@khoavu882/doflow 2.0.0-beta.4 → 2.0.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 (497) hide show
  1. package/README.md +12 -11
  2. package/bin/doflow.js +21 -11
  3. package/core/.antigravity-plugin/plugin.json +1 -3
  4. package/core/.claude-plugin/plugin.json +1 -1
  5. package/core/.codex-plugin/plugin.json +1 -1
  6. package/core/.plugin/plugin.json +1 -1
  7. package/core/harnesses/claude/hooks/lib.sh +43 -24
  8. package/core/harnesses/claude/hooks/mcp-tool-guard.sh +7 -17
  9. package/core/harnesses/claude/hooks/permission-audit.sh +3 -0
  10. package/core/harnesses/claude/hooks/post-compact.sh +35 -32
  11. package/core/harnesses/claude/hooks/post-edit-lint.sh +2 -0
  12. package/core/harnesses/claude/hooks/post-shell-observe.sh +48 -0
  13. package/core/harnesses/claude/hooks/post-tool-failure.sh +3 -0
  14. package/core/harnesses/claude/hooks/pre-bash-guard.sh +7 -17
  15. package/core/harnesses/claude/hooks/pre-compact.sh +23 -27
  16. package/core/harnesses/claude/hooks/pre-implement-gate.sh +7 -18
  17. package/core/harnesses/claude/hooks/session-end.sh +23 -10
  18. package/core/harnesses/claude/hooks/session-start.sh +5 -3
  19. package/core/harnesses/claude/hooks/skill-config-audit.sh +3 -0
  20. package/core/harnesses/claude/hooks/stop-check.sh +5 -3
  21. package/core/harnesses/claude/hooks/subagent-audit.sh +5 -5
  22. package/core/harnesses/claude/hooks/user-prompt-submit.sh +5 -3
  23. package/core/harnesses/claude/settings/settings.json +18 -0
  24. package/core/harnesses/claude/statusline/doflow-statusline.sh +1 -0
  25. package/core/harnesses/codex/agents/core-implementer.toml +1 -0
  26. package/core/harnesses/codex/agents/delivery-lead.toml +10 -0
  27. package/core/harnesses/codex/agents/quality-guardian.toml +1 -1
  28. package/core/harnesses/codex/agents/research-writer.toml +1 -1
  29. package/core/harnesses/codex/agents/reviewer.toml +10 -0
  30. package/core/harnesses/codex/agents/spec-analyst.toml +1 -1
  31. package/core/harnesses/codex/agents/system-architect.toml +1 -1
  32. package/core/harnesses/codex/hooks/lib.sh +44 -25
  33. package/core/harnesses/codex/hooks/mcp-tool-guard.sh +7 -15
  34. package/core/harnesses/codex/hooks/post-edit-lint.impl.sh +3 -1
  35. package/core/harnesses/codex/hooks/pre-bash-guard.sh +7 -15
  36. package/core/harnesses/codex/hooks/pre-compact.impl.sh +29 -26
  37. package/core/harnesses/codex/hooks/pre-implement-gate.sh +7 -16
  38. package/core/harnesses/codex/hooks/session-end.impl.sh +23 -10
  39. package/core/harnesses/codex/hooks/session-start.sh +5 -3
  40. package/core/harnesses/codex/hooks/stop-check.sh +6 -5
  41. package/core/harnesses/codex/hooks/subagent-audit.sh +18 -6
  42. package/core/harnesses/codex/hooks/user-prompt-submit.sh +5 -4
  43. package/core/harnesses/copilot/hooks/doflow-lib.sh +93 -0
  44. package/core/harnesses/copilot/hooks/doflow-mcp-tool-guard.sh +9 -0
  45. package/core/harnesses/copilot/hooks/doflow-pre-bash-guard.sh +9 -0
  46. package/core/harnesses/copilot/hooks/doflow-pre-implement-gate.sh +9 -0
  47. package/core/harnesses/copilot/hooks/doflow-session-start.sh +9 -0
  48. package/core/harnesses/copilot/hooks/doflow-stop-check.sh +9 -0
  49. package/core/harnesses/copilot/hooks/doflow-subagent-start.sh +9 -0
  50. package/core/harnesses/copilot/hooks/doflow-subagent-stop.sh +9 -0
  51. package/core/harnesses/copilot/hooks/doflow.json +57 -0
  52. package/core/harnesses/kiro/agents/doflow.json +1 -1
  53. package/core/harnesses/kiro/hooks/lib.sh +26 -6
  54. package/core/harnesses/kiro/hooks/mcp-tool-guard.sh +21 -5
  55. package/core/harnesses/kiro/hooks/pre-bash-guard.sh +21 -5
  56. package/core/harnesses/kiro/hooks/pre-implement-gate.sh +21 -5
  57. package/core/harnesses/kiro/hooks/session-start.sh +12 -5
  58. package/core/harnesses/kiro/hooks/stop-check.sh +22 -30
  59. package/core/harnesses/pi/extensions/doflow-guard.js +167 -0
  60. package/core/harnesses/shared/hooks/ENVELOPE_MIGRATION.md +27 -12
  61. package/core/harnesses/shared/hooks/adapters/antigravity.js +14 -57
  62. package/core/harnesses/shared/hooks/bridge/bridge.sh +277 -0
  63. package/core/harnesses/shared/hooks/bridge/envelope.jq +129 -0
  64. package/core/harnesses/shared/hooks/bridge/observe-model.sh +75 -0
  65. package/core/harnesses/shared/hooks/bridge/respond.sh +70 -0
  66. package/core/harnesses/shared/hooks/policies/blocked-patterns.conf +28 -14
  67. package/core/harnesses/shared/hooks/policies/capture-failure.sh +51 -16
  68. package/core/harnesses/shared/hooks/policies/compact-text.sh +46 -0
  69. package/core/harnesses/shared/hooks/policies/contract.sh +78 -0
  70. package/core/harnesses/shared/hooks/policies/deny-json.sh +35 -9
  71. package/core/harnesses/shared/hooks/policies/emission-rules.sh +37 -0
  72. package/core/harnesses/shared/hooks/policies/emission.jq +209 -0
  73. package/core/harnesses/shared/hooks/policies/emission.sh +383 -0
  74. package/core/harnesses/shared/hooks/policies/identity.sh +177 -0
  75. package/core/harnesses/shared/hooks/policies/lib.sh +65 -40
  76. package/core/harnesses/shared/hooks/policies/mcp-tool-guard.sh +48 -35
  77. package/core/harnesses/shared/hooks/policies/pre-bash-guard.sh +284 -33
  78. package/core/harnesses/shared/hooks/policies/pre-implementation-gate.sh +180 -110
  79. package/core/harnesses/shared/hooks/policies/session-context.sh +66 -7
  80. package/core/harnesses/shared/hooks/policies/stop-check.sh +61 -23
  81. package/core/harnesses/shared/hooks/policies/subagent-audit.sh +39 -6
  82. package/core/harnesses/shared/hooks/policies/summary-store.sh +347 -0
  83. package/core/harnesses/shared/hooks/policies/user-prompt-submit.sh +97 -159
  84. package/core/harnesses/shared/hooks/stream-hook-runner.js +114 -187
  85. package/core/harnesses/shared/locator/doflow-run +2 -3
  86. package/core/registry/advice.json +3 -3
  87. package/core/registry/assets.json +72 -80
  88. package/core/registry/capabilities.json +12 -0
  89. package/core/registry/contracts.json +60 -33
  90. package/core/registry/contribution-points.json +32 -0
  91. package/core/registry/gates.json +32 -0
  92. package/core/registry/guidance-caps.json +40 -0
  93. package/core/registry/harnesses.json +1542 -277
  94. package/core/registry/lifecycle.json +2837 -37
  95. package/core/registry/mcp.json +5 -1
  96. package/core/registry/models.json +7 -1
  97. package/core/registry/package-templates/README.md +19 -0
  98. package/core/registry/package-templates/agent/files/agent.md +9 -0
  99. package/core/registry/package-templates/agent/template.json +4 -0
  100. package/core/registry/package-templates/capability-provider/files/provider.json +9 -0
  101. package/core/registry/package-templates/capability-provider/template.json +11 -0
  102. package/core/registry/package-templates/debate-preset/files/preset.json +26 -0
  103. package/core/registry/package-templates/debate-preset/template.json +4 -0
  104. package/core/registry/package-templates/review-preset/files/preset.json +30 -0
  105. package/core/registry/package-templates/review-preset/template.json +4 -0
  106. package/core/registry/package-templates/skill/files/SKILL.md +8 -0
  107. package/core/registry/package-templates/skill/template.json +4 -0
  108. package/core/registry/package-templates/worker/files/worker.json +92 -0
  109. package/core/registry/package-templates/worker/template.json +11 -0
  110. package/core/registry/packages/doflow/doflow-package.json +15 -0
  111. package/core/registry/packages/doflow/presets/debate-3.json +26 -0
  112. package/core/registry/protocols.json +61 -0
  113. package/core/registry/routes.json +17 -0
  114. package/core/registry/rules.json +431 -0
  115. package/core/registry/settings.json +276 -0
  116. package/core/registry/storage.json +701 -30
  117. package/core/registry/telemetry.json +236 -0
  118. package/core/registry/transcripts.json +142 -0
  119. package/core/registry/verification.json +76 -1
  120. package/core/registry/workflows.json +55 -0
  121. package/core/shared/agent-specs/core-implementer.md +3 -0
  122. package/core/shared/agent-specs/delivery-lead.md +68 -0
  123. package/core/shared/agent-specs/quality-guardian.md +5 -1
  124. package/core/shared/agent-specs/research-writer.md +10 -3
  125. package/core/shared/agent-specs/reviewer.md +53 -0
  126. package/core/shared/agent-specs/spec-analyst.md +5 -6
  127. package/core/shared/agent-specs/system-architect.md +5 -1
  128. package/core/shared/guidance/DOFLOW_CORE.md +1 -5
  129. package/core/shared/guidance/modes/MODE_DeepResearch.md +1 -1
  130. package/core/shared/guidance/modes/MODE_Orchestration.md +4 -3
  131. package/core/shared/guidance/modes/MODE_Task_Management.md +14 -14
  132. package/core/shared/guidance/pointers/codex.md +1 -4
  133. package/core/shared/guidance/references/ARTIFACT_FORMAT.md +30 -16
  134. package/core/shared/guidance/references/ARTIFACT_VOICE.md +3 -2
  135. package/core/shared/guidance/references/CONSTITUTION_BASE.md +17 -15
  136. package/core/shared/guidance/references/DIAGRAM_GUIDE.md +1 -1
  137. package/core/shared/guidance/references/DOFLOW_CHAIN.md +17 -19
  138. package/core/shared/guidance/references/EVIDENCE_LEDGER.md +7 -8
  139. package/core/shared/guidance/references/MODEL_SELECTION.md +5 -3
  140. package/core/shared/guidance/references/ORCHESTRATION.md +1 -2
  141. package/core/shared/guidance/rules/RULES.md +45 -0
  142. package/core/shared/scripts/doflow/bash/do-args.sh +37 -0
  143. package/core/shared/scripts/doflow/bash/do-exec-paths.sh +4 -0
  144. package/core/shared/scripts/doflow/bash/do-git-state.sh +15 -4
  145. package/core/shared/scripts/doflow/bash/do-parallel-check.sh +4 -0
  146. package/core/shared/scripts/doflow/bash/do-paths.sh +40 -2
  147. package/core/shared/scripts/doflow/bash/do-prereqs.sh +2 -1
  148. package/core/shared/scripts/doflow/bash/do-review-package.sh +4 -0
  149. package/core/shared/scripts/doflow/bash/do-task-brief.sh +58 -16
  150. package/core/shared/scripts/doflow/bash/render-audit.sh +26 -2
  151. package/core/shared/scripts/doflow/bash/render-diagrams.sh +1 -0
  152. package/core/shared/scripts/doflow/bash/render-puml.sh +2 -1
  153. package/core/shared/scripts/doflow/bash/validate-artifacts.sh +48 -4
  154. package/core/shared/scripts/doflow/bin/doflow-run +154 -35
  155. package/core/shared/skills/do/SKILL.md +12 -10
  156. package/core/shared/skills/do/references/advice_calls.md +26 -0
  157. package/core/shared/skills/do/references/pm_routing.md +1 -2
  158. package/core/shared/skills/do/references/program_mode.md +31 -0
  159. package/core/shared/skills/do-brainstorm/SKILL.md +20 -74
  160. package/core/shared/skills/do-brainstorm/references/handoff_branches.md +35 -0
  161. package/core/shared/skills/do-brainstorm/references/intent_seed.md +21 -0
  162. package/core/shared/skills/do-brainstorm/references/round_log.md +17 -0
  163. package/core/shared/skills/do-code-review/SKILL.md +41 -144
  164. package/core/shared/skills/do-code-review/content-types/markdown.md +24 -2
  165. package/core/shared/skills/do-code-review/references/tools.md +90 -0
  166. package/core/shared/skills/do-code-review/scripts/doc_quality_checker.py +549 -7
  167. package/core/shared/skills/do-design/SKILL.md +24 -23
  168. package/core/shared/skills/do-diagnose/SKILL.md +14 -4
  169. package/core/shared/skills/do-document/SKILL.md +11 -1
  170. package/core/shared/skills/do-document/references/deep_research.md +1 -2
  171. package/core/shared/skills/do-document/references/embedded-research.md +18 -6
  172. package/core/shared/skills/do-document/references/implementation-flow.md +5 -6
  173. package/core/shared/skills/do-execute-plan/SKILL.md +17 -59
  174. package/core/shared/skills/do-execute-plan/references/handoff_record.md +7 -2
  175. package/core/shared/skills/do-execute-plan/references/parallel_dispatch.md +13 -0
  176. package/core/shared/skills/do-execute-plan/references/readiness_gate.md +28 -1
  177. package/core/shared/skills/do-execute-plan/references/run_position.md +13 -1
  178. package/core/shared/skills/do-execute-plan/references/scaffold.md +17 -9
  179. package/core/shared/skills/do-execute-plan/references/state_checkpoint.md +11 -0
  180. package/core/shared/skills/do-execute-plan/references/task_attempts.md +78 -24
  181. package/core/shared/skills/do-flow/SKILL.md +8 -9
  182. package/core/shared/skills/do-flow/references/task_classes.md +2 -2
  183. package/core/shared/skills/do-git/SKILL.md +4 -0
  184. package/core/shared/skills/do-implement/SKILL.md +7 -9
  185. package/core/shared/skills/do-plan/SKILL.md +29 -19
  186. package/core/shared/skills/do-test/SKILL.md +7 -4
  187. package/core/shared/templates/doflow/constitution-template.md +9 -3
  188. package/core/shared/templates/doflow/data-model-template.md +1 -1
  189. package/core/shared/templates/doflow/design-template.md +113 -16
  190. package/core/shared/templates/doflow/plan-template.md +11 -10
  191. package/core/shared/templates/doflow/question-log-template.md +14 -2
  192. package/core/shared/templates/doflow/requirement-template.md +1 -1
  193. package/core/worker-evidence/antigravity/checks.json +14 -0
  194. package/core/worker-evidence/codex/2026-10-18-cli-check.json +107 -0
  195. package/core/worker-evidence/codex/2026-10-18-live-run-edit.json +73 -0
  196. package/core/worker-evidence/codex/2026-10-18-live-run-read-only.json +62 -0
  197. package/core/worker-evidence/codex/2026-10-24-cli-check.json +126 -0
  198. package/core/worker-evidence/codex/checks.json +38 -0
  199. package/package.json +10 -6
  200. package/src/adapters/antigravity/index.js +226 -113
  201. package/src/adapters/claude/index.js +39 -5
  202. package/src/adapters/codex/agents.js +25 -15
  203. package/src/adapters/codex/hooks.js +40 -5
  204. package/src/adapters/codex/index.js +100 -22
  205. package/src/adapters/codex/native-projection.js +6 -2
  206. package/src/adapters/copilot/index.js +58 -23
  207. package/src/adapters/copy-tree.js +294 -48
  208. package/src/adapters/guidance-manifest.js +71 -0
  209. package/src/adapters/guidance-pointer.js +19 -0
  210. package/src/adapters/hook-commands.js +6 -10
  211. package/src/adapters/index.js +1 -0
  212. package/src/adapters/kiro/index.js +38 -13
  213. package/src/adapters/opencode/index.js +8 -8
  214. package/src/adapters/pi/hooks.js +120 -0
  215. package/src/adapters/pi/index.js +48 -16
  216. package/src/adapters/resolve-source.js +26 -2
  217. package/src/cli/commands/install.js +3 -2
  218. package/src/cli/commands/reconcile.js +53 -9
  219. package/src/cli/commands/remove.js +2 -2
  220. package/src/cli/commands/rollback.js +6 -3
  221. package/src/cli/commands/self-update.js +18 -9
  222. package/src/cli/commands/status.js +21 -2
  223. package/src/cli/commands/ui.js +99 -0
  224. package/src/cli/commands/update.js +3 -2
  225. package/src/cli/index.js +338 -33
  226. package/src/cli/runtime-commands.js +243 -52
  227. package/src/cli/shared.js +0 -2
  228. package/src/helper/git.js +1 -1
  229. package/src/helper/guardrails.js +1 -1
  230. package/src/helper/marker-merge.js +31 -13
  231. package/src/helper/package-ids.js +37 -0
  232. package/src/helper/semver.js +94 -0
  233. package/src/install/backup.js +105 -15
  234. package/src/install/context.js +1 -1
  235. package/src/install/targets.js +31 -16
  236. package/src/lifecycle/coverage.js +74 -0
  237. package/src/lifecycle/hook-step.js +61 -0
  238. package/src/lifecycle/hook-tier.js +160 -0
  239. package/src/lifecycle/index.js +434 -86
  240. package/src/lifecycle/retired-harnesses.js +318 -0
  241. package/src/lifecycle/view.js +35 -15
  242. package/src/registry/index.js +686 -32
  243. package/src/registry/worker-ids.js +45 -0
  244. package/src/release/build-package.js +0 -3
  245. package/src/release/docs-blocks.js +492 -0
  246. package/src/release/preflight.js +425 -0
  247. package/src/release/rehearse.js +401 -0
  248. package/src/release/release-workflow.js +733 -0
  249. package/src/release/sync-plugin-versions.js +43 -7
  250. package/src/runtime/advice/bench-gate.js +25 -0
  251. package/src/runtime/advice/cli.js +59 -16
  252. package/src/runtime/advice/client.js +32 -9
  253. package/src/runtime/advice/config.js +98 -133
  254. package/src/runtime/advice/doctor.js +1 -1
  255. package/src/runtime/advice/elevation.js +97 -0
  256. package/src/runtime/advice/endpoint-guard.js +9 -3
  257. package/src/runtime/advice/mode.js +37 -0
  258. package/src/runtime/advice/record.js +18 -5
  259. package/src/runtime/advice/registry.js +4 -1
  260. package/src/runtime/advice/shadow-config.js +229 -0
  261. package/src/runtime/advice/shadow-dispatcher.js +276 -0
  262. package/src/runtime/brief-rules.js +81 -0
  263. package/src/runtime/brief-tools.js +111 -34
  264. package/src/runtime/candidate.js +514 -0
  265. package/src/runtime/capabilities/executor.js +450 -0
  266. package/src/runtime/capabilities/loopback.js +41 -0
  267. package/src/runtime/capabilities/sanitizer.js +88 -0
  268. package/src/runtime/capability-router.js +135 -3
  269. package/src/runtime/checkouts.js +73 -11
  270. package/src/runtime/claims.js +27 -12
  271. package/src/runtime/cli-result.js +11 -4
  272. package/src/runtime/cli.js +221 -277
  273. package/src/runtime/config-home.js +42 -0
  274. package/src/runtime/context/arbitrate.js +767 -0
  275. package/src/runtime/context/budget.js +203 -0
  276. package/src/runtime/context/compose.js +1367 -0
  277. package/src/runtime/context/delivery-store.js +100 -0
  278. package/src/runtime/context/emission-rules.js +118 -0
  279. package/src/runtime/context/identity.js +227 -0
  280. package/src/runtime/context/mandatory.js +594 -0
  281. package/src/runtime/context/pointer.js +142 -0
  282. package/src/runtime/context/primary-command.js +117 -0
  283. package/src/runtime/context/primary.js +344 -0
  284. package/src/runtime/context/summary-store.js +655 -0
  285. package/src/runtime/context-pack.js +1106 -245
  286. package/src/runtime/decision-register.js +13 -4
  287. package/src/runtime/dispatch/admission.js +392 -0
  288. package/src/runtime/dispatch/attempt-end.js +274 -0
  289. package/src/runtime/dispatch/command.js +628 -0
  290. package/src/runtime/dispatch/controls.js +904 -0
  291. package/src/runtime/dispatch/envelope.js +276 -0
  292. package/src/runtime/dispatch/grants.js +310 -0
  293. package/src/runtime/dispatch/integrate.js +617 -0
  294. package/src/runtime/dispatch/loop.js +1835 -0
  295. package/src/runtime/dispatch/store.js +352 -0
  296. package/src/runtime/dispatch/verify-run.js +201 -0
  297. package/src/runtime/evidence-fields.js +39 -0
  298. package/src/runtime/evidence-ledger.js +41 -7
  299. package/src/runtime/failure/capture.js +3 -1
  300. package/src/runtime/failure/cli.js +25 -9
  301. package/src/runtime/failure/home.js +57 -30
  302. package/src/runtime/failure/store.js +7 -2
  303. package/src/runtime/feature-pointer.js +174 -0
  304. package/src/runtime/feature-resolve.js +13 -2
  305. package/src/runtime/fleet/command.js +77 -0
  306. package/src/runtime/fleet/projects.js +178 -0
  307. package/src/runtime/fleet/tree.js +383 -0
  308. package/src/runtime/freshness.js +77 -10
  309. package/src/runtime/git-memo.js +46 -0
  310. package/src/runtime/guidance/ablation.js +427 -0
  311. package/src/runtime/health.js +565 -17
  312. package/src/runtime/history-compactor.js +13 -3
  313. package/src/runtime/implementation-gate.js +277 -22
  314. package/src/runtime/inventory/coverage.js +1 -1
  315. package/src/runtime/inventory/index.js +1 -1
  316. package/src/runtime/inventory/precedence.js +2 -2
  317. package/src/runtime/inventory/siblings.js +6 -4
  318. package/src/runtime/knowledge/code-corpus.js +277 -0
  319. package/src/runtime/knowledge/code-lexical.js +130 -0
  320. package/src/runtime/knowledge/code-retrieval.js +307 -0
  321. package/src/runtime/knowledge/code-validation.js +106 -0
  322. package/src/runtime/knowledge/gp3-gate.js +74 -0
  323. package/src/runtime/knowledge/graph-adapter.js +288 -0
  324. package/src/runtime/knowledge/graph-fallback.js +394 -0
  325. package/src/runtime/knowledge/hybrid.js +136 -8
  326. package/src/runtime/knowledge/retrieval.js +34 -1
  327. package/src/runtime/knowledge/rtk-compress.js +77 -0
  328. package/src/runtime/knowledge/semble-bridge.py +106 -0
  329. package/src/runtime/knowledge/semble-lifecycle.js +114 -0
  330. package/src/runtime/knowledge/semble-provider.js +365 -0
  331. package/src/runtime/lifecycle/cli.js +16 -6
  332. package/src/runtime/lifecycle/event-store.js +8 -6
  333. package/src/runtime/lifecycle/followup.js +6 -1
  334. package/src/runtime/lifecycle/overview.js +24 -1
  335. package/src/runtime/lifecycle/report-store.js +8 -10
  336. package/src/runtime/lifecycle/retention.js +95 -31
  337. package/src/runtime/lifecycle/root.js +9 -1
  338. package/src/runtime/lifecycle/status.js +34 -17
  339. package/src/runtime/lifecycle/store-upkeep.js +56 -7
  340. package/src/runtime/mask.js +134 -7
  341. package/src/runtime/mcp-consultations.js +40 -6
  342. package/src/runtime/model-router.js +79 -7
  343. package/src/runtime/models/catalogue.js +191 -0
  344. package/src/runtime/models/command.js +153 -0
  345. package/src/runtime/off-words.js +12 -0
  346. package/src/runtime/outcome.js +3 -3
  347. package/src/runtime/packages/command.js +1009 -0
  348. package/src/runtime/packages/contributions.js +116 -0
  349. package/src/runtime/packages/digest.js +132 -0
  350. package/src/runtime/packages/fetch.js +182 -0
  351. package/src/runtime/packages/grants.js +192 -0
  352. package/src/runtime/packages/index-file.js +134 -0
  353. package/src/runtime/packages/instruction.js +90 -0
  354. package/src/runtime/packages/manifest.js +331 -0
  355. package/src/runtime/packages/points.js +477 -0
  356. package/src/runtime/packages/programs.js +216 -0
  357. package/src/runtime/packages/scaffold.js +277 -0
  358. package/src/runtime/packages/source.js +90 -0
  359. package/src/runtime/packages/state.js +164 -0
  360. package/src/runtime/packages/store.js +449 -0
  361. package/src/runtime/packages/tar.js +106 -0
  362. package/src/runtime/packages/view.js +406 -0
  363. package/src/runtime/plan-check.js +59 -0
  364. package/src/runtime/plan-content.js +324 -0
  365. package/src/runtime/policy-init.js +118 -0
  366. package/src/runtime/profiles/doctor.js +96 -0
  367. package/src/runtime/profiles/resolve.js +244 -0
  368. package/src/runtime/profiles/rollback.js +254 -0
  369. package/src/runtime/profiles/sampler.js +41 -0
  370. package/src/runtime/readiness-record.js +16 -11
  371. package/src/runtime/readiness.js +127 -16
  372. package/src/runtime/research-request.js +50 -25
  373. package/src/runtime/retrieval-plan.js +402 -73
  374. package/src/runtime/retrieval-record.js +293 -0
  375. package/src/runtime/review/command.js +246 -0
  376. package/src/runtime/review/dominance.js +68 -0
  377. package/src/runtime/review/findings.js +434 -0
  378. package/src/runtime/review/identity.js +255 -0
  379. package/src/runtime/review/protocol-command.js +109 -0
  380. package/src/runtime/review/protocols.js +405 -0
  381. package/src/runtime/review/resolve-protocol.js +302 -0
  382. package/src/runtime/review/start.js +530 -0
  383. package/src/runtime/roadmap/facts.js +479 -0
  384. package/src/runtime/roadmap/gates.js +270 -0
  385. package/src/runtime/roadmap/loop.js +1636 -0
  386. package/src/runtime/roadmap/merge.js +381 -0
  387. package/src/runtime/roadmap/rows.js +1113 -0
  388. package/src/runtime/roadmap/seed.js +951 -0
  389. package/src/runtime/rules-report.js +336 -0
  390. package/src/runtime/scaffold/artifacts.js +63 -9
  391. package/src/runtime/scaffold/generate.js +21 -9
  392. package/src/runtime/settings/autopilot.js +106 -0
  393. package/src/runtime/settings/cli.js +280 -0
  394. package/src/runtime/settings/config-write.js +314 -0
  395. package/src/runtime/settings/files.js +271 -0
  396. package/src/runtime/settings/legacy.js +154 -0
  397. package/src/runtime/settings/lexical.js +56 -0
  398. package/src/runtime/settings/prepared-run.js +269 -0
  399. package/src/runtime/settings/project-layers.js +118 -0
  400. package/src/runtime/settings/refs.js +288 -0
  401. package/src/runtime/settings/registry.js +553 -0
  402. package/src/runtime/settings/resolve.js +713 -0
  403. package/src/runtime/settings/shared.js +37 -0
  404. package/src/runtime/settings/worker-billing.js +107 -0
  405. package/src/runtime/settings/write.js +269 -0
  406. package/src/runtime/slot-command.js +78 -0
  407. package/src/runtime/slots.js +671 -0
  408. package/src/runtime/source-version.js +290 -0
  409. package/src/runtime/state-root.js +217 -0
  410. package/src/runtime/storage/cli.js +12 -5
  411. package/src/runtime/storage/engine.js +9 -2
  412. package/src/runtime/storage/registry.js +14 -1
  413. package/src/runtime/storage/roots.js +66 -16
  414. package/src/runtime/storage/rules.js +82 -10
  415. package/src/runtime/storage/upkeep.js +10 -2
  416. package/src/runtime/storage/work-status.js +245 -26
  417. package/src/runtime/task-attempts.js +589 -69
  418. package/src/runtime/task-classifier.js +47 -11
  419. package/src/runtime/task-graph.js +373 -0
  420. package/src/runtime/task-run.js +778 -0
  421. package/src/runtime/task-scope.js +202 -56
  422. package/src/runtime/task-sources.js +147 -0
  423. package/src/runtime/task-state.js +440 -65
  424. package/src/runtime/team/admission.js +301 -0
  425. package/src/runtime/team/envelope.js +324 -0
  426. package/src/runtime/team/review-guard.js +156 -0
  427. package/src/runtime/trace/analyze.js +427 -0
  428. package/src/runtime/trace/baseline.js +770 -0
  429. package/src/runtime/trace/ledger.js +63 -140
  430. package/src/runtime/trace/otlp-export.js +568 -0
  431. package/src/runtime/trace/otlp-map.js +481 -0
  432. package/src/runtime/trace/spans.js +745 -0
  433. package/src/runtime/trace/telemetry.js +225 -0
  434. package/src/runtime/trace/views.js +1 -0
  435. package/src/runtime/transcripts/command.js +98 -0
  436. package/src/runtime/transcripts/cursor.js +326 -0
  437. package/src/runtime/transcripts/read.js +126 -0
  438. package/src/runtime/transcripts/readers/claude-jsonl.js +74 -0
  439. package/src/runtime/transcripts/readers/codex-rollout.js +70 -0
  440. package/src/runtime/transcripts/readers/copilot-events.js +90 -0
  441. package/src/runtime/transcripts/readers/kiro-jsonl.js +77 -0
  442. package/src/runtime/transcripts/readers/pi-jsonl.js +59 -0
  443. package/src/runtime/transcripts/registry.js +161 -0
  444. package/src/runtime/transcripts/stats.js +161 -0
  445. package/src/runtime/verification/check-key.js +628 -0
  446. package/src/runtime/verification/contract-runner.js +546 -11
  447. package/src/runtime/verification/engine.js +499 -9
  448. package/src/runtime/verification/impact.js +617 -0
  449. package/src/runtime/verification/inflight.js +205 -0
  450. package/src/runtime/verification/registry.js +176 -0
  451. package/src/runtime/verification/reuse.js +184 -0
  452. package/src/runtime/verification/telemetry-emit.js +254 -0
  453. package/src/runtime/verification/test-selection.js +67 -7
  454. package/src/runtime/worker/active.js +90 -0
  455. package/src/runtime/worker/cancel.js +222 -0
  456. package/src/runtime/worker/catalogue.js +122 -0
  457. package/src/runtime/worker/command.js +677 -0
  458. package/src/runtime/worker/evidence.js +288 -0
  459. package/src/runtime/worker/launch.js +288 -0
  460. package/src/runtime/worker/models.js +137 -0
  461. package/src/runtime/worker/parsers.js +218 -0
  462. package/src/runtime/worker/probes/index.js +706 -0
  463. package/src/runtime/worker/process-tree.js +415 -0
  464. package/src/runtime/worker/quota.js +43 -0
  465. package/src/runtime/worker/readiness.js +713 -0
  466. package/src/runtime/worker/run-store.js +166 -0
  467. package/src/runtime/worker/supervisor.js +541 -0
  468. package/src/runtime/worker/worktree-check.js +252 -0
  469. package/src/runtime/workflow-engine.js +5 -1
  470. package/src/runtime/workflow-orchestrator.js +578 -63
  471. package/src/runtime/worktree.js +149 -22
  472. package/src/state/index.js +1 -1
  473. package/src/state/lockfile.js +64 -10
  474. package/src/state/run-lock.js +1 -1
  475. package/types/node-commonjs.d.ts +106 -7
  476. package/core/.antigravity-plugin/hooks.json +0 -39
  477. package/core/harnesses/gemini/hooks/hooks.json +0 -77
  478. package/core/harnesses/gemini/hooks/lib.sh +0 -302
  479. package/core/harnesses/gemini/hooks/mcp-tool-guard.sh +0 -21
  480. package/core/harnesses/gemini/hooks/post-edit-lint.sh +0 -39
  481. package/core/harnesses/gemini/hooks/pre-bash-guard.sh +0 -21
  482. package/core/harnesses/gemini/hooks/pre-compact.sh +0 -38
  483. package/core/harnesses/gemini/hooks/pre-implement-gate.sh +0 -22
  484. package/core/harnesses/gemini/hooks/session-end.impl.sh +0 -89
  485. package/core/harnesses/gemini/hooks/session-end.sh +0 -5
  486. package/core/harnesses/gemini/hooks/session-start.sh +0 -5
  487. package/core/harnesses/gemini/settings/adapter-defaults.json +0 -4
  488. package/core/harnesses/shared/hooks/adapters/arg-fields.js +0 -19
  489. package/core/harnesses/shared/hooks/adapters/gemini.js +0 -114
  490. package/core/harnesses/shared/hooks/hooks.json +0 -47
  491. package/core/shared/guidance/FLAGS.md +0 -25
  492. package/core/shared/guidance/rules/RULE_01_SAFETY.md +0 -25
  493. package/core/shared/guidance/rules/RULE_02_WORKFLOW.md +0 -23
  494. package/core/shared/guidance/rules/RULE_03_QUALITY.md +0 -14
  495. package/core/shared/guidance/rules/RULE_04_QUESTIONS.md +0 -46
  496. package/src/adapters/gemini/hooks.js +0 -210
  497. package/src/adapters/gemini/index.js +0 -390
package/src/cli/index.js CHANGED
@@ -2,7 +2,7 @@
2
2
  // doflow CLI — argument parsing, the installer command table, and dispatch.
3
3
  //
4
4
  // bin/doflow.js is only a forwarder into main() here. This module owns: parseArgs (verbatim from
5
- // the pre-extraction monolith), the ONE table mapping the nine installer command names to their
5
+ // the pre-extraction monolith), the ONE table mapping the ten installer command names to their
6
6
  // handlers under commands/, and the runtime verbs' forwarding via ./runtime-commands — whose
7
7
  // implementations stay one-per-module in src/runtime/. Adding an installer command means a new
8
8
  // file in src/cli/commands/, an entry in COMMANDS, and an edit to test/guards/cli-boundary.test.js,
@@ -12,10 +12,11 @@ const {
12
12
  handleCapabilitiesCommand, handleReadinessCommand, handleEvidenceCommand,
13
13
  EVIDENCE_SCORE_FIELDS, scoreFieldRefusal,
14
14
  } = require('../runtime/cli.js');
15
- const { pkg } = require('./shared.js');
15
+ const { pkg, REPO_ROOT } = require('./shared.js');
16
16
  const { VALID: VALID_TARGETS, DEFAULT_TARGETS } = require('../install/targets.js');
17
17
  const { dispatchRuntimeCommand } = require('./runtime-commands.js');
18
18
  const { usageError } = require('../runtime/cli-result.js');
19
+ const { printSafe } = require('../runtime/mask.js');
19
20
 
20
21
  const cmdInstall = require('./commands/install.js');
21
22
  const cmdUpdate = require('./commands/update.js');
@@ -26,6 +27,7 @@ const cmdTools = require('./commands/tools.js');
26
27
  const cmdListBackups = require('./commands/list-backups.js');
27
28
  const cmdRollback = require('./commands/rollback.js');
28
29
  const cmdSelfUpdate = require('./commands/self-update.js');
30
+ const cmdUi = require('./commands/ui.js');
29
31
 
30
32
  /** The installer command surface, written down once. The runtime verbs are dispatched separately
31
33
  * (see ./runtime-commands) because their namespace is owned by the doflow-run verb table. */
@@ -39,6 +41,8 @@ const COMMANDS = {
39
41
  'list-backups': cmdListBackups,
40
42
  rollback: cmdRollback,
41
43
  'self-update': cmdSelfUpdate,
44
+ // The launcher takes the core root as an argument so it loads nothing but three built-ins (092 IC-008).
45
+ ui: (o ) => cmdUi(o, REPO_ROOT),
42
46
  };
43
47
 
44
48
  /** "skip all backup protection" must be an explicit, deliberate choice, never a default combo. */
@@ -51,26 +55,62 @@ function assertNoBackupRequiresForce(o ) {
51
55
 
52
56
  function parseArgs(argv ) {
53
57
  const o = { cmd: null, positional: [], targets: [], mcp: null, dryRun: false, force: false, adopt: false,
58
+ otlpHttp: false,
54
59
  noBackup: false, prune: null, global: false, json: false, help: false, version: false,
55
60
  tools: null, action: 'status', days: null, slug: null,
56
61
  // Explicitly null, not absent. `handleReadinessCommand` declares defaults of `'feature'` and
57
62
  // `'default'`, and a JavaScript default parameter fires on `undefined` — so an *absent* key
58
63
  // silently reinstated exactly the identity defect readiness.ts fixed by failing closed.
59
- taskClass: null, taskId: null };
64
+ taskClass: null, taskId: null,
65
+ flagsGiven: [] };
60
66
  for (let i = 0; i < argv.length; i++) {
61
67
  const a = argv[i];
62
- switch (a) {
68
+ if (a.startsWith('-')) o.flagsGiven.push(a);
69
+ // `--commit` is the roadmap verb's own flag: anywhere else it must reach the default branch and get
70
+ // that verb's unknown-flag answer, as it did before it was added. '' matches no case.
71
+ switch (a === '--commit' && o.cmd !== 'roadmap' ? '' : a) {
63
72
  case '-h': case '--help': o.help = true; break;
64
- case '-v': case '--version': o.version = true; break;
73
+ case '-v': o.version = true; break;
74
+ case '--version':
75
+ if (o.cmd === 'package' && argv[i + 1] !== undefined && !argv[i + 1].startsWith('-')) {
76
+ o.packageVersion = argv[++i];
77
+ } else o.version = true;
78
+ break;
65
79
  case '-n': case '--dry-run': o.dryRun = true; break;
80
+ case '--otlp-http': o.otlpHttp = true; break;
66
81
  case '-f': case '--force': o.force = true; break;
67
82
  case '--adopt': o.adopt = true; break;
83
+ // task-attempt --action cancel (run): a switch, so it cannot go through parseRuntimeFlag,
84
+ // which reads only flags that take a value (IC-017).
85
+ case '--adopt-unowned': o.adoptUnowned = true; break;
86
+ // worker --action run: wait for the run to end. A switch, like --adopt-unowned (081 IC-026).
87
+ case '--wait': o.wait = true; break;
88
+ // slot --action run: refuse at once instead of queueing (115 IC-008). A switch, so key `noWait`.
89
+ case '--no-wait': o.noWait = true; break;
90
+ // slot --action run -- <command> [args...]: everything after the first `--` is the command's
91
+ // own argv, never parsed here (115 IC-008). Any other verb still refuses a bare `--` below.
92
+ case '--':
93
+ if (o.cmd === 'slot') { o.slotCommand = argv.slice(i + 1); i = argv.length; break; }
94
+ if (o.cmd === 'plan-check') break;
95
+ console.error(unknownFlagMessage(a)); process.exit(unknownFlagExit(o.cmd));
96
+ break;
97
+ // worker --action run|describe|select: the isolated-edit recipe and baseline (082 IC-014).
98
+ case '--edit': o.edit = true; break;
68
99
  case '-g': case '--global': o.global = true; break;
69
100
  case '--no-backup': o.noBackup = true; break;
70
101
  case '--permissions': o.permissions = true; break;
71
102
  case '--statusline': o.statusline = true; break;
72
103
  case '--json': o.json = true; break;
104
+ case '--show-origin': o.showOrigin = true; break;
105
+ case '--bare': o.bare = true; break;
106
+ case '--no-record': o.noRecord = true; break;
107
+ // context-emit: decide and render without taking a claim or writing a ledger line.
108
+ case '--peek': o.peek = true; break;
73
109
  case '--check': o.check = true; break;
110
+ // roadmap --action init-policy: commit the policy onto local develop by plumbing instead of only writing it.
111
+ case '--commit': o.commit = true; break;
112
+ // package --action verify: rewrite an unreadable state.json (never widens, 122 IC-009).
113
+ case '--repair': o.repair = true; break;
74
114
  // decision --action list: every decision by id, not just the live ones.
75
115
  case '--all': o.all = true; break;
76
116
  // lifecycle --action overview: the /do maintain view, with a larger list and a pending count.
@@ -82,6 +122,8 @@ function parseArgs(argv ) {
82
122
  // advise --action configure: these are deliberately presence-only switches.
83
123
  case '--off': o.off = true; break;
84
124
  case '--project': o.project = true; break;
125
+ // evidence --action retire: retire every item the ledger classes stale.
126
+ case '--stale': o.stale = true; break;
85
127
  // goal --action check: record the item as not met (evidence is still required, as the reason).
86
128
  case '--unmet': o.unmet = true; break;
87
129
  // goal --action link: move a feature that already serves another goal.
@@ -107,12 +149,13 @@ function parseArgs(argv ) {
107
149
  }
108
150
  case '--action': {
109
151
  const val = argv[i + 1];
110
- if (val === undefined || val.startsWith('-')) { console.error(`doflow: ${a} requires a value`); process.exit(1); }
152
+ // `review`, `protocol`, `config`, `primary` and `package` answer a missing value as usage, exit 2; other verbs keep exit 1.
153
+ if (val === undefined || val.startsWith('-')) { console.error(`doflow: ${a} requires a value`); process.exit(o.cmd === 'review' || o.cmd === 'protocol' || o.cmd === 'config' || o.cmd === 'primary' || o.cmd === 'fleet' || o.cmd === 'transcript' || o.cmd === 'package' ? 2 : 1); }
111
154
  o.action = val; o.actionGiven = true; i++; break;
112
155
  }
113
156
  case '--task-class': {
114
157
  const val = argv[i + 1];
115
- if (val === undefined || val.startsWith('-')) { console.error(`doflow: ${a} requires a value`); process.exit(1); }
158
+ if (val === undefined || val.startsWith('-')) { console.error(`doflow: ${a} requires a value`); process.exit(o.cmd === 'protocol' || o.cmd === 'rules' ? 2 : 1); }
116
159
  o.taskClass = val; i++; break;
117
160
  }
118
161
  case '--task-id': {
@@ -136,6 +179,7 @@ function parseArgs(argv ) {
136
179
  o.node = val; i++; break;
137
180
  }
138
181
  case '--forced': o.forced = true; break;
182
+ case '--absence': o.absence = true; break;
139
183
  case '--decision': {
140
184
  const val = argv[i + 1];
141
185
  if (val === undefined || val.startsWith('-')) { console.error(`doflow: ${a} requires a value`); process.exit(1); }
@@ -190,20 +234,45 @@ function parseArgs(argv ) {
190
234
  // its validation subtly wrong.
191
235
  const runtime = parseRuntimeFlag(a, argv, i, o);
192
236
  if (runtime !== null) { i = runtime; break; }
193
- if (a.startsWith('-')) { console.error(`doflow: unknown flag '${a}'`); process.exit(1); }
237
+ // slot, primary, fleet and transcript report an unknown flag as their own usage error (exit 2, 115 IC-008, 120 IC-008).
238
+ if (a.startsWith('-') && (o.cmd === 'slot' || o.cmd === 'primary' || o.cmd === 'fleet' || o.cmd === 'transcript')) (o.extraFlags = o.extraFlags || []).push(a);
239
+ else if (a.startsWith('-') && o.cmd !== 'plan-check') { console.error(unknownFlagMessage(a)); process.exit(unknownFlagExit(o.cmd)); }
194
240
  else if (!o.cmd) o.cmd = a;
195
241
  else o.positional.push(a);
196
242
  }
197
243
  }
198
244
  }
245
+ if (o.cmd === 'plan-check') o.extraFlags = o.flagsGiven;
199
246
  return o;
200
247
  }
201
248
 
249
+ /** Verbs that answer an unrecognised flag as a usage error (exit 2); every other verb keeps exit 1. */
250
+ function unknownFlagExit(cmd ) {
251
+ return cmd === 'protocol' || cmd === 'config' || cmd === 'rules' || cmd === 'review' ? 2 : 1;
252
+ }
253
+
254
+ /** Longest part of an unrecognised argument echoed back; the rest is cut and marked. */
255
+ const UNKNOWN_FLAG_ECHO_CHARS = 80;
256
+
257
+ /** The unknown-flag error: the argument is untrusted text, so it is made print-safe (no control
258
+ * characters, one line) and cut to a bounded length (FU-8eqytg). */
259
+ function unknownFlagMessage(arg ) {
260
+ const safe = printSafe(String(arg));
261
+ const shown = safe.length > UNKNOWN_FLAG_ECHO_CHARS ? `${safe.slice(0, UNKNOWN_FLAG_ECHO_CHARS)}...` : safe;
262
+ return `doflow: unknown flag '${shown}'`;
263
+ }
264
+
202
265
  /** Single-value arguments of the runtime verbs → the option key each one writes. */
203
266
  const RUNTIME_STRING_FLAGS = new Map([
204
267
  // `scaffold`. The resolver's own ambiguous-feature error tells the caller to "re-run with
205
268
  // --slug=<chosen>"; without this flag that hint would name an argument this CLI rejects.
206
269
  ['--slug', 'slug'],
270
+ ['--listen-address', 'listenAddress'], // ui: explicit private interface for TLS phone access
271
+ ['--tls-cert', 'tlsCert'], // ui: absolute PEM certificate chain
272
+ ['--tls-key', 'tlsKey'], // ui: absolute PEM private key
273
+ // `--reason <text>` is parsed by its own case above; this entry is the `--reason=<text>` spelling
274
+ // of the same flag (FU-8eqytg), so the two forms mean the same on every verb that accepts it.
275
+ ['--reason', 'reason'],
207
276
  ['--rationale', 'rationale'], // classify: why this class was proposed · decision --action add: why it was decided
208
277
  ['--request', 'request'], // classify: request text for an advisory second opinion
209
278
  ['--request-file', 'requestFile'], // classify: request text read from a file
@@ -213,6 +282,7 @@ const RUNTIME_STRING_FLAGS = new Map([
213
282
  ['--supersedes', 'supersedes'], // comma-separated DEC-### ids this decision replaces
214
283
  ['--refs', 'refs'], // comma-separated ids the decision touches, e.g. FR-001,IC-002
215
284
  ['--source', 'source'], // where the decision was stated, e.g. design/design-02-question.md#question-1
285
+ ['--index', 'index'], // package add: local pinned package index
216
286
  // followup and lifecycle (feature 046). `--statement`, `--stage`, `--slug`, `--batch`, `--reason`,
217
287
  // `--channel`, `--state`, `--source`, `--intent`, `--task-class` and `--task-id` above are shared.
218
288
  ['--ids', 'ids'], // followup: comma-separated FU-xxxxxx ids to take, settle or promote
@@ -258,6 +328,21 @@ const RUNTIME_STRING_FLAGS = new Map([
258
328
  // change scope, <path>[,<path>...], unioned with the plan's bound
259
329
  ['--invariants', 'invariants'], // readiness: the invariants a refactor must preserve
260
330
  ['--objective', 'objective'], // context-pack
331
+ ['--mandatory-file', 'mandatoryFile'], // context-pack: caller-supplied mandatory fields
332
+ ['--max-bytes', 'maxBytes'], // context-pack: per-call cap in bytes
333
+ ['--expand', 'expand'], // context-pack: pointer id to expand
334
+ // 078 context-emit (IC-005). Identity is read from the environment only; no flag sets it.
335
+ ['--event', 'event'], // context-emit: launch | prompt | delta
336
+ ['--cwd', 'cwd'], // context-emit: the working directory the emission is for
337
+ ['--session', 'session'], // context-emit: the harness session id
338
+ ['--nudge', 'nudge'], // context-emit: nudge | suppress | none
339
+ // 078 context-grant (IC-013). `--max-bytes` above is shared.
340
+ ['--summary', 'summary'], // context-grant: a summary id, or pending
341
+ ['--to-run', 'toRun'], // context-grant: the recipient run id
342
+ ['--to-lineage', 'toLineage'], // context-grant: the recipient lineage id
343
+ ['--from-worktree', 'fromWorktree'], // context-grant: source scope worktree (default DOFLOW_WORKTREE or cwd)
344
+ ['--from-run', 'fromRun'], // context-grant: source scope run (default DOFLOW_RUN_ID or local)
345
+ ['--from-lineage', 'fromLineage'], // context-grant: source scope lineage (default DOFLOW_LINEAGE_ID or main)
261
346
  ['--stage-id', 'stageId'], // research-request: active feature stage
262
347
  ['--question', 'question'], // research-request: external question
263
348
  ['--blocking', 'blocking'], // research-request: true | false
@@ -266,6 +351,7 @@ const RUNTIME_STRING_FLAGS = new Map([
266
351
  ['--gap', 'gap'], // research-request: unresolved reason
267
352
  ['--stage', 'stage'], // retrieval-plan: the stage id declaring the plan;
268
353
  // outcome: the stage writing it, refused unless terminal
354
+ ['--status', 'attemptStatus'], // retrieval-plan: attempt status (EMPTY|UNREACHED|UNVERIFIED)
269
355
  ['--state', 'state'], // outcome: the terminal state being recorded
270
356
  ['--result', 'result'], // orchestrate complete-stage: the stage's own outcome, passed | failed (omit → unverified)
271
357
  // outcome: the verdicts the run saw, stated by it and validated against the vocabulary the
@@ -281,6 +367,11 @@ const RUNTIME_STRING_FLAGS = new Map([
281
367
  ['--owner', 'owner'], // brief-tools: the agent type the brief is for
282
368
  ['--tier', 'tier'], // brief-tools: the task line's tier (light | standard | frontier)
283
369
  ['--harness', 'harness'], // brief-tools: the harness the brief is for
370
+ ['--policy', 'policy'], // enforcement: lifecycle policy id
371
+ ['--profile', 'profile'], // enforcement profile; retrieve --scope code: lexical-only|hybrid
372
+ ['--root', 'root'], // retrieve --scope code: project root (never harness-home)
373
+ ['--index-action', 'indexAction'], // retrieve --scope code: explicit build|refresh
374
+ ['--model-path', 'modelPath'], // retrieve --scope code: verified existing local Semble model
284
375
  ['--heading-level', 'headingLevel'], // brief-tools: 2 (default) or 3
285
376
  ['--tasks', 'tasks'], // brief-tools: comma-separated plan task ids for tier advice
286
377
  ['--plan-path', 'planPath'], // verify: a feature plan.md whose doflow-verification
@@ -289,10 +380,64 @@ const RUNTIME_STRING_FLAGS = new Map([
289
380
  ['--verification-input', 'verificationInput'], // verify: manifest JSON file for explicit structuralChecks/requirements (IC-022)
290
381
  ['--verification-phase', 'verificationPhase'], // verify: postimplementation (IC-022)
291
382
  ['--baseline-ref', 'baselineRef'], // verify: explicit ancestor commit or ref to measure change against (IC-022)
383
+ ['--base', 'base'], // review --action start: the commit or ref the changed paths are measured from (095b IC-001)
384
+ ['--preset', 'preset'], // review --action start: a review preset id to run with, never looser than the decided one (119 IC-005)
385
+ ['--layer', 'layer'], // config validate|set|unset: user | project | local, checked in handleConfigCommand (119 IC-008)
386
+ ['--prepared-run', 'preparedRun'], // config validate: a prepared-run file to check, writes nothing (119 IC-010)
292
387
  ['--error', 'errorMessage'], // recover: the failure text to classify
293
388
  ['--agent', 'agent'], // recover: which agent produced the failure
294
389
  ['--task', 'task'], // task-attempt: the plan task id, e.g. A.1
295
390
  ['--token', 'token'], // task-attempt finish|release: the fencing token claim returned
391
+ // 080 task-attempt (IC-017). Read as text and validated in handleTaskAttemptCommand, so an
392
+ // integer is digits only (`5abc` and `-1` are usage) rather than what parseInt makes of it.
393
+ ['--owner-override', 'ownerOverride'], // claim: why someone other than the declared owner takes the task
394
+ ['--epoch', 'epoch'], // claim: the run epoch the caller was handed
395
+ ['--reserve-tokens', 'reserveTokens'], // claim: tokens held against the run's budget while active
396
+ ['--exec-worktree', 'execWorktree'], // claim: the worktree the attempt executes in
397
+ ['--tokens', 'tokens'], // finish|release|report-usage: tokens the attempt used, as reported
398
+ ['--tokens-basis', 'tokensBasis'], // finish|release|report-usage: measured | estimated
399
+ ['--budget-attempts', 'budgetAttempts'], // start: the run's attempt limit
400
+ ['--budget-tokens', 'budgetTokens'], // start: the run's token limit
401
+ ['--by', 'by'], // start|pause|cancel|reopen|resume: who acts on the run
402
+ ['--ack', 'ack'], // resume: the digest the unacknowledged resume reported
403
+ // 081 worker (IC-025, IC-026). Read as text and validated in handleWorkerCommand.
404
+ // `--need`, `--harness`, `--budget-tokens`, `--task`, `--token`, `--by` and `--reason` are shared.
405
+ ['--prompt-file', 'promptFile'], // worker run: the brief the worker receives
406
+ ['--timeout-seconds', 'timeoutSeconds'], // worker run: 1 to 14400
407
+ ['--worker-run', 'workerRun'], // worker status|cancel: a w-<12 hex> run id
408
+ ['--checks', 'checks'], // worker evidence: checks file
409
+ ['--out', 'out'], // worker evidence: output record path
410
+ ['--model-check', 'modelCheck'], // worker probe: a declared model-check id
411
+ // 082 dispatch (IC-001, IC-038) and worker --child-of (IC-015). Read as text and validated in
412
+ // executeDispatchCommand / handleWorkerCommand. `--slug`, `--by`, `--reason`, `--mode`,
413
+ // `--reserve-tokens`, `--budget-attempts`, `--budget-tokens`, `--harness`, `--need`, `--status`,
414
+ // `--summary`, `--tokens`, `--tokens-basis`, `--prompt-file`, `--request-id`, `--task`, `--token`,
415
+ // `--ack`, `--request` and `--exec-worktree` are shared.
416
+ ['--concurrency', 'concurrency'], // dispatch start: 1 to 4
417
+ ['--billing-cap', 'billingCap'], // dispatch start: free-only worker billing ceiling
418
+ ['--fallback', 'fallback'], // dispatch start|resume: quota fallback mode off | ask | auto (106 IC-005)
419
+ ['--ladder', 'ladder'], // dispatch start: worker rungs, comma-separated harness ids (106 IC-005)
420
+ ['--verify-argv', 'verifyArgv'], // dispatch start: the verification argv as a JSON array
421
+ ['--verify-seconds', 'verifySeconds'], // dispatch start: 1 to 14400
422
+ ['--attempt-seconds', 'attemptSeconds'], // dispatch start: 1 to 14280
423
+ ['--max-seconds', 'maxSeconds'], // dispatch run: 1 to 14400
424
+ ['--spawn-grant', 'spawnGrant'], // dispatch start: the spawn grant declaration as JSON
425
+ ['--dispatch', 'dispatch'], // dispatch submit: a d-<12 hex> dispatch id
426
+ ['--child-of', 'childOf'], // worker run: the granter's w-<12 hex> run id
427
+ ['--run', 'run'], // trace spans, trace analyze, trace export: keep one run key or run id (088 IC-011, 091 IC-001, 091 IC-006)
428
+ ['--emit', 'emit'], // trace analyze: print a batch for an existing verb, evidence | followups (091 IC-001)
429
+ ['--row', 'row'], // roadmap: restricts the step to one in-flight row (108 IC-001)
430
+ ['--draft', 'draft'], // roadmap seed: the draft file to check, apply or amend (113 IC-001)
431
+ ['--id', 'id'], // package --action list|show|update: the package id
432
+ ['--plan', 'planId'], // package --action add|update: apply the plan file with this 16-hex plan id (122 IC-006)
433
+ ['--points', 'points'], // package --action new: point[:local] entries, comma-separated
434
+ ['--dir', 'dir'], // package --action new: authored package target directory
435
+ ['--name', 'name'], // slot: the slot's name, 1 to 64 characters of a-z, 0-9 and - (115 IC-008)
436
+ ['--label', 'label'], // slot --action run: the holder's label, at most 80 characters (115 IC-008)
437
+ ['--cursor', 'cursor'], // transcript --action read: the cursor an earlier read returned (093 IC-022)
438
+ ['--limit', 'limit'], // transcript --action read: at most this many events, validated in the verb (093 IC-022)
439
+ ['--window', 'window'], // transcript --action stats: minutes, 1 to 60, validated in the verb (093 IC-023)
440
+ ['--port', 'port'], // ui: the Console's port, 0 to 65535, checked in commands/ui.ts (092 IC-008)
296
441
  ]);
297
442
 
298
443
  /** Repeatable arguments — each occurrence appends rather than replaces. */
@@ -305,14 +450,17 @@ const RUNTIME_LIST_FLAGS = new Map([
305
450
  ['--need', 'need'],
306
451
  ['--path', 'paths'], // leak-scan: the files to scan, one per occurrence
307
452
  ['--exclude', 'exclude'], // leak-scan: extra path segments to skip · lifecycle --action release: slugs left out
453
+ ['--exclude-family', 'excludeFamily'], // model-role: model family to exclude from review candidates
308
454
  ['--feature', 'feature'], // lifecycle --action release: a feature slug to add, one per occurrence
309
455
  ['--item', 'item'], // goal --action add: a checklist item, one per occurrence · goal --action check: the one item id (C3)
456
+ ['--blocker', 'blocker'], // dispatch submit: one blocker line per occurrence, at most 20
310
457
  ]);
311
458
 
312
459
  /** Non-negative integer arguments. */
313
460
  const RUNTIME_INT_FLAGS = new Map([
314
461
  ['--iteration', 'iteration'], // recover: retries already spent, bounding the retry budget
315
462
  ['--observed-exit', 'observedExit'], // evidence --action add: exit status of the observed command (0 is meaningful)
463
+ ['--timeout', 'timeout'], // slot --action run: seconds to wait for the slot; the verb checks 1 to 86400 (115 IC-008)
316
464
  ]);
317
465
 
318
466
  /**
@@ -336,6 +484,7 @@ function parseRuntimeFlag(arg , argv , i , o )
336
484
  const inline = eq === -1 ? null : arg.slice(eq + 1);
337
485
  const key = RUNTIME_STRING_FLAGS.get(name) || RUNTIME_LIST_FLAGS.get(name) || RUNTIME_INT_FLAGS.get(name);
338
486
  if (!key) return null;
487
+ if ((name === '--listen-address' || name === '--tls-cert' || name === '--tls-key') && o.cmd !== 'ui') return null;
339
488
 
340
489
  let value = inline;
341
490
  let next = i;
@@ -357,13 +506,11 @@ function parseRuntimeFlag(arg , argv , i , o )
357
506
  if (!Number.isFinite(parsed) || parsed < 0) { console.error(`doflow: ${name} expects a non-negative integer, got '${value}'`); process.exit(2); }
358
507
  o[key] = parsed;
359
508
  } else if (RUNTIME_LIST_FLAGS.has(name)) {
360
- // --exclude alone also accepts a comma-joined value (`--exclude bin,src,core`), not just the
361
- // repeatable form (`--exclude bin --exclude src`) every other list flag uses — the two used to
362
- // be parsed by two separate code paths (a dedicated switch case handling only the space
363
- // spelling's comma-splitting, this generic path handling both spellings but never splitting),
364
- // so `--exclude=bin,src` silently excluded nothing while `--exclude bin,src` worked. One path,
365
- // both spellings, same behavior now.
366
- const parts = name === '--exclude' ? value.split(',').map((s ) => s.trim()).filter(Boolean) : [value];
509
+ // --exclude and --exclude-family both accept comma lists or repeated flags. Keep --exclude's
510
+ // existing trimming, empty-item filtering, and split behavior unchanged for its callers.
511
+ const parts = name === '--exclude' || name === '--exclude-family'
512
+ ? value.split(',').map((s ) => s.trim()).filter(Boolean)
513
+ : [value];
367
514
  (o[key] = o[key] || []).push(...parts);
368
515
  } else if (name === '--evidence-id' && o.cmd === 'research-request') {
369
516
  (o.evidenceIds = o.evidenceIds || []).push(value);
@@ -387,32 +534,47 @@ Commands:
387
534
  list-backups List available backups
388
535
  self-update git pull + reinstall
389
536
  tools Inspect or manage registered external tools
537
+ ui [<project>] Run the DoFlow Console, a separately installed package (--port N; exit 2 when it is not installed)
390
538
  capabilities Show registered abstract capabilities and resolved providers
539
+ enforcement Report lifecycle policy enforcement coverage (--harness, --policy)
391
540
  doctor System health and capability smoke check diagnostics
392
541
  readiness Evaluate task readiness contract (--task-class, --task-id, both required)
393
542
  evidence Record a stage's evidence batch, or inspect what is recorded (--task-id)
394
543
  claim Record a claim, link evidence to it, or list them (--task-id, --action)
395
544
  context-pack Compile a task's evidence and claims into a context block (--task-id)
396
- retrieval-plan Declare a stage's information needs, then report every declared item
545
+ context-emit Decide and render one launch, prompt or delta emission (--event, --cwd)
546
+ context-grant Grant one compacted summary to a launched run and lineage (--summary, --to-run, --to-lineage)
547
+ retrieval-plan Declare a stage's information needs, attempt retrieval, then report every declared item
397
548
  outcome Record a task's terminal state with its basis, or show it (--task-id)
398
549
  classify Validate a proposed task class and return its workflow (--task-class)
399
550
  workflow Resolve a task class to its stages, gates and readiness templates
400
551
  orchestrate Start or resume a run: complete stages, decide gates (--action)
401
552
  research-request Open, list or resolve a feature-stage research question (--task-id)
402
- task-attempt Claim, finish, release or read the attempts on a plan's tasks (--action, --slug)
403
- retrieve BM25 search over the installed guidance tree (--query)
404
- model-role Resolve a model role to ranked provider candidates (--role)
553
+ task-attempt Claim, finish, release, run controls, resume, inspect, reopen or report usage on a plan's task attempts (--action, --slug)
554
+ worker Discover, probe, describe, select, run, status or cancel an external headless worker on a claimed task (--action)
555
+ dispatch Run a feature's task graph: start, step, run, submit, spawn, pause, inspect, cancel, takeover or resume (--action)
556
+ retrieve BM25 guidance search by default; use --scope code for scoped project retrieval (--query)
557
+ model-role Resolve a model role to ranked provider candidates (--role, --exclude-family)
405
558
  advise Route decision questions to the configured local model (--action)
406
559
  brief-tools Tier, tools and report-format block for a dispatch brief (--owner)
407
560
  route Resolve an information need to a healthy provider (--intent)
408
561
  verify Compile the verification contract and report against it (--task-id)
409
562
  recover Classify a verification failure and plan the bounded retry (--error)
410
- trace Trajectory of the current or most recent workflow (run ledger)
563
+ trace Trajectory of the current or most recent workflow (run ledger).
564
+ trace spans [<project>] the span view; trace analyze [<project>] its detectors (exit 1 on a finding);
565
+ trace export --otlp-http [<project>] export spans via OTLP/HTTP
411
566
  stats Aggregate local run-ledger usage
412
567
  indicators Per-stage and per-gate timings from the orchestration record
413
568
  discover Missed capability opportunities in recorded runs
414
569
  inventory Shadowed copies, drift and unmanaged files across both install scopes
415
570
  storage Report stored data and retention bounds (--action report|prune|upkeep)
571
+ config Show each setting's effective value and where it came from, print the settings schema, or validate, set or unset one (exit 0 ok, 1 refused, 2 usage).
572
+ config [list] [--show-origin] [--json] [-g] [<project path>] read-only
573
+ config schema [--json] every key with its type, values, default, scope and whether config set may write it, the locked invariants and the presets
574
+ config validate <key> <json-value> [--layer user|project|local] [--json] check a value, writes nothing
575
+ config validate --prepared-run <file> [--json] check a prepared-run file (task class, settings, presets), one entry per fault, writes nothing
576
+ config set <key> <json-value> --layer user|project|local [--json] validate, then write that layer's file; refuses security-relevant and invariant.* keys
577
+ config unset <key> --layer user|project|local [--json] remove the key from that layer's file
416
578
  scaffold Emit the reviewable code scaffold the active feature's artifacts imply
417
579
  decision Register, list or compact the active feature's decisions (--action init|add|list|compact)
418
580
  followup Record, list, take, settle, promote or report what a feature left unfinished (--action add|list|take|settle|promote|report)
@@ -420,6 +582,47 @@ Commands:
420
582
  goal Add, check, link, list or close a goal and its checklist (--action add|item|check|link|list|done)
421
583
  failure List, settle or switch off the failures DoFlow captured on this machine (--action list|settle|capture)
422
584
  (a value beginning with '-' must be written --flag=value)
585
+ roadmap Session-driven autopilot runner (--action render|status|next|audit|init-policy [--check] [--row <id>] [--run <id>]).
586
+ roadmap --action init-policy [--commit] writes the gate policy for review, or with --commit commits it onto local develop when develop is not checked out in a worktree (otherwise it prints the commands to run there; never pushes);
587
+ roadmap seed --action check|apply|amend --draft <path> [--json] validates and writes new rows;
588
+ rows written while autopilot is on land proposed; roadmap promote <id...> [--json] (person, autopilot off) makes them ready
589
+ plan-check Check a plan's task lines the way the task-attempt ledger reads them: plan-check <plan path> [--json]
590
+ review Validate a feature's review/findings.json; print errors, advisories and counts (exit 0 valid, 1 invalid, 2 usage).
591
+ review --action check [--slug <name> | --path <findings.json>] [--json]
592
+ review --action start [--slug <name>] [--base <ref>] [--json] [--preset <id>] verify precondition and review protocol; --base must be the review's base (exit 0 ok or not applicable, 1 refused, 2 usage)
593
+ protocol Print the review and debate protocol presets, or the one a run would use (read-only, writes nothing).
594
+ protocol --action list [--kind review|debate] [--json]
595
+ protocol --action resolve --kind review|debate [--task-class <id>] [--risk <level>] [--preset <id>] [--json] (exit 0 resolved, 1 refused, 2 usage)
596
+ rules Print the values the runtime owns for this project, each with its source (read-only, writes nothing).
597
+ rules [--task-class <id>] [-g] [--json] [<project>] review protocol per class (attended and unattended), gate floors and loop limits, tiers and worker models, review and autopilot settings (exit 0, 2 usage)
598
+ primary Resolve which harness and model the main session runs (read-only).
599
+ primary --action resolve [--json] (exit 0, 1 refused, 2 usage)
600
+ primary --action observed [--json] checkouts and session hook records (exit 0, 1 cannot list checkouts, 2 usage)
601
+ fleet List the projects this machine knows (read-only).
602
+ fleet --action projects [--json] from the user-state upkeep-roots and the hook project directories (exit 0, 1 cannot list projects, 2 usage)
603
+ fleet --action tree [--json] one project's agent hierarchy as nodes and edges (exit 0, 1 cannot list checkouts, 2 usage)
604
+ transcript Read an agent's recent events, or the project's traffic (read-only, run in a project).
605
+ transcript --action read --agent <key> [--cursor <c>] [--limit <n>] [--json] masked events and DoFlow's record events (exit 0, 1 agent-not-in-project or session-not-in-project, 2 usage)
606
+ transcript --action stats [--window <minutes 1..60>] [--json] events per minute, tool calls, tokens, who works with whom (exit 0, 2 usage)
607
+ package List the contribution points a package may fill, check a package directory, show the packages, add and update a local package, or turn it on and off.
608
+ package --action points [--json]
609
+ package --action check --path <dir> [--json] (read-only; exit 0 clean, 1 findings, 2 usage)
610
+ package --action list [--id <id>] [--json] (read-only; exit 0, 1 when a package is neither active nor disabled)
611
+ package --action show --id <id> [--json] (read-only; exit 0, 1 unknown id, 2 no --id)
612
+ package --action add --source <spec> [--json] (plans a local or granted remote source; exit 0, 1 refused, 2 usage)
613
+ package --action add --index <file> --id <id> [--version <v>] [--json] (selects a pinned source; needs a fetch grant)
614
+ package --action add --plan <planId> [--json] (stores the package and records it disabled; exit 0, 1 refused, e.g. digest-mismatch)
615
+ package --action update --id <id> | --plan <planId> [--json] (plan a new copy from the recorded source, or apply the plan; a changed digest above inert prints the new trust line)
616
+ package --action new --id <id> --points <point[:local],...> [--dir <path>] [--json] (writes an authored package folder only; exit 0 created, 1 refused, 2 usage)
617
+ package --action enable|disable --id <id> [--json] (sets the lock bit; enable prints the resulting state, and for needs-trust the exact grant line and file; exit 0, 1 incompatible or unknown, 2 no --id)
618
+ package --action trust|exempt --id <id> [--json] (prints the grant line a person appends to grants.jsonl and writes nothing; exempt exits 1 while the host is inside the range)
619
+ package --action revoke --id <id> [--json] (records a revocation in state.json; only a later trust line counts)
620
+ package --action remove --id <id> [--json] (disables, deletes the store entry and lock row, records a revocation and a removed tombstone, then lists the settings, records and grant lines that still name the package and rewrites none; exit 0, 1 unknown id or the bundled package, 2 no --id)
621
+ package --action verify [--repair] [--json] (re-hashes enabled third-party entries and records suspensions; exit 0 intact, 1 findings; --repair rewrites an unreadable state.json)
622
+ slot Named machine-wide queue, one holder at a time (--action run|list|peek|release).
623
+ slot --action run --name <name> [--label <text>] [--timeout <s>] [--no-wait] -- <command> [args...]
624
+ slot --action release --name <name> --by <who> --reason <text>
625
+ models Synchronize, list, or inspect observed models across workers (--action sync|list|describe)
423
626
  leak-scan Report DoFlow-internal identifiers in shipped files (--path, repeatable)
424
627
 
425
628
  Scope (mutually exclusive — global wins if both given):
@@ -434,7 +637,7 @@ Scope (mutually exclusive — global wins if both given):
434
637
  Options:
435
638
  -t, --target <list> Comma-separated: ${VALID_TARGETS.join(',')} (default: ${DEFAULT_TARGETS.join(',')})
436
639
  --mcp <list> Comma-separated MCP server names, or all or none, for every targeted
437
- harness that takes MCP servers (all but gemini). Default: none, or the
640
+ harness that takes MCP servers (all of them). Default: none, or the
438
641
  selection a harness has recorded in doflow.lock, or the servers an
439
642
  installed harness already has; a real terminal prompts on install.
440
643
  Recorded per harness.
@@ -445,42 +648,86 @@ Options:
445
648
  the file is still a conflict. For a tree installed before the neutral
446
649
  ledger existed, which nothing else can re-adopt
447
650
  --no-backup Skip backup (requires --force; ignored by rollback's safety snapshot)
448
- --prune <N> Keep the N newest backups after install or update (default 3; 0 keeps all)
651
+ --prune <N> Keep the N newest backups after install, update or reconcile (default 3; 0 keeps all)
449
652
  --days <N> Run-ledger window in calendar days (trace, stats, discover)
653
+ --run <key|id> trace spans, trace analyze, trace export: keep the traces of one run key or run id
654
+ --emit evidence|followups
655
+ trace analyze: print only the batch for evidence --action add --batch -,
656
+ or for followup --action add --batch <file> (with --task-id, cites its evidence)
657
+ --otlp-http trace export: export spans to an OpenTelemetry collector via OTLP/HTTP JSON
450
658
  --slug <name> Scaffold this feature instead of the branch-resolved active one
451
659
 
452
660
  Runtime verb arguments (accept --flag value or --flag=value):
453
- --task-class classify, workflow, readiness, context-pack, outcome --action record
454
- --task-id readiness, evidence, claim, context-pack, retrieval-plan, outcome, verify, advise
455
- --action claim: list|add|link|retract|supersede · evidence: list|add|supersede
456
- verify: report|contract · retrieval-plan: declare|report
661
+ --task-class classify, workflow, readiness, context-pack, outcome --action record, protocol --action resolve
662
+ --task-id readiness, evidence, claim, context-pack, retrieval-plan, outcome, verify, advise, retrieve,
663
+ trace analyze --emit followups (the ledger read for evidence ids)
664
+ --action claim: list|add|link|retract|supersede · evidence: list|add|supersede|retire
665
+ verify: report|contract · retrieval-plan: declare|report|attempt
457
666
  outcome: record|show · advise: ask|outcome|configure · tools: see above
458
667
  followup: add|list|take|settle|promote|report
459
- task-attempt: claim|finish|release|status
668
+ task-attempt: claim|finish|release|status|start|pause|cancel|resume|inspect|reopen|report-usage
669
+ worker: discover|probe|describe|select|run|status|cancel|evidence
670
+ dispatch: start|step|run|submit|spawn|pause|inspect|cancel|takeover|resume
460
671
  lifecycle: overview|init|release|status|merged
461
672
  goal: add|item|check|link|list|done
462
673
  failure: list|settle|capture
674
+ roadmap: render|status|next|audit|init-policy (seed: check|apply|amend; promote <id...>)
675
+ slot: run|list|peek|release
676
+ models: sync|list|describe
677
+ review: check|start
678
+ protocol: list|resolve
679
+ primary: resolve|observed
680
+ fleet: projects|tree
681
+ transcript: read|stats
682
+ package: points|check|list|show|add|update|enable|disable|trust|exempt|revoke|verify|remove
463
683
  --task, --token, --owner, --mode,
464
- --result, --evidence-id, --reason task-attempt (claim: --task --owner --mode manual|sequential|subagent;
465
- finish: --task --token --result COMPLETED|BLOCKED|ABANDONED|INCONCLUSIVE
466
- [--evidence-id]; release: --task --token --reason)
684
+ --result, --evidence-id, --reason task-attempt (claim: --task --owner --mode manual|sequential|subagent
685
+ [--owner-override <reason>] [--epoch <n>=1+] [--reserve-tokens <n>]
686
+ [--exec-worktree <path>];
687
+ finish: --task --token --result COMPLETED|BLOCKED|ABANDONED|INCONCLUSIVE|FAILED
688
+ [--evidence-id] [--reason, required with FAILED];
689
+ release: --task --token --reason; finish and release also
690
+ [--tokens <n> --tokens-basis measured|estimated];
691
+ start: --by [--budget-attempts <n>=1+] [--budget-tokens <n>=1+];
692
+ pause: --by --reason; cancel: --by --reason, one attempt with
693
+ --task --token, else the run [--adopt-unowned];
694
+ reopen: --task --token --by --reason;
695
+ report-usage: --task --token --tokens <n> --tokens-basis
696
+ measured|estimated, once on an ended attempt with no usage;
697
+ resume: report and digest, then --ack sha256:<hex> --by [--reason];
698
+ inspect: graph, task states, budgets and run totals.
699
+ Exit 0 applied or read; 1 refused, stale or ack-required, the
700
+ disposition in the JSON; 2 usage or an unreadable store or plan)
467
701
  --rationale, --proposed-by, --calling-skill classify
468
702
  --request <text>, --request-file <file> classify (mutually exclusive; optional second opinion)
469
703
  --intent, --query, --check route
470
704
  --statement, --claim-id,
471
705
  --evidence-id, --relation claim
472
706
  --kind, --provenance, --provider,
473
- --capability, --locator, --content evidence --action add (one item)
707
+ --capability, --locator, --content,
708
+ --absence evidence --action add (one item)
709
+ --need <intent> evidence --action add (bind evidence to retrieval needs)
710
+ --scope code --profile lexical-only|hybrid,
711
+ --root <project>, --index-action build|refresh,
712
+ --model-path <local-dir> retrieve code scope (guidance remains the default)
474
713
  --batch <file|-> evidence --action add (a stage's JSON batch)
475
714
  --evidence-id, --replaced-by evidence --action supersede (retire one item, point
476
715
  forward to the item that replaces it)
716
+ --stale evidence --action retire (retire every item the ledger
717
+ classes stale, with no replacement; fresh items stay)
477
718
  --verification-plan, --scope,
478
719
  --invariants,
479
720
  --user-decision-pending readiness: inputs the caller states rather than
480
721
  evidence establishes; reported back as such
481
722
  --objective context-pack
723
+ --event, --cwd, --session, --harness,
724
+ --nudge, --max-bytes, --task-id,
725
+ --slug, --peek context-emit (identity comes from the environment only)
726
+ --summary, --to-run, --to-lineage,
727
+ --from-worktree, --from-run,
728
+ --from-lineage, --max-bytes context-grant
482
729
  --need <intent[,intent]>,
483
- --stage retrieval-plan (--need is repeatable), outcome
730
+ --stage, --status retrieval-plan (--need is repeatable), outcome
484
731
  --mcp-outcome <server>=<outcome> orchestrate --action handoff, repeatable: used | nothing-usable |
485
732
  skipped:<reason> | unavailable (a server left out only warns)
486
733
  --state <COMPLETED|BLOCKED|
@@ -499,6 +746,20 @@ Runtime verb arguments (accept --flag value or --flag=value):
499
746
  --model, --endpoint, --project,
500
747
  --off advise --action configure
501
748
  --path, --exclude (repeatable) leak-scan
749
+ --slug | --path review --action check (at most one; with neither, the active feature)
750
+ --path <dir> package --action check (exactly one package directory)
751
+ --id <id> package --action list (one package), show, update (required unless --plan), enable, disable, trust, exempt, revoke and remove
752
+ --source <spec> package --action add (local dir, git:https://<host>/<repo>[#<subdir>]@<ref>, npm:<name>@<version or range>)
753
+ --index <file>, --version <v> package --action add --id <id> (local pinned index; default highest compatible stable version)
754
+ --plan <planId> package --action add and update (apply the plan; it is kept for 24 hours)
755
+ --points <point[:local],...> package --action new (open points and optional local ids)
756
+ --dir <path> package --action new (default: <project>/.doflow/package/<id>/)
757
+ --repair package --action verify (rewrite an unreadable state.json; every grant line present is revoked, never widened)
758
+ --base <ref> review --action start (measure the changed paths from this commit, which must be the review's base; --path is refused)
759
+ --preset <id> review --action start, protocol --action resolve (run this preset; refused when looser than the decided protocol)
760
+ --prepared-run <file> config validate (check a prepared-run file instead of one key; exit 2 with a key, value or --layer)
761
+ --layer user|project|local config validate, set, unset (which settings file; project and local are the current project's .doflow/settings.json and settings.local.json)
762
+ --kind review|debate, --risk <level> protocol (--kind filters list and selects what resolve decides; --risk is the change's risk level)
502
763
  --ids, --as, --evidence, --title,
503
764
  --release, --source, --channel followup (add, list, take, settle, promote)
504
765
  --file <path|->, --stdin, --text,
@@ -511,8 +772,50 @@ Runtime verb arguments (accept --flag value or --flag=value):
511
772
  --tag, --confirm, --feature,
512
773
  --exclude (repeatable), --reason lifecycle (release, merged)
513
774
  --fp, --as, --reason, --set, --all failure (list, settle, capture)
775
+ --harness, --need (repeatable),
776
+ --model-check, --budget-tokens,
777
+ --task, --token, --prompt-file,
778
+ --timeout-seconds, --wait, --edit,
779
+ --child-of, --request, --exec-worktree,
780
+ --worker-run, --by, --reason,
781
+ --checks, --out worker (probe: [--model-check <id> --budget-tokens <n>];
782
+ describe: --harness [--edit]; select: [--edit];
783
+ run: --harness --task --token
784
+ --prompt-file [--timeout-seconds 1-14400] [--wait] [--edit]
785
+ [--child-of <w-id> --request <d-id.cN> --exec-worktree <path>];
786
+ status, cancel: --worker-run or --task --token;
787
+ cancel also --by --reason;
788
+ evidence: --harness --out and exactly one of --checks <file>
789
+ (free CLI checks) or --worker-run <w-id> (an ended run).
790
+ Exit 0 done; 1 refused or
791
+ none-eligible, the disposition in the JSON; 2 usage)
792
+ --slug, --by, --reason, --concurrency,
793
+ --mode, --verify-argv, --verify-seconds,
794
+ --attempt-seconds, --reserve-tokens,
795
+ --budget-attempts, --budget-tokens,
796
+ --spawn-grant, --harness, --need,
797
+ --max-seconds, --dispatch, --status,
798
+ --summary, --blocker (repeatable),
799
+ --tokens, --tokens-basis, --prompt-file,
800
+ --request-id, --task, --ack dispatch (start: --by [--concurrency 1-4] [--mode auto|sequential|manual]
801
+ [--verify-argv <json>] [--verify-seconds <n>] [--attempt-seconds <n>]
802
+ [--reserve-tokens <n>] [--budget-attempts <n>] [--budget-tokens <n>]
803
+ [--spawn-grant <json>] [--harness <id>] [--need <id>];
804
+ step: [--by]; run: [--by] [--max-seconds 1-14400];
805
+ submit: --dispatch <d-id> --status success|failure --summary <text>
806
+ [--blocker <text>] [--tokens <n> --tokens-basis measured|estimated];
807
+ spawn: --prompt-file --reserve-tokens <n>, or --request-id;
808
+ pause, cancel: --by --reason; takeover: --task --by --reason;
809
+ resume: report and digest, then --ack sha256:<hex> --by [--reason];
810
+ inspect. Exit 0 done; 1 refused, stale or ack-required, the
811
+ disposition in the JSON; 2 usage or an unreadable store or plan)
514
812
  --error, --failed-check,
515
813
  --iteration, --agent recover
814
+ --name, --label, --timeout,
815
+ --no-wait, --by, --reason slot (run: --name [--label <text>] [--timeout 1-86400] [--no-wait] -- <command> [args...],
816
+ everything after -- is the command's own argv; list; release: --name --by
817
+ --reason. Exit: run passes the command's code, 75 when busy or timed out;
818
+ release 1 while the holder is alive; 2 usage)
516
819
  --json Machine-readable output (status)
517
820
 
518
821
  External tools:
@@ -547,6 +850,8 @@ async function main(argv ) {
547
850
  if (handler) return handler(o);
548
851
  return await dispatchRuntimeCommand(o);
549
852
  } catch (error ) {
853
+ // A repeated `remove` with nothing left is a finished job, not a failure (FU-0wgcyt).
854
+ if (error?.code === 'DOFLOW_NOTHING_TO_REMOVE') { console.log(`[INFO] ${error.message}`); return; }
550
855
  // Recorded silently when it is a programming error (IC-016); the output and exit status below
551
856
  // are the same whether or not anything was written.
552
857
  // Required here, not at load, so a CLI whose failure modules cannot be loaded still runs as today.
@@ -565,4 +870,4 @@ async function main(argv ) {
565
870
  }
566
871
  }
567
872
 
568
- module.exports = { main, COMMANDS, commandName };
873
+ module.exports = { main, COMMANDS, commandName, parseArgs };