@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
@@ -0,0 +1,53 @@
1
+ """Pilot compression ratio + Iron-Law checksum verification (one-off, not CI)."""
2
+ import sys, re, hashlib, statistics
3
+ from pathlib import Path
4
+
5
+ sys.path.insert(0, "scripts")
6
+ from measure_rule_budget import strip_frontmatter
7
+
8
+ FENCE_RE = re.compile(r"```(?:[^\n]*\n)([\s\S]*?)```")
9
+
10
+
11
+ def iron_law_sha(body: str) -> str:
12
+ blocks = FENCE_RE.findall(body)
13
+ norm = "".join(re.sub(r"\s+", " ", b).strip().upper() for b in blocks)
14
+ return hashlib.sha256(norm.encode()).hexdigest()[:16]
15
+
16
+
17
+ pairs = [
18
+ ("agent-authority", ".agent-src.uncompressed/rules/agent-authority.md", "docs/contracts/pilot/agent-authority.md"),
19
+ ("direct-answers", ".agent-src.uncompressed/rules/direct-answers.md", "docs/contracts/pilot/direct-answers.md"),
20
+ ("language-and-tone", ".agent-src.uncompressed/rules/language-and-tone.md", "docs/contracts/pilot/language-and-tone.md"),
21
+ ]
22
+
23
+ header = f"{'rule':25s} {'orig':>6s} {'pilot':>6s} {'r':>6s} {'budget':>7s} {'sha-orig':>16s} {'sha-pilot':>16s} {'IL':>3s}"
24
+ print(header)
25
+ print("-" * len(header))
26
+
27
+ ratios = []
28
+ for rid, orig_path, pilot_path in pairs:
29
+ orig_body, _ = strip_frontmatter(Path(orig_path).read_text())
30
+ pilot_body, _ = strip_frontmatter(Path(pilot_path).read_text())
31
+ o, p = len(orig_body), len(pilot_body)
32
+ r = p / o
33
+ ratios.append(r)
34
+ sha_o = iron_law_sha(orig_body)
35
+ sha_p = iron_law_sha(pilot_body)
36
+ match = "OK" if sha_o == sha_p else "FAIL"
37
+ budget = "OK" if p <= 1500 else f"+{p - 1500}"
38
+ print(f"{rid:25s} {o:6d} {p:6d} {r:6.3f} {budget:>7s} {sha_o:>16s} {sha_p:>16s} {match:>3s}")
39
+
40
+ mean = sum(ratios) / len(ratios)
41
+ median = statistics.median(ratios)
42
+ print()
43
+ print(f"r-values : {[round(x, 3) for x in ratios]}")
44
+ print(f"mean r = {mean:.3f}")
45
+ print(f"median r = {median:.3f}")
46
+ print(f"max r = {max(ratios):.3f}")
47
+ print(f"min r = {min(ratios):.3f}")
48
+ print()
49
+
50
+ TOTAL = 32403
51
+ print(f"Projected always-bucket @ r=mean ({mean:.3f}) : {int(TOTAL * mean):>6d} (target ≤ 25000)")
52
+ print(f"Projected always-bucket @ r=max ({max(ratios):.3f}) : {int(TOTAL * max(ratios)):>6d} (target ≤ 25000)")
53
+ print(f"Projected always-bucket @ r=med ({median:.3f}) : {int(TOTAL * median):>6d} (target ≤ 25000)")
@@ -68,7 +68,7 @@ Commands:
68
68
  refine-ticket:detect Run the deterministic refine-ticket detection helper
69
69
  chat-history:hook Platform hook entry point (read JSON from stdin)
70
70
  Usage: chat-history:hook --platform <claude|augment|cursor|cline|windsurf|gemini>
71
- chat-history:checkpoint Append a phase-boundary entry to .agent-chat-history
71
+ chat-history:checkpoint Append a phase-boundary entry to agents/.agent-chat-history
72
72
  (CHECKPOINT fallback for platforms without native hooks)
73
73
  roadmap-progress:hook PostToolUse hook entry point (read JSON from stdin)
74
74
  Regenerates roadmaps-progress.md when a tool wrote under agents/roadmaps/
@@ -1,7 +1,7 @@
1
1
  """Shipped baseline prices for the AI Council.
2
2
 
3
- This file is the bootstrap source for `.agent-prices.md` when the
4
- runtime file is missing. It is also the network-fallback source for
3
+ This file is the bootstrap source for `agents/.agent-prices.md` when
4
+ the runtime file is missing. It is also the network-fallback source for
5
5
  `scripts/update_prices.py` when the upstream feed (LiteLLM) is
6
6
  unreachable.
7
7
 
@@ -9,8 +9,8 @@ Prices are USD per **1 000 000** tokens. Models are identified by the
9
9
  exact `model:` string the user puts into `.agent-settings.yml`.
10
10
 
11
11
  Numbers below are a hand-curated snapshot — they will drift. The
12
- runtime never reads them directly once `.agent-prices.md` exists; the
13
- weekly refresh and user edits are the live source of truth.
12
+ runtime never reads them directly once `agents/.agent-prices.md`
13
+ exists; the weekly refresh and user edits are the live source of truth.
14
14
  """
15
15
 
16
16
  from __future__ import annotations
@@ -100,7 +100,7 @@ class ExternalAIClient(ABC):
100
100
 
101
101
  name: str = ""
102
102
  model: str = ""
103
- billable: bool = True # API-mode subclasses spend money; manual/playwright don't.
103
+ billable: bool = True # API-mode subclasses spend money; manual doesn't.
104
104
 
105
105
  @abstractmethod
106
106
  def ask(
@@ -4,14 +4,13 @@ Each council member runs in exactly one transport mode per invocation:
4
4
 
5
5
  - ``api`` — direct SDK call against the provider's API (billable).
6
6
  - ``manual`` — copy-paste loop with the user as transport (free).
7
- - ``playwright`` — browser automation (Phase 2c, not yet wired).
8
7
 
9
8
  Resolution precedence — first non-empty wins:
10
9
 
11
10
  1. Invocation flag e.g. ``/council mode:manual``
12
11
  2. Per-member setting ``ai_council.members.<name>.mode``
13
12
  3. Global setting ``ai_council.mode``
14
- 4. Built-in default ``api``
13
+ 4. Built-in default ``manual``
15
14
 
16
15
  This mirrors how ``cost_profile`` resolves in
17
16
  ``.augment/guidelines/agent-infra/layered-settings.md``.
@@ -24,9 +23,9 @@ from __future__ import annotations
24
23
 
25
24
  from typing import Mapping
26
25
 
27
- VALID_MODES: frozenset[str] = frozenset({"api", "manual", "playwright"})
26
+ VALID_MODES: frozenset[str] = frozenset({"api", "manual"})
28
27
 
29
- DEFAULT_MODE: str = "api"
28
+ DEFAULT_MODE: str = "manual"
30
29
 
31
30
 
32
31
  class InvalidModeError(ValueError):
@@ -1,18 +1,19 @@
1
1
  """Runtime pricing layer for the AI Council.
2
2
 
3
- Reads `.agent-prices.md` from the repo root, parses YAML frontmatter
4
- and the Markdown table, and exposes:
3
+ Reads `agents/.agent-prices.md` from the repo root, parses YAML
4
+ frontmatter and the Markdown table, and exposes:
5
5
 
6
- - `load_prices()` — parse `.agent-prices.md` (bootstraps if missing)
6
+ - `load_prices()` — parse `agents/.agent-prices.md` (bootstraps if missing)
7
7
  - `estimate_input_tokens()` — chars / 4 heuristic
8
8
  - `estimate_cost()` — input + output USD for a single member
9
9
  - `is_stale()` — True if `last_updated` is older than the
10
10
  most recent UTC Monday 00:00
11
- - `bootstrap_from_defaults()` — write a fresh `.agent-prices.md` from
12
- `_default_prices.DEFAULT_PRICES`
11
+ - `bootstrap_from_defaults()` — write a fresh `agents/.agent-prices.md`
12
+ from `_default_prices.DEFAULT_PRICES`
13
13
 
14
14
  The orchestrator never reads `_default_prices` directly. It always
15
- goes through `load_prices()` so user edits to `.agent-prices.md` win.
15
+ goes through `load_prices()` so user edits to
16
+ `agents/.agent-prices.md` win.
16
17
  """
17
18
 
18
19
  from __future__ import annotations
@@ -24,7 +25,7 @@ from pathlib import Path
24
25
  from scripts.ai_council._default_prices import DEFAULT_PRICES, LAST_UPDATED, as_rows
25
26
 
26
27
  REPO_ROOT = Path(__file__).resolve().parents[2]
27
- PRICES_FILE = REPO_ROOT / ".agent-prices.md"
28
+ PRICES_FILE = REPO_ROOT / "agents" / ".agent-prices.md"
28
29
 
29
30
  # Heuristic: 1 token ≈ 4 characters of English text. OpenAI's tiktoken
30
31
  # is more accurate but pulls in a heavy dep we explicitly avoid.
@@ -115,14 +116,14 @@ def is_stale(table: PriceTable, now: _dt.datetime | None = None) -> bool:
115
116
 
116
117
 
117
118
  def load_prices(path: Path = PRICES_FILE) -> PriceTable:
118
- """Parse `.agent-prices.md`; bootstrap from defaults if missing."""
119
+ """Parse `agents/.agent-prices.md`; bootstrap from defaults if missing."""
119
120
  if not path.exists():
120
121
  bootstrap_from_defaults(path)
121
122
  return _parse(path.read_text(encoding="utf-8"))
122
123
 
123
124
 
124
125
  def bootstrap_from_defaults(path: Path = PRICES_FILE) -> None:
125
- """Write a fresh `.agent-prices.md` from `_default_prices.py`."""
126
+ """Write a fresh `agents/.agent-prices.md` from `_default_prices.py`."""
126
127
  rows = as_rows()
127
128
  body = _render_markdown(LAST_UPDATED, "shipped-default", rows)
128
129
  path.write_text(body, encoding="utf-8")
@@ -35,9 +35,15 @@ from scripts.ai_council.orchestrator import render
35
35
 
36
36
  REPO_ROOT = Path(__file__).resolve().parents[2]
37
37
  SESSIONS_DIR = REPO_ROOT / "agents" / "council-sessions"
38
+ QUESTIONS_DIR = REPO_ROOT / "agents" / "council-questions"
39
+ RESPONSES_DIR = REPO_ROOT / "agents" / "council-responses"
38
40
  SETTINGS_FILE = REPO_ROOT / ".agent-settings.yml"
39
41
 
40
- DEFAULT_RETENTION_DAYS = 14
42
+ # Default retention for all council artefacts (questions, responses,
43
+ # sessions). Overridden by `ai_council.session_retention_days`
44
+ # in `.agent-settings.yml`. Council files are local-only scratch — short
45
+ # retention keeps the working tree from accumulating dead weight.
46
+ DEFAULT_RETENTION_DAYS = 7
41
47
  _TS_RE = re.compile(r"^(\d{4})-(\d{2})-(\d{2})T(\d{2})-(\d{2})-(\d{2})Z$")
42
48
 
43
49
 
@@ -152,6 +158,92 @@ def prune_old_sessions(
152
158
  return removed
153
159
 
154
160
 
161
+ def prune_old_artifacts(
162
+ artifact_dir: Path,
163
+ retention_days: int,
164
+ *,
165
+ now: _dt.datetime | None = None,
166
+ ) -> list[Path]:
167
+ """Delete files and timestamp-less directories older than `retention_days`.
168
+
169
+ mtime-based — used for `agents/council-questions/`,
170
+ `agents/council-responses/`, and root-level files in
171
+ `agents/council-sessions/` that don't match the
172
+ timestamp-subdir convention handled by `prune_old_sessions`.
173
+
174
+ Walks the directory non-recursively. For files: deletes when
175
+ mtime predates the cutoff. For sub-directories without a
176
+ timestamp name: deletes recursively when mtime predates the
177
+ cutoff. Never raises — disk failures log to stderr.
178
+
179
+ Returns the list of deleted paths. `retention_days <= 0`
180
+ disables pruning and returns an empty list.
181
+ """
182
+ if retention_days <= 0 or not artifact_dir.exists():
183
+ return []
184
+ cutoff = (now or _dt.datetime.now(_dt.timezone.utc)) - _dt.timedelta(days=retention_days)
185
+ cutoff_ts = cutoff.timestamp()
186
+ removed: list[Path] = []
187
+ try:
188
+ entries = list(artifact_dir.iterdir())
189
+ except OSError as exc: # noqa: BLE001 - never block the report
190
+ print(f"[council:session] artifact iterdir failed: {exc}", file=sys.stderr)
191
+ return removed
192
+ for entry in entries:
193
+ # Timestamp subdirs are owned by prune_old_sessions; skip them
194
+ # so the two pruners don't race.
195
+ if entry.is_dir() and _parse_session_timestamp(entry.name) is not None:
196
+ continue
197
+ try:
198
+ mtime = entry.stat().st_mtime
199
+ except OSError as exc: # noqa: BLE001 - never block the report
200
+ print(f"[council:session] artifact stat failed for {entry}: {exc}",
201
+ file=sys.stderr)
202
+ continue
203
+ if mtime >= cutoff_ts:
204
+ continue
205
+ try:
206
+ if entry.is_dir():
207
+ shutil.rmtree(entry)
208
+ else:
209
+ entry.unlink()
210
+ removed.append(entry)
211
+ except OSError as exc: # noqa: BLE001 - never block the report
212
+ print(f"[council:session] artifact remove failed for {entry}: {exc}",
213
+ file=sys.stderr)
214
+ return removed
215
+
216
+
217
+ def prune_all_council_artifacts(
218
+ retention_days: int | None = None,
219
+ *,
220
+ repo_root: Path | None = None,
221
+ now: _dt.datetime | None = None,
222
+ ) -> dict[str, list[Path]]:
223
+ """Prune every council artefact dir under `repo_root` in one pass.
224
+
225
+ Reads `retention_days` from settings if not supplied. Used by the
226
+ `task council-prune` target and by `save()`. Never raises.
227
+
228
+ Returns a dict keyed by directory label — `sessions`,
229
+ `questions`, `responses` — each mapped to the list of
230
+ paths actually removed.
231
+ """
232
+ root = repo_root or REPO_ROOT
233
+ days = _load_retention_days() if retention_days is None else retention_days
234
+ sessions = root / "agents" / "council-sessions"
235
+ questions = root / "agents" / "council-questions"
236
+ responses = root / "agents" / "council-responses"
237
+ return {
238
+ "sessions": (
239
+ prune_old_sessions(sessions, days, now=now)
240
+ + prune_old_artifacts(sessions, days, now=now)
241
+ ),
242
+ "questions": prune_old_artifacts(questions, days, now=now),
243
+ "responses": prune_old_artifacts(responses, days, now=now),
244
+ }
245
+
246
+
155
247
  def save(
156
248
  *,
157
249
  manifest: SessionManifest,
@@ -167,10 +259,12 @@ def save(
167
259
  - `Iterable[list[CouncilResponse]]` — multi-round, one list per
168
260
  round in execution order.
169
261
 
170
- `retention_days` controls auto-pruning of older sibling sessions
171
- after the new one is written. `None` reads the value from
172
- `.agent-settings.yml` (`ai_council.session_retention_days`,
173
- default `14`); `0` disables pruning.
262
+ `retention_days` controls auto-pruning of older council artefacts
263
+ after the new one is written sibling sessions plus, when
264
+ `sessions_dir` is not overridden, files in `council-questions/`
265
+ and `council-responses/`. `None` reads the value
266
+ from `.agent-settings.yml` (`ai_council.session_retention_days`,
267
+ default `7`); `0` disables pruning.
174
268
 
175
269
  Disk-write failures are surfaced via a stderr line but do not
176
270
  raise; the caller's text report is the source of truth.
@@ -232,5 +326,13 @@ def save(
232
326
 
233
327
  days = _load_retention_days() if retention_days is None else retention_days
234
328
  prune_old_sessions(base, days)
329
+ prune_old_artifacts(base, days)
330
+ # In production (no sessions_dir override), also prune the sibling
331
+ # council artefact dirs so questions/responses aren't left as dead
332
+ # weight. Tests that pass an explicit sessions_dir stay isolated
333
+ # from the wider tree.
334
+ if sessions_dir is None:
335
+ prune_old_artifacts(QUESTIONS_DIR, days)
336
+ prune_old_artifacts(RESPONSES_DIR, days)
235
337
 
236
338
  return session_dir
@@ -76,15 +76,13 @@ WORKSPACE: list[RuleEntry] = [
76
76
  RuleEntry("reviewer-awareness"),
77
77
  RuleEntry("scope-control"),
78
78
  RuleEntry("security-sensitive-stop"),
79
- RuleEntry("think-before-action", "degraded",
80
- strip_sections=["Consult memory before editing"]),
79
+ RuleEntry("think-before-action"),
81
80
  RuleEntry("verify-before-complete"),
82
- RuleEntry("cli-output-handling", "degraded",
83
- strip_sections=["Iron Law — rtk first, tail/grep fallback"]),
81
+ RuleEntry("cli-output-handling"),
84
82
  RuleEntry("downstream-changes"),
85
83
  RuleEntry("improve-before-implement"),
86
84
  RuleEntry("language-and-tone", "degraded",
87
- strip_sections=["`.md` files are ALWAYS English — no exceptions"]),
85
+ strip_sections=["`.md` files ALWAYS English"]),
88
86
  RuleEntry("missing-tool-handling"),
89
87
  RuleEntry("token-efficiency"),
90
88
  RuleEntry("user-interaction"),
@@ -71,14 +71,6 @@ add("no-cheap-questions.md", "pre-send Q&A check", "agent-only", "output",
71
71
  "NA-soft", "3", notes="Pre-send self-check, no platform surface")
72
72
 
73
73
  # ── Auto-rules — Tier 1 candidates (mechanizable, deterministic) ──────
74
- add("chat-history-cadence.md", "per-turn / per-tool / per-phase", "mechanical-already",
75
- "hook", "NA-mechanical", "mechanical-already",
76
- notes="PRECEDENT — heartbeat + chat_history.py + hooks. Reference pattern.")
77
- add("chat-history-ownership.md", "first turn", "hook", "state",
78
- "low", "1", notes="Detectable: ownership classification at session start")
79
- add("chat-history-visibility.md", "heartbeat marker emit", "mechanical-already",
80
- "hook", "NA-mechanical", "mechanical-already",
81
- notes="Subprocess marker print is already mechanical")
82
74
  add("onboarding-gate.md", "first turn (settings.onboarded == false)", "settings",
83
75
  "state", "low", "1",
84
76
  notes="Pilot candidate — frequency 100% on un-onboarded projects, binary verifiable")
@@ -341,7 +333,7 @@ def emit():
341
333
  lines.append("## Cross-references")
342
334
  lines.append("")
343
335
  lines.append("- Budget contract: [`docs/contracts/load-context-budget-model.md`](../../docs/contracts/load-context-budget-model.md)")
344
- lines.append("- Pattern precedent: `chat-history-cadence` (heartbeat hook + `scripts/chat_history.py`)")
336
+ lines.append("- Pattern precedent: `roadmap-progress-sync` (PostToolUse path-filter hook)")
345
337
  lines.append("- Phase 2A finding: [`adr-always-rule-context-split-not-viable.md`](adr-always-rule-context-split-not-viable.md)")
346
338
  lines.append("")
347
339