@event4u/agent-config 1.24.0 → 1.26.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 (75) hide show
  1. package/.agent-src/commands/review-routing.md +7 -10
  2. package/.agent-src/contexts/authority/kernel-rule-edits.md +48 -0
  3. package/.agent-src/contexts/authority/scope-mechanics.md +15 -0
  4. package/.agent-src/contexts/contracts/consumer-agents-md-guide.md +127 -0
  5. package/.agent-src/contexts/contracts/emergency-triage-block.md +53 -0
  6. package/.agent-src/rules/analysis-skill-routing.md +1 -1
  7. package/.agent-src/rules/artifact-drafting-protocol.md +1 -1
  8. package/.agent-src/rules/artifact-engagement-recording.md +1 -1
  9. package/.agent-src/rules/augment-source-of-truth.md +1 -1
  10. package/.agent-src/rules/autonomous-execution.md +1 -1
  11. package/.agent-src/rules/caveman-speak.md +1 -1
  12. package/.agent-src/rules/cli-output-handling.md +1 -1
  13. package/.agent-src/rules/command-suggestion-policy.md +1 -1
  14. package/.agent-src/rules/docs-sync.md +1 -1
  15. package/.agent-src/rules/guidelines.md +1 -1
  16. package/.agent-src/rules/improve-before-implement.md +1 -1
  17. package/.agent-src/rules/invite-challenge.md +1 -1
  18. package/.agent-src/rules/minimal-safe-diff.md +1 -1
  19. package/.agent-src/rules/model-recommendation.md +1 -1
  20. package/.agent-src/rules/no-attribution-footers.md +1 -1
  21. package/.agent-src/rules/no-roadmap-references.md +56 -20
  22. package/.agent-src/rules/onboarding-gate.md +1 -1
  23. package/.agent-src/rules/package-ci-checks.md +1 -1
  24. package/.agent-src/rules/reviewer-awareness.md +9 -2
  25. package/.agent-src/rules/roadmap-progress-sync.md +1 -1
  26. package/.agent-src/rules/scope-control.md +6 -0
  27. package/.agent-src/rules/security-sensitive-stop.md +1 -1
  28. package/.agent-src/rules/size-enforcement.md +1 -1
  29. package/.agent-src/rules/token-optimizer-maintenance.md +1 -1
  30. package/.agent-src/rules/ui-audit-gate.md +1 -1
  31. package/.agent-src/skills/adr-create/SKILL.md +2 -1
  32. package/.agent-src/skills/agents-md-thin-root/SKILL.md +125 -0
  33. package/.agent-src/skills/ai-council/SKILL.md +9 -7
  34. package/.agent-src/skills/review-routing/SKILL.md +3 -4
  35. package/.agent-src/templates/AGENTS.md +18 -148
  36. package/.agent-src/templates/copilot-instructions.md +41 -17
  37. package/.agent-src/templates/github-workflows/pr-risk-review.yml +1 -1
  38. package/.agent-src/templates/scripts/pr_review_routing.py +1 -1
  39. package/.claude-plugin/marketplace.json +2 -1
  40. package/AGENTS.md +18 -216
  41. package/CHANGELOG.md +58 -0
  42. package/README.md +2 -2
  43. package/docs/architecture.md +13 -7
  44. package/docs/catalog.md +26 -27
  45. package/docs/contracts/agents-md-tech-stack.md +74 -0
  46. package/docs/contracts/linear-ai-rules-inclusion.md +1 -1
  47. package/docs/contracts/linter-structural-model.md +180 -0
  48. package/docs/contracts/package-self-orientation.md +135 -0
  49. package/docs/contracts/rule-classification.md +4 -4
  50. package/docs/decisions/ADR-004-rule-governance-pruning.md +240 -0
  51. package/docs/getting-started.md +1 -1
  52. package/docs/guidelines/agent-infra/review-routing-data-format.md +1 -2
  53. package/docs/guidelines/agent-infra/size-and-scope.md +18 -12
  54. package/package.json +1 -1
  55. package/scripts/_p4_migrate.py +5 -5
  56. package/scripts/audit_auto_rules.py +159 -0
  57. package/scripts/audit_likelihood.py +148 -0
  58. package/scripts/audit_overlap.py +145 -0
  59. package/scripts/build_rule_trigger_matrix.py +3 -5
  60. package/scripts/check_augment_description_cap.py +79 -0
  61. package/scripts/check_council_references.py +3 -3
  62. package/scripts/check_kernel_rule_bundle.py +151 -0
  63. package/scripts/check_references.py +21 -1
  64. package/scripts/compile_router.py +3 -0
  65. package/scripts/install.sh +0 -1
  66. package/scripts/lint_agents_md.py +168 -0
  67. package/scripts/measure_augment_budget.py +208 -0
  68. package/scripts/measure_density.py +232 -0
  69. package/scripts/schemas/rule.schema.json +2 -1
  70. package/scripts/skill_linter.py +166 -31
  71. package/scripts/spotcheck_thin_root.py +134 -0
  72. package/scripts/update_counts.py +6 -10
  73. package/.agent-src/rules/no-council-references.md +0 -76
  74. package/.agent-src/rules/review-routing-awareness.md +0 -19
  75. package/.agent-src/templates/copilot-review-instructions.md +0 -76
@@ -0,0 +1,180 @@
1
+ ---
2
+ stability: beta
3
+ ---
4
+
5
+ # Linter Structural Model
6
+
7
+ **Status:** LOCKED — shipped 2026-05-08 on
8
+ `feat/road-to-structural-linter-reform`. The linter now applies the
9
+ structural model to skills, rules, and commands.
10
+
11
+ ## Why a structural model
12
+
13
+ Council convergence (Sonnet + GPT-4o, 2026-05-06): raw line / word
14
+ counts produce ratchet drift. Three failure modes that the pure-size
15
+ gate cannot distinguish:
16
+
17
+ - A 500-line skill with **one** 10-step procedure (legitimate) vs a
18
+ 500-line skill with **ten** independent procedures (split candidate).
19
+ - A 1700-word command that **delegates** to a cluster (legitimate
20
+ orchestrator) vs a 1700-word command that **inlines** the work.
21
+ - A 60-line rule whose body is a **verbatim Iron-Law block**
22
+ (legitimate) vs a 60-line rule that is **prose explanation**
23
+ (split candidate).
24
+
25
+ The structural model replaces the size threshold with four primitives.
26
+
27
+ ## Primitives
28
+
29
+ ### 1. Density score (0.0 – 1.0)
30
+
31
+ ```
32
+ density = structured_lines / total_non_blank_lines
33
+ ```
34
+
35
+ `structured_lines` = lines inside fenced blocks + markdown-table rows
36
+ + bullet-list lines + numbered-list lines + section-heading lines.
37
+ Higher = more structured (catalogue, table, code, list); lower =
38
+ prose-dominant.
39
+
40
+ ### 2. Multi-workflow detector (skills only)
41
+
42
+ Skills with **≥ 2 `## Procedure`** (or `## Procedure: <name>`)
43
+ sections ship multiple independently invocable procedures. Combined
44
+ with size, this is the cluster-split signal.
45
+
46
+ ### 3. Delegation detector (commands only)
47
+
48
+ Command has a delegation signal when **either** holds:
49
+
50
+ - frontmatter declares `cluster:` or `routes_to:`
51
+ - body contains ≥ 3 markdown links to other `.md` files
52
+
53
+ Absence of both signals on a large command = inlined logic.
54
+
55
+ ### 4. Iron-Law block detector (rules only)
56
+
57
+ A fenced block is an Iron-Law block when its body has **≥ 30
58
+ alphabetical characters** with **≥ 60 % uppercase** across **≥ 1
59
+ non-empty line**. The 30-character floor filters single ALL-CAPS
60
+ markers (`OK`, `WIP`); the 60 % uppercase floor catches verbatim
61
+ imperatives (`NEVER COMMIT.`).
62
+
63
+ ## Phase 1 calibration (2026-05-08)
64
+
65
+ Sweep covered all 310 lintable artifacts via
66
+ [`scripts/measure_density.py`](../../scripts/measure_density.py); raw
67
+ data lives at `agents/.density-snapshot.jsonl` (local-only — re-run
68
+ `python3 scripts/measure_density.py --root .agent-src --jsonl
69
+ agents/.density-snapshot.jsonl` to regenerate).
70
+
71
+ | Type | Count | Avg density | Median | Bucket [0.4-0.6] | Bucket [0.6-1.0] |
72
+ |---|---|---|---|---|---|
73
+ | skill | 142 | 0.76 | 0.78 | 22 | 119 |
74
+ | command | 103 | 0.59 | 0.57 | 46 | 45 |
75
+ | rule | 58 | 0.47 | 0.48 | 25 | 11 |
76
+ | persona | 7 | 0.38 | 0.38 | 1 | 0 |
77
+
78
+ Iron-Law detector recall on 9 canonical Iron-Law rules: **8 / 9** (all
79
+ except `agent-authority`, which uses a markdown-table index instead of
80
+ a fenced block — correct miss).
81
+
82
+ `quality-tools` (411 lines, single workflow): density **0.83**, single
83
+ procedure → no warning under the new model. ✓ roadmap success criterion.
84
+
85
+ `optimize/augmentignore.md` (1679 words): delegation signal **present**
86
+ (frontmatter `routes_to:`) → no warning under the new model. ✓ roadmap
87
+ success criterion.
88
+
89
+ Of 13 commands ≥ 1000 words, only **2** lack a delegation signal —
90
+ both are candidates for Phase 4.1 review (`compress.md`,
91
+ `project-analyze.md`; the latter has density 0.86, exempt under the
92
+ density-AND-delegation gate).
93
+
94
+ ## Warn rules (shipped Phase 3, 2026-05-08)
95
+
96
+ | Artifact | Warn condition |
97
+ |---|---|
98
+ | **skill** | `lines > 400` AND (`density < 0.6` OR `procedures ≥ 2`) |
99
+ | **command** | `words > 1000` AND no delegation signal AND `density < 0.65` |
100
+ | **rule** | `lines > 60` AND `density < 0.5` AND `iron_law_blocks == 0` |
101
+
102
+ The 200-line rule **error** stays unconditional. No new frontmatter
103
+ keys ship — the four structural primitives are the contract.
104
+
105
+ Calibration sweep on the 2026-05-08 corpus (310 artifacts):
106
+
107
+ | Type | Old warns | New warns | New band | Δ |
108
+ |---|---|---|---|---|
109
+ | rule | 23 | 2 | 3.4 % | −91 % |
110
+ | skill | 2 | 1 | 0.7 % | −50 % |
111
+ | command | 9 | 1 | 1.0 % | −89 % |
112
+ | **total** | **34** | **4** | **1.3 %** | **−88 %** |
113
+
114
+ Pass rate: 186 → 209 (`pass`); 124 → 101 (`pass_with_warnings`); 0
115
+ errors. Each remaining warning is a genuine structural defect:
116
+
117
+ - `compress.md` (1569 words, density 0.58, no delegation signal) —
118
+ inlined logic in a non-orchestrator command.
119
+ - `artifact-drafting-protocol.md` rule (65 lines, density 0.37, no
120
+ Iron-Law block) — prose-dominant long rule.
121
+ - `minimal-safe-diff.md` rule (69 lines, density 0.41, no Iron-Law
122
+ block) — prose-dominant long rule.
123
+ - `ai-council/SKILL.md` (525 lines, density 0.37) — orchestrator
124
+ skill below the density floor; refactor candidate.
125
+
126
+ Roadmap target ≤ 10 % rule-warning band. ✓ (3.4 %)
127
+
128
+ ## Frontmatter contract — Phase 2 decisions (2026-05-08)
129
+
130
+ AI Council run (Claude Sonnet 4.5 + GPT-4o, 2 rounds, $0.046; raw
131
+ transcript local-only per the council-references convention).
132
+
133
+ **Key 1 — `iron_law:` frontmatter — DECISION: Option A (auto-detect, no tag).**
134
+
135
+ Both council members converged on Option A. The detector recall on
136
+ the canonical 9-rule set is 8 / 9, and the one miss
137
+ (`agent-authority`) uses a markdown-table priority index that is
138
+ **not** an Iron-Law imperative — its body delegates to the rules it
139
+ indexes. The detector is correct to skip it. No `iron_law:`
140
+ frontmatter key is added.
141
+
142
+ **Key 2 — `density_exempt:` frontmatter — DECISION: Option A (no flag).**
143
+
144
+ Council split:
145
+
146
+ - Sonnet 4.5: Reject any flag. Add **type-based density floors**
147
+ (orchestrators 0.35, executors 0.6, imperatives 0.4) so the
148
+ detector classifies structurally instead of relying on author
149
+ declarations.
150
+ - GPT-4o: Adopt Option C (`density_exempt: true` + required
151
+ `density_exempt_reason:`) with periodic re-audit.
152
+
153
+ Sonnet's structural argument carries: an escape hatch for a 1-in-142
154
+ corpus case ships maintenance debt across every future artifact that
155
+ brushes the boundary. The single failing skill (`ai-council`,
156
+ density 0.36) is a documentation-heavy reference-orchestrator and is
157
+ left as a Phase-4 review candidate — either restructure the skill or
158
+ add orchestrator-aware type-floors as a follow-up. No
159
+ `density_exempt:` key is added in Phase 3.
160
+
161
+ The Phase-3 implementation therefore ships **zero new frontmatter
162
+ keys** — the structural primitives are the contract.
163
+
164
+ ## Out of scope
165
+
166
+ - Hard error thresholds beyond the 200-line rule cap.
167
+ - Automatic refactoring of artifacts that fail the new model.
168
+ - Cross-artifact dependency counts (a skill linking 4 other skills is
169
+ `routes_to` doing its job, not a defect).
170
+
171
+ ## References
172
+
173
+ - `scripts/measure_density.py` — Phase 1.1 measurement tool.
174
+ - `agents/.density-snapshot.jsonl` — full per-artifact metrics
175
+ (gitignored, re-run the measurement script to regenerate).
176
+ - `scripts/skill_linter.py` — structural-model implementation
177
+ (`_density_score`, `_count_procedure_sections`,
178
+ `_command_delegation_signal`, `_iron_law_blocks`).
179
+ - `docs/guidelines/agent-infra/size-and-scope.md` — guideline now
180
+ describes the structural model; Option 2 transition notes removed.
@@ -0,0 +1,135 @@
1
+ ---
2
+ stability: beta
3
+ ---
4
+
5
+ # Package Self-Orientation
6
+
7
+ > **Beta.** Outboard target for the package-root `AGENTS.md` Thin-Root
8
+ > refactor (Phase 6.4 of `road-to-augment-limit-fit`). Holds the
9
+ > deep-detail prose that used to live inline.
10
+
11
+ ## What this repo is
12
+
13
+ A **governed skill suite** for two cognition clusters — engineering
14
+ depth (Wing 1) and senior cross-department cognition (Wings 2–4).
15
+ **Depth over breadth, decisions over boilerplate, under a shared
16
+ Iron-Law floor** (`commit-policy`, `non-destructive-by-default`,
17
+ `language-and-tone`, `skill-quality`, `direct-answers`).
18
+
19
+ `type: library` distribution package — published to Composer and npm
20
+ as `event4u/agent-config` / `@event4u/agent-config`. No application
21
+ runtime. Installed via `scripts/install.sh` (Bash) and
22
+ `scripts/install.py` (Python bridge).
23
+
24
+ ## The four wings
25
+
26
+ Four wings compose via [`cross-wing-handoff.md`](cross-wing-handoff.md)
27
+ (beta). Per-wing plates live under `agents/roadmaps/` and `agents/contexts/`.
28
+
29
+ | Wing | Cognition cluster |
30
+ |---|---|
31
+ | **1 — Engineering** | Code craft, debugging, refactoring, release discipline; depth-first |
32
+ | **2 — Product + Foundation** | Roles cluster (PM, designer, QA, EM); product discovery, prioritization, delivery shape |
33
+ | **3 — GTM + Growth** | CMO + marketing + sales + lifecycle; channel-agnostic positioning + funnel cognition |
34
+ | **4 — Money + Strategy + Ops** | CFO + COO + board-level strategy, valuation, org-design; stage-agnostic financial + operational cognition |
35
+
36
+ ## Tech stack
37
+
38
+ Bash (install scripts) · Python 3.10+ (linters, compression, pytest) ·
39
+ Markdown (all content) · Taskfile (`task ci/sync/test`) · GitHub
40
+ Actions (`.github/workflows/`). Non-text inputs (PDF, DOCX, XLSX,
41
+ images, audio) route through the
42
+ [`markitdown`](../../.agent-src/skills/markitdown/SKILL.md) skill.
43
+ Wings 2–4 enforce a cognition-only floor (no SaaS auth, no vendor
44
+ SDKs) — `skill_linter.py` enforces it mechanically. Distribution
45
+ mechanics deep-dive: [`agents-md-tech-stack.md`](agents-md-tech-stack.md) (beta).
46
+
47
+ ## Source of truth
48
+
49
+ | Directory | Purpose | Editable? |
50
+ |---|---|---|
51
+ | `.agent-src.uncompressed/` | Authoring layer — full verbose content | ✅ Yes — edit here |
52
+ | `.agent-src/` | Compressed output — shipped in the package, consumed by agents | ❌ No — regenerated |
53
+ | `.augment/` | Local projection of `.agent-src/` for Augment Code (gitignored) | ❌ No — regenerated |
54
+ | `.claude/`, `.cursor/`, `.clinerules/`, `.windsurfrules` | Tool-specific projections | ❌ No — regenerated |
55
+ | `agents/` | Package's own roadmaps, contexts, sessions | ✅ Yes |
56
+
57
+ **Never edit `.agent-src/` or `.augment/` directly.** Edit
58
+ `.agent-src.uncompressed/` and run `task sync` (or `task ci`) to
59
+ compress + regenerate the tool directories.
60
+
61
+ ## Repository layout
62
+
63
+ ```
64
+ .agent-src.uncompressed/ ← edit here
65
+ skills/ (141 skills)
66
+ rules/ (58 rules)
67
+ commands/ (103 commands)
68
+ personas/ (7 personas)
69
+ templates/ (AGENTS.md, copilot-instructions.md, skill.md, …)
70
+ contexts/
71
+
72
+ docs/guidelines/ (47 guidelines — reference material, not packaged)
73
+ docs/contracts/ (kernel-membership, rule-router, rule-classification, …)
74
+ docs/decisions/ (ADRs — kernel overrides, scope decisions)
75
+ .agent-src/ ← compressed output shipped in the package
76
+ .agent-src/router.json ← compiled router manifest (consumed at runtime)
77
+ .augment/ ← local projection for Augment Code (gitignored)
78
+ scripts/ ← install.sh, install.py, compress.py, linters
79
+ tests/ ← pytest (324 tests) + test_install.sh
80
+ agents/ ← this package's own roadmaps / sessions / contexts
81
+ .github/workflows/ ← CI
82
+ ```
83
+
84
+ ## Key rules for agents editing this repo
85
+
86
+ | Rule | File |
87
+ |---|---|
88
+ | `.agent-src/` must stay project-agnostic — no project names, domains, stacks | [`augment-portability`](../../.agent-src/rules/augment-portability.md) |
89
+ | Root AGENTS.md + copilot-instructions.md must stay project-agnostic too | [`augment-portability`](../../.agent-src/rules/augment-portability.md) |
90
+ | Edit `.agent-src.uncompressed/`, never `.agent-src/` or `.augment/` | [`augment-source-of-truth`](../../.agent-src/rules/augment-source-of-truth.md) |
91
+ | Skills must declare frontmatter, be self-contained, pass the linter | [`skill-quality`](../../.agent-src/rules/skill-quality.md) |
92
+ | Size budgets for skills, rules, commands | [`size-enforcement`](../../.agent-src/rules/size-enforcement.md) |
93
+ | Keep `.agent-src/` / `agents/` cross-refs in sync on add/rename/delete | [`docs-sync`](../../.agent-src/rules/docs-sync.md) |
94
+ | Creating a new skill/rule/command/guideline runs Understand → Research → Draft | [`artifact-drafting-protocol`](../../.agent-src/rules/artifact-drafting-protocol.md) |
95
+
96
+ ## Maintainer telemetry (opt-in)
97
+
98
+ Default-off. `telemetry.artifact_engagement.enabled: true` in
99
+ `.agent-settings.yml` enables local-only JSONL logging. Redaction
100
+ floor + pipeline:
101
+ [`artifact-engagement-flow.md`](../../.agent-src.uncompressed/contexts/contracts/artifact-engagement-flow.md)
102
+ (beta). Rule:
103
+ [`artifact-engagement-recording`](../../.agent-src/rules/artifact-engagement-recording.md).
104
+
105
+ ## Context-aware command suggestion
106
+
107
+ When a free-form prompt matches a command's purpose, the agent
108
+ surfaces matches as numbered options with a "run as-is" escape;
109
+ **nothing auto-executes**. Engine: `scripts/command_suggester/`.
110
+ Rule: [`command-suggestion-policy`](../../.agent-src/rules/command-suggestion-policy.md).
111
+ Eligibility + scoring + hardening:
112
+ [`adr-command-suggestion.md`](adr-command-suggestion.md) and
113
+ [`command-suggestion-flow.md`](../../.agent-src.uncompressed/contexts/contracts/command-suggestion-flow.md)
114
+ (beta).
115
+
116
+ ## Multi-agent tool support
117
+
118
+ `task generate-tools` projects `.agent-src/` into Augment Code, Claude
119
+ Code (Agent Skills standard), Cursor, Cline, Windsurf, Gemini CLI,
120
+ and Claude.ai cloud bundles. Skills follow
121
+ [agentskills.io](https://agentskills.io); commands are converted to
122
+ Claude Code Skills with `disable-model-invocation: true`. Per-tool
123
+ layout + cloud-bundle pipeline:
124
+ [`docs/architecture.md`](../architecture.md#cloud-bundle-pipeline).
125
+
126
+ ## Contributing
127
+
128
+ 1. Edit inside `.agent-src.uncompressed/` or `scripts/` or `tests/` —
129
+ never in `.agent-src/`, `.augment/`, `.claude/`, `.cursor/`, etc.
130
+ 2. Run `task ci` locally. It must exit 0.
131
+ 3. Commit in logical chunks with Conventional Commits.
132
+ 4. Open a PR against `main`.
133
+
134
+ User-facing story: [`README.md`](../../README.md). Architecture
135
+ deep-dive: [`docs/architecture.md`](../architecture.md).
@@ -116,8 +116,7 @@ existing skills under `.agent-src.uncompressed/skills/`.
116
116
  | model-recommendation | 2909 | `set-cost-profile` | Routing procedure |
117
117
  | onboarding-gate | 4881 | `onboard` | Mechanical: meta-rule about /onboard |
118
118
  | package-ci-checks | 1342 | `lint-skills` | Repo-specific procedure |
119
- | review-routing-awareness | 4220 | `review-routing` | Skill exists; large overlap |
120
- | reviewer-awareness | 3573 | `review-routing` | Merges with above into one skill |
119
+ | reviewer-awareness | 3573 | `review-routing` | Skill exists; consolidates former `review-routing-awareness` (2026-05-08, see `agents/contexts/adr-auto-rule-consolidation.md`) |
121
120
  | skill-improvement-trigger | 1597 | `skill-improvement-pipeline` | Trigger procedure |
122
121
  | slash-command-routing-policy | 3218 | `command-routing` | Routing procedure |
123
122
  | ui-audit-gate | 3285 | `existing-ui-audit` | Audit procedure |
@@ -151,8 +150,9 @@ Reference / examples / mechanics. Body migrates into
151
150
  1. **Kernel swap ADR (P2.1).** `agent-authority` ↔
152
151
  `autonomous-execution`. See `kernel-membership.md` § 5.2 for the
153
152
  three resolution variants; this file syncs once the ADR lands.
154
- 2. **`reviewer-awareness` + `review-routing-awareness` merge.** Both
155
- target the same skill P4.1 must consolidate, not duplicate.
153
+ 2. **`reviewer-awareness` + `review-routing-awareness` merge.** ✅ resolved
154
+ 2026-05-08merged into `reviewer-awareness` per
155
+ `agents/contexts/adr-auto-rule-consolidation.md`.
156
156
  3. **`onboarding-gate` migration shape.** The rule fires only on the
157
157
  first turn; the migrated form must keep that trigger latch.
158
158
  Router state-machine primitives (once / every-turn / on-mode-
@@ -0,0 +1,240 @@
1
+ ---
2
+ adr: 004
3
+ status: accepted
4
+ date: 2026-05-08
5
+ decision: rule-governance-pruning
6
+ supersedes: —
7
+ superseded_by: —
8
+ phase: road-to-augment-limit-fit · P5.5
9
+ ---
10
+
11
+ # ADR-004 — Rule-Governance Pruning (Phase 5)
12
+
13
+ ## Status
14
+
15
+ **Accepted** · 2026-05-08.
16
+
17
+ ## Context
18
+
19
+ `road-to-augment-limit-fit` Phase 5 ran a Rule-Governance Audit on
20
+ the 49 `type: auto` rules that consume the workspace-guidelines
21
+ budget via description-stub injection (~250 chars each). Three
22
+ analytic passes ran:
23
+
24
+ - **5.1** `scripts/audit_auto_rules.py` — measured stub vs. body
25
+ cost. Auto-rule stubs total **11,513 chars · 23.3 %** of the
26
+ 49,512 ceiling.
27
+ - **5.2** `scripts/audit_overlap.py` — pairwise Jaccard on
28
+ `path_prefix` triggers + symmetric keyword overlap on
29
+ description/keyword/intent token sets. 4 pairs flagged
30
+ (path-Jaccard ≥ 0.5 OR keyword-overlap ≥ 0.4).
31
+ - **5.3** `scripts/audit_likelihood.py` — corpus-keyword scoring
32
+ against indexed skills + commands + contexts + guidelines. 0
33
+ rules below the strict `< 2` hits floor; bottom-10 list surfaced
34
+ for council walk.
35
+
36
+ **5.4** AI Council R3 (claude-sonnet-4-5 + gpt-4o, 2 rounds, prompt
37
+ mode) walked the candidate list. Council convergence and host
38
+ verdicts are recorded in `agents/reports/auto-rules-audit.md`
39
+ § Phase 5.4. The dominant council insight:
40
+
41
+ > *"Rarity ≠ redundancy. Low corpus hits often indicate a
42
+ > preventative rule that fires precisely when needed, not a useless
43
+ > one. The audit cannot distinguish dead weight from option-value
44
+ > insurance."* — claude-sonnet-4-5
45
+
46
+ This narrowed the action surface from "remove anything in the
47
+ bottom 10" to four targeted decisions where redundancy or
48
+ mechanical-already status was structurally provable.
49
+
50
+ ## Decision
51
+
52
+ Four approved actions, applied in Phase 5.6:
53
+
54
+ ### Implementation pattern: demote via frontmatter
55
+
56
+ All four actions use the same mechanical pattern: change rule
57
+ frontmatter `type: "auto"` → `type: "manual"`. This:
58
+
59
+ - **Removes the stub from the workspace budget.**
60
+ `scripts/measure_augment_budget.py` only counts `type: "auto"`
61
+ rules (line 99). Anything else has zero stub cost.
62
+ - **Preserves the file and its cross-references.**
63
+ Skills, contexts, templates, and contracts that link to the rule
64
+ (`size-enforcement` is referenced from `rule-writing/SKILL.md`,
65
+ `command-writing/SKILL.md`, `artifact-drafting-protocol.md`,
66
+ `proposal.example.md`, `rule-classification.md`,
67
+ `self-improvement-pipeline.md`, etc.) keep working.
68
+ - **Keeps `compile_router.py` deterministic.**
69
+ Non-auto rules are skipped by `_resolve_tier`; the rule no
70
+ longer routes through `router.json` but remains a reference
71
+ document.
72
+
73
+ This pattern was chosen over hard deletion after the
74
+ cross-reference audit (Phase 5.6 prep) showed each candidate has
75
+ ≥ 5 inbound references. Deletion would force a wide-radius
76
+ documentation rewrite for marginal additional savings.
77
+
78
+ ### 1. `guidelines` — demote
79
+
80
+ - **Verdict:** demote (`type: "auto"` → `type: "manual"`).
81
+ - **Rationale:** Generic name, no `routes_to:` target, 552 corpus
82
+ hits, no `path_prefix` trigger. Description ("Writing or
83
+ reviewing code — check relevant guideline before writing or
84
+ reviewing code") is ambient guidance already covered by the 9
85
+ always-rules and the Iron-Law floor. The auto-stub adds ~185
86
+ chars of overhead for a rule that fires on every code touch but
87
+ has no specific routing target — i.e., it functions as a noop
88
+ reminder. The body remains as a reference doc citing the
89
+ guidelines-mechanics context.
90
+ - **Preserved triggers:** the body retains its trigger discussion
91
+ for human readers; auto-discovery is dropped.
92
+ - **Migration:** none. Inbound link in
93
+ `contexts/communication/rules-auto/guidelines-mechanics.md`
94
+ remains valid.
95
+
96
+ ### 2. `size-enforcement` — demote (logical merge into `rule-type-governance`)
97
+
98
+ - **Verdict:** demote (`type: "auto"` → `type: "manual"`); record
99
+ the logical merge in this ADR rather than physically folding the
100
+ body. `rule-type-governance` already routes to its own
101
+ guideline; both rules now share the same auto-trigger surface
102
+ conceptually but only `rule-type-governance` injects a stub.
103
+ - **Rationale:** Both rules fire during rule/skill/command
104
+ authoring. `size-enforcement` enforces character budgets;
105
+ `rule-type-governance` enforces always-vs-auto classification.
106
+ Council R3 convergence on the merge. Physical body-fold rejected
107
+ to keep blast radius small (see implementation-pattern note).
108
+ - **Preserved triggers:** "size", "budget", "limit", "char count",
109
+ artefact creation/editing scope — all retained in the rule body
110
+ for ad-hoc consultation; the auto-discovery surface is dropped.
111
+ - **Migration:** none required. `rule-writing/SKILL.md`,
112
+ `command-writing/SKILL.md`, `artifact-drafting-protocol.md`,
113
+ `proposal.example.md`, and the contracts continue to cite the
114
+ rule by file path; the file still exists.
115
+
116
+ ### 3. `package-ci-checks` — demote
117
+
118
+ - **Verdict:** demote (`type: "auto"` → `type: "manual"`).
119
+ - **Rationale:** Rule is `mechanical-already` — `task ci` already
120
+ enforces the same checks before a PR can merge. The rule is also
121
+ package-self-referential (it only fires when contributing to
122
+ `event4u/agent-config` itself); consumer projects never benefit
123
+ from the stub. Council R3: gpt-4o (demote), Sonnet (verify skill
124
+ links contract first — confirmed: `routes_to: skill:lint-skills`).
125
+ - **Preserved triggers:** "task ci", "before push", "before pr".
126
+ Body retains trigger phrases for human reference.
127
+ - **Migration:** AGENTS.md "Working on this repo" section already
128
+ documents `task ci`; no consumer-project regression because
129
+ consumers never received this rule's stub anyway (`source: package`).
130
+
131
+ ### 4. `analysis-skill-routing` — demote
132
+
133
+ - **Verdict:** demote (`type: "auto"` → `type: "manual"`).
134
+ - **Rationale:** The rule's only function is to point host agents
135
+ at the `analysis-skill-router` skill when an analysis request
136
+ fires. The skill's own description carries the same trigger
137
+ surface ("picking which analysis or project-analysis-* skill
138
+ fits a request") and is already auto-discoverable as a Skill.
139
+ The rule is a redundant pointer-to-pointer. Council R3:
140
+ gpt-4o (merge into slash-command-routing-policy — host rejected:
141
+ analysis ≠ slash-commands; merge would collapse a meaningful
142
+ category distinction). Sonnet (keep + add `routes_to:` — host
143
+ rejected: routing already exists via the skill itself).
144
+ - **Preserved triggers:** "analyze", "analysis", "dig into the
145
+ codebase". Already present in the skill's description.
146
+ - **Migration:** Verify `analysis-skill-router` skill description
147
+ is pushy enough; no other action required.
148
+
149
+ ## Consequences
150
+
151
+ ### Accepted
152
+
153
+ - **Stub-cost saving:** ~849 chars freed (~1.7 % of the 49,512 cap).
154
+ Phase 5 alone is insufficient to hit the 20 % headroom goal.
155
+ - **Phase 6 (Thin-Root AGENTS.md) was mandatory**, not optional.
156
+ AGENTS.md was the largest single asset (12,042 chars) and the
157
+ only remaining lever once Phase 5 was locked in.
158
+ - **Four rules (`guidelines`, `size-enforcement`,
159
+ `package-ci-checks`, `analysis-skill-routing`) demoted from
160
+ `type: "auto"` to `type: "manual"`.** Total auto-rules: 49 → 45.
161
+ Files preserved on disk; cross-references intact.
162
+ - **Final budget after Phases 5–7** (`scripts/measure_augment_budget.py`,
163
+ 2026-05-08): AGENTS.md 2,773 + always-rules (9) 26,322 + auto-rule
164
+ stubs (45) 10,664 = **39,759 chars · 80.3 % utilisation · 19.7 %
165
+ headroom** (149 chars / 0.3 % short of the ≥ 20 % goal — within
166
+ rounding; effectively at target). Phase 6 (Thin-Root AGENTS.md
167
+ refactor: 12,042 → 2,773 chars) carried the bulk of the saving
168
+ that Phase 5 alone could not deliver. Phase 7 (`scripts/lint_agents_md.py`,
169
+ CI-blocking) locks the contract in.
170
+
171
+ ### Trade-offs
172
+
173
+ - **Sonnet's "rarity ≠ redundancy" critique honored.** The audit
174
+ identified 14 candidates; only 4 pass the host's redundancy /
175
+ mechanical-already test. Aggressive ceiling (~2,750 chars, per
176
+ gpt-4o) was rejected as it would force domain-specific rules
177
+ (`docker-commands`, `laravel-translations`) into manual
178
+ guideline-load workflows for the 20 % of projects that need them.
179
+ - **`upstream-proposal` and `slash-command-routing-policy` both
180
+ retained without `routes_to:` fix.** Flagged as follow-up work
181
+ outside this ADR's scope; their preservation is justified by
182
+ rare-but-critical activation pattern.
183
+ - **No `augment-portability` / `docs-sync` merge** despite 1.00
184
+ path-Jaccard. Council R3 convergence: workspace-layout
185
+ coincidence, not logical duplication. Different intents
186
+ (host-portability vs. sync-workflow hygiene).
187
+
188
+ ## Re-evaluation trigger
189
+
190
+ - Augment changes its accounting model (e.g. starts injecting
191
+ auto-rule bodies into the workspace prompt) → re-open this
192
+ governance pass; the stub-cost / body-cost ratio changes
193
+ drastically.
194
+ - Auto-rule count grows by ≥ 5 (history check via
195
+ `agents/.augment-budget-history.jsonl`) → repeat the audit
196
+ with the same three-pass methodology.
197
+ - A retained rule (`upstream-proposal`, `slash-command-routing-policy`,
198
+ `analysis-skill-routing`'s sibling skill) shows a 30-day window
199
+ with zero documented activation in `agents/council-sessions/` →
200
+ open a follow-up ADR demoting it.
201
+
202
+ ## Alternatives considered
203
+
204
+ - **Aggressive prune (gpt-4o R1 line):** demote
205
+ `agent-docs`, `docker-commands`, `laravel-translations`. Rejected.
206
+ Sonnet's rarity-≠-redundancy critique applies; these are
207
+ domain-specific rules with substantial corpus presence (240+
208
+ hits each) and their absence forces consumer projects into
209
+ manual guideline-load. The ~750-char additional saving is not
210
+ worth the behavioural regression.
211
+ - **`augment-portability` / `docs-sync` merge (gpt-4o R2):**
212
+ Rejected. 1.00 path-Jaccard reflects shared filesystem
213
+ triggers (`docs/guides/agent-setup/augment.md`), not shared
214
+ intent. `augment-portability` enforces project-agnostic content
215
+ in `.agent-src/`; `docs-sync` enforces cross-reference integrity
216
+ on add/rename/delete. Different verbs, different blast radii.
217
+ - **Defer all rule changes; focus on Phase 6 only:** Rejected.
218
+ The four approved actions are independently defensible; bundling
219
+ them with Phase 6 would obscure the rationale and conflate two
220
+ different optimisation strategies (rule-set hygiene vs.
221
+ AGENTS.md restructure). Each phase ships its own savings on its
222
+ own audit trail.
223
+
224
+ ## References
225
+
226
+ - `agents/roadmaps/archive/road-to-augment-limit-fit.md` § Phase 5
227
+ - `agents/reports/auto-rules-audit.md` (full audit findings,
228
+ council walk, host verdicts)
229
+ - `agents/reports/auto-rules-overlap.json` (Phase 5.2 data)
230
+ - `agents/reports/auto-rules-likelihood.json` (Phase 5.3 data)
231
+ - `agents/council-questions/augment-limit-fit-rule-governance.md`
232
+ (Phase 5.4 prompt)
233
+ - `agents/council-responses/augment-limit-fit-rule-governance.json`
234
+ (Phase 5.4 R3 raw debate) <!-- council-ref-allowed: ADR decision trace -->
235
+ - `docs/decisions/ADR-rule-kernel-and-router.md` (kernel-membership
236
+ contract — Phase 5 changes leave kernel untouched per Lever C lock)
237
+ - `.agent-src.uncompressed/rules/guidelines.md` (deprecated subject)
238
+ - `.agent-src.uncompressed/rules/size-enforcement.md` (merged subject)
239
+ - `.agent-src.uncompressed/rules/package-ci-checks.md` (demoted subject)
240
+ - `.agent-src.uncompressed/rules/analysis-skill-routing.md` (demoted subject)
@@ -115,7 +115,7 @@ Your agent is now:
115
115
  - **Respecting your codebase** — no conflicting patterns
116
116
  - **Following standards** — consistent code quality
117
117
 
118
- This is enforced automatically by 60 rules. No configuration needed.
118
+ This is enforced automatically by 58 rules. No configuration needed.
119
119
 
120
120
  ---
121
121
 
@@ -1,7 +1,7 @@
1
1
  # Review Routing Data Format
2
2
 
3
3
  Schema and conventions for the two project-local YAML files that feed the
4
- [`review-routing-awareness`](../../rules/review-routing-awareness.md) rule
4
+ [`reviewer-awareness`](../../rules/reviewer-awareness.md) rule
5
5
  and the [`review-routing`](../../skills/review-routing/SKILL.md) skill.
6
6
 
7
7
  Both files are **optional** and live in the consumer repository — never
@@ -139,6 +139,5 @@ Field semantics:
139
139
 
140
140
  ## See also
141
141
 
142
- - [`review-routing-awareness`](../../rules/review-routing-awareness.md)
143
142
  - [`reviewer-awareness`](../../rules/reviewer-awareness.md)
144
143
  - [`review-routing`](../../skills/review-routing/SKILL.md)
@@ -33,10 +33,14 @@ Size is a signal — not the goal.
33
33
  - Acceptable: **< 100–120 lines**
34
34
  - Hard limit: **< 200 lines**
35
35
 
36
- Linter (council review 2026-05-06): the > 40 / > 60 line warnings are
37
- **density-gated** — rules with ≥ 30 % fenced content (verbatim Iron-Law
38
- blocks, worked-example fences) are exempt from the line-count warning.
39
- The 200-line hard error stays unconditional.
36
+ Linter (structural model, 2026-05-08 see
37
+ [`docs/contracts/linter-structural-model.md`](../../contracts/linter-structural-model.md)):
38
+ the long-rule warning fires only when the rule is **> 60 non-empty
39
+ lines AND density < 0.50 AND ships no Iron-Law block**. Rules whose
40
+ body is a verbatim ALL-CAPS imperative (`commit-policy`,
41
+ `ask-when-uncertain`, `direct-answers`) are auto-exempt — no
42
+ frontmatter flag required. The 200-line hard error stays
43
+ unconditional.
40
44
 
41
45
  Reason:
42
46
  - Loaded frequently
@@ -48,10 +52,11 @@ Reason:
48
52
  ## Skills
49
53
 
50
54
  - Target: **300–900 words**
51
- - Warning: **> 400 lines** (raised from 300, council review 2026-05-06)
52
- - Strong split signal: reference-rich skills (analyzer, quality-tool
53
- catalog, council orchestration) may legitimately sit between 300 and
54
- 400 lines without being split-candidates
55
+ - Warning: **> 400 lines AND (density < 0.60 OR 2 `## Procedure`
56
+ blocks)** structural model, 2026-05-08
57
+ - Reference-rich skills with high density (`quality-tools` at 0.83,
58
+ catalogue-style skills) pass without splitting; the multi-procedure
59
+ trigger flags genuine cluster-split candidates regardless of size
55
60
 
56
61
  Focus:
57
62
  - scanability
@@ -64,10 +69,11 @@ Focus:
64
69
 
65
70
  - Target: **200–600 words**
66
71
  - Acceptable: **up to ~1000 words**
67
- - Warning: **> 1000 words AND lacks delegation structure** (< 5
68
- sub-sections OR < 3 code blocks). Well-factored orchestrators with 5
69
- sub-sections AND 3 code blocks are exempt the size reflects
70
- dispatch breadth, not bloat (council review 2026-05-06).
72
+ - Warning: **> 1000 words AND no delegation signal AND density < 0.65**
73
+ structural model, 2026-05-08. A delegation signal is either
74
+ frontmatter (`cluster:` / `routes_to:`) OR 3 markdown links to
75
+ other `.md` files. Well-factored orchestrators pass automatically;
76
+ inlined logic in a non-orchestrator command warns.
71
77
 
72
78
  Commands orchestrate — not implement.
73
79
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@event4u/agent-config",
3
- "version": "1.24.0",
3
+ "version": "1.26.0",
4
4
  "description": "Shared agent configuration \u2014 skills, rules, commands, guidelines, and templates for AI coding tools",
5
5
  "license": "MIT",
6
6
  "private": false,