@event4u/agent-config 8.13.0 → 9.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (279) hide show
  1. package/.claude-plugin/marketplace.json +1 -1
  2. package/CHANGELOG.md +136 -0
  3. package/README.md +1 -1
  4. package/dist/agent-src/commands/agent-handoff.md +35 -0
  5. package/dist/agent-src/commands/agents/init.md +1 -0
  6. package/dist/agent-src/commands/agents/optimize.md +1 -0
  7. package/dist/agent-src/commands/agents/user/accept.md +3 -2
  8. package/dist/agent-src/commands/agents/user/init.md +5 -4
  9. package/dist/agent-src/commands/agents/user/update.md +3 -2
  10. package/dist/agent-src/commands/agents/user.md +1 -0
  11. package/dist/agent-src/commands/agents.md +1 -0
  12. package/dist/agent-src/commands/analytics/show.md +1 -0
  13. package/dist/agent-src/commands/analytics.md +1 -0
  14. package/dist/agent-src/commands/analyze/decision.md +1 -0
  15. package/dist/agent-src/commands/analyze/incident.md +1 -0
  16. package/dist/agent-src/commands/analyze/near-miss.md +1 -0
  17. package/dist/agent-src/commands/analyze/postmortem.md +1 -0
  18. package/dist/agent-src/commands/analyze/premortem.md +1 -0
  19. package/dist/agent-src/commands/analyze/reference-repo.md +1 -0
  20. package/dist/agent-src/commands/analyze.md +3 -2
  21. package/dist/agent-src/commands/brand/identity.md +6 -5
  22. package/dist/agent-src/commands/brand/review.md +6 -5
  23. package/dist/agent-src/commands/brand/strategy.md +6 -4
  24. package/dist/agent-src/commands/brand/tokens.md +7 -6
  25. package/dist/agent-src/commands/brand/voice.md +5 -4
  26. package/dist/agent-src/commands/brand.md +9 -7
  27. package/dist/agent-src/commands/bug/fix.md +1 -0
  28. package/dist/agent-src/commands/bug/investigate.md +1 -0
  29. package/dist/agent-src/commands/bug.md +2 -1
  30. package/dist/agent-src/commands/challenge-me/vision.md +1 -0
  31. package/dist/agent-src/commands/challenge-me/with-docs.md +1 -0
  32. package/dist/agent-src/commands/challenge-me.md +28 -6
  33. package/dist/agent-src/commands/chat-history.md +1 -0
  34. package/dist/agent-src/commands/check-current-md.md +1 -0
  35. package/dist/agent-src/commands/commit.md +1 -0
  36. package/dist/agent-src/commands/context/create.md +3 -2
  37. package/dist/agent-src/commands/context.md +1 -0
  38. package/dist/agent-src/commands/cost/profile.md +1 -0
  39. package/dist/agent-src/commands/cost.md +2 -1
  40. package/dist/agent-src/commands/council/analysis.md +1 -0
  41. package/dist/agent-src/commands/council/debate.md +1 -0
  42. package/dist/agent-src/commands/council/default.md +21 -20
  43. package/dist/agent-src/commands/council/design.md +1 -0
  44. package/dist/agent-src/commands/council/optimize.md +1 -0
  45. package/dist/agent-src/commands/council/pr.md +1 -0
  46. package/dist/agent-src/commands/council.md +1 -0
  47. package/dist/agent-src/commands/estimate-ticket.md +1 -0
  48. package/dist/agent-src/commands/feature/dev.md +1 -0
  49. package/dist/agent-src/commands/feature/explore.md +1 -0
  50. package/dist/agent-src/commands/feature/plan.md +1 -0
  51. package/dist/agent-src/commands/feature/refactor.md +1 -0
  52. package/dist/agent-src/commands/feature/roadmap.md +1 -0
  53. package/dist/agent-src/commands/feature.md +2 -1
  54. package/dist/agent-src/commands/fix/pr-comments.md +19 -0
  55. package/dist/agent-src/commands/fix.md +2 -1
  56. package/dist/agent-src/commands/ghostwriter/delete.md +1 -0
  57. package/dist/agent-src/commands/ghostwriter/fetch.md +1 -0
  58. package/dist/agent-src/commands/ghostwriter/show.md +1 -0
  59. package/dist/agent-src/commands/ghostwriter/write.md +1 -0
  60. package/dist/agent-src/commands/ghostwriter.md +1 -0
  61. package/dist/agent-src/commands/grill-me.md +17 -12
  62. package/dist/agent-src/commands/humanize.md +1 -0
  63. package/dist/agent-src/commands/image/analyse.md +2 -1
  64. package/dist/agent-src/commands/image/create.md +1 -0
  65. package/dist/agent-src/commands/image/verify.md +1 -0
  66. package/dist/agent-src/commands/image.md +16 -12
  67. package/dist/agent-src/commands/implement-ticket.md +1 -0
  68. package/dist/agent-src/commands/judge/on-diff.md +1 -0
  69. package/dist/agent-src/commands/judge/solo.md +1 -0
  70. package/dist/agent-src/commands/judge/steps.md +1 -0
  71. package/dist/agent-src/commands/judge.md +1 -0
  72. package/dist/agent-src/commands/knowledge/cross-repo.md +1 -0
  73. package/dist/agent-src/commands/knowledge/forget.md +1 -0
  74. package/dist/agent-src/commands/knowledge/ingest.md +1 -0
  75. package/dist/agent-src/commands/knowledge/list.md +10 -0
  76. package/dist/agent-src/commands/knowledge.md +1 -0
  77. package/dist/agent-src/commands/memory/learn-low-impact.md +1 -0
  78. package/dist/agent-src/commands/memory/mine-session.md +1 -0
  79. package/dist/agent-src/commands/memory/promote.md +3 -2
  80. package/dist/agent-src/commands/memory.md +1 -0
  81. package/dist/agent-src/commands/mission/upgrade.md +45 -24
  82. package/dist/agent-src/commands/mode.md +1 -0
  83. package/dist/agent-src/commands/module/create.md +1 -0
  84. package/dist/agent-src/commands/module/explore.md +1 -0
  85. package/dist/agent-src/commands/module.md +1 -0
  86. package/dist/agent-src/commands/optimize/agents-dir.md +1 -0
  87. package/dist/agent-src/commands/optimize/project.md +1 -0
  88. package/dist/agent-src/commands/optimize/prompt.md +1 -0
  89. package/dist/agent-src/commands/optimize.md +2 -1
  90. package/dist/agent-src/commands/orchestrate.md +1 -0
  91. package/dist/agent-src/commands/override.md +1 -0
  92. package/dist/agent-src/commands/package.md +2 -1
  93. package/dist/agent-src/commands/post-as/ghostwriter.md +1 -0
  94. package/dist/agent-src/commands/post-as/me.md +1 -0
  95. package/dist/agent-src/commands/post-as.md +1 -0
  96. package/dist/agent-src/commands/pr/create/description-only.md +1 -0
  97. package/dist/agent-src/commands/pr/create.md +19 -17
  98. package/dist/agent-src/commands/prediction-pool.md +7 -6
  99. package/dist/agent-src/commands/prepare-for-review.md +1 -0
  100. package/dist/agent-src/commands/profile/activate.md +1 -0
  101. package/dist/agent-src/commands/profile/deactivate.md +1 -0
  102. package/dist/agent-src/commands/profile.md +1 -0
  103. package/dist/agent-src/commands/project.md +2 -1
  104. package/dist/agent-src/commands/refine-ticket.md +7 -0
  105. package/dist/agent-src/commands/research/deep.md +1 -0
  106. package/dist/agent-src/commands/research.md +1 -0
  107. package/dist/agent-src/commands/review/routing.md +1 -0
  108. package/dist/agent-src/commands/review.md +2 -1
  109. package/dist/agent-src/commands/roadmap/ai-council.md +1 -0
  110. package/dist/agent-src/commands/roadmap/materialize.md +1 -0
  111. package/dist/agent-src/commands/roadmap/process-full.md +1 -0
  112. package/dist/agent-src/commands/roadmap/process-phase.md +1 -0
  113. package/dist/agent-src/commands/roadmap/process-step.md +1 -0
  114. package/dist/agent-src/commands/roadmap.md +1 -0
  115. package/dist/agent-src/commands/security-audit-config.md +2 -1
  116. package/dist/agent-src/commands/skill/preview.md +1 -0
  117. package/dist/agent-src/commands/skill.md +1 -0
  118. package/dist/agent-src/commands/skills/discover.md +1 -0
  119. package/dist/agent-src/commands/skills.md +1 -0
  120. package/dist/agent-src/commands/sync/agent-settings.md +1 -0
  121. package/dist/agent-src/commands/sync.md +2 -1
  122. package/dist/agent-src/commands/team/adversarial.md +3 -2
  123. package/dist/agent-src/commands/team/delegate.md +3 -2
  124. package/dist/agent-src/commands/team/review.md +3 -2
  125. package/dist/agent-src/commands/team/status.md +49 -18
  126. package/dist/agent-src/commands/team-knowledge.md +8 -6
  127. package/dist/agent-src/commands/team.md +21 -16
  128. package/dist/agent-src/commands/tests/e2e-heal.md +1 -0
  129. package/dist/agent-src/commands/tests/e2e-plan.md +1 -0
  130. package/dist/agent-src/commands/tests/execute.md +1 -0
  131. package/dist/agent-src/commands/tests.md +2 -1
  132. package/dist/agent-src/commands/update-form-request-messages.md +1 -0
  133. package/dist/agent-src/commands/upstream-contribute.md +1 -0
  134. package/dist/agent-src/commands/video/from-script.md +3 -2
  135. package/dist/agent-src/commands/video/from-song.md +22 -21
  136. package/dist/agent-src/commands/video/scene.md +1 -0
  137. package/dist/agent-src/commands/video/stitch.md +2 -1
  138. package/dist/agent-src/commands/video/storyboard.md +1 -0
  139. package/dist/agent-src/commands/video.md +1 -0
  140. package/dist/agent-src/commands/work.md +1 -0
  141. package/dist/agent-src/commands/worktree/cleanup.md +8 -7
  142. package/dist/agent-src/commands/worktree/create.md +1 -0
  143. package/dist/agent-src/commands/worktree/verify.md +1 -0
  144. package/dist/agent-src/commands/worktree.md +1 -0
  145. package/dist/agent-src/rules/active-remediation.md +12 -36
  146. package/dist/agent-src/rules/artifact-drafting-protocol.md +7 -64
  147. package/dist/agent-src/rules/context-hygiene.md +19 -113
  148. package/dist/agent-src/rules/design-fidelity.md +4 -60
  149. package/dist/agent-src/rules/domain-adoption-policy.md +10 -106
  150. package/dist/agent-src/rules/framework-neutrality-in-generic-skills.md +12 -60
  151. package/dist/agent-src/rules/improve-before-implement.md +4 -0
  152. package/dist/agent-src/rules/minimal-safe-diff.md +6 -86
  153. package/dist/agent-src/rules/size-enforcement.md +10 -0
  154. package/dist/agent-src/rules/tool-safety.md +17 -3
  155. package/dist/agent-src/skills/agent-security-review/SKILL.md +12 -1
  156. package/dist/agent-src/skills/ai-council/SKILL.md +11 -0
  157. package/dist/agent-src/skills/bug-analyzer/SKILL.md +24 -2
  158. package/dist/agent-src/skills/code-review/SKILL.md +105 -93
  159. package/dist/agent-src/skills/code-review/checklists/backend.md +50 -0
  160. package/dist/agent-src/skills/code-review/checklists/database.md +19 -0
  161. package/dist/agent-src/skills/code-review/checklists/dependency.md +18 -0
  162. package/dist/agent-src/skills/code-review/checklists/docs.md +14 -0
  163. package/dist/agent-src/skills/code-review/checklists/frontend.md +19 -0
  164. package/dist/agent-src/skills/code-review/checklists/infra.md +17 -0
  165. package/dist/agent-src/skills/code-review/checklists/producing-the-review.md +62 -0
  166. package/dist/agent-src/skills/code-review/checklists/test-only.md +13 -0
  167. package/dist/agent-src/skills/code-review/evals/evals.json +53 -15
  168. package/dist/agent-src/skills/condense-memory/SKILL.md +3 -2
  169. package/dist/agent-src/skills/conventional-commits-writing/evals/evals.json +15 -0
  170. package/dist/agent-src/skills/docker/SKILL.md +10 -0
  171. package/dist/agent-src/skills/docx-authoring/SKILL.md +102 -0
  172. package/dist/agent-src/skills/github-ci/evals/evals.json +25 -0
  173. package/dist/agent-src/skills/humanizer/SKILL.md +79 -3
  174. package/dist/agent-src/skills/humanizer/references/anti-aiisms.md +112 -0
  175. package/dist/agent-src/skills/humanizer/references/fixtures.md +70 -0
  176. package/dist/agent-src/skills/judge-bug-hunter/SKILL.md +7 -1
  177. package/dist/agent-src/skills/laravel/SKILL.md +10 -0
  178. package/dist/agent-src/skills/launch-readiness/SKILL.md +35 -0
  179. package/dist/agent-src/skills/merge-conflicts/SKILL.md +30 -0
  180. package/dist/agent-src/skills/pdf-tools/SKILL.md +101 -0
  181. package/dist/agent-src/skills/quality-tools/evals/evals.json +15 -0
  182. package/dist/agent-src/skills/security-audit/SKILL.md +29 -0
  183. package/dist/agent-src/skills/security-maturity-assessment/SKILL.md +90 -0
  184. package/dist/agent-src/skills/security-maturity-assessment/evals/triggers.json +52 -0
  185. package/dist/agent-src/skills/skill-writing/SKILL.md +79 -0
  186. package/dist/agent-src/skills/spreadsheet-authoring/SKILL.md +11 -3
  187. package/dist/agent-src/skills/subagent-orchestration/schemas/team-review-status.json +103 -0
  188. package/dist/agent-src/skills/terraform/SKILL.md +10 -0
  189. package/dist/agent-src/skills/test-driven-development/SKILL.md +31 -0
  190. package/dist/agent-src/skills/threat-modeling/SKILL.md +15 -0
  191. package/dist/agent-src/templates/agents/agent-project-settings.example.yml +1 -1
  192. package/dist/agent-src/templates/scripts/telemetry/aggregator.ts +0 -0
  193. package/dist/agent-src/templates/scripts/telemetry/engagement.ts +30 -0
  194. package/dist/agent-src/templates/scripts/telemetry/report_renderer.ts +22 -9
  195. package/dist/agent-src/templates/scripts/telemetry_record.ts +5 -0
  196. package/dist/discovery/deprecation-report.md +1 -1
  197. package/dist/discovery/discovery-manifest.json +256 -190
  198. package/dist/discovery/discovery-manifest.json.sha256 +1 -1
  199. package/dist/discovery/discovery-manifest.summary.md +5 -5
  200. package/dist/discovery/orphan-report.md +1 -1
  201. package/dist/discovery/packs.json +20 -17
  202. package/dist/discovery/trust-report.md +3 -3
  203. package/dist/discovery/workspaces.json +16 -13
  204. package/dist/install/install.mjs +10 -2
  205. package/dist/mcp/registry-manifest.json +3 -3
  206. package/dist/router.json +1 -1
  207. package/dist/scripts/condense.js +5 -0
  208. package/dist/scripts/condense.js.map +1 -1
  209. package/dist/server/schemas/settings.js +5 -1
  210. package/dist/server/schemas/settings.js.map +1 -1
  211. package/docs/CLAIMS.md +8 -1
  212. package/docs/SKILL_CENSUS.md +8 -0
  213. package/docs/architecture.md +2 -2
  214. package/docs/benchmark.md +67 -2
  215. package/docs/catalog.md +2 -2
  216. package/docs/contracts/ai-council-config.md +9 -2
  217. package/docs/contracts/ai-team-config.md +37 -4
  218. package/docs/contracts/prelaunch-diagnostics.md +151 -0
  219. package/docs/contracts/release-pr-gating.md +1 -0
  220. package/docs/decisions/ADR-049-configuration-trust-boundary.md +9 -1
  221. package/docs/featured-skills.md +2 -2
  222. package/docs/getting-started-by-role.md +1 -1
  223. package/docs/getting-started.md +16 -5
  224. package/docs/governance-advantage.md +1 -1
  225. package/docs/guidelines/agent-infra/active-remediation-mechanics.md +45 -0
  226. package/docs/guidelines/agent-infra/agent-interaction-and-decision-quality.md +28 -0
  227. package/docs/guidelines/agent-infra/artifact-drafting-protocol-mechanics.md +76 -0
  228. package/docs/guidelines/agent-infra/context-hygiene-mechanics.md +90 -0
  229. package/docs/guidelines/agent-infra/domain-adoption-gates.md +112 -0
  230. package/docs/guidelines/agent-infra/framework-neutrality-patterns.md +66 -0
  231. package/docs/guidelines/agent-infra/minimal-safe-diff-mechanics.md +99 -0
  232. package/docs/guidelines/agent-infra/skill-quality-checklist.md +13 -0
  233. package/docs/guidelines/design-fidelity-mechanics.md +76 -0
  234. package/docs/parity/command-frontmatter.md +60 -0
  235. package/docs/proof.md +6 -5
  236. package/package.json +1 -1
  237. package/src/agent-src/templates/scripts/telemetry/aggregator.ts +0 -0
  238. package/src/agent-src/templates/scripts/telemetry/engagement.ts +30 -0
  239. package/src/agent-src/templates/scripts/telemetry/report_renderer.ts +22 -9
  240. package/src/agent-src/templates/scripts/telemetry_record.ts +5 -0
  241. package/src/config/agent-settings.template.yml +34 -10
  242. package/src/config/prelaunch-areas.yml +36 -0
  243. package/src/scripts/_cli/cmd_doctor.ts +118 -26
  244. package/src/scripts/_lib/claude_plugin.ts +77 -2
  245. package/src/scripts/_lib/orchestration_record.ts +5 -0
  246. package/src/scripts/_lib/tool_adapter_registry.ts +120 -0
  247. package/src/scripts/ai_team/config.ts +73 -1
  248. package/src/scripts/ai_team/review_gate.ts +636 -0
  249. package/src/scripts/ai_team/team_dispatch.ts +612 -0
  250. package/src/scripts/bench_ab_task_runner.ts +11 -1
  251. package/src/scripts/bench_parity_count.ts +279 -0
  252. package/src/scripts/build_linear_digest.ts +3 -1
  253. package/src/scripts/check_bridge_derivation.ts +172 -0
  254. package/src/scripts/check_consumer_scope_flip.ts +179 -0
  255. package/src/scripts/check_council_config_location.ts +115 -15
  256. package/src/scripts/check_host_loadability.ts +81 -0
  257. package/src/scripts/condense.ts +5 -0
  258. package/src/scripts/hook_manifest.yaml +12 -1
  259. package/src/scripts/lint_handoffs.ts +42 -0
  260. package/src/scripts/lint_skill_descriptions.ts +228 -0
  261. package/src/scripts/lint_skill_descriptions_allowlist.json +1 -0
  262. package/src/scripts/lint_skill_scripts_readonly.ts +145 -0
  263. package/src/scripts/lint_skill_scripts_readonly_allowlist.json +8 -0
  264. package/src/scripts/lint_supported_tools_matrix.ts +35 -0
  265. package/src/scripts/optimize_skill_description.ts +144 -0
  266. package/src/scripts/orchestration_record.ts +2 -1
  267. package/src/scripts/prelaunch_diagnostics.ts +248 -0
  268. package/src/scripts/run_skill_evals.ts +70 -4
  269. package/src/scripts/schemas/command.schema.json +7 -0
  270. package/src/scripts/schemas/evals.schema.json +105 -14
  271. package/src/scripts/schemas/prelaunch-report.schema.json +107 -0
  272. package/src/scripts/schemas/skill.schema.json +18 -1
  273. package/src/scripts/schemas/subagent.schema.json +6 -0
  274. package/src/scripts/skill_linter.ts +43 -3
  275. package/src/scripts/smoke_host_loadability.sh +73 -0
  276. package/src/scripts/team_review_gate_hook.ts +115 -0
  277. package/src/scripts/trigger_eval_grandfather.json +1 -2
  278. package/src/scripts/utilization_report.ts +225 -0
  279. package/src/server/schemas/settings.ts +9 -1
@@ -0,0 +1,115 @@
1
+ #!/usr/bin/env node
2
+ /**
3
+ * Team Review-Gate governance — `stop` concern (road-to-team-mode Phase 4).
4
+ *
5
+ * Minimal call-site for `src/scripts/ai_team/review_gate.ts`. On Stop it
6
+ * reads the dispatcher envelope, and — ONLY when `ai_team.enabled` AND
7
+ * `ai_team.review_gate.managed` are true — locates the newest stop-gate
8
+ * review job the codex plugin persisted for this session, parses its
9
+ * first-line ALLOW/BLOCK contract, applies the consecutive-BLOCK counter,
10
+ * and prints the circuit-breaker notice (exactly once per trip) to stdout
11
+ * for the dispatch layer to render. With `managed: false` (default) the
12
+ * hook exits 0 without touching anything — byte-identical pre-Phase-4
13
+ * Stop behavior.
14
+ *
15
+ * Composition point (documented, not yet wired): register this script as a
16
+ * `team-review-gate` concern in `src/scripts/hook_manifest.yaml` on the
17
+ * claude / cowork `stop` slots, after `chat-history` (ordering relative to
18
+ * the PLUGIN's own Stop hook is host-scheduled and irrelevant here — the
19
+ * verdict is read from the plugin's persisted job record, not from sibling
20
+ * hook output). Manifest registration drags the lint_hook_manifest +
21
+ * installer + tests/hooks snapshot surface, so it is left to the
22
+ * orchestrator; this file is dispatcher-shaped and drop-in ready.
23
+ *
24
+ * Contract: never blocks, exit 0 on every path, `fail_closed: false`.
25
+ */
26
+ import fs from 'node:fs';
27
+ import path from 'node:path';
28
+ import { fileURLToPath, pathToFileURL } from 'node:url';
29
+
30
+ import {
31
+ find_latest_gate_transcript,
32
+ record_gate_verdict,
33
+ } from './ai_team/review_gate.js';
34
+ import { AI_TEAM_DEFAULTS, load_ai_team_config, type AiTeamConfig } from './ai_team/config.js';
35
+ import { unwrap } from './hooks/envelope.js';
36
+
37
+ function _read_stdin(): string {
38
+ try {
39
+ if (process.stdin.isTTY) {
40
+ return '';
41
+ }
42
+ return fs.readFileSync(0, 'utf-8');
43
+ } catch {
44
+ return '';
45
+ }
46
+ }
47
+
48
+ export function main(): number {
49
+ const [envelope] = unwrap(_read_stdin(), 'claude');
50
+
51
+ const event = String(envelope['event'] ?? '');
52
+ if (event !== '' && event !== 'stop') {
53
+ return 0;
54
+ }
55
+
56
+ const workspace_root =
57
+ String(envelope['workspace_root'] ?? '').trim() || process.cwd();
58
+ const session_id = String(envelope['session_id'] ?? '');
59
+
60
+ let config: AiTeamConfig;
61
+ try {
62
+ config = load_ai_team_config({ cwd: workspace_root });
63
+ } catch {
64
+ // A broken ai_team block must never break the Stop path — doctor
65
+ // owns reporting it. Defaults = managed off = strict no-op.
66
+ config = AI_TEAM_DEFAULTS;
67
+ }
68
+ if (!config.enabled || !config.review_gate.managed) {
69
+ return 0;
70
+ }
71
+
72
+ let notice: string | null = null;
73
+ try {
74
+ const gate = find_latest_gate_transcript(workspace_root, session_id);
75
+ if (gate === null) {
76
+ return 0; // no gate run this session — nothing to govern
77
+ }
78
+ const outcome = record_gate_verdict({
79
+ session_id,
80
+ transcript_text: gate.transcript,
81
+ dedupe_key: gate.job_id,
82
+ config,
83
+ project_root: workspace_root,
84
+ });
85
+ notice = outcome.notice;
86
+ } catch {
87
+ return 0; // fail-open — never block the agent loop
88
+ }
89
+
90
+ if (notice !== null) {
91
+ process.stdout.write(`${notice}\n`);
92
+ }
93
+ return 0;
94
+ }
95
+
96
+ function _isCliEntry(): boolean {
97
+ if (process.argv[1] === undefined) {
98
+ return false;
99
+ }
100
+ const argvUrl = pathToFileURL(path.resolve(process.argv[1])).href;
101
+ if (import.meta.url === argvUrl) {
102
+ return true;
103
+ }
104
+ try {
105
+ const here = fs.realpathSync(fileURLToPath(import.meta.url));
106
+ const argv = fs.realpathSync(path.resolve(process.argv[1]));
107
+ return here === argv;
108
+ } catch {
109
+ return false;
110
+ }
111
+ }
112
+
113
+ if (_isCliEntry()) {
114
+ process.exit(main());
115
+ }
@@ -1,5 +1,5 @@
1
1
  {
2
- "_note": "Shrink-only grandfather allowlist for check_trigger_eval_presence (road-to-composition-ratchet). Skills listed here predate the trigger-eval presence gate and may lack evals/triggers.json. Entries may ONLY be removed (when the skill gains a triggers.json or is deleted) — never added. Frozen 2026-07-08 at 221 of 264 skills.",
2
+ "_note": "Shrink-only grandfather allowlist for check_trigger_eval_presence (road-to-composition-ratchet). Skills listed here predate the trigger-eval presence gate and may lack evals/triggers.json. Entries may ONLY be removed (when the skill gains a triggers.json or is deleted) \u2014 never added. Frozen 2026-07-08 at 221 of 264 skills.",
3
3
  "skills": [
4
4
  "accessibility-auditor",
5
5
  "activation-design",
@@ -64,7 +64,6 @@
64
64
  "emit-tickets",
65
65
  "error-handling-patterns",
66
66
  "expansion-playbook",
67
- "fe-design",
68
67
  "feature-planning",
69
68
  "file-editor",
70
69
  "finishing-a-development-branch",
@@ -0,0 +1,225 @@
1
+ /**
2
+ * utilization_report.ts — U1 loaded-vs-fired utilization report
3
+ * (road-to-ecosystem-harvest-reliability-measurement, P1).
4
+ *
5
+ * PRIVACY: session engagement logs are personal data. This tool is
6
+ * LOCAL-ONLY and REPORT-ONLY by default — it is deliberately NOT wired into
7
+ * `task ci`; the opt-in gate flags below are for a consumer's own CI, never
8
+ * this repo's. The report header restates this.
9
+ *
10
+ * Consumes (never redefines) the pre-registered window criteria at
11
+ * docs/design/utilization-window-criteria.md (CLAIMS
12
+ * `utilization-window-decidability`):
13
+ * floor — ≥ 100 task/phase-step boundaries · ≥ 2 recording periods ≥ 14
14
+ * days apart (host identity is not in the schema) · ≥ 45 days
15
+ * since 2026-07-12. Below floor → UNDERPOWERED report, no verdicts.
16
+ * D1 — loaded-never-consulted over the window → retirement candidate
17
+ * (REAP verdict; kernel + safety floors exempt by construction).
18
+ * Without the U1a denominator in the data the report degrades to
19
+ * consulted-set analysis and says so.
20
+ * D2 — consulted-never-applied with ≥ 5 consultations and
21
+ * applied-ratio < 10% → trigger-review queue (REVIEW verdict).
22
+ * D3/D4 — above floor: ≥ 1 named decision per artifact kind (or a stated
23
+ * reason); below floor: honest null, gates stay closed.
24
+ *
25
+ * Verdicts: REAP (cut candidate — reversible quarantine with a manifest,
26
+ * never hard delete), KEEP, REVIEW. Session floor: no verdict below
27
+ * MIN_SESSIONS distinct task_ids — absence of evidence is not evidence of
28
+ * absence.
29
+ *
30
+ * Opt-in CI-gate flags (consumer-side only): --fail-under-utilization <pct>
31
+ * exits 3 when overall fired/loaded falls below the threshold;
32
+ * --fail-on-stale-days <n> exits 3 when the newest event is older than n
33
+ * days. Neither flag is used in this repo's pipelines.
34
+ */
35
+
36
+ import * as fs from 'node:fs';
37
+ import * as path from 'node:path';
38
+
39
+ import { aggregate } from '../agent-src/templates/scripts/telemetry/aggregator.js';
40
+
41
+ export const WINDOW_START_ISO = '2026-07-12T00:00:00Z';
42
+ export const FLOOR_BOUNDARIES = 100;
43
+ export const FLOOR_ELAPSED_DAYS = 45;
44
+ export const FLOOR_PERIOD_GAP_DAYS = 14;
45
+ export const MIN_SESSIONS = 4; // session floor for any verdict
46
+ export const D2_MIN_CONSULTED = 5;
47
+ export const D2_APPLIED_RATIO_LT = 0.10;
48
+
49
+ export interface VerdictRow {
50
+ kind: string;
51
+ id: string;
52
+ loaded: number;
53
+ consulted: number;
54
+ applied: number;
55
+ verdict: 'REAP' | 'KEEP' | 'REVIEW';
56
+ rule: 'D1' | 'D2' | '—';
57
+ }
58
+
59
+ export interface KernelInfo {
60
+ kernel: Set<string>;
61
+ safety_floors: Set<string>;
62
+ }
63
+
64
+ /** Kernel rule ids (type: always / alwaysApply) + *-safety-floor ids — exempt from REAP. */
65
+ export function read_exempt(rulesDir: string): KernelInfo {
66
+ const kernel = new Set<string>();
67
+ const safety = new Set<string>();
68
+ for (const name of fs.readdirSync(rulesDir)) {
69
+ if (!name.endsWith('.md')) continue;
70
+ const id = name.replace(/\.md$/, '');
71
+ if (id.endsWith('-safety-floor')) safety.add(id);
72
+ const head = fs.readFileSync(path.join(rulesDir, name), 'utf-8').slice(0, 400);
73
+ if (/^type:\s*["']?always["']?/m.test(head) || /^alwaysApply:\s*true/m.test(head)) {
74
+ kernel.add(id);
75
+ }
76
+ }
77
+ return { kernel, safety_floors: safety };
78
+ }
79
+
80
+ export function decide(
81
+ row: { kind: string; id: string; loaded: number; consulted: number; applied: number },
82
+ exempt: KernelInfo,
83
+ sessions: number,
84
+ ): VerdictRow {
85
+ const base = { ...row } as VerdictRow;
86
+ if (sessions < MIN_SESSIONS) {
87
+ base.verdict = 'KEEP';
88
+ base.rule = '—';
89
+ return base; // below the session floor no negative verdict is allowed
90
+ }
91
+ const isExempt = row.kind === 'rules'
92
+ && (exempt.kernel.has(row.id) || exempt.safety_floors.has(row.id));
93
+ if (row.loaded > 0 && row.consulted === 0 && !isExempt) {
94
+ base.verdict = 'REAP';
95
+ base.rule = 'D1';
96
+ return base;
97
+ }
98
+ if (row.consulted >= D2_MIN_CONSULTED && row.applied / row.consulted < D2_APPLIED_RATIO_LT) {
99
+ base.verdict = 'REVIEW';
100
+ base.rule = 'D2';
101
+ return base;
102
+ }
103
+ base.verdict = 'KEEP';
104
+ base.rule = '—';
105
+ return base;
106
+ }
107
+
108
+ interface FloorState {
109
+ boundaries: number;
110
+ sessions: number;
111
+ elapsed_days: number;
112
+ periods_ok: boolean;
113
+ above_floor: boolean;
114
+ has_loaded: boolean;
115
+ }
116
+
117
+ function day_diff(aIso: string, bIso: string): number {
118
+ return Math.abs(Date.parse(aIso) - Date.parse(bIso)) / 86_400_000;
119
+ }
120
+
121
+ export function assess_floor(logPath: string): FloorState {
122
+ const agg = aggregate(logPath);
123
+ // sessions = distinct task_ids; boundaries = parsed events. Recording
124
+ // periods: earliest vs latest ts ≥ FLOOR_PERIOD_GAP_DAYS apart (the
125
+ // schema-preserving degradation recorded in the criteria doc).
126
+ const text = fs.existsSync(logPath) ? fs.readFileSync(logPath, 'utf-8') : '';
127
+ const taskIds = new Set<string>();
128
+ for (const line of text.split('\n')) {
129
+ const m = line.match(/"task_id":"([^"]+)"/);
130
+ if (m) taskIds.add(m[1] ?? '');
131
+ }
132
+ const elapsed = agg.latest_ts ? day_diff(WINDOW_START_ISO, agg.latest_ts) : 0;
133
+ const periodsOk = agg.earliest_ts !== null && agg.latest_ts !== null
134
+ && day_diff(agg.earliest_ts, agg.latest_ts) >= FLOOR_PERIOD_GAP_DAYS;
135
+ return {
136
+ boundaries: agg.parsed_events,
137
+ sessions: taskIds.size,
138
+ elapsed_days: Math.floor(elapsed),
139
+ periods_ok: periodsOk,
140
+ above_floor: agg.parsed_events >= FLOOR_BOUNDARIES && periodsOk
141
+ && elapsed >= FLOOR_ELAPSED_DAYS,
142
+ has_loaded: agg.loaded_events > 0,
143
+ };
144
+ }
145
+
146
+ export async function main(argv: string[]): Promise<number> {
147
+ const arg = (flag: string): string | null => {
148
+ const i = argv.indexOf(flag);
149
+ return i !== -1 ? argv[i + 1] ?? null : null;
150
+ };
151
+ const logPath = arg('--log') ?? '.agent-engagement.jsonl';
152
+ const rulesDir = arg('--rules-dir') ?? 'dist/agent-src/rules';
153
+ const failUnder = arg('--fail-under-utilization');
154
+ const failStale = arg('--fail-on-stale-days');
155
+ const out: string[] = [];
156
+ out.push('# Utilization report — loaded vs fired');
157
+ out.push('');
158
+ out.push('> LOCAL-ONLY, REPORT-ONLY. Session transcripts/engagement logs are personal');
159
+ out.push('> data; this tool never runs in `task ci` and its output stays out of git.');
160
+ out.push('> Criteria consumed from docs/design/utilization-window-criteria.md — the');
161
+ out.push('> report applies D1-D4, it does not redefine them. A REAP verdict is a');
162
+ out.push('> QUARANTINE candidate (reversible move + manifest: what/when/why/restore),');
163
+ out.push('> never a hard delete.');
164
+ out.push('');
165
+
166
+ const floor = assess_floor(logPath);
167
+ out.push(`- boundaries recorded: ${floor.boundaries} (floor ${FLOOR_BOUNDARIES})`);
168
+ out.push(`- distinct sessions: ${floor.sessions} (verdict floor ${MIN_SESSIONS})`);
169
+ out.push(`- recording span ≥ ${FLOOR_PERIOD_GAP_DAYS}d: ${floor.periods_ok}`);
170
+ out.push(`- loaded denominator present: ${floor.has_loaded}${floor.has_loaded ? '' : ' — D1 degrades to consulted-set analysis (stated per the criteria doc)'}`);
171
+ out.push('');
172
+
173
+ const agg = aggregate(logPath);
174
+ const exempt = read_exempt(rulesDir);
175
+ const rows = agg.stats().map((s) => decide(
176
+ { kind: s.kind, id: s.artefact_id, loaded: s.loaded, consulted: s.consulted, applied: s.applied },
177
+ exempt,
178
+ floor.sessions,
179
+ ));
180
+
181
+ if (!floor.above_floor) {
182
+ out.push('## Verdict: UNDERPOWERED (window floor not met — D4 path)');
183
+ out.push('');
184
+ out.push('No REAP/REVIEW verdicts are issued below the observation floor;');
185
+ out.push('lifecycle-automation and field-outcome-ledger gates stay closed.');
186
+ out.push('Interim observed counts follow (informational only):');
187
+ } else {
188
+ out.push('## Verdicts (D3 path — above floor)');
189
+ }
190
+ out.push('');
191
+ out.push('| kind | id | loaded | consulted | applied | verdict | rule |');
192
+ out.push('|---|---|---:|---:|---:|---|---|');
193
+ const ranked = [...rows].sort((a, b) => (a.consulted - b.consulted) || (b.loaded - a.loaded));
194
+ for (const r of ranked) {
195
+ const verdict = floor.above_floor ? r.verdict : '—';
196
+ const rule = floor.above_floor ? r.rule : '—';
197
+ out.push(`| ${r.kind} | \`${r.id}\` | ${r.loaded} | ${r.consulted} | ${r.applied} | ${verdict} | ${rule} |`);
198
+ }
199
+ process.stdout.write(`${out.join('\n')}\n`);
200
+
201
+ // Opt-in consumer CI gates (exit 3) — never wired in this repo.
202
+ if (failUnder !== null) {
203
+ const totLoaded = rows.reduce((n, r) => n + r.loaded, 0);
204
+ const totFired = rows.reduce((n, r) => n + (r.loaded > 0 && r.consulted > 0 ? 1 : 0), 0);
205
+ const denom = rows.filter((r) => r.loaded > 0).length;
206
+ const pct = denom > 0 && totLoaded > 0 ? (totFired / denom) * 100 : 100;
207
+ if (pct < Number(failUnder)) return 3;
208
+ }
209
+ if (failStale !== null && agg.latest_ts !== null) {
210
+ if (day_diff(agg.latest_ts, new Date().toISOString()) > Number(failStale)) return 3;
211
+ }
212
+ return 0;
213
+ }
214
+
215
+ const isMain = process.argv[1] !== undefined
216
+ && path.resolve(process.argv[1]) === path.resolve(new URL(import.meta.url).pathname);
217
+ if (isMain) {
218
+ main(process.argv.slice(2)).then(
219
+ (code) => process.exit(code),
220
+ (err) => {
221
+ process.stderr.write(`${err instanceof Error ? err.stack ?? err.message : String(err)}\n`);
222
+ process.exit(1);
223
+ },
224
+ );
225
+ }
@@ -304,7 +304,15 @@ export const settingsSchema = z.object({
304
304
  suppress_setup_hint: z.boolean().default(false).describe(
305
305
  'Suppress the one-line wizard/init recommendation to set up the codex plugin on Claude-Code hosts. Cosmetic only — never changes behavior.',
306
306
  ),
307
- }).default({ enabled: false, model: 'auto', allow_delegate: false, max_calls_per_day: 50, suppress_setup_hint: false }),
307
+ review_gate: z.object({
308
+ managed: z.boolean().default(false).describe(
309
+ "Managed governance of the codex plugin's Stop-hook Review Gate (road-to-team-mode Phase 4). false (default) = byte-identical pre-Phase-4 behavior: no counting, no circuit breaker. true = count consecutive BLOCK verdicts per session and trip the circuit breaker at max_consecutive_blocks.",
310
+ ),
311
+ max_consecutive_blocks: z.number().int().min(1).default(3).describe(
312
+ 'Circuit-breaker bound: after this many CONSECUTIVE BLOCK verdicts in one session, a visible notice is injected exactly once and the managed layer stops re-blocking — the user decides, never an infinite Claude↔Codex loop. An ALLOW verdict resets the counter. Positive integer.',
313
+ ),
314
+ }).default({ managed: false, max_consecutive_blocks: 3 }),
315
+ }).default({ enabled: false, model: 'auto', allow_delegate: false, max_calls_per_day: 50, suppress_setup_hint: false, review_gate: { managed: false, max_consecutive_blocks: 3 } }),
308
316
  onboarding: z.object({
309
317
  onboarded: z.boolean().default(false).describe(
310
318
  'Set to true once the developer has completed `agent-config setup`. The onboarding-gate rule blocks the first turn of every chat until this is true. Toggle back to false to re-trigger the wizard.',