@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
@@ -0,0 +1,18 @@
1
+ aliases: 搜索内容, 正则, 查找文本
2
+ **Route to grep instead of bash:** `findstr /c:"pat" file` / `grep -rn pat .` → grep. Searching file contents is a read - never shell out for it.
3
+
4
+ Parameters:
5
+ - `pattern` (required): a JavaScript regular expression, or a literal string when `literal: true`.
6
+ - `path`: directory or file to search (default cwd).
7
+ - `glob`: only search files matching this glob - supports `**`, `*`, `?`, `[..]`, `{a,b}` braces and space-separated exclusion (`"**/*.js !test/**"` = .js files outside test/); e.g. `'*.mjs'`.
8
+ - `ignoreCase`: case-insensitive match (default false).
9
+ - `literal`: literal string match, no regex interpretation (default false; use it for strings carrying `.` or `\`).
10
+ - `before`: lines of context to show before each match (like `grep -B`). Default 0.
11
+ - `after`: lines of context to show after each match (like `grep -A`). Default 0.
12
+
13
+ Notes:
14
+ - Skips node_modules, .git, dist, build, .turbo, coverage.
15
+ - Results are capped at 200 matches.
16
+ - Binary and unreadable files are skipped silently.
17
+ - Use this to find usages, definitions and patterns; use `glob` to find files by name.
18
+ - With `before` / `after`: a matching line uses the `:` separator and a context line uses `-` (as in ripgrep), and overlapping context ranges in one file are merged and de-duplicated - you see each context line once.
@@ -0,0 +1,14 @@
1
+ aliases: 按行哈希, 精确改行
2
+ More reliable than `edit` when whitespace or encoding varies, because the addresses are line bytes as they sit on disk.
3
+
4
+ Parameters:
5
+ - `path` (required): file path.
6
+ - `old_hashes` (required): array of the line hashes to replace (12-char hex). Read the file with `hashes=true` first to get them; a single line takes `[hash]`, a contiguous block takes `[hash1, hash2, ...]` in order.
7
+ - `new_content` (required): the replacement text (multi-line ok, `\n` separated).
8
+
9
+ Notes:
10
+ - Hashes are position-independent: they identify lines by content, not by line number, so a line-number drift after an edit does not touch them.
11
+ - When the hash sequence is not found, the error carries the file's current hashes so you can retry with corrected values.
12
+ - Prefer this over `edit` when (1) the file may have mixed whitespace or encoding, or (2) you want to edit a block of lines in one call.
13
+ - The replacement replaces exactly the lines the hashes identify - whatever is not in `new_content` is deleted. For a new line after a known line use `insert_after`; for a single simple string swap use `edit`.
14
+ - Re-read the file after it changed: hashes taken before a write are stale.
@@ -0,0 +1,15 @@
1
+ aliases: 插入行, 加一行
2
+ Safer than `edit` for adding new content - no surrounding context to copy, so no exact-string matching to get wrong.
3
+
4
+ Parameters:
5
+ - `path` (required): file path.
6
+ - `content` (required): the text to insert; it becomes its own line, placed after the target line.
7
+ - `after_line`: line number to insert after (1-based). Preferred when you know the exact line number from `read`.
8
+ - `after_regex`: a JavaScript regex finding the line to insert after. It must match exactly one line; when it matches several the tool errors and shows the matching line numbers.
9
+
10
+ Notes:
11
+ - Either `after_line` or `after_regex` is required; if both are given, `after_line` wins.
12
+ - Use this instead of `edit` when you are adding a line - a checklist item, a doc heading, a line of prose, a function, an import, or a block - rather than fabricating surrounding context to anchor an exact-string match.
13
+ - Returns a diff of the change.
14
+ - **Read-before-insert guard**: `after_line` is judged against the last write to that file. A line at or above that write's write point is allowed; inside or below it - or when the file was written after your read without updating that anchor - the call is refused, naming the path, the drift `±shift` and two ways on: re-read, or address the region without line numbers.
15
+ - Take line numbers from the most recent `read` of that file; re-read after the file changed.
@@ -0,0 +1,6 @@
1
+ aliases: 实例列表, 多实例, 跨实例
2
+ Any cwd — a target in another repository is addressable.
3
+
4
+ Returns [{ sessionId, end, cwd, pid }]; never includes self; pure read — writes nothing.
5
+
6
+ Only sessions that have a pickup face register here, so a headless session (one-shot chat / ACP / direct runAgent) never appears.
@@ -0,0 +1,10 @@
1
+ aliases: 跨实例消息, 发消息, 实例
2
+ Parameters: sessionId (required, no default — an id from instance_list) · text (required, no default — the message body) · re (optional — the requestId this message answers, a non-empty string of at most 128 chars; omit it for a first message).
3
+
4
+ Returns { requestId, target: { sessionId, end }, status: "delivered-to-inbox" }. requestId is the inbox message id — pass it as re when you answer back.
5
+
6
+ The target takes the message only when it has no turn in flight: during its turn the message waits in the inbox (never injected mid-turn) and starts a new normal user turn afterwards.
7
+
8
+ An unreachable target (no such session / exited / unverifiable / inbox not writable) fails the call with the target and the reason named — nothing is queued for later and nothing is dropped silently.
9
+
10
+ Delivering does not make the target your subordinate: it may ignore the message or answer "I won't".
@@ -0,0 +1,18 @@
1
+ aliases: 知识, 主题, 检索知识, 查主题
2
+ Pure-reference topics are never inlined into system prompts.
3
+
4
+ Actions: `list` shows globally unique topic ids and titles; `search` returns bounded locating snippets; `get` returns the complete topic by exact id.
5
+
6
+ Search splits the query on whitespace, lowercases each word, trims the punctuation at both ends of each word and then drops high-frequency function words (`the`, `of`, `a`, `的`, `了` …).
7
+ A word's inner characters stay as written, so `doc?` searches `doc` while `doc-check` is searched whole.
8
+ A query left with no word fails explicitly and names `query` — type a concrete noun instead of retrying the same shape.
9
+ Every remaining word matching the id, the title, an alias or the body puts that topic in the result (OR — not all words must match).
10
+ Ranking: title-level hits first (a distinct word hitting the id, the title or an alias), then total hits, then id ascending.
11
+
12
+ A topic's first line may carry `aliases: word, word` — near-synonyms, Chinese included. Aliases are metadata, never part of the body a `get` returns; they exist so a Chinese query can find an English-id topic.
13
+
14
+ Results are capped at 10 topics and 6,000 characters, so a wide query cannot swallow the window.
15
+ The envelope reports `matched` (topics that matched), `shown` (topics returned) and `truncated` — never read a short list as "these are all the matches".
16
+ No match returns an explicit empty result that names the next step: retry with one English keyword, or run `list` for every topic id first.
17
+
18
+ Search only to locate: read `get` before acting on a rule. Unknown actions, missing arguments, unknown topics and duplicate ids fail explicitly; no match is an explicit empty result.
@@ -0,0 +1,35 @@
1
+ aliases: 台账, 只读, 待办查询
2
+ `query` returns filtered rows, `count` returns how many. Nothing here adds, moves or settles a row.
3
+
4
+ A row is one requirement point or one piece of engineering debt. The six states are `待讨论` / `待设计` / `在途` / `待核销` / `已核销` / `已废弃`; `status` filters to one of them.
5
+
6
+ Use it to find what work is already queued before proposing more: the open rows on your board, what is in flight for this batch record, and how old the unsettled ones are.
7
+
8
+ Adding, moving or settling a row belongs to the main agent. Those actions are not part of this tool face, and calling one directly is refused before anything is written.
9
+
10
+ The other filters:
11
+
12
+ - `kind` — requirement vs tech_todo (the field itself holds those two words).
13
+ - `board` — the owning board (a requirement-document name).
14
+ - `trigger` — the tech-todo trigger.
15
+ - `task_book` — the task-book pointer, i.e. the row → batch lookup.
16
+
17
+ Rows come back 10 per page, with or without filters — a filter narrows what is eligible, not how many rows a page carries.
18
+
19
+ - Every page ends with a tail line giving the total, this page's rank range, and — when another page exists — the command for it: `ledger({action:"query"<the filters in force>, cursor:"<cursor>"})`. Run that line whole: it repeats this page's filters, and copying only the `cursor` drops them. Omit `cursor` for the first page; a malformed one is refused, never treated as page one.
20
+ - `count` is a different book: it counts the four unsettled states only, while a page's total covers all six.
21
+
22
+ Every returned row carries a reading about itself:
23
+
24
+ - `aged` — unsettled and older than 30 days.
25
+ - `evidenceTooLong` — the evidence text is too long to read.
26
+ - `taskBookOnDisk` — the row's task-book file part resolves and is on disk.
27
+ - `overdue` — the exit state as one word (resume_due / dangling / unlabeled / aged); first match wins.
28
+
29
+ `cwd` decides which project's ledger is read. Omit it to use the session anchor.
30
+
31
+ The project root is derived along the ancestor chain — the nearest directory carrying PROJECT-MANIFEST.json. A ledger file sitting on disk does not make a project.
32
+
33
+ A relative path resolves against the session anchor, and the project root is taken inside the anchor; outside it, no project is attached.
34
+
35
+ Rows are stored in the user data directory keyed by project root, so a query never reads another project's book by accident and the repository stays free of ledger files.
@@ -0,0 +1,42 @@
1
+ aliases: 台账, 待办, 记账
2
+ `action` = add / update / close / query / count.
3
+
4
+ - `add`: a new entry lands in `待讨论`.
5
+ - `kind` = `requirement` (requirement pool) / `tech_todo` (engineering debt).
6
+ - `trigger` = `归批` / `条件` / `认账不排期` (optional).
7
+ - `resume_when` = the sentence saying when the entry resumes (optional; when given it may not be blank, and it may carry an anchor `@YYYY-MM-DD` (judged) or `@<event>` (not judged by machine)).
8
+ - **The `task_book` gate** — same on `add` and `update`, judged on what this call writes. An entry that ends up in `在途` / `待核销`, or a call that sets `trigger` = `归批`, must carry `task_book`: absent / empty / blank is refused.
9
+ - A call that writes `task_book` (non-empty), or that sets `trigger` = `归批`, is also held to the pointer: its file part, the text before the first `§`, must resolve, with that file on disk, else refused.
10
+ - A call that does not touch the pointer is not judged: a stale pointer left by an earlier call never blocks a `status` / `evidence` / other-field update — "is the file on disk" is the `taskBookOnDisk` reading, not a gate.
11
+ - **Reserved pointer** — put the marker `(预定)` at the tail of the value (`docs/batches/<x>.md(预定)`) to register the intent to work a record that does not exist yet; that pointer passes the gate while its file is absent (`taskBookOnDisk` stays `false`, a reading not a gate). It must be a project-relative path — no declared-repo prefix and no absolute path, or it is refused; and once that record is on disk the marker is surplus and refused (drop it).
12
+ - `batch create` on that same path later **claims this row** instead of opening a second one: the pointer is rewritten to the plain form, the row goes to `在途`, and no new row appears. Omit `ledger` and `newDebt` there and a reserved row for the path wins before the same-face check. Two reserved rows on one path are refused and named one by one — picking one would silently drop the other's intent.
13
+ - `close --batch`: settles only the rows already at `待核销`. `待讨论` / `待设计` rows are skipped and named (move them to `在途` first to claim them), `在途` rows are skipped and named (they cannot be jumped), settled and withdrawn rows are not counted.
14
+ - `status` may be omitted (default `已核销`) and can only be `已核销`.
15
+ - `query`: equality filters (`status` / `kind` / `board` / `trigger` / `task_book`); with none given, every row is eligible. Rows come back 10 per page either way — a filter narrows which rows are eligible, not how many a page carries. Each row carries:
16
+ - `aged` — an unsettled state and older than 30 days.
17
+ - `evidenceTooLong` — the evidence text is too long to read; a reading, never a write refusal.
18
+ - `taskBookOnDisk` — the `task_book` file part resolves and that file is on disk.
19
+ - `overdue` — the exit state as a word: `resume_due` / `dangling` / `unlabeled` / `aged`, first match wins.
20
+ - The six states: `待讨论` / `待设计` / `在途` / `待核销` / `已核销` / `已废弃`.
21
+ - **Every page ends with a tail line** giving the total, this page's rank range, and — when another page exists — the command for it: `ledger({action:"query"<the filters in force>, cursor:"<cursor>"})`. **Run that line whole**: it repeats this page's filters, and copying only the `cursor` drops them, so the next page comes from the unfiltered set with no error. Omit `cursor` for the first page; a malformed one is refused, never treated as page one.
22
+ - `count` is a different book: it counts the four unsettled states only, while a page's total covers all six.
23
+ - `count`: `{ count, overdue, evidenceTooLong }`. `count` = rows in the four unsettled states; `overdue` = how many of those are in an overdue exit state; `evidenceTooLong` = how many carry over-long evidence. Same equality filters as `query`.
24
+ - `query` / `count` are read-only and open to every role; `add` / `update` / `close` write and are main-agent only.
25
+ - `update`: moves an entry along the six-state table, edge by edge — `待讨论→待设计` / `待讨论→在途` / `待设计→在途` / `在途→待核销` / `在途→待讨论` / `待核销→已核销` / `待核销→在途` / `待核销→待讨论` / any unsettled state → `已废弃`. `已核销` and `已废弃` are terminal; every edge not on that list is refused.
26
+ - `待讨论→在途` is the ignition path: opening a batch moves its coverage rows straight to `在途`, never through `待设计` (`待设计` means design is scheduled, not that ignition happened).
27
+ - `待核销→在途` is the reopen or manual return path and always writes the current session as executor. An explicit old executor does not override it.
28
+ - `在途→待讨论` and `待核销→待讨论` return unfinished work to the waiting pool. They require this call's non-blank `evidence` as the reason, append it to the row, clear `executor` / `task_book` / `trigger`, preserve `created_at`, and return `reason` in the receipt.
29
+ - Give exactly one of `id` / `batch`.
30
+ - `status` omitted = update only the fields you passed; `resume_when` omitted = unchanged; `executor` omitted = entering `待设计` / `在途` writes this session, and leaving `在途`, returning to `待讨论`, or withdrawing clears it.
31
+ - `evidence` appends (old value non-empty ⇒ `old|new`, nothing around `|`; old empty ⇒ written as given). `evidenceReplace: true` together with `evidence` replaces the whole text; the flag alone, or a blank new value, is refused.
32
+ - `update --batch`: one migration across a batch (`batch` = the batch-record pointer; the rows whose `task_book` sits on that record are handled together).
33
+ - With `status` ⇒ every row is re-judged against the migration table; without `status` ⇒ a pure field patch, `status` untouched.
34
+ - Receipt `{ batch, status, applied, skipped }`; each skipped row is named `{ id, from, why }` (`why` = that row's own refusal text) and the rest still land; a transaction-level failure rolls the whole batch back.
35
+ - A `batch` that does not resolve to a record on disk is refused.
36
+ - `close`: settle (`待核销 → 已核销`) — the one settling edge. `待讨论` / `待设计` / `在途` are refused, naming the current state and that state's way out. Withdrawal is allowed only from an unsettled state; both archived states reject further archival writes.
37
+ - Settlement requires non-blank work `evidence` after applying this call. Existing evidence is sufficient; a blank replacement is refused and leaves the row unchanged.
38
+ - **Archiving a row is tied to its batch record.** Before either archived target lands (`已核销` to settle, `已废弃` to withdraw), the record its `task_book` points at is read: a record whose §1 status line reads `进行中` refuses the write — `批档未收口 … 请先 batch close(同笔结算并冻结档)` for a settlement, and `先退回 待讨论(携理由)再 已废弃,或先 batch close` for a withdrawal from `在途` / `待核销`. The row is left unchanged either way, and `batch close` settles the row and freezes the record in one action.
39
+ - `update` to either archived state is held to the same gate, and `close --batch` / `update --batch` name each refused row in `skipped` with that gate's own words. A record whose §1 status line cannot be read (missing, or two or more in the §1 header zone) is refused separately and names its repair: exactly one status line in that zone, written by the main agent as an ordinary document write.
40
+ - Four cases pass the gate without a record to judge, and the receipt carries one `notices` entry per such row — `{id, reason, message}`, key omitted when there is none — for a single-row receipt and at the top level for a `batch` one: the pointer resolves to a file that is not a batch record (`pointer-not-a-record`), the pointer has no file part (`no-task-book`), the pointer does not resolve or its file is not on disk (`record-not-on-disk`, a record may be cleaned up), or the row is a `待讨论` / `待设计` retro-close (`retro-close`). A gate side-step is not work evidence, so it never touches `evidence`.
41
+ - Soft delete: the row keeps its content and gains a `closed_at`, and a settled row's settled time is the close, not an update.
42
+ - `status` is required on a single-row close: `已核销` to settle, `已废弃` to withdraw. Give exactly one of `id` / `batch`. `evidence` / `evidenceReplace` behave as in `update`, and an omitted `evidence` leaves the row's own text as it stands.
@@ -0,0 +1,16 @@
1
+ aliases: 语法检查, 静态检查
2
+ Parameters:
3
+ - path: File to check (default: most recently modified file)
4
+ - full: Run the full language-aware cascade instead of just node --check (default false)
5
+
6
+ Without `full` it runs `node --check` only, which covers the JS/TS family; any other file gets a hint to pass `full` instead.
7
+
8
+ With `full` the cascade is picked by extension:
9
+
10
+ - TS: tsc --noEmit, run only where a TypeScript project config exists.
11
+ - Python: ruff. Rust: cargo check, run only where a Cargo manifest is present.
12
+ - Go: go vet. JS/JSX: still `node --check`.
13
+
14
+ Use the fast default after every write or edit, and `full` before declaring a task complete.
15
+
16
+ Returns `Syntax OK: <path>` / `Syntax error in <path>: <message>`, or the language checker's own line (`✓ <checker>: no issues` / `✗ <checker>: <failure text>`), or a `lint:` line saying that checker is not installed or that no linter exists for that extension.
@@ -0,0 +1,13 @@
1
+ aliases: 目录, 列目录
2
+ Directories listed first. Use to see what a directory contains (glob only matches files).
3
+
4
+ **Route to ls instead of bash:** `dir /b` / `ls` / `dir` → ls. Listing a directory is a read — never shell out for it.
5
+
6
+ Parameters:
7
+ - path: Directory path (default cwd)
8
+ - filter: Only list entries matching this glob (e.g. '*.mjs', '*test*') — a wildcard filter, not a full listing
9
+
10
+ Notes:
11
+ - Shows first 500 entries
12
+ - Directories are suffixed with `/` and listed before files
13
+ - Use this for a quick overview; use glob when you have a specific file pattern in mind
@@ -0,0 +1,11 @@
1
+ aliases: 定义, 引用, 符号, 代码导航
2
+ Use this to understand code structure without grep-guessing function locations or type shapes. Find files with glob / repo_outline — use lsp for definition / references / diagnostics
3
+
4
+ Parameters:
5
+ - subcommand (required): LSP operation — "definition" | "references" | "hover" | "symbols" | "diagnostics"
6
+ - uri (required): Target file path (relative to project root)
7
+ - line: 1-based line number (for definition/references/hover)
8
+ - character: 1-based character offset (for definition/references/hover)
9
+
10
+ Notes:
11
+ - Returns the requested LSP result: definition location, references, hover info, document symbols, or diagnostics — or an error message.
@@ -0,0 +1,2 @@
1
+ aliases: 历史, 会话历史, 之前做过什么
2
+ What has been tried, the exact errors, recent context. Ground your analysis in the actual failure trail instead of guessing. Output is capped (~60k chars — older messages are trimmed with a note).
@@ -0,0 +1,14 @@
1
+ aliases: 清单, 项目档案, 只读
2
+ The file holds version / phase / docRoot / codePaths / index.
3
+
4
+ target — the project root or directory you mean; **required** — omitting it is refused. Relative paths resolve against the session anchor. A workspace target (several projects below it) is reported with the full candidate list — name the project root you mean and pass it as target.
5
+
6
+ `docRoot` holds one entry per document layer, each a directory (a string | a multi-root array | `null` = absent): requirements / specs / design / modules / batches.
7
+
8
+ `standards` is the standards **layer** — a directory whose `.md` files — subdirectories included, in layer-root-relative path order — are the standards; a file path is not accepted (one key, one meaning).
9
+
10
+ Read-only: the only action is `read`. Creating or editing a manifest belongs to the main agent — this subagent variant has no init / write action.
11
+
12
+ read — report the manifest state with a stable anchor `state=ok|missing|invalid|workspace|no-project`. The ok state prints the manifest JSON plus missingKeys / errors rows (only when non-empty). Never throws — a missing manifest is reported, not refused.
13
+
14
+ Use it to locate documentation instead of assuming a path: read `docRoot.<key>` and resolve your target under that root. A missing face (`null`) means that document layer does not exist in this project — report it instead of inventing a path.
@@ -0,0 +1,31 @@
1
+ aliases: 清单, 项目档案, 文档根
2
+ Subagents carry a read-only variant (action `read`); init / write stay main-agent only.
3
+
4
+ Actions:
5
+ - read — report the state with a stable anchor `state=ok|missing|invalid|workspace|no-project`. The ok state prints the manifest JSON plus missingKeys / errors rows (only when non-empty). Never throws — a missing manifest is reported, not refused.
6
+ - init — create the default manifest where the project root resolves. Refused when one already exists — init never overwrites.
7
+ - write <key> <value> — point-edit one node: read, set, write back through the writer gate. The result must validate (a fault is refused, disk byte-for-byte unchanged); a missing manifest is refused — run init first.
8
+
9
+ target — the project root or directory you mean; **required** — omitting it is refused. Relative paths resolve against the session anchor.
10
+
11
+ A workspace target (several projects below it) is reported by `read` and refused by `init` / `write` — name the project root you mean.
12
+
13
+ key — dot path into the manifest: version / phase / codePaths, or a sub-key of docRoot / index. Whole-object writes of those two families are refused, as is any key outside the set (spelling protection).
14
+
15
+ value — JSON first (null / true / 5 / ["a","b"]), else a literal string (docs/design). "null" is the explicit "no such face" for docRoot.<key>: a legal value, not a deletion.
16
+
17
+ Refusals throw `manifest <action>: refused — …`; a missing parameter throws `manifest <action>: <param> is required — …`. Both leave the disk unchanged; the written file reaches the project-state line next turn.
18
+
19
+ read is read-only (no approval); init / write are side effects (approval gate).
20
+
21
+ Key catalog — the 15 writable nodes (3 whole keys + docRoot's 6 sub-keys + index's 6 sub-keys): what each is; when to change it; wrong ⇒ consequence.
22
+ - `version` — schema version (a number); change on migration; wrong ⇒ validation refuses.
23
+ - `phase` — `initial-dev` / `production`; change when the stage is crossed; wrong ⇒ validation refuses.
24
+ - `codePaths` — path segment names (segment match at any depth; **no default segment** — the key is empty until the project declares one, so a project that never declares it has no code segment and a `.md` under `src/` reads as a document); change when the layout moves; wrong ⇒ no segment is classified.
25
+ - `docRoot.requirements` · `docRoot.specs` · `docRoot.design` · `docRoot.modules` · `docRoot.batches` — each doc-layer root (a string | a multi-root array | `null` = absent); change when a layer moves; wrong ⇒ validation refuses, or checks / batch landing / review roots point elsewhere.
26
+ - `docRoot.standards` — the standards **layer**: one directory of `.md` files (a string | a multi-directory array | `null` = no such face; default `null` — there is no default directory, so no default name to guess); members = every `.md` file under the directory, subdirectories included, in layer-root-relative path order (case-insensitive; symbolic links are not followed); change it when a standards document is added or the layer moves; wrong ⇒ the reviewer reports the declaration unreadable and names the path, splitting the cause (no such directory / not a directory / no .md file) — never a silent skip. A file path is not accepted (one key, one meaning).
27
+ - `index.codeExtensions` · `index.docExtensions` — extra code / doc extensions (unioned, add-only); change when a type is missing from the index; wrong ⇒ that type stays out.
28
+ - `index.excludePaths` — project-root-relative prefixes for the index; change to keep a directory out; wrong ⇒ it is still indexed, or another is wrongly excluded.
29
+ - `index.docCheckExcludePaths` — project-root-relative prefixes the document check leaves alone: a document under one of them is not judged and not counted, and a manifest that cannot be read excludes nothing, so every document is judged. Not interchangeable with `index.excludePaths`, which the index reads.
30
+ - `index.publicRepos` — public-repo paths (resolvable from this repo root) = this repo's out-edge table: a repo listed here may be **searched and cited**. Change it when wiring one in or dropping one. Not listed ⇒ that repo is not part of this project's searchable corpus and is not a source this project can cite. Not interchangeable with `index.writableRepos` (reading ≠ writing).
31
+ - `index.writableRepos` — external **directories** this repo may write into (directories, not repos — no `.git` / manifest is read; resolvable from this repo root) = this repo's write-rights table, one-way: the target gets no say, git permissions are the real defence. A target inside the table ⇒ the write gate takes the ledger row number from **this** project's ledger and books the change here; a target outside it ⇒ the gate refuses and names this table. Change it only when you mean to spend **this repo's** account on an external directory — leaving it empty means the target can only be written under its own account. Not interchangeable with `index.publicRepos` (reading ≠ writing). Wrong ⇒ that directory's writes are still refused (the refusal names `writableRepos` and the target), or a directory you did not mean to open sits in the table.
@@ -0,0 +1,20 @@
1
+ aliases: 记忆, 只读记忆, 检索记忆
2
+ Two actions:
3
+
4
+ - `search` — find knowledge saved in previous sessions. Each result row carries `[layer]` plus the entry id, and the id's prefix is the layer.
5
+ - `list` — inventory what memory holds, one row per entry: `[layer] id [type] title (date)`. A truncated list notes the full count.
6
+
7
+ Use it before re-exploring something the project may already know: a saved rule, a decision, a debugging pattern. Session message history is NOT in memory — that is `read_history`.
8
+
9
+ Writing memory belongs to the role that owns writes. Those actions are not part of this tool face, and calling one directly is refused before anything is written.
10
+
11
+ Layer = the memory tier: personal (private) / project (shared via this repo's .thincoder/memory/) / team (CLI only, git-synced). The `[layer]` tag, the id prefix and the `layer` parameter are the same concept.
12
+
13
+ Both actions take `layer` optionally — omit it to read every layer.
14
+
15
+ The other arguments:
16
+
17
+ - `type` — filters list by entry type: rule (coding standards) · knowledge (project facts) · decision (architecture decisions) · pattern (debugging/workflow patterns).
18
+ - `keyword` — filters list by a substring of the title or content.
19
+ - `query` — search's natural-language question.
20
+ - `limit` — caps the rows (list 50 by default, search 5).
@@ -0,0 +1,15 @@
1
+ aliases: 记忆, 长期记忆, 存记忆
2
+ The action parameter picks the operation:
3
+ - search — find knowledge saved in previous sessions; each result row carries [layer] + entry id (the id's prefix = the layer)
4
+ - put — save knowledge for future sessions; type = rule (coding standards) / knowledge (project facts) / decision (architecture decisions) / pattern (debugging/workflow patterns)
5
+ - list — inventory what memory holds; one row per entry: [layer] id [type] title (date); a truncated list notes the full count
6
+ - delete — SINGLE: {id, layer} removes the entry shown in put/search/list output — layer is optional: passed, it is validated against the id prefix (a mismatch is refused — guards against deleting the wrong entry); omitted, the id prefix routes the delete (any id from put/search/list is directly deletable). BATCH (no id): {layer, type and/or keyword} removes every matching entry in that layer — layer plus at least one of type / keyword is required; without confirm:true it returns the count + preview instead; a layer-wide wipe without filters is refused on every layer
7
+ - clear — {layer: "personal", confirm: true} wipes ALL personal memory entries. clear is personal-only: a missing layer or a project/team layer is refused (use delete batch filters on shared layers)
8
+ - maintain — index self-maintenance. Dry run by default: without confirm:true you get the plan and its readings and nothing is written; confirm:true executes. It takes no layer — it works on the whole store, not one layer.
9
+
10
+ Layer = the memory tier: personal (private) / project (shared via this repo's .thincoder/memory/) / team (CLI only, git-synced); the [layer] tag, the id prefix, and the layer parameter are the same concept — pass a result row's [layer] as layer.
11
+
12
+ Deleting project/team entries: team deletion is local only — a later team sync may bring the entry back while the remote still holds it.
13
+
14
+ Save bugs, conventions, and preferences here — they persist across sessions.
15
+ Session message history (what was said in this or past sessions) is NOT in memory — search session messages with read_history.
@@ -0,0 +1,12 @@
1
+ aliases: 上抛, 父代理, 请示
2
+ It queues a message on the parent's side: your turn is not interrupted and nothing is taken out of it.
3
+
4
+ - `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'`, and 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.
5
+ Read the materials first and carry the evidence you already checked (the file path plus the exact words you read) - the parent should not have to re-read for you.
6
+ - `kind: 'note'` - an FYI that needs no answer (a premise you found broken, a conflict you resolved and want visible early).
7
+ - Delivery markers: the message your parent receives is headed `[上抛·待裁]` (ask - awaiting the parent's decision) or `[上抛·知会]` (note - FYI). They are added for you - do not write these markers inside `message`. In your final report the marker is yours to write: tag items still awaiting the parent's decision `[上抛·待裁]`, FYI items `[上抛·知会]`.
8
+ - NON-BLOCKING: it returns immediately. Keep working on the unaffected parts and leave the affected part pending; no fetch, no polling. Finishing first means reporting the unanswered part as not done.
9
+ - SYNCHRONOUS SPAWN: if the parent is blocked on your run, nothing can be sent back - `send` reaches only a RUNNING ASYNC child, and the message is read when the parent's call returns (it may re-spawn you with an answer). Do not idle-wait.
10
+ - Out of scope: naming / implementation / wording details, anything a read or a command would answer, a trade-off the task book already states - those follow the stop-and-report discipline, not this channel. A confirmation-type question (asking for a nod before you continue) does not belong here either: the parent cannot approve anything, so the nod buys nothing - decide, or carry the question to the user-facing seat through your report.
11
+ - Availability: subagents only (depth > 0). At depth 0 you talk to the user through your normal reply or the `question` tool.
12
+ - Limits: `message` is at most 1,500 characters, and the parent's in-flight queue holds at most 20 messages - exceeding either is an explicit error, never a silent drop.
@@ -0,0 +1,114 @@
1
+ aliases: 工具纪律, 工具选择, 检索优先级
2
+ ## Tool discipline
3
+ ### Search tool priority
4
+ **Check the tool table before any search**: MCP search tools (`*_web_search*` / `*_search_prime` etc.) are PRIMARY for technical verification and general search
5
+ — `websearch` (Bing) is ONLY the fallback (unavailable: not configured, or its call failed).
6
+ **`websearch` returns junk/unrelated results twice in a row → switch immediately** to an MCP search tool — the same engine answers the same query with the same junk, so switching tools is the only move that brings new information.
7
+ **Blocked/unreachable site (docs.claude.com / ai.google.dev etc.) → take a mirror path** (e.g. gh-proxy.com to fetch GitHub SDK source / type definitions) — a guessed official-doc URL resolves to a 404 or to an outdated copy, and the page you actually fetched is the one to cite.
8
+ **Before fetching a page by hand, scan the tool table** ("do I already have a tool for this?") — `fetch` / MCP search before `curl`-style scraping.
9
+
10
+ ### When online verification is required
11
+ **Answering version / API / protocol behavior from training memory = guessing** — memory has a cut-off and misremembers; verify before drawing such conclusions.
12
+ **Cases that require a check**: ① **Currency** — version numbers / release status / the "latest · current" behavior of a library · tool · service / quotas · limits;
13
+ ② **Precision** — the signature · parameters · defaults · error codes · endpoints of a public API · SDK · protocol, config key names and value ranges;
14
+ ③ **Negative assertions** — "feature X does not exist" / "behavior Y is not like that" — negations in memory are the least reliable;
15
+ ④ **Conflict with evidence** — when memory contradicts the code in front of you / a measured reading, take the measurement as authoritative and get third-party corroboration online.
16
+ **What counts as enough**: a verbatim sentence or code fragment from a **first-hand source** (official docs / official repo / specification) that you can point to a specific page / file.
17
+ Second-hand accounts (blogs / Q&A / aggregators) are leads only — only tracing back to a first-hand source or confirming by measurement counts as found.
18
+ **No first-hand source ⇒ say so and mark `unverified`** — certainty in tone hides the uncertainty, and downstream cannot tell it from a checked fact.
19
+ **What if you can't find it**: **no usable search tool in the environment** (not configured ∥ no online entry in the tool table) ⇒ say "no search tool in the environment" and mark `unverified`;
20
+ **searchable but no first-hand source** ⇒ switch sources and try once or twice more, still none ⇒ state "checked, no first-hand source" in the conclusion and mark `unverified` — a fabricated source is worse than none, because downstream cannot tell it from a real one.
21
+ **Boundary**: verification = **taking facts**, not **copying an industry checklist** — the criterion is evidence, not "I searched, so I checked". **Common sense needs no check** (language grammar / general algorithms / common knowledge — checking = wasted turns).
22
+ **The online prerequisite** = the environment has a usable search tool (the tool table lists an online entry).
23
+ **A hard-coded tool name points at the wrong place once the tool is renamed or replaced** — which search / fetch tool to use, **take it per the existing priority** (this spot only judges "should this be checked"),
24
+ constrained by network reachability (overseas sites may be unreachable; if needed, translate the Chinese into English first, then search) — getting the facts is what counts; the path follows the environment.
25
+
26
+ ### Codebase exploration order
27
+ repo_outline → doc_search → code_search. Structure → intent → details.
28
+
29
+ ### Document search — finding a document vs locating a line
30
+
31
+ Two questions look alike and take different tools.
32
+ **Discovery** — which document said this, is there an existing standard, where was that decision made, and which repository holds it — starts with `doc_search`.
33
+ **Locating** — the repository, the directory and the file are already known, and what you need is the exact wording — goes to `grep` straight away: a literal scan of a known file, read back with the matching text.
34
+ `Check the docs before you ask or answer` decides when to look; this subsection decides which tool looks.
35
+
36
+ The difference is the search surface, not the syntax.
37
+ `doc_search` searches a declared domain — this project's documents plus the repositories listed under `index.publicRepos` in the project manifest — queried in one call.
38
+ `grep` searches exactly one path: the one you hand it, the current repository by default.
39
+ Other repos on this machine are invisible to it unless your command already carries their absolute paths, and an agent holding no list of the machine's repos has no such paths to carry.
40
+ That is a structural limit across repositories, not a search done carelessly: `grep` answers "nothing here" with only the reach it was given, and that empty answer arrives in the same shape as a checked absence.
41
+
42
+ **A search that found nothing** says so. With `doc_search` empty, `grep` is the legitimate next step — a term spelled differently, a phrase only one known file uses.
43
+ The answer then carries `doc_search: none found` beside the `grep` result.
44
+ An unstated fallback reads to the next person as "the index holds nothing on this", which claims more than "this query missed": the first closes the topic, the second leaves it open.
45
+
46
+ **A hit in a process document** is a lead, not a finding. The declared domain leaves process documents out — batch records always stay out of the index, archived pages wherever the project declares them excluded.
47
+ So a hit in an excluded document tells you the search ran outside the domain: a secondary cost next to the blind spot a `grep`-only search has across repositories.
48
+ It records where something was discussed once, while the state lives in the requirement and design documents, and a batch record can be dropped whole.
49
+ Before an answer rests on such a hit, open the state document it points at: the batch record names the change, the state document carries the rule as it stands.
50
+ Answering from the batch line turns a past round's draft into this round's standard.
51
+
52
+ **Documents in other repositories** count once declared. A repository outside `index.publicRepos` adds nothing to the searchable domain, and a `grep` result from the current repo says nothing about it either way.
53
+ **One key, two consequences**: the same declaration that lets a repo be searched is what lets it be cited — a reference into an undeclared repo is not merely un-indexed, it is refused (reported as a missing document, and a delivery gate fails).
54
+ So when a topic may live in a sibling repository and the answer found nothing, the answer carries `cross-repo: not indexed` beside it.
55
+ That records which surface was searched, and keeps an unsearched repository from reading as a settled absence.
56
+
57
+ ### Parallel call principles
58
+ Batch independent read-only tool calls into a single reply (they run concurrently) — calling them one by one wastes turns.
59
+ **This engine is fully asynchronous and highly concurrent**: a top-level spawn returns immediately, and its report arrives on its own when the session is idle; file conflicts and `dependsOn` dependencies are queued and ordered automatically by the scheduler.
60
+ So after dispatching a subagent there are only two moves: if you need its report for the next step ⇒ end the turn and let it arrive; if not ⇒ go on with other work at once.
61
+ Holding several spawns in hand and waiting for one to finish before dispatching the next only ends up slower than the order the scheduler has already laid out.
62
+ The same goes for repeatedly checking progress midway: the report arrives on its own.
63
+
64
+ ### Steering your own context
65
+ **Your context** is yours to steer. ① To see the usage and composition, and how far you are from the compaction line, check any time (`context`);
66
+ ② when you feel the context needs tidying (the direction changed / too noisy), **start the compaction yourself** and say what the **upcoming work needs** (focus) —
67
+ what gets compacted is **retrievable** (the receipt carries the anchor).
68
+ ③ At the compaction line, compaction happens automatically — that is **only a fallback**, not a signal to wrap up: once tidied, keep working until the task is actually done.
69
+
70
+ ## Tool routing — write-type scenarios route per the table, not bash
71
+ | Tool | Use it for | Not (use the dedicated tool instead) |
72
+ |---|---|---|
73
+ | `read` | read a text file (paged / hashes=true for editing) | `cat`, `type`, `node -e fs.readFileSync` |
74
+ | `write` | create/overwrite a file | `echo >`, `printf >`, heredocs |
75
+ | `edit` | region replacement (line-number or content targeting — exact → fuzzy) | `sed -i`, `perl -p` |
76
+ | `hashline_edit` | content-hash-addressed edit (position-independent) | `sed` by line number |
77
+ | `insert_after` | insert a block after a known line / regex anchor | `sed` insertion, line-number surgery |
78
+ | `apply_patch` | multi-file unified diff (all-or-nothing) | `git apply` by hand |
79
+ | `delete` | delete a single file (tracked files need force) | `del`, `rm` |
80
+ | `file_ops` | move / copy / rename files or dirs | `mv`, `cp`, `ren` |
81
+ | `ls` / `glob` / `grep` / `tree` | list dirs / find files by pattern / regex search / directory tree | bash `dir`/`find`/`findstr`/`grep -rn` |
82
+ | `repo_outline` / `code_search` / `doc_search` | module dependency graph / code search / doc search | ad-hoc scripts, grep gymnastics |
83
+ | `read_image` | view an image (vision models) | external viewers |
84
+ | `execute` | run JS (inline or scriptFile; + nodeArgs for `node --test`/`--check`) | `bash node -e` |
85
+ | `bash` | package-manager/CLI subprocesses, servers, TTY programs, one-off pipelines no dedicated tool expresses | see table — dedicated tools first |
86
+ | `git` | ALL git operations | `git` in bash |
87
+ | `process` / `get_current_time` / `wait_for` | list processes / current time / condition waits | `tasklist`/`ps`, `date`, `sleep` hacks |
88
+ | `timer` | set a thinking-budget reminder — non-blocking; a system reminder lands at the deadline | `sleep` hacks / pushing work to later turns |
89
+ | `verify` | pre-completion gate (you declare verification.status; it gates mechanically — it does not run checks) | expecting it to run your tests |
90
+ | `memory` | long-term memory (search/put/list/delete/clear/maintain) | session notes |
91
+ | `fetch` / `websearch` / MCP search | fetch a URL (explicit proxy) / Bing fallback / technical lookups primary | `curl` scraping |
92
+ | `checkpoint` | git snapshots / rewind safety | manual branches |
93
+ | `subagent` / `advisor` / `consult_*` | delegation / independent review / consultation | inlining exploration, self-review only, single-model guessing |
94
+ | `question` | ask the user (ambiguity, design decisions) | guessing; routine confirm-gates (those go in your plain reply text) |
95
+
96
+ **Why the `git` tool, not `git` in bash (learn the why, not just the rule)** — the rule is not a style preference; bypassing it has cost uncommitted work **permanently**.
97
+ The git tool **auto-snapshots before every destructive action** (`checkout -- <path>` · `restore` · `reset --hard` · `stash pop` · `clean -f` · branch/tag delete) — so a mistaken rollback is recoverable via `checkpoint` (`list` → `rewind`).
98
+ The bash tool has a matching guard, but it **silently fails in exactly the configuration you are most likely to be in**.
99
+ It checks `isGitRepo(cwd)` where `cwd` is the *process* working directory — a session anchored at a non-repo workspace root (with the repo in a subdirectory) resolves that to a non-repo ⇒ **no snapshot is taken, and nothing tells you**.
100
+ Changing directory *inside* the command (a shell `cd` / `Set-Location`, or any prefix of that kind) does not change the `cwd` the guard sees.
101
+ The same holds for the git tool: it demands an explicit `workdir` when the anchor is ambiguous — **pass it; that friction is the guard working, not an obstacle**.
102
+
103
+ **`wait_for` is for states that will not announce themselves**: a port opening, a file appearing — such things have no delivery channel into your session; without a query you would not know, so a blocking wait on them pays off.
104
+ An async subagent's report is the opposite: it arrives on its own when the session is idle; what `wait_for` gets is only the "it has settled" signal — the report's content still waits for delivery.
105
+ And `wait_for` is a **blocking** call — using it to wait for a report leaves the whole session parked in place, with nothing you can do during that time.
106
+
107
+ **Destructive commands — the tool layer catches none of this**:
108
+ - **Deletions go through the tool face**: `rm` / `rmdir` / `del` / `rd` / `Remove-Item` and the like run outside the face that gates deletion and keeps it revertable — `delete` / `git rm`, or a very narrow allowlist, is where deletions belong.
109
+ - **Diagnostics are read-only**: existence / state checks use read-only commands only (`dir` / `ls` / `where` / `type`).
110
+ A smuggled write or delete verb turns a diagnostic into a change nobody expected, and a "no-op / read-only" tag covers the change it labels.
111
+ When a dedicated tool exists for the job, the tool-routing table still wins — this bullet covers the bare-command case only.
112
+ - **Silent masking hides the failure**: no `2>nul` / `2>/dev/null` error-swallowing on destructive / write commands, no `&` / `;` (as opposed to `&&`) chaining — a failure must be visible.
113
+ - **Confirm before irreversible actions**: stop before an irreversible action — the main session asks the user; a subagent raises an upstream `ask` (`notify_parent`).
114
+ - **Boundary**: nothing at the tool layer catches this for you (no mechanical gate, no tool-semantics change) — you write the command, so you are the first line of defense.
@@ -0,0 +1,2 @@
1
+ aliases: 实例, 同工作区, 多实例
2
+ Returns [{ pid, end, sessionId, slots }]; never includes self; pure read — writes nothing.
@@ -0,0 +1,6 @@
1
+ aliases: 计划模式, 只读计划
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
+
5
+ Exit plan mode to present the plan for the user's approval; implement only after they approve.
6
+ For simple single-file edits, skip plan mode and just make the change.
@@ -0,0 +1,13 @@
1
+ aliases: 进程, 只读进程
2
+ Nothing here kills: no process tree and no background task is terminated.
3
+
4
+ The action this tool face carries: `list` (the default). It returns one line per process (name / PID, plus memory on Windows).
5
+
6
+ **Route to process instead of bash:**
7
+ - `tasklist` (Windows) / `ps aux` (POSIX) → process
8
+
9
+ Parameters:
10
+ - action (optional, default 'list'): list — show running processes
11
+ - name: (list) substring filter (case-insensitive), e.g. "node", "python"
12
+
13
+ Use it to check what a previous run left behind, or whether a server you started is still up. Terminating something (`kill`) is deliberately not part of this tool face: it is destructive and stays with the roles that own it — calling it directly is refused before any process is signalled.
@@ -0,0 +1,15 @@
1
+ aliases: 进程, 结束进程
2
+ List returns one line per process (name / PID, plus memory on Windows); kill returns a one-line confirmation.
3
+
4
+ **Route to process instead of bash:**
5
+ - `tasklist` (Windows) / `ps aux` (POSIX) → process
6
+
7
+ Parameters:
8
+ - action (optional, default 'list'): list — show running processes; kill — terminate a process tree (target: pid) or a background task (target: id)
9
+ - name: (list) substring filter (case-insensitive), e.g. "node", "python"
10
+ - pid: (kill) process id — the whole tree is terminated (taskkill /T /F on win32; POSIX group kill)
11
+ - 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).
12
+
13
+ Notes:
14
+ - 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.
15
+ - Repeating a kill is idempotent (same confirmation, no double kill); an unknown or already-finished task id comes back as `Error: ...`.
@@ -0,0 +1,16 @@
1
+ aliases: 提问, 询问用户
2
+ Use when the task is ambiguous, you need a design decision, or you are stuck and need human judgment.
3
+
4
+ Parameters:
5
+ - `question` (required): the question to ask the user.
6
+ - `options`: an array of single-choice options for the user to pick from (optional). They MUST be plain strings, e.g. `["A", "B", "C"]` - never objects.
7
+
8
+ Notes:
9
+ - The agent loop pauses until the user answers, and their reply arrives as the next user message: the chosen option or free text. The loop resumes when it arrives.
10
+ - Use it sparingly - prefer making a reasonable decision when one exists.
11
+ - Ask ONE question per call - never bundle several sub-questions into one question string; ask the next one after the answer arrives.
12
+ - Keep the question text short, one or two sentences. Background, context and analysis belong in your normal reply text, NOT in the question.
13
+ - Routine confirmations (confirm gates) belong in your plain reply text, where the user answers in their next message. Use this tool ONLY when you need the user's decision or input to proceed.
14
+ - Ask here when no default can carry the work forward (new scope, a ruling on a criterion) - this call blocks. When a reasonable default exists, ask in your ordinary reply text and keep working; a reply that arrives while you work steers the work from there.
15
+ Read the materials first and carry the evidence you already checked (the file path plus the exact words you read) - the user should not have to re-read for you.
16
+ - After an answer about a design convention, a tool preference or a recurring pattern, save it with the `memory` tool (action: put) - the user should not have to repeat the same preference in a later session.
@@ -0,0 +1,22 @@
1
+ aliases: 历史, 批次窗口, 会话历史
2
+ The window is fixed by the batch, not by you.
3
+
4
+ This face cannot leave the batch: there is no `path`, no other session, no older batch.
5
+
6
+ Use it to answer "what did the parent decide before dispatching me, and what did it already rule out" — the part of the task that the task book did not carry.
7
+
8
+ When the answer is not in the window, say so in your report instead of guessing; the parent can carry the fact next round.
9
+
10
+ It starts where the batch record was created (or where its first spawn bound it), and ends at the next batch's start — or now, if this is the latest batch.
11
+
12
+ Messages with no timestamp never fall inside a window, so a fact that must not be missed belongs in the task book's `knownFacts`, not here.
13
+
14
+ Filters combine with AND, and every one of them narrows inside that window:
15
+
16
+ - `role` — user / assistant / tool.
17
+ - `keyword` — case-insensitive substring of the message text.
18
+ - `tool` — tool messages by name, plus assistant messages that declared the call.
19
+ - `since` / `until` — epoch ms, inclusive. The batch window still applies on top: the later start and the earlier end win.
20
+ - `direction` — take the limit window from the oldest or newest end of the matched set.
21
+
22
+ `limit` is REQUIRED and carries no default — say how many messages you need (1–50). The window is the caller's decision; nothing supplies it for you.
@@ -0,0 +1,36 @@
1
+ aliases: 历史, 会话历史, 回看
2
+ Recall what was said or done earlier: design decisions, tool-call timing, past rulings.
3
+
4
+ Default (no `path`): this session's full record - never compacted, audit-complete.
5
+
6
+ Sub-agent face: eng-coder / eng-designer children get a bounded form of this tool instead — the parent session only, limited to this batch's window (its creation, or where its first spawn bound it, up to the next batch's start), `limit` required and capped at 50, and no `path`.
7
+
8
+ Everything else (explore / plan / coder / tester / consult) carries no history tool: the facts it needs ride the task book's `knownFacts`.
9
+
10
+ Filters combine with AND (`role` / `keyword` / `tool` / `since`-`until` / `limit` / `direction` - semantics per parameter; `keyword` with `path="all"` matches words and phrases, not only an exact substring).
11
+
12
+ Returns a JSON array in chronological order:
13
+
14
+ ```text
15
+ [{ts, role, name?, tool_call_id?, content (≈500 chars, truncated marker), tool_calls ([{name, arguments}] - arguments capped at 300 chars)}]
16
+ ```
17
+
18
+ Messages without `ts` return `ts: null`. `content` is truncated to ≈500 chars, and the marker states what is actually retrievable -
19
+ `user` / `assistant` bodies: the full text is in the session file; `tool` results: the session file keeps only those first 500 chars, so re-run the tool if you need more.
20
+
21
+ Cross-session (`path`, optional): a session file path deep-queries THAT session with the same filters (a relative path resolves against the project cwd). A session too large to deep-query is refused as `session too large`.
22
+
23
+ `cwd:<dir>` lists that directory's session slots (slot + file path + title + count + updatedAt; copy one into `path` to deep-query it).
24
+
25
+ `all` searches every INDEXED session (cross-project; the rows carry `session.file`). A session never indexed yet is invisible - query it with `path=<file>`, or index first with the CLI `thincoder session index --rebuild`.
26
+
27
+ Which tool for which question:
28
+ - what was said or ruled in THIS session → `read_history` (default).
29
+ - an older conversation in another session or project → `read_history` with `path` / `cwd`.
30
+ - which files changed in this run → `recent_changes`.
31
+ - stored knowledge and conventions (cross-session) → `memory search`.
32
+ - project design documents → `doc_search`.
33
+ - the code as implemented → `code_search`.
34
+ - a git snapshot → `checkpoint cat` / `versions`.
35
+
36
+ `read_history` only reads session messages; file-level changes belong to `recent_changes`, knowledge and conventions to `memory` - none substitutes for another.
@@ -0,0 +1,11 @@
1
+ aliases: 图片, 看图, 截图
2
+ Use this for screenshots, UI mockups, diagrams, or any visual content: the model only sees images through this tool, never by reading a file.
3
+
4
+ Parameters:
5
+ - path (required): Path to image file (relative to cwd or absolute).
6
+
7
+ Notes:
8
+ - Raster formats only: png, jpg, gif, webp. A file over 15MB is rejected.
9
+ - svg is returned as text source instead, which works even with a text-only model.
10
+ - bmp is rejected: convert it to PNG first.
11
+ - Requires a model that accepts image input. Any other model gets an error; svg is the only exception.