@event4u/agent-config 1.15.0 → 1.17.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 (354) hide show
  1. package/.agent-src/commands/{agents-audit.md → agents/audit.md} +4 -3
  2. package/.agent-src/commands/{agents-cleanup.md → agents/cleanup.md} +12 -6
  3. package/.agent-src/commands/{agents-prepare.md → agents/prepare.md} +4 -3
  4. package/.agent-src/commands/agents.md +46 -0
  5. package/.agent-src/commands/bug-fix.md +1 -1
  6. package/.agent-src/commands/bug-investigate.md +2 -2
  7. package/.agent-src/commands/{chat-history-checkpoint.md → chat-history/checkpoint.md} +5 -5
  8. package/.agent-src/commands/{chat-history-clear.md → chat-history/clear.md} +5 -5
  9. package/.agent-src/commands/{chat-history-resume.md → chat-history/resume.md} +4 -4
  10. package/.agent-src/commands/chat-history/show.md +107 -0
  11. package/.agent-src/commands/chat-history.md +33 -89
  12. package/.agent-src/commands/check-current-md.md +1 -1
  13. package/.agent-src/commands/{commit-in-chunks.md → commit/in-chunks.md} +15 -13
  14. package/.agent-src/commands/commit.md +22 -2
  15. package/.agent-src/commands/{context-create.md → context/create.md} +4 -3
  16. package/.agent-src/commands/{context-refactor.md → context/refactor.md} +4 -3
  17. package/.agent-src/commands/context.md +44 -0
  18. package/.agent-src/commands/{copilot-agents-init.md → copilot-agents/init.md} +4 -3
  19. package/.agent-src/commands/{copilot-agents-optimize.md → copilot-agents/optimize.md} +4 -3
  20. package/.agent-src/commands/copilot-agents.md +44 -0
  21. package/.agent-src/commands/council/default.md +221 -0
  22. package/.agent-src/commands/council/design.md +97 -0
  23. package/.agent-src/commands/council/optimize.md +116 -0
  24. package/.agent-src/commands/council/pr.md +124 -0
  25. package/.agent-src/commands/council.md +54 -0
  26. package/.agent-src/commands/{create-pr-description.md → create-pr/description-only.md} +4 -2
  27. package/.agent-src/commands/create-pr.md +49 -5
  28. package/.agent-src/commands/e2e-heal.md +1 -1
  29. package/.agent-src/commands/e2e-plan.md +1 -1
  30. package/.agent-src/commands/{feature-dev.md → feature/dev.md} +6 -3
  31. package/.agent-src/commands/{feature-explore.md → feature/explore.md} +5 -4
  32. package/.agent-src/commands/{feature-plan.md → feature/plan.md} +32 -5
  33. package/.agent-src/commands/{feature-refactor.md → feature/refactor.md} +4 -3
  34. package/.agent-src/commands/{feature-roadmap.md → feature/roadmap.md} +7 -6
  35. package/.agent-src/commands/feature.md +52 -0
  36. package/.agent-src/commands/{fix-ci.md → fix/ci.md} +4 -3
  37. package/.agent-src/commands/{fix-portability.md → fix/portability.md} +4 -3
  38. package/.agent-src/commands/{fix-pr-bot-comments.md → fix/pr-bots.md} +4 -3
  39. package/.agent-src/commands/{fix-pr-developer-comments.md → fix/pr-developers.md} +4 -3
  40. package/.agent-src/commands/{fix-pr-comments.md → fix/pr.md} +7 -6
  41. package/.agent-src/commands/{fix-references.md → fix/refs.md} +4 -3
  42. package/.agent-src/commands/{fix-seeder.md → fix/seeder.md} +4 -3
  43. package/.agent-src/commands/fix.md +54 -0
  44. package/.agent-src/commands/jira-ticket.md +1 -1
  45. package/.agent-src/commands/{do-and-judge.md → judge/on-diff.md} +7 -6
  46. package/.agent-src/commands/judge/solo.md +90 -0
  47. package/.agent-src/commands/{do-in-steps.md → judge/steps.md} +8 -7
  48. package/.agent-src/commands/judge.md +35 -70
  49. package/.agent-src/commands/{memory-add.md → memory/add.md} +7 -6
  50. package/.agent-src/commands/{memory-full.md → memory/load.md} +6 -5
  51. package/.agent-src/commands/{memory-promote.md → memory/promote.md} +6 -5
  52. package/.agent-src/commands/{propose-memory.md → memory/propose.md} +6 -5
  53. package/.agent-src/commands/memory.md +48 -0
  54. package/.agent-src/commands/mode.md +5 -5
  55. package/.agent-src/commands/{module-create.md → module/create.md} +4 -3
  56. package/.agent-src/commands/{module-explore.md → module/explore.md} +4 -3
  57. package/.agent-src/commands/module.md +44 -0
  58. package/.agent-src/commands/onboard.md +3 -3
  59. package/.agent-src/commands/{optimize-agents.md → optimize/agents.md} +5 -4
  60. package/.agent-src/commands/{optimize-augmentignore.md → optimize/augmentignore.md} +4 -4
  61. package/.agent-src/commands/{optimize-rtk-filters.md → optimize/rtk.md} +4 -3
  62. package/.agent-src/commands/{optimize-skills.md → optimize/skills.md} +5 -4
  63. package/.agent-src/commands/optimize.md +48 -0
  64. package/.agent-src/commands/{override-create.md → override/create.md} +4 -3
  65. package/.agent-src/commands/{override-manage.md → override/manage.md} +4 -3
  66. package/.agent-src/commands/override.md +44 -0
  67. package/.agent-src/commands/review-changes.md +26 -1
  68. package/.agent-src/commands/review-routing.md +1 -1
  69. package/.agent-src/commands/{roadmap-create.md → roadmap/create.md} +33 -5
  70. package/.agent-src/commands/{roadmap-execute.md → roadmap/execute.md} +4 -3
  71. package/.agent-src/commands/roadmap.md +44 -0
  72. package/.agent-src/commands/set-cost-profile.md +3 -3
  73. package/.agent-src/commands/sync-agent-settings.md +2 -2
  74. package/.agent-src/commands/{tests-create.md → tests/create.md} +5 -4
  75. package/.agent-src/commands/{tests-execute.md → tests/execute.md} +4 -3
  76. package/.agent-src/commands/tests.md +44 -0
  77. package/.agent-src/commands/upstream-contribute.md +1 -1
  78. package/.agent-src/contexts/authority/commit-mechanics.md +57 -0
  79. package/.agent-src/contexts/authority/destructive-mechanics.md +66 -0
  80. package/.agent-src/contexts/authority/scope-mechanics.md +87 -0
  81. package/.agent-src/contexts/communication/rules-auto/artifact-engagement-recording-mechanics.md +72 -0
  82. package/.agent-src/contexts/communication/rules-auto/augment-portability-mechanics.md +79 -0
  83. package/.agent-src/contexts/communication/rules-auto/augment-source-of-truth-mechanics.md +98 -0
  84. package/.agent-src/contexts/communication/rules-auto/cli-output-handling-mechanics.md +87 -0
  85. package/.agent-src/contexts/communication/rules-auto/command-suggestion-policy-mechanics.md +62 -0
  86. package/.agent-src/contexts/communication/rules-auto/docs-sync-mechanics.md +78 -0
  87. package/.agent-src/contexts/communication/rules-auto/package-ci-checks-mechanics.md +85 -0
  88. package/.agent-src/contexts/communication/rules-auto/review-routing-awareness-mechanics.md +65 -0
  89. package/.agent-src/contexts/communication/rules-auto/roadmap-progress-sync-mechanics.md +78 -0
  90. package/.agent-src/contexts/communication/rules-auto/skill-quality-mechanics.md +62 -0
  91. package/.agent-src/contexts/communication/rules-auto/slash-command-routing-policy-mechanics.md +55 -0
  92. package/.agent-src/contexts/communication/rules-auto/ui-audit-gate-mechanics.md +53 -0
  93. package/.agent-src/contexts/communication/rules-auto/user-interaction-mechanics.md +77 -0
  94. package/.agent-src/contexts/execution/autonomy-detection.md +54 -0
  95. package/.agent-src/contexts/execution/autonomy-examples.md +90 -0
  96. package/.agent-src/contexts/execution/autonomy-mechanics.md +29 -0
  97. package/.agent-src/contexts/execution/verification-mechanics.md +80 -0
  98. package/.agent-src/contexts/judges/no-consolidate-rationale.md +102 -0
  99. package/.agent-src/contexts/judges/persona-voice-rubric.md +140 -0
  100. package/.agent-src/personas/README.md +1 -1
  101. package/.agent-src/rules/agent-authority.md +24 -0
  102. package/.agent-src/rules/architecture.md +1 -1
  103. package/.agent-src/rules/artifact-drafting-protocol.md +1 -1
  104. package/.agent-src/rules/artifact-engagement-recording.md +14 -70
  105. package/.agent-src/rules/ask-when-uncertain.md +28 -43
  106. package/.agent-src/rules/augment-portability.md +15 -61
  107. package/.agent-src/rules/augment-source-of-truth.md +27 -93
  108. package/.agent-src/rules/autonomous-execution.md +78 -114
  109. package/.agent-src/rules/capture-learnings.md +1 -1
  110. package/.agent-src/rules/chat-history-cadence.md +3 -3
  111. package/.agent-src/rules/chat-history-ownership.md +3 -3
  112. package/.agent-src/rules/chat-history-visibility.md +3 -3
  113. package/.agent-src/rules/cli-output-handling.md +10 -76
  114. package/.agent-src/rules/command-suggestion-policy.md +93 -0
  115. package/.agent-src/rules/commit-conventions.md +17 -14
  116. package/.agent-src/rules/commit-policy.md +14 -42
  117. package/.agent-src/rules/context-hygiene.md +3 -3
  118. package/.agent-src/rules/direct-answers.md +34 -49
  119. package/.agent-src/rules/docker-commands.md +5 -5
  120. package/.agent-src/rules/docs-sync.md +16 -70
  121. package/.agent-src/rules/e2e-testing.md +1 -1
  122. package/.agent-src/rules/guidelines.md +4 -4
  123. package/.agent-src/rules/improve-before-implement.md +2 -2
  124. package/.agent-src/rules/language-and-tone.md +50 -133
  125. package/.agent-src/rules/minimal-safe-diff.md +3 -3
  126. package/.agent-src/rules/missing-tool-handling.md +28 -22
  127. package/.agent-src/rules/model-recommendation.md +4 -4
  128. package/.agent-src/rules/no-cheap-questions.md +82 -0
  129. package/.agent-src/rules/no-roadmap-references.md +73 -0
  130. package/.agent-src/rules/non-destructive-by-default.md +15 -49
  131. package/.agent-src/rules/onboarding-gate.md +5 -5
  132. package/.agent-src/rules/package-ci-checks.md +21 -61
  133. package/.agent-src/rules/preservation-guard.md +64 -29
  134. package/.agent-src/rules/review-routing-awareness.md +26 -45
  135. package/.agent-src/rules/roadmap-progress-sync.md +28 -96
  136. package/.agent-src/rules/role-mode-adherence.md +2 -2
  137. package/.agent-src/rules/scope-control.md +65 -46
  138. package/.agent-src/rules/security-sensitive-stop.md +9 -9
  139. package/.agent-src/rules/size-enforcement.md +1 -1
  140. package/.agent-src/rules/skill-quality.md +16 -48
  141. package/.agent-src/rules/{slash-commands.md → slash-command-routing-policy.md} +7 -4
  142. package/.agent-src/rules/think-before-action.md +55 -45
  143. package/.agent-src/rules/token-efficiency.md +4 -4
  144. package/.agent-src/rules/tool-safety.md +19 -16
  145. package/.agent-src/rules/{ui-audit-before-build.md → ui-audit-gate.md} +27 -41
  146. package/.agent-src/rules/user-interaction.md +16 -71
  147. package/.agent-src/rules/verify-before-complete.md +12 -67
  148. package/.agent-src/scripts/update_roadmap_progress.py +9 -4
  149. package/.agent-src/skills/ai-council/SKILL.md +335 -0
  150. package/.agent-src/skills/api-endpoint/SKILL.md +2 -2
  151. package/.agent-src/skills/api-testing/SKILL.md +1 -1
  152. package/.agent-src/skills/blade-ui/SKILL.md +1 -1
  153. package/.agent-src/skills/blast-radius-analyzer/SKILL.md +1 -1
  154. package/.agent-src/skills/bug-analyzer/SKILL.md +1 -1
  155. package/.agent-src/skills/check-refs/SKILL.md +59 -40
  156. package/.agent-src/skills/command-routing/SKILL.md +1 -1
  157. package/.agent-src/skills/command-writing/SKILL.md +1 -1
  158. package/.agent-src/skills/conventional-commits-writing/SKILL.md +86 -28
  159. package/.agent-src/skills/copilot-agents-optimization/SKILL.md +7 -7
  160. package/.agent-src/skills/developer-like-execution/SKILL.md +6 -6
  161. package/.agent-src/skills/finishing-a-development-branch/SKILL.md +101 -65
  162. package/.agent-src/skills/flux/SKILL.md +31 -11
  163. package/.agent-src/skills/git-workflow/SKILL.md +1 -1
  164. package/.agent-src/skills/github-ci/SKILL.md +2 -2
  165. package/.agent-src/skills/guideline-writing/SKILL.md +11 -11
  166. package/.agent-src/skills/judge-code-quality/SKILL.md +7 -8
  167. package/.agent-src/skills/judge-security-auditor/SKILL.md +4 -5
  168. package/.agent-src/skills/judge-test-coverage/SKILL.md +3 -4
  169. package/.agent-src/skills/learning-to-rule-or-skill/SKILL.md +4 -4
  170. package/.agent-src/skills/lint-skills/SKILL.md +57 -39
  171. package/.agent-src/skills/livewire/SKILL.md +1 -1
  172. package/.agent-src/skills/md-language-check/SKILL.md +61 -39
  173. package/.agent-src/skills/override-management/SKILL.md +7 -7
  174. package/.agent-src/skills/php-coder/SKILL.md +1 -1
  175. package/.agent-src/skills/playwright-testing/SKILL.md +2 -2
  176. package/.agent-src/skills/quality-tools/SKILL.md +2 -2
  177. package/.agent-src/skills/react-shadcn-ui/SKILL.md +116 -43
  178. package/.agent-src/skills/readme-reviewer/SKILL.md +31 -30
  179. package/.agent-src/skills/readme-writing/SKILL.md +79 -54
  180. package/.agent-src/skills/readme-writing-package/SKILL.md +51 -48
  181. package/.agent-src/skills/receiving-code-review/SKILL.md +53 -48
  182. package/.agent-src/skills/refine-prompt/SKILL.md +0 -1
  183. package/.agent-src/skills/requesting-code-review/SKILL.md +35 -30
  184. package/.agent-src/skills/review-routing/SKILL.md +2 -2
  185. package/.agent-src/skills/rule-writing/SKILL.md +1 -1
  186. package/.agent-src/skills/security/SKILL.md +7 -2
  187. package/.agent-src/skills/security-audit/SKILL.md +7 -3
  188. package/.agent-src/skills/skill-reviewer/SKILL.md +1 -1
  189. package/.agent-src/skills/skill-writing/SKILL.md +3 -3
  190. package/.agent-src/skills/subagent-orchestration/SKILL.md +1 -0
  191. package/.agent-src/skills/systematic-debugging/SKILL.md +69 -61
  192. package/.agent-src/skills/test-driven-development/SKILL.md +59 -57
  193. package/.agent-src/skills/test-performance/SKILL.md +0 -1
  194. package/.agent-src/skills/traefik/SKILL.md +4 -4
  195. package/.agent-src/skills/upstream-contribute/SKILL.md +1 -1
  196. package/.agent-src/skills/validate-feature-fit/SKILL.md +2 -2
  197. package/.agent-src/skills/{verify-before-complete → verify-completion-evidence}/SKILL.md +30 -28
  198. package/.agent-src/templates/agent-settings.md +8 -8
  199. package/.agent-src/templates/contexts/auth-model.md +1 -1
  200. package/.agent-src/templates/scripts/README.md +2 -2
  201. package/.agent-src/templates/scripts/telemetry/aggregator.py +16 -1
  202. package/.agent-src/templates/scripts/telemetry/engagement.py +59 -0
  203. package/.agent-src/templates/scripts/telemetry/report_renderer.py +28 -1
  204. package/.agent-src/templates/scripts/telemetry_record.py +14 -1
  205. package/.claude-plugin/marketplace.json +31 -12
  206. package/AGENTS.md +11 -9
  207. package/CHANGELOG.md +213 -2
  208. package/README.md +43 -44
  209. package/config/agent-settings.template.yml +58 -1
  210. package/config/gitignore-block.txt +3 -0
  211. package/docs/architecture.md +5 -7
  212. package/docs/catalog.md +359 -0
  213. package/docs/contracts/STABILITY.md +46 -1
  214. package/docs/contracts/adr-chat-history-split.md +1 -3
  215. package/docs/contracts/adr-command-suggestion.md +3 -5
  216. package/docs/contracts/adr-implement-ticket-runtime.md +1 -2
  217. package/docs/contracts/adr-product-ui-track.md +5 -8
  218. package/docs/contracts/adr-prompt-driven-execution.md +3 -4
  219. package/docs/contracts/agent-memory-contract.md +8 -13
  220. package/docs/contracts/artifact-engagement-flow.md +7 -10
  221. package/docs/contracts/command-clusters.md +56 -46
  222. package/docs/contracts/command-suggestion-flow.md +4 -6
  223. package/docs/contracts/context-paths.md +99 -0
  224. package/docs/contracts/file-ownership-matrix.json +6722 -0
  225. package/docs/contracts/file-ownership-matrix.md +134 -0
  226. package/docs/contracts/implement-ticket-flow.md +8 -11
  227. package/docs/contracts/linear-ai-rules-inclusion.md +1 -2
  228. package/docs/contracts/linear-ai-three-layers.md +0 -2
  229. package/docs/contracts/load-context-budget-model.md +178 -0
  230. package/docs/contracts/load-context-schema.md +184 -0
  231. package/docs/contracts/rule-interactions.md +0 -1
  232. package/docs/contracts/rule-interactions.yml +96 -0
  233. package/docs/contracts/rule-priority-hierarchy.md +87 -0
  234. package/docs/contracts/ui-track-flow.md +8 -18
  235. package/docs/customization.md +16 -0
  236. package/docs/end-to-end-walkthroughs.md +165 -0
  237. package/docs/getting-started.md +29 -10
  238. package/docs/github-topics.md +12 -3
  239. package/docs/guidelines/agent-infra/asking-and-brevity-examples.md +100 -0
  240. package/docs/guidelines/agent-infra/language-and-tone-examples.md +79 -0
  241. package/{.agent-src → docs}/guidelines/docs/readme-size-and-splitting.md +26 -25
  242. package/docs/guidelines/php/git.md +164 -0
  243. package/docs/migrations/commands-1.15.0.md +1 -1
  244. package/docs/showcase.md +9 -4
  245. package/docs/skills-catalog.md +14 -8
  246. package/docs/ui-track-mental-model.md +2 -2
  247. package/llms.txt +13 -7
  248. package/package.json +1 -1
  249. package/scripts/_one_off_phase4_dispatch_latency.py +108 -0
  250. package/scripts/_one_off_phase6_trigger_jaccard.py +92 -0
  251. package/scripts/_phase2_shim_helper.py +109 -0
  252. package/scripts/agent-config +33 -0
  253. package/scripts/ai_council/__init__.py +39 -0
  254. package/scripts/ai_council/_default_prices.py +41 -0
  255. package/scripts/ai_council/_one_off_2a4_acceptance.py +208 -0
  256. package/scripts/ai_council/_one_off_context_layer_v1_estimate.py +67 -0
  257. package/scripts/ai_council/_one_off_context_layer_v1_review.py +292 -0
  258. package/scripts/ai_council/_one_off_followups_review.py +259 -0
  259. package/scripts/ai_council/_one_off_nondestructive_inline_audit.py +209 -0
  260. package/scripts/ai_council/_one_off_phase_2a_budget_rebalance.py +257 -0
  261. package/scripts/ai_council/_one_off_phase_2a_post_revert.py +197 -0
  262. package/scripts/ai_council/_one_off_rebalancing_audit.py +149 -0
  263. package/scripts/ai_council/_one_off_roundtrip.py +106 -0
  264. package/scripts/ai_council/_one_off_rule_hardening_v1.py +251 -0
  265. package/scripts/ai_council/_one_off_structural_open_questions.py +232 -0
  266. package/scripts/ai_council/_one_off_structural_optimization.py +144 -0
  267. package/scripts/ai_council/_one_off_structural_v3_gaps.py +252 -0
  268. package/scripts/ai_council/_one_off_structural_v3_review.py +240 -0
  269. package/scripts/ai_council/budget_guard.py +172 -0
  270. package/scripts/ai_council/bundler.py +261 -0
  271. package/scripts/ai_council/clients.py +381 -0
  272. package/scripts/ai_council/modes.py +127 -0
  273. package/scripts/ai_council/orchestrator.py +350 -0
  274. package/scripts/ai_council/pricing.py +213 -0
  275. package/scripts/ai_council/project_context.py +159 -0
  276. package/scripts/ai_council/prompts.py +232 -0
  277. package/scripts/ai_council/session.py +144 -0
  278. package/scripts/check_always_budget.py +444 -0
  279. package/scripts/check_augmentignore.py +69 -0
  280. package/scripts/check_cluster_patterns.py +159 -0
  281. package/scripts/check_command_count_messaging.py +127 -0
  282. package/scripts/check_context_paths.py +201 -0
  283. package/scripts/check_no_roadmap_refs.py +155 -0
  284. package/scripts/check_phase_coupling.py +148 -0
  285. package/scripts/check_portability.py +57 -0
  286. package/scripts/check_public_catalog_links.py +122 -0
  287. package/scripts/check_references.py +33 -3
  288. package/scripts/check_roadmap_trackable.py +111 -0
  289. package/scripts/check_safety_floor_untouched.py +125 -0
  290. package/scripts/command_suggester/cooldown.py +1 -1
  291. package/scripts/command_suggester/loader.py +4 -1
  292. package/scripts/compress.py +59 -13
  293. package/scripts/generate_index.py +270 -0
  294. package/scripts/generate_ownership_matrix.py +323 -0
  295. package/scripts/hooks/augment-roadmap-progress.sh +57 -0
  296. package/scripts/install.py +49 -28
  297. package/scripts/install_anthropic_key.sh +5 -0
  298. package/scripts/install_openai_key.sh +106 -0
  299. package/scripts/lint_load_context.py +163 -0
  300. package/scripts/lint_no_new_atomic_commands.py +12 -11
  301. package/scripts/requirements-evals.txt +1 -0
  302. package/scripts/roadmap_progress_hook.py +159 -0
  303. package/scripts/schemas/command.schema.json +22 -1
  304. package/scripts/schemas/rule.schema.json +10 -0
  305. package/scripts/skill_linter.py +13 -4
  306. package/scripts/sync_agent_settings.py +26 -3
  307. package/scripts/update_counts.py +16 -4
  308. package/scripts/update_prices.py +124 -0
  309. package/.agent-src/guidelines/php/git.md +0 -96
  310. package/.agent-src/rules/command-suggestion.md +0 -134
  311. /package/{.agent-src → docs}/guidelines/agent-infra/agent-interaction-and-decision-quality.md +0 -0
  312. /package/{.agent-src → docs}/guidelines/agent-infra/break-glass-usage.md +0 -0
  313. /package/{.agent-src → docs}/guidelines/agent-infra/developer-judgment.md +0 -0
  314. /package/{.agent-src → docs}/guidelines/agent-infra/engineering-memory-data-format.md +0 -0
  315. /package/{.agent-src → docs}/guidelines/agent-infra/layered-settings.md +0 -0
  316. /package/{.agent-src → docs}/guidelines/agent-infra/memory-access.md +0 -0
  317. /package/{.agent-src → docs}/guidelines/agent-infra/naming.md +0 -0
  318. /package/{.agent-src → docs}/guidelines/agent-infra/output-patterns.md +0 -0
  319. /package/{.agent-src → docs}/guidelines/agent-infra/review-routing-data-format.md +0 -0
  320. /package/{.agent-src → docs}/guidelines/agent-infra/role-contracts.md +0 -0
  321. /package/{.agent-src → docs}/guidelines/agent-infra/role-mode-router.md +0 -0
  322. /package/{.agent-src → docs}/guidelines/agent-infra/runtime-layer.md +0 -0
  323. /package/{.agent-src → docs}/guidelines/agent-infra/self-improvement-pipeline.md +0 -0
  324. /package/{.agent-src → docs}/guidelines/agent-infra/size-and-scope.md +0 -0
  325. /package/{.agent-src → docs}/guidelines/agent-infra/tool-integration.md +0 -0
  326. /package/{.agent-src → docs}/guidelines/e2e/playwright.md +0 -0
  327. /package/{.agent-src → docs}/guidelines/php/api-design.md +0 -0
  328. /package/{.agent-src → docs}/guidelines/php/artisan-commands.md +0 -0
  329. /package/{.agent-src → docs}/guidelines/php/blade-ui.md +0 -0
  330. /package/{.agent-src → docs}/guidelines/php/controllers.md +0 -0
  331. /package/{.agent-src → docs}/guidelines/php/database.md +0 -0
  332. /package/{.agent-src → docs}/guidelines/php/eloquent.md +0 -0
  333. /package/{.agent-src → docs}/guidelines/php/flux.md +0 -0
  334. /package/{.agent-src → docs}/guidelines/php/general.md +0 -0
  335. /package/{.agent-src → docs}/guidelines/php/jobs.md +0 -0
  336. /package/{.agent-src → docs}/guidelines/php/livewire.md +0 -0
  337. /package/{.agent-src → docs}/guidelines/php/logging.md +0 -0
  338. /package/{.agent-src → docs}/guidelines/php/naming.md +0 -0
  339. /package/{.agent-src → docs}/guidelines/php/patterns/dependency-injection.md +0 -0
  340. /package/{.agent-src → docs}/guidelines/php/patterns/dtos.md +0 -0
  341. /package/{.agent-src → docs}/guidelines/php/patterns/events.md +0 -0
  342. /package/{.agent-src → docs}/guidelines/php/patterns/factory.md +0 -0
  343. /package/{.agent-src → docs}/guidelines/php/patterns/pipelines.md +0 -0
  344. /package/{.agent-src → docs}/guidelines/php/patterns/policies.md +0 -0
  345. /package/{.agent-src → docs}/guidelines/php/patterns/repositories.md +0 -0
  346. /package/{.agent-src → docs}/guidelines/php/patterns/service-layer.md +0 -0
  347. /package/{.agent-src → docs}/guidelines/php/patterns/strategy.md +0 -0
  348. /package/{.agent-src → docs}/guidelines/php/patterns.md +0 -0
  349. /package/{.agent-src → docs}/guidelines/php/performance.md +0 -0
  350. /package/{.agent-src → docs}/guidelines/php/resources.md +0 -0
  351. /package/{.agent-src → docs}/guidelines/php/security.md +0 -0
  352. /package/{.agent-src → docs}/guidelines/php/sql.md +0 -0
  353. /package/{.agent-src → docs}/guidelines/php/validations.md +0 -0
  354. /package/{.agent-src → docs}/guidelines/php/websocket.md +0 -0
@@ -0,0 +1,134 @@
1
+ ---
2
+ stability: beta
3
+ ---
4
+
5
+ # File-ownership matrix
6
+
7
+ > **Audience:** roadmap authors, phase reviewers, and CI gate writers
8
+ > who need to know which artefact reads which, and whether two phases
9
+ > can run concurrently without colliding.
10
+ > **Generator:** `scripts/generate_ownership_matrix.py`
11
+ > (run via `task generate-ownership-matrix`).
12
+ > **Validator:** `task check-ownership-matrix` (fails if the JSON drifts
13
+ > from a fresh regeneration).
14
+ > **Companion contracts:** [`load-context-schema.md`](load-context-schema.md),
15
+ > [`context-paths.md`](context-paths.md).
16
+
17
+ This contract defines the **schema** of the file-ownership matrix: the
18
+ machine-readable JSON at `docs/contracts/file-ownership-matrix.json` and
19
+ the human-readable mirror at
20
+ `agents/contexts/structural/file-ownership-matrix.md`. Both are
21
+ regenerated from `.agent-src.uncompressed/` by the generator and locked
22
+ by CI.
23
+
24
+ **Status:** internal-locked (`stability: beta`). Schema bumps require a
25
+ contract version increment plus a roadmap revision (per
26
+ `road-to-structural-optimization.md` § 0.1).
27
+
28
+ ## Why the matrix exists
29
+
30
+ `road-to-structural-optimization` Phase 0.1 (CRITICAL) is the DAG
31
+ successor of Phase 0.6 (path conventions). Subsequent phases (1, 2A,
32
+ 2B, 3, 6) extract material into context files, slim rules, and reorder
33
+ command surface. The matrix is the substrate that lets later phases
34
+ ask three questions deterministically:
35
+
36
+ 1. **Which files does my edit reach transitively?** Answered by the
37
+ `READ_ONLY` edges plus their depth-2 closure.
38
+ 2. **Can Phase X and Phase Y land in either order?** Answered by
39
+ intersecting per-phase `WRITE` sets — empty intersection = safe.
40
+ 3. **Has the matrix drifted since the last green CI run?** Answered by
41
+ the `check-ownership-matrix` consistency gate.
42
+
43
+ ## Schema (v1)
44
+
45
+ The JSON document is a single object:
46
+
47
+ ```json
48
+ {
49
+ "version": 1,
50
+ "generated_by": "scripts/generate_ownership_matrix.py",
51
+ "source_of_truth": ".agent-src.uncompressed/",
52
+ "files": {
53
+ "<repo-root-relative path>": {
54
+ "kind": "rule | skill | command | context | persona",
55
+ "rule_type": "always | auto | manual | null",
56
+ "load_context": ["<path>", ...],
57
+ "load_context_eager": ["<path>", ...]
58
+ }
59
+ },
60
+ "edges": [
61
+ {
62
+ "source": "<path>",
63
+ "target": "<path>",
64
+ "type": "READ_ONLY | WRITE | BLOCKS_IF_CONCURRENT",
65
+ "via": "load_context | load_context_eager | load_context_transitive | body_link",
66
+ "depth": 1
67
+ }
68
+ ]
69
+ }
70
+ ```
71
+
72
+ **Edge types**
73
+
74
+ | Type | Meaning | Populated in v1 |
75
+ |---|---|:-:|
76
+ | `READ_ONLY` | Source file reads target (frontmatter declaration or body markdown link). | ✅ |
77
+ | `WRITE` | Source file owns target. Self-edge for every file (`source == target`). | ✅ |
78
+ | `BLOCKS_IF_CONCURRENT` | Two phases would write the same file. Derived later from a phase manifest; reserved in v1. | ⏳ |
79
+
80
+ **Edge `via` values**
81
+
82
+ - `load_context` — frontmatter `load_context:` entry (lazy).
83
+ - `load_context_eager` — frontmatter `load_context_eager:` entry.
84
+ - `load_context_transitive` — depth-2 hop reached by following a target's own
85
+ `load_context*` declarations one level deeper.
86
+ - `body_link` — markdown link in body to a path inside one of the
87
+ scanned roots.
88
+
89
+ ## Depth invariant (G2 — v3.1)
90
+
91
+ The generator computes the transitive closure of `load_context` /
92
+ `load_context_eager` edges **up to depth 2**. Any chain
93
+ `R → A → B → C` where every hop is a `load_context*` edge **fails the
94
+ build** with exit code 2. This duplicates the same nesting cap that
95
+ Phase 0.2.4 will enforce in `scripts/check_always_budget.py` — two
96
+ enforcement points, one invariant.
97
+
98
+ ## Regeneration policy
99
+
100
+ | Trigger | What runs | What fails |
101
+ |---|---|---|
102
+ | `task generate-ownership-matrix` | Regenerates JSON + MD in place. | Depth-3 chain → exit 2. |
103
+ | `task check-ownership-matrix` (CI) | Regenerates to memory, diffs against committed JSON. | Diff non-empty → exit 1. Depth-3 → exit 2. |
104
+ | Pre-commit hook (Phase 2A — A1 fix) | Future: regenerate and diff on commits that touch contexts. | Same as `check-ownership-matrix`. |
105
+
106
+ Any commit that adds, moves, or modifies a context, rule, skill, or
107
+ command MUST regenerate the matrix in the same commit. CI is the
108
+ backstop; the consistency gate fails if regeneration drifts.
109
+
110
+ ## Scope notes (v1)
111
+
112
+ - **Greppable surface:** `rules/`, `skills/`, `commands/`, `contexts/`,
113
+ `personas/` under `.agent-src.uncompressed/`. Generated tool
114
+ projections (`.augment/`, `.claude/`, `.cursor/`, …) are intentionally
115
+ ignored — they are downstream of the source of truth.
116
+ - **`skill:` frontmatter in rules** (named in roadmap 0.1.2) is reserved.
117
+ No rules currently declare it; the generator scans for it but emits
118
+ zero edges of that kind in v1.
119
+ - **Body link parser** is conservative: it only recognises markdown
120
+ link targets ending in `.md` whose path resolves under one of the
121
+ scanned roots. Bare backtick-name references (e.g., `` `skill-quality` ``)
122
+ are **not** edges in v1; they are too ambiguous to attribute.
123
+ - **Cycles** are not the matrix's concern — the existing
124
+ `lint_load_context.py` rejects them. The matrix generator follows
125
+ edges with a visited-set so a cycle, if one slipped through, cannot
126
+ loop forever; it would surface as a depth-3 abort.
127
+
128
+ ## Versioning
129
+
130
+ `version: 1` is the initial lock. Schema-breaking changes (renaming a
131
+ field, removing an edge type, changing semantics of an existing
132
+ `via`) require a version bump and a roadmap revision. Additive changes
133
+ (new `via` values, new optional file fields) MAY land at the current
134
+ version with a `CHANGELOG.md` entry under `### Beta`.
@@ -4,10 +4,9 @@ stability: beta
4
4
 
5
5
  # `/implement-ticket` — Flow Contract
6
6
 
7
- > Technical contracts for the delivery orchestrator shipped under
8
- > [`road-to-implement-ticket.md`](../../agents/roadmaps/road-to-implement-ticket.md).
9
- > This document is the stable reference; the roadmap tracks phased
10
- > delivery.
7
+ > Technical contracts for the `/implement-ticket` delivery orchestrator.
8
+ > This document is the stable reference for engine boundaries, state
9
+ > schema, and replay protocol.
11
10
  >
12
11
  > - **Created:** 2026-04-22
13
12
  > - **Status:** Phase 1 shipped 2026-04-23 — `DeliveryState` +
@@ -133,9 +132,9 @@ against actual engine output rather than synthetic fixtures.
133
132
  Prompt envelopes (`input.kind="prompt"`) carry a free-form goal
134
133
  instead of a refined ticket. The `refine` step routes on shape
135
134
  (presence of `raw` key) and on the first pass emits an
136
- `@agent-directive: refine-prompt` halt — the agent runs the
137
- matching skill, which reconstructs `acceptance_criteria` +
138
- `assumptions`. On the rebound, `scoring/confidence.py` produces a
135
+ `@agent-directive: refine-prompt` halt — the host agent is
136
+ instructed to run the matching skill, which reconstructs
137
+ `acceptance_criteria` + `assumptions`. On the rebound, `scoring/confidence.py` produces a
139
138
  frozen `ConfidenceScore(band, score, dimensions, reasons,
140
139
  ui_intent)` and the dispatcher branches on `band`:
141
140
 
@@ -281,7 +280,7 @@ via `resolve_policy()` in
281
280
  [`persona_policy.py`](../../.agent-src.uncompressed/templates/scripts/implement_ticket/persona_policy.py).
282
281
  Policies live alongside the dispatcher so the flow can consume
283
282
  them directly; the shared
284
- [`role-contracts`](../../.agent-src.uncompressed/guidelines/agent-infra/role-contracts.md)
283
+ [`role-contracts`](../../docs/guidelines/agent-infra/role-contracts.md)
285
284
  guideline remains the source of truth for persona behaviour in the
286
285
  wider agent surface.
287
286
 
@@ -616,13 +615,11 @@ are blocked by `freeze-guard.yml::manifest-integrity` at PR time.
616
615
 
617
616
  ## See also
618
617
 
619
- - [`agents/roadmaps/road-to-implement-ticket.md`](../../agents/roadmaps/road-to-implement-ticket.md)
620
- - [`agents/roadmaps/road-to-universal-execution-engine.md`](../../agents/roadmaps/road-to-universal-execution-engine.md)
621
618
  - `tests/golden/` — capture sandbox, recipes, and Capture Packs
622
619
  - [`../../tests/golden/harness.py`](../../tests/golden/harness.py) — Strict-Verb replay harness
623
620
  - [`../../.github/workflows/freeze-guard.yml`](../../.github/workflows/freeze-guard.yml) — manifest-integrity + live-replay gates
624
621
  - [`agent-memory-contract.md`](agent-memory-contract.md)
625
- - [`../../.agent-src.uncompressed/guidelines/agent-infra/role-contracts.md`](../../.agent-src.uncompressed/guidelines/agent-infra/role-contracts.md)
622
+ - [`../../docs/guidelines/agent-infra/role-contracts.md`](../../docs/guidelines/agent-infra/role-contracts.md)
626
623
  - [`../../.agent-src.uncompressed/rules/user-interaction.md`](../../.agent-src.uncompressed/rules/user-interaction.md)
627
624
  - [`../../.agent-src.uncompressed/rules/scope-control.md`](../../.agent-src.uncompressed/rules/scope-control.md)
628
625
  - [`../../.agent-src.uncompressed/rules/minimal-safe-diff.md`](../../.agent-src.uncompressed/rules/minimal-safe-diff.md)
@@ -4,7 +4,6 @@ stability: beta
4
4
 
5
5
  # Linear AI — rules inclusion list
6
6
 
7
- > Phase 3 Step 1 deliverable for [`road-to-universal-distribution.md`](../../agents/roadmaps/road-to-universal-distribution.md).
8
7
  > Per-rule decision for the Linear AI rules digest. The digest is a
9
8
  > Markdown blob the user pastes into Linear's `Settings → Agents →
10
9
  > Additional guidance` (workspace / team / personal). The third-party
@@ -101,7 +100,7 @@ These reference Augment-only mechanics — model identity in Augment's
101
100
  system prompt, Augment's `/slash` command surface, and the Augment
102
101
  onboarding flow gated by `.agent-settings.yml`.
103
102
 
104
- `model-recommendation`, `onboarding-gate`, `slash-commands`.
103
+ `model-recommendation`, `onboarding-gate`, `slash-command-routing-policy`.
105
104
 
106
105
  ### Skill-routing only (1)
107
106
 
@@ -4,7 +4,6 @@ stability: beta
4
4
 
5
5
  # Linear AI — three-layer split rationale
6
6
 
7
- > Phase 3 Step 3 deliverable for [`road-to-universal-distribution.md`](../../agents/roadmaps/road-to-universal-distribution.md).
8
7
  > Per-rule routing is in [`linear-ai-rules-inclusion.md`](linear-ai-rules-inclusion.md);
9
8
  > this file documents *why* the split is workspace / team / personal and
10
9
  > what belongs in each.
@@ -128,4 +127,3 @@ does not maintain `event4u/agent-config`.
128
127
  - Per-rule decision: [`linear-ai-rules-inclusion.md`](linear-ai-rules-inclusion.md)
129
128
  - Builder script: [`scripts/build_linear_digest.py`](../../scripts/build_linear_digest.py)
130
129
  - Generated digests: `dist/linear/{workspace,team,personal}.md` (gitignored)
131
- - Roadmap: [`road-to-universal-distribution.md`](../../agents/roadmaps/road-to-universal-distribution.md) Phase 3
@@ -0,0 +1,178 @@
1
+ ---
2
+ stability: beta
3
+ ---
4
+
5
+ # `load_context:` Budget Accounting Model
6
+
7
+ > **Audience:** maintainers of `type: "always"` rules and the budget
8
+ > linter who need a single, deterministic answer to "how many chars
9
+ > does this rule cost the always-budget?".
10
+ > **Linter:** `scripts/check_always_budget.py`
11
+ > (run via `task check-always-budget`).
12
+ > **Companion:** [`load-context-schema.md`](load-context-schema.md) —
13
+ > frontmatter contract for citing a context from a rule.
14
+ > [`STABILITY.md § Budget contracts`](STABILITY.md#budget-contracts) —
15
+ > the numeric caps this model enforces.
16
+
17
+ This contract locks the **accounting model** by which a `type: "always"`
18
+ rule's `load_context:` declarations contribute to the always-rule
19
+ budget. It resolves the "is the rule its file size or its file size
20
+ plus everything it loads?" ambiguity surfaced by Round-2 council on
21
+ `road-to-structural-optimization` (Finding 7, CRITICAL).
22
+
23
+ **Status:** internal-locked. Changes require a contract version bump
24
+ and a roadmap revision (per
25
+ `road-to-structural-optimization.md` § Definitions). The 2 % tolerance
26
+ band on the retroactive test (G3 in v3.1) is the only legal way to
27
+ adjust the model parameters without a roadmap revision; an overshoot
28
+ above the band rejects the model and escalates to the council.
29
+
30
+ ## The locked model — Model (b) literal
31
+
32
+ For any rule with frontmatter `type: "always"`:
33
+
34
+ ```
35
+ EffectiveSize(rule) = RawSize(rule)
36
+ + Σ RawSize(c) for every c in transitive_closure(rule.load_context*)
37
+ ```
38
+
39
+ Where:
40
+
41
+ - `load_context*` is the union of `load_context:` (lazy) **and**
42
+ `load_context_eager:` entries declared in frontmatter
43
+ (per [`load-context-schema.md`](load-context-schema.md)).
44
+ - `transitive_closure` walks `load_context:` declarations on
45
+ context files **up to depth 2** — see § Nesting cap below.
46
+ - `RawSize` is the byte size of the compressed file
47
+ (`.agent-src/...`), measured by `os.path.getsize()`. The
48
+ uncompressed source paths in frontmatter are mapped to their
49
+ compressed counterparts before sizing.
50
+ - A context loaded by N always-rules counts **N times** (once per
51
+ loading rule). Rationale: the always-budget protects context-window
52
+ utilization at activation time; if rule A and rule B both fire on
53
+ the same turn, the agent pays both costs.
54
+
55
+ ### Why model (b) and not (a) or (c)
56
+
57
+ | Model | Definition | Why rejected |
58
+ |---|---|---|
59
+ | (a) rule chars only | `EffectiveSize = RawSize(rule)` | Ignores the cost of declared contexts. Phase-2A obligation extraction would *appear* free, allowing unbounded context bloat. |
60
+ | (b) literal *(this contract)* | `EffectiveSize = RawSize(rule) + Σ contexts` | Simplest invariant. Aligns with how the agent actually pays the cost when both rule and context fire on a turn. |
61
+ | (c) shared-divisor | `EffectiveSize = RawSize(rule) + Σ (RawSize(c) / N_loaders)` | Tempting for shared `commit-mechanics`-style contexts but breaks the "what does each rule cost in isolation" question. Reserved as the **first refinement step** if the 2 % tolerance band is exceeded. |
62
+
63
+ Council Round 3 converged A/A/A on the **separate-skills + shared-context**
64
+ extraction pattern (Q1) and the **one-rule + three-contexts** consolidation
65
+ (Q2); model (b) literal is the accounting that makes both patterns
66
+ honest about their cost.
67
+
68
+ ## Nesting cap — depth 2
69
+
70
+ A rule's `load_context:` may cite a context (depth 1). A context may
71
+ cite further contexts in its own frontmatter (depth 2). A depth-2
72
+ context citing a third context (depth 3) **aborts the build**.
73
+
74
+ Rationale: bounded recursion makes the linter terminate in O(N) and
75
+ prevents accidental cycles. Council Round-2 finding 9 (HIGH).
76
+
77
+ The check is enforced by `scripts/check_always_budget.py` as a
78
+ separate exit-code-1 condition (independent of the budget caps), so
79
+ that a depth violation surfaces with the violating chain, not as a
80
+ budget-cap breach.
81
+
82
+ ## Known-breach allowlist (transitional)
83
+
84
+ Phase 2A targets `non-destructive-by-default` and `scope-control`
85
+ for slimming. Both rules currently exceed the **6,000-char per-rule
86
+ cap** under model (b) literal — this is expected and intentional:
87
+ Phase 0.2 lands the model and its measurement; Phase 2A brings the
88
+ breaches under the cap.
89
+
90
+ To keep CI green during the transition, the linter and the test
91
+ suite carry an explicit `KNOWN_PER_RULE_BREACHES` allowlist with the
92
+ **measured ceiling** for each entry. Each entry must:
93
+
94
+ - Be referenced by the Phase 2A roadmap step that will retire it.
95
+ - Have a documented expected-removal date or roadmap milestone.
96
+ - Fail the build the moment the breach **grows** above the recorded
97
+ ceiling (regression guard).
98
+
99
+ Phase 2A's success criterion (`budget delta ≥ −5 %`) is the trigger
100
+ to remove entries from the allowlist. The allowlist must be **empty**
101
+ before Phase 2A is marked complete.
102
+
103
+ ## Retroactive test result (Phase 0.2.3)
104
+
105
+ PR #34's `autonomous-execution` split moved mechanics into three
106
+ contexts under `contexts/execution/`. Re-measuring under model (b)
107
+ literal:
108
+
109
+ | Metric | Value | Cap | Utilization |
110
+ |---|---:|---:|---:|
111
+ | Total extended budget | 49,311 chars | 49,000 | **100.6 %** |
112
+ | Top-3 extended | 22,248 chars | 24,500 | 90.8 % |
113
+ | Per-rule breaches | 2 of 9 | 0 | `non-destructive-by-default` (7,887), `scope-control` (8,529) |
114
+
115
+ The total sits **0.6 % over** the cap — within the 2 % tolerance band
116
+ (G3) which permits parameter refinement before model rejection. Per
117
+ the contract, the model is **accepted**; the per-rule breaches are
118
+ recorded in the transitional allowlist for Phase 2A.
119
+
120
+ `autonomous-execution` itself is `type: "auto"` and does not enter
121
+ the always-budget. Its own extended size (rule 5,196 + three contexts
122
+ 8,453) = 13,649 chars is reported by the linter for Phase 2B
123
+ diagnostics but does not gate the always-budget cap.
124
+
125
+ ## Linter contract
126
+
127
+ `scripts/check_always_budget.py` enforces:
128
+
129
+ 1. `EffectiveSize` per always-rule against the per-rule cap (with
130
+ the transitional allowlist).
131
+ 2. Sum of `EffectiveSize` across all always-rules against the total
132
+ cap (warn at 80 %, fail at ≥ 90 % — unchanged from PR #34).
133
+ 3. Top-3 sum against the top-3 cap.
134
+ 4. Depth ≤ 2 on every `load_context:` chain reachable from an
135
+ always-rule.
136
+
137
+ ### Recovery band (Phase 2A → Phase 5 transitional)
138
+
139
+ Locked by AI Council session `2026-05-03T12-02-42Z` (verdict A1)
140
+ after Phase 2A was attempted and reverted: the 1:1 rule-to-context
141
+ split was uneconomical under Model (b) literal because the
142
+ frontmatter and citation-line tax on the new context file outweighed
143
+ the chars removed from the rule. Reverting Phase 2A left the budget
144
+ at 96.8 % — strictly better than the `main` baseline at 100.6 % but
145
+ inside the 90–100 % gap zone the linter rejects.
146
+
147
+ While `RECOVERY_BAND_ENABLED = True`, the linter accepts a branch in
148
+ the gap zone iff:
149
+
150
+ - `total_ext < baseline` (read from `.github/budget-baseline.txt`,
151
+ the chars at last-green `main`), AND
152
+ - every per-rule cap holds (allowlisted entries unchanged), AND
153
+ - top-3 cap holds, AND
154
+ - depth-2 cap holds.
155
+
156
+ A branch passing only the recovery band reports
157
+ `⚠️ WARN (recovery band, baseline N)`. The band is a one-way ratchet:
158
+ once a smaller branch lands on `main`, the baseline file must be
159
+ updated to the new total in the same commit. Phase 5 of
160
+ `road-to-structural-optimization` flips `RECOVERY_BAND_ENABLED` to
161
+ `False` and removes both the band and the G3 tolerance — the gate
162
+ collapses to `total < TOTAL_CAP` strict.
163
+
164
+ Exit codes: 0 = pass (or warn, including recovery band), 1 = any cap
165
+ breach or depth violation, 3 = internal error.
166
+
167
+ ## What this contract intentionally does **not** promise
168
+
169
+ - **No claim about runtime cost.** The model treats every context
170
+ as if it were active when its rule fires. The agent may cache or
171
+ short-circuit lazy loads at runtime; the budget is the **upper
172
+ bound**, not the realised cost.
173
+ - **No claim about `type: "auto"` rules.** Auto rules enter the
174
+ agent's context only when their description matches; they have
175
+ their own per-rule LOC targets in Phase 2B (not a global budget).
176
+ - **No claim about commands or skills.** Commands and skills load
177
+ on user invocation. Their token cost is accounted by the
178
+ command-cluster and skill-family contracts, not here.
@@ -0,0 +1,184 @@
1
+ ---
2
+ stability: beta
3
+ ---
4
+
5
+ # `load_context:` Frontmatter Schema
6
+
7
+ > **Audience:** rule authors and reviewers who want to keep an Always-rule
8
+ > small while making deeper reasoning available on demand.
9
+ > **Linter:** `scripts/lint_load_context.py` (run via `task lint-load-context`).
10
+ > **Companion:** [`rule-priority-hierarchy.md`](rule-priority-hierarchy.md) —
11
+ > hierarchy that decides *which* rule wins when several fire on the same turn.
12
+
13
+ This contract defines the frontmatter convention by which a rule (or
14
+ another context) declares the deeper reading material it relies on.
15
+ The convention is **lazy by default**: declared entries are *available
16
+ to load* when the situation demands them, never auto-loaded into every
17
+ turn.
18
+
19
+ ## Schema
20
+
21
+ Two keys, both optional, both top-level frontmatter:
22
+
23
+ ```yaml
24
+ ---
25
+ type: "always"
26
+ description: "..."
27
+ load_context: # lazy — on-demand reference list
28
+ - .agent-src.uncompressed/contexts/<file>.md
29
+ - agents/contexts/<file>.md
30
+ load_context_eager: # opt-in eager — auto-loaded on rule fire
31
+ - .agent-src.uncompressed/contexts/<file>.md
32
+ ---
33
+ ```
34
+
35
+ | Key | Loading | When to use |
36
+ |---|---|---|
37
+ | `load_context:` | **Lazy.** The agent reads the entry only when the rule's reasoning needs it. | Default. Use for everything that is "available knowledge" rather than "on every turn". |
38
+ | `load_context_eager:` | **Eager.** The entry is concatenated into the active context whenever the rule fires. | Only when the deeper material is needed *every single time* the rule fires. Counts against the combined char budget. |
39
+
40
+ **No default eager-load.** A rule with `load_context:` only does **not**
41
+ auto-load anything; the agent decides per turn. Eager loading is
42
+ opt-in and budget-gated.
43
+
44
+ ## Path rules
45
+
46
+ - Paths are repo-root relative.
47
+ - Paths MUST end in `.md`.
48
+ - Allowed roots: `.agent-src.uncompressed/contexts/`, `agents/contexts/`,
49
+ `.agent-src/contexts/` (compressed mirror). Any other root → linter
50
+ error.
51
+ - A rule MAY reference contexts under either tree, but a
52
+ `.agent-src.uncompressed/` rule SHOULD NOT eager-load an
53
+ `agents/contexts/` file (project-local leak into shared package).
54
+ Linter warns on this combination.
55
+ - A context file may itself declare `load_context:` (chain reasoning).
56
+ The linter rejects cycles.
57
+
58
+ ## Subdirectory conventions
59
+
60
+ Subdirectories under `contexts/` are **conventional, not enforced**.
61
+ The linter only validates the root prefix; subdirectory layout is a
62
+ documentation contract for human reviewers.
63
+
64
+ Two canonical subdirectories are in production:
65
+
66
+ | Subdir | Holds | First consumer |
67
+ |---|---|---|
68
+ | `contexts/execution/` | runtime decision logic, mechanics, and examples for execution-time rules (autonomy detection, verification mechanics, etc.) | `autonomous-execution` (Phase 2 of `road-to-pr-34-followups`) |
69
+ | `contexts/authority/` | mechanics behind authority gates — what makes commits, scope changes, and git ops legal vs. illegal | `commit-policy` and `scope-control` (Phase 6 of `road-to-pr-34-followups`) |
70
+
71
+ A third subdirectory, `contexts/communication/`, was proposed by the
72
+ PR #34 round-6 review for user-interaction and language-and-tone
73
+ mechanics. It is **not yet created** — the anti-speculation guard in
74
+ Phase 6 forbids creating a context root before its triggering rule
75
+ exists. Add it the same turn as the first migrating rule, not before.
76
+
77
+ A new subdirectory is justified when:
78
+
79
+ - A second rule needs to share contexts with the first one, AND
80
+ - The contexts have a coherent topic (execution, authority, communication, …), AND
81
+ - The triggering rule and its content move at the same time
82
+ (no empty subdir reservations).
83
+
84
+ Single-rule contexts that don't fit one of the canonical topics live
85
+ directly under `contexts/` (see `contexts/model-recommendations.md`,
86
+ `contexts/skills-and-commands.md`).
87
+
88
+ ## Combined char-budget guard
89
+
90
+ `load_context_eager:` triggers a budget check:
91
+
92
+ ```
93
+ chars(rule.md) + sum(chars(eager_target.md) for each entry) ≤ rule_cap
94
+ ```
95
+
96
+ `rule_cap` is the per-rule budget:
97
+
98
+ - Always rule: 2,500
99
+ - Auto rule: 4,000
100
+ - Safety rule (`type: "always"` AND covers Hard-Floor topics): 5,000
101
+
102
+ Linter computes the rule's class from frontmatter `type:` and the
103
+ hard-floor allowlist (`non-destructive-by-default`,
104
+ `security-sensitive-stop`). Exceeding the cap → linter error.
105
+
106
+ Lazy `load_context:` does **not** count against the budget — by
107
+ definition it is not loaded into every turn.
108
+
109
+ ## Public-vs-internal leak
110
+
111
+ A rule shipped to consumers (`.agent-src.uncompressed/rules/`) may
112
+ declare `load_context:` entries pointing at:
113
+
114
+ - `.agent-src.uncompressed/contexts/` — public, OK.
115
+ - `agents/contexts/` — package-internal, **lint warning** (the entry
116
+ will not exist in consumer projects).
117
+
118
+ Project-local rules may reference either. The linter classifies by
119
+ the rule's tree, not by the target's tree.
120
+
121
+ ## No circular references
122
+
123
+ A `load_context:` graph that cycles fails the linter. Cycles are
124
+ defined across both `load_context:` and `load_context_eager:` edges.
125
+
126
+ ## Examples
127
+
128
+ ### Real consumer — `autonomous-execution`
129
+
130
+ `.agent-src.uncompressed/rules/autonomous-execution.md` is the first
131
+ production rule to declare `load_context:`. Its frontmatter:
132
+
133
+ ```yaml
134
+ ---
135
+ type: "auto"
136
+ description: "Deciding whether to ask the user or just act on a workflow step — trivial-vs-blocking classification, autonomy opt-in detection, commit default; defers to non-destructive-by-default for the Hard Floor"
137
+ alwaysApply: false
138
+ source: package
139
+ load_context:
140
+ - .agent-src.uncompressed/contexts/execution/autonomy-detection.md
141
+ - .agent-src.uncompressed/contexts/execution/autonomy-mechanics.md
142
+ - .agent-src.uncompressed/contexts/execution/autonomy-examples.md
143
+ ---
144
+ ```
145
+
146
+ Three lazy-loaded contexts, no `load_context_eager:`. The agent reads
147
+ each context only when the corresponding section of the slim rule
148
+ points at it (the rule body cites the same paths in prose so the
149
+ load is intent-driven, not blanket).
150
+
151
+ Pattern proven by this consumer:
152
+
153
+ - **Slim the rule to obligations only** — the 192-line pre-split
154
+ source dropped to 119 lines (≤ 120 target met) by extracting LOGIC
155
+ (detection algorithm), MECHANICS (setting table, cloud behavior),
156
+ and EXAMPLES (anchor phrases, worked cases, failure modes) into
157
+ three separate context files.
158
+ - **Cite, don't duplicate** — the slim rule contains zero
159
+ algorithm/mechanics/example prose; everything moved was physically
160
+ removed (verified by Phase 2.5 obligation diff:
161
+ [`agents/reports/pr-34-phase-2-5-autonomous-execution-obligation-check.md`](../../agents/reports/pr-34-phase-2-5-autonomous-execution-obligation-check.md)).
162
+ - **Lazy by default** — no eager-load is declared; the budget guard
163
+ is therefore a no-op for this rule.
164
+
165
+ `task lint-load-context` reports **1 declarer**, all paths resolve,
166
+ no cycles.
167
+
168
+ ## Stability
169
+
170
+ `beta` — schema is settled and serves one production rule
171
+ (`autonomous-execution`). A breaking schema change is a SemVer-minor
172
+ pre-1.0 bump. Adding a new optional key is non-breaking. The first
173
+ consumer surfaced no schema gaps; the next migration batch (roadmap
174
+ `road-to-pr-34-followups` Phase 6 — `commit-policy`, `scope-control`,
175
+ `verify-before-complete`) is the next stress test.
176
+
177
+ ## Cross-references
178
+
179
+ - [`rule-priority-hierarchy.md`](rule-priority-hierarchy.md) — which
180
+ rule wins on conflict; this schema is orthogonal (depth, not
181
+ priority).
182
+ - [`rule-interactions.yml`](rule-interactions.yml) — pairwise rule
183
+ interaction matrix.
184
+ - [`STABILITY.md`](STABILITY.md) — beta-tag implications.
@@ -104,4 +104,3 @@ junior (yields). For `complements`, ordering is documentary only.
104
104
 
105
105
  - [`docs/contracts/STABILITY.md`](STABILITY.md) — public-surface stability tiers.
106
106
  - [`docs/contracts/adr-chat-history-split.md`](adr-chat-history-split.md) — ADR pattern for major rule structural changes.
107
- - [`agents/roadmaps/archive/road-to-post-pr29-optimize.md`](../../agents/roadmaps/archive/road-to-post-pr29-optimize.md) § P2.2 — anchor for this matrix.