@gavin-hu/my-pi-agent 0.18.0 → 0.19.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 (249) hide show
  1. package/README.md +52 -44
  2. package/README.zh-CN.md +46 -41
  3. package/docs/extensions/README.md +34 -0
  4. package/docs/extensions/board.md +344 -0
  5. package/{extensions/bytefly/README.md → docs/extensions/bytefly.md} +446 -404
  6. package/{extensions/check/README.md → docs/extensions/check.md} +83 -68
  7. package/{extensions/context/README.md → docs/extensions/context.md} +40 -23
  8. package/docs/extensions/file-browse.md +554 -0
  9. package/{extensions/file-open/README.md → docs/extensions/file-open.md} +31 -23
  10. package/{extensions/file-read/README.md → docs/extensions/file-read.md} +47 -55
  11. package/{extensions/goal/README.md → docs/extensions/goal.md} +115 -131
  12. package/{extensions/job/README.md → docs/extensions/job.md} +61 -50
  13. package/{extensions/memory/README.md → docs/extensions/memory.md} +71 -60
  14. package/{extensions/plan/README.md → docs/extensions/plan.md} +390 -317
  15. package/{extensions/question/README.md → docs/extensions/question.md} +54 -31
  16. package/{extensions/rewind/README.md → docs/extensions/rewind.md} +115 -122
  17. package/docs/extensions/session-bus.md +285 -0
  18. package/{extensions/subagent/README.md → docs/extensions/subagent.md} +165 -118
  19. package/docs/extensions/team.md +226 -0
  20. package/{extensions/todo/README.md → docs/extensions/todo.md} +85 -88
  21. package/{extensions/watch/README.md → docs/extensions/watch.md} +54 -36
  22. package/{extensions/web-access/README.md → docs/extensions/web-access.md} +93 -50
  23. package/{extensions/wechat/README.md → docs/extensions/wechat.md} +258 -162
  24. package/{extensions/worktree/README.md → docs/extensions/worktree.md} +115 -72
  25. package/extensions/board/commands.ts +87 -0
  26. package/extensions/board/config.ts +36 -0
  27. package/extensions/board/format.ts +72 -0
  28. package/extensions/board/index.ts +40 -0
  29. package/extensions/board/input.ts +54 -0
  30. package/extensions/board/join.ts +42 -0
  31. package/extensions/board/page.ts +312 -0
  32. package/extensions/board/result.ts +99 -0
  33. package/extensions/board/rows.ts +48 -0
  34. package/extensions/board/schema.ts +75 -0
  35. package/extensions/board/seat.ts +29 -0
  36. package/extensions/board/snapshot.ts +41 -0
  37. package/extensions/board/tools.ts +279 -0
  38. package/extensions/board/transport/router.ts +172 -0
  39. package/extensions/board/transport/server.ts +149 -0
  40. package/extensions/board/types.ts +54 -0
  41. package/extensions/board/view/actions.ts +306 -0
  42. package/extensions/board/view/client.ts +41 -0
  43. package/extensions/board/view/keys.ts +121 -0
  44. package/extensions/board/view/live.ts +397 -0
  45. package/extensions/board/view/page.ts +158 -0
  46. package/extensions/board/view/render.ts +496 -0
  47. package/extensions/board/view/styles.ts +211 -0
  48. package/extensions/board/view/team.ts +305 -0
  49. package/extensions/board/writes.ts +99 -0
  50. package/extensions/bytefly/panel/commands.ts +40 -7
  51. package/extensions/bytefly/panel/settings-runtime.ts +0 -6
  52. package/extensions/bytefly/panel/settings.ts +3 -20
  53. package/extensions/bytefly/panel/tui/settings-view.ts +1 -1
  54. package/extensions/bytefly/picker/discovery.ts +0 -2
  55. package/extensions/bytefly/picker/types.ts +0 -2
  56. package/extensions/bytefly/update/check.ts +39 -0
  57. package/extensions/bytefly/update/format.ts +15 -0
  58. package/extensions/bytefly/update/register.ts +73 -34
  59. package/extensions/bytefly/update/state.ts +6 -3
  60. package/extensions/context/tui.ts +1 -1
  61. package/extensions/file-browse/{config.ts → config/config.ts} +1 -1
  62. package/extensions/file-browse/{files.ts → files/files.ts} +1 -14
  63. package/extensions/file-browse/{paths.ts → files/paths.ts} +1 -1
  64. package/extensions/file-browse/{git.ts → git/git.ts} +10 -3
  65. package/extensions/file-browse/index.ts +4 -4
  66. package/extensions/file-browse/{live.ts → live/live.ts} +20 -69
  67. package/extensions/file-browse/{router.ts → transport/router.ts} +21 -15
  68. package/extensions/file-browse/transport/server.ts +110 -0
  69. package/extensions/file-browse/{chrome.ts → view/chrome.ts} +4 -4
  70. package/extensions/file-browse/{client.ts → view/client.ts} +1 -1
  71. package/extensions/file-browse/{diff-html.ts → view/diff-html.ts} +3 -3
  72. package/extensions/file-browse/{html.ts → view/html.ts} +14 -12
  73. package/extensions/file-browse/{icons.ts → view/icons.ts} +1 -1
  74. package/extensions/file-browse/{markdown.ts → view/markdown.ts} +7 -7
  75. package/extensions/file-browse/{raw-html.ts → view/raw-html.ts} +1 -1
  76. package/extensions/file-browse/{styles.ts → view/styles.ts} +29 -5
  77. package/extensions/file-browse/{tree.ts → view/tree.ts} +1 -1
  78. package/extensions/file-browse/{urls.ts → view/urls.ts} +1 -1
  79. package/extensions/file-read/schema.ts +2 -1
  80. package/extensions/memory/store.ts +12 -5
  81. package/extensions/plan/blocks.ts +23 -2
  82. package/extensions/plan/commands.ts +21 -16
  83. package/extensions/plan/feedback.ts +147 -38
  84. package/extensions/plan/index.ts +6 -4
  85. package/extensions/plan/plan-index.ts +43 -9
  86. package/extensions/plan/plan-text.ts +33 -23
  87. package/extensions/plan/plans.ts +8 -11
  88. package/extensions/plan/policy.ts +20 -12
  89. package/extensions/plan/review.ts +3 -27
  90. package/extensions/plan/runtime.ts +21 -9
  91. package/extensions/plan/sections.ts +112 -0
  92. package/extensions/plan/steps.ts +3 -22
  93. package/extensions/plan/tools/exit.ts +11 -95
  94. package/extensions/plan/tui.ts +5 -34
  95. package/extensions/plan/types.ts +0 -8
  96. package/extensions/plan/web-client.ts +1 -1
  97. package/extensions/plan/web-page.ts +0 -7
  98. package/extensions/plan/web-router.ts +3 -57
  99. package/extensions/plan/web-share-session.ts +24 -30
  100. package/extensions/plan/web-streams.ts +14 -14
  101. package/extensions/plan/web-tokens.ts +2 -2
  102. package/extensions/plan/web.ts +66 -120
  103. package/extensions/rewind/{commands.ts → commands/commands.ts} +5 -5
  104. package/extensions/rewind/{review.ts → commands/review.ts} +13 -13
  105. package/extensions/rewind/{rewind.ts → commands/rewind.ts} +6 -6
  106. package/extensions/rewind/{config.ts → config/config.ts} +1 -1
  107. package/extensions/rewind/index.ts +3 -3
  108. package/extensions/rewind/{policy.ts → state/policy.ts} +4 -4
  109. package/extensions/rewind/{runtime.ts → state/runtime.ts} +11 -11
  110. package/extensions/rewind/{snapshot-run.ts → state/snapshot-run.ts} +1 -1
  111. package/extensions/rewind/{timeline.ts → state/timeline.ts} +2 -2
  112. package/extensions/rewind/{format.ts → text/format.ts} +3 -3
  113. package/extensions/rewind/{git.ts → transport/git.ts} +2 -2
  114. package/extensions/rewind/{restore.ts → transport/restore.ts} +2 -2
  115. package/extensions/rewind/{snapshot.ts → transport/snapshot.ts} +1 -1
  116. package/extensions/rewind/{store.ts → transport/store.ts} +1 -1
  117. package/extensions/rewind/{checklist.ts → view/checklist.ts} +6 -6
  118. package/extensions/rewind/{hunk-picker.ts → view/hunk-picker.ts} +8 -8
  119. package/extensions/rewind/{path-picker.ts → view/path-picker.ts} +7 -7
  120. package/extensions/rewind/{review-tui.ts → view/review-tui.ts} +11 -11
  121. package/extensions/rewind/{rewind-tui.ts → view/rewind-tui.ts} +17 -11
  122. package/extensions/rewind/{status.ts → view/status.ts} +4 -4
  123. package/extensions/session-bus/commands.ts +17 -69
  124. package/extensions/session-bus/format.ts +22 -45
  125. package/extensions/session-bus/index.ts +13 -7
  126. package/extensions/session-bus/join-request.ts +40 -0
  127. package/extensions/session-bus/mail-watch.ts +134 -0
  128. package/extensions/session-bus/notice.ts +32 -4
  129. package/{lib/claims → extensions/session-bus}/overlap.ts +11 -18
  130. package/extensions/session-bus/protocol.ts +19 -49
  131. package/extensions/session-bus/resolve.ts +67 -0
  132. package/extensions/session-bus/result.ts +16 -51
  133. package/extensions/session-bus/rows.ts +4 -2
  134. package/extensions/session-bus/runtime.ts +129 -238
  135. package/extensions/session-bus/store.ts +42 -6
  136. package/extensions/session-bus/tools.ts +31 -66
  137. package/extensions/session-bus/tui.ts +4 -4
  138. package/extensions/session-bus/types.ts +13 -13
  139. package/extensions/subagent/agents.ts +9 -8
  140. package/extensions/subagent/invocation.ts +4 -2
  141. package/extensions/team/commands.ts +112 -0
  142. package/extensions/team/dispatch.ts +133 -0
  143. package/extensions/team/format.ts +105 -0
  144. package/extensions/team/index.ts +33 -0
  145. package/extensions/team/schema.ts +29 -0
  146. package/extensions/team/tools.ts +246 -0
  147. package/extensions/team/types.ts +48 -0
  148. package/extensions/web-access/fetch/page.ts +4 -1
  149. package/extensions/web-access/fetch/structured.ts +447 -0
  150. package/extensions/web-access/fetch/tool.ts +2 -1
  151. package/extensions/web-access/search/tool.ts +2 -1
  152. package/extensions/wechat/bridge.ts +76 -92
  153. package/extensions/wechat/{commands.ts → commands/commands.ts} +26 -18
  154. package/extensions/wechat/{doctor.ts → commands/doctor.ts} +5 -5
  155. package/extensions/wechat/{history.ts → commands/history.ts} +1 -1
  156. package/extensions/wechat/{login.ts → commands/login.ts} +3 -3
  157. package/extensions/wechat/{slash.ts → commands/slash.ts} +38 -2
  158. package/extensions/wechat/dialog/channels.ts +136 -0
  159. package/extensions/wechat/{interaction.ts → dialog/interaction.ts} +37 -37
  160. package/extensions/wechat/{prompt.ts → dialog/prompt.ts} +2 -2
  161. package/extensions/wechat/{remote-ui.ts → dialog/remote-ui.ts} +1 -1
  162. package/extensions/wechat/index.ts +10 -10
  163. package/extensions/wechat/{admission.ts → peer/admission.ts} +2 -2
  164. package/extensions/wechat/{peer-session.ts → peer/peer-session.ts} +2 -2
  165. package/extensions/wechat/{peer-worker.ts → peer/peer-worker.ts} +100 -22
  166. package/extensions/wechat/{presence.ts → peer/presence.ts} +8 -7
  167. package/extensions/wechat/{reply-pipeline.ts → peer/reply-pipeline.ts} +1 -1
  168. package/extensions/wechat/{credentials.ts → state/credentials.ts} +2 -2
  169. package/extensions/wechat/{state.ts → state/state.ts} +14 -2
  170. package/extensions/wechat/{format.ts → text/format.ts} +3 -3
  171. package/extensions/wechat/{notices.ts → text/notices.ts} +8 -0
  172. package/extensions/wechat/tools.ts +29 -12
  173. package/extensions/wechat/{client.ts → transport/client.ts} +26 -2
  174. package/extensions/wechat/{deliver.ts → transport/deliver.ts} +72 -28
  175. package/extensions/wechat/{inbound.ts → transport/inbound.ts} +5 -5
  176. package/extensions/wechat/{media.ts → transport/media.ts} +11 -5
  177. package/extensions/wechat/transport/outbound.ts +142 -0
  178. package/extensions/wechat/{poll.ts → transport/poll.ts} +3 -3
  179. package/extensions/wechat/types.ts +10 -1
  180. package/extensions/wechat/{login-screen.ts → view/login-screen.ts} +4 -4
  181. package/extensions/wechat/{status-screen.ts → view/status-screen.ts} +31 -26
  182. package/extensions/worktree/guard.ts +3 -5
  183. package/lib/README.md +8 -6
  184. package/lib/board/card.ts +290 -0
  185. package/lib/board/links.ts +117 -0
  186. package/lib/board/page-pointer.ts +256 -0
  187. package/lib/board/round-text.ts +72 -0
  188. package/lib/board/round.ts +89 -0
  189. package/lib/board/rules.ts +304 -0
  190. package/lib/board/session.ts +105 -0
  191. package/lib/board/store.ts +310 -0
  192. package/lib/board/view.ts +150 -0
  193. package/lib/errors.ts +12 -4
  194. package/lib/format.ts +13 -0
  195. package/lib/http/guard.ts +112 -0
  196. package/lib/http/index.ts +16 -5
  197. package/lib/http/serve.ts +234 -0
  198. package/lib/http/server.ts +12 -10
  199. package/lib/http/sink.ts +110 -0
  200. package/lib/http/token.ts +38 -0
  201. package/lib/policy.ts +12 -2
  202. package/lib/requirements.ts +6 -7
  203. package/lib/session-label.ts +64 -0
  204. package/lib/session-roster.ts +130 -0
  205. package/lib/session-tool.ts +184 -0
  206. package/lib/tool-names.ts +25 -2
  207. package/lib/tui/glyphs.ts +2 -0
  208. package/lib/web/README.md +5 -2
  209. package/lib/web/components.ts +5 -0
  210. package/lib/web/runtime.ts +7 -1
  211. package/lib/web/tokens.ts +25 -2
  212. package/package.json +26 -14
  213. package/skills/next/SKILL.md +4 -3
  214. package/skills/project-docs/SKILL.md +133 -0
  215. package/skills/project-docs/references/audit.md +131 -0
  216. package/skills/project-docs/references/changelog.md +105 -0
  217. package/skills/project-docs/references/discovery.md +127 -0
  218. package/skills/project-docs/references/readme.md +80 -0
  219. package/skills/project-docs/references/release.md +84 -0
  220. package/skills/project-docs/references/roadmap.md +93 -0
  221. package/skills/project-docs/scripts/state.ts +316 -0
  222. package/skills/refactor/SKILL.md +100 -125
  223. package/skills/refactor/references/handoff.md +35 -0
  224. package/skills/refactor/references/signals.md +54 -0
  225. package/skills/refactor/scripts/inventory.ts +587 -0
  226. package/extensions/file-browse/README.md +0 -506
  227. package/extensions/file-browse/server.ts +0 -141
  228. package/extensions/plan/split.ts +0 -87
  229. package/extensions/session-bus/README.md +0 -247
  230. package/extensions/session-bus/team.ts +0 -102
  231. package/extensions/wechat/outbound.ts +0 -100
  232. package/lib/plans/sections.ts +0 -172
  233. package/lib/plans/setting.ts +0 -52
  234. package/lib/plans/split.ts +0 -215
  235. package/lib/plans/store.ts +0 -19
  236. package/lib/plans/team.ts +0 -151
  237. package/skills/changelog/SKILL.md +0 -148
  238. package/skills/parallel-dev/SKILL.md +0 -150
  239. /package/extensions/file-browse/{rev.ts → live/rev.ts} +0 -0
  240. /package/extensions/file-browse/{diff.ts → text/diff.ts} +0 -0
  241. /package/extensions/file-browse/{fuzzy.ts → text/fuzzy.ts} +0 -0
  242. /package/extensions/file-browse/{live-client.ts → view/live-client.ts} +0 -0
  243. /package/extensions/file-browse/{palette.ts → view/palette.ts} +0 -0
  244. /package/extensions/rewind/{patch.ts → text/patch.ts} +0 -0
  245. /package/extensions/rewind/{paths.ts → text/paths.ts} +0 -0
  246. /package/extensions/rewind/{queue.ts → transport/queue.ts} +0 -0
  247. /package/extensions/rewind/{temp-index.ts → transport/temp-index.ts} +0 -0
  248. /package/extensions/wechat/{lock.ts → state/lock.ts} +0 -0
  249. /package/extensions/wechat/{channel.ts → text/channel.ts} +0 -0
@@ -1,27 +1,65 @@
1
1
  # check — cross-stack verification runs
2
2
 
3
3
  Run the project's test, lint, or typecheck command from Pi, watch it live, and
4
- turn its output into a navigable `file:line` list. The same run is available to
5
- the model as `run_check`, with structured failures instead of a wall of log
6
- text.
4
+ turn its output into a navigable `file:line` list. The model gets the same run
5
+ as `run_check`, with structured failures instead of a wall of log text. Detection
6
+ is manifest-driven and deliberately generic: `check` assumes no language, test
7
+ framework, or CI system.
7
8
 
8
- `check` is deliberately generic: it detects the project's command from its
9
- manifest or takes `check.command`, and it does not assume Node, Bun, a test
10
- framework, or a particular CI system.
9
+ ## Capabilities
11
10
 
12
- ```
11
+ Status records what a reader can rely on: **Shipped** is in a tagged release, **Unreleased** is complete in the current tree but not yet tagged, and **Partial** has one released part and one unreleased part. Rows are ordered by user value, highest first.
12
+
13
+ | Capability | How | What you get | Status |
14
+ |---|---|---|---|
15
+ | Plan-mode refusal | `/check`, the read-only policy | Plan mode refuses a check because tests still write caches, snapshots, or generated files; approve the plan first. | Shipped |
16
+ | Single active run | `run_check`, `/check` | A second run is refused with the corrective action while one process is active, instead of starting a parallel check. | Shipped |
17
+ | Supervised run | `/check`, `run_check` | One process per command, with a wall-clock timeout, a bounded log, and `Esc` to cancel the process tree. | Shipped |
18
+ | Command detection | a project manifest, `check.command` | The project's test, lint, and typecheck commands are found without configuration, with a shell command override. | Shipped |
19
+ | Target selection | `/check` with a target, `run_check.target` | Run `test`, `lint`, `typecheck`, or `all`; `all` is the default. | Shipped |
20
+ | Structured failures | `run_check` | The model gets `path`, `line`, `column`, `test`, `message`, and `command` instead of a wall of log text. | Shipped |
21
+ | Failure list | `/check` | A navigable list with a detail view for the focused failure, drawn from a source excerpt or the bounded tail. | Shipped |
22
+ | Rerun from the list | `r` in the failure list | Rerun the same check after reading a failure; `Enter` opens its detail and `Esc` closes. | Shipped |
23
+ | Live run screen | `/check` | A scrolling tail that repaints while the command runs, so a silent compiler still shows progress. | Shipped |
24
+ | Capped transcript | `run_check` | One status summary and at most five failure rows, expanded with `ctrl+o` to the model's 20-failure cap. | Shipped |
25
+ | Headless report | `/check`, `run_check` | RPC, JSON, and print sessions post the summary plus the failure list, with no screen. | Shipped |
26
+ | Honest fallback | `/check`, `run_check` | An unparsed failure names the exit status and the last output lines, never an invented location. | Shipped |
27
+
28
+ ## Quickstart
29
+
30
+ ```bash
13
31
  pi --extension ./extensions/check # load just this extension
14
32
  pi -e . # load the whole @gavin-hu/my-pi-agent package
15
33
  pi install ./ # install the package
16
34
  ```
17
35
 
18
- ## Screens
36
+ ```text
37
+ /check # run every detected command
38
+ /check test # run the detected test command
39
+ ```
19
40
 
20
- <img src="../../assets/check.png" alt="The /check screen: a failed run with failure rows and the focused failure's message" width="100%">
41
+ The model calls `run_check` with the same four targets.
21
42
 
22
- <img src="../../assets/check-detail.png" alt="The /check failure detail: the location and message over a source excerpt with the failing line marked by >" width="100%">
43
+ ## Tool
23
44
 
24
- ## Tool rendering
45
+ <img src="../../assets/tools/run_check.png" alt="The run_check transcript block: a status summary and two failure rows under a rail" width="100%">
46
+
47
+ `run_check` — direct exposure (the default), `executionMode: "sequential"`,
48
+ annotations `readOnlyHint: false`, `destructiveHint: false`,
49
+ `openWorldHint: false`. It takes one optional parameter:
50
+
51
+ | Parameter | Type | Meaning |
52
+ |---|---|---|
53
+ | `target` | `test` \| `lint` \| `typecheck` \| `all` | Which command to run; defaults to `all`. |
54
+
55
+ Result (`details` / `structuredContent`): `{ target, status, commands, exitCode,
56
+ durationMs, truncated, failures[] }`. `details` also carries the bounded `tail`,
57
+ which the transcript block reads and the structured mirror deliberately omits.
58
+
59
+ `content` is a short summary plus up to 20 failures. A failing check is a normal
60
+ result (`isError: false`) so the model can fix it; a check that cannot run — no
61
+ detected command, a spawn failure, or another run already active — is an error
62
+ with the corrective action.
25
63
 
26
64
  The call line is `run_check <target>`. While the command runs, the result is one
27
65
  line — `Running bun run check… · 12s` — and it repaints once a second, so a
@@ -30,47 +68,19 @@ a capped view of the run: a status summary, at most five failure rows, and the
30
68
  bounded tail when nothing parsed. `ctrl+o` expands it to the model's 20-failure
31
69
  cap; `/check` remains the full navigable list.
32
70
 
33
- <img src="../../assets/tools/run_check.png" alt="The run_check transcript block: a status summary and two failure rows under a rail" width="100%">
34
-
35
71
  A failed command whose output parsed no location names the exit status in the
36
72
  summary, prints `no parsed failure; last output:`, and shows the last five tail
37
73
  lines instead of an exit-status row. The transcript never prints the model
38
74
  report; the full failure list and the tail stay in `details`.
39
75
 
40
- ## What it does
41
-
42
- - **Detects a command** from `package.json`, `Cargo.toml`, `go.mod`, a pytest
43
- configuration, a `justfile`, or a `Makefile`, or uses `check.command`.
44
- - **Runs it in a supervised process** with a wall-clock timeout and a bounded
45
- log; `Esc` cancels the process tree.
46
- - **Shows a live tail** while the command runs, then a failure list with a
47
- detail view for the focused failure: a source excerpt around `path:line` when
48
- the file is readable, otherwise the bounded tail.
49
- - **Returns structured failures** to the model with `path`, `line`, `column`,
50
- `test`, `message`, and `command`.
51
- - **Falls back honestly**: a failed command with no recognizable failure becomes
52
- one “Command exited with status N” entry, with the bounded tail in its detail.
53
- - **One line on success**: `Check passed: bun run check · 12.4s`.
54
-
55
- ## Tool
76
+ ## Commands
56
77
 
57
- `run_check` takes optional `target`:
58
-
59
- | Field | Value |
60
- |---|---|
61
- | `target` | `test`, `lint`, `typecheck`, or `all`; defaults to `all`. |
62
- | `exposure` | `direct`, active by default. |
63
- | `executionMode` | `sequential` — one run owns the process and the live buffer. |
64
- | `annotations` | `readOnlyHint: false`, `destructiveHint: false`, `openWorldHint: false`. |
65
- | `outputSchema` | `{ target, status, commands, exitCode, durationMs, truncated, failures[] }`, mirrored by `structuredContent`. |
78
+ `/check [target]` runs one target, or every detected command, with the same
79
+ timeout, bounded log, and failure list as `run_check`.
66
80
 
67
- `content` is a short summary plus up to 20 failures. `details` carries the full
68
- bounded failure list and the tail, which the transcript block reads. A failing
69
- check is a normal result (`isError: false`) so the model can fix it; a check
70
- that cannot run — no detected command, a spawn failure, or another run already
71
- active — is an error with the corrective action.
81
+ <img src="../../assets/screens/check.png" alt="The /check screen: a failed run with failure rows and the focused failure's message" width="100%">
72
82
 
73
- ## Command
83
+ <img src="../../assets/screens/check-detail.png" alt="The /check failure detail: the location and message over a source excerpt with the failing line marked by >" width="100%">
74
84
 
75
85
  | Command | What it does |
76
86
  |---|---|
@@ -80,23 +90,27 @@ active — is an error with the corrective action.
80
90
  | `/check typecheck` | Run the detected typecheck command. |
81
91
  | `/check all` | Same as `/check`. |
82
92
 
83
- `getArgumentCompletions` offers the four targets. The command refuses while plan
84
- mode is on: relying on tests is still writing to the project (caches, snapshots,
85
- generated files), so the plan must be approved first.
93
+ `getArgumentCompletions` offers the four targets. In the TUI the run screen
94
+ shows a scrolling tail and `Esc cancel`; a failed run then opens the failure
95
+ list, where `Enter` opens the focused failure's detail, `r` reruns, and `Esc`
96
+ closes. The command refuses while plan mode is on: relying on tests is still
97
+ writing to the project (caches, snapshots, generated files), so the plan must be
98
+ approved first.
86
99
 
87
100
  ## Behaviour by mode
88
101
 
89
102
  | Mode | Behaviour |
90
103
  |---|---|
91
- | Interactive TUI | A live run screen with a scrolling tail and `Esc cancel`; then a failure list with `Enter` detail, `r` rerun, and `Esc` close. A pass posts one notice. |
92
- | RPC (`hasUI`) | Runs headless and posts the summary plus the failure list; no custom screen. |
104
+ | Interactive TUI | The run screen, then the failure list; a pass posts one notice. |
105
+ | RPC | Runs headless and posts the summary plus the failure list; no custom screen. |
93
106
  | `print` / `json` | Runs headless and posts the same report. |
94
107
  | `run_check` | No UI of its own. Returns the summary in `content`, the structured result, and a capped transcript block drawn from `details`. |
95
108
 
96
109
  ## Configuration
97
110
 
98
- The `check` section of the shared `bytefly.json` (global then project, project
99
- wins). All keys are JSON-only; none has a `/bytefly settings` row.
111
+ The `check` section of the shared `bytefly.json`; resolution rules are in
112
+ [`../configuration.md`](../configuration.md#check--verification-runs). All keys
113
+ are JSON-only; none has a `/bytefly settings` row.
100
114
 
101
115
  | Key | Default | Bounds | Meaning |
102
116
  |---|---|---|---|
@@ -107,6 +121,19 @@ wins). All keys are JSON-only; none has a `/bytefly settings` row.
107
121
  `command` is the escape hatch for any stack without a detector. It is a shell
108
122
  command and runs with the project root as its working directory.
109
123
 
124
+ ## Security
125
+
126
+ `check` executes project scripts. That is the same trust boundary as running the
127
+ command yourself or letting the agent call `bash`: a project with a hostile
128
+ `test` script can do anything your user can do. The extension does not add a
129
+ sandbox. `/check` is user-invoked and refuses in plan mode; `run_check` declares
130
+ `readOnlyHint: false`, so a permission policy can gate it, and plan mode blocks
131
+ it.
132
+
133
+ The extension adds no network calls of its own. The command's environment is
134
+ made non-interactive (`CI=1`, `NO_COLOR=1`, `FORCE_COLOR=0`, `TERM=dumb`,
135
+ `GIT_PAGER=cat`, `PAGER=cat`).
136
+
110
137
  ## Detection
111
138
 
112
139
  Detection order stops at the first family that declares a command:
@@ -141,25 +168,12 @@ the fallback for everything else:
141
168
  | `File "path", line N, in test` | Python tracebacks |
142
169
  | `FAILED path::test - message` | pytest |
143
170
  | `--- FAIL: Test` and `path:line:` | Go |
144
- | `panicked at path:line` / `thread 'test'` | Cargo |
171
+ | `thread 'test' panicked at path:line` | Cargo |
145
172
  | anything else on a non-zero exit | one fallback entry with the bounded tail |
146
173
 
147
174
  Failures are deduped and capped at 200; the model report shows 20. A miss is
148
175
  never turned into an invented location.
149
176
 
150
- ## Security
151
-
152
- `check` executes project scripts. That is the same trust boundary as running the
153
- command yourself or letting the agent call `bash`: a project with a hostile
154
- `test` script can do anything your user can do. The extension does not add a
155
- sandbox. `/check` is user-invoked and refuses in plan mode; `run_check` declares
156
- `readOnlyHint: false`, so a permission policy can gate it, and plan mode blocks
157
- it.
158
-
159
- The extension adds no network calls of its own. The command's environment is
160
- made non-interactive (`CI=1`, `NO_COLOR=1`, `FORCE_COLOR=0`, `TERM=dumb`,
161
- `GIT_PAGER=cat`, `PAGER=cat`).
162
-
163
177
  ## Limitations
164
178
 
165
179
  - Detection covers the families above. Other stacks need `check.command`.
@@ -188,7 +202,7 @@ made non-interactive (`CI=1`, `NO_COLOR=1`, `FORCE_COLOR=0`, `TERM=dumb`,
188
202
 
189
203
  | Aspect | Contract |
190
204
  |---|---|
191
- | Registration | `check(pi)` guards on `isExtensionEnabled("check")` and calls `registerCheck(pi)`, which registers `run_check`, `/check`, and one `session_shutdown` hook. The factory only registers. |
205
+ | Registration | `checkExtension(pi)` guards on `isExtensionEnabled("check")` and calls `registerCheck(pi)`, which registers `run_check`, `/check`, and one `session_shutdown` hook. The factory only registers. |
192
206
  | Tool | `run_check`, `exposure: "direct"`, `executionMode: "sequential"`, annotations `{ readOnlyHint: false, destructiveHint: false, openWorldHint: false }`, TypeBox `parameters` and `outputSchema`, `structuredContent` mirror. |
193
207
  | Command | `/check [target]` with `getArgumentCompletions` for the four targets; reports through `ctx.ui.notify`. |
194
208
  | State | None persisted. The runtime closure owns the single active child, its controller, and the live line buffer; `session_shutdown` aborts it. |
@@ -249,5 +263,6 @@ Co-located tests cover config clamps, every detector family, the runner's
249
263
  streaming/timeout/cancel/log cap, the parsers, command planning, aggregation,
250
264
  the tool's output contract and transcript block, the command's guards and
251
265
  headless path, and both screens' keys and width bounds.
252
- `extensions/check/check.test.ts` runs a real Node script through the extension,
253
- so the process path is exercised without depending on Bun or a test framework.
266
+ `extensions/check/extension.test.ts` runs a real Node script through the
267
+ extension, so the process path is exercised without depending on Bun or a test
268
+ framework.
@@ -5,37 +5,41 @@ the conversation is too full, the report is where you decide to compact. It is
5
5
  command-only on purpose — no tool is declared, so the model's prompt budget is
6
6
  untouched.
7
7
 
8
+ ## Capabilities
9
+
10
+ Status records what a reader can rely on: **Shipped** is in a tagged release, **Unreleased** is complete in the current tree but not yet tagged, and **Partial** has one released part and one unreleased part. Rows are ordered by user value, highest first.
11
+
12
+ | Capability | How | What you get | Status |
13
+ |---|---|---|---|
14
+ | Window headline | `/context` | Pi's own estimate: tokens, window, percentage, free space, and the auto-compaction threshold with the headroom left before it. | Shipped |
15
+ | Composition breakdown | `/context` | Where the window went — system prompt, active tool definitions, the conversation by role, injected pack context, summaries, and shell output. | Shipped |
16
+ | Guarded compaction | `/context compact [instructions]`, `c` on the screen | Compact from the report without interrupting a streaming turn or a running compaction. | Shipped |
17
+ | Compact result | `/context compact` result | The before and after token counts are reported, so the effect of the compaction is visible. | Shipped |
18
+ | Honest drift | `/context` | The difference between Pi's total and the composition estimate, named instead of hidden by forcing the parts to add up. | Shipped |
19
+ | Compaction history | `/context` | How many compactions the branch has, what the newest one cut from and to, and what its summary costs. | Shipped |
20
+ | Largest messages | `/context` | The five largest single messages, so a report that is mostly one tool result says so. | Shipped |
21
+ | Gauge rendering | the `/context` screen | The window and composition bars show ten or eight cells, colored by role, instead of leaving the reader to infer the shape. | Shipped |
22
+ | Pending total | `/context` after a compaction | The report shows a pending total instead of a fabricated estimate while Pi recalculates the window. | Shipped |
23
+ | Mode coverage | `/context` | A scrollable screen in the TUI, the same facts as plain text in `rpc`, `json`, and `print`. | Shipped |
24
+
25
+ ## Quickstart
26
+
8
27
  ```bash
9
28
  pi --extension ./extensions/context # load just this extension
10
29
  pi -e . # load the whole @gavin-hu/my-pi-agent package
11
30
  pi install ./ # install the package
12
31
  ```
13
32
 
14
- ## What it does
15
-
16
- - Registers one command, `/context`. In the TUI it opens a docked screen; in
17
- `rpc`, `json`, and `print` it notifies the same facts as plain text.
18
- - Reports Pi's own estimate first — tokens, window, percentage, free space, the
19
- auto-compaction threshold, and the headroom left before it while compaction is
20
- on — then the composition under a header that names the composition's own
21
- estimate: the system prompt, the active tool definitions, the conversation by
22
- role, injected pack context grouped by type, summaries, and shell output.
23
- - Names the difference between Pi's total and the composition estimate instead
24
- of forcing the parts to add up: one line with both figures, `unattributed` when
25
- the host's total is the larger one, and `host counts messages only` before the
26
- first reply, when Pi's fallback leaves the prompt and the tools out.
27
- - Rounds each bar to the nearest cell, so a bar sits within half a cell of the
28
- percentage printed beside it; the percentage itself is exact.
29
- - Reads the branch's compaction history: how many compactions there have been,
30
- what the newest one cut from and to, and how much its summary costs.
31
- - Lists the five largest single messages, so a report that is mostly one tool
32
- result says so.
33
- - Compacts from the report: `c` on the screen asks first, `/context compact
34
- [instructions]` runs directly. Both refuse while the agent is busy — a
35
- streaming turn or a running compaction.
33
+ ```text
34
+ /context # the report
35
+ /context compact focus on the parser # compact from it, with instructions
36
+ ```
36
37
 
37
38
  ## Commands
38
39
 
40
+ One command, two forms: `/context` reports, `/context compact` acts on the
41
+ report.
42
+
39
43
  | Command | What it does |
40
44
  |---|---|
41
45
  | `/context` | The report: a screen in the TUI, a notification elsewhere |
@@ -67,6 +71,18 @@ largest messages. `/context compact` is the same in every mode and reports throu
67
71
 
68
72
  ## How the numbers are computed
69
73
 
74
+ The report gives Pi's own estimate first — tokens, window, percentage, free
75
+ space, the auto-compaction threshold, and the headroom left before it while
76
+ compaction is on — then the composition under a header that names the
77
+ composition's own estimate.
78
+
79
+ It names the difference between Pi's total and the composition estimate instead
80
+ of forcing the parts to add up: one line with both figures, `unattributed` when
81
+ the host's total is the larger one, and `host counts messages only` before the
82
+ first reply, when Pi's fallback leaves the prompt and the tools out. Each bar
83
+ rounds to the nearest cell, so a bar sits within half a cell of the percentage
84
+ printed beside it; the percentage itself is exact.
85
+
70
86
  | Row | Source |
71
87
  |---|---|
72
88
  | Headline (`tokens`, `percent`) | `ctx.getContextUsage()`: the last valid provider usage plus Pi's estimate of the messages after it. `tokens` is `null` between a compaction and the next successful reply, because the last usage describes the pre-compaction context. |
@@ -76,6 +92,7 @@ largest messages. `/context compact` is the same in every mode and reports throu
76
92
  | Tool definitions | `pi.getAllTools()` filtered to `pi.getActiveTools()`, over each active tool's name, description, and parameter schema at characters/4. `promptGuidelines` are counted in the system prompt instead, because Pi renders them into its rules section. |
77
93
  | Conversation rows | `sessionManager.buildSessionProjection().messages`, each counted with Pi's own `estimateTokens` (characters/4; an image is 4800 characters; a tool call is its name plus its JSON arguments). |
78
94
  | Injected context | `custom` messages grouped by `customType`, biggest first; the five largest types are named and the rest fold into one row. |
95
+ | Largest messages | The five highest `estimateTokens` values in the projection, each with its role and a bounded descriptor: a tool name, a custom type, a command, or the first line of text. |
79
96
  | Threshold | `compaction.modelOverrides["provider/id"]`, then `compaction`, then `DEFAULT_COMPACTION_SETTINGS` — the same three-step fallback Pi uses. |
80
97
  | Compaction history | `getLatestCompactionEntry(branch)` and the branch's `compaction` count. The summary's cost is the summary text at characters/4. |
81
98
  | Drift | `tokens - estimate`, printed with both figures. A positive value appends `+… unattributed` — usage the rows do not explain; a negative one appends `host counts messages only` while the projection holds no assistant message, because Pi's message-only fallback omits the system prompt and the tool definitions. |
@@ -119,7 +136,7 @@ largest messages. `/context compact` is the same in every mode and reports throu
119
136
 
120
137
  | Contract | Detail |
121
138
  |---|---|
122
- | Registration | The default export registers the `/context` command and nothing else. No tool, no flag, no shortcut, no session hook. |
139
+ | Registration | The default export registers the `/context` command and nothing else, behind the `PI_DISABLED_EXTENSIONS` gate. No tool, no flag, no shortcut, no session hook. |
123
140
  | Tool surface | None. Command-only, so there is no `promptSnippet`, `annotations`, `executionMode`, or `outputSchema`. |
124
141
  | Host reads | `ctx.getContextUsage()`, `ctx.getSystemPrompt()`, `ctx.model`, `ctx.isIdle()`, `ctx.sessionManager.buildSessionProjection()` / `getBranch()`, `pi.getActiveTools()` / `getAllTools()` / `getSettings()`. All in `collect.ts`. |
125
142
  | Action | `ctx.compact({ customInstructions, onComplete, onError })`. It is fire-and-forget; the callbacks repaint the screen or notify the command's caller. |