@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
@@ -4068,6 +4068,8 @@ var leanProjectionHost = external_exports.enum(["claude-code", "cursor", "cline"
4068
4068
  var projectionMode = external_exports.enum(["legacy-all", "scoped"]);
4069
4069
  var memoryCadence = external_exports.enum(["auto", "always", "never"]);
4070
4070
  var projectAudience = external_exports.enum(["self", "internal", "client", "public"]);
4071
+ var deliveryMerge = external_exports.enum(["off", "on-green"]);
4072
+ var prTopology = external_exports.enum(["single", "stacked"]);
4071
4073
  var settingsSchema = external_exports.object({
4072
4074
  agent_config_version: external_exports.string().default("").describe(
4073
4075
  'Pin the package to an exact semver (e.g. "1.4.2") so all teammates load the same skill / rule set. Leave empty to track whatever is installed locally \u2014 useful for the maintainers of this package, risky for production projects.'
@@ -4096,7 +4098,7 @@ var settingsSchema = external_exports.object({
4096
4098
  ),
4097
4099
  lean_projection: external_exports.object({
4098
4100
  mode: leanProjectionMode.default("eager-all").describe(
4099
- "How the per-tool projector emits the rule layer. eager-all = every rule body inlined into every projection (safe; what an ABSENT key still resolves to, per ADR-267 decision point 4). thin = kernel rules full-bodied + non-kernel rules as router-resolved pointers (~45k GPT-tok lighter per session), with no delivery mechanism. delivery = thin stubs PLUS the rule-inject hook concern, which delivers a body back on a trigger match; this is the value the SHIPPED TEMPLATE carries for Claude Code since ADR-267, and the activation charge for it is paid in src/config/hook-token-budget.json (user_prompt_submit slot sum 4,096 -> 16,384)."
4101
+ "How the per-tool projector emits the rule layer. eager-all = every rule body inlined into every projection (safe; what an ABSENT key still resolves to, per ADR-267 decision point 4). thin = kernel rules full-bodied + non-kernel rules as router-resolved pointers (~45k GPT-tok lighter per session, exact-BPE \u2014 a different unit from the chars/4 figures below, never compare the two directly), with no delivery mechanism. delivery = thin stubs PLUS the rule-inject hook concern, which delivers a body back on a trigger match; this is the value the SHIPPED TEMPLATE carries for Claude Code since ADR-267. SAVING AND CHARGE, MEASURED TOGETHER so neither is published alone (2026-09-12, `check_preamble_payload_budget`): the rule bucket falls 122,769 -> 24,537 chars/4 tok per session on a thinned host (-80.0%), and a trigger match costs p50 6,728 B / p90 14,016 B / max 16,297 B per fire over 318 gate-open fires of the frozen tests/eval/routing-matrix corpus at the concern's 16,384 B cap. Bytes per fire and tokens per session are different denominators and are never summed; re-read both rather than quoting this line. The ceiling for that charge is registered in src/config/hook-token-budget.json (user_prompt_submit slot sum 4,096 -> 16,384)."
4100
4102
  ),
4101
4103
  hosts: external_exports.array(leanProjectionHost).default(["claude-code"]).describe(
4102
4104
  "Which hosts a thinning mode may thin (ADR-267). Absent resolves to [claude-code]. Only the three hosts with a per-rule rule tree are accepted, and this enum is the AUTHORING layer: an id outside it is a hard validation FAILURE here and under validate_agent_settings, never a warning. resolveLeanProjectionHosts is the READ-TIME backstop for a hand-edited .agent-settings.yml that passed neither, and THERE the id is dropped with a warning (R2 finding 6 \u2014 the two layers answer differently and neither said so). Every host outside this list receives exactly what eager-all writes, asserted byte-for-byte by check_host_tree_parity."
@@ -4185,6 +4187,48 @@ var settingsSchema = external_exports.object({
4185
4187
  "How the agent replies to PR review comments. create_review_comment = post a new review comment (works on every GitHub plan). replies_endpoint = thread the reply under the original comment (needs the newer REST endpoint). auto = detect at runtime, prefer threaded replies when available."
4186
4188
  )
4187
4189
  }),
4190
+ delivery: external_exports.object({
4191
+ merge: deliveryMerge.default("off").describe(
4192
+ "Whether a run may merge the pull request it produced. off (default) = the run ends at mergeable-green-and-open and says so. on-green = merge is permitted, and only when an object-bound grant covering {op: prod_merge, target: <base>} exists and the final head is required-check-green, target-current and tamper-checked. This key is a precondition, never the authorisation by itself; forge auto-merge is the mechanism, so branch protection stays the gate."
4193
+ ),
4194
+ wait_for_ci: external_exports.boolean().default(true).describe(
4195
+ "Whether the run stays alive until the required checks settle. true (default) = the run drives CI and reports the settled verdict. false = the run ends once the branch is pushed and the PR is open, leaving the checks to be read later. Independent of merge: a run may wait for CI without being allowed to merge."
4196
+ ),
4197
+ pr_topology: prTopology.default("single").describe(
4198
+ "How a mission's work is shaped into pull requests. single (default) = one branch, one pull request. stacked = a dependent series. stacked is never chosen by the agent and never asked about at roadmap creation \u2014 the owner plans it or it does not happen."
4199
+ )
4200
+ }),
4201
+ /**
4202
+ * What this package may write into the HOST's own environment.
4203
+ *
4204
+ * THE GUARANTEE IS THE SHAPE, not a check. Only two keys exist here, and
4205
+ * both are request-SIZE caps. Neither traffic variable is expressible —
4206
+ * `CLAUDE_CODE_DISABLE_NONESSENTIAL_TRAFFIC` and `DISABLE_AUTOUPDATER` both
4207
+ * reach the host's update-disabled resolver (the blanket one as its third
4208
+ * rung, measured on Claude Code 2.1.284), so a profile able to write either
4209
+ * could disable a consumer's security updates. Owner-decided 2026-09-30:
4210
+ * they are not writable through this package at all, and the strongest way
4211
+ * to hold that is a schema that cannot say them rather than an exclusion
4212
+ * list somebody has to maintain.
4213
+ *
4214
+ * `null` is the default on both, and it is the off switch: nothing is
4215
+ * written. There is no separate enable flag, because a flag plus a value is
4216
+ * two ways to say off and one of them would drift.
4217
+ */
4218
+ host_environment: external_exports.object({
4219
+ request_size_caps: external_exports.object({
4220
+ bash_max_output_length: external_exports.number().int().positive().max(15e4).nullable().default(null).describe(
4221
+ "Character cap on Bash tool output the host places inline into a model request. null (default) = this package writes nothing and the host default of 30000 applies. A number is written into the host env block. Values above 150000 are capped by the host itself, so the schema refuses them here rather than writing a value the host silently changes. Bounds request SIZE, never request COUNT: lowering it suppresses no telemetry, no update check and no download."
4222
+ ),
4223
+ max_mcp_output_tokens: external_exports.number().int().positive().nullable().default(null).describe(
4224
+ "Token cap on a single MCP tool result the host places into a model request. null (default) = nothing written, host default 25000 applies. Same size-not-count caveat: it does not govern MCP connections, timeouts, or whether a tool runs."
4225
+ )
4226
+ }).default({}).describe(
4227
+ "Request-size caps this package may write into the host env block. Both null by default. No traffic or auto-updater variable is expressible here, by construction \u2014 see the block comment."
4228
+ )
4229
+ }).default({}).describe(
4230
+ 'What this package may write into the host environment. ABSENT resolves to the all-null shape, which is the same thing as off \u2014 a settings file predating this section must not fail to parse, and "no section" and "both caps null" both mean write nothing.'
4231
+ ),
4188
4232
  augment: external_exports.object({
4189
4233
  rules_use_symlinks: external_exports.boolean().default(false).describe(
4190
4234
  "When true, .augment/rules/*.md are symlinks into dist/agent-src/rules/ \u2014 edits flow back to source on save. When false (default), they are copies \u2014 safer on Windows and shared volumes, but rule edits in .augment/ are lost on the next `task sync`."
@@ -4226,8 +4270,8 @@ var settingsSchema = external_exports.object({
4226
4270
  skip_pre_run_gate: external_exports.boolean().default(true).describe(
4227
4271
  'Skip the /roadmap:process-* pre-run confirmation gate. true (default) starts processing immediately and surfaces the resolved config inline; false shows the numbered-options gate and waits. A genuine "which roadmap?" ambiguity always prompts regardless.'
4228
4272
  ),
4229
- quality_cadence: qualityCadence.default("end_of_roadmap").describe(
4230
- "When the agent runs the full quality / test suite during /roadmap:process-* runs. end_of_roadmap = once, after the last step (fastest, default). per_phase = after each phase boundary. per_step = after every single step (slowest, highest confidence)."
4273
+ quality_cadence: qualityCadence.default("per_phase").describe(
4274
+ "When the agent runs the full quality / test suite during /roadmap:process-* runs. per_phase = after each phase boundary (default since 2026-09-13 \u2014 end_of_roadmap lets errors compound across phases, which is expensive in a multi-phase autonomous run nobody is watching). end_of_roadmap = once, after the last step (fastest). per_step = after every single step (slowest, highest confidence)."
4231
4275
  ),
4232
4276
  dashboard_regen_cadence: regenCadence.default("every_5_steps").describe(
4233
4277
  "How often the agent regenerates agents/roadmaps/dashboard.md during a roadmap run. every_5_steps = batch the regen (default). per_step = after every step (freshest dashboard, highest subprocess overhead). phase_boundary = only at phase edges. A rename, phase add, or archive always regenerates immediately regardless."
@@ -4245,8 +4289,8 @@ var settingsSchema = external_exports.object({
4245
4289
  }).default({ max_cost_per_run_usd: 5, max_cost_per_rolling_7d_usd: 25 })
4246
4290
  }),
4247
4291
  planning: external_exports.object({
4248
- challenge_on_create: external_exports.boolean().default(true).describe(
4249
- "Gate C \u2014 plan-confidence gate before authoring. true (default) = a plan-artifact ask (/roadmap:create, roadmap-writing, /feature:plan, /feature:roadmap) first checks the four 95%-confidence conditions from /challenge-me vision; any gap routes into the interview (or the inline degrade protocol) before authoring, and a confident pass emits exactly one marker line. false = inert, plan asks author directly. An explicit user bypass always wins for that turn and is counted."
4292
+ closure_pass: external_exports.boolean().default(true).describe(
4293
+ `Gate C \u2014 plan-closure pass. true (default) = a plan-artifact ask (/roadmap:create, roadmap-writing, /feature:plan, /feature:roadmap, /roadmap:materialize, /implement-ticket, /jira-ticket, /analyze:inbox, /analyze:roadmap-repos) ends in a closure pass (/challenge-me closure): every foreseeable decision is closed at the lowest rung that owns it and written into the roadmap's "## Decisions" table, so a long run never meets a question planning could have closed. false = inert, plan asks author directly. An explicit user bypass always wins for that turn and is counted as a bypass rather than as an absent closure.`
4250
4294
  ),
4251
4295
  risk_review: external_exports.boolean().default(true).describe(
4252
4296
  'Gate R1 \u2014 plan-risk review. true (default) = every ready (non-draft) plan must carry a schema-valid "## Risk Register" section (ranked risks, mitigation + anchor per row, freshness marker, exact honest-null grammar), enforced by lint_plan_risk_register at pre-push + CI. false = escape hatch, the validator skips.'
@@ -4255,9 +4299,20 @@ var settingsSchema = external_exports.object({
4255
4299
  "Gate R2 \u2014 completion review at 100% roadmap completion / pre-PR. true (default) = a findings-before-fixes review by a fresh reviewer context must exist for the current diff hash (or an exact honest-null / skip declaration) before fix commits and PR creation, enforced by check_completion_review at pre-push + CI (CI authoritative; a crashed validator warns and allows). false = escape hatch, the validator skips."
4256
4300
  )
4257
4301
  }).default({}),
4302
+ execution: external_exports.object({
4303
+ fix_loop_max: external_exports.number().int().min(1).default(10).describe(
4304
+ "Consecutive failed fix attempts against one validation target before the escalation ladder reaches its terminal rung. Reaching the bound triggers a strategy change, never a question. Overridable globally, per project and per prompt."
4305
+ ),
4306
+ escalation: external_exports.array(external_exports.string()).default(["independent", "council", "team", "owner_owned_check"]).describe(
4307
+ "The escalation rungs, in order, walked when the fix-loop bound is reached: independent (another session or a provider-diverse reviewer), council, team, then owner_owned_check \u2014 which asks whether the residue is owner-owned, not whether to ask the owner now."
4308
+ )
4309
+ }).default({}),
4258
4310
  quality: external_exports.object({
4259
4311
  local_auto_run: external_exports.boolean().default(false).describe(
4260
- "Run quality tools (linters, type-checks, formatters) and the local test suite autonomously after edits. Off by default \u2014 the agent never runs quality tools proactively and does not ask; the user runs them manually (e.g. /quality-fix) and remote CI is the authoritative gate. The agent only runs a quality tool on an explicit ask, a concrete CI failure, or the new-gate carve-out. Turn on to restore autonomous pipeline runs."
4312
+ "Run quality tools (linters, type-checks, formatters) and the local test suite autonomously after edits, IN CHAT. Off by default \u2014 in a chat turn a human is present and remote CI is the authoritative gate, so a local full-pipeline run duplicates it at wall-clock cost. The agent only runs a quality tool on an explicit ask, a concrete CI failure, or the new-gate carve-out. A mission is governed by local_auto_run_in_mission instead."
4313
+ ),
4314
+ local_auto_run_in_mission: external_exports.boolean().default(true).describe(
4315
+ "Run quality tools autonomously inside a mission \u2014 an autonomous roadmap run with a claimed contract. On by default: nobody is waiting, the next action belongs to the agent itself, and a red found twenty steps later costs more than the run that would have caught it at step one. Inert outside a mission, and a mission never lowers local_auto_run: true."
4261
4316
  )
4262
4317
  }),
4263
4318
  design: external_exports.object({
@@ -4560,7 +4615,7 @@ var settingsSchema = external_exports.object({
4560
4615
  }).default({}),
4561
4616
  rtk_wrap: external_exports.object({
4562
4617
  enabled: external_exports.boolean().default(false).describe(
4563
- 'PreToolUse RTK-wrap nudge (token-saving Phase 3). Default off. When on AND the binary on PATH is verified as Rust Token Killer (a live two-stage identity probe \u2014 not a self-reported flag, and never a colliding same-name binary), warns (never blocks) "re-run wrapped with rtk" before a single verbose CLI command (git/npm/cargo/docker/\u2026) \u2014 upstream reports 60\u201390% output-token savings (their estimate). Skips completeness-critical / piped / compound commands and git diff. No-op when rtk is absent, unverified, or a different tool.'
4618
+ 'PreToolUse RTK-wrap nudge (token-saving Phase 3). Default off. When on AND the binary on PATH is verified as Rust Token Killer (a live two-stage identity probe \u2014 not a self-reported flag, and never a colliding same-name binary), warns (never blocks) "re-run wrapped with rtk" before a single verbose CLI command (git/npm/cargo/docker/\u2026) \u2014 upstream reports 60\u201390% output-token savings (their estimate). Skips completeness-critical / piped / compound commands and git diff. No-op when rtk is absent, unverified, or a different tool. Its own activation charge is one advisory line under the 1,024 B default concern cap in src/config/hook-token-budget.json; the per-fire distribution is UNMEASURED \u2014 stated rather than estimated, because the saving above is a third-party output-token claim and not a standing-payload reduction this package measured.'
4564
4619
  )
4565
4620
  }).default({}),
4566
4621
  design_slop: external_exports.object({
@@ -4,7 +4,7 @@ import {
4
4
  } from "./chunk-OY53J6II.js";
5
5
  import {
6
6
  load_agent_settings
7
- } from "./chunk-2XY7ILBT.js";
7
+ } from "./chunk-FC75PGJE.js";
8
8
  import {
9
9
  resolve_with_fallback,
10
10
  write_target
@@ -2805,7 +2805,7 @@ function buildSecondModel(entry, cls, locked, d) {
2805
2805
  if (!("second_model" in entry)) return null;
2806
2806
  if (locked.has(cls)) {
2807
2807
  throw d.error(
2808
- `decision_resolution.classes.${cls}.second_model=${d.repr(entry["second_model"])}: a second-model rung is not configurable for high-impact / user-required decisions \u2014 those classes are LOCKED to \`user\` (Iron Law) and never resolve on a model of any kind.`
2808
+ `decision_resolution.classes.${cls}.second_model=${d.repr(entry["second_model"])}: a second-model rung is not configurable for an owner-routed class (high-impact / user-required on the impact axis; product-owned / business-owned / destructive-owned on the ownership axis) \u2014 those classes are LOCKED to \`user\` (Iron Law) and never resolve on a model of any kind.`
2809
2809
  );
2810
2810
  }
2811
2811
  const raw = entry["second_model"];
@@ -2818,6 +2818,54 @@ function buildSecondModel(entry, cls, locked, d) {
2818
2818
  return raw;
2819
2819
  }
2820
2820
 
2821
+ // src/scripts/ai_council/ownership_classes.ts
2822
+ var OWNERSHIP_CLASSES = [
2823
+ "deterministic",
2824
+ "reversible-technical",
2825
+ "contested-technical",
2826
+ "critical-technical",
2827
+ "product-owned",
2828
+ "business-owned",
2829
+ "destructive-owned",
2830
+ "spend-exhaustion"
2831
+ ];
2832
+ var OWNER_LOCKED_CLASSES = /* @__PURE__ */ new Set([
2833
+ "product-owned",
2834
+ "business-owned",
2835
+ "destructive-owned"
2836
+ ]);
2837
+ var NEVER_OWNER_CLASSES = /* @__PURE__ */ new Set(["spend-exhaustion"]);
2838
+ function allOwnerLocked(impactLocked) {
2839
+ return /* @__PURE__ */ new Set([...impactLocked, ...OWNER_LOCKED_CLASSES]);
2840
+ }
2841
+ var DEFAULT_RESOLUTION_MODES = {
2842
+ trivial: "agent",
2843
+ low_impact: "agent",
2844
+ medium_impact: "council",
2845
+ high_impact: "user",
2846
+ user_required: "user",
2847
+ deterministic: "agent",
2848
+ "reversible-technical": "agent",
2849
+ "contested-technical": "council",
2850
+ "critical-technical": "council",
2851
+ "product-owned": "user",
2852
+ "business-owned": "user",
2853
+ "destructive-owned": "user",
2854
+ "spend-exhaustion": "agent"
2855
+ };
2856
+ function defaultModeFor(cls) {
2857
+ return DEFAULT_RESOLUTION_MODES[cls] ?? "agent";
2858
+ }
2859
+ function ownershipModeError(cls, mode, repr) {
2860
+ if (OWNER_LOCKED_CLASSES.has(cls) && mode !== "user") {
2861
+ return `decision_resolution.classes.${cls}.mode=${repr(mode)}: class \`${cls}\` is LOCKED to \`user\` (Iron Law) \u2014 product, business and destructive decisions are owner-owned and never resolve on a model.`;
2862
+ }
2863
+ if (NEVER_OWNER_CLASSES.has(cls) && mode === "user") {
2864
+ return `decision_resolution.classes.${cls}.mode=${repr(mode)}: class \`${cls}\` is never owner-routed (Iron Law) \u2014 spend exhaustion pauses and reports, it does not ask.`;
2865
+ }
2866
+ return null;
2867
+ }
2868
+
2821
2869
  // src/scripts/ai_council/py_format.ts
2822
2870
  function _pyReprStr(s) {
2823
2871
  const hasSingle = s.includes("'");
@@ -3445,13 +3493,7 @@ var _LOCKED_IMPACT_CLASSES = /* @__PURE__ */ new Set([
3445
3493
  "high_impact",
3446
3494
  "user_required"
3447
3495
  ]);
3448
- var _DEFAULT_RESOLUTION_MODES = {
3449
- trivial: "agent",
3450
- low_impact: "agent",
3451
- medium_impact: "council",
3452
- high_impact: "user",
3453
- user_required: "user"
3454
- };
3496
+ var _ALL_OWNER_LOCKED = allOwnerLocked(_LOCKED_IMPACT_CLASSES);
3455
3497
  function _build_decision_resolution(d) {
3456
3498
  if (!_isDict(d)) {
3457
3499
  throw new CouncilConfigError("`decision_resolution` must be a mapping.");
@@ -3469,14 +3511,14 @@ function _build_decision_resolution(d) {
3469
3511
  );
3470
3512
  }
3471
3513
  const classes = /* @__PURE__ */ new Map();
3472
- for (const cls of _IMPACT_CLASSES) {
3514
+ for (const cls of [..._IMPACT_CLASSES, ...OWNERSHIP_CLASSES]) {
3473
3515
  const entry_raw = _orEmpty(classes_raw[cls] ?? null);
3474
3516
  if (!_isDict(entry_raw)) {
3475
3517
  throw new CouncilConfigError(
3476
3518
  `\`decision_resolution.classes.${cls}\` must be a mapping.`
3477
3519
  );
3478
3520
  }
3479
- const mode = _get(entry_raw, "mode", _DEFAULT_RESOLUTION_MODES[cls]);
3521
+ const mode = _get(entry_raw, "mode", defaultModeFor(cls));
3480
3522
  if (!(_isStr(mode) && _VALID_RESOLUTION_MODES.has(mode))) {
3481
3523
  throw new CouncilConfigError(
3482
3524
  `decision_resolution.classes.${cls}.mode=${_pyRepr3(mode)} not in ${_sortedListRepr(_VALID_RESOLUTION_MODES)}.`
@@ -3487,7 +3529,9 @@ function _build_decision_resolution(d) {
3487
3529
  `decision_resolution.classes.${cls}.mode=${_pyRepr3(mode)}: class \`${cls}\` is LOCKED to \`user\` (Iron Law) \u2014 high-impact and user-required decisions never bypass the user.`
3488
3530
  );
3489
3531
  }
3490
- if (_LOCKED_IMPACT_CLASSES.has(cls) && "dispatch" in entry_raw) {
3532
+ const ownErr = ownershipModeError(cls, mode, _pyRepr3);
3533
+ if (ownErr !== null) throw new CouncilConfigError(ownErr);
3534
+ if (_ALL_OWNER_LOCKED.has(cls) && "dispatch" in entry_raw) {
3491
3535
  throw new CouncilConfigError(
3492
3536
  `decision_resolution.classes.${cls}.dispatch=${_pyRepr3(entry_raw.dispatch)}: dispatch is not configurable for high-impact / user-required decisions \u2014 always full council.`
3493
3537
  );
@@ -3501,7 +3545,7 @@ function _build_decision_resolution(d) {
3501
3545
  const second_model = buildSecondModel(
3502
3546
  entry_raw,
3503
3547
  cls,
3504
- _LOCKED_IMPACT_CLASSES,
3548
+ _ALL_OWNER_LOCKED,
3505
3549
  _FALLBACK_DEPS
3506
3550
  );
3507
3551
  classes.set(cls, { mode, confidence_threshold: threshold, second_model });
@@ -4227,6 +4271,16 @@ function toTokenCounts(raw) {
4227
4271
  ephemeral_1h_input_tokens: numOr0(cc.ephemeral_1h_input_tokens)
4228
4272
  };
4229
4273
  }
4274
+ function measureContentBytes(raw) {
4275
+ const content = raw.message?.content;
4276
+ if (content === void 0 || content === null) return null;
4277
+ if (typeof content === "string") return Buffer.byteLength(content, "utf8");
4278
+ try {
4279
+ return Buffer.byteLength(JSON.stringify(content), "utf8");
4280
+ } catch {
4281
+ return null;
4282
+ }
4283
+ }
4230
4284
  function classifyBucket(raw) {
4231
4285
  const hasAgentId = typeof raw.agentId === "string" && raw.agentId.length > 0;
4232
4286
  return hasAgentId || raw.isSidechain === true ? "subagent" : "main";
@@ -4304,7 +4358,8 @@ function scanTranscripts(opts = {}) {
4304
4358
  agentId: typeof raw.agentId === "string" ? raw.agentId : null,
4305
4359
  model: typeof raw.message.model === "string" ? raw.message.model : "unknown",
4306
4360
  timestamp: typeof raw.timestamp === "string" ? raw.timestamp : null,
4307
- usage: toTokenCounts(raw.message.usage)
4361
+ usage: toTokenCounts(raw.message.usage),
4362
+ content_bytes: opts.measureBytes === true ? measureContentBytes(raw) : null
4308
4363
  });
4309
4364
  }
4310
4365
  }
@@ -4316,6 +4371,34 @@ function scanTranscripts(opts = {}) {
4316
4371
  dedup_ratio: totalSeen > 0 ? (totalSeen - dedupedCount) / totalSeen : 0
4317
4372
  };
4318
4373
  }
4374
+ function measureBytesPerToken(records) {
4375
+ let bytes = 0;
4376
+ let tokens = 0;
4377
+ let n = 0;
4378
+ for (const rec of records) {
4379
+ if (rec.content_bytes === null || rec.usage.output_tokens <= 0) continue;
4380
+ bytes += rec.content_bytes;
4381
+ tokens += rec.usage.output_tokens;
4382
+ n += 1;
4383
+ }
4384
+ if (n === 0 || tokens <= 0) return null;
4385
+ return {
4386
+ basis: "measured",
4387
+ content_bytes: bytes,
4388
+ output_tokens: tokens,
4389
+ bytes_per_token: bytes / tokens,
4390
+ records: n
4391
+ };
4392
+ }
4393
+ function derivedBytes(tokens, factor) {
4394
+ if (factor === null) return null;
4395
+ return {
4396
+ basis: "derived",
4397
+ tokens,
4398
+ factor,
4399
+ bytes: Math.round(tokens * factor.bytes_per_token)
4400
+ };
4401
+ }
4319
4402
  function emptyAggregate(bucket) {
4320
4403
  return {
4321
4404
  bucket,
@@ -4359,6 +4442,8 @@ export {
4359
4442
  billableInputTokens,
4360
4443
  weightedInputUnits,
4361
4444
  scanTranscripts,
4445
+ measureBytesPerToken,
4446
+ derivedBytes,
4362
4447
  aggregateByBucket,
4363
4448
  resolveSessionRole,
4364
4449
  hardenedSpawnEnv,
@@ -5,7 +5,7 @@ import {
5
5
  import {
6
6
  DEFAULT_PROJECT_FILE,
7
7
  logger
8
- } from "./chunk-2XY7ILBT.js";
8
+ } from "./chunk-FC75PGJE.js";
9
9
 
10
10
  // src/scripts/config/profiles.ts
11
11
  import * as fs from "node:fs";
@@ -4,7 +4,7 @@ import {
4
4
  } from "./chunk-F7DQWYR5.js";
5
5
  import {
6
6
  load_agent_settings
7
- } from "./chunk-2XY7ILBT.js";
7
+ } from "./chunk-FC75PGJE.js";
8
8
 
9
9
  // src/scripts/chat_history.ts
10
10
  import { createHash } from "node:crypto";
@@ -0,0 +1,39 @@
1
+ import { createRequire as __acCreateRequire } from 'node:module'; const require = globalThis.require ?? __acCreateRequire(import.meta.url);
2
+
3
+ // src/shared/missionExecution.ts
4
+ var ESCALATION_LADDER = [
5
+ "independent",
6
+ "council",
7
+ "team",
8
+ "owner_owned_check"
9
+ ];
10
+ var FIX_LOOP_MAX_DEFAULT = 10;
11
+ var MISSION_AUTO_RUN_DEFAULT = true;
12
+ function resolveLocalAutoRun(inputs) {
13
+ if (inputs.configured) return { value: true, origin: "settings" };
14
+ if (!inputs.inMission) return { value: false, origin: "settings" };
15
+ const mission = inputs.missionValue ?? MISSION_AUTO_RUN_DEFAULT;
16
+ return mission ? { value: true, origin: "mission" } : { value: false, origin: "settings" };
17
+ }
18
+ function executionPostureFromOverrides(layers) {
19
+ const raw = {};
20
+ for (const [key, value] of layers) {
21
+ if (key === "execution.fix_loop_max") raw["fix_loop_max"] = value;
22
+ else if (key === "execution.escalation") raw["escalation"] = value;
23
+ }
24
+ return resolveExecutionPosture(raw);
25
+ }
26
+ function resolveExecutionPosture(raw) {
27
+ const block = raw ?? {};
28
+ const rawMax = block["fix_loop_max"];
29
+ const max = typeof rawMax === "number" && Number.isInteger(rawMax) && rawMax > 0 ? rawMax : FIX_LOOP_MAX_DEFAULT;
30
+ const rawLadder = block["escalation"];
31
+ const ladder = Array.isArray(rawLadder) && rawLadder.length > 0 && rawLadder.every((r) => typeof r === "string") ? rawLadder : ESCALATION_LADDER;
32
+ return { fix_loop_max: max, escalation: ladder };
33
+ }
34
+
35
+ export {
36
+ resolveLocalAutoRun,
37
+ executionPostureFromOverrides,
38
+ resolveExecutionPosture
39
+ };
@@ -1,8 +1,10 @@
1
1
  import { createRequire as __acCreateRequire } from 'node:module'; const require = globalThis.require ?? __acCreateRequire(import.meta.url);
2
2
  import {
3
3
  buildInstallPlan,
4
+ classifyOwnership,
5
+ recordedHashesForRoot,
4
6
  sha256File
5
- } from "./chunk-523HCFYO.js";
7
+ } from "./chunk-YDPILCOL.js";
6
8
  import {
7
9
  detectToolPresence
8
10
  } from "./chunk-A4QJ6ENT.js";
@@ -17,23 +19,27 @@ import { existsSync } from "node:fs";
17
19
  function isJsonTarget(entry) {
18
20
  return entry.kind === "deployed" && entry.path.endsWith(".json");
19
21
  }
20
- function computeConflicts(plan) {
22
+ function computeConflicts(plan, recordedOverride) {
21
23
  if (plan.policy.force) return [];
24
+ const recorded = recordedOverride ?? recordedHashesForRoot(plan.root);
22
25
  const out = [];
23
26
  for (const entries of Object.values(plan.filesByTool)) {
24
27
  for (const entry of entries) {
25
28
  if (entry.kind === "bridge") continue;
26
29
  if (entry.sha256 === null) continue;
27
30
  if (!existsSync(entry.path)) continue;
28
- if (plan.policy.knownPaths.has(entry.path)) continue;
29
31
  const onDisk = sha256File(entry.path);
32
+ const ownership = classifyOwnership(recorded.get(entry.path), onDisk);
33
+ if (ownership === "recorded-unchanged") continue;
34
+ if (ownership === "unknown" && plan.policy.knownPaths.has(entry.path)) continue;
30
35
  if (onDisk === entry.sha256) continue;
31
36
  out.push({
32
37
  path: entry.path,
33
38
  kind: entry.kind,
34
39
  plannedSha256: entry.sha256,
35
40
  existingSha256: onDisk,
36
- mergeable: isJsonTarget(entry)
41
+ mergeable: isJsonTarget(entry),
42
+ ownership
37
43
  });
38
44
  }
39
45
  }
@@ -133,8 +139,16 @@ function checkConflicts(inputs) {
133
139
  id: "conflicts",
134
140
  severity: "warning",
135
141
  path: c.path,
136
- message: `existing file conflicts with planned ${c.kind} content`,
137
- remedy: "resolve interactively, or pass --force to overwrite"
142
+ message: c.ownership === "recorded-modified" ? `managed ${c.kind} file has been edited since we wrote it` : `existing file conflicts with planned ${c.kind} content`,
143
+ // A remedy here may only describe what an install actually does. Before
144
+ // the owner ruling of 2026-09-21 the writer overwrote every deployed
145
+ // file unconditionally, so the `recorded-modified` arm told the
146
+ // operator to back their edit up. It now preserves that file and stages
147
+ // the package content beside it, so the same sentence would be false in
148
+ // the opposite direction — it would understate a protection that ships.
149
+ // The `unknown` arm is unchanged: nothing is recorded for that path, so
150
+ // the writer still writes over it.
151
+ remedy: c.ownership === "recorded-modified" ? "installing preserves your edit and stages package content as <path>.agent-config.new; --force replaces it instead" : "back up this file \u2014 installing writes the planned content over it"
138
152
  }));
139
153
  }
140
154
  function checkHostDetection(inputs) {
@@ -0,0 +1,152 @@
1
+ import { createRequire as __acCreateRequire } from 'node:module'; const require = globalThis.require ?? __acCreateRequire(import.meta.url);
2
+ import {
3
+ manifest_path
4
+ } from "./chunk-4E2W63DA.js";
5
+ import {
6
+ require_dist
7
+ } from "./chunk-OY53J6II.js";
8
+ import {
9
+ __toESM
10
+ } from "./chunk-J55WI3RR.js";
11
+
12
+ // src/install/plan.ts
13
+ import { createHash } from "node:crypto";
14
+ import { readFileSync, readdirSync, statSync } from "node:fs";
15
+ import { join, relative, resolve } from "node:path";
16
+ function sha256File(path) {
17
+ try {
18
+ const data = readFileSync(path);
19
+ return createHash("sha256").update(data).digest("hex");
20
+ } catch {
21
+ return null;
22
+ }
23
+ }
24
+ function fileEntry(path, kind, options) {
25
+ return {
26
+ path,
27
+ kind,
28
+ sha256: options.hashContent ? sha256File(path) : null
29
+ };
30
+ }
31
+ function walkSourceTree(dir) {
32
+ const out = [];
33
+ walkInto(dir, out);
34
+ return out;
35
+ }
36
+ function walkInto(dir, out) {
37
+ let entries;
38
+ try {
39
+ entries = readdirSync(dir).sort();
40
+ } catch {
41
+ return;
42
+ }
43
+ for (const name of entries) {
44
+ const full = join(dir, name);
45
+ let isDir;
46
+ try {
47
+ isDir = statSync(full).isDirectory();
48
+ } catch {
49
+ continue;
50
+ }
51
+ if (isDir) {
52
+ walkInto(full, out);
53
+ } else {
54
+ out.push(full);
55
+ }
56
+ }
57
+ }
58
+ function buildInstallPlan(inputs) {
59
+ const filesByTool = {};
60
+ for (const source of inputs.sources) {
61
+ const bucket = filesByTool[source.toolId] ?? [];
62
+ let files = walkSourceTree(source.srcDir);
63
+ if (source.fileFilter !== void 0) {
64
+ files = files.filter(source.fileFilter);
65
+ }
66
+ for (const srcFile of files) {
67
+ const rel = relative(source.srcDir, srcFile);
68
+ const destPath = resolve(source.destDir, rel);
69
+ bucket.push(
70
+ fileEntry(srcFile, source.kind, {
71
+ hashContent: source.kind !== "bridge"
72
+ })
73
+ );
74
+ bucket[bucket.length - 1] = {
75
+ ...bucket[bucket.length - 1],
76
+ path: destPath
77
+ };
78
+ }
79
+ filesByTool[source.toolId] = bucket;
80
+ }
81
+ for (const source of inputs.sources) {
82
+ if (!(source.toolId in filesByTool)) {
83
+ filesByTool[source.toolId] = [];
84
+ }
85
+ }
86
+ return {
87
+ version: 2,
88
+ target: inputs.target,
89
+ root: inputs.root,
90
+ filesByTool,
91
+ mergedKeysByTool: {},
92
+ policy: inputs.policy
93
+ };
94
+ }
95
+
96
+ // src/install/recordedOwnership.ts
97
+ var YAML = __toESM(require_dist(), 1);
98
+ import { existsSync, readFileSync as readFileSync2 } from "node:fs";
99
+ import { homedir } from "node:os";
100
+ import { isAbsolute, join as join2, resolve as resolve2 } from "node:path";
101
+ var NO_RECORDED_HASHES = /* @__PURE__ */ new Map();
102
+ function classifyOwnership(recordedSha256, onDiskSha256) {
103
+ if (recordedSha256 === void 0 || recordedSha256 === null) return "unknown";
104
+ if (onDiskSha256 === null) return "unknown";
105
+ return recordedSha256 === onDiskSha256 ? "recorded-unchanged" : "recorded-modified";
106
+ }
107
+ function readRecordedHashes(manifestPath, projectRoot) {
108
+ if (!existsSync(manifestPath)) return NO_RECORDED_HASHES;
109
+ let doc;
110
+ try {
111
+ doc = YAML.parse(readFileSync2(manifestPath, "utf8"));
112
+ } catch {
113
+ return NO_RECORDED_HASHES;
114
+ }
115
+ if (doc === null || typeof doc !== "object" || Array.isArray(doc)) return NO_RECORDED_HASHES;
116
+ const tools = doc["tools"];
117
+ if (!Array.isArray(tools)) return NO_RECORDED_HASHES;
118
+ const out = /* @__PURE__ */ new Map();
119
+ for (const tool of tools) {
120
+ if (tool === null || typeof tool !== "object" || Array.isArray(tool)) continue;
121
+ const files = tool["files"];
122
+ if (!Array.isArray(files)) continue;
123
+ for (const entry of files) {
124
+ if (entry === null || typeof entry !== "object" || Array.isArray(entry)) continue;
125
+ const rec = entry;
126
+ const raw = rec["path"];
127
+ if (typeof raw !== "string" || raw.length === 0) continue;
128
+ const sha = rec["sha256"];
129
+ const expanded = expanduser(raw);
130
+ const target = isAbsolute(expanded) ? resolve2(expanded) : resolve2(projectRoot, expanded);
131
+ out.set(target, typeof sha === "string" && sha.length > 0 ? sha : null);
132
+ }
133
+ }
134
+ return out;
135
+ }
136
+ function expanduser(p) {
137
+ if (p === "~") return homedir();
138
+ if (p.startsWith("~/") || process.platform === "win32" && p.startsWith("~\\")) {
139
+ return join2(homedir(), p.slice(2));
140
+ }
141
+ return p;
142
+ }
143
+ function recordedHashesForRoot(root, env) {
144
+ return readRecordedHashes(manifest_path(root, env), root);
145
+ }
146
+
147
+ export {
148
+ classifyOwnership,
149
+ recordedHashesForRoot,
150
+ sha256File,
151
+ buildInstallPlan
152
+ };