@thincoder/core 0.11.3 → 0.11.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (183) hide show
  1. package/CHANGELOG.md +23 -0
  2. package/advisor/compaction.mjs +40 -17
  3. package/advisor/loop.mjs +14 -6
  4. package/advisor/notice.mjs +1 -1
  5. package/advisor/timeline.mjs +4 -4
  6. package/agent/completion.mjs +19 -0
  7. package/agent/dispatch-gates.mjs +2 -0
  8. package/agent/dispatch.mjs +2 -2
  9. package/agent/family-tools.mjs +13 -9
  10. package/agent/helpers.mjs +10 -6
  11. package/agent/planning-step.mjs +453 -0
  12. package/agent/post-turn.mjs +70 -2
  13. package/agent/run-stages.mjs +22 -50
  14. package/agent/run-start.mjs +17 -0
  15. package/agent/setup-reminders.mjs +71 -8
  16. package/agent/setup.mjs +8 -39
  17. package/agent/spawn-child.mjs +6 -2
  18. package/agent/task-lifecycle.mjs +146 -0
  19. package/agent/turn-loop.mjs +73 -11
  20. package/agent-tools/batch-closeout.mjs +21 -34
  21. package/agent-tools/batch-gate.mjs +7 -5
  22. package/agent-tools/batch-ledger-bind.mjs +21 -1
  23. package/agent-tools/batch-lifecycle.mjs +7 -7
  24. package/agent-tools/batch-record-write.mjs +237 -280
  25. package/agent-tools/batch-supersede.mjs +3 -3
  26. package/agent-tools/batch.mjs +42 -9
  27. package/agent-tools/context.mjs +0 -13
  28. package/agent-tools/escalate-async.mjs +7 -1
  29. package/agent-tools/parent-channel.mjs +7 -6
  30. package/agent-tools/plan.mjs +103 -67
  31. package/agent-tools/review-facts.mjs +3 -3
  32. package/agent-tools/settings.mjs +2 -0
  33. package/agent-tools/spawn-gates.mjs +37 -11
  34. package/agent-tools/ssh-session.mjs +68 -25
  35. package/agent-tools/ssh-transfer.mjs +7 -2
  36. package/agent-tools/ssh-transport.mjs +2 -2
  37. package/agent-tools/ssh-vault.mjs +2 -2
  38. package/agent-tools/step.mjs +462 -0
  39. package/agent-tools/subagent-actions.mjs +6 -1
  40. package/agent-tools/subagent-run.mjs +7 -0
  41. package/agent-tools/subagent-spawn.mjs +1 -1
  42. package/agent-tools/subagent.mjs +17 -11
  43. package/agent-tools/task.mjs +178 -26
  44. package/agent-tools.mjs +1 -0
  45. package/agent.mjs +2 -0
  46. package/config-defaults.mjs +17 -1
  47. package/config-migrate.mjs +8 -5
  48. package/config.mjs +7 -0
  49. package/context.mjs +5 -4
  50. package/declaration.mjs +4 -4
  51. package/generate-title.mjs +0 -6
  52. package/i18n.mjs +4 -0
  53. package/ledger-cmd.mjs +11 -1
  54. package/ledger-tools.mjs +15 -4
  55. package/manifest-schema.mjs +1 -0
  56. package/model-context.mjs +34 -11
  57. package/model-specs.mjs +5 -2
  58. package/package.json +1 -1
  59. package/prompt-files.mjs +48 -11
  60. package/prompt-overlays.mjs +79 -8
  61. package/prompts/advisor-design.md +253 -206
  62. package/prompts/advisor-round1.md +151 -145
  63. package/prompts/advisor-round2.md +136 -130
  64. package/prompts/advisor-round3.md +140 -134
  65. package/prompts/common.md +244 -96
  66. package/prompts/consult-base.md +29 -30
  67. package/prompts/discipline-engineering.md +73 -519
  68. package/prompts/discipline-normal.md +28 -136
  69. package/prompts/knowledge/batch-before-write.md +8 -0
  70. package/prompts/knowledge/batch-cycle-register.md +15 -0
  71. package/prompts/knowledge/batch-progress-ledger.md +29 -0
  72. package/prompts/knowledge/business-gates.md +24 -24
  73. package/prompts/knowledge/decision-quality.md +8 -19
  74. package/prompts/knowledge/doc-discipline-d-rules.md +63 -0
  75. package/prompts/knowledge/doc-lookup.md +25 -24
  76. package/prompts/knowledge/document-writing.md +11 -32
  77. package/prompts/knowledge/documentation-evaluation.md +42 -42
  78. package/prompts/knowledge/eng-dispatch-ops.md +34 -0
  79. package/prompts/knowledge/eng-ledger-ops.md +26 -0
  80. package/prompts/knowledge/evidence-discipline.md +10 -32
  81. package/prompts/knowledge/normal-batch-discipline.md +13 -0
  82. package/prompts/knowledge/normal-coding-workflow.md +97 -99
  83. package/prompts/knowledge/normal-delivery-collaboration.md +107 -112
  84. package/prompts/knowledge/normal-work-management.md +44 -44
  85. package/prompts/knowledge/product-security.md +7 -26
  86. package/prompts/knowledge/project-records.md +69 -64
  87. package/prompts/knowledge/tool-advisor.md +17 -17
  88. package/prompts/knowledge/tool-apply-patch.md +14 -14
  89. package/prompts/knowledge/tool-bash.md +32 -31
  90. package/prompts/knowledge/tool-batch-eng-coder.md +19 -13
  91. package/prompts/knowledge/tool-batch-eng-designer.md +21 -14
  92. package/prompts/knowledge/tool-batch-review.md +18 -12
  93. package/prompts/knowledge/tool-batch.md +93 -85
  94. package/prompts/knowledge/tool-browser.md +59 -59
  95. package/prompts/knowledge/tool-code-search.md +2 -2
  96. package/prompts/knowledge/tool-consult-start.md +6 -6
  97. package/prompts/knowledge/tool-consult-stop.md +3 -3
  98. package/prompts/knowledge/tool-context.md +4 -4
  99. package/prompts/knowledge/tool-delete.md +16 -16
  100. package/prompts/knowledge/tool-doc-check.md +39 -39
  101. package/prompts/knowledge/tool-doc-graph-read.md +11 -11
  102. package/prompts/knowledge/tool-doc-graph.md +48 -48
  103. package/prompts/knowledge/tool-doc-search.md +3 -3
  104. package/prompts/knowledge/tool-edit.md +30 -30
  105. package/prompts/knowledge/tool-eng.md +1 -1
  106. package/prompts/knowledge/tool-execute.md +16 -16
  107. package/prompts/knowledge/tool-fetch.md +15 -15
  108. package/prompts/knowledge/tool-file-ops.md +15 -15
  109. package/prompts/knowledge/tool-get-current-time.md +3 -3
  110. package/prompts/knowledge/tool-git-read.md +15 -15
  111. package/prompts/knowledge/tool-git.md +26 -26
  112. package/prompts/knowledge/tool-glob.md +14 -14
  113. package/prompts/knowledge/tool-goal.md +5 -5
  114. package/prompts/knowledge/tool-grep.md +19 -18
  115. package/prompts/knowledge/tool-hashline-edit.md +13 -13
  116. package/prompts/knowledge/tool-insert-after.md +14 -14
  117. package/prompts/knowledge/tool-instance-list.md +3 -3
  118. package/prompts/knowledge/tool-instance-send.md +5 -5
  119. package/prompts/knowledge/tool-knowledge.md +12 -12
  120. package/prompts/knowledge/tool-ledger-read.md +20 -20
  121. package/prompts/knowledge/tool-ledger.md +44 -44
  122. package/prompts/knowledge/tool-lint.md +10 -10
  123. package/prompts/knowledge/tool-ls.md +11 -11
  124. package/prompts/knowledge/tool-lsp.md +8 -8
  125. package/prompts/knowledge/tool-main-history.md +1 -1
  126. package/prompts/knowledge/tool-manifest-read.md +7 -7
  127. package/prompts/knowledge/tool-manifest.md +43 -32
  128. package/prompts/knowledge/tool-memory-read.md +12 -12
  129. package/prompts/knowledge/tool-memory.md +14 -14
  130. package/prompts/knowledge/tool-notify-parent.md +10 -10
  131. package/prompts/knowledge/tool-operations.md +88 -88
  132. package/prompts/knowledge/tool-peek.md +10 -0
  133. package/prompts/knowledge/tool-peer-instances.md +1 -1
  134. package/prompts/knowledge/tool-plan.md +6 -3
  135. package/prompts/knowledge/tool-process-read.md +8 -8
  136. package/prompts/knowledge/tool-process.md +11 -11
  137. package/prompts/knowledge/tool-question.md +11 -13
  138. package/prompts/knowledge/tool-read-history-batch.md +13 -13
  139. package/prompts/knowledge/tool-read-history.md +19 -19
  140. package/prompts/knowledge/tool-read-image.md +8 -8
  141. package/prompts/knowledge/tool-read.md +17 -17
  142. package/prompts/knowledge/tool-recent-changes.md +4 -4
  143. package/prompts/knowledge/tool-repo-outline.md +2 -2
  144. package/prompts/knowledge/tool-settings-read.md +5 -7
  145. package/prompts/knowledge/tool-settings.md +10 -10
  146. package/prompts/knowledge/tool-skill.md +4 -4
  147. package/prompts/knowledge/tool-ssh.md +66 -66
  148. package/prompts/knowledge/tool-step.md +26 -0
  149. package/prompts/knowledge/tool-subagent.md +52 -50
  150. package/prompts/knowledge/tool-task.md +14 -11
  151. package/prompts/knowledge/tool-team-ledger-read.md +7 -7
  152. package/prompts/knowledge/tool-team-ledger.md +13 -13
  153. package/prompts/knowledge/tool-timer.md +14 -14
  154. package/prompts/knowledge/tool-tree.md +11 -11
  155. package/prompts/knowledge/tool-verify.md +11 -11
  156. package/prompts/knowledge/tool-wait-for.md +20 -20
  157. package/prompts/knowledge/tool-websearch.md +16 -14
  158. package/prompts/knowledge/tool-write.md +10 -10
  159. package/prompts/knowledge/upstream-protocol.md +37 -38
  160. package/prompts/persona-coder.md +22 -22
  161. package/prompts/persona-eng-coder.md +87 -81
  162. package/prompts/persona-eng-designer.md +173 -153
  163. package/prompts/persona-engineering.md +53 -554
  164. package/prompts/persona-explore.md +18 -15
  165. package/prompts/persona-normal.md +62 -63
  166. package/prompts/persona-plan.md +36 -32
  167. package/prompts/persona-tester.md +39 -39
  168. package/prompts/planning-next-moves.md +9 -0
  169. package/prompts/subagent-base.md +4 -16
  170. package/provider/errors.mjs +0 -24
  171. package/provider/list-models.mjs +20 -2
  172. package/session-lifecycle.mjs +4 -3
  173. package/tool-args.mjs +25 -0
  174. package/tool-docs/peek.md +3 -0
  175. package/tool-docs/plan.md +1 -1
  176. package/tool-docs/question.md +1 -1
  177. package/tool-docs/step.md +3 -0
  178. package/tools/edit-diff.mjs +4 -4
  179. package/tools/index.mjs +3 -2
  180. package/tools/peek.mjs +447 -0
  181. package/tools/question.mjs +87 -9
  182. package/tools/ssh.mjs +1 -1
  183. package/window-policy.mjs +107 -80
@@ -1,28 +1,28 @@
1
1
  aliases: 台账, 只读, 待办查询
2
- `query` returns filtered rows, `count` returns how many. Nothing here adds, moves or settles a row.
2
+ `query` 返回过滤后的行,`count` 返回有多少条。这里什么都不新增、不移动、不结算行。
3
3
 
4
- A row is one requirement point or one piece of engineering debt. The six states are `待讨论` / `待设计` / `在途` / `待核销` / `已核销` / `已废弃`; `status` filters to one of them.
4
+ 一行是一个需求点或一笔工程债。六个状态是 `待讨论` / `待设计` / `在途` / `待核销` / `已核销` / `已废弃`;`status` 过滤到其中一个。
5
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.
6
+ **不给 `status` 时只回未决四态**(前四个)。归档两态(`已核销` / `已废弃`)要 `includeArchived: true` 才回。显式 `status` 恒胜。
7
7
 
8
- Adding, moving or settling a row belongs to the main agent; calling one directly is refused before anything is written.
8
+ 用它弄清已经排了什么活,再提新活:你板块上未结的行、这份批次档在飞的活,以及未结的行有多旧。
9
9
 
10
- The other filters:
11
- - `kind` — requirement vs tech_todo (the field itself holds those two words).
12
- - `board` — the owning board (a requirement-document name).
13
- - `trigger` — the tech-todo trigger.
14
- - `task_book` — the task-book pointer, i.e. the row → batch lookup.
10
+ 其余过滤器:
11
+ - `kind` —— requirement 对 tech_todo(这个字段本身就装这两个词)。
12
+ - `board` —— 所属板块(一个需求文档名)。
13
+ - `trigger` —— 技术债的触发。
14
+ - `task_book` —— 任务书指针,也就是从行到批次的查找。
15
15
 
16
- Rows come back 10 per page, with or without filters — a filter narrows what is eligible, not how many a page carries.
17
- - 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.
18
- - `count` is a different book: it counts the four unsettled states only, while a page's total covers all six.
16
+ 行每页回来 10 条,带不带过滤器都一样 —— 过滤器收窄的是哪些行有资格,不是一页装多少条。
17
+ - 每一页都以一行尾部结束,给出总数、本页的名次范围,以及还有下一页时取它的命令:`ledger({action:"query"<the filters in force>, cursor:"<cursor>"})`。整行照抄执行:它重复了本页的过滤器,只拷 `cursor` 就把过滤器丢了。首页省略 `cursor`;畸形的一个被拒绝,绝不当作第一页。
18
+ - `count` 与 `query` 同口径:两者都只数未决四态。要看归档行就对 `query` 传 `includeArchived: true`。
19
19
 
20
- Every returned row carries a reading about itself:
21
- - `aged` — unsettled and older than 30 days.
22
- - `evidenceTooLong` — the evidence text is too long to read.
23
- - `taskBookOnDisk` — the row's task-book file part resolves and is on disk.
24
- - `overdue` — the exit state as one word (resume_due / dangling / unlabeled / aged); first match wins.
20
+ 每条返回的行都带着一段关于自己的读数:
21
+ - `aged` —— 未结且已超过 30 天。
22
+ - `evidenceTooLong` —— 证据文本太长,读不了。
23
+ - `taskBookOnDisk` —— 该行的任务书文件部分能解析,且在盘上。
24
+ - `overdue` —— 退出状态浓缩成一个词(resume_due / dangling / unlabeled / aged);先匹配到的胜出。
25
25
 
26
- `cwd` decides which project's ledger is read; omit it for the session anchor. A relative path resolves against the anchor, and the project root is taken inside it — outside it no project is attached.
27
- The root is the nearest ancestor directory carrying PROJECT-MANIFEST.json; a ledger file sitting on disk does not make a project.
28
- The book lives in the user data directory keyed by project root, so a query never reads another project's book and the repository stays free of ledger files.
26
+ `cwd` 决定读哪个项目的台账;省略它就用会话锚点。相对路径按锚点解析,项目根落在它之内 —— 之外不挂任何项目。
27
+ 根是最近的、持有 PROJECT-MANIFEST.json 的祖先目录;盘上放着一个台账文件并不使其成为项目。
28
+ 账本活在用户数据目录里、按项目根分键,所以一次查询永远不读别的项目的账本,仓库里也不留台账文件。
@@ -1,46 +1,46 @@
1
1
  aliases: 台账, 待办, 记账
2
- `action` = add / update / close / query / count.
2
+ `action` = add / update / close / query / count。
3
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 machine-judged)).
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 from 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** — the marker `(预定)` at the tail of the value (`docs/batches/<x>.md(预定)`) registers the intent to work a record that does not exist yet;
12
- that pointer passes the gate while its file is absent (`taskBookOnDisk` stays `false`, a reading not a gate).
13
- It must be a project-relative path — no declared-repo prefix, no absolute path — must sit under this project's batch root,
14
- and the record must not be on disk yet: any of the three failing is refused, naming the pointer and the legal form.
15
- Once that record is on disk the marker is surplus and refused (drop it).
16
- - `batch create` on that same path later **claims this row** instead of opening a second one: the pointer becomes the plain form, the row goes to `在途`, 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, each named — picking one would silently drop the other's intent.
17
- - `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.
18
- - `status` may be omitted (default `已核销`) and can only be `已核销`.
19
- - `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:
20
- - `aged` — an unsettled state and older than 30 days.
21
- - `evidenceTooLong` — the evidence text is too long to read; a reading, never a write refusal.
22
- - `taskBookOnDisk` — the `task_book` file part resolves and that file is on disk.
23
- - `overdue` — the exit state as a word: `resume_due` / `dangling` / `unlabeled` / `aged`, first match wins.
24
- - The six states: `待讨论` / `待设计` / `在途` / `待核销` / `已核销` / `已废弃`.
25
- - **Every page ends with a tail line**: 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.
26
- - `count` is a different book: it counts the four unsettled states only, while a page's total covers all six.
27
- - `count`: `{ count, overdue, evidenceTooLong }` — rows in the four unsettled states; how many of those are in an overdue exit state; how many carry over-long evidence. `count` takes `task_book` only: every other filter (`status` / `kind` / `board` / `trigger`) is refused as an unknown parameter (`未知参数:…`), so filter after counting or use `query`.
28
- - `query` / `count` are read-only and open to every role; `add` / `update` / `close` write and are main-agent only.
29
- - `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.
30
- - `待讨论→在途` is the ignition path: opening a batch moves its coverage rows straight to `在途`, never through `待设计` (`待设计` means design is scheduled, not that ignition happened).
31
- - `待核销→在途` is the reopen or manual return path and always writes the current session as executor; an explicit old executor does not override it.
32
- - `在途→待讨论` 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.
33
- - Give exactly one of `id` / `batch`.
34
- - `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.
35
- - `evidence` appends (old value non-empty ⇒ `old|new`, nothing around `|`; old empty ⇒ written as given). `evidenceReplace: true` with `evidence` replaces the whole text; the flag alone, or a blank new value, is refused.
36
- - `update --batch`: one migration across a batch (`batch` = the batch-record pointer; the rows whose `task_book` sits on that record are handled together).
37
- - With `status` ⇒ every row re-judged against the migration table; without `status` ⇒ a pure field patch, `status` untouched.
38
- - 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.
39
- - A `batch` that does not resolve to a record on disk is refused.
40
- - `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.
41
- - Settlement requires non-blank work `evidence` after applying this call. Existing evidence is sufficient; a blank replacement is refused and leaves the row unchanged.
42
- - **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.
43
- - `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.
44
- - 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`.
45
- - 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.
46
- - `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.
4
+ - `add`:一条新条目落进 `待讨论`。
5
+ - `kind` = `requirement`(需求池)/ `tech_todo`(工程债)。
6
+ - `trigger` = `归批` / `条件` / `认账不排期`(可选)。
7
+ - `resume_when` = 一句话,说明该条目何时续起(可选;给了就不能空白,它可以带锚点 `@YYYY-MM-DD`(机器判)或 `@<event>`(不机器判))。
8
+ - **`task_book` 闸** —— `add` 与 `update` 上相同,判断的是这次调用写下的内容。一条最终落在 `在途` / `待核销` 的条目,或一次把 `trigger` 设成 `归批` 的调用,都必须携带 `task_book`:缺失 / 空串 / 纯空白被拒绝。
9
+ - 一次写入 `task_book`(非空)、或把 `trigger` 设成 `归批` 的调用,还要受指针约束:它的文件部分,即第一个 `§` 之前的文本,必须能解析且该文件在盘上,否则拒绝。
10
+ - 不碰那个指针的调用不受判断:一次早先调用留下的陈旧指针绝不阻塞一次 `status` / `evidence` / 其他字段的更新 —— 「文件在不在盘上」是 `taskBookOnDisk` 那条读数,不是闸。
11
+ - **预定指针** —— 值尾部的标记 `(预定)`(`docs/batches/<x>.md(预定)`)登记了「要去做一份尚不存在的记录」的意图;
12
+ 在其文件缺席期间该指针通过闸(`taskBookOnDisk` 保持 `false`,那是读数不是闸)。
13
+ 它必须是项目相对路径 —— 没有声明过的仓库前缀,不能是绝对路径 —— 必须落在本项目的批次根之下,
14
+ 且那份记录必须还不在盘上:三条里有任何一条不成立就拒绝,并指名该指针与合法形式。
15
+ 那份记录一旦落到盘上,标记就是多余的,被拒绝(删掉它)。
16
+ - 之后在同一路径上的 `batch create` 会**认领这一行**,而不是另开一行:指针变成普通形式,行走到 `在途`,不出现新行。那里省略 `ledger` 与 `newDebt` 时,该路径的预定行先于同面孔检查胜出。同一路径上两条预定行被拒绝并逐条指名 —— 挑一条会静默丢掉另一条的意图。
17
+ - `close --batch`:只结算已经处在 `待核销` 的行。`待讨论` / `待设计` 的行被跳过并指名(先把它们移到 `在途` 才能认领),`在途` 的行被跳过并指名(它们不能跳级),已结与已废弃的行不计入。
18
+ - `status` 可以省略(默认 `已核销`),且只能是 `已核销`。
19
+ - `query`:等值过滤器(`status` / `kind` / `board` / `trigger` / `task_book`)。**不给 `status` 时只回未决四态**(`待讨论` / `待设计` / `在途` / `待核销`)——归档两态(`已核销` / `已废弃`)要 `includeArchived: true` 才回。显式 `status` 恒胜。每页 10 行 —— 过滤器收窄的是哪些行有资格,不是一页装多少行。每一行带:
20
+ - `aged` —— 处于未结状态且已超过 30 天。
21
+ - `evidenceTooLong` —— 证据文本太长读不了;是读数,绝不是写入拒绝。
22
+ - `taskBookOnDisk` —— `task_book` 的文件部分能解析,且那个文件在盘上。
23
+ - `overdue` —— 退出状态作为一个词:`resume_due` / `dangling` / `unlabeled` / `aged`,先匹配到的胜出。
24
+ - 六个状态:`待讨论` / `待设计` / `在途` / `待核销` / `已核销` / `已废弃`。
25
+ - **每一页都以一行尾部结束**:总数、本页的名次范围,以及 —— 还有下一页时 —— 取它的命令,`ledger({action:"query"<the filters in force>, cursor:"<cursor>"})`。**整行照抄执行**:它重复了本页的过滤器,只拷 `cursor` 就把过滤器丢了,于是下一页是从未过滤的集合里取的,还不报错。首页省略 `cursor`;畸形的一个被拒绝,绝不当作第一页。
26
+ - `count` 与 `query` 同口径:两者都只数未决四态。要看归档行就对 `query` 传 `includeArchived: true`,`count` 不接这个参数。
27
+ - `count`:`{ count, overdue, evidenceTooLong }` —— 四个未结状态里的行数;其中多少条处于超期的退出状态;多少条带着过长的证据。`count` 只收 `task_book`:其他任何过滤器(`status` / `kind` / `board` / `trigger`)都作为未知参数被拒绝(`未知参数:…`),所以先计数再过滤,或改用 `query`。
28
+ - `query` / `count` 是只读的;`add` / `update` / `close` 会写。
29
+ - `update`:让一条条目沿六状态表逐边移动 —— `待讨论→待设计` / `待讨论→在途` / `待设计→在途` / `在途→待核销` / `在途→待讨论` / `待核销→已核销` / `待核销→在途` / `待核销→待讨论` / 任何未结状态 → `已废弃`。`已核销` 与 `已废弃` 是终态;不在这张表上的每一条边都被拒绝。
30
+ - `待讨论→在途` 是点火路径:开一个批次把它的覆盖行直接移到 `在途`,绝不经过 `待设计`(`待设计` 意味着设计已排期,不是点火已发生)。
31
+ - `待核销→在途` 是重开或手动退回的路径,并且总是把当前会话写成 executor;显式给的旧 executor 不会覆盖它。
32
+ - `在途→待讨论` 与 `待核销→待讨论` 把没做完的活退回等待池。它们要求这次调用给出非空白的 `evidence` 作为理由,把它追加到行里,清掉 `executor` / `task_book` / `trigger`,保留 `created_at`,并在回执里返回 `reason`。
33
+ - `id` / `batch` 恰好给一个。
34
+ - 省略 `status` = 只更新你传的字段;省略 `resume_when` = 不变;省略 `executor` = 进入 `待设计` / `在途` 时写入当前会话,而离开 `在途`、退回 `待讨论` 或废弃时清掉。
35
+ - `evidence` 是追加(旧值非空 ⇒ `old|new`,`|` 两侧不加东西;旧值为空 ⇒ 原样写入)。`evidenceReplace: true` 配 `evidence` 替换整段文本;只给这个旗标,或给一个空白的新值,都被拒绝。
36
+ - `update --batch`:跨一个批次做一次迁移(`batch` = 批次档指针;`task_book` 落在那份记录上的行一起处理)。
37
+ - 配 `status` ⇒ 每一行都按迁移表重新判断;不配 `status` ⇒ 纯字段补丁,`status` 不动。
38
+ - 回执 `{ batch, status, applied, skipped }`;每条被跳过的行被指名 `{ id, from, why }`(`why` = 该行自己的拒绝文本),其余仍然落地;事务级失败把整批回滚。
39
+ - 一个解析不到盘上记录的 `batch` 被拒绝。
40
+ - `close`:结算(`待核销 → 已核销`)—— 唯一一条结算边。`待讨论` / `待设计` / `在途` 被拒绝,指名当前状态与该状态的出路。废弃只允许从未结状态发起;两个归档状态都拒绝后续的归档写入。
41
+ - 结算要求应用这次调用之后是非空白的工作 `evidence`。已有的证据就够用;空白的替换被拒绝,且行保持原样。
42
+ - **一行的归档与它的批次档绑定。** 任一归档目标落地之前(`已核销` 用于结算,`已废弃` 用于废弃),先读它 `task_book` 指向的那份记录:§1 状态行读作 `进行中` 的记录拒绝这次写入 —— 结算时报 `批档未收口 … 请先 batch close(同笔结算并冻结档)`,从 `在途` / `待核销` 发起废弃时报 `先退回 待讨论(携理由)再 已废弃,或先 batch close`。两种情况行都保持原样,而 `batch close` 一次动作就结算行并冻结记录。
43
+ - `update` 到任一归档状态受同一个闸约束,`close --batch` / `update --batch` 在 `skipped` 里用那道闸自己的话逐行指名。§1 状态行读不出来的记录(缺失,或 §1 头部区域有两行及以上)另行拒绝,并指名其修法:那个区域里恰好一行状态行,由主 agent 以一次普通文档写入完成。
44
+ - 四种情形没有记录可判也通过闸,回执为每条这样的行带一条 `notices` 条目 —— `{id, reason, message}`,没有时省略该键 —— 单行回执如此,`batch` 回执放在顶层:指针解析到一个不是批次档的文件(`pointer-not-a-record`)、指针没有文件部分(`no-task-book`)、指针解析不出来或它的文件不在盘上(`record-not-on-disk`,记录可以被清理),或该行是一次 `待讨论` / `待设计` 的补登记(`retro-close`)。绕开闸不是工作证据,所以它绝不碰 `evidence`。
45
+ - 软删除:行保留自己的内容,并得到一个 `closed_at`,已结的行的结算时间是收口那一刻,不是一次更新。
46
+ - 单行收口上 `status` 必填:`已核销` 结算,`已废弃` 废弃。`id` / `batch` 恰好给一个。`evidence` / `evidenceReplace` 的行为同 `update`,省略 `evidence` 就让该行自己的文本原样留着。
@@ -1,16 +1,16 @@
1
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)
2
+ 参数:
3
+ - path:要检查的文件(默认:最近改动的文件)
4
+ - full:跑完整的语言感知级联,而不是只跑 node --check(默认 false)
5
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.
6
+ 不带 `full` 时只跑 `node --check`,它覆盖 JS/TS 家族;其他任何文件会得到一句提示,让你改传 `full`。
7
7
 
8
- With `full` the cascade is picked by extension:
8
+ 带 `full` 时按扩展名挑级联:
9
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`.
10
+ - TS:tsc --noEmit,只在存在 TypeScript 项目配置的地方跑。
11
+ - Python:ruff。Rust:cargo check,只在存在 Cargo 清单的地方跑。
12
+ - Go:go vet。JS/JSX:仍是 `node --check`。
13
13
 
14
- Use the fast default after every write or edit, and `full` before declaring a task complete.
14
+ 每次写入或编辑之后用快的默认档。`full` 留给收口、发布,或当前文件默认档覆盖不了的语言。不要把「做完」当成跑 `full` 的理由。
15
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.
16
+ 返回 `Syntax OK: <path>` / `Syntax error in <path>: <message>`,或语言检查器自己的一行(`✓ <checker>: no issues` / `✗ <checker>: <failure text>`),或一行 `lint:`,说明该检查器没装、或该扩展名没有检查器。
@@ -1,15 +1,15 @@
1
1
  aliases: 目录, 列目录
2
- Directories listed first. Use to see what a directory contains (glob only matches files).
2
+ 目录先列。用它看一个目录里有什么(glob 只匹配文件)。
3
3
 
4
- **Route to ls instead of bash:** `dir /b` / `ls` / `dir` → ls. Listing a directory is a read — never shell out for it.
4
+ **改用 ls,而不是 bash:** `dir /b` / `ls` / `dir` → ls。列一个目录是一次读 —— 绝不为它 shell 出去。
5
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
- - includeProcessDocs: include docs from process layers (batch records, archived material) — excluded by default; pass `true` to get them back
6
+ 参数:
7
+ - path:目录路径(默认 cwd)
8
+ - filter:只列匹配这个 glob 的条目(例如 '*.mjs'、'*test*')—— 一个通配过滤器,不是完整清单
9
+ - includeProcessDocs:包含过程层的文档(批次档、归档材料)—— 默认排除;传 `true` 把它们取回来
10
10
 
11
- Notes:
12
- - Shows first 500 entries
13
- - Directories are suffixed with `/` and listed before files
14
- - A file row carries its layer label after the name (`TOOLS.md [design]`); directory rows carry none. When file rows from process layers are excluded (or included on request), a final line reports how many. Excluded rows spend none of the 500-entry cap.
15
- - Use this for a quick overview; use glob when you have a specific file pattern in mind
11
+ 注意:
12
+ - 最多显示前 500 个条目
13
+ - 目录带 `/` 后缀,并列在文件之前
14
+ - 文件行在名字后面携带它的层标签(`TOOLS.md [design]`);目录行没有。过程层的文件行被排除时(或按请求被包含时),最后一行报告有多少条。被排除的行不占用 500 条上限。
15
+ - 用它做快速概览;心里有具体文件模式时用 glob
@@ -1,11 +1,11 @@
1
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
2
+ 用它理解代码结构,不必靠 grep 猜函数位置或类型形状。找文件用 glob / repo_outline —— 定义 / 引用 / 诊断用 lsp。
3
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)
4
+ 参数:
5
+ - subcommand(必填):LSP 操作 —— "definition" | "references" | "hover" | "symbols" | "diagnostics"
6
+ - uri(必填):目标文件路径(相对于项目根)
7
+ - line:1 起算的行号(用于 definition/references/hover)
8
+ - character:1 起算的字符偏移(用于 definition/references/hover)
9
9
 
10
- Notes:
11
- - Returns the requested LSP result: definition location, references, hover info, document symbols, or diagnostics — or an error message.
10
+ 注意:
11
+ - 返回所请求的 LSP 结果:定义位置、引用、悬停信息、文档符号或诊断 —— 或一条错误信息。
@@ -1,2 +1,2 @@
1
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).
2
+ 试过什么、确切的错误、近期的上下文。让分析扎根在真实的失败轨迹上,而不是猜。输出有上限(约 60k 字符 —— 更旧的消息被裁掉,并附一句说明)。
@@ -1,14 +1,14 @@
1
1
  aliases: 清单, 项目档案, 只读
2
- The file holds version / phase / docRoot / codePaths / index.
2
+ 这个文件装着 version / phase / docRoot / codePaths / index。
3
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.
4
+ target —— 你指的项目根或目录;**必填** —— 省略即被拒绝。相对路径按会话锚点解析。工作区目标(其下有几个项目)会连同完整候选清单一并报出 —— 请指名你要的项目根,并把它作为 target 传入。
5
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.
6
+ `docRoot` 每个文档层一个条目,各是一个目录(字符串 | 多根数组 | `null` = 缺席):requirements / specs / design / modules / batches。
7
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).
8
+ `standards` 是标准**层** —— 一个目录,其下的 `.md` 文件(含子目录,按层根相对的路径顺序)就是标准;不接受文件路径(一个键,一个含义)。
9
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.
10
+ 只读:唯一的动作是 `read`。
11
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.
12
+ read —— 用一个稳定的锚报告清单状态:`state=ok|missing|invalid|workspace|no-project`。ok 状态打印清单 JSON,另加 missingKeys / errors 行(仅在有内容时)。从不抛出 —— 清单缺失是报出来,不是拒绝。
13
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.
14
+ 用它定位文档,而不是假设一个路径:读 `docRoot.<key>`,把你的目标解析到那个根之下。某个面缺失(`null`)意味着这个项目里没有那一层文档 —— 报出来,不要编一个路径。
@@ -1,34 +1,45 @@
1
1
  aliases: 清单, 项目档案, 文档根
2
- Subagents carry a read-only variant (action `read`); init / write stay main-agent only.
3
2
 
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). It 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 …`,
18
- and what follows takes that parameter's own form — a dash clause for `target`, a parenthetical for `key` and `value` —
19
- so match on `is required`, not on the punctuation after it.
20
- Both leave the disk unchanged; the written file reaches the project-state line next turn.
21
-
22
- read is read-only (no approval); init / write are side effects (approval gate).
23
-
24
- 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.
25
- - `version` — schema version (a number); change on migration; wrong ⇒ validation refuses.
26
- - `phase` — `initial-dev` / `production`; change when the stage is crossed; wrong ⇒ validation refuses.
27
- - `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.
28
- - `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.
29
- - `docRoot.standards` — the standards **layer**: one directory of `.md` files (a string | a multi-directory array | `null` = no such face; default `null` — no default directory, so no default name to guess); members = every `.md` file under it, subdirectories included, in layer-root-relative path order (case-insensitive; symbolic links 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).
30
- - `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.
31
- - `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.
32
- - `index.docCheckExcludePaths` — project-root-relative prefixes the document check leaves alone: a document under one 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.
33
- - `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 outside this project's searchable corpus and is not a source this project can cite. Not interchangeable with `index.writableRepos` (reading ≠ writing).
34
- - `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, and 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; 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 — 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.
3
+ 动作:
4
+ - read —— 用一个稳定的锚报告状态:`state=ok|missing|invalid|workspace|no-project`。ok 状态打印清单 JSON,另加 missingKeys / errors 行(仅在有内容时)。它从不抛出 —— 清单缺失是报出来,不是拒绝。
5
+ - init —— 在项目根解析得出的地方创建默认清单。已存在时被拒绝 —— init 从不覆盖。
6
+ - write <key> <value> —— 点编辑一个节点:读、设值、经写者闸写回。结果必须通过校验(一处故障即拒绝,盘上逐字节不变);清单缺失被拒绝 —— 先跑 init。
7
+
8
+ target —— 你指的项目根或目录;**必填** —— 省略即被拒绝。相对路径按会话锚点解析。
9
+
10
+ 工作区目标(其下有几个项目)由 `read` 报出,由 `init` / `write` 拒绝 —— 请指名你要的项目根。
11
+
12
+ key —— 进清单的点路径:version / phase / codePaths,或 docRoot / index 的子键。那两族的整对象写入被拒绝,集合之外的任何键也被拒绝(拼写保护)。
13
+
14
+ value —— 先按 JSON 解析(null / true / 5 / ["a","b"]),否则按字面字符串(docs/design)。"null" 是 docRoot.<key> 显式的「没有这个面」:一个合法值,不是删除。
15
+
16
+ 拒绝会抛 `manifest <action>: refused — …`;缺参数会抛 `manifest <action>: <param> is required …`,
17
+ 后面的部分随参数各用各的形式 —— `target` 是一段破折号子句,`key` 与 `value` 是括号 ——
18
+ 所以匹配 `is required`,不要匹配它后面的标点。
19
+ 两种都不改动磁盘;写成的文件在下一轮到达项目状态行。
20
+
21
+ read 是只读的(无审批);init / write 是副作用(审批闸)。
22
+
23
+ 到用的时候才建,一个项目建一次。已存在时 init 拒绝,从不覆盖。
24
+ 只有在需要版本控制且用户确认时,才 `git init`。
25
+ 没有项目不是错误:那个动作或那一会话轮缺项目参数,就报出来,不要闷掉。
26
+ 关键需求决定放需求文档,不放清单。清单只放当前项目阶段与已声明的目录。把它与台账的剩余工作账、批档的过程账区分开。
27
+ 查文档之前先 `read` 出 `docRoot.requirements` 和 `docRoot.design`,不要先打开批档。
28
+ 定需求、定验收、定边界之前,先 `read` 出 `docRoot.standards`,再读它声明的那个目录。需求与标准冲突,摆给用户,不要绕开写。
29
+
30
+ 键目录 —— 16 个可写节点(3 个整键 + docRoot 的 7 个子键 + index 的 6 个子键):各自是什么;何时改它;错了 ⇒ 什么后果。
31
+ - `version` —— schema 版本(一个数字);迁移时改;错了 ⇒ 校验拒绝。
32
+ - `phase` —— `initial-dev` / `production`;跨过阶段时改;错了 ⇒ 校验拒绝。
33
+ - `codePaths` —— 路径段名(任意深度按段匹配;**没有默认段** —— 项目声明之前这个键是空的,所以从未声明它的项目没有代码段,`src/` 下的一个 `.md` 会读成文档);布局挪动时改;错了 ⇒ 没有任何段被归类。
34
+ - `docRoot.requirements` —— 需求层根(字符串 | 多根数组 | `null` = 缺席):板块的当前目标、功能点、边界、非功能需求与验收条件。实现结构留在 `design`,这一轮的记录留在 `batches`。需求根挪动时改它;错了 ⇒ 校验拒绝,或检查与评审的根指向别处。
35
+ - `docRoot.specs` —— 工程规范层根:跨模块的硬约定(接口契约、协议、数据格式、取值约束),每个模块一份规范;各项目自己的规范文档定义其形式。标准层承载跨主题的规则与阈值,规范引用一条标准,而不是复述它;需求层承载板块级目标与验收条件,规范把它们落到某一个模块的取值与位置上。规范根挪动时改它;错了 ⇒ 模块文档读成 `requirements` 或 `design`。
36
+ - `docRoot.design` —— 设计层根(字符串 | 多根数组 | `null` = 缺席):当前的结构、接口、关键决策、留存下来的理由与实施归属。一次性的执行清单与被撤回的选项留在批次档里。设计根挪动时改它;错了 ⇒ 校验拒绝,或评审读了错的目录。
37
+ - `docRoot.modules` —— 模块级设计根(字符串 | 多根数组 | `null` = 缺席):每个模块一份设计文档,边界与代码树一致,承载该模块的结构、接口、归属与留存理由。它通常落在 `design` 根之内,最长的已声明根胜出,所以一份模块文档读成 `modules`,不是 `design`。模块面挪动时改它;错了 ⇒ 模块文档读成 `design` 而不是 `modules`。
38
+ - `docRoot.batches` —— 批次过程记录根(字符串 | 多根数组 | `null` = 缺席):一轮的设计任务、评审、实施与收口记录,可整份丢弃 —— 没有必须活过这一轮的规则只住在这里。批次目录挪动时改它;错了 ⇒ 检查与评审读了错的地方。
39
+ - `docRoot.standards` —— 标准**层**:一个装着 `.md` 文件的目录(字符串 | 多目录数组 | `null` = 没有这个面;默认 `null` —— 没有默认目录,也就没有默认名字可猜);成员 = 其下每一个 `.md` 文件,含子目录,按层根相对的路径顺序(不区分大小写;不跟随符号链接);加入标准文档或该层挪动时改它;错了 ⇒ 评审报告该声明读不出来并指名路径,分列原因(没有这个目录 / 不是目录 / 没有 .md 文件),绝不静默跳过。不接受文件路径(一个键,一个含义)。
40
+ - `docRoot.manuals` —— 面向产品最终用户的手册层根:字符串 | 多根数组 | `null` = 这一层缺席;默认 `docs/manuals`,所以从未写这个键的清单拿到那个根,而显式 `null` 表示项目没有这一层。它承载产品面向用户的操作说明与常见故障排除:命令怎么用、界面怎么操作、卡住时查什么。需求、设计与标准的文本留在各自的层里。手册根挪动时改它;错了 => 该层读成 `manuals`,而评审与文档检查看的是错的目录。
41
+ - `index.codeExtensions` · `index.docExtensions` —— 额外的代码 / 文档扩展名(取并集,只增);索引里缺某个类型时改它;错了 ⇒ 那个类型一直进不来。
42
+ - `index.excludePaths` —— 用于索引的项目根相对前缀;要把一个目录挡在外面时改它;错了 ⇒ 它仍被索引,或另一个被错误地排除。
43
+ - `index.docCheckExcludePaths` —— 文档检查不碰的项目根相对前缀:其下的文档不被判断、不被计数,而读不出来的清单什么都不排除,于是每一份文档都受判。不能与 `index.excludePaths` 互换,后者是索引读的。
44
+ - `index.publicRepos` —— 公开仓库路径(可从本仓库根解析)= 本仓库的出边表:列在这里的仓库**可以搜索、可以引用**。接一个进来或撤掉一个时改它;没列出的 ⇒ 那个仓库在本项目可搜索语料之外,不是本项目能引用的来源。不能与 `index.writableRepos` 互换(读 ≠ 写)。
45
+ - `index.writableRepos` —— 本仓库可以写入的外部**目录**(是目录,不是仓库 —— 不读 `.git` / 清单;可从本仓库根解析)= 本仓库的写权表,单向:目标没有发言权,git 权限才是真正的防线。目标在表内 ⇒ 写闸从**本**项目的台账取行号,并把改动记在这里;在表外 ⇒ 闸拒绝并指名这张表。只有当你打算把**本仓库的**账花在一个外部目录上时才改它 —— 空意味着目标只能在自己名下被写。不能与 `index.publicRepos` 互换(读 ≠ 写)。错了 ⇒ 那个目录的写入仍被拒绝(拒绝里指名 `writableRepos` 与目标),或一个你本不想打开的目录坐在表里。
@@ -1,20 +1,20 @@
1
1
  aliases: 记忆, 只读记忆, 检索记忆
2
- Two actions:
2
+ 两个动作:
3
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.
4
+ - `search` —— 找之前会话里存下的知识。每条结果行带 `[layer]` 加条目 id,id 的前缀就是层。
5
+ - `list` —— 盘点记忆里有什么,一条条目一行:`[layer] id [type] title (date)`。被截断的清单会注明完整条数。
6
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`.
7
+ 在重新探索项目可能已经知道的东西之前用它:一条已存的规则、一个决策、一个调试模式。会话消息历史**不在**记忆里 —— 那是 `read_history`。
8
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.
9
+ 写入记忆归拥有写权的角色。那些动作不属于这个工具面,直接调用一个会在写入任何东西之前被拒绝。
10
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.
11
+ 层 = 记忆的层级:personal(私有)/ project(经本仓库的 .thincoder/memory/ 共享)/ team(仅 CLI,由 git 同步)。`[layer]` 标签、id 前缀与 `layer` 参数是同一个概念。
12
12
 
13
- Both actions take `layer` optionally — omit it to read every layer.
13
+ 两个动作都可以给 `layer` —— 省略就读每一层。
14
14
 
15
- The other arguments:
15
+ 其余参数:
16
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).
17
+ - `type` —— 按条目类型过滤 list:rule(编码标准)· knowledge(项目事实)· decision(架构决策)· pattern(调试 / 工作流模式)。
18
+ - `keyword` —— 按标题或内容的子串过滤 list。
19
+ - `query` —— search 的自然语言问题。
20
+ - `limit` —— 限制行数(list 默认 50,search 默认 5)。
@@ -1,19 +1,19 @@
1
1
  aliases: 记忆, 长期记忆, 存记忆
2
- The action picks the operation:
3
- - search — find knowledge saved in previous sessions; each result row carries [layer] plus an entry id whose prefix is 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 as [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 and a mismatch is refused (guards against deleting the wrong entry); omitted, the id prefix routes the delete.
7
- - delete, 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 and a preview; a layer-wide wipe without filters is refused on every layer.
8
- - clear — {layer: "personal", confirm: true} wipes ALL personal entries. It is personal-only: a missing layer or a project / team layer is refused (use delete batch filters on shared layers).
9
- - 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.
2
+ 动作选择操作:
3
+ - search —— 找之前会话里存下的知识;每条结果行带 [layer] 加一个条目 id,id 的前缀就是层。
4
+ - put —— 为将来的会话存下知识;type = rule(编码标准)/ knowledge(项目事实)/ decision(架构决策)/ pattern(调试 / 工作流模式)。
5
+ - list —— 盘点记忆里有什么;一条条目一行,形如 [layer] id [type] title (date);被截断的清单会注明完整条数。
6
+ - delete,单条:{id, layer} 删掉 put / search / list 输出里显示的那条条目。`layer` 可选 —— 传了就对 id 前缀做校验,不匹配即拒绝(防着删错条目);省略时由 id 前缀路由这次删除。
7
+ - delete,批量(不给 id):{layer, type 和/或 keyword} 删掉该层里每一条匹配的条目 —— 必须有 layer 加 type / keyword 中至少一个。不给 confirm:true 时返回条数与一份预览;没有过滤器的整层抹除在每一层上都被拒绝。
8
+ - clear —— {layer: "personal", confirm: true} 抹掉**全部** personal 条目。它仅限 personal:缺 layer 或给一个 project / team 层都被拒绝(共享层改用 delete 的批量过滤器)。
9
+ - maintain —— 索引自维护,默认试运行:不给 confirm:true 时你拿到计划与它的读数,什么都不写;confirm:true 才执行。它不收 layer —— 它作用于整个存储。
10
10
 
11
- Write-gate parameters:
12
- - ledger: the in-flight ledger row this call serves — `"#N"` or `"N"`.
13
- - project: the project root holding `PROJECT-MANIFEST.json` (absolute or cwd-relative).
11
+ 写闸参数:
12
+ - ledger:这次调用所服务的在途台账行 —— `"#N"` 或 `"N"`。
13
+ - project:存放 `PROJECT-MANIFEST.json` 的项目根(绝对路径或相对于 cwd)。
14
14
 
15
- 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 one concept — pass a result row's [layer] as layer.
15
+ 层 = 记忆的层级:personal(私有)/ project(经本仓库的 .thincoder/memory/ 共享)/ team(仅 CLI,由 git 同步)。[layer] 标签、id 前缀与 layer 参数是同一个概念 —— 把结果行里的 [layer] 当 layer 传。
16
16
 
17
- Team deletion is local only: a later team sync may bring the entry back while the remote still holds it.
17
+ team 层的删除只在本地生效:之后一次 team 同步可能把条目带回来,远端仍持有它。
18
18
 
19
- Save bugs, conventions and preferences here — they persist across sessions. Session message history is NOT in memory — search it with read_history.
19
+ bug、约定与偏好存在这里 —— 它们跨会话留存。会话消息历史**不在**记忆里 —— 用 read_history 搜它。
@@ -1,12 +1,12 @@
1
1
  aliases: 上抛, 父代理, 请示
2
- It queues a message on the parent's side: your turn is not interrupted and nothing is taken out of it.
2
+ 它在父侧排一条消息:你的轮次不被打断,也没有任何东西被拿走。
3
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.
4
+ - `kind: 'ask'` —— 一个答案会改变你下一步、而你能读到的材料(任务书 / 设计档 / 仓库)又答不了的问题。父侧用 `subagent action:'send'` 回复,你在下一个轮次边界把它当成一条普通指令收到。前一个 ask 还在父侧队列里等待时,一次只能有一个 ask。
5
+ 先读材料,并带上你已经查过的证据(文件路径加你读到的原话)—— 父侧不该为你重读。
6
+ - `kind: 'note'` —— 一条不需要回答的知会(你发现被打破的前提、你解决并希望早点被看见的一处冲突)。
7
+ - 投递标记:父侧收到的消息带 `[上抛·待裁]`(ask —— 等父侧裁决)或 `[上抛·知会]`(note —— 知会)的抬头。它们由系统加,不要在 `message` 里写这些标记。在你的最终报告里,标记由你写:仍在等父侧裁决的条目标 `[上抛·待裁]`,知会类标 `[上抛·知会]`。
8
+ - 非阻塞:它立即返回。继续做不受影响的部分,受影响的那部分留着挂起;不 fetch,不轮询。先做完,就意味着把没得到回答的那部分报成未完成。
9
+ - 同步派生:同步阻塞子代理(`async: false` 或嵌套 spawn)期间父侧无法在途回复,不挂载本工具;待裁/知会项直接以 `[上抛·待裁]` / `[上抛·知会]` 写入最终报告同步返给父侧。
10
+ - 不在范围内:命名 / 实现 / 措辞细节,一次读或一条命令就能回答的事,任务书已经写明的取舍 —— 那些走「停下并报告」的纪律,不走这条通道。求安心的请求也不属于这里。
11
+ - 可用性:仅异步子代理(深度 > 0 且非同步阻塞)。同步子代理不挂载本工具;在深度 0 你用正常回复或 `question` 工具跟用户说话。
12
+ - 限制:`message` 至多 1,500 字符,父侧在飞队列至多 20 条消息 —— 超出任何一条都是显式错误,绝不静默丢弃。