@gavin-hu/my-pi-agent 0.16.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 (200) hide show
  1. package/README.md +29 -15
  2. package/README.zh-CN.md +27 -15
  3. package/extensions/bytefly/README.md +195 -115
  4. package/extensions/bytefly/footer/collect/entries.ts +1 -6
  5. package/extensions/bytefly/footer/collect/snapshot.ts +23 -9
  6. package/extensions/bytefly/footer/price/price.ts +12 -8
  7. package/extensions/bytefly/footer/register.ts +13 -1
  8. package/extensions/bytefly/footer/types.ts +11 -0
  9. package/extensions/bytefly/footer/unpriced.ts +36 -0
  10. package/extensions/bytefly/header/component.ts +15 -29
  11. package/extensions/bytefly/header/identity.ts +71 -0
  12. package/extensions/bytefly/header/register.ts +9 -3
  13. package/extensions/bytefly/index.ts +13 -5
  14. package/extensions/bytefly/message/format.ts +20 -13
  15. package/extensions/bytefly/message/register.ts +8 -7
  16. package/extensions/bytefly/notify/types.ts +1 -1
  17. package/extensions/bytefly/panel/commands.ts +46 -25
  18. package/extensions/bytefly/panel/format.ts +49 -14
  19. package/extensions/bytefly/panel/join.ts +35 -9
  20. package/extensions/bytefly/panel/settings.ts +29 -39
  21. package/extensions/bytefly/panel/skills.ts +51 -0
  22. package/extensions/bytefly/panel/tui/extensions-view.ts +7 -61
  23. package/extensions/bytefly/panel/tui/frame.ts +9 -1
  24. package/extensions/bytefly/panel/tui/list-view.ts +72 -0
  25. package/extensions/bytefly/panel/tui/nav.ts +71 -3
  26. package/extensions/bytefly/panel/tui/settings-section.ts +250 -0
  27. package/extensions/bytefly/panel/tui/skills-view.ts +50 -0
  28. package/extensions/bytefly/panel/tui.ts +223 -331
  29. package/extensions/bytefly/panel/types.ts +26 -8
  30. package/extensions/bytefly/picker/discovery.ts +32 -27
  31. package/extensions/bytefly/picker/resources.ts +16 -8
  32. package/extensions/bytefly/picker/runtime.ts +62 -34
  33. package/extensions/bytefly/picker/toggle.ts +16 -10
  34. package/extensions/bytefly/picker/types.ts +31 -13
  35. package/extensions/bytefly/update/format.ts +66 -8
  36. package/extensions/bytefly/update/patch.ts +66 -0
  37. package/extensions/bytefly/update/register.ts +4 -11
  38. package/extensions/bytefly/update/release.ts +65 -0
  39. package/extensions/bytefly/update/state.ts +14 -0
  40. package/extensions/bytefly/update/suppress.ts +47 -29
  41. package/extensions/bytefly/update/types.ts +15 -5
  42. package/extensions/check/tui.ts +2 -0
  43. package/extensions/context/README.md +21 -11
  44. package/extensions/context/format.ts +10 -8
  45. package/extensions/context/report.ts +21 -8
  46. package/extensions/context/tui.ts +26 -10
  47. package/extensions/context/types.ts +5 -3
  48. package/extensions/file-browse/README.md +89 -22
  49. package/extensions/file-browse/chrome.ts +83 -0
  50. package/extensions/file-browse/client.ts +74 -459
  51. package/extensions/file-browse/config.ts +12 -3
  52. package/extensions/file-browse/diff-html.ts +94 -0
  53. package/extensions/file-browse/html.ts +26 -152
  54. package/extensions/file-browse/live-client.ts +47 -1
  55. package/extensions/file-browse/live.ts +35 -14
  56. package/extensions/file-browse/palette.ts +224 -0
  57. package/extensions/file-browse/rev.ts +42 -0
  58. package/extensions/file-browse/router.ts +27 -6
  59. package/extensions/file-browse/server.ts +7 -0
  60. package/extensions/file-browse/styles.ts +10 -3
  61. package/extensions/file-browse/tree.ts +381 -0
  62. package/extensions/file-read/README.md +4 -1
  63. package/extensions/file-read/extract/odt.ts +7 -5
  64. package/extensions/goal/plan-route.ts +8 -2
  65. package/extensions/goal/tools.ts +6 -11
  66. package/extensions/job/README.md +7 -5
  67. package/extensions/job/index.ts +35 -52
  68. package/extensions/job/tools.ts +51 -77
  69. package/extensions/memory/README.md +3 -3
  70. package/extensions/memory/tools.ts +4 -6
  71. package/extensions/memory/tui.ts +5 -1
  72. package/extensions/plan/README.md +333 -84
  73. package/extensions/plan/commands.ts +73 -7
  74. package/extensions/plan/feedback.ts +300 -63
  75. package/extensions/plan/index.ts +1 -1
  76. package/extensions/plan/plan-index.ts +4 -2
  77. package/extensions/plan/plan-text.ts +18 -1
  78. package/extensions/plan/plans.ts +184 -58
  79. package/extensions/plan/review-prompt.ts +93 -0
  80. package/extensions/plan/review.ts +95 -95
  81. package/extensions/plan/runtime.ts +4 -2
  82. package/extensions/plan/split.ts +87 -0
  83. package/extensions/plan/steps.ts +123 -107
  84. package/extensions/plan/tools/cancel.ts +79 -0
  85. package/extensions/plan/tools/enter.ts +17 -12
  86. package/extensions/plan/tools/exit.ts +148 -59
  87. package/extensions/plan/tools/steps.ts +7 -19
  88. package/extensions/plan/tools/write.ts +29 -31
  89. package/extensions/plan/tools.ts +6 -3
  90. package/extensions/plan/tui.ts +60 -15
  91. package/extensions/plan/types.ts +45 -3
  92. package/extensions/plan/web-chrome.ts +102 -0
  93. package/extensions/plan/web-client.ts +177 -446
  94. package/extensions/plan/web-collab.ts +207 -0
  95. package/extensions/plan/web-comments.ts +269 -0
  96. package/extensions/plan/web-markdown.ts +222 -0
  97. package/extensions/plan/web-page.ts +131 -19
  98. package/extensions/plan/web-router.ts +148 -32
  99. package/extensions/plan/web-share-session.ts +197 -0
  100. package/extensions/plan/web-share.ts +169 -0
  101. package/extensions/plan/web-streams.ts +124 -0
  102. package/extensions/plan/web-tokens.ts +63 -0
  103. package/extensions/plan/web.ts +193 -45
  104. package/extensions/question/README.md +3 -0
  105. package/extensions/question/dialogs.ts +91 -1
  106. package/extensions/question/tools.ts +2 -1
  107. package/extensions/rewind/checklist.ts +4 -0
  108. package/extensions/rewind/review-tui.ts +3 -1
  109. package/extensions/rewind/rewind-tui.ts +4 -0
  110. package/extensions/session-bus/README.md +247 -0
  111. package/extensions/session-bus/commands.ts +165 -0
  112. package/extensions/session-bus/format.ts +124 -0
  113. package/extensions/session-bus/index.ts +69 -0
  114. package/extensions/session-bus/notice.ts +58 -0
  115. package/extensions/session-bus/protocol.ts +134 -0
  116. package/extensions/session-bus/result.ts +243 -0
  117. package/extensions/session-bus/rows.ts +169 -0
  118. package/extensions/session-bus/runtime.ts +575 -0
  119. package/extensions/session-bus/store.ts +329 -0
  120. package/extensions/session-bus/team.ts +102 -0
  121. package/extensions/session-bus/tools.ts +227 -0
  122. package/extensions/session-bus/tui.ts +394 -0
  123. package/extensions/session-bus/types.ts +98 -0
  124. package/extensions/subagent/README.md +26 -13
  125. package/extensions/subagent/format.ts +72 -25
  126. package/extensions/subagent/index.ts +21 -47
  127. package/extensions/subagent/orchestrate.ts +18 -41
  128. package/extensions/subagent/render.ts +29 -42
  129. package/extensions/subagent/stream.ts +24 -18
  130. package/extensions/subagent/types.ts +7 -0
  131. package/extensions/todo/tools.ts +5 -6
  132. package/extensions/todo/tui.ts +5 -1
  133. package/extensions/watch/README.md +9 -5
  134. package/extensions/watch/index.ts +25 -44
  135. package/extensions/watch/tools.ts +31 -59
  136. package/extensions/wechat/README.md +45 -36
  137. package/extensions/wechat/bridge.ts +46 -48
  138. package/extensions/wechat/client.ts +1 -4
  139. package/extensions/wechat/commands.ts +3 -3
  140. package/extensions/wechat/deliver.ts +57 -37
  141. package/extensions/wechat/interaction.ts +54 -18
  142. package/extensions/wechat/login-screen.ts +2 -3
  143. package/extensions/wechat/notices.ts +9 -7
  144. package/extensions/wechat/peer-worker.ts +19 -34
  145. package/extensions/wechat/presence.ts +3 -4
  146. package/extensions/wechat/prompt.ts +53 -23
  147. package/extensions/wechat/reply-pipeline.ts +12 -4
  148. package/extensions/wechat/slash.ts +14 -0
  149. package/extensions/wechat/status-screen.ts +2 -2
  150. package/extensions/wechat/tools.ts +3 -11
  151. package/extensions/worktree/README.md +48 -12
  152. package/extensions/worktree/commands.ts +109 -65
  153. package/extensions/worktree/enter.ts +1 -1
  154. package/extensions/worktree/exit.ts +11 -1
  155. package/extensions/worktree/git.ts +5 -0
  156. package/extensions/worktree/lifecycle.ts +9 -1
  157. package/extensions/worktree/registry.ts +11 -5
  158. package/extensions/worktree/screen.ts +263 -0
  159. package/extensions/worktree/status.ts +84 -40
  160. package/lib/README.md +12 -7
  161. package/lib/claims/overlap.ts +43 -0
  162. package/lib/config.ts +12 -0
  163. package/lib/format.ts +6 -2
  164. package/lib/http/router.ts +40 -13
  165. package/lib/http/server.ts +27 -13
  166. package/lib/interaction.ts +28 -1
  167. package/lib/notice.ts +29 -2
  168. package/lib/plan-entry.ts +7 -2
  169. package/lib/plans/sections.ts +172 -0
  170. package/lib/plans/setting.ts +52 -0
  171. package/lib/plans/split.ts +215 -0
  172. package/lib/plans/store.ts +19 -0
  173. package/lib/plans/team.ts +151 -0
  174. package/lib/qr.ts +64 -0
  175. package/lib/repo-key.ts +74 -0
  176. package/lib/report.ts +117 -25
  177. package/lib/requirements.ts +1 -2
  178. package/lib/tool-result.ts +54 -4
  179. package/lib/tui/README.md +30 -8
  180. package/lib/tui/chrome.ts +27 -6
  181. package/lib/tui/dock-screen.ts +91 -19
  182. package/lib/tui/gauge.ts +9 -5
  183. package/lib/tui/line-pane.ts +15 -4
  184. package/lib/tui/tool.ts +23 -4
  185. package/lib/usage.ts +26 -0
  186. package/lib/web/README.md +131 -0
  187. package/lib/web/base.ts +19 -2
  188. package/lib/web/components.ts +10 -6
  189. package/lib/web/layout.ts +2 -0
  190. package/lib/web/markup.ts +2 -1
  191. package/lib/web/runtime.ts +103 -25
  192. package/lib/web/tokens.ts +23 -7
  193. package/package.json +5 -2
  194. package/skills/changelog/SKILL.md +57 -45
  195. package/skills/init/SKILL.md +80 -45
  196. package/skills/init/references/agents-md-quality.md +26 -2
  197. package/skills/init/references/interview-questions.md +36 -14
  198. package/skills/next/SKILL.md +209 -0
  199. package/skills/parallel-dev/SKILL.md +150 -0
  200. package/extensions/wechat/qrcode.ts +0 -46
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@gavin-hu/my-pi-agent",
3
- "version": "0.16.0",
4
- "description": "Personal Pi customizations, packaged as a Pi package: worktree isolation and rewind snapshots, question, todo, goal, plan, subagent, job, watch, web-access, file-browse, file-open, file-read, check, memory, context, wechat, and bytefly.",
3
+ "version": "0.18.0",
4
+ "description": "Personal Pi customizations, packaged as a Pi package: worktree isolation and rewind snapshots, question, todo, goal, plan, subagent, job, watch, web-access, file-browse, file-open, file-read, check, memory, context, session-bus, wechat, and bytefly.",
5
5
  "keywords": [
6
6
  "pi-package",
7
7
  "pi",
@@ -101,6 +101,7 @@
101
101
  "./extensions/file-open/index.ts",
102
102
  "./extensions/memory/index.ts",
103
103
  "./extensions/context/index.ts",
104
+ "./extensions/session-bus/index.ts",
104
105
  "./extensions/wechat/index.ts",
105
106
  "./extensions/bytefly/index.ts"
106
107
  ],
@@ -127,6 +128,7 @@
127
128
  "compat:versions": "bun run scripts/peer-versions.ts",
128
129
  "bench:render": "bun run scripts/render-bench.ts",
129
130
  "screenshot:file-browse": "bun run scripts/file-browse-shot.ts",
131
+ "screenshot:plan-flow": "bun run scripts/plan-flow-shot.ts",
130
132
  "screenshot:plan": "bun run scripts/plan-review-shot.ts",
131
133
  "screenshot:tools": "bun run scripts/tool-renderings.ts gallery assets/tool-renderings.png",
132
134
  "screenshot:tool-pngs": "bun run scripts/tool-renderings.ts tools assets/tools",
@@ -158,6 +160,7 @@
158
160
  "@types/bun": "latest",
159
161
  "@types/qrcode": "^1.5.5",
160
162
  "get-east-asian-width": "^1.6.0",
163
+ "playwright-core": "^1.64.1",
161
164
  "typebox": "^1.3.27",
162
165
  "typescript": "^5.6.0"
163
166
  }
@@ -1,48 +1,37 @@
1
1
  ---
2
2
  name: changelog
3
- description: "Maintain a Keep a Changelog file: draft the candidate bullet before implementation, record one user-visible bullet in the same commit, audit commits since the last tag for missing or weak entries, and curate a release section from the project's own rules. Use when planning, writing, or auditing a changelog or preparing a release, not for ordinary code edits."
3
+ description: "Maintain a Keep a Changelog file: record one user-visible bullet in the same commit, audit commits since the last tag for missing or weak entries, and curate a release section from the project's own rules. Use when writing, auditing, or releasing a changelog, not for ordinary code edits."
4
4
  ---
5
5
 
6
6
  # Maintain the changelog
7
7
 
8
8
  This is a procedure, not a second policy. Read the project's instructions first;
9
- where they disagree with this skill, the project wins. There are four modes:
10
- **draft** (before the code exists), **record** (the default once it does),
11
- **audit**, and **release**. `/skill:changelog draft`, `... audit`, and
12
- `... release` name the others; with no mode, infer draft versus record from
13
- whether the behavior already exists.
9
+ where they disagree with this skill, the project wins. There are three modes:
10
+ **record** (the default), **audit**, and **release**. `/skill:changelog` records;
11
+ `... audit` and `... release` name the others.
14
12
 
15
13
  ## 1. Read the project profile
16
14
 
17
- Before editing, find:
15
+ In this package the profile is written down; read it rather than rediscover it:
18
16
 
19
- - the changelog file and its preamble;
20
- - the category spelling and order;
21
- - the scope prefix, and whether one bullet per extension or module is required;
22
- - whether the entry belongs in the same commit as the change;
23
- - the release document, version bump, link refs, and tag/push/publish order;
24
- - the check command and any release-consistency test.
17
+ - [`../../CHANGELOG.md`](../../CHANGELOG.md) — the preamble, the scope prefixes,
18
+ and the bullet shape in use;
19
+ - [`../../AGENTS.md`](../../AGENTS.md) — the entry lands in the same commit as the
20
+ change, and a behavior change also updates the two entry READMEs and `docs/`;
21
+ - [`../../docs/development.md#release`](../../docs/development.md#release) — the
22
+ normative release procedure: version bump, link refs, tag and push order;
23
+ - [`../../test/release.test.ts`](../../test/release.test.ts) — the guard on
24
+ subsection names, order, emptiness, and the version pin.
25
+
26
+ Everywhere else, find the same six things: the changelog and its preamble, the
27
+ category spelling and order, the scope prefix and one-bullet-per-unit rule,
28
+ whether the entry ships with the change, the release document with its bump and
29
+ push order, and the check command with any release-consistency test.
25
30
 
26
31
  State the profile in one short paragraph. Do not invent a rule the project never
27
32
  stated; ask instead.
28
33
 
29
- ## 2. Draft before implementing
30
-
31
- For a new feature, draft the bullet in the plan or a scratchpad, not in
32
- `CHANGELOG.md`.
33
-
34
- - Write one line in the project's shape: ``- `scope`: <what the user can now do>``.
35
- - If you cannot state the outcome, or need several unrelated bullets, the feature
36
- is not scoped yet; split it or ask before coding.
37
- - Name the intended category and any migration, breaking change, or required
38
- action now, while the scope is still open.
39
- - Use the draft as the acceptance criterion: implementation is done when the
40
- behavior it describes is true and tested.
41
- - Keep it out of the changelog until the code lands; a draft is not a shipped
42
- claim. Update it when the outcome changes, then move it into `[Unreleased]` in
43
- the same commit as the code (**Record**).
44
-
45
- ## 3. Classify the change
34
+ ## 2. Classify the change
46
35
 
47
36
  It qualifies when a user can observe it: behavior, a CLI/tool/command surface, a
48
37
  config default, packaging, security, or a documented promise that is now true or
@@ -57,7 +46,7 @@ be one bullet if users see one outcome; two observable changes are two bullets.
57
46
  Ask when the outcome is unclear. Never invent an entry to make an audit look
58
47
  complete.
59
48
 
60
- ## 4. Record
49
+ ## 3. Record
61
50
 
62
51
  - Write the entry in the same commit as the change. If the change is already
63
52
  pushed without one, add a follow-up commit rather than rewriting history.
@@ -68,24 +57,40 @@ complete.
68
57
  - Exclude file names, internal helpers, test counts, commit hashes, and vague
69
58
  words such as "various" or "improvements".
70
59
  - Match the file's voice and tense. Do not add marketing.
60
+ - A behavior change also updates its row in the catalog tables of
61
+ [`../../README.md`](../../README.md) and
62
+ [`../../README.zh-CN.md`](../../README.zh-CN.md) plus the `docs/` guide it
63
+ belongs to; the changelog is this skill's subject, not its only file. A skill's
64
+ change updates its `SKILL.md` and its README row together.
71
65
  - Re-read immediately before editing, append within the category, and preserve
72
66
  other bullets and concurrent edits. Never create a second category heading.
73
67
 
68
+ Shape: one blank-line-separated bullet per outcome, wrapped near 80 columns, the
69
+ scope in backticks followed by a colon. The scope is the extension or module name,
70
+ spelled as this package spells it — `bytefly`, `plan`, `wechat`, `todo` — or
71
+ `lib`, `docs`, `test`, `ci`, `skills`. A bullet with no scope, or with a name the
72
+ package does not use, is a defect. A bullet may run several sentences — say what
73
+ the user sees, what it replaced, and any required action. Brevity is not the
74
+ goal; vagueness is the defect.
75
+
74
76
  Good:
75
77
 
76
78
  ```text
77
- - `billing`: invoices now show the tax line separately.
78
- - `config`: `oldKey` is no longer read; run `bun run config:migrate`.
79
+ - `config`: the report now says what its percentages are shares of. A
80
+ `Composition · 11k estimate` header sits above the rows, and a disabled
81
+ compaction no longer prints a headroom figure for a threshold that will never
82
+ fire.
83
+ - `cli`: `oldKey` is no longer read; run `bun run config:migrate`.
79
84
  ```
80
85
 
81
86
  Bad:
82
87
 
83
88
  ```text
84
- - `billing`: refactored invoice rendering and added tests.
89
+ - `config`: refactored invoice rendering and added tests.
85
90
  - `misc`: improvements.
86
91
  ```
87
92
 
88
- ## 5. Audit (read-only)
93
+ ## 4. Audit (read-only)
89
94
 
90
95
  1. Find the last tag: `git describe --tags --abbrev=0`, or the project's
91
96
  equivalent.
@@ -107,29 +112,36 @@ since the tag contain user-visible changes.
107
112
  Do not edit during the audit unless the user asks. If they do, return to
108
113
  **Record** and make only the entries the evidence supports.
109
114
 
110
- ## 6. Release (only when asked)
115
+ ## 5. Release (only when asked)
111
116
 
112
- Follow the project's release document; it is normative. This is a checklist, not
113
- a replacement:
117
+ The project's release document is normative — in this package
118
+ [`../../docs/development.md#release`](../../docs/development.md#release), guarded
119
+ by [`../../test/release.test.ts`](../../test/release.test.ts). This is a
120
+ checklist, not a replacement:
114
121
 
115
122
  - Confirm the version and the SemVer reason with the user.
116
123
  - Move every `[Unreleased]` entry under `## [X.Y.Z] - YYYY-MM-DD`; leave an empty
117
124
  `[Unreleased]` heading.
118
- - Bump every manifest and update the compare and release link refs.
119
- - Run the project's release checks.
120
- - Tag, push, and publish only with explicit approval, in the project's order.
125
+ - Bump every manifest and update the compare and release link refs, in the same
126
+ commit as the movable part; the version in the manifest and the newest dated
127
+ heading must agree or the release test fails.
128
+ - Run the project's release checks, then `bun test test/release.test.ts` for the
129
+ version and subsection rules.
130
+ - Tag, push, and publish only with explicit approval, in the project's order. The
131
+ order matters: push the tag with `main`, never after it.
121
132
  - Keep the release commit mechanical: no behavior, code, or unrelated docs.
122
- - Use that section as the release body; do not add extra prose.
133
+ - Use that section as the release body (`bun run release:notes X.Y.Z` prints it);
134
+ do not add extra prose.
123
135
 
124
- ## 7. Quality gate
136
+ ## 6. Quality gate
125
137
 
126
138
  - One bullet per user-visible change; every bullet starts with a scope and a user
127
- outcome.
139
+ outcome, and may take several sentences to state it.
128
140
  - No internal-only or duplicate entries, and no empty category headings.
129
141
  - No entry for a change that shipped before its heading.
130
142
  - Links and versions agree; the project check passes.
131
143
 
132
- ## 8. Report and stop
144
+ ## 7. Report and stop
133
145
 
134
146
  Say what was recorded, what the audit found, or what the release moved. List what
135
147
  was deliberately left out and why. When nothing qualifies, say so. Stop before
@@ -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.