@aiwg/cli 2026.11.7 → 2026.11.8

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 (44) hide show
  1. package/agentic/code/addons/aiwg-hooks/hooks/aiwg-prompt-discovery.cjs +3 -2
  2. package/agentic/code/providers/model-capabilities.v1.json +22 -21
  3. package/agentic/code/providers/model-catalog.v1.json +11 -10
  4. package/dist/src/cli/handlers/refresh-managed-deployment.js +13 -3
  5. package/dist/src/cli/handlers/refresh-user-hooks.js +102 -0
  6. package/dist/src/cli/handlers/refresh.js +2 -0
  7. package/dist/src/config/worker-guidance-warning.js +8 -0
  8. package/dist/src/extensions/user-hook-diagnostics.js +16 -1
  9. package/dist/src/extensions/verified-hook-command.js +7 -0
  10. package/dist/src/models/cursor-models.js +92 -0
  11. package/dist/src/models/model-capabilities.v1.json +22 -21
  12. package/dist/src/models/model-catalog.v1.json +11 -10
  13. package/dist/src/models/model-discovery.js +4 -3
  14. package/dist/src/models/provider-policy.js +1 -1
  15. package/dist/src/models/worker-health-readiness.js +4 -0
  16. package/dist/src/models/worker-installation.d.mts +2 -0
  17. package/dist/src/models/worker-installation.mjs +8 -2
  18. package/dist/src/models/worker-invocation-policy.js +21 -1
  19. package/dist/src/models/worker-plan.js +3 -1
  20. package/dist/src/models/worker-wiring-diagnostics.js +25 -0
  21. package/dist/src/providers/provider-context-contracts.js +3 -0
  22. package/dist/src/providers/provider-seeds-1.js +1 -1
  23. package/dist/src/smiths/context-pipeline/muse-bridge.js +7 -4
  24. package/dist/src/smiths/context-pipeline/workspace-audit.js +37 -6
  25. package/dist/src/smiths/context-pipeline/workspace-bootstrap.js +3 -1
  26. package/dist/src/smiths/context-pipeline/workspace-doctor.js +16 -4
  27. package/dist/src/smiths/context-pipeline/workspace-document.js +4 -2
  28. package/dist/src/smiths/hook-bridge/codex-trust.js +56 -7
  29. package/dist/src/smiths/hook-bridge/cursor-translator.js +89 -0
  30. package/dist/src/smiths/hook-bridge/index.js +4 -1
  31. package/dist/src/writing/contextual-diagnostics.js +2 -1
  32. package/dist/src/writing/current-patterns.catalogue.json +4 -4
  33. package/dist/src/writing/current-patterns.js +2 -2
  34. package/dist/src/writing/structural-patterns.js +23 -6
  35. package/package.json +1 -1
  36. package/tools/agents/providers/cursor-prompt-discovery.mjs +13 -0
  37. package/tools/agents/providers/cursor.mjs +2 -0
  38. package/tools/agents/providers/openclaw-context.mjs +6 -0
  39. package/tools/agents/providers/openclaw.mjs +14 -12
  40. package/tools/agents/providers/rule-delivery-surface.mjs +1 -1
  41. package/tools/agents/providers/rule-deployment-prepare.mjs +1 -0
  42. package/tools/agents/providers/rule-presentation.mjs +1 -1
  43. package/tools/agents/providers/rule-startup.mjs +3 -1
  44. package/vscode-extension/schemas/aiwg.config.v1.json +13 -0
@@ -891,7 +891,7 @@
891
891
  "id": "cursor-direct",
892
892
  "provider": "cursor",
893
893
  "adapterVersion": "1",
894
- "supportedVersions": "2026.10.1-e373342",
894
+ "supportedVersions": "2026.11.13-eacade1",
895
895
  "runtimeDriver": "installed:cursor",
896
896
  "catalogAdapter": {
897
897
  "kind": "file",
@@ -946,67 +946,67 @@
946
946
  "invocationProfiles": {
947
947
  "direct-shell": {
948
948
  "transport": "shell",
949
- "supportedVersions": "2026.10.1-e373342",
949
+ "supportedVersions": "2026.11.13-eacade1",
950
950
  "controls": {
951
951
  "model": {
952
952
  "support": "unqualified",
953
- "mapping": "[--model MODEL[effort=E]]; exact catalog model ID with the embedded bracket effort override, never a generic alias, never the CLI's own auto-selection ('auto'/'default'); the captured --help documents only --model, no -m short alias",
954
- "evidence": "H: cursor-agent 2026.10.01-e373342 --help documents --model <model> (no -m alias) and its bracket-override syntax; unqualified until live model-pin evidence"
953
+ "mapping": "[--model MODEL]; exact catalog model ID including its effort variant, never a generic alias, never the CLI's own auto-selection ('auto'/'default'); the captured --help documents only --model, no -m short alias",
954
+ "evidence": "H: cursor-agent 2026.11.13-eacade1 --help and live --list-models observed 2026-11-17; composer-2.5 stdin smoke exited 0 with one success result; dispatch remains unqualified pending human review of a live run"
955
955
  },
956
956
  "effort": {
957
957
  "support": "unqualified",
958
- "mapping": "embedded in --model as MODEL[effort=E]; valid levels are account/backend-scoped (parameterizedModels is fetched from the Cursor backend), never a CLI default",
959
- "evidence": "H: cursor-agent 2026.10.01-e373342 --help documents the bracket-override example 'claude-opus-4-8[context=1m,effort=high,fast=false]'; D: installed-module bundle read on noodle (~/.local/share/cursor-agent/versions/2026.10.01-e373342/7000.index.js), never executed shows parameterizedModels is fetched remotely; unqualified until live evidence"
958
+ "mapping": "select the exact catalog model ID encoding effort, e.g. gpt-5.3-codex-high; never append bracket overrides; composer-2.5 has no separate effort selector",
959
+ "evidence": "H: 2026.11.13-eacade1 help still advertises parameterized bracket overrides, but the live list encodes effort in IDs; observed 2026-11-17: claude-sonnet-5-thinking-high[effort=low] rejected with plain-text Cannot use this model, exit 1 and no JSON"
960
960
  },
961
961
  "sandbox": {
962
962
  "support": "unqualified",
963
963
  "mapping": "both contracts emit [--sandbox enabled] (never --sandbox disabled); read-only additionally emits [--mode ask] (the CLI's own documented read-only mode) on top of --sandbox enabled; -f/--force, --yolo, --auto-review and --approve-mcps are out of this contract's scope and are never emitted (--approve-mcps is a bypass, not a non-approval convenience; see pitfalls)",
964
- "evidence": "H: cursor-agent 2026.10.01-e373342 --help documents --sandbox <enabled|disabled>, --mode <plan|ask> ('ask: ... (read-only)') and -f/--force/--yolo/--auto-review/--approve-mcps; D: installed-module bundle read on noodle (~/.local/share/cursor-agent/versions/2026.10.01-e373342/7000.index.js and 8192.index.js), never executed, shows sandboxMode:\"enabled\" pairs with approvalMode:\"allowlist\" and --approve-mcps sets ignoreApprovals:true on the MCP approval source; unqualified until live evidence"
964
+ "evidence": "H: cursor-agent 2026.11.13-eacade1 --help documents --sandbox <enabled|disabled>, --mode <plan|ask> ('ask: ... (read-only)') and -f/--force/--yolo/--auto-review/--approve-mcps; D: installed-module bundle read on noodle (~/.local/share/cursor-agent/versions/2026.10.01-e373342/7000.index.js and 8192.index.js), never executed, shows sandboxMode:\"enabled\" pairs with approvalMode:\"allowlist\" and --approve-mcps sets ignoreApprovals:true on the MCP approval source; Observed 2026-11-17: composer-2.5 smoke with --sandbox enabled exited 0 on titan after host AppArmor setup; read-only mode is help-evidenced only; dispatch unqualified pending human review"
965
965
  },
966
966
  "approval": {
967
967
  "support": "unqualified",
968
968
  "mapping": "unavailable as a separate flag: --sandbox/--mode are the only non-bypass permission gates; the direct profile never emits -f/--force, --yolo, --auto-review or --approve-mcps",
969
- "evidence": "H: cursor-agent 2026.10.01-e373342 --help documents no non-bypass approval-policy flag; unqualified until live evidence"
969
+ "evidence": "H: cursor-agent 2026.11.13-eacade1 --help documents no non-bypass approval-policy flag; Observed 2026-11-17: unapproved project MCP server never ran; smoke exited 0 without error or interaction_query events; dispatch unqualified pending human review"
970
970
  },
971
971
  "workdir": {
972
972
  "support": "unqualified",
973
973
  "mapping": "[--workspace W] conductor working root, plus the conductor process cwd",
974
- "evidence": "H: cursor-agent 2026.10.01-e373342 --help documents --workspace <path-or-name>; unqualified until live evidence"
974
+ "evidence": "H: cursor-agent 2026.11.13-eacade1 --help documents --workspace <path-or-name>; Observed 2026-11-17: smoke system/init cwd matched the supplied temporary workspace; dispatch unqualified pending human review"
975
975
  },
976
976
  "finalOutput": {
977
977
  "support": "unqualified",
978
978
  "mapping": "unavailable as a file target: no output-file flag is documented; the final is the last type:\"result\" line of the captured --output-format stream-json stdout stream",
979
- "evidence": "H: cursor-agent 2026.10.01-e373342 --help documents --output-format <text|json|stream-json> with no file-path argument; D: installed-module bundle read on noodle (~/.local/share/cursor-agent/versions/2026.10.01-e373342/7000.index.js), never executed shows the single terminal result object shape; unqualified until live evidence"
979
+ "evidence": "H: cursor-agent 2026.11.13-eacade1 --help documents --output-format <text|json|stream-json> with no file-path argument; D: installed-module bundle read on noodle (~/.local/share/cursor-agent/versions/2026.10.01-e373342/7000.index.js), never executed shows the single terminal result object shape; Observed 2026-11-17: plain-model smoke emitted exactly one result with subtype success, is_error false and result cursor-smoke-ok, exit 0; dispatch unqualified pending human review"
980
980
  },
981
981
  "stdin": {
982
982
  "support": "unqualified",
983
983
  "mapping": "brief-text: omitting the prompt argument makes the CLI read the prompt from stdin to EOF; brief text never enters argv, rendered commands or serialized plans",
984
- "evidence": "D: installed-module bundle read on noodle (~/.local/share/cursor-agent/versions/2026.10.01-e373342/7000.index.js), never executed shows the prompt-building function reads stdin to EOF only when no positional prompt argument is supplied; unqualified until live evidence"
984
+ "evidence": "D: installed-module bundle read on noodle (~/.local/share/cursor-agent/versions/2026.10.01-e373342/7000.index.js), never executed shows the prompt-building function reads stdin to EOF only when no positional prompt argument is supplied; Observed 2026-11-17: brief piped on stdin with no positional prompt produced cursor-smoke-ok, exit 0; dispatch unqualified pending human review"
985
985
  },
986
986
  "structuredOutput": {
987
987
  "support": "unqualified",
988
988
  "mapping": "unavailable: no output-schema flag is documented",
989
- "evidence": "H: cursor-agent 2026.10.01-e373342 --help advertises no output-schema flag; unqualified until live evidence"
989
+ "evidence": "H: cursor-agent 2026.11.13-eacade1 --help advertises no output-schema flag; unqualified until live evidence"
990
990
  },
991
991
  "stepCap": {
992
992
  "support": "unqualified",
993
993
  "mapping": "unavailable: no step or turn cap flag is evidenced; deadline and output-byte bounds come from the invoking shell",
994
- "evidence": "H: cursor-agent 2026.10.01-e373342 --help advertises no step-cap flag; unknown controls block tasks requiring them"
994
+ "evidence": "H: cursor-agent 2026.11.13-eacade1 --help advertises no step-cap flag; unknown controls block tasks requiring them"
995
995
  },
996
996
  "trust": {
997
997
  "support": "unqualified",
998
998
  "mapping": "always emitted: [--trust] removes the only documented workspace-trust prompt so the non-interactive run cannot block on it",
999
- "evidence": "H: cursor-agent 2026.10.01-e373342 --help documents --trust ('Trust the current workspace without prompting'); unqualified until live evidence"
999
+ "evidence": "H: cursor-agent 2026.11.13-eacade1 --help documents --trust ('Trust the current workspace without prompting'); Observed 2026-11-17: --trust smoke completed with no interaction_query or error events; dispatch unqualified pending human review"
1000
1000
  },
1001
1001
  "children": {
1002
1002
  "support": "unqualified",
1003
1003
  "mapping": "unknown: no subagent/child-process fan-out flag is documented for -p",
1004
- "evidence": "H: cursor-agent 2026.10.01-e373342 --help documents no child-process flag for -p; unqualified until live evidence"
1004
+ "evidence": "H: cursor-agent 2026.11.13-eacade1 --help documents no child-process flag for -p; unqualified until live evidence"
1005
1005
  },
1006
1006
  "fallback": {
1007
1007
  "support": "unqualified",
1008
1008
  "mapping": "unavailable: no fallback-model flag is documented",
1009
- "evidence": "H: cursor-agent 2026.10.01-e373342 --help advertises no fallback-model flag; unknown controls block tasks requiring them"
1009
+ "evidence": "H: cursor-agent 2026.11.13-eacade1 --help advertises no fallback-model flag; unknown controls block tasks requiring them"
1010
1010
  }
1011
1011
  },
1012
1012
  "envAllowlist": [
@@ -1015,16 +1015,17 @@
1015
1015
  "PATH"
1016
1016
  ],
1017
1017
  "pitfalls": [
1018
- "Documentation/help and synthetic observations are not authenticated live qualification.",
1018
+ "Help, live model list and smoke observations from 2026-11-17 are recorded in docs/providers/cursor-direct.md; dispatch remains unqualified pending human review of a live run.",
1019
1019
  "Unknown model, effort, permission or required step mappings block dispatch.",
1020
+ "On hosts with kernel.apparmor_restrict_unprivileged_userns=1, cursorsandbox needs a host AppArmor profile; without it the CLI reports Sandbox mode is enabled but not available in plain text and exits non-zero.",
1020
1021
  "Native MCP/client, MSP/ACP, gateway and conversation capabilities do not establish worker authority.",
1021
1022
  "-f/--force, --yolo and --auto-review are never part of the direct profile; none was ever shipped as a new argv-prompt path.",
1022
1023
  "--approve-mcps is a BYPASS, not a harmless convenience: it sets ignoreApprovals:true on the MCP approval source (installed-module bundle read, 8192.index.js), which is folded with --force/--yolo into one upstream bypass flag. Without it, an MCP server not already recorded as approved fails its load() call and is skipped; the run continues without that server's tools. It is never emitted by this profile.",
1023
1024
  "This version's non-interactive path has no type:\"error\" terminal event: a thrown error writes plain text and exits non-zero with no JSON result line at all; a missing terminal plus a non-zero exit is the failure signal here. Defensively, ANY type:\"error\" event or non-null top-level error field fails the stream regardless of position, including after an earlier success.",
1024
1025
  "A type:\"interaction_query\" line means the CLI is waiting for an approval answer this profile cannot supply; treated as fatal regardless of position (before or after a success line), never as a pending success.",
1025
1026
  "The template placeholder ${mode} documents the conditional --mode ask that read-only additionally emits on top of --sandbox enabled; it is omitted entirely for workspace-write, never rendered as an empty token.",
1026
- "CURSOR_API_KEY must be present for auth (there is no login on the evidenced host); HOME locates ~/.cursor for persistent settings.",
1027
- "SE4: the raw `cursor-agent --version` banner is `2026.10.01-e373342` (leading-zero day-of-month), which is not valid semver; supportedVersions here is the semver-normalized `2026.10.1-e373342` and a caller must apply the same normalization to the live version string before qualification, or a correct installation is unconditionally refused."
1027
+ "Auth may use CURSOR_API_KEY or an existing login (live smoke used login); HOME locates ~/.cursor for persistent settings.",
1028
+ "SE4: historical raw banner 2026.10.01-e373342 needs semver normalization to 2026.10.1-e373342; current supported version 2026.11.13-eacade1 needs no normalization."
1028
1029
  ],
1029
1030
  "health": {
1030
1031
  "version": 1,
@@ -1050,8 +1051,8 @@
1050
1051
  {
1051
1052
  "kind": "help",
1052
1053
  "ref": "tools/ralph-external/lib/cursor-adapter.mjs",
1053
- "observedAt": "2026-10-10T00:00:00Z",
1054
- "cliVersion": "2026.10.1-e373342"
1054
+ "observedAt": "2026-11-17T00:00:00Z",
1055
+ "cliVersion": "2026.11.13-eacade1"
1055
1056
  },
1056
1057
  {
1057
1058
  "kind": "repository",
@@ -141,23 +141,24 @@
141
141
  "cursor": {
142
142
  "roles": {
143
143
  "reasoning": {
144
- "id": "claude-4.6-opus-high-thinking",
145
- "status": "unverified",
146
- "observed": false
144
+ "id": "claude-opus-5-thinking-high",
145
+ "status": "active",
146
+ "observed": true
147
147
  },
148
148
  "coding": {
149
- "id": "claude-4.6-sonnet",
150
- "status": "unverified",
151
- "observed": false
149
+ "id": "gpt-5.3-codex-high",
150
+ "status": "active",
151
+ "observed": true
152
152
  },
153
153
  "efficiency": {
154
- "id": "auto",
155
- "status": "unverified",
156
- "observed": false
154
+ "id": "composer-2.5",
155
+ "status": "active",
156
+ "observed": true
157
157
  }
158
158
  },
159
159
  "sourceUrl": "https://cursor.com/docs/models",
160
- "verifiedAt": "2026-07-20"
160
+ "verifiedAt": "2026-11-17",
161
+ "evidence": "Source: live cursor-agent 2026.11.13-eacade1 --list-models on 2026-11-17 (models.txt); account-offered IDs observed, not dispatch qualification. See docs/providers/cursor-direct.md#live-observations-2026-11-17."
161
162
  },
162
163
  "factory": {
163
164
  "roles": {
@@ -33,9 +33,9 @@ export const PROVIDER_DISCOVERY_DECISIONS = {
33
33
  },
34
34
  cursor: {
35
35
  provider: 'cursor',
36
- status: 'unsupported',
37
- interface: null,
38
- reason: 'Cursor CLI exposes editor and agent launch controls but no documented machine-readable model enumeration surface.',
36
+ status: 'native',
37
+ interface: 'cursor-agent --list-models',
38
+ reason: 'The read-only account list reports exact Cursor selectors; automatic selectors are observed but unavailable for workers.',
39
39
  documentation: 'https://docs.cursor.com/en/cli/reference/parameters',
40
40
  },
41
41
  factory: {
@@ -636,6 +636,7 @@ export async function resolveDynamicModelCatalog(options) {
636
636
  muse: () => discoverMuseCatalogModels({
637
637
  ...options.muse, catalogDir: options.muse?.catalogDir ?? join(homeDir, MUSE_CATALOG_DIR), now: options.now,
638
638
  }),
639
+ cursor: async () => (await import('./cursor-models.js')).discoverProjectCursorModels(options),
639
640
  factory: async () => {
640
641
  const { discoverProjectFactoryModels } = await import('./factory-models.js');
641
642
  return discoverProjectFactoryModels(options.inventory.projectDir, { homeDir, runner: options.runner, now: options.now });
@@ -356,7 +356,7 @@ export function validateWorkerPolicyRoute(input) {
356
356
  if (input.context && !workerContextHeadroom(input.context, observation).fits) {
357
357
  const missing = [observation.contextTokens === null ? 'contextTokens' : ''].filter(Boolean);
358
358
  deny('OG_MODEL_UNAPPROVED', '/worker/contextTokens', missing.length
359
- ? `Bounded context and output cannot be checked: catalog does not report a qualified ${missing.join(', ')} limit. Refresh discovery with reported limits; operator approval does not invent limits.`
359
+ ? `Bounded context and output cannot be checked: catalog does not report a qualified ${missing.join(', ')} limit. Refresh discovery with reported limits; operator approval does not invent limits.${input.inferenceProvider === 'cursor' ? ` Set parallelism.clis.${observation.cliId}.modelLimits["${input.selectedModel}"].contextTokens and refresh discovery/requalify.` : ''}`
360
360
  : 'Bounded context and output do not fit qualified limits; reduce the request context or reserved output.');
361
361
  }
362
362
  if (input.context && observation.contextTokens !== null && observation.maxOutputTokens === null) {
@@ -1,4 +1,5 @@
1
1
  /** Offline S1 health readiness projection; never launch authority or a probe. */
2
+ import { workerWiringDiagnostics } from './worker-wiring-diagnostics.js';
2
3
  import { homedir } from 'node:os';
3
4
  import { collectLocalOnlyPaths } from './conductor-data-policy.mjs';
4
5
  import { isAbsolute, join, resolve } from 'node:path';
@@ -119,6 +120,9 @@ export function diagnoseWorkerHealthReadiness(snapshot, request, paths = {}) {
119
120
  nextAction: 'use-direct-checkpoint', role: null });
120
121
  return report;
121
122
  }
123
+ for (const diagnostic of workerWiringDiagnostics(p, snapshot.models.defaults.workerSelection)) {
124
+ add({ ...diagnostic, status: 'warn', role: null, nextAction: 'review-worker-configuration' });
125
+ }
122
126
  const enabledGroups = Object.values(p?.groups ?? {});
123
127
  const required = new Set(enabledGroups.flatMap(group => group.requiredRoles ?? []));
124
128
  const roles = new Set([...Object.keys(snapshot.models.defaults.workerSelection?.roleGuidance ?? {}), ...required]);
@@ -47,6 +47,8 @@ export function inspectRecordedWorkerQualifications(input: {
47
47
  cwd: string; policy: WorkerSelectionPolicy; parallelism: import('../config/aiwg-config.js').ParallelismConfig;
48
48
  /** Include signed historical inputs for offline health projection, never launch authority. */
49
49
  includeInputs?: boolean;
50
+ /** Signed policy drift only; rejected records never grant authority. */
51
+ diagnostics?: import('./types.js').WorkerPolicyDiagnostic[];
50
52
  }): Promise<Array<{ cli: string; provider: string; binding?: WorkerResolutionBinding;
51
53
  adapter?: import('./provider-policy.js').WorkerAdapterMetadata;
52
54
  observations?: import('./model-discovery.js').ProviderModelDiscovery }>>;
@@ -754,7 +754,7 @@ async function qualificationSignatureFailure(record, trust) {
754
754
  * This is historical evidence, not current launch authority; loadRecordedWorkerInstallations
755
755
  * performs binary/version/scope checks when dispatch actually requests a binding.
756
756
  */
757
- export async function inspectRecordedWorkerQualifications({ cwd, policy, parallelism, includeInputs = false }) {
757
+ export async function inspectRecordedWorkerQualifications({ cwd, policy, parallelism, includeInputs = false, diagnostics = [] }) {
758
758
  const filename = installationStorePath();
759
759
  await assertTrustedStore(filename, [cwd]);
760
760
  const { stored } = await readInstallationStore(filename);
@@ -767,8 +767,8 @@ export async function inspectRecordedWorkerQualifications({ cwd, policy, paralle
767
767
  const configured = parallelism?.clis?.[cli];
768
768
  if (!configured || configured.enabled === false || !/^[a-z][a-z0-9-]{0,62}$/.test(cli)
769
769
  || await realpath(installation.cwd) !== workspace
770
- || qualificationDigest(policy) !== installation.effectiveConfigDigest
771
770
  || (installation.localModelsDigest || configured.localModels) && installation.localModelsDigest !== qualificationDigest(configured.localModels ?? null)
771
+ || (installation.modelLimitsDigest || configured.modelLimits) && installation.modelLimitsDigest !== qualificationDigest(configured.modelLimits ?? null)
772
772
  || configured.adapter !== `providers:${adapter.provider}` && configured.adapter !== adapter.id
773
773
  || configured.accountScope !== binding.accountScope
774
774
  || binding.profile !== installation.profile || binding.cliVersion !== installation.cliVersion
@@ -776,6 +776,11 @@ export async function inspectRecordedWorkerQualifications({ cwd, policy, paralle
776
776
  const proof = adapter.invocationProfiles?.[binding.profile]?.installationQualification;
777
777
  if (!proof || ['scopeDigest', 'fixtureDigest', 'verifiedAt', 'evidenceRef'].some(key => proof[key] !== installation.evidence?.[key])) continue;
778
778
  if (await qualificationSignatureFailure(record, () => qualificationTrust(cwd))) continue;
779
+ if (qualificationDigest(policy) !== installation.effectiveConfigDigest) {
780
+ const { workerQualificationPolicyDiagnostic } = await import('./worker-qualification-policy.js');
781
+ diagnostics.push(workerQualificationPolicyDiagnostic([{ registration: 0, reason: 'effective-config-digest' }], [record], policy));
782
+ continue;
783
+ }
779
784
  await assertWorkerInstallationEvidence({ ...installation, adapter, now: Date.now(), policy }, proof.scopeDigest);
780
785
  results.push({ cli, provider: adapter.provider, ...(includeInputs
781
786
  ? { binding: structuredClone(binding), adapter: structuredClone(adapter), observations: structuredClone(record.modelObservations) } : {}) });
@@ -917,6 +922,7 @@ export async function loadRecordedWorkerInstallations({ registry, cwd, policy, p
917
922
  || binding.accountScope !== installation.accountScope
918
923
  || qualificationDigest(binding.boundary) !== qualificationDigest(installation.boundary)) throw fail();
919
924
  if (parallelism && (installation.localModelsDigest || parallelism.clis?.[cli]?.localModels) && installation.localModelsDigest !== qualificationDigest(parallelism.clis?.[cli]?.localModels ?? null)) throw fail();
925
+ if (parallelism && (installation.modelLimitsDigest || parallelism.clis?.[cli]?.modelLimits) && installation.modelLimitsDigest !== qualificationDigest(parallelism.clis?.[cli]?.modelLimits ?? null)) throw fail();
920
926
  reason = 'effective-config-digest';
921
927
  if (qualificationDigest(policy) !== installation.effectiveConfigDigest) throw fail();
922
928
  reason = 'evidence';
@@ -45,7 +45,7 @@ export function isOperatorQualifiedWorkerAdapter(adapter) {
45
45
  }
46
46
  /** Bundled renderers with an independently checked native direct baseline. */
47
47
  export function hasOperatorWorkerNativeRenderer(adapter) {
48
- return isOperatorQualifiedWorkerAdapter(adapter) && ['codex', 'muse', 'factory'].includes(adapter.provider)
48
+ return isOperatorQualifiedWorkerAdapter(adapter) && ['codex', 'muse', 'factory', 'cursor'].includes(adapter.provider)
49
49
  && adapter.invocation.kind === 'process';
50
50
  }
51
51
  /** The process-group launch boundary requires the independently verified native renderer. */
@@ -73,6 +73,26 @@ export function assertOperatorWorkerNativeArgv(adapter, argv, selected, permissi
73
73
  const sandbox = permissions?.sandbox ?? 'workspace-write';
74
74
  if (!['read-only', 'workspace-write', 'external'].includes(sandbox))
75
75
  throw new Error('Requested sandbox has no verified native renderer');
76
+ if (adapter.provider === 'cursor') {
77
+ if (sandbox === 'external' || (permissions?.approval ?? 'never') !== 'never') {
78
+ throw new Error('Cursor direct worker requires native sandbox and never approval');
79
+ }
80
+ if (!selected.model || /[\0[\]"]/.test(selected.model)
81
+ || ['opus', 'sonnet', 'haiku', 'auto', 'default'].includes(selected.model.toLowerCase())
82
+ || selected.effort.value === null || !/^[A-Za-z0-9_.-]+$/.test(selected.effort.value)) {
83
+ throw new Error('Cursor direct worker requires an exact model ID and explicit effort metadata');
84
+ }
85
+ const cwd = args[args.indexOf('--workspace') + 1];
86
+ if (!args.includes('--workspace') || !cwd?.startsWith('/') || cwd.includes('\0')) {
87
+ throw new Error('Cursor direct worker requires an absolute workspace');
88
+ }
89
+ const expected = ['-p', '--output-format', 'stream-json', '--trust', '--sandbox', 'enabled',
90
+ ...(sandbox === 'read-only' ? ['--mode', 'ask'] : []), '--workspace', cwd, '--model', selected.model];
91
+ if (args.length !== expected.length || args.some((value, index) => value !== expected[index])) {
92
+ throw new Error('Cursor native worker controls could be overridden');
93
+ }
94
+ return;
95
+ }
76
96
  if (adapter.provider === 'factory') {
77
97
  if (sandbox === 'external' || (permissions?.approval ?? 'never') !== 'never') {
78
98
  throw new Error('Factory direct worker requires native sandbox and never approval');
@@ -124,10 +124,12 @@ export function resolveWorkerPlan(snapshot, request, ceilingDefaults = {}) {
124
124
  if (request.member && !request.group)
125
125
  block('OG_CONFIG_REFERENCE', '/request/member', 'Group-local member pins require a group');
126
126
  if (request.group && !guidance?.groups.includes(request.group))
127
- block('OG_CONFIG_REFERENCE', '/request/group', 'Group is outside role guidance');
127
+ block('OG_CONFIG_REFERENCE', '/request/group', `Group is outside role guidance. Edit models.json: add ${JSON.stringify(request.group)} to defaults.workerSelection.roleGuidance.${role}.groups.`);
128
128
  if ([request.maxParallel, snapshot.constraints?.maxParallel].some(value => value !== undefined && (!Number.isSafeInteger(value) || value < 0)))
129
129
  block('OG_CONFIG_REFERENCE', '/request/maxParallel', 'Capacity ceilings must be nonnegative integers');
130
130
  plan.diagnostics.push(...workerReviewLineageDiagnostics(request));
131
+ if (plan.diagnostics.some(diagnostic => diagnostic.code === 'OG_CONFIG_REFERENCE'))
132
+ return plan;
131
133
  const candidateGroups = request.group ? [request.group] : guidance?.groups ?? [];
132
134
  const unqualifiedGroups = new Set(qualificationGaps.map(gapGroup));
133
135
  const qualifiedGroups = candidateGroups.filter(groupId => !unqualifiedGroups.has(groupId));
@@ -0,0 +1,25 @@
1
+ // Audit declared worker routes without granting qualification or launch authority.
2
+ import { expandWorkerGroupTemplates } from '../config/worker-group-templates.js';
3
+ export function workerWiringDiagnostics(parallelism, policy) {
4
+ const groups = expandWorkerGroupTemplates(parallelism).parallelism?.groups ?? {};
5
+ const diagnostics = [];
6
+ for (const [id, group] of Object.entries(groups)) {
7
+ const roles = new Set([...group.members.filter(member => member.enabled !== false
8
+ && parallelism?.clis?.[member.cli]?.enabled !== false).flatMap(member => member.roles), ...group.requiredRoles ?? []]);
9
+ for (const role of roles) {
10
+ if (policy?.roleGuidance?.[role]?.groups.includes(id))
11
+ continue;
12
+ diagnostics.push({ code: 'OG_CONFIG_REFERENCE', pointer: `/defaults/workerSelection/roleGuidance/${role}/groups`,
13
+ message: `Group ${JSON.stringify(id)} is outside role guidance for ${role}. Edit models.json: add ${JSON.stringify(id)} to defaults.workerSelection.roleGuidance.${role}.groups.`,
14
+ roles: [role] });
15
+ }
16
+ }
17
+ for (const cli of Object.keys(parallelism?.clis ?? {})) {
18
+ if (Object.values(groups).some(group => group.members.some(member => member.cli === cli)))
19
+ continue;
20
+ diagnostics.push({ code: 'OG_CONFIG_REFERENCE', pointer: `/parallelism/clis/${cli}`, blocking: false,
21
+ message: `Declared CLI ${JSON.stringify(cli)} is used by no group. Add a member with cli=${JSON.stringify(cli)} to parallelism.groups in .aiwg/aiwg.config, or remove parallelism.clis.${cli}.` });
22
+ }
23
+ return diagnostics;
24
+ }
25
+ //# sourceMappingURL=worker-wiring-diagnostics.js.map
@@ -40,6 +40,9 @@ export const CONTEXT_CONTRACTS = {
40
40
  verification: { method: 'official Copilot CLI custom-instruction imports', source: 'https://docs.github.com/en/copilot/how-tos/copilot-cli/customize-copilot/add-custom-instructions', lastVerified: VERIFIED_ON },
41
41
  },
42
42
  cursor: {
43
+ promptDiscovery: { delivery: 'hook-bridge', event: 'beforeSubmitPrompt', files: [
44
+ '.cursor/hooks.json', '.cursor/hooks/aiwg-prompt-discovery.cjs',
45
+ ] },
43
46
  startupFiles: ['AGENTS.md', 'CLAUDE.md', '.cursor/rules/*.mdc'], precedence: ['provider/system', 'project rules', 'root AGENTS.md'],
44
47
  loadMode: 'prose-directive', includeSyntax: null, configRegistration: null,
45
48
  bootstrapTargets: ['AGENTS.md'], maxContextBytes: null, recommendedMaxLines: 500, nestedContext: false, support: 'supported',
@@ -239,7 +239,7 @@ export const BUILT_IN_SEEDS_1 = [
239
239
  },
240
240
  adapters: {
241
241
  agentFormat: 'cursor-json',
242
- hookBridge: null,
242
+ hookBridge: 'cursor',
243
243
  mcpInjection: 'cursor',
244
244
  contextAggregation: 'agents-md',
245
245
  ruleFormat: 'mdc',
@@ -5,7 +5,7 @@
5
5
  * Muse Code reads project AGENTS.md natively — but only after the workspace
6
6
  * is explicitly trusted (first-run trust prompt). The bridge therefore leads
7
7
  * with the trust-gated load, follows the Muse-native instruction order
8
- * (this AGENTS.md first, then WORKSPACE.md, then AIWG.md), and states the
8
+ * (this AGENTS.md first, discovery, then WORKSPACE.md and AIWG.md), and states the
9
9
  * discover-first protocol (`aiwg discover` / `aiwg show`) with no auto-load
10
10
  * claims for other AIWG paths. Artifact references and one-sentence
11
11
  * summaries only — never full bodies — per
@@ -30,14 +30,17 @@ export function buildMuseBridgeText() {
30
30
  'file does not load: trust the workspace when prompted, then start a new',
31
31
  'Muse session so the bridge is read.',
32
32
  '',
33
- 'Instruction order: this AGENTS.md first, then [WORKSPACE.md](./WORKSPACE.md)',
33
+ 'Instruction order: this AGENTS.md first (native startup context).',
34
+ 'On every new directive, run `aiwg discover "<intent>"` as the first information-gathering call,',
35
+ 'before reading WORKSPACE.md, AIWG.md, the rules index, or quickrefs; this includes coding, decline, and bug-report requests.',
36
+ 'After discovery, read and follow [WORKSPACE.md](./WORKSPACE.md)',
34
37
  'for project/operator context, then [AIWG.md](./AIWG.md), the single generated',
35
38
  'context for AIWG discovery, quickrefs, and framework routing.',
36
39
  'Plain Markdown links are explicit reading instructions; AIWG does not',
37
40
  'claim Muse auto-loads any other AIWG path on its own.',
38
41
  '',
39
- 'Before improvising on any AIWG capability: run `aiwg discover "<intent>"`,',
40
- 'then `aiwg show <type> <name>` for the artifact you need. Prefer indexed',
42
+ "For AIWG lookup, never open `.agents/skills/**` or `agentic/code/**`, including a discovered skill's mirror file or a template. After discover, use `aiwg show <type> <name>` and its drill-ins (`--section`, `--rules --with-rule-bodies`, `--body`); read required rules before governed work.",
43
+ 'Prefer indexed',
41
44
  'agents, skills, rules, and commands over guessing. Store artifact',
42
45
  'references and one-sentence summaries only — never paste full artifact',
43
46
  'bodies into context or memory.',
@@ -9,8 +9,23 @@ import { providerForPath } from './workspace-document.js';
9
9
  import { extractExistingProjectContext } from './workspace-extraction.js';
10
10
  import { projectOutputPath } from './workspace-migration.js';
11
11
  export function directives(content) {
12
- return [...new Set(content
13
- .split('\n')
12
+ const lines = content.split('\n');
13
+ return [...new Set(lines
14
+ .filter((line, index) => {
15
+ const trimmed = line.trim();
16
+ // Markdown structure and canonical context bridges are not operator policy.
17
+ if (/^#{1,6}\s|^(?:[-*_]\s*){3,}$|^=+$/.test(trimmed))
18
+ return false;
19
+ if (/^\s*(?:=+|-+)\s*$/.test(lines[index + 1] ?? ''))
20
+ return false;
21
+ if (/^@(?:\.\/|\.aiwg\/)?(?:AIWG|WORKSPACE|AGENTS|CLAUDE|WARP)\.md\s*$/.test(trimmed))
22
+ return false;
23
+ if (/^Read and follow \[WORKSPACE\.md\]\(\.\/WORKSPACE\.md\) first\.$/.test(trimmed))
24
+ return false;
25
+ if (/^Then read \[AIWG\.md\]\(\.\/AIWG\.md\) for AIWG discovery, quickrefs, and framework routing\.$/.test(trimmed))
26
+ return false;
27
+ return true;
28
+ })
14
29
  .map((line) => line.replace(/^\s*[-*+]\s+/, '').replace(/^#+\s+/, '').trim())
15
30
  .filter((line) => line.length >= 8 && !line.startsWith('<!--') && !/^https?:\/\//i.test(line)))];
16
31
  }
@@ -69,7 +84,9 @@ function operatorContext(relativePath, content, preserveLines = false) {
69
84
  // content (#277, pre-existing) plus two reserved, self-identifying names
70
85
  // that are never legitimately a real project directory.
71
86
  export const CONTEXT_WALK_ALWAYS_IGNORED_DIR_NAMES = new Set([
72
- '.git', 'node_modules', 'dist', 'build', 'coverage', '.aiwg',
87
+ '.git', 'node_modules', 'dist', 'build', 'coverage', '.aiwg', '.index',
88
+ // These files were already excluded after traversal; prune their entire trees.
89
+ 'fixtures', 'templates',
73
90
  ]);
74
91
  // Cache/registry directory names that are only skipped when the walk root
75
92
  // is the home directory itself (#277 fix-round). A project subtree that
@@ -157,13 +174,22 @@ export async function nestedInstructionFiles(projectPath) {
157
174
  const isHomeDirectory = path.resolve(projectPath) === path.resolve(homedir());
158
175
  const maxDepth = isHomeDirectory ? 1 : CONTEXT_WALK_MAX_DEPTH;
159
176
  let visitedDirectories = 0;
160
- let truncated = false;
177
+ const bounds = new Map();
178
+ const subtreeVisits = new Map();
161
179
  async function walk(directory, depth) {
162
180
  if (depth > maxDepth || visitedDirectories >= CONTEXT_WALK_MAX_DIRECTORIES) {
163
- truncated = true;
181
+ const bound = depth > maxDepth ? 'depth' : 'directories';
182
+ if (!bounds.has(bound))
183
+ bounds.set(bound, {
184
+ limit: bound === 'depth' ? maxDepth : CONTEXT_WALK_MAX_DIRECTORIES,
185
+ path: path.relative(projectPath, directory).replace(/\\/g, '/'),
186
+ });
164
187
  return;
165
188
  }
166
189
  visitedDirectories += 1;
190
+ const subtree = path.relative(projectPath, directory).split(path.sep)[0];
191
+ if (subtree)
192
+ subtreeVisits.set(subtree, (subtreeVisits.get(subtree) ?? 0) + 1);
167
193
  let entries;
168
194
  try {
169
195
  entries = await fs.readdir(directory, { withFileTypes: true });
@@ -191,7 +217,11 @@ export async function nestedInstructionFiles(projectPath) {
191
217
  }
192
218
  }
193
219
  await walk(projectPath, 1);
194
- return { files: found.sort((a, b) => a.localeCompare(b)), truncated };
220
+ const busiest = [...subtreeVisits].sort((a, b) => b[1] - a[1] || a[0].localeCompare(b[0]))[0];
221
+ const truncations = [...bounds].map(([bound, detail]) => ({
222
+ bound, ...detail, subtree: busiest?.[0] ?? '.', visitedDirectories: busiest?.[1] ?? visitedDirectories,
223
+ }));
224
+ return { files: found.sort((a, b) => a.localeCompare(b)), truncated: bounds.size > 0, truncations };
195
225
  }
196
226
  export async function migratedProviderFiles(projectPath) {
197
227
  const directory = projectAiwgPath(projectPath, 'context', 'providers');
@@ -302,6 +332,7 @@ export async function auditWorkspaceContext(projectPath) {
302
332
  conflicts,
303
333
  sensitiveFindings,
304
334
  contextWalkTruncated: nested.truncated,
335
+ contextWalkTruncations: nested.truncations,
305
336
  plan: {
306
337
  routing,
307
338
  scopeReview,
@@ -18,6 +18,8 @@ const PROSE_LOADING = [
18
18
  'Then read [AIWG.md](./AIWG.md) for AIWG discovery, quickrefs, and framework routing.',
19
19
  '',
20
20
  'These are explicit reading instructions. Plain Markdown links are not claimed to auto-load.',
21
+ '',
22
+ "For AIWG lookup, never open `.agents/skills/**` or `agentic/code/**`, including a discovered skill's mirror file or a template. After discover, use `aiwg show <type> <name>` and its drill-ins (`--section`, `--rules --with-rule-bodies`, `--body`); read required rules before governed work.",
21
23
  ];
22
24
  function wrapProviderBootstrap(loading) {
23
25
  return [
@@ -53,7 +55,7 @@ export function buildProviderBootstrapBlock(provider) {
53
55
  // A session directive that arrives later cannot claim precedence it was never
54
56
  // granted (#2512).
55
57
  // #227: Muse gets its own discover-first bridge text — Muse-native
56
- // instruction order (this AGENTS.md first, then WORKSPACE.md, then AIWG.md)
58
+ // instruction order (discovery, then WORKSPACE.md, then AIWG.md)
57
59
  // plus the trust-gated load caveat — instead of the generic prose-directive.
58
60
  const loading = provider === 'muse'
59
61
  ? [buildMuseBridgeText()]
@@ -39,7 +39,7 @@ export async function workspaceLinkedFiles(projectPath) {
39
39
  return [...new Set(files)].sort();
40
40
  }
41
41
  export async function diagnoseWorkspaceContext(projectPath) {
42
- const diagnostics = await diagnoseUserHookCommands();
42
+ const diagnostics = await diagnoseUserHookCommands(projectPath);
43
43
  const codexTrust = await diagnoseCodexHookTrust(projectPath);
44
44
  if (codexTrust)
45
45
  diagnostics.push(codexTrust);
@@ -95,7 +95,7 @@ export async function diagnoseWorkspaceContext(projectPath) {
95
95
  diagnostics.push({
96
96
  severity: 'info',
97
97
  code: 'context-walk-truncated',
98
- message: 'Nested-instruction-file walk stopped early (depth/entry bound reached, or the root looks like $HOME or has no project markers); the context graph may be incomplete.',
98
+ message: `Nested-instruction-file walk stopped early: ${audit.contextWalkTruncations?.map((hit) => `${hit.bound}=${hit.limit} reached at ${hit.path}; busiest subtree ${hit.subtree} (${hit.visitedDirectories} visited directories)`).join('; ')}; the context graph may be incomplete.`,
99
99
  });
100
100
  }
101
101
  const workspacePath = path.join(projectPath, 'WORKSPACE.md');
@@ -142,8 +142,20 @@ export async function diagnoseWorkspaceContext(projectPath) {
142
142
  // and degrades the workspace over content that agrees with itself (#2558).
143
143
  const duplicatesByPair = new Map();
144
144
  for (const overlap of audit.identical) {
145
- const key = overlap.sources.join(', ');
146
- duplicatesByPair.set(key, (duplicatesByPair.get(key) ?? 0) + overlap.directives.length);
145
+ // Shared boilerplate in independent repositories is outside a single load scope.
146
+ const byScope = new Map();
147
+ for (const source of overlap.sources) {
148
+ const scope = await directoryScope(path.dirname(path.resolve(root, source)));
149
+ const paths = byScope.get(scope) ?? [];
150
+ paths.push(source);
151
+ byScope.set(scope, paths);
152
+ }
153
+ for (const paths of byScope.values()) {
154
+ if (paths.length < 2)
155
+ continue;
156
+ const key = paths.join(', ');
157
+ duplicatesByPair.set(key, (duplicatesByPair.get(key) ?? 0) + overlap.directives.length);
158
+ }
147
159
  }
148
160
  const operatorBodies = new Map(audit.sources.map((source) => [source.path, source.operatorContent.trim()]));
149
161
  for (const [pair, count] of duplicatesByPair) {
@@ -103,8 +103,10 @@ export function buildWorkspaceManagedBlock(projectPath, providerFiles = [], resi
103
103
  '## AIWG Context Graph',
104
104
  '',
105
105
  'This file is the canonical provider-neutral home for project and operator context.',
106
- 'Provider startup files are generated adapters: they direct the harness here first,',
107
- 'then to AIWG.md for framework discovery and routing.',
106
+ 'Provider startup files are generated adapters and native startup context.',
107
+ 'On every new directive, run `aiwg discover` before tool-based context reads;',
108
+ 'then read WORKSPACE.md, then AIWG.md for framework discovery and routing.',
109
+ 'This read order does not change the policy precedence below.',
108
110
  '',
109
111
  '### Precedence',
110
112
  '',