@prestyj/cli 5.11.0 → 5.13.0

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 (466) hide show
  1. package/README.md +46 -36
  2. package/assets/skills/bulletproof/SKILL.md +158 -0
  3. package/assets/skills/bulletproof/references/agent-surface.md +82 -0
  4. package/assets/skills/bulletproof/references/audit-protocol.md +147 -0
  5. package/assets/skills/bulletproof/references/platform-playbooks.md +176 -0
  6. package/assets/skills/bulletproof/references/provenance.md +45 -0
  7. package/assets/skills/bulletproof/references/secure-defaults.md +108 -0
  8. package/assets/skills/bulletproof/references/supply-chain.md +76 -0
  9. package/assets/skills/bulletproof/references/threat-landscape.md +74 -0
  10. package/assets/skills/bulletproof/references/verification.md +65 -0
  11. package/assets/skills/compliance-guard/SKILL.md +251 -0
  12. package/assets/skills/compliance-guard/references/artifacts.md +186 -0
  13. package/assets/skills/compliance-guard/references/eu-uk.md +151 -0
  14. package/assets/skills/compliance-guard/references/exposure-triage.md +161 -0
  15. package/assets/skills/compliance-guard/references/lawsuit-vectors.md +141 -0
  16. package/assets/skills/compliance-guard/references/provenance.md +42 -0
  17. package/assets/skills/compliance-guard/references/sector-gates.md +173 -0
  18. package/assets/skills/compliance-guard/references/security-baseline.md +130 -0
  19. package/assets/skills/compliance-guard/references/trigger-map.md +163 -0
  20. package/assets/skills/compliance-guard/references/us.md +164 -0
  21. package/assets/skills/durable/SKILL.md +111 -0
  22. package/assets/skills/durable/references/backups-and-runtime.md +86 -0
  23. package/assets/skills/durable/references/migrations-and-schema.md +79 -0
  24. package/assets/skills/lean/SKILL.md +110 -0
  25. package/assets/skills/lean/references/memory-and-processes.md +98 -0
  26. package/assets/skills/lean/references/playbooks.md +107 -0
  27. package/dist/app-sidecar-auth-broadcast.test.js +111 -10
  28. package/dist/app-sidecar-auth-broadcast.test.js.map +1 -1
  29. package/dist/app-sidecar-sessions.test.js +1 -1
  30. package/dist/app-sidecar.js +210 -72
  31. package/dist/app-sidecar.js.map +1 -1
  32. package/dist/chat-agents/jiwa.test.js +1 -1
  33. package/dist/cli/auth.d.ts.map +1 -1
  34. package/dist/cli/auth.js +33 -36
  35. package/dist/cli/auth.js.map +1 -1
  36. package/dist/cli/mcp.js +30 -10
  37. package/dist/cli/mcp.js.map +1 -1
  38. package/dist/cli.d.ts.map +1 -1
  39. package/dist/cli.js +18 -5
  40. package/dist/cli.js.map +1 -1
  41. package/dist/config.d.ts +28 -5
  42. package/dist/config.d.ts.map +1 -1
  43. package/dist/config.js +50 -76
  44. package/dist/config.js.map +1 -1
  45. package/dist/config.test.js +56 -13
  46. package/dist/config.test.js.map +1 -1
  47. package/dist/core/agent-session-checkpoint-flush.test.js +2 -2
  48. package/dist/core/agent-session-compaction.test.js +60 -0
  49. package/dist/core/agent-session-compaction.test.js.map +1 -1
  50. package/dist/core/agent-session-crash-durability.test.js +3 -3
  51. package/dist/core/agent-session-model-switch.test.js +1 -1
  52. package/dist/core/agent-session-process-gate.test.js +7 -1
  53. package/dist/core/agent-session-process-gate.test.js.map +1 -1
  54. package/dist/core/agent-session-review-coverage.test.js +52 -1
  55. package/dist/core/agent-session-review-coverage.test.js.map +1 -1
  56. package/dist/core/agent-session-tool-tiers.test.d.ts +2 -0
  57. package/dist/core/agent-session-tool-tiers.test.d.ts.map +1 -0
  58. package/dist/core/agent-session-tool-tiers.test.js +138 -0
  59. package/dist/core/agent-session-tool-tiers.test.js.map +1 -0
  60. package/dist/core/agent-session-verification-gate.test.d.ts +2 -0
  61. package/dist/core/agent-session-verification-gate.test.d.ts.map +1 -0
  62. package/dist/core/agent-session-verification-gate.test.js +135 -0
  63. package/dist/core/agent-session-verification-gate.test.js.map +1 -0
  64. package/dist/core/agent-session.d.ts +77 -3
  65. package/dist/core/agent-session.d.ts.map +1 -1
  66. package/dist/core/agent-session.js +268 -33
  67. package/dist/core/agent-session.js.map +1 -1
  68. package/dist/core/agents.d.ts +29 -1
  69. package/dist/core/agents.d.ts.map +1 -1
  70. package/dist/core/agents.js +47 -97
  71. package/dist/core/agents.js.map +1 -1
  72. package/dist/core/agents.test.js +87 -7
  73. package/dist/core/agents.test.js.map +1 -1
  74. package/dist/core/api-benchmark.d.ts +3 -3
  75. package/dist/core/api-benchmark.js +7 -7
  76. package/dist/core/auth-providers.d.ts +37 -1
  77. package/dist/core/auth-providers.d.ts.map +1 -1
  78. package/dist/core/auth-providers.js +84 -4
  79. package/dist/core/auth-providers.js.map +1 -1
  80. package/dist/core/auto-update.test.js +1 -1
  81. package/dist/core/autopilot-gate.d.ts +2 -2
  82. package/dist/core/autopilot-gate.js +1 -1
  83. package/dist/core/autopilot-gate.test.js +7 -4
  84. package/dist/core/autopilot-gate.test.js.map +1 -1
  85. package/dist/core/bash-spawn-benchmark.js +6 -6
  86. package/dist/core/bundled-agents.d.ts +3 -0
  87. package/dist/core/bundled-agents.d.ts.map +1 -0
  88. package/dist/core/bundled-agents.js +255 -0
  89. package/dist/core/bundled-agents.js.map +1 -0
  90. package/dist/core/cache-warm-benchmark.d.ts +2 -2
  91. package/dist/core/cache-warm-benchmark.js +5 -5
  92. package/dist/core/code-retrieval-chunkers.d.ts +27 -0
  93. package/dist/core/code-retrieval-chunkers.d.ts.map +1 -0
  94. package/dist/core/code-retrieval-chunkers.js +264 -0
  95. package/dist/core/code-retrieval-chunkers.js.map +1 -0
  96. package/dist/core/code-retrieval-chunkers.test.d.ts +2 -0
  97. package/dist/core/code-retrieval-chunkers.test.d.ts.map +1 -0
  98. package/dist/core/code-retrieval-chunkers.test.js +203 -0
  99. package/dist/core/code-retrieval-chunkers.test.js.map +1 -0
  100. package/dist/core/code-retrieval.d.ts +6 -0
  101. package/dist/core/code-retrieval.d.ts.map +1 -1
  102. package/dist/core/code-retrieval.js +38 -1
  103. package/dist/core/code-retrieval.js.map +1 -1
  104. package/dist/core/compaction/token-estimator.test.js +1 -1
  105. package/dist/core/encode-cwd.test.js +1 -1
  106. package/dist/core/event-bus.d.ts +11 -1
  107. package/dist/core/event-bus.d.ts.map +1 -1
  108. package/dist/core/event-bus.js +1 -0
  109. package/dist/core/event-bus.js.map +1 -1
  110. package/dist/core/event-bus.test.d.ts +2 -0
  111. package/dist/core/event-bus.test.d.ts.map +1 -0
  112. package/dist/core/event-bus.test.js +33 -0
  113. package/dist/core/event-bus.test.js.map +1 -0
  114. package/dist/core/extensions/plugin-bundles.js +2 -2
  115. package/dist/core/extensions/plugin-bundles.js.map +1 -1
  116. package/dist/core/extensions/plugin-bundles.test.js +2 -2
  117. package/dist/core/extensions/plugin-bundles.test.js.map +1 -1
  118. package/dist/core/fast-apply-benchmark.d.ts +2 -2
  119. package/dist/core/fast-apply-benchmark.js +6 -6
  120. package/dist/core/foreign-session-import.test.js +1 -1
  121. package/dist/core/goal-lifecycle-smoke.test.js +2 -2
  122. package/dist/core/goal-store.js +1 -1
  123. package/dist/core/goal-store.test.js +2 -2
  124. package/dist/core/goal-verifier.test.js +2 -2
  125. package/dist/core/goal-worker-dev-server-lifecycle.test.js +1 -1
  126. package/dist/core/goal-worker.test.js +2 -2
  127. package/dist/core/hashline-edit-benchmark.d.ts +2 -2
  128. package/dist/core/hashline-edit-benchmark.js +7 -7
  129. package/dist/core/local-endpoint-store.test.js +1 -1
  130. package/dist/core/logger.d.ts +1 -1
  131. package/dist/core/logger.js +2 -2
  132. package/dist/core/logger.js.map +1 -1
  133. package/dist/core/lsp/client-navigation.test.d.ts +2 -0
  134. package/dist/core/lsp/client-navigation.test.d.ts.map +1 -0
  135. package/dist/core/lsp/client-navigation.test.js +135 -0
  136. package/dist/core/lsp/client-navigation.test.js.map +1 -0
  137. package/dist/core/lsp/client.d.ts +69 -0
  138. package/dist/core/lsp/client.d.ts.map +1 -1
  139. package/dist/core/lsp/client.js +151 -2
  140. package/dist/core/lsp/client.js.map +1 -1
  141. package/dist/core/lsp/integration.test.js +2 -2
  142. package/dist/core/lsp/manager-navigation.test.d.ts +2 -0
  143. package/dist/core/lsp/manager-navigation.test.d.ts.map +1 -0
  144. package/dist/core/lsp/manager-navigation.test.js +121 -0
  145. package/dist/core/lsp/manager-navigation.test.js.map +1 -0
  146. package/dist/core/lsp/manager.d.ts +35 -1
  147. package/dist/core/lsp/manager.d.ts.map +1 -1
  148. package/dist/core/lsp/manager.js +92 -0
  149. package/dist/core/lsp/manager.js.map +1 -1
  150. package/dist/core/lsp/servers.test.js +1 -1
  151. package/dist/core/lsp/windows.test.js +4 -4
  152. package/dist/core/mcp/catalog-cache.test.js +1 -1
  153. package/dist/core/mcp/client-session-recovery.test.js +1 -1
  154. package/dist/core/mcp/client.d.ts.map +1 -1
  155. package/dist/core/mcp/client.js +2 -10
  156. package/dist/core/mcp/client.js.map +1 -1
  157. package/dist/core/mcp/content.d.ts +19 -0
  158. package/dist/core/mcp/content.d.ts.map +1 -0
  159. package/dist/core/mcp/content.js +172 -0
  160. package/dist/core/mcp/content.js.map +1 -0
  161. package/dist/core/mcp/content.test.d.ts +2 -0
  162. package/dist/core/mcp/content.test.d.ts.map +1 -0
  163. package/dist/core/mcp/content.test.js +135 -0
  164. package/dist/core/mcp/content.test.js.map +1 -0
  165. package/dist/core/mcp/defaults.d.ts +3 -1
  166. package/dist/core/mcp/defaults.d.ts.map +1 -1
  167. package/dist/core/mcp/defaults.js +9 -2
  168. package/dist/core/mcp/defaults.js.map +1 -1
  169. package/dist/core/mcp/defaults.test.d.ts +2 -0
  170. package/dist/core/mcp/defaults.test.d.ts.map +1 -0
  171. package/dist/core/mcp/defaults.test.js +60 -0
  172. package/dist/core/mcp/defaults.test.js.map +1 -0
  173. package/dist/core/mcp/deferred-catalog.d.ts +1 -1
  174. package/dist/core/mcp/deferred-catalog.js +1 -1
  175. package/dist/core/mcp/elicitation.test.js +1 -1
  176. package/dist/core/mcp/legacy-negotiation.test.js +2 -2
  177. package/dist/core/mcp/oauth-store.test.js +2 -2
  178. package/dist/core/mcp/resolve-stdio.test.js +5 -5
  179. package/dist/core/mcp/shared-pool.test.js +5 -5
  180. package/dist/core/mcp/store.test.js +5 -5
  181. package/dist/core/mcp/when-connected.test.js +2 -2
  182. package/dist/core/nolan-model.test.js +1 -1
  183. package/dist/core/nolan-prompt.js +5 -5
  184. package/dist/core/oauth/xai.d.ts +2 -0
  185. package/dist/core/oauth/xai.d.ts.map +1 -0
  186. package/dist/core/oauth/xai.js +4 -0
  187. package/dist/core/oauth/xai.js.map +1 -0
  188. package/dist/core/persistent-shell.js +1 -1
  189. package/dist/core/persistent-shell.test.js +6 -6
  190. package/dist/core/process-manager-dev-server-repro.test.js +51 -12
  191. package/dist/core/process-manager-dev-server-repro.test.js.map +1 -1
  192. package/dist/core/process-manager-notifications.test.js +24 -14
  193. package/dist/core/process-manager-notifications.test.js.map +1 -1
  194. package/dist/core/process-manager-wake.test.d.ts +2 -0
  195. package/dist/core/process-manager-wake.test.d.ts.map +1 -0
  196. package/dist/core/process-manager-wake.test.js +96 -0
  197. package/dist/core/process-manager-wake.test.js.map +1 -0
  198. package/dist/core/process-manager.d.ts +61 -1
  199. package/dist/core/process-manager.d.ts.map +1 -1
  200. package/dist/core/process-manager.js +204 -4
  201. package/dist/core/process-manager.js.map +1 -1
  202. package/dist/core/progress/git-xp.test.js +2 -2
  203. package/dist/core/progress/ranks.d.ts +14 -3
  204. package/dist/core/progress/ranks.d.ts.map +1 -1
  205. package/dist/core/progress/ranks.js +181 -12
  206. package/dist/core/progress/ranks.js.map +1 -1
  207. package/dist/core/progress/ranks.test.js +48 -7
  208. package/dist/core/progress/ranks.test.js.map +1 -1
  209. package/dist/core/progress/rebuild.test.js +1 -1
  210. package/dist/core/progress/store.test.js +1 -1
  211. package/dist/core/progress/types.d.ts +2 -1
  212. package/dist/core/progress/types.d.ts.map +1 -1
  213. package/dist/core/project-discovery.d.ts.map +1 -1
  214. package/dist/core/project-discovery.js +62 -48
  215. package/dist/core/project-discovery.js.map +1 -1
  216. package/dist/core/project-discovery.test.js +10 -10
  217. package/dist/core/prompt-commands.d.ts.map +1 -1
  218. package/dist/core/prompt-commands.js +3 -3
  219. package/dist/core/prompt-commands.js.map +1 -1
  220. package/dist/core/provider-cache.e2e.test.d.ts +2 -0
  221. package/dist/core/provider-cache.e2e.test.d.ts.map +1 -0
  222. package/dist/core/provider-cache.e2e.test.js +125 -0
  223. package/dist/core/provider-cache.e2e.test.js.map +1 -0
  224. package/dist/core/radio.d.ts +1 -1
  225. package/dist/core/radio.d.ts.map +1 -1
  226. package/dist/core/radio.js +90 -6
  227. package/dist/core/radio.js.map +1 -1
  228. package/dist/core/radio.test.js +15 -2
  229. package/dist/core/radio.test.js.map +1 -1
  230. package/dist/core/run-journal.test.js +2 -2
  231. package/dist/core/sandbox.test.js +6 -6
  232. package/dist/core/semantic-search-benchmark.d.ts +2 -2
  233. package/dist/core/semantic-search-benchmark.js +5 -5
  234. package/dist/core/session-compaction.test.js +1 -1
  235. package/dist/core/session-injections.test.d.ts +2 -0
  236. package/dist/core/session-injections.test.d.ts.map +1 -0
  237. package/dist/core/session-injections.test.js +117 -0
  238. package/dist/core/session-injections.test.js.map +1 -0
  239. package/dist/core/session-manager.d.ts.map +1 -1
  240. package/dist/core/session-manager.js +83 -67
  241. package/dist/core/session-manager.js.map +1 -1
  242. package/dist/core/session-manager.test.js +7 -7
  243. package/dist/core/session-reconstructability.test.d.ts +2 -0
  244. package/dist/core/session-reconstructability.test.d.ts.map +1 -0
  245. package/dist/core/session-reconstructability.test.js +105 -0
  246. package/dist/core/session-reconstructability.test.js.map +1 -0
  247. package/dist/core/session-storage-fd-leak.test.d.ts +2 -0
  248. package/dist/core/session-storage-fd-leak.test.d.ts.map +1 -0
  249. package/dist/core/session-storage-fd-leak.test.js +116 -0
  250. package/dist/core/session-storage-fd-leak.test.js.map +1 -0
  251. package/dist/core/session-storage.d.ts +22 -2
  252. package/dist/core/session-storage.d.ts.map +1 -1
  253. package/dist/core/session-storage.js +33 -6
  254. package/dist/core/session-storage.js.map +1 -1
  255. package/dist/core/session-storage.test.js +2 -2
  256. package/dist/core/settings-manager.d.ts +12 -0
  257. package/dist/core/settings-manager.d.ts.map +1 -1
  258. package/dist/core/settings-manager.js +46 -1
  259. package/dist/core/settings-manager.js.map +1 -1
  260. package/dist/core/shell-path.js +1 -1
  261. package/dist/core/shell.d.ts +1 -1
  262. package/dist/core/shell.js +2 -2
  263. package/dist/core/shell.test.js +2 -2
  264. package/dist/core/shutdown.d.ts +71 -0
  265. package/dist/core/shutdown.d.ts.map +1 -0
  266. package/dist/core/shutdown.js +144 -0
  267. package/dist/core/shutdown.js.map +1 -0
  268. package/dist/core/shutdown.test.d.ts +2 -0
  269. package/dist/core/shutdown.test.d.ts.map +1 -0
  270. package/dist/core/shutdown.test.js +160 -0
  271. package/dist/core/shutdown.test.js.map +1 -0
  272. package/dist/core/sidecar-error-reporter.js +1 -1
  273. package/dist/core/sidecar-error-reporter.test.js +2 -2
  274. package/dist/core/skills-routing.test.js +142 -0
  275. package/dist/core/skills-routing.test.js.map +1 -1
  276. package/dist/core/skills.d.ts.map +1 -1
  277. package/dist/core/skills.js +4 -1
  278. package/dist/core/skills.js.map +1 -1
  279. package/dist/core/subagent-manager.d.ts +9 -0
  280. package/dist/core/subagent-manager.d.ts.map +1 -1
  281. package/dist/core/subagent-manager.js +45 -12
  282. package/dist/core/subagent-manager.js.map +1 -1
  283. package/dist/core/subagent-manager.test.js +14 -8
  284. package/dist/core/subagent-manager.test.js.map +1 -1
  285. package/dist/core/subagent-store.test.js +3 -3
  286. package/dist/core/task-store.js +1 -1
  287. package/dist/core/verification-gate.d.ts +55 -0
  288. package/dist/core/verification-gate.d.ts.map +1 -0
  289. package/dist/core/verification-gate.js +188 -0
  290. package/dist/core/verification-gate.js.map +1 -0
  291. package/dist/core/verification-gate.test.d.ts +2 -0
  292. package/dist/core/verification-gate.test.d.ts.map +1 -0
  293. package/dist/core/verification-gate.test.js +102 -0
  294. package/dist/core/verification-gate.test.js.map +1 -0
  295. package/dist/index.js +1 -1
  296. package/dist/index.js.map +1 -1
  297. package/dist/modes/acp-mode.js +2 -2
  298. package/dist/modes/acp-mode.test.js +10 -8
  299. package/dist/modes/acp-mode.test.js.map +1 -1
  300. package/dist/modes/agent-home-mode.d.ts.map +1 -1
  301. package/dist/modes/agent-home-mode.js +15 -11
  302. package/dist/modes/agent-home-mode.js.map +1 -1
  303. package/dist/modes/json-mode.d.ts +9 -1
  304. package/dist/modes/json-mode.d.ts.map +1 -1
  305. package/dist/modes/json-mode.js +3 -1
  306. package/dist/modes/json-mode.js.map +1 -1
  307. package/dist/modes/serve-mode.d.ts +1 -1
  308. package/dist/modes/serve-mode.d.ts.map +1 -1
  309. package/dist/modes/serve-mode.js +14 -9
  310. package/dist/modes/serve-mode.js.map +1 -1
  311. package/dist/modes/subagent-worker-mode.d.ts +5 -0
  312. package/dist/modes/subagent-worker-mode.d.ts.map +1 -1
  313. package/dist/modes/subagent-worker-mode.js.map +1 -1
  314. package/dist/session.test.js +1 -1
  315. package/dist/system-prompt.d.ts +37 -1
  316. package/dist/system-prompt.d.ts.map +1 -1
  317. package/dist/system-prompt.js +170 -12
  318. package/dist/system-prompt.js.map +1 -1
  319. package/dist/system-prompt.test.js +170 -11
  320. package/dist/system-prompt.test.js.map +1 -1
  321. package/dist/system-prompt.tiering.test.d.ts +2 -0
  322. package/dist/system-prompt.tiering.test.d.ts.map +1 -0
  323. package/dist/system-prompt.tiering.test.js +108 -0
  324. package/dist/system-prompt.tiering.test.js.map +1 -0
  325. package/dist/tools/bash.d.ts +4 -0
  326. package/dist/tools/bash.d.ts.map +1 -1
  327. package/dist/tools/bash.js +57 -3
  328. package/dist/tools/bash.js.map +1 -1
  329. package/dist/tools/bash.test.js +37 -0
  330. package/dist/tools/bash.test.js.map +1 -1
  331. package/dist/tools/code-nav.d.ts +30 -0
  332. package/dist/tools/code-nav.d.ts.map +1 -0
  333. package/dist/tools/code-nav.js +320 -0
  334. package/dist/tools/code-nav.js.map +1 -0
  335. package/dist/tools/code-nav.test.d.ts +2 -0
  336. package/dist/tools/code-nav.test.d.ts.map +1 -0
  337. package/dist/tools/code-nav.test.js +136 -0
  338. package/dist/tools/code-nav.test.js.map +1 -0
  339. package/dist/tools/edit.d.ts.map +1 -1
  340. package/dist/tools/edit.js +37 -4
  341. package/dist/tools/edit.js.map +1 -1
  342. package/dist/tools/edit.test.js +45 -1
  343. package/dist/tools/edit.test.js.map +1 -1
  344. package/dist/tools/generate-image.d.ts +1 -1
  345. package/dist/tools/goals.d.ts +2 -2
  346. package/dist/tools/goals.test.js +2 -2
  347. package/dist/tools/grep-parity.test.d.ts +2 -0
  348. package/dist/tools/grep-parity.test.d.ts.map +1 -0
  349. package/dist/tools/grep-parity.test.js +92 -0
  350. package/dist/tools/grep-parity.test.js.map +1 -0
  351. package/dist/tools/grep-recall.test.d.ts +2 -0
  352. package/dist/tools/grep-recall.test.d.ts.map +1 -0
  353. package/dist/tools/grep-recall.test.js +114 -0
  354. package/dist/tools/grep-recall.test.js.map +1 -0
  355. package/dist/tools/grep-spawn.test.d.ts +2 -0
  356. package/dist/tools/grep-spawn.test.d.ts.map +1 -0
  357. package/dist/tools/grep-spawn.test.js +66 -0
  358. package/dist/tools/grep-spawn.test.js.map +1 -0
  359. package/dist/tools/grep.d.ts +13 -3
  360. package/dist/tools/grep.d.ts.map +1 -1
  361. package/dist/tools/grep.js +340 -40
  362. package/dist/tools/grep.js.map +1 -1
  363. package/dist/tools/grep.test.js +17 -14
  364. package/dist/tools/grep.test.js.map +1 -1
  365. package/dist/tools/index.d.ts +7 -0
  366. package/dist/tools/index.d.ts.map +1 -1
  367. package/dist/tools/index.js +8 -1
  368. package/dist/tools/index.js.map +1 -1
  369. package/dist/tools/plan-mode.test.js +1 -1
  370. package/dist/tools/prompt-hints.d.ts +9 -0
  371. package/dist/tools/prompt-hints.d.ts.map +1 -1
  372. package/dist/tools/prompt-hints.js +62 -8
  373. package/dist/tools/prompt-hints.js.map +1 -1
  374. package/dist/tools/read-only-bash.d.ts +6 -0
  375. package/dist/tools/read-only-bash.d.ts.map +1 -1
  376. package/dist/tools/read-only-bash.js +168 -9
  377. package/dist/tools/read-only-bash.js.map +1 -1
  378. package/dist/tools/read-only-bash.test.js +49 -0
  379. package/dist/tools/read-only-bash.test.js.map +1 -1
  380. package/dist/tools/safe-env.js +1 -1
  381. package/dist/tools/search-code.d.ts.map +1 -1
  382. package/dist/tools/search-code.js +7 -6
  383. package/dist/tools/search-code.js.map +1 -1
  384. package/dist/tools/search-code.test.js +8 -2
  385. package/dist/tools/search-code.test.js.map +1 -1
  386. package/dist/tools/skill.js +3 -1
  387. package/dist/tools/skill.js.map +1 -1
  388. package/dist/tools/subagent-control.d.ts.map +1 -1
  389. package/dist/tools/subagent-control.js +20 -5
  390. package/dist/tools/subagent-control.js.map +1 -1
  391. package/dist/tools/subagent-control.test.js +34 -1
  392. package/dist/tools/subagent-control.test.js.map +1 -1
  393. package/dist/tools/subagent-shared.d.ts +20 -1
  394. package/dist/tools/subagent-shared.d.ts.map +1 -1
  395. package/dist/tools/subagent-shared.js +34 -7
  396. package/dist/tools/subagent-shared.js.map +1 -1
  397. package/dist/tools/subagent-shared.test.js +43 -9
  398. package/dist/tools/subagent-shared.test.js.map +1 -1
  399. package/dist/tools/subagent.d.ts.map +1 -1
  400. package/dist/tools/subagent.js +11 -8
  401. package/dist/tools/subagent.js.map +1 -1
  402. package/dist/tools/subagent.test.js +3 -0
  403. package/dist/tools/subagent.test.js.map +1 -1
  404. package/dist/tools/task-send.test.js +19 -10
  405. package/dist/tools/task-send.test.js.map +1 -1
  406. package/dist/tools/tool-catalog.test.d.ts +2 -0
  407. package/dist/tools/tool-catalog.test.d.ts.map +1 -0
  408. package/dist/tools/tool-catalog.test.js +124 -0
  409. package/dist/tools/tool-catalog.test.js.map +1 -0
  410. package/dist/tools/tool-search.d.ts.map +1 -1
  411. package/dist/tools/tool-search.js +2 -1
  412. package/dist/tools/tool-search.js.map +1 -1
  413. package/dist/tools/tool-tiers.d.ts +42 -0
  414. package/dist/tools/tool-tiers.d.ts.map +1 -0
  415. package/dist/tools/tool-tiers.js +78 -0
  416. package/dist/tools/tool-tiers.js.map +1 -0
  417. package/dist/tools/tool-tiers.test.d.ts +2 -0
  418. package/dist/tools/tool-tiers.test.d.ts.map +1 -0
  419. package/dist/tools/tool-tiers.test.js +48 -0
  420. package/dist/tools/tool-tiers.test.js.map +1 -0
  421. package/dist/tools/write.test.js +1 -1
  422. package/dist/ui/App.d.ts +3 -0
  423. package/dist/ui/App.d.ts.map +1 -1
  424. package/dist/ui/App.js +39 -3
  425. package/dist/ui/App.js.map +1 -1
  426. package/dist/ui/app-items.d.ts +2 -0
  427. package/dist/ui/app-items.d.ts.map +1 -1
  428. package/dist/ui/app-items.js +2 -0
  429. package/dist/ui/app-items.js.map +1 -1
  430. package/dist/ui/components/Banner.d.ts.map +1 -1
  431. package/dist/ui/components/Banner.js +24 -16
  432. package/dist/ui/components/Banner.js.map +1 -1
  433. package/dist/ui/components/ToolExecution.js +42 -34
  434. package/dist/ui/components/ToolExecution.js.map +1 -1
  435. package/dist/ui/components/force-color.d.ts +2 -0
  436. package/dist/ui/components/force-color.d.ts.map +1 -0
  437. package/dist/ui/components/force-color.js +11 -0
  438. package/dist/ui/components/force-color.js.map +1 -0
  439. package/dist/ui/components/themed-output.test.d.ts +2 -0
  440. package/dist/ui/components/themed-output.test.d.ts.map +1 -0
  441. package/dist/ui/components/themed-output.test.js +111 -0
  442. package/dist/ui/components/themed-output.test.js.map +1 -0
  443. package/dist/ui/error-item.d.ts +1 -1
  444. package/dist/ui/error-item.js +3 -3
  445. package/dist/ui/error-item.js.map +1 -1
  446. package/dist/ui/hooks/useAgentLoop.d.ts +4 -1
  447. package/dist/ui/hooks/useAgentLoop.d.ts.map +1 -1
  448. package/dist/ui/hooks/useAgentLoop.js +27 -2
  449. package/dist/ui/hooks/useAgentLoop.js.map +1 -1
  450. package/dist/ui/login.js +2 -2
  451. package/dist/ui/login.js.map +1 -1
  452. package/dist/ui/render.d.ts +1 -1
  453. package/dist/ui/render.js +6 -6
  454. package/dist/ui/theme/dark-ansi.json +6 -0
  455. package/dist/ui/theme/dark-daltonized.json +6 -0
  456. package/dist/ui/theme/dark.json +6 -0
  457. package/dist/ui/theme/light-ansi.json +6 -0
  458. package/dist/ui/theme/light-daltonized.json +6 -0
  459. package/dist/ui/theme/light.json +6 -0
  460. package/dist/ui/theme/theme.d.ts +6 -0
  461. package/dist/ui/theme/theme.d.ts.map +1 -1
  462. package/dist/ui/tui-terminal-recorder.test.js +1 -1
  463. package/dist/utils/git.test.js +3 -3
  464. package/dist/utils/image.d.ts.map +1 -1
  465. package/dist/utils/image.js.map +1 -1
  466. package/package.json +7 -7
@@ -49,13 +49,14 @@ function renderIdentitySection(provider, goalMode) {
49
49
  function renderTalkSection() {
50
50
  return (`## How to Talk\n\n` +
51
51
  `Write for severe ADHD: fast scanning, low working memory, easy action.\n\n` +
52
- `**First line = actionable state.** Done: lead with the outcome. Blocked or handing off: lead with the ONE next action. Final replies: 1–2 sentences, hard cap 5.\n\n` +
53
- `**Default to action.** Do all safe, reversible steps implied by the goal—never ask permission, merely suggest them, or leave them for the user. If blocked, ask for the ONE action that unblocks you.\n\n` +
54
- `**Keep progress visible.** State what works now and the blocker or next step; never bury completed work.\n\n` +
55
- `**Easy to scan.** One idea per line; **bold** key words. Number steps; cap lists at 5. Recommend ONE approach, not a menu — unless a command's flow defines its own options.\n\n` +
56
- `**Be concrete and decisive.** Give measured outcomes. Default to X; switch to Y only when [condition]. Say what TO do.\n\n` +
57
- `Stay silent between tool calls unless you hit a decision, tradeoff, finding, or question. No preamble, no recap, no hedging, no output dumps. ` +
58
- `Surface tradeoffs and unverified claims plainly. Rarely and at random (roughly 1 in 6 replies), drop ONE short, absurd, cringey interjection with an emoji — a fart confession (“Woops I just farted!”), a sudden weird craving, misplaced pride in a semicolon, an unprompted pigeon fact… invent fresh ones; never repeat, never force, never explain.`);
52
+ `**First line = actionable state.** Done: lead with the outcome. Blocked or handing off: lead with the ONE next action, plus what already works so finished work is never buried. Final replies: 1–2 sentences, hard cap 5 — prose only; a step list or the ask doesn't count.\n\n` +
53
+ `**Default to action.** Take every safe, reversible step the goal implies — never ask permission, merely suggest it, or leave it for the user. When something in How to Work genuinely stops you, ask for the ONE action that unblocks you.\n\n` +
54
+ `**Blockquote = the ask.** That ask is the reply's last line, as exactly one markdown blockquote: \`> **<the ask>?** <what you do the moment they answer>\`, phrased so someone who never saw the code can answer. One per reply — the blocking one. Blockquote nothing else, so \`>\` in your reply always means "you're up".\n\n` +
55
+ `**Keep the real word, add the stakes.** Never dumb a term down or drop an identifier; the first time one appears that the user must judge, say what it does or risks in the same sentence (≤8 words, dash or parens). Once per term, never a glossary.\n\n` +
56
+ `**Cut what they can't act on.** Reasoning, findings, and history earn a clause only when they change the next move: conclusion, not investigation; never re-explain yourself.\n\n` +
57
+ `**Concrete and scannable.** One idea per line; **bold** key words. Number steps; cap lists at 5. Give measured outcomes and ONE recommended approach — default to X, switch to Y only when [condition] — not a menu, unless a command's flow defines its own options.\n\n` +
58
+ `Between tool calls, speak only when the plan changes: a decision, tradeoff, surprise finding, or the ask. No preamble, no recap, no hedging, no output dumps. ` +
59
+ `Surface tradeoffs and unverified claims plainly. Rarely and at random (~1 in 6 replies), drop ONE short, absurd, cringey interjection with an emoji — a fart confession (“Woops I just farted!”), a weird craving, a pigeon fact; invent fresh ones, never repeat, never force, never explain.`);
59
60
  }
60
61
  function renderWorkSection() {
61
62
  return (`## How to Work\n\n` +
@@ -152,26 +153,118 @@ function renderResearchSection(toolNames, provider) {
152
153
  function hasKencodeSearch(toolNames) {
153
154
  return toolNames.some((name) => name.startsWith("mcp__kencode-search__"));
154
155
  }
156
+ /**
157
+ * Code quality, led by an explicit minimization ladder.
158
+ *
159
+ * The ladder is ordered and stop-at-first-hit on purpose: the measured failure
160
+ * mode is not bad code, it is *more* code than the task needed — unrequested
161
+ * abstractions, options nobody asked for, a dependency where a native call
162
+ * would do. Stating the rungs as a sequence converts that judgement into a
163
+ * checklist the model actually runs before writing.
164
+ *
165
+ * Benchmarked against the previous prose-only version (A/B, 5 iterations per
166
+ * cell, every artifact executed against functional tests): same correctness on
167
+ * every task (100% exec pass, no new dependencies, no turn-cap hits) with
168
+ * 50–76% less code and 21–38% fewer output tokens. The section costs ~3.3x its
169
+ * old size and still wins on input tokens — stopping at the first rung that
170
+ * holds takes fewer turns than re-deriving an over-built solution.
171
+ *
172
+ * Rung 2 was checked separately against seeded repos (a helper already present
173
+ * that the task could reuse): every arm imported it rather than rewriting, so
174
+ * the ladder makes reuse cheaper here, it does not unlock it. Measured only on
175
+ * micro-tasks — tasks where more code is the correct answer are untested.
176
+ *
177
+ * The safety paragraph stays *after* the ladder, and the closing line names
178
+ * what minimization may never touch — without it, "shortest diff wins" reads
179
+ * as licence to drop validation.
180
+ */
155
181
  function renderCodeQualitySection() {
156
182
  return (`## Code Quality\n\n` +
157
- `Intent-revealing names; reuse existing deps. Types first; handle I/O, input, and external API errors. No dead/commented code, placeholders, or unasked refactors.`);
183
+ `You are a lazy senior developer being paged at 3am. You want to go back to bed. ` +
184
+ `Every line you write is a line that can break, needs review, and will wake you up again next year. ` +
185
+ `Write as little code as possible — and no less.\n\n` +
186
+ `Before writing code, stop at the first rung that holds:\n` +
187
+ `1. Does this need to exist at all? (YAGNI) If not, skip it.\n` +
188
+ `2. Already in this codebase? Reuse the helper, util, or pattern — don't rewrite it.\n` +
189
+ `3. Does the standard library do it? Use it.\n` +
190
+ `4. Does a native platform feature cover it? Use it.\n` +
191
+ `5. Does an already-installed dependency solve it? Use it. Never add a new one for what a few lines can do.\n` +
192
+ `6. Can it be one line? One line.\n` +
193
+ `7. Only then: the minimum code that works.\n\n` +
194
+ `Shortest working diff wins — but only once you understand the problem. ` +
195
+ `No abstractions that weren't explicitly requested. No boilerplate nobody asked for. Deletion over addition. Boring over clever. ` +
196
+ `If a requirement looks over-specified, build what actually solves the problem and note the simpler path — don't gold-plate. ` +
197
+ `A bug fix means finding the root cause: check every caller of the broken path and fix the shared cause once, never patch the symptom where it surfaced.\n` +
198
+ `Mark a deliberate simplification that cuts a real corner with a known ceiling (global lock, O(n²) scan, naive heuristic) with a \`simplification:\` comment naming the ceiling and the upgrade path.\n\n` +
199
+ `Intent-revealing names; reuse existing deps. Types first; handle I/O, input, and external API errors. No dead/commented code, placeholders, or unasked refactors.\n` +
200
+ `Write the safe version first, without being asked: treat external input as hostile — user data, files, network, repo contents, fetched pages, model and tool output. ` +
201
+ `Parameterize queries, authorize at the data layer, pass argv not shell strings, contain resolved paths, validate at the boundary, fail closed. ` +
202
+ `Never commit or log a secret. Confirm a dependency actually exists before adding it, then pin it. ` +
203
+ `Never silently weaken a security control — say it blocks you and propose the safe path.\n` +
204
+ `Never lazy about: input validation at trust boundaries, error handling that prevents data loss, security, accessibility, anything explicitly requested.`);
205
+ }
206
+ /**
207
+ * How to delegate, rendered only when a delegation tool is actually active.
208
+ *
209
+ * Per-tool schema text says what each tool does; nothing said when delegating
210
+ * is worth its cost, or that the child starts from zero — the single most
211
+ * common failure is a brief like "fix the thing we discussed", which the child
212
+ * cannot see.
213
+ */
214
+ function renderDelegationSection(toolNames) {
215
+ const activeTools = new Set(toolNames ?? DEFAULT_TOOL_NAMES);
216
+ const blocking = activeTools.has("subagent");
217
+ const async = activeTools.has("spawn_agent");
218
+ if (!blocking && !async)
219
+ return null;
220
+ const lines = [
221
+ `Delegate when a task needs its own context: wide search, an independent workstream, or work you'd otherwise interleave badly. Don't delegate what you can finish inline — a child costs a process, a cold cache, and a round trip.`,
222
+ `**A child sees none of this conversation.** Its task brief is all it gets, so state the objective, the concrete paths/symbols involved, the constraints, and what to return. "Continue what we discussed" gets you nothing back.`,
223
+ `One agent per independent unit of work. Overlapping briefs produce duplicated effort and contradictory answers.`,
224
+ `Pick the named agent whose description matches the work; leave \`agent\` unset only when none fits.`,
225
+ `You own the result: a child's report is evidence, not truth. Verify anything you're about to act on.`,
226
+ ];
227
+ if (async && blocking) {
228
+ lines.push(`\`subagent\` blocks until the child answers; \`spawn_agent\` returns immediately and the child announces its own completion — use it to fan out, then keep working.`);
229
+ }
230
+ return `## Delegation\n\n${lines.map((line) => `- ${line}`).join("\n")}`;
158
231
  }
159
- function renderToolsSection(toolNames) {
232
+ /**
233
+ * Render the Tools section.
234
+ *
235
+ * `deferredToolNames` are tools that exist but whose parameter schemas are held
236
+ * out of the request until `tool_search` promotes them. They get a one-line
237
+ * capability hint under their own sub-heading: without it the model cannot
238
+ * search for what it does not know exists, and deferral would trade tokens for
239
+ * capability blindness. Steering clauses see both tiers, since a preference
240
+ * like "use X rather than Y" stays true while X is one `tool_search` away.
241
+ */
242
+ function renderToolsSection(toolNames, deferredToolNames) {
160
243
  const activeTools = toolNames ?? DEFAULT_TOOL_NAMES;
244
+ const deferred = (deferredToolNames ?? []).filter((name) => !activeTools.includes(name));
161
245
  const toolLines = [];
162
246
  for (const name of activeTools) {
163
247
  const hint = TOOL_PROMPT_HINTS[name];
164
248
  if (hint)
165
249
  toolLines.push(`- **${name}**: ${hint}`);
166
250
  }
251
+ const deferredLines = [];
252
+ for (const name of deferred) {
253
+ const hint = TOOL_PROMPT_HINTS[name];
254
+ if (hint)
255
+ deferredLines.push(`- **${name}**: ${hint}`);
256
+ }
167
257
  // Cross-tool steering: each clause renders only when its tools are active.
168
258
  // Per-tool hints only exist for tools with non-obvious usage (see prompt-hints).
169
- const steering = buildToolSteering(activeTools);
259
+ const steering = buildToolSteering([...activeTools, ...deferred]);
170
260
  const parts = [];
171
261
  if (steering)
172
262
  parts.push(steering);
173
263
  if (toolLines.length > 0)
174
264
  parts.push(toolLines.join("\n"));
265
+ if (deferredLines.length > 0) {
266
+ parts.push(`Available on demand (call \`tool_search\` to load):\n${deferredLines.join("\n")}`);
267
+ }
175
268
  return parts.length > 0 ? `## Tools\n\n${parts.join("\n\n")}` : null;
176
269
  }
177
270
  /**
@@ -275,6 +368,58 @@ function renderUncachedDateSuffix() {
275
368
  const year = today.getFullYear();
276
369
  return `${UNCACHED_MARKER}\nToday's date: ${day} ${month} ${year}`;
277
370
  }
371
+ /**
372
+ * What every sub-agent owes its parent.
373
+ *
374
+ * Appended by `buildSubAgentSystemPrompt`, so user-authored agent files inherit
375
+ * it without repeating it. The parent pays context for whatever comes back, and
376
+ * it cannot see the child's transcript — so the reply has to be the answer, not
377
+ * a narration of the search that produced it.
378
+ */
379
+ export const SUBAGENT_RETURN_CONTRACT = `## Report\n\n` +
380
+ `You are a sub-agent. Your reply is the ONLY thing your caller receives — it never sees your tool calls, your reasoning, or the files you opened.\n\n` +
381
+ `- Lead with the answer or the outcome. No preamble, no recap of your process.\n` +
382
+ `- Cite evidence as \`file:line\`. Point at paths; never paste file bodies or command output the caller can re-read.\n` +
383
+ `- State what you actually verified and how (command run, test executed, file read). Never claim a check you did not run.\n` +
384
+ `- Name blockers, assumptions, and anything you could not confirm, plainly.\n` +
385
+ `- Stay under ~400 words. If the finding is genuinely larger, write it to a file and return the path.`;
386
+ /**
387
+ * Build a sub-agent's system prompt: its own definition PLUS the scaffolding
388
+ * that teaches correct tool use.
389
+ *
390
+ * An agent definition body replaces the parent's Identity/Talk/Work sections —
391
+ * that is the point of a specialized agent. It must NOT also cost the child its
392
+ * Tools section, project conventions, or Environment facts (cwd, platform,
393
+ * shell, date), which is what a bare prompt override did: children ran blind to
394
+ * their own toolset and re-derived basics every session.
395
+ *
396
+ * @param agentBody — the agent definition's markdown body (its identity + method).
397
+ * @param opts.toolNames — exactly the tools this child can call, so the Tools
398
+ * section never advertises something the allow-list strips.
399
+ * @param opts.context — `"none"` skips project instruction files, for recon
400
+ * agents where conventions are dead weight.
401
+ */
402
+ export async function buildSubAgentSystemPrompt(agentBody, opts) {
403
+ const sections = [agentBody.trim()];
404
+ const toolsSection = renderToolsSection(opts.toolNames, opts.deferredToolNames);
405
+ if (toolsSection)
406
+ sections.push(toolsSection);
407
+ // A child may itself delegate (up to the nesting limit), so it needs the same
408
+ // briefing rules whenever a delegation tool survived its allow-list.
409
+ const delegationSection = renderDelegationSection(opts.toolNames);
410
+ if (delegationSection)
411
+ sections.push(delegationSection);
412
+ if ((opts.context ?? "project") === "project") {
413
+ const projectContextSection = renderProjectContextSection(await collectProjectContext(opts.cwd));
414
+ if (projectContextSection)
415
+ sections.push(projectContextSection);
416
+ }
417
+ sections.push(SUBAGENT_RETURN_CONTRACT,
418
+ // Environment + date stay last so the cached prefix matches the parent's
419
+ // layout: everything above is stable, the date suffix is the uncached tail.
420
+ renderEnvironmentSection(opts.cwd, opts.environment), renderUncachedDateSuffix());
421
+ return sections.join("\n\n");
422
+ }
278
423
  /**
279
424
  * Build the system prompt dynamically based on cwd and context.
280
425
  *
@@ -286,10 +431,20 @@ function renderUncachedDateSuffix() {
286
431
  * @param environmentArg — extra Environment-section facts (additional workspace
287
432
  * roots, network allowlist). This sits in the cached prefix, so changing it
288
433
  * costs exactly one cache-miss turn.
434
+ * @param deferredToolNames — tools the model can call only after `tool_search`
435
+ * promotes them. Listed as one-line hints so the capability stays discoverable
436
+ * while its parameter schema stays out of the request.
289
437
  */
290
- export async function buildSystemPrompt(cwd, skills, planMode, approvedPlanPath, toolNames, activeLanguages, provider, goalModeOrEnvironment = "off", environmentArg) {
438
+ export async function buildSystemPrompt(cwd, skills, planMode, approvedPlanPath, toolNames, activeLanguages, provider, goalModeOrEnvironment = "off", environmentArgOrDeferred, deferredToolNamesArg) {
291
439
  const goalMode = typeof goalModeOrEnvironment === "string" ? goalModeOrEnvironment : "off";
440
+ const legacyDeferredToolNames = Array.isArray(environmentArgOrDeferred)
441
+ ? environmentArgOrDeferred
442
+ : undefined;
443
+ const environmentArg = legacyDeferredToolNames
444
+ ? undefined
445
+ : environmentArgOrDeferred;
292
446
  const environment = typeof goalModeOrEnvironment === "string" ? environmentArg : goalModeOrEnvironment;
447
+ const deferredToolNames = deferredToolNamesArg ?? legacyDeferredToolNames;
293
448
  const hasKencode = hasKencodeSearch(toolNames ?? DEFAULT_TOOL_NAMES);
294
449
  const sections = [
295
450
  renderIdentitySection(provider, goalMode),
@@ -308,9 +463,12 @@ export async function buildSystemPrompt(cwd, skills, planMode, approvedPlanPath,
308
463
  if (approvedPlanSection)
309
464
  sections.push(approvedPlanSection);
310
465
  sections.push(renderResearchSection(toolNames, provider), renderCodeQualitySection());
311
- const toolsSection = renderToolsSection(toolNames);
466
+ const toolsSection = renderToolsSection(toolNames, deferredToolNames);
312
467
  if (toolsSection)
313
468
  sections.push(toolsSection);
469
+ const delegationSection = renderDelegationSection(toolNames);
470
+ if (delegationSection)
471
+ sections.push(delegationSection);
314
472
  const projectContextSection = renderProjectContextSection(await collectProjectContext(cwd));
315
473
  if (projectContextSection)
316
474
  sections.push(projectContextSection);
@@ -1 +1 @@
1
- {"version":3,"file":"system-prompt.js","sourceRoot":"","sources":["../src/system-prompt.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,kBAAkB,CAAC;AAClC,OAAO,IAAI,MAAM,WAAW,CAAC;AAC7B,OAAO,EAAE,qBAAqB,EAAc,MAAM,kBAAkB,CAAC;AACrE,OAAO,EAAE,iBAAiB,EAAE,iBAAiB,EAAE,kBAAkB,EAAE,MAAM,yBAAyB,CAAC;AAEnG,OAAO,EAAE,QAAQ,EAAE,MAAM,iBAAiB,CAAC;AAC3C,OAAO,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAC;AAC/C,OAAO,EAAE,uBAAuB,EAAE,MAAM,6BAA6B,CAAC;AACtE,OAAO,EAAE,oBAAoB,EAAE,mBAAmB,EAAE,MAAM,2BAA2B,CAAC;AACtF,OAAO,EAAE,gBAAgB,EAAE,MAAM,uBAAuB,CAAC;AAIzD,gFAAgF;AAChF,wEAAwE;AACxE,MAAM,aAAa,GAAG;IACpB,oBAAoB;IACpB,WAAW;IACX,WAAW;IACX,cAAc;IACd,gBAAgB;CACjB,CAAC;AAEF,8EAA8E;AAC9E,MAAM,CAAC,MAAM,yBAAyB,GAAG,EAAE,GAAG,IAAI,CAAC;AACnD,MAAM,eAAe,GAAG,mBAAmB,CAAC;AAE5C;;;;;GAKG;AACH,SAAS,WAAW,CAAC,QAA8B;IAC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eAAe,CAAC,CAAC;QAC9D,MAAM,aAAa,GAAG,mBAAmB,CAAC,UAAU,CAAC,CAAC;QACtD,IAAI,aAAa;YAAE,QAAQ,CAAC,IAAI,CAAC,aAAa,CAAC,CAAC;IAClD,CAAC;IAED,IAAI,MAAM,IAAI,MAAM,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC;QAChC,MAAM,aAAa,GAAG,qBAAqB,CAAC,MAAM,CAAC,CAAC;QACpD,IAAI,aAAa;YAAE,QAAQ,CAAC,IAAI,CAAC,aAAa,CAAC,CAAC;IAClD,CAAC;IAED,QAAQ,CAAC,IAAI,CAAC,wBAAwB,CAAC,GAAG,EAAE,WAAW,CAAC,EAAE,wBAAwB,EAAE,CAAC,CAAC;IAEtF,OAAO,QAAQ,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC;AAC/B,CAAC"}
@@ -2,7 +2,8 @@ import fs from "node:fs/promises";
2
2
  import os from "node:os";
3
3
  import path from "node:path";
4
4
  import { afterEach, describe, expect, it } from "vitest";
5
- import { buildSystemPrompt, collectProjectContext, PROJECT_CONTEXT_MAX_BYTES, } from "./system-prompt.js";
5
+ import { buildSubAgentSystemPrompt, buildSystemPrompt, collectProjectContext, PROJECT_CONTEXT_MAX_BYTES, } from "./system-prompt.js";
6
+ import { buildNolanSystemPrompt } from "./core/nolan-prompt.js";
6
7
  const tempDirs = [];
7
8
  async function makeProject(files = {}) {
8
9
  const cwd = await fs.mkdtemp(path.join(os.tmpdir(), "ezcoder-system-prompt-"));
@@ -82,8 +83,38 @@ describe("buildSystemPrompt", () => {
82
83
  expect(prompt).toContain("never repeat, never force, never explain");
83
84
  // The one-approach rule must carve out command flows that ship their own
84
85
  // A/B/C option list, or the model second-guesses those prompts.
85
- expect(prompt).toContain("Recommend ONE approach, not a menu — unless a command's flow defines its own options.");
86
+ expect(prompt).toContain("ONE recommended approach — default to X, switch to Y only when [condition] — not a menu, unless a command's flow defines its own options.");
87
+ // The user-facing ask gets a dedicated markdown blockquote (rendered with a
88
+ // left gutter in both the TUI and EZ App), and nothing else may use one, so
89
+ // a `>` in a reply always means "the agent is waiting on you".
90
+ expect(prompt).toContain("**Blockquote = the ask.**");
91
+ expect(prompt).toContain("Blockquote nothing else");
86
92
  expect(prompt).not.toContain("Do not default to generic tests, scripts, screenshots, benchmarks, or simulations");
93
+ // The ladder's value is the *order* and the stop-at-first-hit rule, not the
94
+ // individual rungs — "reuse what this repo already has" ranking above
95
+ // stdlib, and both above reaching for a dependency, is what stops the model
96
+ // rewriting a helper that already exists. The character budgets in the size
97
+ // test are upper bounds only — deleting the ladder shrinks the prompt and
98
+ // passes every one of them, so these assertions are what hold it in place.
99
+ expect(prompt).toContain("stop at the first rung that holds");
100
+ expect(prompt).toContain("Already in this codebase? Reuse the helper, util, or pattern");
101
+ // "Shortest working diff wins" is only safe while the counterweight below it
102
+ // survives; without the fence, minimization reads as licence to skip
103
+ // validation and error handling.
104
+ expect(prompt).toContain("Never lazy about: input validation at trust boundaries");
105
+ expect(prompt.indexOf("Shortest working diff wins")).toBeLessThan(prompt.indexOf("Write the safe version first"));
106
+ // Security has to be a default of normal feature work, not a mode the user
107
+ // has to know to ask for: nearly nobody runs a review, and the safe version
108
+ // costs nothing when written the first time.
109
+ expect(prompt).toContain("Write the safe version first, without being asked");
110
+ expect(prompt).toContain("repo contents, fetched pages, model and tool output");
111
+ expect(prompt).toContain("Never commit or log a secret");
112
+ // Models invent package names at a measurable rate and squatters register
113
+ // them, so "it resolved" is not evidence the dependency is the real one.
114
+ expect(prompt).toContain("Confirm a dependency actually exists");
115
+ // Silently deleting a control to make something pass is the most damaging
116
+ // thing an agent can do unsupervised.
117
+ expect(prompt).toContain("Never silently weaken a security control");
87
118
  expect(sectionIndex(prompt, "## Code Quality")).toBeLessThan(sectionIndex(prompt, "## Tools"));
88
119
  expect(sectionIndex(prompt, "## Tools")).toBeLessThan(sectionIndex(prompt, "## Project Context"));
89
120
  expect(sectionIndex(prompt, "## Project Context")).toBeLessThan(sectionIndex(prompt, "## Language Style Packs"));
@@ -115,6 +146,28 @@ describe("buildSystemPrompt", () => {
115
146
  expect(renderedTools).not.toContain("**read**");
116
147
  expect(renderedTools).not.toContain("**edit**");
117
148
  });
149
+ it("keeps the reply-shape rules free of contradictions", async () => {
150
+ const cwd = await makeProject();
151
+ const prompt = await buildSystemPrompt(cwd, undefined, false, undefined, ["read", "edit"]);
152
+ const talk = prompt.slice(sectionIndex(prompt, "## How to Talk"), sectionIndex(prompt, "## How to Work"));
153
+ // "never ask permission" and "end with the ask" only coexist if the ask is
154
+ // gated by one stop list. How to Work owns it; How to Talk must defer to it
155
+ // instead of publishing a second, drifting list of reasons to stop.
156
+ expect(talk).toContain("When something in How to Work genuinely stops you");
157
+ expect(prompt).toContain("Stop only for user decisions, secrets/access, cost");
158
+ // The blockquote is the ask and only the ask, so exactly one blockquote
159
+ // template may exist anywhere in the prompt — a second one teaches the model
160
+ // that `>` is general formatting and the "you're up" signal dies.
161
+ expect(prompt.match(/^\s*`?> /gm) ?? []).toHaveLength(0);
162
+ expect(prompt.match(/`> \*\*/g) ?? []).toHaveLength(1);
163
+ // A hard sentence cap plus a numbered list plus a trailing ask is only
164
+ // followable if the cap says what it counts.
165
+ expect(talk).toContain("prose only; a step list or the ask doesn't count");
166
+ // Mid-turn speech and the cut rule must agree: a bare "finding" cannot both
167
+ // trigger a message and be cut for not changing the next move.
168
+ expect(talk).toContain("speak only when the plan changes");
169
+ expect(talk).not.toContain("unless you hit a decision, tradeoff, finding");
170
+ });
118
171
  it("states rule precedence exactly once and keeps project context before style packs", async () => {
119
172
  const cwd = await makeProject({
120
173
  "AGENTS.md": "Use tabs for this fixture.",
@@ -159,10 +212,15 @@ describe("buildSystemPrompt", () => {
159
212
  "works directly in the user's codebase",
160
213
  "completing tasks end-to-end",
161
214
  "Final replies: 1–2 sentences, hard cap 5",
162
- "Do all safe, reversible steps implied by the goal",
163
- "never ask permission, merely suggest them, or leave them for the user",
215
+ "Take every safe, reversible step the goal implies",
216
+ "never ask permission, merely suggest it, or leave it for the user",
164
217
  "ONE action that unblocks you",
165
- "State what works now and the blocker or next step",
218
+ "what already works so finished work is never buried",
219
+ "conclusion, not investigation",
220
+ // Jargon stays exact, but never bare: the reader must learn the stake of
221
+ // a term/file/command in the same breath, without a glossary paragraph.
222
+ "**Keep the real word, add the stakes.**",
223
+ "say what it does or risks in the same sentence",
166
224
  "Read before `edit`/`write`",
167
225
  "re-read after formatters",
168
226
  "Compute in bash; write with `edit`/`write`",
@@ -291,11 +349,31 @@ describe("buildSystemPrompt", () => {
291
349
  typescriptProjectContextToolsSkills: promptSize(typescriptPrompt),
292
350
  };
293
351
  console.info(`system prompt size measurements: ${JSON.stringify(measurements)}`);
294
- // Ceilings include the fork's longer branding and Goal guidance plus the
295
- // upstream shell, network-policy, context-precedence, and skill-routing instructions.
296
- expect(measurements.normal.characters).toBeLessThan(5_500);
297
- expect(measurements.planMode.characters).toBeLessThan(6_700);
298
- expect(measurements.typescriptProjectContextToolsSkills.characters).toBeLessThan(9_800);
352
+ // Budget includes EZ branding and Goal guidance, plus the "How to Talk" reply-shape rules (blockquote
353
+ // ask, cut-what-they-can't-act-on, jargon stakes); overlapping lines were
354
+ // folded to pay for part of it. ~640 chars of cached prefix buys replies the
355
+ // user can act on without re-reading.
356
+ //
357
+ // Raised again (~490 chars) for the always-on security defaults in Code
358
+ // Quality. The `bulletproof` skill only fires when the model routes to it,
359
+ // and almost no user asks for a security review before shipping — so the
360
+ // controls that must hold on every edit (hostile input, parameterized
361
+ // queries, secrets, dependency existence, never weakening a control) have
362
+ // to live in the prefix instead. Keep these caps tight so drift stays
363
+ // deliberate.
364
+ //
365
+ // Raised again (~1.6k chars) for the Code Quality minimization ladder.
366
+ // This spend is the rare one that pays for itself inside the same budget:
367
+ // A/B benchmarked at 5 iterations per cell with every generated artifact
368
+ // executed against functional tests, the ladder held correctness flat
369
+ // (100% exec pass, no new dependencies, no turn-cap hits) while cutting
370
+ // generated code 50–76% and output tokens 21–38%. Input tokens fell too,
371
+ // despite the longer prefix: stopping at the first rung that holds costs
372
+ // fewer turns than re-deriving an over-built solution.
373
+ // The fork's Goal workflow adds ~250 characters across representative prompts.
374
+ expect(measurements.normal.characters).toBeLessThan(8_400);
375
+ expect(measurements.planMode.characters).toBeLessThan(9_700);
376
+ expect(measurements.typescriptProjectContextToolsSkills.characters).toBeLessThan(12_900);
299
377
  expect(measurements.planMode.characters).toBeGreaterThan(measurements.normal.characters);
300
378
  expect(measurements.typescriptProjectContextToolsSkills.characters).toBeGreaterThan(measurements.normal.characters);
301
379
  });
@@ -321,7 +399,9 @@ describe("buildSystemPrompt", () => {
321
399
  const audit = promptAudit(prompt);
322
400
  console.info(`system prompt audit: ${JSON.stringify(audit)}`);
323
401
  expect(audit.flags).toEqual([]);
324
- expect(audit.size.characters).toBeLessThan(9_500);
402
+ // Raised with the Code Quality minimization ladder — see the size-budget
403
+ // test above for the measured return that justifies the spend.
404
+ expect(audit.size.characters).toBeLessThan(12_600);
325
405
  expect(audit.size.sections).toBeGreaterThanOrEqual(8);
326
406
  });
327
407
  it("only references web_search in Research when it is an active tool", async () => {
@@ -375,6 +455,38 @@ describe("buildSystemPrompt", () => {
375
455
  expect(openai.startsWith("You are EZ Coder by Nolan Grout")).toBe(true);
376
456
  expect(openai).not.toContain("You are Claude Code");
377
457
  });
458
+ it("is byte-stable across builds in one process (prefix-cache safety)", async () => {
459
+ // Deterministic arm of bench/baseline/04-prefix-stability.mjs, promoted to
460
+ // a unit test so a volatile section landing in the cached prefix fails
461
+ // `pnpm test`, not a manual bench run. The live cache-hit e2e
462
+ // (core/provider-cache.e2e.test.ts) guards the same property end-to-end.
463
+ const cwd = await makeProject({
464
+ "CLAUDE.md": "Project rules win.",
465
+ "package.json": JSON.stringify({ scripts: { check: "tsc --noEmit" } }),
466
+ });
467
+ const args = {
468
+ skills: [],
469
+ planMode: false,
470
+ approvedPlanPath: undefined,
471
+ toolNames: ["read", "edit", "bash"],
472
+ activeLanguages: new Set(["typescript"]),
473
+ };
474
+ const a = await buildSystemPrompt(cwd, args.skills, args.planMode, args.approvedPlanPath, args.toolNames, args.activeLanguages);
475
+ const b = await buildSystemPrompt(cwd, args.skills, args.planMode, args.approvedPlanPath, args.toolNames, args.activeLanguages);
476
+ expect(a).toBe(b);
477
+ // Same for the Nolan advisor prompt — its marker must also partition
478
+ // volatile bytes out of the cached prefix (nolan-prompt.ts pins the marker
479
+ // as byte-identical to the build prompt's).
480
+ const nolanA = await buildNolanSystemPrompt(cwd);
481
+ const nolanB = await buildNolanSystemPrompt(cwd);
482
+ expect(nolanA).toBe(nolanB);
483
+ for (const prompt of [a, nolanA]) {
484
+ expect(prompt).toContain("<!-- uncached -->");
485
+ // All volatile content (currently only the date) sits AFTER the marker.
486
+ const markerAt = prompt.indexOf("<!-- uncached -->");
487
+ expect(prompt.slice(markerAt)).toMatch(/Today's date: \d{1,2} \w+ \d{4}/);
488
+ }
489
+ });
378
490
  });
379
491
  describe("collectProjectContext", () => {
380
492
  it("picks one file per directory — AGENTS.md shadows CLAUDE.md and the rest", async () => {
@@ -454,4 +566,51 @@ describe("collectProjectContext", () => {
454
566
  expect(rendered).toContain("Skipped (context budget)");
455
567
  });
456
568
  });
569
+ describe("buildSubAgentSystemPrompt", () => {
570
+ it("composes the agent body with tools, context, contract and environment", async () => {
571
+ const cwd = await makeProject({ "CLAUDE.md": "Project rules win." });
572
+ const prompt = await buildSubAgentSystemPrompt("You are Owl. Explore this repo.", {
573
+ cwd,
574
+ toolNames: ["read", "grep", "code_search"],
575
+ });
576
+ expect(prompt.startsWith("You are Owl. Explore this repo.")).toBe(true);
577
+ expect(sectionIndex(prompt, "## Tools")).toBeLessThan(sectionIndex(prompt, "## Project Context"));
578
+ expect(sectionIndex(prompt, "## Project Context")).toBeLessThan(sectionIndex(prompt, "## Report"));
579
+ expect(sectionIndex(prompt, "## Report")).toBeLessThan(sectionIndex(prompt, "## Environment"));
580
+ expect(prompt).toContain("Project rules win.");
581
+ // The volatile date stays behind the cache marker, exactly as the parent's.
582
+ expect(prompt.indexOf("<!-- uncached -->")).toBeGreaterThan(sectionIndex(prompt, "## Environment"));
583
+ });
584
+ it("never advertises a tool the child's allow-list strips", async () => {
585
+ const cwd = await makeProject();
586
+ const prompt = await buildSubAgentSystemPrompt("You are Owl.", {
587
+ cwd,
588
+ toolNames: ["read", "grep", "code_search"],
589
+ });
590
+ const toolsSection = prompt.slice(sectionIndex(prompt, "## Tools"), sectionIndex(prompt, "## Report"));
591
+ expect(toolsSection).toContain("code_search");
592
+ expect(toolsSection).not.toContain("**write**");
593
+ expect(toolsSection).not.toContain("**bash**");
594
+ expect(prompt).not.toContain("## Delegation");
595
+ });
596
+ it("skips project instruction files when the agent opts out of context", async () => {
597
+ const cwd = await makeProject({ "CLAUDE.md": "Project rules win." });
598
+ const prompt = await buildSubAgentSystemPrompt("You are Owl.", {
599
+ cwd,
600
+ toolNames: ["read"],
601
+ context: "none",
602
+ });
603
+ expect(prompt).not.toContain("Project rules win.");
604
+ expect(prompt).toContain("## Environment");
605
+ });
606
+ it("briefs a delegating child on standalone task briefs", async () => {
607
+ const cwd = await makeProject();
608
+ const prompt = await buildSubAgentSystemPrompt("You are Bee.", {
609
+ cwd,
610
+ toolNames: ["read", "subagent"],
611
+ });
612
+ expect(prompt).toContain("## Delegation");
613
+ expect(prompt).toContain("sees none of this conversation");
614
+ });
615
+ });
457
616
  //# sourceMappingURL=system-prompt.test.js.map