44 lines
2.0 KiB
Bash
Executable File
44 lines
2.0 KiB
Bash
Executable File
#!/bin/sh
|
|
# pi-spark — run the pi coding agent against the local Spark model in tmux.
|
|
#
|
|
# The Spark models live on yveltal (Ollama behind the gpu-broker). Spark only
|
|
# implements thinking levels low and high, so medium breaks its chat template:
|
|
# the launcher defaults to low. Everything else comes from ~/.pi/agent:
|
|
# skills, the wiki + lapis MCP servers and the LaPis memory layer.
|
|
#
|
|
# pi-spark attach, or create the session
|
|
# PI_SPARK_MODEL=ollama/spark:4b pi-spark
|
|
set -eu
|
|
|
|
SESSION=${PI_SPARK_SESSION:-pi-spark}
|
|
MODEL=${PI_SPARK_MODEL:-ollama/spark:ablit}
|
|
THINKING=${PI_SPARK_THINKING:-low}
|
|
DIR=${PI_SPARK_DIR:-$HOME/Projects/pi-spark}
|
|
|
|
if tmux has-session -t "$SESSION" 2>/dev/null; then
|
|
if [ -t 1 ]; then exec tmux attach -t "$SESSION"; fi
|
|
echo "session $SESSION already running: tmux attach -t $SESSION"
|
|
exit 0
|
|
fi
|
|
|
|
# pi-lens (npm:pi-lens) already injects language-server findings after an edit,
|
|
# so the home-grown verify-on-write extension is opt-in only: PI_SPARK_VERIFY=1.
|
|
EXTRA=""
|
|
VERIFY_EXT="$HOME/Projects/pi-verify-on-write/src/index.ts"
|
|
if [ -n "${PI_SPARK_VERIFY:-}" ] && [ -f "$VERIFY_EXT" ]; then
|
|
EXTRA="--extension $VERIFY_EXT"
|
|
fi
|
|
|
|
mkdir -p "$DIR/.pi"
|
|
# Small models need explicit tool-first rules; seed them into a new project.
|
|
if [ ! -f "$DIR/.pi/APPEND_SYSTEM.md" ] && [ -f "$HOME/.dotfiles/config/pi/small-model-APPEND_SYSTEM.md" ]; then
|
|
cp "$HOME/.dotfiles/config/pi/small-model-APPEND_SYSTEM.md" "$DIR/.pi/APPEND_SYSTEM.md"
|
|
echo "seeded $DIR/.pi/APPEND_SYSTEM.md (small-model rules)"
|
|
fi
|
|
# Drop the free-pi session environment so pi uses ~/.pi/agent, not the free-pi agent dir.
|
|
tmux new-session -d -s "$SESSION" -x "${PI_SPARK_COLS:-210}" -y "${PI_SPARK_ROWS:-50}" -c "$DIR" \
|
|
"env -u PI_CODING_AGENT_DIR -u PI_SESSION_FILE -u PI_SESSION_ID -u PI_MODEL -u PI_PROVIDER -u PI_REASONING_LEVEL PI_SKIP_VERSION_CHECK=1 pi --model $MODEL --thinking $THINKING $EXTRA"
|
|
|
|
if [ -t 1 ]; then exec tmux attach -t "$SESSION"; fi
|
|
echo "session $SESSION ready with $MODEL (thinking $THINKING): tmux attach -t $SESSION"
|