@event4u/agent-config 16.4.0 → 17.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 (1052) hide show
  1. package/.augment-plugin/marketplace.json +3 -3
  2. package/.augment-plugin/plugin.json +1 -1
  3. package/.claude-plugin/marketplace.json +2 -2
  4. package/.claude-plugin/skills/install-agent-config/SKILL.md +4 -4
  5. package/CHANGELOG.md +483 -669
  6. package/CONTRIBUTING.md +47 -0
  7. package/README.md +25 -25
  8. package/dist/agent-src/commands/{design.md → agent-design.md} +11 -7
  9. package/dist/agent-src/commands/agents/init.md +66 -3
  10. package/dist/agent-src/commands/agents/user/init.md +3 -0
  11. package/dist/agent-src/commands/{optimize/deep.md → analyze/and-optimize.md} +72 -33
  12. package/dist/agent-src/commands/analyze/inbox.md +168 -37
  13. package/dist/agent-src/commands/analyze/pr.md +144 -0
  14. package/dist/agent-src/commands/analyze/{repo.md → reference.md} +85 -14
  15. package/dist/agent-src/commands/analyze/roadmap-repos.md +19 -10
  16. package/dist/agent-src/commands/analyze.md +28 -12
  17. package/dist/agent-src/commands/audit.md +115 -0
  18. package/dist/agent-src/commands/brand/review.md +13 -2
  19. package/dist/agent-src/commands/brand/tokens.md +3 -3
  20. package/dist/agent-src/commands/brand/voice.md +8 -5
  21. package/dist/agent-src/commands/brand.md +2 -2
  22. package/dist/agent-src/commands/challenge-me/closure.md +25 -0
  23. package/dist/agent-src/commands/design-system/import.md +8 -3
  24. package/dist/agent-src/commands/design-system/sync.md +98 -0
  25. package/dist/agent-src/commands/design-system.md +6 -1
  26. package/dist/agent-src/commands/evals/analyze.json +44 -0
  27. package/dist/agent-src/commands/evals/audit.json +12 -0
  28. package/dist/agent-src/commands/evals/retro.json +12 -0
  29. package/dist/agent-src/commands/fix/ci.md +10 -8
  30. package/dist/agent-src/commands/ghostwriter/write.md +22 -0
  31. package/dist/agent-src/commands/memory/learn-low-impact.md +70 -83
  32. package/dist/agent-src/commands/memory/propose.md +12 -0
  33. package/dist/agent-src/commands/memory.md +1 -1
  34. package/dist/agent-src/commands/optimize.md +4 -3
  35. package/dist/agent-src/commands/post-as/me.md +18 -0
  36. package/dist/agent-src/commands/pr/create.md +17 -342
  37. package/dist/agent-src/commands/pr/merge.md +129 -368
  38. package/dist/agent-src/commands/retro.md +121 -0
  39. package/dist/agent-src/commands/review/routing.md +1 -1
  40. package/dist/agent-src/commands/roadmap/next.md +4 -1
  41. package/dist/agent-src/commands/roadmap/process-full.md +46 -333
  42. package/dist/agent-src/commands/roadmap/triage-parked.md +6 -2
  43. package/dist/agent-src/commands/team-knowledge/consolidate.md +2 -2
  44. package/dist/agent-src/commands/team-knowledge.md +1 -1
  45. package/dist/agent-src/commands/threat-model.md +1 -1
  46. package/dist/agent-src/commands/upstream-contribute.md +91 -101
  47. package/dist/agent-src/commands/worktree/cleanup.md +18 -11
  48. package/dist/agent-src/contexts/contracts/consumer-agents-md-guide.md +54 -0
  49. package/dist/agent-src/contexts/execution/analysis-loop.md +137 -0
  50. package/dist/agent-src/contexts/execution/auto-dispatch-classification.md +3 -3
  51. package/dist/agent-src/contexts/execution/decision-closure-execution.md +1 -1
  52. package/dist/agent-src/contexts/execution/host-capability-manifest.md +6 -0
  53. package/dist/agent-src/contexts/execution/orchestration-telemetry.md +11 -4
  54. package/dist/agent-src/contexts/execution/pr-create-branches-content.md +250 -0
  55. package/dist/agent-src/contexts/execution/pr-create-branches-freshness.md +150 -0
  56. package/dist/agent-src/contexts/execution/pr-merge-queue.md +287 -0
  57. package/dist/agent-src/contexts/execution/pr-merge-sync.md +276 -0
  58. package/dist/agent-src/contexts/execution/pr-merge-trust-boundary.md +69 -0
  59. package/dist/agent-src/contexts/execution/process-full-all.md +233 -0
  60. package/dist/agent-src/contexts/execution/process-full-delivery.md +231 -0
  61. package/dist/agent-src/contexts/execution/roadmap-execution-contract-branches.md +42 -0
  62. package/dist/agent-src/contexts/execution/roadmap-execution-contract.md +1 -35
  63. package/dist/agent-src/contexts/execution/roadmap-process-loop-close.md +235 -0
  64. package/dist/agent-src/contexts/execution/roadmap-process-loop-prescan.md +216 -0
  65. package/dist/agent-src/contexts/execution/roadmap-process-loop-run.md +253 -0
  66. package/dist/agent-src/contexts/execution/roadmap-process-loop-set.md +212 -0
  67. package/dist/agent-src/contexts/execution/roadmap-process-loop.md +25 -864
  68. package/dist/agent-src/contexts/execution/subagent-spawn-contract.md +14 -2
  69. package/dist/agent-src/contexts/execution/subagent-steering.md +65 -8
  70. package/dist/agent-src/contexts/model-recommendations.md +5 -5
  71. package/dist/agent-src/contexts/subagent-configuration.md +1 -1
  72. package/dist/agent-src/guidelines/agent-infra/api-cost-levers.md +4 -3
  73. package/dist/agent-src/guidelines/agent-infra/model-recommendation.md +11 -5
  74. package/dist/agent-src/guidelines/agent-infra/rule-body-migration-inventory.md +1 -1
  75. package/dist/agent-src/guidelines/agent-infra/self-improvement-pipeline.md +47 -24
  76. package/dist/agent-src/guidelines/design-antipatterns.md +6 -1
  77. package/dist/agent-src/guidelines/design-asset-discipline.md +17 -0
  78. package/dist/agent-src/guidelines/design-fidelity-routing.md +1 -0
  79. package/dist/agent-src/guidelines/php/api-design.md +10 -1
  80. package/dist/agent-src/rules/brand-source-of-truth.md +7 -6
  81. package/dist/agent-src/rules/code-provenance.md +1 -1
  82. package/dist/agent-src/rules/context-hygiene.md +0 -1
  83. package/dist/agent-src/rules/design-fidelity.md +12 -13
  84. package/dist/agent-src/rules/external-reference-deep-dive.md +2 -2
  85. package/dist/agent-src/rules/fix-what-you-see.md +1 -1
  86. package/dist/agent-src/rules/low-impact-corpus-privacy-floor.md +14 -15
  87. package/dist/agent-src/rules/missing-skill-recovery.md +12 -11
  88. package/dist/agent-src/rules/neighbour-precedence.md +1 -1
  89. package/dist/agent-src/rules/recurring-criticism.md +1 -1
  90. package/dist/agent-src/rules/roadmap-ci-steps-policy.md +0 -2
  91. package/dist/agent-src/rules/self-repair-loop.md +2 -2
  92. package/dist/agent-src/rules/token-budget-discipline.md +2 -2
  93. package/dist/agent-src/scripts/dashboard_mode.ts +4 -1
  94. package/dist/agent-src/scripts/roadmap_age.ts +175 -0
  95. package/dist/agent-src/scripts/update_roadmap_progress.ts +10 -2
  96. package/dist/agent-src/skills/accessibility-auditor/SKILL.md +3 -3
  97. package/dist/agent-src/skills/accessibility-auditor/data/aria-patterns.csv +2 -0
  98. package/dist/agent-src/skills/accessibility-auditor/data/manifest.json +3 -3
  99. package/dist/agent-src/skills/agent-security-review/SKILL.md +2 -2
  100. package/dist/agent-src/skills/agents-md-thin-root/SKILL.md +12 -4
  101. package/dist/agent-src/skills/ai-code-blindspots/SKILL.md +7 -0
  102. package/dist/agent-src/skills/ai-council/references/advanced-modes.md +11 -1
  103. package/dist/agent-src/skills/ai-council/references/cost-and-redaction.md +7 -0
  104. package/dist/agent-src/skills/ai-council/references/execution-modes.md +7 -0
  105. package/dist/agent-src/skills/ai-council/references/output-and-synthesis.md +19 -0
  106. package/dist/agent-src/skills/ai-council/references/procedure.md +7 -0
  107. package/dist/agent-src/skills/api-design/SKILL.md +2 -2
  108. package/dist/agent-src/skills/api-endpoint/SKILL.md +2 -2
  109. package/dist/agent-src/skills/authz-review/SKILL.md +5 -3
  110. package/dist/agent-src/skills/blade-ui/SKILL.md +2 -2
  111. package/dist/agent-src/skills/brand/SKILL.md +7 -3
  112. package/dist/agent-src/skills/brand-asset-generation/SKILL.md +13 -6
  113. package/dist/agent-src/skills/brand-audit/SKILL.md +2 -1
  114. package/dist/agent-src/skills/brand-identity/SKILL.md +5 -4
  115. package/dist/agent-src/skills/brand-strategy/SKILL.md +5 -4
  116. package/dist/agent-src/skills/brand-to-tokens/SKILL.md +18 -39
  117. package/dist/agent-src/skills/brand-to-tokens/templates/marp-brand-deck.md.example +2 -2
  118. package/dist/agent-src/skills/brand-to-tokens/templates/reveal-brand-deck.yaml +2 -2
  119. package/dist/agent-src/skills/canvas-design/SKILL.md +16 -4
  120. package/dist/agent-src/skills/competitive-positioning/SKILL.md +2 -2
  121. package/dist/agent-src/skills/composer-packages/SKILL.md +18 -0
  122. package/dist/agent-src/skills/condense-memory/SKILL.md +1 -1
  123. package/dist/agent-src/skills/content-funnel-design/SKILL.md +8 -1
  124. package/dist/agent-src/skills/context-authoring/SKILL.md +1 -1
  125. package/dist/agent-src/skills/context-document/SKILL.md +2 -2
  126. package/dist/agent-src/skills/corpus-grounding/SKILL.md +6 -6
  127. package/dist/agent-src/skills/corpus-grounding/scripts/decision_engine.ts +13 -11
  128. package/dist/agent-src/skills/corpus-grounding/scripts/ground.mjs +1706 -0
  129. package/dist/agent-src/skills/corpus-grounding/scripts/schema_validator.ts +7 -1
  130. package/dist/agent-src/skills/dashboard-design/SKILL.md +1 -1
  131. package/dist/agent-src/skills/data-flow-mapper/SKILL.md +5 -2
  132. package/dist/agent-src/skills/database/SKILL.md +5 -4
  133. package/dist/agent-src/skills/decision-record/references/weighted-matrix.md +12 -0
  134. package/dist/agent-src/skills/deep-reading-analyst/SKILL.md +1 -1
  135. package/dist/agent-src/skills/dependency-upgrade/SKILL.md +61 -11
  136. package/dist/agent-src/skills/description-assist/SKILL.md +1 -1
  137. package/dist/agent-src/skills/design-intelligence/SKILL.md +1 -1
  138. package/dist/agent-src/skills/design-intelligence/data/landing.csv +1 -1
  139. package/dist/agent-src/skills/design-intelligence/references/context-and-registers.md +10 -2
  140. package/dist/agent-src/skills/design-intelligence/references/design-languages.md +1 -1
  141. package/dist/agent-src/skills/design-intelligence/references/design-rules-checklist.md +4 -3
  142. package/dist/agent-src/skills/design-intelligence/references/integration-mapping.md +25 -22
  143. package/dist/agent-src/skills/{wireframe → design-review}/references/story-beat-ledger.schema.json +1 -1
  144. package/dist/agent-src/skills/design-review/references/verification-automation.md +11 -3
  145. package/dist/agent-src/skills/design-system-capture/SKILL.md +15 -10
  146. package/dist/agent-src/skills/design-system-capture/references/design-system-json.md +20 -5
  147. package/dist/agent-src/skills/design-system-capture/references/import-procedure.md +2 -2
  148. package/dist/agent-src/skills/design-tokens/SKILL.md +23 -23
  149. package/dist/agent-src/skills/design-tokens/scripts/tokens.mjs +1037 -0
  150. package/dist/agent-src/skills/design-tokens/scripts/tokens.ts +336 -13
  151. package/dist/agent-src/skills/design-tokens/templates/design-tokens-starter.json +52 -53
  152. package/dist/agent-src/skills/docker/SKILL.md +1 -1
  153. package/dist/agent-src/skills/estimate-ticket/SKILL.md +1 -1
  154. package/dist/agent-src/skills/existing-ui-audit/SKILL.md +14 -276
  155. package/dist/agent-src/skills/existing-ui-audit/procedure.yaml +44 -0
  156. package/dist/agent-src/skills/existing-ui-audit/references/anti-slop-cross-reference.md +1 -1
  157. package/dist/agent-src/skills/existing-ui-audit/references/steps/00-inspect-stack-and-input.md +4 -0
  158. package/dist/agent-src/skills/existing-ui-audit/references/steps/01-enumerate-components.md +26 -0
  159. package/dist/agent-src/skills/existing-ui-audit/references/steps/01b-detect-component-taxonomy.md +7 -0
  160. package/dist/agent-src/skills/existing-ui-audit/references/steps/02-identify-design-system.md +12 -0
  161. package/dist/agent-src/skills/existing-ui-audit/references/steps/03-detect-design-tokens.md +35 -0
  162. package/dist/agent-src/skills/existing-ui-audit/references/steps/04-detect-shadcn-inventory.md +13 -0
  163. package/dist/agent-src/skills/existing-ui-audit/references/steps/04b-live-storybook-read.md +26 -0
  164. package/dist/agent-src/skills/existing-ui-audit/references/steps/05-list-reusable-patterns.md +14 -0
  165. package/dist/agent-src/skills/existing-ui-audit/references/steps/06-match-candidates.md +52 -0
  166. package/dist/agent-src/skills/existing-ui-audit/references/steps/07-greenfield-branch.md +29 -0
  167. package/dist/agent-src/skills/existing-ui-audit/references/steps/08-a11y-baseline.md +40 -0
  168. package/dist/agent-src/skills/existing-ui-audit/references/steps/09-validate-and-write.md +5 -0
  169. package/dist/agent-src/skills/experiment-loop/SKILL.md +1 -1
  170. package/dist/agent-src/skills/fe-design/references/design-patterns.md +65 -4
  171. package/dist/agent-src/skills/fe-design/references/design-read-and-memory.md +1 -1
  172. package/dist/agent-src/skills/fe-design/references/source-led-port.md +1 -1
  173. package/dist/agent-src/skills/finishing-a-development-branch/SKILL.md +6 -6
  174. package/dist/agent-src/skills/flux/SKILL.md +1 -1
  175. package/dist/agent-src/skills/form-handler/SKILL.md +15 -2
  176. package/dist/agent-src/skills/frontend-render-security/SKILL.md +9 -0
  177. package/dist/agent-src/skills/git-workflow/SKILL.md +2 -2
  178. package/dist/agent-src/skills/git-workflow/references/branch-update.md +7 -0
  179. package/dist/agent-src/skills/git-workflow/references/commit-subject.md +12 -0
  180. package/dist/agent-src/skills/git-workflow/references/push-closes-its-loop.md +10 -0
  181. package/dist/agent-src/skills/gtm-launch/SKILL.md +8 -1
  182. package/dist/agent-src/skills/html-deck/SKILL.md +7 -2
  183. package/dist/agent-src/skills/humanizer/SKILL.md +16 -3
  184. package/dist/agent-src/skills/humanizer/references/anti-aiisms.md +13 -1
  185. package/dist/agent-src/skills/humanizer/references/fixtures.md +8 -0
  186. package/dist/agent-src/skills/iconography/SKILL.md +4 -2
  187. package/dist/agent-src/skills/image-provider-routing/SKILL.md +16 -5
  188. package/dist/agent-src/skills/js-library-packaging/SKILL.md +5 -4
  189. package/dist/agent-src/skills/js-library-packaging/scripts/check_package_surface.mjs +197 -0
  190. package/dist/agent-src/skills/judge-artifact-completeness/SKILL.md +1 -1
  191. package/dist/agent-src/skills/judge-security-auditor/SKILL.md +2 -2
  192. package/dist/agent-src/skills/launch-readiness/SKILL.md +18 -22
  193. package/dist/agent-src/skills/learning-to-rule-or-skill/SKILL.md +5 -5
  194. package/dist/agent-src/skills/livewire/SKILL.md +1 -1
  195. package/dist/agent-src/skills/llm-provider-knowledge/SKILL.md +18 -0
  196. package/dist/agent-src/skills/logo-generation/SKILL.md +21 -11
  197. package/dist/agent-src/skills/market-entry-analysis/SKILL.md +6 -1
  198. package/dist/agent-src/skills/markitdown/SKILL.md +1 -1
  199. package/dist/agent-src/skills/memory-consolidation/SKILL.md +2 -2
  200. package/dist/agent-src/skills/messaging-architecture/SKILL.md +8 -1
  201. package/dist/agent-src/skills/motion-choreographer/SKILL.md +2 -2
  202. package/dist/agent-src/skills/playwright-testing/SKILL.md +2 -0
  203. package/dist/agent-src/skills/positioning-strategy/SKILL.md +10 -2
  204. package/dist/agent-src/skills/prediction-pool-optimizer/references/ev-fixtures.md +13 -0
  205. package/dist/agent-src/skills/prediction-pool-optimizer/references/odds-and-bonus.md +7 -0
  206. package/dist/agent-src/skills/project-analysis-core/SKILL.md +1 -1
  207. package/dist/agent-src/skills/project-analysis-hypothesis-driven/SKILL.md +1 -1
  208. package/dist/agent-src/skills/project-analyzer/SKILL.md +14 -75
  209. package/dist/agent-src/skills/project-analyzer/procedure.yaml +39 -0
  210. package/dist/agent-src/skills/project-analyzer/references/steps/01-project-overview.md +9 -0
  211. package/dist/agent-src/skills/project-analyzer/references/steps/02-architecture.md +7 -0
  212. package/dist/agent-src/skills/project-analyzer/references/steps/03-data-layer.md +6 -0
  213. package/dist/agent-src/skills/project-analyzer/references/steps/04-business-domains.md +7 -0
  214. package/dist/agent-src/skills/project-analyzer/references/steps/05-api-surface.md +6 -0
  215. package/dist/agent-src/skills/project-analyzer/references/steps/06-service-map.md +6 -0
  216. package/dist/agent-src/skills/project-analyzer/references/steps/07-module-inventory.md +6 -0
  217. package/dist/agent-src/skills/project-analyzer/references/steps/08-infrastructure-and-testing.md +5 -0
  218. package/dist/agent-src/skills/project-analyzer/references/steps/09-agent-docs-audit.md +6 -0
  219. package/dist/agent-src/skills/project-analyzer/references/steps/10-gap-analysis.md +6 -0
  220. package/dist/agent-src/skills/quality-tools/references/js-ts-tools.md +10 -0
  221. package/dist/agent-src/skills/quality-tools/references/php-tools.md +13 -0
  222. package/dist/agent-src/skills/quality-tools/references/python-tools.md +11 -0
  223. package/dist/agent-src/skills/react-native-setup/SKILL.md +7 -2
  224. package/dist/agent-src/skills/react-shadcn-ui/SKILL.md +5 -1
  225. package/dist/agent-src/skills/react-shadcn-ui/references/registry.md +13 -0
  226. package/dist/agent-src/skills/react-shadcn-ui/scripts/shadcn_add.mjs +315 -0
  227. package/dist/agent-src/skills/react-shadcn-ui/scripts/shadcn_add.ts +6 -6
  228. package/dist/agent-src/skills/receiving-code-review/SKILL.md +1 -1
  229. package/dist/agent-src/skills/refine-ticket/SKILL.md +2 -2
  230. package/dist/agent-src/skills/release-comms/SKILL.md +2 -1
  231. package/dist/agent-src/skills/repomix-packer/SKILL.md +2 -2
  232. package/dist/agent-src/skills/requesting-code-review/SKILL.md +3 -3
  233. package/dist/agent-src/skills/roadmap-management/references/archival.md +3 -3
  234. package/dist/agent-src/skills/roadmap-management/references/authoring.md +9 -2
  235. package/dist/agent-src/skills/roadmap-management/references/dashboard.md +3 -3
  236. package/dist/agent-src/skills/roadmap-management/references/lifecycle.md +3 -3
  237. package/dist/agent-src/skills/roadmap-writing/SKILL.md +4 -4
  238. package/dist/agent-src/skills/rtk-output-filtering/SKILL.md +1 -1
  239. package/dist/agent-src/skills/rule-writing/SKILL.md +1 -2
  240. package/dist/agent-src/skills/security/SKILL.md +41 -5
  241. package/dist/agent-src/skills/skill-improvement-pipeline/SKILL.md +5 -3
  242. package/dist/agent-src/skills/skill-reviewer/SKILL.md +1 -1
  243. package/dist/agent-src/skills/skill-writing/SKILL.md +23 -8
  244. package/dist/agent-src/skills/skill-writing/references/section-patterns.md +19 -1
  245. package/dist/agent-src/skills/source-discovery/SKILL.md +3 -3
  246. package/dist/agent-src/skills/sql-writing/SKILL.md +2 -2
  247. package/dist/agent-src/skills/standards-from-config/SKILL.md +2 -2
  248. package/dist/agent-src/skills/storybook-workshop/SKILL.md +5 -0
  249. package/dist/agent-src/skills/storybook-workshop/scripts/story_contrast_floor.mjs +99 -0
  250. package/dist/agent-src/skills/subagent-orchestration/SKILL.md +13 -13
  251. package/dist/agent-src/skills/subagent-orchestration/prompts/README.md +4 -3
  252. package/dist/agent-src/skills/svg-authoring/SKILL.md +324 -0
  253. package/dist/agent-src/skills/systematic-debugging/SKILL.md +2 -2
  254. package/dist/agent-src/skills/tailwind-engineer/SKILL.md +8 -3
  255. package/dist/agent-src/skills/tailwind-engineer/scripts/tailwind_config_gen.mjs +482 -0
  256. package/dist/agent-src/skills/test-case-discovery/SKILL.md +1 -1
  257. package/dist/agent-src/skills/threat-modeling/SKILL.md +8 -1
  258. package/dist/agent-src/skills/threat-modeling/data/manifest.json +5 -2
  259. package/dist/agent-src/skills/threat-modeling/data/reasoning.csv +10 -10
  260. package/dist/agent-src/skills/threat-modeling/data/surfaces.csv +11 -10
  261. package/dist/agent-src/skills/threat-modeling/data/threats.csv +34 -20
  262. package/dist/agent-src/skills/type-design/SKILL.md +196 -0
  263. package/dist/agent-src/skills/type-design/references/font-spec.md +90 -0
  264. package/dist/agent-src/skills/type-design/references/gates.md +113 -0
  265. package/dist/agent-src/skills/type-design/references/toolchain.md +66 -0
  266. package/dist/agent-src/skills/typography-system/SKILL.md +21 -11
  267. package/dist/agent-src/skills/typography-system/references/worked-scales.md +85 -0
  268. package/dist/agent-src/skills/ui-apply-generic/SKILL.md +1 -1
  269. package/dist/agent-src/skills/universal-project-analysis/SKILL.md +1 -1
  270. package/dist/agent-src/skills/upstream-contribute/SKILL.md +120 -125
  271. package/dist/agent-src/skills/using-git-worktrees/SKILL.md +1 -0
  272. package/dist/agent-src/skills/verify-repair-loop/SKILL.md +1 -1
  273. package/dist/agent-src/skills/voice-and-tone-design/SKILL.md +71 -2
  274. package/dist/agent-src/skills/wireframe/SKILL.md +5 -2
  275. package/dist/agent-src/skills/worktree-lifecycle/SKILL.md +16 -14
  276. package/dist/agent-src/templates/AGENTS.md +1 -1
  277. package/dist/agent-src/templates/agents/agent-project-settings.example.yml +1 -1
  278. package/dist/agent-src/templates/agents/proposal.example.md +1 -1
  279. package/dist/agent-src/templates/github-workflows/advisories-daily.yml +85 -0
  280. package/dist/agent-src/templates/roadmaps.md +39 -1
  281. package/dist/agent-src/templates/scripts/check_memory.ts +2 -2
  282. package/dist/agent-src/templates/scripts/historical-bug-patterns.example.yml +13 -1
  283. package/dist/agent-src/templates/scripts/work_engine/cli.ts +17 -0
  284. package/dist/agent-src/templates/scripts/work_engine/cli_args.ts +10 -0
  285. package/dist/agent-src/templates/scripts/work_engine/directives/ui/scaffold.ts +22 -13
  286. package/dist/agent-src/templates/scripts/work_engine/dispatcher.ts +18 -4
  287. package/dist/agent-src/templates/scripts/work_engine/procedure/checks.ts +283 -0
  288. package/dist/agent-src/templates/scripts/work_engine/procedure/run.ts +432 -0
  289. package/dist/agent-src/templates/scripts/work_engine/procedure/sidecar.ts +185 -0
  290. package/dist/agent-src/templates/scripts/work_engine/state.ts +3 -0
  291. package/dist/cli/commands/uiRender.js +265 -13
  292. package/dist/cli/commands/uiRenderAsset.js +1316 -0
  293. package/dist/cli/commands/uiRenderAssetCompare.js +752 -0
  294. package/dist/cli/commands/uiRenderAssetFonts.js +158 -0
  295. package/dist/cli/commands/uiRenderAssetGrid.js +265 -0
  296. package/dist/cli/commands/uiRenderAssetGrounds.js +323 -0
  297. package/dist/cli/commands/uiRenderAssetIsolation.js +85 -0
  298. package/dist/cli/commands/uiRenderAssetTypes.js +133 -0
  299. package/dist/cli/initRouting.js +1 -1
  300. package/dist/cli/main.js +47 -1
  301. package/dist/cli/mcp/dispatch.js +31 -9
  302. package/dist/cli/python/knowledge_ingest.js +7 -39
  303. package/dist/cli/python/workspace_secrets.js +4 -177
  304. package/dist/cli/registry.js +5 -2
  305. package/dist/cli-delegate/archive_completed_roadmaps.js +3 -2
  306. package/dist/cli-delegate/check_update_banner.js +635 -266
  307. package/dist/cli-delegate/{chunk-AED2VQGM.js → chunk-2CX7NWRB.js} +233 -437
  308. package/dist/cli-delegate/{chunk-F3QDG2GT.js → chunk-2SFOOFJJ.js} +259 -159
  309. package/dist/cli-delegate/chunk-2Y5AMLMY.js +136 -0
  310. package/dist/cli-delegate/{chunk-OKJUIAPS.js → chunk-4E2W63DA.js} +1 -62
  311. package/dist/cli-delegate/{chunk-6SRJTYJS.js → chunk-4SHNERBL.js} +37 -16
  312. package/dist/cli-delegate/chunk-5VO3RTMV.js +208 -0
  313. package/dist/cli-delegate/chunk-6E2LDY4F.js +27 -0
  314. package/dist/cli-delegate/{chunk-XQTPXKFA.js → chunk-6ZD2QZMN.js} +8 -17
  315. package/dist/cli-delegate/{chunk-6V5FMA3P.js → chunk-7CEI2YPS.js} +1 -1
  316. package/dist/cli-delegate/{chunk-DMSZHXZS.js → chunk-7DRWULEQ.js} +80 -7
  317. package/dist/cli-delegate/chunk-7NXCZSDL.js +54 -0
  318. package/dist/cli-delegate/chunk-AX3U3UWJ.js +328 -0
  319. package/dist/cli-delegate/{chunk-WOKWX5PL.js → chunk-BKALSTBZ.js} +18 -3
  320. package/dist/cli-delegate/chunk-BMGUGSY6.js +103 -0
  321. package/dist/cli-delegate/chunk-BYV46VRM.js +3309 -0
  322. package/dist/cli-delegate/{chunk-5GPULQBE.js → chunk-CAL76ADI.js} +4215 -682
  323. package/dist/cli-delegate/chunk-DSY6LLCQ.js +127 -0
  324. package/dist/cli-delegate/chunk-E6XNBVE4.js +581 -0
  325. package/dist/cli-delegate/{chunk-ZUZKZYCN.js → chunk-ESUNQ5XR.js} +46 -10
  326. package/dist/cli-delegate/{chunk-G5VVIZRC.js → chunk-F7HLSW6P.js} +1 -1
  327. package/dist/cli-delegate/chunk-FIEEOH5C.js +133 -0
  328. package/dist/cli-delegate/chunk-FKYZOWVD.js +719 -0
  329. package/dist/cli-delegate/chunk-GOMILC3O.js +918 -0
  330. package/dist/cli-delegate/chunk-I4KJYVPB.js +69 -0
  331. package/dist/cli-delegate/{chunk-JQOM7TTM.js → chunk-IDAOTDPE.js} +1 -100
  332. package/dist/cli-delegate/chunk-IROAQ77A.js +137 -0
  333. package/dist/cli-delegate/chunk-J2SJZICO.js +698 -0
  334. package/dist/cli-delegate/{chunk-6YQC2HLF.js → chunk-JHMMWNJ2.js} +54 -40
  335. package/dist/cli-delegate/{chunk-WQWXGIWB.js → chunk-M6CRG5O6.js} +165 -15
  336. package/dist/cli-delegate/{chunk-PHD7OOLE.js → chunk-MQ2UDEGV.js} +14 -3
  337. package/dist/cli-delegate/chunk-NTM7G2V4.js +220 -0
  338. package/dist/cli-delegate/chunk-PV7S5DPJ.js +175 -0
  339. package/dist/cli-delegate/{chunk-F7DQWYR5.js → chunk-RAXQOETZ.js} +6 -2
  340. package/dist/cli-delegate/{chunk-T7XSJSUQ.js → chunk-SIOMDAKL.js} +980 -784
  341. package/dist/cli-delegate/{chunk-KR6EM23A.js → chunk-TULVDQ4L.js} +3 -48
  342. package/dist/cli-delegate/chunk-UUYEKXKR.js +20 -0
  343. package/dist/cli-delegate/{chunk-7XGD2OEU.js → chunk-UXWHY6CQ.js} +2 -1
  344. package/dist/cli-delegate/{chunk-PWX7CKMD.js → chunk-VC3ECUEK.js} +1 -1
  345. package/dist/cli-delegate/{chunk-KXXWJTDO.js → chunk-WMNYVIYX.js} +1 -1
  346. package/dist/cli-delegate/chunk-XCY5KKUC.js +181 -0
  347. package/dist/cli-delegate/{chunk-H76PHZBI.js → chunk-XLY5G3CM.js} +14 -19
  348. package/dist/cli-delegate/cmd_adr_effective.js +41 -2
  349. package/dist/cli-delegate/cmd_analyze_session.js +7 -7
  350. package/dist/cli-delegate/cmd_brand_status.js +1287 -10
  351. package/dist/cli-delegate/cmd_ci_settle.js +330 -0
  352. package/dist/cli-delegate/cmd_conformance.js +669 -822
  353. package/dist/cli-delegate/cmd_doctor.js +26 -16
  354. package/dist/cli-delegate/cmd_doctor_neighbours.js +10 -7
  355. package/dist/cli-delegate/cmd_explain.js +9 -24
  356. package/dist/cli-delegate/cmd_export.js +14 -11
  357. package/dist/cli-delegate/cmd_fleet.js +5 -3
  358. package/dist/cli-delegate/cmd_git_convention.js +8 -4
  359. package/dist/cli-delegate/cmd_handoff.js +79 -242
  360. package/dist/cli-delegate/cmd_mcp_available.js +1 -1
  361. package/dist/cli-delegate/cmd_memory_get.js +4 -2
  362. package/dist/cli-delegate/cmd_migrate.js +2 -2
  363. package/dist/cli-delegate/cmd_packs_active.js +2 -2
  364. package/dist/cli-delegate/cmd_preflight.js +7 -5
  365. package/dist/cli-delegate/cmd_prune.js +16 -13
  366. package/dist/cli-delegate/cmd_route_audit.js +11 -8
  367. package/dist/cli-delegate/cmd_route_explain.js +649 -16
  368. package/dist/cli-delegate/cmd_session_recycle.js +15 -6
  369. package/dist/cli-delegate/cmd_settings_check.js +2 -2
  370. package/dist/cli-delegate/cmd_settings_get.js +1 -1
  371. package/dist/cli-delegate/cmd_settings_migrate.js +14 -11
  372. package/dist/cli-delegate/cmd_settings_set.js +1 -1
  373. package/dist/cli-delegate/cmd_sync.js +16 -13
  374. package/dist/cli-delegate/cmd_uninstall.js +185 -31
  375. package/dist/cli-delegate/cmd_update.js +67 -3
  376. package/dist/cli-delegate/cmd_upgrade.js +38 -7
  377. package/dist/cli-delegate/cmd_validate.js +16 -13
  378. package/dist/cli-delegate/cmd_versions.js +1 -1
  379. package/dist/cli-delegate/dashboard_mode.js +1 -1
  380. package/dist/cli-delegate/gate_execute.js +4 -3
  381. package/dist/cli-delegate/roadmap_age.js +22 -0
  382. package/dist/cli-delegate/roadmap_gates.js +4 -3
  383. package/dist/cli-delegate/update_roadmap_progress.js +3 -2
  384. package/dist/cli-delegate/upgrade_unattended-VVL6JLSX.js +541 -0
  385. package/dist/discovery/deprecation-report.md +1 -1
  386. package/dist/discovery/discovery-manifest.json +409 -201
  387. package/dist/discovery/discovery-manifest.json.sha256 +1 -1
  388. package/dist/discovery/discovery-manifest.summary.md +8 -8
  389. package/dist/discovery/dormancy-report.md +1 -1
  390. package/dist/discovery/orphan-report.md +1 -1
  391. package/dist/discovery/packs.json +36 -27
  392. package/dist/discovery/trust-report.md +3 -3
  393. package/dist/discovery/workspaces.json +25 -16
  394. package/dist/hooks/chat_history.chunk.cjs +6852 -0
  395. package/dist/hooks/chat_history.chunk.cjs.sha256 +1 -0
  396. package/dist/hooks/dispatch.js +17706 -18627
  397. package/dist/hooks/dispatch.sha256 +1 -1
  398. package/dist/hooks/egress_engine.chunk.cjs +915 -0
  399. package/dist/hooks/egress_engine.chunk.cjs.sha256 +1 -0
  400. package/dist/hooks/svg_rules.chunk.cjs +1858 -0
  401. package/dist/hooks/svg_rules.chunk.cjs.sha256 +1 -0
  402. package/dist/install/conflict.js +36 -6
  403. package/dist/install/conflictTracker.js +81 -7
  404. package/dist/install/detect.js +3 -3
  405. package/dist/install/hostPermissionsAdapter.js +106 -0
  406. package/dist/install/install.mjs +3117 -1949
  407. package/dist/install/installThinLayer.js +1 -1
  408. package/dist/install/manifestFiles.js +21 -0
  409. package/dist/install/noGoDenyRows.js +300 -0
  410. package/dist/install/noGoRules.js +368 -0
  411. package/dist/install/ownershipLedger.js +133 -0
  412. package/dist/install/plan.js +1 -1
  413. package/dist/install/preflight.js +39 -8
  414. package/dist/install/preserve.js +74 -12
  415. package/dist/install/recordedOwnership.js +88 -5
  416. package/dist/install/rule_scope.js +20 -3
  417. package/dist/install/stagedRuntime.js +455 -0
  418. package/dist/install/toolsArg.js +19 -0
  419. package/dist/install/userPin.js +47 -0
  420. package/dist/install/wizard-plan.js +26 -4
  421. package/dist/mcp/awesome-mcp-servers.row.md +1 -1
  422. package/dist/mcp/mcp-cloudflare-catalogue.json +3 -2
  423. package/dist/mcp/registry-manifest.json +6 -5
  424. package/dist/mcp/server.json +3 -3
  425. package/dist/mcp/server.mjs +9814 -5333
  426. package/dist/router.json +1 -1
  427. package/dist/scripts/_lib/agent_settings.js +7 -12
  428. package/dist/scripts/_lib/asset_render_record.js +219 -0
  429. package/dist/scripts/_lib/claude_builtin_names.js +9 -4
  430. package/dist/scripts/_lib/claude_settings_hooks.js +102 -34
  431. package/dist/scripts/_lib/egress_rules.js +766 -0
  432. package/dist/scripts/_lib/environment_detector.js +24 -33
  433. package/dist/scripts/_lib/global_deploy_inventory.js +146 -9
  434. package/dist/scripts/_lib/guidelines_lane.js +10 -1
  435. package/dist/scripts/_lib/identifier_redaction.js +24 -0
  436. package/dist/scripts/_lib/installed_layer.js +17 -0
  437. package/dist/scripts/_lib/installed_layer_normalise.js +72 -0
  438. package/dist/scripts/_lib/lean_projection_mode.js +34 -152
  439. package/dist/scripts/_lib/project_tree_form.js +118 -0
  440. package/dist/scripts/_lib/scan_scope.js +105 -0
  441. package/dist/scripts/_lib/scoped_projection.js +133 -3
  442. package/dist/scripts/_lib/settings_removed_keys.js +29 -0
  443. package/dist/scripts/_lib/settings_renamed_keys.js +17 -5
  444. package/dist/scripts/_lib/subagent_native_fields.js +35 -0
  445. package/dist/scripts/_lib/svg_dom.js +284 -0
  446. package/dist/scripts/_lib/svg_filled_counter.js +285 -0
  447. package/dist/scripts/_lib/svg_geometry.js +477 -0
  448. package/dist/scripts/_lib/svg_motion.js +179 -0
  449. package/dist/scripts/_lib/svg_rules.js +1339 -0
  450. package/dist/scripts/_lib/svg_urls.js +67 -0
  451. package/dist/scripts/_lib/ui_surface.js +19 -0
  452. package/dist/scripts/_lib/verification_command.js +364 -0
  453. package/dist/scripts/_lib/workspace_secrets.js +229 -0
  454. package/dist/scripts/ai_council/seat_policy.js +27 -0
  455. package/dist/scripts/ai_council/transport_resolver.js +9 -10
  456. package/dist/scripts/condense.js +25 -29
  457. package/dist/scripts/lint_svg_asset.js +324 -0
  458. package/dist/server/io/substituteTemplate.js +2 -2
  459. package/dist/server/io/yamlIO.js +2 -2
  460. package/dist/server/routes/install.js +5 -1
  461. package/dist/server/routes/settings.js +2 -2
  462. package/dist/server/routes/wizard.js +1 -1
  463. package/dist/server/schemas/settings.js +22 -16
  464. package/dist/server/serverInfo.js +1 -1
  465. package/dist/shared/brandTokenDocument.js +47 -0
  466. package/dist/shared/brandTokenPaths.js +43 -0
  467. package/dist/shared/settingsCarveOut.js +0 -7
  468. package/dist/shared/skillRanking.js +103 -5
  469. package/dist/shared/userMd/formAdapter.js +16 -0
  470. package/dist/shared/userMd/schema.js +17 -0
  471. package/dist/ui/assets/index-w70Ado09.js +23 -0
  472. package/dist/ui/index.html +1 -1
  473. package/docs/MIGRATION.md +89 -2
  474. package/docs/THIRD-PARTY-NOTICES.md +27 -0
  475. package/docs/contracts/settings-classes.md +27 -9
  476. package/docs/guidelines/agent-infra/api-cost-levers.md +4 -3
  477. package/docs/guidelines/agent-infra/model-recommendation.md +11 -5
  478. package/docs/guidelines/agent-infra/rule-body-migration-inventory.md +1 -1
  479. package/docs/guidelines/agent-infra/self-improvement-pipeline.md +47 -24
  480. package/docs/guidelines/design-antipatterns.md +6 -1
  481. package/docs/guidelines/design-asset-discipline.md +17 -0
  482. package/docs/guidelines/design-fidelity-routing.md +1 -0
  483. package/docs/guidelines/php/api-design.md +10 -1
  484. package/llms.txt +12 -10
  485. package/package.json +15 -5
  486. package/src/agent-src/scripts/dashboard_mode.ts +4 -1
  487. package/src/agent-src/scripts/roadmap_age.ts +175 -0
  488. package/src/agent-src/scripts/update_roadmap_progress.ts +10 -2
  489. package/src/agent-src/templates/AGENTS.md +1 -1
  490. package/src/agent-src/templates/scripts/check_memory.ts +2 -2
  491. package/src/agent-src/templates/scripts/historical-bug-patterns.example.yml +13 -1
  492. package/src/agent-src/templates/scripts/work_engine/cli.ts +17 -0
  493. package/src/agent-src/templates/scripts/work_engine/cli_args.ts +10 -0
  494. package/src/agent-src/templates/scripts/work_engine/directives/ui/scaffold.ts +22 -13
  495. package/src/agent-src/templates/scripts/work_engine/dispatcher.ts +18 -4
  496. package/src/agent-src/templates/scripts/work_engine/procedure/checks.ts +283 -0
  497. package/src/agent-src/templates/scripts/work_engine/procedure/run.ts +432 -0
  498. package/src/agent-src/templates/scripts/work_engine/procedure/sidecar.ts +185 -0
  499. package/src/agent-src/templates/scripts/work_engine/state.ts +3 -0
  500. package/src/config/agent-settings.template.yml +120 -57
  501. package/src/config/agents-paths.yml +13 -7
  502. package/src/config/ci-local-parity.yml +44 -0
  503. package/src/config/continuity-surface.json +51 -2
  504. package/src/config/depth-audit-samples.json +5 -0
  505. package/src/config/discovery/command-verbs.yml +1 -0
  506. package/src/config/dispatch-economy-metrics.json +1 -0
  507. package/src/config/egress-mutations/class-precedence-swapped.json +7 -0
  508. package/src/config/egress-mutations/credential-token-restores.json +7 -0
  509. package/src/config/egress-mutations/iban-checksum-disabled.json +7 -0
  510. package/src/config/egress-mutations/raw-value-in-the-count-record.json +7 -0
  511. package/src/config/evaluator-budgets.json +4 -4
  512. package/src/config/gate-coverage.yml +149 -3
  513. package/src/config/gate-reachability-exemptions.json +3 -5
  514. package/src/config/gate-violation-baselines.json +29 -25
  515. package/src/config/gitignore-block.txt +6 -3
  516. package/src/config/hook-bundle-budget.json +34 -3
  517. package/src/config/hook-carrier-probes.json +30 -0
  518. package/src/config/hook-latency-budget.json +4 -2
  519. package/src/config/host-injection-effect.json +8 -1
  520. package/src/config/host-skill-frontmatter-keys.json +56 -0
  521. package/src/config/layer-form-brakes.json +4 -0
  522. package/src/config/layer-form-comparison-corpus.json +42 -0
  523. package/src/config/loop-surfaces.yaml +28 -47
  524. package/src/config/memory-twin-verdicts.yml +9 -1
  525. package/src/config/metric-registry.yml +40 -3
  526. package/src/config/pack-size-budget.json +15 -0
  527. package/src/config/procedure-core-budget.json +21 -0
  528. package/src/config/profiles/minimal.ini +1 -1
  529. package/src/config/project-tree-form.json +24 -0
  530. package/src/config/reach-channels.yml +3 -3
  531. package/src/config/reach-prescriptions-intake.yml +1 -1
  532. package/src/config/roadmap-step-size-baseline.json +118 -0
  533. package/src/config/routing-coverage-seed.json +100 -2
  534. package/src/config/skill-body-budget.json +686 -0
  535. package/src/config/skill-fork-pilot.json +17 -0
  536. package/src/config/skill-lifecycle-probes-codex.json +57 -0
  537. package/src/config/skill-lifecycle-probes.json +57 -0
  538. package/src/config/skill-output-shape.json +316 -0
  539. package/src/config/step-depth-table.json +58 -0
  540. package/src/config/turnaround-budget.json +90 -0
  541. package/src/install/conflict.ts +38 -6
  542. package/src/install/conflictTracker.ts +126 -8
  543. package/src/install/detect.ts +3 -3
  544. package/src/install/hostPermissionsAdapter.ts +136 -0
  545. package/src/install/installThinLayer.ts +6 -1
  546. package/src/install/manifestFiles.ts +24 -0
  547. package/src/install/noGoDenyRows.ts +368 -0
  548. package/src/install/noGoRules.ts +438 -0
  549. package/src/install/ownershipLedger.ts +180 -0
  550. package/src/install/plan.ts +1 -1
  551. package/src/install/preflight.ts +42 -10
  552. package/src/install/preserve.ts +94 -12
  553. package/src/install/recordedOwnership.ts +121 -3
  554. package/src/install/rule_scope.ts +20 -3
  555. package/src/install/stagedRuntime.ts +528 -0
  556. package/src/install/toolsArg.ts +16 -0
  557. package/src/install/types.ts +23 -2
  558. package/src/install/userPin.ts +54 -0
  559. package/src/install/wizard-plan.ts +25 -4
  560. package/src/scripts/_cli/_doctor_emit.ts +24 -0
  561. package/src/scripts/_cli/cmd_brand_status.ts +223 -12
  562. package/src/scripts/_cli/cmd_ci_settle.ts +32 -0
  563. package/src/scripts/_cli/cmd_doctor.ts +23 -44
  564. package/src/scripts/_cli/cmd_route_explain.ts +176 -2
  565. package/src/scripts/_cli/cmd_uninstall.ts +270 -26
  566. package/src/scripts/_cli/cmd_update.ts +34 -1
  567. package/src/scripts/_cli/cmd_upgrade.ts +38 -2
  568. package/src/scripts/_cli/detection_report.ts +7 -0
  569. package/src/scripts/_cli/doctor_execution.ts +1 -2
  570. package/src/scripts/_cli/doctor_install_mode.ts +39 -0
  571. package/src/scripts/_cli/doctor_network_posture.ts +3 -3
  572. package/src/scripts/_cli/doctor_ownership_ledger.ts +126 -0
  573. package/src/scripts/_cli/doctor_update_verdict.ts +104 -0
  574. package/src/scripts/_cli/explain_last/scrubber.ts +9 -21
  575. package/src/scripts/_cli/upgrade_unattended.ts +548 -0
  576. package/src/scripts/_dispatch.bash +42 -9
  577. package/src/scripts/_lib/activation_ladder.ts +1 -1
  578. package/src/scripts/_lib/advisory_inventory.ts +405 -0
  579. package/src/scripts/_lib/advisory_notice.ts +270 -0
  580. package/src/scripts/_lib/advisory_sources.ts +752 -0
  581. package/src/scripts/_lib/advisory_verdicts.ts +363 -0
  582. package/src/scripts/_lib/agent_artifact_location.ts +177 -0
  583. package/src/scripts/_lib/agent_settings.ts +7 -12
  584. package/src/scripts/_lib/arrival_record.ts +217 -0
  585. package/src/scripts/_lib/asset_render_record.ts +247 -0
  586. package/src/scripts/_lib/billing_grant.ts +4 -2
  587. package/src/scripts/_lib/brand_voice_slot.ts +258 -0
  588. package/src/scripts/_lib/canary_status.ts +24 -0
  589. package/src/scripts/_lib/cc_transcript.ts +276 -0
  590. package/src/scripts/_lib/changelog_eras.ts +83 -0
  591. package/src/scripts/_lib/claim_phrases.ts +71 -0
  592. package/src/scripts/_lib/classify_update.ts +171 -0
  593. package/src/scripts/_lib/claude_builtin_names.ts +9 -4
  594. package/src/scripts/_lib/claude_hook_scope.ts +195 -0
  595. package/src/scripts/_lib/claude_settings_hooks.ts +118 -34
  596. package/src/scripts/_lib/codex_resident_set.ts +460 -0
  597. package/src/scripts/_lib/codex_skill_finder.ts +225 -0
  598. package/src/scripts/_lib/confusables.ts +19 -0
  599. package/src/scripts/_lib/consumer_impact.ts +199 -0
  600. package/src/scripts/_lib/content_class.ts +127 -0
  601. package/src/scripts/_lib/counted_probe.ts +68 -1
  602. package/src/scripts/_lib/credential_deny_rows.ts +151 -0
  603. package/src/scripts/_lib/credential_files.ts +367 -0
  604. package/src/scripts/_lib/delivery_arm_experiment.ts +2 -2
  605. package/src/scripts/_lib/depth_flip.ts +141 -0
  606. package/src/scripts/_lib/design_lock.ts +117 -0
  607. package/src/scripts/_lib/design_sync_ledger.ts +142 -0
  608. package/src/scripts/_lib/design_sync_plan.ts +177 -0
  609. package/src/scripts/_lib/design_sync_reconcile.ts +159 -0
  610. package/src/scripts/_lib/design_sync_verify.ts +99 -0
  611. package/src/scripts/_lib/design_system_claude_design.ts +323 -0
  612. package/src/scripts/_lib/design_system_import.ts +84 -6
  613. package/src/scripts/_lib/dispatch_import_closure.ts +42 -11
  614. package/src/scripts/_lib/egress_credential_env.ts +35 -0
  615. package/src/scripts/_lib/egress_engine.ts +22 -0
  616. package/src/scripts/_lib/egress_known_values.ts +223 -0
  617. package/src/scripts/_lib/egress_normalize.ts +67 -0
  618. package/src/scripts/_lib/egress_prefixes.ts +42 -0
  619. package/src/scripts/_lib/egress_rules.ts +896 -0
  620. package/src/scripts/_lib/egress_rules_linearity.ts +56 -0
  621. package/src/scripts/_lib/egress_sender_scan.ts +290 -0
  622. package/src/scripts/_lib/egress_session_table.ts +510 -0
  623. package/src/scripts/_lib/egress_text.ts +63 -0
  624. package/src/scripts/_lib/egress_token.ts +252 -0
  625. package/src/scripts/_lib/empty_cycles.ts +1 -1
  626. package/src/scripts/_lib/environment_detector.ts +45 -30
  627. package/src/scripts/_lib/exemption_shape.ts +75 -1
  628. package/src/scripts/_lib/floor_posture.ts +185 -0
  629. package/src/scripts/_lib/forge_protection.ts +140 -2
  630. package/src/scripts/_lib/global_deploy_inventory.ts +159 -6
  631. package/src/scripts/_lib/guidelines_lane.ts +12 -1
  632. package/src/scripts/_lib/hand_kinds.ts +65 -0
  633. package/src/scripts/_lib/headless_invocation.ts +3 -3
  634. package/src/scripts/_lib/host_capability.ts +34 -2
  635. package/src/scripts/_lib/host_env_write.ts +39 -18
  636. package/src/scripts/_lib/host_listing_model.ts +14 -7
  637. package/src/scripts/_lib/identifier_redaction.ts +26 -0
  638. package/src/scripts/_lib/impact_bump.ts +70 -0
  639. package/src/scripts/_lib/install_reach_checks.ts +53 -1
  640. package/src/scripts/_lib/installed_layer.ts +31 -0
  641. package/src/scripts/_lib/installed_layer_normalise.ts +75 -0
  642. package/src/scripts/_lib/instructions_loaded_classify.ts +75 -0
  643. package/src/scripts/_lib/instructions_loaded_event.ts +53 -0
  644. package/src/scripts/_lib/knowledge_global_redaction.ts +2 -2
  645. package/src/scripts/_lib/layer_form_corpus.ts +165 -0
  646. package/src/scripts/_lib/layer_form_decision.ts +248 -0
  647. package/src/scripts/_lib/layer_form_evidence.ts +112 -0
  648. package/src/scripts/_lib/lean_projection_mode.ts +32 -161
  649. package/src/scripts/_lib/llm_proposer_transport.ts +1 -0
  650. package/src/scripts/_lib/loop_guards.ts +8 -120
  651. package/src/scripts/_lib/major_surface.ts +207 -0
  652. package/src/scripts/_lib/mcp_bridge.ts +30 -69
  653. package/src/scripts/_lib/merge_clearance_record.ts +384 -0
  654. package/src/scripts/_lib/neighbour_census.ts +18 -1
  655. package/src/scripts/_lib/orchestration_record.ts +61 -0
  656. package/src/scripts/_lib/outcome_vocabularies.ts +15 -23
  657. package/src/scripts/_lib/pin_advice.ts +49 -0
  658. package/src/scripts/_lib/platform_anchor.ts +222 -0
  659. package/src/scripts/_lib/procedure_checks.ts +5 -0
  660. package/src/scripts/_lib/project_tree_form.ts +134 -0
  661. package/src/scripts/_lib/projection_key_migration.ts +122 -0
  662. package/src/scripts/_lib/prompt_shape.ts +13 -2
  663. package/src/scripts/_lib/provenance_verify.ts +272 -0
  664. package/src/scripts/_lib/quota_parked.ts +27 -1
  665. package/src/scripts/_lib/ratification_artifact.ts +64 -1
  666. package/src/scripts/_lib/ratification_subject.ts +508 -46
  667. package/src/scripts/_lib/release_findings_ingest.ts +52 -5
  668. package/src/scripts/_lib/release_highlights.ts +72 -2
  669. package/src/scripts/_lib/release_settings_surface.ts +392 -0
  670. package/src/scripts/_lib/review_round.ts +134 -0
  671. package/src/scripts/_lib/roadmap_checkboxes.ts +1 -1
  672. package/src/scripts/_lib/roadmap_slug_lock.ts +254 -0
  673. package/src/scripts/_lib/roadmap_step_size.ts +75 -0
  674. package/src/scripts/_lib/run_checkpoint.ts +60 -3
  675. package/src/scripts/_lib/runtime_wiring_checks.ts +15 -1
  676. package/src/scripts/_lib/scope_guard.sh +64 -5
  677. package/src/scripts/_lib/scoped_projection.ts +136 -3
  678. package/src/scripts/_lib/secret_detector.ts +24 -103
  679. package/src/scripts/_lib/security_fix.ts +429 -0
  680. package/src/scripts/_lib/security_fix_context.ts +133 -0
  681. package/src/scripts/_lib/self_repair.ts +69 -39
  682. package/src/scripts/_lib/self_repair_outgoing.ts +209 -0
  683. package/src/scripts/_lib/self_repair_payload.ts +86 -0
  684. package/src/scripts/_lib/session_eol.ts +3 -0
  685. package/src/scripts/_lib/session_pr_watch.ts +207 -0
  686. package/src/scripts/_lib/session_register.ts +51 -1
  687. package/src/scripts/_lib/session_tag.ts +51 -0
  688. package/src/scripts/_lib/settings_removed_keys.ts +30 -0
  689. package/src/scripts/_lib/settings_renamed_keys.ts +19 -5
  690. package/src/scripts/_lib/skill_catalogue.ts +66 -25
  691. package/src/scripts/_lib/skill_fork_pilot.ts +121 -0
  692. package/src/scripts/_lib/skill_leases.ts +203 -0
  693. package/src/scripts/_lib/skill_listing_overrides.ts +294 -0
  694. package/src/scripts/_lib/skill_materialisation.ts +388 -0
  695. package/src/scripts/_lib/skill_materialisation_gate.ts +210 -0
  696. package/src/scripts/_lib/skill_materialisation_lock.ts +149 -0
  697. package/src/scripts/_lib/skill_materialisation_triggers.ts +96 -0
  698. package/src/scripts/_lib/skill_origin.ts +21 -1
  699. package/src/scripts/_lib/skill_reach.ts +342 -0
  700. package/src/scripts/_lib/source_shape.ts +7 -2
  701. package/src/scripts/_lib/sqlite_guard.ts +1 -1
  702. package/src/scripts/_lib/step_anatomy.ts +330 -0
  703. package/src/scripts/_lib/subagent_capsule.ts +8 -2
  704. package/src/scripts/_lib/subagent_native_fields.ts +30 -0
  705. package/src/scripts/_lib/subagent_spawn.ts +36 -0
  706. package/src/scripts/_lib/subagent_steering.ts +367 -0
  707. package/src/scripts/_lib/svg_dom.ts +318 -0
  708. package/src/scripts/_lib/svg_filled_counter.ts +287 -0
  709. package/src/scripts/_lib/svg_geometry.ts +480 -0
  710. package/src/scripts/_lib/svg_motion.ts +208 -0
  711. package/src/scripts/_lib/svg_rules.ts +1455 -0
  712. package/src/scripts/_lib/svg_urls.ts +72 -0
  713. package/src/scripts/_lib/test_delta.ts +89 -6
  714. package/src/scripts/_lib/tier_downshift_verdict.ts +222 -0
  715. package/src/scripts/_lib/tool_result_census.ts +62 -0
  716. package/src/scripts/_lib/trigger_routers.ts +1 -0
  717. package/src/scripts/_lib/turnaround_throughput.ts +378 -0
  718. package/src/scripts/_lib/ui_surface.ts +22 -0
  719. package/src/scripts/_lib/unattended_gates.ts +100 -0
  720. package/src/scripts/_lib/undeployed_fixes.ts +34 -0
  721. package/src/scripts/_lib/update_check.ts +143 -12
  722. package/src/scripts/_lib/update_invite.ts +116 -0
  723. package/src/scripts/_lib/update_notice.ts +259 -0
  724. package/src/scripts/_lib/verification_command.ts +59 -0
  725. package/src/scripts/_lib/verify_clause.ts +31 -19
  726. package/src/scripts/_lib/version_order.ts +146 -0
  727. package/src/scripts/_lib/worker_reuse.ts +191 -0
  728. package/src/scripts/_lib/workspace_secrets.ts +273 -0
  729. package/src/scripts/_lib/worktree_git.ts +67 -0
  730. package/src/scripts/_lib/worktree_ignored.ts +116 -0
  731. package/src/scripts/adoption_status.ts +330 -3
  732. package/src/scripts/adr_cite_check.ts +93 -0
  733. package/src/scripts/advisories.ts +803 -0
  734. package/src/scripts/ai-image/adapters/flux.sh +1 -0
  735. package/src/scripts/ai-image/adapters/gemini-image.sh +1 -0
  736. package/src/scripts/ai-image/adapters/ideogram.sh +1 -0
  737. package/src/scripts/ai-image/adapters/recraft.sh +1 -0
  738. package/src/scripts/ai-video/adapters/comfyui.sh +1 -0
  739. package/src/scripts/ai-video/adapters/fal.sh +1 -0
  740. package/src/scripts/ai-video/adapters/gemini-veo.sh +1 -0
  741. package/src/scripts/ai-video/adapters/higgsfield.sh +1 -0
  742. package/src/scripts/ai-video/adapters/kling.sh +1 -0
  743. package/src/scripts/ai-video/adapters/musetalk.sh +1 -0
  744. package/src/scripts/ai-video/adapters/openai-images.sh +1 -0
  745. package/src/scripts/ai-video/adapters/replicate.sh +1 -0
  746. package/src/scripts/ai-video/adapters/sora.sh +1 -0
  747. package/src/scripts/ai-video/adapters/syncso.sh +1 -0
  748. package/src/scripts/ai-video/stitch.sh +115 -2
  749. package/src/scripts/ai_council/airgap.ts +1 -0
  750. package/src/scripts/ai_council/api_transport.ts +27 -4
  751. package/src/scripts/ai_council/budget_guard.ts +300 -11
  752. package/src/scripts/ai_council/bundler.ts +20 -29
  753. package/src/scripts/ai_council/chairman.ts +17 -2
  754. package/src/scripts/ai_council/cli_agency_bounds.ts +158 -0
  755. package/src/scripts/ai_council/cli_launch_env.ts +54 -0
  756. package/src/scripts/ai_council/cli_least_agency_canary.ts +18 -2
  757. package/src/scripts/ai_council/clients.ts +55 -73
  758. package/src/scripts/ai_council/config.ts +16 -22
  759. package/src/scripts/ai_council/council_egress.ts +167 -0
  760. package/src/scripts/ai_council/exposure_ledger.ts +117 -0
  761. package/src/scripts/ai_council/free_hand_shadow.ts +276 -0
  762. package/src/scripts/ai_council/free_route.ts +216 -0
  763. package/src/scripts/ai_council/free_route_catalog.ts +173 -0
  764. package/src/scripts/ai_council/free_route_client.ts +95 -0
  765. package/src/scripts/ai_council/free_rung.ts +61 -0
  766. package/src/scripts/ai_council/hand_payload.ts +230 -0
  767. package/src/scripts/ai_council/hand_schemas.ts +123 -0
  768. package/src/scripts/ai_council/jury_aggregate.ts +155 -1
  769. package/src/scripts/ai_council/kind_flip.ts +221 -0
  770. package/src/scripts/ai_council/kind_flip_state.ts +19 -0
  771. package/src/scripts/ai_council/learn_low_impact_preview.ts +50 -22
  772. package/src/scripts/ai_council/modification_review.ts +98 -5
  773. package/src/scripts/ai_council/necessity.ts +7 -0
  774. package/src/scripts/ai_council/orchestrator.ts +16 -16
  775. package/src/scripts/ai_council/pricing.ts +10 -0
  776. package/src/scripts/ai_council/redact_low_impact_entry.ts +5 -2
  777. package/src/scripts/ai_council/response_render.ts +27 -4
  778. package/src/scripts/ai_council/round_reservations.ts +119 -0
  779. package/src/scripts/ai_council/route_chooser.ts +161 -0
  780. package/src/scripts/ai_council/route_liveness.ts +152 -0
  781. package/src/scripts/ai_council/route_member.ts +52 -0
  782. package/src/scripts/ai_council/seat_policy.ts +40 -0
  783. package/src/scripts/ai_council/seat_resume.ts +40 -0
  784. package/src/scripts/ai_council/shadow_dispatch.ts +13 -3
  785. package/src/scripts/ai_council/spend_gate.ts +18 -2
  786. package/src/scripts/ai_council/status_surface.ts +37 -0
  787. package/src/scripts/ai_council/transport_resolver.ts +15 -18
  788. package/src/scripts/analysis_analysts.ts +226 -0
  789. package/src/scripts/analysis_anchors.ts +140 -0
  790. package/src/scripts/analysis_and_optimize.ts +44 -0
  791. package/src/scripts/analysis_emit.ts +150 -0
  792. package/src/scripts/analysis_exchange.ts +186 -0
  793. package/src/scripts/analysis_gate.ts +158 -0
  794. package/src/scripts/analysis_inbox_final.ts +173 -0
  795. package/src/scripts/analysis_ledger.ts +119 -0
  796. package/src/scripts/analysis_pr_optimize.ts +219 -0
  797. package/src/scripts/analysis_pr_review.ts +240 -0
  798. package/src/scripts/analysis_pr_target.ts +121 -0
  799. package/src/scripts/analysis_prompts.ts +130 -0
  800. package/src/scripts/analysis_publish.ts +358 -0
  801. package/src/scripts/analysis_questions.ts +78 -0
  802. package/src/scripts/analysis_run.ts +248 -0
  803. package/src/scripts/analysis_run_record.ts +210 -0
  804. package/src/scripts/analysis_target.ts +343 -0
  805. package/src/scripts/analysis_validate.ts +161 -0
  806. package/src/scripts/anchor_eval_falsify.ts +1 -1
  807. package/src/scripts/arrival_report.ts +115 -0
  808. package/src/scripts/ask_transport.ts +284 -35
  809. package/src/scripts/backfill_model_tier.ts +4 -5
  810. package/src/scripts/before_complete_hook.ts +48 -2
  811. package/src/scripts/bench_hook_latency.ts +3 -3
  812. package/src/scripts/bench_procedure_cursor.ts +440 -0
  813. package/src/scripts/bootstrap.sh +3 -3
  814. package/src/scripts/build_exit_code_register.ts +440 -0
  815. package/src/scripts/build_proof.ts +23 -1
  816. package/src/scripts/cache_realization_report.ts +155 -14
  817. package/src/scripts/canary_liveness.ts +117 -0
  818. package/src/scripts/chat_history.ts +12 -15
  819. package/src/scripts/check_account_surface.ts +318 -0
  820. package/src/scripts/check_agent_artifact_location.ts +17 -160
  821. package/src/scripts/check_bundle_path_leakage.ts +6 -0
  822. package/src/scripts/check_ci_local_parity.ts +21 -13
  823. package/src/scripts/check_claims.ts +77 -2
  824. package/src/scripts/check_completion_review.ts +34 -1
  825. package/src/scripts/check_concern_admissions.ts +41 -5
  826. package/src/scripts/check_consumer_scope_flip.ts +1 -1
  827. package/src/scripts/check_context_paths.ts +2 -0
  828. package/src/scripts/check_council_layout.ts +9 -0
  829. package/src/scripts/check_credential_spelling.ts +267 -0
  830. package/src/scripts/check_egress_mutations.ts +239 -0
  831. package/src/scripts/check_enforcement_coverage.ts +16 -3
  832. package/src/scripts/check_estate_count.ts +16 -1
  833. package/src/scripts/check_finding_dispositions.ts +147 -0
  834. package/src/scripts/check_gate_coverage.ts +123 -21
  835. package/src/scripts/check_gate_reachability.ts +16 -2
  836. package/src/scripts/check_generator_sync.ts +46 -0
  837. package/src/scripts/check_hook_bundle_composition.ts +139 -1
  838. package/src/scripts/check_host_docs_digest.ts +142 -5
  839. package/src/scripts/check_kernel_edit_ratified.ts +301 -76
  840. package/src/scripts/check_kernel_rule_bundle.ts +14 -10
  841. package/src/scripts/check_knowledge_cards.ts +83 -3
  842. package/src/scripts/check_memory.ts +13 -3
  843. package/src/scripts/check_pack_size.ts +1 -1
  844. package/src/scripts/check_permission_deny_syntax.ts +247 -0
  845. package/src/scripts/check_platform_anchor.ts +243 -0
  846. package/src/scripts/check_proposal.ts +183 -1
  847. package/src/scripts/check_reach_channels.ts +5 -3
  848. package/src/scripts/check_references.ts +5 -2
  849. package/src/scripts/check_release_manifest_content.ts +33 -0
  850. package/src/scripts/check_release_pr_shape.ts +5 -0
  851. package/src/scripts/check_rule_invariants.ts +9 -1
  852. package/src/scripts/check_skill_body_budget.ts +343 -0
  853. package/src/scripts/check_skill_requires.ts +137 -1
  854. package/src/scripts/check_step_receipts.ts +246 -0
  855. package/src/scripts/check_structural_breaking.ts +7 -1
  856. package/src/scripts/check_suppression_hygiene.ts +8 -0
  857. package/src/scripts/check_test_weakening.ts +14 -0
  858. package/src/scripts/check_token_quality_golden.ts +5 -1
  859. package/src/scripts/check_update_banner.ts +50 -3
  860. package/src/scripts/check_verify_expectation_delta.ts +2 -1
  861. package/src/scripts/check_voice_lexicon.ts +531 -0
  862. package/src/scripts/ci_os_attribution.ts +327 -0
  863. package/src/scripts/ci_platform_scope.ts +69 -0
  864. package/src/scripts/ci_settle.ts +4 -1
  865. package/src/scripts/ci_status.ts +0 -1
  866. package/src/scripts/ci_time_to_green.ts +748 -0
  867. package/src/scripts/classify_merge_risk.ts +407 -19
  868. package/src/scripts/code_graph/sqlite_store.ts +1 -1
  869. package/src/scripts/compile_trigger_evals.ts +353 -0
  870. package/src/scripts/condense.ts +25 -31
  871. package/src/scripts/consumer_matrix.ts +61 -3
  872. package/src/scripts/council_availability_hook.ts +12 -4
  873. package/src/scripts/council_cli.ts +48 -38
  874. package/src/scripts/cross_repo_retrieve.ts +9 -72
  875. package/src/scripts/design_lock.ts +106 -0
  876. package/src/scripts/design_slop_rules.ts +30 -0
  877. package/src/scripts/design_sync.ts +264 -0
  878. package/src/scripts/design_system_import.ts +30 -13
  879. package/src/scripts/dispatch_economy_report.ts +46 -1
  880. package/src/scripts/dispatch_r2_reviewer.ts +41 -5
  881. package/src/scripts/egress_canary.ts +166 -0
  882. package/src/scripts/egress_sender_census.ts +101 -0
  883. package/src/scripts/external_sources_denylist.json +94 -12
  884. package/src/scripts/generate_catalog.ts +6 -2
  885. package/src/scripts/generate_owned_digest.ts +163 -0
  886. package/src/scripts/generate_reference_toc.ts +143 -0
  887. package/src/scripts/generate_subagent_floor.ts +11 -1
  888. package/src/scripts/handoff_context_hook.ts +34 -0
  889. package/src/scripts/hook_carrier_census.ts +263 -0
  890. package/src/scripts/hook_chunks.d.mts +12 -0
  891. package/src/scripts/hook_chunks.mjs +114 -0
  892. package/src/scripts/hook_manifest.json +1 -1
  893. package/src/scripts/hook_manifest.yaml +65 -42
  894. package/src/scripts/hooks/block_config_weakening.ts +127 -3
  895. package/src/scripts/hooks/block_credential_reads.ts +165 -0
  896. package/src/scripts/hooks/block_no_verify.ts +47 -23
  897. package/src/scripts/hooks/block_speaking_inbox_dir.ts +54 -8
  898. package/src/scripts/hooks/category_a.ts +202 -25
  899. package/src/scripts/hooks/concern_failure_policy.ts +6 -6
  900. package/src/scripts/hooks/concern_registry.ts +31 -6
  901. package/src/scripts/hooks/concern_registry_types.ts +11 -0
  902. package/src/scripts/hooks/delegation_nudge_hook.ts +105 -15
  903. package/src/scripts/hooks/design_pass_hook.ts +199 -13
  904. package/src/scripts/hooks/dispatch_hook.ts +13 -12
  905. package/src/scripts/hooks/egress_engine_loader.ts +125 -0
  906. package/src/scripts/hooks/egress_stage.ts +440 -0
  907. package/src/scripts/hooks/hook_stdin.ts +29 -4
  908. package/src/scripts/hooks/host_docs_pages.ts +194 -0
  909. package/src/scripts/hooks/host_docs_pages.yaml +75 -0
  910. package/src/scripts/hooks/host_lowering.json +1 -1
  911. package/src/scripts/hooks/host_lowering.yaml +22 -21
  912. package/src/scripts/hooks/host_rate_marker_hook.ts +73 -0
  913. package/src/scripts/hooks/instructions_observer_hook.ts +170 -0
  914. package/src/scripts/hooks/interruption_ledger_hook.ts +1 -1
  915. package/src/scripts/hooks/lazy_concern.ts +148 -0
  916. package/src/scripts/hooks/orchestration_record_hook.ts +80 -2
  917. package/src/scripts/hooks/payload_stub.ts +16 -6
  918. package/src/scripts/hooks/permission_gate.ts +7 -7
  919. package/src/scripts/hooks/push_settle_hook.ts +32 -3
  920. package/src/scripts/hooks/replay_hook.ts +43 -0
  921. package/src/scripts/hooks/reread_guard_hook.ts +87 -10
  922. package/src/scripts/hooks/rtk_wrap_hook.ts +4 -3
  923. package/src/scripts/hooks/rule_inject_hook.ts +8 -1
  924. package/src/scripts/hooks/session_eol_hook.ts +48 -1
  925. package/src/scripts/hooks/source_first_gate_hook.ts +6 -8
  926. package/src/scripts/hooks/spawn_guard_shadow_hook.ts +203 -10
  927. package/src/scripts/hooks/state_io.ts +2 -2
  928. package/src/scripts/hooks/svg_obligation.ts +553 -0
  929. package/src/scripts/hooks/svg_rules_loader.ts +133 -0
  930. package/src/scripts/hooks/tool_result_bytes_hook.ts +14 -5
  931. package/src/scripts/hooks/turn_end_gate_hook.ts +5 -3
  932. package/src/scripts/hooks/ui_route_nudge_hook.ts +2 -12
  933. package/src/scripts/hooks_doctor.ts +31 -0
  934. package/src/scripts/hooks_status.ts +58 -3
  935. package/src/scripts/inbox_source_census.ts +74 -13
  936. package/src/scripts/install +25 -3
  937. package/src/scripts/install.ts +60 -91
  938. package/src/scripts/interruption_report.ts +11 -1
  939. package/src/scripts/layer_baseline_report.ts +267 -0
  940. package/src/scripts/learning_sidecar.ts +1 -1
  941. package/src/scripts/lint_agents_layout.ts +3 -0
  942. package/src/scripts/lint_blocker_citations.ts +104 -0
  943. package/src/scripts/lint_breaking_changes_index.ts +40 -7
  944. package/src/scripts/lint_consolidation_lineage.ts +150 -19
  945. package/src/scripts/lint_consumer_internal_refs.ts +90 -42
  946. package/src/scripts/lint_context_spine_usage.ts +21 -0
  947. package/src/scripts/lint_design_antipattern_parity.ts +39 -7
  948. package/src/scripts/lint_design_quality.ts +60 -12
  949. package/src/scripts/lint_evidence_artifacts.ts +31 -0
  950. package/src/scripts/lint_example_fences.ts +11 -2
  951. package/src/scripts/lint_ghostwriter_source.ts +42 -10
  952. package/src/scripts/lint_hook_manifest.ts +94 -0
  953. package/src/scripts/lint_marketplace_install_completeness.ts +4 -0
  954. package/src/scripts/lint_mcp_config_security.ts +9 -11
  955. package/src/scripts/lint_motion_authority_drift.ts +27 -0
  956. package/src/scripts/lint_plan_risk_register.ts +28 -1
  957. package/src/scripts/lint_positioning.ts +4 -4
  958. package/src/scripts/lint_provenance.ts +1 -0
  959. package/src/scripts/lint_roadmap_blockers.ts +65 -4
  960. package/src/scripts/lint_roadmap_complexity.ts +98 -0
  961. package/src/scripts/lint_skill_link_reach.ts +251 -9
  962. package/src/scripts/lint_skill_procedures.ts +252 -0
  963. package/src/scripts/lint_skill_scripts_readonly.ts +12 -1
  964. package/src/scripts/lint_subagent_determinism.ts +14 -1
  965. package/src/scripts/lint_svg_asset.ts +365 -0
  966. package/src/scripts/lint_ticked_unmet_criteria.ts +300 -21
  967. package/src/scripts/mcp_registry_submit.sh +2 -2
  968. package/src/scripts/mcp_server/consumer_tool_catalog.json +4 -4
  969. package/src/scripts/mcp_server/suggest_skill.ts +89 -4
  970. package/src/scripts/mcp_server/tools.ts +2 -33
  971. package/src/scripts/measure_skill_ranker_baseline.ts +203 -5
  972. package/src/scripts/measure_turn_end_gate.ts +61 -1
  973. package/src/scripts/merge_clearance.ts +225 -0
  974. package/src/scripts/migrate_command_suggestions.ts +1 -1
  975. package/src/scripts/network_sources.ts +236 -0
  976. package/src/scripts/no_go_deny_rows.ts +225 -0
  977. package/src/scripts/orchestration_record.ts +15 -2
  978. package/src/scripts/plan_test_shards.ts +103 -0
  979. package/src/scripts/pr_url_reminder_hook.ts +10 -0
  980. package/src/scripts/print_required_checks.ts +5 -5
  981. package/src/scripts/probe_depth_shadow.ts +406 -0
  982. package/src/scripts/probe_turnaround.ts +342 -10
  983. package/src/scripts/ratification_subject.ts +176 -0
  984. package/src/scripts/rdp_gate_classify.ts +1 -0
  985. package/src/scripts/rdp_quality_eval.ts +1 -0
  986. package/src/scripts/release.ts +26 -55
  987. package/src/scripts/release_drill.ts +52 -23
  988. package/src/scripts/release_env.ts +37 -0
  989. package/src/scripts/release_publication.ts +11 -1
  990. package/src/scripts/report_consumer_gate_reach.ts +233 -0
  991. package/src/scripts/report_merge_gate_load.ts +295 -0
  992. package/src/scripts/report_project_contract.ts +123 -0
  993. package/src/scripts/report_reducible_classes.ts +342 -0
  994. package/src/scripts/report_required_checks_drift.ts +5 -3
  995. package/src/scripts/report_skill_host_census.ts +199 -0
  996. package/src/scripts/report_standing_payload_by_host.ts +7 -7
  997. package/src/scripts/retro.ts +758 -0
  998. package/src/scripts/retro_facts.ts +575 -0
  999. package/src/scripts/retro_queue.ts +739 -0
  1000. package/src/scripts/retro_session_facts.ts +218 -0
  1001. package/src/scripts/retro_sweep.ts +493 -0
  1002. package/src/scripts/retro_triage.ts +126 -0
  1003. package/src/scripts/roadmap_context.ts +2 -2
  1004. package/src/scripts/roadmap_drain_queue.ts +601 -0
  1005. package/src/scripts/run_supervise.ts +24 -2
  1006. package/src/scripts/schemas/agent-settings.schema.json +0 -16
  1007. package/src/scripts/schemas/command.schema.json +3 -3
  1008. package/src/scripts/schemas/review-findings.schema.json +8 -0
  1009. package/src/scripts/schemas/skill.schema.json +7 -6
  1010. package/src/scripts/schemas/subagent.schema.json +33 -2
  1011. package/src/scripts/score_skill_selection.ts +5 -2
  1012. package/src/scripts/second_brain_retrieval.ts +1 -0
  1013. package/src/scripts/second_brain_run.ts +1 -0
  1014. package/src/scripts/self_repair_cli.ts +563 -87
  1015. package/src/scripts/self_review_gate.ts +59 -4
  1016. package/src/scripts/session_register_hook.ts +91 -4
  1017. package/src/scripts/sessions_cli.ts +100 -5
  1018. package/src/scripts/skill_collision_clusters.ts +1 -1
  1019. package/src/scripts/skill_tools/score_skill_relevance.ts +31 -2
  1020. package/src/scripts/skill_trigger_eval.ts +4 -2
  1021. package/src/scripts/source_adapters.ts +183 -0
  1022. package/src/scripts/step_receipt.ts +100 -0
  1023. package/src/scripts/sync_pr_branch.ts +4 -0
  1024. package/src/scripts/test_council_qualification.ts +1 -1
  1025. package/src/scripts/trigger_eval_grandfather.json +3 -49
  1026. package/src/scripts/trigger_eval_rotation.ts +31 -3
  1027. package/src/scripts/ui_conformance_probe.ts +405 -1
  1028. package/src/scripts/update_counts.ts +230 -11
  1029. package/src/scripts/update_invite_hook.ts +245 -0
  1030. package/src/scripts/update_notice_hook.ts +298 -0
  1031. package/src/scripts/validate_frontmatter.ts +85 -0
  1032. package/src/scripts/worker_reuse_shadow_report.ts +121 -0
  1033. package/src/scripts/worktree_cleanup_check.ts +915 -121
  1034. package/src/server/io/yamlIO.ts +2 -2
  1035. package/src/server/schemas/settings.ts +37 -23
  1036. package/src/shared/brandTokenDocument.ts +46 -0
  1037. package/src/shared/brandTokenPaths.ts +43 -0
  1038. package/src/shared/settingsCarveOut.ts +0 -8
  1039. package/src/shared/skillRanking.ts +106 -5
  1040. package/src/shared/userMd/formAdapter.ts +15 -1
  1041. package/src/shared/userMd/schema.ts +22 -0
  1042. package/src/templates/agent-user.md +4 -0
  1043. package/src/templates/agent-user.yml +4 -0
  1044. package/dist/cli-delegate/chunk-523HCFYO.js +0 -90
  1045. package/dist/cli-delegate/chunk-AL3RZ22D.js +0 -74
  1046. package/dist/cli-delegate/chunk-KB5FZ655.js +0 -208
  1047. package/dist/cli-delegate/chunk-MDPPKQCQ.js +0 -875
  1048. package/dist/cli-delegate/chunk-MSUL5NYP.js +0 -1123
  1049. package/dist/cli-delegate/chunk-OAFSJBHH.js +0 -272
  1050. package/dist/ui/assets/index-C3djEJah.js +0 -23
  1051. package/src/scripts/_lib/continuation_ladder.ts +0 -335
  1052. package/src/scripts/hooks/run_continuation_hook.ts +0 -1524
@@ -2,58 +2,81 @@ import { createRequire as __acCreateRequire } from 'node:module'; const require
2
2
  import {
3
3
  ZodFirstPartyTypeKind,
4
4
  settingsSchema
5
- } from "./chunk-6SRJTYJS.js";
5
+ } from "./chunk-4SHNERBL.js";
6
6
  import {
7
7
  GLOBAL_DEPLOY_SOURCES,
8
- RULE_SOURCE_REL
9
- } from "./chunk-WOKWX5PL.js";
8
+ RULE_SOURCE_REL,
9
+ dryRunTargetLines
10
+ } from "./chunk-BKALSTBZ.js";
11
+ import {
12
+ OBSERVATION_LOG,
13
+ catalogueLimitWarning,
14
+ knownHostLimits,
15
+ measureCatalogueVolume,
16
+ migrationEligibility,
17
+ migrationPromptLines,
18
+ readObservationLog
19
+ } from "./chunk-NTM7G2V4.js";
20
+ import {
21
+ EXIT_COMPLETED_WITH_CONFLICTS,
22
+ conflictSummaryMessage,
23
+ decideDeployWrite,
24
+ foreignSidecarMessage,
25
+ isLedgerMigration,
26
+ migrationPreservedMessage,
27
+ preservedFileMessage,
28
+ sidecarPathFor
29
+ } from "./chunk-IROAQ77A.js";
10
30
  import {
11
31
  main
12
- } from "./chunk-G5VVIZRC.js";
32
+ } from "./chunk-F7HLSW6P.js";
13
33
  import {
34
+ TIER_TO_CLAUDE_MODEL,
14
35
  absoluteBodyLinkPrefix,
15
36
  appendTxLog,
16
37
  build_thin,
38
+ read_model_tier,
39
+ render_native_model_md,
17
40
  ruleBody,
18
41
  splitFrontmatter,
19
42
  split_frontmatter
20
- } from "./chunk-6YQC2HLF.js";
43
+ } from "./chunk-JHMMWNJ2.js";
21
44
  import {
22
45
  SCOPE_DETECT_AI_DIRS,
23
46
  SCOPE_DETECT_MANIFESTS
24
47
  } from "./chunk-A4QJ6ENT.js";
25
48
  import {
26
- INVENTORY_BASENAME,
49
+ FINDER_NAME,
50
+ _read_settings,
51
+ _with_lock,
52
+ atomicWriteFile,
27
53
  build_claude_hook_matrix,
54
+ deployClaudeCarrier,
55
+ ensureCodexFinder,
28
56
  ensure_managed_hooks,
29
- expected_deploy_files,
30
- inventory_path,
31
- is_ancestor,
32
- load_inventory,
57
+ finderDescription,
58
+ installerThinsHost,
33
59
  printResiduals,
34
60
  probeHostCapabilities,
35
- reap_stale,
36
- reap_tagged_orphans,
37
- record_deploy,
38
- recorded_absolute_files,
39
- recorded_rel_files,
40
- save_inventory
41
- } from "./chunk-MDPPKQCQ.js";
61
+ removeCodexFinder
62
+ } from "./chunk-GOMILC3O.js";
42
63
  import {
43
64
  LEGACY_ALL,
44
65
  compute_active_pack_ids,
45
- is_pruned_under_scoped,
46
66
  load_lab_pack_ids,
47
67
  load_packs_registry,
48
68
  parseFrontmatter,
49
69
  prune_lab_modules,
50
- prune_modules_by,
70
+ prune_scoped_modules,
51
71
  ruleFileArrives,
52
72
  ruleScopeFromSettings
53
- } from "./chunk-DMSZHXZS.js";
73
+ } from "./chunk-7DRWULEQ.js";
54
74
  import {
55
75
  write_managed_block
56
76
  } from "./chunk-ULQRUR23.js";
77
+ import {
78
+ hostBindings
79
+ } from "./chunk-PV7S5DPJ.js";
57
80
  import {
58
81
  check_version,
59
82
  classify_mismatch,
@@ -64,6 +87,10 @@ import {
64
87
  read_lockfile,
65
88
  write_lockfile
66
89
  } from "./chunk-LQOCRFWT.js";
90
+ import {
91
+ find_project_root_with_anchor,
92
+ load_agent_settings
93
+ } from "./chunk-XLY5G3CM.js";
67
94
  import {
68
95
  HOOK_SIGNATURES,
69
96
  deepMerge,
@@ -73,23 +100,34 @@ import {
73
100
  mergeHostConfig
74
101
  } from "./chunk-DEIV7XP7.js";
75
102
  import {
103
+ INVENTORY_BASENAME,
76
104
  NO_RECORDED_HASHES,
105
+ expected_deploy_files,
106
+ file_sha256,
107
+ inventory_path,
108
+ is_ancestor,
109
+ ledgerListedPaths,
110
+ load_inventory,
111
+ readRecordedHashes,
112
+ reap_stale,
113
+ reap_tagged_orphans,
114
+ record_deploy,
115
+ recordedHashesWithLedger,
116
+ recorded_absolute_files,
117
+ recorded_digests,
118
+ recorded_rel_files,
119
+ save_inventory
120
+ } from "./chunk-J2SJZICO.js";
121
+ import {
77
122
  ScopeMismatchError,
78
- classifyOwnership,
79
123
  manifest_path,
80
- readRecordedHashes,
81
124
  read_manifest,
82
- recordedHashesForRoot,
83
125
  upsert_tool,
84
126
  write_manifest
85
- } from "./chunk-OKJUIAPS.js";
127
+ } from "./chunk-4E2W63DA.js";
86
128
  import {
87
129
  require_dist
88
130
  } from "./chunk-OY53J6II.js";
89
- import {
90
- find_project_root_with_anchor,
91
- load_agent_settings
92
- } from "./chunk-H76PHZBI.js";
93
131
  import {
94
132
  DEFAULT_EVENT4U_ROOT_RELATIVE,
95
133
  event4u_root,
@@ -344,24 +382,490 @@ function subtract_pointers(doc, entries) {
344
382
  return [doc, warnings];
345
383
  }
346
384
 
385
+ // src/scripts/_lib/codex_resident_set.ts
386
+ import { createHash as createHash2 } from "node:crypto";
387
+ import * as fs from "node:fs";
388
+ import * as path from "node:path";
389
+ var RECORD_DIRNAME = "codex-resident-set";
390
+ var POLICY_REL = path.join("agents", "openai.yaml");
391
+ var CODEX_BUDGET_CHARS = 8e3;
392
+ var POLICY_BODY = "policy:\n allow_implicit_invocation: false\n";
393
+ var ASSUMPTIONS = [
394
+ {
395
+ id: "entry-cost-is-name-plus-description",
396
+ provenance: "upstream-prose",
397
+ why: 'The host reports a "skills context budget" in characters and does not publish the serialisation it bills. This model bills a name plus its description, which is what the injected list visibly carries.'
398
+ },
399
+ {
400
+ id: "per-entry-overhead",
401
+ provenance: "estimate",
402
+ why: "Each entry also costs separators and a newline. The host quantifies none of it, so the default here is 5 characters per entry and the resulting resident set is therefore an estimate of what fits, never a guarantee \u2014 too small, never too large."
403
+ },
404
+ {
405
+ id: "fill-order-alphabetical",
406
+ provenance: "first-party-observation",
407
+ why: "The 0.3 probe observed the host itself dropping from the alphabetical tail of the user scope. With no usage ledger to order by, filling alphabetically makes the package pick the SAME set the host would have picked, so the resident set is the host's own survivors made explicit rather than a second, conflicting order."
408
+ }
409
+ ];
410
+ var DEFAULT_PER_ENTRY_OVERHEAD_CHARS = 5;
411
+ function computeCodexResidentSet(catalogue, opts) {
412
+ const budgetChars = opts?.budgetChars ?? CODEX_BUDGET_CHARS;
413
+ const overhead = opts?.perEntryOverheadChars ?? DEFAULT_PER_ENTRY_OVERHEAD_CHARS;
414
+ const ordered = catalogue.slice().sort((a, b) => a.name < b.name ? -1 : a.name > b.name ? 1 : 0);
415
+ const resident = [];
416
+ const nonResident = [];
417
+ let listingChars = 0;
418
+ let overflowed = false;
419
+ for (const e of ordered) {
420
+ const cost = e.name.length + e.descriptionChars + overhead;
421
+ if (overflowed || listingChars + cost > budgetChars) {
422
+ overflowed = true;
423
+ nonResident.push(e.name);
424
+ continue;
425
+ }
426
+ resident.push(e.name);
427
+ listingChars += cost;
428
+ }
429
+ return { budgetChars, resident, nonResident, listingChars, assumptions: ASSUMPTIONS };
430
+ }
431
+ function recordPath(anchor, env) {
432
+ const key = createHash2("sha256").update(path.resolve(anchor)).digest("hex").slice(0, 16);
433
+ return path.join(write_target(RECORD_DIRNAME, { env: env ?? null }), `${key}.json`);
434
+ }
435
+ function finderRecordPath(anchor, env) {
436
+ return recordPath(anchor, env).replace(/\.json$/, ".finder.json");
437
+ }
438
+ function codexSkillRoots(home) {
439
+ return [path.join(home, ".codex"), path.join(home, ".agents")].filter(
440
+ (a) => fs.existsSync(path.join(a, "skills"))
441
+ );
442
+ }
443
+ function ownedCatalogue(skillsDir, owned) {
444
+ const out = [];
445
+ for (const name of owned) {
446
+ let raw;
447
+ try {
448
+ raw = fs.readFileSync(path.join(skillsDir, name, "SKILL.md"), "utf8");
449
+ } catch {
450
+ continue;
451
+ }
452
+ const fm = /^---\r?\n([\s\S]*?)\r?\n---/.exec(raw);
453
+ const line = fm ? /^description:[ \t]*(.*)$/m.exec(fm[1]) : null;
454
+ out.push({ name, descriptionChars: line ? line[1].replace(/^["']|["']$/g, "").length : 0 });
455
+ }
456
+ return out;
457
+ }
458
+ function loadRecord(file, anchor) {
459
+ const empty = { schema_version: 1, anchor, written: [] };
460
+ let data;
461
+ try {
462
+ data = JSON.parse(fs.readFileSync(file, "utf-8"));
463
+ } catch {
464
+ return empty;
465
+ }
466
+ const r = data;
467
+ if (!r || typeof r !== "object" || !Array.isArray(r.written)) return empty;
468
+ if (path.resolve(String(r.anchor)) !== path.resolve(anchor)) return empty;
469
+ return { schema_version: 1, anchor, written: r.written.filter((x) => typeof x === "string") };
470
+ }
471
+ function saveRecord(file, rec) {
472
+ if (rec.written.length === 0) {
473
+ fs.rmSync(file, { force: true });
474
+ return;
475
+ }
476
+ fs.mkdirSync(path.dirname(file), { recursive: true });
477
+ const sorted = { ...rec, written: [...rec.written].sort() };
478
+ atomicWriteFile(file, `${JSON.stringify(sorted, null, 2)}
479
+ `);
480
+ }
481
+ function dropPolicy(abs) {
482
+ fs.rmSync(abs, { force: true });
483
+ const dir = path.dirname(abs);
484
+ try {
485
+ if (fs.readdirSync(dir).length === 0) fs.rmdirSync(dir);
486
+ } catch {
487
+ }
488
+ }
489
+ function ensureCodexResidentSet(anchor, recordFile, nonResident) {
490
+ const skillsDir = path.join(anchor, "skills");
491
+ const rec = loadRecord(recordFile, anchor);
492
+ const result = { changed: false, disabled: [], reenabled: [], skipped_foreign: [] };
493
+ const want = new Set(nonResident);
494
+ const ours = new Set(rec.written);
495
+ const next = [];
496
+ for (const rel of rec.written) {
497
+ const abs = path.join(anchor, rel);
498
+ const name = rel.split(path.sep)[1] ?? "";
499
+ if (!fs.existsSync(abs)) continue;
500
+ if (fs.readFileSync(abs, "utf-8") !== POLICY_BODY) continue;
501
+ if (want.has(name)) {
502
+ next.push(rel);
503
+ continue;
504
+ }
505
+ dropPolicy(abs);
506
+ result.reenabled.push(name);
507
+ }
508
+ for (const name of [...want].sort()) {
509
+ const rel = path.join("skills", name, POLICY_REL);
510
+ if (ours.has(rel) && next.includes(rel)) continue;
511
+ const dir = path.join(skillsDir, name);
512
+ if (!fs.existsSync(dir)) continue;
513
+ const abs = path.join(anchor, rel);
514
+ if (fs.existsSync(abs) && fs.readFileSync(abs, "utf-8") !== POLICY_BODY) {
515
+ result.skipped_foreign.push(name);
516
+ continue;
517
+ }
518
+ fs.mkdirSync(path.dirname(abs), { recursive: true });
519
+ atomicWriteFile(abs, POLICY_BODY);
520
+ next.push(rel);
521
+ result.disabled.push(name);
522
+ }
523
+ result.changed = result.disabled.length > 0 || result.reenabled.length > 0;
524
+ saveRecord(recordFile, { schema_version: 1, anchor, written: next });
525
+ result.disabled.sort();
526
+ result.reenabled.sort();
527
+ result.skipped_foreign.sort();
528
+ return result;
529
+ }
530
+ function removeCodexResidentSet(anchor, recordFile) {
531
+ const finder = removeCodexFinder(anchor, recordFile.replace(/\.json$/, ".finder.json"));
532
+ const result = { changed: finder === "removed", removed: [], kept_user: [], finder };
533
+ if (!fs.existsSync(recordFile)) return result;
534
+ const rec = loadRecord(recordFile, anchor);
535
+ for (const rel of rec.written) {
536
+ const abs = path.join(anchor, rel);
537
+ if (!fs.existsSync(abs)) continue;
538
+ if (fs.readFileSync(abs, "utf-8") !== POLICY_BODY) {
539
+ result.kept_user.push(rel);
540
+ continue;
541
+ }
542
+ dropPolicy(abs);
543
+ result.removed.push(rel);
544
+ }
545
+ fs.rmSync(recordFile, { force: true });
546
+ result.changed = result.changed || result.removed.length > 0;
547
+ result.removed.sort();
548
+ result.kept_user.sort();
549
+ return result;
550
+ }
551
+ function applyCodexResidentSet(home, report) {
552
+ try {
553
+ const roots = codexSkillRoots(home);
554
+ if (roots.length === 0) return;
555
+ const firstRootOf = /* @__PURE__ */ new Map();
556
+ const catalogue = [];
557
+ for (const anchor of roots) {
558
+ const skillsDir = path.join(anchor, "skills");
559
+ const owned = fs.readdirSync(skillsDir, { withFileTypes: true }).filter((d) => d.isDirectory() && d.name !== FINDER_NAME && fs.existsSync(path.join(skillsDir, d.name, "SKILL.md"))).map((d) => d.name);
560
+ for (const e of ownedCatalogue(skillsDir, owned)) {
561
+ if (firstRootOf.has(e.name)) continue;
562
+ firstRootOf.set(e.name, anchor);
563
+ catalogue.push(e);
564
+ }
565
+ }
566
+ const finderCost = FINDER_NAME.length + finderDescription(catalogue.length).length + DEFAULT_PER_ENTRY_OVERHEAD_CHARS;
567
+ let split = computeCodexResidentSet(catalogue);
568
+ if (split.nonResident.length > 0) {
569
+ split = computeCodexResidentSet(catalogue, { budgetChars: CODEX_BUDGET_CHARS - finderCost });
570
+ }
571
+ const resident = new Set(split.resident);
572
+ const finder = ensureCodexFinder(
573
+ roots[0],
574
+ finderRecordPath(roots[0]),
575
+ split.nonResident.map((name) => ({ name, skillsDir: path.join(firstRootOf.get(name), "skills") }))
576
+ );
577
+ const unlistAllowed = finder !== "foreign";
578
+ let disabled = 0;
579
+ let reenabled = 0;
580
+ let foreign = 0;
581
+ for (const anchor of roots) {
582
+ const skillsDir = path.join(anchor, "skills");
583
+ const here = fs.readdirSync(skillsDir, { withFileTypes: true }).filter((d) => d.isDirectory() && d.name !== FINDER_NAME && fs.existsSync(path.join(skillsDir, d.name, "SKILL.md"))).map((d) => d.name);
584
+ const nonResident = unlistAllowed ? here.filter((n) => !resident.has(n) || firstRootOf.get(n) !== anchor) : [];
585
+ const res = ensureCodexResidentSet(anchor, recordPath(anchor), nonResident);
586
+ disabled += res.disabled.length;
587
+ reenabled += res.reenabled.length;
588
+ foreign += res.skipped_foreign.length;
589
+ }
590
+ report(
591
+ `codex: resident set across ${roots.length} root(s) \u2014 ${split.resident.length} listed (${split.listingChars} of ${split.budgetChars} chars), ${disabled} newly unlisted, ${reenabled} relisted` + (foreign > 0 ? `, ${foreign} existing policy file(s) untouched` : "") + `, finder ${finder}` + (unlistAllowed ? "" : " \u2014 nothing unlisted, because no finder could route to it")
592
+ );
593
+ } catch (e) {
594
+ report(`codex: resident set skipped \u2014 ${String(e)}`);
595
+ }
596
+ }
597
+
598
+ // src/scripts/_lib/skill_listing_overrides.ts
599
+ import * as fs2 from "node:fs";
600
+ import * as path2 from "node:path";
601
+
602
+ // src/scripts/_lib/host_listing_model.ts
603
+ var CLAUDE_CODE_LISTING_DEFAULTS = {
604
+ fraction: 0.01,
605
+ perEntryCapChars: 1536,
606
+ charsPerToken: 4,
607
+ perEntryOverheadChars: 0
608
+ };
609
+ var ASSUMPTIONS2 = [
610
+ {
611
+ id: "budget-unit-is-chars",
612
+ provenance: "upstream-prose",
613
+ why: 'The docs give the budget as a fraction of the context window (tokens); the 2026-08-22 read illustrated it as "\u22488,000 characters on 200k" (gone by 2026-10-14), which only reconciles at 4 chars per token. That ratio is inferred, never stated.'
614
+ },
615
+ {
616
+ id: "fill-order-is-invocation-frequency",
617
+ provenance: "upstream-prose",
618
+ why: "Upstream says the budget fills by invocation frequency, but does not say what orders entries when no invocation history exists. This model falls back to alphabetical, which is this repo's choice and not upstream behaviour."
619
+ },
620
+ {
621
+ id: "names-are-never-dropped",
622
+ provenance: "upstream-prose",
623
+ why: "Claude Code lists every name and budgets only descriptions. Another host (codex) drops whole entries instead, so this is a per-host property and is not transferable to a second host without its own model."
624
+ },
625
+ {
626
+ id: "stop-at-first-overflow",
627
+ provenance: "upstream-prose",
628
+ why: "The docs describe filling a budget, not packing one. A shorter later entry might in principle still fit after a longer one has overflowed; this model stops at the first entry that does not fit rather than skipping past it."
629
+ },
630
+ {
631
+ id: "wrapper-overhead-unmodelled",
632
+ provenance: "upstream-prose",
633
+ why: "Each delivered entry also costs its name, separators and newlines. Upstream quantifies none of that, so the default overhead here is 0 and the budget is therefore an upper bound on how many descriptions survive."
634
+ }
635
+ ];
636
+ function modelListingBudget(catalogue, input) {
637
+ const fraction = input.fraction ?? CLAUDE_CODE_LISTING_DEFAULTS.fraction;
638
+ const perEntryCap = input.perEntryCapChars ?? CLAUDE_CODE_LISTING_DEFAULTS.perEntryCapChars;
639
+ const charsPerToken = input.charsPerToken ?? CLAUDE_CODE_LISTING_DEFAULTS.charsPerToken;
640
+ const overhead = input.perEntryOverheadChars ?? CLAUDE_CODE_LISTING_DEFAULTS.perEntryOverheadChars;
641
+ const usageOrder = input.usageOrder ?? [];
642
+ const budgetChars = Math.floor(input.contextWindowTokens * fraction * charsPerToken);
643
+ const fillOrder = usageOrder.length > 0 ? "usage" : "alphabetical-fallback";
644
+ const byName = new Map(catalogue.map((e) => [e.name, e]));
645
+ const ordered = [];
646
+ const seen = /* @__PURE__ */ new Set();
647
+ for (const name of usageOrder) {
648
+ const e = byName.get(name);
649
+ if (e && !seen.has(name)) {
650
+ ordered.push(e);
651
+ seen.add(name);
652
+ }
653
+ }
654
+ const rest = catalogue.filter((e) => !seen.has(e.name)).slice().sort((a, b) => a.name < b.name ? -1 : a.name > b.name ? 1 : 0);
655
+ ordered.push(...rest);
656
+ const surviving = [];
657
+ const bare = [];
658
+ let spentChars = 0;
659
+ let overflowed = false;
660
+ for (const e of ordered) {
661
+ if (overflowed) {
662
+ bare.push(e.name);
663
+ continue;
664
+ }
665
+ const cost = Math.min(e.descriptionChars, perEntryCap) + overhead;
666
+ if (spentChars + cost <= budgetChars) {
667
+ surviving.push(e.name);
668
+ spentChars += cost;
669
+ } else {
670
+ overflowed = true;
671
+ bare.push(e.name);
672
+ }
673
+ }
674
+ return { budgetChars, fillOrder, surviving, bare, spentChars, assumptions: ASSUMPTIONS2 };
675
+ }
676
+
677
+ // src/scripts/_lib/skill_listing_overrides.ts
678
+ var OVERRIDE_KEY = "skillOverrides";
679
+ var NAME_ONLY = "name-only";
680
+ var RECORD_BASENAME = "skill-overrides.json";
681
+ function recordPath2(env) {
682
+ return write_target(RECORD_BASENAME, { env: env ?? null });
683
+ }
684
+ function ownedSkillNames(currentFiles) {
685
+ const out = /* @__PURE__ */ new Set();
686
+ for (const rel of currentFiles) {
687
+ const m = /^skills\/([^/]+)\/SKILL\.md$/.exec(rel.split(path2.sep).join("/"));
688
+ if (m) out.add(m[1]);
689
+ }
690
+ return [...out].sort();
691
+ }
692
+ function ownedCatalogue2(skillsDir, owned) {
693
+ const out = [];
694
+ for (const name of owned) {
695
+ let raw;
696
+ try {
697
+ raw = fs2.readFileSync(path2.join(skillsDir, name, "SKILL.md"), "utf8");
698
+ } catch {
699
+ continue;
700
+ }
701
+ const fm = /^---\r?\n([\s\S]*?)\r?\n---/.exec(raw);
702
+ const line = fm ? /^description:[ \t]*(.*)$/m.exec(fm[1]) : null;
703
+ out.push({ name, descriptionChars: line ? line[1].replace(/^["']|["']$/g, "").length : 0 });
704
+ }
705
+ return out;
706
+ }
707
+ function computeOverrides(skillsDir, owned) {
708
+ const catalogue = ownedCatalogue2(skillsDir, owned);
709
+ const { bare } = modelListingBudget(catalogue, { contextWindowTokens: 2e5 });
710
+ const out = {};
711
+ for (const name of bare) out[name] = NAME_ONLY;
712
+ return out;
713
+ }
714
+ function loadRecord2(file, settingsPath) {
715
+ const empty = { schema_version: 1, settings_path: settingsPath, created_key: false, entries: {} };
716
+ let data;
717
+ try {
718
+ data = JSON.parse(fs2.readFileSync(file, "utf-8"));
719
+ } catch {
720
+ return empty;
721
+ }
722
+ const r = data;
723
+ if (!r || typeof r !== "object" || typeof r.entries !== "object" || r.entries === null) return empty;
724
+ if (path2.resolve(String(r.settings_path)) !== path2.resolve(settingsPath)) return empty;
725
+ const entries = {};
726
+ for (const [k, v] of Object.entries(r.entries)) if (typeof v === "string") entries[k] = v;
727
+ return { schema_version: 1, settings_path: settingsPath, created_key: r.created_key === true, entries };
728
+ }
729
+ function saveRecord2(file, rec) {
730
+ if (Object.keys(rec.entries).length === 0) {
731
+ fs2.rmSync(file, { force: true });
732
+ return;
733
+ }
734
+ fs2.mkdirSync(path2.dirname(file), { recursive: true });
735
+ atomicWriteFile(file, `${JSON.stringify({ ...rec, entries: sortKeys(rec.entries) }, null, 2)}
736
+ `);
737
+ }
738
+ function sortKeys(o) {
739
+ return Object.fromEntries(Object.keys(o).sort().map((k) => [k, o[k]]));
740
+ }
741
+ function overridesOf(settings) {
742
+ const raw = settings[OVERRIDE_KEY];
743
+ if (raw === void 0) return void 0;
744
+ if (typeof raw !== "object" || raw === null || Array.isArray(raw)) return null;
745
+ return raw;
746
+ }
747
+ function ensureListingOverrides(settingsPath, recordFile, wanted) {
748
+ return _with_lock(settingsPath, () => {
749
+ const settings = _read_settings(settingsPath);
750
+ const rec = loadRecord2(recordFile, settingsPath);
751
+ const existing = overridesOf(settings);
752
+ const result = { changed: false, written: [], removed: [], skipped_user: [] };
753
+ if (existing === null) {
754
+ result.skipped_user.push(...Object.keys(wanted).sort());
755
+ return result;
756
+ }
757
+ const overrides = { ...existing ?? {} };
758
+ const next = {};
759
+ for (const [name, value] of Object.entries(rec.entries)) {
760
+ if (overrides[name] !== value) continue;
761
+ const want = wanted[name];
762
+ if (want === void 0) {
763
+ delete overrides[name];
764
+ result.removed.push(name);
765
+ } else {
766
+ if (want !== value) {
767
+ overrides[name] = want;
768
+ result.written.push(name);
769
+ }
770
+ next[name] = want;
771
+ }
772
+ }
773
+ for (const [name, value] of Object.entries(wanted)) {
774
+ if (name in next) continue;
775
+ if (name in overrides) {
776
+ result.skipped_user.push(name);
777
+ continue;
778
+ }
779
+ overrides[name] = value;
780
+ next[name] = value;
781
+ result.written.push(name);
782
+ }
783
+ const createdKey = rec.created_key || existing === void 0 && Object.keys(next).length > 0;
784
+ if (Object.keys(overrides).length === 0 && createdKey) delete settings[OVERRIDE_KEY];
785
+ else if (existing !== void 0 || Object.keys(overrides).length > 0) settings[OVERRIDE_KEY] = overrides;
786
+ result.changed = result.written.length + result.removed.length > 0;
787
+ if (result.changed) atomicWriteFile(settingsPath, `${JSON.stringify(settings, null, 2)}
788
+ `);
789
+ saveRecord2(recordFile, { schema_version: 1, settings_path: settingsPath, created_key: createdKey, entries: next });
790
+ result.written.sort();
791
+ result.removed.sort();
792
+ result.skipped_user.sort();
793
+ return result;
794
+ });
795
+ }
796
+ function removeListingOverrides(settingsPath, recordFile) {
797
+ const result = { changed: false, removed: [], kept_user: [] };
798
+ if (!fs2.existsSync(recordFile)) return result;
799
+ if (!fs2.existsSync(settingsPath)) {
800
+ fs2.rmSync(recordFile, { force: true });
801
+ return result;
802
+ }
803
+ return _with_lock(settingsPath, () => {
804
+ const settings = _read_settings(settingsPath);
805
+ const rec = loadRecord2(recordFile, settingsPath);
806
+ const existing = overridesOf(settings);
807
+ if (existing) {
808
+ for (const [name, value] of Object.entries(rec.entries)) {
809
+ if (existing[name] === value) {
810
+ delete existing[name];
811
+ result.removed.push(name);
812
+ } else if (name in existing) {
813
+ result.kept_user.push(name);
814
+ }
815
+ }
816
+ if (rec.created_key && Object.keys(existing).length === 0) delete settings[OVERRIDE_KEY];
817
+ }
818
+ result.changed = result.removed.length > 0;
819
+ if (result.changed) atomicWriteFile(settingsPath, `${JSON.stringify(settings, null, 2)}
820
+ `);
821
+ fs2.rmSync(recordFile, { force: true });
822
+ result.removed.sort();
823
+ result.kept_user.sort();
824
+ return result;
825
+ });
826
+ }
827
+ function applyListingOverrides(anchor, report) {
828
+ try {
829
+ const owned = ownedSkillNames(recorded_rel_files("claude-code", anchor));
830
+ const wanted = computeOverrides(path2.join(anchor, "skills"), owned);
831
+ const res = ensureListingOverrides(path2.join(anchor, "settings.json"), recordPath2(), wanted);
832
+ if (res.changed) {
833
+ report(
834
+ `claude-code: listing override in ~/.claude/settings.json \u2014 ${res.written.length} set name-only, ${res.removed.length} removed`
835
+ );
836
+ }
837
+ if (res.skipped_user.length > 0) {
838
+ report(
839
+ `claude-code: listing override left ${res.skipped_user.length} user value(s) untouched (${res.skipped_user.slice(0, 5).join(", ")}${res.skipped_user.length > 5 ? ", \u2026" : ""})`
840
+ );
841
+ }
842
+ } catch (e) {
843
+ report(`claude-code: listing override skipped \u2014 ${String(e)}`);
844
+ }
845
+ }
846
+ function applyHostListingPolicies(deployed, home, claudeAnchor, report) {
847
+ if (deployed.claudeCode) applyListingOverrides(claudeAnchor, report);
848
+ if (deployed.codex) applyCodexResidentSet(home, report);
849
+ }
850
+
347
851
  // src/scripts/install.ts
348
852
  import { spawn, spawnSync } from "node:child_process";
349
853
  import * as crypto5 from "node:crypto";
350
854
  import * as fs18 from "node:fs";
351
- import * as os7 from "node:os";
855
+ import * as os8 from "node:os";
352
856
  import * as path18 from "node:path";
353
857
  import process2 from "node:process";
354
- import { fileURLToPath as fileURLToPath3, pathToFileURL } from "node:url";
858
+ import { fileURLToPath as fileURLToPath2, pathToFileURL } from "node:url";
355
859
 
356
860
  // src/scripts/_lib/reserved_name_sweep.ts
357
- import * as fs from "node:fs";
358
- import * as path from "node:path";
861
+ import * as fs3 from "node:fs";
862
+ import * as path3 from "node:path";
359
863
  function sweepReservedNames(commandsDir, currentFiles, isBuiltinName, recordedFiles) {
360
864
  const reserved = [];
361
865
  const foreign = [];
362
866
  let entries = [];
363
867
  try {
364
- entries = fs.readdirSync(commandsDir).filter((f) => f.endsWith(".md"));
868
+ entries = fs3.readdirSync(commandsDir).filter((f) => f.endsWith(".md"));
365
869
  } catch {
366
870
  return { reserved, foreign };
367
871
  }
@@ -374,7 +878,7 @@ function sweepReservedNames(commandsDir, currentFiles, isBuiltinName, recordedFi
374
878
  foreign.push(slug);
375
879
  continue;
376
880
  }
377
- fs.rmSync(path.join(commandsDir, fname), { force: true });
881
+ fs3.rmSync(path3.join(commandsDir, fname), { force: true });
378
882
  currentFiles.delete(rel);
379
883
  reserved.push(slug);
380
884
  }
@@ -383,11 +887,13 @@ function sweepReservedNames(commandsDir, currentFiles, isBuiltinName, recordedFi
383
887
 
384
888
  // src/scripts/_lib/host_env_write.ts
385
889
  var YAML = __toESM(require_dist(), 1);
386
- import * as fs2 from "node:fs";
387
- import * as path2 from "node:path";
890
+ import * as fs4 from "node:fs";
891
+ import * as path4 from "node:path";
892
+ var MAX_CONCURRENT_SUBAGENTS = 64;
388
893
  var WRITABLE_HOST_ENV = [
389
- { variable: "BASH_MAX_OUTPUT_LENGTH", settingsKey: "bash_max_output_length" },
390
- { variable: "MAX_MCP_OUTPUT_TOKENS", settingsKey: "max_mcp_output_tokens" }
894
+ { variable: "BASH_MAX_OUTPUT_LENGTH", settingsKey: "host_environment.request_size_caps.bash_max_output_length" },
895
+ { variable: "MAX_MCP_OUTPUT_TOKENS", settingsKey: "host_environment.request_size_caps.max_mcp_output_tokens" },
896
+ { variable: "CLAUDE_CODE_MAX_CONCURRENT_SUBAGENTS", settingsKey: "subagents.max_parallel", max: MAX_CONCURRENT_SUBAGENTS }
391
897
  ];
392
898
  var SETTINGS_CANDIDATES = [
393
899
  ["agents", "settings", ".agent-settings.yml"],
@@ -395,10 +901,10 @@ var SETTINGS_CANDIDATES = [
395
901
  ];
396
902
  function readSettingsDoc(projectRoot) {
397
903
  for (const parts of SETTINGS_CANDIDATES) {
398
- const p = path2.join(projectRoot, ...parts);
904
+ const p = path4.join(projectRoot, ...parts);
399
905
  let text;
400
906
  try {
401
- text = fs2.readFileSync(p, "utf-8");
907
+ text = fs4.readFileSync(p, "utf-8");
402
908
  } catch {
403
909
  continue;
404
910
  }
@@ -413,21 +919,22 @@ function readSettingsDoc(projectRoot) {
413
919
  return null;
414
920
  }
415
921
  function hostEnvBlock(settings) {
416
- const root = settings;
417
- const he = root?.["host_environment"];
418
- const caps = he?.["request_size_caps"];
419
- if (caps === void 0) return null;
420
922
  const out = {};
421
- for (const { variable, settingsKey } of WRITABLE_HOST_ENV) {
422
- const v = caps[settingsKey];
423
- if (typeof v === "number" && Number.isInteger(v) && v > 0) out[variable] = String(v);
923
+ for (const { variable, settingsKey, max } of WRITABLE_HOST_ENV) {
924
+ let v = settings;
925
+ for (const part of settingsKey.split(".")) {
926
+ v = v !== null && typeof v === "object" ? v[part] : void 0;
927
+ }
928
+ if (typeof v !== "number" || !Number.isSafeInteger(v) || v <= 0) continue;
929
+ if (max !== void 0 && v > max) continue;
930
+ out[variable] = String(v);
424
931
  }
425
932
  return Object.keys(out).length === 0 ? null : out;
426
933
  }
427
934
  function withHostEnv(bridge, projectRoot, announce) {
428
935
  const env = hostEnvBlock(readSettingsDoc(projectRoot));
429
936
  if (env === null) return bridge;
430
- announce(`.claude/settings.json: wrote ${Object.keys(env).join(", ")} (request-size caps)`);
937
+ announce(`.claude/settings.json: wrote ${Object.keys(env).join(", ")} (request-size and concurrency caps)`);
431
938
  return { ...bridge, env };
432
939
  }
433
940
 
@@ -546,7 +1053,10 @@ var _CURRENT = [
546
1053
  "dataviz",
547
1054
  "debug",
548
1055
  "deep-research",
1056
+ "design",
1057
+ "design-consent",
549
1058
  "design-login",
1059
+ "design-revoke",
550
1060
  "design-sync",
551
1061
  "desktop",
552
1062
  "diff",
@@ -639,25 +1149,25 @@ function is_claude_builtin_name(slug) {
639
1149
  }
640
1150
 
641
1151
  // src/scripts/_lib/mcp_bridge.ts
642
- import * as fs3 from "node:fs";
643
- import * as path3 from "node:path";
1152
+ import * as fs5 from "node:fs";
1153
+ import * as path5 from "node:path";
644
1154
  var MCP_SERVER_KEY = "agent-config";
645
1155
  var MCP_PACKAGE_NAME = "@event4u/agent-config";
646
1156
  function mcpBridgeEntry(packageRoot) {
647
1157
  const version = readPackageVersion(packageRoot);
648
- const spec = version === null ? MCP_PACKAGE_NAME : `${MCP_PACKAGE_NAME}@${version}`;
1158
+ const args = version === null ? ["-y", MCP_PACKAGE_NAME, "mcp-server"] : ["--prefer-offline", "-y", `${MCP_PACKAGE_NAME}@${version}`, "mcp-server"];
649
1159
  return {
650
1160
  mcpServers: {
651
1161
  [MCP_SERVER_KEY]: {
652
1162
  command: "npx",
653
- args: ["-y", spec, "mcp-server"]
1163
+ args
654
1164
  }
655
1165
  }
656
1166
  };
657
1167
  }
658
1168
  function readPackageVersion(packageRoot) {
659
1169
  try {
660
- const raw = fs3.readFileSync(path3.join(packageRoot, "package.json"), "utf-8");
1170
+ const raw = fs5.readFileSync(path5.join(packageRoot, "package.json"), "utf-8");
661
1171
  const v = JSON.parse(raw).version;
662
1172
  return typeof v === "string" && v.trim() !== "" ? v : null;
663
1173
  } catch {
@@ -666,7 +1176,7 @@ function readPackageVersion(packageRoot) {
666
1176
  }
667
1177
  function makeEnsureMcpBridge(mergeJsonFile) {
668
1178
  return (projectRoot, force, packageRoot = projectRoot) => mergeJsonFile(
669
- path3.join(projectRoot, ".mcp.json"),
1179
+ path5.join(projectRoot, ".mcp.json"),
670
1180
  mcpBridgeEntry(packageRoot),
671
1181
  force,
672
1182
  ".mcp.json"
@@ -692,7 +1202,7 @@ function makeEnsureMcpRegistrations(mergeJsonFile) {
692
1202
  const merged = {};
693
1203
  for (const t of targets) {
694
1204
  merged[t.toolId] = mergeJsonFile(
695
- path3.join(projectRoot, ...t.relPath.split("/")),
1205
+ path5.join(projectRoot, ...t.relPath.split("/")),
696
1206
  mcpBridgeEntry(packageRoot),
697
1207
  force,
698
1208
  t.relPath
@@ -720,132 +1230,120 @@ function registerMcpHosts(mergeJsonFile, projectRoot, force, packageRoot, tools,
720
1230
  }
721
1231
  }
722
1232
  function projectionModeOf(raw) {
723
- return raw === "scoped" ? "scoped" : raw === "tiered" ? "tiered" : "legacy-all";
1233
+ return raw === "scoped" ? "scoped" : "legacy-all";
724
1234
  }
725
1235
  function resolveTierB(packageRoot) {
726
- const p = path3.join(packageRoot, "agents", "runtime", "state", "skill-tiers.json");
727
- if (!fs3.existsSync(p)) return null;
1236
+ const p = path5.join(packageRoot, "agents", "runtime", "state", "skill-tiers.json");
1237
+ if (!fs5.existsSync(p)) return null;
728
1238
  try {
729
- const parsed = JSON.parse(fs3.readFileSync(p, "utf-8"));
1239
+ const parsed = JSON.parse(fs5.readFileSync(p, "utf-8"));
730
1240
  if (!Array.isArray(parsed.tier_b)) return null;
731
1241
  return new Set(parsed.tier_b.filter((n) => typeof n === "string"));
732
1242
  } catch {
733
1243
  return null;
734
1244
  }
735
1245
  }
736
- function tierBPrunePredicate(tierB) {
737
- return (mdPath) => tierB.has(path3.basename(path3.dirname(mdPath)));
738
- }
739
1246
  function tierBAdvisory(packageRoot) {
740
1247
  const tierB = resolveTierB(packageRoot);
741
1248
  if (tierB === null || tierB.size === 0) return null;
742
1249
  return `\u2139\uFE0F ${tierB.size} skill(s) are predicted to reach the model WITHOUT their description on a default 200k window.
743
1250
  Two levers, neither applied for you:
744
1251
  \u2022 raise \`skillListingBudgetFraction\` in your Claude Code settings \u2014 restores descriptions at a token cost (100% delivery of this catalogue measures ~13,003 tok)
745
- \u2022 or set \`projection.mode: tiered\` to withhold them from the catalogue and reach them via the MCP server instead (opt-in, still unproven \u2014 see docs/mcp-server.md)`;
746
- }
747
- function applyTieredPrune(deployResults, packageRoot, pruneBy) {
748
- const tierB = resolveTierB(packageRoot);
749
- if (tierB === null || tierB.size === 0) {
750
- return {
751
- deployResults,
752
- level: "warn",
753
- message: "projection.mode: tiered but no skill-tier split exists (agents/runtime/state/skill-tiers.json) \u2014 shipping the full surface. Compute one with `./scripts-run src/scripts/compute_skill_tiers` first."
754
- };
755
- }
756
- const [pruned, adjusted] = pruneBy(deployResults, tierBPrunePredicate(tierB));
757
- return {
758
- deployResults: adjusted,
759
- level: "info",
760
- message: `\u{1F9F9} Tiered install: pruned ${pruned} Tier-B skill artefact(s) \u2014 still reachable via the MCP server's suggest_skill_for_task / read_skill. Set projection.mode: legacy-all to restore the full surface.`
761
- };
1252
+ \u2022 or reach them through the MCP server, which serves every skill by name regardless of what the host catalogue carries (docs/mcp-server.md)`;
762
1253
  }
763
1254
 
764
1255
  // src/install/conflictTracker.ts
765
1256
  import * as crypto2 from "node:crypto";
766
- import * as fs5 from "node:fs";
767
- import * as path5 from "node:path";
1257
+ import * as fs7 from "node:fs";
1258
+ import * as os from "node:os";
1259
+ import * as path7 from "node:path";
768
1260
 
769
1261
  // src/install/fsPrimitives.ts
770
1262
  import * as crypto from "node:crypto";
771
- import * as fs4 from "node:fs";
772
- import * as path4 from "node:path";
1263
+ import * as fs6 from "node:fs";
1264
+ import * as path6 from "node:path";
773
1265
  function resolvePath(p) {
774
1266
  try {
775
- return fs4.realpathSync(path4.resolve(p));
1267
+ return fs6.realpathSync(path6.resolve(p));
776
1268
  } catch {
777
- return path4.resolve(p);
1269
+ return path6.resolve(p);
778
1270
  }
779
1271
  }
780
1272
  function pathExists(p) {
781
1273
  try {
782
- fs4.statSync(p);
1274
+ fs6.statSync(p);
783
1275
  return true;
784
1276
  } catch {
785
1277
  return false;
786
1278
  }
787
1279
  }
788
1280
  function mkdirp(p) {
789
- fs4.mkdirSync(p, { recursive: true });
1281
+ fs6.mkdirSync(p, { recursive: true });
790
1282
  }
791
1283
  function sha256OfFile(p) {
792
1284
  let data;
793
1285
  try {
794
- data = fs4.readFileSync(p);
1286
+ data = fs6.readFileSync(p);
795
1287
  } catch {
796
1288
  return null;
797
1289
  }
798
1290
  return crypto.createHash("sha256").update(data).digest("hex");
799
1291
  }
800
1292
 
801
- // src/install/preserve.ts
802
- var SIDECAR_SUFFIX = ".agent-config.new";
803
- var EXIT_COMPLETED_WITH_CONFLICTS = 3;
804
- function decideDeployWrite(inputs) {
805
- if (!inputs.exists) return "write";
806
- if (inputs.force) return "write";
807
- const ownership = classifyOwnership(inputs.recordedSha256, inputs.onDiskSha256);
808
- return ownership === "recorded-modified" ? "preserve" : "write";
809
- }
810
- function sidecarPathFor(target) {
811
- return `${target}${SIDECAR_SUFFIX}`;
812
- }
813
- function preservedFileMessage(target, sidecar) {
814
- return `Preserved user-modified ${target}. Package content was written to ${sidecar}; the active installation is not current. Review and merge it, or rerun with --force to replace the managed file.`;
815
- }
816
- function conflictSummaryMessage(count) {
817
- const noun = count === 1 ? "file" : "files";
818
- return `Completed with conflicts: ${count} user-modified ${noun} preserved. Package content is staged alongside as *${SIDECAR_SUFFIX}; the active installation is not current until you merge it, or rerun with --force to replace the managed ${noun}.`;
819
- }
820
- function foreignSidecarMessage(target, sidecar) {
821
- return `Refusing to replace ${sidecar}: it already exists with different content and this install cannot show it wrote it. Package content for ${target} was NOT staged. Move or delete that file and re-run, or rerun with --force to replace the managed file instead.`;
822
- }
823
-
824
1293
  // src/install/conflictTracker.ts
825
1294
  function createConflictTracker(host) {
826
1295
  const conflictState = {
827
1296
  root: null,
828
1297
  recorded: null,
1298
+ ledgerFiles: null,
829
1299
  preserved: [],
1300
+ migrated: /* @__PURE__ */ new Set(),
830
1301
  staged: /* @__PURE__ */ new Map()
831
1302
  };
832
1303
  function recordedHashFor(target) {
833
1304
  if (conflictState.root === null) return void 0;
834
- conflictState.recorded ??= recordedHashesForRoot(conflictState.root);
835
- const plain = path5.resolve(target);
1305
+ conflictState.recorded ??= recordedHashesWithLedger(conflictState.root);
1306
+ const plain = path7.resolve(target);
836
1307
  if (conflictState.recorded.has(plain)) return conflictState.recorded.get(plain);
837
1308
  const real = resolvePath(target);
838
1309
  return real === plain ? void 0 : conflictState.recorded.get(real);
839
1310
  }
1311
+ function ledgerLists(target) {
1312
+ conflictState.ledgerFiles ??= ledgerListedPaths();
1313
+ const files = conflictState.ledgerFiles;
1314
+ return files.has(path7.resolve(target)) || files.has(resolvePath(target));
1315
+ }
1316
+ function wouldWriteDigest(target, would) {
1317
+ const tmp = path7.join(
1318
+ os.tmpdir(),
1319
+ `agent-config-would.${process.pid}.${crypto2.randomBytes(6).toString("hex")}${path7.extname(target)}`
1320
+ );
1321
+ try {
1322
+ if ("content" in would) {
1323
+ fs7.writeFileSync(tmp, would.content, "utf-8");
1324
+ } else {
1325
+ fs7.copyFileSync(would.from, tmp);
1326
+ host.tagDeployed(tmp, would.from, would.packageRoot);
1327
+ }
1328
+ return sha256OfFile(tmp);
1329
+ } catch {
1330
+ return null;
1331
+ } finally {
1332
+ try {
1333
+ fs7.unlinkSync(tmp);
1334
+ } catch {
1335
+ }
1336
+ }
1337
+ }
840
1338
  function stageInto(target, sidecar, produce) {
841
- mkdirp(path5.dirname(sidecar));
842
- const tmp = path5.join(
843
- path5.dirname(sidecar),
844
- `.${path5.basename(sidecar)}.${process.pid}.${crypto2.randomBytes(6).toString("hex")}${path5.extname(target)}`
1339
+ mkdirp(path7.dirname(sidecar));
1340
+ const tmp = path7.join(
1341
+ path7.dirname(sidecar),
1342
+ `.${path7.basename(sidecar)}.${process.pid}.${crypto2.randomBytes(6).toString("hex")}${path7.extname(target)}`
845
1343
  );
846
1344
  const discard = () => {
847
1345
  try {
848
- fs5.unlinkSync(tmp);
1346
+ fs7.unlinkSync(tmp);
849
1347
  } catch {
850
1348
  }
851
1349
  };
@@ -872,7 +1370,7 @@ function createConflictTracker(host) {
872
1370
  }
873
1371
  }
874
1372
  try {
875
- fs5.renameSync(tmp, sidecar);
1373
+ fs7.renameSync(tmp, sidecar);
876
1374
  } catch (exc) {
877
1375
  discard();
878
1376
  host.fail(
@@ -885,14 +1383,19 @@ function createConflictTracker(host) {
885
1383
  function record(target, sidecar) {
886
1384
  if (conflictState.preserved.includes(target)) return;
887
1385
  conflictState.preserved.push(target);
888
- host.warn(preservedFileMessage(target, sidecar));
1386
+ host.warn(
1387
+ conflictState.migrated.has(path7.resolve(target)) ? migrationPreservedMessage(target, sidecar) : preservedFileMessage(target, sidecar)
1388
+ );
889
1389
  }
890
1390
  return {
891
1391
  conflictState,
1392
+ recordedDigest: recordedHashFor,
892
1393
  begin(root) {
893
1394
  conflictState.root = root;
894
1395
  conflictState.recorded = null;
1396
+ conflictState.ledgerFiles = null;
895
1397
  conflictState.preserved = [];
1398
+ conflictState.migrated = /* @__PURE__ */ new Set();
896
1399
  conflictState.staged = /* @__PURE__ */ new Map();
897
1400
  },
898
1401
  /**
@@ -901,14 +1404,23 @@ function createConflictTracker(host) {
901
1404
  * so a file edited between planning and writing is still classified
902
1405
  * from the bytes that are actually about to be destroyed.
903
1406
  */
904
- resolve(target, force) {
1407
+ resolve(target, force, would) {
905
1408
  const exists = pathExists(target);
906
- return decideDeployWrite({
1409
+ const base = {
907
1410
  exists,
908
1411
  recordedSha256: exists ? recordedHashFor(target) : void 0,
909
1412
  onDiskSha256: exists ? sha256OfFile(target) : null,
910
- force
911
- });
1413
+ force,
1414
+ ledgerListed: exists && ledgerLists(target)
1415
+ };
1416
+ const migrating = isLedgerMigration(base);
1417
+ const decision = decideDeployWrite(
1418
+ migrating ? { ...base, packagedSha256: wouldWriteDigest(target, would) } : base
1419
+ );
1420
+ if (decision === "preserve" && migrating) {
1421
+ conflictState.migrated.add(path7.resolve(target));
1422
+ }
1423
+ return decision;
912
1424
  },
913
1425
  /**
914
1426
  * Stage the package content beside a preserved target.
@@ -921,7 +1433,7 @@ function createConflictTracker(host) {
921
1433
  preserve(target, source, packageRoot) {
922
1434
  const sidecar = sidecarPathFor(target);
923
1435
  stageInto(target, sidecar, (tmp) => {
924
- fs5.copyFileSync(source, tmp);
1436
+ fs7.copyFileSync(source, tmp);
925
1437
  host.tagDeployed(tmp, source, packageRoot);
926
1438
  });
927
1439
  record(target, sidecar);
@@ -937,7 +1449,7 @@ function createConflictTracker(host) {
937
1449
  */
938
1450
  preserveContent(target, content) {
939
1451
  const sidecar = sidecarPathFor(target);
940
- stageInto(target, sidecar, (tmp) => fs5.writeFileSync(tmp, content, "utf-8"));
1452
+ stageInto(target, sidecar, (tmp) => fs7.writeFileSync(tmp, content, "utf-8"));
941
1453
  record(target, sidecar);
942
1454
  },
943
1455
  /**
@@ -957,9 +1469,9 @@ function createConflictTracker(host) {
957
1469
 
958
1470
  // src/install/manifestFiles.ts
959
1471
  var YAML2 = __toESM(require_dist(), 1);
960
- import { existsSync as existsSync2, readFileSync as readFileSync4 } from "node:fs";
1472
+ import { existsSync as existsSync4, readFileSync as readFileSync6 } from "node:fs";
961
1473
  import { homedir } from "node:os";
962
- import { isAbsolute, join as join5, resolve as resolve3 } from "node:path";
1474
+ import { isAbsolute, join as join7, resolve as resolve5 } from "node:path";
963
1475
  function fileEntry(p, kind, hashContent) {
964
1476
  return { path: p, kind, sha256: hashContent ? sha256OfFile(p) : null };
965
1477
  }
@@ -982,7 +1494,7 @@ function filesByToolFromBridges(tools, projectRoot, scope, bridgeMarker) {
982
1494
  for (const toolId of [...tools].sort()) {
983
1495
  const marker = bridgeMarker(toolId, scope);
984
1496
  if (!marker) continue;
985
- const markerPath = isAbsolute(marker) ? marker : join5(projectRoot, marker);
1497
+ const markerPath = isAbsolute(marker) ? marker : join7(projectRoot, marker);
986
1498
  out[toolId] = [fileEntry(markerPath, "bridge", false)];
987
1499
  }
988
1500
  return out;
@@ -990,20 +1502,20 @@ function filesByToolFromBridges(tools, projectRoot, scope, bridgeMarker) {
990
1502
  function expanduser(p) {
991
1503
  if (p === "~") return homedir();
992
1504
  if (p.startsWith("~/") || process.platform === "win32" && p.startsWith("~\\")) {
993
- return join5(homedir(), p.slice(2));
1505
+ return join7(homedir(), p.slice(2));
994
1506
  }
995
1507
  return p;
996
1508
  }
997
1509
  function resolveRecorded(raw, projectRoot) {
998
1510
  const expanded = expanduser(raw);
999
- return isAbsolute(expanded) ? resolve3(expanded) : resolve3(projectRoot, expanded);
1511
+ return isAbsolute(expanded) ? resolve5(expanded) : resolve5(projectRoot, expanded);
1000
1512
  }
1001
1513
  function readRecordedByTool(manifestPath, projectRoot) {
1002
1514
  const out = /* @__PURE__ */ new Map();
1003
- if (!existsSync2(manifestPath)) return out;
1515
+ if (!existsSync4(manifestPath)) return out;
1004
1516
  let doc;
1005
1517
  try {
1006
- doc = YAML2.parse(readFileSync4(manifestPath, "utf8"));
1518
+ doc = YAML2.parse(readFileSync6(manifestPath, "utf8"));
1007
1519
  } catch {
1008
1520
  return out;
1009
1521
  }
@@ -1057,7 +1569,7 @@ function reconcileToolFiles(fresh, prior, preserved) {
1057
1569
  const seen = /* @__PURE__ */ new Set();
1058
1570
  for (const entry of fresh) {
1059
1571
  const raw = entry["path"];
1060
- if (typeof raw === "string") seen.add(resolve3(expanduser(raw)));
1572
+ if (typeof raw === "string") seen.add(resolve5(expanduser(raw)));
1061
1573
  }
1062
1574
  const out = [...fresh];
1063
1575
  for (const file of prior.files) {
@@ -1073,18 +1585,106 @@ function preservedIndex(preservedTargets, staged) {
1073
1585
  for (const target of preservedTargets) {
1074
1586
  const sidecar = sidecarPathFor(target);
1075
1587
  const sha = staged.get(sidecar) ?? null;
1076
- out.set(resolve3(target), {
1588
+ out.set(resolve5(target), {
1077
1589
  sha256: sha,
1078
1590
  sidecar: sha === null ? null : { path: sidecar, kind: "sidecar", sha256: sha }
1079
1591
  });
1080
1592
  }
1081
1593
  return out;
1082
1594
  }
1595
+ function dropGlobalScopeFiles(entries, deployed) {
1596
+ for (const entry of entries) {
1597
+ if (entry["scope"] === "global" && deployed.has(String(entry["name"]))) entry["files"] = [];
1598
+ }
1599
+ return entries;
1600
+ }
1601
+
1602
+ // src/install/ownershipLedger.ts
1603
+ import * as fs8 from "node:fs";
1604
+ import * as path8 from "node:path";
1605
+ function relUnder(anchor, abs) {
1606
+ let real = anchor;
1607
+ try {
1608
+ real = fs8.realpathSync(anchor);
1609
+ } catch {
1610
+ }
1611
+ for (const base of [anchor, real]) {
1612
+ const rel = path8.relative(path8.resolve(base), path8.resolve(abs));
1613
+ if (rel !== "" && !rel.startsWith("..") && !path8.isAbsolute(rel)) {
1614
+ return rel.split(path8.sep).join("/");
1615
+ }
1616
+ }
1617
+ return null;
1618
+ }
1619
+ function recordGlobalDeploy(r) {
1620
+ const inventory = load_inventory(r.inventoryPath ?? null);
1621
+ const previous = recorded_digests(r.toolId, r.anchor, inventory);
1622
+ const sidecars = /* @__PURE__ */ new Map();
1623
+ for (const [abs, digest] of r.staged) {
1624
+ const rel = relUnder(r.anchor, abs);
1625
+ if (rel !== null && digest !== null) sidecars.set(rel, digest);
1626
+ }
1627
+ const keep = /* @__PURE__ */ new Set([...r.currentFiles, ...sidecars.keys()]);
1628
+ const retainedAbs = [];
1629
+ let reaped = [];
1630
+ const tools = inventory["tools"] ?? {};
1631
+ if (r.toolId in tools) {
1632
+ reaped = reaped.concat(
1633
+ reap_stale(r.toolId, r.anchor, keep, inventory, false, retainedAbs)
1634
+ );
1635
+ }
1636
+ reaped = reaped.concat(
1637
+ reap_tagged_orphans(
1638
+ r.anchor,
1639
+ [...r.destSubs],
1640
+ keep,
1641
+ r.packageTag,
1642
+ false,
1643
+ previous,
1644
+ retainedAbs
1645
+ )
1646
+ );
1647
+ const preservedRel = /* @__PURE__ */ new Set();
1648
+ for (const abs of r.preserved) {
1649
+ const rel = relUnder(r.anchor, abs);
1650
+ if (rel !== null) preservedRel.add(rel);
1651
+ }
1652
+ const digests = /* @__PURE__ */ new Map();
1653
+ for (const rel of r.currentFiles) {
1654
+ const abs = path8.join(r.anchor, rel);
1655
+ if (preservedRel.has(rel)) {
1656
+ const staged = r.staged.get(sidecarPathFor(abs)) ?? null;
1657
+ const installed = staged ?? previous.get(rel)?.installed_sha256 ?? r.recordedFor(abs);
1658
+ if (typeof installed !== "string" || installed === "") continue;
1659
+ digests.set(rel, { installed_sha256: installed, packaged_sha256: staged ?? installed });
1660
+ continue;
1661
+ }
1662
+ const onDisk = file_sha256(abs);
1663
+ if (onDisk === null) continue;
1664
+ digests.set(rel, { installed_sha256: onDisk, packaged_sha256: onDisk });
1665
+ }
1666
+ for (const [rel, digest] of sidecars) {
1667
+ digests.set(rel, { installed_sha256: digest, packaged_sha256: digest, kind: "sidecar" });
1668
+ }
1669
+ const retained = [...new Set(retainedAbs)].sort();
1670
+ for (const abs of retained) {
1671
+ const rel = relUnder(r.anchor, abs);
1672
+ const prior = rel === null ? void 0 : previous.get(rel);
1673
+ if (rel === null || prior === void 0) continue;
1674
+ digests.set(rel, { installed_sha256: prior.installed_sha256, packaged_sha256: null });
1675
+ }
1676
+ record_deploy(r.toolId, r.anchorRaw, new Set(r.currentFiles), inventory, digests);
1677
+ save_inventory(inventory, r.inventoryPath ?? null);
1678
+ return { reaped: [...new Set(reaped)].sort(), retained };
1679
+ }
1680
+ function retainedFileMessage(target) {
1681
+ return `Kept ${target}: the package no longer ships this file, but it was edited after it was installed, so it was not deleted. It is no longer updated by agent-config; delete it yourself when you no longer need it.`;
1682
+ }
1083
1683
 
1084
1684
  // src/scripts/_lib/rule_layer_overlap.ts
1085
- import * as fs6 from "node:fs";
1086
- import * as os from "node:os";
1087
- import * as path6 from "node:path";
1685
+ import * as fs9 from "node:fs";
1686
+ import * as os2 from "node:os";
1687
+ import * as path9 from "node:path";
1088
1688
  var INSTALLER_PROVENANCE_KEYS = ["package", "source_path"];
1089
1689
  function stripProvenance(text) {
1090
1690
  const lines = text.split("\n");
@@ -1137,21 +1737,21 @@ function compareLayers(global_layer, project_layer) {
1137
1737
  }
1138
1738
  function hostRuleLayerDirs(projectRoot) {
1139
1739
  return [
1140
- path6.join(os.homedir(), ".claude", "rules"),
1141
- path6.join(projectRoot, ".claude", "rules")
1740
+ path9.join(os2.homedir(), ".claude", "rules"),
1741
+ path9.join(projectRoot, ".claude", "rules")
1142
1742
  ];
1143
1743
  }
1144
1744
  function readRuleLayer(dir) {
1145
1745
  let names;
1146
1746
  try {
1147
- names = fs6.readdirSync(dir);
1747
+ names = fs9.readdirSync(dir);
1148
1748
  } catch {
1149
1749
  return null;
1150
1750
  }
1151
1751
  const files = /* @__PURE__ */ new Map();
1152
1752
  for (const name of names.filter((n) => n.endsWith(".md")).sort()) {
1153
1753
  try {
1154
- files.set(name, fs6.readFileSync(path6.join(dir, name), "utf-8"));
1754
+ files.set(name, fs9.readFileSync(path9.join(dir, name), "utf-8"));
1155
1755
  } catch {
1156
1756
  continue;
1157
1757
  }
@@ -1159,7 +1759,7 @@ function readRuleLayer(dir) {
1159
1759
  return { dir, files };
1160
1760
  }
1161
1761
  function claudeMdExcludesGlob(dir) {
1162
- return `${path6.resolve(dir).replace(/\/+$/, "")}/**`;
1762
+ return `${path9.resolve(dir).replace(/\/+$/, "")}/**`;
1163
1763
  }
1164
1764
  function mergeClaudeMdExcludes(existing, entry) {
1165
1765
  if (!Array.isArray(existing)) return [entry];
@@ -1190,25 +1790,25 @@ function decideLayerAction(report, choice, global_dir, project_dir) {
1190
1790
  // src/scripts/_lib/install_drift.ts
1191
1791
  var import_yaml = __toESM(require_dist(), 1);
1192
1792
  import * as crypto3 from "node:crypto";
1193
- import * as fs7 from "node:fs";
1194
- import * as os2 from "node:os";
1195
- import * as path7 from "node:path";
1793
+ import * as fs10 from "node:fs";
1794
+ import * as os3 from "node:os";
1795
+ import * as path10 from "node:path";
1196
1796
  function expanduser2(p) {
1197
1797
  if (p === "~") {
1198
- return os2.homedir();
1798
+ return os3.homedir();
1199
1799
  }
1200
1800
  if (p.startsWith("~/") || process.platform === "win32" && p.startsWith("~\\")) {
1201
- return path7.join(os2.homedir(), p.slice(2));
1801
+ return path10.join(os3.homedir(), p.slice(2));
1202
1802
  }
1203
1803
  return p;
1204
1804
  }
1205
1805
  function resolve_entry_path(project_root, raw) {
1206
1806
  const p = expanduser2(raw);
1207
- return path7.isAbsolute(p) ? p : path7.join(project_root, p);
1807
+ return path10.isAbsolute(p) ? p : path10.join(project_root, p);
1208
1808
  }
1209
1809
  function sha256_of_file(p) {
1210
1810
  try {
1211
- return crypto3.createHash("sha256").update(fs7.readFileSync(p)).digest("hex");
1811
+ return crypto3.createHash("sha256").update(fs10.readFileSync(p)).digest("hex");
1212
1812
  } catch {
1213
1813
  return null;
1214
1814
  }
@@ -1217,7 +1817,7 @@ function collect_drift(project_root, env) {
1217
1817
  const target = manifest_path(project_root, env);
1218
1818
  let text;
1219
1819
  try {
1220
- text = fs7.readFileSync(target, "utf-8");
1820
+ text = fs10.readFileSync(target, "utf-8");
1221
1821
  } catch {
1222
1822
  return null;
1223
1823
  }
@@ -1262,7 +1862,7 @@ function collect_drift(project_root, env) {
1262
1862
  continue;
1263
1863
  }
1264
1864
  const resolved = resolve_entry_path(project_root, raw_path);
1265
- if (!fs7.existsSync(resolved)) {
1865
+ if (!fs10.existsSync(resolved)) {
1266
1866
  out.push({
1267
1867
  tool_id,
1268
1868
  path: resolved,
@@ -1314,185 +1914,6 @@ function format_drift_report(entries) {
1314
1914
  return lines.join("\n") + "\n";
1315
1915
  }
1316
1916
 
1317
- // src/scripts/_lib/skill_catalogue.ts
1318
- import * as fs8 from "node:fs";
1319
- import * as path8 from "node:path";
1320
- var PROJECT_CATALOGUE_ROOTS = ["src/skills", ".claude/skills"];
1321
- var HOST_CATALOGUE_ROOT = ".claude/skills";
1322
- var DEFAULT_CATALOGUE_ROOTS = [
1323
- ...PROJECT_CATALOGUE_ROOTS,
1324
- `~/${HOST_CATALOGUE_ROOT}`
1325
- ];
1326
- var OBSERVATION_LOG = path8.join(
1327
- "agents",
1328
- "evidence",
1329
- "metrics",
1330
- "skill-catalogue.jsonl"
1331
- );
1332
- function frontmatterOf(content) {
1333
- if (!content.startsWith("---")) return "";
1334
- const end = content.indexOf("\n---", 3);
1335
- if (end === -1) return "";
1336
- return content.slice(3, end);
1337
- }
1338
- function topLevelKeys(frontmatter) {
1339
- const keys = [];
1340
- for (const line of frontmatter.split("\n")) {
1341
- const match = /^([A-Za-z_][A-Za-z0-9_-]*):/.exec(line);
1342
- if (match) keys.push(match[1]);
1343
- }
1344
- return keys;
1345
- }
1346
- function descriptionOf(frontmatter) {
1347
- const lines = frontmatter.split("\n");
1348
- for (let i = 0; i < lines.length; i += 1) {
1349
- const match = /^description:\s*(.*)$/.exec(lines[i]);
1350
- if (!match) continue;
1351
- const rest = match[1].trim();
1352
- if (/^[|>][-+]?\d*$/.test(rest)) {
1353
- const body = [];
1354
- for (let j = i + 1; j < lines.length; j += 1) {
1355
- const line = lines[j];
1356
- if (line.trim() === "") {
1357
- body.push("");
1358
- continue;
1359
- }
1360
- if (!/^\s/.test(line)) break;
1361
- body.push(line.trim());
1362
- }
1363
- return body.join(" ").trim();
1364
- }
1365
- return rest.replace(/^["']|["']$/g, "");
1366
- }
1367
- return "";
1368
- }
1369
- function readProjectedCatalogue(root) {
1370
- const names = fs8.readdirSync(root).filter((n) => fs8.existsSync(path8.join(root, n, "SKILL.md"))).sort();
1371
- return names.map((name, index) => {
1372
- const content = fs8.readFileSync(path8.join(root, name, "SKILL.md"), "utf-8");
1373
- const frontmatter = frontmatterOf(content);
1374
- const description = descriptionOf(frontmatter);
1375
- return {
1376
- name,
1377
- position: index + 1,
1378
- hasDescription: description.length > 0,
1379
- descriptionLength: description.length,
1380
- description,
1381
- frontmatterKeys: topLevelKeys(frontmatter)
1382
- };
1383
- });
1384
- }
1385
- function truncationModeOf(record) {
1386
- return record.truncation_mode ?? "per-entry";
1387
- }
1388
- function markdownFilesUnder(root) {
1389
- if (!fs8.existsSync(root)) return [];
1390
- const out = [];
1391
- const walk = (dir) => {
1392
- for (const entry of fs8.readdirSync(dir, { withFileTypes: true })) {
1393
- const full = path8.join(dir, entry.name);
1394
- if (fs8.statSync(full).isDirectory()) walk(full);
1395
- else if (entry.name.endsWith(".md")) out.push(full);
1396
- }
1397
- };
1398
- walk(root);
1399
- return out;
1400
- }
1401
- function measureCatalogueVolume(host, root) {
1402
- const skillsRoot = path8.join(root, "skills");
1403
- const skills = fs8.existsSync(skillsRoot) ? readProjectedCatalogue(skillsRoot) : [];
1404
- const commandEntries = markdownFilesUnder(path8.join(root, "commands")).length;
1405
- return {
1406
- host,
1407
- root,
1408
- skillEntries: skills.length,
1409
- commandEntries,
1410
- artefacts: skills.length + commandEntries,
1411
- descriptionBytes: skills.reduce((sum, e) => sum + Buffer.byteLength(e.description), 0)
1412
- };
1413
- }
1414
- function _supersedes(candidate, incumbent) {
1415
- if (candidate.observed_at !== incumbent.observed_at) {
1416
- return candidate.observed_at > incumbent.observed_at;
1417
- }
1418
- return (candidate.dropped_count ?? 0) > (incumbent.dropped_count ?? 0);
1419
- }
1420
- function knownHostLimits(records) {
1421
- const out = /* @__PURE__ */ new Map();
1422
- const chosen = /* @__PURE__ */ new Map();
1423
- for (const record of records) {
1424
- if (truncationModeOf(record) !== "budget-strip-and-drop") continue;
1425
- if (typeof record.dropped_count !== "number") continue;
1426
- if (record.dropped_count <= 0) continue;
1427
- const previous = chosen.get(record.host);
1428
- if (previous !== void 0 && !_supersedes(record, previous)) continue;
1429
- chosen.set(record.host, record);
1430
- out.set(record.host, {
1431
- host: record.host,
1432
- droppedEntries: record.dropped_count,
1433
- projectedVolume: record.entries_total,
1434
- projectedSkills: record.projected_skill_count ?? null,
1435
- observedAt: record.observed_at
1436
- });
1437
- }
1438
- return out;
1439
- }
1440
- function catalogueLimitWarning(volume, limit) {
1441
- if (limit === void 0) return null;
1442
- if (limit.projectedSkills === null) return null;
1443
- if (volume.skillEntries < limit.projectedSkills) return null;
1444
- return `${volume.host}: deploying ${volume.skillEntries} skills. This host reported dropping ${limit.droppedEntries} entries from the model-visible list when last measured (${limit.observedAt}, at ${limit.projectedSkills} skills) \u2014 that much never reaches the model. Explain: \`agent-config exec capture_skill_catalogue --limits\``;
1445
- }
1446
- function migrationEligibility(host, resolvedMode, currentSkillCount, limits) {
1447
- if (resolvedMode === "scoped") return { eligible: false, reason: "already-scoped" };
1448
- if (resolvedMode === "tiered") return { eligible: false, reason: "already-tiered" };
1449
- const limit = limits.get(host);
1450
- if (limit === void 0) return { eligible: false, reason: "no-observation-for-host" };
1451
- if (limit.projectedSkills === null) return { eligible: false, reason: "observation-not-comparable" };
1452
- if (limit.droppedEntries <= 0) return { eligible: false, reason: "no-truncation-observed" };
1453
- if (currentSkillCount < limit.projectedSkills) {
1454
- return { eligible: false, reason: "below-observed-skill-volume" };
1455
- }
1456
- return {
1457
- eligible: true,
1458
- reason: "eligible",
1459
- droppedEntries: limit.droppedEntries,
1460
- observedAt: limit.observedAt
1461
- };
1462
- }
1463
- function migrationPromptLines(host, eligibility, settingsPath) {
1464
- return [
1465
- `${host}: ${eligibility.droppedEntries} catalogue entries never reach the model.`,
1466
- `Measured on this machine (${eligibility.observedAt}). This install is on \`legacy-all\`,`,
1467
- "which ships everything and lets the host drop what does not fit \u2014 silently.",
1468
- "",
1469
- "Scoping the projection to your active packs is the alternative. Nothing here",
1470
- "changes it for you: `projection.mode` is yours to set, by hand or in the GUI.",
1471
- "",
1472
- ` edit ${settingsPath}`,
1473
- " projection:",
1474
- " mode: scoped",
1475
- "",
1476
- " or agent-config config (Settings \u2192 projection)",
1477
- "",
1478
- "Keeping `legacy-all` is a legitimate choice \u2014 this is a notification, not a gate."
1479
- ];
1480
- }
1481
- function readObservationLog(logPath) {
1482
- if (!fs8.existsSync(logPath)) return [];
1483
- const out = [];
1484
- for (const line of fs8.readFileSync(logPath, "utf-8").split("\n")) {
1485
- const trimmed = line.trim();
1486
- if (trimmed.length === 0) continue;
1487
- try {
1488
- out.push(JSON.parse(trimmed));
1489
- } catch {
1490
- continue;
1491
- }
1492
- }
1493
- return out;
1494
- }
1495
-
1496
1917
  // src/shared/interactiveContext.ts
1497
1918
  var CI_ENV_KEYS = ["CI", "GITHUB_ACTIONS", "AGENT_CONFIG_CI"];
1498
1919
  function _flagSet(env, key) {
@@ -1522,8 +1943,8 @@ function isInteractiveSession(probe) {
1522
1943
 
1523
1944
  // src/scripts/_lib/claude_desktop_bundler.ts
1524
1945
  import * as crypto4 from "node:crypto";
1525
- import * as fs9 from "node:fs";
1526
- import * as path9 from "node:path";
1946
+ import * as fs11 from "node:fs";
1947
+ import * as path11 from "node:path";
1527
1948
 
1528
1949
  // src/scripts/_lib/zip_min.ts
1529
1950
  import * as zlib from "node:zlib";
@@ -1630,7 +2051,7 @@ function _is_excluded(rel_parts) {
1630
2051
  }
1631
2052
  function _is_dir(p) {
1632
2053
  try {
1633
- return fs9.statSync(p).isDirectory();
2054
+ return fs11.statSync(p).isDirectory();
1634
2055
  } catch {
1635
2056
  return false;
1636
2057
  }
@@ -1642,12 +2063,12 @@ function _compare_rel_parts(a, b) {
1642
2063
  }
1643
2064
  function _walk_skill_files(skill_dir) {
1644
2065
  const out = [];
1645
- const resolved = fs9.realpathSync(skill_dir);
2066
+ const resolved = fs11.realpathSync(skill_dir);
1646
2067
  const walk = (root, relRoot) => {
1647
2068
  const dirNames = [];
1648
2069
  const fileNames = [];
1649
- for (const dirent of fs9.readdirSync(root, { withFileTypes: true })) {
1650
- const full = path9.join(root, dirent.name);
2070
+ for (const dirent of fs11.readdirSync(root, { withFileTypes: true })) {
2071
+ const full = path11.join(root, dirent.name);
1651
2072
  const isDir2 = dirent.isDirectory() || dirent.isSymbolicLink() && _is_dir(full);
1652
2073
  if (isDir2) {
1653
2074
  dirNames.push(dirent.name);
@@ -1660,13 +2081,13 @@ function _walk_skill_files(skill_dir) {
1660
2081
  if (_is_excluded(rel_parts)) {
1661
2082
  continue;
1662
2083
  }
1663
- out.push([path9.join(root, fname), rel_parts]);
2084
+ out.push([path11.join(root, fname), rel_parts]);
1664
2085
  }
1665
2086
  for (const dname of dirNames) {
1666
2087
  if (_is_excluded([dname])) {
1667
2088
  continue;
1668
2089
  }
1669
- walk(path9.join(root, dname), [...relRoot, dname]);
2090
+ walk(path11.join(root, dname), [...relRoot, dname]);
1670
2091
  }
1671
2092
  };
1672
2093
  walk(resolved, []);
@@ -1679,53 +2100,53 @@ function _manifest_digest(files) {
1679
2100
  const rel = rel_parts.join("/");
1680
2101
  h.update(Buffer.from(rel, "utf-8"));
1681
2102
  h.update(Buffer.from([0]));
1682
- h.update(crypto4.createHash("sha256").update(fs9.readFileSync(abs_path)).digest());
2103
+ h.update(crypto4.createHash("sha256").update(fs11.readFileSync(abs_path)).digest());
1683
2104
  h.update(Buffer.from([0]));
1684
2105
  }
1685
2106
  return h.digest("hex");
1686
2107
  }
1687
2108
  function _atomic_write_zip(zip_path, files) {
1688
- fs9.mkdirSync(path9.dirname(zip_path), { recursive: true });
1689
- const stem = path9.basename(zip_path, path9.extname(zip_path));
1690
- const tmp_path = path9.join(
1691
- path9.dirname(zip_path),
2109
+ fs11.mkdirSync(path11.dirname(zip_path), { recursive: true });
2110
+ const stem = path11.basename(zip_path, path11.extname(zip_path));
2111
+ const tmp_path = path11.join(
2112
+ path11.dirname(zip_path),
1692
2113
  `.${stem}.${crypto4.randomBytes(6).toString("hex")}.zip.tmp`
1693
2114
  );
1694
2115
  try {
1695
2116
  const entries = files.map(([abs_path, rel_parts]) => ({
1696
2117
  name: rel_parts.join("/"),
1697
- data: fs9.readFileSync(abs_path)
2118
+ data: fs11.readFileSync(abs_path)
1698
2119
  }));
1699
- fs9.writeFileSync(tmp_path, zip_write_sync(entries));
1700
- fs9.renameSync(tmp_path, zip_path);
2120
+ fs11.writeFileSync(tmp_path, zip_write_sync(entries));
2121
+ fs11.renameSync(tmp_path, zip_path);
1701
2122
  } finally {
1702
- if (fs9.existsSync(tmp_path)) {
1703
- fs9.unlinkSync(tmp_path);
2123
+ if (fs11.existsSync(tmp_path)) {
2124
+ fs11.unlinkSync(tmp_path);
1704
2125
  }
1705
2126
  }
1706
2127
  }
1707
2128
  function _write_if_changed(dest_dir, slug, files, force, written) {
1708
2129
  const digest = _manifest_digest(files);
1709
- const zip_path = path9.join(dest_dir, `${slug}.zip`);
1710
- const digest_path = path9.join(dest_dir, `${slug}.sha256`);
1711
- const recorded = fs9.existsSync(digest_path) ? fs9.readFileSync(digest_path, "utf-8").trim() : "";
1712
- if (!force && recorded === digest && fs9.existsSync(zip_path)) {
2130
+ const zip_path = path11.join(dest_dir, `${slug}.zip`);
2131
+ const digest_path = path11.join(dest_dir, `${slug}.sha256`);
2132
+ const recorded = fs11.existsSync(digest_path) ? fs11.readFileSync(digest_path, "utf-8").trim() : "";
2133
+ if (!force && recorded === digest && fs11.existsSync(zip_path)) {
1713
2134
  return;
1714
2135
  }
1715
2136
  _atomic_write_zip(zip_path, files);
1716
- fs9.writeFileSync(digest_path, digest + "\n", "utf-8");
2137
+ fs11.writeFileSync(digest_path, digest + "\n", "utf-8");
1717
2138
  written.push(zip_path);
1718
2139
  }
1719
2140
  function build_skill_bundles(package_root, dest_dir, force = false, curation = null) {
1720
- const skills_root = path9.join(package_root, "dist/agent-src", "skills");
2141
+ const skills_root = path11.join(package_root, "dist/agent-src", "skills");
1721
2142
  if (!_is_dir(skills_root)) {
1722
2143
  return [];
1723
2144
  }
1724
- fs9.mkdirSync(dest_dir, { recursive: true });
2145
+ fs11.mkdirSync(dest_dir, { recursive: true });
1725
2146
  const written = [];
1726
- for (const name of fs9.readdirSync(skills_root).sort()) {
1727
- const entry = path9.join(skills_root, name);
1728
- const isSymlink2 = fs9.lstatSync(entry).isSymbolicLink();
2147
+ for (const name of fs11.readdirSync(skills_root).sort()) {
2148
+ const entry = path11.join(skills_root, name);
2149
+ const isSymlink2 = fs11.lstatSync(entry).isSymbolicLink();
1729
2150
  if (!(_is_dir(entry) || isSymlink2)) {
1730
2151
  continue;
1731
2152
  }
@@ -1733,8 +2154,8 @@ function build_skill_bundles(package_root, dest_dir, force = false, curation = n
1733
2154
  if (curation !== null && !curation.includes(skill_name)) {
1734
2155
  continue;
1735
2156
  }
1736
- const skill_md = path9.join(entry, "SKILL.md");
1737
- if (!fs9.existsSync(skill_md)) {
2157
+ const skill_md = path11.join(entry, "SKILL.md");
2158
+ if (!fs11.existsSync(skill_md)) {
1738
2159
  continue;
1739
2160
  }
1740
2161
  const files = _walk_skill_files(entry);
@@ -1746,15 +2167,15 @@ function build_skill_bundles(package_root, dest_dir, force = false, curation = n
1746
2167
  return written;
1747
2168
  }
1748
2169
  function _command_slug(source_file, commands_root) {
1749
- const rel = path9.relative(commands_root, source_file);
1750
- const noExt = rel.slice(0, rel.length - path9.extname(rel).length);
1751
- return noExt.split(path9.sep).join("-");
2170
+ const rel = path11.relative(commands_root, source_file);
2171
+ const noExt = rel.slice(0, rel.length - path11.extname(rel).length);
2172
+ return noExt.split(path11.sep).join("-");
1752
2173
  }
1753
2174
  function _iter_command_files(commands_root) {
1754
2175
  const found = [];
1755
2176
  const walk = (dir) => {
1756
- for (const dirent of fs9.readdirSync(dir, { withFileTypes: true })) {
1757
- const full = path9.join(dir, dirent.name);
2177
+ for (const dirent of fs11.readdirSync(dir, { withFileTypes: true })) {
2178
+ const full = path11.join(dir, dirent.name);
1758
2179
  if (dirent.isDirectory() || dirent.isSymbolicLink() && _is_dir(full)) {
1759
2180
  walk(full);
1760
2181
  } else if (dirent.name.endsWith(".md")) {
@@ -1764,21 +2185,21 @@ function _iter_command_files(commands_root) {
1764
2185
  };
1765
2186
  walk(commands_root);
1766
2187
  found.sort((a, b) => a < b ? -1 : a > b ? 1 : 0);
1767
- return found.filter((source_file) => path9.basename(source_file) !== "AGENTS.md");
2188
+ return found.filter((source_file) => path11.basename(source_file) !== "AGENTS.md");
1768
2189
  }
1769
2190
  function build_command_bundles(package_root, dest_dir, force = false, curation = null) {
1770
- const commands_root = path9.join(package_root, "dist/agent-src", "commands");
2191
+ const commands_root = path11.join(package_root, "dist/agent-src", "commands");
1771
2192
  if (!_is_dir(commands_root)) {
1772
2193
  return [];
1773
2194
  }
1774
- const skills_root = path9.join(package_root, "dist/agent-src", "skills");
2195
+ const skills_root = path11.join(package_root, "dist/agent-src", "skills");
1775
2196
  let skill_names = /* @__PURE__ */ new Set();
1776
2197
  if (_is_dir(skills_root)) {
1777
2198
  skill_names = new Set(
1778
- fs9.readdirSync(skills_root).filter((name) => _is_dir(path9.join(skills_root, name)))
2199
+ fs11.readdirSync(skills_root).filter((name) => _is_dir(path11.join(skills_root, name)))
1779
2200
  );
1780
2201
  }
1781
- fs9.mkdirSync(dest_dir, { recursive: true });
2202
+ fs11.mkdirSync(dest_dir, { recursive: true });
1782
2203
  const written = [];
1783
2204
  for (const source_file of _iter_command_files(commands_root)) {
1784
2205
  const slug = _command_slug(source_file, commands_root);
@@ -1788,180 +2209,73 @@ function build_command_bundles(package_root, dest_dir, force = false, curation =
1788
2209
  if (curation !== null && !curation.includes(slug)) {
1789
2210
  continue;
1790
2211
  }
1791
- const files = [[fs9.realpathSync(source_file), ["SKILL.md"]]];
2212
+ const files = [[fs11.realpathSync(source_file), ["SKILL.md"]]];
1792
2213
  _write_if_changed(dest_dir, slug, files, force, written);
1793
2214
  }
1794
2215
  return written;
1795
2216
  }
1796
2217
 
1797
- // src/scripts/hooks/host_lowering.ts
1798
- var import_yaml2 = __toESM(require_dist(), 1);
1799
- import * as fs10 from "node:fs";
1800
- import * as path10 from "node:path";
1801
- import { fileURLToPath } from "node:url";
1802
-
1803
- // src/scripts/hooks/table_fingerprint.ts
1804
- import { createHash as createHash5 } from "node:crypto";
1805
- function tableFingerprint(text) {
1806
- const digest = createHash5("sha256").update(text, "utf-8").digest("hex");
1807
- return `${digest}:${String(text.length)}`;
1808
- }
1809
-
1810
- // src/scripts/hooks/host_lowering.ts
1811
- var _IN_BUNDLE = true;
1812
- var _REPO_ROOT = path10.resolve(
1813
- path10.dirname(fileURLToPath(import.meta.url)),
1814
- ..._IN_BUNDLE ? ["..", ".."] : ["..", "..", ".."]
1815
- );
1816
- var HOST_LOWERING_PATH = path10.join(_REPO_ROOT, "src", "scripts", "hooks", "host_lowering.yaml");
1817
- var HOST_LOWERING_JSON_PATH = path10.join(_REPO_ROOT, "src", "scripts", "hooks", "host_lowering.json");
1818
- var DEFAULT_SURFACE = "any";
1819
- function _asString(v) {
1820
- if (v === null || v === void 0) return null;
1821
- if (v instanceof Date) return v.toISOString().slice(0, 10);
1822
- return String(v);
1823
- }
1824
- function _parse(text) {
1825
- return _structure((0, import_yaml2.parse)(text));
1826
- }
1827
- function _structure(raw) {
1828
- const hostsRaw = raw?.["hosts"];
1829
- if (typeof hostsRaw !== "object" || hostsRaw === null) {
1830
- throw new Error("host_lowering.yaml: missing `hosts:` map");
1831
- }
1832
- const out = /* @__PURE__ */ new Map();
1833
- for (const [host, hv] of Object.entries(hostsRaw)) {
1834
- const surfacesRaw = hv?.["surfaces"];
1835
- if (typeof surfacesRaw !== "object" || surfacesRaw === null) {
1836
- throw new Error(`host_lowering.yaml: ${host} has no \`surfaces:\` map`);
1837
- }
1838
- const surfaces = /* @__PURE__ */ new Map();
1839
- for (const [surface, sv] of Object.entries(surfacesRaw)) {
1840
- const s = sv;
1841
- const verifiedRaw = s["verified"];
1842
- let verified = null;
1843
- if (verifiedRaw) {
1844
- const expires = _asString(verifiedRaw["expires"]);
1845
- if (!expires) {
1846
- throw new Error(`host_lowering.yaml: ${host}/${surface} verified block has no \`expires\``);
1847
- }
1848
- verified = {
1849
- docs_at: _asString(verifiedRaw["docs_at"]),
1850
- docs_url: _asString(verifiedRaw["docs_url"]),
1851
- docs_digest: _asString(verifiedRaw["docs_digest"]),
1852
- probe_at: _asString(verifiedRaw["probe_at"]),
1853
- host_version: _asString(verifiedRaw["host_version"]),
1854
- expires
1855
- };
1856
- }
1857
- const slots = /* @__PURE__ */ new Map();
1858
- for (const [slot, rvRaw] of Object.entries(s["slots"] ?? {})) {
1859
- const rv = rvRaw;
1860
- const nativeRaw = rv["native"];
1861
- const native = Array.isArray(nativeRaw) ? nativeRaw.map(String) : [String(nativeRaw)];
1862
- const be = rv["block_exit"];
1863
- const row = {
1864
- native,
1865
- block_exit: typeof be === "number" ? be : null,
1866
- answered_at: _asString(rv["answered_at"]),
1867
- docs_url: _asString(rv["docs_url"])
1868
- };
1869
- if (typeof rv["matcher"] === "string") row.matcher = rv["matcher"];
1870
- slots.set(slot, row);
1871
- }
1872
- surfaces.set(surface, {
1873
- entry_shape: String(s["entry_shape"] ?? "none"),
1874
- json_shape: String(s["json_shape"] ?? "none"),
1875
- fail_policy: String(s["fail_policy"] ?? "discard"),
1876
- timeout_unit: String(s["timeout_unit"] ?? "unknown"),
1877
- timeout_default: typeof s["timeout_default"] === "number" ? s["timeout_default"] : null,
1878
- verified,
1879
- slots
1880
- });
1881
- }
1882
- out.set(host, surfaces);
1883
- }
1884
- return out;
1885
- }
1886
- var _cache = null;
1887
- function loadHostLowering() {
1888
- if (_cache !== null) return _cache;
1889
- const text = fs10.readFileSync(HOST_LOWERING_PATH, "utf-8");
1890
- let compiled;
1891
- try {
1892
- compiled = fs10.readFileSync(HOST_LOWERING_JSON_PATH, "utf-8");
1893
- } catch {
1894
- compiled = null;
1895
- }
1896
- _cache = resolveTable(text, compiled);
1897
- return _cache;
1898
- }
1899
- function resolveTable(yamlText, compiledText) {
1900
- if (compiledText !== null) {
1901
- try {
1902
- const raw = JSON.parse(compiledText);
1903
- const table = raw["table"];
1904
- if (raw["fingerprint"] === tableFingerprint(yamlText) && typeof table === "object" && table !== null && // road-to-blocking-severities 2.3 — the BODY, not only its
1905
- // label. `fingerprint` above says the file was compiled from
1906
- // the YAML as it stands; it says nothing about whether the
1907
- // body underneath was edited afterwards, and an edited body
1908
- // with an untouched label was served. `body_fingerprint` is
1909
- // the fingerprint of the exact bytes the compiler emitted, so
1910
- // re-stringifying what we just parsed recovers them.
1911
- //
1912
- // A compiled file WITHOUT the field — one written before 2.3 —
1913
- // falls through here, which is slow and correct: accepting it
1914
- // would make the check optional and therefore absent.
1915
- //
1916
- // What it covers is a partial edit, never an author: anyone
1917
- // who edits the body can recompute this as easily as the
1918
- // compiler. The deny in `block_plumbing_writes` and the
1919
- // ratification record are the mechanisms aimed at an author;
1920
- // this one is aimed at a mistake.
1921
- raw["body_fingerprint"] === tableFingerprint(JSON.stringify(table))) {
1922
- return _structure(table);
1923
- }
1924
- } catch {
1925
- }
2218
+ // src/scripts/_lib/projection_key_migration.ts
2219
+ var MIGRATION_WINDOW = "one release window after the 2026-10 key removal";
2220
+ var LEGACY_FULL_VALUE = Object.freeze({
2221
+ "lean_projection.mode": "eager-all",
2222
+ "projection.mode": "legacy-all"
2223
+ });
2224
+ function readDotted(root, dotted) {
2225
+ let node = root;
2226
+ for (const part of dotted.split(".")) {
2227
+ if (typeof node !== "object" || node === null || Array.isArray(node)) return void 0;
2228
+ node = node[part];
1926
2229
  }
1927
- return _parse(yamlText);
2230
+ return node;
1928
2231
  }
1929
- function surfaceRow(host, surface = DEFAULT_SURFACE, table = loadHostLowering()) {
1930
- return table.get(host)?.get(surface) ?? table.get(host)?.get(DEFAULT_SURFACE) ?? null;
2232
+ function readLegacyProjectionIntent(merged) {
2233
+ const rows = [];
2234
+ let pin = false;
2235
+ for (const [key, full] of Object.entries(LEGACY_FULL_VALUE)) {
2236
+ const raw = readDotted(merged, key);
2237
+ if (typeof raw !== "string") continue;
2238
+ const value = raw.trim();
2239
+ if (value === "") continue;
2240
+ const disposition = value.toLowerCase() === full ? "pin" : "dropped";
2241
+ if (disposition === "pin") pin = true;
2242
+ rows.push({ key, value, disposition });
2243
+ }
2244
+ return { pin, rows };
2245
+ }
2246
+ function migrationLines(intent) {
2247
+ return intent.rows.map(
2248
+ (row) => row.disposition === "pin" ? `${row.key}: "${row.value}" was removed (ADR-293); read once as a request to keep the rule layer full, and kept as the install receipt's pin \u2014 ${MIGRATION_WINDOW}.` : `${row.key}: "${row.value}" was removed (ADR-293); ignored \u2014 the package decides the layer form from machine evidence, and \`doctor --check layer-form\` says which form it chose and why \u2014 ${MIGRATION_WINDOW}.`
2249
+ );
1931
2250
  }
1932
- function hostBindings(host, table = loadHostLowering()) {
1933
- const row = surfaceRow(host, DEFAULT_SURFACE, table);
1934
- if (!row) return [];
1935
- const out = [];
1936
- for (const [slot, sr] of row.slots) {
1937
- for (const native of sr.native) {
1938
- out.push({ slot, native, matcher: sr.matcher ?? "" });
1939
- }
1940
- }
1941
- return out;
2251
+ function legacyProjectionPin(merged, emit) {
2252
+ if (merged === null) return false;
2253
+ const intent = readLegacyProjectionIntent(merged);
2254
+ for (const line of migrationLines(intent)) emit(line);
2255
+ return intent.pin;
1942
2256
  }
1943
2257
 
1944
2258
  // src/install/partitionEligibility.ts
1945
- import * as fs12 from "node:fs";
1946
- import * as os3 from "node:os";
2259
+ import * as fs13 from "node:fs";
2260
+ import * as os4 from "node:os";
1947
2261
 
1948
2262
  // src/install/hostLayerFingerprint.ts
1949
2263
  import { createHash as createHash6 } from "node:crypto";
1950
- import * as fs11 from "node:fs";
1951
- import * as path11 from "node:path";
2264
+ import * as fs12 from "node:fs";
2265
+ import * as path12 from "node:path";
1952
2266
  var FINGERPRINT_SCHEMA = 1;
1953
2267
  function collectFiles(dir) {
1954
2268
  const out = [];
1955
2269
  const walk = (d) => {
1956
2270
  let entries;
1957
2271
  try {
1958
- entries = fs11.readdirSync(d, { withFileTypes: true });
2272
+ entries = fs12.readdirSync(d, { withFileTypes: true });
1959
2273
  } catch {
1960
2274
  return;
1961
2275
  }
1962
2276
  const sorted = [...entries].sort((a, b) => a.name < b.name ? -1 : a.name > b.name ? 1 : 0);
1963
2277
  for (const e of sorted) {
1964
- const p = path11.join(d, e.name);
2278
+ const p = path12.join(d, e.name);
1965
2279
  if (e.isDirectory()) {
1966
2280
  walk(p);
1967
2281
  } else if (e.isFile()) {
@@ -1978,10 +2292,10 @@ function fingerprintLayers(layers) {
1978
2292
  for (const layer of layers) {
1979
2293
  h.update(`layer:${layer.label}\0`);
1980
2294
  for (const file of collectFiles(layer.root)) {
1981
- h.update(path11.relative(layer.root, file));
2295
+ h.update(path12.relative(layer.root, file));
1982
2296
  h.update("\0");
1983
2297
  try {
1984
- h.update(fs11.readFileSync(file));
2298
+ h.update(fs12.readFileSync(file));
1985
2299
  } catch {
1986
2300
  h.update("\0unreadable\0");
1987
2301
  }
@@ -1991,11 +2305,11 @@ function fingerprintLayers(layers) {
1991
2305
  return h.digest("hex");
1992
2306
  }
1993
2307
  function hostLayerInputs(userHome) {
1994
- const claude = path11.join(userHome, ".claude");
2308
+ const claude = path12.join(userHome, ".claude");
1995
2309
  return [
1996
- { label: "rules", root: path11.join(claude, "rules") },
1997
- { label: "skills", root: path11.join(claude, "skills") },
1998
- { label: "commands", root: path11.join(claude, "commands") }
2310
+ { label: "rules", root: path12.join(claude, "rules") },
2311
+ { label: "skills", root: path12.join(claude, "skills") },
2312
+ { label: "commands", root: path12.join(claude, "commands") }
1999
2313
  ];
2000
2314
  }
2001
2315
 
@@ -2004,7 +2318,7 @@ var MAINTAINER_WORKSPACE = "agent-config-maintainer";
2004
2318
  function isExclusivelyPackageOnly(source_path) {
2005
2319
  let meta;
2006
2320
  try {
2007
- [meta] = parseFrontmatter(fs12.readFileSync(source_path, "utf-8"));
2321
+ [meta] = parseFrontmatter(fs13.readFileSync(source_path, "utf-8"));
2008
2322
  } catch {
2009
2323
  return false;
2010
2324
  }
@@ -2019,7 +2333,7 @@ function stampHostLayerFingerprint(installedVersion, tools, lockfilePath, skip2,
2019
2333
  return null;
2020
2334
  }
2021
2335
  try {
2022
- const fingerprint = fingerprintLayers(hostLayerInputs(os3.homedir()));
2336
+ const fingerprint = fingerprintLayers(hostLayerInputs(os4.homedir()));
2023
2337
  write_lockfile(installedVersion, [...tools], {
2024
2338
  path: lockfilePath,
2025
2339
  host_layer_fingerprint: fingerprint
@@ -2035,8 +2349,8 @@ function stampHostLayerFingerprint(installedVersion, tools, lockfilePath, skip2,
2035
2349
  }
2036
2350
 
2037
2351
  // src/install/claudeRuleRewrite.ts
2038
- import * as fs13 from "node:fs";
2039
- import * as path12 from "node:path";
2352
+ import * as fs14 from "node:fs";
2353
+ import * as path13 from "node:path";
2040
2354
 
2041
2355
  // src/install/claudePathsPlan.ts
2042
2356
  function derive_trigger_globs(meta) {
@@ -2205,23 +2519,23 @@ function rewriteClaudeRules(rulesDir, preserved = /* @__PURE__ */ new Set()) {
2205
2519
  const result = { rewritten: 0, scoped: [], dropped: [], failed: [] };
2206
2520
  let entries;
2207
2521
  try {
2208
- entries = fs13.readdirSync(rulesDir);
2522
+ entries = fs14.readdirSync(rulesDir);
2209
2523
  } catch {
2210
2524
  return result;
2211
2525
  }
2212
2526
  for (const name of entries.filter((n) => n.endsWith(".md")).sort()) {
2213
- const full = path12.join(rulesDir, name);
2214
- if (preserved.has(path12.resolve(full))) continue;
2527
+ const full = path13.join(rulesDir, name);
2528
+ if (preserved.has(path13.resolve(full))) continue;
2215
2529
  let stat;
2216
2530
  try {
2217
- stat = fs13.lstatSync(full);
2531
+ stat = fs14.lstatSync(full);
2218
2532
  } catch {
2219
2533
  continue;
2220
2534
  }
2221
2535
  if (!stat.isFile() || stat.isSymbolicLink()) continue;
2222
2536
  let text;
2223
2537
  try {
2224
- text = fs13.readFileSync(full, "utf-8");
2538
+ text = fs14.readFileSync(full, "utf-8");
2225
2539
  } catch {
2226
2540
  continue;
2227
2541
  }
@@ -2231,7 +2545,7 @@ function rewriteClaudeRules(rulesDir, preserved = /* @__PURE__ */ new Set()) {
2231
2545
  const withOwnership = _withPreservedKeys(rendered.text, text);
2232
2546
  if (withOwnership !== text) {
2233
2547
  try {
2234
- fs13.writeFileSync(full, withOwnership, "utf-8");
2548
+ fs14.writeFileSync(full, withOwnership, "utf-8");
2235
2549
  } catch (e) {
2236
2550
  result.failed.push({
2237
2551
  rule: name.slice(0, -3),
@@ -2251,19 +2565,19 @@ function rewriteClaudeRules(rulesDir, preserved = /* @__PURE__ */ new Set()) {
2251
2565
  }
2252
2566
 
2253
2567
  // src/install/installThinLayer.ts
2568
+ import * as fs16 from "node:fs";
2569
+ import * as path16 from "node:path";
2570
+ import * as os7 from "node:os";
2571
+
2572
+ // src/scripts/_lib/installed_layer.ts
2254
2573
  import * as fs15 from "node:fs";
2255
- import * as path15 from "node:path";
2256
2574
  import * as os6 from "node:os";
2575
+ import * as path15 from "node:path";
2576
+ import { fileURLToPath } from "node:url";
2257
2577
 
2258
- // src/scripts/_lib/installed_layer.ts
2259
- import * as fs14 from "node:fs";
2578
+ // src/install/globalRuleLayers.ts
2260
2579
  import * as os5 from "node:os";
2261
2580
  import * as path14 from "node:path";
2262
- import { fileURLToPath as fileURLToPath2 } from "node:url";
2263
-
2264
- // src/install/globalRuleLayers.ts
2265
- import * as os4 from "node:os";
2266
- import * as path13 from "node:path";
2267
2581
  var GLOBAL_RULE_DIRS = {
2268
2582
  "claude-code": ".claude/rules",
2269
2583
  cursor: ".cursor/rules",
@@ -2273,9 +2587,17 @@ var GLOBAL_RULE_DIRS = {
2273
2587
  // Cline's scope root IS the rules directory — no `rules/` suffix.
2274
2588
  cline: "Documents/Cline/Rules"
2275
2589
  };
2276
- function globalRuleLayerPath(toolId, home = process.env["HOME"] ?? os4.homedir()) {
2590
+ function globalRuleLayerPath(toolId, home = process.env["HOME"] ?? os5.homedir()) {
2277
2591
  const rel = GLOBAL_RULE_DIRS[toolId];
2278
- return rel === void 0 ? null : path13.join(home, rel);
2592
+ return rel === void 0 ? null : path14.join(home, rel);
2593
+ }
2594
+
2595
+ // src/scripts/_lib/installed_layer_normalise.ts
2596
+ var ABSOLUTE_PATH_TOKEN = "<abs>";
2597
+ var POSIX_ABSOLUTE = /(?<![A-Za-z0-9._~%@+:/\\-])(?:\/[A-Za-z0-9._@+~-]+){2,}/g;
2598
+ var WINDOWS_ABSOLUTE = /(?<![A-Za-z0-9._~%@+:/\\-])[A-Za-z]:(?:[\\/][A-Za-z0-9._@+~-]+)+/g;
2599
+ function normaliseLayerText(text) {
2600
+ return text.replace(WINDOWS_ABSOLUTE, ABSOLUTE_PATH_TOKEN).replace(POSIX_ABSOLUTE, ABSOLUTE_PATH_TOKEN);
2279
2601
  }
2280
2602
 
2281
2603
  // src/scripts/_lib/installed_layer.ts
@@ -2294,6 +2616,7 @@ function readLayer(host, scope, dir, recorded) {
2294
2616
  files: 0,
2295
2617
  unconditional: 0,
2296
2618
  chars: 0,
2619
+ normalised_chars: 0,
2297
2620
  package_owned: 0,
2298
2621
  foreign: 0,
2299
2622
  package_owned_chars: 0,
@@ -2304,19 +2627,19 @@ function readLayer(host, scope, dir, recorded) {
2304
2627
  };
2305
2628
  let names;
2306
2629
  try {
2307
- names = fs14.readdirSync(dir);
2630
+ names = fs15.readdirSync(dir);
2308
2631
  } catch {
2309
2632
  return { host, scope, dir, present: false, ...empty };
2310
2633
  }
2311
2634
  const readings = [];
2312
2635
  for (const name of names.sort()) {
2313
2636
  if (!name.endsWith(".md")) continue;
2314
- const abs = path14.join(dir, name);
2637
+ const abs = path15.join(dir, name);
2315
2638
  let text;
2316
2639
  try {
2317
- const st = fs14.statSync(abs);
2640
+ const st = fs15.statSync(abs);
2318
2641
  if (!st.isFile()) continue;
2319
- text = fs14.readFileSync(abs, "utf-8");
2642
+ text = fs15.readFileSync(abs, "utf-8");
2320
2643
  } catch {
2321
2644
  continue;
2322
2645
  }
@@ -2328,6 +2651,10 @@ function readLayer(host, scope, dir, recorded) {
2328
2651
  // a host loads" and "what a delivery carries" cannot drift into two
2329
2652
  // spellings of the same measurement.
2330
2653
  chars: ruleBody(text).length,
2654
+ // THE SAME STRING, MEASURED TWICE. `chars` is what the host loads;
2655
+ // this is that text with every absolute path substituted, so two
2656
+ // machines with different package roots read one figure in common.
2657
+ normalised_chars: normaliseLayerText(ruleBody(text)).length,
2331
2658
  unconditional: isUnconditional(text),
2332
2659
  package_owned: owned
2333
2660
  });
@@ -2341,6 +2668,7 @@ function readLayer(host, scope, dir, recorded) {
2341
2668
  files: readings.length,
2342
2669
  unconditional: readings.filter((r) => r.unconditional).length,
2343
2670
  chars: readings.reduce((n, r) => n + r.chars, 0),
2671
+ normalised_chars: readings.reduce((n, r) => n + r.normalised_chars, 0),
2344
2672
  package_owned: readings.filter((r) => r.package_owned).length,
2345
2673
  foreign: readings.filter((r) => !r.package_owned).length,
2346
2674
  package_owned_chars: readings.reduce((n, r) => n + (r.package_owned ? r.chars : 0), 0),
@@ -2351,8 +2679,8 @@ function readLayer(host, scope, dir, recorded) {
2351
2679
  };
2352
2680
  }
2353
2681
  function defaultHostLimitsPath() {
2354
- return path14.join(
2355
- path14.dirname(fileURLToPath2(import.meta.url)),
2682
+ return path15.join(
2683
+ path15.dirname(fileURLToPath(import.meta.url)),
2356
2684
  "..",
2357
2685
  "..",
2358
2686
  "config",
@@ -2363,7 +2691,7 @@ function loadHostInstructionLimits(file = defaultHostLimitsPath()) {
2363
2691
  const out = /* @__PURE__ */ new Map();
2364
2692
  let raw;
2365
2693
  try {
2366
- raw = JSON.parse(fs14.readFileSync(file, "utf-8"));
2694
+ raw = JSON.parse(fs15.readFileSync(file, "utf-8"));
2367
2695
  } catch {
2368
2696
  return out;
2369
2697
  }
@@ -2417,18 +2745,18 @@ function defaultInventoryPath(home) {
2417
2745
  try {
2418
2746
  const real = (q) => {
2419
2747
  try {
2420
- return fs14.realpathSync(q);
2748
+ return fs15.realpathSync(q);
2421
2749
  } catch {
2422
- return path14.resolve(q);
2750
+ return path15.resolve(q);
2423
2751
  }
2424
2752
  };
2425
- const mine = os5.homedir();
2426
- if (path14.resolve(home) === path14.resolve(mine) || real(home) === real(mine)) {
2753
+ const mine = os6.homedir();
2754
+ if (path15.resolve(home) === path15.resolve(mine) || real(home) === real(mine)) {
2427
2755
  return inventory_path();
2428
2756
  }
2429
2757
  } catch {
2430
2758
  }
2431
- return path14.join(home, DEFAULT_EVENT4U_ROOT_RELATIVE, INVENTORY_BASENAME);
2759
+ return path15.join(home, DEFAULT_EVENT4U_ROOT_RELATIVE, INVENTORY_BASENAME);
2432
2760
  }
2433
2761
  function resolveLayerOwnership(opts) {
2434
2762
  const recorded = /* @__PURE__ */ new Map();
@@ -2448,18 +2776,18 @@ function resolveLayerOwnership(opts) {
2448
2776
  let fromDeploy = 0;
2449
2777
  for (const [anchor, rels] of opts.thisDeploy ?? /* @__PURE__ */ new Map()) {
2450
2778
  for (const rel of rels) {
2451
- const abs = path14.resolve(anchor, rel);
2779
+ const abs = path15.resolve(anchor, rel);
2452
2780
  if (!recorded.has(abs)) fromDeploy += 1;
2453
2781
  recorded.set(abs, null);
2454
2782
  try {
2455
- recorded.set(fs14.realpathSync(abs), null);
2783
+ recorded.set(fs15.realpathSync(abs), null);
2456
2784
  } catch {
2457
2785
  }
2458
2786
  }
2459
2787
  }
2460
2788
  if (fromDeploy > 0) sources.push("this-deploy");
2461
2789
  const manifestPath = opts.manifestPath ?? null;
2462
- if (manifestPath !== null && fs14.existsSync(manifestPath)) {
2790
+ if (manifestPath !== null && fs15.existsSync(manifestPath)) {
2463
2791
  let n = 0;
2464
2792
  let recordedHashes;
2465
2793
  try {
@@ -2515,9 +2843,9 @@ function renderHostLimitRows(rows) {
2515
2843
 
2516
2844
  // src/install/installThinLayer.ts
2517
2845
  function thinInstalledRuleLayer(opts) {
2518
- const packageRoot = path15.resolve(opts.packageRoot);
2519
- const bodySourceDir = path15.join(packageRoot, "dist", "agent-src", "rules");
2520
- const bodyLinkPrefix = absoluteBodyLinkPrefix(packageRoot);
2846
+ const packageRoot = path16.resolve(opts.packageRoot);
2847
+ const bodySourceDir = path16.join(packageRoot, "dist", "agent-src", "rules");
2848
+ const bodyLinkPrefix = absoluteBodyLinkPrefix(opts.bodyLinkRoot ?? packageRoot);
2521
2849
  const preserved = opts.preserved ?? /* @__PURE__ */ new Set();
2522
2850
  const stubs = build_thin(bodySourceDir, null, null, null, { packageRoot, bodyLinkPrefix });
2523
2851
  let thinned = 0;
@@ -2529,10 +2857,10 @@ function thinInstalledRuleLayer(opts) {
2529
2857
  const absent = [];
2530
2858
  const failed = [];
2531
2859
  for (const [name, stubText] of stubs) {
2532
- const target = path15.join(opts.rulesDir, name);
2860
+ const target = path16.join(opts.rulesDir, name);
2533
2861
  let installed;
2534
2862
  try {
2535
- installed = fs15.readFileSync(target, "utf-8");
2863
+ installed = fs16.readFileSync(target, "utf-8");
2536
2864
  } catch (e) {
2537
2865
  if (e.code === "ENOENT") absent.push(name);
2538
2866
  else failed.push({ rule: name, reason: String(e) });
@@ -2540,7 +2868,7 @@ function thinInstalledRuleLayer(opts) {
2540
2868
  }
2541
2869
  let sourceText;
2542
2870
  try {
2543
- sourceText = fs15.readFileSync(path15.join(bodySourceDir, name), "utf-8");
2871
+ sourceText = fs16.readFileSync(path16.join(bodySourceDir, name), "utf-8");
2544
2872
  } catch {
2545
2873
  sourceText = null;
2546
2874
  }
@@ -2550,7 +2878,7 @@ function thinInstalledRuleLayer(opts) {
2550
2878
  charsAfter += installed.length;
2551
2879
  continue;
2552
2880
  }
2553
- if (preserved.has(path15.resolve(target))) {
2881
+ if (preserved.has(path16.resolve(target))) {
2554
2882
  preservedHits.push(name);
2555
2883
  charsBefore += installed.length;
2556
2884
  charsAfter += installed.length;
@@ -2569,7 +2897,7 @@ function thinInstalledRuleLayer(opts) {
2569
2897
  const next = `${frontmatter}${stubText}`;
2570
2898
  try {
2571
2899
  if (next !== installed) {
2572
- fs15.writeFileSync(target, next, "utf-8");
2900
+ fs16.writeFileSync(target, next, "utf-8");
2573
2901
  rewritten += 1;
2574
2902
  }
2575
2903
  thinned += 1;
@@ -2612,7 +2940,7 @@ function describeThinInstalledLayer(res) {
2612
2940
  }
2613
2941
  return out;
2614
2942
  }
2615
- function installReceiptBudgetLines(packageRoot, home = os6.homedir(), opts = {}) {
2943
+ function installReceiptBudgetLines(packageRoot, home = os7.homedir(), opts = {}) {
2616
2944
  try {
2617
2945
  const { recorded, sources } = resolveLayerOwnership({
2618
2946
  manifestPath: opts.manifestPath === void 0 ? manifest_path(packageRoot) : opts.manifestPath,
@@ -2696,107 +3024,18 @@ function resolveGlobalRuleScope(inputs) {
2696
3024
  }
2697
3025
  }
2698
3026
 
2699
- // src/scripts/_lib/lean_projection_mode.ts
2700
- import * as path16 from "node:path";
2701
- var DEFAULT_LEAN_PROJECTION_MODE = "eager-all";
2702
- function normalizeLeanProjectionMode(raw) {
2703
- const v = typeof raw === "string" ? raw.trim().toLowerCase() : "";
2704
- if (v === "thin") return "thin";
2705
- if (v === "delivery") return "delivery";
2706
- return DEFAULT_LEAN_PROJECTION_MODE;
2707
- }
2708
- function writesThinFiles(mode) {
2709
- return mode === "thin" || mode === "delivery";
2710
- }
2711
- var THINNABLE_HOSTS = ["claude-code", "cursor", "cline"];
2712
- var DEFAULT_LEAN_PROJECTION_HOSTS = ["claude-code"];
2713
- function resolveLeanProjectionHosts(raw) {
2714
- const known = new Set(THINNABLE_HOSTS);
2715
- if (!Array.isArray(raw) || raw.length === 0) {
2716
- return { hosts: [...DEFAULT_LEAN_PROJECTION_HOSTS], dropped: [], usedDefault: true };
2717
- }
2718
- const hosts = [];
2719
- const dropped = [];
2720
- for (const entry of raw) {
2721
- const id = typeof entry === "string" ? entry.trim().toLowerCase() : "";
2722
- if (id === "") {
2723
- dropped.push({ id: String(entry), reason: "unknown" });
2724
- continue;
2725
- }
2726
- if (!known.has(id)) {
2727
- dropped.push({ id, reason: KNOWN_NON_THINNABLE_HOSTS.has(id) ? "not-thinnable" : "unknown" });
2728
- continue;
2729
- }
2730
- if (!hosts.includes(id)) hosts.push(id);
2731
- }
2732
- hosts.sort();
2733
- return { hosts, dropped, usedDefault: false };
2734
- }
2735
- var KNOWN_NON_THINNABLE_HOSTS = /* @__PURE__ */ new Set([
2736
- "claude-desktop",
2737
- "augment",
2738
- "copilot",
2739
- "windsurf",
2740
- "gemini",
2741
- "codex",
2742
- "cowork"
2743
- ]);
2744
- function thinsHost(mode, hosts, hostId) {
2745
- return writesThinFiles(mode) && hosts.includes(hostId);
2746
- }
2747
- function resolveLeanProjection(opts = {}) {
2748
- const file = opts.settingsPath ?? path16.join(opts.projectRoot ?? process.cwd(), ".agent-settings.yml");
2749
- const tpl = opts.packageRoot == null ? null : path16.join(opts.packageRoot, "src", "config", "agent-settings.template.yml");
2750
- let lean;
2751
- try {
2752
- lean = load_agent_settings(
2753
- tpl === null ? { project_path: file } : { project_path: file, template_path: tpl }
2754
- )["lean_projection"];
2755
- } catch {
2756
- }
2757
- const obj = typeof lean === "object" && lean !== null && !Array.isArray(lean) ? lean : {};
2758
- const o = obj;
2759
- return {
2760
- mode: normalizeLeanProjectionMode(o["mode"] ?? ""),
2761
- hosts: resolveLeanProjectionHosts(o["hosts"]),
2762
- // LAZY, and the hot path is the reason. Provenance needs a SECOND,
2763
- // template-isolated cascade, and only the installer reads it — the
2764
- // delivery concern on `user_prompt_submit` destructures `{ mode, hosts }`
2765
- // and discards this field, so computing it eagerly doubled the per-prompt
2766
- // settings read for an answer nobody asked for. A getter keeps the
2767
- // field's shape (`readonly modeExplicit: boolean`) and charges only the
2768
- // caller that touches it.
2769
- get modeExplicit() {
2770
- return rawExplicitLeanProjectionMode(opts) !== "";
3027
+ // src/install/toolsArg.ts
3028
+ function mergeToolsAliases(tools, ai) {
3029
+ const items = [];
3030
+ for (const raw of [tools, ai]) {
3031
+ if (!raw) continue;
3032
+ for (const piece of raw.split(",")) {
3033
+ const stripped = piece.trim();
3034
+ if (stripped && !items.includes(stripped)) items.push(stripped);
2771
3035
  }
2772
- };
2773
- }
2774
- var NO_TEMPLATE_LAYER = path16.join(path16.sep, "dev", "null", "agent-config-absent-template.yml");
2775
- function rawExplicitLeanProjectionMode(opts = {}) {
2776
- const file = opts.settingsPath ?? path16.join(opts.projectRoot ?? process.cwd(), ".agent-settings.yml");
2777
- let lean;
2778
- try {
2779
- lean = load_agent_settings({ project_path: file, template_path: NO_TEMPLATE_LAYER })["lean_projection"];
2780
- } catch {
2781
- return "";
2782
3036
  }
2783
- if (typeof lean !== "object" || lean === null || Array.isArray(lean)) return "";
2784
- const m = lean["mode"];
2785
- return typeof m === "string" ? m.trim() : "";
3037
+ return items.length > 0 ? items.join(",") : "all";
2786
3038
  }
2787
- function installerThinsHost(hostId, opts = {}) {
2788
- const { mode, hosts, modeExplicit } = resolveLeanProjection({
2789
- ...opts,
2790
- settingsPath: opts.settingsPath ?? NO_PROJECT_LAYER
2791
- });
2792
- return modeExplicit && thinsHost(mode, hosts.hosts, hostId);
2793
- }
2794
- var NO_PROJECT_LAYER = path16.join(
2795
- path16.sep,
2796
- "dev",
2797
- "null",
2798
- "agent-config-absent-project-settings.yml"
2799
- );
2800
3039
 
2801
3040
  // src/shared/settingsSurface.ts
2802
3041
  function unwrapRef(root) {
@@ -4153,7 +4392,7 @@ var zodToJsonSchema = (schema, options) => {
4153
4392
  };
4154
4393
 
4155
4394
  // src/scripts/_lib/module_detection.ts
4156
- import * as fs16 from "node:fs";
4395
+ import * as fs17 from "node:fs";
4157
4396
  import * as path17 from "node:path";
4158
4397
  var _SKIP_DIRS = /* @__PURE__ */ new Set([".module-template", ".example"]);
4159
4398
  var _RULES = [
@@ -4168,14 +4407,14 @@ var _RULES = [
4168
4407
  ];
4169
4408
  function _isDir(p) {
4170
4409
  try {
4171
- return fs16.statSync(p).isDirectory();
4410
+ return fs17.statSync(p).isDirectory();
4172
4411
  } catch {
4173
4412
  return false;
4174
4413
  }
4175
4414
  }
4176
4415
  function _isFile(p) {
4177
4416
  try {
4178
- return fs16.statSync(p).isFile();
4417
+ return fs17.statSync(p).isFile();
4179
4418
  } catch {
4180
4419
  return false;
4181
4420
  }
@@ -4189,7 +4428,7 @@ function _isUpperChar(ch) {
4189
4428
  function _list_module_subdirs(root) {
4190
4429
  let entries;
4191
4430
  try {
4192
- entries = fs16.readdirSync(root).sort();
4431
+ entries = fs17.readdirSync(root).sort();
4193
4432
  } catch {
4194
4433
  return [];
4195
4434
  }
@@ -4254,34 +4493,8 @@ function detect_module_roots(project_root) {
4254
4493
  return [...high, ...medium];
4255
4494
  }
4256
4495
 
4257
- // src/scripts/_lib/model_tier.ts
4258
- import fs17 from "node:fs";
4259
- var TIER_TO_CLAUDE_MODEL = {
4260
- frontier: "fable",
4261
- high: "opus",
4262
- medium: "sonnet",
4263
- lite: "haiku"
4264
- };
4265
- var MODEL_TIER_RE = /^model_tier:\s*"?([a-z]+)"?\s*$/m;
4266
- function read_model_tier(skill_md) {
4267
- if (!fs17.existsSync(skill_md)) return null;
4268
- const text = fs17.readFileSync(skill_md).toString("utf-8");
4269
- if (!text.startsWith("---\n")) return null;
4270
- const end = text.indexOf("\n---\n", 4);
4271
- if (end === -1) return null;
4272
- const m = MODEL_TIER_RE.exec(text.slice(4, end));
4273
- return m ? m[1] : null;
4274
- }
4275
- function render_native_model_md(text, tier) {
4276
- const model = TIER_TO_CLAUDE_MODEL[tier];
4277
- if (model === void 0) {
4278
- throw new Error(`'${tier}'`);
4279
- }
4280
- return text.replace(MODEL_TIER_RE, `model: ${model}`);
4281
- }
4282
-
4283
4496
  // src/install/paths.ts
4284
- import { homedir as homedir8, tmpdir } from "node:os";
4497
+ import { homedir as homedir8, tmpdir as tmpdir2 } from "node:os";
4285
4498
  import { join as join18 } from "node:path";
4286
4499
  var INSTALL_ROOT_SUBPATH = ".event4u/agent-config";
4287
4500
  var INSTALL_LOG_FILENAME = "install-log.jsonl";
@@ -4305,7 +4518,7 @@ function getLogPath(home) {
4305
4518
  }
4306
4519
 
4307
4520
  // src/scripts/install.ts
4308
- var _HERE = fileURLToPath3(import.meta.url);
4521
+ var _HERE = fileURLToPath2(import.meta.url);
4309
4522
  var SystemExitError = class extends Error {
4310
4523
  constructor(code) {
4311
4524
  super(`system-exit-${code}`);
@@ -4321,9 +4534,9 @@ var ArgparseExit = class extends Error {
4321
4534
  code;
4322
4535
  };
4323
4536
  function expanduser3(p) {
4324
- if (p === "~") return os7.homedir();
4537
+ if (p === "~") return os8.homedir();
4325
4538
  if (p.startsWith("~/") || p.startsWith("~\\")) {
4326
- return path18.join(os7.homedir(), p.slice(2));
4539
+ return path18.join(os8.homedir(), p.slice(2));
4327
4540
  }
4328
4541
  return p;
4329
4542
  }
@@ -4464,7 +4677,8 @@ var LEGACY_RENAME_MAP = {
4464
4677
  };
4465
4678
  var state = {
4466
4679
  QUIET: false,
4467
- PROGRESS_NDJSON: false
4680
+ PROGRESS_NDJSON: false,
4681
+ FULL_PIN: false
4468
4682
  };
4469
4683
  function _emit_progress(obj) {
4470
4684
  if (!state.PROGRESS_NDJSON) return;
@@ -4854,7 +5068,7 @@ function ensure_augment_bridge(project_root, force) {
4854
5068
  ".augment/settings.json"
4855
5069
  );
4856
5070
  }
4857
- var AUGMENT_USER_DIR = path18.join(os7.homedir(), ".augment");
5071
+ var AUGMENT_USER_DIR = path18.join(os8.homedir(), ".augment");
4858
5072
  var AUGMENT_USER_HOOKS_DIR = path18.join(AUGMENT_USER_DIR, "hooks");
4859
5073
  var AUGMENT_DISPATCHER_TRAMPOLINE = "augment-dispatcher.sh";
4860
5074
  var AUGMENT_LEGACY_TRAMPOLINES = [
@@ -4955,7 +5169,7 @@ function ensure_cursor_bridge(project_root, force) {
4955
5169
  ".cursor/hooks.json"
4956
5170
  );
4957
5171
  }
4958
- var CURSOR_USER_DIR = path18.join(os7.homedir(), ".cursor");
5172
+ var CURSOR_USER_DIR = path18.join(os8.homedir(), ".cursor");
4959
5173
  var CURSOR_USER_HOOKS_DIR = path18.join(CURSOR_USER_DIR, "hooks");
4960
5174
  var CURSOR_DISPATCHER_TRAMPOLINE = "cursor-dispatcher.sh";
4961
5175
  function ensure_cursor_user_hooks(package_root, force) {
@@ -5039,7 +5253,7 @@ function ensure_cline_bridge(project_root, force) {
5039
5253
  skip(".clinerules/hooks/ already up to date");
5040
5254
  }
5041
5255
  }
5042
- var CLINE_USER_DIR = path18.join(os7.homedir(), "Documents", "Cline", "Hooks");
5256
+ var CLINE_USER_DIR = path18.join(os8.homedir(), "Documents", "Cline", "Hooks");
5043
5257
  var CLINE_DISPATCHER_TRAMPOLINE = "cline-dispatcher.sh";
5044
5258
  function ensure_cline_user_hooks(package_root, force) {
5045
5259
  const src = path18.join(package_root, "scripts", "hooks", CLINE_DISPATCHER_TRAMPOLINE);
@@ -5091,7 +5305,7 @@ function ensure_windsurf_bridge(project_root, force) {
5091
5305
  ".windsurf/hooks.json"
5092
5306
  );
5093
5307
  }
5094
- var WINDSURF_USER_DIR = path18.join(os7.homedir(), ".codeium", "windsurf");
5308
+ var WINDSURF_USER_DIR = path18.join(os8.homedir(), ".codeium", "windsurf");
5095
5309
  var WINDSURF_USER_HOOKS_DIR = path18.join(WINDSURF_USER_DIR, "hooks");
5096
5310
  var WINDSURF_DISPATCHER_TRAMPOLINE = "windsurf-dispatcher.sh";
5097
5311
  function ensure_windsurf_user_hooks(package_root, force) {
@@ -5147,7 +5361,7 @@ function ensure_gemini_bridge(project_root, force) {
5147
5361
  ".gemini/settings.json"
5148
5362
  );
5149
5363
  }
5150
- var GEMINI_USER_DIR = path18.join(os7.homedir(), ".gemini");
5364
+ var GEMINI_USER_DIR = path18.join(os8.homedir(), ".gemini");
5151
5365
  var GEMINI_USER_HOOKS_DIR = path18.join(GEMINI_USER_DIR, "hooks");
5152
5366
  var GEMINI_DISPATCHER_TRAMPOLINE = "gemini-dispatcher.sh";
5153
5367
  function ensure_gemini_user_hooks(package_root, force) {
@@ -5638,7 +5852,7 @@ To remove this marker, delete this file.
5638
5852
  `;
5639
5853
  }
5640
5854
  var _CLAUDE_DESKTOP_BUNDLES_SUBPATH = "claude-desktop/bundles";
5641
- var GLOBAL_ROOT = path18.join(os7.homedir(), ".event4u", "agent-config");
5855
+ var GLOBAL_ROOT = path18.join(os8.homedir(), ".event4u", "agent-config");
5642
5856
  var GLOBAL_USER_SETTINGS_PATH = path18.join(GLOBAL_ROOT, ".agent-user.yml");
5643
5857
  var GLOBAL_AGENT_SETTINGS_PATH = path18.join(GLOBAL_ROOT, ".agent-settings.yml");
5644
5858
  function _bridge_marker(tool_id, scope) {
@@ -5910,7 +6124,7 @@ function _update_installed_tools_manifest(project_root, tools, scope, force, fil
5910
6124
  throw exc;
5911
6125
  }
5912
6126
  }
5913
- write_manifest(target, version, entries);
6127
+ write_manifest(target, version, dropGlobalScopeFiles(entries, scope === "global" ? tools : /* @__PURE__ */ new Set()));
5914
6128
  if (!state.QUIET) {
5915
6129
  const rel = isRelativeTo(target, project_root) ? path18.relative(project_root, target) : target;
5916
6130
  info(`Manifest updated: ${rel}`);
@@ -6026,7 +6240,7 @@ function _run_migrate_to_global(project_root) {
6026
6240
  }
6027
6241
  }
6028
6242
  function _format_global_root_for_marker(global_root) {
6029
- const home = resolvePath(os7.homedir());
6243
+ const home = resolvePath(os8.homedir());
6030
6244
  const resolved = resolvePath(global_root);
6031
6245
  const rel = path18.relative(home, resolved);
6032
6246
  if (rel === "" || rel.startsWith("..") || path18.isAbsolute(rel)) {
@@ -6182,7 +6396,7 @@ function _copy_dir_dereferencing_symlinks(src, dest, force, package_root = null,
6182
6396
  return [0, 0, written_paths];
6183
6397
  }
6184
6398
  mkdirp(path18.dirname(dest));
6185
- const decision = tracker.resolve(dest, force);
6399
+ const decision = tracker.resolve(dest, force, { from: resolved_src, packageRoot: package_root });
6186
6400
  if (decision === "preserve") {
6187
6401
  tracker.preserve(dest, resolved_src, package_root);
6188
6402
  _log_tx_entry("skip", dest);
@@ -6245,7 +6459,7 @@ function _copy_dir_dereferencing_symlinks(src, dest, force, package_root = null,
6245
6459
  if (file_filter !== null && !file_filter(entry)) {
6246
6460
  continue;
6247
6461
  }
6248
- const decision = tracker.resolve(target, force);
6462
+ const decision = tracker.resolve(target, force, { from: resolved, packageRoot: package_root });
6249
6463
  if (decision === "preserve") {
6250
6464
  tracker.preserve(target, resolved, package_root);
6251
6465
  skipped += 1;
@@ -6269,7 +6483,7 @@ function _write_claude_desktop_marker(force, lockfile_path2, bundles_dir, bundle
6269
6483
  const target = path18.join(anchor, "agent-config.md");
6270
6484
  mkdirp(anchor);
6271
6485
  const body = claudeDesktopMarkerBody(lockfile_path2, anchor, bundles_dir, bundle_count);
6272
- if (tracker.resolve(target, force) === "preserve") {
6486
+ if (tracker.resolve(target, force, { content: body }) === "preserve") {
6273
6487
  tracker.preserveContent(target, body);
6274
6488
  return [0, 1, []];
6275
6489
  }
@@ -6282,12 +6496,8 @@ function _deploy_claude_desktop(force, package_root, lockfile_path2) {
6282
6496
  build_skill_bundles(package_root, bundles_dir, force);
6283
6497
  build_command_bundles(package_root, bundles_dir, force);
6284
6498
  const bundle_count = countZips(bundles_dir);
6285
- const [, , marker_paths] = _write_claude_desktop_marker(
6286
- force,
6287
- lockfile_path2,
6288
- bundles_dir,
6289
- bundle_count
6290
- );
6499
+ const [, , marker_paths] = _write_claude_desktop_marker(force, lockfile_path2, bundles_dir, bundle_count);
6500
+ recordGlobalDeploy({ toolId: "claude-desktop", anchorRaw: USER_SCOPE_PATHS["claude-desktop"], anchor: expanduser3(USER_SCOPE_PATHS["claude-desktop"]), currentFiles: /* @__PURE__ */ new Set(["agent-config.md"]), destSubs: [], packageTag: PACKAGE_TAG_ID, preserved: tracker.conflictState.preserved, staged: tracker.conflictState.staged, recordedFor: tracker.recordedDigest });
6291
6501
  return [bundle_count, 0, "deployed", [bundles_dir, ...marker_paths]];
6292
6502
  }
6293
6503
  var _CLAUDE_FLAT_WRAPPER_EXTRA = /* @__PURE__ */ new Set(["commit"]);
@@ -6392,18 +6602,16 @@ function _deploy_global_content(tools, force, package_root, lockfile_path2) {
6392
6602
  res,
6393
6603
  preserved_now
6394
6604
  );
6395
- if (installerThinsHost(tool_id, { packageRoot: package_root })) {
6396
- try {
6397
- const thin = thinInstalledRuleLayer({
6398
- rulesDir: path18.join(anchor, "rules"),
6399
- packageRoot: package_root,
6400
- preserved: preserved_now
6401
- });
6402
- if (!state.QUIET) for (const l of describeThinInstalledLayer(thin)) info(l);
6403
- } catch (e) {
6404
- warn(`claude-code: thinned rule layer not written \u2014 ${String(e)}`);
6405
- }
6406
- }
6605
+ deployClaudeCarrier({
6606
+ packageRoot: package_root,
6607
+ rulesDir: path18.join(anchor, "rules"),
6608
+ quiet: state.QUIET,
6609
+ info,
6610
+ warn,
6611
+ userPin: state.FULL_PIN,
6612
+ wantsThin: installerThinsHost(tool_id, { packageRoot: package_root }),
6613
+ thin: (bodyLinkRoot) => describeThinInstalledLayer(thinInstalledRuleLayer({ rulesDir: path18.join(anchor, "rules"), packageRoot: package_root, preserved: preserved_now, bodyLinkRoot }))
6614
+ });
6407
6615
  if (!state.QUIET) for (const l of installReceiptBudgetLines(package_root, void 0, { thisDeploy: /* @__PURE__ */ new Map([[anchor, current_files]]) })) info(l);
6408
6616
  }
6409
6617
  const missing_targets = _verify_deploy_targets(anchor, plan);
@@ -6418,25 +6626,18 @@ function _deploy_global_content(tools, force, package_root, lockfile_path2) {
6418
6626
  continue;
6419
6627
  }
6420
6628
  _emit_progress({ type: "verified", tool: tool_id });
6421
- const inventory = load_inventory();
6422
- let reaped = [];
6423
- const inv_tools = inventory["tools"] ?? {};
6424
- if (tool_id in inv_tools) {
6425
- reaped = reaped.concat(
6426
- reap_stale(tool_id, anchor, current_files, inventory)
6427
- );
6428
- }
6429
- reaped = reaped.concat(
6430
- reap_tagged_orphans(
6431
- anchor,
6432
- plan.map(([, dest_sub]) => dest_sub),
6433
- current_files,
6434
- PACKAGE_TAG_ID
6435
- )
6436
- );
6437
- reaped = [...new Set(reaped)].sort();
6438
- record_deploy(tool_id, anchor_raw, current_files, inventory);
6439
- save_inventory(inventory);
6629
+ const { reaped, retained } = recordGlobalDeploy({
6630
+ toolId: tool_id,
6631
+ anchorRaw: anchor_raw,
6632
+ anchor,
6633
+ currentFiles: current_files,
6634
+ destSubs: plan.map(([, dest_sub]) => dest_sub),
6635
+ packageTag: PACKAGE_TAG_ID,
6636
+ preserved: tracker.conflictState.preserved,
6637
+ staged: tracker.conflictState.staged,
6638
+ recordedFor: tracker.recordedDigest
6639
+ });
6640
+ for (const p of retained) warn(retainedFileMessage(p));
6440
6641
  if (reaped.length > 0 && !state.QUIET) {
6441
6642
  info(
6442
6643
  ` ${tool_id}: reaped ${reaped.length} stale deployed file(s) from a previous install`
@@ -6509,7 +6710,9 @@ function _preview_global_reap(tools, package_root) {
6509
6710
  plan.map(([, dest_sub]) => dest_sub),
6510
6711
  current_files,
6511
6712
  PACKAGE_TAG_ID,
6512
- true
6713
+ true,
6714
+ // The ledger spares an edited retired file, so the preview must too.
6715
+ recorded_digests(tool_id, anchor, inventory)
6513
6716
  )
6514
6717
  );
6515
6718
  const paths = [...new Set(would_reap.map((p) => String(p)))].sort();
@@ -6535,7 +6738,6 @@ function _verify_deploy_targets(anchor, plan) {
6535
6738
  }
6536
6739
  return missing;
6537
6740
  }
6538
- var _prune_modules_by = prune_modules_by;
6539
6741
  var _prune_lab_modules = prune_lab_modules;
6540
6742
  var _load_packs_registry = load_packs_registry;
6541
6743
  var _compute_active_pack_ids = compute_active_pack_ids;
@@ -6574,12 +6776,7 @@ function _rule_filter_for_source(src_rel, scope) {
6574
6776
  if (src_rel !== RULE_SOURCE_REL) return null;
6575
6777
  return (srcFile) => ruleFileArrives(srcFile, scope) && !isExclusivelyPackageOnly(srcFile);
6576
6778
  }
6577
- function _prune_scoped_modules(deploy_results, active_ids) {
6578
- return _prune_modules_by(
6579
- deploy_results,
6580
- (p) => is_pruned_under_scoped(p, active_ids)
6581
- );
6582
- }
6779
+ var _prune_scoped_modules = prune_scoped_modules;
6583
6780
  function install_global(tools, force, project_root = null, core_only = false) {
6584
6781
  const migrated = migrate_legacy_namespace();
6585
6782
  if (migrated && !state.QUIET) {
@@ -6657,13 +6854,6 @@ function install_global(tools, force, project_root = null, core_only = false) {
6657
6854
  }
6658
6855
  try {
6659
6856
  const { mode, active_packs } = _resolve_scoped_projection(package_root);
6660
- if (mode === "tiered") {
6661
- const outcome = applyTieredPrune(deploy_results, package_root, _prune_modules_by);
6662
- deploy_results = outcome.deployResults;
6663
- if (!state.QUIET && outcome.message !== null) {
6664
- (outcome.level === "warn" ? warn : info)(outcome.message);
6665
- }
6666
- }
6667
6857
  if (mode === "scoped") {
6668
6858
  const packs_registry = _load_packs_registry(package_root);
6669
6859
  const active_ids = _compute_active_pack_ids(packs_registry, active_packs);
@@ -6680,6 +6870,7 @@ function install_global(tools, force, project_root = null, core_only = false) {
6680
6870
  warn(`Scoped-projection prune failed \u2014 restoring full tree (${String(e)}).`);
6681
6871
  }
6682
6872
  }
6873
+ applyHostListingPolicies({ claudeCode: deploy_results["claude-code"]?.[2] === "deployed", codex: deploy_results["codex"]?.[2] === "deployed" }, os8.homedir(), expanduser3(USER_SCOPE_PATHS["claude-code"]), state.QUIET ? () => void 0 : info);
6683
6874
  const failed_tools = new Set(
6684
6875
  Object.keys(deploy_results).filter(
6685
6876
  (tool_id) => deploy_results[tool_id][2] === "deploy_failed"
@@ -6889,17 +7080,6 @@ function _write_settings_surface_snapshot(installed_version) {
6889
7080
  function arrayStrEqual(a, b) {
6890
7081
  return a.length === b.length && a.every((v, i) => v === b[i]);
6891
7082
  }
6892
- function _merge_tools_aliases(tools, ai) {
6893
- const items = [];
6894
- for (const raw of [tools, ai]) {
6895
- if (!raw) continue;
6896
- for (const piece of raw.split(",")) {
6897
- const stripped = piece.trim();
6898
- if (stripped && !items.includes(stripped)) items.push(stripped);
6899
- }
6900
- }
6901
- return items.length > 0 ? items.join(",") : "all";
6902
- }
6903
7083
  var PROG = "agent-config install";
6904
7084
  var USAGE = `usage: ${PROG} [-h] [--profile PROFILE] [--user-type USER_TYPE] [--force]
6905
7085
  [--skip-bridges] [--augment-user-hooks]
@@ -6907,7 +7087,7 @@ var USAGE = `usage: ${PROG} [-h] [--profile PROFILE] [--user-type USER_TYPE] [--
6907
7087
  [--windsurf-user-hooks] [--gemini-user-hooks]
6908
7088
  [--project PROJECT] [--package PACKAGE] [--quiet]
6909
7089
  [--tools TOOLS] [--ai AI] [--packs PACKS] [--core-only]
6910
- [--no-smoke] [--global]
7090
+ [--no-smoke] [--global] [--full]
6911
7091
  [--scope {project,global,prompt,auto}]
6912
7092
  [--layer {global,project,both-acknowledged}]
6913
7093
  [--custom-path CUSTOM_PATH] [--offline] [--minimal]
@@ -6931,7 +7111,8 @@ var _STORE_TRUE_FLAGS = {
6931
7111
  "--settings-only": "minimal",
6932
7112
  "--interactive": "interactive",
6933
7113
  "--no-ui": "no_ui",
6934
- "--dry-run": "dry_run"
7114
+ "--dry-run": "dry_run",
7115
+ "--full": "full"
6935
7116
  };
6936
7117
  var _VALUE_FLAGS = {
6937
7118
  "--profile": "profile",
@@ -6979,6 +7160,7 @@ function parse_options(argv) {
6979
7160
  interactive: false,
6980
7161
  no_ui: false,
6981
7162
  dry_run: false,
7163
+ full: false,
6982
7164
  apply_payload: null,
6983
7165
  layer: null
6984
7166
  };
@@ -7035,7 +7217,7 @@ function parse_options(argv) {
7035
7217
  if (positionals.length > 0) {
7036
7218
  _argError(`unrecognized arguments: ${positionals.join(" ")}`);
7037
7219
  }
7038
- opts.tools = _merge_tools_aliases(opts.tools, opts.ai);
7220
+ opts.tools = mergeToolsAliases(opts.tools, opts.ai);
7039
7221
  const rawPacks = opts.packs;
7040
7222
  opts.packs = typeof rawPacks === "string" ? rawPacks.split(",").map((p) => p.trim()).filter((p) => p) : [];
7041
7223
  if (opts.scope === "global" && opts.custom_path) {
@@ -7310,7 +7492,7 @@ function _wizard_cli_dist(_project_root) {
7310
7492
  return pathExists(cli) ? cli : null;
7311
7493
  }
7312
7494
  function _server_info_path() {
7313
- return path18.join(os7.homedir(), ".event4u", "agent-config", "local-server.json");
7495
+ return path18.join(os8.homedir(), ".event4u", "agent-config", "local-server.json");
7314
7496
  }
7315
7497
  function _pid_is_agent_config(pid) {
7316
7498
  let res;
@@ -7406,7 +7588,7 @@ function _wizard_spawn(project_root, pass_project_root = true) {
7406
7588
  function _wizard_run_sync(cmd, env, cli) {
7407
7589
  const total = _WIZARD_TIMEOUTS.reduce((a, b) => a + b, 0);
7408
7590
  const log_path = path18.join(
7409
- os7.tmpdir(),
7591
+ os8.tmpdir(),
7410
7592
  `agent-config-wizard-${process2.pid}-${Date.now()}.log`
7411
7593
  );
7412
7594
  let child;
@@ -7500,8 +7682,7 @@ function _dry_run_summary(opts) {
7500
7682
  `);
7501
7683
  process2.stdout.write(` tools: ${opts.tools || "all"}
7502
7684
  `);
7503
- process2.stdout.write(` target: ${target}
7504
- `);
7685
+ process2.stdout.write(dryRunTargetLines(Boolean(opts.global_install) || opts.scope === "global", _parse_tools(opts.tools || "all"), target));
7505
7686
  process2.stdout.write(` minimal: ${pyBool(opts.minimal)}
7506
7687
  `);
7507
7688
  process2.stdout.write(` force: ${pyBool(opts.force)}
@@ -7598,6 +7779,7 @@ function pyRepr(v) {
7598
7779
  function main2(argv) {
7599
7780
  const opts = parse_options(argv);
7600
7781
  state.QUIET = opts.quiet;
7782
+ state.FULL_PIN = opts.full || _legacy_projection_pin();
7601
7783
  if (opts.apply_payload) {
7602
7784
  const payload_path = resolvePath(opts.apply_payload);
7603
7785
  if (!isFile(payload_path)) fail(`--apply-payload path not found: ${payload_path}`);
@@ -7755,6 +7937,15 @@ function _propose_modules_config(project_root, is_first_run) {
7755
7937
  "Re-run anytime via `./scripts-run src/scripts/propose_modules_config` (installed under <package>/src/scripts/)."
7756
7938
  );
7757
7939
  }
7940
+ var _ABSENT_LAYER = ["project-settings", "template"].map((n) => path18.join(path18.sep, "dev", "null", `agent-config-absent-${n}.yml`));
7941
+ function _legacy_projection_pin() {
7942
+ let data = null;
7943
+ try {
7944
+ data = load_agent_settings({ project_path: _ABSENT_LAYER[0], template_path: _ABSENT_LAYER[1] });
7945
+ } catch {
7946
+ }
7947
+ return legacyProjectionPin(data, (line) => warn(line));
7948
+ }
7758
7949
  function _read_consumer_auto_switch(project_root) {
7759
7950
  let data;
7760
7951
  try {
@@ -7987,6 +8178,11 @@ if (_isCliEntry || _argv1 === _HERE) {
7987
8178
 
7988
8179
  export {
7989
8180
  subtract_pointers,
8181
+ recordPath,
8182
+ codexSkillRoots,
8183
+ removeCodexResidentSet,
8184
+ recordPath2,
8185
+ removeListingOverrides,
7990
8186
  SETTINGS_FILE,
7991
8187
  ROOCODE_MARKER,
7992
8188
  CLAUDE_DESKTOP_MARKER,