@aiwg/cli 2026.11.5 → 2026.11.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 (150) hide show
  1. package/agentic/code/providers/model-capabilities.v1.json +9 -9
  2. package/bin/aiwg.mjs +6 -4
  3. package/dist/src/activity-log/cli.js +1 -1
  4. package/dist/src/agents/agent-deployer.js +1 -1
  5. package/dist/src/artifacts/audit/types.js +1 -1
  6. package/dist/src/artifacts/discover-facets.js +1 -1
  7. package/dist/src/artifacts/enrichment/prompt.js +1 -1
  8. package/dist/src/artifacts/enrichment/types.js +1 -1
  9. package/dist/src/artifacts/views/definition.js +1 -1
  10. package/dist/src/artifacts/views/types.js +1 -1
  11. package/dist/src/catalog/cli.js +1 -1
  12. package/dist/src/catalog/cli.mjs +1 -1
  13. package/dist/src/catalog/loader.js +1 -1
  14. package/dist/src/catalog/loader.mjs +1 -1
  15. package/dist/src/catalog/types.js +1 -1
  16. package/dist/src/cli/cli-extension-loader.js +19 -5
  17. package/dist/src/cli/cli-extension-paths.js +65 -0
  18. package/dist/src/cli/handlers/best-practices-audit.js +1 -1
  19. package/dist/src/cli/handlers/help.js +3 -4
  20. package/dist/src/cli/handlers/index.js +1 -1
  21. package/dist/src/cli/handlers/marketplace-plugin-search.js +37 -0
  22. package/dist/src/cli/handlers/marketplace.js +3 -1
  23. package/dist/src/cli/handlers/models.js +1 -1
  24. package/dist/src/cli/handlers/ralph-launcher.js +8 -2
  25. package/dist/src/cli/handlers/ralph.js +1 -1
  26. package/dist/src/cli/handlers/runtime-info.js +1 -1
  27. package/dist/src/cli/handlers/scaffolding.js +2 -2
  28. package/dist/src/cli/handlers/script-runner.js +1 -1
  29. package/dist/src/cli/handlers/sdlc-accelerate.js +1 -1
  30. package/dist/src/cli/handlers/subcommands-bundles.js +1 -1
  31. package/dist/src/cli/handlers/subcommands-list-format.js +19 -1
  32. package/dist/src/cli/handlers/types.js +1 -1
  33. package/dist/src/cli/handlers/use.js +2 -2
  34. package/dist/src/cli/handlers/utilities.js +1 -1
  35. package/dist/src/cli/handlers/version.js +1 -1
  36. package/dist/src/cli/handlers/workspace.js +1 -1
  37. package/dist/src/cli/help-generator.js +9 -11
  38. package/dist/src/cli/hooks/builtin/activity-log-hook.js +1 -1
  39. package/dist/src/cli/router.js +1 -1
  40. package/dist/src/cli/workflow-orchestrator.js +1 -1
  41. package/dist/src/config/worker-context.js +37 -7
  42. package/dist/src/config/worker-parallelism.js +11 -0
  43. package/dist/src/contributors/detect.js +1 -1
  44. package/dist/src/contributors/discover.js +1 -1
  45. package/dist/src/contributors/heuristic.js +1 -1
  46. package/dist/src/contributors/index.js +1 -1
  47. package/dist/src/contributors/types.js +1 -1
  48. package/dist/src/contributors/validation.js +1 -1
  49. package/dist/src/effects/worker-delivery.js +83 -0
  50. package/dist/src/extensions/capability-index.js +1 -1
  51. package/dist/src/extensions/commands/definitions.js +2 -2
  52. package/dist/src/extensions/deployment-registration.js +1 -1
  53. package/dist/src/extensions/index.js +1 -1
  54. package/dist/src/extensions/loader.js +1 -1
  55. package/dist/src/extensions/manifest.js +4 -2
  56. package/dist/src/extensions/project-local-activity.js +1 -1
  57. package/dist/src/extensions/project-local-discovery.js +2 -2
  58. package/dist/src/extensions/project-local-doctor.js +7 -3
  59. package/dist/src/extensions/project-local-promote.js +3 -3
  60. package/dist/src/extensions/project-local-remove.js +3 -3
  61. package/dist/src/extensions/project-local-scaffold.js +1 -1
  62. package/dist/src/extensions/registry.js +1 -1
  63. package/dist/src/extensions/shadow-resolver.js +1 -1
  64. package/dist/src/extensions/types.js +1 -1
  65. package/dist/src/extensions/upstream-registry.js +1 -1
  66. package/dist/src/extensions/validation.js +1 -1
  67. package/dist/src/intake/git-history-analyzer.js +1 -1
  68. package/dist/src/kb/cli.js +1 -1
  69. package/dist/src/marketplace/plugin-directory.js +36 -0
  70. package/dist/src/marketplace/plugin-search.js +180 -0
  71. package/dist/src/mcp/cli.mjs +2 -2
  72. package/dist/src/mcp/helpers.mjs +1 -1
  73. package/dist/src/mcp/http-tools.mjs +8 -6
  74. package/dist/src/mcp/http-transport.mjs +3 -1
  75. package/dist/src/mcp/server.mjs +1 -1
  76. package/dist/src/mcp/tools/command-run.mjs +1 -1
  77. package/dist/src/mcp/tools/discovery.mjs +1 -1
  78. package/dist/src/mcp/tools/subsystems.mjs +1 -1
  79. package/dist/src/mcp/tools/worker-invoke.mjs +68 -22
  80. package/dist/src/mcp/tools/worker-local-only-preflight.mjs +79 -0
  81. package/dist/src/mcp/tools/worker-recorded-launch.mjs +26 -0
  82. package/dist/src/mcp/tools/worker-stdin-runtime.mjs +33 -6
  83. package/dist/src/mcp/tools/worker-verify-deliver-schema.mjs +33 -0
  84. package/dist/src/mcp/tools/worker-verify-deliver.mjs +27 -0
  85. package/dist/src/models/catalog-policy.js +2 -2
  86. package/dist/src/models/conductor-data-policy.mjs +83 -14
  87. package/dist/src/models/config-loader.js +2 -2
  88. package/dist/src/models/index.js +2 -2
  89. package/dist/src/models/local-endpoint-models.js +155 -0
  90. package/dist/src/models/model-capabilities.v1.json +9 -9
  91. package/dist/src/models/model-discovery.js +9 -5
  92. package/dist/src/models/opencode-worker-model.mjs +16 -0
  93. package/dist/src/models/resolver.js +2 -2
  94. package/dist/src/models/worker-installation.mjs +5 -3
  95. package/dist/src/models/worker-plan.js +1 -1
  96. package/dist/src/plugin/plugin-installer.js +2 -2
  97. package/dist/src/plugin/registry-validator.js +2 -2
  98. package/dist/src/plugin/skill-command-translator.js +1 -1
  99. package/dist/src/rlm/cache/hash.js +1 -1
  100. package/dist/src/rlm/cache/store.js +1 -1
  101. package/dist/src/rlm/cache/types.js +1 -1
  102. package/dist/src/serve/worker-invocation-preparation.js +13 -0
  103. package/dist/src/serve/worker-invocation.js +21 -6
  104. package/dist/src/skills/run.js +0 -11
  105. package/dist/src/smiths/agentsmith/generator.js +1 -1
  106. package/dist/src/smiths/context-pipeline/index.js +1 -1
  107. package/dist/src/smiths/context-pipeline/provider-policy.js +1 -1
  108. package/dist/src/smiths/context-pipeline/types.js +1 -1
  109. package/dist/src/smiths/mcpsmith/analyzers/cli-analyzer.js +2 -2
  110. package/dist/src/smiths/mcpsmith/generator.js +2 -2
  111. package/dist/src/smiths/mcpsmith/index.js +2 -2
  112. package/dist/src/smiths/mcpsmith/types.js +2 -2
  113. package/dist/src/smiths/skillsmith/collision-detector.js +1 -1
  114. package/dist/src/smiths/skillsmith/namespace-adapter.js +1 -1
  115. package/dist/src/smiths/toolsmith/runtime-discovery.mjs +2 -2
  116. package/dist/src/smiths/toolsmith/types.js +2 -2
  117. package/dist/src/storage/backends/fortemi.js +1 -1
  118. package/dist/src/storage/backends/fs.js +1 -1
  119. package/dist/src/storage/backends/logseq.js +1 -1
  120. package/dist/src/storage/backends/obsidian.js +1 -1
  121. package/dist/src/storage/cli.js +2 -2
  122. package/dist/src/storage/config.js +1 -1
  123. package/dist/src/storage/index.js +1 -1
  124. package/dist/src/storage/subsystem-cli.js +1 -1
  125. package/dist/src/storage/types.js +1 -1
  126. package/dist/src/testing/generators/test-case-generator.js +1 -1
  127. package/dist/src/writing/validation-engine.js +1 -1
  128. package/package.json +11 -1
  129. package/schemas/models/model-catalog.v1.schema.json +6 -3
  130. package/tools/agents/providers/conductor-data-guard.mjs +1 -1
  131. package/tools/ralph-external/lib/mcp-worker-launch.mjs +67 -0
  132. package/tools/ralph-external/lib/opencode-adapter.mjs +9 -7
  133. package/tools/ralph-external/lib/trusted-verification.mjs +1021 -0
  134. package/tools/ralph-external/lib/typed-stop-delivery.mjs +46 -0
  135. package/tools/ralph-external/lib/verification-isolation.mjs +509 -0
  136. package/tools/ralph-external/lib/worker-context.mjs +3 -3
  137. package/tools/ralph-external/lib/worker-delivery-guards.mjs +95 -0
  138. package/tools/ralph-external/lib/worker-delivery-record.mjs +15 -0
  139. package/tools/ralph-external/lib/worker-final.mjs +4 -1
  140. package/tools/ralph-external/lib/worker-isolation-status.mjs +3 -0
  141. package/tools/ralph-external/lib/worker-launch-cli.mjs +8 -0
  142. package/tools/ralph-external/lib/worker-local-only-paths.mjs +45 -0
  143. package/tools/ralph-external/lib/worker-prompt.mjs +4 -1
  144. package/tools/ralph-external/lib/worker-retry-evidence.mjs +2 -1
  145. package/tools/ralph-external/lib/worker-run-directory.mjs +45 -0
  146. package/tools/ralph-external/lib/worker-unit-cleanup.mjs +10 -2
  147. package/tools/ralph-external/lib/worker-verification-cli.mjs +164 -0
  148. package/tools/ralph-external/lib/worktree-preparation.mjs +417 -0
  149. package/tools/ralph-external/session-launcher.mjs +8 -15
  150. package/vscode-extension/schemas/aiwg.config.v1.json +27 -0
@@ -1312,7 +1312,7 @@
1312
1312
  "id": "opencode-direct",
1313
1313
  "provider": "opencode",
1314
1314
  "adapterVersion": "1",
1315
- "supportedVersions": "2.0.26",
1315
+ "supportedVersions": ">=1.18.0 <2.0.0 || >=2.0.26 <3.0.0",
1316
1316
  "runtimeDriver": "installed:opencode",
1317
1317
  "catalogAdapter": {
1318
1318
  "kind": "file",
@@ -1359,27 +1359,27 @@
1359
1359
  "invocationProfiles": {
1360
1360
  "direct-shell": {
1361
1361
  "transport": "shell",
1362
- "supportedVersions": "2.0.26",
1362
+ "supportedVersions": ">=1.18.0 <2.0.0 || >=2.0.26 <3.0.0",
1363
1363
  "controls": {
1364
1364
  "model": {
1365
1365
  "support": "unqualified",
1366
- "mapping": "-m/--model (opencode run --help: '--model, -m string Model to use in the format provider/model#variant')",
1367
- "evidence": "H: opencode 2.0.26 `opencode run --help` (captured 2026-10-10, .aiwg/working/s1-scratch/cli-help/opencode-2.0.26.txt)"
1366
+ "mapping": "1.x: -m/--model provider/model with separate --variant <effort>; 2.x: -m/--model (opencode run --help: '--model, -m string Model to use in the format provider/model#variant')",
1367
+ "evidence": "H: opencode 2.0.26 `opencode run --help` (captured 2026-10-10, .aiwg/working/s1-scratch/cli-help/opencode-2.0.26.txt); H: opencode 1.19.0 `opencode run --help` (titan, 2026-11-15): -m, --model model to use in the format of provider/model; --variant model variant (provider-specific reasoning effort, e.g., high, max, minimal)"
1368
1368
  },
1369
1369
  "effort": {
1370
1370
  "support": "unqualified",
1371
- "mapping": "explicit effort maps to a #<variant> suffix on --model (provider/model#variant); binary disassembly of the installed CLI (the variant-builder, minified as qU(model, manual)) shows variant ids are drawn directly from each model's own capabilities.supports.reasoning_effort list (e.g. low/medium/high), or fixed ids \"max\"/\"high\" for extended-thinking models exposing max_thinking_budget instead; the valid id set is model-specific and not enumerated here, so this adapter appends a syntactically valid id and the real CLI refuses one a given model does not expose",
1372
- "evidence": "R: conductor binary disassembly of the installed opencode 2.0.26 CLI (variant-builder function, host 'noodle', 2026-10-09), confirming H: opencode 2.0.26 `opencode run --help` ('--model, -m string Model to use in the format provider/model#variant')"
1371
+ "mapping": "1.x explicit effort maps to --variant <effort>; 2.x explicit effort maps to a #<variant> suffix on --model (provider/model#variant); binary disassembly of the installed CLI (the variant-builder, minified as qU(model, manual)) shows variant ids are drawn directly from each model's own capabilities.supports.reasoning_effort list (e.g. low/medium/high), or fixed ids \"max\"/\"high\" for extended-thinking models exposing max_thinking_budget instead; the valid id set is model-specific and not enumerated here, so this adapter appends a syntactically valid id and the real CLI refuses one a given model does not expose",
1372
+ "evidence": "R: conductor binary disassembly of the installed opencode 2.0.26 CLI (variant-builder function, host 'noodle', 2026-10-09), confirming H: opencode 2.0.26 `opencode run --help` ('--model, -m string Model to use in the format provider/model#variant'); H: opencode 1.19.0 `opencode run --help` (titan, 2026-11-15): --variant model variant (provider-specific reasoning effort, e.g., high, max, minimal)"
1373
1373
  },
1374
1374
  "sandbox": {
1375
1375
  "support": "unqualified",
1376
1376
  "mapping": "unavailable: no scoped sandbox flag on 'run'; the only permission-adjacent flag is --auto, a blanket approval bypass this profile never emits",
1377
- "evidence": "H: opencode 2.0.26 `opencode run --help` ('--auto Auto-approve permissions that are not explicitly denied')"
1377
+ "evidence": "H: opencode 2.0.26 `opencode run --help` ('--auto Auto-approve permissions that are not explicitly denied'); H: opencode 1.19.0 `opencode run --help` (titan, 2026-11-15): --auto auto-approve permissions that are not explicitly denied"
1378
1378
  },
1379
1379
  "approval": {
1380
1380
  "support": "unqualified",
1381
1381
  "mapping": "--auto ('Auto-approve permissions that are not explicitly denied') is a blanket bypass and is refused by policy; what a permission request does without --auto in non-interactive `run` is not independently confirmed: binary disassembly shows a shared permission.asked/permission.replied protocol where an unanswered request resolves to a \"reject\" outcome (`_===\"once\"||_===\"always\"?_:\"reject\"`, with requestPermission(...).catch(()=>{return}) on no responder), but that path is traced through the ACP/session-protocol layer, not reproduced against plain `run`, so this stays unavailable rather than asserted",
1382
- "evidence": "R: conductor binary disassembly of the installed opencode 2.0.26 CLI (permission.asked/permission.replied reject-on-no-answer pattern, host 'noodle', 2026-10-09), confirming H: opencode 2.0.26 `opencode run --help`"
1382
+ "evidence": "R: conductor binary disassembly of the installed opencode 2.0.26 CLI (permission.asked/permission.replied reject-on-no-answer pattern, host 'noodle', 2026-10-09), confirming H: opencode 2.0.26 `opencode run --help`; H: opencode 1.19.0 `opencode run --help` (titan, 2026-11-15): --auto auto-approve permissions that are not explicitly denied"
1383
1383
  },
1384
1384
  "workdir": {
1385
1385
  "support": "unqualified",
@@ -1389,7 +1389,7 @@
1389
1389
  "finalOutput": {
1390
1390
  "support": "unqualified",
1391
1391
  "mapping": "no --output/-o flag and no positive whole-run terminal event (binary disassembly: the run loop returns silently on session.execution.succeeded, in any mode); the final answer is the captured stdout --format json JSONL stream, accepted only when every line parses, no error event occurs, any present step_finish says \"stop\", and at least one text part has a recorded part.time.end (or a stop step_finish substitutes for that) -- a live 2.0.26 run confirmed a clean single-text-event stream with no step_start/step_finish at all",
1392
- "evidence": "H: opencode 2.0.26 `opencode run --help` ('--format choice Output format (choices: default, json)')"
1392
+ "evidence": "H: opencode 2.0.26 `opencode run --help` ('--format choice Output format (choices: default, json)'); H: opencode 1.19.0 `opencode run --help` (titan, 2026-11-15): --format default|json"
1393
1393
  },
1394
1394
  "stdin": {
1395
1395
  "support": "unqualified",
@@ -8,6 +8,7 @@ import { dirname, join, relative } from 'node:path';
8
8
  import { constants } from 'node:fs';
9
9
  import { homedir, tmpdir } from 'node:os';
10
10
  import { stripVTControlCharacters } from 'node:util';
11
+ import { mergeLocalEndpointCatalog, usesVendorDiscovery, hasOnlyLocalModelSources } from './local-endpoint-models.js';
11
12
  export const PROVIDER_DISCOVERY_DECISIONS = {
12
13
  claude: {
13
14
  provider: 'claude',
@@ -579,7 +580,7 @@ export async function resolveDynamicModelCatalog(options) {
579
580
  && (!options.codex?.accountBinding || cached.discovery?.providers.codex?.accountBinding === options.codex.accountBinding)
580
581
  && (!options.muse?.accountBinding || cached.discovery?.providers.muse?.accountBinding === options.muse.accountBinding)
581
582
  && isFresh(cached, now, options.ttlMs ?? DEFAULT_TTL_MS, signature)) {
582
- return {
583
+ return mergeLocalEndpointCatalog({
583
584
  ...cached,
584
585
  discovery: cached.discovery
585
586
  ? {
@@ -590,10 +591,10 @@ export async function resolveDynamicModelCatalog(options) {
590
591
  : cached.discovery.source,
591
592
  }
592
593
  : undefined,
593
- };
594
+ }, options, cached);
594
595
  }
595
596
  if (!options.allowNetwork && !options.nativeDiscoverers) {
596
- return {
597
+ return mergeLocalEndpointCatalog({
597
598
  ...staticCatalog,
598
599
  discovery: {
599
600
  source: 'static',
@@ -602,9 +603,9 @@ export async function resolveDynamicModelCatalog(options) {
602
603
  providers: {},
603
604
  ...(staticCatalog.discovery?.instances ? { instances: staticCatalog.discovery.instances } : {}),
604
605
  },
605
- };
606
+ }, options, cached);
606
607
  }
607
- const remoteUrl = options.remoteUrl ?? process.env.AIWG_MODEL_CATALOG_URL;
608
+ const remoteUrl = hasOnlyLocalModelSources(options) ? undefined : options.remoteUrl ?? process.env.AIWG_MODEL_CATALOG_URL;
608
609
  let catalog = staticCatalog;
609
610
  let source = 'static';
610
611
  let remoteError;
@@ -650,6 +651,8 @@ export async function resolveDynamicModelCatalog(options) {
650
651
  };
651
652
  const providerDiscovery = {};
652
653
  for (const provider of available) {
654
+ if (!usesVendorDiscovery(provider, options))
655
+ continue;
653
656
  const discoverer = nativeDiscoverers[provider];
654
657
  if (discoverer) {
655
658
  try {
@@ -755,6 +758,7 @@ export async function resolveDynamicModelCatalog(options) {
755
758
  for (const entry of Object.values(providerDiscovery)) {
756
759
  resolved = recordAccountInstance(resolved, discoveryInstanceId(entry), entry);
757
760
  }
761
+ resolved = await mergeLocalEndpointCatalog(resolved, options, cached);
758
762
  await atomicWrite(cacheFile, `${JSON.stringify(resolved, null, 2)}\n`);
759
763
  return resolved;
760
764
  }
@@ -0,0 +1,16 @@
1
+ // Render OpenCode model/effort arguments for the qualified distribution line.
2
+ import { workerVersionRangeMismatch } from './worker-installation.mjs';
3
+ import { major } from 'semver';
4
+
5
+ export const OPENCODE_SUPPORTED_VERSIONS = Object.freeze(['>=1.18.0 <2.0.0', '>=2.0.26 <3.0.0']);
6
+
7
+ export function opencodeWorkerModelArgs(model, effort, cliVersion) {
8
+ if (typeof cliVersion !== 'string'
9
+ || workerVersionRangeMismatch(cliVersion, [OPENCODE_SUPPORTED_VERSIONS.join(' || ')]) !== null) {
10
+ throw new Error('OpenCode worker requires a supported installed CLI version');
11
+ }
12
+ if (major(cliVersion) === 1) {
13
+ return ['-m', model, ...(effort === null ? [] : ['--variant', effort])];
14
+ }
15
+ return ['-m', effort === null ? model : `${model}#${effort}`];
16
+ }
@@ -2,8 +2,8 @@
2
2
  * Model Resolver
3
3
  * Resolves agent names and roles to concrete model identifiers using tier system
4
4
  *
5
- * @implements @.aiwg/architecture/ADR-015-enhanced-model-selection.md
6
- * @architecture @.aiwg/architecture/enhanced-model-selection-design.md
5
+ * @implements @docs/models/supported-models.md
6
+ * @architecture @docs/models/supported-models.md
7
7
  */
8
8
  import { normalizeModelTier, TIER_ORDER, flagshipElected, isFlagshipModel } from './tiers.js';
9
9
  import { compileModelPolicy } from './provider-policy.js';
@@ -201,7 +201,7 @@ export async function prepareInstalledWorkerInvocation(instance, invocation, qua
201
201
  const expectedArtifacts = typeof instance.buildWorkerArtifacts === 'function'
202
202
  ? instance.buildWorkerArtifacts({ ...driverInput, permissions: qualification.permissions }) : undefined;
203
203
  if (JSON.stringify(expectedArtifacts) !== JSON.stringify(result.artifacts)) throw new WorkerPolicyError('OG_PIN_MISMATCH', 'Worker artifacts differ from authorized driver mapping');
204
- const workerArgs = instance.buildWorkerArgs(driverInput, profile, qualification.permissions);
204
+ const workerArgs = instance.buildWorkerArgs({ ...driverInput, cliVersion: qualification.cliVersion }, profile, qualification.permissions);
205
205
  if (!isOperatorQualifiedWorkerAdapter(qualification.adapter)) assertWorkerControlArgv(profile, workerArgs);
206
206
  const expected = [scope.binary.realpath, ...workerArgs];
207
207
  if (JSON.stringify(expected) !== JSON.stringify(result.argv)
@@ -285,7 +285,7 @@ export async function inspectWorkerInstallation(instance, request) {
285
285
  let controlArgv = null;
286
286
  if (!operatorApproved && Object.values(profile.controls).some(hasControlArgvMapping)) {
287
287
  if (!request.invocation) throw new Error('Worker control qualification requires representative argv invocation');
288
- controlArgv = instance.buildWorkerArgs(structuredClone(request.invocation), profile, request.permissions);
288
+ controlArgv = instance.buildWorkerArgs({ ...structuredClone(request.invocation), cliVersion }, profile, request.permissions);
289
289
  assertWorkerControlArgv(profile, controlArgv);
290
290
  }
291
291
  const environment = request.environment ?? {};
@@ -768,6 +768,7 @@ export async function inspectRecordedWorkerQualifications({ cwd, policy, paralle
768
768
  if (!configured || configured.enabled === false || !/^[a-z][a-z0-9-]{0,62}$/.test(cli)
769
769
  || await realpath(installation.cwd) !== workspace
770
770
  || qualificationDigest(policy) !== installation.effectiveConfigDigest
771
+ || (installation.localModelsDigest || configured.localModels) && installation.localModelsDigest !== qualificationDigest(configured.localModels ?? null)
771
772
  || configured.adapter !== `providers:${adapter.provider}` && configured.adapter !== adapter.id
772
773
  || configured.accountScope !== binding.accountScope
773
774
  || binding.profile !== installation.profile || binding.cliVersion !== installation.cliVersion
@@ -915,6 +916,7 @@ export async function loadRecordedWorkerInstallations({ registry, cwd, policy, p
915
916
  if (binding.profile !== installation.profile || binding.cliVersion !== installation.cliVersion
916
917
  || binding.accountScope !== installation.accountScope
917
918
  || qualificationDigest(binding.boundary) !== qualificationDigest(installation.boundary)) throw fail();
919
+ if (parallelism && (installation.localModelsDigest || parallelism.clis?.[cli]?.localModels) && installation.localModelsDigest !== qualificationDigest(parallelism.clis?.[cli]?.localModels ?? null)) throw fail();
918
920
  reason = 'effective-config-digest';
919
921
  if (qualificationDigest(policy) !== installation.effectiveConfigDigest) throw fail();
920
922
  reason = 'evidence';
@@ -1004,7 +1006,7 @@ export async function loadRecordedWorkerInstallations({ registry, cwd, policy, p
1004
1006
  ...(typeof instance.buildWorkerStdinFrame === 'function'
1005
1007
  ? { buildWorkerStdinFrame: (brief, invocation) => instance.buildWorkerStdinFrame(brief, invocation) } : {}),
1006
1008
  buildInvocation: async input => profile.transport === 'shell'
1007
- ? buildInstalledWorkerTransport(instance, input, profile, adapter.invocation, scope.binary.realpath, installation.environment)
1009
+ ? buildInstalledWorkerTransport(instance, { ...input, cliVersion: binding.cliVersion }, profile, adapter.invocation, scope.binary.realpath, installation.environment)
1008
1010
  : instance.buildInvocation(input),
1009
1011
  prepareWorkerInvocation: (invocation, qualification) => prepareInstalledWorkerInvocation(instance, invocation, qualification),
1010
1012
  ...(mcpRegistry ? { mcpRegistry, mcpProfile: record.mcpProfile } : {}),
@@ -161,7 +161,7 @@ export function resolveWorkerPlan(snapshot, request, ceilingDefaults = {}) {
161
161
  const permissions = { ...group.execution, transport: group.execution?.transport ?? 'shell' };
162
162
  const transport = permissions.transport;
163
163
  if (request.transport === 'mcp' && permissions.launchMode === 'native-sandbox') {
164
- const reason = diagnostic('OG_POLICY_RELAXATION', `/parallelism/groups/${groupId}/execution/launchMode`, 'MCP worker-invoke does not support native-sandbox isolation. Use models resolve --transport shell and the shell launcher, or select a group with systemd-unit isolation.');
164
+ const reason = diagnostic('OG_POLICY_RELAXATION', `/parallelism/groups/${groupId}/execution/launchMode`, '--transport mcp selects an MCP-server worker, which native-sandbox groups do not support. Resolve with --transport shell, then launch with --launch-worker, or from a confined conductor with MCP worker-invoke transport "shell"; or select a group with systemd-unit isolation.');
165
165
  for (const member of group.members ?? [])
166
166
  plan.exclusions.push({ group: groupId, member: member.id, model: member.model, effort: null, diagnostics: [reason] });
167
167
  if (request.group === groupId)
@@ -15,8 +15,8 @@
15
15
  *
16
16
  * @module src/plugin/plugin-installer
17
17
  * @implements @.aiwg/requirements/use-cases/UC-010-rollback-plugin-installation.md
18
- * @architecture @.aiwg/architecture/software-architecture-doc.md - Section 5.1 PluginManager
19
- * @adr @.aiwg/architecture/decisions/ADR-006-plugin-rollback-strategy.md
18
+ * @architecture @docs/architecture/cli/index.md
19
+ * @adr @docs/plugin-marketplace-guide.md
20
20
  * @nfr @.aiwg/requirements/nfr-modules/reliability.md - NFR-REL-002 (zero data loss)
21
21
  * @tests @test/unit/plugin/plugin-installer.test.ts
22
22
  * @depends @src/plugin/metadata-validator.ts
@@ -6,8 +6,8 @@
6
6
  *
7
7
  * @module src/plugin/registry-validator
8
8
  * @implements @.aiwg/requirements/use-cases/UC-011-validate-plugin-security.md
9
- * @architecture @.aiwg/architecture/software-architecture-doc.md - Section 5.1 PluginManager
10
- * @adr @.aiwg/architecture/decisions/ADR-002-plugin-isolation-strategy.md
9
+ * @architecture @docs/architecture/cli/index.md
10
+ * @adr @docs/plugin-marketplace-guide.md
11
11
  * @tests @test/unit/plugin/registry-validator.test.ts
12
12
  * @depends @src/plugin/metadata-validator.ts
13
13
  */
@@ -8,7 +8,7 @@
8
8
  * Skills are the canonical source format; commands are deployment artifacts.
9
9
  * See ADR: Skills as the Canonical Extension Type.
10
10
  *
11
- * @implements .aiwg/architecture/adr-skills-canonical-extension-type.md
11
+ * @implements docs/extensions/extension-types.md
12
12
  * @issue #550
13
13
  */
14
14
  import fs from 'fs/promises';
@@ -6,7 +6,7 @@
6
6
  * order does not affect the resulting hash.
7
7
  *
8
8
  * @implements #1203
9
- * @see .aiwg/architecture/adr-rlm-index-features-impl-plan.md
9
+ * @see docs/architecture/index-and-manifest-loading.md
10
10
  */
11
11
  import { createHash } from 'node:crypto';
12
12
  /** Compute a stable sha256 hex hash for a cache key. */
@@ -8,7 +8,7 @@
8
8
  * └── metadata.json
9
9
  *
10
10
  * @implements #1203
11
- * @see .aiwg/architecture/adr-rlm-index-features-impl-plan.md
11
+ * @see docs/architecture/index-and-manifest-loading.md
12
12
  */
13
13
  import { existsSync, mkdirSync, readFileSync, readdirSync, rmSync, statSync, writeFileSync, } from 'node:fs';
14
14
  import { join } from 'node:path';
@@ -2,7 +2,7 @@
2
2
  * RLM Result Cache — Type Definitions
3
3
  *
4
4
  * @implements #1203
5
- * @see .aiwg/architecture/adr-rlm-index-features-impl-plan.md
5
+ * @see docs/architecture/index-and-manifest-loading.md
6
6
  */
7
7
  export {};
8
8
  //# sourceMappingURL=types.js.map
@@ -1,5 +1,7 @@
1
1
  /** Validate and render a prepared invocation against trusted installation controls. */
2
2
  import path from 'node:path';
3
+ import { findPackageRoot } from '../cli/find-package-root.js';
4
+ import { workerOutputPaths } from './worker-invocation-paths.js';
3
5
  import { directWorkerEnvironment } from '../config/worker-attribution.mjs';
4
6
  import { createHash } from 'node:crypto';
5
7
  import { fileURLToPath } from 'node:url';
@@ -133,6 +135,17 @@ export async function prepareWorkerInvocation(invocation, qualification) {
133
135
  else {
134
136
  throw new Error(`Unsupported worker stdin mode: ${result.stdin}`);
135
137
  }
138
+ const root = findPackageRoot(path.dirname(fileURLToPath(import.meta.url)));
139
+ if (!root)
140
+ throw new Error('Worker shell handoff requires the installed AIWG package root');
141
+ const guard = path.join(root, 'tools/ralph-external/lib/worker-shell-capture.mjs');
142
+ const binding = { request: { role: qualification.role, task: qualification.task ?? null,
143
+ group: result.selected.group, workdir: result.cwd },
144
+ invocation: { cwd: result.cwd, briefPath: result.briefPath, briefDigest: result.briefDigest, stdin: result.stdin, selected: result.selected },
145
+ paths: workerOutputPaths(result) };
146
+ // Reserve every output before shell redirection or vendor-owned final writes.
147
+ // Noclobber also protects stream files created between reservation and exec.
148
+ result.shellCommand = `${[process.execPath, guard, JSON.stringify(binding)].map(quote).join(' ')} && (set -C; ${result.shellCommand})`;
136
149
  }
137
150
  else {
138
151
  const binding = result.mcp;
@@ -83,6 +83,8 @@ const invocationChecks = {
83
83
  message: 'Worker invocation preparation failed; check installation evidence, policy, paths and environment, then qualify again.' },
84
84
  installation_recheck_unavailable: { pointer: '/invocation/prepareWorkerInvocation',
85
85
  message: 'The selected profile requires an installation recheck, but the installed driver has no preparation method. Restore the qualified driver and qualify again.' },
86
+ brief_missing: { pointer: '/request/brief',
87
+ message: 'The brief file does not exist, and the selected worker adapter needs its content to build the invocation. Write the brief, then resolve again.' },
86
88
  qualified_workspace_mismatch: { pointer: '/request/workdir',
87
89
  message: 'Worker workdir differs from the qualified workspace. Use the qualified workspace or run aiwg doctor --probe-workers --qualify from the requested workdir.' },
88
90
  };
@@ -99,7 +101,7 @@ export async function buildWorkerInvocationTransport(driver, input) {
99
101
  assertWorkerLaunchMode(driver.qualification.adapter, input.permissions);
100
102
  let transport;
101
103
  try {
102
- transport = await driver.buildInvocation(input);
104
+ transport = await driver.buildInvocation({ ...input, cliVersion: driver.qualification.cliVersion });
103
105
  }
104
106
  catch (error) {
105
107
  throw new WorkerInvocationCheckError(error instanceof WorkerPolicyError ? error.code : 'OG_ADAPTER_UNQUALIFIED', 'invocation_build_failed');
@@ -140,7 +142,10 @@ export async function revalidateWorkerInvocationPlan(saved, snapshot, drivers, n
140
142
  if (!current.invocation || current.status !== 'eligible'
141
143
  || Date.parse(saved.invocation.expiresAt) > Date.parse(current.invocation.expiresAt)
142
144
  || qualificationDigest({ ...current.invocation, expiresAt: saved.invocation.expiresAt }) !== qualificationDigest(saved.invocation)) {
143
- throw new WorkerPolicyError('OG_PIN_MISMATCH', 'Saved invocation differs from current qualified plan; resolve again');
145
+ // Tell the conductor the usual remedy; a plan resolved from another directory (for example the
146
+ // worker tree, whose config and model sources differ) never matches. The refusal is unchanged.
147
+ throw new WorkerPolicyError('OG_PIN_MISMATCH', 'Saved invocation differs from current qualified plan; resolve again'
148
+ + ' from the conductor project directory you launch from (a plan resolved elsewhere, such as in the worker tree, never matches)');
144
149
  }
145
150
  return structuredClone(saved.invocation);
146
151
  }
@@ -278,9 +283,19 @@ export async function resolveWorkerInvocation(snapshot, request, drivers, now =
278
283
  stepEnforcement: controls.includes('stepCap') ? profile.controls.stepCap.support : 'unavailable' };
279
284
  let effectiveHealth = resolveWorkerEffectiveHealth(healthConfig, healthInput);
280
285
  const invocationId = expected?.invocationId ?? randomUUID();
281
- const transport = await buildWorkerInvocationTransport(driver, { invocationId, selected: structuredClone(selected), permissions: structuredClone(tuple.permissions),
282
- cwd: request.workdir, briefPath: request.brief, brief: bytes?.toString('utf8') ?? '', finalPath, limits: structuredClone(limits),
283
- health: structuredClone(effectiveHealth), role: request.role });
286
+ let transport;
287
+ try {
288
+ transport = await buildWorkerInvocationTransport(driver, { invocationId, selected: structuredClone(selected), permissions: structuredClone(tuple.permissions),
289
+ cwd: request.workdir, briefPath: request.brief, brief: bytes?.toString('utf8') ?? '', finalPath, limits: structuredClone(limits),
290
+ health: structuredClone(effectiveHealth), role: request.role });
291
+ }
292
+ catch (error) {
293
+ // A driver that needs the brief cannot build without it; name the missing file, not the adapter (#4161).
294
+ if (bytes !== null || !(error instanceof WorkerInvocationCheckError) || error.reason !== 'invocation_build_failed')
295
+ throw error;
296
+ pointer = '/request/brief';
297
+ throw new WorkerInvocationCheckError('OG_CONFIG_REFERENCE', 'brief_missing');
298
+ }
284
299
  for (const output of Object.values(workerOutputPaths({ ...transport, selected, transport: tuple.transport, finalPath, stdoutPath, stderrPath }))) {
285
300
  await inspectPath(output, 'output');
286
301
  if (path.resolve(request.brief) === output)
@@ -316,7 +331,7 @@ export async function resolveWorkerInvocation(snapshot, request, drivers, now =
316
331
  controlEvidence: isOperatorQualifiedWorkerAdapter(adapter) ? [adapter.qualification.evidenceRef, ...controls.map(name => profile.controls[name].evidence)] : controls.map(name => profile.controls[name].evidence),
317
332
  health: effectiveHealth, };
318
333
  const invocationQualification = { ...qualification, now: Date.parse(now),
319
- ceilings: request.ceilings,
334
+ ceilings: request.ceilings, task: request.task,
320
335
  policy: plan.policy, permissions: tuple.permissions, role: request.role, modelObservation: observation,
321
336
  expectedDigests: { policyDigest, catalogDigest: plan.digests.catalogDigest, profileDigest: plan.digests.profileDigest, briefDigest },
322
337
  requiredControls: controls };
@@ -159,17 +159,6 @@ export async function runSkill(opts) {
159
159
  ...(aiwgRoot ? { AIWG_ROOT: aiwgRoot } : {}),
160
160
  ...opts.env,
161
161
  };
162
- // Native source owner shares the same indexed script declaration and project CWD.
163
- if (entry.path.replaceAll('\\', '/').endsWith('agentic/code/frameworks/sdlc-complete/skills/issue-audit/SKILL.md')
164
- && entry.script.entrypoint === 'scripts/audit.mjs') {
165
- const audit = await import('../issues/audit-cli.js');
166
- return audit.main(opts.args, runCwd, { env });
167
- }
168
- if (/agentic\/code\/(addons\/aiwg-utils|plugins\/utils)\/skills\/aiwg-pr\/SKILL\.md$/.test(entry.path.replaceAll('\\', '/'))
169
- && entry.script.entrypoint === 'scripts/deliver.mjs') {
170
- const delivery = await import('../delivery/pr.js');
171
- return delivery.main(opts.args, runCwd);
172
- }
173
162
  const fullArgs = [...invocation.prefixArgs, entrypointPath, ...opts.args];
174
163
  return new Promise((resolve) => {
175
164
  const child = spawn(invocation.command, fullArgs, {
@@ -3,7 +3,7 @@
3
3
  *
4
4
  * Generates agents following the 10 Golden Rules from the Agent Design Bible.
5
5
  *
6
- * @architecture @.aiwg/architecture/software-architecture-doc.md
6
+ * @architecture @docs/architecture/cli/index.md
7
7
  */
8
8
  import { AgentPackager } from '../../agents/agent-packager.js';
9
9
  import { getProviderDefinition } from '../../providers/provider-definitions.js';
@@ -2,7 +2,7 @@
2
2
  * context-pipeline — canonical workspace graph and provider adapter generator.
3
3
  *
4
4
  * Implements the cross-platform context delivery pipeline defined in
5
- * `.aiwg/architecture/adr-workspace-context-graph.md`. Emits a project graph:
5
+ * `docs/configuration/workspace-context.md`. Emits a project graph:
6
6
  *
7
7
  * - WORKSPACE.md — protected provider-neutral project/operator context
8
8
  * - AIWG.md — generated framework/discovery context
@@ -21,7 +21,7 @@ import { getProviderDefinition, listProviderDefinitions } from '../../providers/
21
21
  * Providers that receive AGENTS.md emission at project root.
22
22
  *
23
23
  * Sources kept in sync:
24
- * - ADR-1 §3 default-on rollout (`.aiwg/architecture/adr-agents-md-aggregation.md`)
24
+ * - ADR-1 §3 default-on rollout (`docs/configuration/workspace-context.md`)
25
25
  * - ADR-1 §4 per-provider variants table (file-name + twin-file emission)
26
26
  */
27
27
  export const AGENTS_MD_PROVIDERS = new Set(listProviderDefinitions()
@@ -7,7 +7,7 @@
7
7
  * - AIWG.md — generated framework context
8
8
  * - provider startup files — minimal adapters that load WORKSPACE.md, then AIWG.md
9
9
  *
10
- * Per ADR-1 (.aiwg/architecture/adr-agents-md-aggregation.md). NOT part of agentsmith;
10
+ * Per ADR-1 (docs/configuration/workspace-context.md). NOT part of agentsmith;
11
11
  * agentsmith creates subagent personas, this module assembles cross-platform context.
12
12
  */
13
13
  /**
@@ -3,8 +3,8 @@
3
3
  *
4
4
  * Parses CLI tool help output to extract tool definitions.
5
5
  *
6
- * @architecture @.aiwg/architecture/mcpsmith-architecture.md - Section 5.1
7
- * @implements @.aiwg/architecture/decisions/ADR-014-mcpsmith-mcp-server-generator.md
6
+ * @architecture @docs/smithing/mcpsmith.md
7
+ * @implements @docs/smithing/mcpsmith.md
8
8
  */
9
9
  import { spawn } from 'child_process';
10
10
  /**
@@ -3,8 +3,8 @@
3
3
  *
4
4
  * Generates complete MCP servers from analyzer results.
5
5
  *
6
- * @architecture @.aiwg/architecture/mcpsmith-architecture.md - Section 5.5
7
- * @implements @.aiwg/architecture/decisions/ADR-014-mcpsmith-mcp-server-generator.md
6
+ * @architecture @docs/smithing/mcpsmith.md
7
+ * @implements @docs/smithing/mcpsmith.md
8
8
  */
9
9
  import fs from 'fs/promises';
10
10
  import path from 'path';
@@ -8,8 +8,8 @@
8
8
  * - Natural language descriptions
9
9
  *
10
10
  * @module smiths/mcpsmith
11
- * @architecture @.aiwg/architecture/mcpsmith-architecture.md
12
- * @implements @.aiwg/architecture/decisions/ADR-014-mcpsmith-mcp-server-generator.md
11
+ * @architecture @docs/smithing/mcpsmith.md
12
+ * @implements @docs/smithing/mcpsmith.md
13
13
  */
14
14
  export * from './types.js';
15
15
  export * from './analyzers/cli-analyzer.js';
@@ -3,8 +3,8 @@
3
3
  *
4
4
  * Types for MCP server generation from various sources.
5
5
  *
6
- * @architecture @.aiwg/architecture/mcpsmith-architecture.md
7
- * @implements @.aiwg/architecture/decisions/ADR-014-mcpsmith-mcp-server-generator.md
6
+ * @architecture @docs/smithing/mcpsmith.md
7
+ * @implements @docs/smithing/mcpsmith.md
8
8
  */
9
9
  export {};
10
10
  //# sourceMappingURL=types.js.map
@@ -49,7 +49,7 @@ const PLATFORM_BUILTINS = {
49
49
  // IS the canonical slug for the doctor skill (the bare `doctor` collides with
50
50
  // Claude's built-in). Slash commands and shell CLI commands live on different
51
51
  // surfaces and do not actually conflict at runtime.
52
- // See: docs/migration/skill-namespace-migration.md, .aiwg/architecture/adr-skill-namespace-strategy.md
52
+ // See: docs/migration/skill-namespace-migration.md, docs/migration/skill-namespace-migration.md
53
53
  // ============================================
54
54
  // Ownership Attribution
55
55
  // ============================================
@@ -2,7 +2,7 @@
2
2
  * Namespace-aware Skill Deployment Adapter
3
3
  *
4
4
  * Implements per-platform namespace deployment strategy per ADR:
5
- * .aiwg/architecture/adr-skill-namespace-strategy.md
5
+ * docs/migration/skill-namespace-migration.md
6
6
  *
7
7
  * Platform groups:
8
8
  * Group A (deep-recursion): Claude Code, Cursor, Codex, OpenCode, OpenClaw
@@ -3,8 +3,8 @@
3
3
  *
4
4
  * Discovers installed tools, verifies functionality, and generates runtime catalog.
5
5
  *
6
- * @architecture @.aiwg/architecture/decisions/ADR-014-toolsmith-feature-architecture.md
7
- * @architecture @.aiwg/architecture/toolsmith-implementation-spec.md
6
+ * @architecture @docs/smithing/toolsmith.md
7
+ * @architecture @docs/smithing/toolsmith.md
8
8
  */
9
9
 
10
10
  import { boundedExecFileSync, boundedExecSync } from '../../process/bounded-child-process.mjs';
@@ -1,8 +1,8 @@
1
1
  /**
2
2
  * Type definitions for Toolsmith feature
3
3
  *
4
- * @architecture @.aiwg/architecture/decisions/ADR-014-toolsmith-feature-architecture.md
5
- * @architecture @.aiwg/architecture/toolsmith-implementation-spec.md
4
+ * @architecture @docs/smithing/toolsmith.md
5
+ * @architecture @docs/smithing/toolsmith.md
6
6
  */
7
7
  export {};
8
8
  //# sourceMappingURL=types.js.map
@@ -31,7 +31,7 @@
31
31
  * because Fortemi's MCP surface does not document a direct delete
32
32
  * tool (immutability + versioning is core to the design).
33
33
  *
34
- * @design @.aiwg/architecture/storage-design.md (§5.6)
34
+ * @design @docs/storage/overview.md
35
35
  * @issue #934
36
36
  * @issue #961
37
37
  * @issue #972
@@ -5,7 +5,7 @@
5
5
  * overrides from `storage.config`. Output is byte-identical to the
6
6
  * pre-abstraction direct-fs calls so consumer migrations stay safe.
7
7
  *
8
- * @design @.aiwg/architecture/storage-design.md (§5.1)
8
+ * @design @docs/storage/overview.md
9
9
  * @issue #934
10
10
  * @issue #956
11
11
  */
@@ -27,7 +27,7 @@
27
27
  * journals/YYYY_MM_DD.md journal entries
28
28
  * logseq/* REFUSED (Logseq config)
29
29
  *
30
- * @design @.aiwg/architecture/storage-design.md (§5.3)
30
+ * @design @docs/storage/overview.md
31
31
  * @issue #934
32
32
  * @issue #958
33
33
  */
@@ -24,7 +24,7 @@
24
24
  * - Does NOT implement `query()` — Obsidian's search is not exposed
25
25
  * via the CLI as of research date
26
26
  *
27
- * @design @.aiwg/architecture/storage-design.md (§5.2)
27
+ * @design @docs/storage/overview.md
28
28
  * @issue #934
29
29
  * @issue #957
30
30
  */
@@ -9,7 +9,7 @@
9
9
  * migrate <subsystem> — copy entries from one backend to another
10
10
  * import-corpus — ingest the local research corpus through a storage backend
11
11
  *
12
- * @design @.aiwg/architecture/storage-design.md (§7)
12
+ * @design @docs/storage/overview.md
13
13
  * @issue #934
14
14
  * @issue #954
15
15
  * @issue #955
@@ -276,6 +276,6 @@ Examples:
276
276
  aiwg storage import-corpus --to obsidian:~/vault --dry-run
277
277
  aiwg storage import-corpus --server fortemi-enterprise
278
278
 
279
- See @.aiwg/architecture/storage-design.md for the design.`);
279
+ See @docs/storage/overview.md for the design.`);
280
280
  }
281
281
  //# sourceMappingURL=cli.js.map
@@ -9,7 +9,7 @@
9
9
  * `schemas/storage/storage.config.v1.schema.json`; the lightweight path here
10
10
  * avoids loading the full catalog during storage bootstrap.
11
11
  *
12
- * @design @.aiwg/architecture/storage-design.md
12
+ * @design @docs/storage/overview.md
13
13
  * @issue #934
14
14
  * @issue #953
15
15
  */
@@ -6,7 +6,7 @@
6
6
  * subsystem, and memoizes the adapter instance for the lifetime of the
7
7
  * process.
8
8
  *
9
- * @design @.aiwg/architecture/storage-design.md
9
+ * @design @docs/storage/overview.md
10
10
  * @issue #934
11
11
  * @issue #953
12
12
  */
@@ -13,7 +13,7 @@
13
13
  * await runSubsystemCli('memory', args);
14
14
  * }
15
15
  *
16
- * @design @.aiwg/architecture/storage-design.md (§4)
16
+ * @design @docs/storage/overview.md
17
17
  * @issue #934
18
18
  * @issue #966
19
19
  * @issue #967
@@ -5,7 +5,7 @@
5
5
  * `resolveStorage(subsystem)` to obtain a backend-specific adapter
6
6
  * conforming to `StorageAdapter`.
7
7
  *
8
- * @design @.aiwg/architecture/storage-design.md
8
+ * @design @docs/storage/overview.md
9
9
  * @schema @schemas/storage/storage.config.v1.schema.json
10
10
  * @issue #934
11
11
  * @issue #953