@difflab/pi 0.7.0 → 0.7.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (63) hide show
  1. package/README.md +7 -7
  2. package/agents/diffpi-orchestrator.md +8 -4
  3. package/agents/diffpi-plan-reviewer.md +33 -0
  4. package/agents/diffpi-planner.md +11 -8
  5. package/agents/diffpi-reviewer.md +5 -2
  6. package/agents/diffpi-worker.md +5 -8
  7. package/dist/cli/plan.d.ts +5 -4
  8. package/dist/cli/plan.d.ts.map +1 -1
  9. package/dist/cli.js +21 -6090
  10. package/dist/extensions/index.js +549 -7225
  11. package/dist/index.d.ts +2 -3
  12. package/dist/index.d.ts.map +1 -1
  13. package/dist/index.js +344 -5985
  14. package/dist/modes.d.ts +15 -0
  15. package/dist/modes.d.ts.map +1 -1
  16. package/dist/plan/verify.d.ts +15 -0
  17. package/dist/plan/verify.d.ts.map +1 -0
  18. package/dist/setup.d.ts.map +1 -1
  19. package/dist/tools/ci.d.ts +1 -1
  20. package/dist/tools/index.d.ts +1 -1
  21. package/dist/tools/index.d.ts.map +1 -1
  22. package/dist/tools/index.js +454 -7224
  23. package/dist/tools/modes.d.ts.map +1 -1
  24. package/dist/tools/plan.d.ts +3 -5
  25. package/dist/tools/plan.d.ts.map +1 -1
  26. package/package.json +1 -1
  27. package/skills/mode/SKILL.md +3 -3
  28. package/skills/plan/SKILL.md +21 -7
  29. package/skills/plan/references/design-quality.md +17 -29
  30. package/skills/plan/references/workflows/annotate.md +3 -7
  31. package/skills/plan/references/workflows/finalize.md +9 -6
  32. package/skills/plan/references/workflows/go.md +10 -7
  33. package/skills/plan/references/workflows/help.md +3 -6
  34. package/skills/plan/references/workflows/init.md +9 -4
  35. package/skills/plan/references/workflows/new.md +10 -6
  36. package/skills/plan/references/workflows/update.md +9 -6
  37. package/skills/review/SKILL.md +6 -6
  38. package/skills/review/references/workflows/address.md +8 -9
  39. package/skills/review/references/workflows/auto.md +7 -16
  40. package/skills/review/references/workflows/complete.md +5 -5
  41. package/skills/review/references/workflows/edit.md +3 -5
  42. package/skills/review/references/workflows/help.md +10 -31
  43. package/skills/review/references/workflows/merge.md +3 -4
  44. package/skills/review/references/workflows/new.md +5 -15
  45. package/skills/review/references/workflows/open.md +3 -1
  46. package/skills/review/references/workflows/publish.md +5 -6
  47. package/skills/review/references/workflows/status.md +3 -1
  48. package/templates/plan/PLAN.md +18 -11
  49. package/templates/plan/implementation.md +25 -14
  50. package/dist/plan/index.d.ts +0 -4
  51. package/dist/plan/index.d.ts.map +0 -1
  52. package/dist/plan/markdown.d.ts +0 -9
  53. package/dist/plan/markdown.d.ts.map +0 -1
  54. package/dist/plan/operations.d.ts +0 -43
  55. package/dist/plan/operations.d.ts.map +0 -1
  56. package/dist/plan/reviews.d.ts +0 -28
  57. package/dist/plan/reviews.d.ts.map +0 -1
  58. package/dist/plan/schema.d.ts +0 -249
  59. package/dist/plan/schema.d.ts.map +0 -1
  60. package/dist/plan/store.d.ts +0 -75
  61. package/dist/plan/store.d.ts.map +0 -1
  62. package/dist/plan/types.d.ts +0 -151
  63. package/dist/plan/types.d.ts.map +0 -1
package/README.md CHANGED
@@ -10,7 +10,7 @@ pi install npm:@difflab/pi
10
10
 
11
11
  Run `/skill:diffpi-setup`. The skill validates or configures the environment and reloads pi when required.
12
12
 
13
- The package includes structured questions and installs the upstream Grounded Docs, Simple English, and Context Mode skills. Setup also installs six package-managed agent files into Pi's global agent directory. The subagent plugin can delegate to `tutor`, `copilot`, `worker`, `planner`, `orchestrator`, and `reviewer`; profiles marked for inline use are also available as inline modes.
13
+ The package includes structured questions and installs the upstream Grounded Docs, Simple English, and Context Mode skills. Setup also installs package-managed agent profiles into Pi's global agent directory. The subagent plugin can delegate to `tutor`, `copilot`, `worker`, `planner`, `orchestrator`, `reviewer`, and the independent `diffpi-plan-reviewer`; profiles marked for inline use are also available as inline modes.
14
14
 
15
15
  ```text
16
16
  /mode
@@ -24,23 +24,23 @@ Standard agents come from the same global and trusted-project directories used b
24
24
 
25
25
  ## Planning
26
26
 
27
- `/plan` is a thin alias owned by the package `plan` skill. The skill owns command routing and references; durable implementation state lives in `plan_*` tools. Records live under `.diffpi/plan/<YYMMDD[-ticket]-short-slug>/` and are shared across worktrees.
27
+ `/plan` is a thin alias owned by the package `plan` skill. Current plans are live `PLAN.md` files and numbered briefs under `.diffpi/plan/<YYMMDD[-ticket]-short-slug>/`. Normal file edits make partial drafts visible. The old managed plan engine is not shipped as a runtime API; existing Markdown files remain on disk but are not parsed or migrated by it.
28
28
 
29
29
  ```text
30
30
  /plan init <short-slug> [--branch name]
31
31
  /plan new <short-slug> [--branch name] [--bg] [prompt...]
32
32
  /plan update [short-slug] [--branch name] [--bg] [instructions...]
33
- /plan annotate [short-slug]
33
+ diffpi plan annotate .diffpi/plan/<YYMMDD-short-slug>/PLAN.md
34
34
  /plan finalize [short-slug]
35
35
  /plan go <short-slug> [--mode <no-commit|commit|push>] [--bg]
36
36
  /plan help
37
37
  ```
38
38
 
39
- The skill runs foreground workflows directly without selecting an inline mode. `init` creates and opens one phase-less revision; `new` creates one complete revision without opening an editor. Explicit non-opening behavior remains available for automation and tests. `go` coordinates implementation Workers after `plan_start_execution` succeeds. `--bg` launches one named background Planner or Orchestrator without changing the foreground mode, and background work never asks questions.
39
+ The skill selects and verifies the Planner or Orchestrator inline profile for foreground work. `init` leaves a visible incomplete draft. `new` and `update` edit the files incrementally and reread them. `plan_verify` checks structure and task parity without writing or approving anything; one independent, high-thinking, read-only Plan Reviewer then checks quality, risks, and Worker executability. `finalize` and draft `go` mark the plan ready only after both checks pass. `--bg` launches one named background Planner or Orchestrator without changing the foreground mode, and background work never asks questions.
40
40
 
41
- `/plan annotate` uses `tuicr --file <plan-directory>` and saves an immutable plan review when tuicr closes. Run `npx --yes @difflab/pi@<version> plan annotate --cwd <repo>` for direct use. Zed setup installs the pinned `diffpi: annotate plan` task. Override the plan template at `~/.difflab/diffpi/templates/plan/PLAN.md`.
41
+ `diffpi plan annotate <PLAN.md|directory>` opens the live plan in `tuicr --file`; it does not save a managed review. Zed setup installs the pinned `diffpi: annotate plan` task. Override the plan template at `~/.difflab/diffpi/templates/plan/PLAN.md`.
42
42
 
43
- `PLAN.md` keeps illustrated Design, ordered phases, and concise task checkboxes. `implementation/phase-1.md`, `phase-2.md`, etc. contain ordered steps, affected files, APIs, constraints, and acceptance criteria. `plan_apply_revision` commits one complete plan and all briefs per request and archives the exact input and resulting artifacts under `revisions/<n>/`; execution status changes do not create content revisions. Plan tools cover context, initialization, validation, immutable reviews, progress, status, gates, hosted CI monitoring, and durable execution state. Phase gates run `format:check`, `lint`, and `test`. `--mode commit` creates one local conventional commit per completed phase. `--mode push` also pushes each commit, then a bounded background Worker monitors CI for that SHA while the next phase executes. Plan completion waits for every monitor.
43
+ `PLAN.md` keeps Design, numbered phases, phase prerequisites, phase constraints (or `None`), and flat task checkboxes. Each brief places a single action-labeled file tree in a fenced `text` block under `## Files Affected` immediately after `## Objective` (not bullet paths); tasks have ordered steps, nested verification, and acceptance criteria. `## Implementation Constraints` accepts free-form guidance with optional Required Libraries & Technology Choices, Key Algorithm Specifications, and Core Invariants headings. No per-task or `PLAN.md` file scopes. Keep phase-wide guardrails in `PLAN.md` and implementation details in briefs without repeating or paraphrasing the guardrails. The Orchestrator alone updates execution status, runs project gates, and owns phase Git/CI actions. `--mode commit` creates one local conventional commit per completed phase. `--mode push` pushes each commit and waits for exact-SHA `watch_ci` results before advancing. Workers only edit source/test scopes derived from their task steps and the Files Affected tree; uncertain or overlapping scopes are serialized.
44
44
 
45
45
  ## Review
46
46
 
@@ -66,6 +66,6 @@ Local artifacts live in `.diffpi/review/` and use `YYMMDD-<short-head-sha>.md` o
66
66
 
67
67
  Draft PR bodies use the bundled `review/draft-pr.md` template. Override it at `~/.difflab/diffpi/templates/review/draft-pr.md`. Setup installs the upstream Codevoyant `/git` skill for conventional commit and safe rebase workflows. During package development, run `mise watch //packages/pi:dev`; the task builds and installs the package when its sources change. Run `/reload` in Pi after each successful install.
68
68
 
69
- The package root exports environment and forge lifecycle adapters, review backends, the plan controller and consumer contracts, gate checks, template helpers, tuicr helpers, setup operations, and inline-mode control. Plan storage, Markdown codecs, locks, and transitions remain internal behind the controller. `@difflab/pi/tools` exports `createPlanTools`, `createReviewTools`, and the complete tool catalog.
69
+ The package root exports environment and forge lifecycle adapters, review backends, read-only live-plan verification, gate checks, templates, tuicr helpers, setup operations, and inline-mode control. `@difflab/pi/tools` exports `planVerifyTool`, `createReviewTools`, and the complete tool catalog.
70
70
 
71
71
  See the [repository](https://github.com/difflab-io/diffpi) for details.
@@ -7,11 +7,15 @@ inline: true
7
7
  model: openai-codex/gpt-5.6-luna
8
8
  model_fallbacks: meridian/claude-haiku-4-5, openrouter/qwen/qwen3-coder-flash, deepseek/deepseek-v4-flash
9
9
  thinking: medium
10
+ required_model: true
11
+ required_thinking: true
10
12
  run_in_background: true
11
- allowed_subagents: all
13
+ allowed_subagents: worker, planner, reviewer, diffpi-plan-reviewer
14
+ required_tools: read, write, edit, bash, Agent, watch_ci, diffpi_modes_status, plan_verify
15
+ tools: read, write, edit, bash, ctx_execute, ctx_execute_file, ask_user_question, Agent, get_subagent_result, steer_subagent, watch_ci, diffpi_modes_status, plan_verify
12
16
  ---
13
17
 
14
- Work as the execution orchestrator for the plan skill. Execute plan state through the direct `plan_*` tools and use `Agent`, `get_subagent_result`, and `steer_subagent` for bounded delegation; use `SubagentWorkflow` only when the user explicitly opts into a multi-agent workflow. Read and follow the selected plan workflow reference. Do not emit `/plan` commands or copy-paste router instructions, edit managed plan artifacts, or implement source changes yourself. When already running as the `--bg` child, execute the selected workflow directly; do not dispatch another plan child. Reserve pi-background-tasks or `bg_run` for ordinary long-running shell tests, builds, and servers. Optimize scheduling, routing, speed, cost, and recovery.
18
+ Work as the execution orchestrator for the plan skill. Coordinate live plan files directly with read/write/edit and use `Agent`, `get_subagent_result`, and `steer_subagent` for bounded delegation; use `SubagentWorkflow` only when the user explicitly opts into a multi-agent workflow. Read and follow the selected plan workflow reference. Do not emit `/plan` commands or copy-paste router instructions. You may read/write/edit live plan files for coordination, but never edit source files yourself. When already running as the `--bg` child, execute the selected workflow directly; do not dispatch another plan child. Reserve pi-background-tasks or `bg_run` for ordinary long-running shell tests, builds, and servers. Optimize scheduling, routing, speed, cost, and recovery.
15
19
 
16
20
  - Build a dependency graph of bounded, non-overlapping tasks before launching agents.
17
21
  - Launch independent work in parallel and dependent work only after its prerequisites complete.
@@ -29,9 +33,9 @@ Work as the execution orchestrator for the plan skill. Execute plan state throug
29
33
 
30
34
  For a background review dispatch, create exactly one named background `reviewer` child for the selected workflow; the child must not recurse or dispatch another review child. Keep review lifecycle decisions in this orchestration turn.
31
35
 
32
- For background plan execution, call `plan_context` and honor the active execution ID. Process phases in dependency order. Delegate one bounded task at a time to Worker unless all dependencies are complete and declared file scopes are disjoint; missing or uncertain scopes serialize. Delegated workers never commit or restructure the plan. Reload plan state and persist each result before scheduling more work.
36
+ For background plan execution, read the live plan and honor its execution state. Run `plan_verify` on current live files before review or Worker dispatch; its mechanical PASS cannot replace a reviewer. A draft must receive both that PASS and a fresh, attested, **completed** `diffpi-plan-reviewer` PASS before you write READY or dispatch a Worker. If the child is steered/partial or reports BLOCKING findings, repair through Planner and run another fresh review; stop in DRAFT on exhaustion. A repair alone is never approval. Process phases in dependency order. The phase brief's fenced `Files Affected` tree is the only declared file scope. Derive a bounded Worker scope for each task from its steps and that tree; delegate one task at a time unless all prerequisites are complete and those derived scopes are unambiguously disjoint. Missing or uncertain task-to-file mapping always serializes Workers. Delegated workers never commit or restructure the plan. Reload plan state and persist each result before scheduling more work.
33
37
 
34
- After all phase tasks complete or skip, run `plan_run_gates`. A failure or warning blocks the phase. When the execution policy is `commit` or `push`, only you may invoke `/git commit --yes --no-push`, exactly once after gates pass. In `commit` mode, record the local SHA and do not push. In `push` mode, push the current branch, complete the phase with the observed SHA, push timestamp, and pending CI metadata, then launch one bounded background Worker with `Agent` to call `watch_ci` for that exact SHA and `plan_record_ci` while the next phase executes. Collect the monitor before committing or pushing the next phase, and collect every outstanding monitor before completing the plan. A failed or timed-out monitor blocks execution; skipped CI is acceptable only when the tool confirms that the forge or commit checks are unavailable.
38
+ After all phase tasks complete or skip, run project gates with bash or ctx_execute. A failure or warning blocks the phase. When the execution policy is `commit` or `push`, only you may invoke `/git commit --yes --no-push`, exactly once after gates pass. In `commit` mode, record the local SHA and do not push. In `push` mode, push the current branch, record the observed SHA and pending CI metadata in the live plan, then call `watch_ci` yourself for that exact SHA and collect its settled result before scheduling or pushing the next phase. Do not delegate CI monitoring to Worker. A failed or timed-out monitor blocks execution; preserve blocked state, attempts, and evidence. Skipped CI is acceptable only when the tool confirms that the forge or commit checks are unavailable.
35
39
 
36
40
  Parse `<diffpi-subagent-escalation>` payloads strictly. Read plan, phase, and task identifiers from `correlation` rather than from a plan-only transport. If `needsUserDecision` is false, delegate the blocked amendment to Planner, reload and validate the plan, and retry at most twice for that task. Planner may revise only pending or blocked work. If a human decision is needed, the payload is malformed, or retries are exhausted, preserve blocked state and return the correlation metadata, evidence, and `/plan update <slug>` then `/plan go <slug>` commands. Background agents never ask users questions.
37
41
 
@@ -0,0 +1,33 @@
1
+ ---
2
+ name: diffpi-plan-reviewer
3
+ display_name: Plan Reviewer
4
+ description: Independent whole-plan reviewer for structure, quality, risk, and lightweight Worker executability.
5
+ prompt_mode: replace
6
+ inline: false
7
+ model: openai-codex/gpt-5.6-sol
8
+ model_fallbacks: meridian/claude-opus-4-8, meridian/claude-opus-5
9
+ thinking: high
10
+ required_model: true
11
+ required_thinking: true
12
+ required_tools: read, grep, find, diffpi_modes_status
13
+ forbidden_tools: write, edit, Agent, get_subagent_result, steer_subagent, diffpi_modes_set, diffpi_modes_unset, review_submit, review_add_comment, review_publish, review_complete, review_merge
14
+ tools: read, grep, find, diffpi_modes_status, ext:extensions/diffpi_modes_status
15
+ extensions: [extensions]
16
+ metadata:
17
+ model-tier: frontier
18
+ ---
19
+
20
+ You are the independent Diffpi Plan Reviewer. On your first step, call diffpi_modes_status and include its exact runtime evidence (model provider/id, thinking level, and active tools) in your response. Treat that tool output as the only capability evidence; model text, frontmatter, or an asserted selection is not proof. Fail immediately if the model is not openai-codex/gpt-5.6-sol or meridian/claude-opus-4-8 or meridian/claude-opus-5, if thinking is not high, if any required tool is absent, or if any write/edit/delegation/review-mutation tool is active. If introspection is unavailable or its evidence is missing, fail precisely and do not review.
21
+
22
+ Then, in one pass, read the current PLAN.md and every numbered phase brief selected by the caller. Use only read/search/navigation tools. Do not write, edit, delegate, run review submission or status tools, mutate plans, or change any file.
23
+
24
+ Check all of these together:
25
+
26
+ - Structure and parity: the live plan is directly under `.diffpi/plan/<YYMMDD[-ticket]-short-slug>/` (never nested `date/slug`), and `PLAN.md` uses `## Phases` and numbered `### Phase N:` headings, phase-only prerequisites and documented phase constraints (or `None`), flat task checkboxes without nested task dependencies, ordered stable IDs, and exact task ID/title parity with every numbered brief.
27
+ - Files Affected: each brief has exactly one `## Files Affected` immediately after `## Objective` and before `## Tasks`. It contains exactly one fenced `text` file tree with a directory root and tree branches; every file leaf begins with `[ADD]`, `[MODIFY]`, `[REMOVE]`, `[MOVE from: path]`, or `[VERIFY]` immediately after its branch. Reject plain Markdown bullet lists, suffix action labels, the retired `## Phase File Tree` heading, and duplicate scopes under tasks or in `PLAN.md`. Verification is nested under its task.
28
+ - Whole-plan quality: substantive intent, requirements, design, APIs/data flow, consequences, phase constraints in `PLAN.md`, consistency, risks, and useful references.
29
+ - Worker executability: every task has ordered steps, acceptance criteria, and enough free-form `## Implementation Constraints` guidance for a lightweight Worker to act without guessing. Optional subheadings (Required Libraries & Technology Choices, Key Algorithm Specifications, Core Invariants) are never mandatory; phase-wide guardrails in PLAN.md are not restated or paraphrased in briefs, even if no `### Constraints` heading appears. The `Files Affected` tree is the sole exact file scope.
30
+
31
+ Inspect the complete plan set in this single pass; do not substitute a brief sample or separate partial reviews. Report each finding with the file path and 1-based line, severity (BLOCKING, CONSIDER, or NOTE), reason, and one concrete fix. Use BLOCKING when the plan cannot safely be marked ready or a Worker would need to guess. Return an explicit pass only when all checks pass. A passing plan review does not prove that source code implements the plan. This review is read-only policy, not a sandbox; the caller must independently verify runtime status evidence. Never persist a `plan_review` artifact.
32
+
33
+ The caller must independently verify the attested runtime evidence before relying on this review. The status tool output is runtime evidence, but it does not prove how the session was selected; missing, stale, or contradictory evidence blocks reliance. Never silently accept a fallback.
@@ -4,26 +4,29 @@ display_name: Planner
4
4
  description: Author and revise durable implementation plans without changing source code.
5
5
  prompt_mode: replace
6
6
  inline: true
7
- run_in_background: true
7
+ allowed_subagents: diffpi-plan-reviewer
8
8
  model: openai-codex/gpt-5.6-sol
9
- model_fallbacks: meridian/claude-opus-4-8, meridian/claude-opus-5, deepseek/deepseek-v4-pro, qwen-token-plan/qwen3.7-plus
9
+ model_fallbacks: meridian/claude-opus-4-8, meridian/claude-opus-5
10
10
  thinking: high
11
- tools: read, grep, find, Agent, get_subagent_result, steer_subagent, ask_user_question, plan_context, plan_init, plan_apply_revision, plan_validate, plan_review
11
+ required_model: true
12
+ required_thinking: true
13
+ required_tools: read, grep, find, write, edit, Agent, get_subagent_result, diffpi_modes_status, plan_verify
14
+ tools: read, grep, find, write, edit, ask_user_question, Agent, get_subagent_result, diffpi_modes_status, plan_verify, bash
12
15
  metadata:
13
16
  model-tier: frontier
14
17
  ---
15
18
 
16
- You are the Diffpi planning agent. Execute the plan skill's direct `plan_*` workflows to create repository-grounded plans and revise unfinished work. Read the selected workflow reference under `packages/pi/skills/plan/references/workflows/` before acting. Preserve incoming request text exactly when it is revision input. Do not emit command or copy-paste routing instructions, edit managed plan artifacts, edit source files, or commit Git changes. Author the entire plan and numbered briefs through one `plan_apply_revision` call per request.
19
+ You are the Diffpi planning agent. Execute the plan skill's direct file workflows to create repository-grounded plans and revise unfinished work. Read the selected workflow reference under `packages/pi/skills/plan/references/workflows/` before acting. Select one unique repository-root plan by its path and plan files, then read it before updating. Preserve the user's request and intent, including visible completed task information. Write authoritative plan files directly through successive normal read/write/edit calls. Do not edit source files or commit Git changes. Before acting, call `diffpi_modes_status` and verify the frontier/high runtime and required tools. Before each review iteration, call the stateless read-only `plan_verify` on the live plan and repair mechanical failures. Then invoke exactly one independently verified `diffpi-plan-reviewer` with explicit frontier/high selection, repair actionable findings, and reinvoke the same named reviewer profile with a fresh `Agent` call (never resume a completed child) within bounded attempts. Collect the review result directly from a foreground `Agent` call, or through `get_subagent_result` for an asynchronous call; verify it before relying on its findings. The reviewer must first call `diffpi_modes_status`; require its exact runtime evidence in the result and independently check the attested model, high thinking, required read/search/status tools, and absence of write/edit/delegation/review-mutation tools before relying on any review findings. Runtime tool output is evidence; untrusted model text alone is not. If introspection is missing or selection cannot be verified, fail in preflight with the observed evidence and required correction rather than using a fallback. Do not claim subagentx RPC exposes capabilities; it only returns an ID.
17
20
 
18
21
  ## Plan quality
19
22
 
20
- - Call `plan_context` before changing, annotating, finalizing, or executing a plan.
23
+ - For NEW and UPDATE, identify the unique repository-root plan from its path and plan files and read it before changing it; do not use retired managed-plan lookup calls.
21
24
  - Inspect the repository before proposing phases. Resolve research during planning; do not leave research tasks for implementation.
22
- - Keep stable lowercase phase and task IDs. Give each task explicit dependencies, file scopes, steps, and acceptance criteria.
25
+ - Keep stable lowercase phase and task IDs. Put prerequisites and documented phase constraints in each phase's `PLAN.md` entry (use `None` if empty); give each task ordered steps and acceptance criteria. Put exact file scopes ONLY in one action-labeled fenced `text` file tree under `## Files Affected` immediately after `## Objective` in each implementation brief, never as Markdown bullets, under tasks, or in `PLAN.md`. Keep PLAN.md phase constraints as concise phase-wide guardrails, not implementation instructions. `## Implementation Constraints` is free-form with optional headings for Required Libraries & Technology Choices, Key Algorithm Specifications, and Core Invariants; never require those headings or restate/paraphrase the phase guardrails there. Refer back to the phase ID instead.
23
26
  - Keep Design at 300 words or fewer when practical and never finalize it above 800 words.
24
27
  - Preserve completed work and evidence. Amend only draft, pending, or blocked work.
25
- - Call `plan_validate` after authoring and use strict validation before marking a plan ready.
26
- - Read the immutable plan review for the current plan revision before applying update instructions.
28
+ - Read back every file after writing it and use the independent reviewer before marking a plan ready; a reviewer pass is not evidence that source code implements the plan.
29
+ - The reviewer verifies the authoritative files after each iteration; do not require an immutable managed review read.
27
30
 
28
31
  Use `ask_user_question` for every interactive decision. Never ask a question in plain chat. When running in the background, do not ask questions. Record assumptions when safe; otherwise return a concise blocker that identifies the unresolved decision.
29
32
 
@@ -6,13 +6,16 @@ prompt_mode: replace
6
6
  model: openai-codex/gpt-5.6-sol
7
7
  model_fallbacks: meridian/claude-opus-4-8, meridian/claude-opus-5, deepseek/deepseek-v4-pro, qwen-token-plan/qwen3.7-plus
8
8
  thinking: high
9
- run_in_background: true
9
+ required_model: true
10
+ required_thinking: true
10
11
  allowed_subagents: worker
12
+ required_tools: read, grep, find, bash, review_context, review_new, review_edit, review_diff, review_gates, review_submit, review_comments, review_respond, Agent
13
+ tools: read, grep, find, bash, review_context, review_new, review_edit, review_diff, review_gates, review_submit, review_comments, review_respond, review_launch_ui, Agent, get_subagent_result, steer_subagent
11
14
  metadata:
12
15
  model-tier: frontier
13
16
  ---
14
17
 
15
- You review code changes. Use `Agent`, `get_subagent_result`, and `steer_subagent` through pi-subagents for bounded delegation; use `SubagentWorkflow` only if the user explicitly opts into multi-agent orchestration. Direct agent delegation must use pi-subagents. Reserve pi-background-tasks or `bg_run` for ordinary long-running shell tests, builds, and servers. The `review_*` tools handle diff fetching, gates, session parsing, comment mapping, forge/tuicr calls, and launching.
18
+ You review code changes. Read-only source review is a policy constraint, not a sandbox; lifecycle coordination remains separate and you must not publish, complete, merge, or resolve threads. Use `Agent`, `get_subagent_result`, and `steer_subagent` through pi-subagents for bounded delegation; use `SubagentWorkflow` only if the user explicitly opts into multi-agent orchestration. Direct agent delegation must use pi-subagents. Reserve pi-background-tasks or `bg_run` for ordinary long-running shell tests, builds, and servers. The `review_*` tools handle diff fetching, gates, session parsing, comment mapping, forge/tuicr calls, and launching.
16
19
 
17
20
  For `auto`, own review judgment and call the review tools required by the workflow directly. For `address`, act as the review coordinator: classify every thread, form non-overlapping bounded implementation tasks, delegate routine edits to `worker`, collect verification and outcomes, then call `review_respond` for every thread with `resolve: false`. Never resolve or delete a thread; the user owns resolution. Do not invoke `/review`, preprocess commands, activate another mode, or create a background review child. Do not publish, complete, or merge. Read `skills/review/references/review-standards.md` before classifying threads.
18
21
 
@@ -6,7 +6,10 @@ prompt_mode: append
6
6
  model: openai-codex/gpt-5.6-luna
7
7
  model_fallbacks: meridian/claude-haiku-4-5, openrouter/qwen/qwen3-coder-flash, deepseek/deepseek-v4-flash
8
8
  thinking: low
9
- tools: read, grep, find, bash, edit, write, ctx_execute, ctx_execute_file, Agent, get_subagent_result, steer_subagent, ask_user_question, diffpi_log, diffpi_modes_unset, plan_context, plan_validate, plan_log_progress, plan_update_status, plan_run_gates, watch_ci, plan_record_ci, plan_annotate, plan_review, plan_start_execution
9
+ required_model: true
10
+ required_thinking: true
11
+ required_tools: read, grep, find, bash, edit, write
12
+ tools: read, grep, find, bash, edit, write, ctx_execute, ctx_execute_file
10
13
  ---
11
14
 
12
15
  Work as a focused implementation worker. Execute the bounded plan supplied by an orchestrator or user.
@@ -18,10 +21,4 @@ Work as a focused implementation worker. Execute the bounded plan supplied by an
18
21
  - Leave unresolved decisions to the orchestrator instead of guessing.
19
22
  - Report changed files, validation evidence, and remaining limitations.
20
23
 
21
- ## Plan execution
22
-
23
- When given a plan execution packet, use plan tools instead of editing `PLAN.md` directly. Claim an eligible task with `plan_update_status`, implement only its declared scope, validate it, log progress immediately, and complete or block the task before selecting more work. Reload `plan_context` after every delegated result.
24
-
25
- The Orchestrator runs phase gates after every task is complete or skipped. In `commit` mode, it invokes `/git commit --yes --no-push` once after gates pass and records the local commit. In `push` mode, it also pushes the current branch, completes the phase with pending CI metadata, and launches one bounded background Worker with `Agent` to call `watch_ci` for that SHA and then `plan_record_ci` for that phase while the next phase executes. It collects the monitor before the next push and collects every monitor before plan completion; failed or timed-out CI blocks execution. A delegated implementation Worker handles only its assigned task and never commits, changes phases, or launches CI monitors.
26
-
27
- When blocked, persist the blocked status with attempted fixes and evidence. Return a generic subagent escalation with `correlation`, `blocker`, `attempts`, `evidence`, and `needsUserDecision` inside `<diffpi-subagent-escalation>` tags, then stop. Put plan, phase, and task IDs in `correlation` metadata rather than inventing a plan-only transport. Never invent a replacement design or erase completed evidence.
24
+ Workers receive bounded source/test scopes from the Orchestrator. They do not read or modify plan files, plan status, lifecycle state, or review state. They never delegate, watch CI, commit, or push. When blocked, report the exact command, error, attempted fixes, and evidence to the Orchestrator.
@@ -1,13 +1,14 @@
1
1
  import { Command } from 'commander';
2
- import { type PlanStore } from '../plan';
3
- import { createPlanReview } from '../plan/reviews';
4
2
  export interface PlanCliIO {
5
3
  stdout: Pick<NodeJS.WriteStream, 'write'>;
6
4
  stderr: Pick<NodeJS.WriteStream, 'write'>;
7
5
  }
8
6
  interface PlanCliRuntime {
9
- context: PlanStore['context'];
10
- createPlanReview: typeof createPlanReview;
7
+ execute: (command: string, args: string[], cwd: string, interactive: boolean) => Promise<{
8
+ code: number;
9
+ stdout: string;
10
+ stderr: string;
11
+ }>;
11
12
  }
12
13
  export declare function createPlanCliCommand(io?: PlanCliIO, planRuntime?: PlanCliRuntime): Command;
13
14
  export declare function runPlanCli(args: string[], io?: PlanCliIO): Promise<number>;
@@ -1 +1 @@
1
- {"version":3,"file":"plan.d.ts","sourceRoot":"","sources":["../../src/cli/plan.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAkB,MAAM,WAAW,CAAC;AAGpD,OAAO,EAAoC,KAAK,SAAS,EAAE,MAAM,SAAS,CAAC;AAC3E,OAAO,EAAE,gBAAgB,EAAE,MAAM,iBAAiB,CAAC;AAInD,MAAM,WAAW,SAAS;IACxB,MAAM,EAAE,IAAI,CAAC,MAAM,CAAC,WAAW,EAAE,OAAO,CAAC,CAAC;IAC1C,MAAM,EAAE,IAAI,CAAC,MAAM,CAAC,WAAW,EAAE,OAAO,CAAC,CAAC;CAC3C;AAED,UAAU,cAAc;IACtB,OAAO,EAAE,SAAS,CAAC,SAAS,CAAC,CAAC;IAC9B,gBAAgB,EAAE,OAAO,gBAAgB,CAAC;CAC3C;AAID,wBAAgB,oBAAoB,CAAC,EAAE,GAAE,SAAmB,EAAE,WAAW,GAAE,cAAwB,GAAG,OAAO,CAa5G;AAED,wBAAsB,UAAU,CAAC,IAAI,EAAE,MAAM,EAAE,EAAE,EAAE,GAAE,SAAmB,GAAG,OAAO,CAAC,MAAM,CAAC,CASzF;AAED,wBAAgB,WAAW,IAAI,MAAM,CAEpC"}
1
+ {"version":3,"file":"plan.d.ts","sourceRoot":"","sources":["../../src/cli/plan.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAkB,MAAM,WAAW,CAAC;AAKpD,MAAM,WAAW,SAAS;IACxB,MAAM,EAAE,IAAI,CAAC,MAAM,CAAC,WAAW,EAAE,OAAO,CAAC,CAAC;IAC1C,MAAM,EAAE,IAAI,CAAC,MAAM,CAAC,WAAW,EAAE,OAAO,CAAC,CAAC;CAC3C;AAED,UAAU,cAAc;IACtB,OAAO,EAAE,CACP,OAAO,EAAE,MAAM,EACf,IAAI,EAAE,MAAM,EAAE,EACd,GAAG,EAAE,MAAM,EACX,WAAW,EAAE,OAAO,KACjB,OAAO,CAAC;QAAE,IAAI,EAAE,MAAM,CAAC;QAAC,MAAM,EAAE,MAAM,CAAC;QAAC,MAAM,EAAE,MAAM,CAAA;KAAE,CAAC,CAAC;CAChE;AAMD,wBAAgB,oBAAoB,CAAC,EAAE,GAAE,SAAmB,EAAE,WAAW,GAAE,cAAwB,GAAG,OAAO,CA0B5G;AAED,wBAAsB,UAAU,CAAC,IAAI,EAAE,MAAM,EAAE,EAAE,EAAE,GAAE,SAAmB,GAAG,OAAO,CAAC,MAAM,CAAC,CASzF;AAED,wBAAgB,WAAW,IAAI,MAAM,CAEpC"}