@event4u/agent-config 8.11.0 → 8.12.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 (67) hide show
  1. package/.claude-plugin/marketplace.json +1 -1
  2. package/AGENTS.md +1 -0
  3. package/CHANGELOG.md +49 -279
  4. package/README.md +2 -2
  5. package/dist/agent-src/contexts/execution/roadmap-ci-steps-mechanics.md +117 -0
  6. package/dist/agent-src/contexts/execution/roadmap-process-loop.md +106 -94
  7. package/dist/agent-src/rules/architecture.md +6 -51
  8. package/dist/agent-src/rules/code-comment-discipline.md +10 -94
  9. package/dist/agent-src/rules/decision-revisit-gate.md +9 -77
  10. package/dist/agent-src/rules/improve-before-implement.md +7 -66
  11. package/dist/agent-src/rules/no-roadmap-references.md +13 -77
  12. package/dist/agent-src/rules/persona-governance.md +5 -47
  13. package/dist/agent-src/rules/provider-lifecycle-discipline.md +6 -32
  14. package/dist/agent-src/rules/roadmap-ci-steps-policy.md +21 -104
  15. package/dist/agent-src/rules/untrusted-input-defense.md +3 -75
  16. package/dist/agent-src/skills/agent-docs-writing/SKILL.md +83 -0
  17. package/dist/agent-src/skills/decision-review/SKILL.md +86 -0
  18. package/dist/agent-src/skills/module-detect-on-the-fly/SKILL.md +58 -1
  19. package/dist/agent-src/templates/agents/agent-project-settings.example.yml +1 -1
  20. package/dist/agent-src/templates/contexts/knowledge-card.md +12 -0
  21. package/dist/discovery/deprecation-report.md +1 -1
  22. package/dist/discovery/discovery-manifest.json +14 -14
  23. package/dist/discovery/discovery-manifest.json.sha256 +1 -1
  24. package/dist/discovery/discovery-manifest.summary.md +1 -1
  25. package/dist/discovery/orphan-report.md +1 -1
  26. package/dist/discovery/packs.json +2 -2
  27. package/dist/discovery/trust-report.md +1 -1
  28. package/dist/discovery/workspaces.json +2 -2
  29. package/dist/mcp/registry-manifest.json +1 -1
  30. package/dist/router.json +1 -1
  31. package/docs/CLAIMS.md +30 -2
  32. package/docs/architecture.md +1 -1
  33. package/docs/archive/CHANGELOG-pre-8.12.0.md +304 -0
  34. package/docs/benchmark.md +39 -0
  35. package/docs/contracts/ai-council-config.md +9 -4
  36. package/docs/contracts/persona-schema.md +49 -0
  37. package/docs/contracts/provider-lifecycle.md +29 -4
  38. package/docs/decisions/ADR-120-council-chairman-mode.md +70 -0
  39. package/docs/decisions/ADR-121-knowledge-sensitivity-classes.md +90 -0
  40. package/docs/decisions/INDEX.md +2 -0
  41. package/docs/design/council-vs-solo-baseline.md +92 -0
  42. package/docs/design/utilization-window-criteria.md +51 -0
  43. package/docs/guidelines/agent-infra/agent-interaction-and-decision-quality.md +68 -0
  44. package/docs/guidelines/agent-infra/rule-body-migration-inventory.md +241 -0
  45. package/docs/guidelines/agent-infra/untrusted-input-spotlighting.md +80 -3
  46. package/docs/guidelines/code-clarity.md +86 -1
  47. package/docs/maintainers/branch-protection.md +87 -0
  48. package/docs/maintainers/system-map.md +85 -0
  49. package/docs/proof.md +14 -3
  50. package/package.json +1 -1
  51. package/src/config/agent-settings.template.yml +9 -0
  52. package/src/scripts/_cli/cmd_doctor.ts +95 -0
  53. package/src/scripts/_lib/knowledge_global.ts +44 -0
  54. package/src/scripts/_lib/knowledge_global_promote.ts +150 -0
  55. package/src/scripts/ai_council/orchestrator.ts +188 -1
  56. package/src/scripts/bench_persona_placebo.ts +308 -0
  57. package/src/scripts/bench_quality_rerun.ts +357 -0
  58. package/src/scripts/build_proof.ts +9 -0
  59. package/src/scripts/check_artefact_count_messaging.ts +56 -0
  60. package/src/scripts/check_knowledge_cards.ts +33 -4
  61. package/src/scripts/check_portability.ts +1 -0
  62. package/src/scripts/complexity_report.ts +776 -0
  63. package/src/scripts/consumer_matrix.ts +251 -12
  64. package/src/scripts/council_cli.ts +56 -1
  65. package/src/scripts/explain_run.ts +593 -0
  66. package/src/scripts/knowledge_global_cli.ts +234 -45
  67. package/src/scripts/rule_backlinks.ts +0 -0
@@ -30,22 +30,23 @@ roadmaps with open work that is blocked-for-later — parked, not active).
30
30
 
31
31
  ### Live merge-state before any "in-flight / merged / handled" claim
32
32
 
33
- Selection reasoning that **excludes** a roadmap — or a pre-run summary,
34
- decision, or user-facing message that **describes** one — as *in-flight*,
35
- *handled by an open PR*, *already merged*, or *not yet merged* → verify **live
36
- at claim time** (`gh pr view <n> --json state,mergedAt` / `gh pr list --search
37
- "<slug>"`). Never infer merge state from:
38
-
39
- - **dashboard open-count** — lags: a completed roadmap archives in the
40
- **merging** PR, so it can read "open" on `main` while its PR is already
41
- merged, or read "open" seconds before a merge you never re-checked;
42
- - **session memory** ("opened a PR for this earlier") or an **earlier fetch** —
43
- a merge can land between fetch and message.
44
-
45
- Stale merge-state claim ships an unnecessary message about work already done —
46
- the failure this prevents. The [`direct-answers`](../../rules/direct-answers.md)
47
- Iron-Law-2 live-state rule (git/PR state never from memory), applied to
48
- roadmap selection.
33
+ When selection reasoning would **exclude** a roadmap — or a pre-run summary,
34
+ decision, or any user-facing message would **describe** one — as *in-flight*,
35
+ *handled by an open PR*, *already merged*, or *not yet merged*, verify that
36
+ claim **live at the moment of the claim** (`gh pr view <n> --json state,mergedAt`
37
+ or `gh pr list --search "<slug>"`). Never infer merge state from:
38
+
39
+ - the **dashboard's open-count** — it lags: a completed roadmap is archived in
40
+ the **merging** PR, so a roadmap can still read "open" on `main` while its PR
41
+ is already merged (archive not yet on your checkout), or read "open" seconds
42
+ before a merge you never re-checked;
43
+ - **session memory** ("I opened a PR for this earlier") or an **earlier fetch** —
44
+ a merge can land between your fetch and your message.
45
+
46
+ A stale merge-state claim ships an unnecessary user-facing message about work
47
+ that is already done — the exact failure this clause prevents. This is the
48
+ [`direct-answers`](../../rules/direct-answers.md) Iron-Law-2 live-state rule
49
+ (git/PR state never from memory), applied to roadmap selection.
49
50
 
50
51
  ## 2. Pre-run summary — gate or inline note
51
52
 
@@ -90,7 +91,7 @@ does not fire.
90
91
 
91
92
  ## 3. Pre-scan — execution contract or commit-step ask
92
93
 
93
- Read `execution.mode` from roadmap's frontmatter
94
+ Read `execution.mode` from the roadmap's frontmatter
94
95
  (`autonomous` | `phase-checkpoints` | `interactive`; absent =
95
96
  `interactive`).
96
97
 
@@ -101,17 +102,17 @@ its four-class pre-scan over every open step:
101
102
  1. commit-shaped steps (patterns below),
102
103
  2. git-shape needs (branch / push / PR / delivery),
103
104
  3. artifact-authoring steps (new or materially rewritten skill / rule /
104
- command / guideline — feeds batched drafting-protocol research
105
+ command / guideline — feeds the batched drafting-protocol research
105
106
  pass, run at contract time against current artifact state),
106
107
  4. open questions / ambiguity markers (incl. `ask-when-uncertain`
107
108
  vague-trigger patterns).
108
109
 
109
- Surface contract summary; user's single **Accept** activates all run
110
- grants (branch, chunked commits, push to run's own feature branch
111
- only, PR-open, batched artifact drafting, council auto-enable) —
112
- cached for run, never re-asked. Contract never lifts a Hard Floor or
113
- any safety floor; boundaries + per-mode gate table live in contract
114
- context.
110
+ Surface the contract summary; the user's single **Accept** activates
111
+ all run grants (branch, chunked commits, push to the run's own feature
112
+ branch only, PR-open, batched artifact drafting, council auto-enable) —
113
+ cached for the run, never re-asked. The contract never lifts a Hard
114
+ Floor or any safety floor; boundaries + per-mode gate table live in the
115
+ contract context.
115
116
 
116
117
  **`mode: interactive` (or field absent)** → legacy commit-step scan
117
118
  only: lines matching `commit:` / `git commit` / `Commit phase`.
@@ -135,11 +136,11 @@ Read both keys from `.agent-settings.yml` once and cache for the whole
135
136
  run. Do **not** re-read inside the step loop.
136
137
 
137
138
  **`roadmap.quality_cadence`** — when to run the quality pipeline.
138
- Only relevant when `quality.local_auto_run` is `true`; `false` or
139
- missing (default) → local pipeline runs suppressed at EVERY cadence —
140
- remote CI is the gate, run-end report states *"quality gates delegated
141
- to remote CI"* instead of a pass claim (new-gate carve-out steps still
142
- run once).
139
+ Only relevant when `quality.local_auto_run` is `true`; when it is
140
+ `false` or missing (the default), local pipeline runs are suppressed at
141
+ EVERY cadence — remote CI is the gate, and the run-end report states
142
+ *"quality gates delegated to remote CI"* instead of a pass claim
143
+ (new-gate carve-out steps still run once).
143
144
 
144
145
  | Value | Pipeline runs (`local_auto_run: true` only) |
145
146
  |---|---|
@@ -183,7 +184,8 @@ For each open step in the working set (scope-bound — see wrapper):
183
184
  on the same line, regenerate the dashboard, continue to the next
184
185
  step. Never run the gate. Carve-out marker present → run normally
185
186
  (new gate must be verified once locally). Setting `true` → run
186
- normally.
187
+ normally. Full pattern table, carve-outs, linter contract, failure
188
+ modes: [`roadmap-ci-steps-mechanics`](roadmap-ci-steps-mechanics.md).
187
189
  1. **Bundled read — one parallel tool-call block.** The step
188
190
  description, the immediately-relevant code files, and any
189
191
  guideline/context the step cites are **independent** reads and
@@ -201,17 +203,18 @@ For each open step in the working set (scope-bound — see wrapper):
201
203
  2. Analyze the codebase for what the step requires.
202
204
  3. Decide and act — implement. **No "should I implement this?" prompt.**
203
205
  4. **Open question handling:**
204
- - **Council on** (toggled manually, or auto-enabled for run by
205
- accepted execution contract — § 3) → invoke per
206
+ - **Council on** (toggled manually, or auto-enabled for the run by
207
+ an accepted execution contract — § 3) → invoke per
206
208
  [`ai-council`](../../skills/ai-council/SKILL.md), integrate
207
- convergence, proceed. Token spend was opted in (contract summary
208
- named members). `high_impact` / `user_required` classifications
209
- still escalate to user per
209
+ convergence, proceed. Token spend was opted in (the contract
210
+ summary named the members). `high_impact` / `user_required`
211
+ classifications still escalate to the user per
210
212
  [`ask-when-uncertain`](../../rules/ask-when-uncertain.md).
211
213
  - **Council off / not configured** → halt, surface once, wait.
212
- Resume on next turn. Execution contract cannot enable a council
213
- with no configured members — contract summary says so upfront,
214
- and in-run ambiguity halts (never silent guessing).
214
+ Resume on next turn. An execution contract cannot enable a
215
+ council that has no configured members — the contract summary
216
+ says so upfront, and in-run ambiguity halts (never silent
217
+ guessing).
215
218
  5. **Atomic flip — same reply, every step.**
216
219
  Flip the checkbox in `agents/roadmaps/<file>.md`: `[x]` done ·
217
220
  `[~]` partial · `[-]` skipped. **Non-skippable, non-batchable**
@@ -228,32 +231,35 @@ For each open step in the working set (scope-bound — see wrapper):
228
231
  git status --porcelain -- agents/roadmaps/<file>.md
229
232
  ```
230
233
 
231
- (`git status --porcelain`, not `git diff` — roadmap file still
232
- **untracked** (e.g. fresh worktree) is invisible to `git diff`,
233
- would false-halt; `--porcelain` reports both `M` and `??`.)
234
+ (`git status --porcelain`, not `git diff` — a roadmap file that is
235
+ still **untracked**, e.g. in a fresh worktree, is invisible to
236
+ `git diff` and would false-halt; `--porcelain` reports both `M`
237
+ and `??`.)
234
238
 
235
239
  Empty output → Iron Law 2 was violated this iteration: the step
236
240
  landed work but no checkbox flipped. **Halt loudly**, surface
237
241
  "step <N> landed without checkbox flip — flip then resume", and
238
242
  stop the run. Do not auto-fix; the user resumes on the next turn.
239
243
 
240
- Deterministic counterpart to the rule's pre-send self-check —
241
- catches a forgotten flip per step, not only at run end. Runs in
242
- every scope (`process-step`, `process-phase`, `process-full`);
243
- cost is one `git diff` per step.
244
+ This guard is the deterministic counterpart to the rule's
245
+ pre-send self-check — it catches a forgotten flip per step, not
246
+ only at run end. It runs in every scope (`process-step`,
247
+ `process-phase`, `process-full`); the cost is one `git diff` per
248
+ step.
244
249
 
245
250
  **`verify:` gate (when a step carries one).** If the step declares a
246
- named `verify:` command (step-field convention, see
251
+ named `verify:` command (roadmap step-field convention, see
247
252
  [`templates/roadmaps.md`](../../templates/roadmaps.md)), a `[x]` flip
248
253
  additionally requires a **fresh green run of that exact command this
249
- iteration** — its passing output in this reply or an earlier one this
250
- run. Flipping a `verify:`-bearing step without that run is the same
251
- class of violation as a forgotten flip: **halt loudly** ("step \<N\>
252
- flipped without its `verify:` run — \`<cmd>\`"), do not auto-fix. A
253
- check on existing output, not a new loop or script — the agent runs
254
- the step's own command, as `think-before-action`'s `step → verify:`
255
- planning already asks. Steps with no `verify:` field stay governed by
256
- the flip-guard above unchanged (agent-decidable criteria remain the
254
+ iteration** — its passing output present in this reply or an earlier
255
+ one this run. Flipping a `verify:`-bearing step to `[x]` without that
256
+ fresh green run is the same class of violation as a forgotten flip:
257
+ **halt loudly** ("step \<N\> flipped without its `verify:` run —
258
+ \`<cmd>\`"), do not auto-fix. This is a check on existing output, not a
259
+ new loop or a new script — the agent runs the step's own command, the
260
+ same way `think-before-action`'s `step → verify:` planning already
261
+ asks. Steps with no `verify:` field are governed by the flip-guard
262
+ above unchanged (agent-decidable exit/acceptance criteria remain the
257
263
  default; `verify:` is the opt-in machine-checkable tightening).
258
264
 
259
265
  6. **Dashboard regen — cadence-gated.** Run
@@ -279,36 +285,38 @@ For each open step in the working set (scope-bound — see wrapper):
279
285
  - Test failure or quality red on `per_step`
280
286
  - Council off + true ambiguity — under an **accepted execution
281
287
  contract** ([§ 3](#3-pre-scan--execution-contract-or-commit-step-ask))
282
- this halt exists only when no council is configured: contract
283
- auto-enables council for run, so in-run open questions resolve
288
+ this halt exists only when no council is configured: the contract
289
+ auto-enables council for the run, so in-run open questions resolve
284
290
  silently (`high_impact` / `user_required` classifications still
285
291
  escalate per [`ask-when-uncertain`](../../rules/ask-when-uncertain.md));
286
292
  with no council configured, true ambiguity halts — never silent
287
293
  guessing.
288
294
 
289
- An accepted execution contract **never lifts a Hard Floor** or any
290
- other halt above — it removes redundant *asks* (git shape, artifact
291
- drafting, council enablement), not safety.
295
+ An accepted execution contract **never lifts a Hard Floor** or any of
296
+ the other halts above — it removes redundant *asks* (git shape,
297
+ artifact drafting, council enablement), not safety.
292
298
 
293
299
  On halt: stop, surface state, do **not** auto-fix outside the failing step.
294
300
 
295
301
  ### Forbidden non-halt reasons — agent-invented cautions
296
302
 
297
- Halt list above is exhaustive. Never stop a `process-full` (or any wrapper) run
298
- for an invented reason not on it. NOT halt conditions — stopping for them
299
- violates the command + user's will:
303
+ The halt list above is **exhaustive**. An agent running `process-full` (or any
304
+ wrapper) must **never** stop the run for a reason it invented that is not on
305
+ that list. In particular these are NOT halt conditions and stopping for them is
306
+ a violation of the command and the user's will:
300
307
 
301
- - "low context / token budget" — keep landing complete steps until context
302
- actually runs out; never announce a boundary-stop by choice.
303
- - "quality would degrade / deserves a fresh focused run later"
304
- - "avoid a PR pile-up" / "let open PRs merge first"
305
- - "this phase is large / deep subsystem"
306
- - "phase-checkpoints, so I'll checkpoint and wait" — under `process-full` a
307
- phase boundary emits a non-blocking status line and the run continues; the
308
- stop-and-wait reading applies only to `process-phase`.
308
+ - "running low on context / token budget" — keep landing complete steps until
309
+ context actually runs out; never announce a boundary-stop by choice.
310
+ - "quality would degrade / this deserves a fresh focused run later"
311
+ - "avoid a PR pile-up" / "let the open PRs merge first"
312
+ - "this phase is large / touches a deep subsystem"
313
+ - "phase-checkpoints mode, so I'll checkpoint and wait" — under `process-full`
314
+ a phase boundary emits a non-blocking status line and the run **continues**;
315
+ the stop-and-wait reading of `phase-checkpoints` applies only to
316
+ `process-phase`.
309
317
 
310
- Genuine inability to continue = one of the five real halt conditions fired —
311
- surface THAT, not a manufactured caution.
318
+ If the work genuinely cannot continue, it will be because one of the five real
319
+ halt conditions fired — surface THAT, not a manufactured caution.
312
320
 
313
321
  ### Non-halt — gating notes, "optional" tags
314
322
 
@@ -338,47 +346,51 @@ execution either way.
338
346
  - **End state under an accepted execution contract** (per-mode table:
339
347
  [`roadmap-execution-contract § 4`](roadmap-execution-contract.md)):
340
348
  all steps `[x]` · quality green per cadence · work committed in
341
- chunks on run's feature branch · pushed to that branch · ONE PR
342
- open (description-only flow) · archival sweep run. **Merge is out
343
- of scope in every mode — always conversational.** Without a
344
- contract (interactive mode), the run ends after the archival check
345
- with no git delivery beyond explicitly authorized commit steps.
349
+ chunks on the run's feature branch · pushed to that branch · ONE PR
350
+ open (description-only flow) · archival sweep run. **Merge is out of
351
+ scope in every mode — always conversational.** Without a contract
352
+ (interactive mode), the run ends after the archival check with no
353
+ git delivery beyond explicitly authorized commit steps.
346
354
  - **If the entire roadmap reached `count_open == 0`** → run the full
347
355
  project quality pipeline. On red → stop, surface failures, do **not**
348
- archive. On green → run **deferred-resolution gate** below before
356
+ archive. On green → run the **deferred-resolution gate** below before
349
357
  archival.
350
358
 
351
359
  ### 6a. Deferred-resolution gate — Iron Law 3
352
360
 
353
- Before any `git mv` to `archive/`, count `[~]` items in closing
354
- roadmap. If `count_deferred > 0`, archival **blocked** per
361
+ Before any `git mv` to `archive/`, count `[~]` items in the closing
362
+ roadmap. If `count_deferred > 0`, archival is **blocked** per
355
363
  [`roadmap-progress-sync § Iron Law 3`](../../rules/roadmap-progress-sync.md).
356
- Loop MUST:
364
+ The loop MUST:
357
365
 
358
366
  1. Enumerate every `[~]` step (phase + text + optional
359
367
  `<!-- deferred: ... -->` annotation).
360
- 2. Surface numbered-options block from
368
+ 2. Surface the numbered-options block from
361
369
  [`roadmap-management § 4b`](../../skills/roadmap-management/SKILL.md) —
362
370
  five choices: follow-up (draft), follow-up (ready + blocked),
363
371
  keep-in-archive (intentional drop), restore to `[ ]`, convert
364
372
  to `[-]` cancelled.
365
- 3. Wait for user. Autonomous mandate (`/work`,
373
+ 3. Wait for the user. The autonomous mandate (`/work`,
366
374
  `/roadmap:process-full`, "decide for me") does **not** lift this
367
375
  gate — Iron Law 3 calls it "the canonical lost-information failure
368
376
  mode this rule exists to prevent."
369
- 4. On picks 1 / 2 → run "Spawn follow-up from deferred items"
377
+ 4. On picks 1 / 2 → run the "Spawn follow-up from deferred items"
370
378
  procedure in [`roadmap-management`](../../skills/roadmap-management/SKILL.md).
371
- On picks 3 / 4 / 5 → apply change, re-evaluate decision table,
372
- archive when gate clears.
373
-
374
- `count_deferred == 0` → archive. **Primary:** `archive_completed_roadmaps --all`
375
- — untracked-safe (`git mv`, or plain `mv` in a pre-first-commit / untracked
376
- consumer), rewrites inbound refs (index when tracked, filesystem when not),
377
- regens dashboard; PR-independent (gap B). **Fallback (script not vendored):**
378
- emit a one-line vendor instruction (`agents:init`), then the manual procedure in
379
+ On picks 3 / 4 / 5 → apply the change, re-evaluate the decision
380
+ table, archive when the gate clears.
381
+
382
+ `count_deferred == 0` → archive. **Primary path:** run the
383
+ `archive_completed_roadmaps --all` sweep — it is untracked-safe (`git mv`,
384
+ or a plain `mv` in a pre-first-commit / untracked consumer), rewrites inbound
385
+ refs (on the index when tracked, on the filesystem when not), and regenerates
386
+ the dashboard. This entry point is **PR-independent** (gap B): it does not need
387
+ `/create-pr` to have run. **Fallback only when that script is not vendored** in
388
+ the consumer: emit a one-line instruction to vendor it (run `agents:init`),
389
+ then apply the manual procedure in
379
390
  [`roadmap-management`](../../skills/roadmap-management/SKILL.md) (mkdir
380
- `archive/`, `mv`, ref-rewrite, regen). NEVER silently `git mv` (fails on
381
- untracked, leaves a completed roadmap rotting).
391
+ `archive/`, `mv`, inbound-ref rewrite, dashboard regen). NEVER silently
392
+ delegate to a bare `git mv` that fails on untracked files and leaves a
393
+ completed roadmap rotting in the active tree.
382
394
 
383
395
  ## Scope deltas — what each wrapper binds
384
396
 
@@ -8,6 +8,8 @@ triggers:
8
8
  - keyword: "service"
9
9
  - keyword: "module"
10
10
  - intent: "structural decision"
11
+ routes_to:
12
+ - "skill:module-detect-on-the-fly"
11
13
  workspaces: [agent-config-maintainer, engineering]
12
14
  packs: [meta]
13
15
  ---
@@ -20,6 +22,8 @@ ALWAYS VALIDATE AT THE REQUEST BOUNDARY. NEVER INLINE-VALIDATE INSIDE THE HANDLE
20
22
  ALWAYS READ AGENTS.MD AND PROJECT-LOCAL DOCS BEFORE STRUCTURAL DECISIONS.
21
23
  ```
22
24
 
25
+ Fires on new files, classes, controllers, modules, or any structural decision about project organization.
26
+
23
27
  ## General Principles
24
28
 
25
29
  - **HTTP handlers stay thin** — no business logic; delegate to a service / use-case / domain layer.
@@ -34,27 +38,6 @@ ALWAYS READ AGENTS.MD AND PROJECT-LOCAL DOCS BEFORE STRUCTURAL DECISIONS.
34
38
  → Symfony: see [`symfony-workflow`](../skills/symfony-workflow/SKILL.md).
35
39
  → Next.js / TypeScript backends: see [`nextjs-patterns`](../skills/nextjs-patterns/SKILL.md).
36
40
 
37
- ## Project Detection
38
-
39
- Detect the current project type from the **Git remote URL**, **directory name**, or **project files**:
40
-
41
- - **PHP** — `composer.json` (framework slot: Laravel via `artisan`, Symfony via `bin/console`, standalone otherwise).
42
- - **JS / TS** — `package.json` (framework slot: Next.js via `next` dep, Nuxt via `nuxt`, Express / Fastify / NestJS via deps; plain Node otherwise).
43
- - **Python** — `pyproject.toml` / `requirements.txt` (framework slot: Django via `django`, FastAPI via `fastapi`, Flask via `flask`).
44
- - **Go** — `go.mod` (framework slot: `gin`, `echo`, `fiber`, stdlib `net/http`).
45
- - **Ruby** — `Gemfile` (framework slot: Rails via `rails` gem, Sinatra otherwise).
46
- - **Rust** — `Cargo.toml` (framework slot: `axum`, `actix-web`, `rocket`).
47
- - Check `AGENTS.md` or `agents/` for project-specific documentation.
48
-
49
- Tooling lives in a runner file at the project root — detect once and reuse the result:
50
- `Taskfile.yml` → `task`, `Makefile` → `make`, `package.json` `scripts:` → `npm` / `pnpm` / `yarn`, `pyproject.toml` `[tool.poetry.scripts]` or `[project.scripts]` → `poetry` / `uv`, framework CLIs (`artisan`, `bin/console`, `manage.py`, `bin/rails`) when the matching manifest is present.
51
-
52
- ## Project-Specific Architecture
53
-
54
- Each project documents its own architecture in `./agents/` and/or `AGENTS.md`.
55
- **Always read those files** before making structural decisions. Do not rely on this rule file
56
- for project-specific directory layouts, database conventions, or module systems.
57
-
58
41
  ## Architectural Decision Records (ADRs)
59
42
 
60
43
  When a structural decision is non-trivial (kernel membership, contract change, library swap,
@@ -64,33 +47,5 @@ skill — it numbers the file (`ADR-NNN-<slug>.md`), writes the standard templat
64
47
  index via `scripts/adr/regenerate_index.ts`. ADRs land in `docs/adr/` by default; legacy
65
48
  projects use `docs/decisions/`. Reversible refactors and minor cleanups do **not** need ADRs.
66
49
 
67
- ## Module-Level Documentation
68
-
69
- Some projects use a module system (e.g. `app/Modules/` in Laravel, `apps/`/`packages/` in a Turborepo, `src/modules/` in NestJS, `internal/` in Go).
70
- Module roots and the per-module agent-docs folder are configured via
71
- `modules.root_paths` and `modules.agent_folder` in `.agent-settings.yml`
72
- (resolve at runtime via `scripts/_lib/agent_settings.ts::enumerate_modules()`).
73
- Modules may have their own agent docs under
74
- `{module_root}/*/{agent_folder}/` (Laravel shape: `app/Modules/*/agents/`) with:
75
-
76
- - Module descriptions and feature docs
77
- - Module-specific roadmaps (`agents/roadmaps/`)
78
- - Module-specific documentation (`Docs/`)
79
-
80
- When working on a module, **always check for module-level agent docs** first.
81
-
82
- ## Packages
83
-
84
- Packages (Composer, npm, etc.) may also use `./agents/` in their root
85
- for package-specific docs and roadmaps. Treat them the same way as projects.
86
-
87
- ## Build / Task Runner Detection
88
-
89
- Projects use either `Makefile` or `Taskfile.yml` (or both) for common commands.
90
- **Always check which one exists** and read it to discover available targets for
91
- testing, quality checks, container access, migrations, etc.
92
-
93
- - `Makefile` → use `make <target>`
94
- - `Taskfile.yml` → use `task <target>`
95
-
96
- Prefer these targets over raw `docker compose exec` commands when available.
50
+ Body migrated to [`skill:module-detect-on-the-fly`](../skills/module-detect-on-the-fly/SKILL.md) (per P4 of `road-to-kernel-and-router.md`) — project-detection table, project-specific architecture docs, module-level documentation mechanics, packages, build/task-runner detection.
51
+ Trigger-set above activates this routing on demand, independent of the discipline profile (ADR-110).
@@ -22,7 +22,7 @@ packs: [engineering-base]
22
22
 
23
23
  # Code Comment Discipline
24
24
 
25
- AI-written code over-comments: docblocks mirroring the signature, comments narrating the next line, banner headers, change-log notes. Every redundant comment costs tokens on every future read, bloats the file, rots into misinformation when code changes. Default for any new comment: **no** — a comment must earn its place.
25
+ AI-written code over-comments: docblocks that mirror the signature, comments that narrate the next line, banner headers, change-log notes. Every redundant comment costs tokens on every future read, bloats the file, and rots into misinformation the moment the code changes. The default for any new comment is **no** — a comment must earn its place.
26
26
 
27
27
  ## The Iron Law
28
28
 
@@ -39,110 +39,26 @@ WHEN IN DOUBT: NO COMMENT. SHORTER IS BETTER. NONE IS OFTEN BEST.
39
39
 
40
40
  Exactly five legitimate jobs — everything else is noise:
41
41
 
42
- 1. **A why** — non-obvious reason this approach beat the obvious one.
43
- 2. **An invariant or constraint** code can't express — ordering, units, concurrency assumptions, "must run before X".
44
- 3. **A warning** — known trap, workaround for a specific upstream bug (name it), performance cliff.
45
- 4. **Machine-relevant type precision** the native type system can't carry — see carve-out below.
46
- 5. **A spec linkage** where an external contract defines behavior (RFC section, protocol field) — the contract, not ticket history.
42
+ 1. **A why** — the non-obvious reason this approach was chosen over the obvious one.
43
+ 2. **An invariant or constraint** the code cannot express — ordering requirements, units, concurrency assumptions, "must run before X".
44
+ 3. **A warning** — a known trap, a workaround for a specific upstream bug (name it), a performance cliff.
45
+ 4. **Machine-relevant type precision** the native type system cannot carry — carve-out in the guideline.
46
+ 5. **A spec linkage** where an external contract defines the behavior (RFC section, protocol field) — the contract, not the ticket history.
47
47
 
48
48
  Test before writing any comment: *would deleting it leave a future reader confused about a non-obvious constraint?* No → don't write it.
49
49
 
50
- ## Banned comment classes
51
-
52
- | Banned | Example | Instead |
53
- |---|---|---|
54
- | What-narration | `// increment the counter` above `counter++` | Nothing — code says it |
55
- | Signature-mirroring docblock | `@param string $name The name` on `string $name` | Nothing — typehint says it |
56
- | Redundant `@return` | `@return bool` on `): bool` | Nothing |
57
- | Banner / section divider | `// ---------- Helpers ----------` | Structure the file; extract a class |
58
- | Change-log comment | `// added for the export feature`, `// per ticket #123` | Commit message / PR description |
59
- | Reviewer-directed justification | `// this is safe because my change …` | PR description |
60
- | Redundant property docblock | `/** @var LoggerInterface */` on a typed property | Nothing — property type says it |
61
- | Type-restating JSDoc in typed TS | `/** @param {string} id */` on `id: string` | Nothing — TS carries the type |
62
- | Obvious docstring | `"""Return the user."""` on `get_user()` | Nothing, or a real contract note |
63
- | Commented-out code | dead code kept "for reference" | Delete — git history is the tombstone |
64
-
65
- ## Carve-out — machine-relevant precision docblocks STAY
66
-
67
- Docblock carrying type info the native type system can't express is **not** redundant — static analyzers + IDEs consume it. Keep (and write):
68
-
69
- - PHP generics / array shapes for PHPStan/Psalm: `@return Collection<int, Post>`, `@param array<string, User> $usersByEmail`, `@template T`, `@phpstan-type`.
70
- - Union/shape refinements the language can't express natively.
71
- - Tool-consumed markers: `@deprecated` (with successor), `@internal`, `@throws` for checked flows callers must handle.
72
- - Python typing only a docstring/stub can carry in the project's toolchain.
73
-
74
- The line: docblock must add information **beyond** the native signature. `@param array<int, Order> $orders` earns its place; `@param array $orders` does not.
75
-
76
- ## Public-API carve-out — `code_style.docblocks`
77
-
78
- Read `code_style.docblocks` from `.agent-settings.yml` (missing → `minimal`):
79
-
80
- - `minimal` (default) — full discipline above; exported/public symbols get no summary docblock unless one of the five legitimate jobs applies.
81
- - `full` — **exported public surface of a library package** (published API consumers see in their IDE) MAY carry one-line summary docblock per symbol. Redundancy ban holds in `full`: no `@param`/`@return` lines mirroring the signature, ever.
82
-
83
- ## Worked examples
84
-
85
- ```php
86
- // ❌ Redundant — every line restates the signature
87
- /**
88
- * Get the user by id.
89
- *
90
- * @param int $id The user id.
91
- * @return User|null The user or null.
92
- */
93
- public function getUserById(int $id): ?User
94
-
95
- // ✅ Nothing to add — the signature is the documentation
96
- public function getUserById(int $id): ?User
97
- ```
98
-
99
- ```php
100
- // ✅ Docblock KEPT — the generic is machine-relevant (PHPStan), the native type can't carry it
101
- /** @return Collection<int, Post> */
102
- public function publishedPosts(): Collection
103
- ```
104
-
105
- ```ts
106
- // ❌ Redundant — TS already knows all of this
107
- /**
108
- * Formats the price.
109
- * @param amount - the amount
110
- * @returns the formatted price
111
- */
112
- export function formatPrice(amount: number): string
113
-
114
- // ✅ A real constraint the signature can't show
115
- // Rounds half-up to match the invoice PDF renderer; Intl default is half-even.
116
- export function formatPrice(amount: number): string
117
- ```
118
-
119
- ```python
120
- # ❌ Narration
121
- # loop over the items and sum the totals
122
- total = sum(item.total for item in items)
123
-
124
- # ✅ A why that survives
125
- # Stripe amounts are integer cents; convert once at the boundary, never downstream.
126
- total_cents = sum(item.total_cents for item in items)
127
- ```
128
-
129
- ## Scope boundary
130
-
131
- Governs **new and edited code only**. Never a license to strip comments from untouched code — [`minimal-safe-diff`](minimal-safe-diff.md) wins on diff shape ("no docstrings/comments on untouched code" cuts both ways: don't add, don't remove). Sweeping a file's existing comments = separate, explicitly-requested cleanup task.
132
-
133
50
  ## When NOT to fire
134
51
 
135
52
  - Prose surfaces: docs, READMEs, roadmaps, config commentary — different register, not code comments.
136
- - User explicitly asks for documented code / teaching examples ("erkläre im Code", "annotate this for juniors") — that turn's ask wins.
53
+ - The user explicitly asks for documented code / teaching examples ("erkläre im Code", "annotate this for juniors") — that turn's ask wins.
137
54
  - License headers or file-level pragmas a toolchain requires.
138
55
 
139
- ## Fixtures
140
-
141
- Behavioral baseline: `tests/code-comments/eval-fixtures.md` (`ccd-php-class-generation`, `ccd-ts-module-generation`, `ccd-untouched-preservation`, `ccd-explicit-teaching-override`); decidable criteria proven by `tests/scripts/code_comment_fixtures.test.ts`.
56
+ Body migrated to [`guideline:code-clarity § Comment discipline`](../docs/guidelines/code-clarity.md#comment-discipline--state-a-constraint-not-a-narration) (per P4 of `road-to-kernel-and-router.md`) — banned-classes table, machine-relevant precision carve-out, `code_style.docblocks` public-API carve-out, per-language keep/drop tables, worked examples, scope boundary, fixtures pointer.
57
+ Trigger-set above activates this routing on demand, independent of the discipline profile (ADR-110).
142
58
 
143
59
  ## See also
144
60
 
145
- - [`code-clarity.md § Comment discipline`](../docs/guidelines/code-clarity.md#comment-discipline--state-a-constraint-not-a-narration) — canonical long-form with per-language keep/drop tables.
61
+ - [`code-clarity.md § Comment discipline`](../docs/guidelines/code-clarity.md#comment-discipline--state-a-constraint-not-a-narration) — canonical long-form with the migrated body.
146
62
  - [`minimal-safe-diff`](minimal-safe-diff.md) — diff-shape twin; no comment additions or removals on untouched code.
147
63
  - [`output-discipline`](output-discipline.md) — adjacent but distinct: bans placeholder prose (`// TODO: implement`); this rule bans redundant prose.
148
64
  - `docs/guidelines/php/php-coding-patterns.md` § PHPDoc — PHP-specific operationalization.
@@ -12,6 +12,8 @@ triggers:
12
12
  - keyword: "already decided"
13
13
  - keyword: "locked decision"
14
14
  - keyword: "budget blocks"
15
+ routes_to:
16
+ - "skill:decision-review"
15
17
  workspaces: [agent-config-maintainer, engineering]
16
18
  packs: [meta]
17
19
  ---
@@ -34,88 +36,18 @@ and offers the user a path to re-evaluate the lock. Progress means
34
36
  adaptation: locks encode what was true when they were written, not a
35
37
  ceiling on what the package may ever become.
36
38
 
37
- ## What counts as a "lock"
39
+ **Mechanism-match check comes FIRST**: a verdict settles the *mechanism it
40
+ tested*, not every future proposal that resembles it — if the blocked change
41
+ is a different mechanism, the lock does not apply; proceed, noting the
42
+ distinction.
38
43
 
39
- - An eval verdict recorded as an honest null (a mechanism was tested,
40
- showed no lift, and the disposition says "don't rebuild without new
41
- evidence").
42
- - A memory entry or `agents/settings/contexts/` note tagged "don't
43
- relitigate" / "settled" / a locked council convergence.
44
- - A budget or frugality-canon line (`token-budget-discipline`,
45
- `telegraph-speak`, thin-projector trimming) that rejects a change on
46
- cost grounds alone.
47
- - An ADR whose decision is being cited as a blocker for the current change.
48
- - A **hard structural cap** (kernel size, per-domain persona cap, rich-skill
49
- ratio). A change that genuinely *qualifies* to cross the cap — e.g. a new
50
- rule that truly meets the kernel-membership inclusion criteria — triggers a
51
- **cap-raise proposal + maintainer/council approval**, never a silent
52
- downgrade of the rule to fit the old number (e.g. demoting a must-always-fire
53
- rule to `auto` just because the kernel says 9). Fitting the cap is not a
54
- reason to weaken a qualifying rule; but a rule that does **not** meet the
55
- criteria stays out — the cap is not the reason, the criteria are.
56
-
57
- ## What to do when it fires
58
-
59
- 1. **Mechanism-match check — do this FIRST.** A verdict settles the
60
- *mechanism it tested*, not every future proposal that resembles it.
61
- Before applying the lock, verify the blocked change is actually the
62
- same mechanism — not merely a similar-sounding one. A null on
63
- hardened blocking enforcement does not automatically cover
64
- discretionary contextual nudges; a null on one architecture does not
65
- cover a materially different one. If the mechanism differs, the lock
66
- does not apply — proceed, noting the distinction.
67
- 2. **If the mechanism genuinely matches**, do not silently comply.
68
- Surface, in one short block:
69
- - What change is blocked.
70
- - Which lock blocks it (cite the memory/context/ADR).
71
- - Under what conditions the lock was recorded (date, evidence, or
72
- "maintainer decision" if settled-by-decision rather than
73
- settled-by-evidence).
74
- - What has changed since (new evidence, new model generation, new
75
- tooling, repeated encounters) that makes revisiting worth the cost.
76
- 3. **Offer numbered options** (per [`user-interaction`](user-interaction.md)),
77
- always including: re-evaluate the lock in the AI council. Other
78
- options: keep the lock as-is, or proceed without the blocked change.
79
- 4. **On re-evaluation:** route to [`decision-review`](../skills/decision-review/SKILL.md)
80
- for the backward-audit procedure and to [`ai-council`](../skills/ai-council/SKILL.md)
81
- for the debate mechanics. This rule owns the obligation to surface;
82
- those skills own the procedure.
83
- 5. **Record the outcome** with scope + `revisit-if` per
84
- [`ai-council`](../skills/ai-council/SKILL.md)'s convergence-summary
85
- contract — every re-evaluated lock gets a fresh, correctly-scoped
86
- disposition, not a re-statement of the old one.
87
-
88
- ## When NOT to fire
89
-
90
- - The blocked change has no real benefit — this rule is not a lever to
91
- reopen every settled question; [`no-cheap-questions`](no-cheap-questions.md)
92
- still governs whether the resulting numbered-options block is a real
93
- question or noise. A revisit-offer with a genuine trade-off is never
94
- a "cheap question" under that rule — but a revisit-offer with no
95
- actual case for change is.
96
- - The mechanism-match check (step 1) shows the lock is the same
97
- mechanism and no new evidence exists — apply the lock, no surfacing
98
- needed; this is the lock working as intended.
99
- - The user already declined a revisit on this exact lock this
100
- conversation — per [`scope-control § Decline = silence`](scope-control.md),
101
- do not re-ask.
102
-
103
- ## Failure modes
104
-
105
- - Treating a "don't relitigate" memory as permanently closed instead of
106
- as settled-under-conditions-X.
107
- - Applying a null verdict to a superficially similar but architecturally
108
- different mechanism without running the mechanism-match check.
109
- - Letting the token-frugality canon auto-reject a net-positive change
110
- without surfacing the trade-off — see [`token-budget-discipline`](token-budget-discipline.md)'s
111
- value-over-budget clause.
112
- - Silently dropping a good idea because "we already decided this" —
113
- the canonical failure this rule exists to stop.
44
+ Body migrated to [`skill:decision-review` § Decision-revisit gate — mechanics](../skills/decision-review/SKILL.md) (per P4 of `road-to-kernel-and-router.md`) — what-counts-as-a-lock catalog (honest nulls, don't-relitigate notes, budget-canon lines, ADRs, hard structural caps), the five fire steps, when-NOT-to-fire, failure modes.
45
+ Trigger-set above activates this routing on demand, independent of the discipline profile (ADR-110).
114
46
 
115
47
  ## See also
116
48
 
117
49
  - [`decision-review`](../skills/decision-review/SKILL.md) — the backward-audit
118
- procedure this rule routes to when a lock is genuinely re-evaluated.
50
+ procedure + the migrated gate mechanics.
119
51
  - [`ai-council`](../skills/ai-council/SKILL.md) — the re-evaluation mechanism;
120
52
  owns the convergence-summary scope + `revisit-if` contract.
121
53
  - [`decision-record`](../skills/decision-record/SKILL.md) — forward-flow decision