@event4u/agent-config 16.0.0 → 16.2.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 (382) hide show
  1. package/.augment-plugin/marketplace.json +3 -3
  2. package/.augment-plugin/plugin.json +1 -1
  3. package/.claude-plugin/marketplace.json +1 -1
  4. package/CHANGELOG.md +289 -140
  5. package/CONTRIBUTING.md +9 -0
  6. package/README.md +2 -2
  7. package/dist/agent-src/commands/analyze/inbox.md +26 -0
  8. package/dist/agent-src/commands/analyze/roadmap-repos.md +27 -0
  9. package/dist/agent-src/commands/challenge-me/closure.md +178 -0
  10. package/dist/agent-src/commands/challenge-me.md +9 -2
  11. package/dist/agent-src/commands/council/default.md +25 -5
  12. package/dist/agent-src/commands/feature/plan.md +28 -1
  13. package/dist/agent-src/commands/feature/roadmap.md +28 -1
  14. package/dist/agent-src/commands/implement-ticket.md +27 -0
  15. package/dist/agent-src/commands/jira-ticket.md +27 -0
  16. package/dist/agent-src/commands/pr/create.md +29 -0
  17. package/dist/agent-src/commands/pr/merge.md +60 -9
  18. package/dist/agent-src/commands/roadmap/ai-council.md +7 -1
  19. package/dist/agent-src/commands/roadmap/create.md +74 -27
  20. package/dist/agent-src/commands/roadmap/materialize.md +27 -0
  21. package/dist/agent-src/commands/roadmap/process-full.md +123 -18
  22. package/dist/agent-src/commands/team.md +22 -0
  23. package/dist/agent-src/commands/work.md +4 -0
  24. package/dist/agent-src/contexts/authority/scope-growth-ownership.md +80 -0
  25. package/dist/agent-src/contexts/communication/rules-auto/user-interaction-mechanics.md +47 -0
  26. package/dist/agent-src/contexts/execution/auto-orchestration-activation.md +44 -3
  27. package/dist/agent-src/contexts/execution/autonomy-mechanics.md +19 -23
  28. package/dist/agent-src/contexts/execution/decision-closure-execution.md +93 -0
  29. package/dist/agent-src/contexts/execution/fix-loop-ladder.md +108 -0
  30. package/dist/agent-src/contexts/execution/plan-confidence-gate.md +4 -2
  31. package/dist/agent-src/contexts/execution/roadmap-process-loop.md +75 -6
  32. package/dist/agent-src/guidelines/agent-infra/active-remediation-mechanics.md +57 -0
  33. package/dist/agent-src/guidelines/agent-infra/evaluator-independence-mechanics.md +102 -0
  34. package/dist/agent-src/guidelines/design-fidelity-routing.md +29 -0
  35. package/dist/agent-src/rules/autonomous-execution.md +15 -8
  36. package/dist/agent-src/rules/delegation-policy.md +23 -45
  37. package/dist/agent-src/rules/design-fidelity.md +32 -37
  38. package/dist/agent-src/rules/evaluator-independence.md +43 -49
  39. package/dist/agent-src/rules/test-first.md +41 -0
  40. package/dist/agent-src/rules/ui-audit-gate.md +1 -2
  41. package/dist/agent-src/skills/accessibility-auditor/data/aria-patterns.csv +1 -1
  42. package/dist/agent-src/skills/accessibility-auditor/data/manifest.json +3 -3
  43. package/dist/agent-src/skills/ai-council/SKILL.md +11 -3
  44. package/dist/agent-src/skills/api-design/data/manifest.json +3 -3
  45. package/dist/agent-src/skills/database/data/manifest.json +4 -4
  46. package/dist/agent-src/skills/database/data/query-tuning.csv +3 -3
  47. package/dist/agent-src/skills/design-review/SKILL.md +80 -4
  48. package/dist/agent-src/skills/design-review/references/verification-automation.md +32 -0
  49. package/dist/agent-src/skills/existing-ui-audit/SKILL.md +30 -5
  50. package/dist/agent-src/skills/existing-ui-audit/references/component-taxonomy-detection.md +56 -0
  51. package/dist/agent-src/skills/experiment-loop/SKILL.md +31 -1
  52. package/dist/agent-src/skills/markitdown/SKILL.md +4 -0
  53. package/dist/agent-src/skills/playwright-testing/SKILL.md +30 -6
  54. package/dist/agent-src/skills/roadmap-writing/SKILL.md +1 -1
  55. package/dist/agent-src/skills/storybook-workshop/SKILL.md +42 -3
  56. package/dist/agent-src/skills/threat-modeling/SKILL.md +9 -4
  57. package/dist/agent-src/skills/threat-modeling/data/manifest.json +4 -4
  58. package/dist/agent-src/skills/ui-component-architect/SKILL.md +23 -0
  59. package/dist/agent-src/skills/verify-repair-loop/SKILL.md +37 -3
  60. package/dist/agent-src/templates/agent-settings.md +1 -1
  61. package/dist/agent-src/templates/agents/agent-project-settings.example.yml +1 -1
  62. package/dist/agent-src/templates/roadmaps.md +218 -0
  63. package/dist/agent-src/templates/scripts/work_engine/directives/backend/_self_fix.ts +62 -2
  64. package/dist/agent-src/templates/scripts/work_engine/directives/backend/test.ts +1 -0
  65. package/dist/agent-src/templates/scripts/work_engine/directives/backend/verify.ts +1 -0
  66. package/dist/agent-src/templates/scripts/work_engine/directives/ui/app_spec.ts +10 -4
  67. package/dist/agent-src/templates/scripts/work_engine/directives/ui/apply.ts +260 -21
  68. package/dist/agent-src/templates/scripts/work_engine/directives/ui/audit.ts +22 -3
  69. package/dist/agent-src/templates/scripts/work_engine/directives/ui/scaffold.ts +6 -1
  70. package/dist/agent-src/templates/scripts/work_engine/state.ts +57 -7
  71. package/dist/agent-src/templates/scripts/work_engine/taxonomy/detect.ts +500 -0
  72. package/dist/agent-src/templates/scripts/work_engine/taxonomy/place.ts +183 -0
  73. package/dist/cli/python/knowledge_ingest.js +1 -1
  74. package/dist/cli/python/workspace_drive.js +1 -1
  75. package/dist/cli-delegate/check_update_banner.js +40 -2
  76. package/dist/cli-delegate/chunk-4E2W63DA.js +335 -0
  77. package/dist/cli-delegate/{chunk-S3VFXMTM.js → chunk-4XFP2Y3E.js} +1 -1
  78. package/dist/cli-delegate/chunk-5R7HOLAF.js +99 -0
  79. package/dist/cli-delegate/{chunk-IVBPRCQO.js → chunk-6KFEC3G7.js} +1 -1
  80. package/dist/cli-delegate/{chunk-2TAQ2K4V.js → chunk-6KM6ORRY.js} +55 -386
  81. package/dist/cli-delegate/{chunk-AK6HODNQ.js → chunk-7XGBX6ZH.js} +973 -555
  82. package/dist/cli-delegate/{chunk-2XY7ILBT.js → chunk-FC75PGJE.js} +42 -2
  83. package/dist/cli-delegate/{chunk-55ACLDUE.js → chunk-FP36SWJD.js} +587 -141
  84. package/dist/cli-delegate/{chunk-3FKR64R5.js → chunk-IGD6ERX6.js} +62 -7
  85. package/dist/cli-delegate/{chunk-GYC3VRYN.js → chunk-JNMVLWLR.js} +99 -14
  86. package/dist/cli-delegate/{chunk-H32DGUJH.js → chunk-P6ZHP5W2.js} +1 -1
  87. package/dist/cli-delegate/{chunk-57PN4GYJ.js → chunk-RGNIWTEA.js} +1 -1
  88. package/dist/cli-delegate/chunk-ROYYTEZU.js +39 -0
  89. package/dist/cli-delegate/{chunk-2DK2VJWG.js → chunk-WGXTVKCQ.js} +20 -6
  90. package/dist/cli-delegate/chunk-YDPILCOL.js +152 -0
  91. package/dist/cli-delegate/{chunk-QJWAUMJW.js → chunk-YJ72UIAK.js} +730 -15
  92. package/dist/cli-delegate/cmd_analyze_session.js +1 -1
  93. package/dist/cli-delegate/cmd_brand_status.js +1 -1
  94. package/dist/cli-delegate/cmd_conformance.js +985 -831
  95. package/dist/cli-delegate/cmd_doctor.js +7 -5
  96. package/dist/cli-delegate/cmd_explain.js +2 -2
  97. package/dist/cli-delegate/cmd_export.js +9 -7
  98. package/dist/cli-delegate/cmd_fleet.js +4 -2
  99. package/dist/cli-delegate/cmd_handoff.js +7 -7
  100. package/dist/cli-delegate/cmd_mcp_available.js +1 -1
  101. package/dist/cli-delegate/cmd_memory_get.js +1 -1
  102. package/dist/cli-delegate/cmd_migrate.js +2 -2
  103. package/dist/cli-delegate/cmd_packs_active.js +2 -2
  104. package/dist/cli-delegate/cmd_preflight.js +4 -2
  105. package/dist/cli-delegate/cmd_prune.js +10 -8
  106. package/dist/cli-delegate/cmd_route_audit.js +3 -3
  107. package/dist/cli-delegate/cmd_route_explain.js +1 -1
  108. package/dist/cli-delegate/cmd_session_recycle.js +4 -4
  109. package/dist/cli-delegate/cmd_settings_get.js +28 -2
  110. package/dist/cli-delegate/cmd_settings_migrate.js +9 -7
  111. package/dist/cli-delegate/cmd_settings_set.js +1 -1
  112. package/dist/cli-delegate/cmd_sync.js +10 -8
  113. package/dist/cli-delegate/cmd_uninstall.js +16 -13
  114. package/dist/cli-delegate/cmd_update.js +1 -1
  115. package/dist/cli-delegate/cmd_upgrade.js +1 -1
  116. package/dist/cli-delegate/cmd_validate.js +12 -10
  117. package/dist/cli-delegate/cmd_versions.js +1 -1
  118. package/dist/discovery/deprecation-report.md +1 -1
  119. package/dist/discovery/discovery-manifest.json +90 -43
  120. package/dist/discovery/discovery-manifest.json.sha256 +1 -1
  121. package/dist/discovery/discovery-manifest.summary.md +4 -4
  122. package/dist/discovery/dormancy-report.md +1 -1
  123. package/dist/discovery/orphan-report.md +1 -1
  124. package/dist/discovery/packs.json +10 -8
  125. package/dist/discovery/trust-report.md +3 -3
  126. package/dist/discovery/workspaces.json +8 -6
  127. package/dist/hooks/dispatch.js +7682 -2772
  128. package/dist/hooks/dispatch.sha256 +1 -0
  129. package/dist/install/claudeRuleRewrite.js +14 -3
  130. package/dist/install/conflict.js +60 -10
  131. package/dist/install/conflictTracker.js +218 -0
  132. package/dist/install/fsPrimitives.js +54 -0
  133. package/dist/install/install.mjs +2200 -1559
  134. package/dist/install/manifestFiles.js +259 -0
  135. package/dist/install/preflight.js +14 -2
  136. package/dist/install/preserve.js +157 -0
  137. package/dist/install/recordedOwnership.js +132 -0
  138. package/dist/install/txlog.js +11 -2
  139. package/dist/mcp/registry-manifest.json +3 -3
  140. package/dist/mcp/server.json +2 -2
  141. package/dist/mcp/server.mjs +3066 -1470
  142. package/dist/router.json +1 -1
  143. package/dist/scripts/_lib/agent_settings.js +3 -2
  144. package/dist/scripts/_lib/fs_atomic.js +167 -0
  145. package/dist/scripts/_lib/installed_tools.js +460 -0
  146. package/dist/scripts/_lib/lean_projection_mode.js +3 -2
  147. package/dist/scripts/_lib/settings_renamed_keys.js +78 -0
  148. package/dist/server/routes/install.js +8 -0
  149. package/dist/server/routes/wizard.js +9 -3
  150. package/dist/server/schemas/settings.js +40 -5
  151. package/dist/shared/missionExecution.js +97 -0
  152. package/dist/ui/assets/index-Cwq4d0hX.js +23 -0
  153. package/dist/ui/assets/index-Cyjy8bWO.css +1 -0
  154. package/dist/ui/index.html +2 -2
  155. package/docs/MIGRATION.md +103 -0
  156. package/docs/contracts/settings-classes.md +28 -7
  157. package/docs/guidelines/agent-infra/active-remediation-mechanics.md +57 -0
  158. package/docs/guidelines/agent-infra/evaluator-independence-mechanics.md +102 -0
  159. package/docs/guidelines/design-fidelity-routing.md +29 -0
  160. package/package.json +4 -4
  161. package/src/agent-src/templates/scripts/work_engine/directives/backend/_self_fix.ts +62 -2
  162. package/src/agent-src/templates/scripts/work_engine/directives/backend/test.ts +1 -0
  163. package/src/agent-src/templates/scripts/work_engine/directives/backend/verify.ts +1 -0
  164. package/src/agent-src/templates/scripts/work_engine/directives/ui/app_spec.ts +10 -4
  165. package/src/agent-src/templates/scripts/work_engine/directives/ui/apply.ts +260 -21
  166. package/src/agent-src/templates/scripts/work_engine/directives/ui/audit.ts +22 -3
  167. package/src/agent-src/templates/scripts/work_engine/directives/ui/scaffold.ts +6 -1
  168. package/src/agent-src/templates/scripts/work_engine/state.ts +57 -7
  169. package/src/agent-src/templates/scripts/work_engine/taxonomy/detect.ts +500 -0
  170. package/src/agent-src/templates/scripts/work_engine/taxonomy/place.ts +183 -0
  171. package/src/config/agent-settings.template.yml +168 -27
  172. package/src/config/auto-rule-budget.json +16 -0
  173. package/src/config/ci-local-parity.yml +36 -5
  174. package/src/config/continuity-surface.json +23 -2
  175. package/src/config/gate-coverage.yml +377 -13
  176. package/src/config/gate-violation-baselines.json +10 -6
  177. package/src/config/hook-latency-budget.json +21 -0
  178. package/src/config/hook-token-budget.json +4 -2
  179. package/src/config/loop-surfaces.yaml +215 -0
  180. package/src/config/metric-registry.yml +114 -0
  181. package/src/config/placeholder-drift-budget.json +10 -0
  182. package/src/config/platform-anchor.json +3 -2
  183. package/src/config/release-gate-locality.yml +11 -0
  184. package/src/config/routing-coverage-seed.json +33 -5
  185. package/src/config/rule-enforcement-baseline.json +0 -1
  186. package/src/install/claudeRuleRewrite.ts +16 -2
  187. package/src/install/conflict.ts +65 -9
  188. package/src/install/conflictTracker.ts +299 -0
  189. package/src/install/fsPrimitives.ts +54 -0
  190. package/src/install/manifestFiles.ts +312 -0
  191. package/src/install/preflight.ts +16 -2
  192. package/src/install/preserve.ts +205 -0
  193. package/src/install/recordedOwnership.ts +149 -0
  194. package/src/install/txlog.ts +11 -2
  195. package/src/install/types.ts +19 -4
  196. package/src/scripts/_cli/cmd_conformance.ts +88 -15
  197. package/src/scripts/_cli/cmd_doctor.ts +7 -20
  198. package/src/scripts/_cli/cmd_route_explain.ts +9 -2
  199. package/src/scripts/_cli/cmd_settings_get.ts +44 -0
  200. package/src/scripts/_cli/doctor_execution.ts +173 -0
  201. package/src/scripts/_cli/doctor_network_posture.ts +226 -0
  202. package/src/scripts/_lib/activation_payload.ts +247 -0
  203. package/src/scripts/_lib/agent_settings.ts +4 -2
  204. package/src/scripts/_lib/authority_path.ts +102 -0
  205. package/src/scripts/_lib/body_portable.ts +102 -0
  206. package/src/scripts/_lib/cascade_base.ts +94 -0
  207. package/src/scripts/_lib/cc_transcript.ts +132 -1
  208. package/src/scripts/_lib/changelog_eras.ts +7 -2
  209. package/src/scripts/_lib/concern_sla_window.ts +200 -0
  210. package/src/scripts/_lib/continuation_ladder.ts +149 -2
  211. package/src/scripts/_lib/council_transport.ts +129 -0
  212. package/src/scripts/_lib/delivery_ready.ts +112 -0
  213. package/src/scripts/_lib/forge_protection.ts +381 -0
  214. package/src/scripts/_lib/forge_reader.ts +558 -0
  215. package/src/scripts/_lib/hook_platform_keys.ts +27 -0
  216. package/src/scripts/_lib/host_env_write.ts +111 -0
  217. package/src/scripts/_lib/json_python_parity.ts +127 -0
  218. package/src/scripts/_lib/lean_projection_mode.ts +14 -3
  219. package/src/scripts/_lib/llm_proposer_transport.ts +14 -4
  220. package/src/scripts/_lib/loop_surfaces.ts +382 -0
  221. package/src/scripts/_lib/mission_record.ts +190 -0
  222. package/src/scripts/_lib/obligation_frequency.ts +217 -0
  223. package/src/scripts/_lib/obligations.ts +513 -0
  224. package/src/scripts/_lib/orchestration_record.ts +11 -20
  225. package/src/scripts/_lib/probe_inputs.ts +271 -0
  226. package/src/scripts/_lib/read_surface_scan.ts +322 -0
  227. package/src/scripts/_lib/release_highlights.ts +201 -11
  228. package/src/scripts/_lib/release_holds.ts +493 -0
  229. package/src/scripts/_lib/release_migration_gate.ts +184 -0
  230. package/src/scripts/_lib/retrieval_sanitize.ts +77 -16
  231. package/src/scripts/_lib/rides_along.ts +102 -0
  232. package/src/scripts/_lib/settings_renamed_keys.ts +82 -0
  233. package/src/scripts/_lib/shell_write_shapes.ts +108 -0
  234. package/src/scripts/_lib/structural_hiding.ts +622 -0
  235. package/src/scripts/_lib/test_delta.ts +166 -0
  236. package/src/scripts/_lib/test_provenance.ts +171 -0
  237. package/src/scripts/_lib/turn_end_refusals.ts +525 -4
  238. package/src/scripts/_lib/turn_end_transcript.ts +216 -0
  239. package/src/scripts/_lib/typed_op_grant.ts +246 -0
  240. package/src/scripts/_lib/typed_op_watch.ts +185 -0
  241. package/src/scripts/_lib/verification_command.ts +324 -0
  242. package/src/scripts/_lib/verification_evidence.ts +647 -0
  243. package/src/scripts/_lib/verify_clause.ts +280 -0
  244. package/src/scripts/ai_council/config.ts +8 -11
  245. package/src/scripts/ai_council/fallback_config.ts +5 -3
  246. package/src/scripts/ai_council/ownership_classes.ts +118 -0
  247. package/src/scripts/ai_team/team_dispatch.ts +4 -0
  248. package/src/scripts/ask_block_census.ts +285 -15
  249. package/src/scripts/before_complete_hook.ts +340 -23
  250. package/src/scripts/bench_hook_latency.ts +412 -5
  251. package/src/scripts/cache_realization_report.ts +61 -1
  252. package/src/scripts/check_argument_hint.ts +287 -0
  253. package/src/scripts/check_claims.ts +125 -1
  254. package/src/scripts/check_enforcement_coverage.ts +38 -9
  255. package/src/scripts/check_enforcement_matrix.ts +866 -0
  256. package/src/scripts/check_finding_dispositions.ts +22 -3
  257. package/src/scripts/check_gate_reachability.ts +173 -10
  258. package/src/scripts/check_generator_sync.ts +1025 -0
  259. package/src/scripts/check_host_docs_digest.ts +786 -0
  260. package/src/scripts/check_host_format_column.ts +559 -0
  261. package/src/scripts/check_input_references.ts +228 -0
  262. package/src/scripts/check_inputs_parity.ts +235 -0
  263. package/src/scripts/check_kernel_edit_ratified.ts +47 -5
  264. package/src/scripts/check_kill_switch_table.ts +294 -0
  265. package/src/scripts/check_placeholder_drift.ts +221 -0
  266. package/src/scripts/check_preamble_payload_budget.ts +75 -2
  267. package/src/scripts/check_read_surface_coverage.ts +515 -0
  268. package/src/scripts/check_release_highlights.ts +33 -1
  269. package/src/scripts/check_release_holds.ts +568 -0
  270. package/src/scripts/check_routing_coverage.ts +378 -11
  271. package/src/scripts/check_rule_projection_integrity.ts +22 -12
  272. package/src/scripts/check_static_parity.ts +17 -0
  273. package/src/scripts/check_test_delta.ts +294 -0
  274. package/src/scripts/check_test_weakening.ts +299 -0
  275. package/src/scripts/ci_settle.ts +145 -19
  276. package/src/scripts/closure_scan.ts +447 -0
  277. package/src/scripts/compile_hook_manifest.ts +102 -18
  278. package/src/scripts/council_record_shape.ts +209 -0
  279. package/src/scripts/external_sources_denylist.json +29 -4
  280. package/src/scripts/hook_manifest.json +1 -1
  281. package/src/scripts/hook_manifest.yaml +127 -11
  282. package/src/scripts/hooks/block_config_weakening.ts +229 -4
  283. package/src/scripts/hooks/block_kernel_rule_writes.ts +9 -78
  284. package/src/scripts/hooks/block_plumbing_writes.ts +314 -0
  285. package/src/scripts/hooks/bundle_integrity.ts +291 -0
  286. package/src/scripts/hooks/chain_nudge_hook.ts +1 -2
  287. package/src/scripts/hooks/code_graph_context_hook.ts +1 -2
  288. package/src/scripts/hooks/comment_discipline_hook.ts +1 -3
  289. package/src/scripts/hooks/concern_registry.ts +6 -0
  290. package/src/scripts/hooks/concern_timings.ts +94 -0
  291. package/src/scripts/hooks/delegation_nudge_hook.ts +1 -2
  292. package/src/scripts/hooks/design_pass_hook.ts +221 -5
  293. package/src/scripts/hooks/design_slop_hook.ts +1 -2
  294. package/src/scripts/hooks/dispatch_hook.ts +25 -19
  295. package/src/scripts/hooks/edit_shape_hook.ts +1 -2
  296. package/src/scripts/hooks/end_review_nudge_hook.ts +1 -1
  297. package/src/scripts/hooks/evidence_independence.ts +97 -2
  298. package/src/scripts/hooks/exit_codes.ts +128 -0
  299. package/src/scripts/hooks/host_lowering.json +1 -0
  300. package/src/scripts/hooks/host_lowering.ts +128 -3
  301. package/src/scripts/hooks/host_lowering.yaml +262 -46
  302. package/src/scripts/hooks/host_semantics.ts +30 -2
  303. package/src/scripts/hooks/injection_budget.ts +9 -2
  304. package/src/scripts/hooks/interruption_ledger_hook.ts +1 -2
  305. package/src/scripts/hooks/journal_record_hook.ts +1 -2
  306. package/src/scripts/hooks/memory_recall_hook.ts +539 -0
  307. package/src/scripts/hooks/obligation_settle_hook.ts +328 -0
  308. package/src/scripts/hooks/one_question_per_ask_hook.ts +25 -4
  309. package/src/scripts/hooks/orchestration_record_hook.ts +1 -2
  310. package/src/scripts/hooks/permission_gate.ts +1 -2
  311. package/src/scripts/hooks/push_settle_hook.ts +1 -3
  312. package/src/scripts/hooks/replay_hook.ts +2 -1
  313. package/src/scripts/hooks/reread_guard_hook.ts +1 -2
  314. package/src/scripts/hooks/review_baseline_hook.ts +1 -2
  315. package/src/scripts/hooks/rtk_wrap_hook.ts +1 -2
  316. package/src/scripts/hooks/rule_inject_hook.ts +55 -4
  317. package/src/scripts/hooks/run_continuation_hook.ts +30 -35
  318. package/src/scripts/hooks/skill_route_hook.ts +1 -2
  319. package/src/scripts/hooks/source_first_gate_hook.ts +1 -2
  320. package/src/scripts/hooks/spawn_guard_shadow_hook.ts +1 -2
  321. package/src/scripts/hooks/subagent_ledger_hook.ts +1 -2
  322. package/src/scripts/hooks/suggestion_capture_hook.ts +1 -1
  323. package/src/scripts/hooks/table_fingerprint.ts +49 -0
  324. package/src/scripts/hooks/telemetry_flush_hook.ts +1 -2
  325. package/src/scripts/hooks/telemetry_usage_hook.ts +1 -2
  326. package/src/scripts/hooks/tool_result_bytes_hook.ts +93 -9
  327. package/src/scripts/hooks/turn_end_gate_hook.ts +337 -324
  328. package/src/scripts/hooks/ui_route_nudge_hook.ts +1 -2
  329. package/src/scripts/hooks_doctor.ts +85 -0
  330. package/src/scripts/hooks_status.ts +19 -0
  331. package/src/scripts/install.ts +109 -210
  332. package/src/scripts/janitor.ts +7 -0
  333. package/src/scripts/lint_decision_classes.ts +464 -0
  334. package/src/scripts/lint_deny_text.ts +419 -0
  335. package/src/scripts/lint_exit_codes.ts +262 -0
  336. package/src/scripts/lint_hook_manifest.ts +66 -0
  337. package/src/scripts/lint_major_migration_sections.ts +450 -0
  338. package/src/scripts/lint_plan_risk_register.ts +47 -3
  339. package/src/scripts/lint_roadmap_blockers.ts +139 -12
  340. package/src/scripts/lint_roadmap_producers.ts +202 -0
  341. package/src/scripts/lint_skill_descriptions.ts +1 -1
  342. package/src/scripts/lint_skill_scripts_readonly.ts +1 -1
  343. package/src/scripts/mcp_server/prompts.ts +142 -1
  344. package/src/scripts/measure_rule_budget.ts +101 -5
  345. package/src/scripts/measure_skill_ranker_baseline.ts +305 -51
  346. package/src/scripts/measure_turn_end_gate.ts +193 -0
  347. package/src/scripts/memory_lookup.ts +1 -1
  348. package/src/scripts/new_roadmap.ts +37 -0
  349. package/src/scripts/orchestration_record.ts +0 -5
  350. package/src/scripts/prepack-check.mjs +53 -0
  351. package/src/scripts/release.ts +14 -98
  352. package/src/scripts/release_drill.ts +267 -1
  353. package/src/scripts/release_publication.ts +64 -1
  354. package/src/scripts/report_enforcement_drift.ts +566 -0
  355. package/src/scripts/report_host_injection_effect.ts +3 -11
  356. package/src/scripts/report_invocation_surface.ts +383 -0
  357. package/src/scripts/report_obligation_carriers.ts +699 -0
  358. package/src/scripts/report_obligation_writer_split.ts +236 -0
  359. package/src/scripts/report_skill_menu_census.ts +208 -0
  360. package/src/scripts/report_standing_payload_by_host.ts +26 -152
  361. package/src/scripts/roadmap_verify_share.ts +213 -0
  362. package/src/scripts/schemas/agent-settings.schema.json +23 -0
  363. package/src/scripts/schemas/command.schema.json +48 -0
  364. package/src/scripts/schemas/review-findings.schema.json +4 -0
  365. package/src/scripts/schemas/skill.schema.json +44 -0
  366. package/src/scripts/scope_growth.ts +219 -0
  367. package/src/scripts/self_review_gate.ts +359 -10
  368. package/src/scripts/semantic_parity_census.ts +314 -0
  369. package/src/scripts/session_eol_report.ts +54 -1
  370. package/src/scripts/sweep_dead_scan_roots.ts +1 -1
  371. package/src/scripts/trigger_eval_grandfather.json +0 -3
  372. package/src/scripts/trigger_eval_rotation.ts +122 -27
  373. package/src/scripts/ui_conformance_probe.ts +774 -0
  374. package/src/scripts/update_prices.ts +85 -3
  375. package/src/scripts/write_bundle_digest.mjs +74 -0
  376. package/src/server/schemas/settings.ts +62 -7
  377. package/src/shared/missionExecution.ts +126 -0
  378. package/src/templates/consumer-settings/ONBOARDING.md +1 -0
  379. package/dist/cli-delegate/chunk-523HCFYO.js +0 -90
  380. package/dist/ui/assets/index-D0jaCRPM.js +0 -29
  381. package/dist/ui/assets/index-jSfMW8_t.css +0 -1
  382. /package/dist/cli-delegate/{chunk-YUM5KURG.js → chunk-7RQP4UDH.js} +0 -0
@@ -83,7 +83,15 @@ regressions are detectable. Pick the verdict commands per the project's
83
83
 
84
84
  Each iteration is agent turns, never executing control-flow code:
85
85
 
86
- 1. **Generate / revise** — make the smallest change toward the contract.
86
+ 1. **Read the failure, then revise** — before changing a line, inspect what the
87
+ previous run actually reported: which checks failed, the assertion text, and
88
+ whether this failure signature matches the last one. Analyze the existing
89
+ code path the failing check exercises rather than pattern-matching the error
90
+ string. A revision written without reading the failure is the blind retry
91
+ both the plateau rule below and
92
+ [`autonomous-execution`](../../rules/autonomous-execution.md) exist to stop —
93
+ and on attempt 1 there is no previous run, so this is the baseline green set
94
+ from step 1. Then make the smallest change toward the contract.
87
95
  2. **Run** — execute the verdict commands; parse the **structured** result
88
96
  (counts green/total, which checks failed). This is one tool call, read in
89
97
  context.
@@ -183,6 +191,7 @@ verify-repair-loop
183
191
  Contract: <one-line requirement> · threshold <X> · allow_regressions false
184
192
  Attempts: <k>/<max> scores: [s1, s2, …] stop: threshold|plateau|cap|regression|reject
185
193
  Verdict: DONE | DONE_WITH_CONCERNS | BLOCKED
194
+ run_terminal: success | blocked | exhausted | stagnated
186
195
  Judge: <judge skill> → apply|revise|reject
187
196
  Evidence: <green/total> · regressions: none | <named checks>
188
197
  ```
@@ -193,9 +202,34 @@ Required fields (ordered):
193
202
  2. **Attempts** — `k/max`, the score history, and the exact stop reason
194
203
  (`threshold` / `plateau` / `cap` / `regression` / `reject`).
195
204
  3. **Verdict** — `DONE`, `DONE_WITH_CONCERNS`, or `BLOCKED`.
196
- 4. **Judge** — the dispatched judge skill and its `apply` / `revise` /
205
+ 4. **run_terminal** — this loop's stop in the vocabulary every other loop in
206
+ this tree reports in. The verdict above is local to this skill; this field is
207
+ the one a reader can aggregate across the continuation hook, the self-fix
208
+ lanes and this loop without a per-surface translation table.
209
+
210
+ | stop reason | `run_terminal` | why |
211
+ |---|---|---|
212
+ | `threshold` (judge `apply`) | `success` | the contract is met |
213
+ | `cap` | `exhausted` | the attempt budget ran out — a bigger budget might help |
214
+ | `plateau` | `stagnated` | scores stopped moving — a bigger budget will not help |
215
+ | `regression` | `blocked` | a baseline-green check broke; the loop must not proceed |
216
+ | `reject` | `blocked` | the judge refused the work |
217
+
218
+ The value set is `RunTerminalState`, whose members are `success`,
219
+ `clean-no-op`, `blocked`, `approval-required`, `exhausted`, `stagnated` and
220
+ `premise-invalidated`. It is declared once, at
221
+ `src/scripts/_lib/outcome_vocabularies.ts` (`RUN_TERMINAL_STATES`), and
222
+ described in [`terminal-states`](../../agent-src/contexts/execution/terminal-states.md).
223
+ Never emit a value outside that set: a sixth stop reason maps onto an
224
+ existing member or it is not a terminal state.
225
+
226
+ `exhausted` and `stagnated` are deliberately distinct. Both mean "stopped
227
+ without a green", and they call for opposite responses — raise the budget
228
+ against the first, change approach against the second. Collapsing them loses
229
+ the only part of the stop a reader can act on.
230
+ 5. **Judge** — the dispatched judge skill and its `apply` / `revise` /
197
231
  `reject` verdict (omit only when the loop stopped before escalation).
198
- 5. **Evidence** — final `green/total` and any regressed checks by name.
232
+ 6. **Evidence** — final `green/total` and any regressed checks by name.
199
233
 
200
234
  ## Examples
201
235
 
@@ -654,7 +654,7 @@ the canonical narrative lives in
654
654
  | `commands.create_pr.api_paths` | glob list | `[]` | Optional globs pinning API-endpoint detection; empty = light heuristic, fail-open. |
655
655
  | `verbosity.preview_artifacts` | `true`, `false` | `false` | Show generated commit messages, PR titles/bodies, branch names before acting. `false` = use generated content directly. See the token-frugality plate under `agents/roadmaps/` (Phase 2/3). |
656
656
  | `verbosity.routine_confirmations` | `true`, `false` | `false` | Confirmation prompts for routine workflow steps when there is one obvious answer ("looks good — commit?"). Iron-Law gates (`commit-policy`, `scope-control` git-ops, `non-destructive-by-default`) ALWAYS ask regardless. |
657
- | `verbosity.offer_council_in_delivery` | `true`, `false` | `false` | Offer "run AI Council on this?" inside delivery commands (`/feature-plan`, `/review-changes`, `/roadmap-create`). Council commands themselves are unaffected. |
657
+ | `verbosity.offer_council_in_delivery` | `true`, `false` | `false` | Offer "run AI Council on this?" inside delivery commands (`/feature-plan`, `/review-changes`). Council commands themselves are unaffected. `/roadmap:create` no longer reads it — under a mission the council is a step, resolved from `agent-config council:status`, never an offer. |
658
658
  | `verbosity.post_action_reports` | `off`, `minimal`, `full` | `minimal` | Multi-line status / summary blocks after a successful action. `off` = no report; `minimal` = one-line confirmation; `full` = bullet list. |
659
659
  | `verbosity.intent_announcements` | `true`, `false` | `false` | Intent announcements ("Let me check…", "Now I will…", "Found it") in skill bodies. `false` = act and emit the result. |
660
660
  | `telegraph.speak` | `true`, `false` | `false` | Whether the telegraph-speak rule ships at all. `false` (default) = dormant: the projector omits the rule from `dist/router.json`, so its body never reaches a host. The rule body states its own grammar scope and carve-outs (numbered options, Iron-Law literals, code, paths), so this is the only lever. |
@@ -39,7 +39,7 @@ schema_version: 1
39
39
  # CI guard: a release bump of `package.json` must update this value
40
40
  # in lockstep — see scripts/check_template_pin_drift.ts (road-to-
41
41
  # portable-runtime-and-update-check P3.3).
42
- agent_config_version: "16.0.0"
42
+ agent_config_version: "16.2.0"
43
43
 
44
44
  # --- Project identity ---
45
45
  project:
@@ -64,6 +64,16 @@ that was never a judgement call.
64
64
  "Target release: X.Y.Z", never plan git tags or deprecation dates. Release
65
65
  and tag decisions belong to the user and are taken outside the roadmap.
66
66
  This is enforced by [`scope-control`](../rules/scope-control.md#git-operations--permission-gated).
67
+
68
+ **What the prohibition does not reach — a state, not a schedule.** The five
69
+ sentences above are unchanged and stay the rule: a roadmap does not decide
70
+ *when* or *in which version* work ships. It MUST, however, declare any
71
+ intentionally unreleasable intermediate tree state, together with the
72
+ machine-verified condition that clears it, per rule 28. Naming a state that
73
+ must not be published is not a release decision — it is a fact about the tree
74
+ that the release path has no other way to learn, and today cannot learn: the
75
+ release entry points read no roadmap at all. Declaring the state is
76
+ mandatory; deciding what to do about it at a cut is still the operator's.
67
77
  14. **No automatic branch switches mid-roadmap.** Roadmap work runs on the
68
78
  branch the user is on. If a separate branch (spike, hotfix, experiment)
69
79
  would be genuinely useful, the agent may propose it **once** while
@@ -231,6 +241,32 @@ that was never a judgement call.
231
241
  edge source stays the single one already defined above; `relates:` never
232
242
  becomes a second dependency source.
233
243
 
244
+ **Sibling block, same frontmatter — `delivery:`.** Optional, and unlike
245
+ `execution:` it describes what happens to the BRANCH rather than to the
246
+ run's interaction pattern:
247
+
248
+ ```yaml
249
+ delivery:
250
+ pr_topology: stacked # single (default) | stacked
251
+ ```
252
+
253
+ `pr_topology: stacked` declares a dependent series of pull requests. It is
254
+ a plan the owner writes before execution and is **never** chosen by the
255
+ agent and never asked about at roadmap creation — see the `delivery:` block
256
+ in `agent-settings.template.yml`, where all three keys are Class C for that
257
+ reason. A roadmap declaring `stacked` owes a `## PR plan` section naming
258
+ the series and the order; `single` owes nothing, which is why it is the
259
+ default.
260
+
261
+ **Not yet a live override, and this is the honest state rather than an
262
+ omission.** `load_agent_settings` has four layers and none of them is a
263
+ roadmap, so a `delivery:` block here is read by no code today. It is
264
+ documented now because the key it mirrors is Class C — the owner has to
265
+ have a place to write the plan that is not an agent-writable setting — and
266
+ the cascade layer that would read it is scheduled by ADR-268, not yet
267
+ built. Until it is, treat a `delivery:` block here as a note to the next
268
+ human reader rather than as configuration.
269
+
234
270
  An explicit `relates: []` is a complete answer and the common one, but only
235
271
  when it carries the probe's `scanned:` line as its justification:
236
272
 
@@ -301,6 +337,13 @@ that was never a judgement call.
301
337
  step gated by a specific blocker may cross-reference it inline:
302
338
  `- [ ] … <!-- blocked-by: <blocker-id> -->`.
303
339
 
340
+ **A blocker stops execution; a hold stops publication.** The two are not
341
+ interchangeable and never substitute for one another. A blocker says the work
342
+ cannot proceed and is cleared by a person; a release hold (rule 28) says the
343
+ work may proceed but its intermediate tree state must not ship, and is
344
+ cleared by a checkbox whose `verify:` a machine runs. A roadmap that is
345
+ merely unfinished has neither — incompleteness is not a release condition.
346
+
304
347
  **A user-decision blocker's annotation records whether the question
305
348
  was actually put.** Where the blocker's `Owner:` is the maintainer,
306
349
  the user or the owner, the marker carries an `asked:` field —
@@ -400,6 +443,22 @@ that was never a judgement call.
400
443
  on nothing until an author declares a class and there is no backlog
401
444
  to grandfather.
402
445
 
446
+ **A judgement call is never parked here.** A blocker records a decision
447
+ the agent **correctly did not own**. A technical judgement call — two
448
+ valid architectures, a dependency trade-off, an unclear boundary with no
449
+ new product semantics — is not one of those: it routes back through the
450
+ closure pass and is resolved at the lowest rung that owns it (evidence,
451
+ convention, the agent, an independent session, the council, the team),
452
+ then recorded as a `## Decisions` row per rule 27. A technical decision
453
+ does not become owner-owned because it is hard (ADR-268 § 10).
454
+
455
+ An entry MAY declare `- **Ownership:** <class>`, and when it does the
456
+ class must be one of the three owner-owned ones — `product-owned`,
457
+ `business-owned`, `destructive-owned`. A technical class there is the
458
+ parked judgement call this retires, and `lint_roadmap_blockers` reds it.
459
+ The field is optional and HARD rather than ratcheted, on the same
460
+ no-backlog-to-grandfather ground as `Class:`.
461
+
403
462
  **Legacy fallback.** A body-level `> Blocked until <condition>`
404
463
  note (the follow-up-roadmap convention from rule 17) is parsed by
405
464
  the dashboard generator as one implicit roadmap-level blocker
@@ -516,6 +575,36 @@ that was never a judgement call.
516
575
  full CI pipeline — per `roadmap-ci-steps-policy` a `verify:` must not
517
576
  be a full-suite gate.
518
577
 
578
+ **The expectation half — say what the command must produce.** A command
579
+ alone names no oracle. `` verify: `cat notes.md` `` is a conforming step
580
+ field that cannot say no, so the box gets flipped on a command that was
581
+ never able to fail. In practice the great majority of clauses in a
582
+ roadmap tree state no oracle at all — run the share command below on
583
+ your own tree rather than trusting a number written here. A clause
584
+ MAY therefore state what the command must produce, using the arrow
585
+ `exec:` evidence already carries — not a new symbol:
586
+
587
+ - `` verify: `<cmd>` -> 0 `` — the command must exit with that code.
588
+ - `` verify: `<cmd>` -> /regex/ `` — its output must match.
589
+
590
+ Prose after `verify:` stays legal and reads as MANUAL. Forbidding it
591
+ would invalidate most clauses already in the tree at a stroke, and a
592
+ grammar that reds every producer gets weakened until it finds nothing.
593
+ One parser reads the arrow (`src/scripts/_lib/verify_clause.ts`) and
594
+ nothing parses it a second time. `closure_scan`'s `unfalsifiable-verify`
595
+ family reports the clauses whose oracle cannot say no, and exits 0
596
+ unconditionally — it is a listing, never a gate. The share per roadmap
597
+ is `./scripts-run src/scripts/roadmap_verify_share`.
598
+
599
+ **An absence check names its positive control.** A `verify:` asserting
600
+ that something is *absent* — no match, no occurrence, an empty diff —
601
+ passes identically when the property holds, when the check itself is
602
+ broken, when the path moved, and when the corpus is empty. Such a clause
603
+ MUST name the input on which it does fire: the positive control. A
604
+ fixture that plants the thing, a prior commit that carried it, or a
605
+ sabotage the step records. Without one it is a check nobody has seen
606
+ working, and its green means only that nothing ran.
607
+
519
608
  24. **Ready roadmaps carry a `## Risk Register` (Gate R1).** Every
520
609
  ready (non-draft) roadmap ends with a schema-valid Risk Register —
521
610
  marker line (`<!-- risk-review: v1 | reviewed: YYYY-MM-DD |
@@ -582,6 +671,126 @@ that was never a judgement call.
582
671
  tracked estate; blocking is earned by tracked-scope evidence, not
583
672
  assumed).
584
673
 
674
+ 27. **A ready roadmap carries no unresolved decision — it carries a
675
+ `## Decisions` table.** A plan enters execution as an **execution
676
+ contract**: every foreseeable decision closed before the first step,
677
+ so a long run never meets a question planning could have closed.
678
+
679
+ The section is a six-column table, and the two vocabularies in it are
680
+ closed sets:
681
+
682
+ ```markdown
683
+ ## Decisions
684
+
685
+ | ID | ownership | resolved by | decision | evidence | revisit if |
686
+ |---|---|---|---|---|---|
687
+ | D1 | contested-technical | council:2026-09-13 | NDJSON on disk | streaming read at bounded RSS | the reader stops streaming |
688
+ ```
689
+
690
+ `ownership` is one of the eight ownership classes — `deterministic`,
691
+ `reversible-technical`, `contested-technical`, `critical-technical`,
692
+ `product-owned`, `business-owned`, `destructive-owned`,
693
+ `spend-exhaustion`. The axis is **ownership, not impact**: a technical
694
+ decision does not become owner-owned because it is hard
695
+ (ADR-268 § 10). `resolved by` is one of `evidence`, `agent`,
696
+ `independent:<session or model>`, `council:<record>`, `team:<record>`,
697
+ `owner` — the prefixed forms carry their record, because a resolver
698
+ with no record is a claim rather than a resolution.
699
+
700
+ `revisit if` names the condition that reopens the row. Execution reads
701
+ the table **before any step**, and a closed decision is re-asked only
702
+ when its `revisit if` condition became true — not because a context
703
+ reset lost it, which is the repeat the ask census counts.
704
+
705
+ Enforced by `lint_decision_classes`: in a ready roadmap an unresolved
706
+ marker (`TBD`, *to be decided*, *decide later*, *open question*)
707
+ outside the section is a finding, and the same marker resolved into a
708
+ row is not. `## Blockers` is the other discharge — a five-field
709
+ structured blocker IS the record of a decision the agent correctly did
710
+ not own, so an open item there is not an unclosed one.
711
+
712
+ The section is owed where there is a decision to record. A plan that
713
+ closed everything inline carries no table and no marker, and is
714
+ complete; an empty table written to satisfy a template records
715
+ nothing, exactly as rule 25 says of a perfunctory pre-mortem.
716
+
717
+ 28. **Release holds — declare an unreleasable intermediate state, or there is
718
+ not one.** A roadmap whose intermediate tree state must not be published
719
+ declares that state in a `## Release holds` section. Nothing else in the
720
+ repository can express it, and the release path reads no roadmap today, so
721
+ an undeclared unreleasable state is invisible to every release boundary.
722
+
723
+ **Non-goal, stated first because it is the failure mode closest to hand:
724
+ roadmap *incompleteness* is never a release condition.** An unfinished
725
+ roadmap does not block a release, has never blocked one, and must not start
726
+ to. A hold is a positive declaration about a named tree state, never a side
727
+ effect of open checkboxes.
728
+
729
+ **Authoring order — `re-sequence → guard → hold`, in that order.** A hold is
730
+ the last resort, not the first tool:
731
+
732
+ 1. **Re-sequence.** Can the phases be cut so that no intermediate state is
733
+ broken? A continuous shape needs no hold and is always preferred.
734
+ 2. **Guard.** Can the half-built surface be hidden behind a flag, an unwired
735
+ entry point, or a default that keeps it inert? A guarded state is
736
+ publishable and needs no hold.
737
+ 3. **Hold.** Only when neither works. Every hold entry therefore carries a
738
+ mandatory `Why not a guard:` field naming the concrete reason the guard
739
+ rung failed. A hold entry without it is malformed and reddens CI.
740
+
741
+ **Entry shape** (one entry per hold, inside `## Release holds`):
742
+
743
+ ```markdown
744
+ ## Release holds
745
+
746
+ ### hold: <kebab-id>
747
+ - **Channel:** all <!-- all | latest -->
748
+ - **Opened by:** <phase.step> <!-- the checkbox whose [x] opens the window -->
749
+ - **Cleared by:** <phase.step> <!-- the checkbox whose [x] closes it -->
750
+ - **State:** {the one sentence naming what is broken in the tree while open.}
751
+ - **Why not a guard:** {why rung 2 failed, concretely.}
752
+ ```
753
+
754
+ **Marker grammar.** Both named steps carry an inline marker so the binding is
755
+ readable from the checkbox and not only from the section:
756
+ `- [ ] … <!-- opens-hold: <hold-id> -->` and
757
+ `- [ ] … <!-- clears-hold: <hold-id> -->`. The clearing step MUST carry a
758
+ `verify:` field (rule 23) — a hold cleared by an unverified flip is a hold
759
+ cleared by assertion.
760
+
761
+ **Channel vocabulary.** `all` (the default, and what an omitted `Channel:`
762
+ parses to) refuses every cut. `latest` refuses a stable `X.Y.Z` cut and
763
+ permits a `-next.N` prerelease, for a state safe to publish to an opt-in
764
+ channel but not to the default one. There is no third value and no override:
765
+ a plain `X.Y.Z` cut is never silently converted to a prerelease, and the
766
+ choice between finishing the clearing step, cutting `-next.N`, and using a
767
+ release line stays the operator's.
768
+
769
+ **State table.** A hold is in exactly one of four states, and only the first
770
+ is publishable:
771
+
772
+ | State | How it is reached | Release boundary |
773
+ |---|---|---|
774
+ | `unopened` | the opening checkbox is not `[x]` | permits |
775
+ | `open` | opener `[x]`, clearer not `[x]` | **refuses**, per `Channel:` |
776
+ | `cleared` | both `[x]` | permits |
777
+ | `not-evaluable` | the declaration is malformed, the file unreadable, or the evaluator errored or timed out | **refuses**, always, on every channel |
778
+
779
+ `not-evaluable` refusing is the load-bearing row: there is no path on which
780
+ "could not evaluate" reads as safe. A malformed declaration additionally
781
+ reddens normal CI, so a broken hold cannot fail open by being unparseable.
782
+
783
+ **Per-folder lifecycle.** A window does not disappear by moving the file.
784
+ A roadmap with an open window may not be moved to `archive/` or `skipped/` —
785
+ the move is refused naming the hold id. It may be moved to `later/`, and the
786
+ open window is then named in the `entry_condition.what` part; it still lists
787
+ and still refuses. Deletion is a known residual, not a mitigation: rule 12
788
+ already forbids it and no gate can see a file that is gone.
789
+
790
+ **No versions inside a hold entry.** Rule 13's prohibition applies inside
791
+ `## Release holds` exactly as it does everywhere else. A hold names a *state*
792
+ and its clearing *checkbox*; it never names a version, a tag, or a date.
793
+
585
794
  ---
586
795
 
587
796
  ## Quality Gates (remote CI by default)
@@ -672,6 +881,15 @@ complexity: lightweight
672
881
  - [ ] {Observable, testable criterion}
673
882
  - [ ] All quality gates pass (PHPStan, Rector, tests)
674
883
 
884
+ <!-- ## Decisions — INCLUDE when the closure pass closed a decision this
885
+ plan would otherwise have met mid-run (rule 27). OMIT entirely when
886
+ nothing was open: an empty table records nothing.
887
+ ## Decisions
888
+
889
+ | ID | ownership | resolved by | decision | evidence | revisit if |
890
+ |---|---|---|---|---|---|
891
+ | D1 | {ownership class} | {resolver} | {what was decided} | {file:line, record, probe} | {condition that reopens it} | -->
892
+
675
893
  <!-- ## Blockers — INCLUDE ONLY when a gate exists that only the user /
676
894
  a maintainer can clear (decision, external dependency, evidence
677
895
  threshold, soak window). OMIT entirely when there are none — see
@@ -78,6 +78,41 @@ export const VOLATILE_KEYS: ReadonlyArray<string> = [
78
78
  /** Why the loop stopped, or that it has budget left. */
79
79
  export type SelfFixKind = 'retry' | 'exhausted' | 'no_progress';
80
80
 
81
+ /**
82
+ * `SelfFixKind` in the vocabulary a reader can aggregate across surfaces.
83
+ *
84
+ * `Outcome.PARTIAL` says the loop stopped without a green; it cannot say
85
+ * whether the budget ran out or the target stopped moving, and those want
86
+ * different responses — a bigger budget against the first, a different
87
+ * approach against the second. Until now the distinction left this module only
88
+ * inside a free-text `message`, so the continuation hook's stops were
89
+ * countable and this loop's were not.
90
+ *
91
+ * The two values are members of `RunTerminalState`, whose authoritative
92
+ * declaration is `src/scripts/_lib/outcome_vocabularies.ts:RUN_TERMINAL_STATES`
93
+ * and whose prose home is `contexts/execution/terminal-states.md`. They are
94
+ * written as literals rather than imported because this file is a TEMPLATE:
95
+ * it ships into consumer projects that have no `src/scripts/_lib` to import
96
+ * from, and reaching across that boundary would break every install. It is a
97
+ * two-member projection across a packaging boundary, not a second vocabulary —
98
+ * nothing here may add a member the registry does not have.
99
+ */
100
+ export const RUN_TERMINAL_BY_KIND: Readonly<Record<Exclude<SelfFixKind, 'retry'>, string>> = {
101
+ exhausted: 'exhausted',
102
+ no_progress: 'stagnated',
103
+ };
104
+
105
+ /**
106
+ * The run-terminal value for a decision, or `null` while the loop is still live.
107
+ *
108
+ * `retry` has no terminal by construction — the loop has not stopped — and the
109
+ * null is returned rather than defaulted so a caller cannot accidentally stamp
110
+ * a terminal value onto a run that is still going.
111
+ */
112
+ export function run_terminal_for(kind: SelfFixKind): string | null {
113
+ return kind === 'retry' ? null : RUN_TERMINAL_BY_KIND[kind];
114
+ }
115
+
81
116
  /** Verdict of {@link decide} — pure, so the caller owns every mutation. */
82
117
  export interface SelfFixDecision {
83
118
  kind: SelfFixKind;
@@ -147,6 +182,27 @@ export function record_attempt(state: DeliveryState, lane: string, signature: st
147
182
  state.self_fix = container;
148
183
  }
149
184
 
185
+ /**
186
+ * Stamp the lane's run-terminal value onto `state.self_fix`.
187
+ *
188
+ * Written into the state the module already owns and the dispatcher already
189
+ * persists, rather than onto `StepResult` — `StepResult` carries `outcome`,
190
+ * `questions` and `message` and is shared by every directive in the engine, so
191
+ * widening it for one loop's stop reason would be a change to all of them.
192
+ *
193
+ * A `retry` decision writes nothing: the loop has not stopped, and a terminal
194
+ * value recorded mid-loop would be read as one by anything aggregating the
195
+ * field.
196
+ */
197
+ export function record_run_terminal(state: DeliveryState, lane: string, decision: SelfFixDecision): void {
198
+ const run_terminal = run_terminal_for(decision.kind);
199
+ if (run_terminal === null) return;
200
+ const container = _pyTruthy(state.self_fix) ? (state.self_fix as Record<string, Any>) : {};
201
+ const lane_state = _lane_state(state, lane);
202
+ container[lane] = { ...lane_state, run_terminal };
203
+ state.self_fix = container;
204
+ }
205
+
150
206
  /** DoD entries the agent has not recorded as proven. Never inferred. */
151
207
  export function unmet_dod(state: DeliveryState): Array<Record<string, Any>> {
152
208
  const dod = (state.ticket ?? {})['dod'];
@@ -213,8 +269,11 @@ export function partial_exit(args: {
213
269
  decision: SelfFixDecision;
214
270
  unmet: Array<Record<string, Any>>;
215
271
  rerun_directive: string;
272
+ /** Written the run-terminal value onto, when the caller has the state in hand. */
273
+ state?: DeliveryState;
216
274
  }): StepResult {
217
- const { lane, ticket_id, verdict, decision, unmet, rerun_directive } = args;
275
+ const { lane, ticket_id, verdict, decision, unmet, rerun_directive, state } = args;
276
+ if (state !== undefined) record_run_terminal(state, lane, decision);
218
277
  const reason =
219
278
  decision.kind === 'no_progress'
220
279
  ? `two consecutive attempts produced an identical \`${lane}\` verdict, ` +
@@ -244,7 +303,8 @@ export function partial_exit(args: {
244
303
  ],
245
304
  message:
246
305
  `Ticket ${ticket_id} ${lane} verdict is \`${String(verdict)}\` after ` +
247
- `${decision.attempts} self-fix attempt(s) (${decision.kind}); exiting PARTIAL.`,
306
+ `${decision.attempts} self-fix attempt(s) (${decision.kind}); exiting PARTIAL ` +
307
+ `(run_terminal: ${String(run_terminal_for(decision.kind))}).`,
248
308
  });
249
309
  }
250
310
 
@@ -225,6 +225,7 @@ function _blocked_on_bad_verdict(state: DeliveryState, verdict: Any): StepResult
225
225
  decision,
226
226
  unmet: unmet_dod(state),
227
227
  rerun_directive: 'run-tests',
228
+ state,
228
229
  });
229
230
  }
230
231
 
@@ -201,6 +201,7 @@ function _blocked_on_bad_verdict(state: DeliveryState, verdict: Any): StepResult
201
201
  decision,
202
202
  unmet: unmet_dod(state),
203
203
  rerun_directive: 'review-changes',
204
+ state,
204
205
  });
205
206
  }
206
207
 
@@ -11,8 +11,9 @@
11
11
  *
12
12
  * The gate is **scoped to the greenfield-scaffold path only**. It acts only
13
13
  * when `state.ui_audit` records `greenfield == True` and
14
- * `greenfield_decision == "scaffold"`. Every other UI flow sees this slot as a
15
- * clean `SUCCESS` no-op, so those flows stay byte-identical.
14
+ * `greenfield_decision` ∈ `{scaffold, granularity_convention}`. Every other
15
+ * UI flow sees this slot as a clean `SUCCESS` no-op, so those flows stay
16
+ * byte-identical.
16
17
  */
17
18
  import {
18
19
  type Any,
@@ -21,6 +22,7 @@ import {
21
22
  StepResult,
22
23
  agent_directive,
23
24
  } from '../../delivery_state.js';
25
+ import { GRANULARITY_CONVENTION } from '../../state.js';
24
26
 
25
27
  /** Declared ambiguity surfaces for this step. */
26
28
  export const AMBIGUITIES: ReadonlyArray<Record<string, string>> = [
@@ -112,14 +114,18 @@ export function run(state: DeliveryState): StepResult {
112
114
  * The gate is inert for every other flow: improve-existing, the `bare` /
113
115
  * `external_reference` greenfield picks, and the `diff` / `file` envelopes all
114
116
  * leave `ui_audit` without the `greenfield == True` +
115
- * `greenfield_decision == "scaffold"` pair.
117
+ * `greenfield_decision` ∈ `{scaffold, granularity_convention}` pair.
116
118
  */
117
119
  function _is_greenfield_scaffold(state: DeliveryState): boolean {
118
120
  const audit = state.ui_audit;
119
121
  if (!_isDict(audit)) return false;
122
+ // `granularity_convention` is option 4 — a scaffold that additionally
123
+ // organises what it creates under a named convention, so it takes the same
124
+ // grounding pass. Kept in step with the identical guard in `scaffold`.
120
125
  return (
121
126
  audit['greenfield'] === true &&
122
- audit['greenfield_decision'] === 'scaffold'
127
+ (audit['greenfield_decision'] === 'scaffold' ||
128
+ audit['greenfield_decision'] === GRANULARITY_CONVENTION)
123
129
  );
124
130
  }
125
131