Pi prompt + upgrade plan
Draft for Shaw · 2026-11-25 · Nothing has been changed. Every "after" below is a proposal. Live files are untouched.
SYSTEM.md replaces Pi's own prompt. As a result, Pi drops its tool list, tool rules and docs map. 92% of the file (14.8 KB of 16.2 KB) is a content-policy spec that does not help DeepSeek code or browse. The proposal: delete SYSTEM.md, keep Pi's default, and add a 2.5 KB APPEND_SYSTEM.md with a tight work loop. Upgrade Pi from 0.87.0 to 1.6.1 only after a side-by-side test.1 · What DeepSeek receives today vs. after
| Prompt section | Today (0.87.0 + SYSTEM.md) | Proposed (1.6.1 + APPEND_SYSTEM.md) |
|---|---|---|
| Preamble | Your SYSTEM.md, 16.2 KB (~4.0k tokens) | Pi default, 1 line |
| Tool list + tool rules | Missing. Pi skips them when SYSTEM.md is set. | Pi default, per-tool guidance |
| Pi docs map | Missing | Pi default (used only for harness questions) |
| Your rules | ~1.4 KB useful lines inside SYSTEM.md | APPEND_SYSTEM.md, 2.5 KB (~0.6k tokens) |
| Content-policy spec | 14.8 KB (~3.7k tokens) on every request | Removed |
| AGENTS.md (environment) | 16.5 KB | Unchanged in this pass. A trim comes later as its own proposal. |
Token figures are estimates at ~4 characters per token. DeepSeek caches a stable prefix, so the cost hit is small. The bigger loss is attention: Flash reads ~3.7k tokens of policy text before every task.
2 · Change A — the system prompt
~/.pi/agent/SYSTEM.md · 16,161 bytes
Part 1: useful (1,373 bytes, kept)
You are a coding agent running in a terminal on Shaw's Linux workstation. You have tools to read, write and edit files and to run bash commands. Use them to do the task; do not describe what you would do. Rules: - Read a file before you edit it. - Make the smallest change that does the job. - Run the code or the test after a change. Report what you ran and the result. - State the verdict first, then the support. Short sentences. No filler. - Ask only when a wrong guess would destroy work. Local generation on this machine (free, runs on the display RTX 3090 through ComfyUI at localhost:8188, one job at a time): - Images: `comfy-queue add "<prompt>" --wait --json` returns the PNG path. Default model `sakura` (Qwen-Image 2.1 Turbo, ~11 s, renders text well). Fallback `--model qwen-turbo`. Use `--aspect 9:16` and similar. Details: the comfy-queue skill. - Video: `h3-video t2v "<idea>" --seconds 5 --wait --json`, or `h3-video i2v <image> "<idea>" --wait --json`. Returns an MP4 with audio. Default `--quality high` (two-pass, ~3.5 min per 5 s); use `fast` (~70 s) only for drafts. A plain idea is rewritten into H3's structured prompt automatically (h3-writer). Details: the h3-video skill. - Never use sakura or NSFW LoRAs on family or kids media. Kids clips go through ~/vibing/kids-photo-animation only. - `ai-mode status` shows what is loaded on each GPU.
Part 2: content-policy spec (14,788 bytes, removed)
Outline only. The full text stays in your local file.
# Assistant Operating Specification ## 1. Role ## 2. Capabilities ## 3. Core values ## 4. Domains of assistance ### 4.1 Software and security engineering ### 4.2 Creative writing ### 4.3 Technical knowledge ### 4.4 Analysis and conversation ## 5. Content and safety policy ## 6. Refusal handling ## 7. Reasoning procedure ## 8. Response quality ## 9. Communication and tone ## 10. Session conduct
~/.pi/agent/APPEND_SYSTEM.md (new) · 2,485 bytesSYSTEM.md is moved to SYSTEM.md.bak-2026-11-25. Pi's default prompt comes back.
# Operating rules — Shaw's workstation ## Work loop 1. Read before you act: the file, the error, the docs page. Never guess a path, flag or API. 2. If the task has more than 3 steps, write a short numbered plan first. Mark steps done as you go. 3. Make one change at a time. Make the smallest change that does the job. 4. Verify every change: run the code, the test or the command, then read the output. 5. Stop when the task is done. Do not add scope. Do not "also improve" nearby code. 6. Ask only when a wrong guess would destroy work or spend money. ## Tool use - Put independent reads and searches in the same turn. - Use `rg` and `fd`, not `grep -r` and `find`. - Keep tool output small: pipe through `head`, `tail` or `rg`. Never `cat` a large file; read the lines you need. - If an edit fails, re-read the file before you try again. Never repeat a failed call unchanged. - If the same command fails twice for the same reason, stop and report the error. ## Hard limits - No destructive git: `reset --hard`, `checkout .`, `clean -f`, `push --force`, `stash`. - Never print a secret. Use it inline: `$(pass apis/<name>)`. - Ask Shaw before anything that sends, posts, pays or deletes outside this machine. ## Report End every task with this block: - **Result:** one line, done or blocked. - **Changed:** absolute file paths. - **Verified:** the command you ran and what it showed. - **Not verified:** anything you assumed. Say "done" only after a check ran. Otherwise say "written, not tested". Verdict first. Short sentences. No filler. ## Local generation (kept verbatim from the old SYSTEM.md) Local generation on this machine (free, runs on the display RTX 3090 through ComfyUI at localhost:8188, one job at a time): - Images: `comfy-queue add "<prompt>" --wait --json` returns the PNG path. Default model `sakura` (Qwen-Image 2.1 Turbo, ~11 s, renders text well). Fallback `--model qwen-turbo`. Use `--aspect 9:16` and similar. Details: the comfy-queue skill. - Video: `h3-video t2v "<idea>" --seconds 5 --wait --json`, or `h3-video i2v <image> "<idea>" --wait --json`. Returns an MP4 with audio. Default `--quality high` (two-pass, ~3.5 min per 5 s); use `fast` (~70 s) only for drafts. A plain idea is rewritten into H3's structured prompt automatically (h3-writer). Details: the h3-video skill. - Never use sakura or NSFW LoRAs on family or kids media. Kids clips go through ~/vibing/kids-photo-animation only. - `ai-mode status` shows what is loaded on each GPU.
How the full prompt assembles after the change (Pi 1.6.1 builder)
You are a coding assistant running inside pi, a coding agent harness. Help users inspect files, run commands, and modify code. <tools> - read: … - bash: … - edit: … - write: … (one line per active tool, written by Pi) Additional tools may be available. </tools> <rules> - Use bash for file operations like ls, rg, find - (per-tool guidelines Pi ships for read / edit / write / bash) - Be concise in your responses - Show file paths clearly when working with files </rules> <docs> Pi documentation (read only when the user asks about the harness itself …) </docs> <addendum> ← APPEND_SYSTEM.md goes here </addendum> <project_context> ← AGENTS.md (unchanged) </project_context> <skills> … </skills> <cwd> … </cwd>
Why each rule is in the draft
| Rule | Reason |
|---|---|
| Read before acting · never guess paths | Flash's typical failure is a confident wrong path or flag. Kept from your current prompt. |
| Plan when more than 3 steps | A small harness with "a TODO planner" was all ds4-flash needed (@neural_avb). Pi has no built-in plan tool, so the prompt does the job. |
| Stop when done · no extra scope | Composio: DeepSeek "made more tool calls per task, but that didn't result in more passes." |
| Batch reads · small output · no repeat of failed calls | Cuts turns and context growth. Turns are where Pi was slowest in the Composio runs (363 s median). |
| Report block + "done only after a check" | Same status rule as your Claude stack. Makes Pi output easy to check. |
| No dates or changing text in the prompt | A stable prefix keeps DeepSeek's cache hit near 100%. Evidence: 99.93% hit, $2.65 per ~1B tokens on Pi (@EvanDeKim). |
3 · Change B — upgrade Pi 0.87.0 → 1.6.1
@earendil-works/pi-coding-agent0.87.0 (2026-09-21)- MCP through the
pi-mcp-adapterextension - Regular TUI with normal scrollback
- 1.6.1 (published 2026-11-25), 18 releases newer
- Pi now has built-in MCP, codemode and
tool_search(since 0.99) - Pi 1.5.0 changelog: "Tightened system prompt"
- TUI is fullscreen by default (since 1.0). Set
"tuiMode":"regular"to keep the current behaviour.
Risks found in the changelog
| Risk | Effect on your setup | Plan |
|---|---|---|
| MCP clash | Per the docs: an extension that registers /mcp (pi-mcp-adapter) replaces built-in MCP. The setup keeps working as today, but you don't get tool_search. | Keep the adapter on day 1. Built-in MCP is Change C. |
Extension API: render() returns read-only arrays (1.6.0) | Could break shaw-footer.ts, pi-telegram or subagent if they change render output in place | Test each one in the side-by-side install |
| Theme schema validation at startup (1.2.0) | themes/shaw.json could fail to load | Test it; fix the theme file if it fails |
| Tool-argument validation moved to pi-schema (1.5.0) | Affects custom tools that use TypeBox-only features | Test the subagent and local-llm extensions |
| Upgrade while Pi is running | The bundle loads chunks lazily. Swapping it mid-session can crash your open session. | Install side by side now. Swap the global package only after you close Pi. |
4 · Change C (later, separate decision) — built-in MCP
Your mcp.json already uses the mcpServers format that built-in MCP reads. It has 8 servers: context7, apify, firecrawl, chrome-devtools, meta-ads, ad-library, memory and google-ads-skill. Built-in tool_search loads tool schemas on demand, so all 8 servers stop sitting in every prompt. The cost: the pi-ds launcher's --mcp-config rosters (pi-ads, pi-web, pi-bare) must move to .pi/mcp.json overrides or --tools 'mcp__x__*' patterns. I'd do this only after A and B are stable.
5 · Test plan (no effect on your running Pi)
- Install 1.6.1 into a separate prefix:
npm i --prefix ~/opt/pi-1.6.1 @earendil-works/pi-coding-agent@1.6.1. - Copy
~/.pi/agentto~/.pi/agent-test. Run the new binary withPI_CODING_AGENT_DIR=~/.pi/agent-test, so it never reads or writes your live config. - Check startup, the theme,
/mcp, the Telegram extension, the footer and subagent. - A/B the prompts in the test dir: (a) old SYSTEM.md, (b) Pi default + APPEND_SYSTEM.md. Use the same DeepSeek Flash model and the same task set (the 34-check verifier from the 2026-09-16 bake-off).
- Record pass rate, turns, tokens and wall time. Put the results on this page.
- You pick. I swap the live files only on your yes, after you close Pi, with backups.
6 · What X said (118 reads)
| Source | Point |
|---|---|
| @composio | DeepSeek V4 Flash across harnesses: Pi passed the most tasks and was the cheapest. On V4 Pro, Pi passed 21 of 30, the best of 5 harnesses (thread). Pi was also the slowest (363 s median). |
| @mihail_eric | Pi's bet is minimalism: 4 tools, system prompt + tool definitions under 1,000 tokens. |
| @Howaboua | "A lot of system prompt is taste." Keep the base around 2k tokens. Put taste in global AGENTS.md. "You're only correcting for what the RL missed." Cut one extension's guidance from 1,556 to 108 tokens and it still worked (post). |
| @EvanDeKim | 99.93% cache hit on DeepSeek V4 Flash in Pi: $2.65 for ~1B tokens vs $132 uncached. A stable prefix is worth more than a short one. |
| @neural_avb | ds4-flash needed only a ~200-word system prompt, simple tools, a TODO planner and a skill library. |
| @badlogicgames (Pi author) | Mid-conversation system messages are "thoughts and prayers". They do not replace the original prompt. Put the rules in the real system prompt. |
| @trq212 (Claude Code) | Model families aren't interchangeable. Claude Code keeps a separate system prompt per model. This argues for a DeepSeek-specific addendum, not a generic one. |
X posts are anecdotes. The Pi 1.6.1 source and docs are the primary evidence for how prompts assemble. I read dist/core/system-prompt.js and docs/configuration.md directly.
7 · Decisions for you
- Approve the prompt draft as written, or mark edits.
- Removing the content-policy spec: OK?
- Run the side-by-side test now (it touches nothing live)?
- Fullscreen TUI or regular after the upgrade?
- Where did you see the prompt as empty? Which command or screen? The answer tells me whether some launcher skips SYSTEM.md.