@event4u/agent-config 1.20.0 → 1.21.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 (238) hide show
  1. package/.agent-src/commands/agents.md +1 -1
  2. package/.agent-src/commands/bug-fix.md +1 -1
  3. package/.agent-src/commands/bug-investigate.md +2 -2
  4. package/.agent-src/commands/chat-history/import.md +60 -64
  5. package/.agent-src/commands/compress.md +12 -0
  6. package/.agent-src/commands/context/create.md +2 -2
  7. package/.agent-src/commands/context.md +1 -1
  8. package/.agent-src/commands/copilot-agents.md +1 -1
  9. package/.agent-src/commands/council/default.md +17 -5
  10. package/.agent-src/commands/council.md +1 -1
  11. package/.agent-src/commands/e2e-heal.md +1 -1
  12. package/.agent-src/commands/e2e-plan.md +1 -1
  13. package/.agent-src/commands/feature/dev.md +3 -3
  14. package/.agent-src/commands/feature.md +1 -1
  15. package/.agent-src/commands/fix/seeder.md +2 -2
  16. package/.agent-src/commands/fix.md +1 -1
  17. package/.agent-src/commands/jira-ticket.md +1 -1
  18. package/.agent-src/commands/judge.md +2 -2
  19. package/.agent-src/commands/memory.md +1 -1
  20. package/.agent-src/commands/mode.md +5 -5
  21. package/.agent-src/commands/module.md +1 -1
  22. package/.agent-src/commands/onboard.md +4 -4
  23. package/.agent-src/commands/optimize/augmentignore.md +1 -1
  24. package/.agent-src/commands/optimize-prompt.md +61 -0
  25. package/.agent-src/commands/optimize.md +1 -1
  26. package/.agent-src/commands/override.md +1 -1
  27. package/.agent-src/commands/review-changes.md +1 -1
  28. package/.agent-src/commands/review-routing.md +1 -1
  29. package/.agent-src/commands/roadmap.md +1 -1
  30. package/.agent-src/commands/set-cost-profile.md +3 -3
  31. package/.agent-src/commands/sync-agent-settings.md +2 -2
  32. package/.agent-src/commands/tests/create.md +2 -2
  33. package/.agent-src/commands/tests.md +1 -1
  34. package/.agent-src/commands/threat-model.md +4 -4
  35. package/.agent-src/contexts/authority/commit-mechanics.md +14 -1
  36. package/.agent-src/contexts/authority/destructive-mechanics.md +14 -1
  37. package/.agent-src/contexts/authority/scope-mechanics.md +5 -0
  38. package/.agent-src/contexts/communication/rules-auto/guidelines-mechanics.md +76 -0
  39. package/.agent-src/contexts/communication/rules-auto/slash-command-routing-policy-mechanics.md +1 -1
  40. package/.agent-src/contexts/communication/rules-auto/think-before-action-mechanics.md +98 -0
  41. package/.agent-src/contexts/communication/rules-auto/token-efficiency-mechanics.md +93 -0
  42. package/.agent-src/contexts/communication/rules-auto/user-interaction-mechanics.md +128 -5
  43. package/.agent-src/contexts/execution/autonomy-mechanics.md +44 -0
  44. package/.agent-src/contexts/model-recommendations.md +2 -2
  45. package/.agent-src/contexts/override-system.md +1 -1
  46. package/.agent-src/personas/product-owner.md +2 -2
  47. package/.agent-src/personas/qa.md +1 -1
  48. package/.agent-src/rules/agent-authority.md +5 -6
  49. package/.agent-src/rules/agent-docs.md +11 -53
  50. package/.agent-src/rules/analysis-skill-routing.md +10 -40
  51. package/.agent-src/rules/architecture.md +6 -1
  52. package/.agent-src/rules/artifact-drafting-protocol.md +5 -0
  53. package/.agent-src/rules/artifact-engagement-recording.md +23 -59
  54. package/.agent-src/rules/ask-when-uncertain.md +24 -47
  55. package/.agent-src/rules/augment-portability.md +14 -62
  56. package/.agent-src/rules/augment-source-of-truth.md +10 -1
  57. package/.agent-src/rules/autonomous-execution.md +17 -98
  58. package/.agent-src/rules/capture-learnings.md +9 -80
  59. package/.agent-src/rules/cli-output-handling.md +12 -42
  60. package/.agent-src/rules/command-suggestion-policy.md +25 -73
  61. package/.agent-src/rules/commit-conventions.md +9 -58
  62. package/.agent-src/rules/commit-policy.md +16 -47
  63. package/.agent-src/rules/context-hygiene.md +5 -0
  64. package/.agent-src/rules/direct-answers.md +21 -50
  65. package/.agent-src/rules/docker-commands.md +11 -45
  66. package/.agent-src/rules/docs-sync.md +10 -56
  67. package/.agent-src/rules/downstream-changes.md +5 -0
  68. package/.agent-src/rules/e2e-testing.md +9 -44
  69. package/.agent-src/rules/guidelines.md +13 -75
  70. package/.agent-src/rules/improve-before-implement.md +10 -2
  71. package/.agent-src/rules/language-and-tone.md +41 -106
  72. package/.agent-src/rules/laravel-translations.md +11 -40
  73. package/.agent-src/rules/markdown-safe-codeblocks.md +4 -0
  74. package/.agent-src/rules/minimal-safe-diff.md +4 -0
  75. package/.agent-src/rules/missing-tool-handling.md +4 -0
  76. package/.agent-src/rules/model-recommendation.md +9 -61
  77. package/.agent-src/rules/no-attribution-footers.md +5 -0
  78. package/.agent-src/rules/no-cheap-questions.md +11 -27
  79. package/.agent-src/rules/no-council-references.md +76 -0
  80. package/.agent-src/rules/no-roadmap-references.md +7 -0
  81. package/.agent-src/rules/non-destructive-by-default.md +13 -43
  82. package/.agent-src/rules/onboarding-gate.md +9 -117
  83. package/.agent-src/rules/package-ci-checks.md +10 -37
  84. package/.agent-src/rules/php-coding.md +10 -55
  85. package/.agent-src/rules/preservation-guard.md +9 -0
  86. package/.agent-src/rules/review-routing-awareness.md +9 -97
  87. package/.agent-src/rules/reviewer-awareness.md +8 -83
  88. package/.agent-src/rules/roadmap-progress-sync.md +7 -170
  89. package/.agent-src/rules/role-mode-adherence.md +6 -2
  90. package/.agent-src/rules/rule-type-governance.md +8 -66
  91. package/.agent-src/rules/runtime-safety.md +5 -0
  92. package/.agent-src/rules/scope-control.md +17 -62
  93. package/.agent-src/rules/security-sensitive-stop.md +7 -1
  94. package/.agent-src/rules/size-enforcement.md +6 -1
  95. package/.agent-src/rules/skill-improvement-trigger.md +9 -49
  96. package/.agent-src/rules/skill-quality.md +7 -113
  97. package/.agent-src/rules/slash-command-routing-policy.md +11 -63
  98. package/.agent-src/rules/think-before-action.md +22 -87
  99. package/.agent-src/rules/token-efficiency.md +10 -74
  100. package/.agent-src/rules/token-optimizer-maintenance.md +68 -0
  101. package/.agent-src/rules/tool-safety.md +4 -0
  102. package/.agent-src/rules/ui-audit-gate.md +25 -61
  103. package/.agent-src/rules/upstream-proposal.md +9 -67
  104. package/.agent-src/rules/user-interaction.md +22 -108
  105. package/.agent-src/rules/verify-before-complete.md +1 -1
  106. package/.agent-src/skills/agent-docs-writing/SKILL.md +1 -1
  107. package/.agent-src/skills/ai-council/SKILL.md +65 -0
  108. package/.agent-src/skills/analysis-autonomous-mode/SKILL.md +1 -1
  109. package/.agent-src/skills/analysis-skill-router/SKILL.md +3 -3
  110. package/.agent-src/skills/artisan-commands/SKILL.md +2 -2
  111. package/.agent-src/skills/authz-review/SKILL.md +1 -1
  112. package/.agent-src/skills/aws-infrastructure/SKILL.md +5 -5
  113. package/.agent-src/skills/blast-radius-analyzer/SKILL.md +8 -8
  114. package/.agent-src/skills/bug-analyzer/SKILL.md +5 -5
  115. package/.agent-src/skills/code-refactoring/SKILL.md +4 -4
  116. package/.agent-src/skills/code-review/SKILL.md +2 -2
  117. package/.agent-src/skills/command-writing/SKILL.md +11 -0
  118. package/.agent-src/skills/composer-packages/SKILL.md +2 -2
  119. package/.agent-src/skills/context-authoring/SKILL.md +11 -0
  120. package/.agent-src/skills/context-document/SKILL.md +1 -1
  121. package/.agent-src/skills/copilot-agents-optimization/SKILL.md +23 -0
  122. package/.agent-src/skills/copilot-config/SKILL.md +1 -1
  123. package/.agent-src/skills/dependency-upgrade/SKILL.md +2 -2
  124. package/.agent-src/skills/devcontainer/SKILL.md +2 -2
  125. package/.agent-src/skills/developer-like-execution/SKILL.md +1 -1
  126. package/.agent-src/skills/docker/SKILL.md +1 -1
  127. package/.agent-src/skills/dto-creator/SKILL.md +1 -1
  128. package/.agent-src/skills/estimate-ticket/SKILL.md +2 -2
  129. package/.agent-src/skills/fe-design/SKILL.md +4 -4
  130. package/.agent-src/skills/feature-planning/SKILL.md +5 -5
  131. package/.agent-src/skills/funnel-analysis/SKILL.md +1 -1
  132. package/.agent-src/skills/laravel/SKILL.md +1 -1
  133. package/.agent-src/skills/laravel-notifications/SKILL.md +5 -5
  134. package/.agent-src/skills/laravel-pennant/SKILL.md +1 -1
  135. package/.agent-src/skills/laravel-pulse/SKILL.md +4 -4
  136. package/.agent-src/skills/laravel-reverb/SKILL.md +2 -2
  137. package/.agent-src/skills/laravel-scheduling/SKILL.md +1 -1
  138. package/.agent-src/skills/migration-creator/SKILL.md +7 -7
  139. package/.agent-src/skills/multi-tenancy/SKILL.md +8 -8
  140. package/.agent-src/skills/performance-analysis/SKILL.md +3 -3
  141. package/.agent-src/skills/pest-testing/SKILL.md +6 -6
  142. package/.agent-src/skills/php-service/SKILL.md +2 -2
  143. package/.agent-src/skills/project-analysis-hypothesis-driven/SKILL.md +3 -3
  144. package/.agent-src/skills/project-analysis-react/SKILL.md +1 -1
  145. package/.agent-src/skills/project-analysis-symfony/SKILL.md +1 -1
  146. package/.agent-src/skills/project-analysis-zend-laminas/SKILL.md +2 -2
  147. package/.agent-src/skills/project-analyzer/SKILL.md +4 -4
  148. package/.agent-src/skills/prompt-optimizer/SKILL.md +108 -0
  149. package/.agent-src/skills/readme-reviewer/SKILL.md +1 -1
  150. package/.agent-src/skills/rule-writing/SKILL.md +33 -0
  151. package/.agent-src/skills/sentry-integration/SKILL.md +1 -1
  152. package/.agent-src/skills/skill-writing/SKILL.md +14 -0
  153. package/.agent-src/skills/terraform/SKILL.md +2 -2
  154. package/.agent-src/skills/terragrunt/SKILL.md +8 -8
  155. package/.agent-src/skills/test-performance/SKILL.md +5 -5
  156. package/.agent-src/skills/threat-modeling/SKILL.md +2 -2
  157. package/.agent-src/skills/token-optimizer/SKILL.md +110 -0
  158. package/.agent-src/skills/universal-project-analysis/SKILL.md +1 -1
  159. package/.agent-src/templates/AGENTS.md +1 -1
  160. package/.agent-src/templates/agent-settings.md +21 -16
  161. package/.agent-src/templates/contexts/tenant-boundaries.md +2 -2
  162. package/.agent-src/templates/contexts.md +1 -1
  163. package/.agent-src/templates/copilot-instructions.md +21 -0
  164. package/.agent-src/templates/copilot-review-instructions.md +76 -0
  165. package/.agent-src/templates/features.md +1 -1
  166. package/.agent-src/templates/rule.md +127 -0
  167. package/.claude-plugin/marketplace.json +4 -1
  168. package/AGENTS.md +32 -5
  169. package/CHANGELOG.md +69 -3
  170. package/README.md +22 -21
  171. package/config/agent-settings.template.yml +44 -10
  172. package/config/gitignore-block.txt +7 -0
  173. package/docs/architecture.md +86 -5
  174. package/docs/catalog.md +16 -6
  175. package/docs/contracts/agent-memory-contract.md +1 -1
  176. package/docs/contracts/context-paths.md +2 -1
  177. package/docs/contracts/file-ownership-matrix.json +354 -500
  178. package/docs/contracts/iron-law-overrides.txt +25 -0
  179. package/docs/contracts/kernel-membership.md +273 -0
  180. package/docs/contracts/load-context-schema.md +26 -11
  181. package/docs/contracts/pilot/agent-authority.md +24 -0
  182. package/docs/contracts/pilot/direct-answers.md +70 -0
  183. package/docs/contracts/pilot/language-and-tone.md +63 -0
  184. package/docs/contracts/rule-classification.md +170 -0
  185. package/docs/contracts/rule-router.md +153 -0
  186. package/docs/customization.md +17 -6
  187. package/docs/decisions/ADR-001-kernel-swap-deferred.md +109 -0
  188. package/docs/decisions/ADR-002-kernel-bucket-overrides.md +124 -0
  189. package/docs/decisions/ADR-rule-kernel-and-router.md +122 -0
  190. package/docs/getting-started.md +2 -2
  191. package/docs/guidelines/agent-infra/roadmap-progress-mechanics.md +176 -0
  192. package/docs/guidelines/agent-infra/rule-type-governance.md +73 -0
  193. package/docs/guidelines/agent-infra/size-and-scope.md +13 -2
  194. package/docs/guidelines/agent-infra/skill-quality-checklist.md +119 -0
  195. package/docs/guidelines/augment-portability-patterns.md +68 -0
  196. package/docs/guidelines/php/php-coding-patterns.md +62 -0
  197. package/package.json +1 -1
  198. package/scripts/_p43_bodies.py +235 -0
  199. package/scripts/_p43_compress.py +118 -0
  200. package/scripts/_p4_migrate.py +199 -0
  201. package/scripts/_pilot_council_question.py +57 -0
  202. package/scripts/_pilot_measure.py +53 -0
  203. package/scripts/ai_council/session.py +107 -5
  204. package/scripts/build_linear_digest.py +3 -5
  205. package/scripts/check_always_budget.py +39 -6
  206. package/scripts/check_compressed_paths.py +213 -0
  207. package/scripts/check_compression.py +15 -0
  208. package/scripts/check_context_paths.py +1 -0
  209. package/scripts/check_council_layout.py +105 -0
  210. package/scripts/check_council_references.py +145 -0
  211. package/scripts/check_portability.py +2 -0
  212. package/scripts/check_references.py +2 -0
  213. package/scripts/check_token_optimizer_freshness.py +131 -0
  214. package/scripts/compile_router.py +148 -0
  215. package/scripts/compress.py +219 -11
  216. package/scripts/council_cli.py +9 -5
  217. package/scripts/council_prune.py +81 -0
  218. package/scripts/count_token_optimizer_usage.sh +54 -0
  219. package/scripts/install.sh +44 -2
  220. package/scripts/iron_law_sha.py +98 -0
  221. package/scripts/lint_load_context.py +35 -5
  222. package/scripts/measure_rule_budget.py +314 -0
  223. package/scripts/prototype_lint_contradictions.py +150 -0
  224. package/scripts/schemas/rule.schema.json +55 -6
  225. package/scripts/skill_linter.py +196 -6
  226. package/scripts/smoke_path_resolution.py +93 -0
  227. package/scripts/validate_frontmatter.py +41 -1
  228. package/.agent-src/contexts/communication/rules-auto/artifact-engagement-recording-mechanics.md +0 -72
  229. package/.agent-src/contexts/communication/rules-auto/augment-portability-mechanics.md +0 -79
  230. package/.agent-src/contexts/communication/rules-auto/cli-output-handling-mechanics.md +0 -87
  231. package/.agent-src/contexts/communication/rules-auto/command-suggestion-policy-mechanics.md +0 -62
  232. package/.agent-src/contexts/communication/rules-auto/docs-sync-mechanics.md +0 -78
  233. package/.agent-src/contexts/communication/rules-auto/package-ci-checks-mechanics.md +0 -85
  234. package/.agent-src/contexts/communication/rules-auto/review-routing-awareness-mechanics.md +0 -65
  235. package/.agent-src/contexts/communication/rules-auto/roadmap-progress-sync-mechanics.md +0 -78
  236. package/.agent-src/contexts/communication/rules-auto/ui-audit-gate-mechanics.md +0 -53
  237. /package/{docs → .agent-src/contexts}/contracts/artifact-engagement-flow.md +0 -0
  238. /package/{docs → .agent-src/contexts}/contracts/command-suggestion-flow.md +0 -0
@@ -0,0 +1,110 @@
1
+ ---
2
+ name: token-optimizer
3
+ description: "Use BEFORE any verbose CLI run, large file read, doc conversion, or near-context handoff — single decision tree keyed by intent that cites the canonical token-saving asset. Consult before the action."
4
+ source: package
5
+ execution:
6
+ type: assisted
7
+ handler: shell
8
+ allowed_tools: []
9
+ ---
10
+
11
+ # Token Optimizer — decision tree + catalog
12
+
13
+ ## Iron Law
14
+
15
+ ```
16
+ CONSULT THIS SKILL BEFORE THE ACTION, NOT AFTER.
17
+ THE TREE NAMES THE CANONICAL ASSET — DO NOT RESTATE OR DUPLICATE IT.
18
+ ```
19
+
20
+ ## When to use
21
+
22
+ Proactively, BEFORE you:
23
+
24
+ - Run a verbose CLI command (tests, linters, build, git log, large `grep`)
25
+ - Read or paste a large document, log, or tool dump
26
+ - Repeat the same tool call across many files / records
27
+ - Approach the context-window limit and need to hand off
28
+ - Make a cost-aware decision (which model, which budget, when to stop)
29
+
30
+ Reactively when output already burned tokens — record the lesson, do
31
+ not re-explore. Cite the leaf, move on.
32
+
33
+ ## Procedure
34
+
35
+ 1. **Classify intent** — match the situation to one branch of the tree below.
36
+ 2. **Cite the leaf** — name the canonical asset (rule, skill, or upstream link).
37
+ 3. **Apply** — execute the cited asset's contract; do NOT inline its content.
38
+ 4. **Verify** — output respects the cited Iron Law (redirect, wrap, batch, etc.).
39
+
40
+ ### Decision tree
41
+
42
+ ```
43
+ INTENT
44
+ ├── Verbose CLI output incoming
45
+ │ → cite [cli-output-handling](../../rules/cli-output-handling.md)
46
+ │ (Iron Law: redirect / tail / grep / wrap)
47
+ │ → cite [rtk-output-filtering](../rtk-output-filtering/SKILL.md)
48
+ │ (rtk wrapper, 60-90% savings on tests/linters/git)
49
+
50
+ ├── Large document or paste (PDF, DOCX, HTML, transcript)
51
+ │ → cite markitdown (upstream: https://github.com/microsoft/markitdown)
52
+ │ Convert FIRST, then read the markdown — never paste raw binary.
53
+
54
+ ├── Repeated tool-call across N targets
55
+ │ → cite [token-efficiency](../../rules/token-efficiency.md)
56
+ │ (batch, parallelize, prune; one tool call > many)
57
+
58
+ ├── Near context limit, work not finished
59
+ │ → cite [agent-handoff](../../../.claude/skills/agent-handoff/SKILL.md)
60
+ │ (structured handoff envelope; resume in fresh chat)
61
+
62
+ └── Cost-aware decision (model pick, budget, stop-criterion)
63
+ → cite /cost:report (when shipped) — until then, fall back to
64
+ [token-efficiency](../../rules/token-efficiency.md) and
65
+ [direct-answers § Brevity by Default](../../rules/direct-answers.md)
66
+ ```
67
+
68
+ ## Catalog
69
+
70
+ | Asset | Path | Trigger keywords | What it does |
71
+ |---|---|---|---|
72
+ | `cli-output-handling` | `.agent-src.uncompressed/rules/cli-output-handling.md` | `verbose`, `tail`, `grep`, `CLI` | Wrap-tail-grep contract for any verbose command |
73
+ | `rtk-output-filtering` | `.agent-src.uncompressed/skills/rtk-output-filtering/SKILL.md` | `rtk`, `verbose`, `filter`, `wrap` | Project-local rtk filters; wrapper command |
74
+ | `token-efficiency` | `.agent-src.uncompressed/rules/token-efficiency.md` | `redirect`, `verbose`, `concise`, `tool` | Batch + parallelize tool calls; brevity floor |
75
+ | `agent-handoff` | `.claude/skills/agent-handoff/SKILL.md` | `handoff`, `fresh`, `chat`, `context` | Context envelope for fresh-chat continuation |
76
+ | `direct-answers` | `.agent-src.uncompressed/rules/direct-answers.md` | `brevity`, `flattery`, `severity`, `tiered` | Iron-Law brevity floor (kernel) |
77
+ | `markitdown` | upstream: github.com/microsoft/markitdown | `PDF`, `DOCX`, `HTML`, `convert` | Document → markdown converter (authoritative-link only) |
78
+ | `/cost:report` | TBD — `road-to-ruflo-adoption.md § P1.2` | `cost`, `model spend`, `budget` | Per-session cost telemetry (planned) |
79
+
80
+ ## Output format
81
+
82
+ 1. Name the cited asset by its leaf id (e.g. `cli-output-handling`, `rtk-output-filtering`).
83
+ 2. State the Iron Law in one line; do NOT inline the asset's body.
84
+ 3. If multiple branches match, cite all relevant leaves (no merge, no rewrite).
85
+ 4. End with the action you take next, citing the asset that authorizes it.
86
+
87
+ ## Gotcha
88
+
89
+ - Catalog rows live and die with their target asset. If you edit a
90
+ cited asset's trigger keywords or scope, update the matching row in
91
+ this skill in the same commit (enforced by
92
+ [`token-optimizer-maintenance`](../../rules/token-optimizer-maintenance.md)
93
+ rule + `scripts/check_token_optimizer_freshness.py` CI gate).
94
+ - Tree must stay scannable (≤ 50 lines incl. labels). Catalog rows
95
+ carry the long form.
96
+ - Authoritative-link assets (`rtk` upstream, `markitdown` upstream,
97
+ pricing constants) are never copied — always linked.
98
+
99
+ ## Do NOT
100
+
101
+ - Do NOT inline content from a cited asset. If the leaf is "rtk does X",
102
+ the agent reads `rtk-output-filtering`. Duplication = drift = stale.
103
+ - Do NOT replace any rule. The rules carry the Iron Laws; this skill
104
+ carries the lookup index.
105
+ - Do NOT define new policies — every leaf must cite an existing rule,
106
+ skill, or upstream asset.
107
+ - Do NOT consult this skill AFTER tokens were already burned — record
108
+ the lesson and move on.
109
+
110
+ <!-- TELEMETRY: consulted=[uncomment + ISO timestamp on each consult] context=[CLI|doc|repeat|handoff|cost] -->
@@ -71,7 +71,7 @@ Goal: understand structure, identify major components, detect investigation path
71
71
  ### Investigation mode
72
72
 
73
73
  Use when there is a concrete issue inside a large or unclear system.
74
- Goal: isolate the affected area, route into root-cause analysis, verify likely causes with evidence.
74
+ Goal: isolate the affected area, route into root-cause analysis, verify likely with evidence.
75
75
 
76
76
  ### Optimization mode
77
77
 
@@ -113,7 +113,7 @@ Regenerate: `task generate-tools` · Clean: `task clean-tools`
113
113
  |---|---|
114
114
  | `.env` | Main environment |
115
115
  | `.env.local` | Local overrides |
116
- | `.env.testing` | Testing environment |
116
+ | `.env.testing` | Testing env |
117
117
 
118
118
  ---
119
119
 
@@ -14,7 +14,7 @@ Keep the format regular — 2-space indent, no tabs, no lists, one nesting
14
14
  level only. The installer's YAML handler is a restricted stdlib parser, not
15
15
  a full YAML engine. Ask the agent to normalize after manual edits — it
16
16
  follows the merge rules in
17
- [`layered-settings`](../../docs/guidelines/agent-infra/layered-settings.md#section-aware-merge-rules).
17
+ [`layered-settings`](../docs/guidelines/agent-infra/layered-settings.md#section-aware-merge-rules).
18
18
 
19
19
  ### Migration from the legacy `.agent-settings` (key=value)
20
20
 
@@ -36,7 +36,7 @@ This block defines the personal and project-level settings that
36
36
  `scripts/install.py` (via `config/agent-settings.template.yml`)
37
37
  writes to `.agent-settings.yml` on first install. Subsequent edits are
38
38
  made by the user directly or by the agent on request, following the
39
- [section-aware merge rules](../../docs/guidelines/agent-infra/layered-settings.md#section-aware-merge-rules).
39
+ [section-aware merge rules](../docs/guidelines/agent-infra/layered-settings.md#section-aware-merge-rules).
40
40
 
41
41
  ```yaml
42
42
  # Agent Settings
@@ -45,14 +45,19 @@ made by the user directly or by the agent on request, following the
45
45
 
46
46
  # --- Cost profile ---
47
47
  #
48
- # Controls which agent surfaces are active. See `docs/customization.md` for
49
- # the authoritative description.
48
+ # Master switch that controls which rule tiers load each session.
49
+ # See `docs/customization.md` for the authoritative description and
50
+ # `docs/contracts/rule-router.md` for the kernel + router architecture.
50
51
  #
51
- # minimal = rules, skills, and commands only (zero extra surface, default)
52
- # balanced = + runtime dispatcher for skills that declare a shell command
53
- # full = + tool adapters (GitHub / Jira, read-only, opt-in)
54
- # custom = ignore profile every matrix value must be set explicitly
55
- cost_profile: minimal
52
+ # minimal = kernel only (always-loaded Iron-Law floor, ≤ 26k chars).
53
+ # No router, no auto-rules. Lowest token footprint.
54
+ # balanced = kernel + router + tier-1 auto-rules (default current behaviour
55
+ # superset; matches what existing consumer projects expect).
56
+ # full = kernel + tier-1 + tier-2 (everything). Highest fidelity,
57
+ # highest token cost. Pick this when working on agent-config
58
+ # itself or when you need every behavioural rule active.
59
+ # custom = ignore profile — every matrix value must be set explicitly.
60
+ cost_profile: balanced
56
61
 
57
62
  # --- Personal preferences ---
58
63
  personal:
@@ -294,8 +299,8 @@ commands:
294
299
  # rules, commands, guidelines, personas) the agent consulted and
295
300
  # applied. Local only, append-only JSONL, never reaches a consumer
296
301
  # repo (gitignored). Maintainer-targeted feature; consumers leave it
297
- # off. See `docs/contracts/artifact-engagement-flow.md` (once Phase 3
298
- # of road-to-artifact-engagement-telemetry lands).
302
+ # off. See `.augment/contexts/contracts/artifact-engagement-flow.md`
303
+ # (once Phase 3 of road-to-artifact-engagement-telemetry lands).
299
304
  telemetry:
300
305
  artifact_engagement:
301
306
  # Master switch. `false` (default) produces zero file IO and zero
@@ -323,7 +328,7 @@ telemetry:
323
328
 
324
329
  Personal and project-level settings (initial file written by
325
330
  `scripts/install.py`, edits follow the merge rules in
326
- [`layered-settings`](../../docs/guidelines/agent-infra/layered-settings.md#section-aware-merge-rules)).
331
+ [`layered-settings`](../docs/guidelines/agent-infra/layered-settings.md#section-aware-merge-rules)).
327
332
  **Key paths use dot-notation** to denote nesting: `personal.user_name`
328
333
  lives under `personal:` in YAML.
329
334
 
@@ -353,16 +358,16 @@ lives under `personal:` in YAML.
353
358
  | `hooks.halt_surface_audit` | `true`, `false` | `true` | Defense-in-depth check that every halt surfaced by the dispatcher carries the expected shape. Cheap. |
354
359
  | `hooks.state_shape_validation` | `true`, `false` | `true` | Re-run the state schema validator on `AFTER_LOAD` and `BEFORE_SAVE`. Cheap, catches drift. |
355
360
  | `hooks.directive_set_guard` | `true`, `false` | `true` | Verify the dispatcher-resolved directive set matches the input envelope intent. Cheap, catches routing drift. |
356
- | `hooks.chat_history.enabled` | `true`, `false` | `true` | Register chat-history hooks (`append` on `after_step`, `halt_append` on `on_halt`). Gated by **both** this flag AND `chat_history.enabled`; either off → no chat-history hook registers. Schema v4: every entry self-identifies via 16-char session fingerprint, no ownership/sidecar layer. |
361
+ | `hooks.chat_history.enabled` | `true`, `false` | `true` | Register the chat-history hooks (`append` on `after_step`, `halt_append` on `on_halt`). Gated by **both** this flag AND `chat_history.enabled`; either off → no chat-history hook registers. Schema v4: every entry self-identifies via a 16-char session fingerprint, no ownership/sidecar layer. |
357
362
  | `hooks.chat_history.script` | path | `scripts/chat_history.py` | Override path to the chat-history CLI. Set only when the script lives outside the standard location. |
358
363
  | `pipelines.skill_improvement` | `true`, `false` | `true` | When `true`: propose learning capture after meaningful tasks. When `false`: silent. Included in every profile except `custom`. |
359
364
  | `roadmap.quality_cadence` | `end_of_roadmap`, `per_phase`, `per_step` | `end_of_roadmap` | When `/roadmap execute` runs the project's quality pipeline. Default skips per-step / per-phase runs and gates only the final archival. `per_phase` runs once after every phase; `per_step` is the legacy verbose mode. Step checkboxes and the dashboard are always updated regardless. `verify-before-complete` still requires fresh output before any "roadmap complete" claim. |
360
365
  | `subagents.implementer_model` | model alias or empty | _(empty)_ | Model for implementer subagents. Empty = same tier as session model. See [subagent-configuration](../contexts/subagent-configuration.md). |
361
366
  | `subagents.judge_model` | model alias or empty | _(empty)_ | Model for judge subagents. Empty = one tier above implementer (opus if sonnet, sonnet if haiku). |
362
367
  | `subagents.max_parallel` | integer | `3` | Maximum parallel subagent invocations. `1` serializes. |
363
- | `roles.default_role` | `""`, `developer`, `reviewer`, `tester`, `po`, `incident`, `planner` | _(empty)_ | Role the agent defaults to at the start of a session. See [`role-contracts`](../../docs/guidelines/agent-infra/role-contracts.md). |
368
+ | `roles.default_role` | `""`, `developer`, `reviewer`, `tester`, `po`, `incident`, `planner` | _(empty)_ | Role the agent defaults to at the start of a session. See [`role-contracts`](../docs/guidelines/agent-infra/role-contracts.md). |
364
369
  | `roles.active_role` | same as `default_role` | _(empty)_ | Role currently active; set by `/mode <name>`, cleared by `/mode none`. Enables the `role-mode-adherence` rule. |
365
- | `personas.override` | list of persona ids | `[]` | Developer-local override of the team default lens cast. Empty = inherit `personas.default` from `.agent-project-settings.yml`. See [`layered-settings`](../../docs/guidelines/agent-infra/layered-settings.md). |
370
+ | `personas.override` | list of persona ids | `[]` | Developer-local override of the team default lens cast. Empty = inherit `personas.default` from `.agent-project-settings.yml`. See [`layered-settings`](../docs/guidelines/agent-infra/layered-settings.md). |
366
371
  | `personas.ignore` | list of persona ids | `[]` | Persona ids dropped from the default cast locally. Ignored personas stay invokable via `--personas=<id>`. |
367
372
  | `onboarding.onboarded` | `true`, `false` | `false` | Whether `/onboard` has run on this project. The `onboarding-gate` rule prompts for `/onboard` when this is `false`. Missing entirely = legacy project, treated as onboarded. |
368
373
  | `commands.suggestion.enabled` | `true`, `false` | `true` | Master switch for the command-suggestion layer. `false` = the layer is silent; explicit `/commands` still work. See `rules/command-suggestion-policy.md`. |
@@ -427,7 +432,7 @@ they ship with a live consumer in code and get documented here, not before.
427
432
  ## Sync rules
428
433
 
429
434
  When new settings are added to this template, the
430
- [section-aware merge rules](../../docs/guidelines/agent-infra/layered-settings.md#section-aware-merge-rules)
435
+ [section-aware merge rules](../docs/guidelines/agent-infra/layered-settings.md#section-aware-merge-rules)
431
436
  govern the update:
432
437
 
433
438
  1. Missing keys are added with their **default value** from this template,
@@ -16,10 +16,10 @@
16
16
  - [ ] **Single-tenant** — one database per deployment. No cross-tenant
17
17
  leakage is possible at the infra layer. Delete this file if true
18
18
  and the app will never shard.
19
- - [ ] **Multi-tenant, shared database** — one table with a tenant key
19
+ - [ ] **Multi-tenant, shared DB** — one table with a tenant key
20
20
  column (e.g., `tenant_id`, `workspace_id`).
21
21
  - [ ] **Multi-tenant, schema per tenant** — one DB, one schema each.
22
- - [ ] **Multi-tenant, database per tenant** — each tenant has its own
22
+ - [ ] **Multi-tenant, DB per tenant** — each tenant has its own
23
23
  connection.
24
24
 
25
25
  ## Tenant identifier
@@ -24,7 +24,7 @@ agents (and developers) quickly orient themselves when working in that area.
24
24
  |---|---|---|
25
25
  | **Module** | Document a module's structure and purpose | `client-software.md` |
26
26
  | **Domain** | Document a business domain across modules | `import-pipeline.md` |
27
- | **Service** | Document a complex service and its dependencies | `customer-service.md` |
27
+ | **Service** | Document a complex service and its deps | `customer-service.md` |
28
28
  | **Integration** | Document an external API/system integration | `probaus-api.md` |
29
29
  | **Infrastructure** | Document infrastructure or DevOps concerns | `queue-system.md` |
30
30
 
@@ -86,6 +86,27 @@ This repository contains {{project_description_oneline}}.
86
86
  - Do NOT review or suggest changes to unmodified code in the same file.
87
87
  - Do NOT nitpick style issues that linters/formatters auto-fix.
88
88
 
89
+ ## ✅ Known False Positives — Do NOT Flag
90
+
91
+ The repo ships agent-config rules and skills under `.augment/`,
92
+ `.agent-src/`, and `.agent-src.uncompressed/`. These trees use a
93
+ deliberate path convention; the following patterns are **correct by
94
+ design** — do not flag them as broken:
95
+
96
+ - **Relative cross-references inside markdown rules / skills** like
97
+ `[x](../docs/guidelines/foo.md)` or `[y](../contexts/bar.md)`. The
98
+ base resolves from the file's delivered location (e.g.
99
+ `.augment/rules/<rule>.md`) — these paths are valid via the
100
+ `.augment/` tree, even when the file is symlinked into
101
+ `.claude/rules/`, `.cursor/rules/`, or `.clinerules/`.
102
+ - **`path_prefix:` triggers containing `.agent-src.uncompressed/`**
103
+ in YAML frontmatter. This is a literal match pattern for the
104
+ host's router, **not** a file reference — keeping the verbatim
105
+ source path is required for the rule to fire on the right edits.
106
+ - **Symlinked rule files** under `.claude/rules/`, `.cursor/rules/`,
107
+ `.clinerules/`. Targets resolve into `.augment/rules/`; missing-file
108
+ reports here are renderer artifacts, not real bugs.
109
+
89
110
  ## ✅ Code Review Comment Behavior
90
111
 
91
112
  - **Never create duplicate comments** — one comment per concern per location.
@@ -0,0 +1,76 @@
1
+ # Copilot Code Review — Repository-Specific Suppressions
2
+
3
+ > Read by GitHub Copilot Code Review (PR bot) when reviewing this repo.
4
+ > Companion to `.github/copilot-instructions.md`. **This file is the
5
+ > path-resolution suppression floor** — it carries the rules Copilot
6
+ > needs to *not* flag, sharply scoped to the agent-config layout.
7
+
8
+ ## Why this file exists
9
+
10
+ The repo ships agent-config rules, skills, commands, and contexts under
11
+ `.augment/`, `.agent-src/`, and (during authoring) `.agent-src.uncompressed/`.
12
+ Cross-references inside those trees are valid via the **delivered**
13
+ `.augment/` layout — not via raw git checkout. Copilot's static checker
14
+ walks the git tree, so it sees broken paths where there are none.
15
+
16
+ This is **intentional, not a bug**. The installer (`scripts/install.sh`)
17
+ projects `.agent-src/` → `.augment/` and creates the symlinks that make
18
+ the paths resolve at agent runtime.
19
+
20
+ ## ✅ Known False Positives — Do NOT Flag
21
+
22
+ ### Relative cross-references inside markdown rules / skills / commands
23
+
24
+ ```markdown
25
+ [link](../docs/guidelines/foo.md)
26
+ [link](../contexts/bar.md)
27
+ [link](../docs/guidelines/baz.md)
28
+ ```
29
+
30
+ These resolve from the file's delivered location (e.g.
31
+ `.augment/rules/<rule>.md`). Even when the file is symlinked into
32
+ `.claude/rules/`, `.cursor/rules/`, or `.clinerules/`, the relative
33
+ form is correct by construction.
34
+
35
+ ### `path_prefix:` triggers containing `.agent-src.uncompressed/`
36
+
37
+ ```yaml
38
+ triggers:
39
+ - path_prefix: ".agent-src.uncompressed/rules/"
40
+ ```
41
+
42
+ This is a **literal match string** for the host's router — *not* a file
43
+ reference. Source-of-truth meta-rules (`augment-source-of-truth`,
44
+ `augment-portability`, `skill-quality`, `docs-sync`,
45
+ `rule-type-governance`) legitimately match against the authoring tree.
46
+
47
+ ### Symlinked rule / skill / command files
48
+
49
+ Targets resolve into `.augment/rules/`, `.augment/skills/`,
50
+ `.augment/commands/` via installer-managed symlinks. Missing-file
51
+ reports under `.claude/`, `.cursor/`, `.clinerules/` are renderer
52
+ artifacts, not real bugs.
53
+
54
+ ### Body-link forms `../docs/guidelines/...`
55
+
56
+ Single-up form is the post-rewrite shape produced by
57
+ `scripts/compress.py`. The compressed `.agent-src/rules/` tree is one
58
+ level deeper than the source `.agent-src.uncompressed/rules/`, so the
59
+ rewriter collapses `../../docs/...` to `../docs/...`. Both forms are
60
+ expected — one in source, one in compressed output.
61
+
62
+ ## ✅ What TO flag
63
+
64
+ - Code defects, security issues, broken tests, type errors — normal
65
+ review.
66
+ - New `.agent-src.uncompressed/` substrings introduced into
67
+ `.agent-src/rules/` body content (the `check-compressed-paths` task
68
+ already gates this — flag it as a regression if it slips through).
69
+ - Rule frontmatter with `load_context:` entries that don't follow the
70
+ logical-name convention (`contexts/<area>/<file>.md`).
71
+
72
+ ## Pointer
73
+
74
+ The full architecture is in `docs/architecture.md` § "Path resolution
75
+ and Copilot integration". The compressed-path validator is
76
+ `scripts/check_compressed_paths.py`, wired into `task ci`.
@@ -22,7 +22,7 @@ Templates for feature plan files stored in `agents/features/` or `app/Modules/{M
22
22
  | 💡 | Idea | Rough concept, not yet validated |
23
23
  | 🔍 | Exploring | Being researched and brainstormed |
24
24
  | 📋 | Planned | Structured plan complete, ready for roadmap |
25
- | 🗺️ | Roadmapped | Roadmap(s) generated, ready for implementation |
25
+ | 🗺️ | Roadmapped | Roadmap(s) generated, ready for impl |
26
26
  | 🔄 | In Progress | Implementation started |
27
27
  | ✅ | Complete | Feature shipped |
28
28
  | ❌ | Rejected | Decided not to build |
@@ -0,0 +1,127 @@
1
+ # Rule Template
2
+
3
+ > Template for creating new rules in `.agent-src.uncompressed/rules/{rule-name}.md`.
4
+ > Rules ship to `.agent-src/rules/` (compressed) and `.augment/rules/` (projected).
5
+ > Schema: `scripts/schemas/rule.schema.json`.
6
+
7
+ ## Instructions
8
+
9
+ 1. Pick a kebab-case `{rule-name}` matching the file stem.
10
+ 2. Copy the template below into `.agent-src.uncompressed/rules/{rule-name}.md`.
11
+ 3. Replace placeholders, drop sections that don't apply.
12
+ 4. Run `task lint-skills` and `python3 scripts/lint_load_context.py`.
13
+ 5. Compress: `bash scripts/compress.sh --changed` then follow the agent flow.
14
+
15
+ ## Path conventions — load-bearing
16
+
17
+ Two different fields, two different rules. Mixing them up will either
18
+ break linting or produce paths that resolve to nothing in the
19
+ consumer's `.augment/`.
20
+
21
+ ### `load_context:` / `load_context_eager:` — logical names
22
+
23
+ Use **logical names** rooted at the source — never the
24
+ `.agent-src.uncompressed/` prefix. The compress-time rewriter
25
+ (`scripts/compress.py::_rewrite_paths`) resolves logical names to
26
+ deployment-correct relative paths; the schema regex
27
+ (`scripts/schemas/rule.schema.json`) and `scripts/lint_load_context.py`
28
+ both reject the legacy prefix.
29
+
30
+ | Write this (logical) | Forbidden (legacy) |
31
+ |---|---|
32
+ | `contexts/execution/verification-mechanics.md` | `.agent-src.uncompressed/contexts/execution/verification-mechanics.md` |
33
+ | `contexts/authority/commit-mechanics.md` | `.agent-src.uncompressed/contexts/authority/commit-mechanics.md` |
34
+ | `agents/contexts/local.md` (project-local) | `.agent-src.uncompressed/contexts/...` for project-only material |
35
+
36
+ ### `triggers[].path_prefix:` — literal match pattern, not a file path
37
+
38
+ `path_prefix:` is a **literal match pattern** the host evaluates against
39
+ the file the agent is editing — it is **not** a file reference and is
40
+ **not rewritten**. Rules that fire when the agent edits source-of-truth
41
+ files legitimately keep the `.agent-src.uncompressed/` prefix (see
42
+ `skill-quality`, `docs-sync`, `rule-type-governance`,
43
+ `augment-portability`). Rules that fire on consumer-project paths use
44
+ `agents/`, `lang/`, `.augment/`, etc.
45
+
46
+ | Use case | Example `path_prefix:` |
47
+ |---|---|
48
+ | Fires when editing source-of-truth artifacts | `.agent-src.uncompressed/skills/` |
49
+ | Fires when editing consumer project files | `agents/`, `lang/`, `app/`, `src/` |
50
+ | Fires when editing the projected layer | `.augment/` |
51
+
52
+ ### Body links — `../../docs/...` is fine in source
53
+
54
+ Source files keep verbatim `../../docs/guidelines/...` and
55
+ `../../docs/contracts/...` links so they work in any markdown viewer.
56
+ The rewriter rewrites them to depth-aware single-up form at compress
57
+ time and is idempotent. Do not pre-rewrite in source.
58
+
59
+ ### Why "logical, depth-aware, idempotent"
60
+
61
+ A rule at `rules/{name}.md` resolves `contexts/{area}/{file}.md` to
62
+ `../contexts/{area}/{file}.md` in the compressed output; a nested
63
+ file at `commands/{cluster}/{sub}.md` resolves to
64
+ `../../contexts/{area}/{file}.md`. Re-running the rewriter does not
65
+ double-prefix. The full decision history lives in the archived
66
+ path-fixes roadmap under `agents/roadmaps/archive/`.
67
+
68
+ ## Template
69
+
70
+ ````markdown
71
+ ---
72
+ type: "always"
73
+ tier: "kernel"
74
+ description: "{One-line trigger sentence — what fires this rule}"
75
+ source: package
76
+ load_context:
77
+ - contexts/{area}/{file}.md
78
+ triggers:
79
+ - path_prefix: "{project-relative path or .augment/...}"
80
+ - keyword: "{trigger-keyword}"
81
+ routes_to:
82
+ - "skill:{target-skill}"
83
+ ---
84
+
85
+ # {Rule Title}
86
+
87
+ **Iron Law.** {The single non-negotiable behavior the rule enforces.}
88
+
89
+ ## When this fires
90
+
91
+ {1–3 bullets on the trigger surface — what the agent is doing when this rule applies.}
92
+
93
+ ## What to do
94
+
95
+ {Numbered procedure or short directive list. Reference skills / guidelines
96
+ for full detail; rules are pointers, not playbooks.}
97
+
98
+ ## What NOT to do
99
+
100
+ - {Anti-pattern 1}
101
+ - {Anti-pattern 2}
102
+
103
+ ## See also
104
+
105
+ - [`{related-rule}`](./{related-rule}.md)
106
+ - [`{guideline-ref}`](docs/guidelines/{group}/{name}.md) — full pattern catalog
107
+ ````
108
+
109
+ ## Field reference
110
+
111
+ | Field | Required | Notes |
112
+ |---|---|---|
113
+ | `type` | yes | `always` or `auto`. Always-rules load every turn; auto-rules require trigger match. |
114
+ | `tier` | yes | `kernel` (Iron Law floor), `tier-1` (default), `tier-2` (full profile only). Legacy values still accepted. |
115
+ | `description` | yes | One sentence, ≤ 500 chars. Trigger-clarity wins over poetry. |
116
+ | `source` | yes | `package` (this repo) or `project` (consumer override). |
117
+ | `load_context` | no | Lazy context list — logical names only. Budget enforced by `lint_load_context.py`. |
118
+ | `load_context_eager` | no | Eager context list — counts against per-rule char budget. |
119
+ | `triggers` | no | Required on non-kernel rules per `rule-router.md`. |
120
+ | `routes_to` | no | `skill:`, `guideline:`, `command:`, `contract:` targets. Forbidden on kernel rules. |
121
+ | `alwaysApply` | no | Cursor/Cline sidecar — by convention `true` for `type: always`. |
122
+
123
+ ## Size budget
124
+
125
+ - Kernel rules: ≤ 4 000 chars (Iron-Law overrides documented in `docs/contracts/iron-law-overrides.txt`).
126
+ - Non-kernel rules: ≤ 2 500 chars.
127
+ - Enforced by `task lint-rule-budget`.
@@ -6,7 +6,7 @@
6
6
  },
7
7
  "metadata": {
8
8
  "description": "Shared agent configuration \u2014 skills for AI coding tools (Claude Code, Augment, Cursor, Cline, Windsurf, Gemini CLI).",
9
- "version": "1.20.0"
9
+ "version": "1.21.0"
10
10
  },
11
11
  "plugins": [
12
12
  {
@@ -157,6 +157,7 @@
157
157
  "./.claude/skills/optimize",
158
158
  "./.claude/skills/optimize-agents",
159
159
  "./.claude/skills/optimize-augmentignore",
160
+ "./.claude/skills/optimize-prompt",
160
161
  "./.claude/skills/optimize-rtk",
161
162
  "./.claude/skills/optimize-skills",
162
163
  "./.claude/skills/override",
@@ -185,6 +186,7 @@
185
186
  "./.claude/skills/project-analyzer",
186
187
  "./.claude/skills/project-docs",
187
188
  "./.claude/skills/project-health",
189
+ "./.claude/skills/prompt-optimizer",
188
190
  "./.claude/skills/quality-fix",
189
191
  "./.claude/skills/quality-tools",
190
192
  "./.claude/skills/react-shadcn-ui",
@@ -229,6 +231,7 @@
229
231
  "./.claude/skills/tests-execute",
230
232
  "./.claude/skills/threat-model",
231
233
  "./.claude/skills/threat-modeling",
234
+ "./.claude/skills/token-optimizer",
232
235
  "./.claude/skills/traefik",
233
236
  "./.claude/skills/unit-economics-modeling",
234
237
  "./.claude/skills/universal-project-analysis",
package/AGENTS.md CHANGED
@@ -111,7 +111,7 @@ want to measure which skills/rules/commands the agent actually applies set
111
111
  `telemetry.artifact_engagement.enabled: true` in `.agent-settings.yml`. The
112
112
  log is local-only JSONL (no upload, no cross-project share) and is bound
113
113
  by the redaction floor described in
114
- [`docs/contracts/artifact-engagement-flow.md`](docs/contracts/artifact-engagement-flow.md) (beta).
114
+ [`contexts/contracts/artifact-engagement-flow.md`](.agent-src.uncompressed/contexts/contracts/artifact-engagement-flow.md) (beta).
115
115
  The recording rule lives at
116
116
  [`.agent-src/rules/artifact-engagement-recording.md`](.agent-src/rules/artifact-engagement-recording.md).
117
117
 
@@ -125,7 +125,7 @@ picks every time. Engine: `scripts/command_suggester/`. Rule:
125
125
  Locked eligibility table, scoring contract, and hardening list:
126
126
  [`docs/contracts/adr-command-suggestion.md`](docs/contracts/adr-command-suggestion.md)
127
127
  and
128
- [`docs/contracts/command-suggestion-flow.md`](docs/contracts/command-suggestion-flow.md) (beta).
128
+ [`contexts/contracts/command-suggestion-flow.md`](.agent-src.uncompressed/contexts/contracts/command-suggestion-flow.md) (beta).
129
129
 
130
130
  ## Key rules for agents editing this repo
131
131
 
@@ -139,19 +139,46 @@ and
139
139
  | Keep `.agent-src/` / `agents/` cross-refs in sync on add/rename/delete | [`docs-sync`](.agent-src/rules/docs-sync.md) |
140
140
  | Creating a new skill/rule/command/guideline runs Understand → Research → Draft | [`artifact-drafting-protocol`](.agent-src/rules/artifact-drafting-protocol.md) |
141
141
 
142
+ ## Kernel + Router
143
+
144
+ The rule set runs on a **Kernel + Router** model (locked 2026-05-06,
145
+ see [`docs/decisions/ADR-rule-kernel-and-router.md`](docs/decisions/ADR-rule-kernel-and-router.md)):
146
+
147
+ - **Kernel** = 9 always-loaded Iron-Law rules, ≤ 26k chars
148
+ (`agent-authority`, `ask-when-uncertain`, `commit-policy`,
149
+ `direct-answers`, `language-and-tone`, `no-cheap-questions`,
150
+ `non-destructive-by-default`, `scope-control`, `verify-before-complete`).
151
+ Locked set: [`docs/contracts/kernel-membership.md`](docs/contracts/kernel-membership.md) (beta).
152
+ - **Router** = frontmatter `tier:` + `triggers:` + `routes_to:` keys
153
+ on every rule. `scripts/compile_router.py` builds `router.json`
154
+ deterministically. Contract: [`docs/contracts/rule-router.md`](docs/contracts/rule-router.md) (beta).
155
+ - **Cost profiles** gate which tiers load:
156
+ `minimal` = kernel only · `balanced` = kernel + tier-1 (default) ·
157
+ `full` = kernel + tier-1 + tier-2.
158
+
159
+ Hard caps enforced by `task lint-rule-budget`: kernel-bucket ≤ 26k chars,
160
+ per-rule ≤ 2.5k chars (Iron-Law overrides up to 4.0k via ADR in
161
+ [`docs/decisions/`](docs/decisions/) and
162
+ [`docs/contracts/iron-law-overrides.txt`](docs/contracts/iron-law-overrides.txt)).
163
+ Daily snapshots: `python3 scripts/measure_rule_budget.py --trend-append`
164
+ appends to `agents/.rule-budget-history.jsonl`.
165
+
142
166
  ## Repository layout
143
167
 
144
168
  ```
145
169
  .agent-src.uncompressed/ ← edit here
146
- skills/ (134 skills)
147
- rules/ (56 rules)
148
- commands/ (94 commands)
170
+ skills/ (136 skills)
171
+ rules/ (58 rules)
172
+ commands/ (95 commands)
149
173
  personas/ (7 personas)
150
174
  templates/ (AGENTS.md, copilot-instructions.md, skill.md, …)
151
175
  contexts/
152
176
 
153
177
  docs/guidelines/ (47 guidelines — reference material, not packaged)
178
+ docs/contracts/ (kernel-membership, rule-router, rule-classification, …)
179
+ docs/decisions/ (ADRs — kernel overrides, scope decisions)
154
180
  .agent-src/ ← compressed output shipped in the package
181
+ .agent-src/router.json ← compiled router manifest (consumed at runtime)
155
182
  .augment/ ← local projection for Augment Code (gitignored)
156
183
  scripts/ ← install.sh, install.py, compress.py, linters
157
184
  tests/ ← pytest (324 tests) + test_install.sh