@thincoder/core 0.11.3 → 0.11.5

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 (183) hide show
  1. package/CHANGELOG.md +23 -0
  2. package/advisor/compaction.mjs +40 -17
  3. package/advisor/loop.mjs +14 -6
  4. package/advisor/notice.mjs +1 -1
  5. package/advisor/timeline.mjs +4 -4
  6. package/agent/completion.mjs +19 -0
  7. package/agent/dispatch-gates.mjs +2 -0
  8. package/agent/dispatch.mjs +2 -2
  9. package/agent/family-tools.mjs +13 -9
  10. package/agent/helpers.mjs +10 -6
  11. package/agent/planning-step.mjs +453 -0
  12. package/agent/post-turn.mjs +70 -2
  13. package/agent/run-stages.mjs +22 -50
  14. package/agent/run-start.mjs +17 -0
  15. package/agent/setup-reminders.mjs +71 -8
  16. package/agent/setup.mjs +8 -39
  17. package/agent/spawn-child.mjs +6 -2
  18. package/agent/task-lifecycle.mjs +146 -0
  19. package/agent/turn-loop.mjs +73 -11
  20. package/agent-tools/batch-closeout.mjs +21 -34
  21. package/agent-tools/batch-gate.mjs +7 -5
  22. package/agent-tools/batch-ledger-bind.mjs +21 -1
  23. package/agent-tools/batch-lifecycle.mjs +7 -7
  24. package/agent-tools/batch-record-write.mjs +237 -280
  25. package/agent-tools/batch-supersede.mjs +3 -3
  26. package/agent-tools/batch.mjs +42 -9
  27. package/agent-tools/context.mjs +0 -13
  28. package/agent-tools/escalate-async.mjs +7 -1
  29. package/agent-tools/parent-channel.mjs +7 -6
  30. package/agent-tools/plan.mjs +103 -67
  31. package/agent-tools/review-facts.mjs +3 -3
  32. package/agent-tools/settings.mjs +2 -0
  33. package/agent-tools/spawn-gates.mjs +37 -11
  34. package/agent-tools/ssh-session.mjs +68 -25
  35. package/agent-tools/ssh-transfer.mjs +7 -2
  36. package/agent-tools/ssh-transport.mjs +2 -2
  37. package/agent-tools/ssh-vault.mjs +2 -2
  38. package/agent-tools/step.mjs +462 -0
  39. package/agent-tools/subagent-actions.mjs +6 -1
  40. package/agent-tools/subagent-run.mjs +7 -0
  41. package/agent-tools/subagent-spawn.mjs +1 -1
  42. package/agent-tools/subagent.mjs +17 -11
  43. package/agent-tools/task.mjs +178 -26
  44. package/agent-tools.mjs +1 -0
  45. package/agent.mjs +2 -0
  46. package/config-defaults.mjs +17 -1
  47. package/config-migrate.mjs +8 -5
  48. package/config.mjs +7 -0
  49. package/context.mjs +5 -4
  50. package/declaration.mjs +4 -4
  51. package/generate-title.mjs +0 -6
  52. package/i18n.mjs +4 -0
  53. package/ledger-cmd.mjs +11 -1
  54. package/ledger-tools.mjs +15 -4
  55. package/manifest-schema.mjs +1 -0
  56. package/model-context.mjs +34 -11
  57. package/model-specs.mjs +5 -2
  58. package/package.json +1 -1
  59. package/prompt-files.mjs +48 -11
  60. package/prompt-overlays.mjs +79 -8
  61. package/prompts/advisor-design.md +253 -206
  62. package/prompts/advisor-round1.md +151 -145
  63. package/prompts/advisor-round2.md +136 -130
  64. package/prompts/advisor-round3.md +140 -134
  65. package/prompts/common.md +244 -96
  66. package/prompts/consult-base.md +29 -30
  67. package/prompts/discipline-engineering.md +73 -519
  68. package/prompts/discipline-normal.md +28 -136
  69. package/prompts/knowledge/batch-before-write.md +8 -0
  70. package/prompts/knowledge/batch-cycle-register.md +15 -0
  71. package/prompts/knowledge/batch-progress-ledger.md +29 -0
  72. package/prompts/knowledge/business-gates.md +24 -24
  73. package/prompts/knowledge/decision-quality.md +8 -19
  74. package/prompts/knowledge/doc-discipline-d-rules.md +63 -0
  75. package/prompts/knowledge/doc-lookup.md +25 -24
  76. package/prompts/knowledge/document-writing.md +11 -32
  77. package/prompts/knowledge/documentation-evaluation.md +42 -42
  78. package/prompts/knowledge/eng-dispatch-ops.md +34 -0
  79. package/prompts/knowledge/eng-ledger-ops.md +26 -0
  80. package/prompts/knowledge/evidence-discipline.md +10 -32
  81. package/prompts/knowledge/normal-batch-discipline.md +13 -0
  82. package/prompts/knowledge/normal-coding-workflow.md +97 -99
  83. package/prompts/knowledge/normal-delivery-collaboration.md +107 -112
  84. package/prompts/knowledge/normal-work-management.md +44 -44
  85. package/prompts/knowledge/product-security.md +7 -26
  86. package/prompts/knowledge/project-records.md +69 -64
  87. package/prompts/knowledge/tool-advisor.md +17 -17
  88. package/prompts/knowledge/tool-apply-patch.md +14 -14
  89. package/prompts/knowledge/tool-bash.md +32 -31
  90. package/prompts/knowledge/tool-batch-eng-coder.md +19 -13
  91. package/prompts/knowledge/tool-batch-eng-designer.md +21 -14
  92. package/prompts/knowledge/tool-batch-review.md +18 -12
  93. package/prompts/knowledge/tool-batch.md +93 -85
  94. package/prompts/knowledge/tool-browser.md +59 -59
  95. package/prompts/knowledge/tool-code-search.md +2 -2
  96. package/prompts/knowledge/tool-consult-start.md +6 -6
  97. package/prompts/knowledge/tool-consult-stop.md +3 -3
  98. package/prompts/knowledge/tool-context.md +4 -4
  99. package/prompts/knowledge/tool-delete.md +16 -16
  100. package/prompts/knowledge/tool-doc-check.md +39 -39
  101. package/prompts/knowledge/tool-doc-graph-read.md +11 -11
  102. package/prompts/knowledge/tool-doc-graph.md +48 -48
  103. package/prompts/knowledge/tool-doc-search.md +3 -3
  104. package/prompts/knowledge/tool-edit.md +30 -30
  105. package/prompts/knowledge/tool-eng.md +1 -1
  106. package/prompts/knowledge/tool-execute.md +16 -16
  107. package/prompts/knowledge/tool-fetch.md +15 -15
  108. package/prompts/knowledge/tool-file-ops.md +15 -15
  109. package/prompts/knowledge/tool-get-current-time.md +3 -3
  110. package/prompts/knowledge/tool-git-read.md +15 -15
  111. package/prompts/knowledge/tool-git.md +26 -26
  112. package/prompts/knowledge/tool-glob.md +14 -14
  113. package/prompts/knowledge/tool-goal.md +5 -5
  114. package/prompts/knowledge/tool-grep.md +19 -18
  115. package/prompts/knowledge/tool-hashline-edit.md +13 -13
  116. package/prompts/knowledge/tool-insert-after.md +14 -14
  117. package/prompts/knowledge/tool-instance-list.md +3 -3
  118. package/prompts/knowledge/tool-instance-send.md +5 -5
  119. package/prompts/knowledge/tool-knowledge.md +12 -12
  120. package/prompts/knowledge/tool-ledger-read.md +20 -20
  121. package/prompts/knowledge/tool-ledger.md +44 -44
  122. package/prompts/knowledge/tool-lint.md +10 -10
  123. package/prompts/knowledge/tool-ls.md +11 -11
  124. package/prompts/knowledge/tool-lsp.md +8 -8
  125. package/prompts/knowledge/tool-main-history.md +1 -1
  126. package/prompts/knowledge/tool-manifest-read.md +7 -7
  127. package/prompts/knowledge/tool-manifest.md +43 -32
  128. package/prompts/knowledge/tool-memory-read.md +12 -12
  129. package/prompts/knowledge/tool-memory.md +14 -14
  130. package/prompts/knowledge/tool-notify-parent.md +10 -10
  131. package/prompts/knowledge/tool-operations.md +88 -88
  132. package/prompts/knowledge/tool-peek.md +10 -0
  133. package/prompts/knowledge/tool-peer-instances.md +1 -1
  134. package/prompts/knowledge/tool-plan.md +6 -3
  135. package/prompts/knowledge/tool-process-read.md +8 -8
  136. package/prompts/knowledge/tool-process.md +11 -11
  137. package/prompts/knowledge/tool-question.md +11 -13
  138. package/prompts/knowledge/tool-read-history-batch.md +13 -13
  139. package/prompts/knowledge/tool-read-history.md +19 -19
  140. package/prompts/knowledge/tool-read-image.md +8 -8
  141. package/prompts/knowledge/tool-read.md +17 -17
  142. package/prompts/knowledge/tool-recent-changes.md +4 -4
  143. package/prompts/knowledge/tool-repo-outline.md +2 -2
  144. package/prompts/knowledge/tool-settings-read.md +5 -7
  145. package/prompts/knowledge/tool-settings.md +10 -10
  146. package/prompts/knowledge/tool-skill.md +4 -4
  147. package/prompts/knowledge/tool-ssh.md +66 -66
  148. package/prompts/knowledge/tool-step.md +26 -0
  149. package/prompts/knowledge/tool-subagent.md +52 -50
  150. package/prompts/knowledge/tool-task.md +14 -11
  151. package/prompts/knowledge/tool-team-ledger-read.md +7 -7
  152. package/prompts/knowledge/tool-team-ledger.md +13 -13
  153. package/prompts/knowledge/tool-timer.md +14 -14
  154. package/prompts/knowledge/tool-tree.md +11 -11
  155. package/prompts/knowledge/tool-verify.md +11 -11
  156. package/prompts/knowledge/tool-wait-for.md +20 -20
  157. package/prompts/knowledge/tool-websearch.md +16 -14
  158. package/prompts/knowledge/tool-write.md +10 -10
  159. package/prompts/knowledge/upstream-protocol.md +37 -38
  160. package/prompts/persona-coder.md +22 -22
  161. package/prompts/persona-eng-coder.md +87 -81
  162. package/prompts/persona-eng-designer.md +173 -153
  163. package/prompts/persona-engineering.md +53 -554
  164. package/prompts/persona-explore.md +18 -15
  165. package/prompts/persona-normal.md +62 -63
  166. package/prompts/persona-plan.md +36 -32
  167. package/prompts/persona-tester.md +39 -39
  168. package/prompts/planning-next-moves.md +9 -0
  169. package/prompts/subagent-base.md +4 -16
  170. package/provider/errors.mjs +0 -24
  171. package/provider/list-models.mjs +20 -2
  172. package/session-lifecycle.mjs +4 -3
  173. package/tool-args.mjs +25 -0
  174. package/tool-docs/peek.md +3 -0
  175. package/tool-docs/plan.md +1 -1
  176. package/tool-docs/question.md +1 -1
  177. package/tool-docs/step.md +3 -0
  178. package/tools/edit-diff.mjs +4 -4
  179. package/tools/index.mjs +3 -2
  180. package/tools/peek.mjs +447 -0
  181. package/tools/question.mjs +87 -9
  182. package/tools/ssh.mjs +1 -1
  183. package/window-policy.mjs +107 -80
@@ -1,74 +1,74 @@
1
1
  aliases: 远程, 网络设备, 登录
2
- A session survives across tool calls. Password hosts get a credential window, or reuse a saved credential silently — the value never appears in tool args or results.
2
+ 会话跨工具调用存活。密码主机要么弹出一个凭据窗口,要么静默复用已存的凭据 —— 那个值绝不出现在工具参数或结果里。
3
3
 
4
- **Route to ssh instead of bash:**
5
- - a one-shot non-interactive command over ssh on a key / ssh-agent host → `bash` with `ssh host <command>` (cheaper, no session); a password host takes the session's long wait instead
6
- - an interactive shell that must survive several calls (network device CLI, interactive prompts) → ssh
7
- - one file to or from a host you already have a session on → `put` / `get` (they reuse the session's host and credential chain, which `bash scp` cannot reach)
8
- - a whole directory tree, a resumable transfer or a progress bar → not this tool (single file only)
9
- - port forwarding (`ssh -L` / `-R`) → `bash`
4
+ **改用 ssh,而不是 bash:**
5
+ - 在 key / ssh-agent 主机上跑一条一次性、非交互的 ssh 命令 → `bash` 里 `ssh host <command>`(更便宜,不起会话);密码主机改为走会话的长等待
6
+ - 必须活过几次调用的交互式 shell(网络设备 CLI、交互式提示)→ ssh
7
+ - 一个文件往来于你已有会话的主机 → `put` / `get`(它们复用会话的主机与凭据链,`bash scp` 够不到)
8
+ - 整棵目录树、可续传的传输或进度条 → 不是这个工具(只支持单个文件)
9
+ - 端口转发(`ssh -L` / `-R`)→ `bash`
10
10
 
11
- **Long waits:**
12
- - Two triggers: the wait is expected to run past 30 seconds, or two consecutive reads of the same observation show no change.
13
- Either one means change shape — never send the next identical read of that observation.
14
- - Key or ssh-agent host (a connect that showed no credential window and reused no saved credential): run the wait as a `bash` background task (`async`).
15
- It returns an ack at once and opens a round with the result when the process exits.
16
- - Password host (a connect that showed the credential window, or one that reused a saved credential): keep the session and wait once — `send` with a large enough `timeoutMs`.
17
- `timeoutMs` bounds that wait, so give the remote command a hard bound of its own that makes it return.
18
- - Never run `bash ssh` against a password host: that shell has no terminal, the password prompt has nowhere to answer, and the process hangs.
19
- - The auth face is known only after the first connect: reach an untouched host with the session `connect`, then split by auth face from its next wait on.
11
+ **长等待:**
12
+ - 两个触发器:预计这次等待会超过 30 秒,或对同一观察连续两次读取毫无变化。
13
+ 任一条成立就意味着换形状 —— 绝不发出对该观察的下一次相同读取。
14
+ - key 或 ssh-agent 主机(连接时没弹凭据窗口、也没复用已存凭据):把等待作为 `bash` 后台任务跑(`async`)。
15
+ 它立即返回一个确认,并在进程退出时开一轮带结果的对话。
16
+ - 密码主机(连接时弹了凭据窗口,或复用了已存凭据):留着会话,等一次 —— 用 `send` 配一个足够大的 `timeoutMs`。
17
+ `timeoutMs` 给那次等待封顶,所以给远端命令它自己的硬性时限,让它能返回。
18
+ - 绝不对密码主机跑 `bash ssh`:那个 shell 没有终端,密码提示无处作答,进程会挂住。
19
+ - 认证面只有在第一次连接之后才知道:对一个没碰过的主机用会话 `connect`,从它下一次等待起再按认证面分流。
20
20
 
21
- **Session reuse:**
22
- - `list` before `connect`: reuse the live session for that host through its `ssh#N`, and `connect` only when `list` shows no session for the host.
23
- - Never keep a second session on a host that already has one.
24
- - `close` when the task ends; do not leave it to the idle sweep.
25
- - When the session id is lost, take it back from `list` instead of reconnecting.
26
- - A `connect` refused because the pool is full names every live session: `close` one of those and continue.
27
- A retry meets the same refusal and frees nothing.
28
- - When a long wait outlives the round, end the round with user-facing text that says what you are waiting for and what wakes you.
29
- A long wait is no exception to that close.
30
- - A subagent has neither this tool nor the background channel: hand the long wait up to the parent instead of polling in its own layer.
21
+ **会话复用:**
22
+ - `connect` 之前先 `list`:用那个主机的活会话,经它的 `ssh#N` 复用;只在 `list` 显示该主机没有会话时才 `connect`。
23
+ - 一个主机已经有一个会话时,绝不保留第二个。
24
+ - 任务结束时 `close`;不要留给空闲清扫。
25
+ - 会话 id 丢了时,从 `list` 取回来,而不是重连。
26
+ - 因池满被拒绝的一次 `connect` 会指名每一个活会话:`close` 其中一个再继续。
27
+ 重试会遇到同一个拒绝,什么也腾不出来。
28
+ - 一次长等待活过了这一轮时,用面向用户的文字结束这一轮,说明你在等什么、什么会唤醒你。
29
+ 长等待不是那条收尾的例外。
30
+ - 子代理有 `ssh`,但它开出来的会话住自己的池(与主会话那 4 格互不相干),结清时排空;它没有后台通道(`bash` 的 `async` 只在 depth 0),所以长等待仍上抛父侧,不在自己那一层轮询。
31
31
 
32
- Parameters:
33
- - action (required): connect | send | read | secret_input | close | list | credentials | forget | put | get
34
- - host: connect / forget — target host (IP or name)
35
- - user: connect — login user (optional: your local ssh config decides, else the user recorded for this host locally)
36
- - port: connect / forget — TCP port (optional, default 22)
37
- - label: connect — short human label for this session (optional); secret_input — label for the value being sent
38
- - promptPattern: connect — regex marking the shell prompt as ready (optional). Give it when the device's prompt does not look like a shell prompt, or every command waits out the full timeout. Left out, a line ending in `#` `>` `$` `%` counts as the prompt.
39
- - identityFile: connect — private-key path to offer as `-i` (`~` expands); remembered for this host and reused when omitted (optional)
40
- - id: send / read / secret_input / close / put / get — session id from connect (`ssh#N`)
41
- - data: send — text to type into the session (a trailing newline is passed as-is; otherwise Enter is sent as `\r`)
42
- - settle: send — wait for the ready verdict before returning (default true); false returns right after the bytes are written
43
- - timeoutMs: send / read — wait budget override (default 60000; the wait ends as soon as the device waits for input — a prompt, `--More--`, a y/n or password prompt); put / get — transfer budget override (default 600000; on expiry the process tree is killed)
44
- - maxChars: read — return-window override (default 8000): head 60% + a note + tail 40%, and the omitted middle stays in the session for the next read
45
- - localPath: put / get — local file path (`~` expands; a file, never a directory)
46
- - remotePath: put / get — path of that file on the session host (e.g. `/flash/img.bin`)
47
- - overwrite: get — replace an existing local file (default false: an existing target is refused, never overwritten silently). put follows scp's own semantics: a same-named remote file is replaced
48
- - protocol: put / get — `scp` (classic SCP protocol, the default, what network devices speak) | `sftp` (for hosts that only offer that). No automatic fallback between them
49
- - ledger: the in-flight ledger row this call serves — `"#N"` or `"N"`. `ledger` is needed on `get` only — `get` writes into the project, `put` writes the remote host.
32
+ 参数:
33
+ - action(必填):connect | send | read | secret_input | close | list | credentials | forget | put | get
34
+ - host:connect / forget —— 目标主机(IP 或名字)
35
+ - user:connect —— 登录用户(可选:由你本地的 ssh 配置决定,否则用本地为该主机记录的用户)
36
+ - port:connect / forget —— TCP 端口(可选,默认 22)
37
+ - label:connect —— 这个会话的简短人读标签(可选);secret_input —— 正在发送的那个值的标签
38
+ - promptPattern:connect —— 把 shell 提示判为就绪的正则(可选)。设备的提示不像 shell 提示、或每条命令都要等满超时才给它。不写时,以 `#` `>` `$` `%` 结尾的一行算作提示。
39
+ - identityFile:connect —— 作为 `-i` 提供的私钥路径(`~` 会展开);为该主机记住,省略时复用它(可选)
40
+ - id:send / read / secret_input / close / put / get —— 来自 connect 的会话 id(`ssh#N`)
41
+ - data:send —— 敲进会话的文本(末尾换行原样传入;否则按 `\r` 发出 Enter)
42
+ - settle:send —— 返回之前等就绪裁决(默认 true);false 则在字节写出之后立即返回
43
+ - timeoutMs:send / read —— 覆盖等待预算(默认 60000;设备一旦等你输入,等待就结束 —— 一个提示、`--More--`、y/n 或密码提示);put / get —— 覆盖传输预算(默认 600000;到期即杀掉进程树)
44
+ - maxChars:read —— 覆盖返回窗口(默认 8000):头部 60% + 一句说明 + 尾部 40%,被略去的中间留在会话里,供下一次读取
45
+ - localPath:put / get —— 本地文件路径(`~` 会展开;只能是文件,绝不是目录)
46
+ - remotePath:put / get —— 那个文件在会话主机上的路径(例如 `/flash/img.bin`)
47
+ - overwrite:get —— 替换一个已存在的本地文件(默认 false:已存在的目标被拒绝,绝不静默覆盖)。put 遵循 scp 自己的语义:同名远端文件被替换
48
+ - protocol:put / get —— `scp`(经典 SCP 协议,默认,网络设备说的就是它)| `sftp`(供只提供那种协议的主机)。两者之间没有自动回退
49
+ - ledger:这次调用所服务的在途台账行 —— `"#N"` 或 `"N"`。`ledger` 只在 `get` 上需要 —— `get` 写进项目,`put` 写远端主机。
50
50
 
51
- Output:
52
- - connect / send / read / secret_input / close / list / put / get start with the session status line: `[ssh (ssh#3) 10.0.0.5 — ready · idle 3s]`
53
- - connect returns the first screen; send returns the round's output plus the ready verdict (answer prompt such as `--More--` | prompt matched | timeout); read returns what arrived since the last read
54
- - put / get return the status line, then exactly one more line — `put <localPath> → <remotePath> · N bytes · exit 0` (mirrored for get). The file's content never enters context: the bytes travel over the disk only, never through a result, a log or a message. On failure you get an `Error:` line plus the tail of scp's stderr — its last 600 characters, absent when stderr is empty, and escaped for markup after the cut, so the tail you read can run past 600 characters. The exit code is named only when the failure matches no known class — an auth failure or another recognised class reports that class's message instead.
51
+ 输出:
52
+ - connect / send / read / secret_input / close / list / put / get 都以会话状态行开头:`[ssh (ssh#3) 10.0.0.5 — ready · idle 3s]`
53
+ - connect 返回第一屏;send 返回这一轮输出加就绪裁决(`--More--` 之类的应答提示 | 提示匹配 | 超时);read 返回自上次读取以来到达的内容
54
+ - put / get 返回状态行,然后恰好再一行 —— `put <localPath> → <remotePath> · N bytes · exit 0`(get 与之镜像)。文件内容永不进入上下文:字节只经由磁盘旅行,绝不经过结果、日志或消息。失败时你得到一行 `Error:` 加 scp stderr 的尾部 —— 它的最后 600 个字符,stderr 为空时缺席,且截取之后又做了标记转义,所以你读到的尾部可能超过 600 字符。退出码只在失败不匹配任何已知类别时才被指名 —— 认证失败或其他已识别的类别改报该类别的信息。
55
55
 
56
- Notes:
57
- - Key-first: keys, your ssh config and ssh-agent are always tried before any saved credential, so a connect succeeds without a window when a key works. To make a password host prompt-free, install a key once: `ssh-keygen -t ed25519` (if you have none), then `ssh-copy-id user@host`, then reconnect.
58
- - Credential discipline: the password is asked for in a window and reaches ssh only through its child-process environment — never echoed in a result, never stored in plaintext. Any captured output containing that value (or a value given to secret_input) is scrubbed from the returned text and the session log.
59
- - Saving a credential is opt-in and belongs to `connect`: the window carries a `save` checkbox (off by default). When checked and authentication succeeds, the password is stored encrypted under your OS user account in a per-user file outside the repository and reused silently — the next connect skips the window, and only after key authentication fails. Another process running as the same logged-in user could decrypt it. Saving is Windows-only for now; elsewhere the checkbox does not appear.
60
- - Fail-soft: an unreadable or undecryptable entry, a damaged store or a missing backend falls back to the credential window (the connection is not broken, and undecryptable entries are kept). If the server rejects a saved credential it is deleted and the window is shown. A failed save never affects the connection.
61
- - secret_input is for device prompts (enable password, sudo, key passphrases): it opens the same kind of window, writes the value plus Enter, and returns only the output — the value is never shown.
62
- - Sessions: at most 4 live at once (a connect beyond the cap is refused — close one first). A session idle for 600s with no send/read closes automatically. `close` ends it. Ctrl+I (interrupt) does not kill sessions; a user Stop does.
63
- - Output is a cleaned text stream: terminal escape sequences and CRLF noise are stripped. Each return is a window (8000 chars: head + a note + tail); the omitted middle stays in the session, so another read collects it and a large configuration comes back in full.
64
- - Not for full-screen terminal UIs (vim/top/screen): output is read as a text stream — paged output such as `--More--` is shown as-is, not driven for you.
65
- - Transfers are binary safe and single-file: no recursive directory sync, no resume, no progress bar, and the parameters take files only (a directory is not a valid `localPath` / `remotePath`).
66
- - `get` never overwrites silently and never creates directories: an existing local file is refused unless you pass `overwrite:true`, and the local parent directory must already exist.
67
- - `put` on a password host runs the same credential decision as connect: keys first, then the saved credential (no window), then the credential window. That window asks for user / password only and carries no save checkbox; a session built by typing a password without saving keeps no password, so the next transfer asks again.
68
- - A transfer killed at `timeoutMs`: a `get` removes the partial local file only when that transfer wrote it (an existing file scp never touched is kept, and the receipt says so); after a `put` the remote host may keep a partial file — resend the whole file with `overwrite:true`, or delete it on the host.
69
- - Ready means the device waits for you, not that output stopped: a prompt or an answer prompt (`--More--`, y/n, password) ends the wait, and a slow operation that goes quiet keeps waiting instead of returning half its output.
70
- - Host keys follow your local ssh config — the tool never rewrites known_hosts. A changed or untrusted key stops the connect with a readable error before any credential is asked for.
71
- - read / list / credentials are read-only (no approval prompt); connect / send / secret_input / close / forget / put / get pass the approval gate like any side-effecting tool, and secret_input shows a masked placeholder — the value itself is never in the approval text. A transfer's approval text names both ends (`localPath` → `remotePath`), never the file's content.
72
- - credentials lists saved entries (host / user / saved / last used — never a value); forget deletes the entry for a host (and optional port) and is idempotent — the next connect asks in the window again.
56
+ 注意:
57
+ - key 优先:key、你的 ssh 配置与 ssh-agent 总是先于任何已存凭据被尝试,所以 key 能用时,连接无需窗口即可成功。要让密码主机免提示,装一次 key:`ssh-keygen -t ed25519`(如果你还没有),然后 `ssh-copy-id user@host`,再重连。
58
+ - 凭据纪律:密码在窗口里询问,只经它的子进程环境到达 ssh —— 绝不在结果里回显,绝不明文存储。任何包含该值(或给过 secret_input 的值)的捕获输出,都会从返回文本与会话日志里擦掉。
59
+ - 保存凭据是选择加入的,属于 `connect`:窗口带一个 `save` 复选框(默认关)。勾选且认证成功时,密码以加密形式存到你的操作系统用户账户下、仓库之外的一个按用户划分的文件里,并静默复用 —— 下一次连接跳过窗口,且只在 key 认证失败之后。以同一登录用户身份运行的另一个进程可能解密它。保存目前仅 Windows 可用;其他地方不出现该复选框。
60
+ - 软失败:一条读不出或解不开的条目、一份损坏的存储或缺失的后端,都回落到凭据窗口(连接不被打断,解不开的条目被保留)。服务器拒绝一条已存凭据时,它被删除并显示窗口。保存失败绝不影响连接。
61
+ - secret_input 用于设备提示(enable 密码、sudo、密钥口令):它打开同一种窗口,写入值加 Enter,只返回输出 —— 值从不显示。
62
+ - 会话:最多同时 4 个(超出上限的 connect 被拒绝 —— 先关一个)。空闲 600 秒且没有 send/read 的会话自动关闭。`close` 结束它。Ctrl+I(打断)不杀会话;用户 Stop 会。
63
+ - 输出是清理过的文本流:终端转义序列与 CRLF 噪声被剥掉。每次返回是一个窗口(8000 字符:头部 + 一句说明 + 尾部);被略去的中间留在会话里,所以再读一次就收齐它,一份大配置可以完整取回。
64
+ - 不适用于全屏终端 UI(vim/top/screen):输出按文本流读取 —— `--More--` 这类分页输出原样显示,不替你驱动。
65
+ - 传输是二进制安全且单文件的:没有递归目录同步、没有续传、没有进度条,且这些参数只收文件(目录不是合法的 `localPath` / `remotePath`)。
66
+ - `get` 绝不静默覆盖、也绝不建目录:已存在的本地文件被拒绝,除非你传 `overwrite:true`,且本地父目录必须已经存在。
67
+ - 密码主机上的 `put` 与 connect 走同一套凭据决策:先 key,再已存凭据(无窗口),再凭据窗口。那个窗口只问 user / 密码,不带 save 复选框;一个靠输入密码而不保存建起的会话不留密码,所以下一次传输会再问。
68
+ - 在 `timeoutMs` 被杀掉的一次传输:`get` 只在这次传输写过那个部分本地文件时才删它(scp 从未碰过的已存在文件被保留,回执会说明);`put` 之后远端主机可能留下一个部分文件 —— 用 `overwrite:true` 重发整个文件,或在主机上删掉它。
69
+ - 就绪意味着设备在等你,不是输出停了:一个提示或应答提示(`--More--`、y/n、密码)结束等待,而一个安静下来的慢操作会继续等,而不是只返回一半输出。
70
+ - 主机 key 遵循你本地的 ssh 配置 —— 工具绝不改写 known_hosts。变更过或不受信任的 key 会在任何凭据被询问之前以一条可读的错误停住连接。
71
+ - read / list / credentials 是只读的(无审批提示);connect / send / secret_input / close / forget / put / get 与其他有副作用的工具一样过审批闸,secret_input 显示一个打码的占位符 —— 值本身绝不在审批文本里。一次传输的审批文本指名两端(`localPath` → `remotePath`),绝不指名文件内容。
72
+ - credentials 列出已存的条目(host / user / saved / last used —— 绝不含值);forget 删掉某个主机(以及可选端口)的条目,并且是幂等的 —— 下一次连接会在窗口里再问。
73
73
 
74
- Availability: where the end has no UI to collect a credential (headless / ACP), connecting to a password host fails with a readable error — use keys or an ssh-agent there.
74
+ 可用性:末端没有 UI 收集凭据的地方(无头 / ACP),连密码主机会以一条可读的错误失败 —— 在那里用 key 或 ssh-agent。
@@ -0,0 +1,26 @@
1
+ # `step` — 分叉上下文微步执行器
2
+
3
+ `step` 介于普通单次工具与独立 `subagent` 之间:它从主会话当前实时上下文分叉出一个独立多轮微循环,内部可连续读文件、查代码、改代码并跑定向验证;过程中的一切试错与大段工具输出**只留在分叉内**,不进入主会话历史,最后只把精炼结论作为单条工具结果返回给主会话。
4
+
5
+ 因为分叉原样复用主会话当刻的 `systemPrompt`、`toolSchemas` 与前序对话前缀,服务端的 KV Prefix Cache 可直接命中,起步极快且避免像 `subagent` 那样从零重读。
6
+
7
+ ## 何时使用
8
+
9
+ - **跨 2+ 来源/维度的只读调研,或主会话已连探 2 轮仍需深挖**:**直接并发派 1–3 个 `step(readonly=true, goal=...)`**(例如同时查多包 changelog、git 提交、源码落点),把翻长文与反复 `grep` 的噪音挡在分叉里,不要在主会话连滚 5–10 轮 `read`/`grep`/`git`。
10
+ - **单步「改代码 + 跑定向测试 + 修到绿」的闭环微步**:用 `step(goal=..., verify="node --test ...")`,在分叉内改完并跑通定向测试,只把改动摘要与实测读数带回主会话。
11
+ - **排障 / 消化长命令输出**:复现报错、翻测试堆栈或 `git log`/`diff` 追回归时放进 `step`,主会话只收根因与锚点。
12
+
13
+ ## 何时不用
14
+
15
+ - 只需 1–2 次简单工具调用(如单次 `read`/`edit`/`peek`):直接调用即可,不必起 `step`。
16
+ - 需要跨大量目录深度重构、需要独立角色/独立模型或异步后台长跑:改用 `subagent`。
17
+
18
+ ## 参数与约束
19
+
20
+ - `title`(必填):3–8 词简短可读标题(显示在三端标题栏与活动块头,让用户一眼看出这一步在干什么,如 `"检查配置解析链路"` / `"Fix plan exit guard"`)。
21
+ - `goal`(必填):本微步的具体目标(查什么 / 改什么 / 要拿回什么证据)。
22
+ - `readonly`(可选,默认 `false`):`true` = 只读并发分叉,机械禁止一切写文件/写命令;`false` = 可写串行分叉,避免同轮多步写盘冲突。
23
+ - `verify`(可选):本步收尾前要跑的定向验证命令或检查项。
24
+ - `maxTurns`(可选,默认 `25`,上限 `40`):分叉内部最大轮次;到帽自动收敛汇报已完成的改动与剩余项。
25
+ - 工程模式主代理(depth-0)仅挂载只读变体(schema 不含 `readonly`/`verify`,机械禁止写盘,并发只读);产品面修改仍须走设计凭证与 `eng-coder`。
26
+ - 分叉内不可嵌套调用 `step`、`subagent`、`question`、`advisor`、`plan` 及 `batch(create/close/supersede)`。
@@ -1,57 +1,59 @@
1
1
  aliases: 子代理, 派单, 派活
2
- ONE tool, NINE actions — pick by what you need:
3
-
4
- - `spawn` (default): run a sub-agent in its own isolated context — only the final report reaches your history. Spawn several in the SAME response; they run concurrently.
5
- - `status`: non-blocking progress query; returns immediately and consumes nothing. With a spawn id: role, state (running | queued | done), model, elapsed, turn, position, touched files (first 5 plus a count). Without: the pool overview. Background advisor reviews share this surface — pass the review id; an id that belongs to no live spawn, review or settled row is refused with it named.
6
- - `observe`: what a running async child is doing now — state, turn, the tools executing, and the last `recent` (required, 1..20) one-line summaries, newest first. Read-only; queued returns a placeholder, done gives the activity summary, not the report.
7
- - `send`: steer a running async child — id + message, consumed at its next turn boundary as an ordinary user instruction (non-interrupting guidance, not a deviation waiver). Returns {id, status:'delivered', queued}. Sync / queued / settled / unknown error clearly; a child that settles first carries an 'undelivered' note.
8
- - `escalate`: hand an implementation task to a STRONGER model from your consult models; it gets write access, does the work, then returns a post-op report (what changed, why, verification). Not available in engineering mode. Omission still means the async flight and `false` asks for the blocking one; at depth 0 pass `async: true` — ack `{id, role:'escalate', status:'running'}` returns immediately and the report arrives automatically.
9
- - `cancel`: stop ONE background child — the spawn id is required. Running aborts (`{id, status:'cancelled'}`); queued is removed (`{id, status:'cancelled', was:'queued'}`) and later positions shift. Last resort: in-flight work dies and partial changes stay unmerged and unaudited. Advisor reviews cancel the same way.
10
- - `consume-design` (engineering mode, parent side): chain-terminal token consumption. Pass exactly ONE selector — designId / designIds / expired:true / olderThanDays:N. A consumed slot rejects further spawns for that designId, deviation fixes included: new work needs a fresh review and token. Idempotent (unknown or already consumed = a no-op notice); batch calls report per-slot lines plus a `consumed N` count line. Do not call while the chain is open — fix rounds reuse the same slot.
11
- - `design-slots` (engineering mode, parent side): read-only inventory of this session's approved design tokens, oldest first — designId, live|expired, ageDays, expiresAt, batch, designToken — ending with a total/live/expired line. Malformed records show designToken=—. Copy designId + designToken verbatim onto the eng-coder spawn; the gate checks exact equality.
12
- - `panel`: diagnose and fix the subagent panel (headless / VS Code degrade to a 'no panel' pool view). `view`: the live blocks (`running` | `queued` | `done` | `awaitingDigest`). `freeze`: pass a digested-stuck block key — passes only for awaitingDigest blocks with no live pool entry and no pending report.
13
-
14
- Available roles (exposed per mode; `spawn` requires one — missing or misspelled is refused):
15
- - explore — read-only search and analysis; git access read-only; no working-tree context injected, so evidence comes from reads and the task book. Its report must list what it searched and what it did NOT find. Say quick / medium / thorough (default medium).
16
- - plan — read-only planning; never edits; returns a step-by-step plan.
17
- - coder — full implementation: the parent's toolset minus the interactive main-session tools (`question` · `ssh`), plus verify and advisor self-review. Its report carries the requirement-point table, one row per requirement (Done / Simplified / Not done — no deferred column). Normal mode: an optional `batchDoc` binds this spawn's §5 write channel.
18
- - eng-coder — engineering mode only (replaces coder): the same toolset plus the design-driven overlay, and the delivery protocol runs fully inside the child. REQUIRES a valid designToken from a passed `advisor(type='design')` review. Missing or mismatched is refused; expired is refused with expired named. Echo the designId in the delivery report. REQUIRES a batchDoc that resolves to a readable record with no spawn in flight.
19
- - eng-designer — engineering mode only: the SOLE author of design documents and of the batch record's design section (requirement docs stay with the main agent). Writes no code, edits no prompts, fires no reviews, needs NO designToken. Surveys on its own; may only spawn read-only explore children (sync, ≤6 per batch). REQUIRES a batchDoc.
20
- - tester — both modes: the readings seat. Runs the verification commands the task book puts in `goal` and hands the readings back as they stand — no verdict, no fix, no document. Tool face: read-only tools plus `execute` / `bash` (dependency installs, compiles and fixtures included), minus `verify`. Run only, never change is a role contract, not a sandbox — `bash` can write, so a tester that edits anything is a defect.
21
-
22
- Task book, non-engineering roles (explore / plan / coder / tester): five required parameters — a missing, blank or non-string value is refused with it named. A free-text task is an optional supplement, never the whole brief.
23
- - goal — the goal and why.
24
- - knownFacts — the facts you already verified.
25
- - acceptance — machine-verifiable criteria.
26
- - reportFormat — the delivery-report format.
27
- - scope — what to read, and what not to touch.
28
-
29
- Engineering roles take their task book from the batch record; no other task text reaches either:
30
- - batchDoc — the record path. An eng-coder's task book is that record's §2, written and owned by eng-designer; an eng-designer reads the whole record — §1's rulings bind it, §2 is its own pen.
31
- - round — initial | fix.
32
- - files / dependsOn — scheduling.
33
- - An eng-coder spawn also carries designToken and, when several designs are open, designId.
34
-
35
- A record carries one concurrent spawn: a second spawn on a record in flight is refused, naming the occupant. Sequential hand-offs (design → implementation → fix round) pass, because the previous spawn settled first.
36
-
37
- Pass one parameter per field — contents only, the runtime adds the labels:
2
+ 一个工具,九个动作 —— 按你需要挑:
3
+
4
+ - `spawn`(默认):在它自己的隔离上下文里跑一个子代理 —— 只有最终报告进入你的历史。在同一次回复里派几个;它们并发跑。
5
+ - `status`:非阻塞的进度查询;立即返回,什么都不消耗。带一个派生 id 时:角色、状态(running | queued | done)、模型、已耗时、轮次、位次、碰过的文件(前 5 个加一个计数)。不带时:池的总览。后台 advisor 评审共用这个面 —— 传评审 id;一个不属于任何活派生、评审或已结行的 id 会被拒绝并指名它。
6
+ - `observe`:一个运行中的异步子代理此刻在做什么 —— 状态、轮次、正在执行的工具,以及最近 `recent`(必填,1..20)条单行摘要,最新的在前。只读;排队中返回一个占位,已完成给出活动摘要,不是报告。
7
+ - `send`:给一个运行中的异步子代理递方向 —— id + message,在它下一个轮次边界作为一条普通用户指令被消费(非打断式指引,不是偏离豁免)。返回 {id, status:'delivered', queued}。同步 / 排队中 / 已结 / 未知都清楚报错;先结掉的子代理会带一条 'undelivered' 注记。
8
+ - `escalate`:把一件实施任务交给一个**更强**的模型,从你的会诊模型里选;它拿到写权限、把活做完,然后返回一份事后报告(改了什么、为什么、怎么验的)。工程模式下不可用。省略仍意味着异步飞行,`false` 要求阻塞的那种;在深度 0 传 `async: true` —— 确认 `{id, role:'escalate', status:'running'}` 立即返回,报告自动送达。
9
+ - `cancel`:停掉**一个**后台子代理 —— 派生 id 必填。运行中的被中止(`{id, status:'cancelled'}`);排队中的被移除(`{id, status:'cancelled', was:'queued'}`),后面的位次前移。最后手段:在飞的活死掉,部分的改动留在未合并、未审计状态。advisor 评审按同样方式取消。
10
+ - `consume-design`(工程模式,父侧):链端令牌消费。恰好给**一个**选择器 —— designId / designIds / expired:true / olderThanDays:N。被消费的槽位拒绝该 designId 的后续派生,偏离修复也算:新的活需要一次新的评审与令牌。幂等(未知或已消费 = 一条无操作提示);批量调用按槽位逐行报告,另有一行 `consumed N` 计数。链还开着时不要调用 —— 修复轮复用同一个槽位。
11
+ - `design-slots`(工程模式,父侧):本会话已批准设计令牌的只读清单,最旧的在前 —— designId、live|expired、ageDays、expiresAt、batch、designToken —— 末尾一行总数 / 活 / 过期。畸形记录显示 designToken=—。把 designId + designToken 逐字拷到 eng-coder 派生上;闸检查精确相等。
12
+ - `panel`:诊断并修复子代理面板(无头 / VS Code 降级成「无面板」的池视图)。`view`:活块(`running` | `queued` | `done` | `awaitingDigest`)。`freeze`:传一个卡在摘要上的块键 —— 只对没有任何活池条目、也没有待送报告的 awaitingDigest 块放行。
13
+
14
+ 可用角色(按模式开放;`spawn` 必须有一个 —— 缺失或拼错即被拒绝):
15
+ - explore —— 只读的搜索与分析(常规批量扫骨架/抽节优先用本地毫秒级 `peek`);git 访问只读;不注入工作树上下文,所以证据来自读取与任务书。它的报告必须列出它搜了什么、**没有**找到什么。说清 quick / medium / thorough(默认 medium)。
16
+ - coder —— 完整实施:父侧的工具集减去交互式主会话工具(`question` · `ssh`),加上 verify 与 advisor 自审。它的报告带需求点表,每条需求一行(Done / Simplified / Not done —— 没有暂缓列)。普通模式:可选的 `batchDoc` 绑定这次派生的 §5 写通道。
17
+ - eng-coder —— 仅工程模式(替代 coder):同一套工具集加上设计驱动叠加层,交付协议完全在子代理内部跑。**要求**一个来自已通过的 `advisor(type='design')` 评审的有效 designToken。缺失或不匹配被拒绝;过期被拒绝并指名过期。在交付报告里回显 designId。**要求**一个解析到可读记录、且没有派生在飞的 batchDoc。
18
+ - eng-designer —— 仅工程模式:设计文档与批次档设计小节的**唯一**作者(需求文档仍归主 agent)。不写代码、不改提示词、不发起评审、**不需要** designToken。自己勘察;只能派生只读的 explore 子代理(同步,每批 ≤6)。**要求**一个 batchDoc。
19
+ - tester —— 两种模式都有:读数席。跑任务书放进 `goal` 的核验命令,并把读数原样交回 —— 不做裁决、不做修复、不写文档。工具面:只读工具加 `execute` / `bash`(含依赖安装、编译与夹具),减去 `verify`。只跑不改是角色契约,不是沙箱 —— `bash` 能写,所以一个改了任何东西的 tester 是一个缺陷。
20
+
21
+ 任务书,非工程角色分两档:
22
+ - 只读轻派单角色(`explore`):`goal` 与 `scope` 两个必填参数(缺失、空白或非字符串被拒绝并点名),`knownFacts` / `acceptance` / `reportFormat` 均为可选补充;另支持可选 `thoroughness`(`quick` / `medium` / `thorough`,默认 `medium`)。
23
+ - 写盘/执行角色(`coder` / `tester`):五个必填参数 —— `goal` / `knownFacts` / `scope` / `acceptance` / `reportFormat`(缺失、空白或非字符串会被拒绝并指名它)。
24
+ 自由文本 `task` 是可选的补充,绝不是全部简述。
25
+ - goal —— 目标与为什么(或要回答的问题)。
26
+ - knownFacts —— 你已经核实过的事实(`explore` 可选)。
27
+ - acceptance —— 机器可验证的判据(`explore` 可选)。
28
+ - reportFormat —— 交付报告的格式(`explore` 可选)。
29
+ - scope —— 该读什么,不该碰什么。
30
+
31
+ 工程角色从批次档拿任务书;没有别的任务文本到达它们:
32
+ - batchDoc —— 记录路径。eng-coder 的任务书是那份记录的 §2,由 eng-designer 写并拥有;eng-designer 读整份记录 —— §1 的裁决约束它,§2 是它自己的笔。
33
+ - round —— initial | fix。
34
+ - files / dependsOn —— 调度。
35
+ - 一次 eng-coder 派生还携带 designToken,以及多个设计同时开着时的 designId。
36
+
37
+ 一份记录只承载一个并发派生:对一份在飞记录的第二次派生被拒绝,并指名占用者。顺序交接(设计 → 实施 → 修复轮)能过,因为前一个派生先结了。
38
+
39
+ 每个字段传一个参数 —— 只传内容,标签由运行时加:
38
40
  subagent(role="eng-coder", round="initial", batchDoc="<batch record>", designToken="…", files=[…], async=true)
39
- subagent(role="explore", goal="…", knownFacts="…", scope="…", acceptance="…", reportFormat="…", async=true)
41
+ subagent(role="explore", goal="…", scope="…", thoroughness="medium", async=false)
40
42
 
41
- Mode filtering: normal mode exposes explore / plan / coder / tester; engineering mode exposes explore / eng-designer / eng-coder / tester. A role the mode does not expose is refused (plan is normal-mode only, coder is replaced by eng-coder, tester is dispatchable in both).
43
+ 模式过滤:普通模式开放 explore / coder / tester;工程模式开放 explore / eng-designer / eng-coder / tester。模式未开放的角色被拒绝(普通模式规划在主会话用 `peek` + `task` 轻量完成,不再派 `plan` 子代理;工程模式 `coder` 被 `eng-coder` 替代;`tester` 两种模式都可派)。
42
44
 
43
- Async spawn:
44
- - Pass `async: true` — the spawn returns {id, status:"running"} immediately and the report arrives automatically; if your next step needs it, end the turn and let the digest deliver it. Omitting `async` is refused.
45
- - At depth>0 spawns are always synchronous: pass `async: false` (an explicit `async: true` is refused).
45
+ 异步派生:
46
+ - 传 `async: true` —— 派生立即返回 {id, status:"running"},报告自动送达;下一步需要它时,结束这一轮,让摘要送进来。省略 `async` 被拒绝。
47
+ - 深度>0 时派生永远是同步的:传 `async: false`(显式 `async: true` 被拒绝)。
46
48
 
47
- Pool: async spawns pool per role domain — 4 concurrent eng-coders plus 4 concurrent other-role spawns by default (agent.poolLimits overrides both). A full domain queues with a position while the other keeps starting.
49
+ 池:异步派生按角色域分池 —— 默认 4 个并发 eng-coder 加 4 个其他角色的并发派生(agent.poolLimits 覆盖两者)。一个域满了就带位次排队,另一个域继续开工。
48
50
 
49
- Scheduling: declare `files` (the paths this task will modify) and `dependsOn` (ids from prior async returns whose outcome this task needs).
50
- - Overlapping-file tasks serialize and dependents start in order: a conflicting or dependent spawn queues (position / reason) and auto-starts when the conflict clears or the dependency settles.
51
- - A cancelled or failed dependency leaves it queued marked "dependency cancelled" until you decide. Unknown ids error; a consumed id counts as satisfied.
52
- - Omit both for a plain immediate spawn.
51
+ 调度:声明 `files`(这个任务会改的路径)与 `dependsOn`(先前异步返回里、本任务结果所依赖的 id)。
52
+ - 文件重叠的任务串行,依赖者按顺序启动:冲突或带依赖的派生排队(位次 / 原因),在冲突解除或依赖结算时自动启动。
53
+ - 被取消或失败的依赖让它留在队列里,标着 "dependency cancelled",直到你决定。未知 id 报错;已消费的 id 算作已满足。
54
+ - 普通立即派生两个都省略。
53
55
 
54
- The child starts with zero context, so brief it like a colleague who just walked in.
55
- - Put exact paths and commands in — do not make it search for what you already know.
56
- - Do not delegate understanding: resolve the paths and symbols the task hinges on first.
57
- - Once it runs, leave that scope to it — do not redo its searches in parallel or finish manually midway.
56
+ 子代理从零上下文开始,所以像对待刚走进来的同事那样交代它。
57
+ - 把确切的路径与命令放进去 —— 别让它去找你已经知道的东西。
58
+ - 不要委派“理解”:先把任务所系的那批路径与符号弄清。
59
+ - 它一跑起来,那个范围就交给它 —— 不要在它旁边重跑它的搜索,也不要中途自己手动收尾。
@@ -1,14 +1,17 @@
1
- aliases: 任务清单, 待办列表
2
- Each call replaces the entire list.
1
+ aliases: 任务清单, 待办列表, 微步清单
2
+ 主会话微循环的 0ms 节拍器:支持三种调用形——传 `items` 全量建表/替换、传 `complete`/`start`(按 1 起编号如 `"1"`、标题子串或 `"all"`,可附顶层 `result`)做增量推进而不重抄整表、传 `clear: true`(或 `items: []`)一键清表。
3
3
 
4
- Statuses: pending | in_progress | done - synonyms (completed/finished/complete, todo/open/waiting, active/running/working, …) are accepted and normalized with a warning.
4
+ 全量项字段:
5
+ - `title`(必填,不能为空):当前微步一句话目标。
6
+ - `status`(必填):`pending | in_progress | done` —— 同义词(completed/finished/complete、todo/open/waiting、active/running/working、……)被接受,并归一化且附一句警告。
7
+ - `targets`(可选,建议给):本微步只动哪 1–3 个文件。
8
+ - `evidence`(可选,建议给):动手前已读到的事实/锚点(来自 `peek`/`read`/`grep`)。
9
+ - `verify`(可选,建议给):本微步改完立刻跑的定向验证(如 `doc_check` 或单测命令)。
10
+ - `result`(可选,标 `done` 时建议给):本微步刚跑完的实测读数。
5
11
 
6
- - Keep exactly one item in_progress at a time.
7
- - Mark items done as you complete them; never mark done while tests fail or the work is partial.
8
- - title is required and must be non-empty: an item whose title is empty is dropped, and the receipt names it.
12
+ 用法习惯:
13
+ - 任何时候保持恰好一项 `in_progress`(聚焦当前这一小片),改完立刻验证并用 `task({ complete: ["1"], start: "2", result: "..." })` 增量结清并切下一步;全部完成后用 `task({ clear: true })` 或把余项全置 `done`(回合正常收尾时全 `done` 清单会自动清表收起面板)。
14
+ - 模式:普通模式(tiny 与 normal)提供 `task` 作为轻量进度与微步清单 —— 批次档与台账仍是追踪的权威。工程模式不提供 `task`。
15
+ - 生命周期提醒:执行期若连续多轮未更新未闭项会收到一次 B 段轻推;交卷时若仍有未闭 `in_progress` 或更新后又推进过工具轮的陈旧项,Harness 至多提醒 1 次同步/清空;刚更新且仅留 `pending` 的刻意交接不推回。跨会话 / 项目级追踪用 `/ledger`。
9
16
 
10
- Modes: normal mode (tiny and normal) provides `task` as a lightweight progress checklist only - the batch record and the ledger stay the tracking authority.
11
- Engineering mode does not provide `task` - the tool is not in that mode's tool table, so its description is not assembled into engineering contexts.
12
- A pending item neither triggers a completion push-back nor extends the turn. For cross-session / project-level tracking in any mode, use `/ledger`.
13
-
14
- Returns a one-line receipt - `Task list updated: N/M done` - plus a warning naming every status or title that was normalized or dropped.
17
+ 返回回执 `Task list updated: N/M done`(或 `Task list cleared.`)、当前活跃微步摘要、未闭项编号列表及归一化/并发提示。
@@ -1,11 +1,11 @@
1
1
  aliases: 团队台账, 只读, 团队待办
2
- It is a separate book from the local `ledger` — two independent accounts, no sync between them, and this one keeps no offline copy.
2
+ 它是与本地 `ledger` 分开的另一本账 —— 两个互相独立的户头,彼此不同步,这一本也不留离线副本。
3
3
 
4
- The actions this tool face carries: `query` (filtered entries) and `count` (how many). Both are read-only.
4
+ 这一工具面承载的动作:`query`(过滤后的条目)与 `count`(有多少条)。两个都是只读的。
5
5
 
6
- - The repo tag is derived for you from the current project root's git origin; with no git repo, or no `remote.origin.url`, the call fails explicitly and sends no request. You cannot pick or change the repo.
7
- - `query`: `scope` = `"repo"` (default — the current repo) or `"team"` (every repo in the team); filters `status` (one of the six states `待讨论` / `待设计` / `在途` / `待核销` / `已核销` / `已废弃`) and `owner` (exact username). Each row carries `aged` when it sits in an unsettled state and is older than 30 days.
8
- - `count`: the same filters as `query`, and returns the total.
9
- - Login gate: not logged in ⇒ the call fails with a message saying so, and sends no request; 401 (token expired) ⇒ login expired, log in again; server unreachable ⇒ reported as such, with no offline fallback: a retry never serves an old value.
6
+ - 仓库标签由当前项目根的 git origin 替你推导;没有 git 仓库、或没有 `remote.origin.url` 时,调用显式失败,不发任何请求。你既不能挑也不能改仓库。
7
+ - `query`:`scope` = `"repo"`(默认 —— 当前仓库)或 `"team"`(团队里的每个仓库);过滤器 `status`(六个状态之一 `待讨论` / `待设计` / `在途` / `待核销` / `已核销` / `已废弃`)与 `owner`(精确用户名)。每一行处于未结状态且超过 30 天时携带 `aged`。
8
+ - `count`:与 `query` 相同的过滤器,返回总数。
9
+ - 登录闸:未登录 ⇒ 调用失败并说明这一点,且不发任何请求;401(token 过期)⇒ 登录已过期,请重新登录;服务器不可达 ⇒ 照实报出,没有离线回落:一次重试绝不供应旧值。
10
10
 
11
- Use it to see what the rest of the team already has queued on this repo before proposing the same work again. Adding, moving or settling an entry belongs to the main agent — those actions are not part of this tool face, and calling one directly is refused before any request goes out.
11
+ 用它看清团队其余成员已经在这个仓库上排了什么,再提同样的活。
@@ -1,15 +1,15 @@
1
1
  aliases: 团队台账, 团队待办
2
- It is a separate book from the local `ledger` - two independent accounts, no sync between them, and this one keeps no offline copy. `action` = query / count / add / update / close.
2
+ 它是与本地 `ledger` 分开的另一本账 —— 两个互相独立的户头,彼此不同步,这一本也不留离线副本。`action` = query / count / add / update / close。
3
3
 
4
- - `query` / `count` are read-only and open to every role; `add` / `update` / `close` write and reach the main agent only (a subagent gets the read-only two).
5
- - The repo tag is derived for you from the current project root's git origin; with no git repo, or no `remote.origin.url`, the call fails explicitly and sends no request. You cannot pick or change the repo.
6
- - `query`: `scope` = `"repo"` (default - the current repo) / `"team"` (every repo in the team); filters `status` (one of the six states `待讨论` / `待设计` / `在途` / `待核销` / `已核销` / `已废弃`) and `owner` (exact username). Each row carries `aged` when it sits in an unsettled state and is older than 30 days.
7
- - `count`: the same filters as `query`, and returns the total.
8
- - `add`: `title` required (non-blank, ≤200), `detail` (≤4000), `owner` (default = yourself). A new entry always lands in `待讨论`.
9
- - `update`: `id` required; `title` / `detail` / `owner` / `status` are each optional, and an omitted one stays unchanged. The client checks nothing beyond `id` — an `update` that changes no field is still sent, and the server alone judges the result.
10
- `status` is judged by the server, not by this client: the client sends the target state and an illegal edge comes back as a 400.
11
- The local `ledger` tool's own table allows `待讨论→待设计` / `待讨论→在途` / `待设计→在途` / `在途→待核销` / `在途→待讨论` /
12
- `待核销→已核销` / `待核销→在途` / `待核销→待讨论` / `待讨论→已废弃` / `待设计→已废弃` / `在途→已废弃` / `待核销→已废弃`,
13
- and there `已核销` and `已废弃` are both final; this book's server table is not readable from here, so take that list as the client-side reference, not as a copy of the server's.
14
- - `close`: `id` + `status` (`已核销` / `已废弃`). `已核销` settles, and only from `待核销` - from any other state it is refused, and the way out is to `update` that entry to `待核销` first. `已废弃` withdraws an entry from any non-archived state.
15
- - Login gate: not logged in ⇒ the call fails with a message saying so, and sends no request; 401 (token expired) ⇒ login expired, log in again; server unreachable ⇒ reported as such, with no offline fallback: a retry never serves an old value.
4
+ - `query` / `count` 是只读的,对所有角色开放;`add` / `update` / `close` 会写,只到主 agent(子代理拿到的是那两个只读的)。
5
+ - 仓库标签由当前项目根的 git origin 替你推导;没有 git 仓库、或没有 `remote.origin.url` 时,调用显式失败,不发任何请求。你既不能挑也不能改仓库。
6
+ - `query`:`scope` = `"repo"`(默认 —— 当前仓库)/ `"team"`(团队里的每个仓库);过滤器 `status`(六个状态之一 `待讨论` / `待设计` / `在途` / `待核销` / `已核销` / `已废弃`)与 `owner`(精确用户名)。每一行处于未结状态且超过 30 天时携带 `aged`。
7
+ - `count`:与 `query` 相同的过滤器,返回总数。
8
+ - `add`:`title` 必填(非空白,≤200),`detail`(≤4000),`owner`(默认 = 你自己)。新条目总是落进 `待讨论`。
9
+ - `update`:`id` 必填;`title` / `detail` / `owner` / `status` 各自可选,省略的保持原样。客户端除 `id` 之外什么都不查 —— 一个没改任何字段的 `update` 照样发出,结果只由服务器判定。
10
+ `status` 由服务器判定,不由这个客户端:客户端发出目标状态,非法的边以 400 回来。
11
+ 本地 `ledger` 工具自己的表允许 `待讨论→待设计` / `待讨论→在途` / `待设计→在途` / `在途→待核销` / `在途→待讨论` /
12
+ `待核销→已核销` / `待核销→在途` / `待核销→待讨论` / `待讨论→已废弃` / `待设计→已废弃` / `在途→已废弃` / `待核销→已废弃`,
13
+ 那里 `已核销` 与 `已废弃` 都是终态;这本账的服务器表从这里读不到,所以把那张清单当客户端侧的参照,不是服务器表的副本。
14
+ - `close`:`id` + `status`(`已核销` / `已废弃`)。`已核销` 结算,且只能从 `待核销` 发起 —— 从其他任何状态都被拒绝,出路是先把那条 `update` 到 `待核销`。`已废弃` 从任何非归档状态撤回一条条目。
15
+ - 登录闸:未登录 ⇒ 调用失败并说明这一点,且不发任何请求;401(token 过期)⇒ 登录已过期,请重新登录;服务器不可达 ⇒ 照实报出,没有离线回落:一次重试绝不供应旧值。
@@ -1,23 +1,23 @@
1
1
  aliases: 定时器, 提醒, 计时
2
- Set it before you start analyzing code: when the timer fires, a system reminder is injected suggesting you run code or add debug logs — N seconds to reason, then the reminder to act.
2
+ 开始分析代码之前先设它:定时器一响,会注入一条系统提醒,建议你跑代码或加调试日志 —— N 秒用来推理,然后提醒你去动手。
3
3
 
4
- Four schedule forms, one per call (`seconds`, `at`, `every` and `daily` are mutually exclusive - passing more than one is a validation error):
4
+ 四种时间表形式,每次调用一种(`seconds`、`at`、`every` 与 `daily` 互斥 —— 传多个就是校验错误):
5
5
 
6
- - `seconds` - a one-shot countdown, a finite positive number of seconds.
7
- - `at` - a local clock time such as `"2026-10-13T09:00"`, firing once at that moment; a time already past fires immediately.
8
- - `every` - a fixed interval in seconds (minimum 60): the first reminder comes N seconds after setting, then every N seconds, until cancelled.
9
- - `daily` - a local `"HH:MM"`, repeating every day at that time until cancelled; a time already past today fires tomorrow.
6
+ - `seconds` —— 一次性倒计时,一个有限的正秒数。
7
+ - `at` —— 一个本地钟点,例如 `"2026-10-13T09:00"`,到那一刻响一次;已经过去的时间立即响。
8
+ - `every` —— 以秒为单位的固定间隔(最少 60):第一次提醒在设下之后 N 秒到,然后每 N 秒一次,直到被取消。
9
+ - `daily` —— 一个本地 `"HH:MM"`,每天那个时刻重复,直到被取消;今天已经过去的时间明天响。
10
10
 
11
- All times are local to the host.
11
+ 所有时间都是宿主的本地时间。
12
12
 
13
- - `cancel` takes the id from the set confirmation and stops that timer; `list` shows every pending timer with its next due time.
14
- - A repeating timer holds one pending slot for as long as it stands.
15
- - A pending timer survives across runs. At most 8 may be pending at once, and further timer calls are rejected until some expire.
13
+ - `cancel` 取设置确认里的 id,停掉那个定时器;`list` 显示每个待响的定时器及其下次到期时间。
14
+ - 一个重复定时器只要还在,就占着一个待响槽位。
15
+ - 待响的定时器活过运行。同时至多 8 个待响,超出之后的定时器调用被拒绝,直到有些到期。
16
16
 
17
- Returns the set confirmation; the reminder itself fires at the deadline.
17
+ 返回设置确认;提醒本身在到期时响。
18
18
 
19
- Delivery: when the session is idle the reminder is delivered on the spot and starts a turn - on the CLI / VSC / desktop foregrounds, and in a suspension window.
19
+ 投递:会话空闲时提醒当场送达并开启一个轮次 —— 在 CLI / VSC / 桌面等前台,以及在挂起窗口里。
20
20
 
21
- Headless is structurally unsupported.
21
+ 无头模式在结构上不支持。
22
22
 
23
- A running session turn gets no delivery: an expired timer waits for the next delivery round.
23
+ 运行中的会话轮次收不到投递:到期的定时器等下一轮投递。
@@ -1,16 +1,16 @@
1
1
  aliases: 目录树, 结构
2
- Use it to see quickly which modules exist and where files live. Skips dotfiles, .git/node_modules/dist/build/obj and other build/vendor dirs, and binary files.
2
+ 用它快速看清有哪些模块、文件都住哪。它会跳过点文件、.git/node_modules/dist/build/obj 与其他构建 / 第三方目录,以及二进制文件。
3
3
 
4
- **Route to tree instead of bash:**
4
+ **改用 tree,而不是 bash:**
5
5
  - `tree` / `find .` / `dir /s` → tree
6
6
 
7
- Parameters:
8
- - path: Root directory (default cwd)
9
- - depth: Tree depth (default 3, max 6)
10
- - includeProcessDocs: include docs from process layers (batch records, archived material) - excluded by default; pass `true` to get them back
7
+ 参数:
8
+ - path:根目录(默认 cwd)
9
+ - depth:树的深度(默认 3,最大 6)
10
+ - includeProcessDocs:包含过程层的文档(批次档、归档材料)—— 默认排除;传 `true` 把它们取回来
11
11
 
12
- Notes:
13
- - Returns the tree as text: directories first (each ending with `/`), files after, both sorted, capped at 200 entries.
14
- - Tree-drawing uses `├──`/`└──`/`│`.
15
- - A file row carries its layer label after the name (`TOOLS.md [design]`); directory rows carry none and process-layer directories stay reachable. When file rows from process layers are excluded (or included on request), a final line reports how many; excluded rows spend none of the 200-entry cap.
16
- - Use depth for a shallow overview; use `ls` for one directory, `glob` for a specific file pattern.
12
+ 注意:
13
+ - 以文本返回这棵树:目录在前(各以 `/` 结尾),文件在后,两者都排序,上限 200 个条目。
14
+ - 画树用 `├──`/`└──`/`│`。
15
+ - 文件行在名字后面携带它的层标签(`TOOLS.md [design]`);目录行没有,过程层的目录仍然可达。过程层的文件行被排除时(或按请求被包含时),最后一行报告有多少条;被排除的行不占用 200 条上限。
16
+ - 浅层概览用 depth;单个目录用 `ls`,具体文件模式用 `glob`。
@@ -1,19 +1,19 @@
1
1
  aliases: 交付前校验, 验证门
2
- verify does NOT run any test or verification command for you, and does NOT require a test per change.
2
+ verify **不**替你跑任何测试或核验命令,也**不**要求每个改动都配一个测试。
3
3
 
4
- You DECLARE your verification status through the `verification` argument, `{ status: 'passed' | 'failed' | 'skipped', command?, summary?, basis? }` - the declaration is self-reported evidence.
4
+ 你通过 `verification` 参数**声明**自己的核验状态:`{ status: 'passed' | 'failed' | 'skipped', command?, summary?, basis? }` —— 这份声明是自己报出的证据。
5
5
 
6
- The three outcomes and what each does to your completion:
7
- - `passed` → allowed.
8
- - `failed` → blocked.
9
- - `skipped` → allowed, but needs a `summary` giving the reason.
6
+ 三种结果与各自对你完成度的影响:
7
+ - `passed` → 放行。
8
+ - `failed` → 拦住。
9
+ - `skipped` → 放行,但需要一段说明理由的 `summary`。
10
10
 
11
- `basis` (optional) is the "what it stands on" dimension of the declaration: a judgment source, the exact words you read at their path, or an explicit `unverified`. It is declaration-only - no format is enforced and nothing is machine-checked.
11
+ `basis`(可选)是声明里「它站在什么之上」的那个维度:一个判断来源、你在它们路径上读到的原话,或一个显式的 `unverified`。它只是声明 —— 格式不强制,也没有任何东西被机器检查。
12
12
 
13
- A `passed` / `skipped` declaration with no `basis` gets one advisory hint line in the report: never blocking, never changing the outcome. A `failed` declaration gets no basis hint - it is already blocked.
13
+ 一次没有 `basis` 的 `passed` / `skipped` 声明,会在报告里得到一行提示:绝不阻塞,绝不改变结果。`failed` 声明得不到 basis 提示 —— 它已经被拦住了。
14
14
 
15
- Whether and how to verify is described in natural language in the project's AGENTS.md, and is decided and executed by you.
15
+ 要不要验、怎么验,写在项目 AGENTS.md 里的自然语言中,由你决定并执行。
16
16
 
17
- The report also carries the changed files (git diff), an advisory `node --check` hint on changed .js / .mjs files (not gating), the task list, and a self-review checklist.
17
+ 报告还带着改动过的文件(git diff)、对改动的 .js / .mjs 文件一句劝告性的 `node --check` 提示(不把关)、任务列表,以及一份自审清单。
18
18
 
19
- Call this BEFORE declaring a coding task complete - do not say "done" until verify passes.
19
+ 在宣布一个编码任务完成**之前**调用它 —— verify 通过之前不要说「做完了」。