sneakoscope 10.6.2 → 10.7.1

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 (135) hide show
  1. package/README.md +28 -6
  2. package/config/perf-budgets.v1.json +1 -2
  3. package/config/skills-hash-ledger.v1.json +7 -2
  4. package/crates/sks-core/Cargo.lock +1 -1
  5. package/crates/sks-core/Cargo.toml +1 -1
  6. package/dist/bin/sks-dispatch.js +6 -3
  7. package/dist/cli/args.js +3 -1
  8. package/dist/cli/command-manifest-lite.js +48 -114
  9. package/dist/cli/command-registry.js +1 -18
  10. package/dist/cli/commands-fast.js +11 -4
  11. package/dist/cli/help-fast.js +11 -22
  12. package/dist/cli/help.js +3 -3
  13. package/dist/cli/install-helpers-codex-lb-config.js +11 -8
  14. package/dist/cli/install-helpers.js +1 -1
  15. package/dist/cli/router.js +12 -26
  16. package/dist/commands/codex-app.js +2 -2
  17. package/dist/commands/doctor-helpers.js +1 -1
  18. package/dist/commands/mad-sks.js +2 -2
  19. package/dist/config/skills-manifest.json +13 -8
  20. package/dist/core/agent-bridge/async-command.js +2 -2
  21. package/dist/core/agents/agent-recursion-guard.js +0 -2
  22. package/dist/core/agents/agent-role-config.js +6 -2
  23. package/dist/core/agents/sks-model-pin-hygiene.js +150 -0
  24. package/dist/core/auto-review.js +15 -172
  25. package/dist/core/code-structure.js +0 -1
  26. package/dist/core/codex/codex-config-guard.js +18 -13
  27. package/dist/core/codex-app/codex-app-ui-state-snapshot.js +7 -1
  28. package/dist/core/codex-control/codex-reliability-shield.js +64 -15
  29. package/dist/core/codex-control/codex-sdk-adapter.js +38 -5
  30. package/dist/core/codex-lb/bridge-contracts.js +5 -0
  31. package/dist/core/codex-lb/combined-catalog/builder.js +4 -2
  32. package/dist/core/codex-lb/combined-catalog/latest-generation.js +7 -34
  33. package/dist/core/codex-lb/combined-catalog/normalize.js +3 -1
  34. package/dist/core/codex-lb/desktop-bridge/codex-lb-turn-state.js +35 -0
  35. package/dist/core/codex-lb/desktop-bridge/compaction-adapter.js +3 -0
  36. package/dist/core/codex-lb/desktop-bridge/header-policy.js +10 -4
  37. package/dist/core/codex-lb/desktop-bridge/http-forward.js +92 -30
  38. package/dist/core/codex-lb/desktop-bridge/provider-handoff.js +79 -0
  39. package/dist/core/codex-lb/desktop-bridge/responses-websocket.js +57 -13
  40. package/dist/core/codex-lb/desktop-bridge/security.js +101 -55
  41. package/dist/core/codex-lb/desktop-bridge/server.js +10 -2
  42. package/dist/core/codex-lb/desktop-bridge/types.js +3 -0
  43. package/dist/core/codex-lb/desktop-bridge/websocket-forward.js +3 -0
  44. package/dist/core/codex-lb/desktop-controller-v3/catalog.js +13 -0
  45. package/dist/core/codex-lb/desktop-controller-v3/provider-commands.js +0 -9
  46. package/dist/core/codex-lb/desktop-service.js +10 -13
  47. package/dist/core/codex-lb/request-route-resolver.js +1 -1
  48. package/dist/core/codex-runtime/codex-desktop-config-policy.js +0 -1
  49. package/dist/core/commands/agent-bridge-command.js +1 -1
  50. package/dist/core/commands/basic-cli.js +60 -233
  51. package/dist/core/commands/command-utils.js +1 -1
  52. package/dist/core/commands/gc-command.js +30 -29
  53. package/dist/core/commands/image-ux-review-command.js +1 -1
  54. package/dist/core/commands/install-package-command.js +1 -1
  55. package/dist/core/commands/intent-normalization/normalizer.js +2 -2
  56. package/dist/core/commands/pipeline-command.js +13 -5
  57. package/dist/core/commands/plan-command.js +2 -3
  58. package/dist/core/commands/research-command.js +0 -3
  59. package/dist/core/commands/review-command.js +1 -1
  60. package/dist/core/commands/seo-command.js +27 -20
  61. package/dist/core/commands/status-command.js +8 -2
  62. package/dist/core/doctor/command-alias-cleanup.js +6 -6
  63. package/dist/core/evaluation.js +1 -1
  64. package/dist/core/feature-fixtures.js +9 -43
  65. package/dist/core/feature-registry.js +9 -27
  66. package/dist/core/git-hygiene/shared-memory-publish.js +1 -1
  67. package/dist/core/hooks-runtime/jev-spawn-routing.js +1 -5
  68. package/dist/core/hooks-runtime/parent-orchestration-gate.js +6 -8
  69. package/dist/core/hooks-runtime/stop-repeat-guard.js +0 -13
  70. package/dist/core/hooks-runtime.js +13 -9
  71. package/dist/core/init/skills.js +27 -16
  72. package/dist/core/init.js +0 -9
  73. package/dist/core/install/installed-package-smoke.js +3 -1
  74. package/dist/core/perf/import-graph-budget.js +0 -1
  75. package/dist/core/perf/release-latency-slo.js +2 -30
  76. package/dist/core/pipeline-internals/pipeline-stage-builder.js +2 -4
  77. package/dist/core/pipeline-internals/runtime-core.js +2 -38
  78. package/dist/core/proof/route-proof-policy.js +2 -4
  79. package/dist/core/proof/runtime-truth-matrix.js +2 -2
  80. package/dist/core/proof-field.js +104 -39
  81. package/dist/core/provider/provider-context.js +4 -1
  82. package/dist/core/questions.js +11 -7
  83. package/dist/core/release/gate-affected-globs.js +0 -2
  84. package/dist/core/research/research-reviewer-contract.js +34 -0
  85. package/dist/core/research/research-work-graph.js +1 -1
  86. package/dist/core/research.js +1 -1
  87. package/dist/core/routes/constants.js +0 -1
  88. package/dist/core/routes/diagnostic-allowlist.js +1 -3
  89. package/dist/core/routes/light-routes.js +1 -2
  90. package/dist/core/routes.js +1 -1
  91. package/dist/core/safety/command-contract/contracts.js +5 -1
  92. package/dist/core/search/context.js +2 -2
  93. package/dist/core/search-visibility/marketing-truthfulness.js +10 -7
  94. package/dist/core/search-visibility/marketing.js +194 -149
  95. package/dist/core/skill-forge.js +1 -361
  96. package/dist/core/strategy/adhd-orchestrating-gate.js +3 -3
  97. package/dist/core/triwiki/context-graph/extractors/topology/commands.js +2 -6
  98. package/dist/core/triwiki-wrongness/wrongness-cli.js +9 -27
  99. package/dist/core/update/update-migration-state.js +10 -40
  100. package/dist/core/version.js +1 -1
  101. package/package.json +2 -3
  102. package/release-gates.v2.json +1 -32
  103. package/dist/cli/recallpulse-command.js +0 -144
  104. package/dist/commands/auto-review.js +0 -5
  105. package/dist/commands/codex-native.js +0 -77
  106. package/dist/commands/recallpulse.js +0 -5
  107. package/dist/core/codex-native/codex-native-interop-policy.js +0 -127
  108. package/dist/core/commands/autoresearch-command.js +0 -4
  109. package/dist/core/commands/code-structure-command.js +0 -52
  110. package/dist/core/commands/goal-command.js +0 -43
  111. package/dist/core/commands/recallpulse-command.js +0 -4
  112. package/dist/core/commands/remote-command.js +0 -119
  113. package/dist/core/commands/skill-dream-command.js +0 -43
  114. package/dist/core/commands/wrongness-command.js +0 -2
  115. package/dist/core/goal-workflow.js +0 -80
  116. package/dist/core/mcp/mcp-tool-name-normalizer.js +0 -28
  117. package/dist/core/recallpulse/policy.js +0 -207
  118. package/dist/core/recallpulse.js +0 -947
  119. package/dist/core/remote/audit-idempotency.js +0 -241
  120. package/dist/core/remote/index.js +0 -10
  121. package/dist/core/remote/machine-registry.js +0 -167
  122. package/dist/core/remote/owner-proof.js +0 -216
  123. package/dist/core/remote/protocol.js +0 -249
  124. package/dist/core/remote/readiness.js +0 -156
  125. package/dist/core/remote/session-index.js +0 -61
  126. package/dist/core/remote/session-snapshot.js +0 -197
  127. package/dist/core/remote/ssh-worker-client.js +0 -377
  128. package/dist/core/remote/types.js +0 -10
  129. package/dist/core/remote/worker.js +0 -360
  130. package/dist/core/search/context-graph-seeds.js +0 -15
  131. package/dist/core/verification/context-graph-affected.js +0 -312
  132. package/dist/core/verification/verification-artifact-lock.js +0 -21
  133. package/dist/core/verification/verification-dag.js +0 -89
  134. package/dist/core/verification/verification-result.js +0 -19
  135. package/dist/core/verification/verification-worker-pool.js +0 -204
@@ -5,11 +5,21 @@ import { flag, readOption } from './command-utils.js';
5
5
  import { runSearchVisibilityApply, runSearchVisibilityAudit, runSearchVisibilityDoctor, runSearchVisibilityFixture, runSearchVisibilityPlan, runSearchVisibilityResearch, runSearchVisibilityRollback, runSearchVisibilityStatus, runSearchVisibilityStrategy, runSearchVisibilityVerify, resolveSearchVisibilityMission, } from '../search-visibility/index.js';
6
6
  import { evaluateGate } from '../stop-gate/gate-evaluator.js';
7
7
  import { evaluateLocalGate } from './route-success-helpers.js';
8
+ const SEO_GEO_USAGE = [
9
+ 'Usage: sks seo-geo-optimizer [seo|geo] doctor|audit|research|strategy|plan|apply|verify|status|rollback|fixture [mission|latest] [--mode seo|geo] [--root <path>] [--url <origin>] [--target auto|website|docs|package] [--framework auto|next-app|next-pages|static] [--offline] [--strict] [--include-marketing] [--json]',
10
+ ' sks seo-geo-optimizer research [mission|latest] [--offline] [--include-competitors --competitor <url>...] [--json]',
11
+ ' sks seo-geo-optimizer strategy <mission|latest> [--json]',
12
+ ' sks seo-geo-optimizer apply <mission|latest> --mode seo|geo --apply [--include-marketing] [--include-llms-txt] [--scope <rule-or-path,...>] [--yes] [--json]',
13
+ ' sks seo-geo-optimizer rollback <mission|latest> --mode seo|geo --apply [--yes] [--json]'
14
+ ];
15
+ export function usage() {
16
+ return SEO_GEO_USAGE.join('\n');
17
+ }
8
18
  export async function seoGeoOptimizerCommand(args = []) {
9
19
  const normalized = normalizeOptimizerArgs(args);
10
- return runSearchVisibilityCommand(normalized.mode, normalized.args, 'seo-geo-optimizer');
20
+ return runSearchVisibilityCommand(normalized.mode, normalized.args);
11
21
  }
12
- export async function runSearchVisibilityCommand(mode, args = [], displayCommand = mode) {
22
+ export async function runSearchVisibilityCommand(mode, args = []) {
13
23
  const action = args[0] || 'doctor';
14
24
  const rest = args.slice(1);
15
25
  const options = await parseOptions(rest);
@@ -63,7 +73,7 @@ export async function runSearchVisibilityCommand(mode, args = [], displayCommand
63
73
  else if (action === 'fixture')
64
74
  result = await runSearchVisibilityFixture(mode, options);
65
75
  else
66
- return usage(mode, 2, displayCommand);
76
+ return invalidSubcommand(mode);
67
77
  result = await applySearchVisibilityGateResult(mode, action, result, options);
68
78
  if (isBlocked(result))
69
79
  process.exitCode = 1;
@@ -152,6 +162,7 @@ async function parseOptions(args) {
152
162
  includeLlmsTxt: flag(args, '--include-llms-txt'),
153
163
  includeMarketing: flag(args, '--include-marketing'),
154
164
  includeCompetitors: flag(args, '--include-competitors'),
165
+ competitorUrls: readRepeated(args, '--competitor'),
155
166
  strategyRef: readOption(args, '--strategy-ref', null),
156
167
  maxMarketingSources: Number(readOption(args, '--max-marketing-sources', '4')) || 4,
157
168
  observeQueries: flag(args, '--observe-queries'),
@@ -159,6 +170,14 @@ async function parseOptions(args) {
159
170
  scope: String(readOption(args, '--scope', '') || '').split(',').map((item) => item.trim()).filter(Boolean),
160
171
  };
161
172
  }
173
+ function readRepeated(args, name) {
174
+ const out = [];
175
+ for (let i = 0; i < args.length; i += 1) {
176
+ if (args[i] === name && args[i + 1])
177
+ out.push(...String(args[i + 1]).split(','));
178
+ }
179
+ return out.map((value) => value.trim()).filter(Boolean);
180
+ }
162
181
  function targetOption(value) {
163
182
  return ['auto', 'website', 'docs', 'package'].includes(value) ? value : 'auto';
164
183
  }
@@ -166,7 +185,7 @@ function frameworkOption(value) {
166
185
  return ['auto', 'next-app', 'next-pages', 'static', 'package', 'unsupported'].includes(value) ? value : 'auto';
167
186
  }
168
187
  function firstPositional(args) {
169
- const valueFlags = new Set(['--root', '--url', '--target', '--framework', '--scope', '--query-file', '--strategy-ref', '--max-marketing-sources']);
188
+ const valueFlags = new Set(['--root', '--url', '--target', '--framework', '--scope', '--query-file', '--strategy-ref', '--max-marketing-sources', '--competitor']);
170
189
  for (let i = 0; i < args.length; i += 1) {
171
190
  const value = args[i] || '';
172
191
  if (valueFlags.has(value)) {
@@ -178,22 +197,10 @@ function firstPositional(args) {
178
197
  }
179
198
  return null;
180
199
  }
181
- function usage(mode, exitCode, displayCommand = mode) {
182
- if (displayCommand === 'seo-geo-optimizer') {
183
- console.error('Usage: sks seo-geo-optimizer [seo|geo] doctor|audit|research|strategy|plan|apply|verify|status|rollback|fixture [mission|latest] [--mode seo|geo] [--root <path>] [--url <origin>] [--target auto|website|docs|package] [--framework auto|next-app|next-pages|static] [--offline] [--strict] [--include-marketing] [--json]');
184
- console.error(' sks seo-geo-optimizer research [mission|latest] [--offline] [--include-competitors] [--json]');
185
- console.error(' sks seo-geo-optimizer strategy <mission|latest> [--json]');
186
- console.error(' sks seo-geo-optimizer apply <mission|latest> --mode seo|geo --apply [--include-marketing] [--include-llms-txt] [--scope <rule-or-path,...>] [--yes] [--json]');
187
- console.error(' sks seo-geo-optimizer rollback <mission|latest> --mode seo|geo --apply [--yes] [--json]');
188
- process.exitCode = exitCode;
189
- return { schema: 'sks.search-visibility.usage.v1', ok: false, status: 'blocked', mode, command: displayCommand, reason: 'invalid_subcommand' };
190
- }
191
- const applyFlag = mode === 'geo' ? ' [--include-llms-txt]' : '';
192
- console.error(`Usage: sks ${mode} doctor|audit|research|strategy|plan|apply|verify|status|rollback|fixture [mission|latest] [--root <path>] [--url <origin>] [--target auto|website|docs|package] [--framework auto|next-app|next-pages|static] [--offline] [--strict] [--include-marketing] [--json]`);
193
- console.error(` sks ${mode} apply <mission|latest> --apply${applyFlag} [--include-marketing] [--scope <rule-or-path,...>] [--yes] [--json]`);
194
- console.error(` sks ${mode} rollback <mission|latest> --apply [--yes] [--json]`);
195
- process.exitCode = exitCode;
196
- return { schema: 'sks.search-visibility.usage.v1', ok: false, status: 'blocked', mode, reason: 'invalid_subcommand' };
200
+ function invalidSubcommand(mode) {
201
+ console.error(usage());
202
+ process.exitCode = 2;
203
+ return { schema: 'sks.search-visibility.usage.v1', ok: false, status: 'blocked', mode, command: 'seo-geo-optimizer', reason: 'invalid_subcommand' };
197
204
  }
198
205
  function isBlocked(value) {
199
206
  if (!value || typeof value !== 'object')
@@ -4,6 +4,7 @@ import { listSessionStates, stateFile } from '../mission.js';
4
4
  import { readRouteProof } from '../proof/proof-reader.js';
5
5
  import { latestTrustReport } from '../trust-kernel/trust-report.js';
6
6
  import { flag } from './command-utils.js';
7
+ import { stopFinalizationRitualsEnforced } from '../verification-profile.js';
7
8
  export async function statusCommand(args = []) {
8
9
  const root = await projectRoot();
9
10
  const state = await readJson(stateFile(root), {});
@@ -23,7 +24,7 @@ export async function statusCommand(args = []) {
23
24
  agent_status: proof?.evidence?.agents?.status || (state.agents_required === false ? 'not_required' : 'not_recorded'),
24
25
  image_voxel_status: proof?.evidence?.image_voxels?.status || 'not_recorded',
25
26
  db_safety_status: proof?.evidence?.db || proof?.evidence?.db_safety ? 'recorded' : 'not_recorded',
26
- next_action: nextAction(state, trust, proof),
27
+ next_action: nextAction(state, trust, proof, stopFinalizationRitualsEnforced(root)),
27
28
  sessions: sessions.map(sessionStatusRow),
28
29
  files: missionId ? {
29
30
  mission: path.join(root, '.sneakoscope', 'missions', missionId),
@@ -61,9 +62,14 @@ function printSessionTable(sessions = []) {
61
62
  console.log(` ${row.session_key} ${row.mission_id || 'none'} ${row.route || '-'} ${row.phase || '-'}`);
62
63
  }
63
64
  }
64
- function nextAction(state = {}, trust = {}, proof = {}) {
65
+ function nextAction(state = {}, trust = {}, proof = {}, strict = false) {
65
66
  if (!state.mission_id)
66
67
  return 'no active mission; ask Codex directly, or use $sks-plan or $sks-naruto';
68
+ if (!strict) {
69
+ return trust?.issues?.length
70
+ ? `resolve trust blocker: ${trust.issues[0]}`
71
+ : 'finish the route and state what changed and what was verified';
72
+ }
67
73
  if (!proof?.schema)
68
74
  return `write completion proof for ${state.mission_id}`;
69
75
  if (trust?.ok)
@@ -4,7 +4,7 @@ import path from 'node:path';
4
4
  import { COMMAND_CATALOG } from '../routes.js';
5
5
  import { nowIso, writeJsonAtomic } from '../fsx.js';
6
6
  import { cleanupRemovedSksSkillResidue } from '../init/skills.js';
7
- import { COMMANDS, LEGACY_COMMAND_ALIASES, commandNames } from '../../cli/command-registry.js';
7
+ import { COMMANDS, COMMAND_ALIASES, commandNames } from '../../cli/command-registry.js';
8
8
  import { REMOVED_PUBLIC_COMMANDS } from './retired-managed-residue-private.js';
9
9
  import { reconcileRetiredManagedResidue, RETIRED_MANAGED_RESIDUE_SCHEMA } from './retired-managed-residue.js';
10
10
  import { CURRENT_PROJECT_GUIDANCE_SCHEMA, reconcileCurrentProjectGuidance } from './current-project-guidance.js';
@@ -121,15 +121,15 @@ function aggregateAgentBridgeManifest(reports) {
121
121
  }
122
122
  export function commandAliasCleanupReport(opts, skillResidue = emptySkillResidue(Boolean(opts.fix)), managedResidue = emptyManagedResidue(Boolean(opts.fix)), projectGuidance = emptyProjectGuidance(Boolean(opts.fix)), skillLegacySurface = emptySkillLegacySurface(Boolean(opts.fix))) {
123
123
  const root = opts.root;
124
- const legacyAliases = Object.entries(LEGACY_COMMAND_ALIASES).map(([alias, canonical]) => ({ alias, canonical }));
124
+ const aliases = Object.entries(COMMAND_ALIASES).map(([alias, canonical]) => ({ alias, canonical }));
125
125
  const registeredRemovedCommands = REMOVED_PUBLIC_COMMANDS
126
126
  .filter((name) => Object.prototype.hasOwnProperty.call(COMMANDS, name));
127
127
  const catalogRemovedCommands = REMOVED_PUBLIC_COMMANDS
128
128
  .filter((name) => COMMAND_CATALOG.some((row) => row.name === name));
129
129
  const redirectingRemovedCommands = REMOVED_PUBLIC_COMMANDS
130
- .filter((name) => Object.prototype.hasOwnProperty.call(LEGACY_COMMAND_ALIASES, name));
130
+ .filter((name) => Object.prototype.hasOwnProperty.call(COMMAND_ALIASES, name));
131
131
  const canonical = commandNames();
132
- const missingCanonicalTargets = legacyAliases
132
+ const missingCanonicalTargets = aliases
133
133
  .filter((entry) => !canonical.includes(entry.canonical))
134
134
  .map((entry) => `${entry.alias}->${entry.canonical}`);
135
135
  const blockers = [
@@ -161,8 +161,8 @@ export function commandAliasCleanupReport(opts, skillResidue = emptySkillResidue
161
161
  fix: Boolean(opts.fix),
162
162
  report_path: path.join(root, '.sneakoscope', 'reports', 'command-alias-cleanup.json'),
163
163
  canonical_command_count: canonical.length,
164
- current_alias_count: legacyAliases.length,
165
- aliases: legacyAliases,
164
+ current_alias_count: aliases.length,
165
+ aliases,
166
166
  detected: {
167
167
  retired_registry_entry_count: registeredRemovedCommands.length,
168
168
  retired_catalog_entry_count: catalogRemovedCommands.length,
@@ -364,7 +364,7 @@ export function defaultEvaluationScenario() {
364
364
  ['req-wiki-rgba', 'TriWiki stores RGBA-derived trigonometric wiki anchors so compressed context remains hydratable by id, hash, source, and coordinate.', 'code', 'high', 1.2],
365
365
  ['req-retention', 'runtime logs and mission artifacts are bounded through retention policy and sks gc.', 'code', 'medium', 0.85],
366
366
  ['req-selftest', 'selftest covers contract sealing, DB guard blocking, done-gate evaluation, GX render/validate/drift, snapshot, and retention report.', 'test', 'high', 1.1],
367
- ['req-skill', 'sks init installs one canonical repo-local Codex App skill set under .agents/skills so project workflows can trigger domain-specific guidance without duplicate commands.', 'code', 'medium', 0.9],
367
+ ['req-skill', 'sks setup installs one canonical repo-local Codex App skill set under .agents/skills so project workflows can trigger domain-specific guidance without duplicate commands.', 'code', 'medium', 0.9],
368
368
  ['req-design', 'design artifact work should gather design context, build an HTML artifact, expose variations when useful, and verify rendered output.', 'code', 'medium', 0.8]
369
369
  ];
370
370
  const noise = [
@@ -37,15 +37,11 @@ const FIXTURES = Object.freeze({
37
37
  'cli-mcp': fixture('execute', 'sks mcp config list --scope project --trusted-project --json', [], 'pass', {
38
38
  reason: 'Project-scoped MCP inventory is a read-only, hermetic runtime probe when the trusted-project boundary is explicit; mutation, health, auth, and merge behavior remain covered by dedicated tests.'
39
39
  }),
40
- 'cli-remote': fixture('real_optional', 'sks remote readiness --json', [], 'pass', {
41
- reason: 'Remote readiness is environment-dependent on the official Codex host and local project capabilities; SSH worker behavior is covered by dedicated hermetic protocol and policy tests.'
42
- }),
43
40
  'cli-hooks': fixture('execute', 'sks hooks trust-report --json', [], 'pass'),
44
41
  'cli-commands': fixture('execute', 'sks commands --json', [], 'pass'),
45
42
  'cli-plan': fixture('execute', 'sks plan "fixture" --json', [], 'pass'),
46
43
  'cli-review': fixture('execute', 'sks review --diff HEAD --json', [], 'pass'),
47
44
  'cli-status': fixture('execute', 'sks status --json', [], 'pass'),
48
- 'cli-usage': fixture('execute', 'sks usage overview', [], 'pass'),
49
45
  'cli-quickstart': fixture('execute', 'sks quickstart', [], 'pass'),
50
46
  'cli-install': fixture('static', 'npm exec --yes --package=sneakoscope@latest -- sneakoscope install --yes', [], 'pass', {
51
47
  quality: 'wiring_only',
@@ -55,15 +51,12 @@ const FIXTURES = Object.freeze({
55
51
  'cli-update-check': fixture('static', 'sks update-check --json', [], 'pass'),
56
52
  'cli-guard': fixture('execute', 'sks guard check --json', [], 'pass'),
57
53
  'cli-conflicts': fixture('execute', 'sks conflicts check --json', [], 'pass'),
58
- 'cli-aliases': fixture('execute', 'sks aliases', [], 'pass'),
59
- 'cli-fix-path': fixture('execute', 'sks fix-path --json', [], 'pass'),
60
54
  'cli-wiki-code': fixture('execute_and_validate_artifacts', 'sks align run --token-budget 20000 --json', [{ path: '.sneakoscope/wiki/code-pack.json', schema: 'sks.code-pack.v1', optional: true }], 'pass'),
61
55
  'cli-agent-bridge': fixture('execute_and_validate_artifacts', 'sks agent-bridge setup --json', [{ path: '.sneakoscope/agent-bridge/manifest.json', schema: 'sks.agent-manifest.v2', optional: true }], 'pass'),
62
56
  'cli-mcp-server': fixture('execute', 'sks mcp-server --probe', [], 'pass'),
63
57
  'cli-selftest': fixture('execute', 'sks selftest --mock', [], 'pass'),
64
58
  'cli-git': fixture('execute', 'sks git policy --json', [], 'pass'),
65
59
  'cli-uninstall': fixture('execute', 'sks uninstall --dry-run --json', [], 'pass'),
66
- 'cli-goal': fixture('execute', 'sks goal create "Fixture smoke: create a minimal Node.js CLI health-check script" --json', [], 'pass', { reason: 'The compatibility command is stateless: it prints a detailed Codex native /goal request and writes no SKS mission, artifact, loop, or fallback state.' }),
67
60
  'cli-align': fixture('execute_and_validate_artifacts', 'sks align prepare "fixture modernization contract" --json', ['work-order-ledger.json', 'align-plan.json', 'align-ledger.json', 'align-gate.json'], 'pass', {
68
61
  reason: 'The CLI fixture exercises the real hermetic preparation path, including literal-request work-order registration. It intentionally leaves align-gate.json blocked because no external modernization work is fabricated.'
69
62
  }),
@@ -74,43 +67,34 @@ const FIXTURES = Object.freeze({
74
67
  'cli-image-ux-review': fixture('execute_and_validate_artifacts', 'sks image-ux-review fixture --mock --json', ['completion-proof.json', 'image-voxel-ledger.json', 'image-ux-generated-review-ledger.json'], 'blocked', { reason: 'Same as route-image-ux-review: the image-ux-review fixture command intentionally always exits 1 by design (honest mock, cannot claim a real completion), even though it does write all declared artifacts.' }),
75
68
  'cli-computer-use': fixture('real_optional', 'sks computer-use status --json', [], 'pass'),
76
69
  'cli-pipeline': fixture('execute_and_validate_artifacts', 'sks pipeline plan latest --agents 1 --json', ['pipeline-plan.json'], 'pass'),
77
- 'cli-recallpulse': fixture('execute_and_validate_artifacts', 'sks recallpulse run latest --json', ['mission-status-ledger.json'], 'pass'),
78
70
  'cli-gx': fixture('execute_and_validate_artifacts', 'sks gx validate fixture --mock', ['gx-validation.json'], 'blocked', { reason: 'gxValidateFixture() intentionally exits non-zero (execution_class: mock_fixture) for an honest mock/blocked result; without --mock the command crashes on a missing cartridge instead.' }),
79
- 'cli-code-structure': fixture('execute', 'sks code-structure scan --json', [], 'pass', { timeout_ms: 180000 }),
80
71
  'cli-decision': fixture('execute', 'sks decision status --json', [], 'pass'),
81
72
  'cli-imagegen': fixture('execute', 'sks imagegen status --json', [], 'pass'),
82
- 'cli-skill-dream': fixture('execute', 'sks skill-dream status --json', [], 'pass'),
83
73
  'cli-gc': fixture('execute', 'sks gc --dry-run --json', [], 'pass'),
84
74
  'cli-eval': fixture('execute', 'sks eval run --mock --json', [], 'pass'),
85
75
  'cli-cleanup': fixture('execute', 'sks cleanup plan --json', [], 'pass', {
86
76
  reason: 'Destructive blank-state apply stays behind explicit `sks cleanup run --apply`; the contract fixture only exercises the read-only plan surface.'
87
77
  }),
88
- 'cli-memory': fixture('execute', 'sks memory --dry-run --json', [], 'pass', { timeout_ms: 300000 }),
89
- 'cli-stats': fixture('execute', 'sks stats --json', [], 'pass'),
78
+ 'cli-memory': fixture('execute', 'sks memory gc --dry-run --json', [], 'pass', { timeout_ms: 300000 }),
90
79
  'cli-dollar-commands': fixture('execute', 'sks dollar-commands --json', [], 'pass'),
91
80
  'cli-fast-mode': fixture('execute', 'sks fast-mode status --json', [], 'pass'),
92
81
  'cli-dfix': fixture('execute_and_validate_artifacts', 'sks dfix fixture --json', ['completion-proof.json', 'dfix-gate.json', 'dfix-verification.json'], 'pass'),
93
82
  'cli-wiki': fixture('execute_and_validate_artifacts', 'sks wiki image-ingest test/fixtures/images/one-by-one.png --json', [{ path: '.sneakoscope/wiki/image-voxel-ledger.json', schema: 'sks.image-voxel-ledger.v1', require_anchors: false }], 'pass'),
94
- 'cli-bootstrap': fixture('execute', 'sks bootstrap --dry-run', [], 'pass'),
95
- 'cli-deps': fixture('execute', 'sks deps check --json', [], 'pass'),
96
- 'cli-auth': fixture('execute', 'sks auth status --json', [], 'pass'),
97
- 'cli-codex-native': fixture('execute', 'sks codex-native status --json', [], 'pass'),
98
- 'cli-mad': fixture('execute', 'sks mad --help', [], 'pass'),
83
+ 'cli-bootstrap': fixture('real_optional', 'sks bootstrap --json', [], 'pass', {
84
+ reason: 'Bootstrap is real project setup (`setup --local-only`) and refuses --dry-run, so it runs only on opt-in real runs.'
85
+ }),
99
86
  'cli-mad-sks': fixture('static', 'sks mad-sks status --json', [], 'pass'),
100
- 'cli-auto-review': fixture('execute', 'sks auto-review status --json', [], 'pass'),
101
87
  'cli-commit': fixture('mock', 'sks commit --dry-run', [], 'pass', {
102
- reason: 'simpleGitCommitCommand() in git-simple.ts performs a real `git add -A && git commit` against whatever repo cwd it runs in; it has no --dry-run implementation (argValue() only reads --message/-m/--json, so --dry-run is silently ignored) and would mutate git history if actually spawned by an automated fixture runner. Left as documented mock rather than execute a real commit or invent an unsupported --dry-run mode.'
88
+ reason: '`--dry-run` prints the commit plan without touching git (simpleGitCommitPlan in git-simple.ts, covered by git-simple-dry-run.test.ts); the fixture stays mock because the hermetic fixture project is not a git repository.'
103
89
  }),
104
90
  'cli-commit-and-push': fixture('mock', 'sks commit-and-push --dry-run', [], 'pass', {
105
- reason: 'Same underlying simpleGitCommitCommand() as cli-commit plus a real `git push`; genuinely destructive (commits and pushes to the remote) with no real --dry-run support. Left as documented mock rather than execute a real commit+push or invent an unsupported --dry-run mode.'
91
+ reason: 'Same handler as cli-commit plus a push; `--dry-run` prints the plan only. Mock for the same reason as cli-commit.'
106
92
  }),
107
93
  'cli-context7': fixture('real_optional', 'sks context7 check --json', [], 'pass'),
108
94
  'cli-super-search': fixture('execute', 'sks super-search doctor --json', [], 'pass'),
109
95
  'cli-search': fixture('execute', 'sks search status --json', [], 'pass'),
110
96
  'cli-triwiki': fixture('execute', 'sks triwiki index --json', [], 'pass'),
111
- 'cli-init': fixture('execute', 'sks init --local-only --dry-run', [], 'pass'),
112
97
  'cli-naruto': fixture('execute_and_validate_artifacts', 'sks naruto run "fixture" --agents 4 --max-threads 4 --json', ['subagent-plan.json', 'subagent-events.jsonl', 'subagent-evidence.json', 'naruto-summary.json', 'naruto-gate.json', 'work-order-ledger.json'], 'pass', preparationFixtureContract()),
113
- 'cli-reasoning': fixture('execute', 'sks reasoning status --json', [], 'pass'),
114
98
  'skill-db-safety-guard': fixture('execute', 'node --test test/unit/db-safety.test.mjs', [], 'pass', { root_mode: 'source_checkout_required' }),
115
99
  'skill-honest-mode': fixture('execute_and_validate_artifacts', 'sks proof smoke --json', ['completion-proof.json', 'trust-report.json'], 'pass'),
116
100
  'skill-imagegen': fixture('execute_and_validate_artifacts', 'sks image-ux-review fixture --mock --json', ['image-ux-generated-review-ledger.json', 'image-voxel-ledger.json'], 'pass'),
@@ -124,9 +108,6 @@ const FIXTURES = Object.freeze({
124
108
  'skill-context7-docs': fixture('real_optional', 'sks context7 check --json', [], 'pass'),
125
109
  'skill-seo-geo-optimizer': fixture('execute_and_validate_artifacts', 'sks seo-geo-optimizer fixture --mode geo --json', ['search-visibility/site-inventory.json', 'search-visibility/geo-findings.json', 'geo-gate.json', 'completion-proof.json'], 'pass'),
126
110
  'cli-proof': fixture('execute_and_validate_artifacts', 'sks proof smoke --json', ['.sneakoscope/proof/latest.json'], 'pass'),
127
- 'cli-wrongness': fixture('execute', 'sks wrongness validate project --json', [], 'pass', {
128
- reason: 'Release fixtures must not add synthetic project-wide wrongness records. The read-only validator exercises the CLI and ledger schema without contaminating trust state for later route proofs.'
129
- }),
130
111
  'route-naruto': fixture('execute_and_validate_artifacts', 'sks naruto run "fixture" --agents 4 --max-threads 4 --json', ['subagent-plan.json', 'subagent-events.jsonl', 'subagent-evidence.json', 'naruto-summary.json', 'naruto-gate.json', 'work-order-ledger.json'], 'pass', preparationFixtureContract({ timeout_ms: 90000 })),
131
112
  'route-work': fixture('static', '$Work compatibility alias for the Naruto Codex official subagent workflow', [], 'pass', { quality: 'wiring_only', reason: 'Pure alias of $Naruto; official workflow execution is covered by route-naruto.' }),
132
113
  'route-plan': fixture('execute', 'sks plan "fixture" --json', [], 'pass'),
@@ -187,39 +168,24 @@ const FIXTURES = Object.freeze({
187
168
  reason: 'Pure alias of the cli-help command; no independent behavior to verify beyond cli-help\'s own execute fixture.'
188
169
  }),
189
170
  'route-commit': fixture('mock', '$Commit git route', ['completion-proof.json'], 'pass', {
190
- reason: 'Dollar-command alias of cli-commit; dispatches to the same simpleGitCommitCommand() that performs a real `git add -A && git commit` with no working --dry-run mode, so it is not safe to execute from an automated fixture runner. Left as documented mock alongside cli-commit.'
171
+ reason: 'Dollar-command alias of cli-commit; documented mock alongside cli-commit.'
191
172
  }),
192
173
  'route-commit-and-push': fixture('mock', '$Commit-And-Push git route', ['completion-proof.json'], 'pass', {
193
- reason: 'Dollar-command alias of cli-commit-and-push; dispatches to the same simpleGitCommitCommand() that performs a real commit and `git push` with no working --dry-run mode. Left as documented mock alongside cli-commit-and-push.'
174
+ reason: 'Dollar-command alias of cli-commit-and-push; documented mock alongside cli-commit-and-push.'
194
175
  }),
195
176
  'route-release-review': fixture('execute_and_validate_artifacts', 'sks naruto run "$Release-Review release audit" --agents 3 --max-threads 3 --read-only --json', ['subagent-plan.json', 'subagent-events.jsonl', 'subagent-evidence.json', 'naruto-summary.json', 'naruto-gate.json', 'work-order-ledger.json'], 'pass', preparationFixtureContract({ timeout_ms: 90000 })),
196
177
  'proof-official-subagent-evidence': fixture('execute_and_validate_artifacts', 'sks naruto run "fixture" --agents 2 --max-threads 2 --json', ['subagent-plan.json', 'subagent-events.jsonl', 'subagent-parent-summary.json', 'subagent-evidence.json', 'naruto-gate.json'], 'pass', preparationFixtureContract({ timeout_ms: 90000 }))
197
178
  });
198
179
  const STATIC_CONTRACT_FEATURES = new Set([
199
180
  'cli-bootstrap',
200
- 'cli-deps',
201
- 'cli-auth',
202
- 'cli-codex-native',
203
- 'cli-mad',
204
- 'cli-auto-review',
205
181
  'cli-commit',
206
182
  'cli-commit-and-push',
207
183
  'cli-context7',
208
184
  'cli-naruto',
209
- 'cli-reasoning',
210
185
  'cli-postinstall',
211
186
  'cli-menubar',
212
187
  'cli-route',
213
- 'cli-autoresearch',
214
- 'cli-hook',
215
- 'handler-$',
216
- 'handler-autoresearch',
217
- 'handler-autoreview',
218
- 'handler-computer-use',
219
- 'handler-cu',
220
- 'handler-dollars',
221
- 'handler-mad-sks',
222
- 'handler-postinstall'
188
+ 'cli-hook'
223
189
  ]);
224
190
  export function fixtureForFeature(featureId) {
225
191
  const fixtures = FIXTURES;
@@ -14,11 +14,8 @@ export const ALL_FEATURES_SELFTEST_SCHEMA = 'sks.all-features-selftest.v1';
14
14
  export const ALL_FEATURE_COMPLETION_SCHEMA = 'sks.all-feature-completion.v1';
15
15
  const HANDLER_ALIAS_TO_COMMAND = Object.freeze({
16
16
  hook: 'hooks',
17
- memory: 'gc',
18
17
  postinstall: 'postinstall',
19
- 'ux-review': 'image-ux-review',
20
- 'visual-review': 'image-ux-review',
21
- 'ui-ux-review': 'image-ux-review'
18
+ 'ux-review': 'image-ux-review'
22
19
  });
23
20
  const FEATURE_ACCEPTANCE_DEFAULTS = Object.freeze([
24
21
  'contracts tracked',
@@ -490,30 +487,23 @@ const SAFE_EXECUTABLE_FIXTURE_ARGS = Object.freeze({
490
487
  'cli-root': ['root', '--json'],
491
488
  'cli-commands': ['commands', '--json'],
492
489
  'cli-status': ['status', '--json'],
493
- 'cli-usage': ['usage', 'overview'],
494
490
  'cli-quickstart': ['quickstart'],
495
491
  'cli-guard': ['guard', 'check', '--json'],
496
492
  'cli-conflicts': ['conflicts', 'check', '--json'],
497
- 'cli-aliases': ['aliases'],
498
- 'cli-fix-path': ['fix-path', '--json'],
499
493
  'cli-selftest': ['selftest', '--mock'],
500
494
  'cli-git': ['git', 'policy', '--json'],
501
495
  'cli-seo-geo-optimizer': ['seo-geo-optimizer', 'fixture', '--mode', 'seo', '--json'],
502
496
  'cli-paths': ['paths', 'managed', '--json'],
503
497
  'cli-proof': ['proof', 'smoke', '--json'],
504
- 'cli-wrongness': ['wrongness', 'validate', 'project', '--json'],
505
498
  'cli-wiki': ['wiki', 'image-ingest', 'test/fixtures/images/one-by-one.png', '--json'],
506
499
  'cli-codex': ['codex', 'compatibility', '--json'],
507
500
  'cli-bridge': ['bridge', 'status', '--json'],
508
501
  'cli-hooks': ['hooks', 'trust-report', '--json'],
509
- 'cli-code-structure': ['code-structure', 'scan', '--json'],
510
502
  'cli-decision': ['decision', 'status', '--json'],
511
503
  'cli-imagegen': ['imagegen', 'status', '--json'],
512
- 'cli-skill-dream': ['skill-dream', 'status', '--json'],
513
504
  'cli-gc': ['gc', '--dry-run', '--json'],
514
505
  'cli-cleanup': ['cleanup', 'plan', '--json'],
515
- 'cli-memory': ['memory', '--dry-run', '--json'],
516
- 'cli-stats': ['stats', '--json'],
506
+ 'cli-memory': ['memory', 'gc', '--dry-run', '--json'],
517
507
  'cli-dollar-commands': ['dollar-commands', '--json'],
518
508
  'cli-fast-mode': ['fast-mode', 'status', '--json'],
519
509
  'cli-triwiki': ['triwiki', 'index', '--json'],
@@ -591,14 +581,13 @@ export function renderFeatureInventoryMarkdown(registry) {
591
581
  function commandFeature(command, handlerAliases = []) {
592
582
  const name = command.name;
593
583
  const category = commandCategory(name);
594
- const maturity = commandMaturity(name);
595
584
  const aliases = [...new Set(handlerAliases.map((alias) => `sks ${alias}`))];
596
585
  return baseFeature({
597
586
  id: `cli-${name}`,
598
587
  commands: [command.usage],
599
588
  aliases,
600
589
  category,
601
- maturity: command.maturity || maturity,
590
+ maturity: command.maturity,
602
591
  intent: command.description,
603
592
  completion_proof_integration: proofContract(category),
604
593
  voxel_triwiki_integration: voxelContract(category),
@@ -928,27 +917,20 @@ function slug(value) {
928
917
  return String(value || '').replace(/^\$/, '').toLowerCase().replace(/[^a-z0-9]+/g, '-').replace(/^-|-$/g, '');
929
918
  }
930
919
  function commandCategory(name) {
931
- if (['naruto', 'pipeline', 'goal', 'hproof', 'proof-field', 'validate-artifacts'].includes(name))
920
+ if (['naruto', 'pipeline'].includes(name))
932
921
  return 'proof-route';
933
- if (['qa-loop', 'research', 'recallpulse', 'skill-dream', 'eval', 'perf'].includes(name))
922
+ if (['qa-loop', 'research', 'eval'].includes(name))
934
923
  return 'loop';
935
- if (['codex', 'codex-app', 'codex-native', 'codex-lb', 'hooks', 'context7', 'computer-use'].includes(name))
924
+ if (['codex', 'codex-app', 'hooks', 'context7', 'computer-use'].includes(name))
936
925
  return 'integration';
937
- if (['db', 'guard', 'conflicts', 'harness', 'versioning'].includes(name))
926
+ if (['guard', 'conflicts'].includes(name))
938
927
  return 'safety';
939
- if (['wiki', 'wrongness', 'gx', 'image-ux-review', 'ppt'].includes(name))
928
+ if (['wiki', 'gx', 'image-ux-review', 'ppt'].includes(name))
940
929
  return 'visual-memory';
941
- if (['setup', 'bootstrap', 'doctor', 'deps', 'init', 'postinstall', 'fix-path'].includes(name))
930
+ if (['setup', 'bootstrap', 'doctor', 'postinstall'].includes(name))
942
931
  return 'install';
943
932
  return 'core-cli';
944
933
  }
945
- function commandMaturity(name) {
946
- if (['help', 'version', 'commands', 'usage', 'root', 'quickstart', 'setup', 'doctor', 'selftest', 'update-check', 'fast-mode'].includes(name))
947
- return 'stable';
948
- if (['codex', 'codex-app', 'codex-native', 'codex-lb', 'hooks', 'features', 'all-features', 'wiki', 'wrongness', 'naruto', 'pipeline', 'goal', 'db', 'guard', 'computer-use', 'mad-sks', 'seo-geo-optimizer'].includes(name))
949
- return 'beta';
950
- return 'labs';
951
- }
952
934
  function routeMaturity(command) {
953
935
  const key = dollarPolicyKey(command);
954
936
  if (['answer', 'dfix', 'sks', 'fast-mode', 'wiki', 'help'].includes(key))
@@ -691,7 +691,7 @@ export async function publishPlan(root) {
691
691
  commands: [
692
692
  'sks git doctor --fix',
693
693
  'sks wiki publish latest --shared',
694
- 'sks wrongness publish latest --shared',
694
+ 'sks wiki wrongness publish latest --shared',
695
695
  'sks wiki rebuild-index --json',
696
696
  'sks wiki validate-shared --json',
697
697
  'sks git precommit --json'
@@ -75,7 +75,7 @@ async function openRouterOnlySpawnRouting(root, parentState, input, allowlist) {
75
75
  const requestedEffort = String(input.reasoning_effort || '') || null;
76
76
  const agent = String(input.agent_type || input.agentType || '').trim() || null;
77
77
  const task = spawnTask(input, { items: true });
78
- const choice = task && !parentState?.jev_execution_plan
78
+ const choice = task
79
79
  ? await chooseChildModel({ root, task, role: agent, requestedModel: requested, requestedEffort, state, profile: childModelListProfile(allowlist) })
80
80
  .catch(() => fallbackChildModel(state, requested, 'consult_failed', requestedEffort))
81
81
  : fallbackChildModel(state, requested, 'empty_task', requestedEffort);
@@ -144,10 +144,6 @@ async function tierSpawnRewrite(root, state, input) {
144
144
  return next;
145
145
  }
146
146
  }
147
- if (boundPlan) {
148
- const fallback = roleTierFallback(agent);
149
- return { ...input, model: fallback.model, reasoning_effort: fallback.effort, ...forkTurns };
150
- }
151
147
  const decision = await consultJevTurnModel({ root, prompt: task, roleId: 'spawn' }).catch(() => null);
152
148
  if (!decision?.called)
153
149
  return null;
@@ -328,14 +328,12 @@ export async function evaluateParentOrchestrationGate(input) {
328
328
  const message = ledger.escapes === 0 ? escapeMessage(missionId, intent, next) : null;
329
329
  return { action: 'escape', reason: 'max_blocks_reached', message, jev: null };
330
330
  }
331
- const jev = state?.jev_execution_plan
332
- ? { called: false, choice: null, reason: 'turn_binding_keeps_delegation_baseline' }
333
- : await consultJevToolDelegation({
334
- root,
335
- missionGoal: missionGoal(state),
336
- toolName: intent.toolName,
337
- targets: intent.targets
338
- }).catch(() => ({ called: false, choice: null, reason: 'consult_failed' }));
331
+ const jev = await consultJevToolDelegation({
332
+ root,
333
+ missionGoal: missionGoal(state),
334
+ toolName: intent.toolName,
335
+ targets: intent.targets
336
+ }).catch(() => ({ called: false, choice: null, reason: 'consult_failed' }));
339
337
  const base = {
340
338
  ...ledger,
341
339
  last_tool: intent.toolName,
@@ -1,6 +1,5 @@
1
1
  import path from 'node:path';
2
2
  import { nowIso, readJson, sha256, writeJsonAtomic } from '../fsx.js';
3
- import { appendMissionStatus } from '../recallpulse.js';
4
3
  import { conversationId } from './payload-signals.js';
5
4
  const STOP_REPEAT_GUARD_ARTIFACT = 'stop-hook-repeat-guard.json';
6
5
  const STOP_REPEAT_GUARD_WINDOW_MS = 10 * 60 * 1000;
@@ -53,18 +52,6 @@ export async function finalizationRepeatDecision(root, state = {}, payload = {},
53
52
  systemMessage: `SKS could not persist the ${kind} repeat budget. Finalization stopped fail-closed and completion remains unverified.`
54
53
  };
55
54
  }
56
- if (state.mission_id) {
57
- await appendMissionStatus(root, state.mission_id, {
58
- category: repeatCount >= limit ? 'warning' : 'blocker',
59
- audience: ['user', 'route', 'final-summary'],
60
- stage_id: 'before_final',
61
- message: repeatCount >= limit
62
- ? `Repeated ${kind} stop prompt was suppressed; route completion is still unclaimed until evidence passes.`
63
- : reason,
64
- dedupe_key: key,
65
- evidence: [STOP_REPEAT_GUARD_ARTIFACT]
66
- }).catch(() => null);
67
- }
68
55
  if (repeatCount < limit)
69
56
  return null;
70
57
  return {
@@ -335,17 +335,18 @@ async function hookUserPrompt(root, state, payload, noQuestion, sessionKey = nul
335
335
  const submittedPrompt = stripVisibleDecisionAnswerBlocks(extractUserPrompt(payload));
336
336
  let stagedMemory = null;
337
337
  const disposition = jevPlan?.memoryDisposition;
338
- if (state?.mission_id && jevPlan?.executionPlan) {
338
+ const plan = jevPlan?.executionPlan || null;
339
+ if (state?.mission_id && (plan || state?.jev_execution_plan)) {
339
340
  await setCurrent(root, {
340
- jev_execution_plan: jevPlan.executionPlan,
341
- jev_turn_binding: jevPlan.decisionBinding ? {
342
- plan_id: jevPlan.executionPlan.plan_id,
343
- source_digest: jevPlan.executionPlan.source_digest,
344
- graph_digest: jevPlan.executionPlan.graph_digest,
345
- policy_revision: jevPlan.executionPlan.policy_revision,
346
- config_digest: jevPlan.executionPlan.config_digest
341
+ jev_execution_plan: plan,
342
+ jev_turn_binding: plan && jevPlan?.decisionBinding ? {
343
+ plan_id: plan.plan_id,
344
+ source_digest: plan.source_digest,
345
+ graph_digest: plan.graph_digest,
346
+ policy_revision: plan.policy_revision,
347
+ config_digest: plan.config_digest
347
348
  } : null,
348
- jev_turn_tier: jevPlan.decision.tier ? { ...jevPlan.decision.tier } : null
349
+ jev_turn_tier: plan && jevPlan?.decision.tier ? { ...jevPlan.decision.tier } : null
349
350
  }, { sessionKey, replace: false }).catch(() => null);
350
351
  }
351
352
  if (state?.mission_id && jevPlan?.decisionBinding && disposition
@@ -1135,6 +1136,9 @@ function clarificationPauseBlockReason(state = {}) {
1135
1136
  }
1136
1137
  async function hookStop(root, state, payload, noQuestion, sessionKey = null) {
1137
1138
  const last = extractLastMessage(payload);
1139
+ if (state?.jev_execution_plan) {
1140
+ await setCurrent(root, { jev_execution_plan: null, jev_turn_binding: null, jev_turn_tier: null }, { sessionKey, replace: false }).catch(() => null);
1141
+ }
1138
1142
  if (!noQuestion) {
1139
1143
  const lightTurn = await consumeLightTurnStopBypass(root, { sessionKey, turnId: hookTurnId(payload) });
1140
1144
  if (lightTurn.accepted)