@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,122 @@
1
+ # ADR โ€” Rule Kernel and Router (Roadmap Closure)
2
+
3
+ - **Status:** Accepted (2026-05-06)
4
+ - **Closes:** `agents/roadmaps/road-to-kernel-and-router.md`
5
+ - **Sibling roadmaps closed in the same window:**
6
+ `agents/roadmaps/road-to-token-optimization.md`
7
+ (Phase 1 shipped, Phase 2/3 deferred-with-trigger by design),
8
+ `agents/roadmaps/road-to-package-optimization.md`
9
+ (closed with null result per P1.1 binary acceptance gate).
10
+ - **Related ADRs:** ADR-001 (kernel-swap deferred), ADR-002
11
+ (kernel-bucket cap raise 25k โ†’ 26k, per-rule Iron-Law overrides).
12
+
13
+ ## Context
14
+
15
+ The agent rule set was an "always-loaded" surface: every conversation
16
+ paid the full 193k-char rule cost regardless of task. There was no
17
+ deterministic way to load only the policy actually relevant to the
18
+ current intent, and no mechanical guard against rule-bucket creep.
19
+
20
+ ## Decision
21
+
22
+ Adopt a **Kernel + Router** loading model with three tiers and three
23
+ cost profiles, governed by a compiled router manifest and CI-enforced
24
+ size budgets.
25
+
26
+ ### What shipped
27
+
28
+ - **Kernel:** 9 always-loaded Iron-Law rules (`agent-authority`,
29
+ `ask-when-uncertain`, `commit-policy`, `direct-answers`,
30
+ `language-and-tone`, `no-cheap-questions`,
31
+ `non-destructive-by-default`, `scope-control`,
32
+ `verify-before-complete`). Locked set:
33
+ [`docs/contracts/kernel-membership.md`](../contracts/kernel-membership.md).
34
+ - **Router:** `router.json` compiled deterministically from rule
35
+ frontmatter (`tier:`, `triggers:`, `routes_to:`) by
36
+ `scripts/compile_router.py`. Contract:
37
+ [`docs/contracts/rule-router.md`](../contracts/rule-router.md).
38
+ - **Cost profiles:** `minimal` = kernel only ยท `balanced` = kernel +
39
+ tier-1 (default) ยท `full` = kernel + tier-1 + tier-2.
40
+ - **Budget gates:** `task lint-rule-budget` enforces kernel โ‰ค 26k chars
41
+ and per-rule โ‰ค 2.5k (Iron-Law overrides up to 4.0k via ADR-002).
42
+ Daily snapshots in `agents/.rule-budget-history.jsonl`.
43
+ - **Compression discipline:** P4.3 brought the auto-bucket from
44
+ ~75k โ†’ 59 220 chars (under the 60k target) without behaviour drift.
45
+
46
+ ### What we cut
47
+
48
+ - **P4.1 / P4.2** โ€” auto-rule โ†’ skill / guideline migrations.
49
+ Cancelled as scope-cut after P4.3 compression alone landed the
50
+ auto-bucket under target. The migrations were a means, not an end.
51
+ - **road-to-package-optimization Phase 1.2 / 1.3 / Phase 2 / Phase 3**
52
+ โ€” cancelled per P1.1's binary acceptance gate. The prototype
53
+ contradiction linter scanned 317 artefacts in 0.034 s and flagged
54
+ zero cross-artefact contradictions. The artefact surface is
55
+ empirically already well-governed on the heuristics tested; building
56
+ a production linter for a non-existent failure mode is not honest.
57
+ - **road-to-token-optimization Phase 2 / Phase 3** โ€” *not* cut, just
58
+ trigger-deferred by design (telemetry threshold + `/cost:report`
59
+ ship). Will reopen autonomously when their declared signals fire.
60
+
61
+ ### What stayed
62
+
63
+ - All Iron-Law fences. SHA-verified preserved by
64
+ `scripts/iron_law_sha.py` across the kernel compression pass.
65
+ - Behaviour parity. Golden transcripts pass under all three profiles.
66
+ - The pre-existing `auto`-tier rules; only their compressed bodies
67
+ changed, never their obligation surface.
68
+
69
+ ## Profile semantics
70
+
71
+ | Profile | Buckets loaded | Use case |
72
+ |---|---|---|
73
+ | `minimal` | kernel only | Tightly bounded automation, CLI shell-outs, "run this one command" |
74
+ | `balanced` *(default)* | kernel + tier-1 | Day-to-day engineering work; matches pre-roadmap behaviour superset |
75
+ | `full` | kernel + tier-1 + tier-2 | Architectural / cross-wing / governance sessions |
76
+
77
+ Consumer projects opt in via `personal.cost_profile` in
78
+ `.agent-settings.yml`. The install script keeps user-set values; only
79
+ the template default is `balanced`.
80
+
81
+ ## Reversibility
82
+
83
+ If the Kernel + Router model needs unwinding:
84
+
85
+ 1. Set every rule's frontmatter `tier:` to `kernel` and rebuild
86
+ `router.json` โ€” every rule loads on every turn (legacy behaviour).
87
+ 2. Drop `lint-rule-budget` from `task ci`.
88
+ 3. The compiled `router.json` is a derived artefact; deleting it and
89
+ running `compile_router.py --no-router` returns the always-loaded
90
+ model.
91
+
92
+ No data migration, no irreversible compression. Iron-Law SHA fences
93
+ mean Iron Laws can be diffed against the pre-roadmap baseline at any
94
+ point.
95
+
96
+ ## Final measurements (2026-05-06)
97
+
98
+ | Metric | Pre-roadmap | Post-roadmap | ฮ” |
99
+ |---|---:|---:|---:|
100
+ | kernel bucket | n/a (always-loaded) | 25 590 | new gate |
101
+ | auto bucket | ~75 000 | 59 220 | โˆ’21 % |
102
+ | total rule chars | ~193 000 | 84 810 | โˆ’56 % |
103
+ | rule count | 56 | 57 (added `token-optimizer-maintenance`) | +1 |
104
+ | skills count | 134 | 135 (added `token-optimizer`) | +1 |
105
+
106
+ Kernel-bucket-check: PASS. Per-rule cap: 16 rules over 2.5k target,
107
+ all within 4.0k Iron-Law override per ADR-002. Trend snapshot
108
+ appended to `agents/.rule-budget-history.jsonl`.
109
+
110
+ ## Consequences
111
+
112
+ - New rule submissions must declare `tier:` + `triggers:` + (when
113
+ applicable) `routes_to:` in frontmatter; the router compiler
114
+ rejects malformed entries.
115
+ - Editing Iron-Law-fenced bodies requires a fresh
116
+ `scripts/iron_law_sha.py --update` pass; CI fails on hash drift.
117
+ - The `token-optimizer` skill is now the single consult surface for
118
+ token-cost decisions; editing any cited asset requires a same-commit
119
+ catalog update per `token-optimizer-maintenance` rule (CI-backstopped
120
+ by `scripts/check_token_optimizer_freshness.py`).
121
+ - Deferred phases (token-opt P2/P3, kernel-swap from ADR-001) remain
122
+ reopenable on their declared triggers without further roadmap work.
@@ -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 56 rules. No configuration needed.
118
+ This is enforced automatically by 58 rules. No configuration needed.
119
119
 
120
120
  ---
121
121
 
@@ -153,7 +153,7 @@ Your agent now understands slash commands:
153
153
  | `/quality-fix` | Run and fix all quality checks |
154
154
  | `/chat-history` | Inspect the persistent chat-history log (read-only `show`) |
155
155
 
156
- โ†’ [Browse all 94 active commands](../.agent-src/commands/)
156
+ โ†’ [Browse all 95 active commands](../.agent-src/commands/)
157
157
 
158
158
  ---
159
159
 
@@ -0,0 +1,176 @@
1
+ # Roadmap Progress Sync
2
+
3
+ > Any touch to agents/roadmaps/ โ€” create/rename/delete/move, edit checkboxes ([x]/[~]/[-]), add/rename/remove phases โ€” must regenerate dashboard and archive if 0 open items, same response
4
+
5
+ _Origin: migrated from `.agent-src.uncompressed/rules/roadmap-progress-sync.md` per P4.2 of `road-to-kernel-and-router.md`._
6
+
7
+ <!-- cloud_safe: degrade -->
8
+ <!-- Authoring discipline applies in cloud; local script + regen are no-ops there. -->
9
+
10
+ # Roadmap Progress Sync
11
+
12
+ > **Enforced by:** [`scripts/roadmap_progress_hook.py`](../../scripts/roadmap_progress_hook.py)
13
+ > on Augment + Claude Code (`PostToolUse`). Hook is primary; the prose
14
+ > below is the specification the hook implements and the fallback when
15
+ > the platform has no hook surface.
16
+
17
+ ## Iron Law โ€” dashboard sync
18
+
19
+ ```
20
+ ANY ROADMAP TOUCH โ†’ REGENERATE THE DASHBOARD, SAME RESPONSE.
21
+ NO EXCEPTIONS. NO "I'LL DO IT AT THE END". NO BATCHING ACROSS TURNS.
22
+ A ROADMAP NOT IN THE DASHBOARD IS A RULE VIOLATION, NOT AN OVERSIGHT.
23
+ ```
24
+
25
+ **Roadmap touch =** create the file, rename it, delete it, move it
26
+ between `roadmaps/` โ†” `archive/` โ†” `skipped/`, add/rename/remove a
27
+ phase, **OR** flip any checkbox (`[ ]` โ†” `[x]` โ†” `[~]` โ†” `[-]`).
28
+
29
+ `agents/roadmaps-progress.md` is the read-only dashboard. Every
30
+ unsynced edit makes it lie to the next reader. Created a roadmap
31
+ without regenerating? The dashboard claims it does not exist. Marked
32
+ 8 steps `[x]` and forgot the regen? The dashboard says 0 done.
33
+
34
+ ## Iron Law โ€” every active roadmap is trackable
35
+
36
+ ```
37
+ EVERY ACTIVE ROADMAP MUST CONTAIN AT LEAST ONE TRACKABLE CHECKBOX
38
+ (`- [ ]`) PER NON-INTRO PHASE. ROADMAPS WITHOUT EXECUTABLE STEPS
39
+ EITHER GET A CHECKLIST OR THE `status: draft` FLAG.
40
+ CI-ENFORCED: `scripts/check_roadmap_trackable.py` (CANNOT BE DEFERRED).
41
+ ```
42
+
43
+ **Active roadmap =** any file in `agents/roadmaps/` (root, not
44
+ `archive/` or `skipped/`) without `status: draft` frontmatter.
45
+
46
+ **Trackable checkbox =** an actionable `- [ ]` line under a `## Phase N`
47
+ or `### Phase N` heading (numeric `Phase 1`, roman `Phase II`, or
48
+ letter-track `Phase A1` โ€” matched by the dashboard's `PHASE_RE`).
49
+ Tables of decisions, ICE matrices, ADR captures, and "block
50
+ sequencing" tables are valid **rationale**, but they do not satisfy
51
+ this rule on their own โ€” they must be paired with at least one
52
+ `## Phase N` section whose checkboxes execute the decision.
53
+ Headings such as `## Phase steps`, `### Sequencing โ€” Phase 1 โ€ฆ`,
54
+ `### P0 #1 โ€” โ€ฆ`, or `## Block A` do **not** count โ€” only the
55
+ canonical `Phase <id>` form parsed by the dashboard.
56
+
57
+ **CI backstop.** `scripts/check_roadmap_trackable.py` (package-shipped,
58
+ wire into the consumer's pre-commit / pre-push / Actions gate) fails
59
+ when an active roadmap has zero canonical `Phase` headings or when
60
+ any parsed phase has zero checkboxes. Last line of defence โ€” real-time
61
+ authoring still flips checkboxes and regenerates the dashboard the
62
+ same response.
63
+
64
+ ## Status โ€” binary `ready` (default) vs `draft`
65
+
66
+ ```yaml
67
+ ---
68
+ status: draft # hidden from the dashboard until flipped
69
+ ---
70
+ ```
71
+
72
+ Two values, no synonyms. Anything else โ€” no frontmatter at all,
73
+ `status: ready`, an unknown value โ€” counts as **ready** and lands
74
+ in the dashboard.
75
+
76
+ - **Ready** is the implicit default. New roadmaps are created
77
+ ready unless the user explicitly says draft. Ready roadmaps are
78
+ listed in the dashboard, count towards open/done totals, and
79
+ trip the "completed but not archived" warning when they close.
80
+ - **Draft** hides the file from the dashboard entirely (not
81
+ counted, not listed). Use it while the roadmap is still being
82
+ authored, while waiting for upstream decisions, or as a
83
+ capture-only synthesis that has not yet been promoted to
84
+ executable phases. Flip to ready (or remove the field) the
85
+ moment the roadmap is ready to track.
86
+
87
+ **Completion = archival, same response.** When the edit takes a
88
+ roadmap to `count_open == 0` (every item is `[x]`, `[~]`, or `[-]`),
89
+ `git mv` it into `agents/roadmaps/archive/` (or `skipped/` if no `[x]`
90
+ at all) **before** regenerating the dashboard. A 100%-complete
91
+ roadmap left under `agents/roadmaps/` is a rule violation, not an
92
+ optional cleanup. See `roadmap-management` skill for the archive vs
93
+ skipped decision table.
94
+
95
+ ## Agent-authored roadmaps โ€” placement is mandatory
96
+
97
+ ```
98
+ A FILE THE AGENT DROPS INTO agents/roadmaps/ MUST EITHER
99
+ (a) PASS check_roadmap_trackable.py AND LAND IN THE DASHBOARD, OR
100
+ (b) NOT BE IN agents/roadmaps/ AT ALL.
101
+ NO "DECISION MATRIX" / "DESIGN NOTE" SHORTCUT.
102
+ ```
103
+
104
+ When the agent autonomously creates a roadmap, it owns the placement
105
+ in the **same response**:
106
+
107
+ - **Phase plan** (checkboxes, multi-turn execution) โ†’ `agents/roadmaps/<name>.md`, `status: ready` (default), regen dashboard.
108
+ - **Decision matrix / ADR / pattern / lookup** (no `Phase N`, durable rationale) โ†’ `agents/contexts/<name>.md`.
109
+ - **Completed work snapshot** โ†’ `agents/roadmaps/archive/<name>.md`.
110
+
111
+ A non-trackable file in `agents/roadmaps/` is a rule violation โ€” the
112
+ trackable CI fails it, the dashboard hides it. The agent that
113
+ created it moves it the same response. If the autonomous run also
114
+ **finishes** the roadmap within the session (every box `[x]`/`[~]`/`[-]`),
115
+ the completion-archival rule above fires too โ€” same response.
116
+
117
+ ## Autonomous execution โ€” checkbox cadence
118
+
119
+ When executing a roadmap autonomously (multi-turn, no per-step user
120
+ prompt), the user loses progress visibility unless checkboxes flip
121
+ **as work lands**, not in a batch at the end. Iron Law:
122
+
123
+ ```
124
+ EVERY DONE STEP FLIPS [ ] โ†’ [x] IN NEXT REPLY THAT ACKNOWLEDGES IT.
125
+ NO "I UPDATE ROADMAP AT END OF PHASE."
126
+ NO "FOUR STEPS DONE, ONE COMMIT, ONE REGEN."
127
+ ```
128
+
129
+ Step counts as completed when:
130
+
131
+ - Code / docs change for that step has been **written and saved** AND
132
+ - Verification cited in the step (project CI command, targeted test, lint) has
133
+ **passed in this response or an earlier one** โ€” fresh output, not memory.
134
+
135
+ Then in the **same reply**: flip the checkbox, regenerate the
136
+ dashboard, commit if commit policy allows.
137
+
138
+ **Forbidden:** four turns of step work, dashboard flat, single regen at the end.
139
+ **Required:** each turn โ€” implement step, flip `[x]`, regen, commit (if policy allows).
140
+ A reply that lands a verified step without flipping its checkbox is a rule violation.
141
+
142
+ **In-progress marker:** when a step takes more than one reply,
143
+ mark it `[~]` the moment work starts on it and regenerate. The
144
+ user sees one row move from `[ ]` to `[~]` to `[x]` instead of
145
+ silent rows. `[~]` is treated as open for `count_open` but moves
146
+ the phase percentage forward in the dashboard.
147
+
148
+ ## Mechanics โ€” triggers, regen command, self-check, failures
149
+
150
+ The triggers table, the regen command (`./agent-config roadmap:progress`),
151
+ the mandatory pre-send self-check, the failure-mode catalog, and the
152
+ `Do NOT` list live in
153
+ [`contexts/communication/rules-auto/roadmap-progress-sync-mechanics.md`](../contexts/communication/rules-auto/roadmap-progress-sync-mechanics.md).
154
+ Pull it whenever a trigger fires โ€” the rule above is the obligation
155
+ surface; the mechanics file is the lookup material.
156
+
157
+ ## Copilot fallback
158
+
159
+ GitHub Copilot has no `PostToolUse` hook surface, so
160
+ `scripts/roadmap_progress_hook.py` cannot detect roadmap-file writes
161
+ structurally. The dashboard at `agents/roadmaps-progress.md` will
162
+ not regenerate on its own.
163
+
164
+ The cooperative path: every time a roadmap touch fires (per the
165
+ trigger list in the mechanics context above), the agent regenerates
166
+ the dashboard in the same response โ€” which is the same Iron Law the
167
+ hook enforces, just executed manually:
168
+
169
+ ```bash
170
+ ./agent-config roadmap:progress
171
+ ```
172
+
173
+ The hook implementation is the specification; on Copilot the agent
174
+ runs the regenerator itself after the same triggers fire. Skipping
175
+ it is a rule violation, not a hook gap โ€” the Iron Law on dashboard
176
+ sync survives the missing hook surface.
@@ -0,0 +1,73 @@
1
+ # Rule Type Governance
2
+
3
+ > Creating or editing rules, or auditing rule types โ€” decides when a rule should be always vs auto
4
+
5
+ _Origin: migrated from `.agent-src.uncompressed/rules/rule-type-governance.md` per P4.2 of `road-to-kernel-and-router.md`._
6
+
7
+ # rule-type-governance
8
+
9
+ ## `always` = loaded every conversation
10
+
11
+ Use ONLY when the rule applies to virtually every interaction:
12
+
13
+ - Universal agent behavior (language, tone, interaction style)
14
+ - Safety constraints (scope control, verification before completion)
15
+ - Token/efficiency constraints
16
+ - First-message checks that cannot wait for auto-trigger
17
+
18
+ ## `auto` = loaded on demand by description match
19
+
20
+ Use for everything else:
21
+
22
+ - Language-specific rules (PHP, JS, SQL)
23
+ - Tool-specific rules (Docker, Git, quality tools)
24
+ - Workflow-specific rules (commands, skill creation, E2E testing)
25
+ - Domain-specific rules (translations, architecture)
26
+
27
+ ## Decision test
28
+
29
+ > "Does this rule need to be active when the user asks a simple question, reviews a PR, or discusses architecture?"
30
+
31
+ - Yes โ†’ `always`
32
+ - No โ†’ `auto` with a clear trigger description
33
+
34
+ ## Auto description quality
35
+
36
+ The `description` field IS the trigger. It must describe **when** the rule applies, not **what** it contains.
37
+
38
+ - โŒ `"PHP coding standards"` โ€” too vague, won't match reliably
39
+ - โœ… `"Writing or reviewing PHP code โ€” strict types, naming, Eloquent conventions"`
40
+
41
+ ## Hard constraint
42
+
43
+ - Default to `auto`. Justify `always`.
44
+ - If >50% of conversations don't need a rule โ†’ it must be `auto`.
45
+ - `optimize-agents` command checks this and suggests changes.
46
+
47
+ ## Hardening tier โ€” required on new or edited rules
48
+
49
+ Every new rule, and every edited rule whose body changes the trigger
50
+ or the obligation, MUST classify itself against the hardening tiers
51
+ documented in [`rule-trigger-matrix.md`](../../agents/contexts/rule-trigger-matrix.md):
52
+
53
+ | Tier | Meaning |
54
+ |---|---|
55
+ | `1` | Mechanically enforceable โ€” hook acts, rule body stays minimal. |
56
+ | `2a` | Marker nudge โ€” hook injects signal, agent acts on it. |
57
+ | `2b` | Structured injection / tool-call gate โ€” hook reads/writes state, may deny. |
58
+ | `3` | Soft, judgment-bound โ€” no platform surface; self-check rule. |
59
+ | `safety-floor` | Iron-Law subset, never modified. |
60
+ | `mechanical-already` | Precedent โ€” script enforces, rule body documents. |
61
+
62
+ Classification surface: the optional `tier:` frontmatter field
63
+ (declared in `scripts/schemas/rule.schema.json`). Recommended for new
64
+ rules; bulk-retrofit of existing rules is tracked separately.
65
+
66
+ Tier 3 dispositions are recorded centrally in
67
+ [`agents/contexts/tier-3-dispositions.md`](../../agents/contexts/tier-3-dispositions.md)
68
+ with a 6-month re-audit clock. New Tier 3 rules append to that list
69
+ on landing.
70
+
71
+ The `optimize-agents` command checks the tier alongside `type`/`source`
72
+ and suggests escalations when a rule's trigger matches a hardening
73
+ opportunity that has shipped since the rule was authored.
@@ -33,6 +33,11 @@ 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.
40
+
36
41
  Reason:
37
42
  - Loaded frequently
38
43
  - Must be reliably followed
@@ -43,8 +48,10 @@ Reason:
43
48
  ## Skills
44
49
 
45
50
  - Target: **300โ€“900 words**
46
- - Warning: **>1200 words**
47
- - Strong split signal: **>1500 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
48
55
 
49
56
  Focus:
50
57
  - scanability
@@ -57,6 +64,10 @@ Focus:
57
64
 
58
65
  - Target: **200โ€“600 words**
59
66
  - 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).
60
71
 
61
72
  Commands orchestrate โ€” not implement.
62
73
 
@@ -0,0 +1,119 @@
1
+ # Skill Quality
2
+
3
+ > Creating, editing, or reviewing skills โ€” minimum quality standard, every skill must be executable, validated, and self-contained
4
+
5
+ _Origin: migrated from `.agent-src.uncompressed/rules/skill-quality.md` per P4.2 of `road-to-kernel-and-router.md`._
6
+
7
+ # Skill Quality
8
+
9
+ ## Minimum Sharpness
10
+
11
+ Every skill must answer four questions. If ANY answer is weak, the skill is not done.
12
+
13
+ | # | Question | Section | Standard |
14
+ |---|---|---|---|
15
+ | 1 | When should I use this? | `When to use` | Concrete trigger, not generic |
16
+ | 2 | What exactly do I do? | `Procedure` | Executable steps with decisions |
17
+ | 3 | How do I verify it worked? | `Procedure` (validation step) | Concrete checks, not "verify it works" |
18
+ | 4 | What common failure must I avoid? | `Gotcha` + `Do NOT` | Real failure patterns, not platitudes |
19
+
20
+ ## Required Sections
21
+
22
+ Every skill MUST have: `When to use`, `Procedure`, `Gotcha`, `Output format`, `Do NOT`.
23
+
24
+ ## Frontmatter Contract
25
+
26
+ Every skill's YAML frontmatter MUST validate against `scripts/schemas/skill.schema.json`.
27
+ Violations are reported by `scripts/skill_linter.py` as `schema_<rule>` errors
28
+ and fail `python3 scripts/validate_frontmatter.py` and the full CI pipeline.
29
+
30
+ ## Description Triggering
31
+
32
+ Claude routes skills by their frontmatter `description`. Pushy,
33
+ trigger-rich descriptions are required โ€” polite or hedged ones cause
34
+ undertriggering. The full recipe (concrete verb phrase, โ‰ฅ2 triggers,
35
+ `even if they don't explicitly ask for โ€ฆ` tail, โ‰ค200 chars,
36
+ litmus test) lives in
37
+ [`contexts/communication/rules-auto/skill-quality-mechanics.md`](../contexts/communication/rules-auto/skill-quality-mechanics.md)
38
+ ยง Description Triggering.
39
+
40
+ ## Skill Independence
41
+
42
+ ```
43
+ If a skill is not executable without opening a guideline, it is broken.
44
+ ```
45
+
46
+ - Skills MAY reference guidelines for detailed conventions
47
+ - Skills MUST NOT outsource their core workflow to guidelines
48
+ - If removing guideline references makes the skill useless โ†’ the skill is too weak
49
+
50
+ **Litmus test:** Cover all guideline references in the Procedure. Is it still executable?
51
+ If not โ†’ the skill needs more own steps, decisions, and validation โ€” not more guideline links.
52
+
53
+ ## Merge & Compression Preservation
54
+
55
+ When merging or compressing skills, the result MUST preserve the
56
+ strongest validation, strongest examples, all anti-patterns, all
57
+ decision criteria, and trigger quality. Full preservation invariants
58
+ and "merge is invalid if โ€ฆ" / "compression may remove โ€ฆ" lists in
59
+ [`contexts/communication/rules-auto/skill-quality-mechanics.md`](../contexts/communication/rules-auto/skill-quality-mechanics.md)
60
+ ยง Merge Preservation and ยง Compression Preservation.
61
+
62
+ ## Refactor Safety
63
+
64
+ When refactoring or optimizing skills:
65
+
66
+ - NEVER weaken validation to pass linter
67
+ - NEVER remove anti-patterns to reduce size
68
+ - NEVER replace concrete checks with "verify it works"
69
+ - NEVER merge skills if the result is broader than either source
70
+ - ALWAYS run linter before and after โ€” fail count must not increase
71
+
72
+ ## Senior-Tier Required Structure
73
+
74
+ Skills with `tier: senior` in YAML frontmatter MUST carry four named
75
+ blocks beyond the standard required sections:
76
+
77
+ | # | Block | Heading / Location | Standard |
78
+ |---|---|---|---|
79
+ | 1 | Context-First lead | Frontmatter `description` | First sentence anchors the cognition cluster (domain + senior role); second sentence names the trigger. |
80
+ | 2 | Related Skills | `## Related Skills` | Two-list pattern โ€” `**WHEN to use this**` (situations this skill resolves) + `**WHEN NOT to use this**` (route-elsewhere peers, named). |
81
+ | 3 | Proactive Triggers | `## When the agent should load this` | 3โ€“5 concrete user-prompt patterns (paraphrases users actually type), not abstract categories. |
82
+ | 4 | Output Artifacts | `## Output` | 1โ€“4 named artifacts with shape (file path, table, markdown structure) โ€” orchestrator-citable identifier each. |
83
+
84
+ **Forward-only.** `scripts/skill_linter.py` enforces these blocks for
85
+ `tier: senior` skills only; mid-tier and untiered skills skip the
86
+ check. No retrofit pass on existing Wing-1 skills.
87
+
88
+ Subsection specs (โ‰ค 6-line spec + 1 reference example each), good /
89
+ bad pattern pairs, and the WHEN-NOT routing peer rules live in
90
+ [`contexts/communication/rules-auto/skill-quality-mechanics.md`](../contexts/communication/rules-auto/skill-quality-mechanics.md)
91
+ ยง Senior-tier patterns.
92
+
93
+ ## Structural Malice Floor
94
+
95
+ `scripts/skill_linter.py` runs five regex patterns against every
96
+ skill / rule / command body โ€” credential exfiltration, remote
97
+ execution, force-push to a protected ref, world-readable secret
98
+ files, and shell-injection in subprocess calls. A match emits
99
+ ``Issue("error", "malice:<pattern>", "<line>:<matched>")`` and the
100
+ linter exits with code **3** (security-failure), distinct from
101
+ exit 2 (build-failure) so CI surfaces can split the two.
102
+
103
+ The check is **structural**, not semantic โ€” it catches the shapes
104
+ the [`tool-safety`](tool-safety.md) rule denies in prose: hidden
105
+ credentials, arbitrary execution, write-without-approval. Fixtures
106
+ and the exit-code-3 contract live in
107
+ [`tests/test_skill_linter_malice.py`](../../tests/test_skill_linter_malice.py).
108
+
109
+ ## Confidence Tagging
110
+
111
+ Senior-tier procedure steps MAY append `[CONFIDENCE: high|medium|low]`
112
+ at the end of multi-step chains where the agent's evidence varies
113
+ across steps. Optional but recommended when a step's output feeds a
114
+ downstream decision.
115
+
116
+ Text-tag form is deliberate. Emoji ๐ŸŸข / ๐ŸŸก / ๐Ÿ”ด is **not** allowed โ€”
117
+ collides with [`direct-answers`](direct-answers.md) ยง Emoji scope
118
+ (functional markers only). Linter does not enforce the tag itself;
119
+ the rule documents the placement so authors converge on one form.
@@ -0,0 +1,68 @@
1
+ # Augment Portability
2
+
3
+ > Editing or creating files inside .augment/ directory โ€” skills, rules, commands, templates, contexts must be project-agnostic
4
+
5
+ _Origin: migrated from `.agent-src.uncompressed/rules/augment-portability.md` per P4.2 of `road-to-kernel-and-router.md`._
6
+
7
+ # Package Portability
8
+
9
+ Everything that ships with the `event4u/agent-config` package MUST be
10
+ **project-agnostic**. That includes:
11
+
12
+ - Everything inside `.augment/` (skills, rules, commands, guidelines,
13
+ templates, contexts)
14
+ - The package repo's own root `AGENTS.md`
15
+ - The package repo's own `.github/copilot-instructions.md`
16
+
17
+ All three are either installed into consumer projects (`.augment/` via
18
+ `install.sh`) or read by AI tools when working on the package itself
19
+ (`AGENTS.md`, `copilot-instructions.md`). Leaking consumer-specific
20
+ content into any of them pollutes downstream projects or misleads agents.
21
+
22
+ ## Rules
23
+
24
+ - NEVER reference a specific consumer project, repo name, domain, or tech
25
+ stack directly. The package repo itself (`event4u/agent-config`) MAY be
26
+ named inside its own root `AGENTS.md` and `copilot-instructions.md` โ€”
27
+ that is meta about the package, not a leak.
28
+ - NEVER hardcode consumer-project paths, class names, or conventions.
29
+ - Write content so it works as a **reusable package** across any project.
30
+ - Project-specific behavior belongs in the **consumer's** `.agent-settings.yml`,
31
+ `AGENTS.md`, or `agents/` โ€” never in files shipped by this package.
32
+ - If a skill or rule needs project-specific input, read it from
33
+ `.agent-settings.yml` or accept it as a parameter.
34
+ - When reviewing or editing package files, always ask: "Would this still
35
+ make sense in a completely different project?"
36
+
37
+ ## Runtime invocations โ€” no `task` commands
38
+
39
+ Skills, rules, commands, guidelines, personas, and context docs run in
40
+ **consumer projects**, which may not have Task installed. **Never**
41
+ reference a `task <something>` invocation inside any artefact file
42
+ under `.agent-src.uncompressed/{skills,rules,commands,guidelines,personas,contexts}/`
43
+ (and therefore also not in the compressed mirror under `.agent-src/`).
44
+ Use direct script invocations instead.
45
+
46
+ ## Consumer CLI โ€” `./agent-config`
47
+
48
+ A subset of package scripts is exposed through a project-local CLI
49
+ wrapper `./agent-config` (written into the project root by the
50
+ installer, gitignored). Artefacts MUST prefer the CLI over raw
51
+ `python3 scripts/โ€ฆ` paths for every command the CLI already covers.
52
+
53
+ ## Translation tables โ€” see mechanics
54
+
55
+ The full `task`-to-script translation table, the `./agent-config`
56
+ CLI mapping, and the rationale (Task absence on consumers,
57
+ maintainer-vs-artefact split) all live in
58
+ [`contexts/communication/rules-auto/augment-portability-mechanics.md`](../contexts/communication/rules-auto/augment-portability-mechanics.md).
59
+ Pull it whenever an artefact is about to mention a runtime
60
+ invocation.
61
+
62
+ ## Enforcement
63
+
64
+ `scripts/check_portability.py` scans `.augment/`, `.agent-src.uncompressed/`,
65
+ and the package repo's root `AGENTS.md` + `.github/copilot-instructions.md`
66
+ for forbidden identifiers, for any `task <name>` invocation inside
67
+ artefact files, and for direct script invocations that bypass the
68
+ `./agent-config` CLI. It runs in CI and must pass before any PR.
@@ -0,0 +1,62 @@
1
+ # Php Coding
2
+
3
+ > Writing or reviewing PHP code โ€” strict types, naming, comparisons, early returns, Eloquent conventions
4
+
5
+ _Origin: migrated from `.agent-src.uncompressed/rules/php-coding.md` per P4.2 of `road-to-kernel-and-router.md`._
6
+
7
+ # PHP Coding Rules
8
+
9
+ - Use `declare(strict_types=1)` in every **new** PHP file. Not required when modifying existing files that don't have it.
10
+ - If the project has a `Math` helper class, use it for ALL business calculations. Never use native PHP arithmetic operators (`+`, `-`, `*`, `/`) for business calculations. Search for the `Math` class in the project.
11
+ - Never use `var_dump()`, `print_r()`, or `dd()` โ€” they are disallowed by PHPStan config. Exception: legacy projects where these are already used and no alternative is feasible.
12
+ - Never use `float` for money โ€” use `decimal` or the `Math` helper.
13
+ - Always use `===` / `!==` (strict comparison), Yoda style: `null === $var`.
14
+ - Early return over nested if/else.
15
+ - No one-liner if statements.
16
+ - Single quotes for strings without interpolation. `sprintf()` for complex strings.
17
+ - Variables: `camelCase`. Array keys: `snake_case`. Constants: `UPPER_SNAKE_CASE`.
18
+ - Typed properties, parameters, and return types โ€” always.
19
+ - Constructor property promotion where it makes sense.
20
+
21
+ ## Eloquent Models โ€” Attribute Access
22
+
23
+ Read `eloquent.access_style` from `.agent-settings.yml` to determine the preferred style.
24
+ Default: `getters_setters`. See the `eloquent` skill for the full reference table and examples.
25
+
26
+ - **`getters_setters`** (strict): Every attribute has a typed getter + fluent setter. Inside the model: `getAttribute('column_name')`/`setAttribute('column_name', $value)`. Outside: always getters/setters. If a getter doesn't exist yet, create it first.
27
+ - **`get_attribute`**: Use `getAttribute('column_name')`/`setAttribute('column_name', $value)` everywhere, no getters/setters needed.
28
+ - **`magic_properties`**: Laravel default `$model->column_name` everywhere.
29
+
30
+ ### Relationship Getters
31
+
32
+ - Every relationship MUST have a typed getter method **above** the relationship method.
33
+ - **Inside the getter:** use `$this->getAttribute('relationship_name')`, NEVER `$this->relationship_name`.
34
+ - **Outside the model:** ALWAYS use the getter (`$model->getEquipment()`), NEVER access the magic property (`$model->equipment`).
35
+ - Use `instanceof` checks instead of `null ===` when checking relationship results.
36
+
37
+ ## Eloquent Models โ€” Observers over `booted()`
38
+
39
+ - Do NOT use `booted()` / `boot()` for model lifecycle hooks (saving, saved, deleted, etc.).
40
+ - Use a dedicated **Observer** class registered via `#[ObservedBy]` attribute.
41
+ - This keeps models slim and lifecycle logic testable and discoverable.
42
+
43
+ ## PHPStan
44
+
45
+ - Always fix the root cause. Do NOT add entries to `phpstan-baseline.neon`.
46
+ - Adding `ignoreErrors` to `phpstan.neon` is allowed for **structural toolchain limitations** (e.g., Pest runtime bindings). NOT for individual code issues. **If unsure โ†’ ask the user.**
47
+ - If a fix is truly impossible (confirmed false positive), use an inline ignore as last resort:
48
+ ```php
49
+ // @phpstan-ignore-next-line โ€” false positive: reason here
50
+ ```
51
+
52
+ ## Testing
53
+
54
+ - Always write tests in **Pest**, not PHPUnit class syntax โ€” unless the user explicitly asks for PHPUnit.
55
+ - Pest tests in `tests/Unit/` automatically use `UnitTestCase` as the base class (configured in `tests/Pest.php`).
56
+
57
+ ## PHPDoc
58
+
59
+ - Only add PHPDoc when type hints are insufficient (e.g. generic arrays: `@param array<int, MyObject> $items`).
60
+ - Do NOT add PHPDoc that just repeats the method signature.
61
+ - One docblock per method โ€” never split into multiple `/** */` blocks.
62
+ - Tag order: `@param` โ†’ `@return` โ†’ `@throws`.