@gavin-hu/my-pi-agent 0.17.0 → 0.18.0

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 (112) hide show
  1. package/README.md +17 -9
  2. package/README.zh-CN.md +16 -9
  3. package/extensions/bytefly/README.md +25 -18
  4. package/extensions/bytefly/notify/types.ts +1 -1
  5. package/extensions/bytefly/panel/settings.ts +25 -18
  6. package/extensions/file-browse/README.md +60 -21
  7. package/extensions/file-browse/chrome.ts +83 -0
  8. package/extensions/file-browse/client.ts +62 -0
  9. package/extensions/file-browse/config.ts +12 -3
  10. package/extensions/file-browse/diff-html.ts +94 -0
  11. package/extensions/file-browse/html.ts +19 -147
  12. package/extensions/file-browse/live-client.ts +47 -1
  13. package/extensions/file-browse/live.ts +35 -14
  14. package/extensions/file-browse/rev.ts +42 -0
  15. package/extensions/file-browse/router.ts +25 -4
  16. package/extensions/file-browse/server.ts +7 -0
  17. package/extensions/file-browse/styles.ts +2 -0
  18. package/extensions/goal/plan-route.ts +8 -2
  19. package/extensions/job/README.md +7 -5
  20. package/extensions/job/index.ts +15 -7
  21. package/extensions/memory/README.md +3 -3
  22. package/extensions/plan/README.md +280 -86
  23. package/extensions/plan/commands.ts +56 -5
  24. package/extensions/plan/feedback.ts +300 -63
  25. package/extensions/plan/index.ts +1 -1
  26. package/extensions/plan/plan-index.ts +1 -1
  27. package/extensions/plan/plan-text.ts +18 -1
  28. package/extensions/plan/plans.ts +165 -57
  29. package/extensions/plan/review-prompt.ts +93 -0
  30. package/extensions/plan/review.ts +78 -98
  31. package/extensions/plan/runtime.ts +1 -1
  32. package/extensions/plan/split.ts +87 -0
  33. package/extensions/plan/steps.ts +80 -93
  34. package/extensions/plan/tools/enter.ts +8 -3
  35. package/extensions/plan/tools/exit.ts +101 -23
  36. package/extensions/plan/tools/write.ts +8 -3
  37. package/extensions/plan/tools.ts +1 -1
  38. package/extensions/plan/tui.ts +51 -8
  39. package/extensions/plan/types.ts +37 -3
  40. package/extensions/plan/web-chrome.ts +2 -1
  41. package/extensions/plan/web-client.ts +121 -177
  42. package/extensions/plan/web-collab.ts +207 -0
  43. package/extensions/plan/web-comments.ts +269 -0
  44. package/extensions/plan/web-page.ts +103 -17
  45. package/extensions/plan/web-router.ts +146 -30
  46. package/extensions/plan/web-share-session.ts +197 -0
  47. package/extensions/plan/web-share.ts +169 -0
  48. package/extensions/plan/web-streams.ts +124 -0
  49. package/extensions/plan/web-tokens.ts +63 -0
  50. package/extensions/plan/web.ts +193 -45
  51. package/extensions/question/README.md +3 -0
  52. package/extensions/question/dialogs.ts +91 -1
  53. package/extensions/question/tools.ts +2 -1
  54. package/extensions/session-bus/README.md +247 -0
  55. package/extensions/session-bus/commands.ts +165 -0
  56. package/extensions/session-bus/format.ts +124 -0
  57. package/extensions/session-bus/index.ts +69 -0
  58. package/extensions/session-bus/notice.ts +58 -0
  59. package/extensions/session-bus/protocol.ts +134 -0
  60. package/extensions/session-bus/result.ts +243 -0
  61. package/extensions/session-bus/rows.ts +169 -0
  62. package/extensions/session-bus/runtime.ts +575 -0
  63. package/extensions/session-bus/store.ts +329 -0
  64. package/extensions/session-bus/team.ts +102 -0
  65. package/extensions/session-bus/tools.ts +227 -0
  66. package/extensions/session-bus/tui.ts +394 -0
  67. package/extensions/session-bus/types.ts +98 -0
  68. package/extensions/subagent/README.md +1 -1
  69. package/extensions/watch/README.md +9 -5
  70. package/extensions/watch/index.ts +15 -9
  71. package/extensions/wechat/README.md +20 -33
  72. package/extensions/wechat/bridge.ts +8 -8
  73. package/extensions/wechat/commands.ts +2 -2
  74. package/extensions/wechat/deliver.ts +57 -37
  75. package/extensions/wechat/interaction.ts +31 -16
  76. package/extensions/wechat/notices.ts +7 -7
  77. package/extensions/wechat/peer-worker.ts +19 -34
  78. package/extensions/wechat/presence.ts +3 -4
  79. package/extensions/wechat/prompt.ts +39 -24
  80. package/extensions/wechat/reply-pipeline.ts +12 -4
  81. package/extensions/worktree/git.ts +5 -0
  82. package/extensions/worktree/registry.ts +11 -5
  83. package/extensions/worktree/status.ts +1 -3
  84. package/lib/README.md +6 -2
  85. package/lib/claims/overlap.ts +43 -0
  86. package/lib/http/router.ts +40 -13
  87. package/lib/http/server.ts +27 -13
  88. package/lib/interaction.ts +10 -0
  89. package/lib/notice.ts +29 -2
  90. package/lib/plan-entry.ts +7 -2
  91. package/lib/plans/sections.ts +172 -0
  92. package/lib/plans/setting.ts +52 -0
  93. package/lib/plans/split.ts +215 -0
  94. package/lib/plans/store.ts +19 -0
  95. package/lib/plans/team.ts +151 -0
  96. package/lib/qr.ts +64 -0
  97. package/lib/repo-key.ts +74 -0
  98. package/lib/report.ts +52 -33
  99. package/lib/requirements.ts +1 -2
  100. package/lib/tui/README.md +16 -2
  101. package/lib/tui/dock-screen.ts +85 -17
  102. package/lib/tui/line-pane.ts +15 -4
  103. package/lib/tui/tool.ts +23 -4
  104. package/lib/web/components.ts +1 -1
  105. package/package.json +3 -2
  106. package/skills/init/SKILL.md +80 -45
  107. package/skills/init/references/agents-md-quality.md +26 -2
  108. package/skills/init/references/interview-questions.md +36 -14
  109. package/skills/next/SKILL.md +78 -53
  110. package/skills/parallel-dev/SKILL.md +150 -0
  111. package/extensions/plan/config.ts +0 -27
  112. package/extensions/wechat/qrcode.ts +0 -46
@@ -1,34 +1,37 @@
1
1
  ---
2
2
  name: init
3
- description: "Initialize or refresh AGENTS.md through a built-in interactive interview and a reviewed plan. Use when the user runs /skill:init or asks to set up project agent instructions."
3
+ description: "Initialize or refresh a project's agent instructions (AGENTS.md, or AGENTS.override.md when it shadows AGENTS.md) through a built-in interactive interview and a reviewed plan. Run /skill:init to start it."
4
4
  disable-model-invocation: true
5
5
  ---
6
6
 
7
- # Initialize AGENTS.md
7
+ # Initialize agent instructions
8
8
 
9
- Goal: create or update **`AGENTS.md` at the project root** by combining repository
9
+ Goal: create or update the instruction file Pi reads at the **project root** —
10
+ `AGENTS.md`, or `AGENTS.override.md` when one shadows it — by combining repository
10
11
  evidence with a short, built-in interview. The interview captures intent the code
11
12
  cannot show; the repository supplies every command, path, and convention that can
12
13
  be verified. Plan mode is the review gate: no write happens before approval.
13
14
 
14
15
  `/skill:init` loads this skill. If plan mode is not active, call
15
16
  `enter_plan_mode` and wait for confirmation. Keep the interview and the plan
16
- review in that order; do not write the file early to save a step.
17
+ review in that order; do not write the file early to save a step. A declined plan
18
+ mode ends the skill: stop and explain, rather than writing directly.
17
19
 
18
20
  ## Workflow
19
21
 
20
22
  ```text
21
23
  /skill:init
22
24
  └─> plan mode (read-only)
23
- └─> recon: manifests, docs, CI, tests, existing instructions
24
- └─> interview: one built-in question call (at most 4)
25
+ └─> recon: effective instruction file, sourced evidence, existing instructions
26
+ └─> interview: one built-in question call (at most 4), minus resolved facts
25
27
  ├─ answers ───────────────> reconcile with evidence
26
28
  └─ unavailable/cancelled ─> evidence + recorded assumptions
27
29
  └─> draft: new file, exact edits, or an honest no-op
28
30
  └─> quality gate
31
+ └─> plan outline with ## Steps and ## Verification
29
32
  └─> write_plan ──> exit_plan_mode
30
33
  ├─ not approved ──> refine the same plan
31
- └─ approved ──────> write/edit AGENTS.md
34
+ └─ approved ──────> write/edit the target
32
35
  └─ read back + quality gate
33
36
  ```
34
37
 
@@ -37,35 +40,34 @@ before the interview. Read
37
40
  [`references/agents-md-quality.md`](./references/agents-md-quality.md) before
38
41
  drafting and again before writing the plan.
39
42
 
40
- ## Repository states
43
+ ## Default question sets
41
44
 
42
- | State | Interview | Outcome |
43
- |---|---|---|
44
- | Existing project, no `AGENTS.md` | Purpose (only if unclear; otherwise Priorities), Verify, Rules, Isolation | New smallest-useful file. |
45
- | Existing `AGENTS.md` | Existing file, Preserve (only if sections are unclear), Priorities (only if stale), Rules | Exact edits that preserve correct instructions, or a no-op. |
46
- | Empty or near-empty repository | Stack, Commands, Purpose, Priorities | Honest minimal file from the answers and known facts only. |
47
- | Related instruction files exist | Swap Related docs in for Preserve or Rules | Describe the relationship; do not duplicate the other file. |
48
- | Git repository with no guidance | Isolation, Verify, Done, External changes | Prefer this set over a generic workflow question. |
49
- | No UI, inactive tool, or cancelled interview | Skip the call; record the gaps as assumptions | Evidence-based draft; the plan review remains the place to correct it. |
50
-
51
- The full bank, selectable alternatives, and option wording live in
52
- `references/interview-questions.md`. The table above is the default, not a menu to
53
- exhaust.
45
+ The bank's deterministic default sets, in
46
+ [`references/interview-questions.md`](./references/interview-questions.md), decide
47
+ the first call for each repository state. They are the only copy; do not restate
48
+ them here. Drop a question the evidence sheet already answers.
54
49
 
55
50
  ## 1. Recon
56
51
 
57
- - Read existing instruction files first: `AGENTS.md`, `AGENTS.override.md`,
58
- `CLAUDE.md`, and nested `AGENTS.md` files. Note how they relate; do not silently
59
- absorb or replace one.
52
+ - Resolve the instruction file Pi reads in this directory first. A root
53
+ `AGENTS.override.md` replaces `AGENTS.md` and `CLAUDE.md` in the same directory —
54
+ it still applies below — so it is the target; a new `AGENTS.md` beside it would
55
+ be dead text. Report an override above the project root or in the agent
56
+ directory, but never edit outside the project.
57
+ - Read the remaining instruction files (`CLAUDE.md`, nested `AGENTS.md` and
58
+ overrides) and note how they relate; do not silently absorb or replace one.
60
59
  - Read the files that define the project: manifests, lockfiles, README, docs
61
60
  index, source layout, tests, CI, formatter and linter configuration.
62
- - Build a short evidence sheet: stack, layout, install/test/lint/typecheck
63
- commands, validation gates, release path, and existing rules.
64
- - List the gaps the interview must fill. Stop the first pass once the shape is
61
+ - Build a sourced evidence sheet: stack and package manager from the manifest and
62
+ lockfile; every install/test/lint/typecheck command with the file that defines
63
+ it; generated, vendored, and build-output paths from `.gitignore` and the tree;
64
+ workspace packages and boundaries; purpose and audience from the README lead or
65
+ manifest description; validation gates, release path, and existing rules. Mark
66
+ each field `resolved` or `unknown`.
67
+ - The unknown fields are the interview gaps. Stop the first pass once the shape is
65
68
  clear; do not investigate the whole repository before asking.
66
69
  - In an empty or near-empty repository, record that evidence is absent. Never
67
70
  invent a command from a language's usual tooling.
68
- - Check that any command you plan to record is copied from a file that defines it.
69
71
  - Use `read`, `grep`, `find`, and `ls`. For a large repository, delegate a
70
72
  read-only survey to the `explorer` or `reviewer` subagent.
71
73
  - Do not read or copy secrets, credentials, tokens, or private environment
@@ -74,14 +76,19 @@ exhaust.
74
76
  ## 2. Interview
75
77
 
76
78
  Use `ask_user_question` once with at most four questions from the built-in bank.
77
- Choose the deterministic default set for the repository state.
79
+ Choose the bank's deterministic default set for the repository state, then drop
80
+ every question the evidence sheet already answers: `Purpose` only when README and
81
+ manifest are silent, `Verify` only when detected commands are missing or conflict,
82
+ `Sensitive` only when generated-path evidence leaves a boundary unclear. Ask the
83
+ bank's `Target` question when a root override exists.
78
84
 
79
85
  - One call is the default. Make a second call only when an answer leaves a
80
86
  material ambiguity that changes what the file says; do not ask a second round
81
87
  merely to collect preferences.
82
88
  - Fill option labels with evidence: the detected test command, the actual package
83
- manager, the real instruction file names. Keep a free-form escape on every
84
- question whose answer cannot be enumerated.
89
+ manager, the real instruction file names. Four options at most, and never one of
90
+ them for a free-form escape: the tool always adds Other, so an "Other" or "None of
91
+ these" label spends a real answer's slot.
85
92
  - Ask only what the evidence cannot answer. Do not ask for the stack when a
86
93
  manifest states it, or for a command already documented in CI.
87
94
  - Never ask for secrets, credentials, tokens, environment values, or personal
@@ -103,15 +110,23 @@ Treat answers and evidence as different kinds of fact:
103
110
  - If they conflict, record the conflict, what the draft uses, and the alternative
104
111
  in the plan. Do not quietly rewrite the user's intent or invent a command to
105
112
  match it.
113
+ - A command, path, or package with no source in the evidence sheet stays out or is
114
+ asked; it is never inferred from convention.
115
+
116
+ The target is the effective file from recon. If a root `AGENTS.override.md`
117
+ exists, edit it. Never write an `AGENTS.md` that the override shadows; if the user
118
+ chooses to consolidate into `AGENTS.md`, the plan removes or renames the override
119
+ in the same step and preserves its instructions.
106
120
 
107
121
  Then choose the outcome:
108
122
 
109
- - **No `AGENTS.md`** — draft the smallest useful file. Use the sections this
123
+ - **No instruction file** — draft the smallest useful file. Use the sections this
110
124
  repository needs; omit empty ones.
111
- - **Existing `AGENTS.md`** — preserve correct instructions and propose exact
112
- edits for the rest. If the user chose to rewrite, the plan must still list what
113
- is being removed.
114
- - **Accurate `AGENTS.md`** — propose no edits and explain the no-op with evidence.
125
+ - **Existing instruction file** — preserve correct instructions and propose exact
126
+ edits for the rest, shown as a fenced before/after diff. If the user chose to
127
+ rewrite, the plan must still list what is being removed.
128
+ - **Accurate instruction file** — propose no edits and explain the no-op with
129
+ evidence.
115
130
  - **Empty or near-empty repository** — say plainly that it is newly initialized,
116
131
  record the interview facts, and omit commands and architecture that do not
117
132
  exist yet.
@@ -132,31 +147,51 @@ evidence, not as a replacement for reading the repository.
132
147
 
133
148
  ## 5. Plan and review
134
149
 
135
- - Save the proposal with `write_plan`. The plan must include:
136
- - the recon summary and the evidence that supports the draft;
137
- - the questions asked, the answers, and how each answer was used;
138
- - the full draft for a new file, or the exact edits for an existing one;
139
- - assumptions, conflicts, and unanswered gaps from a cancelled or unavailable
150
+ - Save the proposal with `write_plan` in the documented outline. The plan must
151
+ include:
152
+ - `## Goal` — the outcome for the instruction file;
153
+ - `## Context` — the sourced evidence sheet, the effective-file finding, and the
154
+ questions asked with how each answer was used;
155
+ - `## Approach` — the full draft for a new file, or a fenced before/after diff
156
+ for edits;
157
+ - `## Steps` — one top-level bullet per apply action: write or edit the target,
158
+ read it back, run the check. Without this heading approval seeds the
159
+ shallowest list anywhere, which is the draft rather than the actions;
160
+ - `## Risks` — assumptions, conflicts, and gaps from a cancelled or unavailable
140
161
  interview;
141
- - a verification step that reads the written file back against the checklist.
162
+ - `## Verification` — the project's own check when it declares one (`run_check`,
163
+ or the narrower docs or structure test that guards the instruction file), then
164
+ reading the written file back against the checklist.
142
165
  - Call `exit_plan_mode` with the returned path.
143
166
  - If the user refines or rejects the plan, stay in plan mode, rewrite the same
144
167
  plan file with `write_plan` (`plan_path`), and present it again.
145
- - No `AGENTS.md` write may happen before approval.
168
+ - No write to the target may happen before approval.
146
169
 
147
170
  ## 6. Apply and verify
148
171
 
149
- - Create a new file with `write`, or update an existing one with `edit`.
150
- - Change only `AGENTS.md`. Do not touch unrelated files.
172
+ - Create a new file with `write`, or update the target with `edit`.
173
+ - Change only the instruction files the approved plan names: the target, and an
174
+ override the plan removes or renames while consolidating. Do not touch unrelated
175
+ files.
151
176
  - Read the result back from disk and rerun the quality checklist against what is
152
177
  actually there, not what you intended to write.
178
+ - Run the plan's verification step. A check that fails on the written file is the
179
+ report's follow-up, not a success; a check that fails for something the
180
+ instruction file cannot cause is named as an unrelated failure rather than
181
+ blamed on the draft.
153
182
  - Report the path, what the file covers, whether the interview was answered or
154
183
  fell back to assumptions, and any real follow-up. Name a missing fact instead of
155
184
  inventing it.
156
185
 
157
186
  ## Boundaries
158
187
 
159
- - One target: `AGENTS.md` at the project root selected in the plan.
188
+ - One target for the instructions: the instruction file Pi reads at the project
189
+ root — `AGENTS.override.md` when one exists, otherwise `AGENTS.md`, as selected
190
+ in the plan.
191
+ - A consolidation edits the file it absorbs only when the approved plan names it;
192
+ otherwise the other file is left alone.
193
+ - Never leave a written `AGENTS.md` shadowed by a root override, and never edit an
194
+ override outside the project root.
160
195
  - Plan mode is mandatory. If it is unavailable, stop and explain why instead of
161
196
  writing directly.
162
197
  - The built-in bank is the default; one custom gap question is allowed only when
@@ -9,6 +9,8 @@ invented command.
9
9
 
10
10
  - [ ] The first call used the deterministic default set for the repository state.
11
11
  - [ ] At most four questions were asked in the call.
12
+ - [ ] No question offered more than four options, and none spent one on a free-form
13
+ escape the tool already provides.
12
14
  - [ ] Options were filled from evidence where the bank names commands, files, or
13
15
  instruction documents.
14
16
  - [ ] No question duplicated a fact the recon already answered.
@@ -27,12 +29,24 @@ invented command.
27
29
  plan, with the chosen resolution.
28
30
  - [ ] The plan names which questions were asked and what the user answered.
29
31
 
32
+ ## Target file
33
+
34
+ - [ ] The plan names the instruction file Pi reads in the target directory.
35
+ - [ ] A root `AGENTS.override.md` is the target, or the plan removes or renames it
36
+ while consolidating its instructions into `AGENTS.md`.
37
+ - [ ] The written file is not an `AGENTS.md` that a root override shadows.
38
+ - [ ] An override above the project root or in the agent directory is reported,
39
+ not edited.
40
+
30
41
  ## Evidence accuracy
31
42
 
32
- - [ ] Every command is copied from a manifest, script, Makefile, CI file, or docs
33
- page that defines it. No command is guessed.
43
+ - [ ] Every command is paired with the file that defines it in the evidence sheet.
34
44
  - [ ] Every path and package name exists in the repository as written.
35
45
  - [ ] Every claimed convention is visible in the code or contributor docs.
46
+ - [ ] Generated and vendored exclusions name paths that exist and are backed by
47
+ `.gitignore` or build output.
48
+ - [ ] Purpose came from the README lead or manifest description, or was asked.
49
+ - [ ] No field marked `resolved` was asked again in the interview.
36
50
  - [ ] Unknown facts are omitted or named as unknown. They are never filled with
37
51
  plausible-sounding placeholders.
38
52
  - [ ] An answer that contradicts the code is treated as intent, not as evidence
@@ -76,12 +90,20 @@ invented command.
76
90
  `AGENTS.md`; the relationship is stated instead.
77
91
  - [ ] Two sections do not give the same instruction.
78
92
 
93
+ ## Plan and review
94
+
95
+ - [ ] The plan uses `## Steps` and `## Verification`.
96
+ - [ ] Each top-level step is an apply action, not a bullet from the draft.
97
+ - [ ] An existing-file change is shown as a before/after diff, not prose edits.
98
+
79
99
  ## Existing files
80
100
 
81
101
  - [ ] Correct existing instructions are preserved.
82
102
  - [ ] Stale instructions are changed only when the replacement is supported by
83
103
  repository evidence or an explicit answer.
84
104
  - [ ] The plan lists exact edits, not a wholesale rewrite.
105
+ - [ ] An override that is consolidated is removed or renamed in the same step, and
106
+ its instructions are preserved.
85
107
  - [ ] A rewrite records what is being removed and why.
86
108
  - [ ] A genuinely accurate file produces a no-op plan instead of churn.
87
109
 
@@ -97,6 +119,8 @@ invented command.
97
119
  ## Final read-back
98
120
 
99
121
  - [ ] The written file matches the approved plan.
122
+ - [ ] The project's own check passed against the written file, or the report names the
123
+ failure it returned.
100
124
  - [ ] The file was read back from disk, not recalled from memory.
101
125
  - [ ] Only `AGENTS.md` changed.
102
126
  - [ ] The report names the path, whether the interview was answered or fell back
@@ -5,6 +5,13 @@ The `init` skill selects from this bank. It is a menu, not a checklist: one
5
5
  call is allowed only for a material ambiguity. Never ask for secrets,
6
6
  credentials, tokens, environment values, or personal data.
7
7
 
8
+ Every select question lists its options inside `Shape`, separated by `;`, between
9
+ two and four of them. Anything after ` — ` is a note rather than an option, and
10
+ the tool's free-form **Other** is never listed as one: it is always offered, so a
11
+ label spent on it costs a real answer. In this package, `test/skill-bank.test.ts`
12
+ holds these tables to that convention, so an over-long list fails the check rather
13
+ than the interview.
14
+
8
15
  ## Consolidation rules
9
16
 
10
17
  The bank merges questions that would otherwise create two copies of the same
@@ -14,7 +21,11 @@ answer:
14
21
  first decision an agent makes.
15
22
  - **Done** absorbs testing and documentation expectations: both define when a
16
23
  task is complete.
17
- - **Sensitive** absorbs generated, vendored, and secret-bearing paths.
24
+ - **Sensitive** is the fallback for generated, vendored, and secret-bearing
25
+ boundaries that `.gitignore` and build-output evidence cannot settle.
26
+ - **Target** settles which file is written when a root `AGENTS.override.md`
27
+ exists; Related docs still covers `CLAUDE.md` and nested files once the target
28
+ is fixed.
18
29
  - **External changes** absorbs dependency and network policy.
19
30
  - **Commits** absorbs branch naming.
20
31
  - **Scope** and **Related docs** stay separate because they decide where the file
@@ -26,25 +37,29 @@ Use the first matching row. Fill option labels with evidence before asking.
26
37
 
27
38
  | Repository state | First four questions |
28
39
  |---|---|
29
- | Existing project, no `AGENTS.md` | Purpose (only if unclear; otherwise Priorities), Verify, Rules, Isolation |
40
+ | Existing project, no `AGENTS.md` | Purpose (only if README and manifest are silent; otherwise Priorities), Verify (only if commands are missing or conflict; otherwise Done), Rules, Isolation |
30
41
  | Existing project, `AGENTS.md` present | Existing file, Preserve (only if sections are unclear), Priorities (only if stale), Rules |
31
42
  | Empty or near-empty repository | Stack, Commands, Purpose, Priorities |
32
- | Related instruction files present | Swap Related docs in for Preserve or Rules |
43
+ | Related instruction files present | Target first when a root override exists; otherwise swap Related docs in for Preserve or Rules |
33
44
  | Git repository with no guidance | Isolation, Verify, Done, External changes |
34
45
  | No UI, inactive tool, or cancelled interview | No call; record the gaps as assumptions |
35
46
 
47
+ A field the evidence sheet resolves is dropped, and the parenthesised fallback
48
+ keeps the call at four questions only when the field is unknown. A root
49
+ `AGENTS.override.md` adds `Target` before any other state question.
50
+
36
51
  ## Core questions
37
52
 
38
53
  | Header | Question | Shape | Selected when |
39
54
  |---|---|---|---|
40
55
  | Purpose | What is this project, and who will agents work on it for? | Free-form | README and manifest do not state the purpose and audience, or the repository is empty/near-empty. |
41
- | Verify | Which commands should an agent trust to verify a change? | Multi-select: detected install, build, test, lint, and typecheck commands, plus No reliable command yet; free-form Other for a missing command | Detected commands conflict or are ambiguous, or no command was found. |
56
+ | Verify | Which commands should an agent trust to verify a change? | Multi-select: the detected full check; the detected test command; one file's test command; no reliable command yet — Other takes a command the recon missed | Detected commands conflict or are ambiguous, or no command was found. |
42
57
  | Rules | What should an agent know that is not obvious from the code? | Free-form | No explicit conventions, invariants, style rules, or traps are found in the source, docs, or contributor files. |
43
58
  | Isolation | How should agents isolate and land work? | Single-select: Worktree per task, then PR; Branch in the current checkout, then PR; Commit directly; Follow repository instructions | The project is a Git repository with no stated isolation or branch rule. |
44
- | Done | What must be true before a task is done? | Multi-select: Tests pass; Lint and typecheck pass; Docs and changelog updated; Diff self-reviewed; Pull request opened | No contributor guide defines done, test level, or documentation expectations. |
45
- | Sensitive | Are any files, directories, or workflows off-limits for agents? | Free-form, including generated, vendored, and secret-bearing paths | Access boundaries are unclear, or generated, vendored, or secret-bearing paths need explicit exclusion. |
59
+ | Done | What must be true before a task is done, on top of the landing rule? | Multi-select: Tests pass; Lint and typecheck pass; Docs and changelog updated; Diff self-reviewed — the pull request belongs to Isolation or Commits | No contributor guide defines done, test level, or documentation expectations. |
60
+ | Sensitive | Are any files, directories, or workflows off-limits for agents? | Free-form, including generated, vendored, and secret-bearing paths | Generated-path evidence leaves a boundary unclear, or a workflow boundary is not visible in the files. |
46
61
  | External changes | May an agent add dependencies or use the network? | Single-select: Yes, when needed; Ask first; Offline and no new dependencies | A manifest exists and dependency, package-install, or network rules are unclear. |
47
- | Existing file | How should the `init` skill handle the current `AGENTS.md`? | Single-select: Review and update in place; Keep it and only append missing guidance; Rewrite it from this interview | `AGENTS.md` already exists. |
62
+ | Existing file | How should the `init` skill handle the current instruction file? | Single-select: Review and update in place; Keep it and only append missing guidance; Rewrite it from this interview | The target instruction file already exists. |
48
63
 
49
64
  ## State questions
50
65
 
@@ -52,18 +67,19 @@ Use the first matching row. Fill option labels with evidence before asking.
52
67
  |---|---|---|---|
53
68
  | Stack | What are you building, and with which language or framework? | Free-form | The repository is empty/near-empty, or no manifest or README states the stack. |
54
69
  | Commands | What install, build, test, lint, and typecheck commands do you intend to use? | Free-form, with None yet accepted | The repository is empty/near-empty and no real command exists to copy. |
55
- | Related docs | How should `AGENTS.md` relate to existing instruction files? | Single-select: Link to them and add only gaps; Consolidate them into `AGENTS.md`; Leave them alone | `CLAUDE.md`, `AGENTS.override.md`, or a nested `AGENTS.md` exists. |
56
- | Preserve | Which current instructions must stay? | Free-form | `AGENTS.md` exists and its authoritative sections are unclear. |
57
- | Scope | Where should `AGENTS.md` apply? | Single-select: Repository root only; Root plus package-level files; Follow an existing instruction file | The repository is a monorepo, has nested packages, or already has a related instruction file. |
70
+ | Target | Which instruction file should `init` maintain? | Single-select: Edit `AGENTS.override.md`; Consolidate into `AGENTS.md` and remove the override — the first keeps Pi's effective file, the second unshadows `AGENTS.md` | A root `AGENTS.override.md` exists. |
71
+ | Related docs | How should the target instruction file relate to existing instruction files? | Single-select: Link to them and add only gaps; Consolidate them into the target file; Leave them alone | `CLAUDE.md` or a nested `AGENTS.md` exists. |
72
+ | Preserve | Which current instructions must stay? | Free-form | The target instruction file exists and its authoritative sections are unclear. |
73
+ | Scope | Where should the instruction file apply? | Single-select: Repository root only; Root plus package-level files; Follow an existing instruction file | The repository is a monorepo, has nested packages, or already has a related instruction file. |
58
74
 
59
75
  ## Optional follow-ups
60
76
 
61
77
  | Header | Question | Shape | Selected when |
62
78
  |---|---|---|---|
63
- | Priorities | What should agents optimize for here? | Multi-select: Correctness and safety; Small, reviewable changes; Fast iteration; Test coverage; Match existing style | No `AGENTS.md` yet, or the current priorities are absent or ambiguous. |
79
+ | Priorities | What should agents optimize for here? | Multi-select: Correctness and safety; Small, reviewable changes; Fast iteration; Match existing style — test coverage belongs to Done | No instruction file yet, or the current priorities are absent or ambiguous. |
64
80
  | Planning | When should an agent plan before acting? | Single-select: Non-trivial or multi-file work; Every task; Only when asked; Never | No plan-mode or workflow guidance exists. |
65
81
  | Commits | What commit convention and branch naming should agents follow? | Single-select: Conventional Commits with type/scope; Plain descriptive messages; Repository-defined convention; No preference | No commit or branch guidance exists in docs or CI. |
66
- | Release | What release or versioning process must an agent follow? | Single-select: Maintainer handles releases; Follow documented release steps; No release process; free-form Other | The project is published or versioned and the process is unclear. |
82
+ | Release | What release or versioning process must an agent follow? | Single-select: Maintainer handles releases; Follow documented release steps; No release process — Other takes a process this list misses | The project is published or versioned and the process is unclear. |
67
83
  | Performance | Are there performance budgets or hot paths to protect? | Free-form | The project exposes performance-sensitive code or has benchmarks. |
68
84
  | Environment | What local services or setup steps does an agent need? | Free-form, no secrets | Setup requires services, databases, or environment configuration that is not documented. |
69
85
  | Finish | Anything else the next agent should know? | Free-form | Always optional, at most once. |
@@ -72,9 +88,15 @@ Use the first matching row. Fill option labels with evidence before asking.
72
88
 
73
89
  - Ask at most four questions in one call, ordered by impact: state-specific
74
90
  question first, then command verification, then conventions and limits.
91
+ - Offer at most four options per question, filled from evidence, and never spend one
92
+ on a free-form escape the tool already provides.
75
93
  - Use the deterministic default set for the state. Do not pick a random subset.
76
- - Never ask for something the recon already answered, and never ask for a secret
77
- or credential.
94
+ - Never ask for something the evidence sheet already resolved, and never ask for a
95
+ secret or credential.
96
+ - `Purpose`, `Verify`, and `Sensitive` are fallbacks: ask each only when the
97
+ evidence sheet cannot answer it.
98
+ - When a root `AGENTS.override.md` exists, ask `Target` before drafting; a target
99
+ that keeps the override is edited in place, and a consolidation removes it.
78
100
  - One custom gap question is allowed only when no bank entry covers a material
79
101
  fact. It counts toward the four-question cap.
80
102
  - One follow-up call is allowed only when an answer creates a material ambiguity.
@@ -1,20 +1,24 @@
1
1
  ---
2
2
  name: next
3
- description: "Decide what to do next from a project's real state, or from the current conversation: loose work in the tree, commits since the last tag, unreleased changelog entries, roadmap or plan items still open, and the project's check command. Returns a short ranked list with the evidence for each item and the command that starts it; read-only, it never edits, commits, or begins the work. Use when asked what to do next, where to pick up, what is left, or what to work on now."
3
+ description: "Decide what to do next from the current conversation when it has work in it, or from the project's real state when it is empty: loose work, commits since the last tag, unreleased changelog entries, roadmap or plan items still open, and the project's check command. Returns a short list of suggested next todos in priority order, with the evidence for each and the command that starts it; read-only, it never edits, commits, or begins the work. Use when asked what to do next, where to pick up, what is left, or what to work on now."
4
4
  ---
5
5
 
6
- # Decide what to do next
6
+ # Suggest the next todos, by priority
7
7
 
8
- This is a triage, not a work session. The deliverable is a short ranked list with
9
- evidence; do not edit, commit, tag, or start the top item. The skill is
10
- model-invoked when a request matches the description; `/skill:next` is the
11
- explicit fallback. Read the project's own instructions first; where they disagree
12
- with this skill, the project wins.
8
+ This is a triage, not a work session. The deliverable is a short list of
9
+ suggested next todos in priority order, each with the evidence for it; do not
10
+ edit, commit, tag, or start the first one. The skill is model-invoked when a
11
+ request matches the description; `/skill:next` is the explicit fallback. Read the
12
+ project's own instructions first; where they disagree with this skill, the
13
+ project wins.
13
14
 
14
- Two sibling skills own a narrower question: an audit of *where to refactor* is
15
- `refactor`, and *what the last tag owes the changelog* is `changelog`. When the
16
- request is already scoped to one of those, name the skill that answers it and
17
- hand over, instead of returning a generic list.
15
+ The conversation decides where the candidates come from (section 3); the request
16
+ decides only what to ask and where to look.
17
+
18
+ Two sibling skills, where they are installed, own a narrower question: an audit
19
+ of *where to refactor* is `refactor`, and *what the last tag owes the changelog*
20
+ is `changelog`. When the request is already scoped to one of those, name the
21
+ skill that answers it and hand over, instead of returning a generic list.
18
22
 
19
23
  A next-steps block that the host draws itself is not this skill's output: that is
20
24
  the reply's suggested follow-up, a turn-level hint. This skill inspects state, so
@@ -24,15 +28,12 @@ its list survives the conversation that produced it.
24
28
 
25
29
  The host appends the text after the command to these instructions as the request.
26
30
  It is `<prompt>` in `/skill:next <prompt>`, it comes before any reading, and it
27
- carries up to three parts:
31
+ carries up to two parts:
28
32
 
29
33
  ```text
30
- /skill:next [session] [what you want] [@path ...]
34
+ /skill:next [what you want] [@path ...]
31
35
  ```
32
36
 
33
- - **`session`, first word** — session mode (section 3). The rest of the prompt
34
- keeps its own meaning: `/skill:next session what is left?` is session mode with
35
- a filter, not a filter of `session`.
36
37
  - **What you want** — a question, a goal, or a topic: "what is left before
37
38
  0.17?", "plan file outline". It chooses what the shortlist is about and keeps
38
39
  only the sources that can answer it; say which ones you kept. A named release,
@@ -48,7 +49,9 @@ carries up to three parts:
48
49
  - **An imperative** — "fix the failing test" names one piece of work, and the
49
50
  prompt is not approval for it. Answer with that item alone — evidence, starting
50
51
  command, effort — and ask before starting, instead of producing a list.
51
- - **No prompt** — triage of the current project.
52
+ - **No prompt** — the source rule in section 3 still decides: an empty
53
+ conversation is triaged from the project, and one that has done work is read
54
+ for what it left open.
52
55
  - **Anything unreadable** — triage anyway, and say in one clause how you read the
53
56
  prompt, so a misreading is visible in the report rather than silently narrowing
54
57
  the list.
@@ -66,40 +69,56 @@ With the request read, find:
66
69
  - the release path: what a tag, a version bump, or an unreleased entry owes;
67
70
  - the VCS, its branch model, and the last tag if there is one.
68
71
 
69
- State the profile in one or two lines. Do not invent a source the project does
70
- not have; a project with no roadmap is triaged from git and the check alone.
72
+ Do not invent a source the project does not have; a project with no roadmap is
73
+ triaged from version control and the check alone. These profile facts decide
74
+ which evidence rows apply, and section 7's report states them.
75
+
76
+ ## 3. Choose the source
77
+
78
+ There are two sources, and the conversation picks one:
79
+
80
+ - **This conversation** — the source once it has done work. Read its own record:
81
+ the todo list, the goal, the approved plan and its ticked steps, what subagents
82
+ and jobs returned, the paths it recorded, and the diff it produced. The
83
+ candidates are the loose ends it left: uncommitted files, an unapproved plan, a
84
+ check that was never run, a documented behavior that changed without a doc or
85
+ changelog edit.
86
+ - **The project's real state** — only when the conversation is empty. Read git,
87
+ the changelog, the roadmap or issues, and the plans directory; the candidates
88
+ are the project's loose work, broken promises, and unfinished ones.
71
89
 
72
- ## 3. Choose the mode
90
+ Empty means the conversation has done no work yet, not that it has no messages:
91
+ there is no todo list, no goal, no approved plan or ticked step, no subagent or
92
+ job result, no path it recorded, and no edit or commit from this session. The
93
+ request itself never counts, or `/skill:next` could never reach the tree.
73
94
 
74
- - **Triage** — what the tree says. Use git, the changelog, the roadmap or issues,
75
- and the plans directory. This is the default.
76
- - **Session** — what this conversation left open. Read the conversation's own
77
- record: the todo list, the goal, the approved plan and its ticked steps, what
78
- subagents and jobs returned, and the diff this session produced. Then list the
79
- loose ends it left: uncommitted files, an unapproved plan, a claim that was
80
- never run, a documented behavior that changed without a doc or changelog edit.
81
- - When both apply, run triage and read the session for context; the tree wins,
82
- because it is where the work actually is.
95
+ The tree is evidence in both sources. Verify every candidate against the code
96
+ before recommending it, and read the tree's status, the session's diff, the
97
+ changelog's unreleased section where the project has one, and the last check
98
+ result whichever source chose the candidates. A conversation that ended cleanly
99
+ has an empty list; do not fall back to the tree to fill it.
83
100
 
84
- Mode and scope are independent: session mode still honours a path, and triage
85
- with a path reads the whole tree's evidence before narrowing. State the mode, the
86
- scope, and the prompt as read, at the top of the report.
101
+ Scope is independent of the source: a path narrows either one, and a topic keeps
102
+ only the sources that can answer it. State the source, the scope, and the prompt
103
+ as read, at the top of the report.
87
104
 
88
105
  ## 4. Gather evidence
89
106
 
90
107
  Read only; nothing in this stage writes. Follow the project's own tool
91
- discipline, and say what you could not read.
108
+ discipline, and say what you could not read. The commands below are git's — use
109
+ the project's VCS for a project that is not on git — and read the rows its
110
+ profile says exist.
92
111
 
93
112
  | Source | What it proves |
94
113
  |---|---|
95
114
  | `git status --short`, `git diff --stat` | Work in flight, and whose it is |
96
- | `git log --oneline <last-tag>..HEAD` | What has landed unreleased |
115
+ | `git log --oneline <last-tag>..HEAD` | What has landed unreleased, if the project tags |
97
116
  | `git worktree list`, `git branch --no-merged` | An isolated tree left behind, a branch never merged |
98
- | The changelog's `[Unreleased]` | Whether a landed change is recorded, and whether the window is empty |
117
+ | The changelog's unreleased section (`[Unreleased]` under Keep a Changelog) | Whether a landed change is recorded, and whether the window is empty |
99
118
  | The roadmap, issue tracker, or `TODO` docs | The project's stated priorities, and which are already done |
100
- | The plans directory (`.pi/plans` or the project's equivalent) | An approved plan whose steps remain |
119
+ | The plan files the host's plan tool records (`~/.pi/agent/plans/<repo-key>` here) | An approved plan whose steps remain |
101
120
  | The todo list, the goal, job and subagent results | What the session promised and did not finish |
102
- | The check command | Whether the tree is green — cite the last known result, and make running it the item's starting command rather than running it here |
121
+ | The check command | Whether the tree is green — cite the session's last result, and make running it the item's starting command rather than running it here |
103
122
 
104
123
  A roadmap, a changelog, and a plan all lag the tree. Verify a candidate against
105
124
  the code before recommending it, and drop one that is already done.
@@ -116,12 +135,14 @@ cannot point at it, drop it.
116
135
  - Prefer the candidate with a fast verification command.
117
136
  - Never invent work to fill the list. An empty list is a valid answer.
118
137
 
119
- ## 6. Rank by cost of loss
138
+ ## 6. Rank by priority
120
139
 
121
- Order by what it would cost to lose, cheapest loss first:
140
+ Priority is what it would cost to lose the work, cheapest loss first, so the
141
+ order is the suggestion: the first item is the one to start, and a later item is
142
+ not an alternative to an earlier one. Order by that cost:
122
143
 
123
144
  - **Loose work** — a dirty tree, an unapproved plan, a check that has not been
124
- run, an unmerged branch, a worktree left behind, a stopped job.
145
+ run, an unmerged branch, a scratch tree or branch left behind, a stopped job.
125
146
  - **A broken promise** — a README, roadmap, or doc claim the code no longer
126
147
  meets, a released behavior with no test.
127
148
  - **An unfinished promise** — a stated roadmap item, the remaining steps of an
@@ -130,8 +151,8 @@ Order by what it would cost to lose, cheapest loss first:
130
151
  - **New reach** — a capability nobody has asked for comes last, and only when the
131
152
  three above are empty.
132
153
 
133
- Label each item with the ceremony it needs. The label is not a second ordering:
134
- cost of loss decides the order, and the label says how much work the item takes.
154
+ Label each item with the ceremony it needs. The label says how much work the item
155
+ takes, not where it ranks: the priority ladder decides the order.
135
156
 
136
157
  - **Do next** — cheap, safe, and unblocks the rest.
137
158
  - **Worth planning** — high value, but it spans files, changes a public surface,
@@ -139,17 +160,20 @@ cost of loss decides the order, and the label says how much work the item takes.
139
160
  - **Later** — real, but not now.
140
161
 
141
162
  Cap the list at three to five items, and let a tier be empty. A roadmap restated
142
- as ten suggestions is not a triage. Do not invent a numeric score; the reason
143
- must be readable.
163
+ as ten suggestions is not a triage. Number the items: the number is the priority.
164
+ Do not invent a score beyond that; the reason must be readable.
144
165
 
145
166
  ## 7. Report
146
167
 
147
- - **State** — one paragraph: the mode, the scope and how the prompt was read,
148
- the branch or worktree, what is dirty, what is unreleased, and whether the
149
- check passes. Name anything you could not read.
150
- - **The shortlist** — each item with its label, the action, the evidence at
151
- `path:line` or the command output that proves it, the command that starts it,
152
- and effort (S/M/L). Link the file the item lives in.
168
+ - **State** — one paragraph: the source and why it was chosen (a conversation
169
+ with work in it, or an empty one), the scope and how the prompt was read, the
170
+ branch or tree, what is dirty, what is unreleased, whether the check passes,
171
+ and the profile facts the list rests on — VCS, check command, and where work
172
+ is tracked. Name anything you could not read.
173
+ - **The list** — the suggested next todos, numbered in priority order, each with
174
+ its label, the action, the evidence at `path:line` or the command output that
175
+ proves it, the command that starts it, and effort (S/M/L). Link the file the
176
+ item lives in.
153
177
  - **Rejected or stale** — one line each, with the reason the roadmap, changelog,
154
178
  or plan entry no longer applies.
155
179
  - **Next step** — ask which item to start. Do not start it, and do not open with
@@ -174,11 +198,12 @@ When the user picks an item, the audit is over:
174
198
  - Nothing worth doing: say so, with what was checked, instead of inventing work.
175
199
  - The tree is mid-rebase, mid-merge, mid-bisect, or has a conflict: reconciling it
176
200
  is the only next item; nothing else is safe to suggest.
177
- - The project has no work tracking: say the list is derived from git and the check
178
- only, and suggest recording the plan or roadmap the project is missing.
201
+ - The project has no work tracking: say the list is derived from version control
202
+ and the check only, and suggest recording the plan or roadmap the project is
203
+ missing.
179
204
  - A candidate needs a destructive command (a branch delete, a worktree prune, a
180
205
  history rewrite) to start: name it as a decision for the user, not as a step.
181
206
 
182
- The triage is done when the mode is stated, every item has evidence and a
207
+ The triage is done when the source is stated, every item has evidence and a
183
208
  starting command, the list is capped, rejected candidates are explained, and no
184
209
  file was modified.