@event4u/agent-config 6.0.0 → 6.1.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 (378) hide show
  1. package/.claude-plugin/marketplace.json +5 -5
  2. package/CHANGELOG.md +167 -440
  3. package/README.md +3 -3
  4. package/dist/agent-src/commands/agent-handoff.md +5 -4
  5. package/dist/agent-src/commands/agent-status.md +1 -0
  6. package/dist/agent-src/commands/agents/audit.md +1 -0
  7. package/dist/agent-src/commands/agents/init.md +3 -0
  8. package/dist/agent-src/commands/agents/optimize.md +1 -0
  9. package/dist/agent-src/commands/agents/user/accept.md +1 -0
  10. package/dist/agent-src/commands/agents/user/init.md +1 -0
  11. package/dist/agent-src/commands/agents/user/review.md +1 -0
  12. package/dist/agent-src/commands/agents/user/show.md +1 -0
  13. package/dist/agent-src/commands/agents/user/update.md +1 -0
  14. package/dist/agent-src/commands/agents/user.md +1 -0
  15. package/dist/agent-src/commands/agents.md +1 -0
  16. package/dist/agent-src/commands/analytics/prune.md +3 -2
  17. package/dist/agent-src/commands/analytics/show.md +3 -2
  18. package/dist/agent-src/commands/analytics.md +3 -2
  19. package/dist/agent-src/commands/analyze-reference-repo.md +1 -0
  20. package/dist/agent-src/commands/bug-fix.md +1 -0
  21. package/dist/agent-src/commands/bug-investigate.md +1 -0
  22. package/dist/agent-src/commands/challenge-me/vision.md +3 -2
  23. package/dist/agent-src/commands/challenge-me/with-docs.md +3 -2
  24. package/dist/agent-src/commands/challenge-me.md +3 -2
  25. package/dist/agent-src/commands/chat-history/import.md +9 -9
  26. package/dist/agent-src/commands/chat-history.md +32 -30
  27. package/dist/agent-src/commands/check-current-md.md +1 -0
  28. package/dist/agent-src/commands/commit/in-chunks.md +1 -0
  29. package/dist/agent-src/commands/commit.md +1 -0
  30. package/dist/agent-src/commands/condense.md +1 -0
  31. package/dist/agent-src/commands/context/create.md +1 -0
  32. package/dist/agent-src/commands/context/refactor.md +1 -0
  33. package/dist/agent-src/commands/context.md +1 -0
  34. package/dist/agent-src/commands/cost-report.md +5 -4
  35. package/dist/agent-src/commands/council/analysis.md +3 -2
  36. package/dist/agent-src/commands/council/debate.md +5 -4
  37. package/dist/agent-src/commands/council/default.md +3 -2
  38. package/dist/agent-src/commands/council/design.md +3 -2
  39. package/dist/agent-src/commands/council/optimize.md +3 -2
  40. package/dist/agent-src/commands/council/pr.md +3 -2
  41. package/dist/agent-src/commands/council.md +4 -3
  42. package/dist/agent-src/commands/e2e-heal.md +1 -0
  43. package/dist/agent-src/commands/e2e-plan.md +1 -0
  44. package/dist/agent-src/commands/estimate-ticket.md +1 -0
  45. package/dist/agent-src/commands/feature/dev.md +1 -0
  46. package/dist/agent-src/commands/feature/explore.md +1 -0
  47. package/dist/agent-src/commands/feature/plan.md +6 -6
  48. package/dist/agent-src/commands/feature/refactor.md +1 -0
  49. package/dist/agent-src/commands/feature/roadmap.md +1 -0
  50. package/dist/agent-src/commands/feature.md +1 -0
  51. package/dist/agent-src/commands/fix/ci.md +1 -0
  52. package/dist/agent-src/commands/fix/portability.md +1 -0
  53. package/dist/agent-src/commands/fix/pr-comments.md +147 -15
  54. package/dist/agent-src/commands/fix/refs.md +1 -0
  55. package/dist/agent-src/commands/fix/seeder.md +1 -0
  56. package/dist/agent-src/commands/fix.md +8 -8
  57. package/dist/agent-src/commands/ghostwriter/delete.md +1 -0
  58. package/dist/agent-src/commands/ghostwriter/fetch.md +1 -0
  59. package/dist/agent-src/commands/ghostwriter/list.md +1 -0
  60. package/dist/agent-src/commands/ghostwriter/show.md +1 -0
  61. package/dist/agent-src/commands/ghostwriter/write.md +1 -0
  62. package/dist/agent-src/commands/ghostwriter.md +1 -0
  63. package/dist/agent-src/commands/grill-me.md +3 -2
  64. package/dist/agent-src/commands/image/analyse.md +1 -0
  65. package/dist/agent-src/commands/image/create.md +1 -0
  66. package/dist/agent-src/commands/image/verify.md +1 -0
  67. package/dist/agent-src/commands/image.md +1 -0
  68. package/dist/agent-src/commands/implement-ticket.md +1 -0
  69. package/dist/agent-src/commands/jira-ticket.md +1 -0
  70. package/dist/agent-src/commands/judge/on-diff.md +1 -0
  71. package/dist/agent-src/commands/judge/solo.md +1 -0
  72. package/dist/agent-src/commands/judge/steps.md +1 -0
  73. package/dist/agent-src/commands/judge.md +1 -0
  74. package/dist/agent-src/commands/knowledge/cross-repo.md +1 -0
  75. package/dist/agent-src/commands/knowledge/forget.md +1 -0
  76. package/dist/agent-src/commands/knowledge/ingest.md +1 -0
  77. package/dist/agent-src/commands/knowledge/list.md +1 -0
  78. package/dist/agent-src/commands/knowledge.md +1 -0
  79. package/dist/agent-src/commands/memory/add.md +8 -6
  80. package/dist/agent-src/commands/memory/learn-low-impact.md +3 -2
  81. package/dist/agent-src/commands/memory/load.md +7 -7
  82. package/dist/agent-src/commands/memory/mine-session.md +39 -12
  83. package/dist/agent-src/commands/memory/promote.md +3 -2
  84. package/dist/agent-src/commands/memory/propose.md +7 -6
  85. package/dist/agent-src/commands/memory.md +3 -2
  86. package/dist/agent-src/commands/mode.md +1 -0
  87. package/dist/agent-src/commands/module/create.md +1 -0
  88. package/dist/agent-src/commands/module/explore.md +1 -0
  89. package/dist/agent-src/commands/module.md +1 -0
  90. package/dist/agent-src/commands/optimize/agents-dir.md +1 -0
  91. package/dist/agent-src/commands/optimize/augmentignore.md +1 -0
  92. package/dist/agent-src/commands/optimize/rtk.md +1 -0
  93. package/dist/agent-src/commands/optimize/skills.md +1 -0
  94. package/dist/agent-src/commands/optimize-prompt.md +1 -0
  95. package/dist/agent-src/commands/optimize.md +1 -0
  96. package/dist/agent-src/commands/orchestrate.md +1 -0
  97. package/dist/agent-src/commands/override/create.md +1 -0
  98. package/dist/agent-src/commands/override/manage.md +1 -0
  99. package/dist/agent-src/commands/override.md +1 -0
  100. package/dist/agent-src/commands/package-reset.md +1 -0
  101. package/dist/agent-src/commands/package-test.md +1 -0
  102. package/dist/agent-src/commands/post-as/ghostwriter.md +1 -0
  103. package/dist/agent-src/commands/post-as/me.md +1 -0
  104. package/dist/agent-src/commands/post-as.md +1 -0
  105. package/dist/agent-src/commands/pr/create/description-only.md +1 -0
  106. package/dist/agent-src/commands/pr/create.md +25 -0
  107. package/dist/agent-src/commands/prediction-pool.md +1 -0
  108. package/dist/agent-src/commands/prepare-for-review.md +1 -0
  109. package/dist/agent-src/commands/profile/activate.md +1 -0
  110. package/dist/agent-src/commands/profile/deactivate.md +1 -0
  111. package/dist/agent-src/commands/profile/show.md +1 -0
  112. package/dist/agent-src/commands/profile.md +1 -0
  113. package/dist/agent-src/commands/project-analyze.md +1 -0
  114. package/dist/agent-src/commands/project-health.md +1 -0
  115. package/dist/agent-src/commands/quality-fix.md +1 -0
  116. package/dist/agent-src/commands/refine-ticket.md +1 -0
  117. package/dist/agent-src/commands/research/deep.md +1 -0
  118. package/dist/agent-src/commands/research/report.md +1 -0
  119. package/dist/agent-src/commands/research.md +1 -0
  120. package/dist/agent-src/commands/review-changes.md +1 -0
  121. package/dist/agent-src/commands/review-routing.md +1 -0
  122. package/dist/agent-src/commands/roadmap/ai-council.md +1 -0
  123. package/dist/agent-src/commands/roadmap/create.md +1 -0
  124. package/dist/agent-src/commands/roadmap/process-full.md +1 -0
  125. package/dist/agent-src/commands/roadmap/process-phase.md +1 -0
  126. package/dist/agent-src/commands/roadmap/process-step.md +1 -0
  127. package/dist/agent-src/commands/roadmap.md +1 -0
  128. package/dist/agent-src/commands/rule-compliance-audit.md +1 -0
  129. package/dist/agent-src/commands/security-audit-config.md +84 -0
  130. package/dist/agent-src/commands/set-cost-profile.md +1 -0
  131. package/dist/agent-src/commands/skill/preview.md +1 -0
  132. package/dist/agent-src/commands/skill.md +1 -0
  133. package/dist/agent-src/commands/skills/discover.md +1 -0
  134. package/dist/agent-src/commands/skills.md +1 -0
  135. package/dist/agent-src/commands/sync-agent-settings.md +1 -0
  136. package/dist/agent-src/commands/sync-gitignore/fix.md +1 -0
  137. package/dist/agent-src/commands/sync-gitignore.md +1 -0
  138. package/dist/agent-src/commands/tests/create.md +1 -0
  139. package/dist/agent-src/commands/tests/execute.md +1 -0
  140. package/dist/agent-src/commands/tests.md +1 -0
  141. package/dist/agent-src/commands/threat-model.md +1 -0
  142. package/dist/agent-src/commands/update-form-request-messages.md +1 -0
  143. package/dist/agent-src/commands/upstream-contribute.md +1 -0
  144. package/dist/agent-src/commands/video/from-script.md +1 -0
  145. package/dist/agent-src/commands/video/from-song.md +1 -0
  146. package/dist/agent-src/commands/video/scene.md +1 -0
  147. package/dist/agent-src/commands/video/stitch.md +1 -0
  148. package/dist/agent-src/commands/video/storyboard.md +1 -0
  149. package/dist/agent-src/commands/video.md +1 -0
  150. package/dist/agent-src/commands/work.md +1 -0
  151. package/dist/agent-src/contexts/augment-infrastructure.md +1 -1
  152. package/dist/agent-src/contexts/communication/rules-auto/skill-quality-mechanics.md +1 -1
  153. package/dist/agent-src/contexts/communication/rules-auto/slash-command-routing-policy-mechanics.md +2 -2
  154. package/dist/agent-src/contexts/communication/rules-auto/think-before-action-mechanics.md +6 -6
  155. package/dist/agent-src/contexts/contracts/consumer-agents-md-guide.md +2 -2
  156. package/dist/agent-src/contexts/execution/rdp-gate.md +75 -0
  157. package/dist/agent-src/contexts/subagent-configuration.md +1 -0
  158. package/dist/agent-src/personas/advisors/contrarian.md +1 -1
  159. package/dist/agent-src/personas/advisors/executor.md +1 -1
  160. package/dist/agent-src/personas/advisors/expansionist.md +1 -1
  161. package/dist/agent-src/personas/advisors/first-principles.md +1 -1
  162. package/dist/agent-src/personas/advisors/outsider.md +1 -1
  163. package/dist/agent-src/rules/autonomous-execution.md +12 -0
  164. package/dist/agent-src/rules/external-reference-deep-dive.md +1 -1
  165. package/dist/agent-src/rules/git-history-discipline.md +47 -1
  166. package/dist/agent-src/rules/improve-before-implement.md +12 -0
  167. package/dist/agent-src/rules/lethal-trifecta-guard.md +80 -0
  168. package/dist/agent-src/rules/no-pr-progress-comments.md +3 -4
  169. package/dist/agent-src/rules/notes-first-reasoning.md +71 -0
  170. package/dist/agent-src/rules/roadmap-progress-sync.md +48 -31
  171. package/dist/agent-src/rules/security-sensitive-stop.md +14 -1
  172. package/dist/agent-src/rules/source-confidentiality.md +97 -0
  173. package/dist/agent-src/rules/think-before-action.md +9 -1
  174. package/dist/agent-src/rules/untrusted-input-defense.md +76 -0
  175. package/dist/agent-src/scripts/archive_completed_roadmaps.py +171 -0
  176. package/dist/agent-src/skills/adversarial-review/SKILL.md +14 -0
  177. package/dist/agent-src/skills/agent-security-review/SKILL.md +113 -0
  178. package/dist/agent-src/skills/agent-security-review/evals/triggers.json +51 -0
  179. package/dist/agent-src/skills/ai-council/SKILL.md +3 -3
  180. package/dist/agent-src/skills/async-python-patterns/SKILL.md +1 -1
  181. package/dist/agent-src/skills/blast-radius-analyzer/SKILL.md +12 -11
  182. package/dist/agent-src/skills/command-routing/SKILL.md +1 -1
  183. package/dist/agent-src/skills/complexity-first-planning/SKILL.md +96 -0
  184. package/dist/agent-src/skills/complexity-first-planning/evals/triggers.json +16 -0
  185. package/dist/agent-src/skills/copilot-config/SKILL.md +3 -4
  186. package/dist/agent-src/skills/defense-in-depth/SKILL.md +1 -1
  187. package/dist/agent-src/skills/developer-like-execution/SKILL.md +5 -4
  188. package/dist/agent-src/skills/error-handling-patterns/SKILL.md +1 -1
  189. package/dist/agent-src/skills/feature-planning/SKILL.md +2 -2
  190. package/dist/agent-src/skills/mcp-builder/SKILL.md +1 -1
  191. package/dist/agent-src/skills/memory-consolidation/SKILL.md +63 -17
  192. package/dist/agent-src/skills/prompt-engineering-patterns/SKILL.md +1 -1
  193. package/dist/agent-src/skills/readme-writing-package/SKILL.md +1 -1
  194. package/dist/agent-src/skills/reasoning-orchestrator/SKILL.md +119 -0
  195. package/dist/agent-src/skills/reasoning-orchestrator/evals/triggers.json +16 -0
  196. package/dist/agent-src/skills/receiving-code-review/SKILL.md +6 -6
  197. package/dist/agent-src/skills/refine-prompt/SKILL.md +1 -1
  198. package/dist/agent-src/skills/refine-ticket/SKILL.md +1 -1
  199. package/dist/agent-src/skills/repomix-packer/SKILL.md +1 -1
  200. package/dist/agent-src/skills/secrets-management/SKILL.md +1 -1
  201. package/dist/agent-src/skills/subagent-orchestration/SKILL.md +10 -3
  202. package/dist/agent-src/skills/testing-anti-patterns/SKILL.md +1 -1
  203. package/dist/agent-src/skills/testing-anti-patterns/process-anti-patterns.md +1 -1
  204. package/dist/agent-src/skills/token-optimizer/SKILL.md +1 -1
  205. package/dist/agent-src/templates/agents/.gitattributes.fragment +0 -1
  206. package/dist/agent-src/templates/agents/agent-project-settings.example.yml +4 -4
  207. package/dist/agent-src/templates/scripts/check_memory.py +1 -2
  208. package/dist/agent-src/templates/scripts/check_memory_proposal.py +1 -1
  209. package/dist/agent-src/templates/scripts/memory_lookup.py +148 -289
  210. package/dist/agent-src/templates/scripts/memory_report.py +132 -2
  211. package/dist/agent-src/templates/scripts/memory_signal.py +7 -9
  212. package/dist/agent-src/templates/scripts/memory_status.py +25 -206
  213. package/dist/agent-src/templates/scripts/work_engine/directives/backend/memory.py +6 -6
  214. package/dist/agent-src/templates/scripts/work_engine/directives/ui/_passthrough.py +3 -3
  215. package/dist/agent-src/templates/scripts/work_engine/scoring/memory_visibility.py +0 -1
  216. package/dist/cli/agent-config.js +31 -300
  217. package/dist/cli/agent-config.js.map +1 -1
  218. package/dist/cli/commands/commands.js +10 -5
  219. package/dist/cli/commands/commands.js.map +1 -1
  220. package/dist/cli/discovery/loadManifest.js.map +1 -1
  221. package/dist/cli/main.js +309 -0
  222. package/dist/cli/main.js.map +1 -0
  223. package/dist/discovery/deprecation-report.md +1 -1
  224. package/dist/discovery/discovery-manifest.json +645 -342
  225. package/dist/discovery/discovery-manifest.json.sha256 +1 -1
  226. package/dist/discovery/discovery-manifest.summary.md +8 -5
  227. package/dist/discovery/orphan-report.md +1 -1
  228. package/dist/discovery/packs.json +149 -37
  229. package/dist/discovery/trust-report.md +3 -3
  230. package/dist/discovery/workspaces.json +61 -36
  231. package/dist/mcp/registry-manifest.json +4 -4
  232. package/dist/router.json +1 -1
  233. package/dist/server/routes/wizard.js +4 -3
  234. package/dist/server/routes/wizard.js.map +1 -1
  235. package/dist/server/schemas/settings.js +18 -0
  236. package/dist/server/schemas/settings.js.map +1 -1
  237. package/docs/MIGRATION.md +1 -1
  238. package/docs/adrs/cost/0001-hard-stop-hook.md +5 -5
  239. package/docs/adrs/memory/0001-consumer-side-snapshot.md +15 -7
  240. package/docs/adrs/memory/README.md +6 -5
  241. package/docs/adrs/router/0001-three-tier-routing.md +2 -2
  242. package/docs/adrs/schema/0001-json-schema-frontmatter.md +2 -2
  243. package/docs/adrs/smoke/0001-per-tier-smoke-scripts.md +5 -5
  244. package/docs/adrs/telegraph/0001-default-off-until-bench.md +3 -3
  245. package/docs/architecture.md +9 -9
  246. package/docs/archive/CHANGELOG-pre-2.2.0.md +30 -30
  247. package/docs/archive/CHANGELOG-pre-2.25.0.md +1 -1
  248. package/docs/archive/CHANGELOG-pre-4.5.0.md +1 -1
  249. package/docs/archive/CHANGELOG-pre-6.0.0.md +473 -0
  250. package/docs/benchmark.md +54 -53
  251. package/docs/benchmarks.md +2 -2
  252. package/docs/case-studies/{frontend-design-vs-ui-ux-pro-max.md → frontend-design-positioning.md} +4 -4
  253. package/docs/catalog.md +20 -13
  254. package/docs/command-flows.md +90 -92
  255. package/docs/contracts/adr-layout.md +2 -3
  256. package/docs/contracts/adr-level-6-productization.md +1 -1
  257. package/docs/contracts/ai-council-config.md +42 -7
  258. package/docs/contracts/command-clusters.md +1 -1
  259. package/docs/contracts/cost-enforcement.md +1 -1
  260. package/docs/contracts/cost-summary-schema.md +1 -1
  261. package/docs/contracts/daily-workspace.md +1 -0
  262. package/docs/contracts/discovery-manifest.schema.json +4 -2
  263. package/docs/contracts/explain-modes.md +1 -1
  264. package/docs/contracts/implement-ticket-flow.md +6 -7
  265. package/docs/contracts/mcp-tool-inventory.md +10 -10
  266. package/docs/contracts/measurement-baseline.md +1 -1
  267. package/docs/contracts/memory-visibility-v1.md +1 -5
  268. package/docs/contracts/namespace.md +1 -1
  269. package/docs/contracts/persona-schema.md +1 -1
  270. package/docs/contracts/rule-interactions.md +1 -1
  271. package/docs/contracts/smoke-contracts.md +1 -1
  272. package/docs/contracts/universal-skills.md +0 -1
  273. package/docs/contracts/workspace-boundary.md +84 -0
  274. package/docs/customization.md +3 -3
  275. package/docs/decisions/ADR-009-event4u-namespace.md +1 -1
  276. package/docs/decisions/ADR-013-discovery-frontmatter-contract.md +1 -1
  277. package/docs/decisions/ADR-026-explain-mode-translation.md +1 -1
  278. package/docs/decisions/ADR-088-no-external-runtime-federation.md +26 -27
  279. package/docs/decisions/ADR-090-visibility-command-frontmatter-field.md +95 -0
  280. package/docs/decisions/ADR-091-split-meta-capability-packs.md +113 -0
  281. package/docs/decisions/ADR-092-defer-command-tier-alias-removal.md +93 -0
  282. package/docs/decisions/ADR-093-ai-council-config-user-global.md +111 -0
  283. package/docs/decisions/ADR-094-agent-memory-layer-removal.md +94 -0
  284. package/docs/decisions/ADR-095-workspace-boundary-contract.md +108 -0
  285. package/docs/decisions/INDEX.md +6 -0
  286. package/docs/development.md +5 -7
  287. package/docs/getting-started.md +4 -4
  288. package/docs/guidelines/agent-infra/5w2h-analysis.md +1 -1
  289. package/docs/guidelines/agent-infra/comparison-matrix.md +1 -1
  290. package/docs/guidelines/agent-infra/corpus-grounding-authoring.md +1 -1
  291. package/docs/guidelines/agent-infra/critical-thinking.md +1 -1
  292. package/docs/guidelines/agent-infra/engineering-memory-data-format.md +1 -5
  293. package/docs/guidelines/agent-infra/first-principles.md +1 -1
  294. package/docs/guidelines/agent-infra/frontier-reasoning-operating-profile.md +164 -0
  295. package/docs/guidelines/agent-infra/inversion-thinking.md +1 -1
  296. package/docs/guidelines/agent-infra/ios-simulator-guide.md +9 -14
  297. package/docs/guidelines/agent-infra/mcp-request-signing.md +19 -22
  298. package/docs/guidelines/agent-infra/memory-access.md +25 -31
  299. package/docs/guidelines/agent-infra/mental-models.md +1 -1
  300. package/docs/guidelines/agent-infra/model-recommendation.md +29 -0
  301. package/docs/guidelines/agent-infra/scqa-framework.md +3 -3
  302. package/docs/guidelines/agent-infra/security-lint-containment.md +81 -0
  303. package/docs/guidelines/agent-infra/six-hats.md +1 -1
  304. package/docs/guidelines/agent-infra/systems-thinking.md +1 -1
  305. package/docs/guidelines/agent-infra/untrusted-input-spotlighting.md +72 -0
  306. package/docs/installation.md +1 -1
  307. package/docs/mcp.md +2 -2
  308. package/docs/parity/{bench-ruflo.json → bench-external.json} +10 -10
  309. package/docs/parity/{ruflo.md → external-runtime.md} +9 -9
  310. package/docs/quality.md +3 -3
  311. package/docs/safety.md +3 -3
  312. package/docs/skills-catalog.md +4 -1
  313. package/llms.txt +3 -0
  314. package/package.json +1 -1
  315. package/src/config/agent-settings.template.yml +65 -3
  316. package/src/config/discovery/packs.yml +29 -0
  317. package/src/config/discovery/workspaces.yml +3 -1
  318. package/src/config/gitignore-block.txt +6 -0
  319. package/src/scripts/__pycache__/validate_frontmatter.cpython-312.pyc +0 -0
  320. package/src/scripts/_cli/cmd_doctor.py +99 -13
  321. package/src/scripts/_lib/__pycache__/__init__.cpython-312.pyc +0 -0
  322. package/src/scripts/_lib/__pycache__/agent_src.cpython-312.pyc +0 -0
  323. package/src/scripts/_lib/bench_ab_scoring_v2.py +227 -0
  324. package/src/scripts/_lib/global_deploy_inventory.py +39 -9
  325. package/src/scripts/_lib/link_crypto.py +206 -0
  326. package/src/scripts/_lib/security_lint.py +228 -0
  327. package/src/scripts/ai_council/clients.py +2 -2
  328. package/src/scripts/ai_council/config.py +55 -0
  329. package/src/scripts/audit_adr_coverage.py +0 -2
  330. package/src/scripts/audit_command_surface.py +18 -5
  331. package/src/scripts/audit_mcp_tools.py +2 -2
  332. package/src/scripts/audit_skill_descriptions.py +2 -2
  333. package/src/scripts/bench_ab_clone.py +62 -12
  334. package/src/scripts/bench_ab_task_runner.py +475 -30
  335. package/src/scripts/bench_ab_v2_run.py +247 -0
  336. package/src/scripts/bench_ab_v2_stats.py +347 -0
  337. package/src/scripts/bench_run.py +1 -1
  338. package/src/scripts/build_discovery_manifest.py +10 -0
  339. package/src/scripts/check_bite_sized_granularity.py +1 -2
  340. package/src/scripts/check_memory.py +49 -63
  341. package/src/scripts/check_memory_proposal.py +1 -1
  342. package/src/scripts/check_no_external_sources.py +101 -0
  343. package/src/scripts/check_references.py +2 -0
  344. package/src/scripts/cost_by_conversation.py +1 -1
  345. package/src/scripts/council_cli.py +28 -14
  346. package/src/scripts/external_sources_denylist.json +91 -0
  347. package/src/scripts/hook_manifest.yaml +14 -6
  348. package/src/scripts/injection_scan_hook.py +145 -0
  349. package/src/scripts/install-hooks.sh +11 -0
  350. package/src/scripts/install.py +88 -13
  351. package/src/scripts/lint_agent_security.py +112 -0
  352. package/src/scripts/lint_bench_ab.py +5 -4
  353. package/src/scripts/lint_command_tiers.py +63 -22
  354. package/src/scripts/lint_discovery_vocabulary.py +2 -0
  355. package/src/scripts/lint_empty_roadmaps.py +80 -0
  356. package/src/scripts/lint_hidden_unicode.py +132 -0
  357. package/src/scripts/lint_instruction_smuggling.py +107 -0
  358. package/src/scripts/lint_marketplace.py +1 -1
  359. package/src/scripts/lint_mcp_config_security.py +124 -0
  360. package/src/scripts/lint_skill_frontmatter_safety.py +144 -0
  361. package/src/scripts/lint_workspace_boundary.py +122 -0
  362. package/src/scripts/mcp_server/consumer_tool_catalog.json +2 -3
  363. package/src/scripts/mcp_server/tools.py +8 -32
  364. package/src/scripts/memory_lookup.py +27 -296
  365. package/src/scripts/memory_report.py +1 -23
  366. package/src/scripts/memory_signal.py +6 -53
  367. package/src/scripts/memory_status.py +25 -206
  368. package/src/scripts/mine_session.py +118 -41
  369. package/src/scripts/pack_dependency_allowlist.json +2 -2
  370. package/src/scripts/render_benchmark_md.py +141 -52
  371. package/src/scripts/schemas/command.schema.json +6 -1
  372. package/src/scripts/security_audit_config.py +153 -0
  373. package/dist/agent-src/commands/chat-history/learn.md +0 -184
  374. package/dist/agent-src/commands/chat-history/show.md +0 -113
  375. package/dist/agent-src/commands/fix/pr-bot-comments.md +0 -157
  376. package/dist/agent-src/commands/fix/pr-developer-comments.md +0 -163
  377. package/dist/agent-src/templates/agents/memory/architecture-decisions.example.yml +0 -95
  378. package/docs/contracts/agent-memory-contract.md +0 -159
@@ -1,113 +0,0 @@
1
- ---
2
- model_tier: medium
3
- name: chat-history-show
4
- pack: meta
5
- tier: 2
6
- cluster: chat-history
7
- sub: show
8
- skills: [chat-history]
9
- description: Show the status of the persistent chat-history log — file size, entry count, header fingerprint, age, and the last few entries
10
- suggestion:
11
- eligible: false
12
- rationale: "Status display only; no NL trigger distinct from 'show status'."
13
- workspaces:
14
- - agent-config-maintainer
15
- packs:
16
- - meta
17
- ---
18
- <!-- cloud_safe: noop -->
19
-
20
- # /chat-history show
21
- Inspect `agents/runtime/.agent-chat-history` — the JSONL log appended by the
22
- structural chat-history hooks (`ChatHistoryAppendHook`,
23
- `ChatHistoryHaltAppendHook`) for crash recovery.
24
-
25
- Shows:
26
-
27
- - Whether the file exists and whether logging is currently enabled
28
- - File size vs `max_size_kb`
29
- - Header metadata: schema version, `started`, `frequency`
30
- - Entry count and age of the oldest/newest entry
31
- - A peek at the last 3–5 entries so the user can see what was captured
32
-
33
- Read-only — this command never writes to the file.
34
-
35
- ## When NOT to use
36
-
37
- - Wipe the file → delete `agents/runtime/.agent-chat-history` manually; it is
38
- git-ignored and will be recreated on the next hook fire.
39
- - Configure logging behavior → edit `.agent-settings.yml` directly
40
- (`chat_history.*`); see
41
- [`layered-settings`](../../docs/guidelines/agent-infra/layered-settings.md#section-aware-merge-rules).
42
-
43
- ## Steps
44
-
45
- ### 1. Check if enabled
46
-
47
- Read `chat_history.enabled` from `.agent-settings.yml`. If `false` or
48
- the section is missing, say so and stop:
49
-
50
- ```
51
- > 📒 chat-history is disabled (chat_history.enabled = false).
52
- > Set it to true in .agent-settings.yml to start logging.
53
- ```
54
-
55
- ### 2. Read status via helper
56
-
57
- Run `scripts/chat_history.py status`. The helper returns a JSON object
58
- with `exists`, `size_bytes`, `size_kb`, `entries`, `header`, and `path`.
59
-
60
- If `exists: false`, tell the user the file has not been created yet —
61
- it will be created on the next agent turn that writes an entry.
62
-
63
- ### 3. Read last N entries
64
-
65
- Run `scripts/chat_history.py read --last 5` (or equivalent — see the
66
- helper's CLI). Capture timestamps and entry types without loading the
67
- full file.
68
-
69
- ### 4. Present the summary
70
-
71
- Render a concise report:
72
-
73
- ```
74
- > 📒 chat-history status
75
- >
76
- > File: agents/runtime/.agent-chat-history ({size_kb} KB / {max_size_kb} KB)
77
- > Entries: {entries}
78
- > Schema: v{header.v} (started {header.started})
79
- > Frequency: {header.freq}
80
- > Overflow: {on_overflow}
81
- >
82
- > Last entries:
83
- > {ts_1} {type_1} {preview_1}
84
- > {ts_2} {type_2} {preview_2}
85
- > ...
86
- ```
87
-
88
- Keep previews short (≤ 60 chars). Do not render the full entry text
89
- unless the user asks (avoids flooding the conversation with old log
90
- data, see [`token-efficiency`](../rules/token-efficiency.md)).
91
-
92
- ### 5. Offer follow-ups (optional)
93
-
94
- If the file is close to `max_size_kb` (> 80 %), mention it — the next
95
- append may trigger overflow handling. To pull a specific prior
96
- session into the current chat verbatim, point the user at
97
- `/chat-history import`; to mine a prior session for project-improving
98
- learnings, `/chat-history learn`. The body filter on `s` is the v4
99
- isolation surface in both cases.
100
-
101
- ## Gotchas
102
-
103
- - `agents/runtime/.agent-chat-history` is git-ignored. This command never commits.
104
- - The helper is the only way to read the file — do not cat or parse
105
- the JSONL directly; entry shape is owned by `scripts/chat_history.py`.
106
- - If `exists: false` but the rule says logging is enabled, the file is
107
- created lazily on the first append. That is expected — not an error.
108
-
109
- ## See also
110
-
111
- - [`chat-history-platform-hooks`](../../../agents/settings/contexts/chat-history-platform-hooks.md) — the hook-only contract
112
- - [`agent-settings` template](../templates/agent-settings.md) — `chat_history.*` reference
113
- - [`scripts/chat_history.py`](../../../scripts/chat_history.py) — helper API (`status`, `read`, `sessions`, `prune-sessions`)
@@ -1,157 +0,0 @@
1
- ---
2
- model_tier: medium
3
- name: fix-pr-bot-comments
4
- pack: engineering-base
5
- tier: 2
6
- cluster: fix
7
- sub: pr-bot-comments
8
- skills: [php-coder, quality-tools]
9
- description: Fix and reply to bot review comments (Copilot, Augment, Greptile, etc.) on a GitHub PR
10
- suggestion:
11
- eligible: true
12
- trigger_description: "address the Copilot/Greptile comments, fix the bot review feedback"
13
- trigger_context: "open PR with bot review comments unresolved"
14
- workspaces:
15
- - agent-config-maintainer
16
- packs:
17
- - meta
18
- ---
19
-
20
- # /fix pr-bot-comments
21
- ## Input
22
-
23
- The user may or may not provide a PR URL.
24
-
25
- ### PR detection
26
-
27
- 1. If the user provides a GitHub PR URL → use that PR.
28
- 2. If no URL is provided → **try to detect the PR automatically:**
29
- - Determine the current Git branch (`git branch --show-current`).
30
- - Search for an open PR on that branch via the GitHub API
31
- (`GET /repos/{owner}/{repo}/pulls?head={owner}:{branch}&state=open`).
32
- - If exactly one PR is found → tell the user: "I found PR #{number} ({title}) on branch `{branch}`. Is that the one?"
33
- - Wait for confirmation before proceeding.
34
- - If no PR or multiple PRs are found → ask the user for the PR URL.
35
- 3. **Never** reuse a PR number from earlier in the conversation.
36
-
37
- ## Mode selection
38
-
39
- After the PR is confirmed, ask the user (use numbered options per `user-interaction` rule):
40
-
41
- ```
42
- > 1. Interactive — ask before each comment
43
- > 2. Automatic — handle all independently
44
- ```
45
-
46
- - **Option 1** → follow the "Interactive flow" below.
47
- - **Option 2** → follow the "Auto flow" below.
48
-
49
- ## Bot detection
50
-
51
- A comment is from a **bot** if the GitHub user has `type: "Bot"` or the login matches
52
- known bot accounts: `Copilot`, `github-actions[bot]`, `greptile[bot]`, `augment[bot]`,
53
- or any login ending in `[bot]`.
54
-
55
- ## Instructions (shared)
56
-
57
- 1. **Fetch all review comments** from the PR using the GitHub API (`/pulls/{number}/comments`).
58
- Use `per_page: 100`. Filter for **bot comments** that have **no reply yet** from a human user.
59
-
60
- 2. **For each unresolved bot comment**, read the affected file and surrounding context
61
- to understand the code and the suggestion.
62
-
63
- 3. **Report the total count** to the user: "Found X unresolved bot comments."
64
-
65
- ---
66
-
67
- ## Interactive flow
68
-
69
- For each comment, present it to the user **before** taking action:
70
-
71
- ### 1. Summarize the comment
72
-
73
- In the **user's language**, briefly explain:
74
- - Which file/line is affected
75
- - What the bot is suggesting
76
- - Your assessment: is it valid, partially valid, or not applicable?
77
-
78
- ### 2. Offer options
79
-
80
- Present numbered options. Always include a "leave as-is" option. Examples:
81
-
82
- **If there's one clear fix:**
83
- > **Comment 1/3** — `WorkingTimeService.php:108`
84
- > Bot says: The guard condition only checks `job_start`, but the comment also mentions `job_stop`.
85
- >
86
- > 1. Fix the comment (only mention `job_start`)
87
- > 2. Extend the guard condition (also check `job_stop`)
88
- > 3. Leave as-is, dismiss comment
89
-
90
- **If there are multiple valid approaches:**
91
- > **Comment 2/3** — `AbsencePlannerService.php:520`
92
- > Bot says: When an exception occurs mid-loop, log entries are missing.
93
- >
94
- > 1. `writeLogBulk()` in einen `finally`-Block verschieben
95
- > 2. Die gesamte Schleife in eine DB-Transaction wrappen
96
- > 3. Leave as-is, dismiss comment
97
-
98
- ### 3. Wait for the user's choice
99
-
100
- - Do NOT proceed until the user picks an option.
101
- - If the user asks a follow-up question, answer it before proceeding.
102
- - After the user chooses, apply the fix (or skip) and reply on GitHub.
103
-
104
- ### 4. Move to the next comment
105
-
106
- Repeat until all comments are handled.
107
-
108
- ---
109
-
110
- ## Auto flow
111
-
112
- Process all comments without asking. For each comment:
113
-
114
- 1. Analyze whether the suggestion is valid.
115
- 2. **If valid** — fix it and reply on GitHub.
116
- 3. **If not valid** — reply on GitHub explaining why, do NOT change the code.
117
-
118
- ---
119
-
120
- ## Common patterns to watch for
121
-
122
- - **Duplicate PHPDoc tags** → fix by keeping the more specific/typed version.
123
- - **Split PHPDoc blocks** → merge into a single docblock.
124
- - **Wrong PHPDoc tag order** → `@param` before `@return` before `@throws`.
125
- - **Conflicting PHPDoc types** → remove incorrect PHPDoc, trust the method signature.
126
- - **Broad ignore patterns / intentional config** → reply explaining rationale, don't change.
127
- - **Validation/logic bugs** → fix the code.
128
-
129
- ## Reply style — write like a human developer, not an AI
130
-
131
- - The GitHub API token authenticates as the PR author. Write replies as if you ARE the developer.
132
- - Keep it casual, short, and natural. Like a real dev replying to a code review.
133
- - Vary your wording — never use the same opening phrase twice in a row.
134
- - Don't over-explain. A dev who fixed something doesn't write a paragraph about it.
135
- - Good examples: `"Good catch, fixed."`, `"Yep, consolidated into one docblock now."`,
136
- `"Removed the duplicate 👍"`, `"That's intentional — [reason]"`
137
- - Never start multiple replies with "Fixed". Mix it up: "Done", "Good catch", "Yep", etc.
138
-
139
- ### Bot icon prefix
140
-
141
- Read `personal.pr_comment_bot_icon` from `.agent-settings.yml`. If `true` (default),
142
- prefix every reply with `🤖 ` so reviewers can see at a glance that the reply was
143
- bot-authored.
144
-
145
- Example: `🤖 Good catch, fixed.`
146
-
147
- If `false` or `.agent-settings.yml` doesn't exist, do NOT add the prefix.
148
-
149
- ## Replying via GitHub API
150
-
151
- Read `github.pr_reply_method` from `.agent-settings.yml` to determine the correct endpoint.
152
- See the `command-routing` skill → "GitHub API: Replying to PR review comments" for full details.
153
-
154
- ## After all comments
155
-
156
- 1. Run a PHP syntax check (`php -l`) on all modified files to verify nothing is broken.
157
- 2. **Do NOT commit or push.** Just apply the fixes locally and reply to all comments on GitHub.
@@ -1,163 +0,0 @@
1
- ---
2
- model_tier: medium
3
- name: fix-pr-developer-comments
4
- pack: engineering-base
5
- tier: 2
6
- cluster: fix
7
- sub: pr-developer-comments
8
- skills: [php-coder]
9
- description: Fix and reply to human reviewer comments on a GitHub PR
10
- suggestion:
11
- eligible: true
12
- trigger_description: "fix the human reviewer comments, address the developer feedback"
13
- trigger_context: "open PR with unresolved human-reviewer comments"
14
- workspaces:
15
- - agent-config-maintainer
16
- packs:
17
- - meta
18
- ---
19
-
20
- # /fix pr-developer-comments
21
- ## Input
22
-
23
- The user may or may not provide a PR URL.
24
-
25
- ### PR detection
26
-
27
- 1. If the user provides a GitHub PR URL → use that PR.
28
- 2. If no URL is provided → **try to detect the PR automatically:**
29
- - Determine the current Git branch (`git branch --show-current`).
30
- - Search for an open PR on that branch via the GitHub API
31
- (`GET /repos/{owner}/{repo}/pulls?head={owner}:{branch}&state=open`).
32
- - If exactly one PR is found → tell the user: "I found PR #{number} ({title}) on branch `{branch}`. Is that the one?"
33
- - Wait for confirmation before proceeding.
34
- - If no PR or multiple PRs are found → ask the user for the PR URL.
35
- 3. **Never** reuse a PR number from earlier in the conversation.
36
-
37
- ## Mode selection
38
-
39
- After the PR is confirmed, ask the user (use numbered options per `user-interaction` rule):
40
-
41
- ```
42
- > 1. Interactive — ask before each comment
43
- > 2. Automatic — handle all independently
44
- ```
45
-
46
- - **Option 1** → follow the "Interactive flow" below.
47
- - **Option 2** → follow the "Auto flow" below.
48
-
49
- ## Human reviewer detection
50
-
51
- A comment is from a **human reviewer** if:
52
- - The GitHub user `type` is `"User"` (not `"Bot"`).
53
- - The login does NOT end in `[bot]`.
54
- - The user is NOT the PR author (don't process your own comments).
55
-
56
- ## Instructions (shared)
57
-
58
- 1. **Fetch all review comments** from the PR using the GitHub API (`/pulls/{number}/comments`).
59
- Use `per_page: 100`. Also fetch **PR reviews** (`/pulls/{number}/reviews`) for top-level
60
- review comments. Filter for **human reviewer comments** that have **no reply yet** from the PR author.
61
-
62
- 2. **For each unresolved reviewer comment**, read the affected file and surrounding context
63
- to understand the code and what the reviewer is asking for.
64
-
65
- 3. **Report the total count** to the user: "Found X unresolved reviewer comments."
66
-
67
- ---
68
-
69
- ## Interactive flow
70
-
71
- For each comment, present it to the user **before** taking action:
72
-
73
- ### 1. Summarize the comment
74
-
75
- In the **user's language**, briefly explain:
76
- - Who wrote the comment (reviewer name/login)
77
- - Which file/line is affected
78
- - What the reviewer is requesting or asking
79
- - Your assessment: is it a valid concern, a question, a style preference, or a misunderstanding?
80
-
81
- ### 2. Offer options
82
-
83
- Present numbered options. Always include a "skip" option. Adapt options to the comment type:
84
-
85
- **For a change request:**
86
- > **Comment 1/3** — @cjost1988 in `WorkingTimeService.php:108`
87
- > Reviewer asks: Why is the fallback `float`? `$time` is `$hours * 60`.
88
- >
89
- > 1. Reply and explain why (no code change needed)
90
- > 2. Adjust type annotation to `float|int|string`
91
- > 3. Skip
92
-
93
- **For a bug report:**
94
- > **Comment 2/3** — @cjost1988 in `AbsencePlannerService.php:520`
95
- > Reviewer says: Race condition when two requests book simultaneously.
96
- >
97
- > 1. Add locking mechanism (DB lock or cache lock)
98
- > 2. Reply: not relevant in current scope, create a ticket
99
- > 3. Skip
100
-
101
- **For a question (no code change needed):**
102
- > **Comment 3/3** — @cjost1988 in `KS21Client.php:42`
103
- > Reviewer asks: Is this fallback ever reached?
104
- >
105
- > 1. Reply with explanation
106
- > 2. Skip
107
-
108
- ### 3. Wait for the user's choice
109
-
110
- - Do NOT proceed until the user picks an option.
111
- - If the user wants to write a custom reply, let them dictate the text.
112
- - If the user asks a follow-up question, answer it before proceeding.
113
- - After the user chooses, apply the fix (or reply) and post on GitHub.
114
-
115
- ### 4. Move to the next comment
116
-
117
- Repeat until all comments are handled.
118
-
119
- ---
120
-
121
- ## Auto flow
122
-
123
- Process all comments without asking. For each comment:
124
-
125
- 1. Analyze what the reviewer is requesting.
126
- 2. **If it's a clear code fix** — fix it and reply on GitHub.
127
- 3. **If it's a question** — reply with a concise explanation on GitHub.
128
- 4. **If it's ambiguous or a design decision** — flag it to the user instead of guessing.
129
- In auto mode, collect these and present them at the end: "These comments need your decision: ..."
130
-
131
- ---
132
-
133
- ## Reply style — write like a human developer, not an AI
134
-
135
- - The GitHub API token authenticates as the PR author. Write replies as if you ARE the developer.
136
- - Keep it casual, short, and natural. Like a real dev replying to a code review.
137
- - Vary your wording — never use the same opening phrase twice in a row.
138
- - For reviewer questions: answer directly and concisely. Don't over-explain.
139
- - For fixes: confirm briefly what was changed.
140
- - Be respectful — these are colleagues, not bots. Don't dismiss feedback.
141
- - Good examples: `"Good point, fixed."`, `"Yep, that was a leftover — removed."`,
142
- `"The fallback covers legacy data where getTime() returns a string."`
143
- - Never start multiple replies with the same phrase. Mix it up naturally.
144
-
145
- ### Bot icon prefix
146
-
147
- Read `personal.pr_comment_bot_icon` from `.agent-settings.yml`. If `true` (default),
148
- prefix every reply with `🤖 ` so reviewers can see at a glance that the reply was
149
- bot-authored.
150
-
151
- Example: `🤖 Good point, fixed.`
152
-
153
- If `false` or `.agent-settings.yml` doesn't exist, do NOT add the prefix.
154
-
155
- ## Replying via GitHub API
156
-
157
- Read `github.pr_reply_method` from `.agent-settings.yml` to determine the correct endpoint.
158
- See the `command-routing` skill → "GitHub API: Replying to PR review comments" for full details.
159
-
160
- ## After all comments
161
-
162
- 1. Run a PHP syntax check (`php -l`) on all modified files to verify nothing is broken.
163
- 2. **Do NOT commit or push.** Just apply the fixes locally and reply to all comments on GitHub.
@@ -1,95 +0,0 @@
1
- # architecture-decisions.yml — indexed ADRs with path constraints
2
- #
3
- # Writer: decision author at ADR time
4
- # Reader: `feature-plan`, `api-design`, `blast-radius-analyzer`
5
- # (consulted BEFORE proposing structural changes)
6
- # Expiry: marked `deprecated` on reversal; NEVER deleted — history
7
- # is the value. Supersession via `superseded_by`.
8
- # Location: agents/memory/architecture-decisions/<hash>.yml
9
- # OR agents/memory/architecture-decisions.yml (single-file)
10
- #
11
- # The YAML is an **index**, not the decision doc. Each entry points
12
- # to a long-form ADR (Markdown, Notion, Confluence — wherever your
13
- # team writes them) and captures the machine-readable metadata an
14
- # agent needs: paths constrained, alternatives rejected, trade-offs.
15
-
16
- version: 1
17
-
18
- entries:
19
- - id: 0007-tenant-boundaries
20
- status: active # active | deprecated | archived
21
- confidence: high
22
- source:
23
- - docs/adr/0007-tenant-boundaries.md
24
- - https://github.com/example/repo/pull/842
25
- owner: platform-team
26
- last_validated: 2026-04-10
27
- review_after_days: 365
28
-
29
- # --- decision body ---
30
- title: Tenant boundaries enforced by global scopes + dedicated DB
31
- date: 2025-11-18
32
- context: >
33
- Multi-tenant SaaS; legal requirement to isolate tenant data at
34
- rest. Prior approach (column-based scoping) leaked in three
35
- incidents over six months.
36
- decision: >
37
- Adopt per-tenant database connections with a `TenantScope`
38
- global scope on every tenant-owned Eloquent model. Raw DB
39
- access is forbidden outside migrations.
40
- alternatives_rejected:
41
- - id: column-scoping-only
42
- reason: Column scoping proven unsafe under complex joins.
43
- - id: schema-per-tenant
44
- reason: Operational cost of N schemas exceeded team capacity.
45
- trade_offs:
46
- - Higher connection pool usage — mitigated by connection reuse.
47
- - Slower local dev onboarding — mitigated by seeder changes.
48
- paths: # globs this ADR constrains
49
- - app/Models/Tenant*/**
50
- - config/database.php
51
- - database/migrations/*_tenant_*.php
52
- superseded_by: "" # id of replacement ADR
53
-
54
- - id: 0012-money-representation
55
- status: active
56
- confidence: high
57
- source:
58
- - docs/adr/0012-money-representation.md
59
- owner: finance-team
60
- last_validated: 2026-03-20
61
- review_after_days: 730
62
-
63
- title: Money represented as integer cents end-to-end
64
- date: 2026-01-05
65
- context: >
66
- Float precision errors in payment reconciliation caused
67
- two customer-facing discrepancies.
68
- decision: >
69
- All monetary values are integer cents (smallest currency unit).
70
- Floats appear only inside the formatter boundary, never in
71
- storage, transport, or business logic.
72
- alternatives_rejected:
73
- - id: decimal-type
74
- reason: DB decimal support uneven across MariaDB / SQLite
75
- test environments; integer is unambiguous.
76
- trade_offs:
77
- - Every new developer must learn the convention — mitigated by
78
- a dedicated `Money` value object with a strict type.
79
- paths:
80
- - app/Models/Invoice*.php
81
- - app/Models/Payment*.php
82
- - app/Services/Billing/**
83
- superseded_by: ""
84
-
85
- # --- How to add an entry ---
86
- #
87
- # 1. Write the ADR as a Markdown doc FIRST. This index is a pointer,
88
- # not a replacement.
89
- # 2. Link the ADR doc under `source`. At least one link is mandatory.
90
- # 3. List `paths` as globs the agent can match. Be generous — it is
91
- # better to trigger the ADR on too many paths than too few.
92
- # 4. Fill `alternatives_rejected` even when it feels obvious. The
93
- # agent's main job here is to stop re-litigating decisions.
94
- # 5. On reversal: keep the old entry, set `status: deprecated`, add
95
- # the new entry with `superseded_by` pointing back. History stays.
@@ -1,159 +0,0 @@
1
- ---
2
- stability: beta
3
- keep-beta-until: 2026-08-12
4
- ---
5
-
6
- # Agent-Memory Contract (as expected by `agent-config`)
7
-
8
- **Purpose.** Freeze the interface `agent-config` currently expects from
9
- the sibling package `@event4u/agent-memory`, so when that package
10
- actually ships we can diff its real surface against this document in
11
- one place — instead of chasing drift across skills, commands, and
12
- helpers.
13
-
14
- **Ownership.** `agent-memory` is ours; we decide release timing. This
15
- doc is internal, not a spec handed to an external team. The
16
- authoritative spec-side documents live under
17
- [`agents/roadmaps/agent-memory/`](../../agents/roadmaps/archive/agent-memory/); this context
18
- is the **consumer-side snapshot** — what our wired code assumes today.
19
-
20
- Last refreshed: 2026-04-22.
21
-
22
- ## What this doc is *not*
23
-
24
- - Not a replacement for the agent-memory retrieval-contract spec —
25
- that lives in the agent-memory package and is the spec we hand to
26
- the implementer.
27
- - Not a commitment that consumer code looks exactly like this forever
28
- — it is a point-in-time pin.
29
- - Not an agent-facing skill. Humans read this when the package lands.
30
-
31
- ## Expected backend states
32
-
33
- Defined in [`memory-access.md`](../../docs/guidelines/agent-infra/memory-access.md)
34
- and `scripts/memory_status.py`:
35
-
36
- | Status | Meaning | Agent-config behaviour |
37
- |---|---|---|
38
- | `absent` | Package not installed or CLI not on PATH | File fallback only |
39
- | `misconfigured` | Installed but `health()` fails within 2s | Warn once / session, fall back to file |
40
- | `present` | Installed and healthy within 2s | Route retrieval through package |
41
-
42
- Detection must be **bounded** (≤ 2s cold probe), **cached** per
43
- process, **non-raising** on probe failure.
44
-
45
- ## Expected CLI surface
46
-
47
- Probed in `scripts/memory_status.py` via `_CLI_CANDIDATES`:
48
-
49
- - Executable on `PATH` as **`memory`** (canonical, ships in
50
- `@event4u/agent-memory` v1.1+ as `package.json#bin.memory`),
51
- **`agent-memory`** (planned alias), or **`agentmem`** (legacy).
52
- - Supports `health` subcommand emitting a v1 health envelope on stdout
53
- (`{contract_version, status, backend_version, features, latency_ms}`)
54
- and exiting non-zero on unhealthy.
55
- - Supports `retrieve <query> [--type T …] [--limit N] [--layer 1|2|3]
56
- [--budget N] [--low-trust] [--repository ID]` emitting a v1
57
- retrieval envelope on stdout (always JSON).
58
-
59
- The retrieval invocation is **semantic, not key-based** — see the
60
- "⚠️ Known contract drift" section below for the consumer-side
61
- implication.
62
-
63
- If the released package diverges from these names, we update
64
- `_CLI_CANDIDATES` in `memory_status.py` — not the other way round.
65
-
66
- ## Expected retrieval shape (present path)
67
-
68
- Source of truth: the retrieval-contract spec in the agent-memory
69
- package. Consumer skills call the shared abstraction, not the package
70
- directly.
71
-
72
- **Request** (Python):
73
-
74
- ```python
75
- retrieve(types=[…], keys=[…] or {…}, limit: int = 20, timeout_ms: int = 2000)
76
- ```
77
-
78
- **Response** (v1 envelope) — mandatory fields per entry: `id`, `type`,
79
- `source ∈ {repo, operational}`, `confidence`, `body`. Optional:
80
- `trust`, `last_validated`, `shadowed_by`.
81
-
82
- Envelope: `contract_version`, `status ∈ {ok, partial, error}`,
83
- `entries`, `slices`, `errors`.
84
-
85
- ## ⚠️ Known contract drift (consumer vs. spec)
86
-
87
- **Status: resolved at the consumer boundary.** The CLI / JSON output of
88
- `scripts/memory_lookup.py` already emits the v1 envelope with
89
- `source ∈ {repo, operational}`, `confidence`, `slices`, `status`, and
90
- `contract_version` — see `memory_lookup.py:320-345` (envelope
91
- assembly).
92
-
93
- What remains is **internal-only**: the private `Hit` dataclass inside
94
- `memory_lookup.py` still uses `source ∈ {curated, intake}` and `score`.
95
- No skill, command, or external consumer imports `Hit` directly — they
96
- all go through the public JSON surface, which is already spec-aligned.
97
-
98
- | Internal `Hit` field | Public envelope field | Visible to consumers? |
99
- |---|---|---|
100
- | `id`, `type` | `id`, `type` | yes — match |
101
- | `source ∈ {curated, intake}` | `source ∈ {repo, operational}` | no — translated at boundary |
102
- | `score ∈ [0,1]` | `confidence` | no — translated at boundary |
103
- | `path` | — | no — internal scoring signal |
104
-
105
- **Trigger to revisit:** if a second module starts importing the `Hit`
106
- dataclass directly (e.g. `memory_lookup.py` is split into multiple
107
- files and `Hit` becomes a public type), rename `Hit.source`/`Hit.score`
108
- to match the envelope so the boundary translation can be deleted.
109
- Until then, the internal naming is an implementation detail.
110
-
111
- There is also a **calling-convention drift** between the contract's
112
- key-based `retrieve(types, keys, limit)` and the package's
113
- semantic-only `retrieve(query, …)`. This is tracked separately and
114
- is the subject of an ongoing design decision (hybrid contract — keys
115
- synthesise into a query for the package path; file-fallback stays
116
- key-match).
117
-
118
- ## Expected `propose()` / signal emission
119
-
120
- Shape used by `scripts/memory_signal.py` and the `/propose-memory`
121
- command: JSONL append-only drop-ins under
122
- `agents/memory/intake/*.jsonl`, one signal per line. When the package
123
- is present, the same payload is accepted by a `propose()` CLI or MCP
124
- call. File-drop is the always-works path.
125
-
126
- **Required fields** (keep in sync with `/propose-memory` command):
127
- `ts`, `type`, `key` (path or logical id), `observation`, `source`
128
- (`agent` or `human`), `session_id`.
129
-
130
- **Optional fields:**
131
-
132
- - `tags: string[]` — zero or more schema-routing labels from the
133
- controlled vocabulary `{convention, invariant, gotcha, pattern}`.
134
- Default `[]`. Producers (`/memory propose`, `/memory mine-session`)
135
- emit tags; consumers (`/memory promote`) read **tag intersection**
136
- to pick the curated YAML target when a signal carries two tags
137
- (e.g. `[gotcha, invariant]` → primary `gotcha` JSONL, promote target
138
- resolved by the reviewer at promotion time). See
139
- [`memory-consolidation`](../../.agent-src.uncondensed/skills/memory-consolidation/SKILL.md)
140
- § Phase 3 for the schema-routing table.
141
- - `confidence: low | medium | high` — producer-supplied estimate; the
142
- inline-review hook in `/memory load` ranks the top-3 by this field.
143
-
144
- ## Revisit triggers
145
-
146
- Q29 is **parked open**, not a blocker. Revisit when **one** of these
147
- holds:
148
-
149
- - `@event4u/agent-memory` ships a tagged release (any v0.x)
150
- - A consumer project explicitly asks for the `present` path
151
- - The agent-memory repo opens an integration PR against `agent-config`
152
- - We change the file fallback's public shape (then rewrite this doc
153
- *before* the change lands)
154
-
155
- ## See also
156
-
157
- - [`memory-access guideline`](../../docs/guidelines/agent-infra/memory-access.md)
158
- - [`scripts/memory_status.py`](../../.agent-src.uncondensed/templates/scripts/memory_status.py)
159
- - [`scripts/memory_lookup.py`](../../.agent-src.uncondensed/templates/scripts/memory_lookup.py)