@aiwg/cli 2026.10.4 → 2026.10.6

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 (220) hide show
  1. package/agentic/code/addons/composition-engine/lib/runtime.mjs +1401 -0
  2. package/agentic/code/addons/composition-engine/lib/validator.mjs +513 -0
  3. package/agentic/code/addons/composition-engine/schemas/flow-graph.schema.json +372 -0
  4. package/agentic/code/providers/model-capabilities.v1.json +74 -50
  5. package/bin/aiwg.mjs +3 -1
  6. package/dist/src/artifacts/browser-export.js +1 -0
  7. package/dist/src/artifacts/citation-parser.js +8 -1
  8. package/dist/src/artifacts/cli.js +72 -9
  9. package/dist/src/artifacts/fortemi-core-query-adapter.js +2 -0
  10. package/dist/src/artifacts/fortemi-core-sync.js +26 -8
  11. package/dist/src/artifacts/graph-query.js +18 -8
  12. package/dist/src/artifacts/index-adapters.js +339 -0
  13. package/dist/src/artifacts/index-builder.js +146 -16
  14. package/dist/src/artifacts/index-files.js +15 -4
  15. package/dist/src/artifacts/index-preparation.js +91 -26
  16. package/dist/src/artifacts/index-reader.js +44 -0
  17. package/dist/src/artifacts/index-refresh.js +130 -56
  18. package/dist/src/artifacts/index-status.js +20 -5
  19. package/dist/src/artifacts/index-worker.mjs +9 -7
  20. package/dist/src/artifacts/memory-maintenance.js +503 -0
  21. package/dist/src/artifacts/prebuilt-relations.js +3 -1
  22. package/dist/src/artifacts/query-engine.js +263 -108
  23. package/dist/src/artifacts/relations-builder.js +2 -2
  24. package/dist/src/artifacts/source-graph.js +2 -2
  25. package/dist/src/artifacts/types.js +9 -1
  26. package/dist/src/cli/handlers/decision.js +19 -1
  27. package/dist/src/cli/handlers/guided-setup.js +470 -0
  28. package/dist/src/cli/handlers/help.js +2 -2
  29. package/dist/src/cli/handlers/housekeeper.js +1110 -0
  30. package/dist/src/cli/handlers/index.js +4 -2
  31. package/dist/src/cli/handlers/init.js +41 -6
  32. package/dist/src/cli/handlers/local-executor.js +5 -3
  33. package/dist/src/cli/handlers/mc.js +509 -53
  34. package/dist/src/cli/handlers/models.js +32 -2
  35. package/dist/src/cli/handlers/ralph-launcher.js +76 -4
  36. package/dist/src/cli/handlers/rules.js +1 -1
  37. package/dist/src/cli/handlers/script-runner.js +73 -2
  38. package/dist/src/cli/handlers/serve.js +5 -3
  39. package/dist/src/cli/handlers/sessions.js +40 -6
  40. package/dist/src/cli/handlers/setup.js +428 -1
  41. package/dist/src/cli/handlers/skill-lint.js +1 -1
  42. package/dist/src/cli/handlers/subcommands.js +118 -8
  43. package/dist/src/cli/handlers/use.js +279 -93
  44. package/dist/src/cli/handlers/workspace.js +3 -1
  45. package/dist/src/cli/prompt-utils.js +8 -0
  46. package/dist/src/cli/router.js +16 -1
  47. package/dist/src/config/aiwg-config.js +42 -0
  48. package/dist/src/config/cli.js +7 -3
  49. package/dist/src/config/decision-config.js +14 -1
  50. package/dist/src/config/native-sandbox-warnings.js +25 -0
  51. package/dist/src/contributors/validation.js +6 -5
  52. package/dist/src/decision/admission.js +7 -3
  53. package/dist/src/decision/benchmark.js +469 -0
  54. package/dist/src/decision/ledger.js +22 -3
  55. package/dist/src/decision/pricing.js +147 -0
  56. package/dist/src/decision/qualification/gate-evidence.js +18 -15
  57. package/dist/src/decision/qualification/load-staged.js +539 -0
  58. package/dist/src/decision/qualification/load.js +109 -33
  59. package/dist/src/decision/qualification/runner.js +5 -2
  60. package/dist/src/decision/review/service.js +6 -4
  61. package/dist/src/decision/review/validate.js +23 -2
  62. package/dist/src/decision/savings.js +8 -3
  63. package/dist/src/discovery/index.js +492 -0
  64. package/dist/src/discovery/interview.js +233 -0
  65. package/dist/src/discovery/plan-apply.js +571 -0
  66. package/dist/src/discovery/plan-store.js +171 -0
  67. package/dist/src/discovery/plan-types.js +2 -0
  68. package/dist/src/discovery/plan-validation.js +139 -0
  69. package/dist/src/discovery/types.js +2 -0
  70. package/dist/src/extensions/commands/definitions.js +49 -9
  71. package/dist/src/extensions/manifest.js +71 -44
  72. package/dist/src/extensions/project-local-discovery.js +1 -1
  73. package/dist/src/extensions/project-quickref.js +18 -17
  74. package/dist/src/extensions/validation.js +32 -29
  75. package/dist/src/housekeeper/daemon-config.js +148 -0
  76. package/dist/src/housekeeper/ipc.js +84 -0
  77. package/dist/src/housekeeper/lifecycle.js +148 -0
  78. package/dist/src/housekeeper/platform.js +35 -0
  79. package/dist/src/housekeeper/status.js +70 -0
  80. package/dist/src/housekeeper/units.js +114 -0
  81. package/dist/src/jobs/flow.js +22 -21
  82. package/dist/src/lint/rule-activation.js +20 -5
  83. package/dist/src/lint/runner.js +1 -1
  84. package/dist/src/mcp/cli.mjs +5 -6
  85. package/dist/src/mcp/config-file.mjs +6 -2
  86. package/dist/src/mcp/config-layers.mjs +23 -7
  87. package/dist/src/mcp/profiles.js +18 -31
  88. package/dist/src/mcp/profiles.mjs +18 -32
  89. package/dist/src/mcp/registry.js +7 -27
  90. package/dist/src/mcp/registry.mjs +7 -28
  91. package/dist/src/mcp/server.mjs +34 -1
  92. package/dist/src/mcp/tools/agentic-sandbox.mjs +8 -7
  93. package/dist/src/mcp/tools/command-run.mjs +3 -2
  94. package/dist/src/mcp/tools/decision.mjs +49 -48
  95. package/dist/src/mcp/tools/discovery.mjs +46 -21
  96. package/dist/src/mcp/tools/orchestration.mjs +22 -22
  97. package/dist/src/mcp/tools/subsystems.mjs +9 -8
  98. package/dist/src/mcp/tools/worker-invoke.mjs +17 -4
  99. package/dist/src/mcp/tools/writer-profiles.mjs +1 -1
  100. package/dist/src/memory/audit.js +719 -0
  101. package/dist/src/memory/canonical-context.js +392 -13
  102. package/dist/src/memory/canonical-maintenance.js +95 -0
  103. package/dist/src/memory/cli-result.js +22 -0
  104. package/dist/src/memory/cli.js +176 -0
  105. package/dist/src/memory/context-pack.js +57 -6
  106. package/dist/src/memory/cost.js +512 -0
  107. package/dist/src/memory/firewall-classification.d.mts +7 -0
  108. package/dist/src/memory/firewall-classification.mjs +32 -0
  109. package/dist/src/memory/index.js +8 -0
  110. package/dist/src/memory/line-maintenance.js +68 -0
  111. package/dist/src/memory/maintenance-cli.js +286 -0
  112. package/dist/src/memory/maintenance-contract.js +136 -0
  113. package/dist/src/memory/maintenance-index.js +18 -0
  114. package/dist/src/memory/maintenance-owner.js +2 -0
  115. package/dist/src/memory/maintenance-record.js +138 -0
  116. package/dist/src/memory/maintenance.js +254 -0
  117. package/dist/src/memory/provider-memory-adapter.js +154 -0
  118. package/dist/src/memory/recommend-cli.js +83 -0
  119. package/dist/src/memory/recommend.js +269 -0
  120. package/dist/src/memory/scheduled.js +81 -0
  121. package/dist/src/memory/taxonomy.js +44 -0
  122. package/dist/src/mission-protocol/codecs.js +19 -9
  123. package/dist/src/models/config-loader.js +11 -1
  124. package/dist/src/models/model-capabilities.v1.json +74 -50
  125. package/dist/src/models/provider-policy.js +125 -62
  126. package/dist/src/models/resolver.js +45 -8
  127. package/dist/src/models/worker-installation.d.mts +7 -0
  128. package/dist/src/models/worker-installation.mjs +169 -37
  129. package/dist/src/models/wrapper-route.js +1 -1
  130. package/dist/src/output-modes/registry.js +8 -7
  131. package/dist/src/plugin/metadata-validator.js +1 -1
  132. package/dist/src/providers/deploy-version.d.mts +1 -0
  133. package/dist/src/providers/deploy-version.mjs +17 -0
  134. package/dist/src/providers/provider-definitions.js +19 -16
  135. package/dist/src/providers/skill-ownership.d.mts +11 -2
  136. package/dist/src/providers/skill-ownership.mjs +35 -17
  137. package/dist/src/rules/activation.d.mts +11 -2
  138. package/dist/src/rules/activation.mjs +82 -6
  139. package/dist/src/rules/inventory.js +1 -1
  140. package/dist/src/rules/rule-frontmatter.schema.json +2 -0
  141. package/dist/src/schema/zod-validation.d.mts +6 -0
  142. package/dist/src/schema/zod-validation.mjs +50 -0
  143. package/dist/src/serve/executor-registry.js +297 -20
  144. package/dist/src/serve/executor-token.d.mts +1 -0
  145. package/dist/src/serve/executor-token.mjs +8 -0
  146. package/dist/src/serve/shared-host-scheduler.js +1102 -31
  147. package/dist/src/serve/worker-invocation.js +114 -15
  148. package/dist/src/sessions/adapters/claude.js +19 -18
  149. package/dist/src/sessions/adapters/codex.js +33 -19
  150. package/dist/src/sessions/adapters/copilot.js +14 -13
  151. package/dist/src/sessions/adapters/cursor.js +19 -18
  152. package/dist/src/sessions/adapters/deepseek-harness.js +9 -8
  153. package/dist/src/sessions/adapters/factory.js +11 -10
  154. package/dist/src/sessions/adapters/generic.js +32 -23
  155. package/dist/src/sessions/adapters/grokbot.js +35 -35
  156. package/dist/src/sessions/adapters/hermes.js +20 -19
  157. package/dist/src/sessions/adapters/muse.js +50 -49
  158. package/dist/src/sessions/adapters/omp.js +5 -4
  159. package/dist/src/sessions/adapters/openclaw.js +30 -29
  160. package/dist/src/sessions/adapters/opencode.js +26 -26
  161. package/dist/src/sessions/adapters/openhuman.js +24 -23
  162. package/dist/src/sessions/adapters/pi.js +5 -4
  163. package/dist/src/sessions/adapters/windsurf.js +8 -8
  164. package/dist/src/sessions/analytics.js +10 -9
  165. package/dist/src/sessions/batch-contracts.js +1 -1
  166. package/dist/src/sessions/batch-import.js +202 -2
  167. package/dist/src/sessions/candidates.js +7 -6
  168. package/dist/src/sessions/contracts.js +73 -54
  169. package/dist/src/sessions/coverage-preflight.js +26 -1
  170. package/dist/src/sessions/output-registration.js +11 -10
  171. package/dist/src/sessions/policy.js +18 -7
  172. package/dist/src/sessions/refresh.js +2 -3
  173. package/dist/src/sessions/repository.js +4 -2
  174. package/dist/src/sessions/workspace-discovery.js +92 -26
  175. package/dist/src/smiths/context-pipeline/aiwg-md.js +18 -1
  176. package/dist/src/smiths/context-pipeline/claude-hook.js +42 -6
  177. package/dist/src/smiths/context-pipeline/parallelism-section.js +72 -5
  178. package/dist/src/smiths/context-pipeline/workspace-context.js +106 -10
  179. package/dist/src/update/checker.d.mts +4 -0
  180. package/dist/src/update/checker.mjs +14 -0
  181. package/dist/src/writing/exemplar-selection.js +6 -6
  182. package/dist/src/writing/voice-evaluation.js +24 -23
  183. package/dist/src/writing/writer-migration.js +14 -13
  184. package/dist/src/writing/writer-profile.js +19 -18
  185. package/dist/src/writing/writing-brief.js +18 -17
  186. package/dist/src/writing/writing-receipt.js +47 -46
  187. package/package.json +5 -2
  188. package/schemas/decision/DecisionReview.schema.json +78 -1
  189. package/schemas/mission-v1.schema.json +3 -0
  190. package/tools/agents/deploy-agents.mjs +67 -39
  191. package/tools/agents/providers/antigravity.mjs +6 -1
  192. package/tools/agents/providers/base.mjs +19 -13
  193. package/tools/agents/providers/claude.mjs +1 -1
  194. package/tools/agents/providers/codex.mjs +50 -56
  195. package/tools/agents/providers/copilot.mjs +8 -2
  196. package/tools/agents/providers/cursor.mjs +1 -1
  197. package/tools/agents/providers/deepseek-harness.mjs +1 -1
  198. package/tools/agents/providers/factory.mjs +7 -1
  199. package/tools/agents/providers/grok-build.mjs +18 -2
  200. package/tools/agents/providers/grokbot.mjs +1 -1
  201. package/tools/agents/providers/hermes.mjs +7 -13
  202. package/tools/agents/providers/muse-hooks.mjs +21 -14
  203. package/tools/agents/providers/muse.mjs +7 -2
  204. package/tools/agents/providers/omp.mjs +28 -4
  205. package/tools/agents/providers/opencode.mjs +14 -5
  206. package/tools/agents/providers/openhuman.mjs +1 -1
  207. package/tools/agents/providers/pi.mjs +1 -1
  208. package/tools/agents/providers/provider-prepare-coordinator.mjs +29 -9
  209. package/tools/agents/providers/rule-delivery.mjs +263 -71
  210. package/tools/agents/providers/windsurf.mjs +7 -0
  211. package/tools/cli/workspace-status.mjs +5 -0
  212. package/tools/commands/deploy-prompts-codex.mjs +11 -8
  213. package/tools/ralph-external/lib/codex-adapter.mjs +6 -2
  214. package/tools/ralph-external/lib/muse-adapter.mjs +12 -2
  215. package/tools/ralph-external/lib/worker-health.mjs +1 -1
  216. package/tools/ralph-external/lib/worker-isolation.mjs +65 -9
  217. package/tools/ralph-external/process-monitor.mjs +7 -4
  218. package/tools/ralph-external/session-launcher.mjs +280 -32
  219. package/tools/skills/deploy-skills-codex.mjs +11 -7
  220. package/vscode-extension/schemas/aiwg.config.v1.json +11 -1
@@ -43,6 +43,7 @@ import { detectScope, mirrorToUserScope, rejectOpenClawProjectScope, USER_SCOPE_
43
43
  import { maybeWarnProjectIsolation } from '../project-isolation/index.js';
44
44
  import { formatWorkspaceSignalPlan, includedBundleIds, resolveWorkspaceSignalPlan, writeWorkspaceSignalPlan, } from '../workspace-signals.js';
45
45
  import { getProviderArtifactPathStrings, getProviderDefinition, getProviderKernelSkillPath, normalizeProviderDefinitionId, } from '../../providers/provider-definitions.js';
46
+ import { resolveDeployVersion } from '../../providers/deploy-version.mjs';
46
47
  import { deployedSkillRoots } from '../../providers/deployed-skill-roots.js';
47
48
  // Module-level guard so the iteration loops further down (which re-enter
48
49
  // execute() per framework/provider) don't re-emit the warning each pass.
@@ -152,10 +153,11 @@ const MODEL_OVERRIDE_VALUE_FLAGS = new Set([
152
153
  '--model', '--reasoning-model', '--coding-model', '--efficiency-model', '--model-tier',
153
154
  ]);
154
155
  const MODEL_DEPLOY_BOOLEAN_FLAGS = new Set(['--save', '--save-user']);
155
- /** Forward explicit user scope to every provider deploy subprocess. */
156
+ /** Forward explicit scope to every provider deploy subprocess. */
156
157
  export function collectUseScopeDeployArgs(args) {
157
158
  const scope = detectScope(args);
158
- return scope === 'user' || args.includes('--user') ? ['--scope', 'user'] : [];
159
+ return scope === 'user' || args.includes('--user') ? ['--scope', 'user']
160
+ : args.includes('--scope') ? ['--scope', 'project'] : [];
159
161
  }
160
162
  export function collectUseModelDeployArgs(args) {
161
163
  const forwarded = [];
@@ -410,7 +412,7 @@ export function addonPath(frameworkRoot, name) {
410
412
  * this only suppresses redundant deploy-agents subprocesses.
411
413
  */
412
414
  export function mainDeploymentIncludesAddons(provider, selectedMode, providerDeployArgs) {
413
- return (((provider === 'claude' || provider === 'pi')
415
+ return (((provider === 'claude' || provider === 'pi' || provider === 'omp')
414
416
  && ['general', 'sdlc', 'both', 'all'].includes(selectedMode))
415
417
  || (provider === 'codex' && selectedMode === 'all'))
416
418
  && !providerDeployArgs.some(arg => arg === '--source' || arg.startsWith('--source='))
@@ -628,7 +630,7 @@ async function mirrorStandardCommandSkills(opts) {
628
630
  projectPath: opts.target,
629
631
  dryRun: opts.dryRun,
630
632
  verbose: opts.verbose,
631
- deployVersion: (await getVersionInfo()).version,
633
+ deployVersion: deploymentVersion(opts.frameworkRoot),
632
634
  nameFilter: shouldMirrorStandardCommandSkill,
633
635
  });
634
636
  count += result.translated.length;
@@ -1326,7 +1328,7 @@ async function deployOneProjectLocalBundle(opts) {
1326
1328
  }
1327
1329
  let exitCode = 0;
1328
1330
  if (artifactTotal > 0) {
1329
- const runner = createScriptRunner(frameworkRoot);
1331
+ const runner = createUseScriptRunner(frameworkRoot);
1330
1332
  const args = [
1331
1333
  '--source', bundle.artifactPath,
1332
1334
  '--deploy-commands', '--deploy-skills', '--deploy-rules',
@@ -1622,6 +1624,101 @@ const USE_FLAGS_WITH_VALUES = new Set([
1622
1624
  '--scope',
1623
1625
  '--target',
1624
1626
  ]);
1627
+ // Public use options, including supported deployer passthroughs. Value flags
1628
+ // also drive positional parsing, so option values cannot become bundle names.
1629
+ for (const flag of [...MODEL_DEPLOY_VALUE_FLAGS, '--reasoning', '--coding', '--efficiency']) {
1630
+ USE_FLAGS_WITH_VALUES.add(flag);
1631
+ }
1632
+ const USE_BOOLEAN_FLAGS = new Set([
1633
+ '--force', '--copy-all', '--copy-standard-skills', '--dry-run', '--verbose', '-v', '--quiet', '-q',
1634
+ '--json', '--no-project-local', '--no-context-files', '--no-workspace-md',
1635
+ '--no-aiwg-md', '--no-agents-md', '--force-context-files', '--global', '--user',
1636
+ '--no-utils', '--ci-hooks-enabled', '--skip-conflicts', '--no-harness-agents',
1637
+ '--workspace-signals', '--no-workspace-signals', '--yes', '-y', '--non-interactive',
1638
+ '--allow-over-budget', '--no-hooks', '--enable-cross-provider-hooks',
1639
+ '--skip-commands-migration', '--listing-budget', '--mcp', '--as-agents-md',
1640
+ '--create-agents-md', '--commands-only', '--skills-only', '--rules-only',
1641
+ '--save', '--save-user', '--help', '-h',
1642
+ ]);
1643
+ export function validateUseOptions(args, preparedCapabilities = new Set()) {
1644
+ for (let i = 0; i < args.length; i++) {
1645
+ const arg = args[i];
1646
+ if (arg === '--aiwg-provider-main-prepared' && preparedCapabilities.has(args[i + 1])) {
1647
+ i++;
1648
+ continue;
1649
+ }
1650
+ if (USE_FLAGS_WITH_VALUES.has(arg)) {
1651
+ if (!args[i + 1] || args[i + 1].startsWith('-'))
1652
+ return `Missing value for option '${arg}'. See aiwg use --help.`;
1653
+ i++;
1654
+ }
1655
+ else if (arg.startsWith('-') && !USE_BOOLEAN_FLAGS.has(arg)) {
1656
+ return `Unknown option '${arg}'. See aiwg use --help.`;
1657
+ }
1658
+ }
1659
+ return undefined;
1660
+ }
1661
+ /** Pi's agent discovery path doubles as its kernel skill directory. */
1662
+ export async function countPiAgentFiles(target, agentsPath) {
1663
+ if (!agentsPath)
1664
+ return 0;
1665
+ try {
1666
+ const dir = path.isAbsolute(agentsPath) ? agentsPath : path.join(target, agentsPath);
1667
+ const entries = await fs.readdir(dir, { withFileTypes: true });
1668
+ return entries.filter(entry => entry.isFile() && entry.name.endsWith('.md')).length;
1669
+ }
1670
+ catch {
1671
+ return 0;
1672
+ }
1673
+ }
1674
+ // Capture provider previews here: their staging summaries count source entries,
1675
+ // and additive passes can describe the same destination more than once.
1676
+ let usePreviewActions;
1677
+ // Recursive framework/addon/provider passes share the boundary's resolved policy.
1678
+ let useDeployment;
1679
+ function useDeploymentArgs(args) {
1680
+ const forwarded = [...args];
1681
+ if (useDeployment && !forwarded.includes('--deploy-version'))
1682
+ forwarded.push('--deploy-version', useDeployment.version);
1683
+ if (useDeployment?.skipContextFiles && !forwarded.includes('--no-context-files'))
1684
+ forwarded.push('--no-context-files');
1685
+ return forwarded;
1686
+ }
1687
+ function deploymentVersion(root) {
1688
+ return useDeployment?.version ?? resolveDeployVersion(root);
1689
+ }
1690
+ function createUseScriptRunner(frameworkRoot) {
1691
+ const runner = createScriptRunner(frameworkRoot);
1692
+ return {
1693
+ async run(script, args, options = {}) {
1694
+ if (script === 'tools/agents/deploy-agents.mjs')
1695
+ args = useDeploymentArgs(args);
1696
+ if (!usePreviewActions)
1697
+ return runner.run(script, args, options);
1698
+ const scratch = await fs.mkdtemp(path.join(os.tmpdir(), 'aiwg-use-preview-'));
1699
+ const removeScratch = trackTemporaryDirectory(scratch);
1700
+ const stdoutFile = await fs.open(path.join(scratch, 'stdout'), 'w+');
1701
+ try {
1702
+ // Keep the shared runner's timeout/error handling and injectable
1703
+ // execution boundary; capture only this invocation's stdout to disk.
1704
+ const result = await runner.run(script, args, { ...options, capture: true, stdoutFd: stdoutFile.fd });
1705
+ const stdout = await fs.readFile(path.join(scratch, 'stdout'), 'utf8');
1706
+ for (const line of stdout.split(/\r?\n/)) {
1707
+ if (/^\[dry-run\] Would (write|remove|deploy|copy|create) /i.test(line))
1708
+ usePreviewActions.add(line);
1709
+ }
1710
+ return result;
1711
+ }
1712
+ catch (error) {
1713
+ return { exitCode: 1, message: error instanceof Error ? error.message : String(error) };
1714
+ }
1715
+ finally {
1716
+ await stdoutFile.close();
1717
+ removeScratch();
1718
+ }
1719
+ },
1720
+ };
1721
+ }
1625
1722
  export const OPENHUMAN_DEFAULT_HARNESS_AGENTS = [
1626
1723
  'architecture-designer',
1627
1724
  'code-reviewer',
@@ -2013,6 +2110,8 @@ async function generateGlobalProjectContext(opts) {
2013
2110
  if (!userPaths)
2014
2111
  return;
2015
2112
  const skipContext = opts.args.includes('--no-context-files');
2113
+ if (skipContext)
2114
+ return;
2016
2115
  const sections = await discoverDeployedArtifacts(opts.projectPath, {
2017
2116
  agents: userPaths.agents,
2018
2117
  rules: userPaths.rules,
@@ -2120,9 +2219,11 @@ async function deploySourceDirectory(opts) {
2120
2219
  args.push('--copy-all');
2121
2220
  if (opts.kernelOnly)
2122
2221
  args.push('--kernel-only');
2222
+ if (opts.deferRuleProjection)
2223
+ args.push('--defer-rule-projection');
2123
2224
  if (opts.quiet)
2124
2225
  args.unshift('--quiet');
2125
- const runner = createScriptRunner(opts.frameworkRoot);
2226
+ const runner = createUseScriptRunner(opts.frameworkRoot);
2126
2227
  const result = await runner.run('tools/agents/deploy-agents.mjs', args, opts.quiet ? { capture: true } : {});
2127
2228
  if (result.exitCode === 0 && !opts.kernelOnly) {
2128
2229
  try {
@@ -2207,7 +2308,7 @@ async function deployOmpUserSource(opts) {
2207
2308
  const adapter = await import(pathToFileURL(path.join(opts.frameworkRoot, 'tools/agents/providers/omp.mjs')).href);
2208
2309
  await adapter.deploy({ srcRoot: opts.source, target: opts.target, provider: 'omp', scope: 'user',
2209
2310
  mode: opts.mode ?? 'general', deployCommands: true, deploySkills: true, deployRules: true,
2210
- copyStandardSkills: opts.copyAll, quiet: true, deployVersion: (await getVersionInfo()).version });
2311
+ copyStandardSkills: opts.copyAll, quiet: true, contextFiles: !useDeployment?.skipContextFiles, deployVersion: deploymentVersion(opts.frameworkRoot) });
2211
2312
  const sourceBundles = new Set([opts.source]);
2212
2313
  const { resourceDirs } = resolveOmpPaths({ cwd: opts.target });
2213
2314
  const entries = {
@@ -2359,7 +2460,7 @@ const USE_HELP = `Usage: aiwg use <bundle> [options]
2359
2460
  Deploy an AIWG framework, addon, or extension into the current project.
2360
2461
 
2361
2462
  Bundles:
2362
- all Kernel surface only (kernel skills, rules, behaviors)
2463
+ all Kernel surface only (kernel skills, kernel and core rules, behaviors)
2363
2464
  sdlc | research | ops | forensics | marketing | media-curator | ...
2364
2465
  Full framework surface (agents, commands, skills, rules)
2365
2466
  <addon> | <extension> Any installed addon or extension name
@@ -2371,15 +2472,56 @@ Options:
2371
2472
  --force Re-write every artifact, replacing files AIWG does
2372
2473
  not currently manage. Use this to reclaim a
2373
2474
  directory left behind by an older AIWG install.
2374
- --copy-all Mirror standard-tier skills into the project instead
2375
- of relying on index-driven discovery
2475
+ --copy-all Mirror standard-tier skills into the project; for
2476
+ all, restore the full agent, command and rule surface
2376
2477
  --dry-run Preview the deployment without writing files
2478
+ --quiet, -q Suppress deployer progress output
2377
2479
  --verbose, -v Show per-artifact deploy decisions
2378
2480
  --json Emit the machine-readable deployment result
2379
2481
  --no-project-local Skip project-local bundles under .aiwg/
2380
- --no-context-files Skip WORKSPACE.md / AIWG.md / AGENTS.md emission
2482
+ --no-context-files Preserve WORKSPACE.md / AIWG.md / AGENTS.md, including managed blocks
2381
2483
  -h, --help Show this help without deploying
2382
2484
 
2485
+ Additional options:
2486
+ --platform <name> Alias for --provider
2487
+ --providers <a,b> Providers for global bootstrap
2488
+ --prefix <dir> Alias for --target
2489
+ --global, --user Install to user scope
2490
+ --copy-standard-skills Alias for --copy-all (also restores the full surface)
2491
+ --profile <name> Select workspace profile (implicit target: all)
2492
+ --workspace-signals Show the workspace signal plan
2493
+ --no-workspace-signals Skip workspace signal resolution
2494
+ --model <name>, --model-tier <tier>
2495
+ --reasoning-model <name>, --coding-model <name>, --efficiency-model <name>
2496
+ --reasoning <name>, --coding <name>, --efficiency <name>
2497
+ Override deployer model selection
2498
+ --filter <glob>, --filter-role <role>
2499
+ Filter deployed agents
2500
+ --save, --save-user Persist model selection
2501
+ --no-utils Skip additive addon and extension passes
2502
+ --no-workspace-md, --no-aiwg-md, --no-agents-md
2503
+ Suppress individual context files
2504
+ --force-context-files Replace context files
2505
+ --no-hooks Skip managed hooks
2506
+ --enable-cross-provider-hooks
2507
+ Enable cross-provider hooks
2508
+ --ci-hooks-enabled Deploy CI workflows
2509
+ --skip-conflicts Skip the collision check
2510
+ --allow-over-budget Allow oversized startup context
2511
+ --harness-agents <list>, --no-harness-agents
2512
+ Select OpenHuman harness agents
2513
+ --skip-commands-migration Skip commands migration
2514
+ --listing-budget Honor startup listing caps with --copy-all
2515
+ --mcp Opt in to the Muse MCP profile
2516
+ --as-agents-md, --create-agents-md
2517
+ Select Codex context aggregation
2518
+ --commands-only, --skills-only, --rules-only
2519
+ Limit artifact kinds
2520
+ --yes, -y, --non-interactive
2521
+ Allow unattended setup
2522
+
2523
+ Source installs are detected automatically; no development flag is needed.
2524
+
2383
2525
  Deployment counts report what the run wrote or already manages. Files AIWG does
2384
2526
  not own are listed separately as unmanaged and are never counted as deployed.
2385
2527
  `;
@@ -2395,6 +2537,30 @@ export class UseHandler {
2395
2537
  return { exitCode: 0, message: USE_HELP, rawOutput: true };
2396
2538
  }
2397
2539
  async execute(ctx) {
2540
+ const invalidOption = validateUseOptions(ctx.args, this.preparedProviderContinuations);
2541
+ if (invalidOption)
2542
+ return { exitCode: 2, message: invalidOption };
2543
+ const previousDeployment = useDeployment;
2544
+ useDeployment = {
2545
+ version: previousDeployment?.version ?? resolveDeployVersion(ctx.frameworkRoot || await getFrameworkRoot()),
2546
+ skipContextFiles: previousDeployment?.skipContextFiles || ctx.args.includes('--no-context-files'),
2547
+ };
2548
+ try {
2549
+ return await this.executeDeployment(ctx);
2550
+ }
2551
+ finally {
2552
+ useDeployment = previousDeployment;
2553
+ }
2554
+ }
2555
+ async executeDeployment(ctx) {
2556
+ // Normalize the physical framework directory just as addon folder aliases
2557
+ // are normalized, before orchestration/registry bookkeeping sees the name.
2558
+ const aliasIndex = ctx.args.indexOf('sdlc-complete');
2559
+ if (firstUsePositional(ctx.args) === 'sdlc-complete' && aliasIndex >= 0) {
2560
+ const args = [...ctx.args];
2561
+ args[aliasIndex] = 'sdlc';
2562
+ ctx = { ...ctx, args };
2563
+ }
2398
2564
  const requestedBundle = firstUsePositional(ctx.args)
2399
2565
  ?? (ctx.args[0] === '--profile' ? 'all' : undefined);
2400
2566
  const bypassOrchestration = this.orchestrationDepth > 0
@@ -2403,9 +2569,9 @@ export class UseHandler {
2403
2569
  || ctx.args.includes('--workspace-signals');
2404
2570
  if (bypassOrchestration)
2405
2571
  return this.executeCore(ctx);
2406
- // Child deployers share one source-index snapshot for this invocation. Each
2407
- // addon still resolves and validates its bindings through the common query
2408
- // engine, without rebuilding the entire corpus on every additive pass.
2572
+ // Projectors share one source-index snapshot for this invocation. Full
2573
+ // addon passes validate their bindings through the common query engine;
2574
+ // deferred kernel passes leave the shared rule set to the final projector.
2409
2575
  const previousBindingCache = process.env.AIWG_RULE_BINDING_INDEX_CACHE;
2410
2576
  const bindingCache = previousBindingCache || await fs.mkdtemp(path.join(os.tmpdir(), 'aiwg-use-bindings-'));
2411
2577
  const removeBindingCache = previousBindingCache ? () => { } : trackTemporaryDirectory(bindingCache);
@@ -2457,8 +2623,13 @@ export class UseHandler {
2457
2623
  warn: console.warn,
2458
2624
  error: console.error,
2459
2625
  };
2460
- if (json) {
2461
- machineReadableUseDepth += 1;
2626
+ const previewActions = dryRun ? new Set() : undefined;
2627
+ const previousPreview = usePreviewActions;
2628
+ if (previewActions)
2629
+ usePreviewActions = previewActions;
2630
+ if (json || dryRun) {
2631
+ if (!dryRun)
2632
+ machineReadableUseDepth += 1;
2462
2633
  console.log = () => { };
2463
2634
  console.info = () => { };
2464
2635
  console.warn = () => { };
@@ -2469,8 +2640,10 @@ export class UseHandler {
2469
2640
  coreResult = await this.executeCore({ ...ctx, args: coreArgs });
2470
2641
  }
2471
2642
  finally {
2472
- if (json) {
2473
- machineReadableUseDepth -= 1;
2643
+ usePreviewActions = previousPreview;
2644
+ if (json || dryRun) {
2645
+ if (!dryRun)
2646
+ machineReadableUseDepth -= 1;
2474
2647
  console.log = originalConsole.log;
2475
2648
  console.info = originalConsole.info;
2476
2649
  console.warn = originalConsole.warn;
@@ -2528,7 +2701,7 @@ export class UseHandler {
2528
2701
  originalConsole.warn(`Provider receipt finalization failed for ${provider}: ${error instanceof Error ? error.message : String(error)}`);
2529
2702
  }
2530
2703
  }
2531
- providerResults.push(await verifyProviderDeployment({
2704
+ const verified = await verifyProviderDeployment({
2532
2705
  projectRoot: projectDir,
2533
2706
  frameworkRoot,
2534
2707
  provider,
@@ -2542,7 +2715,14 @@ export class UseHandler {
2542
2715
  // yet, so receipt absence belongs in doctor/status rather than
2543
2716
  // degrading an otherwise successful `aiwg use` result.
2544
2717
  reportMissingReceipt: false,
2545
- }));
2718
+ });
2719
+ // Pi exposes agents through skills. The shared verifier counts skill
2720
+ // directories at that path as agents; report only actual agent files.
2721
+ if (provider === 'pi') {
2722
+ const paths = effectiveScope === 'user' ? USER_SCOPE_PATHS.pi : getProviderPaths(provider);
2723
+ verified.counts.agents = await countPiAgentFiles(projectDir, paths.agents);
2724
+ }
2725
+ providerResults.push(verified);
2546
2726
  }
2547
2727
  result = aggregateUseDeploymentResult({
2548
2728
  projectRoot: projectDir,
@@ -2580,7 +2760,7 @@ export class UseHandler {
2580
2760
  });
2581
2761
  return {
2582
2762
  exitCode: result.exitCode,
2583
- message: [coreResult.message, rendered].filter(Boolean).join('\n'),
2763
+ message: [coreResult.message, rendered, ...(previewActions ? [...previewActions].sort() : [])].filter(Boolean).join('\n'),
2584
2764
  };
2585
2765
  }
2586
2766
  async executeCore(ctx) {
@@ -2728,6 +2908,14 @@ export class UseHandler {
2728
2908
  : null;
2729
2909
  const projectDir = getProjectDir(ctx, remainingArgs);
2730
2910
  let config = await readAiwgConfig(projectDir);
2911
+ if (detectScope(remainingArgs) === 'project' && remainingArgs.includes('--scope')) {
2912
+ for (const requested of configuredGlobalProviders(remainingArgs, config)) {
2913
+ const resolved = await resolveProjectLocalProviderAdapter(projectDir, requested);
2914
+ if (normalizeProviderDefinitionId(resolved.provider) === 'hermes') {
2915
+ return { exitCode: 1, message: "Hermes does not support --scope project: it discovers skills only under HERMES_HOME/skills (default ~/.hermes/skills). Use --scope user or an isolated HERMES_HOME profile shared with Hermes." };
2916
+ }
2917
+ }
2918
+ }
2731
2919
  // Auto-init when no config found (#720)
2732
2920
  // Check early for --provider/--platform and --providers flags
2733
2921
  const _providerFlagIdx = remainingArgs.findIndex(a => a === '--provider' || a === '--platform');
@@ -2766,7 +2954,9 @@ export class UseHandler {
2766
2954
  }
2767
2955
  else if (process.stdin.isTTY) {
2768
2956
  // Interactive terminal with no config → run init wizard inline (#720)
2769
- const initResult = await initHandler.execute({ ...ctx, args: [] });
2957
+ const initResult = await initHandler.execute({ ...ctx,
2958
+ args: remainingArgs.includes('--no-context-files') ? ['--no-context-files'] : [],
2959
+ });
2770
2960
  if (initResult.exitCode !== 0)
2771
2961
  return initResult;
2772
2962
  config = await readAiwgConfig(projectDir);
@@ -2780,7 +2970,7 @@ export class UseHandler {
2780
2970
  : '';
2781
2971
  return {
2782
2972
  exitCode: 1,
2783
- message: `Error: Framework, addon, or extension name required\nFrameworks: sdlc, marketing, media-curator, research, forensics, dfir, security-engineering, ops, validation, knowledge-base, all\nAddons: rlm, ring, daemon, aiwg-dev (full list: \`aiwg list\`)\nExtensions: sys, net, it, sec, stream, dev (full list: \`ls $AIWG_ROOT/agentic/code/extensions\`)\n'all' deploys every framework + every addon + every extension.${advisory}`,
2973
+ message: `Error: Framework, addon, or extension name required\nFrameworks: sdlc, marketing, media-curator, research, forensics, dfir, security-engineering, ops, validation, knowledge-base, all\nAddons: rlm, ring, daemon, aiwg-dev (full list: \`aiwg list\`)\nExtensions: sys, net, it, sec, stream, dev (full list: \`ls $AIWG_ROOT/agentic/code/extensions\`)\n'all' deploys the kernel surface (kernel skills, kernel and core rules, behaviors).${advisory}`,
2784
2974
  };
2785
2975
  }
2786
2976
  const installedNames = Object.keys(config.installed);
@@ -2843,50 +3033,19 @@ export class UseHandler {
2843
3033
  ui.dim(' Use `aiwg use all` for the full deployment.');
2844
3034
  for (const providerName of providersForFiltered) {
2845
3035
  const kernelOnly = !copyAll;
2846
- for (const selected of selectedFrameworks) {
2847
- const frameworkDir = resolveFrameworkDir(selected);
2848
- if (!frameworkDir)
2849
- continue;
2850
- const result = await deploySourceDirectory({
2851
- ctx,
2852
- frameworkRoot,
2853
- source: path.join(frameworkRoot, 'agentic/code/frameworks', frameworkDir),
2854
- provider: providerName,
2855
- target,
2856
- dryRun,
2857
- verbose,
2858
- force,
2859
- copyAll,
2860
- kernelOnly,
2861
- quiet,
2862
- modelArgs: modelDeployArgs,
2863
- });
2864
- if (result.exitCode !== 0)
2865
- return result;
2866
- }
2867
- for (const selected of selectedAddons) {
2868
- const result = await deploySourceDirectory({
2869
- ctx,
2870
- frameworkRoot,
2871
- source: addonPath(frameworkRoot, selected),
2872
- provider: providerName,
2873
- target,
2874
- dryRun,
2875
- verbose,
2876
- force,
2877
- copyAll,
2878
- kernelOnly,
2879
- quiet,
2880
- modelArgs: modelDeployArgs,
2881
- });
2882
- if (result.exitCode !== 0)
2883
- return result;
2884
- }
2885
- for (const selected of selectedExtensions) {
3036
+ const sources = [
3037
+ ...selectedFrameworks.flatMap(selected => {
3038
+ const directory = resolveFrameworkDir(selected);
3039
+ return directory ? [path.join(frameworkRoot, 'agentic/code/frameworks', directory)] : [];
3040
+ }),
3041
+ ...selectedAddons.map(selected => addonPath(frameworkRoot, selected)),
3042
+ ...selectedExtensions.map(selected => extensionPath(frameworkRoot, selected)),
3043
+ ];
3044
+ for (const [index, source] of sources.entries()) {
2886
3045
  const result = await deploySourceDirectory({
2887
3046
  ctx,
2888
3047
  frameworkRoot,
2889
- source: extensionPath(frameworkRoot, selected),
3048
+ source,
2890
3049
  provider: providerName,
2891
3050
  target,
2892
3051
  dryRun,
@@ -2894,6 +3053,10 @@ export class UseHandler {
2894
3053
  force,
2895
3054
  copyAll,
2896
3055
  kernelOnly,
3056
+ // Kernel rule selection is invocation-wide, independent of the
3057
+ // source bundle. The last pass projects once over all deployed
3058
+ // skills, including their bound-rule pointers and startup blocks.
3059
+ deferRuleProjection: kernelOnly && index < sources.length - 1,
2897
3060
  quiet,
2898
3061
  modelArgs: modelDeployArgs,
2899
3062
  });
@@ -3086,7 +3249,7 @@ export class UseHandler {
3086
3249
  }
3087
3250
  return {
3088
3251
  exitCode: 1,
3089
- message: `Error: Unknown target '${framework}'\nFrameworks: ${VALID_FRAMEWORKS.join(', ')}\n\n'all' deploys every framework + every addon + every extension.\nFor a single addon, run 'aiwg list' to see available addons.\nFor extensions (sys, net, it, sec, stream, dev), see $AIWG_ROOT/agentic/code/extensions/.\nFor project-local artifacts, run 'aiwg list --project-local'.\nRun 'aiwg help' for usage information.`,
3252
+ message: `Error: Unknown target '${framework}'\nFrameworks: ${VALID_FRAMEWORKS.join(', ')}\n\n'all' deploys the kernel surface (kernel skills, kernel and core rules, behaviors).\nFor a single addon, run 'aiwg list' to see available addons.\nFor extensions (sys, net, it, sec, stream, dev), see $AIWG_ROOT/agentic/code/extensions/.\nFor project-local artifacts, run 'aiwg list --project-local'.\nRun 'aiwg help' for usage information.`,
3090
3253
  };
3091
3254
  }
3092
3255
  // Handle addon-only or extension-only deployment.
@@ -3113,7 +3276,7 @@ export class UseHandler {
3113
3276
  message: `--scope user not supported for provider '${provider}' — see docs/customization/user-scope-deployment.md for the supported list`,
3114
3277
  };
3115
3278
  }
3116
- const runner = createScriptRunner(frameworkRoot);
3279
+ const runner = createUseScriptRunner(frameworkRoot);
3117
3280
  const addonBaseArgs = ['--deploy-commands', '--deploy-skills', '--deploy-rules'];
3118
3281
  if (remainingArgs.includes('--allow-over-budget'))
3119
3282
  addonBaseArgs.push('--allow-over-budget');
@@ -3422,8 +3585,8 @@ export class UseHandler {
3422
3585
  const filteredArgs = removeFlagWithOptionalValue(deployArgs, preparedFlag).filter(a => a !== '--no-utils' && a !== '--no-project-local' && a !== '--ci-hooks-enabled' && a !== '--skip-conflicts' && a !== '--no-harness-agents');
3423
3586
  const deployFilteredArgs = removeFlagWithOptionalValue(filteredArgs, '--harness-agents');
3424
3587
  // Pass --quiet to suppress deploy-agents.mjs header/footer in default mode (#460)
3425
- // Human dry-run remains verbose; machine-readable dry-run captures the
3426
- // preview so stdout stays a single JSON document.
3588
+ // Dry-run action output is captured and consolidated at the use boundary;
3589
+ // keep it available to the collector rather than silencing child plans.
3427
3590
  if (machineReadableUseDepth > 0 || (!verbose && !dryRun))
3428
3591
  deployFilteredArgs.push('--quiet');
3429
3592
  // Extract provider and target from remainingArgs to pass to addon deployments
@@ -3467,10 +3630,17 @@ export class UseHandler {
3467
3630
  canPrepareConcurrently = false;
3468
3631
  break;
3469
3632
  }
3470
- const args = withProviderOverride([...deployFilteredArgs], resolved.provider);
3471
- if (framework === 'all' && !['pi', 'omp'].includes(resolved.provider)
3472
- && !remainingArgs.includes('--copy-all') && !remainingArgs.includes('--copy-standard-skills'))
3473
- args.push('--kernel-only');
3633
+ const args = useDeploymentArgs(withProviderOverride([...deployFilteredArgs], resolved.provider));
3634
+ if (framework === 'all') {
3635
+ const kernelOnly = !['pi', 'omp'].includes(resolved.provider)
3636
+ && !remainingArgs.includes('--copy-all') && !remainingArgs.includes('--copy-standard-skills');
3637
+ if (kernelOnly)
3638
+ args.push('--kernel-only');
3639
+ if (!skipUtils && ((!kernelOnly && (await getAllExtensions(frameworkRoot)).length > 0)
3640
+ || (!mainDeploymentIncludesAddons(resolved.provider, mode, args) && (await getAllAddons(frameworkRoot)).length > 0))) {
3641
+ args.push('--defer-rule-projection');
3642
+ }
3643
+ }
3474
3644
  preparedJobs.push({ order, provider: resolved.provider, target: path.resolve(target), args });
3475
3645
  }
3476
3646
  if (canPrepareConcurrently && preparedJobs.length === providers.length) {
@@ -3539,6 +3709,21 @@ export class UseHandler {
3539
3709
  && !remainingArgs.includes('--copy-standard-skills');
3540
3710
  if (bulkKernelOnly)
3541
3711
  providerDeployArgs.push('--kernel-only');
3712
+ const allAddons = skipUtils ? [] : await getAllAddons(frameworkRoot);
3713
+ const allExtensions = skipUtils || bulkKernelOnly ? [] : await getAllExtensions(frameworkRoot);
3714
+ const mainIncludesAddons = mainDeploymentIncludesAddons(provider, mode, providerDeployArgs);
3715
+ // OMP's extension sources share the root transaction and binding scan.
3716
+ // Their CLI contributions are still registered below in source order.
3717
+ const batchedOmpExtensions = provider === 'omp' && mainIncludesAddons ? allExtensions : [];
3718
+ for (const extension of batchedOmpExtensions) {
3719
+ providerDeployArgs.push('--additional-source', extensionPath(frameworkRoot, extension));
3720
+ }
3721
+ const additiveSources = (mainIncludesAddons ? 0 : allAddons.length)
3722
+ + allExtensions.length - batchedOmpExtensions.length;
3723
+ // Keep the final source's rule selection and presentation, while earlier
3724
+ // full-surface passes still deploy their own agents/skills/flow resources.
3725
+ if (framework === 'all' && additiveSources > 0)
3726
+ providerDeployArgs.push('--defer-rule-projection');
3542
3727
  if ((verbose || dryRun) && projectLocalProviderResolution.requestedProvider) {
3543
3728
  ui.dim(` project-local provider '${projectLocalProviderResolution.requestedProvider}' extends '${provider}'`);
3544
3729
  }
@@ -3619,18 +3804,18 @@ export class UseHandler {
3619
3804
  const captureOpts = quiet ? { capture: true } : {};
3620
3805
  if (quiet) {
3621
3806
  const installLabel = framework === 'all'
3622
- ? 'Installing complete AIWG surface'
3807
+ ? (bulkKernelOnly ? 'Installing AIWG kernel surface' : 'Installing full AIWG surface')
3623
3808
  : `Installing ${framework} framework`;
3624
3809
  const providerLabel = getProviderDefinition(provider)?.displayName ?? provider;
3625
3810
  ui.blank();
3626
3811
  console.log(` ${ui.brandMark()} ${ui.bold(installLabel)} ${ui.dimText(`for ${providerLabel}`)}`);
3627
3812
  ui.blank();
3628
3813
  }
3629
- const runner = createScriptRunner(ctx.frameworkRoot);
3814
+ const runner = createUseScriptRunner(ctx.frameworkRoot);
3630
3815
  let mainResult;
3631
3816
  if (mainProviderPrepared) {
3632
3817
  try {
3633
- await finalizePreparedProvider(frameworkRoot, providerDeployArgs);
3818
+ await finalizePreparedProvider(frameworkRoot, useDeploymentArgs(providerDeployArgs));
3634
3819
  mainResult = { exitCode: 0 };
3635
3820
  }
3636
3821
  catch (error) {
@@ -3690,14 +3875,11 @@ export class UseHandler {
3690
3875
  }
3691
3876
  // Deploy all addons (excluding disallow list) unless --no-utils
3692
3877
  if (!skipUtils) {
3693
- const allAddons = await getAllAddons(frameworkRoot);
3694
3878
  // These root collectors already deploy every eligible addon. Re-staging
3695
3879
  // the entire deployment per addon duplicates that work. Codex's skills
3696
3880
  // helper includes addons only in all mode; other modes retain their pass.
3697
3881
  // CLI contribution registration below still runs for every addon.
3698
- const selectedMode = MODE_MAP[framework];
3699
- const mainIncludesAddons = mainDeploymentIncludesAddons(provider, selectedMode, providerDeployArgs);
3700
- for (const addon of allAddons) {
3882
+ for (const [index, addon] of allAddons.entries()) {
3701
3883
  if (verbose) {
3702
3884
  console.log('');
3703
3885
  console.log(`Deploying ${addon} addon...`);
@@ -3706,6 +3888,9 @@ export class UseHandler {
3706
3888
  const addonArgs = quiet
3707
3889
  ? ['--quiet', '--source', source, ...addonBaseArgs]
3708
3890
  : ['--source', source, ...addonBaseArgs];
3891
+ if (framework === 'all' && (allExtensions.length > 0 || index < allAddons.length - 1)) {
3892
+ addonArgs.push('--defer-rule-projection');
3893
+ }
3709
3894
  if (!mainIncludesAddons) {
3710
3895
  const result = await runner.run('tools/agents/deploy-agents.mjs', addonArgs, captureOpts);
3711
3896
  if (result.exitCode !== 0)
@@ -3727,10 +3912,9 @@ export class UseHandler {
3727
3912
  // Deploy all extensions from agentic/code/extensions/* (#1222).
3728
3913
  // Extensions are addon-shaped bundles (manifest type: "addon") that live
3729
3914
  // in a separate top-level dir to keep ops/sysops/itops/devops grouped.
3730
- // `aiwg use all` was previously silent about them, leaving 6 extension
3731
- // bundles undeployed even when the user explicitly asked for everything.
3732
- const allExtensions = await getAllExtensions(frameworkRoot);
3733
- for (const ext of allExtensions) {
3915
+ // Kernel mode projects its shared rule set on the final framework/addon
3916
+ // pass. Extension-only passes would repeat that same surface.
3917
+ for (const [index, ext] of allExtensions.entries()) {
3734
3918
  if (verbose) {
3735
3919
  console.log('');
3736
3920
  console.log(`Deploying ${ext} extension...`);
@@ -3739,9 +3923,12 @@ export class UseHandler {
3739
3923
  const extArgs = quiet
3740
3924
  ? ['--quiet', '--source', source, ...addonBaseArgs]
3741
3925
  : ['--source', source, ...addonBaseArgs];
3742
- const result = await runner.run('tools/agents/deploy-agents.mjs', extArgs, captureOpts);
3743
- if (result.exitCode !== 0) {
3744
- return result;
3926
+ if (framework === 'all' && index < allExtensions.length - 1)
3927
+ extArgs.push('--defer-rule-projection');
3928
+ if (!batchedOmpExtensions.includes(ext)) {
3929
+ const result = await runner.run('tools/agents/deploy-agents.mjs', extArgs, captureOpts);
3930
+ if (result.exitCode !== 0)
3931
+ return result;
3745
3932
  }
3746
3933
  try {
3747
3934
  await registerSourceCliCommands({
@@ -3810,7 +3997,7 @@ export class UseHandler {
3810
3997
  projectPath: target,
3811
3998
  dryRun,
3812
3999
  verbose,
3813
- deployVersion: (await getVersionInfo()).version,
4000
+ deployVersion: deploymentVersion(frameworkRoot),
3814
4001
  });
3815
4002
  if (verbose && translationResult.translated.length > 0) {
3816
4003
  ui.success(`Translated ${translationResult.translated.length} skills → commands (${provider})`);
@@ -3861,7 +4048,7 @@ export class UseHandler {
3861
4048
  projectPath: target,
3862
4049
  dryRun,
3863
4050
  verbose,
3864
- deployVersion: (await getVersionInfo()).version,
4051
+ deployVersion: deploymentVersion(frameworkRoot),
3865
4052
  nameFilter: shouldMirrorKernelCommandSkill,
3866
4053
  });
3867
4054
  if (verbose && kernel.translated.length > 0) {
@@ -4177,11 +4364,10 @@ export class UseHandler {
4177
4364
  // failed deploys produce shorter indexes, never broken links.
4178
4365
  //
4179
4366
  // Operators opt out via --no-context-files / --no-aiwg-md / --no-agents-md.
4180
- if (!dryRun) {
4181
- const skipContext = remainingArgs.includes('--no-context-files');
4182
- const skipWorkspaceMd = skipContext || remainingArgs.includes('--no-workspace-md');
4183
- const skipAiwgMd = skipContext || remainingArgs.includes('--no-aiwg-md');
4184
- const skipAgentsMd = skipContext || remainingArgs.includes('--no-agents-md');
4367
+ if (!dryRun && !remainingArgs.includes('--no-context-files')) {
4368
+ const skipWorkspaceMd = remainingArgs.includes('--no-workspace-md');
4369
+ const skipAiwgMd = remainingArgs.includes('--no-aiwg-md');
4370
+ const skipAgentsMd = remainingArgs.includes('--no-agents-md');
4185
4371
  const forceContext = remainingArgs.includes('--force-context-files');
4186
4372
  try {
4187
4373
  const paths = getProviderPaths(provider);