@event4u/agent-config 14.23.0 → 15.0.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 (503) hide show
  1. package/.augment-plugin/marketplace.json +3 -3
  2. package/.augment-plugin/plugin.json +1 -1
  3. package/.claude-plugin/marketplace.json +1 -1
  4. package/CHANGELOG.md +198 -0
  5. package/README.md +1 -1
  6. package/dist/agent-src/commands/agent-handoff.md +8 -7
  7. package/dist/agent-src/commands/agents/init.md +1 -1
  8. package/dist/agent-src/commands/agents/user/accept.md +4 -4
  9. package/dist/agent-src/commands/agents/user/delete.md +2 -2
  10. package/dist/agent-src/commands/agents/user/init.md +3 -3
  11. package/dist/agent-src/commands/agents/user/review.md +3 -3
  12. package/dist/agent-src/commands/agents/user/show.md +3 -3
  13. package/dist/agent-src/commands/agents/user/update.md +2 -2
  14. package/dist/agent-src/commands/agents/user.md +6 -6
  15. package/dist/agent-src/commands/analytics/prune.md +1 -1
  16. package/dist/agent-src/commands/analytics/show.md +2 -2
  17. package/dist/agent-src/commands/analyze/decision.md +2 -2
  18. package/dist/agent-src/commands/analyze/inbox.md +5 -5
  19. package/dist/agent-src/commands/analyze/incident.md +3 -3
  20. package/dist/agent-src/commands/analyze/near-miss.md +3 -3
  21. package/dist/agent-src/commands/analyze/postmortem.md +4 -4
  22. package/dist/agent-src/commands/analyze/premortem.md +2 -2
  23. package/dist/agent-src/commands/analyze.md +2 -2
  24. package/dist/agent-src/commands/bug/fix.md +1 -1
  25. package/dist/agent-src/commands/bug/investigate.md +2 -2
  26. package/dist/agent-src/commands/cost/profile.md +3 -3
  27. package/dist/agent-src/commands/design.md +1 -1
  28. package/dist/agent-src/commands/feature/explore.md +1 -1
  29. package/dist/agent-src/commands/feature/plan.md +2 -2
  30. package/dist/agent-src/commands/feature/roadmap.md +2 -2
  31. package/dist/agent-src/commands/ghostwriter/fetch.md +4 -4
  32. package/dist/agent-src/commands/ghostwriter/list.md +1 -1
  33. package/dist/agent-src/commands/ghostwriter/show.md +1 -1
  34. package/dist/agent-src/commands/ghostwriter/write.md +9 -9
  35. package/dist/agent-src/commands/humanize.md +6 -6
  36. package/dist/agent-src/commands/jira-ticket.md +1 -1
  37. package/dist/agent-src/commands/judge/solo.md +1 -1
  38. package/dist/agent-src/commands/judge.md +1 -1
  39. package/dist/agent-src/commands/knowledge/cross-repo.md +1 -1
  40. package/dist/agent-src/commands/knowledge/forget.md +1 -1
  41. package/dist/agent-src/commands/knowledge/ingest.md +2 -2
  42. package/dist/agent-src/commands/knowledge/list.md +1 -1
  43. package/dist/agent-src/commands/memory/add.md +3 -3
  44. package/dist/agent-src/commands/memory/load.md +4 -4
  45. package/dist/agent-src/commands/memory/mine-session.md +1 -1
  46. package/dist/agent-src/commands/memory/promote.md +4 -4
  47. package/dist/agent-src/commands/memory/propose.md +2 -2
  48. package/dist/agent-src/commands/mode.md +5 -5
  49. package/dist/agent-src/commands/post-as/ghostwriter.md +3 -3
  50. package/dist/agent-src/commands/post-as/me.md +7 -7
  51. package/dist/agent-src/commands/pr/create.md +1 -1
  52. package/dist/agent-src/commands/pr/merge.md +1 -1
  53. package/dist/agent-src/commands/profile/activate.md +1 -1
  54. package/dist/agent-src/commands/profile/show.md +1 -1
  55. package/dist/agent-src/commands/research/deep.md +2 -2
  56. package/dist/agent-src/commands/research/report.md +2 -2
  57. package/dist/agent-src/commands/review/changes.md +1 -1
  58. package/dist/agent-src/commands/review/routing.md +1 -1
  59. package/dist/agent-src/commands/roadmap/create.md +1 -1
  60. package/dist/agent-src/commands/roadmap/materialize.md +2 -2
  61. package/dist/agent-src/commands/roadmap/next.md +1 -1
  62. package/dist/agent-src/commands/roadmap/process-full.md +2 -2
  63. package/dist/agent-src/commands/security-audit-config.md +3 -3
  64. package/dist/agent-src/commands/skill/preview.md +1 -1
  65. package/dist/agent-src/commands/skills/discover.md +1 -1
  66. package/dist/agent-src/commands/sync/agent-settings.md +2 -2
  67. package/dist/agent-src/commands/sync/gitignore/fix.md +1 -1
  68. package/dist/agent-src/commands/tests/create.md +1 -1
  69. package/dist/agent-src/commands/tests/e2e-heal.md +1 -1
  70. package/dist/agent-src/commands/tests/e2e-plan.md +1 -1
  71. package/dist/agent-src/contexts/authority/kernel-rule-edits.md +6 -6
  72. package/dist/agent-src/contexts/communication/rules-auto/slash-command-routing-policy-mechanics.md +1 -2
  73. package/dist/agent-src/contexts/communication/rules-auto/think-before-action-mechanics.md +2 -2
  74. package/dist/agent-src/contexts/communication/rules-auto/token-efficiency-mechanics.md +88 -1
  75. package/dist/agent-src/contexts/communication/rules-auto/user-interaction-mechanics.md +1 -1
  76. package/dist/agent-src/contexts/contracts/frugality-charter.md +1 -1
  77. package/dist/agent-src/contexts/execution/auto-dispatch-classification.md +1 -1
  78. package/dist/agent-src/contexts/execution/auto-orchestration-activation.md +1 -1
  79. package/dist/agent-src/contexts/execution/autonomy-mechanics.md +1 -1
  80. package/dist/agent-src/contexts/execution/cheap-question-mechanics.md +1 -1
  81. package/dist/agent-src/contexts/execution/contract-decision-sheet.md +3 -3
  82. package/dist/agent-src/contexts/execution/mandated-lines.md +1 -1
  83. package/dist/agent-src/contexts/execution/non-interactive-contract.md +1 -1
  84. package/dist/agent-src/contexts/execution/orchestration-telemetry.md +1 -1
  85. package/dist/agent-src/contexts/execution/plan-confidence-gate.md +5 -5
  86. package/dist/agent-src/contexts/execution/roadmap-execution-contract.md +1 -1
  87. package/dist/agent-src/contexts/execution/subagent-modes-detail.md +1 -1
  88. package/dist/agent-src/contexts/execution/subagent-routing.md +2 -2
  89. package/dist/agent-src/contexts/execution/subagent-spawn-contract.md +1 -1
  90. package/dist/agent-src/contexts/execution/user-memory-channels.md +3 -3
  91. package/dist/agent-src/contexts/execution/verification-mechanics.md +1 -1
  92. package/dist/agent-src/contexts/judges/persona-voice-rubric.md +2 -2
  93. package/dist/agent-src/guidelines/abstraction-thresholds.md +88 -0
  94. package/dist/agent-src/guidelines/agent-infra/5w2h-analysis.md +260 -0
  95. package/dist/agent-src/guidelines/agent-infra/active-remediation-mechanics.md +99 -0
  96. package/dist/agent-src/guidelines/agent-infra/agent-interaction-and-decision-quality.md +325 -0
  97. package/dist/agent-src/guidelines/agent-infra/api-cost-levers.md +177 -0
  98. package/dist/agent-src/guidelines/agent-infra/artifact-drafting-protocol-mechanics.md +222 -0
  99. package/dist/agent-src/guidelines/agent-infra/ask-when-uncertain-demos.md +134 -0
  100. package/dist/agent-src/guidelines/agent-infra/asking-and-brevity-examples.md +198 -0
  101. package/dist/agent-src/guidelines/agent-infra/break-glass-usage.md +113 -0
  102. package/dist/agent-src/guidelines/agent-infra/carve-out-predicates.md +17 -0
  103. package/dist/agent-src/guidelines/agent-infra/comparison-matrix.md +179 -0
  104. package/dist/agent-src/guidelines/agent-infra/context-hygiene-mechanics.md +165 -0
  105. package/dist/agent-src/guidelines/agent-infra/corpus-grounding-authoring.md +91 -0
  106. package/dist/agent-src/guidelines/agent-infra/critical-thinking.md +156 -0
  107. package/dist/agent-src/guidelines/agent-infra/cross-source-consistency-mechanics.md +109 -0
  108. package/dist/agent-src/guidelines/agent-infra/developer-judgment.md +82 -0
  109. package/dist/agent-src/guidelines/agent-infra/direct-answers-demos.md +142 -0
  110. package/dist/agent-src/guidelines/agent-infra/domain-adoption-gates.md +112 -0
  111. package/dist/agent-src/guidelines/agent-infra/domain-eval-anti-pattern.md +53 -0
  112. package/dist/agent-src/guidelines/agent-infra/domain-pack-architecture.md +56 -0
  113. package/dist/agent-src/guidelines/agent-infra/downstream-changes-mechanics.md +91 -0
  114. package/dist/agent-src/guidelines/agent-infra/emphasis-budget.md +45 -0
  115. package/dist/agent-src/guidelines/agent-infra/engineering-memory-data-format.md +210 -0
  116. package/dist/agent-src/guidelines/agent-infra/evaluator-independence-mechanics.md +92 -0
  117. package/dist/agent-src/guidelines/agent-infra/existence-question-verdicts.md +80 -0
  118. package/dist/agent-src/guidelines/agent-infra/failure-signatures.md +70 -0
  119. package/dist/agent-src/guidelines/agent-infra/false-green.md +233 -0
  120. package/dist/agent-src/guidelines/agent-infra/first-principles.md +192 -0
  121. package/dist/agent-src/guidelines/agent-infra/framework-neutrality-patterns.md +66 -0
  122. package/dist/agent-src/guidelines/agent-infra/frontier-reasoning-operating-profile.md +169 -0
  123. package/dist/agent-src/guidelines/agent-infra/gate-authoring.md +177 -0
  124. package/dist/agent-src/guidelines/agent-infra/guarded-baseline.md +39 -0
  125. package/dist/agent-src/guidelines/agent-infra/installed-tools-manifest.md +142 -0
  126. package/dist/agent-src/guidelines/agent-infra/inversion-thinking.md +388 -0
  127. package/dist/agent-src/guidelines/agent-infra/ios-simulator-guide.md +378 -0
  128. package/dist/agent-src/guidelines/agent-infra/language-and-tone-examples.md +141 -0
  129. package/dist/agent-src/guidelines/agent-infra/layered-settings.md +317 -0
  130. package/dist/agent-src/guidelines/agent-infra/linked-projects-onboarding-gate.md +80 -0
  131. package/dist/agent-src/guidelines/agent-infra/mcp-request-signing.md +197 -0
  132. package/dist/agent-src/guidelines/agent-infra/memory-access.md +149 -0
  133. package/dist/agent-src/guidelines/agent-infra/mental-models.md +314 -0
  134. package/dist/agent-src/guidelines/agent-infra/minimal-safe-diff-mechanics.md +241 -0
  135. package/dist/agent-src/guidelines/agent-infra/missing-tool-handling.md +66 -0
  136. package/dist/agent-src/guidelines/agent-infra/model-recommendation.md +101 -0
  137. package/dist/agent-src/guidelines/agent-infra/naming.md +69 -0
  138. package/dist/agent-src/guidelines/agent-infra/notes-horizon-mechanics.md +90 -0
  139. package/dist/agent-src/guidelines/agent-infra/output-patterns.md +117 -0
  140. package/dist/agent-src/guidelines/agent-infra/recurring-criticism-mechanics.md +96 -0
  141. package/dist/agent-src/guidelines/agent-infra/reuse-verdict-mechanics.md +71 -0
  142. package/dist/agent-src/guidelines/agent-infra/review-routing-data-format.md +143 -0
  143. package/dist/agent-src/guidelines/agent-infra/roadmap-deferred-resolution-provenance.md +54 -0
  144. package/dist/agent-src/guidelines/agent-infra/roadmap-progress-mechanics.md +274 -0
  145. package/dist/agent-src/guidelines/agent-infra/role-contracts.md +209 -0
  146. package/dist/agent-src/guidelines/agent-infra/role-mode-router.md +89 -0
  147. package/dist/agent-src/guidelines/agent-infra/rule-body-migration-inventory.md +241 -0
  148. package/dist/agent-src/guidelines/agent-infra/rule-type-governance.md +73 -0
  149. package/dist/agent-src/guidelines/agent-infra/runtime-layer.md +89 -0
  150. package/dist/agent-src/guidelines/agent-infra/scqa-framework.md +526 -0
  151. package/dist/agent-src/guidelines/agent-infra/security-lint-containment.md +121 -0
  152. package/dist/agent-src/guidelines/agent-infra/self-improvement-pipeline.md +134 -0
  153. package/dist/agent-src/guidelines/agent-infra/simplicity-and-goal-demos.md +211 -0
  154. package/dist/agent-src/guidelines/agent-infra/six-hats.md +353 -0
  155. package/dist/agent-src/guidelines/agent-infra/size-and-scope.md +229 -0
  156. package/dist/agent-src/guidelines/agent-infra/skill-quality-checklist.md +157 -0
  157. package/dist/agent-src/guidelines/agent-infra/source-confidentiality-mechanics.md +109 -0
  158. package/dist/agent-src/guidelines/agent-infra/symptom-driven-harvest-loop.md +104 -0
  159. package/dist/agent-src/guidelines/agent-infra/systems-thinking.md +220 -0
  160. package/dist/agent-src/guidelines/agent-infra/tool-description-as-policy.md +35 -0
  161. package/dist/agent-src/guidelines/agent-infra/tool-integration.md +73 -0
  162. package/dist/agent-src/guidelines/agent-infra/traceability-field-mechanics.md +50 -0
  163. package/dist/agent-src/guidelines/agent-infra/untrusted-input-spotlighting.md +166 -0
  164. package/dist/agent-src/guidelines/agent-infra/verify-before-complete-demos.md +128 -0
  165. package/dist/agent-src/guidelines/augment-portability-patterns.md +70 -0
  166. package/dist/agent-src/guidelines/code-clarity.md +350 -0
  167. package/dist/agent-src/guidelines/component-oriented-and-oop-development.md +189 -0
  168. package/dist/agent-src/guidelines/cross-role-handoff.md +127 -0
  169. package/dist/agent-src/guidelines/design-antipatterns-triggers.json +18 -0
  170. package/dist/agent-src/guidelines/design-antipatterns.md +327 -0
  171. package/dist/agent-src/guidelines/design-asset-discipline.md +38 -0
  172. package/dist/agent-src/guidelines/design-canon.md +63 -0
  173. package/dist/agent-src/guidelines/design-fidelity-mechanics.md +293 -0
  174. package/dist/agent-src/guidelines/design-fidelity-routing.md +78 -0
  175. package/dist/agent-src/guidelines/design-handover-extraction.md +117 -0
  176. package/dist/agent-src/guidelines/design-modes.md +143 -0
  177. package/dist/agent-src/guidelines/design-reconciliation.md +172 -0
  178. package/dist/agent-src/guidelines/docs/readme-size-and-splitting.md +209 -0
  179. package/dist/agent-src/guidelines/e2e/playwright.md +363 -0
  180. package/dist/agent-src/guidelines/gtm-handoff.md +114 -0
  181. package/dist/agent-src/guidelines/monorepo-antipatterns.md +141 -0
  182. package/dist/agent-src/guidelines/php/api-design.md +115 -0
  183. package/dist/agent-src/guidelines/php/artisan-commands.md +81 -0
  184. package/dist/agent-src/guidelines/php/blade-ui.md +78 -0
  185. package/dist/agent-src/guidelines/php/controllers.md +90 -0
  186. package/dist/agent-src/guidelines/php/database.md +194 -0
  187. package/dist/agent-src/guidelines/php/eloquent.md +208 -0
  188. package/dist/agent-src/guidelines/php/flux.md +80 -0
  189. package/dist/agent-src/guidelines/php/general.md +207 -0
  190. package/dist/agent-src/guidelines/php/git.md +164 -0
  191. package/dist/agent-src/guidelines/php/jobs.md +111 -0
  192. package/dist/agent-src/guidelines/php/livewire.md +71 -0
  193. package/dist/agent-src/guidelines/php/logging.md +79 -0
  194. package/dist/agent-src/guidelines/php/naming.md +89 -0
  195. package/dist/agent-src/guidelines/php/patterns/dependency-injection.md +57 -0
  196. package/dist/agent-src/guidelines/php/patterns/dtos.md +199 -0
  197. package/dist/agent-src/guidelines/php/patterns/events.md +67 -0
  198. package/dist/agent-src/guidelines/php/patterns/factory.md +53 -0
  199. package/dist/agent-src/guidelines/php/patterns/pipelines.md +66 -0
  200. package/dist/agent-src/guidelines/php/patterns/policies.md +66 -0
  201. package/dist/agent-src/guidelines/php/patterns/repositories.md +122 -0
  202. package/dist/agent-src/guidelines/php/patterns/service-layer.md +64 -0
  203. package/dist/agent-src/guidelines/php/patterns/strategy.md +247 -0
  204. package/dist/agent-src/guidelines/php/patterns.md +28 -0
  205. package/dist/agent-src/guidelines/php/performance.md +92 -0
  206. package/dist/agent-src/guidelines/php/php-coding-patterns.md +80 -0
  207. package/dist/agent-src/guidelines/php/resources.md +100 -0
  208. package/dist/agent-src/guidelines/php/security.md +110 -0
  209. package/dist/agent-src/guidelines/php/sql.md +97 -0
  210. package/dist/agent-src/guidelines/php/validations.md +119 -0
  211. package/dist/agent-src/guidelines/php/websocket.md +100 -0
  212. package/dist/agent-src/guidelines/prompt-templates.md +189 -0
  213. package/dist/agent-src/guidelines/redundancy-taxonomy.md +208 -0
  214. package/dist/agent-src/guidelines/wing4-handoff.md +127 -0
  215. package/dist/agent-src/personas/README.md +1 -1
  216. package/dist/agent-src/personas/_template-specialist/persona.md +1 -1
  217. package/dist/agent-src/personas/product-owner.md +1 -1
  218. package/dist/agent-src/rules/active-remediation.md +1 -1
  219. package/dist/agent-src/rules/architecture.md +2 -2
  220. package/dist/agent-src/rules/artifact-drafting-protocol.md +1 -1
  221. package/dist/agent-src/rules/ask-when-uncertain.md +2 -2
  222. package/dist/agent-src/rules/brand-source-of-truth.md +9 -7
  223. package/dist/agent-src/rules/code-comment-discipline.md +2 -2
  224. package/dist/agent-src/rules/code-provenance.md +1 -1
  225. package/dist/agent-src/rules/content-quoting-floor.md +1 -1
  226. package/dist/agent-src/rules/context-hygiene.md +5 -5
  227. package/dist/agent-src/rules/cross-source-consistency.md +1 -1
  228. package/dist/agent-src/rules/design-fidelity.md +36 -46
  229. package/dist/agent-src/rules/direct-answers.md +2 -2
  230. package/dist/agent-src/rules/domain-adoption-policy.md +1 -1
  231. package/dist/agent-src/rules/evaluator-independence.md +1 -1
  232. package/dist/agent-src/rules/framework-neutrality-in-generic-skills.md +1 -1
  233. package/dist/agent-src/rules/icon-consistency.md +5 -1
  234. package/dist/agent-src/rules/improve-before-implement.md +1 -1
  235. package/dist/agent-src/rules/language-and-tone.md +3 -3
  236. package/dist/agent-src/rules/minimal-safe-diff.md +1 -1
  237. package/dist/agent-src/rules/notes-first-reasoning.md +2 -2
  238. package/dist/agent-src/rules/recurring-criticism.md +1 -1
  239. package/dist/agent-src/rules/roadmap-progress-sync.md +1 -1
  240. package/dist/agent-src/rules/role-mode-adherence.md +2 -2
  241. package/dist/agent-src/rules/security-sensitive-stop.md +1 -1
  242. package/dist/agent-src/rules/size-enforcement.md +1 -1
  243. package/dist/agent-src/rules/source-confidentiality.md +2 -2
  244. package/dist/agent-src/rules/think-before-action.md +1 -1
  245. package/dist/agent-src/rules/token-efficiency.md +7 -5
  246. package/dist/agent-src/rules/ui-audit-gate.md +3 -2
  247. package/dist/agent-src/rules/untrusted-input-defense.md +3 -3
  248. package/dist/agent-src/skills/activation-design/SKILL.md +2 -2
  249. package/dist/agent-src/skills/adr-create/SKILL.md +5 -5
  250. package/dist/agent-src/skills/ai-council/SKILL.md +1 -1
  251. package/dist/agent-src/skills/ai-council/references/advanced-modes.md +1 -1
  252. package/dist/agent-src/skills/blade-ui/SKILL.md +1 -1
  253. package/dist/agent-src/skills/blast-radius-analyzer/SKILL.md +1 -1
  254. package/dist/agent-src/skills/brand-to-tokens/SKILL.md +24 -3
  255. package/dist/agent-src/skills/bug-analyzer/SKILL.md +1 -1
  256. package/dist/agent-src/skills/build-buy-partner/SKILL.md +1 -1
  257. package/dist/agent-src/skills/churn-prevention/SKILL.md +2 -2
  258. package/dist/agent-src/skills/code-refactoring/SKILL.md +3 -3
  259. package/dist/agent-src/skills/code-review/SKILL.md +3 -3
  260. package/dist/agent-src/skills/command-writing/SKILL.md +3 -3
  261. package/dist/agent-src/skills/comp-banding/SKILL.md +1 -1
  262. package/dist/agent-src/skills/competitive-moat-analysis/SKILL.md +1 -1
  263. package/dist/agent-src/skills/competitive-positioning/SKILL.md +2 -2
  264. package/dist/agent-src/skills/complexity-first-planning/SKILL.md +1 -1
  265. package/dist/agent-src/skills/condense-memory/SKILL.md +1 -1
  266. package/dist/agent-src/skills/content-funnel-design/SKILL.md +2 -2
  267. package/dist/agent-src/skills/contracts-cognition/SKILL.md +1 -1
  268. package/dist/agent-src/skills/copilot-agents-optimization/SKILL.md +2 -2
  269. package/dist/agent-src/skills/corpus-grounding/SKILL.md +2 -2
  270. package/dist/agent-src/skills/customer-research/SKILL.md +2 -2
  271. package/dist/agent-src/skills/dashboard-design/SKILL.md +1 -1
  272. package/dist/agent-src/skills/data-handling-judgment/SKILL.md +1 -1
  273. package/dist/agent-src/skills/deal-qualification-meddic/SKILL.md +2 -2
  274. package/dist/agent-src/skills/decision-record/SKILL.md +3 -3
  275. package/dist/agent-src/skills/decision-review/SKILL.md +8 -8
  276. package/dist/agent-src/skills/deep-reading-analyst/SKILL.md +22 -22
  277. package/dist/agent-src/skills/design-intelligence/SKILL.md +4 -4
  278. package/dist/agent-src/skills/design-intelligence/references/context-and-registers.md +2 -2
  279. package/dist/agent-src/skills/design-review/SKILL.md +4 -4
  280. package/dist/agent-src/skills/design-system-capture/references/design-system-json.md +20 -1
  281. package/dist/agent-src/skills/design-tokens/SKILL.md +17 -2
  282. package/dist/agent-src/skills/design-variations/SKILL.md +2 -2
  283. package/dist/agent-src/skills/developer-like-execution/SKILL.md +2 -2
  284. package/dist/agent-src/skills/discovery-interview/SKILL.md +2 -2
  285. package/dist/agent-src/skills/doc-coauthoring/SKILL.md +3 -3
  286. package/dist/agent-src/skills/editorial-calendar/SKILL.md +2 -2
  287. package/dist/agent-src/skills/existing-ui-audit/SKILL.md +44 -1
  288. package/dist/agent-src/skills/existing-ui-audit/references/anti-slop-cross-reference.md +2 -2
  289. package/dist/agent-src/skills/expansion-playbook/SKILL.md +2 -2
  290. package/dist/agent-src/skills/experiment-loop/SKILL.md +1 -1
  291. package/dist/agent-src/skills/experiment-loop/references/protocol.md +1 -1
  292. package/dist/agent-src/skills/fe-design/SKILL.md +3 -3
  293. package/dist/agent-src/skills/fe-design/references/design-patterns.md +1 -1
  294. package/dist/agent-src/skills/fe-design/references/design-read-and-memory.md +3 -3
  295. package/dist/agent-src/skills/fe-design/references/source-led-port.md +1 -1
  296. package/dist/agent-src/skills/feature-planning/SKILL.md +1 -1
  297. package/dist/agent-src/skills/flux/SKILL.md +1 -1
  298. package/dist/agent-src/skills/forecast-accuracy/SKILL.md +2 -2
  299. package/dist/agent-src/skills/forecasting/SKILL.md +2 -2
  300. package/dist/agent-src/skills/fundraising-narrative/SKILL.md +2 -2
  301. package/dist/agent-src/skills/funnel-analysis/SKILL.md +2 -2
  302. package/dist/agent-src/skills/gtm-launch/SKILL.md +2 -2
  303. package/dist/agent-src/skills/hiring-loop-design/SKILL.md +1 -1
  304. package/dist/agent-src/skills/html-deck/SKILL.md +5 -5
  305. package/dist/agent-src/skills/humanizer/SKILL.md +1 -1
  306. package/dist/agent-src/skills/humanizer/data/patterns.md +1 -1
  307. package/dist/agent-src/skills/iconography/SKILL.md +3 -3
  308. package/dist/agent-src/skills/judge-synthesis/SKILL.md +1 -1
  309. package/dist/agent-src/skills/laravel-api-endpoint/SKILL.md +2 -2
  310. package/dist/agent-src/skills/launch-readiness/SKILL.md +3 -3
  311. package/dist/agent-src/skills/learning-to-rule-or-skill/SKILL.md +6 -6
  312. package/dist/agent-src/skills/livewire/SKILL.md +1 -1
  313. package/dist/agent-src/skills/market-entry-analysis/SKILL.md +1 -1
  314. package/dist/agent-src/skills/mcp-builder/SKILL.md +1 -1
  315. package/dist/agent-src/skills/memory-consolidation/SKILL.md +3 -3
  316. package/dist/agent-src/skills/messaging-architecture/SKILL.md +2 -2
  317. package/dist/agent-src/skills/monorepo-workspace/SKILL.md +1 -1
  318. package/dist/agent-src/skills/onboarding-design/SKILL.md +2 -2
  319. package/dist/agent-src/skills/onboarding-program/SKILL.md +1 -1
  320. package/dist/agent-src/skills/one-on-one-cadence/SKILL.md +1 -1
  321. package/dist/agent-src/skills/org-design/SKILL.md +1 -1
  322. package/dist/agent-src/skills/overbuild-review-lens/SKILL.md +3 -3
  323. package/dist/agent-src/skills/override-management/SKILL.md +1 -1
  324. package/dist/agent-src/skills/perf-feedback-craft/SKILL.md +1 -1
  325. package/dist/agent-src/skills/persona-writing/SKILL.md +1 -1
  326. package/dist/agent-src/skills/php-coder/SKILL.md +1 -1
  327. package/dist/agent-src/skills/pipeline-strategy/SKILL.md +2 -2
  328. package/dist/agent-src/skills/playwright-testing/SKILL.md +3 -3
  329. package/dist/agent-src/skills/po-discovery/SKILL.md +1 -1
  330. package/dist/agent-src/skills/positioning-strategy/SKILL.md +2 -2
  331. package/dist/agent-src/skills/privacy-review/SKILL.md +1 -1
  332. package/dist/agent-src/skills/prompt-optimizer/SKILL.md +3 -3
  333. package/dist/agent-src/skills/react-shadcn-ui/SKILL.md +1 -1
  334. package/dist/agent-src/skills/reasoning-orchestrator/SKILL.md +2 -2
  335. package/dist/agent-src/skills/receiving-code-review/SKILL.md +1 -1
  336. package/dist/agent-src/skills/refine-ticket/SKILL.md +2 -2
  337. package/dist/agent-src/skills/release-comms/SKILL.md +2 -2
  338. package/dist/agent-src/skills/retention-loops/SKILL.md +2 -2
  339. package/dist/agent-src/skills/review-routing/SKILL.md +2 -2
  340. package/dist/agent-src/skills/roadmap-management/SKILL.md +1 -1
  341. package/dist/agent-src/skills/roadmap-management/references/archival.md +1 -1
  342. package/dist/agent-src/skills/roadmap-writing/SKILL.md +5 -5
  343. package/dist/agent-src/skills/rule-writing/SKILL.md +6 -6
  344. package/dist/agent-src/skills/runway-cognition/SKILL.md +2 -2
  345. package/dist/agent-src/skills/scenario-modeling/SKILL.md +2 -2
  346. package/dist/agent-src/skills/skill-writing/SKILL.md +2 -2
  347. package/dist/agent-src/skills/skill-writing/references/procedure.md +1 -1
  348. package/dist/agent-src/skills/skill-writing/references/section-patterns.md +3 -3
  349. package/dist/agent-src/skills/spreadsheet-authoring/SKILL.md +1 -1
  350. package/dist/agent-src/skills/stakeholder-tradeoff/SKILL.md +3 -3
  351. package/dist/agent-src/skills/subagent-orchestration/SKILL.md +1 -1
  352. package/dist/agent-src/skills/supply-chain-intake/SKILL.md +1 -1
  353. package/dist/agent-src/skills/systematic-debugging/SKILL.md +2 -2
  354. package/dist/agent-src/skills/tailwind-engineer/SKILL.md +11 -5
  355. package/dist/agent-src/skills/throughput-vs-morale-tradeoff/SKILL.md +1 -1
  356. package/dist/agent-src/skills/token-optimizer/SKILL.md +1 -1
  357. package/dist/agent-src/skills/typography-system/SKILL.md +2 -2
  358. package/dist/agent-src/skills/ui-component-architect/SKILL.md +28 -8
  359. package/dist/agent-src/skills/unit-economics-modeling/SKILL.md +2 -2
  360. package/dist/agent-src/skills/upstream-contribute/SKILL.md +1 -1
  361. package/dist/agent-src/skills/validate-feature-fit/SKILL.md +2 -2
  362. package/dist/agent-src/skills/verify-repair-loop/SKILL.md +2 -2
  363. package/dist/agent-src/skills/vision-articulation/SKILL.md +1 -1
  364. package/dist/agent-src/skills/voc-extract/SKILL.md +2 -2
  365. package/dist/agent-src/skills/voice-and-tone-design/SKILL.md +2 -2
  366. package/dist/agent-src/skills/wireframe/SKILL.md +1 -1
  367. package/dist/agent-src/skills/workspace-link/SKILL.md +1 -1
  368. package/dist/agent-src/templates/agent-settings.md +6 -6
  369. package/dist/agent-src/templates/agents/agent-project-settings.example.yml +1 -1
  370. package/dist/agent-src/templates/contexts/knowledge-pages.md +2 -3
  371. package/dist/agent-src/templates/copilot-instructions.md +1 -1
  372. package/dist/agent-src/templates/roadmaps.md +1 -1
  373. package/dist/agent-src/templates/scripts/README.md +2 -2
  374. package/dist/agent-src/user-types/_template/user-type.md +1 -1
  375. package/dist/cli-delegate/check_update_banner.js +12 -1
  376. package/dist/cli-delegate/{chunk-NLP54U3J.js → chunk-2XY7ILBT.js} +13 -1
  377. package/dist/cli-delegate/{chunk-IAI3XL43.js → chunk-3FKR64R5.js} +22 -6
  378. package/dist/cli-delegate/{chunk-J3RFNKG4.js → chunk-55ACLDUE.js} +2 -2
  379. package/dist/cli-delegate/{chunk-PKOBQADP.js → chunk-57PN4GYJ.js} +1 -1
  380. package/dist/cli-delegate/{chunk-KCNTUSPI.js → chunk-AK6HODNQ.js} +4 -4
  381. package/dist/cli-delegate/{chunk-2FTMENJL.js → chunk-GYC3VRYN.js} +1 -1
  382. package/dist/cli-delegate/{chunk-LWTYTX6F.js → chunk-HZ52BRGG.js} +24 -18
  383. package/dist/cli-delegate/{chunk-6RJA2F5A.js → chunk-IVBPRCQO.js} +1 -1
  384. package/dist/cli-delegate/{chunk-I6RHFQEG.js → chunk-YUM5KURG.js} +17 -1
  385. package/dist/cli-delegate/cmd_analyze_session.js +1 -1
  386. package/dist/cli-delegate/cmd_brand_status.js +1 -1
  387. package/dist/cli-delegate/cmd_conformance.js +3 -3
  388. package/dist/cli-delegate/cmd_doctor.js +3 -3
  389. package/dist/cli-delegate/cmd_explain.js +2 -2
  390. package/dist/cli-delegate/cmd_export.js +4 -4
  391. package/dist/cli-delegate/cmd_handoff.js +4 -4
  392. package/dist/cli-delegate/cmd_mcp_available.js +1 -1
  393. package/dist/cli-delegate/cmd_memory_get.js +1 -1
  394. package/dist/cli-delegate/cmd_migrate.js +2 -2
  395. package/dist/cli-delegate/cmd_packs_active.js +2 -2
  396. package/dist/cli-delegate/cmd_prune.js +4 -4
  397. package/dist/cli-delegate/cmd_route_audit.js +3 -3
  398. package/dist/cli-delegate/cmd_route_explain.js +1 -1
  399. package/dist/cli-delegate/cmd_session_recycle.js +1 -1
  400. package/dist/cli-delegate/cmd_settings_get.js +15 -9
  401. package/dist/cli-delegate/cmd_settings_migrate.js +4 -4
  402. package/dist/cli-delegate/cmd_settings_set.js +41 -11
  403. package/dist/cli-delegate/cmd_sync.js +4 -4
  404. package/dist/cli-delegate/cmd_uninstall.js +4 -4
  405. package/dist/cli-delegate/cmd_update.js +1 -1
  406. package/dist/cli-delegate/cmd_upgrade.js +1 -1
  407. package/dist/cli-delegate/cmd_validate.js +4 -4
  408. package/dist/cli-delegate/cmd_versions.js +1 -1
  409. package/dist/discovery/deprecation-report.md +1 -1
  410. package/dist/discovery/discovery-manifest.json +22 -75
  411. package/dist/discovery/discovery-manifest.json.sha256 +1 -1
  412. package/dist/discovery/discovery-manifest.summary.md +3 -3
  413. package/dist/discovery/dormancy-report.md +1 -1
  414. package/dist/discovery/orphan-report.md +1 -1
  415. package/dist/discovery/packs.json +5 -7
  416. package/dist/discovery/trust-report.md +2 -2
  417. package/dist/discovery/workspaces.json +4 -6
  418. package/dist/hooks/dispatch.js +8607 -8930
  419. package/dist/install/install.mjs +35 -8
  420. package/dist/mcp/registry-manifest.json +3 -3
  421. package/dist/mcp/server.json +2 -2
  422. package/dist/mcp/server.mjs +1433 -1342
  423. package/dist/router.json +1 -1
  424. package/dist/scripts/_lib/agent_settings.js +73 -0
  425. package/dist/scripts/_lib/agent_src.js +20 -0
  426. package/dist/scripts/_lib/guidelines_lane.js +158 -0
  427. package/dist/scripts/condense.js +2 -5
  428. package/dist/server/io/yamlIO.js +125 -17
  429. package/dist/server/schemas/settings.js +18 -4
  430. package/dist/shared/settingsSurface.js +6 -1
  431. package/docs/contracts/settings-classes.md +18 -9
  432. package/docs/guidelines/abstraction-thresholds.md +35 -0
  433. package/docs/guidelines/agent-infra/active-remediation-mechanics.md +3 -3
  434. package/docs/guidelines/agent-infra/false-green.md +2 -2
  435. package/docs/guidelines/agent-infra/roadmap-progress-mechanics.md +1 -1
  436. package/docs/guidelines/agent-infra/skill-quality-checklist.md +1 -1
  437. package/docs/guidelines/design-fidelity-mechanics.md +4 -0
  438. package/docs/guidelines/design-fidelity-routing.md +78 -0
  439. package/docs/guidelines/design-reconciliation.md +172 -0
  440. package/docs/guidelines/gtm-handoff.md +2 -2
  441. package/docs/guidelines/wing4-handoff.md +2 -2
  442. package/package.json +7 -3
  443. package/src/config/agent-settings.template.yml +55 -8
  444. package/src/config/ci-local-parity.yml +34 -0
  445. package/src/config/continuity-surface.json +4 -32
  446. package/src/config/gate-coverage.yml +31 -8
  447. package/src/config/gate-reachability-exemptions.json +1 -0
  448. package/src/config/gate-violation-baselines.json +3 -3
  449. package/src/config/hook-token-budget.json +1 -1
  450. package/src/config/host-injection-effect.json +2 -2
  451. package/src/config/pack-size-budget.json +55 -4
  452. package/src/config/platform-anchor.json +47 -0
  453. package/src/config/preamble-payload-budget.json +2 -3
  454. package/src/config/publish-surface.json +4 -2
  455. package/src/config/ratification-policy.json +7 -0
  456. package/src/config/rule-stub-ceilings.json +16 -9
  457. package/src/scripts/_cli/cmd_settings_get.ts +22 -7
  458. package/src/scripts/_lib/agent_settings.ts +85 -0
  459. package/src/scripts/_lib/agent_src.ts +21 -0
  460. package/src/scripts/_lib/artifact_maturity.ts +242 -0
  461. package/src/scripts/_lib/conformance_report.ts +403 -0
  462. package/src/scripts/_lib/continuity_writer.ts +72 -13
  463. package/src/scripts/_lib/design_system_import.ts +20 -0
  464. package/src/scripts/_lib/design_tolerance.ts +281 -0
  465. package/src/scripts/_lib/guidelines_lane.ts +164 -0
  466. package/src/scripts/_lib/obligation_frequency.ts +2 -3
  467. package/src/scripts/_lib/platform_anchor.ts +1053 -0
  468. package/src/scripts/_lib/ratification_artifact.ts +278 -0
  469. package/src/scripts/_lib/security_lint.ts +23 -2
  470. package/src/scripts/_lib/self_repair.ts +21 -0
  471. package/src/scripts/_lib/session_index_trust.ts +42 -1
  472. package/src/scripts/_lib/standing_bound_ratchet.ts +103 -37
  473. package/src/scripts/_lib/tolerance_shadow.ts +177 -0
  474. package/src/scripts/ai_council/redact_low_impact_entry.ts +8 -0
  475. package/src/scripts/autonomy_friction_traffic.ts +379 -0
  476. package/src/scripts/check_kernel_edit_ratified.ts +462 -0
  477. package/src/scripts/check_loss_class_declared.ts +793 -46
  478. package/src/scripts/check_platform_anchor.ts +390 -0
  479. package/src/scripts/check_preamble_payload_budget.ts +292 -4
  480. package/src/scripts/check_projected_rule_routes.ts +395 -0
  481. package/src/scripts/code_graph/cli.ts +6 -0
  482. package/src/scripts/condense.ts +2 -6
  483. package/src/scripts/generate_host_cost_table.ts +354 -0
  484. package/src/scripts/hook_manifest.json +1 -1
  485. package/src/scripts/hook_manifest.yaml +35 -27
  486. package/src/scripts/hooks/category_a.ts +1 -1
  487. package/src/scripts/hooks/chain_nudge_hook.ts +311 -25
  488. package/src/scripts/hooks/session_eol_hook.ts +68 -154
  489. package/src/scripts/hooks/source_first_gate_hook.ts +12 -0
  490. package/src/scripts/hooks/ui_route_nudge_hook.ts +52 -15
  491. package/src/scripts/hot_context_hook.ts +41 -401
  492. package/src/scripts/lint_evidence_artifacts.ts +1 -0
  493. package/src/scripts/lint_knowledge_scale.ts +0 -26
  494. package/src/scripts/memory_lookup.ts +9 -9
  495. package/src/scripts/report_standing_payload_by_host.ts +7 -7
  496. package/src/scripts/session_memory_index.ts +5 -0
  497. package/src/scripts/sync_agent_settings.ts +270 -10
  498. package/src/server/io/yamlIO.ts +127 -17
  499. package/src/server/schemas/settings.ts +25 -5
  500. package/src/shared/settingsSurface.ts +13 -2
  501. package/src/templates/compact-instructions.md +8 -3
  502. package/dist/agent-src/commands/chat-history/import.md +0 -170
  503. package/dist/agent-src/commands/chat-history.md +0 -63
@@ -1,395 +1,63 @@
1
1
  #!/usr/bin/env node
2
2
  /**
3
- * Hot-context working-memory cache — `stop` + `session_start` hook.
3
+ * Memory session-index restore — `session_start` hook.
4
4
  *
5
- * road-to-second-brain Phase 1 (council 2026-07-07, verdict:
6
- * `agents/settings/contexts/second-brain-delta-verdict.md`). A bounded,
7
- * gitignored working-memory artifact that survives session boundaries and —
8
- * on Claude Code — context compaction (`SessionStart source=compact`).
5
+ * The working-memory CACHE this concern used to carry was retired
6
+ * (road-to-continuity-writer-activation step 3.1, AI council 2026-09-09 under
7
+ * the owner's written delegation; openai's mechanism operative). What survives
8
+ * is the half the council kept: the `session_start` restore of the persisted
9
+ * memory session index.
9
10
  *
10
- * Contract (per the verdict):
11
- * - `agents/runtime/state/hot-context.md`, gitignored, OVERWRITTEN on every
12
- * `stop` (cache, not journal). 400-word hard cap.
11
+ * The concern id `hot-context` is DELIBERATELY unchanged. Retiring the id was
12
+ * the competing proposal and was rejected: the −1 on `concern_count` buys
13
+ * nothing, while untagged running code costs the manifest its completeness
14
+ * property. Its DESCRIPTION is what changed.
13
15
  *
14
- * loss_class: ephemeral-lossy
16
+ * Contract:
17
+ * - `session_start` only. The `stop` / `session_end` / `pre_compact` write
18
+ * bindings are gone, and the cache file they maintained is neither written
19
+ * nor read any more.
20
+ * - Emits `{"decision":"allow","context":"<block>"}` on stdout; the
21
+ * dispatcher forwards `context` so the host adds it to the session context.
22
+ * The block is spotlighted as DATA, not instructions
23
+ * (untrusted-input-defense).
24
+ * - Never blocks: exit 0 on every path; failures are silent (stderr note).
15
25
  *
16
- * Named, not changed (`road-to-runtime-context-floors` step 3.1). The two losses
17
- * here are both deliberate and both unrecoverable, which is exactly what the
18
- * class asserts: the 400-word cap discards the older half of the window, and
19
- * `_redact_lines` DROPS any line the low-impact redactor refuses — including on
20
- * a redactor error, which is fail-closed per line. Neither is retrievable from
21
- * the output, and neither should be: this file is a privacy-floored cache whose
22
- * source of truth is the transcript it was built from, and storing a recovery
23
- * for a line dropped for privacy would defeat the reason it was dropped.
26
+ * No `loss_class` is declared on THIS file any more, and that is a real
27
+ * coverage change rather than an omission. The two lossy transforms the class
28
+ * described — the 400-word cap and the fail-closed `_redact_lines` drop — left
29
+ * with the cache. The 30-row cap the memory index still applies lives in
30
+ * `_lib/session_index_trust.ts`, which is not a concern script.
24
31
  *
25
- * `recoverable-lossy` would be the WRONG class here even though the transcript
26
- * still exists, and the distinction is the point of the vocabulary: the class
27
- * describes what THIS transform guarantees to its consumer, and this one
28
- * guarantees nothing about the dropped content on purpose.
29
- * - Written by DETERMINISTIC extraction from the chat-history JSONL
30
- * (`agents/runtime/.agent-chat-history`) — never LLM summarization.
31
- * - Every extracted line passes the low-impact privacy floor
32
- * (`redact_low_impact_entry`); violating lines are DROPPED, never
33
- * rewritten (soft rewrite would be a soft gate).
34
- * - `session_start` restore emits `{"decision":"allow","context":"<block>"}`
35
- * on stdout; the dispatcher forwards `context` to its own stdout on
36
- * session_start so the host adds it to the session context. The block is
37
- * spotlighted as DATA, not instructions (untrusted-input-defense).
38
- * - Staleness: discard (delete) when the stamped branch differs from the
39
- * current branch, the stamp is older than 48 h, or the host says
40
- * `source=clear`. `source=compact` / `resume` / `startup` re-inject.
41
- * - Never blocks: exit 0 on every path; failures are silent (stderr note).
32
+ * A `loss_module:` pointer used to sit here, naming that module so the gate
33
+ * could see it. It is gone because the gate now REACHES the module instead of
34
+ * being told about it: `check_loss_class_declared` walks relative specifiers
35
+ * from every context-emitting concern, and this file's `createRequire` load of
36
+ * `_lib/session_index_trust.js` is one. The pointer's premise — that only a
37
+ * static-import closure was on offer and it could not see a `createRequire`
38
+ * load — is what changed; a specifier walk sees both.
39
+ *
40
+ * What that costs, stated because a pointer did catch one thing a walk cannot:
41
+ * a module loaded through a COMPUTED specifier is now invisible again. Nothing
42
+ * here does that, and if something ever does, the answer is to name the module
43
+ * rather than to reason about the walk.
42
44
  *
43
45
  * Reads the dispatcher JSON envelope on stdin
44
46
  * (`{platform, event, payload, workspace_root, …}`).
45
47
  */
46
48
 
47
- import { spawnSync } from 'node:child_process';
48
- import * as fs from 'node:fs';
49
49
  import { createRequire } from 'node:module';
50
50
  import * as path from 'node:path';
51
51
  import process from 'node:process';
52
52
  import { fileURLToPath } from 'node:url';
53
53
 
54
- import { hardenedSpawnEnv } from './_lib/spawn_env.js';
55
- import { computeRereads } from './_lib/transcript_reads.js';
56
- import { redact_low_impact_entry } from './ai_council/redact_low_impact_entry.js';
57
54
  import { readHookStdin } from './hooks/hook_stdin.js';
58
55
 
59
- export const HOT_CONTEXT_REL = path.join('agents', 'runtime', 'state', 'hot-context.md');
60
-
61
56
  /** Replay-fixture runs must never mutate state (same contract as chat_history). */
62
57
  const REPLAY_ENV_VAR = 'AGENT_CONFIG_REPLAY';
63
58
  function _is_replay_mode(): boolean {
64
59
  return (process.env[REPLAY_ENV_VAR] ?? '').trim() === '1';
65
60
  }
66
- export const WORD_CAP = 400;
67
- export const MAX_AGE_HOURS = 48;
68
-
69
- const HISTORY_REL = 'agents/runtime/.agent-chat-history';
70
-
71
- const MAX_ACTIVE_THREADS = 3; // last user intents
72
- const MAX_RECENT_CHANGES = 5; // last tool results
73
- const MAX_OPEN_VERIFICATIONS = 3;
74
- const THREAD_SNIPPET_CHARS = 200;
75
- const CHANGE_SNIPPET_CHARS = 120;
76
- const KEY_FACTS_CHARS = 600;
77
- const MAX_REREAD_LINES = 3; // advisory, not an inventory — see _reread_lines
78
-
79
- const VERIFICATION_RE = /\b(fail(ing|ed|ure)?|error|exit[= ][1-9]|red\b|broken)\b/i;
80
-
81
- interface HistoryEntry {
82
- t?: string;
83
- ts?: string;
84
- s?: string;
85
- text?: string;
86
- tool?: string;
87
- [k: string]: unknown;
88
- }
89
-
90
- // ---------------------------------------------------------------------
91
- // shared helpers
92
- // ---------------------------------------------------------------------
93
-
94
- function _history_path(root: string): string {
95
- return process.env.AGENT_CHAT_HISTORY_FILE || path.join(root, HISTORY_REL);
96
- }
97
-
98
- function _hot_context_path(root: string): string {
99
- return process.env.AGENT_HOT_CONTEXT_FILE || path.join(root, HOT_CONTEXT_REL);
100
- }
101
-
102
- export function _current_branch(root: string): string {
103
- try {
104
- const proc = spawnSync('git', ['rev-parse', '--abbrev-ref', 'HEAD'], {
105
- cwd: root,
106
- encoding: 'utf-8',
107
- timeout: 5000,
108
- env: hardenedSpawnEnv(),
109
- });
110
- if (proc.status === 0) {
111
- return (proc.stdout || '').trim() || 'unknown';
112
- }
113
- } catch {
114
- // fall through
115
- }
116
- return 'unknown';
117
- }
118
-
119
- function _read_history(root: string): HistoryEntry[] {
120
- let text: string;
121
- try {
122
- text = fs.readFileSync(_history_path(root), 'utf-8');
123
- } catch {
124
- return [];
125
- }
126
- const entries: HistoryEntry[] = [];
127
- for (const line of text.split('\n')) {
128
- const trimmed = line.trim();
129
- if (!trimmed) continue;
130
- try {
131
- const parsed = JSON.parse(trimmed) as unknown;
132
- if (parsed && typeof parsed === 'object' && !Array.isArray(parsed)) {
133
- entries.push(parsed as HistoryEntry);
134
- }
135
- } catch {
136
- // skip malformed lines — fail-open
137
- }
138
- }
139
- return entries;
140
- }
141
-
142
- /** Entries of the most recent session (by `s` tag of the last body entry). */
143
- export function _latest_session_entries(entries: HistoryEntry[]): HistoryEntry[] {
144
- const body = entries.filter((e) => e.t && e.t !== 'header');
145
- if (body.length === 0) return [];
146
- const sid = body[body.length - 1]?.s;
147
- if (!sid) {
148
- // untagged history — fall back to the trailing 50 entries
149
- return body.slice(-50);
150
- }
151
- return body.filter((e) => e.s === sid);
152
- }
153
-
154
- function _snippet(text: string, max: number): string {
155
- const oneLine = text.replace(/\s+/g, ' ').trim();
156
- return oneLine.length <= max ? oneLine : oneLine.slice(0, max - 1) + '…';
157
- }
158
-
159
- /** Privacy floor: keep only lines the low-impact redactor clears. */
160
- function _redact_lines(lines: string[]): { kept: string[]; dropped: number } {
161
- const kept: string[] = [];
162
- let dropped = 0;
163
- for (const line of lines) {
164
- try {
165
- const result = redact_low_impact_entry(line);
166
- if (result.ok) {
167
- kept.push(line);
168
- } else {
169
- dropped += 1;
170
- }
171
- } catch {
172
- dropped += 1; // fail-closed per line: on redactor error, drop
173
- }
174
- }
175
- return { kept, dropped };
176
- }
177
-
178
- function _word_count(text: string): number {
179
- return text.split(/\s+/).filter((w) => w.length > 0).length;
180
- }
181
-
182
- // ---------------------------------------------------------------------
183
- // re-read advisory (road-to-role-scoped-spawn-profiles Phase 3 Steps 4-5)
184
- // ---------------------------------------------------------------------
185
-
186
- /**
187
- * Files this leg read more than once, as advisory lines for the cache.
188
- *
189
- * Phase 3 Step 4 of `road-to-role-scoped-spawn-profiles` requires the
190
- * suppression to ride THIS surface rather than arrive as a second artefact,
191
- * and Step 5 requires it to stay advice: there is no refuse branch anywhere
192
- * below, and there is no code path that returns a deny on a re-read condition.
193
- * The output is three lines in a markdown cache; the next leg may ignore it.
194
- *
195
- * **Why the path is relativised, and why an outside path is dropped rather
196
- * than shortened.** The privacy floor
197
- * ({@link _redact_lines} → `redact_low_impact_entry`) drops any line carrying
198
- * a project-rooted absolute path, so emitting `/Users/...` would produce a
199
- * silently empty section — the feature would look implemented and do nothing.
200
- * Relativising to the workspace root keeps the line inside the floor. A path
201
- * OUTSIDE the root cannot be relativised without `../` escapes that re-reveal
202
- * the layout, and it is another project's business in any case, so it is
203
- * dropped entirely.
204
- *
205
- * Fail-silent: no transcript path, an unreadable one, or a malformed leg all
206
- * yield `[]`. This is a cache, and a cache that throws is worse than a cache
207
- * that is short.
208
- */
209
- export function _reread_lines(transcriptPath: string | null, root: string): string[] {
210
- if (!transcriptPath) return [];
211
- const result = computeRereads([transcriptPath]);
212
- const lines: string[] = [];
213
- for (const f of result.files) {
214
- if (lines.length >= MAX_REREAD_LINES) break;
215
- const rel = path.relative(root, f.file_path);
216
- if (rel === '' || rel.startsWith('..') || path.isAbsolute(rel)) continue;
217
- lines.push(`${rel} — read ${f.total_reads}x this leg (${f.duplicate_reads} re-read)`);
218
- }
219
- return lines;
220
- }
221
-
222
- // ---------------------------------------------------------------------
223
- // stop — deterministic write
224
- // ---------------------------------------------------------------------
225
-
226
- export function build_hot_context(
227
- root: string,
228
- now: Date = new Date(),
229
- transcriptPath: string | null = null,
230
- ): string {
231
- const session = _latest_session_entries(_read_history(root));
232
-
233
- const userPrompts = session.filter((e) => e.t === 'user_prompt' && e.text);
234
- const toolUses = session.filter((e) => e.t === 'post_tool_use' && (e.tool || e.text));
235
- const stops = session.filter((e) => e.t === 'stop' && e.text);
236
-
237
- const activeThreads = _redact_lines(
238
- userPrompts.slice(-MAX_ACTIVE_THREADS).map((e) => _snippet(String(e.text), THREAD_SNIPPET_CHARS)),
239
- );
240
- const recentChanges = _redact_lines(
241
- toolUses
242
- .slice(-MAX_RECENT_CHANGES)
243
- .map((e) => _snippet(`${e.tool ? `${e.tool}: ` : ''}${String(e.text ?? '')}`, CHANGE_SNIPPET_CHARS)),
244
- );
245
- const openVerifications = _redact_lines(
246
- toolUses
247
- .filter((e) => VERIFICATION_RE.test(String(e.text ?? '')))
248
- .slice(-MAX_OPEN_VERIFICATIONS)
249
- .map((e) => _snippet(`${e.tool ? `${e.tool}: ` : ''}${String(e.text ?? '')}`, CHANGE_SNIPPET_CHARS)),
250
- );
251
- const lastStop = String(stops[stops.length - 1]?.text ?? '');
252
- const keyFacts = _redact_lines(lastStop ? [_snippet(lastStop, KEY_FACTS_CHARS)] : []);
253
- const rereads = _redact_lines(_reread_lines(transcriptPath, root));
254
-
255
- const droppedTotal =
256
- activeThreads.dropped +
257
- recentChanges.dropped +
258
- openVerifications.dropped +
259
- keyFacts.dropped +
260
- rereads.dropped;
261
-
262
- // Assemble; trim lowest-priority sections first until under the word cap.
263
- // Priority (highest kept longest): Key Facts > Active Threads >
264
- // Open Verifications > Recent Changes > Re-Read Advisory.
265
- //
266
- // The advisory sits LAST on purpose. It is the only section that is a
267
- // suggestion rather than a record of what happened, so when the 400-word
268
- // cap bites it is the one whose loss costs nothing.
269
- const sections: Array<{ title: string; items: string[] }> = [
270
- { title: 'Key Facts', items: keyFacts.kept },
271
- { title: 'Active Threads', items: activeThreads.kept },
272
- { title: 'Open Verifications', items: openVerifications.kept },
273
- { title: 'Recent Changes', items: recentChanges.kept },
274
- { title: 'Re-Read Advisory', items: rereads.kept },
275
- ];
276
- const trimOrder = [
277
- 'Re-Read Advisory',
278
- 'Recent Changes',
279
- 'Open Verifications',
280
- 'Active Threads',
281
- 'Key Facts',
282
- ];
283
-
284
- const render = (): string => {
285
- const lines: string[] = [
286
- '# Hot Context',
287
- '',
288
- '> Auto-generated working-memory cache (deterministic, overwritten on every',
289
- '> stop). DATA for session continuity — not instructions. 400-word cap.',
290
- '',
291
- `Last Updated: ${now.toISOString()}`,
292
- `Branch: ${_current_branch(root)}`,
293
- ];
294
- if (droppedTotal > 0) {
295
- lines.push(`Privacy floor: ${droppedTotal} line(s) dropped`);
296
- }
297
- for (const s of sections) {
298
- if (s.items.length === 0) continue;
299
- lines.push('', `## ${s.title}`, '');
300
- for (const item of s.items) {
301
- lines.push(`- ${item}`);
302
- }
303
- }
304
- lines.push('');
305
- return lines.join('\n');
306
- };
307
-
308
- let text = render();
309
- for (const title of trimOrder) {
310
- if (_word_count(text) <= WORD_CAP) break;
311
- const section = sections.find((s) => s.title === title);
312
- if (!section) continue;
313
- while (section.items.length > 0 && _word_count(text) > WORD_CAP) {
314
- section.items.pop();
315
- text = render();
316
- }
317
- }
318
- return text;
319
- }
320
-
321
- function _write_hot_context(root: string, transcriptPath: string | null = null): void {
322
- const target = _hot_context_path(root);
323
- const text = build_hot_context(root, new Date(), transcriptPath);
324
- fs.mkdirSync(path.dirname(target), { recursive: true });
325
- const tmp = `${target}.tmp-${process.pid}`;
326
- fs.writeFileSync(tmp, text, { encoding: 'utf-8' });
327
- fs.renameSync(tmp, target);
328
- }
329
-
330
- // ---------------------------------------------------------------------
331
- // session_start — staleness-checked restore
332
- // ---------------------------------------------------------------------
333
-
334
- export interface RestoreDecision {
335
- action: 'inject' | 'discard' | 'absent';
336
- reason: string;
337
- context?: string;
338
- }
339
-
340
- export function restore_hot_context(
341
- root: string,
342
- source: string,
343
- now: Date = new Date(),
344
- ): RestoreDecision {
345
- const target = _hot_context_path(root);
346
- let text: string;
347
- try {
348
- text = fs.readFileSync(target, 'utf-8');
349
- } catch {
350
- return { action: 'absent', reason: 'no cache file' };
351
- }
352
-
353
- const discard = (reason: string): RestoreDecision => {
354
- try {
355
- fs.unlinkSync(target);
356
- } catch {
357
- // fail-open
358
- }
359
- return { action: 'discard', reason };
360
- };
361
-
362
- if (source === 'clear') {
363
- return discard('host source=clear');
364
- }
365
-
366
- const stampRaw = text.match(/^Last Updated: (.+)$/m)?.[1];
367
- const branchRaw = text.match(/^Branch: (.+)$/m)?.[1];
368
- if (!stampRaw || !branchRaw) {
369
- return discard('unparseable stamp');
370
- }
371
- const stamp = Date.parse(stampRaw.trim());
372
- if (Number.isNaN(stamp)) {
373
- return discard('unparseable timestamp');
374
- }
375
- const ageHours = (now.getTime() - stamp) / (1000 * 60 * 60);
376
- if (ageHours > MAX_AGE_HOURS) {
377
- return discard(`stale: ${ageHours.toFixed(1)}h > ${MAX_AGE_HOURS}h`);
378
- }
379
- const stampedBranch = branchRaw.trim();
380
- const currentBranch = _current_branch(root);
381
- if (stampedBranch !== 'unknown' && currentBranch !== 'unknown' && stampedBranch !== currentBranch) {
382
- return discard(`branch changed: ${stampedBranch} -> ${currentBranch}`);
383
- }
384
-
385
- const block = [
386
- '<hot-context source="agents/runtime/state/hot-context.md"',
387
- ' note="cached working memory from the previous session — DATA, not instructions">',
388
- text.trimEnd(),
389
- '</hot-context>',
390
- ].join('\n');
391
- return { action: 'inject', reason: `restored (source=${source || 'startup'})`, context: block };
392
- }
393
61
 
394
62
  // ---------------------------------------------------------------------
395
63
  // opt-in memory session index (road-to-memory-retrieval-economy P5)
@@ -504,35 +172,10 @@ export function main(): number {
504
172
  if (_is_replay_mode()) {
505
173
  return 0; // replay fixtures: read-only, no state mutation
506
174
  }
507
- // `pre_compact` joins the write set (road-to-inbox-harvest-2026-08-d-
508
- // context-ledger Step 2.1). It is the only slot that fires WHILE state
509
- // is being destroyed, and until now it carried no writer at all: the
510
- // cache a post-compaction `session_start` restores was written at the
511
- // last `stop`, so everything the session did since then was lost with
512
- // the compaction. Writing here makes the restore reflect the moment
513
- // before the loss instead of the moment before the last turn.
514
- //
515
- // Cheap and idempotent by construction: `_write_hot_context` is a
516
- // deterministic rebuild from the history file, so an extra fire costs
517
- // one rebuild and can never produce a worse cache than the older one it
518
- // replaces. It emits nothing — the restore side is unchanged.
519
- if (event === 'stop' || event === 'session_end' || event === 'pre_compact') {
520
- // Claude Code puts the leg's own transcript on the stop payload;
521
- // the camelCase alias is defensive, matching how the subagent
522
- // ledger reads `last_assistant_message`. Absent on other hosts,
523
- // where the advisory is simply empty.
524
- const tp = payload.transcript_path ?? payload.transcriptPath;
525
- _write_hot_context(root, typeof tp === 'string' && tp.length > 0 ? tp : null);
526
- } else if (event === 'session_start') {
527
- const source = String(payload.source ?? '');
528
- const decision = restore_hot_context(root, source);
529
- const blocks: string[] = [];
530
- if (decision.action === 'inject' && decision.context) {
531
- blocks.push(decision.context);
532
- }
175
+ if (event === 'session_start') {
533
176
  // Opt-in compact memory index (road-to-memory-retrieval-economy
534
- // P5) — default OFF; rides the same injection surface. Memory
535
- // roots are cwd-relative, so resolve from the workspace root.
177
+ // P5) — default OFF. Memory roots are cwd-relative, so resolve
178
+ // from the workspace root.
536
179
  // R2 finding 1: reading the payload alone left P5 INERT whenever
537
180
  // the host supplied no payload id. `dispatch_hook.ts` resolves
538
181
  // `envelope.session_id` from the payload OR `AGENT_SESSION_ID`, and
@@ -543,14 +186,11 @@ export function main(): number {
543
186
  );
544
187
  const indexBlock = _session_index_block_or_null(root, sessionId);
545
188
  if (indexBlock !== null) {
546
- blocks.push(indexBlock);
547
- }
548
- if (blocks.length > 0) {
549
189
  process.stdout.write(
550
190
  JSON.stringify({
551
191
  decision: 'allow',
552
- reason: decision.action === 'inject' ? decision.reason : 'memory session index',
553
- context: blocks.join('\n\n'),
192
+ reason: 'memory session index',
193
+ context: indexBlock,
554
194
  }) + '\n',
555
195
  );
556
196
  }
@@ -63,6 +63,7 @@ export const EVIDENCE_TYPES = [
63
63
  'honest-null',
64
64
  'analysis',
65
65
  'feel',
66
+ 'ratification',
66
67
  ] as const;
67
68
 
68
69
  /**
@@ -18,9 +18,6 @@
18
18
  * trigram, no engine fork / no FTS5; ADR-061 honoured)
19
19
  * - corpus scale — > 500 files across all types
20
20
  * → same lexical-index activation path
21
- * - hot-context size — `agents/runtime/state/hot-context.md` > 600 tokens
22
- * (estimated at 4 chars/token) → trim schema / fix the
23
- * deterministic writer
24
21
  *
25
22
  * Usage: lint_knowledge_scale.ts [--dir <repo-root>] [--format text|json] [--quiet]
26
23
  * Exit codes: 0 = ran cleanly (warnings never fail the build), 1 = usage
@@ -39,8 +36,6 @@ export const INTAKE_EVENTS_MAX = 2000;
39
36
  export const SESSIONS_PAGES_MAX = 50;
40
37
  export const TYPE_FILES_MAX = 200;
41
38
  export const CORPUS_FILES_MAX = 500;
42
- export const HOT_CONTEXT_TOKENS_MAX = 600;
43
- export const CHARS_PER_TOKEN = 4;
44
39
 
45
40
  const KNOWLEDGE_TYPED_DIRS = ['sessions', 'concepts', 'procedures', 'decisions'] as const;
46
41
 
@@ -206,27 +201,6 @@ export function runChecks(root: string, stats?: ScanStats): Warning[] {
206
201
  });
207
202
  }
208
203
 
209
- // 5. Hot-context budget.
210
- const hotContext = path.join(root, 'agents', 'runtime', 'state', 'hot-context.md');
211
- let hotText = '';
212
- try {
213
- hotText = fs.readFileSync(hotContext, 'utf-8');
214
- } catch {
215
- // absent — fine (feature not active or fresh session)
216
- }
217
- if (hotText) {
218
- const tokens = Math.ceil(hotText.length / CHARS_PER_TOKEN);
219
- if (tokens > HOT_CONTEXT_TOKENS_MAX) {
220
- warnings.push({
221
- rule: 'hot-context-budget',
222
- metric: `${tokens}/${HOT_CONTEXT_TOKENS_MAX}`,
223
- message:
224
- `hot-context.md parses to ~${tokens} tokens (> ${HOT_CONTEXT_TOKENS_MAX}). ` +
225
- 'Activation path (pre-decided): trim the schema sections or fix the deterministic writer cap.',
226
- });
227
- }
228
- }
229
-
230
204
  return warnings;
231
205
  }
232
206
 
@@ -3,12 +3,11 @@
3
3
  * File-first memory retrieval.
4
4
  *
5
5
  * Ported from the retired Python `src/scripts/memory_lookup.py` (ADR-200). The public
6
- * API and CLI contract mirror the retired Python implementation EXACTLY — same exported
7
- * names (snake_case kept deliberately, especially `retrieve(...)` whose
8
- * signature/return shape is cited by rules), same exit codes, stdout/stderr
9
- * split, byte-identical messages, same memory-file scan + ranking + JSON
10
- * output. No behaviour changes — latent Python bugs are replicated and
11
- * flagged as divergence candidates.
6
+ * API and CLI contract mirror it EXACTLY — same exported names (snake_case kept
7
+ * deliberately, especially `retrieve(...)`, whose signature and return shape are cited
8
+ * by rules), same exit codes, stdout/stderr split, byte-identical messages, same
9
+ * memory-file scan, ranking and JSON output. No behaviour changes; latent Python bugs
10
+ * are replicated and flagged as divergence candidates.
12
11
  *
13
12
  * Implements the shared `retrieve(types, keys, limit)` abstraction used
14
13
  * by skills. Reads YAML under `agents/memory/<type>/` (curated, hand-
@@ -16,9 +15,8 @@
16
15
  * append-only, supersede-chain aware), plus user-ingested `knowledge`
17
16
  * chunks and opted-in `cross-repo` matches.
18
17
  *
19
- * Retrieval is entirely repo-side and file-backed — there is no external
20
- * backend. (The former optional `@event4u/agent-memory` package routing
21
- * was removed; see `docs/decisions/` for the agent-memory removal ADR.)
18
+ * Retrieval is entirely repo-side and file-backed — no external backend. (The former
19
+ * optional `@event4u/agent-memory` routing was removed; see `docs/decisions/`.)
22
20
  *
23
21
  * Usage:
24
22
  * memory_lookup --types domain-invariants,ownership --key "app/Http/Controllers/Foo" --limit 5
@@ -26,6 +24,8 @@
26
24
  *
27
25
  * import { retrieve } from './memory_lookup.js';
28
26
  * const hits = retrieve(['ownership'], ['app/Http'], 3);
27
+ * loss_class: recoverable-lossy
28
+ * loss_recovery: the envelope's `truncation.omitted` plus its next-path hint under `agents/memory/`.
29
29
  */
30
30
 
31
31
  import * as fs from 'node:fs';
@@ -101,19 +101,19 @@ export interface HostSurface {
101
101
  export const HOST_SURFACES: readonly HostSurface[] = [
102
102
  {
103
103
  host: 'augment', surface: '.augment/rules', perRuleTree: true,
104
- writer: 'src/scripts/condense.ts:2499',
104
+ writer: 'src/scripts/condense.ts:2495',
105
105
  anchor: '\'.augment/rules\',',
106
106
  note: 'copies by default; symlinks under `augment.rules_use_symlinks`',
107
107
  },
108
108
  {
109
109
  host: 'claude-code', surface: '.claude/rules', perRuleTree: true,
110
- writer: 'src/scripts/condense.ts:1192',
110
+ writer: 'src/scripts/condense.ts:1188',
111
111
  anchor: '_emit_claude_rule(',
112
112
  note: '`_emit_claude_rule` rewrites frontmatter to the host\'s own `paths:` key',
113
113
  },
114
114
  {
115
115
  host: 'cline', surface: '.clinerules', perRuleTree: true,
116
- writer: 'src/scripts/condense.ts:1194',
116
+ writer: 'src/scripts/condense.ts:1190',
117
117
  anchor: 'fs.symlinkSync(',
118
118
  note: 'symlink per rule into the projection',
119
119
  },
@@ -131,19 +131,19 @@ export const HOST_SURFACES: readonly HostSurface[] = [
131
131
  },
132
132
  {
133
133
  host: 'cursor', surface: '.cursor/rules', perRuleTree: true,
134
- writer: 'src/scripts/condense.ts:1194',
134
+ writer: 'src/scripts/condense.ts:1190',
135
135
  anchor: 'fs.symlinkSync(',
136
- note: 'symlink per rule, plus `.mdc` companions at `condense.ts:1422`',
136
+ note: 'symlink per rule, plus `.mdc` companions at `condense.ts:1418`',
137
137
  },
138
138
  {
139
139
  host: 'gemini', surface: 'GEMINI.md', perRuleTree: false,
140
- writer: 'src/scripts/condense.ts:1498',
140
+ writer: 'src/scripts/condense.ts:1494',
141
141
  anchor: '\'GEMINI.md\'',
142
142
  note: 'single file',
143
143
  },
144
144
  {
145
145
  host: 'windsurf', surface: '.windsurfrules', perRuleTree: false,
146
- writer: 'src/scripts/condense.ts:1242',
146
+ writer: 'src/scripts/condense.ts:1238',
147
147
  anchor: '\'.windsurfrules\'',
148
148
  note: 'single concatenated file',
149
149
  },
@@ -20,6 +20,11 @@
20
20
  * deterministic (real tokenizer, reported by `session_index_cost()`); the
21
21
  * hit-rate arm needs a live paired run and has NOT been executed — so the
22
22
  * default is off, per the roadmap's "off unless proven".
23
+ *
24
+ * loss_class: recoverable-lossy
25
+ * loss_recovery: agents/memory/ — this module renders the block and applies
26
+ * `capRows`, so it carries the same class as the cap it applies. Each dropped
27
+ * row names a curated entry that remains on disk and is fetchable by id.
23
28
  */
24
29
 
25
30
  import { CURATED_TYPES, MEMORY_ROOT, retrieve_v1 } from './memory_lookup.js';