@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
@@ -14,7 +14,7 @@ Keep the format regular — 2-space indent, no tabs, no lists, one nesting
14
14
  level only. The installer's YAML handler is a restricted stdlib parser, not
15
15
  a full YAML engine. Ask the agent to normalize after manual edits — it
16
16
  follows the merge rules in
17
- [`layered-settings`](../../docs/guidelines/agent-infra/layered-settings.md#section-aware-merge-rules).
17
+ [`layered-settings`](../docs/guidelines/agent-infra/layered-settings.md#section-aware-merge-rules).
18
18
 
19
19
  ### Migration from the legacy `.agent-settings` (key=value)
20
20
 
@@ -36,7 +36,7 @@ This block defines the personal and project-level settings that
36
36
  `scripts/install.py` (via `config/agent-settings.template.yml`)
37
37
  writes to `.agent-settings.yml` on first install. Subsequent edits are
38
38
  made by the user directly or by the agent on request, following the
39
- [section-aware merge rules](../../docs/guidelines/agent-infra/layered-settings.md#section-aware-merge-rules).
39
+ [section-aware merge rules](../docs/guidelines/agent-infra/layered-settings.md#section-aware-merge-rules).
40
40
 
41
41
  ```yaml
42
42
  # Agent Settings
@@ -45,14 +45,19 @@ made by the user directly or by the agent on request, following the
45
45
 
46
46
  # --- Cost profile ---
47
47
  #
48
- # Controls which agent surfaces are active. See `docs/customization.md` for
49
- # the authoritative description.
48
+ # Master switch that controls which rule tiers load each session.
49
+ # See `docs/customization.md` for the authoritative description and
50
+ # `docs/contracts/rule-router.md` for the kernel + router architecture.
50
51
  #
51
- # minimal = rules, skills, and commands only (zero extra surface, default)
52
- # balanced = + runtime dispatcher for skills that declare a shell command
53
- # full = + tool adapters (GitHub / Jira, read-only, opt-in)
54
- # custom = ignore profile every matrix value must be set explicitly
55
- cost_profile: minimal
52
+ # minimal = kernel only (always-loaded Iron-Law floor, ≤ 26k chars).
53
+ # No router, no auto-rules. Lowest token footprint.
54
+ # balanced = kernel + router + tier-1 auto-rules (default current behaviour
55
+ # superset; matches what existing consumer projects expect).
56
+ # full = kernel + tier-1 + tier-2 (everything). Highest fidelity,
57
+ # highest token cost. Pick this when working on agent-config
58
+ # itself or when you need every behavioural rule active.
59
+ # custom = ignore profile — every matrix value must be set explicitly.
60
+ cost_profile: balanced
56
61
 
57
62
  # --- Personal preferences ---
58
63
  personal:
@@ -122,7 +127,7 @@ eloquent:
122
127
 
123
128
  # --- Chat history (crash recovery) ---
124
129
  #
125
- # Persistent JSONL log at .agent-chat-history (project root, git-ignored).
130
+ # Persistent JSONL log at agents/.agent-chat-history (project root, git-ignored).
126
131
  # Keeps a durable record of the conversation so a crashed or switched
127
132
  # agent session can be resumed. See scripts/chat_history.py for the API.
128
133
  #
@@ -141,26 +146,6 @@ chat_history:
141
146
  # Overflow behavior: rotate (drop oldest) | compress (summarize)
142
147
  on_overflow: rotate
143
148
 
144
- # Heartbeat marker visibility: on | off | hybrid
145
- # on — print marker every reply (~20 tokens/reply, legacy)
146
- # off — never print (zero tokens, no drift signal)
147
- # hybrid — print only on drift (missing/foreign/returning); silent otherwise
148
- # YAML 1.1 booleanizes bare on/off — both are accepted, no quoting needed.
149
- heartbeat: hybrid
150
-
151
- # Population path: hook | checkpoint | manual
152
- # hook — platform fires lifecycle hooks; agent observes only
153
- # (Claude Code, Augment CLI, Cursor 1.7+, Cline non-Windows,
154
- # Windsurf, Gemini CLI). scripts/install.py wires hooks.
155
- # checkpoint — agent invokes /chat-history-checkpoint at phase boundaries
156
- # (Augment IDE plugin, Cursor < 1.7, Cline on Windows).
157
- # Cooperative three-gate Iron Law applies.
158
- # manual — rule is inert (cloud surfaces). Persistence is local-only.
159
- # Default `checkpoint` is the safest cooperative fallback. HOOK platforms
160
- # set this to `hook` automatically when scripts/install.py merges the
161
- # platform's settings file.
162
- path: checkpoint
163
-
164
149
  # --- Work-engine hooks ---
165
150
  #
166
151
  # Lifecycle hook surface of the `work_engine` Python engine
@@ -197,7 +182,7 @@ hooks:
197
182
  # routing drift.
198
183
  directive_set_guard: true
199
184
 
200
- # Chat-history hooks — populate .agent-chat-history structurally from
185
+ # Chat-history hooks — populate agents/.agent-chat-history structurally from
201
186
  # the engine. Gated by BOTH this block AND the global
202
187
  # chat_history.enabled above; either off → no chat-history hook
203
188
  # registers. Keep both on for the HOOK path; flip either off to fall
@@ -314,8 +299,8 @@ commands:
314
299
  # rules, commands, guidelines, personas) the agent consulted and
315
300
  # applied. Local only, append-only JSONL, never reaches a consumer
316
301
  # repo (gitignored). Maintainer-targeted feature; consumers leave it
317
- # off. See `docs/contracts/artifact-engagement-flow.md` (once Phase 3
318
- # of road-to-artifact-engagement-telemetry lands).
302
+ # off. See `.augment/contexts/contracts/artifact-engagement-flow.md`
303
+ # (once Phase 3 of road-to-artifact-engagement-telemetry lands).
319
304
  telemetry:
320
305
  artifact_engagement:
321
306
  # Master switch. `false` (default) produces zero file IO and zero
@@ -343,7 +328,7 @@ telemetry:
343
328
 
344
329
  Personal and project-level settings (initial file written by
345
330
  `scripts/install.py`, edits follow the merge rules in
346
- [`layered-settings`](../../docs/guidelines/agent-infra/layered-settings.md#section-aware-merge-rules)).
331
+ [`layered-settings`](../docs/guidelines/agent-infra/layered-settings.md#section-aware-merge-rules)).
347
332
  **Key paths use dot-notation** to denote nesting: `personal.user_name`
348
333
  lives under `personal:` in YAML.
349
334
 
@@ -363,27 +348,26 @@ lives under `personal:` in YAML.
363
348
  | `project.improvement_pr_branch_prefix` | string | `improve/agent-` | Branch prefix for agent improvement PRs. |
364
349
  | `github.pr_reply_method` | `replies_endpoint`, `create_review_comment`, `auto` | `create_review_comment` | GitHub API method for replying to PR review comments. `auto` detects on first use. |
365
350
  | `eloquent.access_style` | `getters_setters`, `get_attribute`, `magic_properties` | `getters_setters` | How to access Eloquent model attributes. See `eloquent` skill for details. |
366
- | `chat_history.enabled` | `true`, `false` | `true` | Persist chat events to `.agent-chat-history` (JSONL) for crash recovery. |
351
+ | `chat_history.enabled` | `true`, `false` | `true` | Persist chat events to `agents/.agent-chat-history` (JSONL) for crash recovery. |
367
352
  | `chat_history.frequency` | `per_turn`, `per_phase`, `per_tool` | per profile | Logging granularity. Defaults: `minimal`→`per_turn`, `balanced`→`per_phase`, `full`→`per_tool`. |
368
353
  | `chat_history.max_size_kb` | integer | per profile | Max file size before overflow handling. Defaults: `minimal`→`128`, `balanced`→`256`, `full`→`512`. |
369
354
  | `chat_history.on_overflow` | `rotate`, `compress` | per profile | On overflow: `rotate` drops oldest entries; `compress` marks the file for summarization on the next turn. Defaults: `minimal`/`balanced`→`rotate`, `full`→`compress`. |
370
- | `chat_history.heartbeat` | `on`, `off`, `hybrid` | `hybrid` | Visibility of the `📒 chat-history:` marker. `on` = every reply (~20 tokens), `off` = silent, `hybrid` = print only on drift states (`missing`/`foreign`/`returning`). YAML `on`/`off` accepted bare. |
371
- | `chat_history.path` | `hook`, `checkpoint`, `manual` | `checkpoint` | Population path. `hook` = platform fires lifecycle hooks; `checkpoint` = agent invokes `/chat-history-checkpoint` at phase boundaries; `manual` = rule inert (cloud). `scripts/install.py` flips this to `hook` when the platform's hook config is deployed. See [`agents/contexts/chat-history-platform-hooks.md`](../../../agents/contexts/chat-history-platform-hooks.md). |
355
+ | `chat_history.text_limits.{user,agent,tool,phase}` | integer (chars) | `user=0`, `agent=5000`, `tool=200`, `phase=200` | Per-entry-type text-length cap. `0` = verbatim, no slice. `N > 0` = collapse whitespace, slice to N chars, append `" [+K chars]"` so the log self-reports truncation. Defaults match `DEFAULT_TEXT_LIMITS` in `scripts/chat_history.py`. |
372
356
  | `hooks.enabled` | `true`, `false` | `false` | Master switch for the work-engine hook layer. When `false` (default) the registry stays empty and golden replay is byte-stable. See [`agents/contexts/work-engine-hooks.md`](../../../agents/contexts/work-engine-hooks.md). |
373
357
  | `hooks.trace` | `true`, `false` | `false` | Emit per-event trace lines on stderr. Useful for debugging; off by default because it is noisy. |
374
358
  | `hooks.halt_surface_audit` | `true`, `false` | `true` | Defense-in-depth check that every halt surfaced by the dispatcher carries the expected shape. Cheap. |
375
359
  | `hooks.state_shape_validation` | `true`, `false` | `true` | Re-run the state schema validator on `AFTER_LOAD` and `BEFORE_SAVE`. Cheap, catches drift. |
376
360
  | `hooks.directive_set_guard` | `true`, `false` | `true` | Verify the dispatcher-resolved directive set matches the input envelope intent. Cheap, catches routing drift. |
377
- | `hooks.chat_history.enabled` | `true`, `false` | `true` | Register the four chat-history hooks (turn-check, append, halt-append, heartbeat). Gated by **both** this flag AND `chat_history.enabled`; either off → no chat-history hook registers. |
361
+ | `hooks.chat_history.enabled` | `true`, `false` | `true` | Register the chat-history hooks (`append` on `after_step`, `halt_append` on `on_halt`). Gated by **both** this flag AND `chat_history.enabled`; either off → no chat-history hook registers. Schema v4: every entry self-identifies via a 16-char session fingerprint, no ownership/sidecar layer. |
378
362
  | `hooks.chat_history.script` | path | `scripts/chat_history.py` | Override path to the chat-history CLI. Set only when the script lives outside the standard location. |
379
363
  | `pipelines.skill_improvement` | `true`, `false` | `true` | When `true`: propose learning capture after meaningful tasks. When `false`: silent. Included in every profile except `custom`. |
380
364
  | `roadmap.quality_cadence` | `end_of_roadmap`, `per_phase`, `per_step` | `end_of_roadmap` | When `/roadmap execute` runs the project's quality pipeline. Default skips per-step / per-phase runs and gates only the final archival. `per_phase` runs once after every phase; `per_step` is the legacy verbose mode. Step checkboxes and the dashboard are always updated regardless. `verify-before-complete` still requires fresh output before any "roadmap complete" claim. |
381
365
  | `subagents.implementer_model` | model alias or empty | _(empty)_ | Model for implementer subagents. Empty = same tier as session model. See [subagent-configuration](../contexts/subagent-configuration.md). |
382
366
  | `subagents.judge_model` | model alias or empty | _(empty)_ | Model for judge subagents. Empty = one tier above implementer (opus if sonnet, sonnet if haiku). |
383
367
  | `subagents.max_parallel` | integer | `3` | Maximum parallel subagent invocations. `1` serializes. |
384
- | `roles.default_role` | `""`, `developer`, `reviewer`, `tester`, `po`, `incident`, `planner` | _(empty)_ | Role the agent defaults to at the start of a session. See [`role-contracts`](../../docs/guidelines/agent-infra/role-contracts.md). |
368
+ | `roles.default_role` | `""`, `developer`, `reviewer`, `tester`, `po`, `incident`, `planner` | _(empty)_ | Role the agent defaults to at the start of a session. See [`role-contracts`](../docs/guidelines/agent-infra/role-contracts.md). |
385
369
  | `roles.active_role` | same as `default_role` | _(empty)_ | Role currently active; set by `/mode <name>`, cleared by `/mode none`. Enables the `role-mode-adherence` rule. |
386
- | `personas.override` | list of persona ids | `[]` | Developer-local override of the team default lens cast. Empty = inherit `personas.default` from `.agent-project-settings.yml`. See [`layered-settings`](../../docs/guidelines/agent-infra/layered-settings.md). |
370
+ | `personas.override` | list of persona ids | `[]` | Developer-local override of the team default lens cast. Empty = inherit `personas.default` from `.agent-project-settings.yml`. See [`layered-settings`](../docs/guidelines/agent-infra/layered-settings.md). |
387
371
  | `personas.ignore` | list of persona ids | `[]` | Persona ids dropped from the default cast locally. Ignored personas stay invokable via `--personas=<id>`. |
388
372
  | `onboarding.onboarded` | `true`, `false` | `false` | Whether `/onboard` has run on this project. The `onboarding-gate` rule prompts for `/onboard` when this is `false`. Missing entirely = legacy project, treated as onboarded. |
389
373
  | `commands.suggestion.enabled` | `true`, `false` | `true` | Master switch for the command-suggestion layer. `false` = the layer is silent; explicit `/commands` still work. See `rules/command-suggestion-policy.md`. |
@@ -448,7 +432,7 @@ they ship with a live consumer in code and get documented here, not before.
448
432
  ## Sync rules
449
433
 
450
434
  When new settings are added to this template, the
451
- [section-aware merge rules](../../docs/guidelines/agent-infra/layered-settings.md#section-aware-merge-rules)
435
+ [section-aware merge rules](../docs/guidelines/agent-infra/layered-settings.md#section-aware-merge-rules)
452
436
  govern the update:
453
437
 
454
438
  1. Missing keys are added with their **default value** from this template,
@@ -16,10 +16,10 @@
16
16
  - [ ] **Single-tenant** — one database per deployment. No cross-tenant
17
17
  leakage is possible at the infra layer. Delete this file if true
18
18
  and the app will never shard.
19
- - [ ] **Multi-tenant, shared database** — one table with a tenant key
19
+ - [ ] **Multi-tenant, shared DB** — one table with a tenant key
20
20
  column (e.g., `tenant_id`, `workspace_id`).
21
21
  - [ ] **Multi-tenant, schema per tenant** — one DB, one schema each.
22
- - [ ] **Multi-tenant, database per tenant** — each tenant has its own
22
+ - [ ] **Multi-tenant, DB per tenant** — each tenant has its own
23
23
  connection.
24
24
 
25
25
  ## Tenant identifier
@@ -24,7 +24,7 @@ agents (and developers) quickly orient themselves when working in that area.
24
24
  |---|---|---|
25
25
  | **Module** | Document a module's structure and purpose | `client-software.md` |
26
26
  | **Domain** | Document a business domain across modules | `import-pipeline.md` |
27
- | **Service** | Document a complex service and its dependencies | `customer-service.md` |
27
+ | **Service** | Document a complex service and its deps | `customer-service.md` |
28
28
  | **Integration** | Document an external API/system integration | `probaus-api.md` |
29
29
  | **Infrastructure** | Document infrastructure or DevOps concerns | `queue-system.md` |
30
30
 
@@ -86,6 +86,27 @@ This repository contains {{project_description_oneline}}.
86
86
  - Do NOT review or suggest changes to unmodified code in the same file.
87
87
  - Do NOT nitpick style issues that linters/formatters auto-fix.
88
88
 
89
+ ## ✅ Known False Positives — Do NOT Flag
90
+
91
+ The repo ships agent-config rules and skills under `.augment/`,
92
+ `.agent-src/`, and `.agent-src.uncompressed/`. These trees use a
93
+ deliberate path convention; the following patterns are **correct by
94
+ design** — do not flag them as broken:
95
+
96
+ - **Relative cross-references inside markdown rules / skills** like
97
+ `[x](../docs/guidelines/foo.md)` or `[y](../contexts/bar.md)`. The
98
+ base resolves from the file's delivered location (e.g.
99
+ `.augment/rules/<rule>.md`) — these paths are valid via the
100
+ `.augment/` tree, even when the file is symlinked into
101
+ `.claude/rules/`, `.cursor/rules/`, or `.clinerules/`.
102
+ - **`path_prefix:` triggers containing `.agent-src.uncompressed/`**
103
+ in YAML frontmatter. This is a literal match pattern for the
104
+ host's router, **not** a file reference — keeping the verbatim
105
+ source path is required for the rule to fire on the right edits.
106
+ - **Symlinked rule files** under `.claude/rules/`, `.cursor/rules/`,
107
+ `.clinerules/`. Targets resolve into `.augment/rules/`; missing-file
108
+ reports here are renderer artifacts, not real bugs.
109
+
89
110
  ## ✅ Code Review Comment Behavior
90
111
 
91
112
  - **Never create duplicate comments** — one comment per concern per location.
@@ -0,0 +1,76 @@
1
+ # Copilot Code Review — Repository-Specific Suppressions
2
+
3
+ > Read by GitHub Copilot Code Review (PR bot) when reviewing this repo.
4
+ > Companion to `.github/copilot-instructions.md`. **This file is the
5
+ > path-resolution suppression floor** — it carries the rules Copilot
6
+ > needs to *not* flag, sharply scoped to the agent-config layout.
7
+
8
+ ## Why this file exists
9
+
10
+ The repo ships agent-config rules, skills, commands, and contexts under
11
+ `.augment/`, `.agent-src/`, and (during authoring) `.agent-src.uncompressed/`.
12
+ Cross-references inside those trees are valid via the **delivered**
13
+ `.augment/` layout — not via raw git checkout. Copilot's static checker
14
+ walks the git tree, so it sees broken paths where there are none.
15
+
16
+ This is **intentional, not a bug**. The installer (`scripts/install.sh`)
17
+ projects `.agent-src/` → `.augment/` and creates the symlinks that make
18
+ the paths resolve at agent runtime.
19
+
20
+ ## ✅ Known False Positives — Do NOT Flag
21
+
22
+ ### Relative cross-references inside markdown rules / skills / commands
23
+
24
+ ```markdown
25
+ [link](../docs/guidelines/foo.md)
26
+ [link](../contexts/bar.md)
27
+ [link](../docs/guidelines/baz.md)
28
+ ```
29
+
30
+ These resolve from the file's delivered location (e.g.
31
+ `.augment/rules/<rule>.md`). Even when the file is symlinked into
32
+ `.claude/rules/`, `.cursor/rules/`, or `.clinerules/`, the relative
33
+ form is correct by construction.
34
+
35
+ ### `path_prefix:` triggers containing `.agent-src.uncompressed/`
36
+
37
+ ```yaml
38
+ triggers:
39
+ - path_prefix: ".agent-src.uncompressed/rules/"
40
+ ```
41
+
42
+ This is a **literal match string** for the host's router — *not* a file
43
+ reference. Source-of-truth meta-rules (`augment-source-of-truth`,
44
+ `augment-portability`, `skill-quality`, `docs-sync`,
45
+ `rule-type-governance`) legitimately match against the authoring tree.
46
+
47
+ ### Symlinked rule / skill / command files
48
+
49
+ Targets resolve into `.augment/rules/`, `.augment/skills/`,
50
+ `.augment/commands/` via installer-managed symlinks. Missing-file
51
+ reports under `.claude/`, `.cursor/`, `.clinerules/` are renderer
52
+ artifacts, not real bugs.
53
+
54
+ ### Body-link forms `../docs/guidelines/...`
55
+
56
+ Single-up form is the post-rewrite shape produced by
57
+ `scripts/compress.py`. The compressed `.agent-src/rules/` tree is one
58
+ level deeper than the source `.agent-src.uncompressed/rules/`, so the
59
+ rewriter collapses `../../docs/...` to `../docs/...`. Both forms are
60
+ expected — one in source, one in compressed output.
61
+
62
+ ## ✅ What TO flag
63
+
64
+ - Code defects, security issues, broken tests, type errors — normal
65
+ review.
66
+ - New `.agent-src.uncompressed/` substrings introduced into
67
+ `.agent-src/rules/` body content (the `check-compressed-paths` task
68
+ already gates this — flag it as a regression if it slips through).
69
+ - Rule frontmatter with `load_context:` entries that don't follow the
70
+ logical-name convention (`contexts/<area>/<file>.md`).
71
+
72
+ ## Pointer
73
+
74
+ The full architecture is in `docs/architecture.md` § "Path resolution
75
+ and Copilot integration". The compressed-path validator is
76
+ `scripts/check_compressed_paths.py`, wired into `task ci`.
@@ -22,7 +22,7 @@ Templates for feature plan files stored in `agents/features/` or `app/Modules/{M
22
22
  | 💡 | Idea | Rough concept, not yet validated |
23
23
  | 🔍 | Exploring | Being researched and brainstormed |
24
24
  | 📋 | Planned | Structured plan complete, ready for roadmap |
25
- | 🗺️ | Roadmapped | Roadmap(s) generated, ready for implementation |
25
+ | 🗺️ | Roadmapped | Roadmap(s) generated, ready for impl |
26
26
  | 🔄 | In Progress | Implementation started |
27
27
  | ✅ | Complete | Feature shipped |
28
28
  | ❌ | Rejected | Decided not to build |
@@ -0,0 +1,127 @@
1
+ # Rule Template
2
+
3
+ > Template for creating new rules in `.agent-src.uncompressed/rules/{rule-name}.md`.
4
+ > Rules ship to `.agent-src/rules/` (compressed) and `.augment/rules/` (projected).
5
+ > Schema: `scripts/schemas/rule.schema.json`.
6
+
7
+ ## Instructions
8
+
9
+ 1. Pick a kebab-case `{rule-name}` matching the file stem.
10
+ 2. Copy the template below into `.agent-src.uncompressed/rules/{rule-name}.md`.
11
+ 3. Replace placeholders, drop sections that don't apply.
12
+ 4. Run `task lint-skills` and `python3 scripts/lint_load_context.py`.
13
+ 5. Compress: `bash scripts/compress.sh --changed` then follow the agent flow.
14
+
15
+ ## Path conventions — load-bearing
16
+
17
+ Two different fields, two different rules. Mixing them up will either
18
+ break linting or produce paths that resolve to nothing in the
19
+ consumer's `.augment/`.
20
+
21
+ ### `load_context:` / `load_context_eager:` — logical names
22
+
23
+ Use **logical names** rooted at the source — never the
24
+ `.agent-src.uncompressed/` prefix. The compress-time rewriter
25
+ (`scripts/compress.py::_rewrite_paths`) resolves logical names to
26
+ deployment-correct relative paths; the schema regex
27
+ (`scripts/schemas/rule.schema.json`) and `scripts/lint_load_context.py`
28
+ both reject the legacy prefix.
29
+
30
+ | Write this (logical) | Forbidden (legacy) |
31
+ |---|---|
32
+ | `contexts/execution/verification-mechanics.md` | `.agent-src.uncompressed/contexts/execution/verification-mechanics.md` |
33
+ | `contexts/authority/commit-mechanics.md` | `.agent-src.uncompressed/contexts/authority/commit-mechanics.md` |
34
+ | `agents/contexts/local.md` (project-local) | `.agent-src.uncompressed/contexts/...` for project-only material |
35
+
36
+ ### `triggers[].path_prefix:` — literal match pattern, not a file path
37
+
38
+ `path_prefix:` is a **literal match pattern** the host evaluates against
39
+ the file the agent is editing — it is **not** a file reference and is
40
+ **not rewritten**. Rules that fire when the agent edits source-of-truth
41
+ files legitimately keep the `.agent-src.uncompressed/` prefix (see
42
+ `skill-quality`, `docs-sync`, `rule-type-governance`,
43
+ `augment-portability`). Rules that fire on consumer-project paths use
44
+ `agents/`, `lang/`, `.augment/`, etc.
45
+
46
+ | Use case | Example `path_prefix:` |
47
+ |---|---|
48
+ | Fires when editing source-of-truth artifacts | `.agent-src.uncompressed/skills/` |
49
+ | Fires when editing consumer project files | `agents/`, `lang/`, `app/`, `src/` |
50
+ | Fires when editing the projected layer | `.augment/` |
51
+
52
+ ### Body links — `../../docs/...` is fine in source
53
+
54
+ Source files keep verbatim `../../docs/guidelines/...` and
55
+ `../../docs/contracts/...` links so they work in any markdown viewer.
56
+ The rewriter rewrites them to depth-aware single-up form at compress
57
+ time and is idempotent. Do not pre-rewrite in source.
58
+
59
+ ### Why "logical, depth-aware, idempotent"
60
+
61
+ A rule at `rules/{name}.md` resolves `contexts/{area}/{file}.md` to
62
+ `../contexts/{area}/{file}.md` in the compressed output; a nested
63
+ file at `commands/{cluster}/{sub}.md` resolves to
64
+ `../../contexts/{area}/{file}.md`. Re-running the rewriter does not
65
+ double-prefix. The full decision history lives in the archived
66
+ path-fixes roadmap under `agents/roadmaps/archive/`.
67
+
68
+ ## Template
69
+
70
+ ````markdown
71
+ ---
72
+ type: "always"
73
+ tier: "kernel"
74
+ description: "{One-line trigger sentence — what fires this rule}"
75
+ source: package
76
+ load_context:
77
+ - contexts/{area}/{file}.md
78
+ triggers:
79
+ - path_prefix: "{project-relative path or .augment/...}"
80
+ - keyword: "{trigger-keyword}"
81
+ routes_to:
82
+ - "skill:{target-skill}"
83
+ ---
84
+
85
+ # {Rule Title}
86
+
87
+ **Iron Law.** {The single non-negotiable behavior the rule enforces.}
88
+
89
+ ## When this fires
90
+
91
+ {1–3 bullets on the trigger surface — what the agent is doing when this rule applies.}
92
+
93
+ ## What to do
94
+
95
+ {Numbered procedure or short directive list. Reference skills / guidelines
96
+ for full detail; rules are pointers, not playbooks.}
97
+
98
+ ## What NOT to do
99
+
100
+ - {Anti-pattern 1}
101
+ - {Anti-pattern 2}
102
+
103
+ ## See also
104
+
105
+ - [`{related-rule}`](./{related-rule}.md)
106
+ - [`{guideline-ref}`](docs/guidelines/{group}/{name}.md) — full pattern catalog
107
+ ````
108
+
109
+ ## Field reference
110
+
111
+ | Field | Required | Notes |
112
+ |---|---|---|
113
+ | `type` | yes | `always` or `auto`. Always-rules load every turn; auto-rules require trigger match. |
114
+ | `tier` | yes | `kernel` (Iron Law floor), `tier-1` (default), `tier-2` (full profile only). Legacy values still accepted. |
115
+ | `description` | yes | One sentence, ≤ 500 chars. Trigger-clarity wins over poetry. |
116
+ | `source` | yes | `package` (this repo) or `project` (consumer override). |
117
+ | `load_context` | no | Lazy context list — logical names only. Budget enforced by `lint_load_context.py`. |
118
+ | `load_context_eager` | no | Eager context list — counts against per-rule char budget. |
119
+ | `triggers` | no | Required on non-kernel rules per `rule-router.md`. |
120
+ | `routes_to` | no | `skill:`, `guideline:`, `command:`, `contract:` targets. Forbidden on kernel rules. |
121
+ | `alwaysApply` | no | Cursor/Cline sidecar — by convention `true` for `type: always`. |
122
+
123
+ ## Size budget
124
+
125
+ - Kernel rules: ≤ 4 000 chars (Iron-Law overrides documented in `docs/contracts/iron-law-overrides.txt`).
126
+ - Non-kernel rules: ≤ 2 500 chars.
127
+ - Enforced by `task lint-rule-budget`.
@@ -17,8 +17,6 @@ from .hooks import HookRegistry
17
17
  from .hooks.builtin import (
18
18
  ChatHistoryAppendHook,
19
19
  ChatHistoryHaltAppendHook,
20
- ChatHistoryHeartbeatHook,
21
- ChatHistoryTurnCheckHook,
22
20
  DecisionTraceHook,
23
21
  DirectiveSetGuardHook,
24
22
  HaltSurfaceAuditHook,
@@ -74,12 +72,16 @@ def _build_hook_registry(args: argparse.Namespace) -> HookRegistry:
74
72
  def _register_chat_history_hooks(
75
73
  registry: HookRegistry, settings: HookSettings,
76
74
  ) -> None:
77
- """Register the four chat-history hooks bound to the configured script."""
75
+ """Register the structural chat-history hooks bound to the configured script.
76
+
77
+ Hook-only contract (post road-to-chat-history-hook-only): only the
78
+ append + halt-append hooks remain; cooperative ``turn-check`` /
79
+ ``heartbeat`` hooks were removed when the cooperative always-rules
80
+ were retired.
81
+ """
78
82
  script = Path(settings.chat_history_script)
79
- ChatHistoryTurnCheckHook(script).register(registry)
80
83
  ChatHistoryAppendHook(script).register(registry)
81
84
  ChatHistoryHaltAppendHook(script).register(registry)
82
- ChatHistoryHeartbeatHook(script).register(registry)
83
85
 
84
86
 
85
87
  __all__ = ["_build_hook_registry", "_register_chat_history_hooks"]
@@ -22,8 +22,6 @@ from __future__ import annotations
22
22
  from .builtin import (
23
23
  ChatHistoryAppendHook,
24
24
  ChatHistoryHaltAppendHook,
25
- ChatHistoryHeartbeatHook,
26
- ChatHistoryTurnCheckHook,
27
25
  DecisionTraceHook,
28
26
  DirectiveSetGuardHook,
29
27
  HaltSurfaceAuditHook,
@@ -40,8 +38,6 @@ from .runner import HookRunner
40
38
  __all__ = [
41
39
  "ChatHistoryAppendHook",
42
40
  "ChatHistoryHaltAppendHook",
43
- "ChatHistoryHeartbeatHook",
44
- "ChatHistoryTurnCheckHook",
45
41
  "DecisionTraceHook",
46
42
  "DirectiveSetGuardHook",
47
43
  "HaltSurfaceAuditHook",
@@ -13,8 +13,6 @@ from __future__ import annotations
13
13
 
14
14
  from .chat_history_append import ChatHistoryAppendHook
15
15
  from .chat_history_halt_append import ChatHistoryHaltAppendHook
16
- from .chat_history_heartbeat import ChatHistoryHeartbeatHook
17
- from .chat_history_turn_check import ChatHistoryTurnCheckHook
18
16
  from .decision_trace import DecisionTraceHook
19
17
  from .directive_set_guard import DirectiveSetGuardHook
20
18
  from .halt_surface_audit import HaltSurfaceAuditHook
@@ -25,8 +23,6 @@ from .trace import TraceHook
25
23
  __all__ = [
26
24
  "ChatHistoryAppendHook",
27
25
  "ChatHistoryHaltAppendHook",
28
- "ChatHistoryHeartbeatHook",
29
- "ChatHistoryTurnCheckHook",
30
26
  "DecisionTraceHook",
31
27
  "DirectiveSetGuardHook",
32
28
  "HaltSurfaceAuditHook",
@@ -12,9 +12,6 @@ import sys
12
12
  from pathlib import Path
13
13
  from typing import Callable, Sequence
14
14
 
15
- from ..context import HookContext
16
- from ..exceptions import HookError
17
-
18
15
  ProcessRunner = Callable[[Sequence[str]], "subprocess.CompletedProcess[str]"]
19
16
  """Callable that runs a subprocess. Production default: ``_default_runner``."""
20
17
 
@@ -28,65 +25,24 @@ def _default_runner(cmd: Sequence[str]) -> "subprocess.CompletedProcess[str]":
28
25
  return subprocess.run(list(cmd), capture_output=True, text=True, check=False)
29
26
 
30
27
 
31
- def _derive_first_user_msg(ctx: HookContext) -> str | None:
32
- """Pull a stable first-user-msg out of the available context.
28
+ class _ChatHistoryHookBase:
29
+ """Shared plumbing script path and runner.
33
30
 
34
- CLI-layer events carry ``ctx.work`` (the v1 envelope); dispatcher-layer
35
- events (``before_step`` / ``after_step`` / ``on_halt``) carry only
36
- ``ctx.delivery`` (the legacy :class:`DeliveryState`). Both shapes feed
37
- the same ``id: title`` / ``raw`` derivation so chat-history entries
38
- stay stable across the lifecycle. Returns ``None`` when the shape is
39
- unknown — callers raise ``HookError`` so the runner converts it to
40
- a warning.
31
+ Schema v4 derives session attribution from the platform ``session_id``
32
+ (passed by the platform-hook dispatcher), not from a derived
33
+ first-user-msg. work-engine internal hooks have no platform session
34
+ in scope, so they omit ``--session-id`` and entries land in the
35
+ ``<unknown>`` session bucket.
41
36
  """
42
- work = ctx.work
43
- if work is not None and getattr(work, "input", None) is not None:
44
- inp = work.input
45
- data = getattr(inp, "data", None) or {}
46
- kind = getattr(inp, "kind", None)
47
- if kind == "prompt":
48
- raw = data.get("raw")
49
- if raw:
50
- return str(raw)
51
- elif kind == "ticket":
52
- joined = _ticket_msg(data)
53
- if joined:
54
- return joined
55
-
56
- delivery = ctx.delivery
57
- if delivery is not None:
58
- ticket = getattr(delivery, "ticket", None) or {}
59
- joined = _ticket_msg(ticket)
60
- if joined:
61
- return joined
62
- return None
63
-
64
-
65
- def _ticket_msg(ticket: dict) -> str:
66
- ticket_id = ticket.get("id") or ""
67
- title = ticket.get("title") or ""
68
- return f"{ticket_id}: {title}".strip(": ").strip()
69
-
70
-
71
- class _ChatHistoryHookBase:
72
- """Shared plumbing — script path, runner, and first-msg derivation."""
73
37
 
74
38
  def __init__(
75
39
  self,
76
40
  script_path: Path,
77
41
  *,
78
42
  runner: ProcessRunner | None = None,
79
- first_user_msg: str | None = None,
80
43
  ) -> None:
81
44
  self.script_path = Path(script_path)
82
45
  self._runner = runner or _default_runner
83
- self._fixed_msg = first_user_msg
84
-
85
- def _resolve_msg(self, ctx: HookContext) -> str:
86
- msg = self._fixed_msg or _derive_first_user_msg(ctx)
87
- if not msg:
88
- raise HookError("chat-history hook: cannot derive first-user-msg")
89
- return msg
90
46
 
91
47
  def _invoke(self, *args: str) -> "subprocess.CompletedProcess[str]":
92
48
  cmd = [sys.executable, str(self.script_path), *args]
@@ -29,10 +29,9 @@ class ChatHistoryAppendHook(_ChatHistoryHookBase):
29
29
  result = ctx.result
30
30
  if result is None or getattr(result, "outcome", None) != Outcome.SUCCESS:
31
31
  return
32
- msg = self._resolve_msg(ctx)
33
32
  payload: dict[str, Any] = {"step": ctx.step_name or "<unknown>"}
34
33
  proc = self._invoke(
35
- "append", "--first-user-msg", msg,
34
+ "append",
36
35
  "--type", "phase", "--json", json.dumps(payload),
37
36
  )
38
37
  if proc.returncode != EXIT_OK:
@@ -22,7 +22,6 @@ class ChatHistoryHaltAppendHook(_ChatHistoryHookBase):
22
22
  registry.register(HookEvent.ON_HALT, self._on_halt)
23
23
 
24
24
  def _on_halt(self, ctx: HookContext) -> None:
25
- msg = self._resolve_msg(ctx)
26
25
  questions: list[str] = []
27
26
  if ctx.result is not None:
28
27
  questions = list(getattr(ctx.result, "questions", []) or [])
@@ -30,7 +29,7 @@ class ChatHistoryHaltAppendHook(_ChatHistoryHookBase):
30
29
  questions = list(getattr(ctx.delivery, "questions", []) or [])
31
30
  payload = {"step": ctx.step_name or "<unknown>", "questions": questions}
32
31
  proc = self._invoke(
33
- "append", "--first-user-msg", msg,
32
+ "append",
34
33
  "--type", "decision", "--json", json.dumps(payload),
35
34
  )
36
35
  if proc.returncode != EXIT_OK:
@@ -4,10 +4,9 @@ Implements the producer side of
4
4
  ``docs/contracts/memory-visibility-v1.md``: derive ``asks/hits/ids``
5
5
  from ``state.memory`` and thread the rendered line into
6
6
  ``state.report`` so the agent's reply naturally carries the memory
7
- heartbeat.
7
+ visibility marker.
8
8
 
9
- Fires on ``before_save`` for the same reason as
10
- ``ChatHistoryHeartbeatHook``: ``cli._sync_back`` runs between
9
+ Fires on ``before_save``: ``cli._sync_back`` runs between
11
10
  ``after_dispatch`` and ``before_save`` and reassigns
12
11
  ``work.report = delivery.report``. A line written on
13
12
  ``after_dispatch`` would be overwritten before ``_save``; firing on