@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
@@ -7,6 +7,7 @@ visibility: internal
7
7
  cluster: video
8
8
  sub: from-song
9
9
  description: Music-video from a song + reference images — accept or derive a timed scene script, optional character-lock, render, stitch, mux song as master track. Preview default; --mode commit gates the spend.
10
+ argument-hint: "<images-dir> <song-file> [--mode preview|commit] [--brief <text>|--auto-script] [--max-spend-usd <usd>]"
10
11
  personas: [hollywood-director, ai-video-technical-director]
11
12
  skills: [song-to-script, scene-expander, video-director, character-consistency, motion-choreographer, prompt-validator]
12
13
  suggestion:
@@ -61,7 +62,7 @@ silent best-guess.
61
62
  | Input | Required | Meaning |
62
63
  |---|---|---|
63
64
  | `<images-dir>` | yes | Folder of reference stills (`.png` / `.jpg`). When they contain a consistent human subject the on-screen identity is locked from them; otherwise the run is style-only (Step 6). |
64
- | `<song-file>` | yes | Audio track (`.mp3` / `.wav` / `.m4a`) — or an `https://` song link (Suno / Udio / YouTube / any yt-dlp-supported page): ingested to a local file first via `scripts/ai-video/lib/ingest-song.sh <url> <project>` (operator-installed `yt-dlp` + `ffmpeg`; rights note surfaced; size-capped; never a silent overwrite); pipeline continues on `<project>/song.m4a`. Defines total duration and, in `--auto-script` mode, the scene structure. |
65
+ | `<song-file>` | yes | Audio track (`.mp3` / `.wav` / `.m4a`) — or an `https://` song link (Suno / Udio / YouTube / any yt-dlp-supported page): the link is ingested to a local file first via `scripts/ai-video/lib/ingest-song.sh <url> <project>` (operator-installed `yt-dlp` + `ffmpeg`; rights note surfaced; size-capped; never a silent overwrite) and the pipeline continues on `<project>/song.m4a`. Defines total duration and, in `--auto-script` mode, the scene structure. |
65
66
  | `--brief "<text>"` | one of brief/auto | Operator-written description of the video (mood, story, settings). |
66
67
  | `--auto-script` | one of brief/auto | Derive the script from the song via the `song-to-script` skill. |
67
68
  | `--scene-durations <list>` | no | Manual cut points (e.g. `0:00-0:15,0:15-0:30,…`). Overrides probe timing — the honest path when the track is flat (probe `method: interval`). |
@@ -95,28 +96,28 @@ with usage, never a deadlocked prompt.
95
96
 
96
97
  - `<images-dir>` exists and holds ≥1 `.png`/`.jpg`. Empty or missing →
97
98
  halt, list what was found.
98
- - `<song-file>` given as an `https://` link → ingest first:
99
+ - `<song-file>` given as an `https://` link → ingest it first:
99
100
  `scripts/ai-video/lib/ingest-song.sh <url> <project>` (exit 3 names
100
- the missing tool; exit 75 = retryable download failure). The ingested
101
- local file replaces the URL for every later step — ground truth stays
102
- the real bytes, and the media-governance gate below runs on the
103
- ingested file (a platform link is *more* likely a recognisable
104
- commercial song — check `voice-cloning` deliberately).
101
+ the missing tool; exit 75 is a retryable download failure). The
102
+ ingested local file replaces the URL for every later step — ground
103
+ truth stays the real bytes, and the media-governance gate below runs
104
+ on the ingested file (a platform link is *more* likely to be a
105
+ recognisable commercial song — check `voice-cloning` deliberately).
105
106
  - `<song-file>` exists and is a readable audio container (`ffprobe`
106
107
  returns an audio stream). Derive its length + structure now,
107
108
  **adapter-first with the probe as the floor** (fallback semantics per
108
109
  [`audio-adapter-contract.md § Fallback`](../../../scripts/ai-video/lib/audio-adapter-contract.md)):
109
- 1. An `audio-analysis` provider configured in `agents/.ai-video.xml`
110
+ 1. An `audio-analysis` provider is configured in `agents/.ai-video.xml`
110
111
  **and** `scripts/ai-video/audio-adapters/<id>.sh` exists → run
111
112
  ```bash
112
113
  echo '{"audio_path":"<song-file>"}' | scripts/ai-video/audio-adapters/<id>.sh analyze
113
114
  ```
114
115
  Real `{bpm, beats, downbeats, sections:[{start,end,label}]}` drives
115
- the cut; report names the `source`. **Transient** failure (exit 75)
116
- → retry once, then fall back to the probe with ONE warning line.
117
- **Config** failure (exit 3/6/7 — CLI missing, disabled, bad key) →
118
- **halt with the actionable message** — a configured adapter never
119
- silently degrades.
116
+ the cut; the report names the `source`. On a **transient** failure
117
+ (exit 75) retry once, then fall back to the probe with ONE warning
118
+ line. On a **config** failure (exit 3/6/7 — CLI missing, disabled,
119
+ bad key) **halt with the actionable message** — a configured
120
+ adapter never silently degrades.
120
121
  2. No audio-analysis provider configured → run the zero-dependency
121
122
  probe (the normal path, not a degradation):
122
123
  ```bash
@@ -224,7 +225,7 @@ When the track has vocals **and** the run assigns singers / lip-sync:
224
225
  scripts/ai-video/lib/validate-vocal-map.sh <project>/vocal-map.json \
225
226
  <project>/transcript.json --roster "<cast>"
226
227
  ```
227
- — mechanically rejects re-timed lines, lyrics absent from the
228
+ — it mechanically rejects re-timed lines, lyrics absent from the
228
229
  transcript, and missing singers (exit 7 with the offending line). A
229
230
  skeleton-derived map cannot reach the operator, let alone a render.
230
231
  3. **Each vocal line maps to its OWN singer.** Never put one character's
@@ -363,20 +364,20 @@ Before rendering, run the mechanical scan:
363
364
  scripts/ai-video/lib/resume-scan.sh scan <project> --plan <project>/plan.json
364
365
  ```
365
366
 
366
- `plan.json` holds each scene's current `input_sha256`
367
+ where `plan.json` holds each scene's current `input_sha256`
367
368
  (`resume-scan.sh hash < scenes/<id>/prompt.json` — same canonicalization
368
- the render path stamps). `green` scenes skipped verbatim; `stale`
369
- (prompt edited, provider/model switched, hash tampered) + `missing`
370
- re-render; `failed` surfaces its `error.json` reason. After each live
371
- scene completes, write `scenes/<id>/cost.json`
369
+ the render path stamps). `green` scenes are skipped verbatim; `stale`
370
+ (prompt edited, provider/model switched, hash tampered) and `missing`
371
+ scenes re-render; `failed` scenes surface their `error.json` reason.
372
+ After each live scene completes, write `scenes/<id>/cost.json`
372
373
  (`{charged_usd, adapter, model}`, atomic `tmp`+`mv`) — the scan sums it
373
374
  as `spent_usd` and the batch loop re-checks `--max-spend-usd` against it
374
375
  before **every** live submit, not only at the upfront gate. Per-scene
375
376
  kill-switch (ADR-059 §6): max one surfaced auto-retry on
376
- `retryable: true`; content-policy refusals always halt. Rollback =
377
+ `retryable: true`, content-policy refusals always halt. Rollback is
377
378
  deletion (`rm -rf scenes/<id>/` → re-render); `--clean`
378
379
  (`resume-scan.sh clean <project>`) removes failed-scene residue only —
379
- green artifacts never auto-deleted.
380
+ green artifacts are never auto-deleted.
380
381
 
381
382
  ### 9. Stitch + master-audio mux + duration reconciliation
382
383
 
@@ -7,6 +7,7 @@ visibility: internal
7
7
  cluster: video
8
8
  sub: scene
9
9
  description: Render a single scene from a one-line idea — scene-expander → blueprint → image → operator pick → motion → video. Preview mode default (no spend); --mode commit renders live behind the cost gate.
10
+ argument-hint: "<idea> [--mode preview|commit] [--image-provider <id>] [--video-provider <id>] [--project <slug>]"
10
11
  personas: [hollywood-director, ai-video-technical-director]
11
12
  skills: [scene-expander, video-director, character-consistency, motion-choreographer]
12
13
  suggestion:
@@ -7,6 +7,7 @@ visibility: internal
7
7
  cluster: video
8
8
  sub: stitch
9
9
  description: Re-stitch existing clips in `<project>/scenes/*/` after operator edits — no re-render. ffmpeg concat driven by manifest.json.
10
+ argument-hint: "<project-slug> [--skip-scene <id>] [--continue]"
10
11
  personas: [ai-video-technical-director]
11
12
  skills: []
12
13
  suggestion:
@@ -86,4 +87,4 @@ No live cost (no network calls happened). No commit. No push.
86
87
  - [`/video:from-script`](from-script.md) — full pipeline including
87
88
  initial stitch
88
89
  - [`/video:scene`](scene.md) — render one scene
89
- - [`scripts/ai-video/stitch.sh`](../../scripts/ai-video/stitch.sh) — the underlying tool
90
+ - [`scripts/ai-video/stitch.sh`](../../../scripts/ai-video/stitch.sh) — the underlying tool
@@ -7,6 +7,7 @@ visibility: internal
7
7
  cluster: video
8
8
  sub: storyboard
9
9
  description: Image-only storyboard — script → scenes → blueprint → image render → contact-sheet PNG via ffmpeg montage. No video calls.
10
+ argument-hint: "<path-to-script.md> [--image-provider <id>]"
10
11
  personas: [hollywood-director]
11
12
  skills: [scene-expander, video-director, character-consistency]
12
13
  suggestion:
@@ -6,6 +6,7 @@ tier: 2
6
6
  visibility: internal
7
7
  cluster: video
8
8
  description: Video-creation orchestrator — Hollywood-level AI video pipeline. Routes to from-script, from-song, scene, storyboard, stitch.
9
+ argument-hint: "[from-script|from-song|scene|storyboard|stitch] [args]"
9
10
  type: orchestrator
10
11
  suggestion:
11
12
  eligible: true
@@ -9,6 +9,7 @@ tier: 0
9
9
  visibility: visible
10
10
  skills: [refine-prompt, command-routing]
11
11
  description: Drive a free-form prompt end-to-end through refine → score → plan → implement → test → verify → report — Option-A loop over the `work_engine` engine, confidence-band gated, no auto-git.
12
+ argument-hint: "[prompt]"
12
13
  suggestion:
13
14
  eligible: true
14
15
  trigger_description: "build this, implement this, drive this end-to-end"
@@ -8,6 +8,7 @@ cluster: worktree
8
8
  sub: cleanup
9
9
  skills: [worktree-lifecycle, git-workflow]
10
10
  description: Safe worktree removal gate — refuses while the branch holds commits on no other ref; never force-deletes
11
+ argument-hint: "[worktree-path]"
11
12
  suggestion:
12
13
  eligible: true
13
14
  trigger_description: "clean up the worktrees, remove the finished worktree"
@@ -41,8 +42,8 @@ untracked files, paths with spaces — `tests/scripts/worktree_cleanup_check.tes
41
42
  ./scripts-run src/scripts/worktree_cleanup_check check <worktree-path>
42
43
  ```
43
44
 
44
- Exit `0` → removal allowed. Exit `1` → **refuse** that candidate; output
45
- names the exact gate:
45
+ Exit `0` → removal allowed. Exit `1` → **refuse** that candidate; the
46
+ output names the exact gate:
46
47
 
47
48
  1. **Detached HEAD** — no branch to judge reachability for; resolve the
48
49
  state manually first.
@@ -50,11 +51,11 @@ names the exact gate:
50
51
  files count as work). Never `git worktree remove --force`.
51
52
  3. **Unique commits** — commits reachable from the worktree branch but
52
53
  from no other ref (branches, remotes, AND tags — a tag counts as
53
- reachability). Branch holds work that exists nowhere else: surface
54
- the commit list and hand the decision back — dropping commits the
55
- session did not author is forbidden by the `git-history-discipline`
56
- rule (shared-branch Iron Law); merging or preserving them is the
57
- user's call.
54
+ reachability). The branch holds work that exists nowhere else:
55
+ surface the commit list and hand the decision back — dropping
56
+ commits the session did not author is forbidden by the
57
+ `git-history-discipline` rule (shared-branch Iron Law); merging or
58
+ preserving them is the user's call.
58
59
 
59
60
  ### 3. Remove the allowed candidates
60
61
 
@@ -8,6 +8,7 @@ cluster: worktree
8
8
  sub: create
9
9
  skills: [worktree-lifecycle, using-git-worktrees]
10
10
  description: Create a governed worktree and write its scope-lock note — propose-once branch naming, host-native primitive preferred
11
+ argument-hint: "[task] [branch-name]"
11
12
  suggestion:
12
13
  eligible: true
13
14
  trigger_description: "do this in a worktree, isolate this task, spawn a worktree for X"
@@ -8,6 +8,7 @@ cluster: worktree
8
8
  sub: verify
9
9
  skills: [worktree-lifecycle, verify-completion-evidence]
10
10
  description: Run the scoped verification for a worktree's declared change — narrow probes matched to the diff, never the full CI pipeline
11
+ argument-hint: "[worktree-path | branch]"
11
12
  suggestion:
12
13
  eligible: true
13
14
  trigger_description: "verify the worktree change, prove this worktree is ready"
@@ -2,6 +2,7 @@
2
2
  model_tier: medium
3
3
  name: worktree
4
4
  disable-model-invocation: true
5
+ argument-hint: "[create|status|verify|cleanup] [args]"
5
6
  pack: engineering-base
6
7
  tier: 2
7
8
  visibility: internal
@@ -14,13 +14,15 @@ triggers:
14
14
  - keyword: "upgrade"
15
15
  - keyword: "cleanup"
16
16
  - keyword: "technical debt"
17
+ routes_to:
18
+ - "guideline:agent-infra/active-remediation-mechanics"
17
19
  workspaces: [engineering]
18
20
  packs: [engineering-base]
19
21
  ---
20
22
 
21
23
  # Active Remediation
22
24
 
23
- The user doesn't see the code at the spot you're editing — you do. So this package guides the agent to **actively improve** what it touches: don't accept legacy, debt, security gaps, or duplication as given. But active improvement is bounded — never the scope creep `minimal-safe-diff` exists to stop. The rule is a **ladder**: act by size and alignment, and **never silently ignore** a real issue.
25
+ The user does not see the code at the spot you are editing — you do. So this package guides the agent to **actively improve** what it touches: don't accept legacy, debt, security gaps, or duplication as given. But active improvement is bounded — it must never become the scope creep `minimal-safe-diff` exists to stop. The rule is a **ladder**: act by size and alignment, and **never silently ignore** a real issue.
24
26
 
25
27
  ## The Iron Law
26
28
 
@@ -34,44 +36,15 @@ A LIVE SECURITY / DATA-EXPOSURE GAP IS NEVER MERELY "NOTED FOR LATER".
34
36
 
35
37
  ## What to remediate
36
38
 
37
- Security gaps (broken access control, injection, secrets, missing authz — see `broken-access-control`) · missing/weak test coverage · bad code (dead code, silent error-swallow, unguarded edge cases) · **duplication** (same/near-same logic repeated instead of one method/abstraction) · **stale version-idioms** (code for an older language/framework version than the project runs).
39
+ Security gaps (broken access control, injection, secrets, missing authz — see `broken-access-control`) · missing/weak test coverage · bad code (dead code, silent error-swallow, unguarded edge cases) · **duplication** (the same or near-same logic repeated instead of one method/abstraction) · **stale version-idioms** (code written for an older language/framework version than the project actually runs).
38
40
 
39
- ## The ladder — classify, then act
41
+ ## The ladder — three tiers
40
42
 
41
- ### Fix now (autonomous, inline) — a bounded amendment to `minimal-safe-diff`
42
-
43
- Allowed **only** when ALL hold — the testable "small + task-aligned" definition:
44
- - **Same request path / module** as the current task (not an unrelated feature).
45
- - **≤ ~10 changed lines** in one production file plus its test file — no wider cross-file ripple.
46
- - **No public-API / response-shape change**, no new parameter.
47
- - **No dependency bump, no migration, no data change.**
48
- - **Its verification ships in the same commit** — the security fix's negative test, the correctness fix's case.
49
-
50
- Under those constraints the fix is auditable in the same diff and is *not* scope creep — it corrects a boundary the agent touched. Anything outside them → **note + ask**, never auto. (`minimal-safe-diff` still governs the rest: no reformatting, no opportunistic refactor, no drive-by rename.)
51
-
52
- ### Note + ask (batched)
53
-
54
- Bigger, or diverges from the task → do **not** refactor inline, do **not** interrupt the flow. Note the site (file:line + issue). Surface the batch as **one** numbered-options prompt (`user-interaction`, one recommendation line) **after the task is delivered** — or mid-work only when the flow makes it natural. Each option carries a real trade-off (`no-cheap-questions`). Refactor only on an explicit yes, as a separate scoped change (`scope-control`, `downstream-changes`).
55
-
56
- ### Propose a follow-up PR (many spots)
57
-
58
- Too many to fold in without blowing the current diff's scope → propose **one or more separate follow-up PRs** (or a roadmap under `agents/roadmaps/`, using the shared-prefix convention) so the user reviews before merge. Creating the PR/roadmap is **permission-gated** — propose, get a yes, then create (`scope-control`, `commit-policy`).
59
-
60
- ## Version-gated modernization
61
-
62
- Update stale idioms to the version the project **actually runs** — only when that version is **verified**:
63
- - **Establish the version first** from the manifest constraint (`composer.json` `require`, `package.json` `engines`, `.tool-versions`, lockfile) — use the **lowest** bound; on an ambiguous/monorepo range, ask once. **Unknown version → do not touch** (must fit the project structure — the `source-discovery` gate).
64
- - **Syntax-only, behavior-preserving idioms** (e.g. `array()` → `[]`, `isset($x)?$x:$d` → `$x ?? $d`, concat → template) provably equivalent → treat as a small fix (auto per the ladder).
65
- - **Behavioral changes** (`readonly`/typed properties, new semantics) and **any dependency/version bump** → **ask only**, never auto (a version bump stays under `minimal-safe-diff`'s no-dependency-bump prohibition; a pure syntax idiom is categorically different).
43
+ **Fix now** — small + task-aligned; ALL five conditions hold: same request path/module · ≤ ~10 changed lines in one production file (plus its test file) · no public-API / response-shape change · no dependency bump, no migration · verification ships in the same commit. Anything outside → next tier. · **Note + ask** (batched, one numbered-options prompt after delivery) · **Follow-up PR** (many spots; creation stays permission-gated). Per-tier criteria + version-gated modernization + guardrails: the mechanics guideline below.
66
44
 
67
45
  ## Live-security carve-out (priority)
68
46
 
69
- A **live cross-user / cross-tenant data exposure** (`broken-access-control`) is not "note for later": a potential GDPR-notifiable breach (Art. 33, 72 h from discovery). Meets the fix-now bar → fix now with its negative test. Otherwise → **stop and surface it immediately** (a safety surface, visible even under an autonomous mandate — like the `no-pr-progress-comments` safety carve-out). Never defer silently, never look away.
70
-
71
- ## Guardrails — don't become a nagging machine
72
-
73
- - Subordinate to `no-cheap-questions` (self-check items 3 & 14 — real trade-off, not a disguised continuation/commit ask), `autonomous-execution` (the end-of-session batch must not read as "shall I continue?"), `user-interaction`, `ask-when-uncertain` (one batched prompt = one question).
74
- - Threshold to surface at all: a **real, nameable** improvement with concrete benefit. Cosmetic nitpicks with no trade-off → drop silently. The live-security carve-out is the only case that interrupts or overrides autonomy.
47
+ A **live cross-user / cross-tenant data exposure** (per `broken-access-control`) is not a "note for later": it is a potential GDPR-notifiable breach (Art. 33, 72 h from discovery). If it meets the fix-now bar → fix it now with its negative test. If not → **stop and surface it immediately** (a safety surface, visible even under an autonomous mandate — like the `no-pr-progress-comments` safety carve-out). Never defer it silently, never look away.
75
48
 
76
49
  ## When it fires
77
50
 
@@ -79,12 +52,15 @@ While implementing/modifying code you pass an issue outside the literal task. Al
79
52
 
80
53
  ## When NOT to fire
81
54
 
82
- - No issue spotted. Prose/docs-only. User fenced the scope ("just this one line").
55
+ - No issue spotted. Prose/docs-only. The user fenced the scope ("just this one line").
83
56
  - The issue is the task itself — then it's just the task (no ladder needed).
84
57
 
58
+ Body migrated to [`guideline:agent-infra/active-remediation-mechanics`](../docs/guidelines/agent-infra/active-remediation-mechanics.md) (per P4 of `road-to-kernel-and-router.md`) — per-tier fix-now/note+ask/follow-up-PR criteria, version-gated modernization, anti-nagging guardrails.
59
+ Trigger-set above activates this routing on demand, independent of the discipline profile (ADR-110).
60
+
85
61
  ## See also
86
62
 
87
- - [`minimal-safe-diff`](minimal-safe-diff.md) — the carve-out above is bounded by it; everything outside the five conditions stays note+ask.
63
+ - [`minimal-safe-diff`](minimal-safe-diff.md) — the fix-now carve-out is bounded by it; everything outside the five conditions stays note+ask.
88
64
  - [`broken-access-control`](broken-access-control.md) — the security category + the live-exposure carve-out.
89
65
  - [`prefer-enums-over-literals`](prefer-enums-over-literals.md) — an instance of this ladder (enum literals).
90
66
  - [`source-discovery-gate`](source-discovery-gate.md) — establishing the verified project version before modernizing.
@@ -14,6 +14,8 @@ triggers:
14
14
  - phrase: "new guideline"
15
15
  - phrase: "neue Regel"
16
16
  - phrase: "bau mir ein Skill"
17
+ routes_to:
18
+ - "guideline:agent-infra/artifact-drafting-protocol-mechanics"
17
19
  workspaces: [agent-config-maintainer, engineering]
18
20
  packs: [meta]
19
21
  ---
@@ -42,71 +44,9 @@ rewrites with a specific target phrasing, < 10-line edits, or explicit
42
44
  bypass (*"just write it"*, *"skip protocol"*, *"einfach machen"*).
43
45
  Fires once per creation task, not once per edit.
44
46
 
45
- ## Phase A — Understand
47
+ ## The three phases
46
48
 
47
- Ask up to **5** clarifying questions (numbered options, each with a
48
- *"skip / I don't know yet"* escape):
49
-
50
- 1. **Problem** — what does this solve that no existing artifact solves?
51
- 2. **Trigger surface** — which user phrasings should fire this?
52
- 3. **Should-trigger examples** — 2-3 in the user's words.
53
- 4. **Near-miss cases** — 2-3 phrasings that must **not** fire.
54
- 5. **Artifact type** — skill, rule, command, or guideline? Offer a
55
- 3-line primer if unsure.
56
-
57
- If the user skips Q1 or Q5, stop and surface the ambiguity — don't guess.
58
-
59
- ## Phase B — Research
60
-
61
- Run the **search protocol** from
62
- [`learning-to-rule-or-skill` § 4](../skills/learning-to-rule-or-skill/SKILL.md#4-check-for-overlap--search-protocol-mandatory)
63
- — `ls` all four surfaces (`skills/`, `rules/`, `guidelines/`, `commands/`),
64
- grep with **solution-words AND problem-words**, scan sub-directory
65
- taxonomies, then **open and skim** the 3 nearest matches. A negative grep
66
- alone is not proof of no overlap. Report the top 3-5 most-similar
67
- artifacts and ask (numbered options):
68
-
69
- - Extend an existing one?
70
- - Create a new one — gap is real?
71
- - Show overlap first?
72
- - Promote via `learning-to-rule-or-skill` instead?
73
-
74
- Carry the summary into the commit message (*"Reviewed before drafting:
75
- X, Y"*).
76
-
77
- ## Phase C — Draft
78
-
79
- Propose **2-3 description variants** — Conservative / Pushy
80
- (per `skill-quality`) / Concrete (embedded trigger example). User picks
81
- or merges. Only then draft the body. Surface every structural choice
82
- (size class, section order) as numbered options if in doubt.
83
-
84
- Enforce size live: *"Body is at 420/500 lines. Split?"* (budgets per
85
- `size-enforcement`). New skills also get an `evals/triggers.json` stub
86
- (5 should-trigger + 5 should-not-trigger). See `skill-writing` § 1c.
87
-
88
- ## Roadmap-run batch mode — the ONE structured bypass
89
-
90
- When a `/roadmap:process-*` run starts under an **accepted execution
91
- contract** ([`roadmap-execution-contract`](../contexts/execution/roadmap-execution-contract.md))
92
- whose pre-scan detected artifact-authoring steps, the protocol runs in
93
- batch mode for exactly those artifacts:
94
-
95
- - **Phase B (Research) runs ONCE at contract time, against the CURRENT
96
- artifact state** — one overlap scan covering every artifact the
97
- roadmap plans; results (nearest matches, extend-vs-create verdicts)
98
- are surfaced inside the contract summary the user accepts. This is
99
- why authoring-time-only checking is not enough: a sibling roadmap may
100
- have landed overlapping artifacts between authoring and execution.
101
- - **Phases A (Understand) and C (Draft) run non-interactively during
102
- the run** — the roadmap step text is the Understand input; the
103
- contract acceptance is the approval that the per-phase prompts exist
104
- to obtain.
105
- - **Scope is the batch, nothing more.** An artifact NOT declared in the
106
- roadmap (discovered mid-run) triggers the full interactive protocol —
107
- or, under the contract, the scope-out-of-roadmap halt.
108
- - Batch mode never skips the Research pass itself — it relocates and
109
- batches it. `artifact_protocol: skip` does not exist.
49
+ **A — Understand** (≤ 5 clarifying questions: problem, trigger surface, should-trigger examples, near-misses, artifact type) · **B — Research** (mandatory four-surface overlap scan; open + skim the 3 nearest matches; extend-vs-create decision) · **C — Draft** (2-3 description variants first, then the body; live size enforcement). Per-phase procedure + the roadmap batch-mode carve-out: the mechanics guideline below.
110
50
 
111
51
  ## Golden rules
112
52
 
@@ -118,5 +58,8 @@ batch mode for exactly those artifacts:
118
58
  - Commit only on approval.
119
59
  - Bypass is legitimate — *"just write it"* drops the protocol immediately.
120
60
 
61
+ Body migrated to [`guideline:agent-infra/artifact-drafting-protocol-mechanics`](../docs/guidelines/agent-infra/artifact-drafting-protocol-mechanics.md) (per P4 of `road-to-kernel-and-router.md`) — Phase A/B/C procedure detail + the roadmap-run batch-mode carve-out (Research-once-at-contract-time, batch scope, no `artifact_protocol: skip`).
62
+ Trigger-set above activates this routing on demand, independent of the discipline profile (ADR-110).
63
+
121
64
  Extends (cross-link, don't restate): `ask-when-uncertain`,
122
65
  `improve-before-implement`, `user-interaction`, `skill-quality`.
@@ -8,6 +8,8 @@ triggers:
8
8
  - intent: "tool loop"
9
9
  - intent: "fresh chat"
10
10
  - keyword: "3-failure"
11
+ routes_to:
12
+ - "guideline:agent-infra/context-hygiene-mechanics"
11
13
  workspaces: [agent-config-maintainer, construction, engineering, finance, founder, gtm, legal-review-prep, ops, product, small-business]
12
14
  packs: [meta]
13
15
  ---
@@ -24,31 +26,13 @@ packs: [meta]
24
26
 
25
27
  Monitor for **context decay** — long conversations degrade quality and waste tokens.
26
28
 
27
- **Suggest a new chat when:**
28
-
29
- - Conversation exceeds **~20 user messages**
30
- - Topic **changes completely**
31
- - Re-reading files already in context
32
- - **15+ completed tasks** and new unrelated topic
33
- - Branch changed since start
34
- - ~24 hours passed
29
+ **Suggest a new chat when:** ~20+ user messages · complete topic change ·
30
+ re-reading files already in context · 15+ completed tasks and a new unrelated
31
+ topic · branch changed since start · ~24 hours passed.
35
32
 
36
33
  **Repeat** at multiples: messages 20/40/60, tasks 15/30/45.
37
- **ONLY at exact thresholds.** Between: silence.
38
-
39
- **How to suggest:**
40
-
41
- Estimate token cost: responses × ~1,500 tokens.
42
-
43
- ```
44
- > ⚡ This conversation has ~{N} messages (~{N×1500} tokens history cost — charged on EVERY request).
45
- > A fresh chat saves ~{N×1500} input tokens per request.
46
- >
47
- > 1. Start fresh — I'll initiate a session handoff
48
- > 2. Continue here
49
- ```
50
-
51
- **If the user picks 1:** Initiate a session handoff or start fresh.
34
+ **ONLY at exact thresholds.** Between: silence. Suggestion template
35
+ (token-cost estimate + numbered options): the mechanics guideline below.
52
36
 
53
37
  ## The 3-Failure Rule
54
38
 
@@ -58,40 +42,20 @@ When **3 consecutive attempts** at the same task fail (code fix, test fix, confi
58
42
  2. **State dump** — summarize what was tried, what failed, and what you know so far.
59
43
  3. **Recommend fresh start** — suggest a fresh session with the state dump as context, or ask for a different approach.
60
44
 
61
- **What counts as a failure:**
62
-
63
- - Code change that doesn't fix the problem
64
- - Test that still fails after the fix
65
- - Quality check (type-checker, linter, formatter) that still errors
66
- - Build/deploy that fails after config change
67
-
68
- **Does NOT reset the counter:** Unrelated tasks. User providing new information (course correction).
45
+ **What counts as a failure:** a change that doesn't fix the problem · a test still failing after the fix · a quality check still erroring · a build/deploy failing after a config change. **Does NOT reset the counter:** unrelated tasks; the user providing new information (course correction).
69
46
 
70
47
  **Failure identity — same error vs new error.** Failure signature = **same target + same error class** (same failing test + same assertion/exception, same lint rule id, same build error).
71
48
 
72
49
  - **Same failure signature twice → stop and pivot now.** Don't burn the third attempt on a near-identical retry of a fix that already failed the same way — a repeated identical signature means the hypothesis is wrong, not under-applied. Change strategy (re-read source, new hypothesis, ask).
73
50
  - **New error signature each attempt = progress.** Peeling one error to reveal a different one is forward motion; counter continues — learning, not looping.
74
51
 
75
- **Hard-blocker classes — skip retries, go straight to ask/surface.** On the **first** occurrence, do not count toward the 3 — stop and surface:
76
-
77
- - Missing credentials / unset required secret or token.
78
- - Permission denied (auth/authz, file mode, protected branch, scope).
79
- - Spend / quota / rate limit reached (billing cap, API quota, 429 that won't self-clear).
80
- - External-service `5xx` / outage / DNS-unreachable — a dependency is down, not your code.
81
-
82
- Retrying a hard-blocker is the canonical wasted-attempt; the fix is a decision or external change only the user/environment can make.
52
+ **Hard-blocker classes — skip retries, go straight to ask/surface.** On the **first** occurrence, do not count toward the 3 — stop and surface: missing credentials / unset secret · permission denied · spend / quota / rate limit reached · external-service 5xx / outage. Retrying a hard-blocker is the canonical wasted attempt; the fix is a decision or external change only the user/environment can make.
83
53
 
84
54
  ## Tool Loop Detection
85
55
 
86
56
  Calling the **same tool** more than **2 times in a row** with similar parameters = loop.
87
-
88
- **Immediate action:**
89
- 1. **STOP** all tool calls.
90
- 2. **Do the task directly** — write the code, run the command, answer the question.
91
- 3. If you can't proceed — ask the user for help.
92
-
93
- `sequentialthinking` is especially prone to loops. Use at most **once** per task,
94
- NEVER for simple file operations, command execution, or straightforward edits.
57
+ **Immediate action:** 1. STOP all tool calls. 2. Do the task directly. 3. Can't proceed → ask the user.
58
+ `sequentialthinking` is especially prone to loops: at most **once** per task, NEVER for simple file operations, command execution, or straightforward edits.
95
59
 
96
60
  ## Read-Loop Detection — the 15 / 25 rule
97
61
 
@@ -101,74 +65,16 @@ EVERY TURN MUST EDIT, RUN, OR ASK.
101
65
  ```
102
66
 
103
67
  **Read-only turn:** only `view` / `codebase-retrieval` / `grep` /
104
- `git log` / `git show`. No `str-replace-editor`, `save-file`, no
105
- test/build/quality run, no `git commit`.
106
-
107
- **15-min warning (3 read-only turns in a row) — change approach.**
108
- Next turn MUST contain at least one of: an edit, a test/build/quality
109
- command, or an explicit user question. Self-check:
110
-
111
- 1. Source expectation known? If no → read **once**, then act.
112
- 2. Can a single failing test name the error? If yes → run it now.
113
- 3. Regression in working code? → `git log` + `git show <sha> -- <file>`.
114
- 4. Guessing at mock / payload shape? → read the producer **once**.
115
-
116
- **25-min abort (5 read-only turns) — STOP and ask:**
68
+ `git log` / `git show`. No edit/save, no test/build/quality run, no `git commit`.
117
69
 
118
- ```
119
- > ⛔ Loop: N read-only turns, ~M min. Read: <files>. Hypothesis: <X>.
120
- > 1. Different approach (suggestion: <Y>)
121
- > 2. Point me at the right spot
122
- > 3. Fresh chat with state dump
123
- ```
124
-
125
- Non-bypassable. Autonomous mandate (`/work`, `/roadmap:process-*`,
126
- "entscheide selbst") does **not** lift the abort — it is the safety
127
- net that protects autonomy from becoming a token sink.
128
-
129
- Debug procedure for "I'm in a read loop fixing tests" →
130
- [`systematic-debugging § Debug micro-loop`](../skills/systematic-debugging/SKILL.md#debug-micro-loop--one-test-one-fix-one-re-run).
131
-
132
- ## State dump format
133
-
134
- ```
135
- ## State Dump: [Task]
136
- ### Tried: 1. [Approach] → [Why failed] 2. ... 3. ...
137
- ### Known: [Key facts]
138
- ### Hypothesis: [Best guess for root cause]
139
- ### Recommendation: [Next approach for fresh session]
140
- ```
70
+ **15-min warning (3 read-only turns in a row) — change approach.** The next turn MUST contain at least one of: an edit, a test/build/quality command, or an explicit user question (self-check in the mechanics guideline).
141
71
 
142
- Use `/agent-handoff` to generate a context summary for a fresh conversation.
72
+ **25-min abort (5 read-only turns) — STOP and ask** with the abort block (template in the mechanics guideline). Non-bypassable: an autonomous mandate does **not** lift the abort — it is the safety net that protects autonomy from becoming a token sink.
143
73
 
144
- ## Augment-specific: Ignored Skills Recovery
74
+ Body migrated to [`guideline:agent-infra/context-hygiene-mechanics`](../docs/guidelines/agent-infra/context-hygiene-mechanics.md) (per P4 of `road-to-kernel-and-router.md`) — the freshness-suggestion template, the read-loop self-check + abort block, the state-dump format + `/agent-handoff` pointer, the Augment ignored-skills recovery flow, and the Copilot no-hook fallback (manual `context_hygiene_hook` refresh).
75
+ Trigger-set above activates this routing on demand, independent of the discipline profile (ADR-110).
145
76
 
146
- Skills excluded via `.augmentignore` don't appear in `<available_skills>`.
147
- If you need an ignored skill: read its SKILL.md directly, apply guidance, then ask:
148
-
149
- ```
150
- > 💡 I loaded `{name}` manually — currently ignored in `.augmentignore`.
151
- > 1. Remove from ignore — relevant for this project
152
- > 2. Keep ignored — one-off
153
- ```
154
-
155
- ## Copilot fallback
156
-
157
- GitHub Copilot has no `PostToolUse` hook surface, so
158
- `scripts/context_hygiene_hook.ts` cannot run structurally and
159
- `agents/runtime/state/context-hygiene.json` is not maintained automatically
160
- (turn count, loop signal, freshness milestones at 20/40/60).
161
-
162
- The cooperative path: track turns and tool-loop signals from memory
163
- during the conversation and apply the suggest-a-new-chat / 3-failure
164
- stop / loop-detection rules above. To refresh the state file
165
- manually so the dashboard or another tool can read the latest
166
- counters, run:
167
-
168
- ```bash
169
- ./scripts-run src/scripts/context_hygiene_hook < /dev/null
170
- ```
77
+ ## See also
171
78
 
172
- The script reads from stdin if a JSON envelope is provided and
173
- otherwise writes a no-op snapshot under the shared dispatcher lock.
174
- Exit code is always 0 — hooks must never block the agent loop.
79
+ - [`guideline:agent-infra/context-hygiene-mechanics`](../docs/guidelines/agent-infra/context-hygiene-mechanics.md) — templates + per-host procedures.
80
+ - [`systematic-debugging § Debug micro-loop`](../skills/systematic-debugging/SKILL.md) — the read-loop debug procedure.