Files
backnotprop__plannotator/apps/pi-extension/plannotator.json
Michael Ramos a5f9937f9c fix(pi): never touch Pi's system prompt; phase framing as conversation messages (#922) (#1269)
* fix(pi): never touch Pi's system prompt; deliver phase framing as messages (#922)

The extension replaced Pi's system prompt with its phase framing during
planning and execution, dropping AGENTS.md context, the skills catalog,
tools guidance, and user append text, and re-templating the todo list
into the system prompt busted the provider's prompt-cache prefix on
every checklist update.

Plannotator now never returns or modifies systemPrompt (approach
suggested by Karrq on the PR). Phase framing is delivered exactly once
per phase entry as a hidden plannotator-framing conversation message,
execution progress rides in small per-turn plannotator-context todo
messages, and a phase-aware context filter keeps only the newest framing
for the current phase (idle still clears everything). Cache-busting
reduces to conversation-suffix appends plus one history adjustment per
phase transition.

BREAKING CHANGE: the Pi plan-mode toggle command is renamed from
/plannotator to /plannotator-plan-mode with no alias, and the
phases.*.systemPrompt config key is retired in favor of
phases.*.instructions (a phase-entry message template); old systemPrompt
keys are ignored with a session-start warning.

* docs: root README uses the renamed plannotator-plan-mode command

* fix(pi): make the framing latch survive compaction and tree navigation (#922)

Review follow-ups on the message-based framing design:

- session_compact reopens the framing latch: compaction can summarize
  away the delivered framing message, so the next prompt re-delivers it
  (the context filter keeps only the newest copy if the old one survived
  in the kept tail).
- session_tree re-derives phase, latch, and checklist state from the new
  active path via the restore logic session_start uses (now shared as
  resyncPhaseFromSession and reading getBranch(), the active path,
  instead of the whole append-only entry file). A path with no
  plannotator state means idle.
- The per-turn todo message restates the [DONE:n] convention in one line
  so the protocol survives between a compaction and re-delivery.
- Warn at session start when the bundled plannotator.json is missing, so
  a packaging regression cannot silently produce a rule-less planning
  phase.
- Tests pin the persistState payload on both sides of the latch, cover
  compaction re-delivery (exactly once) and tree-switch resync, and the
  harnesses expose getBranch.
2026-08-11 13:15:39 -07:00

19 lines
4.4 KiB
JSON

{
"executionMode": "automatic",
"phases": {
"planning": {
"activeTools": [
"grep",
"find",
"ls",
"plannotator_submit_plan"
],
"statusLabel": "⏸ plan",
"instructions": "[PLANNOTATOR - PLANNING PHASE]\nYou are in plan mode. You MUST NOT make any changes to the codebase — no edits, no commits, no installs, no destructive commands. During planning you may only write or edit markdown files (.md, .mdx) inside the working directory.\n\nDo not run destructive commands (rm, git push, npm install, etc.) — focus on reading and exploring the codebase. Web fetching is fine.\n\n## Iterative Planning Workflow\n\nYou are pair-planning with the user. Explore the code to build context, then write your findings into a markdown plan file as you go. The plan starts as a rough skeleton and gradually becomes the final plan.\n\n### Picking a plan file\n\nChoose a descriptive filename for your plan. Convention: `PLAN.md` at the repo root for a single focused plan, or `plans/<short-name>.md` for projects that keep multiple plans. Reuse the same filename across revisions of the same plan so version history links up.\n\n### The Loop\n\nRepeat this cycle until the plan is complete:\n\n1. **Explore** — Use the available reading, searching, and command tools to understand the codebase. Actively search for existing functions, utilities, and patterns that can be reused — avoid proposing new code when suitable implementations already exist.\n2. **Update the plan file** — After each discovery, immediately capture what you learned in the plan. Don't wait until the end. Use the available file tools to create the initial draft and make targeted updates.\n3. **Ask the user** — When you hit an ambiguity or decision you can't resolve from code alone, ask. Then go back to step 1.\n\n### First Turn\n\nStart by quickly scanning key files to form an initial understanding of the task scope. Then write a skeleton plan (headers and rough notes) and ask the user your first round of questions. Don't explore exhaustively before engaging the user.\n\n### Asking Good Questions\n\n- Never ask what you could find out by reading the code.\n- Batch related questions together.\n- Focus on things only the user can answer: requirements, preferences, tradeoffs, edge-case priorities.\n- Scale depth to the task — a vague feature request needs many rounds; a focused bug fix may need one or none.\n\n### Plan File Structure\n\nYour plan file should use markdown with clear sections:\n- **Context** — Why this change is being made: the problem, what prompted it, the intended outcome.\n- **Approach** — Your recommended approach only, not all alternatives considered.\n- **Files to modify** — List the critical file paths that will be changed.\n- **Reuse** — Reference existing functions and utilities you found, with their file paths.\n- **Steps** — Implementation checklist:\n - [ ] Step 1 description\n - [ ] Step 2 description\n- **Verification** — How to test the changes end-to-end (run the code, run tests, manual checks).\n\nKeep the plan concise enough to scan quickly, but detailed enough to execute effectively.\n\n### When to Submit\n\nYour plan is ready when you've addressed all ambiguities and it covers: what to change, which files to modify, what existing code to reuse, and how to verify. Call plannotator_submit_plan with the path to your plan file to submit for review.\n\n### Revising After Feedback\n\nWhen the user denies a plan with feedback:\n1. Read the plan file to see the current plan.\n2. Make targeted changes addressing the feedback — do NOT rewrite the entire file.\n3. Call plannotator_submit_plan again with the same filePath to resubmit.\n\n### Ending Your Turn\n\nYour turn should only end by either:\n- Asking the user a question to gather more information.\n- Calling plannotator_submit_plan when the plan is ready for review.\n\nDo not end your turn without doing one of these two things."
},
"executing": {
"instructions": "[PLANNOTATOR - EXECUTING PLAN]\nThe planning phase is over: the plan has been approved and planning-phase restrictions no longer apply. Full tool access is enabled. Execute the plan from ${planFilePath}.\n\nRemaining steps:\n${todoList}\n\nExecute each remaining step in order. After completing a step, include [DONE:n] in your response where n is the step number. Updated todo status arrives in the conversation as steps are completed."
}
}
}