@thincoder/core 0.10.13 → 0.11.2

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 (366) hide show
  1. package/CHANGELOG.md +74 -1
  2. package/advisor/convergence.mjs +34 -3
  3. package/advisor/loop.mjs +42 -10
  4. package/advisor/messages.mjs +46 -27
  5. package/advisor/notice.mjs +1 -1
  6. package/advisor/project-context.mjs +253 -14
  7. package/advisor/run.mjs +7 -4
  8. package/advisor.mjs +29 -43
  9. package/agent/batch-attribution.mjs +87 -0
  10. package/agent/batch-changed-surface.mjs +129 -0
  11. package/agent/completion.mjs +57 -4
  12. package/agent/digest-account.mjs +73 -46
  13. package/agent/dispatch-gates.mjs +6 -0
  14. package/agent/dispatch-run.mjs +1 -1
  15. package/agent/dispatch.mjs +35 -22
  16. package/agent/family-tools.mjs +36 -17
  17. package/agent/helpers.mjs +123 -95
  18. package/agent/offload.mjs +84 -0
  19. package/agent/post-turn.mjs +24 -10
  20. package/agent/record-results.mjs +19 -7
  21. package/agent/run-stages.mjs +127 -61
  22. package/agent/run-start.mjs +45 -8
  23. package/agent/setup-reminders.mjs +9 -2
  24. package/agent/setup.mjs +27 -22
  25. package/agent/spawn-child.mjs +38 -1
  26. package/agent/suspension.mjs +1 -1
  27. package/agent/timers.mjs +5 -3
  28. package/agent/turn-loop.mjs +60 -6
  29. package/agent/turn-projection.mjs +386 -0
  30. package/agent/turn-task-state.mjs +274 -0
  31. package/agent/turn-tool-process.mjs +168 -0
  32. package/agent/write-face.mjs +99 -0
  33. package/agent/write-gate-ledger.mjs +569 -0
  34. package/agent/write-gate.mjs +39 -13
  35. package/agent-tools/advisor-async.mjs +29 -169
  36. package/agent-tools/advisor-launch.mjs +178 -0
  37. package/agent-tools/advisor-settle.mjs +28 -1
  38. package/agent-tools/advisor.mjs +136 -31
  39. package/agent-tools/async-settle.mjs +2 -2
  40. package/agent-tools/audit-block.mjs +6 -6
  41. package/agent-tools/bash-async.mjs +8 -2
  42. package/agent-tools/batch-closeout.mjs +444 -0
  43. package/agent-tools/batch-gate.mjs +152 -138
  44. package/agent-tools/batch-ledger-bind.mjs +392 -0
  45. package/agent-tools/batch-ledger-link.mjs +73 -0
  46. package/agent-tools/batch-ledger-view.mjs +109 -0
  47. package/agent-tools/batch-lifecycle.mjs +245 -376
  48. package/agent-tools/batch-paths.mjs +73 -47
  49. package/agent-tools/batch-read.mjs +1 -1
  50. package/agent-tools/batch-record-write.mjs +417 -0
  51. package/agent-tools/batch-regions.mjs +215 -0
  52. package/agent-tools/batch-reopen.mjs +154 -0
  53. package/agent-tools/batch-segment-vocab.mjs +379 -0
  54. package/agent-tools/batch-skeleton.mjs +344 -196
  55. package/agent-tools/batch-supersede.mjs +232 -0
  56. package/agent-tools/batch-tier-gate.mjs +297 -0
  57. package/agent-tools/batch.mjs +189 -253
  58. package/agent-tools/consult.mjs +7 -4
  59. package/agent-tools/context.mjs +47 -17
  60. package/agent-tools/design-review-record.mjs +225 -0
  61. package/agent-tools/design-slots.mjs +24 -24
  62. package/agent-tools/design-token.mjs +318 -39
  63. package/agent-tools/doc-check.mjs +55 -29
  64. package/agent-tools/doc-graph.mjs +140 -0
  65. package/agent-tools/eng.mjs +10 -9
  66. package/agent-tools/escalate-async.mjs +5 -5
  67. package/agent-tools/manifest.mjs +34 -15
  68. package/agent-tools/read-history.mjs +115 -14
  69. package/agent-tools/review-facts.mjs +40 -15
  70. package/agent-tools/settings.mjs +23 -2
  71. package/agent-tools/spawn-gates.mjs +19 -22
  72. package/agent-tools/ssh-session.mjs +120 -111
  73. package/agent-tools/ssh-text.mjs +155 -0
  74. package/agent-tools/ssh-transfer.mjs +210 -0
  75. package/agent-tools/ssh-transport.mjs +183 -81
  76. package/agent-tools/subagent-actions-query.mjs +11 -7
  77. package/agent-tools/subagent-actions.mjs +1 -1
  78. package/agent-tools/subagent-async.mjs +11 -11
  79. package/agent-tools/subagent-brief.mjs +76 -0
  80. package/agent-tools/subagent-design-token.mjs +168 -0
  81. package/agent-tools/subagent-run.mjs +1 -1
  82. package/agent-tools/subagent-scheduler.mjs +45 -11
  83. package/agent-tools/subagent-spawn.mjs +143 -104
  84. package/agent-tools/subagent.mjs +26 -23
  85. package/agent-tools/taskbook-block.mjs +94 -0
  86. package/agent-tools/timer.mjs +12 -8
  87. package/agent-tools/verify.mjs +13 -4
  88. package/agent-tools.mjs +7 -3
  89. package/agent.mjs +20 -1
  90. package/attachments.mjs +3 -3
  91. package/browser/actions.mjs +9 -3
  92. package/browser/cdp.mjs +45 -17
  93. package/browser/launch.mjs +25 -43
  94. package/browser/pool.mjs +299 -0
  95. package/browser/queue.mjs +2 -0
  96. package/browser/session-state.mjs +450 -0
  97. package/browser/session.mjs +127 -151
  98. package/browser/snapshot.mjs +89 -0
  99. package/client-identity.mjs +22 -6
  100. package/config-defaults.mjs +2 -1
  101. package/config-migrate.mjs +40 -0
  102. package/config-normalize.mjs +28 -2
  103. package/config-presets.mjs +5 -3
  104. package/config-reload.mjs +59 -0
  105. package/config.mjs +62 -98
  106. package/context-degrade.mjs +38 -10
  107. package/context-echo.mjs +11 -0
  108. package/context.mjs +165 -68
  109. package/conventions.mjs +11 -9
  110. package/declaration.mjs +33 -7
  111. package/declared-repos.mjs +94 -0
  112. package/doc-check/doc-names.mjs +73 -0
  113. package/doc-check/doc-tokens.mjs +110 -0
  114. package/doc-check/existence.mjs +160 -0
  115. package/doc-check/index.mjs +312 -163
  116. package/doc-check/line-refs.mjs +38 -0
  117. package/doc-check/paragraph.mjs +220 -91
  118. package/doc-graph/anchors.mjs +474 -0
  119. package/doc-graph/doc-batch-face.mjs +59 -0
  120. package/doc-graph/doc-suffix.mjs +27 -0
  121. package/doc-graph/graph-tokens.mjs +160 -0
  122. package/doc-graph.mjs +778 -0
  123. package/explore-distill.mjs +12 -6
  124. package/i18n.mjs +2 -2
  125. package/index-discover.mjs +4 -1
  126. package/instance-inbox-watch.mjs +272 -0
  127. package/instance-inbox.mjs +218 -0
  128. package/instance-registry.mjs +179 -0
  129. package/knowledge/README.md +3 -0
  130. package/knowledge/prompt-resources.md +6 -0
  131. package/ledger-close-proof.mjs +95 -62
  132. package/ledger-close.mjs +188 -0
  133. package/ledger-cmd.mjs +76 -244
  134. package/ledger-consistency.mjs +113 -0
  135. package/ledger-db.mjs +70 -37
  136. package/ledger-executors.mjs +1 -1
  137. package/ledger-migrate.mjs +4 -4
  138. package/ledger-read.mjs +10 -8
  139. package/ledger-surface.mjs +1 -1
  140. package/ledger-tools.mjs +83 -24
  141. package/ledger-variant-notice.mjs +1 -1
  142. package/ledger-write-ops.mjs +462 -0
  143. package/ledger.mjs +2 -2
  144. package/manifest-discovery.mjs +5 -3
  145. package/manifest-schema.mjs +28 -2
  146. package/memory/memory-tool.mjs +5 -2
  147. package/memory/schema.mjs +6 -27
  148. package/package.json +3 -1
  149. package/path-resolve.mjs +498 -0
  150. package/permission.mjs +4 -0
  151. package/prompt-files.mjs +91 -1
  152. package/prompt-overlays.mjs +14 -6
  153. package/prompts/advisor-design.md +66 -22
  154. package/prompts/advisor-round1.md +37 -3
  155. package/prompts/advisor-round2.md +44 -10
  156. package/prompts/advisor-round3.md +43 -9
  157. package/prompts/common.md +15 -375
  158. package/prompts/consult-base.md +6 -1
  159. package/prompts/discipline-engineering.md +251 -95
  160. package/prompts/discipline-normal.md +4 -250
  161. package/prompts/knowledge/business-gates.md +22 -0
  162. package/prompts/knowledge/decision-quality.md +23 -0
  163. package/prompts/knowledge/doc-lookup.md +35 -0
  164. package/prompts/knowledge/document-writing.md +51 -0
  165. package/prompts/knowledge/documentation-evaluation.md +56 -0
  166. package/prompts/knowledge/evidence-discipline.md +57 -0
  167. package/prompts/knowledge/normal-coding-workflow.md +104 -0
  168. package/prompts/knowledge/normal-delivery-collaboration.md +108 -0
  169. package/prompts/knowledge/normal-work-management.md +57 -0
  170. package/prompts/knowledge/product-security.md +23 -0
  171. package/prompts/knowledge/project-records.md +62 -0
  172. package/prompts/knowledge/tool-advisor.md +29 -0
  173. package/prompts/knowledge/tool-apply-patch.md +18 -0
  174. package/prompts/knowledge/tool-bash.md +39 -0
  175. package/prompts/knowledge/tool-batch-eng-coder.md +12 -0
  176. package/prompts/knowledge/tool-batch-eng-designer.md +12 -0
  177. package/prompts/knowledge/tool-batch-review.md +12 -0
  178. package/prompts/knowledge/tool-batch.md +80 -0
  179. package/prompts/knowledge/tool-browser.md +57 -0
  180. package/prompts/knowledge/tool-code-search.md +4 -0
  181. package/prompts/knowledge/tool-consult-start.md +12 -0
  182. package/prompts/knowledge/tool-consult-stop.md +6 -0
  183. package/prompts/knowledge/tool-context.md +6 -0
  184. package/prompts/knowledge/tool-delete.md +17 -0
  185. package/prompts/knowledge/tool-doc-check.md +70 -0
  186. package/prompts/knowledge/tool-doc-graph-read.md +20 -0
  187. package/prompts/knowledge/tool-doc-graph.md +49 -0
  188. package/prompts/knowledge/tool-doc-search.md +6 -0
  189. package/prompts/knowledge/tool-edit.md +38 -0
  190. package/prompts/knowledge/tool-eng.md +2 -0
  191. package/prompts/knowledge/tool-execute.md +16 -0
  192. package/prompts/knowledge/tool-fetch.md +12 -0
  193. package/prompts/knowledge/tool-file-ops.md +16 -0
  194. package/prompts/knowledge/tool-get-current-time.md +7 -0
  195. package/prompts/knowledge/tool-git-read.md +19 -0
  196. package/prompts/knowledge/tool-git.md +29 -0
  197. package/prompts/knowledge/tool-glob.md +15 -0
  198. package/prompts/knowledge/tool-goal.md +8 -0
  199. package/prompts/knowledge/tool-grep.md +18 -0
  200. package/prompts/knowledge/tool-hashline-edit.md +14 -0
  201. package/prompts/knowledge/tool-insert-after.md +15 -0
  202. package/prompts/knowledge/tool-instance-list.md +6 -0
  203. package/prompts/knowledge/tool-instance-send.md +10 -0
  204. package/prompts/knowledge/tool-knowledge.md +18 -0
  205. package/prompts/knowledge/tool-ledger-read.md +35 -0
  206. package/prompts/knowledge/tool-ledger.md +42 -0
  207. package/prompts/knowledge/tool-lint.md +16 -0
  208. package/prompts/knowledge/tool-ls.md +13 -0
  209. package/prompts/knowledge/tool-lsp.md +11 -0
  210. package/prompts/knowledge/tool-main-history.md +2 -0
  211. package/prompts/knowledge/tool-manifest-read.md +14 -0
  212. package/prompts/knowledge/tool-manifest.md +31 -0
  213. package/prompts/knowledge/tool-memory-read.md +20 -0
  214. package/prompts/knowledge/tool-memory.md +15 -0
  215. package/prompts/knowledge/tool-notify-parent.md +12 -0
  216. package/prompts/knowledge/tool-operations.md +114 -0
  217. package/prompts/knowledge/tool-peer-instances.md +2 -0
  218. package/prompts/knowledge/tool-plan.md +6 -0
  219. package/prompts/knowledge/tool-process-read.md +13 -0
  220. package/prompts/knowledge/tool-process.md +15 -0
  221. package/prompts/knowledge/tool-question.md +16 -0
  222. package/prompts/knowledge/tool-read-history-batch.md +22 -0
  223. package/prompts/knowledge/tool-read-history.md +36 -0
  224. package/prompts/knowledge/tool-read-image.md +11 -0
  225. package/prompts/knowledge/tool-read.md +21 -0
  226. package/prompts/knowledge/tool-recent-changes.md +6 -0
  227. package/prompts/knowledge/tool-repo-outline.md +4 -0
  228. package/prompts/knowledge/tool-settings-read.md +12 -0
  229. package/prompts/knowledge/tool-settings.md +18 -0
  230. package/prompts/knowledge/tool-skill.md +6 -0
  231. package/prompts/knowledge/tool-ssh.md +52 -0
  232. package/prompts/knowledge/tool-subagent.md +59 -0
  233. package/prompts/knowledge/tool-task.md +12 -0
  234. package/prompts/knowledge/tool-team-ledger-read.md +11 -0
  235. package/prompts/knowledge/tool-team-ledger.md +11 -0
  236. package/prompts/knowledge/tool-timer.md +23 -0
  237. package/prompts/knowledge/tool-tree.md +14 -0
  238. package/prompts/knowledge/tool-verify.md +19 -0
  239. package/prompts/knowledge/tool-wait-for.md +25 -0
  240. package/prompts/knowledge/tool-websearch.md +19 -0
  241. package/prompts/knowledge/tool-write.md +9 -0
  242. package/prompts/knowledge/upstream-protocol.md +43 -0
  243. package/prompts/persona-eng-coder.md +29 -3
  244. package/prompts/persona-eng-designer.md +131 -159
  245. package/prompts/persona-engineering.md +202 -131
  246. package/prompts/persona-explore.md +1 -1
  247. package/prompts/persona-plan.md +6 -1
  248. package/prompts/persona-tester.md +55 -0
  249. package/prompts/subagent-base.md +2 -0
  250. package/provider/anthropic.mjs +6 -4
  251. package/provider/core.mjs +5 -4
  252. package/provider/errors.mjs +29 -4
  253. package/provider/google.mjs +39 -12
  254. package/provider/rate.mjs +11 -3
  255. package/provider/responses.mjs +3 -1
  256. package/provider/sse.mjs +15 -4
  257. package/provider-flows.mjs +2 -2
  258. package/session-identity.mjs +21 -0
  259. package/session-index-build.mjs +1 -1
  260. package/session-index-pass.mjs +1 -1
  261. package/session-index-query.mjs +1 -1
  262. package/session-index.mjs +1 -1
  263. package/session-lifecycle.mjs +79 -19
  264. package/session-slot-write.mjs +37 -5
  265. package/session-slots.mjs +9 -14
  266. package/session.mjs +29 -8
  267. package/skip-dirs.mjs +48 -0
  268. package/team-ledger.mjs +17 -13
  269. package/text-budget.mjs +4 -0
  270. package/token-ttl.mjs +73 -4
  271. package/token-window.mjs +244 -34
  272. package/tool-docs/advisor.md +2 -27
  273. package/tool-docs/apply_patch.md +1 -13
  274. package/tool-docs/bash.md +2 -37
  275. package/tool-docs/batch-eng-coder.md +3 -0
  276. package/tool-docs/batch-eng-designer.md +3 -0
  277. package/tool-docs/batch-review.md +3 -0
  278. package/tool-docs/batch.md +3 -1
  279. package/tool-docs/browser.md +2 -47
  280. package/tool-docs/code_search.md +3 -1
  281. package/tool-docs/consult_start.md +2 -4
  282. package/tool-docs/consult_stop.md +2 -2
  283. package/tool-docs/context.md +1 -5
  284. package/tool-docs/delete.md +2 -14
  285. package/tool-docs/doc_check.md +2 -72
  286. package/tool-docs/doc_graph-read.md +3 -0
  287. package/tool-docs/doc_graph.md +3 -0
  288. package/tool-docs/doc_search.md +3 -1
  289. package/tool-docs/edit.md +2 -18
  290. package/tool-docs/eng.md +3 -1
  291. package/tool-docs/execute.md +2 -12
  292. package/tool-docs/fetch.md +2 -12
  293. package/tool-docs/file_ops.md +2 -16
  294. package/tool-docs/get_current_time.md +1 -6
  295. package/tool-docs/git-read.md +3 -0
  296. package/tool-docs/git.md +2 -27
  297. package/tool-docs/glob.md +2 -10
  298. package/tool-docs/goal.md +2 -5
  299. package/tool-docs/grep.md +2 -18
  300. package/tool-docs/hashline_edit.md +2 -13
  301. package/tool-docs/insert_after.md +2 -14
  302. package/tool-docs/instance_list.md +3 -0
  303. package/tool-docs/instance_send.md +3 -0
  304. package/tool-docs/knowledge.md +3 -0
  305. package/tool-docs/ledger-read.md +3 -0
  306. package/tool-docs/ledger.md +3 -8
  307. package/tool-docs/lint.md +2 -9
  308. package/tool-docs/ls.md +2 -11
  309. package/tool-docs/lsp.md +2 -9
  310. package/tool-docs/main_history.md +3 -1
  311. package/tool-docs/manifest-read.md +2 -7
  312. package/tool-docs/manifest.md +2 -28
  313. package/tool-docs/memory-read.md +3 -0
  314. package/tool-docs/memory.md +3 -11
  315. package/tool-docs/notify_parent.md +2 -13
  316. package/tool-docs/peer_instances.md +3 -1
  317. package/tool-docs/plan.md +2 -4
  318. package/tool-docs/process-read.md +3 -0
  319. package/tool-docs/process.md +2 -13
  320. package/tool-docs/question.md +3 -17
  321. package/tool-docs/read.md +2 -19
  322. package/tool-docs/read_history-batch.md +3 -0
  323. package/tool-docs/read_history.md +2 -6
  324. package/tool-docs/read_image.md +2 -7
  325. package/tool-docs/recent_changes.md +3 -1
  326. package/tool-docs/repo_outline.md +3 -1
  327. package/tool-docs/settings-read.md +3 -0
  328. package/tool-docs/settings.md +2 -5
  329. package/tool-docs/skill.md +3 -5
  330. package/tool-docs/ssh.md +2 -50
  331. package/tool-docs/subagent.md +2 -63
  332. package/tool-docs/task.md +2 -6
  333. package/tool-docs/team_ledger-read.md +3 -0
  334. package/tool-docs/team_ledger.md +3 -9
  335. package/tool-docs/timer.md +3 -13
  336. package/tool-docs/tree.md +2 -13
  337. package/tool-docs/verify.md +3 -1
  338. package/tool-docs/wait_for.md +2 -32
  339. package/tool-docs/websearch.md +2 -17
  340. package/tool-docs/write.md +2 -10
  341. package/tools/bash.mjs +12 -2
  342. package/tools/browser.mjs +52 -7
  343. package/tools/doc-write-gate.mjs +73 -0
  344. package/tools/edit-batch.mjs +176 -91
  345. package/tools/edit-diff.mjs +129 -45
  346. package/tools/edit-receipt.mjs +39 -0
  347. package/tools/execute.mjs +11 -5
  348. package/tools/file.mjs +32 -34
  349. package/tools/git.mjs +43 -2
  350. package/tools/index.mjs +6 -0
  351. package/tools/knowledge.mjs +143 -0
  352. package/tools/linter.mjs +3 -3
  353. package/tools/ops.mjs +4 -1
  354. package/tools/patch.mjs +127 -38
  355. package/tools/process-doc-mark.mjs +139 -0
  356. package/tools/search.mjs +15 -6
  357. package/tools/shared.mjs +31 -7
  358. package/tools/ssh.mjs +48 -7
  359. package/tools/tree.mjs +4 -1
  360. package/tools/write-gate-params.mjs +31 -0
  361. package/tools/write-path.mjs +79 -6
  362. package/traces/trace-store.mjs +4 -3
  363. package/window-policy.mjs +203 -0
  364. package/agent/light-round.mjs +0 -63
  365. package/agent/unbooked-pen.mjs +0 -62
  366. package/doc-check/anchors.mjs +0 -135
@@ -1,14 +1,3 @@
1
- A one-way channel to your PARENT (the agent that spawned you) — you are a subagent, so there is no user to ask. Queue a message on the parent's side; your turn is not interrupted and nothing is consumed from it.
1
+ Send a one-way message to your PARENT (the agent that spawned you) — you are a subagent, so there is no user to ask.
2
2
 
3
- - kind:'ask' — a question whose answer changes your next step and that you cannot answer from the materials you can read (task book / design doc / repo). The parent replies with subagent action:'send'; you receive it as an ordinary instruction at your next turn boundary. One ask at a time while a previous one still waits in the parent's queue.
4
- Read the materials first and carry the evidence you already checked (`file:line` + the key text) — the parent should not have to re-read for you.
5
- - kind:'note' — an FYI that needs no answer (a premise you found broken, a conflict you resolved and want visible early).
6
- - Delivery markers: the message your parent receives is headed `[上抛·待裁]` (ask — awaiting the
7
- parent's decision) or `[上抛·知会]` (note — FYI) — added for you, so do not write these markers
8
- inside `message`. In your final report the marker is yours to write: tag items still awaiting the
9
- parent's decision `[上抛·待裁]`, FYI items `[上抛·知会]`.
10
- - NON-BLOCKING: returns immediately — keep working on the unaffected parts, keep the affected part pending. No fetch, no polling; finish first = report the unanswered part as not done.
11
- - SYNCHRONOUS SPAWN: if the parent is blocked on your run, nothing can be sent back — `send` reaches only a RUNNING ASYNC child; the message is read when the parent's call returns (it may re-spawn you with an answer). Do not idle-wait.
12
- - Out of scope: naming / implementation / wording details, anything a read or a command would answer, trade-offs the task book already states — use the stop-and-report discipline, not this channel.
13
- - Availability: subagents only (depth > 0). At depth 0 you talk to the user through your normal reply or the question tool.
14
- - Limits: message ≤1,500 chars; the parent's in-flight queue holds ≤20 messages — exceeding either is an explicit error (nothing is silently dropped).
3
+ {{knowledge:tool-notify-parent}}
@@ -1 +1,3 @@
1
- peer_instances — read-only: list other live ThinCoder instances sharing this workspace cwd. Returns [{ pid, end, sessionId, slots }]; never includes self; pure read — writes nothing.
1
+ List other live ThinCoder instances sharing this workspace cwd.
2
+
3
+ {{knowledge:tool-peer-instances}}
package/tool-docs/plan.md CHANGED
@@ -1,5 +1,3 @@
1
1
  Enter or exit plan mode.
2
- In plan mode you are restricted to READ-ONLY tools: read files, search code, run read-only shell commands.
3
- Use plan mode before complex multi-step tasks — explore the codebase, design the architecture, present a plan to the user.
4
- Exit plan mode to present the plan for the user's approval; implement only after they approve.
5
- For simple single-file edits, skip plan mode and just make the change.
2
+
3
+ {{knowledge:tool-plan}}
@@ -0,0 +1,3 @@
1
+ List running processes, optionally filtered by name — read-only.
2
+
3
+ {{knowledge:tool-process-read}}
@@ -1,14 +1,3 @@
1
- List running processes, optionally filtered by name — or kill a process tree / a background task. List returns process name / PID / memory; kill returns a one-line confirmation.
1
+ List running processes — or kill a process tree or a background task.
2
2
 
3
- **Route to process instead of bash:**
4
- - `tasklist` (Windows) / `ps aux` (POSIX) → process
5
-
6
- Parameters:
7
- - action (optional, default 'list'): list — show running processes; kill — terminate a process tree (target: pid) or a background task (target: id)
8
- - name: (list) substring filter (case-insensitive), e.g. "node", "python"
9
- - pid: (kill) process id — the whole tree is terminated (taskkill /T /F on win32; POSIX group kill)
10
- - id: (kill) background task id — a `bash#N` (bash async ack) or `browser#N` (browser async ack): bash ⇒ its process tree is terminated; browser ⇒ a queued task is dropped, a running one is aborted (the browser itself is not killed); either way the entry leaves the pool and no digest will arrive (a bash task's log so far stays readable).
11
-
12
- Notes:
13
- - kill is destructive: pass exactly one target (pid or id — never both), and it goes through the same approval gate as other destructive actions — confirm before killing.
14
- - Repeating a kill is idempotent (same confirmation, no double kill); an unknown or already-finished task id comes back as `Error: ...`.
3
+ {{knowledge:tool-process}}
@@ -1,18 +1,4 @@
1
- Ask the user a question and wait for their response. Use when the task is ambiguous, you need a design decision, or you're stuck and need human judgment.
2
-
3
- Parameters:
4
- - question (required): The question to ask the user
5
- - options: Array of single-choice options for the user to pick from (optional). MUST be plain strings, e.g. ["A", "B", "C"] — never objects.
6
-
7
- Notes:
8
- - The agent loop pauses until the user answers
9
- - The answer is injected as the next user message
10
- - Returns the user's answer — the chosen option or free text — as the next message; the loop resumes when it arrives.
1
+ Ask the user a question and wait for their response.
11
2
  {{inject:question-ui-face}}
12
- - Use sparingly — prefer making reasonable decisions when possible
13
- - Ask ONE question per call — never bundle multiple sub-questions into one question string; ask the next one after the answer arrives.
14
- - Keep the question text short — one or two sentences. Background, context, and analysis belong in your normal reply text, NOT in the question.
15
- - Routine confirmations (confirm gates) belong in your plain reply text — the user answers in their next message. Use this tool ONLY when you need the user's decision or input to proceed.
16
- - Ask here when no default can carry the work forward (new scope, a ruling on a criterion) — this blocks; when a reasonable default exists, ask in your ordinary reply text and keep going — a reply arriving while you work steers the work from there.
17
- Read the materials first and carry the evidence you already checked (`file:line` + the key text) — the user should not have to re-read for you.
18
- - After receiving an answer about a design convention, tool preference, or recurring pattern: save it with the memory tool (action: put). This prevents asking the same question in future sessions — the user shouldn't have to repeat their preferences.
3
+
4
+ {{knowledge:tool-question}}
package/tool-docs/read.md CHANGED
@@ -1,20 +1,3 @@
1
- Read a text file. Returns numbered lines. Use offset/limit to page large files.
1
+ Read a text file and return its numbered lines.
2
2
 
3
- **Route to read instead of bash:** `cat file` / `type file` / `node -e "fs.readFileSync(...)"` → read. Reading a file is a read — never shell out for it.
4
-
5
- **Routing:**
6
- - Don't know which file? → `repo_outline` / `code_search` / `glob` first
7
- - Know the symbol but not the location? → `code_search` or `lsp definition`
8
- - Know the file but not the lines? → `grep` to find line numbers, then read that range with offset/limit
9
- - Reading an image? → `read_image` instead
10
-
11
- Parameters:
12
- - path (required): File path, relative to cwd or absolute (alias: filePath)
13
- - offset: 1-based line number to start reading from
14
- - limit: Max lines to return (default 2000) — windows over files beyond that return head + `…(truncated: K lines in middle, use offset to continue)` + the file's real tail lines, so the file end is never hidden
15
- - hashes: Include SHA256 content hashes per line (for hashline_edit). Set true before using hashline_edit.
16
-
17
- Notes:
18
- - Always prefer this over `cat` or shell-based reading — it caps output and avoids large dumps
19
- - Use offset for pagination when the file is large
20
- - When you plan to edit the file, set hashes=true to get line hashes for hashline_edit — hash-based editing avoids whitespace/encoding matching failures
3
+ {{knowledge:tool-read}}
@@ -0,0 +1,3 @@
1
+ Read the parent session's messages for THIS batch — read-only and bounded.
2
+
3
+ {{knowledge:tool-read-history-batch}}
@@ -1,7 +1,3 @@
1
- Query message history — THIS session by default, any session on disk with `path`. Recall what was said or done earlier: design decisions, tool-call timing, past rulings.
1
+ Query message history — this session by default, any session on disk with `path`.
2
2
 
3
- Default (no path): this session's full record (never compacted, audit-complete). Filters combine with AND (role / keyword / tool / since-until / limit / direction — semantics per parameter; keyword with path="all" matches FTS words / phrases). Returns a JSON array in chronological order: [{ts, role, name?, tool_call_id?, content (≈500 chars, truncated marker), tool_calls ([{name, arguments}] — arguments capped at 300 chars)}]. Messages without ts return ts:null; content is truncated — the full text is in the session file.
4
-
5
- Cross-session (`path`, optional): a session file path deep-queries THAT session with the same filters (relative paths resolve against the project cwd) — from the derived session index when it covers that session, otherwise from the session file itself (a file over 50,000 messages or 200,000 lines is refused as "session too large"). "cwd:<dir>" lists that directory's session slots (slot + file path + title + count + updatedAt; copy one into path= to deep-query it). "all" searches every INDEXED session (cross-project; rows carry session.file) — sessions never indexed yet are invisible (query them with path=<file>, or index first with the CLI `thincoder session index --rebuild`).
6
-
7
- 检索/记忆族选哪个:查**本会话**说过/裁定过 → read_history(默认);查**别的会话/项目**旧对话 → read_history 带 path/cwd 参数;查**本 run 改过哪些文件** → recent_changes;查**跨会话已存知识/约定**(memory)→ memory search;查**项目设计文档** → doc_search;查**代码实现** → code_search;查 git 历史快照 → checkpoint cat/versions。read_history 只查会话消息——文件级改动用 recent_changes——知识与约定用 memory——互相不替代。
3
+ {{knowledge:tool-read-history}}
@@ -1,8 +1,3 @@
1
- Read an image file and return it as multimodal content visible to the model. Use this to view screenshots, UI mockups, diagrams, or any visual content. The model only sees images through this tool — it cannot "see" files directly. Supports png, jpg, gif, webp. The image is base64-encoded and included in the response. Large images (>15MB) are rejected.
1
+ Read an image file and return it as content you can see.
2
2
 
3
- Parameters:
4
- - path (required): Path to image file (relative to cwd or absolute). Supports png, jpg, gif, webp; svg is returned as text source.
5
-
6
- Notes:
7
- - Raster formats only (png/jpg/gif/webp): no mainstream vision API (Kimi, Anthropic, OpenAI, Gemini) accepts svg or bmp, and an unsupported image part in history makes every subsequent request fail with 400. svg files are returned as text source instead (readable by any model); bmp is rejected — convert to PNG first.
8
- - This tool only works with models that support vision/image input (capability is spec-driven — the model spec decides, not a hardcoded list). Models without vision support will receive an error — except svg, which needs no vision support since it is read as text.
3
+ {{knowledge:tool-read-image}}
@@ -1 +1,3 @@
1
- Show files modified in this agent run (write/edit/insert_after/delete). Use when you need to remember which files you've already touched — during long multi-file tasks, it's easy to lose track. This is scoped to the current run, unlike git status which shows all uncommitted changes. For session-level history (what was said in a session), use read_history.
1
+ Show files modified in this agent run.
2
+
3
+ {{knowledge:tool-recent-changes}}
@@ -1 +1,3 @@
1
- Show the project's file dependency outline: which files import/export from which, and what symbols they export. Use when you need to understand the project structure, find where a function is defined, or see what files depend on a module. Pass a path to focus on a single file's relationships. Find code by keyword or snippet with code_search.
1
+ Show the project's file dependency outline: which files import/export from which, and what symbols they export.
2
+
3
+ {{knowledge:tool-repo-outline}}
@@ -0,0 +1,3 @@
1
+ Read ThinCoder runtime configuration, read-only.
2
+
3
+ {{knowledge:tool-settings-read}}
@@ -1,6 +1,3 @@
1
1
  Adjust ThinCoder runtime configuration — persisted to config.json AND hot-applied to the live agent config.
2
- Actions: list (all keys + values, flattened) | get <key> | set <key> <value> — dot paths into config.json, any nesting.
3
- set persists to disk (only the set key is written — defaults are never baked in) and takes effect in the running session immediately (turn-boundary keys apply next turn); the value survives restarts.
4
- Known keys are type-checked: scalar keys against the built-in defaults (agent.maxTurns a number, traces.enabled a boolean); keys whose default is null against their real consumption shape — defaultModel "provider:model", agent.subagentModel / shell non-empty string, memory.team object with a repo — so a value the app would silently drop is refused (null clears the key: the entry is removed from config.json and the built-in default applies; string-typed keys refuse null — no "unset" state to fall back to). Unknown keys under a known section are stored as given.
5
- SENSITIVE keys (path segment matching apiKey/key/token/secret/password/authorization/auth/cookie/credential, or any key under a headers/env segment) are NEVER echoed in plaintext — list/get/set replies show ••••(masked); setting a sensitive key is allowed and stored, but never echoed back.
6
- list/get are read-only (planMode ok, no approval); set is a side effect (approval gate). The /config TUI command is the human equivalent.
2
+
3
+ {{knowledge:tool-settings}}
@@ -1,5 +1,3 @@
1
- Load a project skill from .thincoder/skills/.
2
- Skills contain reusable instructions, workflows, or reference material.
3
- Use this when the user references a skill by name, or when a task matches a known skill's description.
4
- Call with action='list' to see available skills; call with action='load' and name=<skill> to activate one.
5
- Returns the skill list ('list'), the load confirmation ('load' — instructions arrive in the next message), or Error: ... with the available skills.
1
+ Load a project skill from `.thincoder/skills/`.
2
+
3
+ {{knowledge:tool-skill}}
package/tool-docs/ssh.md CHANGED
@@ -1,51 +1,3 @@
1
- Open and drive a persistent interactive SSH session (remote login shell) on a host. The session survives across tool calls; password hosts get a credential window — the value never appears in tool args or results (an explicit opt-in can store it as ciphertext on this machine).
1
+ Open and drive a persistent interactive SSH session (remote login shell) on a host, and move single files to or from that host (`put` / `get`).
2
2
 
3
- **Route to ssh instead of bash:**
4
- - a one-shot non-interactive command over ssh → `bash` with `ssh host <command>` (cheaper, no session)
5
- - an interactive shell that must survive several calls (network device CLI, interactive prompts) → ssh
6
-
7
- Parameters:
8
- - action (required): connect | send | read | secret_input | close | list | credentials | forget
9
- - host: connect / forget — target host (IP or name)
10
- - user: connect — login user (optional: your local ssh config decides, else the user recorded for this host locally)
11
- - port: connect / forget — TCP port (optional, default 22)
12
- - label: connect — short human label for this session (optional); secret_input — label for the value being sent
13
- - promptPattern: connect — regex that marks the shell prompt as ready (optional): send/read then settle the moment the prompt appears instead of waiting out the silence window
14
- - identityFile: connect — private-key path to offer as `-i` (`~` expands); remembered for this host and reused when omitted (optional)
15
- - id: send / read / secret_input / close — session id from connect (`ssh#N`)
16
- - data: send — text to type into the session (a trailing newline is passed as-is; otherwise Enter is sent as `\r`)
17
- - settle: send — wait for the ready verdict before returning (default true); false returns right after the bytes are written
18
- - timeoutMs: send / read — wait budget override (default 10000; the wait then returns partial output with a readable line)
19
- - maxChars: read — return cap override (default 8000; the full output stays in the session log)
20
-
21
- Output:
22
- - every result starts with the session status line: `[ssh (ssh#3) 10.0.0.5 — ready · idle 3s]`
23
- - connect returns the first screen; send returns the round's output plus the ready verdict (silence | prompt matched | timeout); read returns what arrived since the last read
24
-
25
- Notes:
26
- - Key-first: keys, your ssh config and ssh-agent are always tried before any saved credential — a connect succeeds without a window
27
- when a key works, and the credential store is not read at all in that case. To make a password host prompt-free, install a key once:
28
- `ssh-keygen -t ed25519` (if you have none), then `ssh-copy-id user@host` (or append `id_ed25519.pub` to the host's
29
- `~/.ssh/authorized_keys`), then reconnect.
30
- - Credential discipline: the password is asked for in a window and reaches ssh only through its child-process environment — never in tool
31
- args, never echoed in a result, never stored in plaintext. Any captured output containing that value (or a value given to secret_input)
32
- is scrubbed from the returned text and from the session log.
33
- - Saving a credential is opt-in: the credential window carries a `save` checkbox (off by default). When checked and authentication succeeds,
34
- the password is stored encrypted with your OS user account (Windows DPAPI) in a per-user file outside the repository; the store holds only
35
- ciphertext. A saved credential is reused silently — the next connect skips the window, and only after key
36
- authentication fails. The residual risk is honest: another process running as the same logged-in user can decrypt it; this protects the
37
- file at rest, not a compromised account. Saving is Windows-only for now; on other platforms the checkbox does not appear and the window
38
- keeps asking.
39
- - Fail-soft: an unreadable/undecryptable entry, a damaged store or a missing backend falls back to the credential window (the connection is
40
- not broken; undecryptable entries are kept). If the server rejects a saved credential it is deleted and the window is shown. A failed save
41
- never affects the connection.
42
- - 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.
43
- - 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 is closed automatically. `close` ends it (stdin EOF → 1.5s grace → the process tree is killed). Ctrl+I (interrupt) does not kill sessions; a user Stop does.
44
- - Output is capped per return (8000 chars, tail kept); the full stream is always in the session log whose path connect returns.
45
- - 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.
46
- - 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.
47
- - read / list / credentials are read-only (no approval prompt); connect / send / secret_input / close / forget 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.
48
- - 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.
49
- - Not for file transfer or port forwarding — run `scp` / `sftp` / `ssh -L` through bash.
50
-
51
- 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.
3
+ {{knowledge:tool-ssh}}
@@ -1,64 +1,3 @@
1
- ONE tool, NINE actions — pick by what you need:
1
+ Spawn, steer and inspect sub-agents — one `action` per call.
2
2
 
3
- - action:'spawn' (DEFAULT): run a sub-agent in its own isolated context — its reads, searches and tool calls never reach your history; only the final report comes back. Spawn MULTIPLE subagents in the SAME response for parallel work — they run concurrently.
4
- - action:'status': NON-BLOCKING progress query — returns immediately, consumes nothing, never fetches. Pass the spawn id for one child (role, state: running|queued|done, model, elapsed, turn, position, plus a touched-files summary — first 5 + a count) or omit it for a pool overview — see what a
5
- running child has changed BEFORE cancelling it. Background advisor reviews share this surface (pass the review id — role:'advisor', reviewType/round/elapsedSec, same shape).
6
- - action:'observe': SEE what a running async subagent is DOING right now (progress vs stuck) — pass the id; returns state, turn, the tool(s) executing right now (omitted when none), and the last N one-line turn summaries, newest first (default 5, via recent). Readonly; running/queued/done all answer
7
- — queued returns a placeholder, done gives the activity summary only, NOT the report (it rides the auto channel). Judge stuck vs progressing BEFORE cancelling or steering.
8
- - action:'send': STEER a running async subagent mid-flight — id + message (a direction, e.g. "check X, don't fixate on Y"). The child consumes it at its next turn boundary as an ORDINARY user instruction (non-interrupting; its discipline is unchanged — guidance, not a deviation waiver); returns {id,
9
- status:'delivered', queued}. Only RUNNING async children are targetable — sync/queued/settled/unknown error clearly; if the child settles first, its report carries an 'undelivered' note.
10
- - action:'escalate' (飞刀): hand an implementation task to a STRONGER model from your consult models; it gets WRITE access and does the work itself, then returns a post-op report (what changed, why, verification). Escalate EARLY, when the task calls for stronger hands (complex refactors, intractable
11
- bugs, intricate algorithms — or beyond your comfortable ability). Not available in engineering mode (implementation goes through eng-coder). Default-async at depth 0: ack {id, role:'escalate', status:'running'} returns immediately; the report arrives automatically with its mutations merged into
12
- your bookkeeping (pooled with the other role-domain spawns).
13
- - action:'cancel': STOP ONE background subagent — the id from the spawn return is REQUIRED (a blanket cancel is unsupported; Ctrl+C stops everything). Running aborts immediately ({id, status:'cancelled'}); queued is removed ({id, status:'cancelled', was:'queued'}; later positions shift). Other
14
- children and the session keep running. Cancel is a last resort: verify alarming signals with reliable checks (git/node — not guesses) first, and prefer scoped recovery — a running child's in-flight work dies with it, partial changes stay unmerged and unaudited. Background advisor reviews cancel
15
- the same way (pass the review id — no token is issued for a cancelled review).
16
- - action:'consume-design' (engineering mode, parent side): chain-terminal token consumption — after the delivery is verified and the chain closes out, consume this design's token slot. Selectors — pass exactly ONE: designId (a single slot; optional for a single-design session), designIds (an
17
- explicit non-empty list), expired:true (every expired slot), or olderThanDays:N (every slot older than N days). A consumed slot mechanically rejects further spawns for the same designId — new work (deviation fixes included) needs a fresh design review and token. Idempotent
18
- (unknown/already-consumed = a no-op notice); batch calls report per-slot lines + a `consumed N` count line. Do NOT call while the chain is still open — fix rounds reuse the same slot.
19
- - action:'design-slots' (engineering mode, parent side): READ-ONLY inventory of this session's approved design token slots — one line per slot (designId, live|expired, ageDays, expiresAt, batch, designToken), oldest first, ending with a total/live/expired count line. Nothing is written. Use it to
20
- see what still holds a slot before consuming; the expired / olderThanDays selectors act on the same set.
21
- Every row carries its designToken value (expired ones included — status marks them; a malformed record shows designToken=—). Pass designId to filter to a single slot (trimmed exact match; unknown = refused with the held id list; empty string = no filter). Take designId + designToken verbatim onto
22
- the eng-coder spawn — the gate checks exact equality.
23
- - action:'panel': DIAGNOSE + fix the subagent panel (the collapsible blocks the user sees; headless/VS Code degrade to a 'no panel' pool view). view (default): the live blocks (key, role, status: running|done|awaitingDigest) exactly as the user sees them — digested-stuck entries carry digested:true.
24
- freeze: pass a digested-stuck block key (e.g. 'eng-coder#9' — {action:'panel', freeze:'role#N'}) to reclaim it into the conversation — passes ONLY for awaitingDigest blocks with no live pool entry and no pending report (a still-pending report would break the digestion order — refused).
25
-
26
- Why delegate? The child's noise never reaches your window — delegation keeps your context lean and the child focused; parallel children save wall-clock time, and coder/eng-coder children self-review (verify + advisor) before their reports arrive.
27
-
28
- Available roles (exposed per mode; the role is REQUIRED for action:'spawn' — a missing or misspelled role is refused):
29
- - explore — read-only search & analysis (read/search family); no git context — 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).
30
- - plan — read-only planning; NEVER edits; returns a step-by-step plan.
31
- - coder — full implementation; the parent's complete read/write/execute toolset plus verify and advisor self-review. Its report carries a delivery table, one row per requirement (Done / Simplified / Not done — no deferred column). Normal mode: may optionally carry `batchDoc` — binds this spawn's §5
32
- record-write channel (unbound ⇒ the main agent records §5 on its behalf); when provided the path must resolve to a readable file.
33
- - eng-coder — engineering mode only (replaces coder): same toolset plus the design-driven methodology overlay; its delivery protocol (implementation → audit → self-fix → advisor re-review → converged delivery) runs fully inside the child. REQUIRES a valid designToken from a passed
34
- advisor(type='design') review — pass the exact value from that review, or copy it verbatim from the action:'design-slots' row (the text after designToken=): missing or mismatched = the spawn is refused, and an expired token is refused with expired named (its reply also echoes a designId — pass it:
35
- required to pick between concurrent designs, optional for one; echo it back in the delivery report). REQUIRES a batchDoc — the batch record path, the task book this spawn implements (refused without it or when it does not resolve to a readable file).
36
- - eng-designer — engineering mode only: the SOLE author of the design documents and of the batch record's design section (requirement docs stay with the main agent). Writes no implementation code, does not edit prompts, does not fire reviews, needs NO designToken. Surveys on its own; may only spawn
37
- read-only explore children (sync, ≤6 per batch). REQUIRES a batchDoc (same gate as eng-coder).
38
-
39
- Task book (normal-mode roles: explore / plan / coder): four core structured parameters — goal (goal & why), knownFacts (the facts you already verified), acceptance (machine-verifiable criteria), reportFormat (delivery-report format)
40
- — plus scope (scope & forbidden scope — what to read / what not to touch).
41
- All five are required: a missing, blank or non-string value is refused with the parameter named.
42
- A free-text task is an optional supplement, never the whole brief.
43
- Engineering roles (eng-coder / eng-designer) take their task book from the batch record: batchDoc (the record path) and round (initial|fix), plus files / dependsOn for scheduling; the child reads §2 of that record itself — no other task text is passed.
44
- An eng-coder spawn also carries designToken — the write credential (the exact value from the review, or copied verbatim from the action:'design-slots' row, the text after designToken=), and designId when several designs are open: missing or mismatched = the spawn is refused.
45
-
46
- Pass one parameter per field — contents only (the runtime adds the labels):
47
- subagent(role="eng-coder", round="initial", batchDoc="<batch record>", designToken="…", files=[…])
48
- subagent(role="explore", goal="…", knownFacts="…", scope="…", acceptance="…", reportFormat="…")
49
-
50
- Mode filtering: normal mode exposes explore/plan/coder; engineering mode exposes explore/eng-designer/eng-coder — off-mode roles are refused mechanically (enums filtered at assembly; the spawn gate re-checks).
51
-
52
- Async spawn: top-level spawns are async by default — never pass async:false at depth 0 (the spawn returns {id, status:"running"} immediately; the report arrives automatically; if your next step needs it, end the turn and let the digest deliver it — do not poll; the explicit async:false is a
53
- mechanism parameter, not for model use). Inside subagents (depth>0) spawns are always synchronous. Async spawns are pooled per role domain — 4 concurrent eng-coders plus 4 concurrent other-role spawns by default (agent.poolLimits overrides both); a full domain queues further spawns with a position
54
- while the other keeps starting.
55
-
56
- Task scheduling: declare files (the file paths this task will modify) and dependsOn (ids from prior async returns whose outcome this task needs) to let the scheduler order your spawns. Overlapping-file tasks serialize and dependents start in order: a conflicting/dependent spawn queues
57
- (position/reason) and auto-starts when the conflict clears / the dependency settles (cancel to drop). A cancelled/failed dependency leaves it queued marked "dependency cancelled" until you decide (AUTO sessions auto-start). Unknown ids error; a consumed id counts as satisfied. Omit both for a plain
58
- immediate spawn (no scheduler involvement).
59
-
60
- Writing the prompt:
61
- - The child starts with zero context — brief it like a colleague who just walked in: goal, what you already know, the specifics.
62
- - Put exact paths and commands in — do not make it search for what you already know.
63
- - Do not delegate understanding: resolve the paths/line numbers the task hinges on first.
64
- - Once it runs, leave that scope to it — don't redo its searches in parallel or finish manually midway.
3
+ {{knowledge:tool-subagent}}
package/tool-docs/task.md CHANGED
@@ -1,7 +1,3 @@
1
1
  Plan and track a task list for complex multi-step work.
2
- Each call replaces the entire list.
3
- Keep exactly one item in_progress at a time; mark items done as you complete them; never mark done if tests fail or work is partial.
4
- Statuses: pending | in_progress | done — synonyms (completed/finished/complete, todo/open/waiting, active/running/working, …) are accepted and normalized with a warning.
5
- IMPORTANT: title is required and must be a non-empty string — items with empty titles are silently dropped.
6
- For cross-session / project-level tracking, use `/ledger`.
7
- Returns the updated task list (or the new item's ID on add).
2
+
3
+ {{knowledge:tool-task}}
@@ -0,0 +1,3 @@
1
+ The team ledger, read-only: one book on the server, shared by the whole team, usable once you are logged in.
2
+
3
+ {{knowledge:tool-team-ledger-read}}
@@ -1,9 +1,3 @@
1
- 团队台账(服务端一本——登录后可用;与**本机台账两账独立**:本机账照旧,团队账零离线缓存)。action = query / count / add / update / close。
2
- - query / count:只读全角色;add / update / close:写仅主 agent 装配面(子代理只读)。
3
- - 仓标记自动派生(当前项目根的 git 源——不手挑):无 git 仓 ∥ 无 remote.origin.url ⇒ 明示失败、零请求。
4
- - query:scope = "repo"(缺省——当前仓)∥ "team"(全队跨仓);过滤 status(六态:待讨论 / 待设计 / 在途 / 待核销 / 已核销 / 已废弃)∥ owner(用户名精确匹配);行集携 aged(未决四态 ∧ 行龄 > 30 天)。
5
- - count:同 query 参数,出 total。
6
- - add:title 必填(≤200)∥ detail(≤4000)∥ owner(缺省 = 自己)——status 恒 待讨论。
7
- - update:id 必填;title / detail / owner / status 至少一件;status = 迁移表合法后继(待讨论→待设计 ∥ 待设计→在途 ∥ 在途→待核销 ∥ 待核销→已核销 ∥ 未归档→已废弃);已归档(已核销 / 已废弃)⇒ 拒;仓不可改。
8
- - close:id + status(已核销 ∥ 已废弃)——已核销:勾销(待核销)/ 追认核销(待讨论 ∥ 待设计,须正文非空);已废弃 = 撤回(任意未归档态)。
9
- - 登录态门:未登录 ⇒ 明示「未登录」且零请求;401(token 失效)⇒ 「登录已失效——请重新登录」;不可达 ⇒ 「服务器不可达」(零离线缓存,重试不落旧值)。
1
+ The team ledger: one book on the server, shared by the whole team, usable once you are logged in.
2
+
3
+ {{knowledge:tool-team-ledger}}
@@ -1,13 +1,3 @@
1
- Set a timer before you start analyzing code.
2
- When the timer fires, a system reminder will be injected suggesting you try running code or adding debug logs.
3
- Use this to enforce a thinking budget: you get N seconds to reason, then the timer reminds you to act.
4
- Beyond a one-shot countdown, three schedule forms are available, one per call (`seconds`, `at`, `every` and `daily` are mutually exclusive — passing more than one is a validation error):
5
- `at` takes a local clock time such as "2026-10-13T09:00" and fires once at that moment — a time already past fires immediately.
6
- `every` takes a fixed interval in seconds (minimum 60): the first reminder comes N seconds after setting, then every N seconds, until cancelled.
7
- `daily` takes a local "HH:MM" and repeats every day at that time (a time already past today fires tomorrow), until cancelled.
8
- All times are local to the host.
9
- `cancel` takes the id from the set confirmation and stops that timer; `list` shows every pending timer with its next due time. Repeating timers occupy one pending slot each until cancelled.
10
- Returns the set confirmation — the reminder fires at the deadline.
11
- Delivery: when the session is idle it is delivered on the spot and starts a turn — the idle wake is available on the CLI / VSC / desktop foregrounds and suspension windows (headless is structurally unsupported).
12
- A user turn gets no delivery: while a session turn is running, an expired timer waits for the next delivery round (suspension window / idle latch); other paths keep the step-boundary behavior.
13
- A pending timer survives across runs; at most 8 timers may be pending at once, and further timer calls are rejected until some expire.
1
+ Set a timer whose expiry injects a reminder — a way to hold yourself to a thinking budget.
2
+
3
+ {{knowledge:tool-timer}}
package/tool-docs/tree.md CHANGED
@@ -1,14 +1,3 @@
1
- Generate a directory tree of the codebase (default depth 3). Skips dotfiles, .git/node_modules/dist/build/bin/obj and other build/vendor dirs, and binary files. Use to quickly see which modules exist and where files live.
1
+ Generate a directory tree of the codebase.
2
2
 
3
- **Route to tree instead of bash:**
4
- - `tree` / `find .` / `dir /s` → tree
5
-
6
- Parameters:
7
- - path: Root directory (default cwd)
8
- - depth: Tree depth (default 3, max 6). Directories are listed before files, both sorted.
9
-
10
- Notes:
11
- - Capped at 200 entries.
12
- - Directories end with `/`; tree-drawing uses `├──`/`└──`/`│`.
13
- - Use depth for a shallow overview; use `ls` for one directory, `glob` for a specific file pattern.
14
- - Returns the directory text tree — directories first (`dir/`), files after, both sorted, capped at 200 entries.
3
+ {{knowledge:tool-tree}}
@@ -1 +1,3 @@
1
- Generic pre-completion verification gate — language/framework/project agnostic. verify does NOT run any test/verification command for you and does NOT require a test per change. You DECLARE your verification status via the verification argument ({ status: 'passed' | 'failed' | 'skipped', command?, summary?, basis? } — effects per parameter): the declaration is self-reported evidence — verify only mechanically gates on it ('passed' → allowed; 'failed' → blocked; 'skipped' → allowed but needs a reason). 'basis' (optional) is the 'what it stands on' dimension of the declaration — a judgment source, a read file:line coordinate, or an explicit 'unverified' (declaration-only: no format is enforced or machine-checked); a passed / skipped declaration with no basis gets one advisory hint line in the report — never blocking and never changing the gate — while the failed face gets no basis hint (already blocked). Whether/how to verify is described in natural language in the project's AGENTS.md and is decided + executed by you. The report also carries the changed files (git diff), an advisory node --check hint on changed .js/.mjs (not gating), the task list, and a self-review checklist. Call this BEFORE declaring a coding task complete — do not say 'done' until verify passes.
1
+ Generic pre-completion verification gate — language, framework and project agnostic.
2
+
3
+ {{knowledge:tool-verify}}
@@ -1,33 +1,3 @@
1
- Wait until a condition becomes true — polls every interval_ms and returns as soon as it holds or timeout_ms passes.
1
+ Wait until a condition becomes true.
2
2
 
3
- **Use it only for states that cannot announce themselves**: a file appearing, a port opening, a background bash or browser task finishing. Nothing delivers those into the session, so a blocking wait is the only way to learn about them.
4
-
5
- **Never use it to wait for a subagent or a review report.** Those arrive on their own when the session is idle — the act of waiting for one is simply ending the turn.
6
-
7
- `wait_for "subagent id:N done"` and `wait_for "advisor settled"` park the session for the whole budget, poll hundreds of times, and learn nothing you would not have been handed anyway.
8
-
9
- Measured in practice: two such waits in one session burned ~4.5 minutes and 210 polls on reports that were already on their way. The conditions stay supported (a background task genuinely may need joining), but reaching for them on a child is the classic misuse.
10
-
11
- Parameters:
12
- - condition (required): a semantic condition expression:
13
- - `advisor settled` — an in-flight advisor review session has finished — **discouraged**: the report is delivered automatically; end the turn instead
14
- - `subagent id:N done` — async subagent N (the id your async spawn ack returned) has settled — **discouraged**, same reason
15
- - `consult done` — every consult_start session has drained — the verdict text is delivered automatically; wait only when a synchronous caller cannot proceed without it
16
- - `bash id:N done` — background bash task N (the id from the bash async ack, `bash#N`) has finished — settled, or already left the pool (nothing left to wait on)
17
- - `browser id:N done` — a background browser task N (the id from the ack, `browser#N`) has settled — finished, or already left the pool (nothing left to wait on)
18
- - `file exists:path` — the file at path exists (path relative to cwd)
19
- - `port open:N` — something is listening on 127.0.0.1 port N
20
- - The agent-internal conditions (advisor / subagent / consult / bash) apply to ASYNC sessions only — a synchronous call already completed before it returned and has nothing to wait for.
21
- - An unknown condition is an explicit error (`wait_for: unsupported condition "..."` — the supported forms are listed above), never a silent wait.
22
- - interval_ms: poll interval (default 1000, floor 100 — polling never busy-spins)
23
- - timeout_ms: overall ceiling (default 30000; config.json `agent.waitForTimeoutMs` overrides the default; hard cap 600000 like the execute tool)
24
-
25
- Returns:
26
- - `wait_for: condition satisfied after Nms (N checks): "<condition>"` — condition held
27
- - `wait_for: timed out after Nms waiting for "<condition>" ...` — ceiling passed with the condition still false (never burns beyond the ceiling)
28
- - interrupts (Ctrl+C / cancel) exit immediately; malformed conditions and unsupported syntax error out explicitly
29
-
30
- Notes:
31
- - Read-only and non-destructive — it only observes (agent pools, the filesystem, a local port probe).
32
- - Blocking by design — call it ALONE in a turn, not batched with calls that depend on its result.
33
- - This is the one blocking call an agent usually should not reach for. Before calling it, ask: **will this state announce itself to me anyway?** If yes (a subagent report, a review digest, a timer), end the turn and let it arrive.
3
+ {{knowledge:tool-wait-for}}
@@ -1,18 +1,3 @@
1
- Search the web (DeepSeek Search when a DeepSeek provider is configured; otherwise Tavily with a key, else Bing). Returns result titles, URLs, and snippets — DeepSeek results also carry a date · authority (0–4) · rerank (0–3) line and a long summary. Use for looking up current information, docs, error messages.
1
+ Search the web and return result titles, URLs and snippets.
2
2
 
3
- Parameters:
4
- - query (required): Search query
5
- - limit: Max results (default 8, max 20)
6
- - engine: Specific engine to use — "bing" (Bing). Omit to search all engines concurrently.
7
- - page: Page number for pagination (1-based, default 1). Only used when engine is specified.
8
- - proxy: http://host:port explicit proxy (optional) — use ONLY when passed; no proxy = direct. config.json proxy is NOT auto-applied (2026-08-31 ruling); Bing/foreign sites usually need a proxy, domestic targets don't
9
-
10
- Notes:
11
- - Before searching the web, call the memory tool (action: search) first — you may already know the answer from a previous session. Only reach for websearch if memory comes up empty.
12
- - Runs synchronously — returns when the search completes (all selected engines run in parallel).
13
- - Use this for information that is NOT in the local codebase — current docs, error messages, API references
14
- - Follow up with `fetch` to read full pages from the results
15
- - **Weak engine warning**: Bing's index is noisy for technical queries — if a first websearch returns irrelevant/townhall-grade results, DO NOT retry the same query. Configure a search MCP tool (e.g. `glm-websearch` via the MCP config) for technical lookups; websearch is the fallback.
16
- - Proxy: NOT auto-applied from config.json (2026-08-31 ruling). Pass `proxy: "http://host:port"` explicitly when the target needs one; omit for domestic targets.
17
- - Backend priority: DeepSeek (auto — a providers[] entry with baseURL host api.deepseek.com and a key) → Tavily → Bing. websearch.backend: "local" disables the DeepSeek backend.
18
- - DeepSeek query operators: site:, lang:, after:/before:, and quoted phrases pass through as-is; limit maps to count (1–20).
3
+ {{knowledge:tool-websearch}}
@@ -1,11 +1,3 @@
1
- Write content to a file. Creates parent directories; overwrites existing file.
1
+ Write content to a file, creating parent directories; an existing file is overwritten.
2
2
 
3
- Parameters:
4
- - path (required): File path, relative to cwd or absolute
5
- - content (required): Full content to write
6
-
7
- Notes:
8
- - write replaces the WHOLE file — read it first and confirm you intend to rewrite it entirely; for a small change use edit / insert_after.
9
- - Returns `Wrote N chars to <path>` + git diff + syntax-check note.
10
- - This overwrites the entire file — use `edit` for targeted changes
11
- - The file is atomic: it either writes completely or fails
3
+ {{knowledge:tool-write}}
package/tools/bash.mjs CHANGED
@@ -3,12 +3,16 @@ import {
3
3
  sanitizeOutput,
4
4
  truncate,
5
5
  makeDecoder,
6
- BASH_TIMEOUT_MS,
6
+ BASH_TIMEOUT_MS,
7
+ LEDGER_PARAM_DESC,
8
+ PROJECT_PARAM_DESC,
7
9
  } from "./shared.mjs";
8
10
  import { spawn } from "node:child_process";
9
11
  // 树杀单源(台账 #208② · TOOLS.md §6.14 落位表行 2):本地副本删除——改用 `./process-tree.mjs`
10
12
  // (行为逐字同:win32 `taskkill /T /F` · POSIX 组杀 + 直杀兜底)。
11
13
  import { killProcessTree } from "./process-tree.mjs";
14
+ // 过程档标记(TOOLS.md §6.28):输出里行首路径 token 真解析到盘上的过程档行 ⇒ 行首前缀 + 末尾汇总行。
15
+ import { markProcessDocLines } from "./process-doc-mark.mjs";
12
16
  import { resolveShellIdentity } from "../shell-identity.mjs";
13
17
 
14
18
  /** Maximum buffer size per stream (stdout / stderr) before truncation */
@@ -247,6 +251,9 @@ export const bashTool = {
247
251
  timeout: { type: "number", description: `Timeout in ms (default ${BASH_TIMEOUT_MS} for synchronous runs; background runs have no default — an explicit timeout still applies)` },
248
252
  async: { type: "boolean", description: "Run in the background (default false): returns an ack at once (bash#<id>, log path) and the result arrives as a digest when the process exits. Depth-0 only." },
249
253
  filter: { type: "string", description: "Optional: only return output lines matching this regex (case-insensitive; synchronous runs only)" },
254
+ ledger: { type: "string", description: LEDGER_PARAM_DESC },
255
+ // 项目声明面(决策 40):`bash` 没有定位参数 ⇒ 判据点只能靠声明;纯声明,命令仍在会话 cwd 执行。
256
+ project: { type: "string", description: PROJECT_PARAM_DESC },
250
257
  },
251
258
  required: ["command"],
252
259
  },
@@ -288,7 +295,10 @@ export const bashTool = {
288
295
  shell: ctx.agent?.config?.shell ?? null,
289
296
  })
290
297
  const filtered = args.filter ? applyLineFilter(result, args.filter) : result
291
- const body = guard ? `${guard.notice}\n\n${filtered}` : filtered
298
+ // §6.28:顺序写死 = **过滤 → 打标 → 汇总 → 外包装**(filter 才照旧匹配原始行,前缀不吃
299
+ // 过滤命中;`guard.notice` ∥ `hint` 包在标之外)。解析基准 = 子进程 cwd(同步径 = `ctx.cwd`)。
300
+ const marked = markProcessDocLines(filtered, ctx.cwd)
301
+ const body = guard ? `${guard.notice}\n\n${marked}` : marked
292
302
  return hint ? `${hint}\n${body}` : body
293
303
  },
294
304
  }