@event4u/agent-config 1.19.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 (297) hide show
  1. package/.agent-src/commands/agent-handoff.md +14 -10
  2. package/.agent-src/commands/agents.md +1 -1
  3. package/.agent-src/commands/bug-fix.md +1 -1
  4. package/.agent-src/commands/bug-investigate.md +2 -2
  5. package/.agent-src/commands/chat-history/import.md +166 -0
  6. package/.agent-src/commands/chat-history/learn.md +178 -0
  7. package/.agent-src/commands/chat-history/show.md +17 -18
  8. package/.agent-src/commands/chat-history.md +26 -25
  9. package/.agent-src/commands/compress.md +12 -0
  10. package/.agent-src/commands/context/create.md +2 -2
  11. package/.agent-src/commands/context.md +1 -1
  12. package/.agent-src/commands/copilot-agents.md +1 -1
  13. package/.agent-src/commands/council/default.md +21 -12
  14. package/.agent-src/commands/council.md +1 -1
  15. package/.agent-src/commands/create-pr.md +28 -8
  16. package/.agent-src/commands/e2e-heal.md +1 -1
  17. package/.agent-src/commands/e2e-plan.md +1 -1
  18. package/.agent-src/commands/feature/dev.md +3 -3
  19. package/.agent-src/commands/feature.md +1 -1
  20. package/.agent-src/commands/fix/seeder.md +2 -2
  21. package/.agent-src/commands/fix.md +1 -1
  22. package/.agent-src/commands/jira-ticket.md +1 -1
  23. package/.agent-src/commands/judge.md +2 -2
  24. package/.agent-src/commands/memory.md +1 -1
  25. package/.agent-src/commands/mode.md +5 -5
  26. package/.agent-src/commands/module.md +1 -1
  27. package/.agent-src/commands/onboard.md +4 -4
  28. package/.agent-src/commands/optimize/augmentignore.md +1 -1
  29. package/.agent-src/commands/optimize-prompt.md +61 -0
  30. package/.agent-src/commands/optimize.md +1 -1
  31. package/.agent-src/commands/override.md +1 -1
  32. package/.agent-src/commands/review-changes.md +1 -1
  33. package/.agent-src/commands/review-routing.md +1 -1
  34. package/.agent-src/commands/roadmap.md +1 -1
  35. package/.agent-src/commands/set-cost-profile.md +3 -3
  36. package/.agent-src/commands/sync-agent-settings.md +2 -2
  37. package/.agent-src/commands/sync-gitignore.md +1 -1
  38. package/.agent-src/commands/tests/create.md +2 -2
  39. package/.agent-src/commands/tests.md +1 -1
  40. package/.agent-src/commands/threat-model.md +4 -4
  41. package/.agent-src/contexts/authority/commit-mechanics.md +14 -1
  42. package/.agent-src/contexts/authority/destructive-mechanics.md +14 -1
  43. package/.agent-src/contexts/authority/scope-mechanics.md +5 -0
  44. package/.agent-src/contexts/communication/rules-auto/guidelines-mechanics.md +76 -0
  45. package/.agent-src/contexts/communication/rules-auto/skill-quality-mechanics.md +76 -0
  46. package/.agent-src/contexts/communication/rules-auto/slash-command-routing-policy-mechanics.md +4 -4
  47. package/.agent-src/contexts/communication/rules-auto/think-before-action-mechanics.md +98 -0
  48. package/.agent-src/contexts/communication/rules-auto/token-efficiency-mechanics.md +93 -0
  49. package/.agent-src/contexts/communication/rules-auto/user-interaction-mechanics.md +125 -9
  50. package/.agent-src/contexts/execution/autonomy-mechanics.md +44 -0
  51. package/.agent-src/contexts/model-recommendations.md +2 -2
  52. package/.agent-src/contexts/override-system.md +1 -1
  53. package/.agent-src/personas/product-owner.md +2 -2
  54. package/.agent-src/personas/qa.md +1 -1
  55. package/.agent-src/rules/agent-authority.md +5 -6
  56. package/.agent-src/rules/agent-docs.md +11 -53
  57. package/.agent-src/rules/analysis-skill-routing.md +10 -40
  58. package/.agent-src/rules/architecture.md +6 -1
  59. package/.agent-src/rules/artifact-drafting-protocol.md +5 -0
  60. package/.agent-src/rules/artifact-engagement-recording.md +23 -59
  61. package/.agent-src/rules/ask-when-uncertain.md +24 -47
  62. package/.agent-src/rules/augment-portability.md +14 -62
  63. package/.agent-src/rules/augment-source-of-truth.md +10 -1
  64. package/.agent-src/rules/autonomous-execution.md +17 -98
  65. package/.agent-src/rules/capture-learnings.md +9 -80
  66. package/.agent-src/rules/cli-output-handling.md +12 -42
  67. package/.agent-src/rules/command-suggestion-policy.md +25 -73
  68. package/.agent-src/rules/commit-conventions.md +9 -58
  69. package/.agent-src/rules/commit-policy.md +16 -47
  70. package/.agent-src/rules/context-hygiene.md +5 -0
  71. package/.agent-src/rules/direct-answers.md +21 -42
  72. package/.agent-src/rules/docker-commands.md +11 -45
  73. package/.agent-src/rules/docs-sync.md +10 -56
  74. package/.agent-src/rules/downstream-changes.md +5 -0
  75. package/.agent-src/rules/e2e-testing.md +9 -44
  76. package/.agent-src/rules/guidelines.md +13 -75
  77. package/.agent-src/rules/improve-before-implement.md +10 -2
  78. package/.agent-src/rules/language-and-tone.md +35 -69
  79. package/.agent-src/rules/laravel-translations.md +11 -40
  80. package/.agent-src/rules/markdown-safe-codeblocks.md +4 -0
  81. package/.agent-src/rules/minimal-safe-diff.md +4 -0
  82. package/.agent-src/rules/missing-tool-handling.md +4 -0
  83. package/.agent-src/rules/model-recommendation.md +9 -61
  84. package/.agent-src/rules/no-attribution-footers.md +53 -0
  85. package/.agent-src/rules/no-cheap-questions.md +11 -27
  86. package/.agent-src/rules/no-council-references.md +76 -0
  87. package/.agent-src/rules/no-roadmap-references.md +8 -1
  88. package/.agent-src/rules/non-destructive-by-default.md +13 -43
  89. package/.agent-src/rules/onboarding-gate.md +9 -117
  90. package/.agent-src/rules/package-ci-checks.md +10 -37
  91. package/.agent-src/rules/php-coding.md +10 -55
  92. package/.agent-src/rules/preservation-guard.md +9 -0
  93. package/.agent-src/rules/review-routing-awareness.md +9 -97
  94. package/.agent-src/rules/reviewer-awareness.md +8 -83
  95. package/.agent-src/rules/roadmap-progress-sync.md +7 -170
  96. package/.agent-src/rules/role-mode-adherence.md +6 -2
  97. package/.agent-src/rules/rule-type-governance.md +8 -66
  98. package/.agent-src/rules/runtime-safety.md +5 -0
  99. package/.agent-src/rules/scope-control.md +17 -62
  100. package/.agent-src/rules/security-sensitive-stop.md +7 -1
  101. package/.agent-src/rules/size-enforcement.md +6 -1
  102. package/.agent-src/rules/skill-improvement-trigger.md +9 -49
  103. package/.agent-src/rules/skill-quality.md +7 -64
  104. package/.agent-src/rules/slash-command-routing-policy.md +11 -63
  105. package/.agent-src/rules/think-before-action.md +22 -87
  106. package/.agent-src/rules/token-efficiency.md +10 -74
  107. package/.agent-src/rules/token-optimizer-maintenance.md +68 -0
  108. package/.agent-src/rules/tool-safety.md +4 -0
  109. package/.agent-src/rules/ui-audit-gate.md +25 -61
  110. package/.agent-src/rules/upstream-proposal.md +9 -67
  111. package/.agent-src/rules/user-interaction.md +25 -95
  112. package/.agent-src/rules/verify-before-complete.md +1 -1
  113. package/.agent-src/skills/agent-docs-writing/SKILL.md +1 -1
  114. package/.agent-src/skills/ai-council/SKILL.md +69 -5
  115. package/.agent-src/skills/analysis-autonomous-mode/SKILL.md +1 -1
  116. package/.agent-src/skills/analysis-skill-router/SKILL.md +3 -3
  117. package/.agent-src/skills/artisan-commands/SKILL.md +2 -2
  118. package/.agent-src/skills/authz-review/SKILL.md +1 -1
  119. package/.agent-src/skills/aws-infrastructure/SKILL.md +5 -5
  120. package/.agent-src/skills/blast-radius-analyzer/SKILL.md +8 -8
  121. package/.agent-src/skills/bug-analyzer/SKILL.md +5 -5
  122. package/.agent-src/skills/code-refactoring/SKILL.md +4 -4
  123. package/.agent-src/skills/code-review/SKILL.md +2 -2
  124. package/.agent-src/skills/command-writing/SKILL.md +11 -0
  125. package/.agent-src/skills/composer-packages/SKILL.md +2 -2
  126. package/.agent-src/skills/context-authoring/SKILL.md +11 -0
  127. package/.agent-src/skills/context-document/SKILL.md +1 -1
  128. package/.agent-src/skills/copilot-agents-optimization/SKILL.md +23 -0
  129. package/.agent-src/skills/copilot-config/SKILL.md +1 -1
  130. package/.agent-src/skills/dcf-modeling/SKILL.md +89 -0
  131. package/.agent-src/skills/dependency-upgrade/SKILL.md +2 -2
  132. package/.agent-src/skills/devcontainer/SKILL.md +2 -2
  133. package/.agent-src/skills/developer-like-execution/SKILL.md +1 -1
  134. package/.agent-src/skills/docker/SKILL.md +1 -1
  135. package/.agent-src/skills/dto-creator/SKILL.md +1 -1
  136. package/.agent-src/skills/estimate-ticket/SKILL.md +2 -2
  137. package/.agent-src/skills/fe-design/SKILL.md +4 -4
  138. package/.agent-src/skills/feature-planning/SKILL.md +5 -5
  139. package/.agent-src/skills/funnel-analysis/SKILL.md +100 -0
  140. package/.agent-src/skills/laravel/SKILL.md +1 -1
  141. package/.agent-src/skills/laravel-notifications/SKILL.md +5 -5
  142. package/.agent-src/skills/laravel-pennant/SKILL.md +1 -1
  143. package/.agent-src/skills/laravel-pulse/SKILL.md +4 -4
  144. package/.agent-src/skills/laravel-reverb/SKILL.md +2 -2
  145. package/.agent-src/skills/laravel-scheduling/SKILL.md +1 -1
  146. package/.agent-src/skills/md-language-check/SKILL.md +1 -1
  147. package/.agent-src/skills/migration-creator/SKILL.md +7 -7
  148. package/.agent-src/skills/multi-tenancy/SKILL.md +8 -8
  149. package/.agent-src/skills/okr-tree-modeling/SKILL.md +93 -0
  150. package/.agent-src/skills/performance-analysis/SKILL.md +3 -3
  151. package/.agent-src/skills/pest-testing/SKILL.md +6 -6
  152. package/.agent-src/skills/php-service/SKILL.md +2 -2
  153. package/.agent-src/skills/project-analysis-hypothesis-driven/SKILL.md +3 -3
  154. package/.agent-src/skills/project-analysis-react/SKILL.md +1 -1
  155. package/.agent-src/skills/project-analysis-symfony/SKILL.md +1 -1
  156. package/.agent-src/skills/project-analysis-zend-laminas/SKILL.md +2 -2
  157. package/.agent-src/skills/project-analyzer/SKILL.md +4 -4
  158. package/.agent-src/skills/prompt-optimizer/SKILL.md +108 -0
  159. package/.agent-src/skills/readme-reviewer/SKILL.md +1 -1
  160. package/.agent-src/skills/rice-prioritization/SKILL.md +100 -0
  161. package/.agent-src/skills/rule-writing/SKILL.md +33 -0
  162. package/.agent-src/skills/sentry-integration/SKILL.md +1 -1
  163. package/.agent-src/skills/skill-writing/SKILL.md +14 -0
  164. package/.agent-src/skills/subagent-orchestration/SKILL.md +34 -2
  165. package/.agent-src/skills/terraform/SKILL.md +2 -2
  166. package/.agent-src/skills/terragrunt/SKILL.md +8 -8
  167. package/.agent-src/skills/test-performance/SKILL.md +5 -5
  168. package/.agent-src/skills/threat-modeling/SKILL.md +2 -2
  169. package/.agent-src/skills/token-optimizer/SKILL.md +110 -0
  170. package/.agent-src/skills/unit-economics-modeling/SKILL.md +104 -0
  171. package/.agent-src/skills/universal-project-analysis/SKILL.md +1 -1
  172. package/.agent-src/skills/using-git-worktrees/SKILL.md +1 -0
  173. package/.agent-src/templates/AGENTS.md +1 -1
  174. package/.agent-src/templates/agent-settings.md +25 -41
  175. package/.agent-src/templates/contexts/tenant-boundaries.md +2 -2
  176. package/.agent-src/templates/contexts.md +1 -1
  177. package/.agent-src/templates/copilot-instructions.md +21 -0
  178. package/.agent-src/templates/copilot-review-instructions.md +76 -0
  179. package/.agent-src/templates/features.md +1 -1
  180. package/.agent-src/templates/rule.md +127 -0
  181. package/.agent-src/templates/scripts/work_engine/hook_bootstrap.py +7 -5
  182. package/.agent-src/templates/scripts/work_engine/hooks/__init__.py +0 -4
  183. package/.agent-src/templates/scripts/work_engine/hooks/builtin/__init__.py +0 -4
  184. package/.agent-src/templates/scripts/work_engine/hooks/builtin/_chat_history_base.py +7 -51
  185. package/.agent-src/templates/scripts/work_engine/hooks/builtin/chat_history_append.py +1 -2
  186. package/.agent-src/templates/scripts/work_engine/hooks/builtin/chat_history_halt_append.py +1 -2
  187. package/.agent-src/templates/scripts/work_engine/hooks/builtin/memory_visibility.py +2 -3
  188. package/.agent-src/templates/skill.md +30 -1
  189. package/.claude-plugin/marketplace.json +11 -4
  190. package/AGENTS.md +71 -3
  191. package/CHANGELOG.md +180 -3
  192. package/README.md +24 -23
  193. package/config/agent-settings.template.yml +63 -23
  194. package/config/gitignore-block.txt +11 -4
  195. package/docs/architecture.md +84 -3
  196. package/docs/catalog.md +23 -11
  197. package/docs/contracts/adr-chat-history-split.md +10 -1
  198. package/docs/contracts/agent-memory-contract.md +1 -1
  199. package/docs/contracts/command-clusters.md +1 -1
  200. package/docs/contracts/context-paths.md +2 -1
  201. package/docs/contracts/cross-wing-handoff.md +133 -0
  202. package/docs/contracts/file-ownership-matrix.json +678 -609
  203. package/docs/contracts/hook-architecture-v1.md +8 -1
  204. package/docs/contracts/iron-law-overrides.txt +25 -0
  205. package/docs/contracts/kernel-membership.md +273 -0
  206. package/docs/contracts/load-context-schema.md +26 -11
  207. package/docs/contracts/memory-visibility-v1.md +8 -24
  208. package/docs/contracts/pilot/agent-authority.md +24 -0
  209. package/docs/contracts/pilot/direct-answers.md +70 -0
  210. package/docs/contracts/pilot/language-and-tone.md +63 -0
  211. package/docs/contracts/rule-classification.md +170 -0
  212. package/docs/contracts/rule-router.md +153 -0
  213. package/docs/customization.md +18 -7
  214. package/docs/decisions/ADR-001-kernel-swap-deferred.md +109 -0
  215. package/docs/decisions/ADR-002-kernel-bucket-overrides.md +124 -0
  216. package/docs/decisions/ADR-rule-kernel-and-router.md +122 -0
  217. package/docs/getting-started.md +19 -27
  218. package/docs/guidelines/agent-infra/ask-when-uncertain-demos.md +1 -1
  219. package/docs/guidelines/agent-infra/roadmap-progress-mechanics.md +176 -0
  220. package/docs/guidelines/agent-infra/rule-type-governance.md +73 -0
  221. package/docs/guidelines/agent-infra/size-and-scope.md +13 -2
  222. package/docs/guidelines/agent-infra/skill-quality-checklist.md +119 -0
  223. package/docs/guidelines/augment-portability-patterns.md +68 -0
  224. package/docs/guidelines/php/php-coding-patterns.md +62 -0
  225. package/docs/hook-payload-capture.md +221 -0
  226. package/docs/migrations/commands-1.15.0.md +17 -12
  227. package/docs/skills-catalog.md +5 -4
  228. package/llms.txt +4 -3
  229. package/package.json +1 -1
  230. package/scripts/_p43_bodies.py +235 -0
  231. package/scripts/_p43_compress.py +118 -0
  232. package/scripts/_p4_migrate.py +199 -0
  233. package/scripts/_pilot_council_question.py +57 -0
  234. package/scripts/_pilot_measure.py +53 -0
  235. package/scripts/agent-config +1 -1
  236. package/scripts/ai_council/_default_prices.py +4 -4
  237. package/scripts/ai_council/clients.py +1 -1
  238. package/scripts/ai_council/modes.py +3 -4
  239. package/scripts/ai_council/pricing.py +10 -9
  240. package/scripts/ai_council/session.py +107 -5
  241. package/scripts/build_linear_digest.py +3 -5
  242. package/scripts/build_rule_trigger_matrix.py +1 -9
  243. package/scripts/chat_history.py +952 -596
  244. package/scripts/check_always_budget.py +39 -6
  245. package/scripts/check_compressed_paths.py +213 -0
  246. package/scripts/check_compression.py +15 -0
  247. package/scripts/check_context_paths.py +1 -0
  248. package/scripts/check_council_layout.py +105 -0
  249. package/scripts/check_council_references.py +145 -0
  250. package/scripts/check_portability.py +2 -0
  251. package/scripts/check_references.py +14 -2
  252. package/scripts/check_token_optimizer_freshness.py +131 -0
  253. package/scripts/compile_router.py +148 -0
  254. package/scripts/compress.py +219 -11
  255. package/scripts/council_cli.py +63 -9
  256. package/scripts/council_prune.py +81 -0
  257. package/scripts/count_token_optimizer_usage.sh +54 -0
  258. package/scripts/hook_manifest.yaml +33 -0
  259. package/scripts/hooks/augment-chat-history.sh +10 -0
  260. package/scripts/hooks/cowork-dispatcher.sh +98 -0
  261. package/scripts/hooks/dispatch_hook.py +35 -0
  262. package/scripts/hooks_status.py +12 -1
  263. package/scripts/install-hooks.sh +2 -2
  264. package/scripts/install.sh +81 -2
  265. package/scripts/iron_law_sha.py +98 -0
  266. package/scripts/lint_handoffs.py +214 -0
  267. package/scripts/lint_hook_manifest.py +2 -1
  268. package/scripts/lint_load_context.py +35 -5
  269. package/scripts/measure_rule_budget.py +314 -0
  270. package/scripts/prototype_lint_contradictions.py +150 -0
  271. package/scripts/redact_hook_capture.py +148 -0
  272. package/scripts/schemas/rule.schema.json +55 -6
  273. package/scripts/schemas/skill.schema.json +5 -0
  274. package/scripts/skill_linter.py +359 -7
  275. package/scripts/smoke_path_resolution.py +93 -0
  276. package/scripts/update_prices.py +3 -3
  277. package/scripts/validate_frontmatter.py +41 -1
  278. package/.agent-src/commands/chat-history/checkpoint.md +0 -126
  279. package/.agent-src/commands/chat-history/clear.md +0 -103
  280. package/.agent-src/commands/chat-history/resume.md +0 -183
  281. package/.agent-src/contexts/communication/rules-auto/artifact-engagement-recording-mechanics.md +0 -72
  282. package/.agent-src/contexts/communication/rules-auto/augment-portability-mechanics.md +0 -79
  283. package/.agent-src/contexts/communication/rules-auto/cli-output-handling-mechanics.md +0 -87
  284. package/.agent-src/contexts/communication/rules-auto/command-suggestion-policy-mechanics.md +0 -62
  285. package/.agent-src/contexts/communication/rules-auto/docs-sync-mechanics.md +0 -78
  286. package/.agent-src/contexts/communication/rules-auto/package-ci-checks-mechanics.md +0 -85
  287. package/.agent-src/contexts/communication/rules-auto/review-routing-awareness-mechanics.md +0 -65
  288. package/.agent-src/contexts/communication/rules-auto/roadmap-progress-sync-mechanics.md +0 -78
  289. package/.agent-src/contexts/communication/rules-auto/ui-audit-gate-mechanics.md +0 -53
  290. package/.agent-src/rules/chat-history-cadence.md +0 -143
  291. package/.agent-src/rules/chat-history-ownership.md +0 -124
  292. package/.agent-src/rules/chat-history-visibility.md +0 -97
  293. package/.agent-src/templates/scripts/work_engine/hooks/builtin/chat_history_heartbeat.py +0 -50
  294. package/.agent-src/templates/scripts/work_engine/hooks/builtin/chat_history_turn_check.py +0 -49
  295. package/scripts/check_phase_coupling.py +0 -148
  296. /package/{docs → .agent-src/contexts}/contracts/artifact-engagement-flow.md +0 -0
  297. /package/{docs → .agent-src/contexts}/contracts/command-suggestion-flow.md +0 -0
@@ -8,12 +8,7 @@ source: package
8
8
 
9
9
  # No Cheap Questions
10
10
 
11
- A question is **cheap** when the answer follows from stated context,
12
- an option breaches an Iron Law, choices differ only in sequencing /
13
- format, or one option is obviously dominant. Mode-independent — holds
14
- in `off`, `auto`, and `on`; autonomy never lifts the no-trade-off
15
- floor (cf. [`autonomous-execution`](autonomous-execution.md), whose
16
- "trivial" failure modes only scope to `on` / opted-in `auto`).
11
+ A question is **cheap** when context already answers, an option breaches an Iron Law, choices differ only in sequencing / format, or one option is dominant. Mode-independent — `off`, `auto`, `on`. Autonomy never lifts the floor.
17
12
 
18
13
  ## The Iron Laws
19
14
 
@@ -23,54 +18,43 @@ NEVER PRESENT AN OPTION THAT VIOLATES AN IRON LAW.
23
18
  NEVER OFFER NUMBERED CHOICES WITHOUT A REAL TRADE-OFF.
24
19
  ```
25
20
 
26
- Hold in `off`, `auto`, and `on`. Autonomy never lifts them.
27
-
28
21
  ## What counts as cheap
29
22
 
30
23
  - **Sequencing** — "Step 2 or 3 next?" when the roadmap orders them.
31
24
  - **Format-only** — "Table or paragraph?"; no semantic trade-off.
32
25
  - **Commit asks** — forbidden by [`commit-policy`](commit-policy.md).
33
26
  - **CI / test asks** — [`verify-before-complete`](verify-before-complete.md) decides, not the user.
34
- - **Fenced-step re-asks** — "Start Phase 1?" after *"plan only"*; see
35
- [`scope-control § fenced step`](scope-control.md#fenced-step--user-set-review-gates).
36
- - **Iron-Law option** — breaches `commit-policy`, `scope-control` § git-ops, or `non-destructive-by-default`.
27
+ - **Fenced-step re-asks** — "Start Phase 1?" after *"plan only"*; see [`scope-control § fenced step`](scope-control.md#fenced-step--user-set-review-gates).
28
+ - **Iron-Law option** — breaches `commit-policy`, `scope-control § git-ops`, or `non-destructive-by-default`.
37
29
  - **Context-derived** — answer follows from prior turn / standing instruction / roadmap; act, state the assumption inline.
38
30
  - **Dominant option** — one choice obviously correct; alternatives carry no upside.
39
31
  - **Re-ask after decline** — forbidden per [`scope-control § decline = silence`](scope-control.md#decline--silence--no-re-asking-on-the-same-task).
40
32
 
41
- Examples per class:
42
- [`asking-and-brevity-examples`](../../docs/guidelines/agent-infra/asking-and-brevity-examples.md#cheap-question-class-catalog--extended-examples).
33
+ Examples per class: [`asking-and-brevity-examples § cheap-question-catalog`](../docs/guidelines/agent-infra/asking-and-brevity-examples.md#cheap-question-class-catalog--extended-examples).
43
34
 
44
35
  ## Pre-Send Self-Check — MANDATORY before every question
45
36
 
46
37
  Run silently before any numbered-options block:
47
38
 
48
39
  1. Answer already in stated context?
49
- 2. Any option violates `commit-policy`, `scope-control` § git-ops, or `non-destructive-by-default`?
40
+ 2. Any option violates `commit-policy`, `scope-control § git-ops`, or `non-destructive-by-default`?
50
41
  3. Options pure sequencing / format, no trade-off?
51
42
  4. One option obviously dominant?
52
- 5. User fenced next step (*"plan only"*, *"review first"*) → deliver + handback per `scope-control` § fenced step.
53
- 6. User already declined? Re-ask forbidden per `scope-control` § decline = silence.
43
+ 5. User fenced next step (*"plan only"*, *"review first"*) → deliver + handback per `scope-control § fenced step`.
44
+ 6. User already declined? Re-ask forbidden per `scope-control § decline = silence`.
54
45
 
55
- Any "yes" → **do not ask**. Pick the dominant path, state assumption
56
- inline (*"assuming X — adjust if wrong"*), hand back. One-question-per-turn
57
- from [`ask-when-uncertain`](ask-when-uncertain.md) still applies when
58
- the question is genuine.
46
+ Any "yes" → **do not ask**. Pick the dominant path, state assumption inline (*"assuming X — adjust if wrong"*), hand back. One-question-per-turn from [`ask-when-uncertain`](ask-when-uncertain.md) still applies when the question is genuine.
59
47
 
60
48
  ## When asking IS allowed
61
49
 
62
50
  - Real architectural / scope decision with non-obvious trade-offs.
63
- - Vague-request trigger per [`ask-when-uncertain`](ask-when-uncertain.md#vague-request-triggers--must-ask).
51
+ - Vague-request trigger per [`ask-when-uncertain § vague-triggers`](ask-when-uncertain.md#vague-request-triggers--must-ask).
64
52
  - Security-sensitive path per [`security-sensitive-stop`](security-sensitive-stop.md).
65
- - Hard Floor per `non-destructive-by-default` — confirmation mandatory.
53
+ - Hard Floor per [`non-destructive-by-default`](non-destructive-by-default.md) — confirmation mandatory.
66
54
  - Two genuinely-equivalent paths; user preference is the tiebreaker.
67
55
 
68
56
  In doubt → ask. This rule narrows asking, never widens silence.
69
57
 
70
58
  ## Interactions
71
59
 
72
- - [`ask-when-uncertain`](ask-when-uncertain.md) vague triggers + one-question-per-turn; narrows the cheap subset.
73
- - [`autonomous-execution`](autonomous-execution.md) — mode-scoped triviality there; mode-independent floor here.
74
- - [`commit-policy`](commit-policy.md) · [`scope-control`](scope-control.md) · [`non-destructive-by-default`](non-destructive-by-default.md) — Iron Laws this rule defends.
75
- - [`user-interaction`](user-interaction.md) — numbered-options shape; this rule decides whether to send.
76
- - [`direct-answers`](direct-answers.md) — brevity, no flattery.
60
+ [`ask-when-uncertain`](ask-when-uncertain.md) · [`autonomous-execution`](autonomous-execution.md) · [`commit-policy`](commit-policy.md) · [`scope-control`](scope-control.md) · [`non-destructive-by-default`](non-destructive-by-default.md) · [`user-interaction`](user-interaction.md) · [`direct-answers`](direct-answers.md).
@@ -0,0 +1,76 @@
1
+ ---
2
+ type: "auto"
3
+ tier: "mechanical-already"
4
+ description: "Linking a specific file in agents/council-{questions,responses,sessions}/ from any artifact — council files are gitignored, local-only, auto-pruned; inline the convergence instead"
5
+ alwaysApply: false
6
+ source: package
7
+ triggers:
8
+ - path_prefix: "agents/council-questions/"
9
+ - path_prefix: "agents/council-responses/"
10
+ - path_prefix: "agents/council-sessions/"
11
+ - intent: "link to council artefact"
12
+ routes_to:
13
+ - "skill:ai-council"
14
+ validator_ignore:
15
+ - type: "substring"
16
+ pattern: ".agent-src.uncompressed/"
17
+ reason: "Rule references the authoring tree when contrasting transient council files."
18
+ ---
19
+
20
+ # No Council References from Any Artifact
21
+
22
+ Council artefacts under `agents/council-{questions,responses,sessions}/`
23
+ are **gitignored, local-only, and auto-pruned** after
24
+ `ai_council.session_retention_days` (default 7). They are
25
+ disposable scratch — never part of the repo, never visible to a
26
+ reviewer who clones, never durable across the retention window.
27
+
28
+ A link to a specific council file rots three ways: gitignored
29
+ (not in cloned repo), pruned after retention window (gone even
30
+ locally), and the installed `.augment/` projection cannot follow a
31
+ path that does not exist in the consumer.
32
+
33
+ ## The Iron Law
34
+
35
+ ```
36
+ NEVER LINK TO A SPECIFIC FILE INSIDE
37
+ agents/council-{questions,responses,sessions}/
38
+ FROM ANY ARTIFACT — ROADMAPS INCLUDED.
39
+ INLINE THE CONVERGENCE WITH DATE + MEMBERS, NEVER THE PATH.
40
+ ```
41
+
42
+ Applies to **every** artifact. Council artefacts are more transient
43
+ than roadmaps — the local copy disappears too.
44
+
45
+ ## Forbidden vs allowed
46
+
47
+ **Forbidden** in any `*.md` / `*.yml` / `*.json` / `*.py`:
48
+ `agents/council-questions/<file>.md`,
49
+ `agents/council-responses/<file>.json`,
50
+ `agents/council-sessions/<file>.json` or `<timestamp>/...`.
51
+
52
+ **Allowed**: directory mentions (talking about the output convention,
53
+ not a specific file); the `ai-council` skill and `/council:*` commands
54
+ documenting the output path schema; inline convergence summary —
55
+ e.g. *"Council (claude-sonnet-4-5 + gpt-4o, 2026-05-06) converged
56
+ on …"* with date + members, no filepath.
57
+
58
+ ## What to do instead
59
+
60
+ Identify the durable conclusion (decision, contract, lesson),
61
+ inline a convergence-summary block (members, date, cost if relevant
62
+ — see `ai-council` § Output format), and optionally promote the
63
+ lesson to `agents/contexts/`. The context is durable; the council
64
+ file was the catalyst.
65
+
66
+ Failure mode: *"I'll just link to the session JSON, it's evidence."*
67
+ The session is gone in 7 days. **Inline first, link never.**
68
+
69
+ ## See also
70
+
71
+ - [`no-roadmap-references`](no-roadmap-references.md) — sibling rule
72
+ for the roadmap layer
73
+ - [`augment-source-of-truth`](augment-source-of-truth.md) — edit
74
+ `.agent-src.uncompressed/`
75
+ - [`ai-council`](../skills/ai-council/SKILL.md) — output path
76
+ convention and convergence-summary format
@@ -4,6 +4,13 @@ tier: "mechanical-already"
4
4
  description: "Adding a link to a specific file in agents/roadmaps/ from any stable artifact (rule, skill, command, context, guideline) — roadmaps are transient; promote durable findings to agents/contexts/ instead"
5
5
  alwaysApply: false
6
6
  source: package
7
+ triggers:
8
+ - path_prefix: "agents/roadmaps/"
9
+ - intent: "link from stable artifact"
10
+ validator_ignore:
11
+ - type: "substring"
12
+ pattern: ".agent-src.uncompressed/"
13
+ reason: "Rule contrasts the authoring tree with transient roadmap files."
7
14
  ---
8
15
 
9
16
  # No Roadmap References from Stable Artifacts
@@ -45,7 +52,7 @@ CI enforcement: `scripts/check_no_roadmap_refs.py` (companion linter
45
52
  - `agents/roadmaps/` and its subdirectories as directory mentions
46
53
  (talking about the layer, not a specific file)
47
54
  - Roadmap → roadmap references (siblings within the transient layer)
48
- - Council sessions, `.agent-chat-history`, commit messages, PR
55
+ - Council sessions, `agents/.agent-chat-history`, commit messages, PR
49
56
  descriptions — transient by construction, not part of the package
50
57
  surface
51
58
 
@@ -5,16 +5,12 @@ description: "Agent is never destructive — Hard Floor always asks for prod-tru
5
5
  alwaysApply: true
6
6
  source: package
7
7
  load_context:
8
- - .agent-src.uncompressed/contexts/authority/destructive-mechanics.md
8
+ - ../contexts/authority/destructive-mechanics.md
9
9
  ---
10
10
 
11
11
  # Non-Destructive by Default
12
12
 
13
- The agent is **never** destructive and **never** endangers user work
14
- or production systems. This is the universal safety floor — it applies
15
- in every mode, every conversation, every turn. Autonomy settings, "just
16
- keep going" directives, roadmap authorizations, and standing
17
- permissions narrow other rules; **none of them lift this one**.
13
+ Universal safety floor. Applies in every mode, every conversation, every turn. Autonomy, "just keep going", roadmap authorizations, and standing permissions narrow other rules — **none lift this one**.
18
14
 
19
15
  ## The Iron Law
20
16
 
@@ -24,61 +20,35 @@ NO AUTONOMY SETTING, NO ROADMAP STEP, NO STANDING INSTRUCTION,
24
20
  NO "JUST KEEP GOING" CAN BYPASS IT.
25
21
  ```
26
22
 
27
- Triggers below require explicit user confirmation **on this turn** —
28
- not from a previous turn, not from a roadmap, not from a standing
29
- autonomy directive (see [`autonomous-execution`](autonomous-execution.md#opt-in-detection--match-by-intent-not-exact-string)
30
- for the anchor list of recognized phrases):
23
+ Triggers below require explicit user confirmation **on this turn** — not from a previous turn, not from a roadmap, not from a standing autonomy directive (anchor list: [`autonomous-execution § opt-in detection`](autonomous-execution.md#opt-in-detection--match-by-intent-not-exact-string)):
31
24
 
32
25
  | Trigger | Examples |
33
26
  |---|---|
34
- | **Production-branch merge** | merging into `main`, `master`, `prod`, `production`, `release/*`, or any branch the project marks as deployment trunk |
27
+ | **Production-branch merge** | `main`, `master`, `prod`, `production`, `release/*`, or any branch the project marks as deployment trunk |
35
28
  | **Deploy / release** | `terraform apply` on prod, `kubectl apply` on prod, deploy scripts, release commands, tag pushes that trigger CI deployment |
36
29
  | **Push to remote** | any `git push` (also covered by [`scope-control`](scope-control.md), restated so the floor never weakens) |
37
- | **Production data / infra** | prod DB writes or migrations, prod config, secrets rotation, IAM / role / policy, DNS, anything in a `prod`-scoped path or pipeline |
38
- | **Whimsical or unscoped bulk deletion** | `rm -rf <dir>`, `git rm -r`, glob deletions, `DROP TABLE`, `TRUNCATE`, `git reset --hard` past unpushed work — when the deletions are **not required by the current task**. Task-aligned bulk deletions are allowed during WIP — see below. |
39
- | **Commit containing bulk deletions or infra changes** | a commit whose diff removes a directory, deletes ≥5 unrelated files, or touches Terraform / Pulumi / k8s manifests / Ansible / cloud-config — surface the diff and confirm even when [`commit-policy`](commit-policy.md) otherwise authorizes the commit |
30
+ | **Production data / infra** | prod DB writes / migrations, prod config, secrets rotation, IAM / role / policy, DNS, anything in a `prod`-scoped path or pipeline |
31
+ | **Whimsical / unscoped bulk deletion** | `rm -rf <dir>`, `git rm -r`, glob deletions, `DROP TABLE`, `TRUNCATE`, `git reset --hard` past unpushed work — when **not required** by the current task. Task-aligned WIP deletions are allowed (below) |
32
+ | **Commit containing bulk deletions or infra changes** | commit whose diff removes a directory, deletes ≥5 unrelated files, or touches Terraform / Pulumi / k8s manifests / Ansible / cloud-config — surface diff and confirm even when [`commit-policy`](commit-policy.md) otherwise authorizes |
40
33
 
41
- Standing "just keep going" + next step crosses the floor → STOP,
42
- surface what's about to happen (one numbered-options block per
43
- [`user-interaction`](user-interaction.md)), wait. Other rules still
44
- apply to every other step.
34
+ Standing "just keep going" + next step crosses the floor → STOP, surface what's about to happen (one numbered-options block per [`user-interaction`](user-interaction.md)), wait. Other rules still apply to every other step.
45
35
 
46
36
  ## Not in scope — deterministic regeneration
47
37
 
48
- Output regenerated from a tracked source (compression, code-gen,
49
- formatter passes, lock-file rebuilds) is not destructive — the source
50
- of truth makes it reversible. Lives in
51
- [`autonomous-execution`](autonomous-execution.md#trivial--just-act-do-not-ask)
52
- § Trivial, not here. Per-file diff approval is theater.
38
+ Output regenerated from a tracked source (compression, code-gen, formatter passes, lock-file rebuilds) is reversible from source — **not destructive**. Lives in [`autonomous-execution § Trivial`](autonomous-execution.md#trivial--just-act-do-not-ask). Per-file diff approval is theater.
53
39
 
54
40
  ## Bulk deletions during WIP — allowed if task-connected
55
41
 
56
- Deletions inside an **active, user-stated task** are allowed in the
57
- working tree, **even multiple files or multiple folders** — the Hard
58
- Floor moves to the **commit** (row 6 above), not the in-progress edit.
59
- Whimsical / drive-by / unnamed-scope deletions still trip the floor on
60
- the edit. Full allowed/forbidden lists in
61
- [`destructive-mechanics`](../contexts/authority/destructive-mechanics.md)
62
- § Bulk deletions during WIP.
42
+ Deletions inside an **active, user-stated task** are allowed in the working tree, even multiple files / folders — the Hard Floor moves to the **commit** (row 6), not the in-progress edit. Whimsical / drive-by / unnamed-scope deletions still trip the floor on the edit. Allowed / forbidden lists: [`destructive-mechanics § Bulk deletions during WIP`](../contexts/authority/destructive-mechanics.md).
63
43
 
64
44
  ## Failure modes
65
45
 
66
- The full failure-mode catalog (autonomy-as-cover, roadmap-as-authorization,
67
- refusing-named-deletions, commit-without-diff-surface,
68
- roadmap-step-≠-commit-authorization) lives in
69
- [`destructive-mechanics`](../contexts/authority/destructive-mechanics.md)
70
- § Failure modes. Reach for it when a Hard-Floor situation feels
71
- ambiguous; the rule itself stays focused on the trigger table.
46
+ Full catalog (autonomy-as-cover, roadmap-as-authorization, refusing-named-deletions, commit-without-diff-surface, roadmap-step ≠ commit-authorization): [`destructive-mechanics § Failure modes`](../contexts/authority/destructive-mechanics.md).
72
47
 
73
48
  ## Cloud Behavior
74
49
 
75
- The Hard Floor applies on every surface, including Claude.ai Web,
76
- Skills API, and any cloud agent. There is no "cloud override" — the
77
- floor predates and outranks any platform-specific autonomy default.
50
+ Floor applies on every surface Claude.ai Web, Skills API, any cloud agent. No "cloud override".
78
51
 
79
52
  ## See also
80
53
 
81
- - [`autonomous-execution`](autonomous-execution.md) defers to this rule for the floor; covers trivial-vs-blocking and opt-in detection only
82
- - [`commit-policy`](commit-policy.md) — four commit-exception paths; row 6 of the floor still applies on top of all four
83
- - [`scope-control`](scope-control.md) — git-ops permission gate; the floor is the never-overridable subset
84
- - [`user-interaction`](user-interaction.md) — numbered-options Iron Law for the confirmation prompt
54
+ [`autonomous-execution`](autonomous-execution.md) · [`commit-policy`](commit-policy.md) · [`scope-control`](scope-control.md) · [`user-interaction`](user-interaction.md).
@@ -2,126 +2,18 @@
2
2
  type: "auto"
3
3
  tier: "1"
4
4
  description: "First turn of a conversation on a project — check onboarding.onboarded in .agent-settings.yml; when false, prompt the user to run /onboard before executing any other request"
5
- alwaysApply: false
6
5
  source: package
6
+ triggers:
7
+ - phrase: "first turn"
8
+ - keyword: "onboarding"
9
+ - path_prefix: ".agent-settings.yml"
10
+ routes_to:
11
+ - "command:onboard"
7
12
  ---
8
13
 
9
14
  # Onboarding Gate
10
15
 
11
- > **Enforced by:** [`scripts/onboarding_gate_hook.py`](../../scripts/onboarding_gate_hook.py)
12
- > on Augment + Claude Code (`SessionStart`). The hook refreshes
13
- > `agents/state/onboarding-gate.json` from `.agent-settings.yml`; the
14
- > prose below is the spec the hook implements and the fallback for
15
- > platforms without a hook surface.
16
+ **Iron Law.** First turn of a project: if `onboarding.onboarded` is false, prompt `/onboard` before executing any other request.
16
17
 
17
- Forces a one-time `/onboard` run for each developer on each project. This
18
- replaces the previously scattered "ask once" patterns across `user_name`,
19
- `personal.ide`, `personal.rtk_installed`, and cost profile confirmation.
20
-
21
- ## When to activate
22
-
23
- Read `onboarding.onboarded` from `.agent-settings.yml` **once per
24
- conversation**, on the very first agent turn.
25
-
26
- - Key missing entirely → **legacy project**. Treat as onboarded, do
27
- nothing. Do not write the key.
28
- - `true` → do nothing. Rule is inert for the rest of the conversation.
29
- - `false` → gate is active for this conversation (see below).
30
-
31
- Cache the result for the whole conversation. Do not re-read on every turn.
32
-
33
- ## Gate behavior when `onboarded: false`
34
-
35
- On the **first** turn of the conversation, before executing the user's
36
- request, emit this prompt and stop:
37
-
38
- ```
39
- > 👋 First-run setup hasn't been completed for this project.
40
- >
41
- > Run /onboard once (≈2 minutes) to capture:
42
- > • your name, IDE, and rtk status
43
- > • cost profile + learning loop confirmation
44
- >
45
- > 1. Run /onboard now
46
- > 2. Skip — mark as onboarded and continue with the request
47
- > 3. Snooze — continue just this turn; ask again next conversation
48
- ```
49
-
50
- - `1` → invoke `/onboard`. Resume the user's original request afterwards.
51
- - `2` → set `onboarding.onboarded: true` in `.agent-settings.yml` (touch
52
- only that field; preserve comments and order). Then execute the
53
- original request.
54
- - `3` → proceed with the original request. Do not ask again in this
55
- conversation. Do not write the file.
56
-
57
- Free-text replies (`"mach weiter"`, `"just do it"`) count as `3`.
58
-
59
- ## Exceptions — do NOT block
60
-
61
- Skip the gate when the user's request already is an onboarding or
62
- settings operation, so we don't prompt users mid-setup:
63
-
64
- - `/onboard`, `/set-cost-profile`, `/mode`
65
- - The user explicitly asks about `.agent-settings.yml` or onboarding
66
- - Incident / break-glass signals (`hotfix`, `break-glass`, `"prod is
67
- down"`). The gate waits for normal operations to resume.
68
-
69
- ## Non-blocking for legacy projects
70
-
71
- If `.agent-settings.yml` exists but has no `onboarding` section at all,
72
- treat as onboarded. Only `onboarded: false` (explicit) triggers the
73
- gate. This protects projects that were set up before this rule shipped.
74
-
75
- ## What this rule does NOT do
76
-
77
- - Write `onboarded: true` automatically. Only `/onboard` (step 6) and
78
- the user's explicit `2` choice do that.
79
- - Re-prompt across turns in the same conversation. One prompt per
80
- conversation, max.
81
- - Replace normal settings edits. Mid-life changes are ad-hoc (edit the
82
- file directly or ask the agent, which follows
83
- [`layered-settings`](../../docs/guidelines/agent-infra/layered-settings.md#section-aware-merge-rules));
84
- this rule is a one-time gate.
85
- - Run on every agent turn. First turn only.
86
-
87
- ## Interactions
88
-
89
- - `ask-when-uncertain` — the gate uses its numbered-options iron law;
90
- one question per turn.
91
- - `language-and-tone` — prompt is translated to the user's language at
92
- runtime; `.md` source stays English.
93
- - `scope-control` — option `2` writes exactly one key; no side effects.
94
- - `role-mode-adherence` — gate runs BEFORE the mode marker is emitted.
95
-
96
- ## Copilot fallback
97
-
98
- GitHub Copilot has no `SessionStart` hook surface, so
99
- `scripts/onboarding_gate_hook.py` cannot run structurally and
100
- `agents/state/onboarding-gate.json` is not refreshed for the agent.
101
- On the first turn of a Copilot conversation:
102
-
103
- 1. Read `onboarding.onboarded` from `.agent-settings.yml` directly
104
- (one read per conversation, then cache as the prose above
105
- describes).
106
- 2. Optionally refresh the state file manually so other tooling sees
107
- the same value the hook would have written:
108
-
109
- ```bash
110
- python3 scripts/onboarding_gate_hook.py < /dev/null
111
- ```
112
-
113
- The script reads `.agent-settings.yml`, atomically writes
114
- `agents/state/onboarding-gate.json`, and exits 0 — same payload
115
- the Augment / Claude / Cursor / Cline / Windsurf / Gemini hook
116
- would have produced.
117
- 3. Apply the gate behavior from "Gate behavior when `onboarded:
118
- false`" above. The cooperative path is the spec; the hook is the
119
- cache.
120
-
121
- ## See also
122
-
123
- - [`/onboard`](../commands/onboard.md) — the command this gate invokes
124
- - [`layered-settings`](../../docs/guidelines/agent-infra/layered-settings.md) — merge rules for mid-life edits
125
- - [`agent-settings` template](../templates/agent-settings.md) — `onboarding.onboarded` reference
126
- - [`rule-type-governance`](rule-type-governance.md) — why this is `always`
127
- - [`hardening-pattern`](../../agents/contexts/hardening-pattern.md) — Tier 1 mechanical-rule contract
18
+ Body migrated to `command:onboard` (per P4 of `road-to-kernel-and-router.md`).
19
+ Trigger-set above activates this routing under the `balanced` and `full` profiles.
@@ -1,46 +1,19 @@
1
1
  ---
2
2
  type: "auto"
3
3
  tier: "mechanical-already"
4
- alwaysApply: false
5
4
  description: "Before pushing to remote or creating a PR in the agent-config package — run all CI checks locally first"
6
5
  source: package
7
- load_context:
8
- - .agent-src.uncompressed/contexts/communication/rules-auto/package-ci-checks-mechanics.md
6
+ triggers:
7
+ - phrase: "task ci"
8
+ - phrase: "before push"
9
+ - phrase: "before pr"
10
+ routes_to:
11
+ - "skill:lint-skills"
9
12
  ---
10
13
 
11
- # Package CI Checks
14
+ # Package Ci Checks
12
15
 
13
- ## When this applies
16
+ **Iron Law.** Run `task ci` locally and confirm green before pushing or opening a PR in this package.
14
17
 
15
- Before **any** push to remote or PR creation in the **agent-config** package.
16
- This rule is specific to this package it does NOT apply to consumer projects.
17
-
18
- ## The Iron Law
19
-
20
- ```
21
- NEVER push without running ALL CI checks locally first.
22
- ```
23
-
24
- Every CI pipeline failure is preventable by running these checks before pushing.
25
-
26
- ## Required checks — see mechanics
27
-
28
- Five checks must pass locally before push, in this order:
29
-
30
- 1. **Sync** — `compress.sh --check` and `--check-hashes`.
31
- 2. **Consistency** — `check_compression.py`, `check_references.py`, `check_portability.py`.
32
- 3. **Linter** — `skill_linter.py --all`, 0 FAIL required.
33
- 4. **Tests** — `pytest tests/`.
34
- 5. **README** — `readme_linter.py`.
35
-
36
- The full command snippets, common-failure notes per step, the quick
37
- chained one-liner, and the post-edit workflow ("after editing
38
- skills/rules", "after editing `scripts/compress.py`") all live in
39
- [`contexts/communication/rules-auto/package-ci-checks-mechanics.md`](../contexts/communication/rules-auto/package-ci-checks-mechanics.md).
40
- Pull it whenever pre-push verification is needed.
41
-
42
- ## Do NOT
43
-
44
- - Do NOT push "to see if CI passes" — that wastes pipeline minutes
45
- - Do NOT skip hash checks because "I only changed one file"
46
- - Do NOT assume tests pass because linter passes — they check different things
18
+ Body migrated to `skill:lint-skills` (per P4 of `road-to-kernel-and-router.md`).
19
+ Trigger-set above activates this routing under the `balanced` and `full` profiles.
@@ -2,63 +2,18 @@
2
2
  type: "auto"
3
3
  tier: "3"
4
4
  description: "Writing or reviewing PHP code — strict types, naming, comparisons, early returns, Eloquent conventions"
5
- alwaysApply: false
6
5
  source: package
6
+ triggers:
7
+ - file_pattern: "*.php"
8
+ - keyword: "phpstan"
9
+ - keyword: "ecs"
10
+ routes_to:
11
+ - "guideline:php/php-coding-patterns"
7
12
  ---
8
13
 
9
- # PHP Coding Rules
14
+ # Php Coding
10
15
 
11
- - Use `declare(strict_types=1)` in every **new** PHP file. Not required when modifying existing files that don't have it.
12
- - 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.
13
- - 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.
14
- - Never use `float` for money — use `decimal` or the `Math` helper.
15
- - Always use `===` / `!==` (strict comparison), Yoda style: `null === $var`.
16
- - Early return over nested if/else.
17
- - No one-liner if statements.
18
- - Single quotes for strings without interpolation. `sprintf()` for complex strings.
19
- - Variables: `camelCase`. Array keys: `snake_case`. Constants: `UPPER_SNAKE_CASE`.
20
- - Typed properties, parameters, and return types — always.
21
- - Constructor property promotion where it makes sense.
16
+ **Iron Law.** PHP: strict types, named comparisons, early returns, Eloquent conventions full pattern library in the guideline.
22
17
 
23
- ## Eloquent Models Attribute Access
24
-
25
- Read `eloquent.access_style` from `.agent-settings.yml` to determine the preferred style.
26
- Default: `getters_setters`. See the `eloquent` skill for the full reference table and examples.
27
-
28
- - **`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.
29
- - **`get_attribute`**: Use `getAttribute('column_name')`/`setAttribute('column_name', $value)` everywhere, no getters/setters needed.
30
- - **`magic_properties`**: Laravel default `$model->column_name` everywhere.
31
-
32
- ### Relationship Getters
33
-
34
- - Every relationship MUST have a typed getter method **above** the relationship method.
35
- - **Inside the getter:** use `$this->getAttribute('relationship_name')`, NEVER `$this->relationship_name`.
36
- - **Outside the model:** ALWAYS use the getter (`$model->getEquipment()`), NEVER access the magic property (`$model->equipment`).
37
- - Use `instanceof` checks instead of `null ===` when checking relationship results.
38
-
39
- ## Eloquent Models — Observers over `booted()`
40
-
41
- - Do NOT use `booted()` / `boot()` for model lifecycle hooks (saving, saved, deleted, etc.).
42
- - Use a dedicated **Observer** class registered via `#[ObservedBy]` attribute.
43
- - This keeps models slim and lifecycle logic testable and discoverable.
44
-
45
- ## PHPStan
46
-
47
- - Always fix the root cause. Do NOT add entries to `phpstan-baseline.neon`.
48
- - 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.**
49
- - If a fix is truly impossible (confirmed false positive), use an inline ignore as last resort:
50
- ```php
51
- // @phpstan-ignore-next-line — false positive: reason here
52
- ```
53
-
54
- ## Testing
55
-
56
- - Always write tests in **Pest**, not PHPUnit class syntax — unless the user explicitly asks for PHPUnit.
57
- - Pest tests in `tests/Unit/` automatically use `UnitTestCase` as the base class (configured in `tests/Pest.php`).
58
-
59
- ## PHPDoc
60
-
61
- - Only add PHPDoc when type hints are insufficient (e.g. generic arrays: `@param array<int, MyObject> $items`).
62
- - Do NOT add PHPDoc that just repeats the method signature.
63
- - One docblock per method — never split into multiple `/** */` blocks.
64
- - Tag order: `@param` → `@return` → `@throws`.
18
+ Body migrated to `guideline:php/php-coding-patterns` (per P4 of `road-to-kernel-and-router.md`).
19
+ Trigger-set above activates this routing under the `balanced` and `full` profiles.
@@ -4,6 +4,15 @@ tier: "2b"
4
4
  alwaysApply: false
5
5
  description: "When merging, refactoring, compressing, or restructuring skills, rules, commands, or guidelines — prevent quality loss"
6
6
  source: package
7
+ triggers:
8
+ - intent: "merge skill"
9
+ - intent: "compress rule"
10
+ - intent: "refactor artifact"
11
+ - keyword: "Iron Law"
12
+ validator_ignore:
13
+ - type: "substring"
14
+ pattern: ".agent-src.uncompressed/"
15
+ reason: "Rule references the authoring tree as the operand of compression/preservation."
7
16
  ---
8
17
 
9
18
  # Preservation Guard