@event4u/agent-config 16.5.0 → 17.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (1047) 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 +114 -530
  6. package/CONTRIBUTING.md +47 -0
  7. package/README.md +25 -24
  8. package/dist/agent-src/commands/{design.md → agent-design.md} +10 -6
  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 +10 -2
  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 +5 -0
  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 +1 -1
  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/agent-security-review/SKILL.md +2 -2
  98. package/dist/agent-src/skills/agents-md-thin-root/SKILL.md +12 -4
  99. package/dist/agent-src/skills/ai-code-blindspots/SKILL.md +7 -0
  100. package/dist/agent-src/skills/ai-council/references/advanced-modes.md +11 -1
  101. package/dist/agent-src/skills/ai-council/references/cost-and-redaction.md +7 -0
  102. package/dist/agent-src/skills/ai-council/references/execution-modes.md +7 -0
  103. package/dist/agent-src/skills/ai-council/references/output-and-synthesis.md +19 -0
  104. package/dist/agent-src/skills/ai-council/references/procedure.md +7 -0
  105. package/dist/agent-src/skills/api-design/SKILL.md +2 -2
  106. package/dist/agent-src/skills/api-endpoint/SKILL.md +2 -2
  107. package/dist/agent-src/skills/authz-review/SKILL.md +5 -3
  108. package/dist/agent-src/skills/blade-ui/SKILL.md +2 -2
  109. package/dist/agent-src/skills/brand/SKILL.md +7 -3
  110. package/dist/agent-src/skills/brand-asset-generation/SKILL.md +13 -6
  111. package/dist/agent-src/skills/brand-audit/SKILL.md +2 -1
  112. package/dist/agent-src/skills/brand-identity/SKILL.md +5 -4
  113. package/dist/agent-src/skills/brand-strategy/SKILL.md +5 -4
  114. package/dist/agent-src/skills/brand-to-tokens/SKILL.md +18 -39
  115. package/dist/agent-src/skills/brand-to-tokens/templates/marp-brand-deck.md.example +2 -2
  116. package/dist/agent-src/skills/brand-to-tokens/templates/reveal-brand-deck.yaml +2 -2
  117. package/dist/agent-src/skills/canvas-design/SKILL.md +12 -2
  118. package/dist/agent-src/skills/competitive-positioning/SKILL.md +2 -2
  119. package/dist/agent-src/skills/composer-packages/SKILL.md +18 -0
  120. package/dist/agent-src/skills/condense-memory/SKILL.md +1 -1
  121. package/dist/agent-src/skills/content-funnel-design/SKILL.md +8 -1
  122. package/dist/agent-src/skills/context-authoring/SKILL.md +1 -1
  123. package/dist/agent-src/skills/context-document/SKILL.md +2 -2
  124. package/dist/agent-src/skills/corpus-grounding/SKILL.md +6 -6
  125. package/dist/agent-src/skills/corpus-grounding/scripts/decision_engine.ts +13 -11
  126. package/dist/agent-src/skills/corpus-grounding/scripts/ground.mjs +1706 -0
  127. package/dist/agent-src/skills/corpus-grounding/scripts/schema_validator.ts +7 -1
  128. package/dist/agent-src/skills/dashboard-design/SKILL.md +1 -1
  129. package/dist/agent-src/skills/data-flow-mapper/SKILL.md +5 -2
  130. package/dist/agent-src/skills/database/SKILL.md +5 -4
  131. package/dist/agent-src/skills/decision-record/references/weighted-matrix.md +12 -0
  132. package/dist/agent-src/skills/deep-reading-analyst/SKILL.md +1 -1
  133. package/dist/agent-src/skills/dependency-upgrade/SKILL.md +61 -11
  134. package/dist/agent-src/skills/description-assist/SKILL.md +1 -1
  135. package/dist/agent-src/skills/design-intelligence/SKILL.md +1 -1
  136. package/dist/agent-src/skills/design-intelligence/data/landing.csv +1 -1
  137. package/dist/agent-src/skills/design-intelligence/references/context-and-registers.md +10 -2
  138. package/dist/agent-src/skills/design-intelligence/references/design-languages.md +1 -1
  139. package/dist/agent-src/skills/design-intelligence/references/design-rules-checklist.md +4 -3
  140. package/dist/agent-src/skills/design-intelligence/references/integration-mapping.md +14 -14
  141. package/dist/agent-src/skills/{wireframe → design-review}/references/story-beat-ledger.schema.json +1 -1
  142. package/dist/agent-src/skills/design-review/references/verification-automation.md +11 -3
  143. package/dist/agent-src/skills/design-system-capture/SKILL.md +15 -10
  144. package/dist/agent-src/skills/design-system-capture/references/design-system-json.md +20 -5
  145. package/dist/agent-src/skills/design-system-capture/references/import-procedure.md +2 -2
  146. package/dist/agent-src/skills/design-tokens/SKILL.md +23 -23
  147. package/dist/agent-src/skills/design-tokens/scripts/tokens.mjs +1037 -0
  148. package/dist/agent-src/skills/design-tokens/scripts/tokens.ts +336 -13
  149. package/dist/agent-src/skills/design-tokens/templates/design-tokens-starter.json +52 -53
  150. package/dist/agent-src/skills/docker/SKILL.md +1 -1
  151. package/dist/agent-src/skills/estimate-ticket/SKILL.md +1 -1
  152. package/dist/agent-src/skills/existing-ui-audit/SKILL.md +14 -276
  153. package/dist/agent-src/skills/existing-ui-audit/procedure.yaml +44 -0
  154. package/dist/agent-src/skills/existing-ui-audit/references/anti-slop-cross-reference.md +1 -1
  155. package/dist/agent-src/skills/existing-ui-audit/references/steps/00-inspect-stack-and-input.md +4 -0
  156. package/dist/agent-src/skills/existing-ui-audit/references/steps/01-enumerate-components.md +26 -0
  157. package/dist/agent-src/skills/existing-ui-audit/references/steps/01b-detect-component-taxonomy.md +7 -0
  158. package/dist/agent-src/skills/existing-ui-audit/references/steps/02-identify-design-system.md +12 -0
  159. package/dist/agent-src/skills/existing-ui-audit/references/steps/03-detect-design-tokens.md +35 -0
  160. package/dist/agent-src/skills/existing-ui-audit/references/steps/04-detect-shadcn-inventory.md +13 -0
  161. package/dist/agent-src/skills/existing-ui-audit/references/steps/04b-live-storybook-read.md +26 -0
  162. package/dist/agent-src/skills/existing-ui-audit/references/steps/05-list-reusable-patterns.md +14 -0
  163. package/dist/agent-src/skills/existing-ui-audit/references/steps/06-match-candidates.md +52 -0
  164. package/dist/agent-src/skills/existing-ui-audit/references/steps/07-greenfield-branch.md +29 -0
  165. package/dist/agent-src/skills/existing-ui-audit/references/steps/08-a11y-baseline.md +40 -0
  166. package/dist/agent-src/skills/existing-ui-audit/references/steps/09-validate-and-write.md +5 -0
  167. package/dist/agent-src/skills/experiment-loop/SKILL.md +1 -1
  168. package/dist/agent-src/skills/fe-design/references/design-patterns.md +16 -2
  169. package/dist/agent-src/skills/fe-design/references/design-read-and-memory.md +1 -1
  170. package/dist/agent-src/skills/fe-design/references/source-led-port.md +1 -1
  171. package/dist/agent-src/skills/finishing-a-development-branch/SKILL.md +6 -6
  172. package/dist/agent-src/skills/flux/SKILL.md +1 -1
  173. package/dist/agent-src/skills/form-handler/SKILL.md +15 -2
  174. package/dist/agent-src/skills/git-workflow/SKILL.md +2 -2
  175. package/dist/agent-src/skills/git-workflow/references/branch-update.md +7 -0
  176. package/dist/agent-src/skills/git-workflow/references/commit-subject.md +12 -0
  177. package/dist/agent-src/skills/git-workflow/references/push-closes-its-loop.md +10 -0
  178. package/dist/agent-src/skills/gtm-launch/SKILL.md +8 -1
  179. package/dist/agent-src/skills/html-deck/SKILL.md +7 -2
  180. package/dist/agent-src/skills/humanizer/SKILL.md +16 -3
  181. package/dist/agent-src/skills/humanizer/references/anti-aiisms.md +13 -1
  182. package/dist/agent-src/skills/humanizer/references/fixtures.md +8 -0
  183. package/dist/agent-src/skills/js-library-packaging/SKILL.md +5 -4
  184. package/dist/agent-src/skills/js-library-packaging/scripts/check_package_surface.mjs +197 -0
  185. package/dist/agent-src/skills/judge-artifact-completeness/SKILL.md +1 -1
  186. package/dist/agent-src/skills/judge-security-auditor/SKILL.md +2 -2
  187. package/dist/agent-src/skills/launch-readiness/SKILL.md +18 -22
  188. package/dist/agent-src/skills/learning-to-rule-or-skill/SKILL.md +5 -5
  189. package/dist/agent-src/skills/livewire/SKILL.md +1 -1
  190. package/dist/agent-src/skills/llm-provider-knowledge/SKILL.md +18 -0
  191. package/dist/agent-src/skills/logo-generation/SKILL.md +9 -3
  192. package/dist/agent-src/skills/market-entry-analysis/SKILL.md +6 -1
  193. package/dist/agent-src/skills/markitdown/SKILL.md +1 -1
  194. package/dist/agent-src/skills/memory-consolidation/SKILL.md +2 -2
  195. package/dist/agent-src/skills/messaging-architecture/SKILL.md +8 -1
  196. package/dist/agent-src/skills/motion-choreographer/SKILL.md +2 -2
  197. package/dist/agent-src/skills/playwright-testing/SKILL.md +2 -0
  198. package/dist/agent-src/skills/positioning-strategy/SKILL.md +10 -2
  199. package/dist/agent-src/skills/prediction-pool-optimizer/references/ev-fixtures.md +13 -0
  200. package/dist/agent-src/skills/prediction-pool-optimizer/references/odds-and-bonus.md +7 -0
  201. package/dist/agent-src/skills/project-analysis-core/SKILL.md +1 -1
  202. package/dist/agent-src/skills/project-analysis-hypothesis-driven/SKILL.md +1 -1
  203. package/dist/agent-src/skills/project-analyzer/SKILL.md +14 -75
  204. package/dist/agent-src/skills/project-analyzer/procedure.yaml +39 -0
  205. package/dist/agent-src/skills/project-analyzer/references/steps/01-project-overview.md +9 -0
  206. package/dist/agent-src/skills/project-analyzer/references/steps/02-architecture.md +7 -0
  207. package/dist/agent-src/skills/project-analyzer/references/steps/03-data-layer.md +6 -0
  208. package/dist/agent-src/skills/project-analyzer/references/steps/04-business-domains.md +7 -0
  209. package/dist/agent-src/skills/project-analyzer/references/steps/05-api-surface.md +6 -0
  210. package/dist/agent-src/skills/project-analyzer/references/steps/06-service-map.md +6 -0
  211. package/dist/agent-src/skills/project-analyzer/references/steps/07-module-inventory.md +6 -0
  212. package/dist/agent-src/skills/project-analyzer/references/steps/08-infrastructure-and-testing.md +5 -0
  213. package/dist/agent-src/skills/project-analyzer/references/steps/09-agent-docs-audit.md +6 -0
  214. package/dist/agent-src/skills/project-analyzer/references/steps/10-gap-analysis.md +6 -0
  215. package/dist/agent-src/skills/quality-tools/references/js-ts-tools.md +10 -0
  216. package/dist/agent-src/skills/quality-tools/references/php-tools.md +13 -0
  217. package/dist/agent-src/skills/quality-tools/references/python-tools.md +11 -0
  218. package/dist/agent-src/skills/react-native-setup/SKILL.md +7 -2
  219. package/dist/agent-src/skills/react-shadcn-ui/SKILL.md +5 -1
  220. package/dist/agent-src/skills/react-shadcn-ui/references/registry.md +13 -0
  221. package/dist/agent-src/skills/react-shadcn-ui/scripts/shadcn_add.mjs +315 -0
  222. package/dist/agent-src/skills/react-shadcn-ui/scripts/shadcn_add.ts +6 -6
  223. package/dist/agent-src/skills/receiving-code-review/SKILL.md +1 -1
  224. package/dist/agent-src/skills/refine-ticket/SKILL.md +2 -2
  225. package/dist/agent-src/skills/release-comms/SKILL.md +2 -1
  226. package/dist/agent-src/skills/repomix-packer/SKILL.md +2 -2
  227. package/dist/agent-src/skills/requesting-code-review/SKILL.md +3 -3
  228. package/dist/agent-src/skills/roadmap-management/references/archival.md +3 -3
  229. package/dist/agent-src/skills/roadmap-management/references/authoring.md +9 -2
  230. package/dist/agent-src/skills/roadmap-management/references/dashboard.md +3 -3
  231. package/dist/agent-src/skills/roadmap-management/references/lifecycle.md +3 -3
  232. package/dist/agent-src/skills/roadmap-writing/SKILL.md +4 -4
  233. package/dist/agent-src/skills/rtk-output-filtering/SKILL.md +1 -1
  234. package/dist/agent-src/skills/rule-writing/SKILL.md +1 -2
  235. package/dist/agent-src/skills/security/SKILL.md +41 -5
  236. package/dist/agent-src/skills/skill-improvement-pipeline/SKILL.md +5 -3
  237. package/dist/agent-src/skills/skill-reviewer/SKILL.md +1 -1
  238. package/dist/agent-src/skills/skill-writing/SKILL.md +23 -8
  239. package/dist/agent-src/skills/skill-writing/references/section-patterns.md +19 -1
  240. package/dist/agent-src/skills/source-discovery/SKILL.md +3 -3
  241. package/dist/agent-src/skills/sql-writing/SKILL.md +2 -2
  242. package/dist/agent-src/skills/standards-from-config/SKILL.md +2 -2
  243. package/dist/agent-src/skills/storybook-workshop/SKILL.md +5 -0
  244. package/dist/agent-src/skills/storybook-workshop/scripts/story_contrast_floor.mjs +99 -0
  245. package/dist/agent-src/skills/subagent-orchestration/SKILL.md +13 -13
  246. package/dist/agent-src/skills/subagent-orchestration/prompts/README.md +4 -3
  247. package/dist/agent-src/skills/svg-authoring/SKILL.md +7 -1
  248. package/dist/agent-src/skills/systematic-debugging/SKILL.md +2 -2
  249. package/dist/agent-src/skills/tailwind-engineer/SKILL.md +8 -3
  250. package/dist/agent-src/skills/tailwind-engineer/scripts/tailwind_config_gen.mjs +482 -0
  251. package/dist/agent-src/skills/test-case-discovery/SKILL.md +1 -1
  252. package/dist/agent-src/skills/threat-modeling/SKILL.md +8 -1
  253. package/dist/agent-src/skills/threat-modeling/data/manifest.json +5 -2
  254. package/dist/agent-src/skills/threat-modeling/data/reasoning.csv +10 -10
  255. package/dist/agent-src/skills/threat-modeling/data/surfaces.csv +11 -10
  256. package/dist/agent-src/skills/threat-modeling/data/threats.csv +34 -20
  257. package/dist/agent-src/skills/type-design/SKILL.md +196 -0
  258. package/dist/agent-src/skills/type-design/references/font-spec.md +90 -0
  259. package/dist/agent-src/skills/type-design/references/gates.md +113 -0
  260. package/dist/agent-src/skills/type-design/references/toolchain.md +66 -0
  261. package/dist/agent-src/skills/typography-system/SKILL.md +21 -11
  262. package/dist/agent-src/skills/typography-system/references/worked-scales.md +85 -0
  263. package/dist/agent-src/skills/ui-apply-generic/SKILL.md +1 -1
  264. package/dist/agent-src/skills/universal-project-analysis/SKILL.md +1 -1
  265. package/dist/agent-src/skills/upstream-contribute/SKILL.md +120 -125
  266. package/dist/agent-src/skills/using-git-worktrees/SKILL.md +1 -0
  267. package/dist/agent-src/skills/verify-repair-loop/SKILL.md +1 -1
  268. package/dist/agent-src/skills/voice-and-tone-design/SKILL.md +71 -2
  269. package/dist/agent-src/skills/worktree-lifecycle/SKILL.md +16 -14
  270. package/dist/agent-src/templates/AGENTS.md +1 -1
  271. package/dist/agent-src/templates/agents/agent-project-settings.example.yml +1 -1
  272. package/dist/agent-src/templates/agents/proposal.example.md +1 -1
  273. package/dist/agent-src/templates/github-workflows/advisories-daily.yml +85 -0
  274. package/dist/agent-src/templates/roadmaps.md +44 -2
  275. package/dist/agent-src/templates/scripts/check_memory.ts +2 -2
  276. package/dist/agent-src/templates/scripts/historical-bug-patterns.example.yml +13 -1
  277. package/dist/agent-src/templates/scripts/work_engine/cli.ts +17 -0
  278. package/dist/agent-src/templates/scripts/work_engine/cli_args.ts +10 -0
  279. package/dist/agent-src/templates/scripts/work_engine/directives/ui/scaffold.ts +22 -13
  280. package/dist/agent-src/templates/scripts/work_engine/dispatcher.ts +18 -4
  281. package/dist/agent-src/templates/scripts/work_engine/procedure/checks.ts +283 -0
  282. package/dist/agent-src/templates/scripts/work_engine/procedure/run.ts +432 -0
  283. package/dist/agent-src/templates/scripts/work_engine/procedure/sidecar.ts +185 -0
  284. package/dist/agent-src/templates/scripts/work_engine/state.ts +3 -0
  285. package/dist/cli/commands/uiRender.js +72 -17
  286. package/dist/cli/commands/uiRenderAsset.js +10 -2
  287. package/dist/cli/commands/uiRenderAssetFonts.js +158 -0
  288. package/dist/cli/commands/uiRenderAssetTypes.js +8 -20
  289. package/dist/cli/initRouting.js +1 -1
  290. package/dist/cli/mcp/dispatch.js +31 -9
  291. package/dist/cli/python/knowledge_ingest.js +7 -39
  292. package/dist/cli/python/workspace_secrets.js +4 -177
  293. package/dist/cli/registry.js +4 -1
  294. package/dist/cli-delegate/archive_completed_roadmaps.js +3 -2
  295. package/dist/cli-delegate/check_update_banner.js +635 -266
  296. package/dist/cli-delegate/{chunk-TMWYUOK4.js → chunk-2CX7NWRB.js} +224 -437
  297. package/dist/cli-delegate/chunk-2Y5AMLMY.js +136 -0
  298. package/dist/cli-delegate/chunk-3PK3VZHB.js +235 -0
  299. package/dist/cli-delegate/{chunk-OKJUIAPS.js → chunk-4E2W63DA.js} +1 -62
  300. package/dist/cli-delegate/chunk-5VO3RTMV.js +208 -0
  301. package/dist/cli-delegate/chunk-6E2LDY4F.js +27 -0
  302. package/dist/cli-delegate/{chunk-XQTPXKFA.js → chunk-6ZD2QZMN.js} +8 -17
  303. package/dist/cli-delegate/{chunk-6V5FMA3P.js → chunk-7CEI2YPS.js} +1 -1
  304. package/dist/cli-delegate/{chunk-DMSZHXZS.js → chunk-7DRWULEQ.js} +80 -7
  305. package/dist/cli-delegate/chunk-7NXCZSDL.js +54 -0
  306. package/dist/cli-delegate/chunk-AX3U3UWJ.js +328 -0
  307. package/dist/cli-delegate/{chunk-WOKWX5PL.js → chunk-BKALSTBZ.js} +18 -3
  308. package/dist/cli-delegate/chunk-BMGUGSY6.js +103 -0
  309. package/dist/cli-delegate/chunk-BYV46VRM.js +3309 -0
  310. package/dist/cli-delegate/{chunk-F3QDG2GT.js → chunk-BZJ4Y3CI.js} +259 -159
  311. package/dist/cli-delegate/{chunk-5GPULQBE.js → chunk-CMZEKSNN.js} +4280 -705
  312. package/dist/cli-delegate/chunk-DSY6LLCQ.js +127 -0
  313. package/dist/cli-delegate/{chunk-ZUZKZYCN.js → chunk-E3CFULNX.js} +67 -13
  314. package/dist/cli-delegate/{chunk-G5VVIZRC.js → chunk-F7HLSW6P.js} +1 -1
  315. package/dist/cli-delegate/chunk-FIEEOH5C.js +133 -0
  316. package/dist/cli-delegate/chunk-FKYZOWVD.js +719 -0
  317. package/dist/cli-delegate/chunk-I4KJYVPB.js +69 -0
  318. package/dist/cli-delegate/{chunk-JQOM7TTM.js → chunk-IDAOTDPE.js} +1 -100
  319. package/dist/cli-delegate/chunk-J2SJZICO.js +698 -0
  320. package/dist/cli-delegate/chunk-KR5ZIFPO.js +581 -0
  321. package/dist/cli-delegate/{chunk-WQWXGIWB.js → chunk-M6CRG5O6.js} +165 -15
  322. package/dist/cli-delegate/{chunk-PHD7OOLE.js → chunk-MQ2UDEGV.js} +14 -3
  323. package/dist/cli-delegate/chunk-NTM7G2V4.js +220 -0
  324. package/dist/cli-delegate/chunk-PV7S5DPJ.js +175 -0
  325. package/dist/cli-delegate/chunk-QBHEI5N4.js +919 -0
  326. package/dist/cli-delegate/{chunk-F7DQWYR5.js → chunk-RAXQOETZ.js} +6 -2
  327. package/dist/cli-delegate/{chunk-KR6EM23A.js → chunk-TULVDQ4L.js} +3 -48
  328. package/dist/cli-delegate/chunk-UUYEKXKR.js +20 -0
  329. package/dist/cli-delegate/{chunk-7XGD2OEU.js → chunk-UXWHY6CQ.js} +2 -1
  330. package/dist/cli-delegate/{chunk-PWX7CKMD.js → chunk-VC3ECUEK.js} +1 -1
  331. package/dist/cli-delegate/{chunk-T7XSJSUQ.js → chunk-VYZGJLCA.js} +1000 -814
  332. package/dist/cli-delegate/chunk-W5JXMF2T.js +77 -0
  333. package/dist/cli-delegate/{chunk-KXXWJTDO.js → chunk-WMNYVIYX.js} +1 -1
  334. package/dist/cli-delegate/chunk-XCY5KKUC.js +181 -0
  335. package/dist/cli-delegate/{chunk-6SRJTYJS.js → chunk-XIAPY44N.js} +37 -16
  336. package/dist/cli-delegate/{chunk-H76PHZBI.js → chunk-XLY5G3CM.js} +14 -19
  337. package/dist/cli-delegate/{chunk-6YQC2HLF.js → chunk-YHAPONWV.js} +54 -40
  338. package/dist/cli-delegate/cmd_adr_effective.js +41 -2
  339. package/dist/cli-delegate/cmd_analyze_session.js +7 -7
  340. package/dist/cli-delegate/cmd_brand_status.js +1287 -10
  341. package/dist/cli-delegate/cmd_ci_settle.js +330 -0
  342. package/dist/cli-delegate/cmd_conformance.js +487 -820
  343. package/dist/cli-delegate/cmd_doctor.js +26 -16
  344. package/dist/cli-delegate/cmd_doctor_neighbours.js +10 -7
  345. package/dist/cli-delegate/cmd_explain.js +9 -24
  346. package/dist/cli-delegate/cmd_export.js +15 -12
  347. package/dist/cli-delegate/cmd_fleet.js +6 -4
  348. package/dist/cli-delegate/cmd_git_convention.js +8 -4
  349. package/dist/cli-delegate/cmd_handoff.js +79 -242
  350. package/dist/cli-delegate/cmd_mcp_available.js +1 -1
  351. package/dist/cli-delegate/cmd_memory_get.js +4 -2
  352. package/dist/cli-delegate/cmd_migrate.js +2 -2
  353. package/dist/cli-delegate/cmd_packs_active.js +2 -2
  354. package/dist/cli-delegate/cmd_preflight.js +8 -6
  355. package/dist/cli-delegate/cmd_prune.js +17 -14
  356. package/dist/cli-delegate/cmd_route_audit.js +11 -8
  357. package/dist/cli-delegate/cmd_route_explain.js +649 -16
  358. package/dist/cli-delegate/cmd_session_recycle.js +15 -6
  359. package/dist/cli-delegate/cmd_settings_check.js +2 -2
  360. package/dist/cli-delegate/cmd_settings_get.js +1 -1
  361. package/dist/cli-delegate/cmd_settings_migrate.js +15 -12
  362. package/dist/cli-delegate/cmd_settings_set.js +1 -1
  363. package/dist/cli-delegate/cmd_sync.js +17 -14
  364. package/dist/cli-delegate/cmd_uninstall.js +186 -32
  365. package/dist/cli-delegate/cmd_update.js +76 -16
  366. package/dist/cli-delegate/cmd_upgrade.js +38 -7
  367. package/dist/cli-delegate/cmd_validate.js +17 -14
  368. package/dist/cli-delegate/cmd_versions.js +1 -1
  369. package/dist/cli-delegate/dashboard_mode.js +1 -1
  370. package/dist/cli-delegate/gate_execute.js +4 -3
  371. package/dist/cli-delegate/roadmap_age.js +22 -0
  372. package/dist/cli-delegate/roadmap_gates.js +4 -3
  373. package/dist/cli-delegate/update_roadmap_progress.js +3 -2
  374. package/dist/cli-delegate/upgrade_unattended-VVL6JLSX.js +541 -0
  375. package/dist/discovery/deprecation-report.md +1 -1
  376. package/dist/discovery/discovery-manifest.json +373 -190
  377. package/dist/discovery/discovery-manifest.json.sha256 +1 -1
  378. package/dist/discovery/discovery-manifest.summary.md +5 -5
  379. package/dist/discovery/dormancy-report.md +1 -1
  380. package/dist/discovery/orphan-report.md +1 -1
  381. package/dist/discovery/packs.json +21 -16
  382. package/dist/discovery/trust-report.md +3 -3
  383. package/dist/discovery/workspaces.json +16 -11
  384. package/dist/hooks/chat_history.chunk.cjs +6852 -0
  385. package/dist/hooks/chat_history.chunk.cjs.sha256 +1 -0
  386. package/dist/hooks/dispatch.js +17450 -18612
  387. package/dist/hooks/dispatch.sha256 +1 -1
  388. package/dist/hooks/egress_engine.chunk.cjs +915 -0
  389. package/dist/hooks/egress_engine.chunk.cjs.sha256 +1 -0
  390. package/dist/hooks/svg_rules.chunk.cjs +281 -49
  391. package/dist/hooks/svg_rules.chunk.cjs.sha256 +1 -1
  392. package/dist/install/claudeRuleRewrite.js +10 -3
  393. package/dist/install/conflict.js +59 -7
  394. package/dist/install/conflictTracker.js +93 -8
  395. package/dist/install/detect.js +3 -3
  396. package/dist/install/hostPermissionsAdapter.js +106 -0
  397. package/dist/install/install.mjs +3234 -1961
  398. package/dist/install/installThinLayer.js +2 -1
  399. package/dist/install/loggedWrites.js +142 -0
  400. package/dist/install/manifestFiles.js +21 -0
  401. package/dist/install/noGoDenyRows.js +300 -0
  402. package/dist/install/noGoRules.js +368 -0
  403. package/dist/install/ownershipLedger.js +133 -0
  404. package/dist/install/paths.js +12 -2
  405. package/dist/install/plan.js +1 -1
  406. package/dist/install/preflight.js +39 -8
  407. package/dist/install/preserve.js +96 -13
  408. package/dist/install/recordedOwnership.js +88 -5
  409. package/dist/install/rule_scope.js +20 -3
  410. package/dist/install/stagedRuntime.js +455 -0
  411. package/dist/install/toolsArg.js +19 -0
  412. package/dist/install/txlog.js +10 -6
  413. package/dist/install/userPin.js +47 -0
  414. package/dist/install/wizard-plan.js +26 -4
  415. package/dist/mcp/awesome-mcp-servers.row.md +1 -1
  416. package/dist/mcp/mcp-cloudflare-catalogue.json +3 -2
  417. package/dist/mcp/registry-manifest.json +6 -5
  418. package/dist/mcp/server.json +3 -3
  419. package/dist/mcp/server.mjs +10716 -5880
  420. package/dist/router.json +1 -1
  421. package/dist/scripts/_lib/agent_settings.js +7 -12
  422. package/dist/scripts/_lib/asset_render_record.js +219 -0
  423. package/dist/scripts/_lib/claude_builtin_names.js +9 -4
  424. package/dist/scripts/_lib/claude_settings_hooks.js +102 -34
  425. package/dist/scripts/_lib/egress_rules.js +769 -0
  426. package/dist/scripts/_lib/environment_detector.js +24 -33
  427. package/dist/scripts/_lib/global_deploy_inventory.js +146 -9
  428. package/dist/scripts/_lib/guidelines_lane.js +10 -1
  429. package/dist/scripts/_lib/identifier_redaction.js +57 -0
  430. package/dist/scripts/_lib/installed_layer.js +17 -0
  431. package/dist/scripts/_lib/installed_layer_normalise.js +72 -0
  432. package/dist/scripts/_lib/lean_projection_mode.js +34 -152
  433. package/dist/scripts/_lib/project_tree_form.js +118 -0
  434. package/dist/scripts/_lib/scoped_projection.js +133 -3
  435. package/dist/scripts/_lib/settings_removed_keys.js +29 -0
  436. package/dist/scripts/_lib/settings_renamed_keys.js +17 -5
  437. package/dist/scripts/_lib/subagent_native_fields.js +35 -0
  438. package/dist/scripts/_lib/svg_filled_counter.js +285 -0
  439. package/dist/scripts/_lib/svg_rules.js +2 -0
  440. package/dist/scripts/_lib/ui_surface.js +19 -0
  441. package/dist/scripts/_lib/verification_command.js +364 -0
  442. package/dist/scripts/_lib/workspace_secrets.js +229 -0
  443. package/dist/scripts/ai_council/seat_policy.js +33 -0
  444. package/dist/scripts/ai_council/transport_resolver.js +9 -10
  445. package/dist/scripts/condense.js +25 -29
  446. package/dist/server/io/substituteTemplate.js +2 -2
  447. package/dist/server/io/yamlIO.js +2 -2
  448. package/dist/server/routes/install.js +5 -1
  449. package/dist/server/routes/settings.js +2 -2
  450. package/dist/server/routes/wizard.js +1 -1
  451. package/dist/server/schemas/settings.js +22 -16
  452. package/dist/server/serverInfo.js +1 -1
  453. package/dist/shared/brandTokenDocument.js +47 -0
  454. package/dist/shared/brandTokenPaths.js +43 -0
  455. package/dist/shared/settingsCarveOut.js +0 -7
  456. package/dist/shared/skillRanking.js +103 -5
  457. package/dist/shared/userMd/formAdapter.js +16 -0
  458. package/dist/shared/userMd/schema.js +17 -0
  459. package/dist/ui/assets/index-w70Ado09.js +23 -0
  460. package/dist/ui/index.html +1 -1
  461. package/docs/MIGRATION.md +89 -2
  462. package/docs/THIRD-PARTY-NOTICES.md +27 -0
  463. package/docs/contracts/settings-classes.md +27 -9
  464. package/docs/guidelines/agent-infra/api-cost-levers.md +4 -3
  465. package/docs/guidelines/agent-infra/model-recommendation.md +11 -5
  466. package/docs/guidelines/agent-infra/rule-body-migration-inventory.md +1 -1
  467. package/docs/guidelines/agent-infra/self-improvement-pipeline.md +47 -24
  468. package/docs/guidelines/design-antipatterns.md +5 -0
  469. package/docs/guidelines/design-asset-discipline.md +17 -0
  470. package/docs/guidelines/design-fidelity-routing.md +1 -0
  471. package/docs/guidelines/php/api-design.md +10 -1
  472. package/llms.txt +12 -10
  473. package/package.json +13 -4
  474. package/src/agent-src/scripts/dashboard_mode.ts +4 -1
  475. package/src/agent-src/scripts/roadmap_age.ts +175 -0
  476. package/src/agent-src/scripts/update_roadmap_progress.ts +10 -2
  477. package/src/agent-src/templates/AGENTS.md +1 -1
  478. package/src/agent-src/templates/scripts/check_memory.ts +2 -2
  479. package/src/agent-src/templates/scripts/historical-bug-patterns.example.yml +13 -1
  480. package/src/agent-src/templates/scripts/work_engine/cli.ts +17 -0
  481. package/src/agent-src/templates/scripts/work_engine/cli_args.ts +10 -0
  482. package/src/agent-src/templates/scripts/work_engine/directives/ui/scaffold.ts +22 -13
  483. package/src/agent-src/templates/scripts/work_engine/dispatcher.ts +18 -4
  484. package/src/agent-src/templates/scripts/work_engine/procedure/checks.ts +283 -0
  485. package/src/agent-src/templates/scripts/work_engine/procedure/run.ts +432 -0
  486. package/src/agent-src/templates/scripts/work_engine/procedure/sidecar.ts +185 -0
  487. package/src/agent-src/templates/scripts/work_engine/state.ts +3 -0
  488. package/src/config/agent-settings.template.yml +120 -57
  489. package/src/config/agents-paths.yml +13 -7
  490. package/src/config/ci-local-parity.yml +45 -1
  491. package/src/config/continuity-surface.json +51 -2
  492. package/src/config/depth-audit-samples.json +5 -0
  493. package/src/config/discovery/command-verbs.yml +1 -0
  494. package/src/config/dispatch-economy-metrics.json +1 -0
  495. package/src/config/egress-mutations/class-precedence-swapped.json +7 -0
  496. package/src/config/egress-mutations/credential-token-restores.json +7 -0
  497. package/src/config/egress-mutations/iban-checksum-disabled.json +7 -0
  498. package/src/config/egress-mutations/raw-value-in-the-count-record.json +7 -0
  499. package/src/config/evaluator-budgets.json +4 -4
  500. package/src/config/gate-coverage.yml +176 -10
  501. package/src/config/gate-reachability-exemptions.json +3 -5
  502. package/src/config/gate-violation-baselines.json +32 -22
  503. package/src/config/gitignore-block.txt +6 -3
  504. package/src/config/hook-bundle-budget.json +34 -3
  505. package/src/config/hook-carrier-probes.json +30 -0
  506. package/src/config/hook-latency-budget.json +4 -2
  507. package/src/config/host-injection-effect.json +8 -1
  508. package/src/config/host-skill-frontmatter-keys.json +56 -0
  509. package/src/config/layer-form-brakes.json +4 -0
  510. package/src/config/layer-form-comparison-corpus.json +42 -0
  511. package/src/config/loop-surfaces.yaml +28 -47
  512. package/src/config/memory-twin-verdicts.yml +9 -1
  513. package/src/config/metric-registry.yml +40 -3
  514. package/src/config/pack-size-budget.json +15 -0
  515. package/src/config/procedure-core-budget.json +21 -0
  516. package/src/config/production-entries.json +18 -0
  517. package/src/config/profiles/minimal.ini +1 -1
  518. package/src/config/project-tree-form.json +24 -0
  519. package/src/config/reach-channels.yml +3 -3
  520. package/src/config/reach-prescriptions-intake.yml +1 -1
  521. package/src/config/release-gate-locality.yml +0 -7
  522. package/src/config/roadmap-step-size-baseline.json +118 -0
  523. package/src/config/routing-coverage-seed.json +93 -2
  524. package/src/config/skill-body-budget.json +686 -0
  525. package/src/config/skill-fork-pilot.json +17 -0
  526. package/src/config/skill-lifecycle-probes-codex.json +57 -0
  527. package/src/config/skill-lifecycle-probes.json +57 -0
  528. package/src/config/skill-output-shape.json +316 -0
  529. package/src/config/step-depth-table.json +58 -0
  530. package/src/config/turnaround-budget.json +90 -0
  531. package/src/install/claudeRuleRewrite.ts +10 -1
  532. package/src/install/conflict.ts +61 -6
  533. package/src/install/conflictTracker.ts +143 -9
  534. package/src/install/detect.ts +3 -3
  535. package/src/install/hostPermissionsAdapter.ts +136 -0
  536. package/src/install/installThinLayer.ts +12 -1
  537. package/src/install/loggedWrites.ts +148 -0
  538. package/src/install/manifestFiles.ts +24 -0
  539. package/src/install/noGoDenyRows.ts +368 -0
  540. package/src/install/noGoRules.ts +438 -0
  541. package/src/install/ownershipLedger.ts +180 -0
  542. package/src/install/paths.ts +11 -2
  543. package/src/install/plan.ts +1 -1
  544. package/src/install/preflight.ts +42 -10
  545. package/src/install/preserve.ts +131 -13
  546. package/src/install/recordedOwnership.ts +121 -3
  547. package/src/install/rule_scope.ts +20 -3
  548. package/src/install/stagedRuntime.ts +528 -0
  549. package/src/install/toolsArg.ts +16 -0
  550. package/src/install/txlog.ts +10 -6
  551. package/src/install/types.ts +23 -2
  552. package/src/install/userPin.ts +54 -0
  553. package/src/install/wizard-plan.ts +25 -4
  554. package/src/scripts/_cli/_doctor_emit.ts +24 -0
  555. package/src/scripts/_cli/cmd_brand_status.ts +223 -12
  556. package/src/scripts/_cli/cmd_ci_settle.ts +32 -0
  557. package/src/scripts/_cli/cmd_conformance.ts +3 -2
  558. package/src/scripts/_cli/cmd_doctor.ts +23 -44
  559. package/src/scripts/_cli/cmd_route_explain.ts +176 -2
  560. package/src/scripts/_cli/cmd_uninstall.ts +270 -26
  561. package/src/scripts/_cli/cmd_update.ts +49 -18
  562. package/src/scripts/_cli/cmd_upgrade.ts +38 -2
  563. package/src/scripts/_cli/detection_report.ts +7 -0
  564. package/src/scripts/_cli/doctor_execution.ts +1 -2
  565. package/src/scripts/_cli/doctor_install_mode.ts +39 -0
  566. package/src/scripts/_cli/doctor_network_posture.ts +3 -3
  567. package/src/scripts/_cli/doctor_ownership_ledger.ts +126 -0
  568. package/src/scripts/_cli/doctor_update_verdict.ts +104 -0
  569. package/src/scripts/_cli/explain_last/scrubber.ts +9 -21
  570. package/src/scripts/_cli/upgrade_unattended.ts +548 -0
  571. package/src/scripts/_dispatch.bash +42 -9
  572. package/src/scripts/_lib/activation_ladder.ts +1 -1
  573. package/src/scripts/_lib/advisory_inventory.ts +405 -0
  574. package/src/scripts/_lib/advisory_notice.ts +270 -0
  575. package/src/scripts/_lib/advisory_sources.ts +752 -0
  576. package/src/scripts/_lib/advisory_verdicts.ts +363 -0
  577. package/src/scripts/_lib/agent_artifact_location.ts +177 -0
  578. package/src/scripts/_lib/agent_settings.ts +7 -12
  579. package/src/scripts/_lib/arrival_record.ts +217 -0
  580. package/src/scripts/_lib/asset_render_record.ts +247 -0
  581. package/src/scripts/_lib/billing_grant.ts +4 -2
  582. package/src/scripts/_lib/brand_voice_slot.ts +258 -0
  583. package/src/scripts/_lib/canary_status.ts +24 -0
  584. package/src/scripts/_lib/cc_transcript.ts +276 -0
  585. package/src/scripts/_lib/changelog_eras.ts +83 -0
  586. package/src/scripts/_lib/claim_phrases.ts +71 -0
  587. package/src/scripts/_lib/classify_update.ts +171 -0
  588. package/src/scripts/_lib/claude_builtin_names.ts +9 -4
  589. package/src/scripts/_lib/claude_hook_scope.ts +195 -0
  590. package/src/scripts/_lib/claude_settings_hooks.ts +118 -34
  591. package/src/scripts/_lib/codex_resident_set.ts +460 -0
  592. package/src/scripts/_lib/codex_skill_finder.ts +225 -0
  593. package/src/scripts/_lib/confusables.ts +19 -0
  594. package/src/scripts/_lib/consumer_impact.ts +199 -0
  595. package/src/scripts/_lib/content_class.ts +127 -0
  596. package/src/scripts/_lib/council_settings_block.ts +9 -2
  597. package/src/scripts/_lib/counted_probe.ts +68 -1
  598. package/src/scripts/_lib/credential_deny_rows.ts +151 -0
  599. package/src/scripts/_lib/credential_files.ts +367 -0
  600. package/src/scripts/_lib/delivery_arm_experiment.ts +2 -2
  601. package/src/scripts/_lib/depth_flip.ts +141 -0
  602. package/src/scripts/_lib/design_lock.ts +117 -0
  603. package/src/scripts/_lib/design_sync_ledger.ts +142 -0
  604. package/src/scripts/_lib/design_sync_plan.ts +177 -0
  605. package/src/scripts/_lib/design_sync_reconcile.ts +159 -0
  606. package/src/scripts/_lib/design_sync_verify.ts +99 -0
  607. package/src/scripts/_lib/design_system_claude_design.ts +323 -0
  608. package/src/scripts/_lib/design_system_import.ts +84 -6
  609. package/src/scripts/_lib/dispatch_import_closure.ts +42 -11
  610. package/src/scripts/_lib/egress_credential_env.ts +35 -0
  611. package/src/scripts/_lib/egress_engine.ts +22 -0
  612. package/src/scripts/_lib/egress_known_values.ts +223 -0
  613. package/src/scripts/_lib/egress_normalize.ts +67 -0
  614. package/src/scripts/_lib/egress_prefixes.ts +42 -0
  615. package/src/scripts/_lib/egress_rules.ts +899 -0
  616. package/src/scripts/_lib/egress_rules_linearity.ts +56 -0
  617. package/src/scripts/_lib/egress_sender_scan.ts +290 -0
  618. package/src/scripts/_lib/egress_session_table.ts +510 -0
  619. package/src/scripts/_lib/egress_text.ts +63 -0
  620. package/src/scripts/_lib/egress_token.ts +252 -0
  621. package/src/scripts/_lib/empty_cycles.ts +1 -1
  622. package/src/scripts/_lib/environment_detector.ts +45 -30
  623. package/src/scripts/_lib/exemption_shape.ts +75 -1
  624. package/src/scripts/_lib/floor_posture.ts +185 -0
  625. package/src/scripts/_lib/forge_protection.ts +140 -2
  626. package/src/scripts/_lib/global_deploy_inventory.ts +159 -6
  627. package/src/scripts/_lib/guidelines_lane.ts +12 -1
  628. package/src/scripts/_lib/hand_kinds.ts +65 -0
  629. package/src/scripts/_lib/headless_invocation.ts +3 -3
  630. package/src/scripts/_lib/host_capability.ts +44 -7
  631. package/src/scripts/_lib/host_env_write.ts +39 -18
  632. package/src/scripts/_lib/host_listing_model.ts +14 -7
  633. package/src/scripts/_lib/identifier_redaction.ts +62 -0
  634. package/src/scripts/_lib/impact_bump.ts +70 -0
  635. package/src/scripts/_lib/install_reach_checks.ts +53 -1
  636. package/src/scripts/_lib/installed_layer.ts +31 -0
  637. package/src/scripts/_lib/installed_layer_normalise.ts +75 -0
  638. package/src/scripts/_lib/instructions_loaded_classify.ts +75 -0
  639. package/src/scripts/_lib/instructions_loaded_event.ts +53 -0
  640. package/src/scripts/_lib/knowledge_global_redaction.ts +2 -2
  641. package/src/scripts/_lib/layer_form_corpus.ts +165 -0
  642. package/src/scripts/_lib/layer_form_decision.ts +248 -0
  643. package/src/scripts/_lib/layer_form_evidence.ts +112 -0
  644. package/src/scripts/_lib/lean_projection_mode.ts +32 -161
  645. package/src/scripts/_lib/llm_proposer_transport.ts +1 -0
  646. package/src/scripts/_lib/loop_guards.ts +8 -120
  647. package/src/scripts/_lib/major_surface.ts +207 -0
  648. package/src/scripts/_lib/mcp_bridge.ts +30 -69
  649. package/src/scripts/_lib/merge_clearance_record.ts +384 -0
  650. package/src/scripts/_lib/neighbour_census.ts +18 -1
  651. package/src/scripts/_lib/orchestration_record.ts +61 -0
  652. package/src/scripts/_lib/outcome_vocabularies.ts +15 -23
  653. package/src/scripts/_lib/pin_advice.ts +49 -0
  654. package/src/scripts/_lib/platform_anchor.ts +222 -0
  655. package/src/scripts/_lib/price_freshness.ts +112 -0
  656. package/src/scripts/_lib/procedure_checks.ts +5 -0
  657. package/src/scripts/_lib/production_reach.ts +194 -0
  658. package/src/scripts/_lib/project_tree_form.ts +134 -0
  659. package/src/scripts/_lib/projection_key_migration.ts +122 -0
  660. package/src/scripts/_lib/prompt_shape.ts +13 -2
  661. package/src/scripts/_lib/provenance_verify.ts +272 -0
  662. package/src/scripts/_lib/quota_parked.ts +29 -14
  663. package/src/scripts/_lib/ratification_artifact.ts +64 -1
  664. package/src/scripts/_lib/ratification_subject.ts +508 -46
  665. package/src/scripts/_lib/release_findings_ingest.ts +36 -311
  666. package/src/scripts/_lib/release_highlights.ts +72 -2
  667. package/src/scripts/_lib/release_settings_surface.ts +392 -0
  668. package/src/scripts/_lib/review_round.ts +134 -0
  669. package/src/scripts/_lib/roadmap_checkboxes.ts +1 -1
  670. package/src/scripts/_lib/roadmap_slug_lock.ts +254 -0
  671. package/src/scripts/_lib/roadmap_step_size.ts +75 -0
  672. package/src/scripts/_lib/run_checkpoint.ts +60 -3
  673. package/src/scripts/_lib/runtime_wiring_checks.ts +15 -1
  674. package/src/scripts/_lib/scope_guard.sh +64 -5
  675. package/src/scripts/_lib/scoped_projection.ts +136 -3
  676. package/src/scripts/_lib/secret_detector.ts +24 -103
  677. package/src/scripts/_lib/security_fix.ts +429 -0
  678. package/src/scripts/_lib/security_fix_context.ts +133 -0
  679. package/src/scripts/_lib/self_repair.ts +69 -39
  680. package/src/scripts/_lib/self_repair_outgoing.ts +209 -0
  681. package/src/scripts/_lib/self_repair_payload.ts +86 -0
  682. package/src/scripts/_lib/session_eol.ts +3 -0
  683. package/src/scripts/_lib/session_pr_watch.ts +207 -0
  684. package/src/scripts/_lib/session_register.ts +51 -1
  685. package/src/scripts/_lib/session_tag.ts +51 -0
  686. package/src/scripts/_lib/settings_removed_keys.ts +30 -0
  687. package/src/scripts/_lib/settings_renamed_keys.ts +19 -5
  688. package/src/scripts/_lib/skill_catalogue.ts +66 -25
  689. package/src/scripts/_lib/skill_fork_pilot.ts +121 -0
  690. package/src/scripts/_lib/skill_leases.ts +203 -0
  691. package/src/scripts/_lib/skill_listing_overrides.ts +294 -0
  692. package/src/scripts/_lib/skill_materialisation.ts +388 -0
  693. package/src/scripts/_lib/skill_materialisation_gate.ts +210 -0
  694. package/src/scripts/_lib/skill_materialisation_lock.ts +149 -0
  695. package/src/scripts/_lib/skill_materialisation_triggers.ts +96 -0
  696. package/src/scripts/_lib/skill_origin.ts +21 -1
  697. package/src/scripts/_lib/skill_reach.ts +342 -0
  698. package/src/scripts/_lib/source_shape.ts +7 -2
  699. package/src/scripts/_lib/sqlite_guard.ts +1 -1
  700. package/src/scripts/_lib/step_anatomy.ts +330 -0
  701. package/src/scripts/_lib/subagent_capsule.ts +8 -2
  702. package/src/scripts/_lib/subagent_native_fields.ts +30 -0
  703. package/src/scripts/_lib/subagent_spawn.ts +36 -0
  704. package/src/scripts/_lib/subagent_steering.ts +367 -0
  705. package/src/scripts/_lib/svg_filled_counter.ts +287 -0
  706. package/src/scripts/_lib/svg_rules.ts +2 -0
  707. package/src/scripts/_lib/test_delta.ts +89 -6
  708. package/src/scripts/_lib/tier_downshift_verdict.ts +268 -0
  709. package/src/scripts/_lib/tool_result_census.ts +62 -0
  710. package/src/scripts/_lib/trigger_routers.ts +1 -0
  711. package/src/scripts/_lib/turnaround_throughput.ts +378 -0
  712. package/src/scripts/_lib/ui_surface.ts +22 -0
  713. package/src/scripts/_lib/unattended_gates.ts +100 -0
  714. package/src/scripts/_lib/undeployed_fixes.ts +34 -0
  715. package/src/scripts/_lib/update_check.ts +143 -12
  716. package/src/scripts/_lib/update_invite.ts +116 -0
  717. package/src/scripts/_lib/update_notice.ts +259 -0
  718. package/src/scripts/_lib/verify_clause.ts +4 -2
  719. package/src/scripts/_lib/version_order.ts +146 -0
  720. package/src/scripts/_lib/worker_reuse.ts +191 -0
  721. package/src/scripts/_lib/workspace_secrets.ts +273 -0
  722. package/src/scripts/_lib/worktree_git.ts +67 -0
  723. package/src/scripts/_lib/worktree_ignored.ts +116 -0
  724. package/src/scripts/adoption_status.ts +330 -3
  725. package/src/scripts/adr_cite_check.ts +93 -0
  726. package/src/scripts/advisories.ts +803 -0
  727. package/src/scripts/ai-image/adapters/flux.sh +1 -0
  728. package/src/scripts/ai-image/adapters/gemini-image.sh +1 -0
  729. package/src/scripts/ai-image/adapters/ideogram.sh +1 -0
  730. package/src/scripts/ai-image/adapters/recraft.sh +1 -0
  731. package/src/scripts/ai-video/adapters/comfyui.sh +1 -0
  732. package/src/scripts/ai-video/adapters/fal.sh +1 -0
  733. package/src/scripts/ai-video/adapters/gemini-veo.sh +1 -0
  734. package/src/scripts/ai-video/adapters/higgsfield.sh +1 -0
  735. package/src/scripts/ai-video/adapters/kling.sh +1 -0
  736. package/src/scripts/ai-video/adapters/musetalk.sh +1 -0
  737. package/src/scripts/ai-video/adapters/openai-images.sh +1 -0
  738. package/src/scripts/ai-video/adapters/replicate.sh +1 -0
  739. package/src/scripts/ai-video/adapters/sora.sh +1 -0
  740. package/src/scripts/ai-video/adapters/syncso.sh +1 -0
  741. package/src/scripts/ai-video/stitch.sh +115 -2
  742. package/src/scripts/ai_council/airgap.ts +1 -0
  743. package/src/scripts/ai_council/api_transport.ts +27 -4
  744. package/src/scripts/ai_council/budget_guard.ts +300 -11
  745. package/src/scripts/ai_council/bundler.ts +20 -29
  746. package/src/scripts/ai_council/chairman.ts +20 -2
  747. package/src/scripts/ai_council/cli_agency_bounds.ts +158 -0
  748. package/src/scripts/ai_council/cli_launch_env.ts +54 -0
  749. package/src/scripts/ai_council/cli_least_agency_canary.ts +18 -2
  750. package/src/scripts/ai_council/clients.ts +56 -73
  751. package/src/scripts/ai_council/config.ts +16 -22
  752. package/src/scripts/ai_council/council_egress.ts +167 -0
  753. package/src/scripts/ai_council/exposure_ledger.ts +117 -0
  754. package/src/scripts/ai_council/free_hand_shadow.ts +288 -0
  755. package/src/scripts/ai_council/free_route.ts +216 -0
  756. package/src/scripts/ai_council/free_route_catalog.ts +310 -0
  757. package/src/scripts/ai_council/free_route_client.ts +99 -0
  758. package/src/scripts/ai_council/free_rung.ts +61 -0
  759. package/src/scripts/ai_council/hand_payload.ts +338 -0
  760. package/src/scripts/ai_council/hand_schemas.ts +123 -0
  761. package/src/scripts/ai_council/jury_aggregate.ts +155 -1
  762. package/src/scripts/ai_council/kind_flip.ts +221 -0
  763. package/src/scripts/ai_council/kind_flip_state.ts +19 -0
  764. package/src/scripts/ai_council/learn_low_impact_preview.ts +50 -22
  765. package/src/scripts/ai_council/modification_review.ts +98 -5
  766. package/src/scripts/ai_council/necessity.ts +7 -0
  767. package/src/scripts/ai_council/orchestrator.ts +23 -26
  768. package/src/scripts/ai_council/pricing.ts +10 -0
  769. package/src/scripts/ai_council/redact_low_impact_entry.ts +5 -2
  770. package/src/scripts/ai_council/response_render.ts +27 -4
  771. package/src/scripts/ai_council/round_reservations.ts +119 -0
  772. package/src/scripts/ai_council/route_chooser.ts +161 -0
  773. package/src/scripts/ai_council/route_liveness.ts +152 -0
  774. package/src/scripts/ai_council/route_member.ts +114 -0
  775. package/src/scripts/ai_council/seat_policy.ts +47 -0
  776. package/src/scripts/ai_council/seat_resume.ts +40 -0
  777. package/src/scripts/ai_council/self_hosted_probe.ts +327 -0
  778. package/src/scripts/ai_council/shadow_dispatch.ts +13 -3
  779. package/src/scripts/ai_council/spend_gate.ts +18 -2
  780. package/src/scripts/ai_council/status_surface.ts +39 -0
  781. package/src/scripts/ai_council/transport_resolver.ts +15 -18
  782. package/src/scripts/analysis_analysts.ts +226 -0
  783. package/src/scripts/analysis_anchors.ts +140 -0
  784. package/src/scripts/analysis_and_optimize.ts +44 -0
  785. package/src/scripts/analysis_emit.ts +150 -0
  786. package/src/scripts/analysis_exchange.ts +186 -0
  787. package/src/scripts/analysis_gate.ts +158 -0
  788. package/src/scripts/analysis_inbox_final.ts +173 -0
  789. package/src/scripts/analysis_ledger.ts +119 -0
  790. package/src/scripts/analysis_pr_optimize.ts +219 -0
  791. package/src/scripts/analysis_pr_review.ts +240 -0
  792. package/src/scripts/analysis_pr_target.ts +121 -0
  793. package/src/scripts/analysis_prompts.ts +130 -0
  794. package/src/scripts/analysis_publish.ts +358 -0
  795. package/src/scripts/analysis_questions.ts +78 -0
  796. package/src/scripts/analysis_run.ts +248 -0
  797. package/src/scripts/analysis_run_record.ts +210 -0
  798. package/src/scripts/analysis_target.ts +343 -0
  799. package/src/scripts/analysis_validate.ts +161 -0
  800. package/src/scripts/anchor_eval_falsify.ts +1 -1
  801. package/src/scripts/arrival_report.ts +115 -0
  802. package/src/scripts/ask_transport.ts +406 -35
  803. package/src/scripts/backfill_model_tier.ts +4 -5
  804. package/src/scripts/before_complete_hook.ts +48 -2
  805. package/src/scripts/bench_hook_latency.ts +3 -3
  806. package/src/scripts/bench_procedure_cursor.ts +440 -0
  807. package/src/scripts/bootstrap.sh +3 -3
  808. package/src/scripts/build_exit_code_register.ts +440 -0
  809. package/src/scripts/build_proof.ts +23 -1
  810. package/src/scripts/cache_realization_report.ts +155 -14
  811. package/src/scripts/canary_liveness.ts +117 -0
  812. package/src/scripts/chat_history.ts +12 -15
  813. package/src/scripts/check_account_surface.ts +318 -0
  814. package/src/scripts/check_agent_artifact_location.ts +17 -160
  815. package/src/scripts/check_bundle_path_leakage.ts +6 -0
  816. package/src/scripts/check_ci_local_parity.ts +21 -13
  817. package/src/scripts/check_claims.ts +77 -2
  818. package/src/scripts/check_completion_review.ts +34 -1
  819. package/src/scripts/check_concern_admissions.ts +41 -5
  820. package/src/scripts/check_consumer_scope_flip.ts +1 -1
  821. package/src/scripts/check_context_paths.ts +2 -0
  822. package/src/scripts/check_council_layout.ts +9 -0
  823. package/src/scripts/check_credential_spelling.ts +267 -0
  824. package/src/scripts/check_egress_mutations.ts +239 -0
  825. package/src/scripts/check_enforcement_coverage.ts +16 -3
  826. package/src/scripts/check_estate_count.ts +16 -1
  827. package/src/scripts/check_finding_dispositions.ts +174 -73
  828. package/src/scripts/check_gate_coverage.ts +123 -21
  829. package/src/scripts/check_gate_reachability.ts +16 -2
  830. package/src/scripts/check_generator_sync.ts +46 -0
  831. package/src/scripts/check_hook_bundle_composition.ts +139 -1
  832. package/src/scripts/check_host_docs_digest.ts +142 -5
  833. package/src/scripts/check_kernel_edit_ratified.ts +301 -76
  834. package/src/scripts/check_kernel_rule_bundle.ts +14 -10
  835. package/src/scripts/check_knowledge_cards.ts +83 -3
  836. package/src/scripts/check_memory.ts +13 -3
  837. package/src/scripts/check_pack_size.ts +1 -1
  838. package/src/scripts/check_permission_deny_syntax.ts +247 -0
  839. package/src/scripts/check_platform_anchor.ts +243 -0
  840. package/src/scripts/check_proposal.ts +183 -1
  841. package/src/scripts/check_reach_channels.ts +5 -3
  842. package/src/scripts/check_references.ts +5 -2
  843. package/src/scripts/check_release_manifest_content.ts +33 -0
  844. package/src/scripts/check_release_pr_shape.ts +8 -3
  845. package/src/scripts/check_rule_invariants.ts +9 -1
  846. package/src/scripts/check_skill_body_budget.ts +343 -0
  847. package/src/scripts/check_skill_requires.ts +137 -1
  848. package/src/scripts/check_step_production_reach.ts +257 -0
  849. package/src/scripts/check_step_receipts.ts +246 -0
  850. package/src/scripts/check_structural_breaking.ts +7 -1
  851. package/src/scripts/check_suppression_hygiene.ts +8 -0
  852. package/src/scripts/check_test_weakening.ts +14 -0
  853. package/src/scripts/check_token_quality_golden.ts +5 -1
  854. package/src/scripts/check_update_banner.ts +50 -3
  855. package/src/scripts/check_verify_expectation_delta.ts +2 -1
  856. package/src/scripts/check_voice_lexicon.ts +531 -0
  857. package/src/scripts/ci_os_attribution.ts +327 -0
  858. package/src/scripts/ci_platform_scope.ts +69 -0
  859. package/src/scripts/ci_settle.ts +4 -1
  860. package/src/scripts/ci_status.ts +0 -1
  861. package/src/scripts/ci_time_to_green.ts +748 -0
  862. package/src/scripts/classify_merge_risk.ts +407 -19
  863. package/src/scripts/code_graph/sqlite_store.ts +1 -1
  864. package/src/scripts/compile_trigger_evals.ts +353 -0
  865. package/src/scripts/condense.ts +25 -31
  866. package/src/scripts/consumer_matrix.ts +61 -3
  867. package/src/scripts/council_availability_hook.ts +12 -4
  868. package/src/scripts/council_cli.ts +56 -44
  869. package/src/scripts/cross_repo_retrieve.ts +9 -72
  870. package/src/scripts/design_lock.ts +106 -0
  871. package/src/scripts/design_slop_rules.ts +30 -0
  872. package/src/scripts/design_sync.ts +264 -0
  873. package/src/scripts/design_system_import.ts +30 -13
  874. package/src/scripts/dispatch_economy_report.ts +46 -1
  875. package/src/scripts/dispatch_r2_reviewer.ts +41 -5
  876. package/src/scripts/egress_canary.ts +166 -0
  877. package/src/scripts/egress_sender_census.ts +101 -0
  878. package/src/scripts/external_sources_denylist.json +94 -12
  879. package/src/scripts/generate_catalog.ts +6 -2
  880. package/src/scripts/generate_owned_digest.ts +163 -0
  881. package/src/scripts/generate_reference_toc.ts +143 -0
  882. package/src/scripts/generate_subagent_floor.ts +11 -1
  883. package/src/scripts/handoff_context_hook.ts +34 -0
  884. package/src/scripts/hook_carrier_census.ts +263 -0
  885. package/src/scripts/hook_chunks.d.mts +12 -0
  886. package/src/scripts/hook_chunks.mjs +114 -0
  887. package/src/scripts/hook_manifest.json +1 -1
  888. package/src/scripts/hook_manifest.yaml +68 -42
  889. package/src/scripts/hooks/block_config_weakening.ts +127 -3
  890. package/src/scripts/hooks/block_credential_reads.ts +165 -0
  891. package/src/scripts/hooks/block_no_verify.ts +47 -23
  892. package/src/scripts/hooks/block_speaking_inbox_dir.ts +38 -7
  893. package/src/scripts/hooks/category_a.ts +202 -25
  894. package/src/scripts/hooks/concern_failure_policy.ts +6 -6
  895. package/src/scripts/hooks/concern_registry.ts +31 -6
  896. package/src/scripts/hooks/concern_registry_types.ts +11 -0
  897. package/src/scripts/hooks/delegation_nudge_hook.ts +105 -15
  898. package/src/scripts/hooks/design_pass_hook.ts +42 -10
  899. package/src/scripts/hooks/dispatch_hook.ts +14 -13
  900. package/src/scripts/hooks/egress_engine_loader.ts +125 -0
  901. package/src/scripts/hooks/egress_stage.ts +440 -0
  902. package/src/scripts/hooks/hook_stdin.ts +29 -4
  903. package/src/scripts/hooks/host_docs_pages.ts +194 -0
  904. package/src/scripts/hooks/host_docs_pages.yaml +75 -0
  905. package/src/scripts/hooks/host_lowering.json +1 -1
  906. package/src/scripts/hooks/host_lowering.yaml +22 -21
  907. package/src/scripts/hooks/host_rate_marker_hook.ts +73 -0
  908. package/src/scripts/hooks/instructions_observer_hook.ts +170 -0
  909. package/src/scripts/hooks/interruption_ledger_hook.ts +1 -1
  910. package/src/scripts/hooks/lazy_concern.ts +148 -0
  911. package/src/scripts/hooks/orchestration_record_hook.ts +80 -2
  912. package/src/scripts/hooks/payload_stub.ts +43 -6
  913. package/src/scripts/hooks/permission_gate.ts +7 -7
  914. package/src/scripts/hooks/push_settle_hook.ts +32 -3
  915. package/src/scripts/hooks/replay_hook.ts +43 -0
  916. package/src/scripts/hooks/reread_guard_hook.ts +87 -10
  917. package/src/scripts/hooks/rtk_wrap_hook.ts +4 -3
  918. package/src/scripts/hooks/rule_inject_hook.ts +8 -1
  919. package/src/scripts/hooks/session_eol_hook.ts +48 -1
  920. package/src/scripts/hooks/source_first_gate_hook.ts +6 -8
  921. package/src/scripts/hooks/spawn_guard_shadow_hook.ts +162 -10
  922. package/src/scripts/hooks/state_io.ts +2 -2
  923. package/src/scripts/hooks/subagent_ledger_hook.ts +80 -0
  924. package/src/scripts/hooks/svg_obligation.ts +75 -19
  925. package/src/scripts/hooks/tool_result_bytes_hook.ts +14 -5
  926. package/src/scripts/hooks/turn_end_gate_hook.ts +1 -1
  927. package/src/scripts/hooks/ui_route_nudge_hook.ts +2 -12
  928. package/src/scripts/hooks_doctor.ts +31 -0
  929. package/src/scripts/hooks_status.ts +58 -3
  930. package/src/scripts/inbox_source_census.ts +74 -13
  931. package/src/scripts/install +25 -3
  932. package/src/scripts/install.ts +61 -92
  933. package/src/scripts/interruption_report.ts +11 -1
  934. package/src/scripts/layer_baseline_report.ts +267 -0
  935. package/src/scripts/learning_sidecar.ts +1 -1
  936. package/src/scripts/lint_agents_layout.ts +3 -0
  937. package/src/scripts/lint_blocker_citations.ts +104 -0
  938. package/src/scripts/lint_breaking_changes_index.ts +40 -7
  939. package/src/scripts/lint_consolidation_lineage.ts +144 -16
  940. package/src/scripts/lint_consumer_internal_refs.ts +90 -42
  941. package/src/scripts/lint_context_spine_usage.ts +21 -0
  942. package/src/scripts/lint_decision_classes.ts +34 -0
  943. package/src/scripts/lint_design_antipattern_parity.ts +39 -7
  944. package/src/scripts/lint_evidence_artifacts.ts +31 -0
  945. package/src/scripts/lint_example_fences.ts +11 -2
  946. package/src/scripts/lint_ghostwriter_source.ts +42 -10
  947. package/src/scripts/lint_hook_manifest.ts +118 -0
  948. package/src/scripts/lint_marketplace_install_completeness.ts +4 -0
  949. package/src/scripts/lint_mcp_config_security.ts +9 -11
  950. package/src/scripts/lint_plan_risk_register.ts +28 -1
  951. package/src/scripts/lint_positioning.ts +4 -4
  952. package/src/scripts/lint_provenance.ts +1 -0
  953. package/src/scripts/lint_roadmap_blockers.ts +114 -4
  954. package/src/scripts/lint_roadmap_complexity.ts +98 -0
  955. package/src/scripts/lint_skill_link_reach.ts +251 -9
  956. package/src/scripts/lint_skill_procedures.ts +252 -0
  957. package/src/scripts/lint_skill_scripts_readonly.ts +12 -1
  958. package/src/scripts/lint_subagent_determinism.ts +14 -1
  959. package/src/scripts/lint_ticked_unmet_criteria.ts +300 -21
  960. package/src/scripts/mcp_registry_submit.sh +2 -2
  961. package/src/scripts/mcp_server/consumer_tool_catalog.json +4 -4
  962. package/src/scripts/mcp_server/suggest_skill.ts +89 -4
  963. package/src/scripts/mcp_server/tools.ts +2 -33
  964. package/src/scripts/measure_skill_ranker_baseline.ts +203 -5
  965. package/src/scripts/measure_turn_end_gate.ts +61 -1
  966. package/src/scripts/merge_clearance.ts +225 -0
  967. package/src/scripts/migrate_command_suggestions.ts +1 -1
  968. package/src/scripts/network_sources.ts +236 -0
  969. package/src/scripts/no_go_deny_rows.ts +225 -0
  970. package/src/scripts/orchestration_record.ts +15 -2
  971. package/src/scripts/plan_test_shards.ts +103 -0
  972. package/src/scripts/pr_url_reminder_hook.ts +10 -0
  973. package/src/scripts/print_required_checks.ts +5 -5
  974. package/src/scripts/probe_depth_shadow.ts +406 -0
  975. package/src/scripts/probe_turnaround.ts +342 -10
  976. package/src/scripts/ratification_subject.ts +176 -0
  977. package/src/scripts/rdp_gate_classify.ts +1 -0
  978. package/src/scripts/rdp_quality_eval.ts +1 -0
  979. package/src/scripts/release.ts +31 -64
  980. package/src/scripts/release_drill.ts +63 -188
  981. package/src/scripts/release_env.ts +37 -0
  982. package/src/scripts/release_publication.ts +11 -10
  983. package/src/scripts/report_consumer_gate_reach.ts +233 -0
  984. package/src/scripts/report_merge_gate_load.ts +295 -0
  985. package/src/scripts/report_production_reach.ts +35 -0
  986. package/src/scripts/report_project_contract.ts +123 -0
  987. package/src/scripts/report_reducible_classes.ts +342 -0
  988. package/src/scripts/report_required_checks_drift.ts +5 -3
  989. package/src/scripts/report_skill_host_census.ts +199 -0
  990. package/src/scripts/report_standing_payload_by_host.ts +7 -7
  991. package/src/scripts/retro.ts +758 -0
  992. package/src/scripts/retro_facts.ts +575 -0
  993. package/src/scripts/retro_queue.ts +739 -0
  994. package/src/scripts/retro_session_facts.ts +218 -0
  995. package/src/scripts/retro_sweep.ts +493 -0
  996. package/src/scripts/retro_triage.ts +126 -0
  997. package/src/scripts/roadmap_context.ts +2 -2
  998. package/src/scripts/roadmap_drain_queue.ts +601 -0
  999. package/src/scripts/run_supervise.ts +24 -2
  1000. package/src/scripts/schemas/agent-settings.schema.json +0 -16
  1001. package/src/scripts/schemas/command.schema.json +3 -3
  1002. package/src/scripts/schemas/review-findings.schema.json +8 -0
  1003. package/src/scripts/schemas/skill.schema.json +7 -6
  1004. package/src/scripts/schemas/subagent.schema.json +33 -2
  1005. package/src/scripts/score_skill_selection.ts +5 -2
  1006. package/src/scripts/second_brain_retrieval.ts +1 -0
  1007. package/src/scripts/second_brain_run.ts +1 -0
  1008. package/src/scripts/self_repair_cli.ts +563 -87
  1009. package/src/scripts/self_review_gate.ts +59 -4
  1010. package/src/scripts/session_register_hook.ts +91 -4
  1011. package/src/scripts/sessions_cli.ts +100 -5
  1012. package/src/scripts/skill_collision_clusters.ts +1 -1
  1013. package/src/scripts/skill_tools/score_skill_relevance.ts +31 -2
  1014. package/src/scripts/skill_trigger_eval.ts +4 -2
  1015. package/src/scripts/source_adapters.ts +183 -0
  1016. package/src/scripts/step_receipt.ts +100 -0
  1017. package/src/scripts/sync_pr_branch.ts +4 -0
  1018. package/src/scripts/test_council_qualification.ts +1 -1
  1019. package/src/scripts/trigger_eval_grandfather.json +3 -49
  1020. package/src/scripts/trigger_eval_rotation.ts +31 -3
  1021. package/src/scripts/ui_conformance_probe.ts +405 -1
  1022. package/src/scripts/update_counts.ts +230 -11
  1023. package/src/scripts/update_invite_hook.ts +245 -0
  1024. package/src/scripts/update_notice_hook.ts +298 -0
  1025. package/src/scripts/validate_frontmatter.ts +85 -0
  1026. package/src/scripts/worker_reuse_shadow_report.ts +519 -0
  1027. package/src/scripts/worktree_cleanup_check.ts +915 -121
  1028. package/src/server/io/yamlIO.ts +2 -2
  1029. package/src/server/schemas/settings.ts +37 -23
  1030. package/src/shared/brandTokenDocument.ts +46 -0
  1031. package/src/shared/brandTokenPaths.ts +43 -0
  1032. package/src/shared/settingsCarveOut.ts +0 -8
  1033. package/src/shared/skillRanking.ts +106 -5
  1034. package/src/shared/userMd/formAdapter.ts +15 -1
  1035. package/src/shared/userMd/schema.ts +22 -0
  1036. package/src/templates/agent-user.md +4 -0
  1037. package/src/templates/agent-user.yml +4 -0
  1038. package/dist/cli-delegate/chunk-4DBG5K7M.js +0 -1123
  1039. package/dist/cli-delegate/chunk-523HCFYO.js +0 -90
  1040. package/dist/cli-delegate/chunk-A4QJ6ENT.js +0 -50
  1041. package/dist/cli-delegate/chunk-AL3RZ22D.js +0 -74
  1042. package/dist/cli-delegate/chunk-KB5FZ655.js +0 -208
  1043. package/dist/cli-delegate/chunk-MDPPKQCQ.js +0 -875
  1044. package/dist/cli-delegate/chunk-OAFSJBHH.js +0 -272
  1045. package/dist/ui/assets/index-C3djEJah.js +0 -23
  1046. package/src/scripts/_lib/continuation_ladder.ts +0 -335
  1047. package/src/scripts/hooks/run_continuation_hook.ts +0 -1524
@@ -2,58 +2,86 @@ 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-XIAPY44N.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
+ logProofApplies,
27
+ loggedWriteDigests,
28
+ migrationPreservedMessage,
29
+ onlyDeployed,
30
+ preservedFileMessage,
31
+ sidecarPathFor,
32
+ wroteTheseBytes
33
+ } from "./chunk-3PK3VZHB.js";
10
34
  import {
11
35
  main
12
- } from "./chunk-G5VVIZRC.js";
36
+ } from "./chunk-F7HLSW6P.js";
13
37
  import {
38
+ TIER_TO_CLAUDE_MODEL,
14
39
  absoluteBodyLinkPrefix,
15
40
  appendTxLog,
16
41
  build_thin,
42
+ read_model_tier,
43
+ render_native_model_md,
17
44
  ruleBody,
18
45
  splitFrontmatter,
19
46
  split_frontmatter
20
- } from "./chunk-6YQC2HLF.js";
47
+ } from "./chunk-YHAPONWV.js";
21
48
  import {
22
49
  SCOPE_DETECT_AI_DIRS,
23
- SCOPE_DETECT_MANIFESTS
24
- } from "./chunk-A4QJ6ENT.js";
50
+ SCOPE_DETECT_MANIFESTS,
51
+ getLogPath
52
+ } from "./chunk-W5JXMF2T.js";
25
53
  import {
26
- INVENTORY_BASENAME,
54
+ FINDER_NAME,
55
+ _read_settings,
56
+ _with_lock,
57
+ atomicWriteFile,
27
58
  build_claude_hook_matrix,
59
+ deployClaudeCarrier,
60
+ ensureCodexFinder,
28
61
  ensure_managed_hooks,
29
- expected_deploy_files,
30
- inventory_path,
31
- is_ancestor,
32
- load_inventory,
62
+ finderDescription,
63
+ installerThinsHost,
33
64
  printResiduals,
34
65
  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";
66
+ removeCodexFinder
67
+ } from "./chunk-QBHEI5N4.js";
42
68
  import {
43
69
  LEGACY_ALL,
44
70
  compute_active_pack_ids,
45
- is_pruned_under_scoped,
46
71
  load_lab_pack_ids,
47
72
  load_packs_registry,
48
73
  parseFrontmatter,
49
74
  prune_lab_modules,
50
- prune_modules_by,
75
+ prune_scoped_modules,
51
76
  ruleFileArrives,
52
77
  ruleScopeFromSettings
53
- } from "./chunk-DMSZHXZS.js";
78
+ } from "./chunk-7DRWULEQ.js";
54
79
  import {
55
80
  write_managed_block
56
81
  } from "./chunk-ULQRUR23.js";
82
+ import {
83
+ hostBindings
84
+ } from "./chunk-PV7S5DPJ.js";
57
85
  import {
58
86
  check_version,
59
87
  classify_mismatch,
@@ -64,6 +92,10 @@ import {
64
92
  read_lockfile,
65
93
  write_lockfile
66
94
  } from "./chunk-LQOCRFWT.js";
95
+ import {
96
+ find_project_root_with_anchor,
97
+ load_agent_settings
98
+ } from "./chunk-XLY5G3CM.js";
67
99
  import {
68
100
  HOOK_SIGNATURES,
69
101
  deepMerge,
@@ -73,23 +105,34 @@ import {
73
105
  mergeHostConfig
74
106
  } from "./chunk-DEIV7XP7.js";
75
107
  import {
108
+ INVENTORY_BASENAME,
76
109
  NO_RECORDED_HASHES,
110
+ expected_deploy_files,
111
+ file_sha256,
112
+ inventory_path,
113
+ is_ancestor,
114
+ ledgerListedPaths,
115
+ load_inventory,
116
+ readRecordedHashes,
117
+ reap_stale,
118
+ reap_tagged_orphans,
119
+ record_deploy,
120
+ recordedHashesWithLedger,
121
+ recorded_absolute_files,
122
+ recorded_digests,
123
+ recorded_rel_files,
124
+ save_inventory
125
+ } from "./chunk-J2SJZICO.js";
126
+ import {
77
127
  ScopeMismatchError,
78
- classifyOwnership,
79
128
  manifest_path,
80
- readRecordedHashes,
81
129
  read_manifest,
82
- recordedHashesForRoot,
83
130
  upsert_tool,
84
131
  write_manifest
85
- } from "./chunk-OKJUIAPS.js";
132
+ } from "./chunk-4E2W63DA.js";
86
133
  import {
87
134
  require_dist
88
135
  } from "./chunk-OY53J6II.js";
89
- import {
90
- find_project_root_with_anchor,
91
- load_agent_settings
92
- } from "./chunk-H76PHZBI.js";
93
136
  import {
94
137
  DEFAULT_EVENT4U_ROOT_RELATIVE,
95
138
  event4u_root,
@@ -344,24 +387,490 @@ function subtract_pointers(doc, entries) {
344
387
  return [doc, warnings];
345
388
  }
346
389
 
390
+ // src/scripts/_lib/codex_resident_set.ts
391
+ import { createHash as createHash2 } from "node:crypto";
392
+ import * as fs from "node:fs";
393
+ import * as path from "node:path";
394
+ var RECORD_DIRNAME = "codex-resident-set";
395
+ var POLICY_REL = path.join("agents", "openai.yaml");
396
+ var CODEX_BUDGET_CHARS = 8e3;
397
+ var POLICY_BODY = "policy:\n allow_implicit_invocation: false\n";
398
+ var ASSUMPTIONS = [
399
+ {
400
+ id: "entry-cost-is-name-plus-description",
401
+ provenance: "upstream-prose",
402
+ 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.'
403
+ },
404
+ {
405
+ id: "per-entry-overhead",
406
+ provenance: "estimate",
407
+ 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."
408
+ },
409
+ {
410
+ id: "fill-order-alphabetical",
411
+ provenance: "first-party-observation",
412
+ 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."
413
+ }
414
+ ];
415
+ var DEFAULT_PER_ENTRY_OVERHEAD_CHARS = 5;
416
+ function computeCodexResidentSet(catalogue, opts) {
417
+ const budgetChars = opts?.budgetChars ?? CODEX_BUDGET_CHARS;
418
+ const overhead = opts?.perEntryOverheadChars ?? DEFAULT_PER_ENTRY_OVERHEAD_CHARS;
419
+ const ordered = catalogue.slice().sort((a, b) => a.name < b.name ? -1 : a.name > b.name ? 1 : 0);
420
+ const resident = [];
421
+ const nonResident = [];
422
+ let listingChars = 0;
423
+ let overflowed = false;
424
+ for (const e of ordered) {
425
+ const cost = e.name.length + e.descriptionChars + overhead;
426
+ if (overflowed || listingChars + cost > budgetChars) {
427
+ overflowed = true;
428
+ nonResident.push(e.name);
429
+ continue;
430
+ }
431
+ resident.push(e.name);
432
+ listingChars += cost;
433
+ }
434
+ return { budgetChars, resident, nonResident, listingChars, assumptions: ASSUMPTIONS };
435
+ }
436
+ function recordPath(anchor, env) {
437
+ const key = createHash2("sha256").update(path.resolve(anchor)).digest("hex").slice(0, 16);
438
+ return path.join(write_target(RECORD_DIRNAME, { env: env ?? null }), `${key}.json`);
439
+ }
440
+ function finderRecordPath(anchor, env) {
441
+ return recordPath(anchor, env).replace(/\.json$/, ".finder.json");
442
+ }
443
+ function codexSkillRoots(home) {
444
+ return [path.join(home, ".codex"), path.join(home, ".agents")].filter(
445
+ (a) => fs.existsSync(path.join(a, "skills"))
446
+ );
447
+ }
448
+ function ownedCatalogue(skillsDir, owned) {
449
+ const out = [];
450
+ for (const name of owned) {
451
+ let raw;
452
+ try {
453
+ raw = fs.readFileSync(path.join(skillsDir, name, "SKILL.md"), "utf8");
454
+ } catch {
455
+ continue;
456
+ }
457
+ const fm = /^---\r?\n([\s\S]*?)\r?\n---/.exec(raw);
458
+ const line = fm ? /^description:[ \t]*(.*)$/m.exec(fm[1]) : null;
459
+ out.push({ name, descriptionChars: line ? line[1].replace(/^["']|["']$/g, "").length : 0 });
460
+ }
461
+ return out;
462
+ }
463
+ function loadRecord(file, anchor) {
464
+ const empty = { schema_version: 1, anchor, written: [] };
465
+ let data;
466
+ try {
467
+ data = JSON.parse(fs.readFileSync(file, "utf-8"));
468
+ } catch {
469
+ return empty;
470
+ }
471
+ const r = data;
472
+ if (!r || typeof r !== "object" || !Array.isArray(r.written)) return empty;
473
+ if (path.resolve(String(r.anchor)) !== path.resolve(anchor)) return empty;
474
+ return { schema_version: 1, anchor, written: r.written.filter((x) => typeof x === "string") };
475
+ }
476
+ function saveRecord(file, rec) {
477
+ if (rec.written.length === 0) {
478
+ fs.rmSync(file, { force: true });
479
+ return;
480
+ }
481
+ fs.mkdirSync(path.dirname(file), { recursive: true });
482
+ const sorted = { ...rec, written: [...rec.written].sort() };
483
+ atomicWriteFile(file, `${JSON.stringify(sorted, null, 2)}
484
+ `);
485
+ }
486
+ function dropPolicy(abs) {
487
+ fs.rmSync(abs, { force: true });
488
+ const dir = path.dirname(abs);
489
+ try {
490
+ if (fs.readdirSync(dir).length === 0) fs.rmdirSync(dir);
491
+ } catch {
492
+ }
493
+ }
494
+ function ensureCodexResidentSet(anchor, recordFile, nonResident) {
495
+ const skillsDir = path.join(anchor, "skills");
496
+ const rec = loadRecord(recordFile, anchor);
497
+ const result = { changed: false, disabled: [], reenabled: [], skipped_foreign: [] };
498
+ const want = new Set(nonResident);
499
+ const ours = new Set(rec.written);
500
+ const next = [];
501
+ for (const rel of rec.written) {
502
+ const abs = path.join(anchor, rel);
503
+ const name = rel.split(path.sep)[1] ?? "";
504
+ if (!fs.existsSync(abs)) continue;
505
+ if (fs.readFileSync(abs, "utf-8") !== POLICY_BODY) continue;
506
+ if (want.has(name)) {
507
+ next.push(rel);
508
+ continue;
509
+ }
510
+ dropPolicy(abs);
511
+ result.reenabled.push(name);
512
+ }
513
+ for (const name of [...want].sort()) {
514
+ const rel = path.join("skills", name, POLICY_REL);
515
+ if (ours.has(rel) && next.includes(rel)) continue;
516
+ const dir = path.join(skillsDir, name);
517
+ if (!fs.existsSync(dir)) continue;
518
+ const abs = path.join(anchor, rel);
519
+ if (fs.existsSync(abs) && fs.readFileSync(abs, "utf-8") !== POLICY_BODY) {
520
+ result.skipped_foreign.push(name);
521
+ continue;
522
+ }
523
+ fs.mkdirSync(path.dirname(abs), { recursive: true });
524
+ atomicWriteFile(abs, POLICY_BODY);
525
+ next.push(rel);
526
+ result.disabled.push(name);
527
+ }
528
+ result.changed = result.disabled.length > 0 || result.reenabled.length > 0;
529
+ saveRecord(recordFile, { schema_version: 1, anchor, written: next });
530
+ result.disabled.sort();
531
+ result.reenabled.sort();
532
+ result.skipped_foreign.sort();
533
+ return result;
534
+ }
535
+ function removeCodexResidentSet(anchor, recordFile) {
536
+ const finder = removeCodexFinder(anchor, recordFile.replace(/\.json$/, ".finder.json"));
537
+ const result = { changed: finder === "removed", removed: [], kept_user: [], finder };
538
+ if (!fs.existsSync(recordFile)) return result;
539
+ const rec = loadRecord(recordFile, anchor);
540
+ for (const rel of rec.written) {
541
+ const abs = path.join(anchor, rel);
542
+ if (!fs.existsSync(abs)) continue;
543
+ if (fs.readFileSync(abs, "utf-8") !== POLICY_BODY) {
544
+ result.kept_user.push(rel);
545
+ continue;
546
+ }
547
+ dropPolicy(abs);
548
+ result.removed.push(rel);
549
+ }
550
+ fs.rmSync(recordFile, { force: true });
551
+ result.changed = result.changed || result.removed.length > 0;
552
+ result.removed.sort();
553
+ result.kept_user.sort();
554
+ return result;
555
+ }
556
+ function applyCodexResidentSet(home, report) {
557
+ try {
558
+ const roots = codexSkillRoots(home);
559
+ if (roots.length === 0) return;
560
+ const firstRootOf = /* @__PURE__ */ new Map();
561
+ const catalogue = [];
562
+ for (const anchor of roots) {
563
+ const skillsDir = path.join(anchor, "skills");
564
+ 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);
565
+ for (const e of ownedCatalogue(skillsDir, owned)) {
566
+ if (firstRootOf.has(e.name)) continue;
567
+ firstRootOf.set(e.name, anchor);
568
+ catalogue.push(e);
569
+ }
570
+ }
571
+ const finderCost = FINDER_NAME.length + finderDescription(catalogue.length).length + DEFAULT_PER_ENTRY_OVERHEAD_CHARS;
572
+ let split = computeCodexResidentSet(catalogue);
573
+ if (split.nonResident.length > 0) {
574
+ split = computeCodexResidentSet(catalogue, { budgetChars: CODEX_BUDGET_CHARS - finderCost });
575
+ }
576
+ const resident = new Set(split.resident);
577
+ const finder = ensureCodexFinder(
578
+ roots[0],
579
+ finderRecordPath(roots[0]),
580
+ split.nonResident.map((name) => ({ name, skillsDir: path.join(firstRootOf.get(name), "skills") }))
581
+ );
582
+ const unlistAllowed = finder !== "foreign";
583
+ let disabled = 0;
584
+ let reenabled = 0;
585
+ let foreign = 0;
586
+ for (const anchor of roots) {
587
+ const skillsDir = path.join(anchor, "skills");
588
+ 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);
589
+ const nonResident = unlistAllowed ? here.filter((n) => !resident.has(n) || firstRootOf.get(n) !== anchor) : [];
590
+ const res = ensureCodexResidentSet(anchor, recordPath(anchor), nonResident);
591
+ disabled += res.disabled.length;
592
+ reenabled += res.reenabled.length;
593
+ foreign += res.skipped_foreign.length;
594
+ }
595
+ report(
596
+ `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")
597
+ );
598
+ } catch (e) {
599
+ report(`codex: resident set skipped \u2014 ${String(e)}`);
600
+ }
601
+ }
602
+
603
+ // src/scripts/_lib/skill_listing_overrides.ts
604
+ import * as fs2 from "node:fs";
605
+ import * as path2 from "node:path";
606
+
607
+ // src/scripts/_lib/host_listing_model.ts
608
+ var CLAUDE_CODE_LISTING_DEFAULTS = {
609
+ fraction: 0.01,
610
+ perEntryCapChars: 1536,
611
+ charsPerToken: 4,
612
+ perEntryOverheadChars: 0
613
+ };
614
+ var ASSUMPTIONS2 = [
615
+ {
616
+ id: "budget-unit-is-chars",
617
+ provenance: "upstream-prose",
618
+ 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.'
619
+ },
620
+ {
621
+ id: "fill-order-is-invocation-frequency",
622
+ provenance: "upstream-prose",
623
+ 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."
624
+ },
625
+ {
626
+ id: "names-are-never-dropped",
627
+ provenance: "upstream-prose",
628
+ 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."
629
+ },
630
+ {
631
+ id: "stop-at-first-overflow",
632
+ provenance: "upstream-prose",
633
+ 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."
634
+ },
635
+ {
636
+ id: "wrapper-overhead-unmodelled",
637
+ provenance: "upstream-prose",
638
+ 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."
639
+ }
640
+ ];
641
+ function modelListingBudget(catalogue, input) {
642
+ const fraction = input.fraction ?? CLAUDE_CODE_LISTING_DEFAULTS.fraction;
643
+ const perEntryCap = input.perEntryCapChars ?? CLAUDE_CODE_LISTING_DEFAULTS.perEntryCapChars;
644
+ const charsPerToken = input.charsPerToken ?? CLAUDE_CODE_LISTING_DEFAULTS.charsPerToken;
645
+ const overhead = input.perEntryOverheadChars ?? CLAUDE_CODE_LISTING_DEFAULTS.perEntryOverheadChars;
646
+ const usageOrder = input.usageOrder ?? [];
647
+ const budgetChars = Math.floor(input.contextWindowTokens * fraction * charsPerToken);
648
+ const fillOrder = usageOrder.length > 0 ? "usage" : "alphabetical-fallback";
649
+ const byName = new Map(catalogue.map((e) => [e.name, e]));
650
+ const ordered = [];
651
+ const seen = /* @__PURE__ */ new Set();
652
+ for (const name of usageOrder) {
653
+ const e = byName.get(name);
654
+ if (e && !seen.has(name)) {
655
+ ordered.push(e);
656
+ seen.add(name);
657
+ }
658
+ }
659
+ const rest = catalogue.filter((e) => !seen.has(e.name)).slice().sort((a, b) => a.name < b.name ? -1 : a.name > b.name ? 1 : 0);
660
+ ordered.push(...rest);
661
+ const surviving = [];
662
+ const bare = [];
663
+ let spentChars = 0;
664
+ let overflowed = false;
665
+ for (const e of ordered) {
666
+ if (overflowed) {
667
+ bare.push(e.name);
668
+ continue;
669
+ }
670
+ const cost = Math.min(e.descriptionChars, perEntryCap) + overhead;
671
+ if (spentChars + cost <= budgetChars) {
672
+ surviving.push(e.name);
673
+ spentChars += cost;
674
+ } else {
675
+ overflowed = true;
676
+ bare.push(e.name);
677
+ }
678
+ }
679
+ return { budgetChars, fillOrder, surviving, bare, spentChars, assumptions: ASSUMPTIONS2 };
680
+ }
681
+
682
+ // src/scripts/_lib/skill_listing_overrides.ts
683
+ var OVERRIDE_KEY = "skillOverrides";
684
+ var NAME_ONLY = "name-only";
685
+ var RECORD_BASENAME = "skill-overrides.json";
686
+ function recordPath2(env) {
687
+ return write_target(RECORD_BASENAME, { env: env ?? null });
688
+ }
689
+ function ownedSkillNames(currentFiles) {
690
+ const out = /* @__PURE__ */ new Set();
691
+ for (const rel of currentFiles) {
692
+ const m = /^skills\/([^/]+)\/SKILL\.md$/.exec(rel.split(path2.sep).join("/"));
693
+ if (m) out.add(m[1]);
694
+ }
695
+ return [...out].sort();
696
+ }
697
+ function ownedCatalogue2(skillsDir, owned) {
698
+ const out = [];
699
+ for (const name of owned) {
700
+ let raw;
701
+ try {
702
+ raw = fs2.readFileSync(path2.join(skillsDir, name, "SKILL.md"), "utf8");
703
+ } catch {
704
+ continue;
705
+ }
706
+ const fm = /^---\r?\n([\s\S]*?)\r?\n---/.exec(raw);
707
+ const line = fm ? /^description:[ \t]*(.*)$/m.exec(fm[1]) : null;
708
+ out.push({ name, descriptionChars: line ? line[1].replace(/^["']|["']$/g, "").length : 0 });
709
+ }
710
+ return out;
711
+ }
712
+ function computeOverrides(skillsDir, owned) {
713
+ const catalogue = ownedCatalogue2(skillsDir, owned);
714
+ const { bare } = modelListingBudget(catalogue, { contextWindowTokens: 2e5 });
715
+ const out = {};
716
+ for (const name of bare) out[name] = NAME_ONLY;
717
+ return out;
718
+ }
719
+ function loadRecord2(file, settingsPath) {
720
+ const empty = { schema_version: 1, settings_path: settingsPath, created_key: false, entries: {} };
721
+ let data;
722
+ try {
723
+ data = JSON.parse(fs2.readFileSync(file, "utf-8"));
724
+ } catch {
725
+ return empty;
726
+ }
727
+ const r = data;
728
+ if (!r || typeof r !== "object" || typeof r.entries !== "object" || r.entries === null) return empty;
729
+ if (path2.resolve(String(r.settings_path)) !== path2.resolve(settingsPath)) return empty;
730
+ const entries = {};
731
+ for (const [k, v] of Object.entries(r.entries)) if (typeof v === "string") entries[k] = v;
732
+ return { schema_version: 1, settings_path: settingsPath, created_key: r.created_key === true, entries };
733
+ }
734
+ function saveRecord2(file, rec) {
735
+ if (Object.keys(rec.entries).length === 0) {
736
+ fs2.rmSync(file, { force: true });
737
+ return;
738
+ }
739
+ fs2.mkdirSync(path2.dirname(file), { recursive: true });
740
+ atomicWriteFile(file, `${JSON.stringify({ ...rec, entries: sortKeys(rec.entries) }, null, 2)}
741
+ `);
742
+ }
743
+ function sortKeys(o) {
744
+ return Object.fromEntries(Object.keys(o).sort().map((k) => [k, o[k]]));
745
+ }
746
+ function overridesOf(settings) {
747
+ const raw = settings[OVERRIDE_KEY];
748
+ if (raw === void 0) return void 0;
749
+ if (typeof raw !== "object" || raw === null || Array.isArray(raw)) return null;
750
+ return raw;
751
+ }
752
+ function ensureListingOverrides(settingsPath, recordFile, wanted) {
753
+ return _with_lock(settingsPath, () => {
754
+ const settings = _read_settings(settingsPath);
755
+ const rec = loadRecord2(recordFile, settingsPath);
756
+ const existing = overridesOf(settings);
757
+ const result = { changed: false, written: [], removed: [], skipped_user: [] };
758
+ if (existing === null) {
759
+ result.skipped_user.push(...Object.keys(wanted).sort());
760
+ return result;
761
+ }
762
+ const overrides = { ...existing ?? {} };
763
+ const next = {};
764
+ for (const [name, value] of Object.entries(rec.entries)) {
765
+ if (overrides[name] !== value) continue;
766
+ const want = wanted[name];
767
+ if (want === void 0) {
768
+ delete overrides[name];
769
+ result.removed.push(name);
770
+ } else {
771
+ if (want !== value) {
772
+ overrides[name] = want;
773
+ result.written.push(name);
774
+ }
775
+ next[name] = want;
776
+ }
777
+ }
778
+ for (const [name, value] of Object.entries(wanted)) {
779
+ if (name in next) continue;
780
+ if (name in overrides) {
781
+ result.skipped_user.push(name);
782
+ continue;
783
+ }
784
+ overrides[name] = value;
785
+ next[name] = value;
786
+ result.written.push(name);
787
+ }
788
+ const createdKey = rec.created_key || existing === void 0 && Object.keys(next).length > 0;
789
+ if (Object.keys(overrides).length === 0 && createdKey) delete settings[OVERRIDE_KEY];
790
+ else if (existing !== void 0 || Object.keys(overrides).length > 0) settings[OVERRIDE_KEY] = overrides;
791
+ result.changed = result.written.length + result.removed.length > 0;
792
+ if (result.changed) atomicWriteFile(settingsPath, `${JSON.stringify(settings, null, 2)}
793
+ `);
794
+ saveRecord2(recordFile, { schema_version: 1, settings_path: settingsPath, created_key: createdKey, entries: next });
795
+ result.written.sort();
796
+ result.removed.sort();
797
+ result.skipped_user.sort();
798
+ return result;
799
+ });
800
+ }
801
+ function removeListingOverrides(settingsPath, recordFile) {
802
+ const result = { changed: false, removed: [], kept_user: [] };
803
+ if (!fs2.existsSync(recordFile)) return result;
804
+ if (!fs2.existsSync(settingsPath)) {
805
+ fs2.rmSync(recordFile, { force: true });
806
+ return result;
807
+ }
808
+ return _with_lock(settingsPath, () => {
809
+ const settings = _read_settings(settingsPath);
810
+ const rec = loadRecord2(recordFile, settingsPath);
811
+ const existing = overridesOf(settings);
812
+ if (existing) {
813
+ for (const [name, value] of Object.entries(rec.entries)) {
814
+ if (existing[name] === value) {
815
+ delete existing[name];
816
+ result.removed.push(name);
817
+ } else if (name in existing) {
818
+ result.kept_user.push(name);
819
+ }
820
+ }
821
+ if (rec.created_key && Object.keys(existing).length === 0) delete settings[OVERRIDE_KEY];
822
+ }
823
+ result.changed = result.removed.length > 0;
824
+ if (result.changed) atomicWriteFile(settingsPath, `${JSON.stringify(settings, null, 2)}
825
+ `);
826
+ fs2.rmSync(recordFile, { force: true });
827
+ result.removed.sort();
828
+ result.kept_user.sort();
829
+ return result;
830
+ });
831
+ }
832
+ function applyListingOverrides(anchor, report) {
833
+ try {
834
+ const owned = ownedSkillNames(recorded_rel_files("claude-code", anchor));
835
+ const wanted = computeOverrides(path2.join(anchor, "skills"), owned);
836
+ const res = ensureListingOverrides(path2.join(anchor, "settings.json"), recordPath2(), wanted);
837
+ if (res.changed) {
838
+ report(
839
+ `claude-code: listing override in ~/.claude/settings.json \u2014 ${res.written.length} set name-only, ${res.removed.length} removed`
840
+ );
841
+ }
842
+ if (res.skipped_user.length > 0) {
843
+ report(
844
+ `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" : ""})`
845
+ );
846
+ }
847
+ } catch (e) {
848
+ report(`claude-code: listing override skipped \u2014 ${String(e)}`);
849
+ }
850
+ }
851
+ function applyHostListingPolicies(deployed, home, claudeAnchor, report) {
852
+ if (deployed.claudeCode) applyListingOverrides(claudeAnchor, report);
853
+ if (deployed.codex) applyCodexResidentSet(home, report);
854
+ }
855
+
347
856
  // src/scripts/install.ts
348
857
  import { spawn, spawnSync } from "node:child_process";
349
858
  import * as crypto5 from "node:crypto";
350
859
  import * as fs18 from "node:fs";
351
- import * as os7 from "node:os";
860
+ import * as os8 from "node:os";
352
861
  import * as path18 from "node:path";
353
862
  import process2 from "node:process";
354
- import { fileURLToPath as fileURLToPath3, pathToFileURL } from "node:url";
863
+ import { fileURLToPath as fileURLToPath2, pathToFileURL } from "node:url";
355
864
 
356
865
  // src/scripts/_lib/reserved_name_sweep.ts
357
- import * as fs from "node:fs";
358
- import * as path from "node:path";
866
+ import * as fs3 from "node:fs";
867
+ import * as path3 from "node:path";
359
868
  function sweepReservedNames(commandsDir, currentFiles, isBuiltinName, recordedFiles) {
360
869
  const reserved = [];
361
870
  const foreign = [];
362
871
  let entries = [];
363
872
  try {
364
- entries = fs.readdirSync(commandsDir).filter((f) => f.endsWith(".md"));
873
+ entries = fs3.readdirSync(commandsDir).filter((f) => f.endsWith(".md"));
365
874
  } catch {
366
875
  return { reserved, foreign };
367
876
  }
@@ -374,7 +883,7 @@ function sweepReservedNames(commandsDir, currentFiles, isBuiltinName, recordedFi
374
883
  foreign.push(slug);
375
884
  continue;
376
885
  }
377
- fs.rmSync(path.join(commandsDir, fname), { force: true });
886
+ fs3.rmSync(path3.join(commandsDir, fname), { force: true });
378
887
  currentFiles.delete(rel);
379
888
  reserved.push(slug);
380
889
  }
@@ -383,11 +892,13 @@ function sweepReservedNames(commandsDir, currentFiles, isBuiltinName, recordedFi
383
892
 
384
893
  // src/scripts/_lib/host_env_write.ts
385
894
  var YAML = __toESM(require_dist(), 1);
386
- import * as fs2 from "node:fs";
387
- import * as path2 from "node:path";
895
+ import * as fs4 from "node:fs";
896
+ import * as path4 from "node:path";
897
+ var MAX_CONCURRENT_SUBAGENTS = 64;
388
898
  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" }
899
+ { variable: "BASH_MAX_OUTPUT_LENGTH", settingsKey: "host_environment.request_size_caps.bash_max_output_length" },
900
+ { variable: "MAX_MCP_OUTPUT_TOKENS", settingsKey: "host_environment.request_size_caps.max_mcp_output_tokens" },
901
+ { variable: "CLAUDE_CODE_MAX_CONCURRENT_SUBAGENTS", settingsKey: "subagents.max_parallel", max: MAX_CONCURRENT_SUBAGENTS }
391
902
  ];
392
903
  var SETTINGS_CANDIDATES = [
393
904
  ["agents", "settings", ".agent-settings.yml"],
@@ -395,10 +906,10 @@ var SETTINGS_CANDIDATES = [
395
906
  ];
396
907
  function readSettingsDoc(projectRoot) {
397
908
  for (const parts of SETTINGS_CANDIDATES) {
398
- const p = path2.join(projectRoot, ...parts);
909
+ const p = path4.join(projectRoot, ...parts);
399
910
  let text;
400
911
  try {
401
- text = fs2.readFileSync(p, "utf-8");
912
+ text = fs4.readFileSync(p, "utf-8");
402
913
  } catch {
403
914
  continue;
404
915
  }
@@ -413,21 +924,22 @@ function readSettingsDoc(projectRoot) {
413
924
  return null;
414
925
  }
415
926
  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
927
  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);
928
+ for (const { variable, settingsKey, max } of WRITABLE_HOST_ENV) {
929
+ let v = settings;
930
+ for (const part of settingsKey.split(".")) {
931
+ v = v !== null && typeof v === "object" ? v[part] : void 0;
932
+ }
933
+ if (typeof v !== "number" || !Number.isSafeInteger(v) || v <= 0) continue;
934
+ if (max !== void 0 && v > max) continue;
935
+ out[variable] = String(v);
424
936
  }
425
937
  return Object.keys(out).length === 0 ? null : out;
426
938
  }
427
939
  function withHostEnv(bridge, projectRoot, announce) {
428
940
  const env = hostEnvBlock(readSettingsDoc(projectRoot));
429
941
  if (env === null) return bridge;
430
- announce(`.claude/settings.json: wrote ${Object.keys(env).join(", ")} (request-size caps)`);
942
+ announce(`.claude/settings.json: wrote ${Object.keys(env).join(", ")} (request-size and concurrency caps)`);
431
943
  return { ...bridge, env };
432
944
  }
433
945
 
@@ -546,7 +1058,10 @@ var _CURRENT = [
546
1058
  "dataviz",
547
1059
  "debug",
548
1060
  "deep-research",
1061
+ "design",
1062
+ "design-consent",
549
1063
  "design-login",
1064
+ "design-revoke",
550
1065
  "design-sync",
551
1066
  "desktop",
552
1067
  "diff",
@@ -639,25 +1154,25 @@ function is_claude_builtin_name(slug) {
639
1154
  }
640
1155
 
641
1156
  // src/scripts/_lib/mcp_bridge.ts
642
- import * as fs3 from "node:fs";
643
- import * as path3 from "node:path";
1157
+ import * as fs5 from "node:fs";
1158
+ import * as path5 from "node:path";
644
1159
  var MCP_SERVER_KEY = "agent-config";
645
1160
  var MCP_PACKAGE_NAME = "@event4u/agent-config";
646
1161
  function mcpBridgeEntry(packageRoot) {
647
1162
  const version = readPackageVersion(packageRoot);
648
- const spec = version === null ? MCP_PACKAGE_NAME : `${MCP_PACKAGE_NAME}@${version}`;
1163
+ const args = version === null ? ["-y", MCP_PACKAGE_NAME, "mcp-server"] : ["--prefer-offline", "-y", `${MCP_PACKAGE_NAME}@${version}`, "mcp-server"];
649
1164
  return {
650
1165
  mcpServers: {
651
1166
  [MCP_SERVER_KEY]: {
652
1167
  command: "npx",
653
- args: ["-y", spec, "mcp-server"]
1168
+ args
654
1169
  }
655
1170
  }
656
1171
  };
657
1172
  }
658
1173
  function readPackageVersion(packageRoot) {
659
1174
  try {
660
- const raw = fs3.readFileSync(path3.join(packageRoot, "package.json"), "utf-8");
1175
+ const raw = fs5.readFileSync(path5.join(packageRoot, "package.json"), "utf-8");
661
1176
  const v = JSON.parse(raw).version;
662
1177
  return typeof v === "string" && v.trim() !== "" ? v : null;
663
1178
  } catch {
@@ -666,7 +1181,7 @@ function readPackageVersion(packageRoot) {
666
1181
  }
667
1182
  function makeEnsureMcpBridge(mergeJsonFile) {
668
1183
  return (projectRoot, force, packageRoot = projectRoot) => mergeJsonFile(
669
- path3.join(projectRoot, ".mcp.json"),
1184
+ path5.join(projectRoot, ".mcp.json"),
670
1185
  mcpBridgeEntry(packageRoot),
671
1186
  force,
672
1187
  ".mcp.json"
@@ -692,7 +1207,7 @@ function makeEnsureMcpRegistrations(mergeJsonFile) {
692
1207
  const merged = {};
693
1208
  for (const t of targets) {
694
1209
  merged[t.toolId] = mergeJsonFile(
695
- path3.join(projectRoot, ...t.relPath.split("/")),
1210
+ path5.join(projectRoot, ...t.relPath.split("/")),
696
1211
  mcpBridgeEntry(packageRoot),
697
1212
  force,
698
1213
  t.relPath
@@ -720,132 +1235,121 @@ function registerMcpHosts(mergeJsonFile, projectRoot, force, packageRoot, tools,
720
1235
  }
721
1236
  }
722
1237
  function projectionModeOf(raw) {
723
- return raw === "scoped" ? "scoped" : raw === "tiered" ? "tiered" : "legacy-all";
1238
+ return raw === "scoped" ? "scoped" : "legacy-all";
724
1239
  }
725
1240
  function resolveTierB(packageRoot) {
726
- const p = path3.join(packageRoot, "agents", "runtime", "state", "skill-tiers.json");
727
- if (!fs3.existsSync(p)) return null;
1241
+ const p = path5.join(packageRoot, "agents", "runtime", "state", "skill-tiers.json");
1242
+ if (!fs5.existsSync(p)) return null;
728
1243
  try {
729
- const parsed = JSON.parse(fs3.readFileSync(p, "utf-8"));
1244
+ const parsed = JSON.parse(fs5.readFileSync(p, "utf-8"));
730
1245
  if (!Array.isArray(parsed.tier_b)) return null;
731
1246
  return new Set(parsed.tier_b.filter((n) => typeof n === "string"));
732
1247
  } catch {
733
1248
  return null;
734
1249
  }
735
1250
  }
736
- function tierBPrunePredicate(tierB) {
737
- return (mdPath) => tierB.has(path3.basename(path3.dirname(mdPath)));
738
- }
739
1251
  function tierBAdvisory(packageRoot) {
740
1252
  const tierB = resolveTierB(packageRoot);
741
1253
  if (tierB === null || tierB.size === 0) return null;
742
1254
  return `\u2139\uFE0F ${tierB.size} skill(s) are predicted to reach the model WITHOUT their description on a default 200k window.
743
1255
  Two levers, neither applied for you:
744
1256
  \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
- };
1257
+ \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
1258
  }
763
1259
 
764
1260
  // src/install/conflictTracker.ts
765
1261
  import * as crypto2 from "node:crypto";
766
- import * as fs5 from "node:fs";
767
- import * as path5 from "node:path";
1262
+ import * as fs7 from "node:fs";
1263
+ import * as os from "node:os";
1264
+ import * as path7 from "node:path";
768
1265
 
769
1266
  // src/install/fsPrimitives.ts
770
1267
  import * as crypto from "node:crypto";
771
- import * as fs4 from "node:fs";
772
- import * as path4 from "node:path";
1268
+ import * as fs6 from "node:fs";
1269
+ import * as path6 from "node:path";
773
1270
  function resolvePath(p) {
774
1271
  try {
775
- return fs4.realpathSync(path4.resolve(p));
1272
+ return fs6.realpathSync(path6.resolve(p));
776
1273
  } catch {
777
- return path4.resolve(p);
1274
+ return path6.resolve(p);
778
1275
  }
779
1276
  }
780
1277
  function pathExists(p) {
781
1278
  try {
782
- fs4.statSync(p);
1279
+ fs6.statSync(p);
783
1280
  return true;
784
1281
  } catch {
785
1282
  return false;
786
1283
  }
787
1284
  }
788
1285
  function mkdirp(p) {
789
- fs4.mkdirSync(p, { recursive: true });
1286
+ fs6.mkdirSync(p, { recursive: true });
790
1287
  }
791
1288
  function sha256OfFile(p) {
792
1289
  let data;
793
1290
  try {
794
- data = fs4.readFileSync(p);
1291
+ data = fs6.readFileSync(p);
795
1292
  } catch {
796
1293
  return null;
797
1294
  }
798
1295
  return crypto.createHash("sha256").update(data).digest("hex");
799
1296
  }
800
1297
 
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
1298
  // src/install/conflictTracker.ts
825
1299
  function createConflictTracker(host) {
826
1300
  const conflictState = {
827
1301
  root: null,
828
1302
  recorded: null,
1303
+ ledgerFiles: null,
1304
+ logged: null,
829
1305
  preserved: [],
1306
+ migrated: /* @__PURE__ */ new Set(),
830
1307
  staged: /* @__PURE__ */ new Map()
831
1308
  };
832
1309
  function recordedHashFor(target) {
833
1310
  if (conflictState.root === null) return void 0;
834
- conflictState.recorded ??= recordedHashesForRoot(conflictState.root);
835
- const plain = path5.resolve(target);
1311
+ conflictState.recorded ??= recordedHashesWithLedger(conflictState.root);
1312
+ const plain = path7.resolve(target);
836
1313
  if (conflictState.recorded.has(plain)) return conflictState.recorded.get(plain);
837
1314
  const real = resolvePath(target);
838
1315
  return real === plain ? void 0 : conflictState.recorded.get(real);
839
1316
  }
1317
+ function ledgerLists(target) {
1318
+ conflictState.ledgerFiles ??= ledgerListedPaths();
1319
+ const files = conflictState.ledgerFiles;
1320
+ return files.has(path7.resolve(target)) || files.has(resolvePath(target));
1321
+ }
1322
+ function wouldWriteDigest(target, would) {
1323
+ const tmp = path7.join(
1324
+ os.tmpdir(),
1325
+ `agent-config-would.${process.pid}.${crypto2.randomBytes(6).toString("hex")}${path7.extname(target)}`
1326
+ );
1327
+ try {
1328
+ if ("content" in would) {
1329
+ fs7.writeFileSync(tmp, would.content, "utf-8");
1330
+ } else {
1331
+ fs7.copyFileSync(would.from, tmp);
1332
+ host.tagDeployed(tmp, would.from, would.packageRoot);
1333
+ }
1334
+ return sha256OfFile(tmp);
1335
+ } catch {
1336
+ return null;
1337
+ } finally {
1338
+ try {
1339
+ fs7.unlinkSync(tmp);
1340
+ } catch {
1341
+ }
1342
+ }
1343
+ }
840
1344
  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)}`
1345
+ mkdirp(path7.dirname(sidecar));
1346
+ const tmp = path7.join(
1347
+ path7.dirname(sidecar),
1348
+ `.${path7.basename(sidecar)}.${process.pid}.${crypto2.randomBytes(6).toString("hex")}${path7.extname(target)}`
845
1349
  );
846
1350
  const discard = () => {
847
1351
  try {
848
- fs5.unlinkSync(tmp);
1352
+ fs7.unlinkSync(tmp);
849
1353
  } catch {
850
1354
  }
851
1355
  };
@@ -872,7 +1376,7 @@ function createConflictTracker(host) {
872
1376
  }
873
1377
  }
874
1378
  try {
875
- fs5.renameSync(tmp, sidecar);
1379
+ fs7.renameSync(tmp, sidecar);
876
1380
  } catch (exc) {
877
1381
  discard();
878
1382
  host.fail(
@@ -885,14 +1389,20 @@ function createConflictTracker(host) {
885
1389
  function record(target, sidecar) {
886
1390
  if (conflictState.preserved.includes(target)) return;
887
1391
  conflictState.preserved.push(target);
888
- host.warn(preservedFileMessage(target, sidecar));
1392
+ host.warn(
1393
+ conflictState.migrated.has(path7.resolve(target)) ? migrationPreservedMessage(target, sidecar) : preservedFileMessage(target, sidecar)
1394
+ );
889
1395
  }
890
1396
  return {
891
1397
  conflictState,
1398
+ recordedDigest: recordedHashFor,
892
1399
  begin(root) {
893
1400
  conflictState.root = root;
894
1401
  conflictState.recorded = null;
1402
+ conflictState.ledgerFiles = null;
1403
+ conflictState.logged = null;
895
1404
  conflictState.preserved = [];
1405
+ conflictState.migrated = /* @__PURE__ */ new Set();
896
1406
  conflictState.staged = /* @__PURE__ */ new Map();
897
1407
  },
898
1408
  /**
@@ -901,14 +1411,27 @@ function createConflictTracker(host) {
901
1411
  * so a file edited between planning and writing is still classified
902
1412
  * from the bytes that are actually about to be destroyed.
903
1413
  */
904
- resolve(target, force) {
1414
+ resolve(target, force, would) {
905
1415
  const exists = pathExists(target);
906
- return decideDeployWrite({
1416
+ const recordedSha256 = exists ? recordedHashFor(target) : void 0;
1417
+ const unproven = {
907
1418
  exists,
908
- recordedSha256: exists ? recordedHashFor(target) : void 0,
1419
+ recordedSha256,
909
1420
  onDiskSha256: exists ? sha256OfFile(target) : null,
910
- force
911
- });
1421
+ force,
1422
+ ledgerListed: exists && ledgerLists(target),
1423
+ recordedIsStaged: typeof recordedSha256 === "string" && recordedSha256 === recordedHashFor(sidecarPathFor(target))
1424
+ };
1425
+ const loggedWrite = logProofApplies(unproven) && wroteTheseBytes(target, unproven.onDiskSha256, conflictState.logged ??= loggedWriteDigests());
1426
+ const base = { ...unproven, loggedWrite };
1427
+ const migrating = isLedgerMigration(base);
1428
+ const decision = decideDeployWrite(
1429
+ migrating ? { ...base, packagedSha256: wouldWriteDigest(target, would) } : base
1430
+ );
1431
+ if (decision === "preserve" && migrating) {
1432
+ conflictState.migrated.add(path7.resolve(target));
1433
+ }
1434
+ return decision;
912
1435
  },
913
1436
  /**
914
1437
  * Stage the package content beside a preserved target.
@@ -921,7 +1444,7 @@ function createConflictTracker(host) {
921
1444
  preserve(target, source, packageRoot) {
922
1445
  const sidecar = sidecarPathFor(target);
923
1446
  stageInto(target, sidecar, (tmp) => {
924
- fs5.copyFileSync(source, tmp);
1447
+ fs7.copyFileSync(source, tmp);
925
1448
  host.tagDeployed(tmp, source, packageRoot);
926
1449
  });
927
1450
  record(target, sidecar);
@@ -937,7 +1460,7 @@ function createConflictTracker(host) {
937
1460
  */
938
1461
  preserveContent(target, content) {
939
1462
  const sidecar = sidecarPathFor(target);
940
- stageInto(target, sidecar, (tmp) => fs5.writeFileSync(tmp, content, "utf-8"));
1463
+ stageInto(target, sidecar, (tmp) => fs7.writeFileSync(tmp, content, "utf-8"));
941
1464
  record(target, sidecar);
942
1465
  },
943
1466
  /**
@@ -957,9 +1480,9 @@ function createConflictTracker(host) {
957
1480
 
958
1481
  // src/install/manifestFiles.ts
959
1482
  var YAML2 = __toESM(require_dist(), 1);
960
- import { existsSync as existsSync2, readFileSync as readFileSync4 } from "node:fs";
1483
+ import { existsSync as existsSync4, readFileSync as readFileSync6 } from "node:fs";
961
1484
  import { homedir } from "node:os";
962
- import { isAbsolute, join as join5, resolve as resolve3 } from "node:path";
1485
+ import { isAbsolute, join as join7, resolve as resolve5 } from "node:path";
963
1486
  function fileEntry(p, kind, hashContent) {
964
1487
  return { path: p, kind, sha256: hashContent ? sha256OfFile(p) : null };
965
1488
  }
@@ -982,7 +1505,7 @@ function filesByToolFromBridges(tools, projectRoot, scope, bridgeMarker) {
982
1505
  for (const toolId of [...tools].sort()) {
983
1506
  const marker = bridgeMarker(toolId, scope);
984
1507
  if (!marker) continue;
985
- const markerPath = isAbsolute(marker) ? marker : join5(projectRoot, marker);
1508
+ const markerPath = isAbsolute(marker) ? marker : join7(projectRoot, marker);
986
1509
  out[toolId] = [fileEntry(markerPath, "bridge", false)];
987
1510
  }
988
1511
  return out;
@@ -990,20 +1513,20 @@ function filesByToolFromBridges(tools, projectRoot, scope, bridgeMarker) {
990
1513
  function expanduser(p) {
991
1514
  if (p === "~") return homedir();
992
1515
  if (p.startsWith("~/") || process.platform === "win32" && p.startsWith("~\\")) {
993
- return join5(homedir(), p.slice(2));
1516
+ return join7(homedir(), p.slice(2));
994
1517
  }
995
1518
  return p;
996
1519
  }
997
1520
  function resolveRecorded(raw, projectRoot) {
998
1521
  const expanded = expanduser(raw);
999
- return isAbsolute(expanded) ? resolve3(expanded) : resolve3(projectRoot, expanded);
1522
+ return isAbsolute(expanded) ? resolve5(expanded) : resolve5(projectRoot, expanded);
1000
1523
  }
1001
1524
  function readRecordedByTool(manifestPath, projectRoot) {
1002
1525
  const out = /* @__PURE__ */ new Map();
1003
- if (!existsSync2(manifestPath)) return out;
1526
+ if (!existsSync4(manifestPath)) return out;
1004
1527
  let doc;
1005
1528
  try {
1006
- doc = YAML2.parse(readFileSync4(manifestPath, "utf8"));
1529
+ doc = YAML2.parse(readFileSync6(manifestPath, "utf8"));
1007
1530
  } catch {
1008
1531
  return out;
1009
1532
  }
@@ -1057,7 +1580,7 @@ function reconcileToolFiles(fresh, prior, preserved) {
1057
1580
  const seen = /* @__PURE__ */ new Set();
1058
1581
  for (const entry of fresh) {
1059
1582
  const raw = entry["path"];
1060
- if (typeof raw === "string") seen.add(resolve3(expanduser(raw)));
1583
+ if (typeof raw === "string") seen.add(resolve5(expanduser(raw)));
1061
1584
  }
1062
1585
  const out = [...fresh];
1063
1586
  for (const file of prior.files) {
@@ -1073,18 +1596,106 @@ function preservedIndex(preservedTargets, staged) {
1073
1596
  for (const target of preservedTargets) {
1074
1597
  const sidecar = sidecarPathFor(target);
1075
1598
  const sha = staged.get(sidecar) ?? null;
1076
- out.set(resolve3(target), {
1599
+ out.set(resolve5(target), {
1077
1600
  sha256: sha,
1078
1601
  sidecar: sha === null ? null : { path: sidecar, kind: "sidecar", sha256: sha }
1079
1602
  });
1080
1603
  }
1081
1604
  return out;
1082
1605
  }
1606
+ function dropGlobalScopeFiles(entries, deployed) {
1607
+ for (const entry of entries) {
1608
+ if (entry["scope"] === "global" && deployed.has(String(entry["name"]))) entry["files"] = [];
1609
+ }
1610
+ return entries;
1611
+ }
1612
+
1613
+ // src/install/ownershipLedger.ts
1614
+ import * as fs8 from "node:fs";
1615
+ import * as path8 from "node:path";
1616
+ function relUnder(anchor, abs) {
1617
+ let real = anchor;
1618
+ try {
1619
+ real = fs8.realpathSync(anchor);
1620
+ } catch {
1621
+ }
1622
+ for (const base of [anchor, real]) {
1623
+ const rel = path8.relative(path8.resolve(base), path8.resolve(abs));
1624
+ if (rel !== "" && !rel.startsWith("..") && !path8.isAbsolute(rel)) {
1625
+ return rel.split(path8.sep).join("/");
1626
+ }
1627
+ }
1628
+ return null;
1629
+ }
1630
+ function recordGlobalDeploy(r) {
1631
+ const inventory = load_inventory(r.inventoryPath ?? null);
1632
+ const previous = recorded_digests(r.toolId, r.anchor, inventory);
1633
+ const sidecars = /* @__PURE__ */ new Map();
1634
+ for (const [abs, digest] of r.staged) {
1635
+ const rel = relUnder(r.anchor, abs);
1636
+ if (rel !== null && digest !== null) sidecars.set(rel, digest);
1637
+ }
1638
+ const keep = /* @__PURE__ */ new Set([...r.currentFiles, ...sidecars.keys()]);
1639
+ const retainedAbs = [];
1640
+ let reaped = [];
1641
+ const tools = inventory["tools"] ?? {};
1642
+ if (r.toolId in tools) {
1643
+ reaped = reaped.concat(
1644
+ reap_stale(r.toolId, r.anchor, keep, inventory, false, retainedAbs)
1645
+ );
1646
+ }
1647
+ reaped = reaped.concat(
1648
+ reap_tagged_orphans(
1649
+ r.anchor,
1650
+ [...r.destSubs],
1651
+ keep,
1652
+ r.packageTag,
1653
+ false,
1654
+ previous,
1655
+ retainedAbs
1656
+ )
1657
+ );
1658
+ const preservedRel = /* @__PURE__ */ new Set();
1659
+ for (const abs of r.preserved) {
1660
+ const rel = relUnder(r.anchor, abs);
1661
+ if (rel !== null) preservedRel.add(rel);
1662
+ }
1663
+ const digests = /* @__PURE__ */ new Map();
1664
+ for (const rel of r.currentFiles) {
1665
+ const abs = path8.join(r.anchor, rel);
1666
+ if (preservedRel.has(rel)) {
1667
+ const staged = r.staged.get(sidecarPathFor(abs)) ?? null;
1668
+ const installed = staged ?? previous.get(rel)?.installed_sha256 ?? r.recordedFor(abs);
1669
+ if (typeof installed !== "string" || installed === "") continue;
1670
+ digests.set(rel, { installed_sha256: installed, packaged_sha256: staged ?? installed });
1671
+ continue;
1672
+ }
1673
+ const onDisk = file_sha256(abs);
1674
+ if (onDisk === null) continue;
1675
+ digests.set(rel, { installed_sha256: onDisk, packaged_sha256: onDisk });
1676
+ }
1677
+ for (const [rel, digest] of sidecars) {
1678
+ digests.set(rel, { installed_sha256: digest, packaged_sha256: digest, kind: "sidecar" });
1679
+ }
1680
+ const retained = [...new Set(retainedAbs)].sort();
1681
+ for (const abs of retained) {
1682
+ const rel = relUnder(r.anchor, abs);
1683
+ const prior = rel === null ? void 0 : previous.get(rel);
1684
+ if (rel === null || prior === void 0) continue;
1685
+ digests.set(rel, { installed_sha256: prior.installed_sha256, packaged_sha256: null });
1686
+ }
1687
+ record_deploy(r.toolId, r.anchorRaw, new Set(r.currentFiles), inventory, digests);
1688
+ save_inventory(inventory, r.inventoryPath ?? null);
1689
+ return { reaped: [...new Set(reaped)].sort(), retained };
1690
+ }
1691
+ function retainedFileMessage(target) {
1692
+ 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.`;
1693
+ }
1083
1694
 
1084
1695
  // 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";
1696
+ import * as fs9 from "node:fs";
1697
+ import * as os2 from "node:os";
1698
+ import * as path9 from "node:path";
1088
1699
  var INSTALLER_PROVENANCE_KEYS = ["package", "source_path"];
1089
1700
  function stripProvenance(text) {
1090
1701
  const lines = text.split("\n");
@@ -1137,21 +1748,21 @@ function compareLayers(global_layer, project_layer) {
1137
1748
  }
1138
1749
  function hostRuleLayerDirs(projectRoot) {
1139
1750
  return [
1140
- path6.join(os.homedir(), ".claude", "rules"),
1141
- path6.join(projectRoot, ".claude", "rules")
1751
+ path9.join(os2.homedir(), ".claude", "rules"),
1752
+ path9.join(projectRoot, ".claude", "rules")
1142
1753
  ];
1143
1754
  }
1144
1755
  function readRuleLayer(dir) {
1145
1756
  let names;
1146
1757
  try {
1147
- names = fs6.readdirSync(dir);
1758
+ names = fs9.readdirSync(dir);
1148
1759
  } catch {
1149
1760
  return null;
1150
1761
  }
1151
1762
  const files = /* @__PURE__ */ new Map();
1152
1763
  for (const name of names.filter((n) => n.endsWith(".md")).sort()) {
1153
1764
  try {
1154
- files.set(name, fs6.readFileSync(path6.join(dir, name), "utf-8"));
1765
+ files.set(name, fs9.readFileSync(path9.join(dir, name), "utf-8"));
1155
1766
  } catch {
1156
1767
  continue;
1157
1768
  }
@@ -1159,7 +1770,7 @@ function readRuleLayer(dir) {
1159
1770
  return { dir, files };
1160
1771
  }
1161
1772
  function claudeMdExcludesGlob(dir) {
1162
- return `${path6.resolve(dir).replace(/\/+$/, "")}/**`;
1773
+ return `${path9.resolve(dir).replace(/\/+$/, "")}/**`;
1163
1774
  }
1164
1775
  function mergeClaudeMdExcludes(existing, entry) {
1165
1776
  if (!Array.isArray(existing)) return [entry];
@@ -1190,25 +1801,25 @@ function decideLayerAction(report, choice, global_dir, project_dir) {
1190
1801
  // src/scripts/_lib/install_drift.ts
1191
1802
  var import_yaml = __toESM(require_dist(), 1);
1192
1803
  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";
1804
+ import * as fs10 from "node:fs";
1805
+ import * as os3 from "node:os";
1806
+ import * as path10 from "node:path";
1196
1807
  function expanduser2(p) {
1197
1808
  if (p === "~") {
1198
- return os2.homedir();
1809
+ return os3.homedir();
1199
1810
  }
1200
1811
  if (p.startsWith("~/") || process.platform === "win32" && p.startsWith("~\\")) {
1201
- return path7.join(os2.homedir(), p.slice(2));
1812
+ return path10.join(os3.homedir(), p.slice(2));
1202
1813
  }
1203
1814
  return p;
1204
1815
  }
1205
1816
  function resolve_entry_path(project_root, raw) {
1206
1817
  const p = expanduser2(raw);
1207
- return path7.isAbsolute(p) ? p : path7.join(project_root, p);
1818
+ return path10.isAbsolute(p) ? p : path10.join(project_root, p);
1208
1819
  }
1209
1820
  function sha256_of_file(p) {
1210
1821
  try {
1211
- return crypto3.createHash("sha256").update(fs7.readFileSync(p)).digest("hex");
1822
+ return crypto3.createHash("sha256").update(fs10.readFileSync(p)).digest("hex");
1212
1823
  } catch {
1213
1824
  return null;
1214
1825
  }
@@ -1217,7 +1828,7 @@ function collect_drift(project_root, env) {
1217
1828
  const target = manifest_path(project_root, env);
1218
1829
  let text;
1219
1830
  try {
1220
- text = fs7.readFileSync(target, "utf-8");
1831
+ text = fs10.readFileSync(target, "utf-8");
1221
1832
  } catch {
1222
1833
  return null;
1223
1834
  }
@@ -1262,7 +1873,7 @@ function collect_drift(project_root, env) {
1262
1873
  continue;
1263
1874
  }
1264
1875
  const resolved = resolve_entry_path(project_root, raw_path);
1265
- if (!fs7.existsSync(resolved)) {
1876
+ if (!fs10.existsSync(resolved)) {
1266
1877
  out.push({
1267
1878
  tool_id,
1268
1879
  path: resolved,
@@ -1314,185 +1925,6 @@ function format_drift_report(entries) {
1314
1925
  return lines.join("\n") + "\n";
1315
1926
  }
1316
1927
 
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
1928
  // src/shared/interactiveContext.ts
1497
1929
  var CI_ENV_KEYS = ["CI", "GITHUB_ACTIONS", "AGENT_CONFIG_CI"];
1498
1930
  function _flagSet(env, key) {
@@ -1522,8 +1954,8 @@ function isInteractiveSession(probe) {
1522
1954
 
1523
1955
  // src/scripts/_lib/claude_desktop_bundler.ts
1524
1956
  import * as crypto4 from "node:crypto";
1525
- import * as fs9 from "node:fs";
1526
- import * as path9 from "node:path";
1957
+ import * as fs11 from "node:fs";
1958
+ import * as path11 from "node:path";
1527
1959
 
1528
1960
  // src/scripts/_lib/zip_min.ts
1529
1961
  import * as zlib from "node:zlib";
@@ -1630,7 +2062,7 @@ function _is_excluded(rel_parts) {
1630
2062
  }
1631
2063
  function _is_dir(p) {
1632
2064
  try {
1633
- return fs9.statSync(p).isDirectory();
2065
+ return fs11.statSync(p).isDirectory();
1634
2066
  } catch {
1635
2067
  return false;
1636
2068
  }
@@ -1642,12 +2074,12 @@ function _compare_rel_parts(a, b) {
1642
2074
  }
1643
2075
  function _walk_skill_files(skill_dir) {
1644
2076
  const out = [];
1645
- const resolved = fs9.realpathSync(skill_dir);
2077
+ const resolved = fs11.realpathSync(skill_dir);
1646
2078
  const walk = (root, relRoot) => {
1647
2079
  const dirNames = [];
1648
2080
  const fileNames = [];
1649
- for (const dirent of fs9.readdirSync(root, { withFileTypes: true })) {
1650
- const full = path9.join(root, dirent.name);
2081
+ for (const dirent of fs11.readdirSync(root, { withFileTypes: true })) {
2082
+ const full = path11.join(root, dirent.name);
1651
2083
  const isDir2 = dirent.isDirectory() || dirent.isSymbolicLink() && _is_dir(full);
1652
2084
  if (isDir2) {
1653
2085
  dirNames.push(dirent.name);
@@ -1660,13 +2092,13 @@ function _walk_skill_files(skill_dir) {
1660
2092
  if (_is_excluded(rel_parts)) {
1661
2093
  continue;
1662
2094
  }
1663
- out.push([path9.join(root, fname), rel_parts]);
2095
+ out.push([path11.join(root, fname), rel_parts]);
1664
2096
  }
1665
2097
  for (const dname of dirNames) {
1666
2098
  if (_is_excluded([dname])) {
1667
2099
  continue;
1668
2100
  }
1669
- walk(path9.join(root, dname), [...relRoot, dname]);
2101
+ walk(path11.join(root, dname), [...relRoot, dname]);
1670
2102
  }
1671
2103
  };
1672
2104
  walk(resolved, []);
@@ -1679,53 +2111,53 @@ function _manifest_digest(files) {
1679
2111
  const rel = rel_parts.join("/");
1680
2112
  h.update(Buffer.from(rel, "utf-8"));
1681
2113
  h.update(Buffer.from([0]));
1682
- h.update(crypto4.createHash("sha256").update(fs9.readFileSync(abs_path)).digest());
2114
+ h.update(crypto4.createHash("sha256").update(fs11.readFileSync(abs_path)).digest());
1683
2115
  h.update(Buffer.from([0]));
1684
2116
  }
1685
2117
  return h.digest("hex");
1686
2118
  }
1687
2119
  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),
2120
+ fs11.mkdirSync(path11.dirname(zip_path), { recursive: true });
2121
+ const stem = path11.basename(zip_path, path11.extname(zip_path));
2122
+ const tmp_path = path11.join(
2123
+ path11.dirname(zip_path),
1692
2124
  `.${stem}.${crypto4.randomBytes(6).toString("hex")}.zip.tmp`
1693
2125
  );
1694
2126
  try {
1695
2127
  const entries = files.map(([abs_path, rel_parts]) => ({
1696
2128
  name: rel_parts.join("/"),
1697
- data: fs9.readFileSync(abs_path)
2129
+ data: fs11.readFileSync(abs_path)
1698
2130
  }));
1699
- fs9.writeFileSync(tmp_path, zip_write_sync(entries));
1700
- fs9.renameSync(tmp_path, zip_path);
2131
+ fs11.writeFileSync(tmp_path, zip_write_sync(entries));
2132
+ fs11.renameSync(tmp_path, zip_path);
1701
2133
  } finally {
1702
- if (fs9.existsSync(tmp_path)) {
1703
- fs9.unlinkSync(tmp_path);
2134
+ if (fs11.existsSync(tmp_path)) {
2135
+ fs11.unlinkSync(tmp_path);
1704
2136
  }
1705
2137
  }
1706
2138
  }
1707
2139
  function _write_if_changed(dest_dir, slug, files, force, written) {
1708
2140
  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)) {
2141
+ const zip_path = path11.join(dest_dir, `${slug}.zip`);
2142
+ const digest_path = path11.join(dest_dir, `${slug}.sha256`);
2143
+ const recorded = fs11.existsSync(digest_path) ? fs11.readFileSync(digest_path, "utf-8").trim() : "";
2144
+ if (!force && recorded === digest && fs11.existsSync(zip_path)) {
1713
2145
  return;
1714
2146
  }
1715
2147
  _atomic_write_zip(zip_path, files);
1716
- fs9.writeFileSync(digest_path, digest + "\n", "utf-8");
2148
+ fs11.writeFileSync(digest_path, digest + "\n", "utf-8");
1717
2149
  written.push(zip_path);
1718
2150
  }
1719
2151
  function build_skill_bundles(package_root, dest_dir, force = false, curation = null) {
1720
- const skills_root = path9.join(package_root, "dist/agent-src", "skills");
2152
+ const skills_root = path11.join(package_root, "dist/agent-src", "skills");
1721
2153
  if (!_is_dir(skills_root)) {
1722
2154
  return [];
1723
2155
  }
1724
- fs9.mkdirSync(dest_dir, { recursive: true });
2156
+ fs11.mkdirSync(dest_dir, { recursive: true });
1725
2157
  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();
2158
+ for (const name of fs11.readdirSync(skills_root).sort()) {
2159
+ const entry = path11.join(skills_root, name);
2160
+ const isSymlink2 = fs11.lstatSync(entry).isSymbolicLink();
1729
2161
  if (!(_is_dir(entry) || isSymlink2)) {
1730
2162
  continue;
1731
2163
  }
@@ -1733,8 +2165,8 @@ function build_skill_bundles(package_root, dest_dir, force = false, curation = n
1733
2165
  if (curation !== null && !curation.includes(skill_name)) {
1734
2166
  continue;
1735
2167
  }
1736
- const skill_md = path9.join(entry, "SKILL.md");
1737
- if (!fs9.existsSync(skill_md)) {
2168
+ const skill_md = path11.join(entry, "SKILL.md");
2169
+ if (!fs11.existsSync(skill_md)) {
1738
2170
  continue;
1739
2171
  }
1740
2172
  const files = _walk_skill_files(entry);
@@ -1746,15 +2178,15 @@ function build_skill_bundles(package_root, dest_dir, force = false, curation = n
1746
2178
  return written;
1747
2179
  }
1748
2180
  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("-");
2181
+ const rel = path11.relative(commands_root, source_file);
2182
+ const noExt = rel.slice(0, rel.length - path11.extname(rel).length);
2183
+ return noExt.split(path11.sep).join("-");
1752
2184
  }
1753
2185
  function _iter_command_files(commands_root) {
1754
2186
  const found = [];
1755
2187
  const walk = (dir) => {
1756
- for (const dirent of fs9.readdirSync(dir, { withFileTypes: true })) {
1757
- const full = path9.join(dir, dirent.name);
2188
+ for (const dirent of fs11.readdirSync(dir, { withFileTypes: true })) {
2189
+ const full = path11.join(dir, dirent.name);
1758
2190
  if (dirent.isDirectory() || dirent.isSymbolicLink() && _is_dir(full)) {
1759
2191
  walk(full);
1760
2192
  } else if (dirent.name.endsWith(".md")) {
@@ -1764,21 +2196,21 @@ function _iter_command_files(commands_root) {
1764
2196
  };
1765
2197
  walk(commands_root);
1766
2198
  found.sort((a, b) => a < b ? -1 : a > b ? 1 : 0);
1767
- return found.filter((source_file) => path9.basename(source_file) !== "AGENTS.md");
2199
+ return found.filter((source_file) => path11.basename(source_file) !== "AGENTS.md");
1768
2200
  }
1769
2201
  function build_command_bundles(package_root, dest_dir, force = false, curation = null) {
1770
- const commands_root = path9.join(package_root, "dist/agent-src", "commands");
2202
+ const commands_root = path11.join(package_root, "dist/agent-src", "commands");
1771
2203
  if (!_is_dir(commands_root)) {
1772
2204
  return [];
1773
2205
  }
1774
- const skills_root = path9.join(package_root, "dist/agent-src", "skills");
2206
+ const skills_root = path11.join(package_root, "dist/agent-src", "skills");
1775
2207
  let skill_names = /* @__PURE__ */ new Set();
1776
2208
  if (_is_dir(skills_root)) {
1777
2209
  skill_names = new Set(
1778
- fs9.readdirSync(skills_root).filter((name) => _is_dir(path9.join(skills_root, name)))
2210
+ fs11.readdirSync(skills_root).filter((name) => _is_dir(path11.join(skills_root, name)))
1779
2211
  );
1780
2212
  }
1781
- fs9.mkdirSync(dest_dir, { recursive: true });
2213
+ fs11.mkdirSync(dest_dir, { recursive: true });
1782
2214
  const written = [];
1783
2215
  for (const source_file of _iter_command_files(commands_root)) {
1784
2216
  const slug = _command_slug(source_file, commands_root);
@@ -1788,180 +2220,73 @@ function build_command_bundles(package_root, dest_dir, force = false, curation =
1788
2220
  if (curation !== null && !curation.includes(slug)) {
1789
2221
  continue;
1790
2222
  }
1791
- const files = [[fs9.realpathSync(source_file), ["SKILL.md"]]];
2223
+ const files = [[fs11.realpathSync(source_file), ["SKILL.md"]]];
1792
2224
  _write_if_changed(dest_dir, slug, files, force, written);
1793
2225
  }
1794
2226
  return written;
1795
2227
  }
1796
2228
 
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;
2229
+ // src/scripts/_lib/projection_key_migration.ts
2230
+ var MIGRATION_WINDOW = "one release window after the 2026-10 key removal";
2231
+ var LEGACY_FULL_VALUE = Object.freeze({
2232
+ "lean_projection.mode": "eager-all",
2233
+ "projection.mode": "legacy-all"
2234
+ });
2235
+ function readDotted(root, dotted) {
2236
+ let node = root;
2237
+ for (const part of dotted.split(".")) {
2238
+ if (typeof node !== "object" || node === null || Array.isArray(node)) return void 0;
2239
+ node = node[part];
1895
2240
  }
1896
- _cache = resolveTable(text, compiled);
1897
- return _cache;
2241
+ return node;
1898
2242
  }
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
- }
1926
- }
1927
- return _parse(yamlText);
2243
+ function readLegacyProjectionIntent(merged) {
2244
+ const rows = [];
2245
+ let pin = false;
2246
+ for (const [key, full] of Object.entries(LEGACY_FULL_VALUE)) {
2247
+ const raw = readDotted(merged, key);
2248
+ if (typeof raw !== "string") continue;
2249
+ const value = raw.trim();
2250
+ if (value === "") continue;
2251
+ const disposition = value.toLowerCase() === full ? "pin" : "dropped";
2252
+ if (disposition === "pin") pin = true;
2253
+ rows.push({ key, value, disposition });
2254
+ }
2255
+ return { pin, rows };
2256
+ }
2257
+ function migrationLines(intent) {
2258
+ return intent.rows.map(
2259
+ (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}.`
2260
+ );
1928
2261
  }
1929
- function surfaceRow(host, surface = DEFAULT_SURFACE, table = loadHostLowering()) {
1930
- return table.get(host)?.get(surface) ?? table.get(host)?.get(DEFAULT_SURFACE) ?? null;
1931
- }
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;
2262
+ function legacyProjectionPin(merged, emit) {
2263
+ if (merged === null) return false;
2264
+ const intent = readLegacyProjectionIntent(merged);
2265
+ for (const line of migrationLines(intent)) emit(line);
2266
+ return intent.pin;
1942
2267
  }
1943
2268
 
1944
2269
  // src/install/partitionEligibility.ts
1945
- import * as fs12 from "node:fs";
1946
- import * as os3 from "node:os";
2270
+ import * as fs13 from "node:fs";
2271
+ import * as os4 from "node:os";
1947
2272
 
1948
2273
  // src/install/hostLayerFingerprint.ts
1949
2274
  import { createHash as createHash6 } from "node:crypto";
1950
- import * as fs11 from "node:fs";
1951
- import * as path11 from "node:path";
2275
+ import * as fs12 from "node:fs";
2276
+ import * as path12 from "node:path";
1952
2277
  var FINGERPRINT_SCHEMA = 1;
1953
2278
  function collectFiles(dir) {
1954
2279
  const out = [];
1955
2280
  const walk = (d) => {
1956
2281
  let entries;
1957
2282
  try {
1958
- entries = fs11.readdirSync(d, { withFileTypes: true });
2283
+ entries = fs12.readdirSync(d, { withFileTypes: true });
1959
2284
  } catch {
1960
2285
  return;
1961
2286
  }
1962
2287
  const sorted = [...entries].sort((a, b) => a.name < b.name ? -1 : a.name > b.name ? 1 : 0);
1963
2288
  for (const e of sorted) {
1964
- const p = path11.join(d, e.name);
2289
+ const p = path12.join(d, e.name);
1965
2290
  if (e.isDirectory()) {
1966
2291
  walk(p);
1967
2292
  } else if (e.isFile()) {
@@ -1978,10 +2303,10 @@ function fingerprintLayers(layers) {
1978
2303
  for (const layer of layers) {
1979
2304
  h.update(`layer:${layer.label}\0`);
1980
2305
  for (const file of collectFiles(layer.root)) {
1981
- h.update(path11.relative(layer.root, file));
2306
+ h.update(path12.relative(layer.root, file));
1982
2307
  h.update("\0");
1983
2308
  try {
1984
- h.update(fs11.readFileSync(file));
2309
+ h.update(fs12.readFileSync(file));
1985
2310
  } catch {
1986
2311
  h.update("\0unreadable\0");
1987
2312
  }
@@ -1991,11 +2316,11 @@ function fingerprintLayers(layers) {
1991
2316
  return h.digest("hex");
1992
2317
  }
1993
2318
  function hostLayerInputs(userHome) {
1994
- const claude = path11.join(userHome, ".claude");
2319
+ const claude = path12.join(userHome, ".claude");
1995
2320
  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") }
2321
+ { label: "rules", root: path12.join(claude, "rules") },
2322
+ { label: "skills", root: path12.join(claude, "skills") },
2323
+ { label: "commands", root: path12.join(claude, "commands") }
1999
2324
  ];
2000
2325
  }
2001
2326
 
@@ -2004,7 +2329,7 @@ var MAINTAINER_WORKSPACE = "agent-config-maintainer";
2004
2329
  function isExclusivelyPackageOnly(source_path) {
2005
2330
  let meta;
2006
2331
  try {
2007
- [meta] = parseFrontmatter(fs12.readFileSync(source_path, "utf-8"));
2332
+ [meta] = parseFrontmatter(fs13.readFileSync(source_path, "utf-8"));
2008
2333
  } catch {
2009
2334
  return false;
2010
2335
  }
@@ -2019,7 +2344,7 @@ function stampHostLayerFingerprint(installedVersion, tools, lockfilePath, skip2,
2019
2344
  return null;
2020
2345
  }
2021
2346
  try {
2022
- const fingerprint = fingerprintLayers(hostLayerInputs(os3.homedir()));
2347
+ const fingerprint = fingerprintLayers(hostLayerInputs(os4.homedir()));
2023
2348
  write_lockfile(installedVersion, [...tools], {
2024
2349
  path: lockfilePath,
2025
2350
  host_layer_fingerprint: fingerprint
@@ -2035,8 +2360,8 @@ function stampHostLayerFingerprint(installedVersion, tools, lockfilePath, skip2,
2035
2360
  }
2036
2361
 
2037
2362
  // src/install/claudeRuleRewrite.ts
2038
- import * as fs13 from "node:fs";
2039
- import * as path12 from "node:path";
2363
+ import * as fs14 from "node:fs";
2364
+ import * as path13 from "node:path";
2040
2365
 
2041
2366
  // src/install/claudePathsPlan.ts
2042
2367
  function derive_trigger_globs(meta) {
@@ -2146,8 +2471,8 @@ function _withPreservedKeys(rendered, original) {
2146
2471
  }
2147
2472
  return ["---", ...keep, "---", "", rendered].join("\n");
2148
2473
  }
2149
- function rewriteAndReport(rulesDir, quiet, info2, warn2, wrappers, preserved = /* @__PURE__ */ new Set()) {
2150
- const result = rewriteClaudeRules(rulesDir, preserved);
2474
+ function rewriteAndReport(rulesDir, quiet, info2, warn2, wrappers, preserved = /* @__PURE__ */ new Set(), onWrite) {
2475
+ const result = rewriteClaudeRules(rulesDir, preserved, onWrite);
2151
2476
  if (wrappers && !quiet) {
2152
2477
  if (wrappers.wrapped.length > 0) {
2153
2478
  info2(
@@ -2201,27 +2526,27 @@ function renderClaudeRule(sourceText) {
2201
2526
  lines.push(pyRstrip(body) + "\n");
2202
2527
  return { text: lines.join("\n"), globs: plan.globs, dropped: plan.dropped };
2203
2528
  }
2204
- function rewriteClaudeRules(rulesDir, preserved = /* @__PURE__ */ new Set()) {
2529
+ function rewriteClaudeRules(rulesDir, preserved = /* @__PURE__ */ new Set(), onWrite) {
2205
2530
  const result = { rewritten: 0, scoped: [], dropped: [], failed: [] };
2206
2531
  let entries;
2207
2532
  try {
2208
- entries = fs13.readdirSync(rulesDir);
2533
+ entries = fs14.readdirSync(rulesDir);
2209
2534
  } catch {
2210
2535
  return result;
2211
2536
  }
2212
2537
  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;
2538
+ const full = path13.join(rulesDir, name);
2539
+ if (preserved.has(path13.resolve(full))) continue;
2215
2540
  let stat;
2216
2541
  try {
2217
- stat = fs13.lstatSync(full);
2542
+ stat = fs14.lstatSync(full);
2218
2543
  } catch {
2219
2544
  continue;
2220
2545
  }
2221
2546
  if (!stat.isFile() || stat.isSymbolicLink()) continue;
2222
2547
  let text;
2223
2548
  try {
2224
- text = fs13.readFileSync(full, "utf-8");
2549
+ text = fs14.readFileSync(full, "utf-8");
2225
2550
  } catch {
2226
2551
  continue;
2227
2552
  }
@@ -2231,7 +2556,7 @@ function rewriteClaudeRules(rulesDir, preserved = /* @__PURE__ */ new Set()) {
2231
2556
  const withOwnership = _withPreservedKeys(rendered.text, text);
2232
2557
  if (withOwnership !== text) {
2233
2558
  try {
2234
- fs13.writeFileSync(full, withOwnership, "utf-8");
2559
+ fs14.writeFileSync(full, withOwnership, "utf-8");
2235
2560
  } catch (e) {
2236
2561
  result.failed.push({
2237
2562
  rule: name.slice(0, -3),
@@ -2239,6 +2564,7 @@ function rewriteClaudeRules(rulesDir, preserved = /* @__PURE__ */ new Set()) {
2239
2564
  });
2240
2565
  continue;
2241
2566
  }
2567
+ onWrite?.(full);
2242
2568
  result.rewritten += 1;
2243
2569
  }
2244
2570
  const stem = name.slice(0, -3);
@@ -2251,19 +2577,19 @@ function rewriteClaudeRules(rulesDir, preserved = /* @__PURE__ */ new Set()) {
2251
2577
  }
2252
2578
 
2253
2579
  // src/install/installThinLayer.ts
2580
+ import * as fs16 from "node:fs";
2581
+ import * as path16 from "node:path";
2582
+ import * as os7 from "node:os";
2583
+
2584
+ // src/scripts/_lib/installed_layer.ts
2254
2585
  import * as fs15 from "node:fs";
2255
- import * as path15 from "node:path";
2256
2586
  import * as os6 from "node:os";
2587
+ import * as path15 from "node:path";
2588
+ import { fileURLToPath } from "node:url";
2257
2589
 
2258
- // src/scripts/_lib/installed_layer.ts
2259
- import * as fs14 from "node:fs";
2590
+ // src/install/globalRuleLayers.ts
2260
2591
  import * as os5 from "node:os";
2261
2592
  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
2593
  var GLOBAL_RULE_DIRS = {
2268
2594
  "claude-code": ".claude/rules",
2269
2595
  cursor: ".cursor/rules",
@@ -2273,9 +2599,17 @@ var GLOBAL_RULE_DIRS = {
2273
2599
  // Cline's scope root IS the rules directory — no `rules/` suffix.
2274
2600
  cline: "Documents/Cline/Rules"
2275
2601
  };
2276
- function globalRuleLayerPath(toolId, home = process.env["HOME"] ?? os4.homedir()) {
2602
+ function globalRuleLayerPath(toolId, home = process.env["HOME"] ?? os5.homedir()) {
2277
2603
  const rel = GLOBAL_RULE_DIRS[toolId];
2278
- return rel === void 0 ? null : path13.join(home, rel);
2604
+ return rel === void 0 ? null : path14.join(home, rel);
2605
+ }
2606
+
2607
+ // src/scripts/_lib/installed_layer_normalise.ts
2608
+ var ABSOLUTE_PATH_TOKEN = "<abs>";
2609
+ var POSIX_ABSOLUTE = /(?<![A-Za-z0-9._~%@+:/\\-])(?:\/[A-Za-z0-9._@+~-]+){2,}/g;
2610
+ var WINDOWS_ABSOLUTE = /(?<![A-Za-z0-9._~%@+:/\\-])[A-Za-z]:(?:[\\/][A-Za-z0-9._@+~-]+)+/g;
2611
+ function normaliseLayerText(text) {
2612
+ return text.replace(WINDOWS_ABSOLUTE, ABSOLUTE_PATH_TOKEN).replace(POSIX_ABSOLUTE, ABSOLUTE_PATH_TOKEN);
2279
2613
  }
2280
2614
 
2281
2615
  // src/scripts/_lib/installed_layer.ts
@@ -2294,6 +2628,7 @@ function readLayer(host, scope, dir, recorded) {
2294
2628
  files: 0,
2295
2629
  unconditional: 0,
2296
2630
  chars: 0,
2631
+ normalised_chars: 0,
2297
2632
  package_owned: 0,
2298
2633
  foreign: 0,
2299
2634
  package_owned_chars: 0,
@@ -2304,19 +2639,19 @@ function readLayer(host, scope, dir, recorded) {
2304
2639
  };
2305
2640
  let names;
2306
2641
  try {
2307
- names = fs14.readdirSync(dir);
2642
+ names = fs15.readdirSync(dir);
2308
2643
  } catch {
2309
2644
  return { host, scope, dir, present: false, ...empty };
2310
2645
  }
2311
2646
  const readings = [];
2312
2647
  for (const name of names.sort()) {
2313
2648
  if (!name.endsWith(".md")) continue;
2314
- const abs = path14.join(dir, name);
2649
+ const abs = path15.join(dir, name);
2315
2650
  let text;
2316
2651
  try {
2317
- const st = fs14.statSync(abs);
2652
+ const st = fs15.statSync(abs);
2318
2653
  if (!st.isFile()) continue;
2319
- text = fs14.readFileSync(abs, "utf-8");
2654
+ text = fs15.readFileSync(abs, "utf-8");
2320
2655
  } catch {
2321
2656
  continue;
2322
2657
  }
@@ -2328,6 +2663,10 @@ function readLayer(host, scope, dir, recorded) {
2328
2663
  // a host loads" and "what a delivery carries" cannot drift into two
2329
2664
  // spellings of the same measurement.
2330
2665
  chars: ruleBody(text).length,
2666
+ // THE SAME STRING, MEASURED TWICE. `chars` is what the host loads;
2667
+ // this is that text with every absolute path substituted, so two
2668
+ // machines with different package roots read one figure in common.
2669
+ normalised_chars: normaliseLayerText(ruleBody(text)).length,
2331
2670
  unconditional: isUnconditional(text),
2332
2671
  package_owned: owned
2333
2672
  });
@@ -2341,6 +2680,7 @@ function readLayer(host, scope, dir, recorded) {
2341
2680
  files: readings.length,
2342
2681
  unconditional: readings.filter((r) => r.unconditional).length,
2343
2682
  chars: readings.reduce((n, r) => n + r.chars, 0),
2683
+ normalised_chars: readings.reduce((n, r) => n + r.normalised_chars, 0),
2344
2684
  package_owned: readings.filter((r) => r.package_owned).length,
2345
2685
  foreign: readings.filter((r) => !r.package_owned).length,
2346
2686
  package_owned_chars: readings.reduce((n, r) => n + (r.package_owned ? r.chars : 0), 0),
@@ -2351,8 +2691,8 @@ function readLayer(host, scope, dir, recorded) {
2351
2691
  };
2352
2692
  }
2353
2693
  function defaultHostLimitsPath() {
2354
- return path14.join(
2355
- path14.dirname(fileURLToPath2(import.meta.url)),
2694
+ return path15.join(
2695
+ path15.dirname(fileURLToPath(import.meta.url)),
2356
2696
  "..",
2357
2697
  "..",
2358
2698
  "config",
@@ -2363,7 +2703,7 @@ function loadHostInstructionLimits(file = defaultHostLimitsPath()) {
2363
2703
  const out = /* @__PURE__ */ new Map();
2364
2704
  let raw;
2365
2705
  try {
2366
- raw = JSON.parse(fs14.readFileSync(file, "utf-8"));
2706
+ raw = JSON.parse(fs15.readFileSync(file, "utf-8"));
2367
2707
  } catch {
2368
2708
  return out;
2369
2709
  }
@@ -2417,18 +2757,18 @@ function defaultInventoryPath(home) {
2417
2757
  try {
2418
2758
  const real = (q) => {
2419
2759
  try {
2420
- return fs14.realpathSync(q);
2760
+ return fs15.realpathSync(q);
2421
2761
  } catch {
2422
- return path14.resolve(q);
2762
+ return path15.resolve(q);
2423
2763
  }
2424
2764
  };
2425
- const mine = os5.homedir();
2426
- if (path14.resolve(home) === path14.resolve(mine) || real(home) === real(mine)) {
2765
+ const mine = os6.homedir();
2766
+ if (path15.resolve(home) === path15.resolve(mine) || real(home) === real(mine)) {
2427
2767
  return inventory_path();
2428
2768
  }
2429
2769
  } catch {
2430
2770
  }
2431
- return path14.join(home, DEFAULT_EVENT4U_ROOT_RELATIVE, INVENTORY_BASENAME);
2771
+ return path15.join(home, DEFAULT_EVENT4U_ROOT_RELATIVE, INVENTORY_BASENAME);
2432
2772
  }
2433
2773
  function resolveLayerOwnership(opts) {
2434
2774
  const recorded = /* @__PURE__ */ new Map();
@@ -2448,18 +2788,18 @@ function resolveLayerOwnership(opts) {
2448
2788
  let fromDeploy = 0;
2449
2789
  for (const [anchor, rels] of opts.thisDeploy ?? /* @__PURE__ */ new Map()) {
2450
2790
  for (const rel of rels) {
2451
- const abs = path14.resolve(anchor, rel);
2791
+ const abs = path15.resolve(anchor, rel);
2452
2792
  if (!recorded.has(abs)) fromDeploy += 1;
2453
2793
  recorded.set(abs, null);
2454
2794
  try {
2455
- recorded.set(fs14.realpathSync(abs), null);
2795
+ recorded.set(fs15.realpathSync(abs), null);
2456
2796
  } catch {
2457
2797
  }
2458
2798
  }
2459
2799
  }
2460
2800
  if (fromDeploy > 0) sources.push("this-deploy");
2461
2801
  const manifestPath = opts.manifestPath ?? null;
2462
- if (manifestPath !== null && fs14.existsSync(manifestPath)) {
2802
+ if (manifestPath !== null && fs15.existsSync(manifestPath)) {
2463
2803
  let n = 0;
2464
2804
  let recordedHashes;
2465
2805
  try {
@@ -2515,9 +2855,9 @@ function renderHostLimitRows(rows) {
2515
2855
 
2516
2856
  // src/install/installThinLayer.ts
2517
2857
  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);
2858
+ const packageRoot = path16.resolve(opts.packageRoot);
2859
+ const bodySourceDir = path16.join(packageRoot, "dist", "agent-src", "rules");
2860
+ const bodyLinkPrefix = absoluteBodyLinkPrefix(opts.bodyLinkRoot ?? packageRoot);
2521
2861
  const preserved = opts.preserved ?? /* @__PURE__ */ new Set();
2522
2862
  const stubs = build_thin(bodySourceDir, null, null, null, { packageRoot, bodyLinkPrefix });
2523
2863
  let thinned = 0;
@@ -2529,10 +2869,10 @@ function thinInstalledRuleLayer(opts) {
2529
2869
  const absent = [];
2530
2870
  const failed = [];
2531
2871
  for (const [name, stubText] of stubs) {
2532
- const target = path15.join(opts.rulesDir, name);
2872
+ const target = path16.join(opts.rulesDir, name);
2533
2873
  let installed;
2534
2874
  try {
2535
- installed = fs15.readFileSync(target, "utf-8");
2875
+ installed = fs16.readFileSync(target, "utf-8");
2536
2876
  } catch (e) {
2537
2877
  if (e.code === "ENOENT") absent.push(name);
2538
2878
  else failed.push({ rule: name, reason: String(e) });
@@ -2540,7 +2880,7 @@ function thinInstalledRuleLayer(opts) {
2540
2880
  }
2541
2881
  let sourceText;
2542
2882
  try {
2543
- sourceText = fs15.readFileSync(path15.join(bodySourceDir, name), "utf-8");
2883
+ sourceText = fs16.readFileSync(path16.join(bodySourceDir, name), "utf-8");
2544
2884
  } catch {
2545
2885
  sourceText = null;
2546
2886
  }
@@ -2550,7 +2890,7 @@ function thinInstalledRuleLayer(opts) {
2550
2890
  charsAfter += installed.length;
2551
2891
  continue;
2552
2892
  }
2553
- if (preserved.has(path15.resolve(target))) {
2893
+ if (preserved.has(path16.resolve(target))) {
2554
2894
  preservedHits.push(name);
2555
2895
  charsBefore += installed.length;
2556
2896
  charsAfter += installed.length;
@@ -2569,7 +2909,8 @@ function thinInstalledRuleLayer(opts) {
2569
2909
  const next = `${frontmatter}${stubText}`;
2570
2910
  try {
2571
2911
  if (next !== installed) {
2572
- fs15.writeFileSync(target, next, "utf-8");
2912
+ fs16.writeFileSync(target, next, "utf-8");
2913
+ opts.onWrite?.(target);
2573
2914
  rewritten += 1;
2574
2915
  }
2575
2916
  thinned += 1;
@@ -2612,7 +2953,7 @@ function describeThinInstalledLayer(res) {
2612
2953
  }
2613
2954
  return out;
2614
2955
  }
2615
- function installReceiptBudgetLines(packageRoot, home = os6.homedir(), opts = {}) {
2956
+ function installReceiptBudgetLines(packageRoot, home = os7.homedir(), opts = {}) {
2616
2957
  try {
2617
2958
  const { recorded, sources } = resolveLayerOwnership({
2618
2959
  manifestPath: opts.manifestPath === void 0 ? manifest_path(packageRoot) : opts.manifestPath,
@@ -2696,107 +3037,18 @@ function resolveGlobalRuleScope(inputs) {
2696
3037
  }
2697
3038
  }
2698
3039
 
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) !== "";
3040
+ // src/install/toolsArg.ts
3041
+ function mergeToolsAliases(tools, ai) {
3042
+ const items = [];
3043
+ for (const raw of [tools, ai]) {
3044
+ if (!raw) continue;
3045
+ for (const piece of raw.split(",")) {
3046
+ const stripped = piece.trim();
3047
+ if (stripped && !items.includes(stripped)) items.push(stripped);
2771
3048
  }
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
3049
  }
2783
- if (typeof lean !== "object" || lean === null || Array.isArray(lean)) return "";
2784
- const m = lean["mode"];
2785
- return typeof m === "string" ? m.trim() : "";
3050
+ return items.length > 0 ? items.join(",") : "all";
2786
3051
  }
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
3052
 
2801
3053
  // src/shared/settingsSurface.ts
2802
3054
  function unwrapRef(root) {
@@ -4153,7 +4405,7 @@ var zodToJsonSchema = (schema, options) => {
4153
4405
  };
4154
4406
 
4155
4407
  // src/scripts/_lib/module_detection.ts
4156
- import * as fs16 from "node:fs";
4408
+ import * as fs17 from "node:fs";
4157
4409
  import * as path17 from "node:path";
4158
4410
  var _SKIP_DIRS = /* @__PURE__ */ new Set([".module-template", ".example"]);
4159
4411
  var _RULES = [
@@ -4168,14 +4420,14 @@ var _RULES = [
4168
4420
  ];
4169
4421
  function _isDir(p) {
4170
4422
  try {
4171
- return fs16.statSync(p).isDirectory();
4423
+ return fs17.statSync(p).isDirectory();
4172
4424
  } catch {
4173
4425
  return false;
4174
4426
  }
4175
4427
  }
4176
4428
  function _isFile(p) {
4177
4429
  try {
4178
- return fs16.statSync(p).isFile();
4430
+ return fs17.statSync(p).isFile();
4179
4431
  } catch {
4180
4432
  return false;
4181
4433
  }
@@ -4189,7 +4441,7 @@ function _isUpperChar(ch) {
4189
4441
  function _list_module_subdirs(root) {
4190
4442
  let entries;
4191
4443
  try {
4192
- entries = fs16.readdirSync(root).sort();
4444
+ entries = fs17.readdirSync(root).sort();
4193
4445
  } catch {
4194
4446
  return [];
4195
4447
  }
@@ -4254,58 +4506,8 @@ function detect_module_roots(project_root) {
4254
4506
  return [...high, ...medium];
4255
4507
  }
4256
4508
 
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
- // src/install/paths.ts
4284
- import { homedir as homedir8, tmpdir } from "node:os";
4285
- import { join as join18 } from "node:path";
4286
- var INSTALL_ROOT_SUBPATH = ".event4u/agent-config";
4287
- var INSTALL_LOG_FILENAME = "install-log.jsonl";
4288
- function resolveHome(home) {
4289
- if (home && home.length > 0) {
4290
- return home;
4291
- }
4292
- const fromOs = homedir8();
4293
- if (!fromOs) {
4294
- throw new Error(
4295
- "Cannot resolve home directory \u2014 both $HOME (POSIX) and $USERPROFILE (Windows) are unset."
4296
- );
4297
- }
4298
- return fromOs;
4299
- }
4300
- function getInstallRoot(home) {
4301
- return join18(resolveHome(home), INSTALL_ROOT_SUBPATH);
4302
- }
4303
- function getLogPath(home) {
4304
- return join18(getInstallRoot(home), INSTALL_LOG_FILENAME);
4305
- }
4306
-
4307
4509
  // src/scripts/install.ts
4308
- var _HERE = fileURLToPath3(import.meta.url);
4510
+ var _HERE = fileURLToPath2(import.meta.url);
4309
4511
  var SystemExitError = class extends Error {
4310
4512
  constructor(code) {
4311
4513
  super(`system-exit-${code}`);
@@ -4321,9 +4523,9 @@ var ArgparseExit = class extends Error {
4321
4523
  code;
4322
4524
  };
4323
4525
  function expanduser3(p) {
4324
- if (p === "~") return os7.homedir();
4526
+ if (p === "~") return os8.homedir();
4325
4527
  if (p.startsWith("~/") || p.startsWith("~\\")) {
4326
- return path18.join(os7.homedir(), p.slice(2));
4528
+ return path18.join(os8.homedir(), p.slice(2));
4327
4529
  }
4328
4530
  return p;
4329
4531
  }
@@ -4464,7 +4666,8 @@ var LEGACY_RENAME_MAP = {
4464
4666
  };
4465
4667
  var state = {
4466
4668
  QUIET: false,
4467
- PROGRESS_NDJSON: false
4669
+ PROGRESS_NDJSON: false,
4670
+ FULL_PIN: false
4468
4671
  };
4469
4672
  function _emit_progress(obj) {
4470
4673
  if (!state.PROGRESS_NDJSON) return;
@@ -4854,7 +5057,7 @@ function ensure_augment_bridge(project_root, force) {
4854
5057
  ".augment/settings.json"
4855
5058
  );
4856
5059
  }
4857
- var AUGMENT_USER_DIR = path18.join(os7.homedir(), ".augment");
5060
+ var AUGMENT_USER_DIR = path18.join(os8.homedir(), ".augment");
4858
5061
  var AUGMENT_USER_HOOKS_DIR = path18.join(AUGMENT_USER_DIR, "hooks");
4859
5062
  var AUGMENT_DISPATCHER_TRAMPOLINE = "augment-dispatcher.sh";
4860
5063
  var AUGMENT_LEGACY_TRAMPOLINES = [
@@ -4955,7 +5158,7 @@ function ensure_cursor_bridge(project_root, force) {
4955
5158
  ".cursor/hooks.json"
4956
5159
  );
4957
5160
  }
4958
- var CURSOR_USER_DIR = path18.join(os7.homedir(), ".cursor");
5161
+ var CURSOR_USER_DIR = path18.join(os8.homedir(), ".cursor");
4959
5162
  var CURSOR_USER_HOOKS_DIR = path18.join(CURSOR_USER_DIR, "hooks");
4960
5163
  var CURSOR_DISPATCHER_TRAMPOLINE = "cursor-dispatcher.sh";
4961
5164
  function ensure_cursor_user_hooks(package_root, force) {
@@ -5039,7 +5242,7 @@ function ensure_cline_bridge(project_root, force) {
5039
5242
  skip(".clinerules/hooks/ already up to date");
5040
5243
  }
5041
5244
  }
5042
- var CLINE_USER_DIR = path18.join(os7.homedir(), "Documents", "Cline", "Hooks");
5245
+ var CLINE_USER_DIR = path18.join(os8.homedir(), "Documents", "Cline", "Hooks");
5043
5246
  var CLINE_DISPATCHER_TRAMPOLINE = "cline-dispatcher.sh";
5044
5247
  function ensure_cline_user_hooks(package_root, force) {
5045
5248
  const src = path18.join(package_root, "scripts", "hooks", CLINE_DISPATCHER_TRAMPOLINE);
@@ -5091,7 +5294,7 @@ function ensure_windsurf_bridge(project_root, force) {
5091
5294
  ".windsurf/hooks.json"
5092
5295
  );
5093
5296
  }
5094
- var WINDSURF_USER_DIR = path18.join(os7.homedir(), ".codeium", "windsurf");
5297
+ var WINDSURF_USER_DIR = path18.join(os8.homedir(), ".codeium", "windsurf");
5095
5298
  var WINDSURF_USER_HOOKS_DIR = path18.join(WINDSURF_USER_DIR, "hooks");
5096
5299
  var WINDSURF_DISPATCHER_TRAMPOLINE = "windsurf-dispatcher.sh";
5097
5300
  function ensure_windsurf_user_hooks(package_root, force) {
@@ -5147,7 +5350,7 @@ function ensure_gemini_bridge(project_root, force) {
5147
5350
  ".gemini/settings.json"
5148
5351
  );
5149
5352
  }
5150
- var GEMINI_USER_DIR = path18.join(os7.homedir(), ".gemini");
5353
+ var GEMINI_USER_DIR = path18.join(os8.homedir(), ".gemini");
5151
5354
  var GEMINI_USER_HOOKS_DIR = path18.join(GEMINI_USER_DIR, "hooks");
5152
5355
  var GEMINI_DISPATCHER_TRAMPOLINE = "gemini-dispatcher.sh";
5153
5356
  function ensure_gemini_user_hooks(package_root, force) {
@@ -5638,7 +5841,7 @@ To remove this marker, delete this file.
5638
5841
  `;
5639
5842
  }
5640
5843
  var _CLAUDE_DESKTOP_BUNDLES_SUBPATH = "claude-desktop/bundles";
5641
- var GLOBAL_ROOT = path18.join(os7.homedir(), ".event4u", "agent-config");
5844
+ var GLOBAL_ROOT = path18.join(os8.homedir(), ".event4u", "agent-config");
5642
5845
  var GLOBAL_USER_SETTINGS_PATH = path18.join(GLOBAL_ROOT, ".agent-user.yml");
5643
5846
  var GLOBAL_AGENT_SETTINGS_PATH = path18.join(GLOBAL_ROOT, ".agent-settings.yml");
5644
5847
  function _bridge_marker(tool_id, scope) {
@@ -5910,7 +6113,7 @@ function _update_installed_tools_manifest(project_root, tools, scope, force, fil
5910
6113
  throw exc;
5911
6114
  }
5912
6115
  }
5913
- write_manifest(target, version, entries);
6116
+ write_manifest(target, version, dropGlobalScopeFiles(entries, scope === "global" ? tools : /* @__PURE__ */ new Set()));
5914
6117
  if (!state.QUIET) {
5915
6118
  const rel = isRelativeTo(target, project_root) ? path18.relative(project_root, target) : target;
5916
6119
  info(`Manifest updated: ${rel}`);
@@ -6026,7 +6229,7 @@ function _run_migrate_to_global(project_root) {
6026
6229
  }
6027
6230
  }
6028
6231
  function _format_global_root_for_marker(global_root) {
6029
- const home = resolvePath(os7.homedir());
6232
+ const home = resolvePath(os8.homedir());
6030
6233
  const resolved = resolvePath(global_root);
6031
6234
  const rel = path18.relative(home, resolved);
6032
6235
  if (rel === "" || rel.startsWith("..") || path18.isAbsolute(rel)) {
@@ -6182,7 +6385,7 @@ function _copy_dir_dereferencing_symlinks(src, dest, force, package_root = null,
6182
6385
  return [0, 0, written_paths];
6183
6386
  }
6184
6387
  mkdirp(path18.dirname(dest));
6185
- const decision = tracker.resolve(dest, force);
6388
+ const decision = tracker.resolve(dest, force, { from: resolved_src, packageRoot: package_root });
6186
6389
  if (decision === "preserve") {
6187
6390
  tracker.preserve(dest, resolved_src, package_root);
6188
6391
  _log_tx_entry("skip", dest);
@@ -6245,7 +6448,7 @@ function _copy_dir_dereferencing_symlinks(src, dest, force, package_root = null,
6245
6448
  if (file_filter !== null && !file_filter(entry)) {
6246
6449
  continue;
6247
6450
  }
6248
- const decision = tracker.resolve(target, force);
6451
+ const decision = tracker.resolve(target, force, { from: resolved, packageRoot: package_root });
6249
6452
  if (decision === "preserve") {
6250
6453
  tracker.preserve(target, resolved, package_root);
6251
6454
  skipped += 1;
@@ -6269,7 +6472,7 @@ function _write_claude_desktop_marker(force, lockfile_path2, bundles_dir, bundle
6269
6472
  const target = path18.join(anchor, "agent-config.md");
6270
6473
  mkdirp(anchor);
6271
6474
  const body = claudeDesktopMarkerBody(lockfile_path2, anchor, bundles_dir, bundle_count);
6272
- if (tracker.resolve(target, force) === "preserve") {
6475
+ if (tracker.resolve(target, force, { content: body }) === "preserve") {
6273
6476
  tracker.preserveContent(target, body);
6274
6477
  return [0, 1, []];
6275
6478
  }
@@ -6282,12 +6485,8 @@ function _deploy_claude_desktop(force, package_root, lockfile_path2) {
6282
6485
  build_skill_bundles(package_root, bundles_dir, force);
6283
6486
  build_command_bundles(package_root, bundles_dir, force);
6284
6487
  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
- );
6488
+ const [, , marker_paths] = _write_claude_desktop_marker(force, lockfile_path2, bundles_dir, bundle_count);
6489
+ 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
6490
  return [bundle_count, 0, "deployed", [bundles_dir, ...marker_paths]];
6292
6491
  }
6293
6492
  var _CLAUDE_FLAT_WRAPPER_EXTRA = /* @__PURE__ */ new Set(["commit"]);
@@ -6390,20 +6589,19 @@ function _deploy_global_content(tools, force, package_root, lockfile_path2) {
6390
6589
  info,
6391
6590
  warn,
6392
6591
  res,
6393
- preserved_now
6592
+ preserved_now,
6593
+ onlyDeployed(anchor, current_files, (p) => _log_tx_entry("write", p))
6394
6594
  );
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
- }
6595
+ deployClaudeCarrier({
6596
+ packageRoot: package_root,
6597
+ rulesDir: path18.join(anchor, "rules"),
6598
+ quiet: state.QUIET,
6599
+ info,
6600
+ warn,
6601
+ userPin: state.FULL_PIN,
6602
+ wantsThin: installerThinsHost(tool_id, { packageRoot: package_root }),
6603
+ thin: (bodyLinkRoot) => describeThinInstalledLayer(thinInstalledRuleLayer({ rulesDir: path18.join(anchor, "rules"), packageRoot: package_root, preserved: preserved_now, bodyLinkRoot, onWrite: onlyDeployed(anchor, current_files, (p) => _log_tx_entry("write", p)) }))
6604
+ });
6407
6605
  if (!state.QUIET) for (const l of installReceiptBudgetLines(package_root, void 0, { thisDeploy: /* @__PURE__ */ new Map([[anchor, current_files]]) })) info(l);
6408
6606
  }
6409
6607
  const missing_targets = _verify_deploy_targets(anchor, plan);
@@ -6418,25 +6616,18 @@ function _deploy_global_content(tools, force, package_root, lockfile_path2) {
6418
6616
  continue;
6419
6617
  }
6420
6618
  _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);
6619
+ const { reaped, retained } = recordGlobalDeploy({
6620
+ toolId: tool_id,
6621
+ anchorRaw: anchor_raw,
6622
+ anchor,
6623
+ currentFiles: current_files,
6624
+ destSubs: plan.map(([, dest_sub]) => dest_sub),
6625
+ packageTag: PACKAGE_TAG_ID,
6626
+ preserved: tracker.conflictState.preserved,
6627
+ staged: tracker.conflictState.staged,
6628
+ recordedFor: tracker.recordedDigest
6629
+ });
6630
+ for (const p of retained) warn(retainedFileMessage(p));
6440
6631
  if (reaped.length > 0 && !state.QUIET) {
6441
6632
  info(
6442
6633
  ` ${tool_id}: reaped ${reaped.length} stale deployed file(s) from a previous install`
@@ -6509,7 +6700,9 @@ function _preview_global_reap(tools, package_root) {
6509
6700
  plan.map(([, dest_sub]) => dest_sub),
6510
6701
  current_files,
6511
6702
  PACKAGE_TAG_ID,
6512
- true
6703
+ true,
6704
+ // The ledger spares an edited retired file, so the preview must too.
6705
+ recorded_digests(tool_id, anchor, inventory)
6513
6706
  )
6514
6707
  );
6515
6708
  const paths = [...new Set(would_reap.map((p) => String(p)))].sort();
@@ -6535,7 +6728,6 @@ function _verify_deploy_targets(anchor, plan) {
6535
6728
  }
6536
6729
  return missing;
6537
6730
  }
6538
- var _prune_modules_by = prune_modules_by;
6539
6731
  var _prune_lab_modules = prune_lab_modules;
6540
6732
  var _load_packs_registry = load_packs_registry;
6541
6733
  var _compute_active_pack_ids = compute_active_pack_ids;
@@ -6574,12 +6766,7 @@ function _rule_filter_for_source(src_rel, scope) {
6574
6766
  if (src_rel !== RULE_SOURCE_REL) return null;
6575
6767
  return (srcFile) => ruleFileArrives(srcFile, scope) && !isExclusivelyPackageOnly(srcFile);
6576
6768
  }
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
- }
6769
+ var _prune_scoped_modules = prune_scoped_modules;
6583
6770
  function install_global(tools, force, project_root = null, core_only = false) {
6584
6771
  const migrated = migrate_legacy_namespace();
6585
6772
  if (migrated && !state.QUIET) {
@@ -6657,13 +6844,6 @@ function install_global(tools, force, project_root = null, core_only = false) {
6657
6844
  }
6658
6845
  try {
6659
6846
  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
6847
  if (mode === "scoped") {
6668
6848
  const packs_registry = _load_packs_registry(package_root);
6669
6849
  const active_ids = _compute_active_pack_ids(packs_registry, active_packs);
@@ -6680,6 +6860,7 @@ function install_global(tools, force, project_root = null, core_only = false) {
6680
6860
  warn(`Scoped-projection prune failed \u2014 restoring full tree (${String(e)}).`);
6681
6861
  }
6682
6862
  }
6863
+ 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
6864
  const failed_tools = new Set(
6684
6865
  Object.keys(deploy_results).filter(
6685
6866
  (tool_id) => deploy_results[tool_id][2] === "deploy_failed"
@@ -6889,17 +7070,6 @@ function _write_settings_surface_snapshot(installed_version) {
6889
7070
  function arrayStrEqual(a, b) {
6890
7071
  return a.length === b.length && a.every((v, i) => v === b[i]);
6891
7072
  }
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
7073
  var PROG = "agent-config install";
6904
7074
  var USAGE = `usage: ${PROG} [-h] [--profile PROFILE] [--user-type USER_TYPE] [--force]
6905
7075
  [--skip-bridges] [--augment-user-hooks]
@@ -6907,7 +7077,7 @@ var USAGE = `usage: ${PROG} [-h] [--profile PROFILE] [--user-type USER_TYPE] [--
6907
7077
  [--windsurf-user-hooks] [--gemini-user-hooks]
6908
7078
  [--project PROJECT] [--package PACKAGE] [--quiet]
6909
7079
  [--tools TOOLS] [--ai AI] [--packs PACKS] [--core-only]
6910
- [--no-smoke] [--global]
7080
+ [--no-smoke] [--global] [--full]
6911
7081
  [--scope {project,global,prompt,auto}]
6912
7082
  [--layer {global,project,both-acknowledged}]
6913
7083
  [--custom-path CUSTOM_PATH] [--offline] [--minimal]
@@ -6931,7 +7101,8 @@ var _STORE_TRUE_FLAGS = {
6931
7101
  "--settings-only": "minimal",
6932
7102
  "--interactive": "interactive",
6933
7103
  "--no-ui": "no_ui",
6934
- "--dry-run": "dry_run"
7104
+ "--dry-run": "dry_run",
7105
+ "--full": "full"
6935
7106
  };
6936
7107
  var _VALUE_FLAGS = {
6937
7108
  "--profile": "profile",
@@ -6979,6 +7150,7 @@ function parse_options(argv) {
6979
7150
  interactive: false,
6980
7151
  no_ui: false,
6981
7152
  dry_run: false,
7153
+ full: false,
6982
7154
  apply_payload: null,
6983
7155
  layer: null
6984
7156
  };
@@ -7035,7 +7207,7 @@ function parse_options(argv) {
7035
7207
  if (positionals.length > 0) {
7036
7208
  _argError(`unrecognized arguments: ${positionals.join(" ")}`);
7037
7209
  }
7038
- opts.tools = _merge_tools_aliases(opts.tools, opts.ai);
7210
+ opts.tools = mergeToolsAliases(opts.tools, opts.ai);
7039
7211
  const rawPacks = opts.packs;
7040
7212
  opts.packs = typeof rawPacks === "string" ? rawPacks.split(",").map((p) => p.trim()).filter((p) => p) : [];
7041
7213
  if (opts.scope === "global" && opts.custom_path) {
@@ -7310,7 +7482,7 @@ function _wizard_cli_dist(_project_root) {
7310
7482
  return pathExists(cli) ? cli : null;
7311
7483
  }
7312
7484
  function _server_info_path() {
7313
- return path18.join(os7.homedir(), ".event4u", "agent-config", "local-server.json");
7485
+ return path18.join(os8.homedir(), ".event4u", "agent-config", "local-server.json");
7314
7486
  }
7315
7487
  function _pid_is_agent_config(pid) {
7316
7488
  let res;
@@ -7406,7 +7578,7 @@ function _wizard_spawn(project_root, pass_project_root = true) {
7406
7578
  function _wizard_run_sync(cmd, env, cli) {
7407
7579
  const total = _WIZARD_TIMEOUTS.reduce((a, b) => a + b, 0);
7408
7580
  const log_path = path18.join(
7409
- os7.tmpdir(),
7581
+ os8.tmpdir(),
7410
7582
  `agent-config-wizard-${process2.pid}-${Date.now()}.log`
7411
7583
  );
7412
7584
  let child;
@@ -7500,8 +7672,7 @@ function _dry_run_summary(opts) {
7500
7672
  `);
7501
7673
  process2.stdout.write(` tools: ${opts.tools || "all"}
7502
7674
  `);
7503
- process2.stdout.write(` target: ${target}
7504
- `);
7675
+ process2.stdout.write(dryRunTargetLines(Boolean(opts.global_install) || opts.scope === "global", _parse_tools(opts.tools || "all"), target));
7505
7676
  process2.stdout.write(` minimal: ${pyBool(opts.minimal)}
7506
7677
  `);
7507
7678
  process2.stdout.write(` force: ${pyBool(opts.force)}
@@ -7598,6 +7769,7 @@ function pyRepr(v) {
7598
7769
  function main2(argv) {
7599
7770
  const opts = parse_options(argv);
7600
7771
  state.QUIET = opts.quiet;
7772
+ state.FULL_PIN = opts.full || _legacy_projection_pin();
7601
7773
  if (opts.apply_payload) {
7602
7774
  const payload_path = resolvePath(opts.apply_payload);
7603
7775
  if (!isFile(payload_path)) fail(`--apply-payload path not found: ${payload_path}`);
@@ -7755,6 +7927,15 @@ function _propose_modules_config(project_root, is_first_run) {
7755
7927
  "Re-run anytime via `./scripts-run src/scripts/propose_modules_config` (installed under <package>/src/scripts/)."
7756
7928
  );
7757
7929
  }
7930
+ var _ABSENT_LAYER = ["project-settings", "template"].map((n) => path18.join(path18.sep, "dev", "null", `agent-config-absent-${n}.yml`));
7931
+ function _legacy_projection_pin() {
7932
+ let data = null;
7933
+ try {
7934
+ data = load_agent_settings({ project_path: _ABSENT_LAYER[0], template_path: _ABSENT_LAYER[1] });
7935
+ } catch {
7936
+ }
7937
+ return legacyProjectionPin(data, (line) => warn(line));
7938
+ }
7758
7939
  function _read_consumer_auto_switch(project_root) {
7759
7940
  let data;
7760
7941
  try {
@@ -7987,6 +8168,11 @@ if (_isCliEntry || _argv1 === _HERE) {
7987
8168
 
7988
8169
  export {
7989
8170
  subtract_pointers,
8171
+ recordPath,
8172
+ codexSkillRoots,
8173
+ removeCodexResidentSet,
8174
+ recordPath2,
8175
+ removeListingOverrides,
7990
8176
  SETTINGS_FILE,
7991
8177
  ROOCODE_MARKER,
7992
8178
  CLAUDE_DESKTOP_MARKER,