thincoder 0.12.62 → 0.12.63

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 (228) hide show
  1. package/CHANGELOG.md +9 -0
  2. package/README.md +13 -12
  3. package/bin/thincoder.mjs +53 -27
  4. package/package.json +6 -5
  5. package/src/acp/bridge.mjs +35 -15
  6. package/src/acp/client-caps.mjs +86 -0
  7. package/src/acp/ext.mjs +86 -0
  8. package/src/acp/handlers-session.mjs +240 -0
  9. package/src/acp/handlers-slots.mjs +196 -0
  10. package/src/acp/login.mjs +48 -0
  11. package/src/acp/session.mjs +6 -4
  12. package/src/acp.mjs +67 -379
  13. package/src/cli/distill-command.mjs +3 -3
  14. package/src/cli/make-agent.mjs +59 -17
  15. package/src/cli/memory-command.mjs +3 -3
  16. package/src/cli/permission.mjs +4 -48
  17. package/src/cli/setup-wizard.mjs +1 -1
  18. package/src/completions.mjs +3 -1
  19. package/src/crash-reports.mjs +1 -1
  20. package/src/distill.mjs +4 -4
  21. package/src/heap-watch.mjs +1 -1
  22. package/src/prompt-injections.mjs +20 -0
  23. package/src/tui/agent-turn.mjs +40 -9
  24. package/src/tui/cmd-advisor.mjs +5 -5
  25. package/src/tui/cmd-config.mjs +8 -8
  26. package/src/tui/cmd-eng.mjs +25 -9
  27. package/src/tui/cmd-mcp.mjs +9 -8
  28. package/src/tui/cmd-model.mjs +1 -1
  29. package/src/tui/cmd-new.mjs +6 -5
  30. package/src/tui/cmd-reindex.mjs +1 -1
  31. package/src/tui/cmd-restore.mjs +2 -2
  32. package/src/tui/cmd-session.mjs +24 -1
  33. package/src/tui/cmd-skills.mjs +1 -1
  34. package/src/tui/cmd-think.mjs +22 -9
  35. package/src/tui/config-helpers.mjs +1 -1
  36. package/src/tui/display-budget.mjs +33 -11
  37. package/src/tui/index.mjs +9 -9
  38. package/src/tui/interaction.mjs +16 -7
  39. package/src/tui/key-modes.mjs +9 -4
  40. package/src/tui/ledger-surface.mjs +26 -10
  41. package/src/tui/model-catalog.mjs +4 -4
  42. package/src/tui/model-picker.mjs +8 -7
  43. package/src/tui/mouse.mjs +11 -6
  44. package/src/tui/pickers.mjs +15 -2
  45. package/src/tui/render-conversation.mjs +1 -1
  46. package/src/tui/render-frame.mjs +10 -5
  47. package/src/tui/render-loop.mjs +1 -1
  48. package/src/tui/render-segments.mjs +3 -1
  49. package/src/tui/slash-commands.mjs +1 -1
  50. package/src/tui/startup.mjs +14 -14
  51. package/src/tui/subagent-blocks.mjs +20 -3
  52. package/src/tui/subagent-freeze.mjs +73 -2
  53. package/src/tui/suspension-drive.mjs +46 -22
  54. package/src/tui/tool-events.mjs +11 -8
  55. package/src/tui/wizard.mjs +3 -3
  56. package/src/abort-provenance.mjs +0 -116
  57. package/src/advisor/citations.mjs +0 -139
  58. package/src/advisor/compaction.mjs +0 -174
  59. package/src/advisor/convergence.mjs +0 -80
  60. package/src/advisor/history.mjs +0 -77
  61. package/src/advisor/loop.mjs +0 -293
  62. package/src/advisor/messages.mjs +0 -299
  63. package/src/advisor/project-context.mjs +0 -194
  64. package/src/advisor/repos.mjs +0 -150
  65. package/src/advisor/run.mjs +0 -293
  66. package/src/advisor/truncate.mjs +0 -57
  67. package/src/advisor.mjs +0 -290
  68. package/src/agent/completion.mjs +0 -146
  69. package/src/agent/dispatch.mjs +0 -489
  70. package/src/agent/helpers.mjs +0 -384
  71. package/src/agent/post-turn.mjs +0 -70
  72. package/src/agent/record-results.mjs +0 -174
  73. package/src/agent/relay-prefix.mjs +0 -39
  74. package/src/agent/run-stages.mjs +0 -244
  75. package/src/agent/setup-reminders.mjs +0 -69
  76. package/src/agent/setup.mjs +0 -354
  77. package/src/agent/spawn-child.mjs +0 -243
  78. package/src/agent-tools/advisor-async.mjs +0 -346
  79. package/src/agent-tools/advisor-settle.mjs +0 -231
  80. package/src/agent-tools/advisor.mjs +0 -260
  81. package/src/agent-tools/async-settle.mjs +0 -204
  82. package/src/agent-tools/batch-segment.mjs +0 -195
  83. package/src/agent-tools/consult.mjs +0 -473
  84. package/src/agent-tools/design-token.mjs +0 -117
  85. package/src/agent-tools/digest-budget.mjs +0 -76
  86. package/src/agent-tools/eng.mjs +0 -67
  87. package/src/agent-tools/escalate-async.mjs +0 -295
  88. package/src/agent-tools/goal.mjs +0 -119
  89. package/src/agent-tools/plan.mjs +0 -81
  90. package/src/agent-tools/read-history.mjs +0 -309
  91. package/src/agent-tools/recent-changes.mjs +0 -24
  92. package/src/agent-tools/review-streak.mjs +0 -93
  93. package/src/agent-tools/settings.mjs +0 -265
  94. package/src/agent-tools/skill.mjs +0 -47
  95. package/src/agent-tools/subagent-actions.mjs +0 -482
  96. package/src/agent-tools/subagent-async.mjs +0 -434
  97. package/src/agent-tools/subagent-panel.mjs +0 -160
  98. package/src/agent-tools/subagent-run.mjs +0 -205
  99. package/src/agent-tools/subagent-scheduler.mjs +0 -392
  100. package/src/agent-tools/subagent-spawn.mjs +0 -459
  101. package/src/agent-tools/subagent.mjs +0 -404
  102. package/src/agent-tools/task.mjs +0 -87
  103. package/src/agent-tools/timer.mjs +0 -46
  104. package/src/agent-tools/verify.mjs +0 -271
  105. package/src/agent-tools.mjs +0 -17
  106. package/src/agent.mjs +0 -417
  107. package/src/auto-think.mjs +0 -115
  108. package/src/config-migrate.mjs +0 -70
  109. package/src/config.mjs +0 -496
  110. package/src/context.mjs +0 -392
  111. package/src/conventions.mjs +0 -223
  112. package/src/embedding.mjs +0 -120
  113. package/src/escape.mjs +0 -152
  114. package/src/expand-home.mjs +0 -16
  115. package/src/explore-distill.mjs +0 -155
  116. package/src/generate-title.mjs +0 -88
  117. package/src/git/checkpoint.mjs +0 -448
  118. package/src/git/gitmem.mjs +0 -100
  119. package/src/hooks.mjs +0 -97
  120. package/src/ledger.mjs +0 -227
  121. package/src/log.mjs +0 -195
  122. package/src/markdown.mjs +0 -106
  123. package/src/mcp/helpers.mjs +0 -51
  124. package/src/mcp/transport-http.mjs +0 -248
  125. package/src/mcp/transport-stdio.mjs +0 -140
  126. package/src/mcp/transport-ws.mjs +0 -122
  127. package/src/mcp.mjs +0 -295
  128. package/src/memory/code-index.mjs +0 -219
  129. package/src/memory/code-sync.mjs +0 -415
  130. package/src/memory/core.mjs +0 -299
  131. package/src/memory/delete.mjs +0 -236
  132. package/src/memory/docs.mjs +0 -419
  133. package/src/memory/file-walk.mjs +0 -109
  134. package/src/memory/scan.mjs +0 -95
  135. package/src/memory/schema.mjs +0 -452
  136. package/src/memory.mjs +0 -21
  137. package/src/model-ref.mjs +0 -66
  138. package/src/model-specs.mjs +0 -179
  139. package/src/peer-domains.mjs +0 -265
  140. package/src/peer-instances.mjs +0 -231
  141. package/src/prompt-overlays.mjs +0 -82
  142. package/src/prompts/advisor-design.md +0 -41
  143. package/src/prompts/advisor-round1.md +0 -41
  144. package/src/prompts/advisor-round2.md +0 -46
  145. package/src/prompts/advisor-round3.md +0 -42
  146. package/src/prompts/common.md +0 -115
  147. package/src/prompts/consult-base.md +0 -19
  148. package/src/prompts/discipline-engineering.md +0 -258
  149. package/src/prompts/discipline-normal.md +0 -185
  150. package/src/prompts/persona-coder.md +0 -21
  151. package/src/prompts/persona-eng-coder.md +0 -37
  152. package/src/prompts/persona-eng-designer.md +0 -60
  153. package/src/prompts/persona-engineering.md +0 -55
  154. package/src/prompts/persona-explore.md +0 -15
  155. package/src/prompts/persona-normal.md +0 -27
  156. package/src/prompts/persona-plan.md +0 -26
  157. package/src/provider/anthropic.mjs +0 -225
  158. package/src/provider/core.mjs +0 -476
  159. package/src/provider/errors.mjs +0 -101
  160. package/src/provider/google.mjs +0 -257
  161. package/src/provider/index.mjs +0 -7
  162. package/src/provider/list-models.mjs +0 -93
  163. package/src/provider/normalize.mjs +0 -81
  164. package/src/provider/rate.mjs +0 -108
  165. package/src/provider/responses.mjs +0 -495
  166. package/src/provider/retry.mjs +0 -88
  167. package/src/provider/sse.mjs +0 -264
  168. package/src/proxy.mjs +0 -261
  169. package/src/rules.mjs +0 -53
  170. package/src/session-gc.mjs +0 -221
  171. package/src/session-guard.mjs +0 -59
  172. package/src/session-migrate.mjs +0 -48
  173. package/src/session-rename.mjs +0 -38
  174. package/src/session-segments.mjs +0 -100
  175. package/src/session-slots.mjs +0 -492
  176. package/src/session-store.mjs +0 -441
  177. package/src/session.mjs +0 -492
  178. package/src/skills.mjs +0 -153
  179. package/src/text-budget.mjs +0 -46
  180. package/src/token-ttl.mjs +0 -274
  181. package/src/tools/apply_patch.md +0 -15
  182. package/src/tools/bash.md +0 -37
  183. package/src/tools/bash.mjs +0 -268
  184. package/src/tools/checklist-sync.mjs +0 -181
  185. package/src/tools/checklist.md +0 -13
  186. package/src/tools/checklist.mjs +0 -299
  187. package/src/tools/delete.md +0 -13
  188. package/src/tools/edit-batch.mjs +0 -191
  189. package/src/tools/edit-diff.mjs +0 -348
  190. package/src/tools/edit.md +0 -30
  191. package/src/tools/execute.md +0 -21
  192. package/src/tools/execute.mjs +0 -228
  193. package/src/tools/fetch.md +0 -12
  194. package/src/tools/file.mjs +0 -469
  195. package/src/tools/file_ops.md +0 -17
  196. package/src/tools/get_current_time.md +0 -8
  197. package/src/tools/git-checkpoint.mjs +0 -143
  198. package/src/tools/git-ext.mjs +0 -173
  199. package/src/tools/git.md +0 -54
  200. package/src/tools/git.mjs +0 -356
  201. package/src/tools/glob-dialect.mjs +0 -130
  202. package/src/tools/glob.md +0 -11
  203. package/src/tools/grep.md +0 -19
  204. package/src/tools/hashline_edit.md +0 -14
  205. package/src/tools/index.mjs +0 -36
  206. package/src/tools/insert_after.md +0 -15
  207. package/src/tools/lint.md +0 -10
  208. package/src/tools/linter.mjs +0 -128
  209. package/src/tools/ls.md +0 -12
  210. package/src/tools/lsp.md +0 -10
  211. package/src/tools/lsp.mjs +0 -316
  212. package/src/tools/ops.mjs +0 -299
  213. package/src/tools/patch.mjs +0 -282
  214. package/src/tools/process.md +0 -10
  215. package/src/tools/question.md +0 -16
  216. package/src/tools/question.mjs +0 -26
  217. package/src/tools/read.md +0 -20
  218. package/src/tools/read_image.md +0 -8
  219. package/src/tools/repomap.mjs +0 -314
  220. package/src/tools/search.mjs +0 -236
  221. package/src/tools/shared.mjs +0 -446
  222. package/src/tools/tree.md +0 -14
  223. package/src/tools/tree.mjs +0 -66
  224. package/src/tools/wait_for.md +0 -22
  225. package/src/tools/web.mjs +0 -224
  226. package/src/tools/websearch.md +0 -16
  227. package/src/tools/write.md +0 -11
  228. package/src/traces/trace-store.mjs +0 -355
@@ -1,271 +0,0 @@
1
- /**
2
- * verify.mjs — verify tool: generic pre-completion verification gate (VERIFY-REDESIGN.md).
3
- * Verify is language/framework/project agnostic: it does NOT hardcode any project's
4
- * module→test mapping, does NOT auto-run any test/verification command, and does NOT
5
- * require a test for every change. The model DECLARES its verification status via the
6
- * `verification` argument (whether it already ran the project's verification and the
7
- * result); verify makes a mechanical gate decision on that declaration. Which
8
- * verification to run is described in natural language in each project's AGENTS.md —
9
- * verify never parses or executes it. Retained mechanical checks: doc-only fast path,
10
- * an advisory (non-gating) node --check hint, git diff report, and — on the code
11
- * path (doc-only changes return early) — the task list and self-review checklist.
12
- */
13
-
14
- import { isCodePath, isDocPath, loadConventions } from "../conventions.mjs"
15
- import { execSync, spawnSync } from "node:child_process"
16
- import { existsSync } from "node:fs"
17
- import { resolve } from "node:path"
18
-
19
- /**
20
- * §18.12 D-VR1 path normalization — mirrors the §20.5 file-domain handling:
21
- * resolved to an absolute path with forward slashes; dedup uses the win32
22
- * lowercase comparison key (changedFileKey) so "D:/x/src/a.mjs" and
23
- * "d:\\x\SRC\a.mjs" count as the same file.
24
- */
25
- function normalizeChangedPath(p, base) {
26
- return resolve(base, p).replace(/\\/g, "/")
27
- }
28
-
29
- /** Win32 comparison key: case-insensitive drives/folders (same file). */
30
- function changedFileKey(p) {
31
- return process.platform === "win32" ? p.toLowerCase() : p
32
- }
33
-
34
- /**
35
- * D-V3 block guidance — a block message must not just say "not verified": it lists
36
- * the changed code files and points to the project's AGENTS.md natural-language
37
- * description of how to verify, so the model knows what to run/add.
38
- */
39
- function appendBlockGuidance(lines, codeFiles) {
40
- lines.push("")
41
- lines.push("Changed code file(s):")
42
- for (const f of codeFiles) lines.push(` ${f}`)
43
- lines.push("")
44
- lines.push("verify does not run commands for you — decide and run the project's verification yourself.")
45
- lines.push("Reference the verification approach declared in the project's AGENTS.md (natural language, e.g. \"tests run with npm test\" / \"no automated tests — rely on manual review\") to decide what to run, then call verify again declaring the outcome via verification.status.")
46
- }
47
-
48
- /**
49
- * verify tool: generic pre-completion verification gate. Flow:
50
- * 0. Doc-only fast path — all changed files are docs: short report, no verification needed.
51
- * 1. git diff --stat — changed file list (_touchedFiles ∪ git diff)
52
- * 2. Advisory syntax hint (D-V5) — node --check changed .js/.mjs when node exists; SOFT, not gating.
53
- * 3. Verification gate (D-V1/D-V2) — requires the model to DECLARE verification.status:
54
- * passed → allowed; failed → blocked; skipped → allowed but needs a summary reason.
55
- * 4. Task list + self-review checklist.
56
- * Agent must not say "done" before verify passes.
57
- */
58
- export const verifyTool = {
59
- name: "verify",
60
- description:
61
- "Generic pre-completion verification gate — language/framework/project agnostic. verify does NOT run any test/verification command for you and does NOT require a test per change. You DECLARE your verification status via the verification argument: { status: 'passed' | 'failed' | 'skipped', command?, summary? }. 'passed' → allowed; 'failed' → blocked (cannot claim done); 'skipped' → allowed but requires a summary reason. Whether/how to verify is described in natural language in the project's AGENTS.md and is decided + executed by you — verify only mechanically gates on your declaration. Also reports changed files (git diff), an advisory node --check hint on changed .js/.mjs (not gating), the task list, and a self-review checklist. Call this BEFORE declaring a coding task complete — do not say 'done' until verify passes.",
62
- parameters: {
63
- type: "object",
64
- properties: {
65
- verification: {
66
- type: "object",
67
- description: "The model's declaration of whether it already ran the project's verification and its outcome. verify does not execute the command — it is self-reported evidence.",
68
- properties: {
69
- status: { type: "string", enum: ["passed", "failed", "skipped"], description: "The verification outcome you declare: 'passed' → allowed; 'failed' → blocked; 'skipped' → allowed but requires a summary reason." },
70
- command: { type: "string", description: "Optional: the verification command you ran (self-reported — verify does not execute it)." },
71
- summary: { type: "string", description: "Optional: summary/result of the verification. Required when status='skipped' — a concrete reason (e.g. \"project has no automated tests — verified by manual review\")." },
72
- },
73
- required: ["status"],
74
- },
75
- workdir: { type: "string", description: "Optional: run verify in this subdirectory (relative to cwd or absolute) — for monorepos" },
76
- },
77
- },
78
- readonly: true,
79
- async execute(args, ctx) {
80
- const cwd = ctx.agent.cwd
81
- // Changed-file resolution (§18.12 D-VR3): _touchedFiles (per-run bookkeeping,
82
- // absolute paths) ∪ git diff fallback — git is tried at testCwd
83
- // (workdir-resolved) first, then at ctx.agent.cwd; first success wins.
84
- // git-diff paths are repo-root-relative — resolved against the discovered
85
- // git root, then normalized (absolute, forward slashes, win32 key).
86
- const testCwd = args.workdir ? resolve(cwd, args.workdir) : cwd
87
- const lines = []
88
- lines.push("=== VERIFICATION REPORT ===")
89
- lines.push("")
90
-
91
- // 1. Changed files — _touchedFiles ∪ git diff (§18.12 D-VR1)
92
- let gitOk = false
93
- let gitStat = ""
94
- let gitFiles = []
95
- for (const gitCwd of new Set([testCwd, cwd])) {
96
- try {
97
- // Anchor the repo root FIRST (also proves git works here) — diff paths
98
- // are repo-root-relative, so both diff calls run at the root.
99
- const gitRoot = execSync("git rev-parse --show-toplevel", { cwd: gitCwd, encoding: "utf8", stdio: ["ignore", "pipe", "ignore"], timeout: 5000 }).trim() || gitCwd
100
- const diff = execSync("git diff --stat", { cwd: gitRoot, encoding: "utf8", stdio: ["ignore", "pipe", "ignore"], timeout: 5000 })
101
- const nameOnly = execSync("git diff --name-only", { cwd: gitRoot, encoding: "utf8", stdio: ["ignore", "pipe", "ignore"], timeout: 5000 })
102
- gitOk = true
103
- gitStat = diff.trim()
104
- gitFiles = nameOnly.trim().split("\n").filter(Boolean).map((p) => normalizeChangedPath(p, gitRoot))
105
- break
106
- } catch { /* git unavailable here — try the next cwd in the chain */ }
107
- }
108
- if (gitOk && gitStat) {
109
- lines.push("Changed files (git diff --stat):")
110
- lines.push(gitStat)
111
- } else if (gitOk) {
112
- lines.push("Changed files: (none — no uncommitted changes)")
113
- } else {
114
- lines.push("Changed files: (not a git repo or git unavailable)")
115
- }
116
- // _touchedFiles: files written by the tools this run — captured regardless
117
- // of git state (§18.12 F-VR1: subagent cwd ≠ git root must still locate).
118
- const touchedFiles = (ctx.agent._touchedFiles ?? []).map((p) => normalizeChangedPath(p, cwd))
119
- const gitKeys = new Set(gitFiles.map(changedFileKey))
120
- const touchedOnly = touchedFiles.filter((p) => !gitKeys.has(changedFileKey(p)))
121
- if (touchedOnly.length > 0) {
122
- lines.push("")
123
- lines.push("Changed files (this run — _touchedFiles):")
124
- for (const f of touchedOnly) lines.push(` ${f}`)
125
- }
126
- // Union, deduped by comparison key (win32 case-insensitive).
127
- const changedKeys = new Set()
128
- const changedFiles = [...touchedFiles, ...gitFiles].filter((p) => {
129
- const k = changedFileKey(p)
130
- if (changedKeys.has(k)) return false
131
- changedKeys.add(k)
132
- return true
133
- })
134
-
135
- // D-V11 G10 (doc-only/empty change set must not swallow an explicit failed):
136
- // an explicit verification.status='failed' is ALWAYS respected — never
137
- // overridden to pass by the doc-only fast path or the no-code-changed path
138
- // below (D-V5 exception, review #6). Aligns CLI with VS Code (T-V8). Lists
139
- // the changed files + points at AGENTS.md (D-V3 guidance).
140
- if (args.verification?.status === "failed") {
141
- lines.push("")
142
- lines.push("VERIFY BLOCKED: you declared verification failed (verification.status = 'failed').")
143
- lines.push("Do not say 'done' while verification fails — fix the issue, re-run the project's verification, then call verify again declaring the outcome.")
144
- lines.push("")
145
- lines.push("Changed file(s):")
146
- for (const f of changedFiles) lines.push(` ${f}`)
147
- lines.push("")
148
- lines.push("verify does not run commands for you — decide and run the project's verification yourself.")
149
- lines.push("Reference the verification approach declared in the project's AGENTS.md (natural language, e.g. \"tests run with npm test\" / \"no automated tests — rely on manual review\") to decide what to run, then call verify again declaring the outcome via verification.status.")
150
- ctx.agent._verifyPassed = false
151
- return lines.join("\n")
152
- }
153
-
154
- // 1b. Doc-only fast path: every changed file is documentation (docs/, *.md,
155
- // LICENSE…) — syntax checks and a verification declaration are meaningless
156
- // for doc changes, and the task list/self-review checklist add nothing either.
157
- // Paths inside a declared code segment (default: src — incl. prompts/*.md) are
158
- // product code — excluded from the fast path, consistent with the design gate.
159
- // The project's own layout is declarable (.thincoder/conventions.json).
160
- // Empty list (no changes / git unavailable)
161
- // intentionally falls through to the normal path below.
162
- const conv = loadConventions(cwd)
163
- if (changedFiles.length > 0 && changedFiles.every((f) => isDocPath(f, conv))) {
164
- lines.push("")
165
- lines.push("Documentation-only changes — skipping syntax checks and tests.")
166
- ctx.agent._verifyPassed = true
167
- return lines.join("\n")
168
- }
169
-
170
- // Code files needing verification: anything the shared classifier calls product
171
- // code (D-V1 — these require a verification declaration). Temp scratch files are
172
- // neither code nor docs and fall out of this list (a throwaway diagnostic script
173
- // is not a code change — no declaration is demanded for it).
174
- const codeFiles = changedFiles.filter((f) => isCodePath(f, conv))
175
-
176
- // 2. Advisory syntax hint (D-V5) — node --check on changed .js/.mjs when node
177
- // exists. SOFT hint only — it does NOT gate done (no language-specific
178
- // enforcement; a non-JS project or a missing node simply skips silently).
179
- const jsFiles = codeFiles.filter((f) => /\.(m?js)$/i.test(f) && existsSync(f))
180
- if (jsFiles.length > 0) {
181
- lines.push("")
182
- lines.push("Advisory syntax hint (node --check — does not gate):")
183
- for (const f of jsFiles) {
184
- try {
185
- const result = spawnSync("node", ["--check", f], { encoding: "utf8", stdio: ["ignore", "pipe", "pipe"], timeout: 10000 })
186
- if (result.status !== 0) throw result
187
- lines.push(` ✓ ${f}`)
188
- } catch (e) {
189
- const errOutput = (e.stderr || e.stdout || e.message || "").toString()
190
- const errMsg = errOutput.split("\n").slice(0, 3).join("\n")
191
- lines.push(` ⚠ ${f} — node --check flagged it`)
192
- lines.push(` ${errMsg.replace(/\n/g, "\n ")}`)
193
- }
194
- }
195
- }
196
-
197
- // 3. Verification gate (D-V1/D-V2): the model declares its verification status.
198
- if (codeFiles.length === 0) {
199
- // No code changed (empty change set / only temp/non-code files) — nothing to verify.
200
- lines.push("")
201
- lines.push("No code files changed — nothing to verify.")
202
- ctx.agent._verifyPassed = true
203
- } else {
204
- const v = args.verification ?? {}
205
- const status = v?.status
206
- if (!status) {
207
- lines.push("")
208
- lines.push("VERIFY BLOCKED: no verification status was declared.")
209
- lines.push("These code changes must be verified before you say 'done' — declare whether you ran the project's verification and its result.")
210
- appendBlockGuidance(lines, codeFiles)
211
- ctx.agent._verifyPassed = false
212
- } else if (status === "passed") {
213
- lines.push("")
214
- lines.push("Verification declared passed.")
215
- if (v.command) lines.push(` command: ${v.command}`)
216
- if (v.summary) lines.push(` summary: ${v.summary}`)
217
- ctx.agent._verifyPassed = true
218
- } else if (status === "skipped") {
219
- const reason = (v.summary ?? "").trim()
220
- if (reason) {
221
- lines.push("")
222
- lines.push(`Verification skipped with reason: ${reason}`)
223
- ctx.agent._verifyPassed = true
224
- } else {
225
- lines.push("")
226
- lines.push("VERIFY BLOCKED: verification skipped with no summary reason — an empty skip is not allowed.")
227
- lines.push("Give a concrete reason in verification.summary (e.g. \"project has no automated tests — verified by manual review\"), or run the project's verification and declare its result.")
228
- appendBlockGuidance(lines, codeFiles)
229
- ctx.agent._verifyPassed = false
230
- }
231
- } else {
232
- // Unknown status value — defensive (schema enum normally rejects it first).
233
- lines.push("")
234
- lines.push(`VERIFY BLOCKED: unknown verification.status ${JSON.stringify(status)} — use 'passed' | 'failed' | 'skipped'.`)
235
- appendBlockGuidance(lines, codeFiles)
236
- ctx.agent._verifyPassed = false
237
- }
238
- }
239
-
240
- // 4. Task list
241
- lines.push("")
242
- if (ctx.agent.tasks.length === 0) {
243
- lines.push("Task list: (no tasks tracked)")
244
- } else {
245
- const done = ctx.agent.tasks.filter((t) => t.status === "done").length
246
- const total = ctx.agent.tasks.length
247
- const open = ctx.agent.tasks.filter((t) => t.status !== "done")
248
- lines.push(`Task list: ${done}/${total} done`)
249
- for (const t of ctx.agent.tasks) {
250
- const mark = t.status === "done" ? "✓" : t.status === "in_progress" ? "▶" : "○"
251
- lines.push(` ${mark} [${t.status}] ${t.title}`)
252
- }
253
- if (open.length > 0) {
254
- lines.push("")
255
- lines.push(`WARNING: ${open.length} task(s) still open. Complete them or explain why they can be left undone.`)
256
- }
257
- }
258
-
259
- // 5. Checklist
260
- lines.push("")
261
- lines.push("Self-review checklist:")
262
- lines.push("- [ ] Did I run the project's verification (per its AGENTS.md) and does it pass, or did I declare a concrete skip reason?")
263
- lines.push("- [ ] Did I read every file I changed to catch leftover debug code or stale comments?")
264
- lines.push("- [ ] Do comments and docstrings match what the code actually does?")
265
- lines.push("- [ ] Did I remove placeholder code, TODO stubs, or commented-out experiment blocks?")
266
- lines.push("- [ ] If I used a subagent, did I verify its report against the actual files it touched?")
267
- lines.push("- [ ] Are all task items genuinely done (not just marked done to finish early)?")
268
-
269
- return lines.join("\n")
270
- },
271
- }
@@ -1,17 +0,0 @@
1
- /**
2
- * agent-tools.mjs — self-discipline tool index
3
- * Loaded from agent.mjs via dynamic import to avoid ESM circular dependencies.
4
- * Each tool implementation lives in the agent-tools/ subdirectory.
5
- */
6
- export { planTool } from "./agent-tools/plan.mjs"
7
- export { subagentTool } from "./agent-tools/subagent.mjs"
8
- export { taskTool } from "./agent-tools/task.mjs"
9
- export { skillTool } from "./agent-tools/skill.mjs"
10
- export { goalTool } from "./agent-tools/goal.mjs"
11
- export { verifyTool } from "./agent-tools/verify.mjs"
12
- export { recentChangesTool } from "./agent-tools/recent-changes.mjs"
13
- export { timerTool } from "./agent-tools/timer.mjs"
14
- export { advisorTool } from "./agent-tools/advisor.mjs"
15
- export { engTool } from "./agent-tools/eng.mjs"
16
- export { readHistoryTool } from "./agent-tools/read-history.mjs"
17
- export { batchSegmentTool } from "./agent-tools/batch-segment.mjs"