Pi prompt + upgrade plan

Draft for Shaw · 2026-11-25 · APPLIED 2026-11-25. Pi 1.6.1 is live with the new prompt, Refuseless vision, the look / check-in guard / question extensions and or-gen. Local models are scrapped (ComfyUI and llama-swap stopped and disabled). Backup: ~/.pi/agent-backup-2026-11-25. Not yet live-tested: or-gen real generation (paid, waiting on Shaw).

Verdict. Pi's prompt is not empty. Your custom 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 ~3 KB APPEND_SYSTEM.md. It sets a check-in-first work loop, OpenRouter-only generation, and a look tool for images. Vision for Refuseless is solvable today: two Refuseless models passed a live image test. 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 sectionToday (0.87.0 + SYSTEM.md)Proposed (1.6.1 + APPEND_SYSTEM.md)
PreambleYour SYSTEM.md, 16.2 KB (~4.0k tokens)Pi default, 1 line
Tool list + tool rulesMissing. Pi skips them when SYSTEM.md is set.Pi default, per-tool guidance
Pi docs mapMissingPi default (used only for harness questions)
Your rules~1.4 KB useful lines inside SYSTEM.mdAPPEND_SYSTEM.md, 3.0 KB (~0.75k tokens)
Content-policy spec14.8 KB (~3.7k tokens) on every requestRemoved
AGENTS.md (environment)16.5 KBUnchanged 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

BEFORE ~/.pi/agent/SYSTEM.md · 16,161 bytes

Part 1: useful lines (1,373 bytes). The rules carry over; the local-generation block is removed.

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
AFTER ~/.pi/agent/APPEND_SYSTEM.md (new) · 3,036 bytes
SYSTEM.md is moved to SYSTEM.md.bak-2026-11-25. Pi's default prompt comes back.
# Operating rules — Shaw's workstation

## Check in before you build
Shaw wants a game plan before execution, not a rabbit hole.
For any task that is not a small, obvious change:
1. Scout first. Read files, search, run read-only commands. Use at most about 10 tool calls.
2. Stop and report, in this shape:
   - **Found:** the facts, with paths or links.
   - **I think:** your read of the problem.
   - **Options:** 2 or 3 routes, each with its cost and risk.
   - **Recommend:** one option and why.
   - **Question:** which route?
3. Wait for Shaw's answer. Do not start building in the same turn.

Skip the check-in only when Shaw says "just do it" or "go", when the task is one obvious change, or when the plan is already approved.
While you execute an approved plan, stop and check in again if:
- you find something the plan did not expect, or
- two attempts at the same step failed.
Do not open a new line of investigation without asking.

## Work loop
1. Read before you act: the file, the error, the docs page. Never guess a path, flag or API.
2. Make one change at a time. Make the smallest change that does the job.
3. Verify every change: run the code, the test or the command, then read the output.
4. Stop when the task is done. Do not add scope. Do not "also improve" nearby code.

## 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.

## Images you need to see
- If the current model can see images, read the image file directly.
- If it cannot, call the `look` tool with the image path and a question. It returns a text description. Never guess what an image shows.

## Image and video generation
- Use OpenRouter only, with the key `$(pass apis/openrouter)`. Use a different model or service only when Shaw names it.
- Images: `or-gen image "<prompt>" [--ref <image>] [--aspect 9:16]` prints the PNG path. Default model: `google/gemini-nano-banana-2.1`.
- Video: `or-gen video "<prompt>" [--ref <image>] [--seconds 8]` prints the MP4 path. Default model: `google/gemini-omni-1.2-flash`.
- Every generation costs money. Say the model and the count before a batch of more than 3.

## 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.

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

RuleReason
Check in before you buildYour ask: Claude-style scouting, then found / think / options / recommendation, then wait. A tool-call guard (Change E) backs it up.
Read before acting · never guess pathsFlash's typical failure is a confident wrong path or flag. Kept from your current prompt.
Plan when more than 3 stepsA 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 scopeComposio: DeepSeek "made more tool calls per task, but that didn't result in more passes."
Batch reads · small output · no repeat of failed callsCuts 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 promptA stable prefix keeps DeepSeek's cache hit near 100%. Evidence: 99.93% hit, $2.65 per ~1B tokens on Pi (@EvanDeKim).

3 · Change D — vision for Refuseless models

Live test, 2026-11-25. I sent the same test image (blue text "BLUE 42") to three Refuseless models through their API. kimi-k3.1-pro-abliterated answered "The text is 'BLUE 42' and it is blue." gemma-4-26b-storyteller answered "The text 'BLUE 42' is written in blue." glm-5.3-abliterated answered "I can't view images." So two Refuseless models already have vision. Your models.json doesn't list them.

Why it fails today: all 3 Refuseless entries in models.json say "input": ["text"]. For those models Pi swaps every image for a placeholder (1.6.1 changelog). The model never gets the pixels.

BEFORE models.json → refuseless
glm-5.3-abliterated              input: [text]
glm-5.3-flash-abliterated        input: [text]
deepseek-v4.1-flash-abliterated  input: [text]
AFTER models.json → refuseless
glm-5.3-abliterated              input: [text]
glm-5.3-flash-abliterated        input: [text]
deepseek-v4.1-flash-abliterated  input: [text]
kimi-k3.1-pro-abliterated        input: [text, image]   ← new, vision tested
gemma-4-26b-storyteller          input: [text, image]   ← new, vision tested

Three layers, from simple to complete

LayerWhat it doesStatus
1. Add the 2 vision modelsPick Kimi K3.1 Pro abliterated when the task has images. Native vision, no relay.API live-verified. The Pi entry is not tested yet.
2. look tool (extension)Gives text-only models (GLM, DeepSeek abliterated) eyes. look({path, question}) sends the image to kimi-k3.1-pro-abliterated on Refuseless and returns text. It uses the same provider, so the describer has the same no-refusal behaviour as the main model.To build, about 60 lines. Fallback describer: an OpenRouter vision model.
3. Auto-describe pasted imagesIf you paste an image while a text-only model is active, the extension saves it, runs look, and replaces the image with "[image at <path>: <description>]". It uses Pi's input-transform event (example input-transform.ts).To build. I still need to confirm the event exposes pasted images.

Refuseless also lists 4 models your config doesn't have: deepseek-v4.1-flash-fast, deepseek-v4.1-flash-abliterated-fast, minimax-m3.1-flash and kimi-k3.1-pro. I didn't test them for vision.

4 · Change E — stop the rabbit holes

Two parts. The prompt sets the habit. An extension enforces it, because prose rules decay under momentum.

PartWhat
PromptThe new "Check in before you build" section at the top of APPEND_SYSTEM.md. It sets the order scout → Found / I think / Options / Recommend / Question → wait. It also sets re-check triggers: something unexpected, or 2 failed attempts.
question toolPi ships a question.ts example: one question, options with descriptions, and a free-text "Other". It works like Claude's option picker. Install it so DeepSeek can ask you with real choices. Over Telegram it falls back to plain text options.
Plan modePi ships a plan-mode example: /plan disables edit/write and allows only read-only bash until you approve the plan. Use it for big tasks.
Check-in guard (new, small)An extension that counts tool calls in one run. At 15 calls with no message to you, it injects a steer: "Stop. Report what you found and your options before you continue." This is the mechanical backstop.

5 · Change F — remove all local models

You're scrapping the 3090, ComfyUI, local LLMs and the kids pipeline references. All generation goes to OpenRouter with pass apis/openrouter, unless you name another model.

ItemBeforeAfter
Prompt local-generation blockcomfy-queue, h3-video, sakura, kids rule, ai-modeRemoved. Replaced by "Image and video generation" (OpenRouter only).
models.json provider localqwen38-27b, qwen38-27b-big at :8081Removed
settings.json enabledModelslocal/qwen38-27b, refuseless/*, cliproxy/*refuseless/*, cliproxy/*
extensions/local-llm.tsStarts llama-swap on model selectRemoved (backup kept)
Skill links in ~/.pi/agent/skillscomfy-queue, h3-video, gemini-imagegen (Flow), nano-banana-prompterRemove comfy-queue and h3-video. gemini-imagegen and nano-banana-prompter: your call (see decisions).
New CLI or-gen—or-gen image|video on OpenRouter. Defaults: Nano Banana 2.1 for images, Omni 1.2 Flash for video. Both are on OpenRouter's model list today. I still need to verify the video API shape.

Scope: this changes Pi only. The machine services (llama-swap, ComfyUI) and the Claude-side skills stay as they are unless you say otherwise. Note: the Claude-side image skill has a rule from 2026-11-01 that paid OpenRouter image models are off unless --allow-paid. This plan makes paid OpenRouter the Pi default. Please confirm that is what you want.

6 · Change B — upgrade Pi 0.87.0 → 1.6.1

BEFORE
  • @earendil-works/pi-coding-agent 0.87.0 (2026-09-21)
  • MCP through the pi-mcp-adapter extension
  • Regular TUI with normal scrollback
AFTER
  • 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

RiskEffect on your setupPlan
MCP clashPer 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 placeTest each one in the side-by-side install
Theme schema validation at startup (1.2.0)themes/shaw.json could fail to loadTest 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 featuresTest the subagent and local-llm extensions
Upgrade while Pi is runningThe 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.

7 · 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.

8 · Test plan (no effect on your running Pi)

  1. Install 1.6.1 into a separate prefix: npm i --prefix ~/opt/pi-1.6.1 @earendil-works/pi-coding-agent@1.6.1.
  2. Copy ~/.pi/agent to ~/.pi/agent-test. Run the new binary with PI_CODING_AGENT_DIR=~/.pi/agent-test, so it never reads or writes your live config.
  3. Check startup, the theme, /mcp, the Telegram extension, the footer and subagent.
  4. 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).
  5. Record pass rate, turns, tokens and wall time. Put the results on this page.
  6. You pick. I swap the live files only on your yes, after you close Pi, with backups.

9 · What X said (118 reads)

SourcePoint
@composioDeepSeek 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_ericPi'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).
@EvanDeKim99.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_avbds4-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.

10 · Decisions for you

  1. Approve the prompt draft as written, or mark edits.
  2. Removing the content-policy spec: OK?
  3. Vision: add Kimi K3.1 Pro abliterated + Gemma 4 storyteller, and build the look tool (layers 1 and 2)? Auto-describe on paste (layer 3) as well?
  4. Rabbit holes: install the question tool and the 15-call check-in guard? Is 15 the right number?
  5. Local removal: also drop the gemini-imagegen (Flow, free) and nano-banana-prompter skills from Pi? Also stop llama-swap and ComfyUI on the machine, or leave them?
  6. Confirm paid OpenRouter generation as the Pi default (Nano Banana 2.1 / Omni 1.2 Flash).
  7. Run the side-by-side test now (it touches nothing live)?
  8. Fullscreen TUI or regular after the upgrade?
  9. Where did you see the prompt as empty?