@difflab/pi 0.7.0-rc.202609272138.58b8da4 → 0.7.0-rc.202609280043.c43aa2b

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 (38) hide show
  1. package/README.md +7 -7
  2. package/agents/diffpi-orchestrator.md +3 -3
  3. package/agents/diffpi-plan-reviewer.md +2 -2
  4. package/agents/diffpi-planner.md +4 -4
  5. package/dist/extensions/index.js +419 -169
  6. package/dist/index.d.ts +2 -3
  7. package/dist/index.d.ts.map +1 -1
  8. package/dist/index.js +216 -5816
  9. package/dist/plan/verify.d.ts +15 -0
  10. package/dist/plan/verify.d.ts.map +1 -0
  11. package/dist/tools/index.d.ts +1 -0
  12. package/dist/tools/index.d.ts.map +1 -1
  13. package/dist/tools/index.js +429 -178
  14. package/dist/tools/plan.d.ts +4 -0
  15. package/dist/tools/plan.d.ts.map +1 -0
  16. package/package.json +1 -1
  17. package/skills/plan/SKILL.md +5 -5
  18. package/skills/plan/references/design-quality.md +1 -1
  19. package/skills/plan/references/workflows/finalize.md +4 -4
  20. package/skills/plan/references/workflows/go.md +4 -4
  21. package/skills/plan/references/workflows/init.md +2 -2
  22. package/skills/plan/references/workflows/new.md +4 -4
  23. package/skills/plan/references/workflows/update.md +3 -3
  24. package/templates/plan/implementation.md +1 -2
  25. package/dist/plan/index.d.ts +0 -4
  26. package/dist/plan/index.d.ts.map +0 -1
  27. package/dist/plan/markdown.d.ts +0 -9
  28. package/dist/plan/markdown.d.ts.map +0 -1
  29. package/dist/plan/operations.d.ts +0 -43
  30. package/dist/plan/operations.d.ts.map +0 -1
  31. package/dist/plan/reviews.d.ts +0 -28
  32. package/dist/plan/reviews.d.ts.map +0 -1
  33. package/dist/plan/schema.d.ts +0 -249
  34. package/dist/plan/schema.d.ts.map +0 -1
  35. package/dist/plan/store.d.ts +0 -75
  36. package/dist/plan/store.d.ts.map +0 -1
  37. package/dist/plan/types.d.ts +0 -151
  38. 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, and flat task checkboxes. Each brief contains ordered steps, nested verification, acceptance criteria, and one action-labeled phase file tree as its sole exact file scope. No per-task or `PLAN.md` file scopes. 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 phase 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.
@@ -11,8 +11,8 @@ required_model: true
11
11
  required_thinking: true
12
12
  run_in_background: true
13
13
  allowed_subagents: worker, planner, reviewer, diffpi-plan-reviewer
14
- required_tools: read, write, edit, bash, Agent, watch_ci, diffpi_modes_status
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
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
16
16
  ---
17
17
 
18
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.
@@ -33,7 +33,7 @@ Work as the execution orchestrator for the plan skill. Coordinate live plan file
33
33
 
34
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.
35
35
 
36
- For background plan execution, read the live plan and honor its execution state. A draft must receive 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. 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 single file 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.
37
37
 
38
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.
39
39
 
@@ -23,10 +23,10 @@ Then, in one pass, read the current PLAN.md and every numbered phase brief selec
23
23
 
24
24
  Check all of these together:
25
25
 
26
- - Structure and parity: `PLAN.md` uses `## Phases` and numbered `### Phase N:` headings, phase-only prerequisites, flat task checkboxes without nested task dependencies, ordered stable IDs, and exact task ID/title parity with every numbered brief.
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, flat task checkboxes without nested task dependencies, ordered stable IDs, and exact task ID/title parity with every numbered brief.
27
27
  - Action-labeled trees: exactly one `## Phase File Tree` fenced `text` tree per brief; every file leaf starts with `[ADD]`, `[MODIFY]`, `[REMOVE]`, `[MOVE from: path]`, or `[VERIFY]` immediately after its tree branch (suffix labels are invalid). Verification is nested under its task.
28
28
  - Whole-plan quality: substantive intent, requirements, design, APIs/data flow, consequences, constraints, consistency, risks, and useful references.
29
- - Worker executability: every task has ordered steps, exact file scopes, implementation constraints, acceptance criteria, and enough context for a lightweight Worker to act without guessing.
29
+ - Worker executability: every task has ordered steps, implementation constraints, acceptance criteria, and enough context for a lightweight Worker to act without guessing; the phase-level tree is the sole exact file scope.
30
30
 
31
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
32
 
@@ -10,19 +10,19 @@ model_fallbacks: meridian/claude-opus-4-8, meridian/claude-opus-5
10
10
  thinking: high
11
11
  required_model: true
12
12
  required_thinking: true
13
- required_tools: read, grep, find, write, edit, Agent, get_subagent_result, diffpi_modes_status
14
- tools: read, grep, find, write, edit, ask_user_question, Agent, get_subagent_result, diffpi_modes_status, bash
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
15
15
  metadata:
16
16
  model-tier: frontier
17
17
  ---
18
18
 
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. After each iteration, 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.
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.
20
20
 
21
21
  ## Plan quality
22
22
 
23
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.
24
24
  - Inspect the repository before proposing phases. Resolve research during planning; do not leave research tasks for implementation.
25
- - 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 on phases only; give each task ordered steps and acceptance criteria. Put exact file scopes ONLY in one action-labeled Phase File Tree per implementation brief, never under a task or in PLAN.md.
26
26
  - Keep Design at 300 words or fewer when practical and never finalize it above 800 words.
27
27
  - Preserve completed work and evidence. Amend only draft, pending, or blocked work.
28
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.