sneakoscope 6.1.0 → 6.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (246) hide show
  1. package/README.md +35 -11
  2. package/crates/sks-core/Cargo.lock +1 -1
  3. package/crates/sks-core/Cargo.toml +1 -1
  4. package/dist/bin/fast-inline.js +18 -9
  5. package/dist/bin/sks-dispatch.js +2 -2
  6. package/dist/cli/args.js +2 -0
  7. package/dist/cli/command-manifest-lite.js +2 -3
  8. package/dist/cli/command-registry.js +3 -4
  9. package/dist/cli/help-fast.js +1 -1
  10. package/dist/cli/install-helpers.js +116 -306
  11. package/dist/cli/install-tool-helpers.js +287 -0
  12. package/dist/cli/router.js +40 -4
  13. package/dist/commands/codex-lb.js +51 -20
  14. package/dist/commands/codex.js +39 -1
  15. package/dist/commands/doctor.js +242 -20
  16. package/dist/commands/tmux.js +5 -1
  17. package/dist/commands/zellij-monitor-pane.js +2 -0
  18. package/dist/commands/zellij-viewport-pane.js +3 -1
  19. package/dist/commands/zellij.js +1 -1
  20. package/dist/config/skills-manifest.json +59 -59
  21. package/dist/core/agent-bridge/agent-manifest.js +48 -0
  22. package/dist/core/agents/agent-command-surface.js +2 -1
  23. package/dist/core/agents/agent-effort-policy.js +38 -35
  24. package/dist/core/agents/agent-plan.js +100 -21
  25. package/dist/core/agents/agent-role-config.js +43 -46
  26. package/dist/core/agents/agent-runner-codex-exec.js +16 -3
  27. package/dist/core/agents/agent-schema.js +3 -2
  28. package/dist/core/agents/native-cli-session-swarm.js +1 -1
  29. package/dist/core/agents/zellij-right-lane-cockpit.js +2 -2
  30. package/dist/core/codex/agent-config-file-repair.js +94 -193
  31. package/dist/core/codex/codex-cli-update.js +723 -0
  32. package/dist/core/codex/codex-config-guard.js +185 -9
  33. package/dist/core/codex/codex-config-readability.js +21 -8
  34. package/dist/core/codex/codex-config-toml.js +14 -11
  35. package/dist/core/codex/codex-project-config-policy.js +3 -6
  36. package/dist/core/codex/codex-startup-config-postcheck.js +52 -42
  37. package/dist/core/codex-adapter.js +35 -22
  38. package/dist/core/codex-app/codex-agent-role-sync.js +13 -54
  39. package/dist/core/codex-app/codex-app-launcher.js +48 -17
  40. package/dist/core/codex-app/codex-app-restart.js +23 -2
  41. package/dist/core/codex-app/mcp-manager.js +679 -0
  42. package/dist/core/codex-app/sks-menubar.js +533 -8
  43. package/dist/core/codex-control/codex-0139-image-path-real-probe.js +15 -4
  44. package/dist/core/codex-control/codex-0139-web-search-probe.js +17 -6
  45. package/dist/core/codex-control/codex-lb-launch-recovery.js +293 -0
  46. package/dist/core/codex-control/codex-reliability-shield.js +89 -29
  47. package/dist/core/codex-control/codex-sdk-adapter.js +44 -8
  48. package/dist/core/codex-control/codex-task-runner.js +62 -9
  49. package/dist/core/codex-control/python-codex-sdk-adapter.js +30 -3
  50. package/dist/core/codex-exec-output-schema.js +35 -6
  51. package/dist/core/codex-lb/codex-lb-env.js +1 -1
  52. package/dist/core/codex-lb/codex-lb-tool-output-recovery.js +291 -0
  53. package/dist/core/codex-native/codex-native-feature-broker.js +9 -16
  54. package/dist/core/codex-native/codex-native-repair-transaction.js +1 -1
  55. package/dist/core/codex-native/core-skill-manifest.js +8 -4
  56. package/dist/core/codex-runtime/codex-desktop-config-policy.js +2 -3
  57. package/dist/core/commands/agent-bridge-command.js +23 -2
  58. package/dist/core/commands/agent-command.js +19 -5
  59. package/dist/core/commands/basic-cli.js +47 -6
  60. package/dist/core/commands/command-utils.js +1 -1
  61. package/dist/core/commands/mad-sks-command.js +76 -10
  62. package/dist/core/commands/menubar-command.js +94 -0
  63. package/dist/core/commands/naruto-command.js +645 -1156
  64. package/dist/core/commands/research-command.js +293 -231
  65. package/dist/core/commands/run-command.js +100 -23
  66. package/dist/core/commands/team-command.js +2 -3
  67. package/dist/core/commands/team-legacy-observe-command.js +94 -359
  68. package/dist/core/commands/wiki-command.js +11 -5
  69. package/dist/core/db-safety.js +2 -2
  70. package/dist/core/decision-lattice.js +6 -6
  71. package/dist/core/doctor/codex-startup-config-repair.js +8 -3
  72. package/dist/core/doctor/doctor-codex-startup-repair.js +6 -141
  73. package/dist/core/feature-fixture-executor.js +71 -7
  74. package/dist/core/feature-fixture-runner.js +53 -12
  75. package/dist/core/feature-fixtures.js +47 -14
  76. package/dist/core/feature-registry.js +28 -27
  77. package/dist/core/fsx.js +1 -0
  78. package/dist/core/harness-conflicts.js +18 -9
  79. package/dist/core/hooks-runtime/code-pack-freshness-preflight.js +14 -8
  80. package/dist/core/hooks-runtime/hook-io.js +8 -4
  81. package/dist/core/hooks-runtime/light-turn.js +70 -0
  82. package/dist/core/hooks-runtime/naruto-decision-gate.js +184 -0
  83. package/dist/core/hooks-runtime/payload-signals.js +270 -0
  84. package/dist/core/hooks-runtime/stop-repeat-guard.js +89 -0
  85. package/dist/core/hooks-runtime/team-digest.js +0 -1
  86. package/dist/core/hooks-runtime/tool-output-quarantine.js +93 -0
  87. package/dist/core/hooks-runtime.js +438 -354
  88. package/dist/core/init/skills.js +16 -30
  89. package/dist/core/init.js +144 -36
  90. package/dist/core/managed-assets/managed-assets-manifest.js +566 -10
  91. package/dist/core/mission.js +24 -1
  92. package/dist/core/pipeline-internals/runtime-core.js +570 -177
  93. package/dist/core/pipeline-internals/runtime-gates.js +174 -48
  94. package/dist/core/preflight/parallel-preflight-engine.js +66 -4
  95. package/dist/core/proof/route-adapter.js +1 -1
  96. package/dist/core/proof/route-proof-gate.js +7 -2
  97. package/dist/core/proof/selftest-proof-fixtures.js +3 -5
  98. package/dist/core/proof-field.js +1 -1
  99. package/dist/core/provider/model-router.js +42 -31
  100. package/dist/core/recallpulse/policy.js +12 -28
  101. package/dist/core/recallpulse.js +11 -6
  102. package/dist/core/release/npm-pack-proof.js +247 -0
  103. package/dist/core/release/package-dist-snapshot.js +151 -0
  104. package/dist/core/release/package-size-budget.js +4 -1
  105. package/dist/core/release/release-authorization-snapshot.js +115 -0
  106. package/dist/core/release/release-gate-affected-selector.js +14 -2
  107. package/dist/core/release/release-gate-cache-v2.js +30 -0
  108. package/dist/core/release/release-gate-contract.js +161 -0
  109. package/dist/core/release/release-gate-dag.js +1 -0
  110. package/dist/core/release/release-real-contract.js +90 -10
  111. package/dist/core/release-parallel-full-coverage.js +31 -143
  112. package/dist/core/research/claim-evidence-matrix.js +41 -6
  113. package/dist/core/research/experiment-plan.js +14 -10
  114. package/dist/core/research/falsification.js +9 -2
  115. package/dist/core/research/implementation-blueprint-densifier.js +82 -60
  116. package/dist/core/research/implementation-blueprint.js +32 -26
  117. package/dist/core/research/mock-result.js +122 -11
  118. package/dist/core/research/replication-pack.js +15 -8
  119. package/dist/core/research/research-adversarial-review.js +1068 -0
  120. package/dist/core/research/research-claim-builder.js +69 -17
  121. package/dist/core/research/research-claim-synthesizer.js +343 -0
  122. package/dist/core/research/research-cycle-runner.js +53 -3
  123. package/dist/core/research/research-falsification-runner.js +176 -0
  124. package/dist/core/research/research-final-reviewer.js +44 -125
  125. package/dist/core/research/research-plan-markdown.js +123 -0
  126. package/dist/core/research/research-realistic-report.js +14 -6
  127. package/dist/core/research/research-review-artifact-digest.js +66 -0
  128. package/dist/core/research/research-source-evidence.js +144 -0
  129. package/dist/core/research/research-source-layer-catalog.js +68 -0
  130. package/dist/core/research/research-source-ledger-merge.js +250 -12
  131. package/dist/core/research/research-source-shards.js +26 -70
  132. package/dist/core/research/research-stage-runner.js +237 -247
  133. package/dist/core/research/research-super-search.js +188 -0
  134. package/dist/core/research/research-synthesis-prompt.js +20 -1
  135. package/dist/core/research/research-synthesis-writer.js +86 -5
  136. package/dist/core/research/research-work-graph.js +25 -18
  137. package/dist/core/research/source-quality-report.js +21 -0
  138. package/dist/core/research.js +424 -390
  139. package/dist/core/retention.js +70 -2
  140. package/dist/core/routes/constants.js +1 -1
  141. package/dist/core/routes/dollar-manifest-lite.js +11 -11
  142. package/dist/core/routes.js +149 -69
  143. package/dist/core/runtime/task-profile.js +66 -0
  144. package/dist/core/runtime/verification-budget.js +12 -0
  145. package/dist/core/security/high-risk-contracts.js +6 -6
  146. package/dist/core/stop-gate/stop-gate-check.js +49 -12
  147. package/dist/core/subagents/agent-catalog.js +287 -0
  148. package/dist/core/subagents/model-policy.js +259 -0
  149. package/dist/core/subagents/naruto-help-contract.js +47 -0
  150. package/dist/core/subagents/official-subagent-config.js +488 -0
  151. package/dist/core/subagents/official-subagent-preparation.js +297 -0
  152. package/dist/core/subagents/official-subagent-prompt.js +159 -0
  153. package/dist/core/subagents/official-subagent-runner.js +129 -0
  154. package/dist/core/subagents/subagent-evidence.js +663 -0
  155. package/dist/core/subagents/terminology.js +16 -0
  156. package/dist/core/subagents/thread-budget.js +21 -0
  157. package/dist/core/subagents/triwiki-attention.js +168 -0
  158. package/dist/core/super-search/runtime-helpers.js +173 -19
  159. package/dist/core/super-search/runtime.js +140 -15
  160. package/dist/core/super-search/source-records.js +49 -8
  161. package/dist/core/team-review-policy.js +15 -0
  162. package/dist/core/triwiki/code-pack-head-freshness.js +291 -0
  163. package/dist/core/triwiki/triwiki-module-card.js +1 -1
  164. package/dist/core/triwiki-wrongness/wrongness-ledger.js +9 -2
  165. package/dist/core/version-manager.js +51 -1
  166. package/dist/core/version.js +1 -1
  167. package/dist/core/work-order-ledger.js +40 -1
  168. package/dist/core/zellij/zellij-fake-adapter.js +3 -1
  169. package/dist/core/zellij/zellij-launcher.js +49 -10
  170. package/dist/core/zellij/zellij-layout-builder.js +14 -5
  171. package/dist/core/zellij/zellij-official-subagent-activity.js +477 -0
  172. package/dist/core/zellij/zellij-official-subagent-telemetry.js +264 -0
  173. package/dist/core/zellij/zellij-pane-proof.js +9 -1
  174. package/dist/core/zellij/zellij-slot-pane-renderer.js +17 -5
  175. package/dist/core/zellij/zellij-slot-telemetry.js +15 -3
  176. package/dist/core/zellij/zellij-ui-mode.js +1 -1
  177. package/dist/core/zellij/zellij-update.js +14 -1
  178. package/dist/core/zellij/zellij-viewport-binder.js +3 -0
  179. package/dist/scripts/agent-role-config-repair-check.js +14 -16
  180. package/dist/scripts/architecture-guard-check.js +8 -1
  181. package/dist/scripts/canonical-test-runner.js +7 -1
  182. package/dist/scripts/check-route-modularity.js +0 -1
  183. package/dist/scripts/check-ts-contracts.js +1 -1
  184. package/dist/scripts/codex-control-all-pipelines-check.js +7 -3
  185. package/dist/scripts/codex-control-tool-output-continuity-audit-check.js +27 -0
  186. package/dist/scripts/codex-lb-fast-mode-truth-check.js +11 -1
  187. package/dist/scripts/codex-lb-fast-ui-preservation-check.js +9 -2
  188. package/dist/scripts/codex-lb-gpt56-fast-profile-check.js +13 -2
  189. package/dist/scripts/codex-native-agent-role-content-check.js +27 -7
  190. package/dist/scripts/codex-native-repair-transaction-check.js +3 -1
  191. package/dist/scripts/codex-sdk-all-pipelines-check.js +7 -4
  192. package/dist/scripts/codex-sdk-backend-router-check.js +2 -0
  193. package/dist/scripts/codex-sdk-research-pipeline-check.js +30 -8
  194. package/dist/scripts/db-route-materialization-check.js +33 -0
  195. package/dist/scripts/docs-truthfulness-check.js +3 -1
  196. package/dist/scripts/doctor-codex-startup-repair-check.js +12 -15
  197. package/dist/scripts/doctor-fix-production-blackbox.js +12 -2
  198. package/dist/scripts/doctor-startup-config-repair-blackbox.js +8 -2
  199. package/dist/scripts/doctor-startup-config-repair-check.js +12 -2
  200. package/dist/scripts/install-update-preserves-config-check.js +6 -1
  201. package/dist/scripts/lib/codex-sdk-gate-lib.js +4 -0
  202. package/dist/scripts/mad-sks-app-ui-no-mutation-check.js +0 -1
  203. package/dist/scripts/managed-role-manifest-parity-check.js +5 -4
  204. package/dist/scripts/naruto-codex-e2e-check.js +14 -7
  205. package/dist/scripts/naruto-shadow-clone-swarm-check.js +4 -201
  206. package/dist/scripts/npm-publish-performance-check.js +20 -12
  207. package/dist/scripts/official-subagent-workflow-check.js +145 -0
  208. package/dist/scripts/package-published-contract-check.js +6 -29
  209. package/dist/scripts/packlist-performance-check.js +18 -21
  210. package/dist/scripts/parallel-verification-engine-check.js +2 -2
  211. package/dist/scripts/prepublish-release-check-or-fast.js +23 -86
  212. package/dist/scripts/python-codex-sdk-all-pipelines-check.js +8 -0
  213. package/dist/scripts/release-affected-selector-check.js +74 -1
  214. package/dist/scripts/release-check-stamp.js +153 -248
  215. package/dist/scripts/release-dag-full-coverage-check.js +7 -15
  216. package/dist/scripts/release-dynamic-presets-check.js +2 -1
  217. package/dist/scripts/release-gate-dag-runner-check.js +0 -1
  218. package/dist/scripts/release-gate-dag-runner.js +12 -1
  219. package/dist/scripts/release-gate-existence-audit.js +1 -2
  220. package/dist/scripts/release-parallel-full-coverage-check.js +12 -6
  221. package/dist/scripts/release-parallel-speed-budget-check.js +18 -2
  222. package/dist/scripts/release-real-check.js +26 -4
  223. package/dist/scripts/release-registry-check.js +61 -16
  224. package/dist/scripts/research-blueprint-densifier-check.js +2 -2
  225. package/dist/scripts/research-real-cycle-no-legacy-final-md-check.js +11 -7
  226. package/dist/scripts/sizecheck.js +2 -2
  227. package/dist/scripts/sks-3-1-4-directive-check-lib.js +8 -2
  228. package/dist/scripts/sks-3-1-5-directive-check-lib.js +3 -2
  229. package/dist/scripts/sks-3-1-6-directive-check-lib.js +5 -3
  230. package/dist/scripts/sks-menubar-install-check.js +14 -1
  231. package/dist/scripts/super-search-provider-interface-check.js +31 -18
  232. package/dist/scripts/trust-fixture-check.js +32 -10
  233. package/dist/scripts/wrongness-fixture-check.js +1 -1
  234. package/dist/scripts/zellij-layout-valid-check.js +5 -5
  235. package/dist/scripts/zellij-spawn-on-demand-layout-check.js +3 -3
  236. package/docs/demo.tape +1 -1
  237. package/infra-harness-gates.json +1486 -0
  238. package/package.json +15 -10
  239. package/release-gates.v2.json +4060 -0
  240. package/runtime-required-scripts.json +9 -0
  241. package/dist/commands/db.js +0 -6
  242. package/dist/core/commands/db-command.js +0 -146
  243. package/dist/core/research/prompt.js +0 -15
  244. package/dist/scripts/codex-0139-feature-probes-check.js +0 -30
  245. package/dist/scripts/codex-0139-marketplace-source-check.js +0 -13
  246. package/dist/scripts/codex-control-tool-call-sequence-repair-check.js +0 -14
@@ -1,7 +1,7 @@
1
1
  import fs from 'node:fs/promises';
2
2
  import path from 'node:path';
3
3
  import os from 'node:os';
4
- import { exists, readJson, writeJsonAtomic, ensureDir, dirSize, fileSize, formatBytes, rmrf, nowIso, appendJsonlBounded, listFilesRecursive, managedSksTmpRoot, sha256 } from './fsx.js';
4
+ import { exists, readJson, writeJsonAtomic, ensureDir, dirSize, fileSize, formatBytes, rmrf, nowIso, appendJsonlBounded, listFilesRecursive, managedSksTmpRoot, sha256, SKS_TEMP_LEASE_FILE } from './fsx.js';
5
5
  import { FROM_CHAT_IMG_TEMP_TRIWIKI_ARTIFACT, FROM_CHAT_IMG_TEMP_TRIWIKI_SESSIONS } from './routes.js';
6
6
  export const DEFAULT_RETENTION_POLICY = Object.freeze({
7
7
  schema_version: 1,
@@ -487,6 +487,44 @@ function currentProcessOwns(stat) {
487
487
  function sharedTempEntryMatchesProject(entryName, projectHash) {
488
488
  return entryName === `sks-${projectHash}` || entryName.startsWith(`sks-${projectHash}-`);
489
489
  }
490
+ function activeTempEnvironmentKey(target) {
491
+ const resolvedTarget = path.resolve(target);
492
+ for (const key of ['SKS_TMP_DIR', 'TMPDIR', 'TMP', 'TEMP']) {
493
+ const raw = process.env[key];
494
+ if (!raw)
495
+ continue;
496
+ const activePath = path.resolve(raw);
497
+ if (isWithin(resolvedTarget, activePath))
498
+ return key;
499
+ }
500
+ return null;
501
+ }
502
+ async function liveTempLease(target) {
503
+ const leasePath = path.join(target, SKS_TEMP_LEASE_FILE);
504
+ const stat = await fs.lstat(leasePath).catch(() => null);
505
+ if (!stat?.isFile() || stat.isSymbolicLink() || !currentProcessOwns(stat))
506
+ return null;
507
+ const lease = await readJson(leasePath, null).catch(() => null);
508
+ const pid = Number(lease?.pid);
509
+ if (lease?.schema !== 'sks.temp-lease.v1' || !processIdAlive(pid))
510
+ return null;
511
+ return {
512
+ path: leasePath,
513
+ pid,
514
+ kind: lease?.kind ? String(lease.kind) : null
515
+ };
516
+ }
517
+ function processIdAlive(pid) {
518
+ if (!Number.isSafeInteger(pid) || pid <= 0)
519
+ return false;
520
+ try {
521
+ process.kill(pid, 0);
522
+ return true;
523
+ }
524
+ catch (error) {
525
+ return error?.code === 'EPERM';
526
+ }
527
+ }
490
528
  async function pruneTmp(root, policy, dryRun, actions) {
491
529
  const tmp = path.join(root, '.sneakoscope', 'tmp');
492
530
  if (!(await exists(tmp)))
@@ -1138,6 +1176,28 @@ export async function sweepSksTempDirs(root, opts = {}) {
1138
1176
  const stat = await fs.lstat(target).catch(() => null);
1139
1177
  if (!stat || stat.isSymbolicLink() || !currentProcessOwns(stat))
1140
1178
  continue;
1179
+ const environmentKey = activeTempEnvironmentKey(target);
1180
+ if (environmentKey) {
1181
+ actions.push({
1182
+ action: 'retain_active_sks_temp',
1183
+ path: target,
1184
+ reason: 'active_temp_environment',
1185
+ environment_key: environmentKey
1186
+ });
1187
+ continue;
1188
+ }
1189
+ const lease = stat.isDirectory() ? await liveTempLease(target) : null;
1190
+ if (lease) {
1191
+ actions.push({
1192
+ action: 'retain_active_sks_temp',
1193
+ path: target,
1194
+ reason: 'active_temp_lease',
1195
+ lease_path: lease.path,
1196
+ owner_pid: lease.pid,
1197
+ lease_kind: lease.kind
1198
+ });
1199
+ continue;
1200
+ }
1141
1201
  const inspected = await inspectTempPath(target);
1142
1202
  if (!inspected.complete) {
1143
1203
  actions.push({ action: 'skip_unsafe_temp_entry', path: target, reason: inspected.blockers.join(',') });
@@ -1561,7 +1621,15 @@ export async function enforceRetention(root, opts = {}) {
1561
1621
  await rotateLargeJsonl(root, policy, dryRun, actions);
1562
1622
  await pruneDisposableReportLogs(root, policy, dryRun, actions, opts);
1563
1623
  await pruneSessionStateFiles(root, policy, dryRun, actions);
1564
- await sweepSksTempDirs(root, { dryRun, actions, maxAgeHours: opts.sksTempMaxAgeHours ?? policy.max_tmp_age_hours ?? 0 });
1624
+ if (opts.skipSksTempSweep === true) {
1625
+ actions.push({
1626
+ action: 'skip_sks_temp_sweep',
1627
+ reason: opts.afterRoute ? 'post_route_global_temp_isolation' : 'explicit_temp_sweep_skip'
1628
+ });
1629
+ }
1630
+ else {
1631
+ await sweepSksTempDirs(root, { dryRun, actions, maxAgeHours: opts.sksTempMaxAgeHours ?? policy.max_tmp_age_hours ?? 0 });
1632
+ }
1565
1633
  if (opts.pruneWikiArtifacts || policy.prune_wiki_artifacts)
1566
1634
  await pruneWikiArtifacts(root, { policy, dryRun, actions, lowTrust: opts.pruneWikiLowTrust });
1567
1635
  let report = boundedMode || opts.skipStorageReport === true ? await lightweightStorageReport(root) : await storageReport(root);
@@ -9,7 +9,7 @@ export const FROM_CHAT_IMG_CHECKLIST_ARTIFACT = 'from-chat-img-checklist.md';
9
9
  export const FROM_CHAT_IMG_TEMP_TRIWIKI_ARTIFACT = 'from-chat-img-temp-triwiki.json';
10
10
  export const FROM_CHAT_IMG_QA_LOOP_ARTIFACT = 'from-chat-img-qa-loop.json';
11
11
  export const FROM_CHAT_IMG_TEMP_TRIWIKI_SESSIONS = 5;
12
- export const USAGE_TOPICS = 'install|setup|bootstrap|root|deps|zellij|tmux|auto-review|team|qa-loop|ppt|image-ux-review|computer-use|goal|fast-mode|review|ui|research|seo-geo-optimizer|db|git|codex|codex-app|codex-native|hooks|features|all-features|dfix|commit|commit-and-push|design|imagegen|dollar|context7|super-search|xai|pipeline|reasoning|guard|conflicts|versioning|eval|harness|hproof|gx|wiki|memory|wrongness|code-structure|proof-field|skill-dream|rust';
12
+ export const USAGE_TOPICS = 'install|setup|bootstrap|root|deps|zellij|tmux|auto-review|naruto|team|qa-loop|ppt|image-ux-review|computer-use|goal|fast-mode|review|ui|research|seo-geo-optimizer|git|codex|codex-app|codex-native|hooks|features|all-features|dfix|commit|commit-and-push|design|imagegen|dollar|context7|super-search|xai|pipeline|reasoning|guard|conflicts|versioning|eval|harness|hproof|gx|wiki|memory|wrongness|code-structure|proof-field|skill-dream|rust';
13
13
  export const RECOMMENDED_MCP_SERVERS = [
14
14
  {
15
15
  id: 'context7',
@@ -1,22 +1,22 @@
1
- const NARUTO_DESCRIPTION = '$Naruto mode launches a hardware-safe massive parallel work swarm. Clones may implement, modify, verify, test, research, document, and resolve conflicts according to role and lease policy; write-capable output is accepted only through patch envelopes, verification DAG, mutation guard, and GPT final arbiter.';
1
+ const NARUTO_DESCRIPTION = '$Naruto is the lightweight Codex official subagent workflow. The Sol Max parent uses two independent children for non-trivial work and at most three for critical multi-domain risk; explicit --agents remains authoritative. Child routing is fixed to Luna Max mechanical, Sol High implementation, Sol Max judgment, and Terra Medium long-context/Computer Use/Browser/ImageGen execution. It delegates only defensible independent slices, reuses bounded query-aware TriWiki attention anchors, and requires official lifecycle events plus a trustworthy structured parent summary.';
2
2
  const COMPUTER_USE_DESCRIPTION = 'Maximum-speed Codex Computer Use lane for native macOS, desktop-app, OS-settings, and non-web visual tasks only. Browser, localhost, website, webapp, and web-based app verification must route through Codex Chrome Extension readiness first.';
3
3
  export const DOLLAR_COMMANDS_LITE = [
4
4
  { command: '$DFix', route: 'fast direct fix', description: 'Tiny simple direct edits such as copy, labels, typos, wording, spacing, colors, or clearly scoped one-line changes. Bypasses the general SKS pipeline and runs an ultralight, no-record task-list path.' },
5
5
  { command: '$Answer', route: 'answer-only research', description: 'Answer questions without starting implementation. Uses TriWiki, web, Context7 when relevant, and Honest Mode fact-checking.' },
6
6
  { command: '$SKS', route: 'general SKS workflow', description: 'General Sneakoscope setup, help, status, and workflow routing.' },
7
- { command: '$Plan', route: 'planning-only frontdoor', description: 'Plan scaffold only: writes a fixed-template .sneakoscope/plans/<slug>.md (goal/scope/steps headings to fill in), not project-specific decision-complete planning. Keeps implementation disallowed until $Work runs the plan.' },
7
+ { command: '$Plan', route: 'planning-only frontdoor', description: 'Plan scaffold only: writes a fixed-template .sneakoscope/plans/<slug>.md (goal/scope/steps headings to fill in), not project-specific decision-complete planning. Keeps implementation disallowed until an explicit $Work alias or $Naruto runs the plan.' },
8
8
  { command: '$Review', route: 'machine-first diff review', description: 'Review staged or selected diffs with machine evidence sorted above LLM opinion.' },
9
- { command: '$Fast-Mode', route: 'fast-mode toggle', description: 'Turn the SKS Fast mode default on or off for project-local dollar-command and native-agent routes. Explicit --fast, --no-fast, and --service-tier flags still override it.' },
10
- { command: '$Fast-On', route: 'fast-mode toggle', description: 'Turn the SKS Fast mode default on or off for project-local dollar-command and native-agent routes. Explicit --fast, --no-fast, and --service-tier flags still override it.' },
11
- { command: '$Fast-Off', route: 'fast-mode toggle', description: 'Turn the SKS Fast mode default on or off for project-local dollar-command and native-agent routes. Explicit --fast, --no-fast, and --service-tier flags still override it.' },
9
+ { command: '$Fast-Mode', route: 'fast-mode toggle', description: 'Turn the SKS Fast mode default on or off for project-local dollar-command and routed workflows. Explicit --fast, --no-fast, and --service-tier flags still override it.' },
10
+ { command: '$Fast-On', route: 'fast-mode toggle', description: 'Turn the SKS Fast mode default on or off for project-local dollar-command and routed workflows. Explicit --fast, --no-fast, and --service-tier flags still override it.' },
11
+ { command: '$Fast-Off', route: 'fast-mode toggle', description: 'Turn the SKS Fast mode default on or off for project-local dollar-command and routed workflows. Explicit --fast, --no-fast, and --service-tier flags still override it.' },
12
12
  { command: '$with-local-llm-on', route: 'local Ollama worker toggle', description: 'Turn the optional local Ollama worker backend on or off. Default off keeps SKS GPT-only; enabled mode lets eligible simple code/collection worker slices use Ollama while GPT/Codex owns strategy, design, review, verification, and integration.' },
13
13
  { command: '$with-local-llm-off', route: 'local Ollama worker toggle', description: 'Turn the optional local Ollama worker backend on or off. Default off keeps SKS GPT-only; enabled mode lets eligible simple code/collection worker slices use Ollama while GPT/Codex owns strategy, design, review, verification, and integration.' },
14
- { command: '$Naruto', route: 'hardware-safe massive parallel work swarm', description: NARUTO_DESCRIPTION },
15
- { command: '$ShadowClone', route: 'hardware-safe massive parallel work swarm', description: NARUTO_DESCRIPTION },
16
- { command: '$Kagebunshin', route: 'hardware-safe massive parallel work swarm', description: NARUTO_DESCRIPTION },
17
- { command: '$Work', route: 'hardware-safe massive parallel work swarm', description: NARUTO_DESCRIPTION },
18
- { command: '$Swarm', route: 'hardware-safe massive parallel work swarm', description: NARUTO_DESCRIPTION },
19
- { command: '$Release-Review', route: 'native release review', description: 'Run release-readiness collaboration through native multi-session agents with explicit agent count, concurrency, route personas, leases, dynamic effort, proof, and cleanup artifacts.' },
14
+ { command: '$Naruto', route: 'Codex official subagent workflow', description: NARUTO_DESCRIPTION },
15
+ { command: '$ShadowClone', route: 'deprecated alias to the Codex official subagent workflow', description: NARUTO_DESCRIPTION },
16
+ { command: '$Kagebunshin', route: 'deprecated alias to the Codex official subagent workflow', description: NARUTO_DESCRIPTION },
17
+ { command: '$Work', route: 'compatibility alias to the Codex official subagent workflow', description: NARUTO_DESCRIPTION },
18
+ { command: '$Swarm', route: 'compatibility alias to the Codex official subagent workflow', description: NARUTO_DESCRIPTION },
19
+ { command: '$Release-Review', route: 'official subagent release review', description: 'Run release-readiness collaboration through Codex official subagent threads with explicit review lanes, bounded thread budgets, structured parent outcomes, evidence, and cleanup artifacts.' },
20
20
  { command: '$QA-LOOP', route: 'QA loop', description: 'Dogfood UI/API as human proxy with safety gates, Codex Chrome Extension-first web UI evidence, safe fixes, rechecks, Honest Mode.' },
21
21
  { command: '$PPT', route: 'HTML/PDF presentation pipeline', description: 'Create restrained, information-first HTML/PDF presentation artifacts after delivery context, audience profile, STP, decision context, pain-point, research, design-system, and verification questions are sealed.' },
22
22
  { command: '$Image-UX-Review', route: 'image-generation UI/UX review loop', description: 'Review UI/UX through the imagegen/gpt-image-2 visual critique loop: source screenshots become generated annotated review images, those images become issue ledgers, then fixes are rechecked.' },
@@ -4,6 +4,7 @@ import { ALLOWED_REASONING_EFFORTS, FROM_CHAT_IMG_CHECKLIST_ARTIFACT, FROM_CHAT_
4
4
  import { CODEX_APP_IMAGE_GENERATION_DOC_URL, CODEX_COMPUTER_USE_ONLY_POLICY, CODEX_IMAGEGEN_REQUIRED_POLICY, CODEX_WEB_VERIFICATION_POLICY, RESERVED_CODEX_PLUGIN_SKILL_NAMES } from './routes/evidence.js';
5
5
  import { getdesignReferencePolicyText, imageUxReviewPipelinePolicyText } from './routes/design-policy.js';
6
6
  import { PPT_PIPELINE_SKILL_ALLOWLIST, pptPipelineAllowlistPolicyText } from './routes/ppt-policy.js';
7
+ import { classifyTaskProfile, looksLikeDatabaseWorkRequest } from './runtime/task-profile.js';
7
8
  export * from './routes/constants.js';
8
9
  export * from './routes/design-policy.js';
9
10
  export * from './routes/evidence.js';
@@ -217,7 +218,7 @@ export const ROUTES = [
217
218
  command: '$Fast-Mode',
218
219
  mode: 'FAST_MODE',
219
220
  route: 'fast-mode toggle',
220
- description: 'Turn the SKS Fast mode default on or off for project-local dollar-command and native-agent routes. Explicit --fast, --no-fast, and --service-tier flags still override it.',
221
+ description: 'Turn the SKS Fast mode default on or off for project-local dollar-command and routed workflows. Explicit --fast, --no-fast, and --service-tier flags still override it.',
221
222
  requiredSkills: ['fast-mode', 'honest-mode'],
222
223
  dollarAliases: ['$Fast-On', '$Fast-Off'],
223
224
  appSkillAliases: ['fast-on', 'fast-off'],
@@ -251,52 +252,52 @@ export const ROUTES = [
251
252
  command: '$Team',
252
253
  mode: 'TEAM',
253
254
  route: 'deprecated alias to Naruto',
254
- description: 'Deprecated compatibility alias. New substantial work is routed to $Naruto, the native shadow-clone swarm SSOT.',
255
+ description: 'Deprecated compatibility alias. New substantial work is routed to $Naruto, the Codex official subagent workflow SSOT.',
255
256
  requiredSkills: ['team', 'pipeline-runner', 'context7-docs', 'prompt-pipeline', REFLECTION_SKILL_NAME, 'honest-mode'],
256
257
  dollarAliases: ['$From-Chat-IMG'],
257
258
  appSkillAliases: ['from-chat-img'],
258
259
  deprecated: true,
259
260
  hidden: true,
260
261
  aliasTo: '$Naruto',
261
- deprecationMessage: '$Team is deprecated and redirects new execution missions to $Naruto. Existing Team observation commands remain available for old missions.',
262
+ deprecationMessage: '$Team is deprecated and redirects new execution missions to $Naruto. Only read-only Team log/tail/watch/lane/status commands remain for old missions.',
262
263
  lifecycle: ['deprecated_alias_redirect', 'naruto_gate', 'honest_mode'],
263
264
  context7Policy: 'optional',
264
265
  reasoningPolicy: 'high',
265
266
  stopGate: 'naruto-gate.json',
266
267
  coverage_required: true,
267
- cliEntrypoint: 'sks team "task" [executor:5 reviewer:6 user:1] | sks team log|tail|watch|lane|status|event|message|open-zellij|attach-zellij|cleanup-zellij',
268
+ cliEntrypoint: 'sks team "task" | sks team log|tail|watch|lane|status',
268
269
  examples: ['$Team executor:5 agree on the best plan and implement it', '$From-Chat-IMG 채팅+첨부 이미지 작업 지시서']
269
270
  },
270
271
  {
271
272
  id: 'Naruto',
272
273
  command: '$Naruto',
273
274
  mode: 'NARUTO',
274
- route: 'hardware-safe massive parallel work swarm',
275
- description: '$Naruto mode launches a hardware-safe massive parallel work swarm. Clones may implement, modify, verify, test, research, document, and resolve conflicts according to role and lease policy; write-capable output is accepted only through patch envelopes, verification DAG, mutation guard, and GPT final arbiter.',
275
+ route: 'Codex official subagent workflow',
276
+ description: '$Naruto prepares a lightweight Codex official subagent workflow. The Sol Max parent owns decomposition, delegates only defensible direct-child slices, reuses bounded query-aware TriWiki attention anchors, waits for every requested thread, integrates the results, and reports scoped verification. Automatic fan-out is two for non-trivial work and at most three for critical multi-domain risk; explicit --agents remains authoritative.',
276
277
  requiredSkills: ['naruto', 'pipeline-runner', 'prompt-pipeline', 'honest-mode'],
277
278
  dollarAliases: ['$ShadowClone', '$Kagebunshin', '$Work', '$Swarm'],
278
279
  appSkillAliases: ['shadow-clone', 'kage-bunshin', 'work', 'swarm'],
279
- lifecycle: ['clone_roster_build', 'massive_work_graph', 'hardware_safe_governor', 'dynamic_active_pool', 'lease_based_write_swarm', 'parallel_verification_dag', 'gpt_final_arbiter_pack', 'per_clone_proof', 'session_cleanup', 'honest_mode'],
280
+ lifecycle: ['task_profile', 'subagent_plan', 'official_delegation_context', 'subagent_events', 'parent_integration', 'scoped_verification', 'honest_mode'],
280
281
  context7Policy: 'optional',
281
282
  reasoningPolicy: 'high',
282
283
  stopGate: 'naruto-gate.json',
283
284
  coverage_required: true,
284
- cliEntrypoint: 'sks naruto run "task" [--clones N] [--backend codex-sdk|fake|ollama] [--parallel-write] | sks naruto status',
285
- examples: ['$Naruto run sweep the codebase for TODO comments with 50 clones', '$Work', '$Swarm "fix all lint errors"']
285
+ cliEntrypoint: 'sks naruto run "task" [--agents N] [--max-threads N] | sks naruto status|subagents|proof',
286
+ examples: ['$Naruto run review twelve independent packages with --agents 12', '$Work', '$Swarm "fix all lint errors"']
286
287
  },
287
288
  {
288
289
  id: 'ReleaseReview',
289
290
  command: '$Release-Review',
290
291
  mode: 'RELEASE_REVIEW',
291
- route: 'native release review',
292
- description: 'Run release-readiness collaboration through native multi-session agents with explicit agent count, concurrency, route personas, leases, dynamic effort, proof, and cleanup artifacts.',
293
- requiredSkills: ['team', 'pipeline-runner', REFLECTION_SKILL_NAME, 'honest-mode'],
294
- lifecycle: ['native_agent_intake', 'release_fixture_matrix', 'five_lane_review', 'integration_evidence', 'session_cleanup', 'honest_mode'],
292
+ route: 'official subagent release review',
293
+ description: 'Run release-readiness collaboration through official Codex subagents with explicit thread budget, disjoint ownership, parent integration, scoped verification, and cleanup evidence.',
294
+ requiredSkills: ['naruto', 'pipeline-runner', REFLECTION_SKILL_NAME, 'honest-mode'],
295
+ lifecycle: ['subagent_plan', 'release_fixture_matrix', 'risk_scoped_review', 'parent_integration', 'session_cleanup', 'honest_mode'],
295
296
  context7Policy: 'optional',
296
297
  reasoningPolicy: 'high',
297
298
  stopGate: 'release-readiness-report.json',
298
- cliEntrypoint: 'sks agent run "release audit" --route "$Release-Review" --agents <n> --concurrency <n> --mock --json',
299
- examples: ['$Release-Review agents:10 concurrency:4 release audit', 'sks agent run "wide release audit" --route "$Release-Review" --agents 10 --concurrency 4 --mock --json']
299
+ cliEntrypoint: 'sks naruto run "$Release-Review release audit" --agents <n> --read-only --json',
300
+ examples: ['$Release-Review agents:10 release audit', 'sks naruto run "$Release-Review wide release audit" --agents 10 --read-only --json']
300
301
  },
301
302
  {
302
303
  id: 'QALoop',
@@ -471,7 +472,9 @@ export const ROUTES = [
471
472
  context7Policy: 'required',
472
473
  reasoningPolicy: 'high',
473
474
  stopGate: 'db-review.json',
474
- cliEntrypoint: 'sks db scan',
475
+ cliEntrypoint: 'Codex App prompt route only; the legacy `sks db` CLI is removed',
476
+ codexAppOnly: true,
477
+ codexAppOnlyReason: '$DB remains a route-level safety policy. The legacy `sks db` CLI is removed from public dispatch and returns unknown_command.',
475
478
  examples: ['$DB check this migration safely']
476
479
  },
477
480
  {
@@ -601,9 +604,9 @@ export const COMMAND_CATALOG = [
601
604
  { name: 'daemon', usage: 'sks daemon status|warm|stop [--json]', description: 'Inspect or warm the local SKS daemon cache state for build/proof reuse.' },
602
605
  { name: 'run', usage: 'sks run "task" [--visual|--research|--db] [--json]', description: 'Classify a plain-language task, materialize a mission, and route it through the SKS trust kernel.' },
603
606
  { name: 'plan', usage: 'sks plan "task" [--json]', description: 'Write a planning-only artifact under .sneakoscope/plans without editing code.' },
604
- { name: 'status', usage: 'sks status [--json]', description: 'Show the active mission, route, phase, proof, trust, native agent, image voxel, DB safety, and next action.' },
607
+ { name: 'status', usage: 'sks status [--json]', description: 'Show the active mission, route, phase, proof, trust, subagent or legacy-agent evidence, image voxel, DB safety, and next action.' },
605
608
  { name: 'review', usage: 'sks review [--staged|--diff <ref>] [--fix] [--json]', description: 'Review a diff with machine-evidence findings sorted above LLM review notes.' },
606
- { name: 'ui', usage: 'sks ui [--port 4477] [--mission latest] [--once] [--json]', description: 'Open the localhost SKS dashboard with live swarm slots, events, and gate status.' },
609
+ { name: 'ui', usage: 'sks ui [--port 4477] [--mission latest] [--once] [--json]', description: 'Open the localhost SKS dashboard with live agent-thread slots, events, and gate status.' },
607
610
  { name: 'usage', usage: `sks usage [${USAGE_TOPICS}]`, description: 'Print copy-ready workflows for common tasks.' },
608
611
  { name: 'quickstart', usage: 'sks quickstart', description: 'Show the shortest safe setup and verification flow.' },
609
612
  { name: 'bootstrap', usage: 'sks bootstrap [--install-scope global|project] [--local-only] [--json]', description: 'Initialize the current project, install SKS Codex App files/skills, check Context7/Codex App/Zellij, and print ready true/false.' },
@@ -611,12 +614,12 @@ export const COMMAND_CATALOG = [
611
614
  { name: 'update', usage: 'sks update [check|now] [--version <version>] [--json] [--dry-run]', description: 'Check npm for the latest SKS release and update the global package by default; use `check` for status-only.' },
612
615
  { name: 'uninstall', usage: 'sks uninstall [--dry-run] [--yes] [--keep-config] [--keep-data] [--purge-projects] [--json]', description: 'Remove SKS global skills, hooks, menu bar, state, temp files, and optional project residue while preserving user-owned content by default.' },
613
616
  { name: 'deps', usage: 'sks deps check [--json] [--yes]', description: 'Check Node/npm, Codex CLI, and Zellij readiness; pass --yes to repair missing Codex CLI/Zellij tooling when supported.' },
614
- { name: 'codex', usage: 'sks codex compatibility|version|doctor|schema|0.144 [--json]', description: 'Check Codex CLI rust-v0.144.1 compatibility, installed version, current manifest/capability evidence, inherited historical baselines, and vendored hook schema snapshot freshness.' },
617
+ { name: 'codex', usage: 'sks codex compatibility|version|update-status [--refresh]|update|doctor|schema|0.144 [--json]', description: 'Check Codex CLI compatibility/version/update status, run the official `codex update`, and inspect current manifest, capability, and hook-schema evidence.' },
615
618
  { name: 'codex-app', usage: 'sks codex-app [check|glm-profile install|set-openrouter-key --api-key-stdin|product-design|chrome-extension|pat status|remote-control]', description: 'Check Codex App install, GLM/OpenRouter model profile visibility, codex-lb key-entry guidance, Product Design plugin readiness, Codex Chrome Extension web verification readiness, PAT-safe status, first-party MCP/plugin readiness, and Codex CLI 0.130.0+ remote-control availability.' },
616
619
  { name: 'codex-native', usage: 'sks codex-native status|feature-broker|invocation-plan|init-deep [--json]', description: 'Inspect Codex Native feature broker readiness, invocation routing, pattern evidence, and managed memory setup.' },
617
620
  { name: 'hooks', usage: 'sks hooks explain|status|trust-report|replay|codex-validate|warning-check ... [--json]', description: 'Explain Codex hook events, validate vendored latest 10-event output schemas, replay fixtures, and enforce warning-zero SKS hook policies under the 0.134 compatibility matrix.' },
618
621
  { name: 'codex-lb', usage: 'sks codex-lb status|health|metrics|doctor|circuit|repair|setup ...', description: 'Configure, health-check, repair, and record circuit evidence for codex-lb provider auth without confusing ChatGPT OAuth and proxy keys.' },
619
- { name: 'zellij', usage: 'sks zellij status|repair [--json] | sks naruto dashboard latest | sks --mad', description: 'Inspect Zellij runtime status, explain repair (no auto-install), and open the SKS Zellij runtime used by MAD and Naruto lane UI.' },
622
+ { name: 'zellij', usage: 'sks zellij status|repair [--json] | sks --mad', description: 'Inspect Zellij runtime status, explain repair (no auto-install), and open the SKS Zellij runtime used by MAD. Zellij panes are not official Naruto subagent evidence.' },
620
623
  { name: 'tmux', usage: 'removed-runtime migration notice (replacement: zellij)', description: 'Show the removed-runtime migration notice and point operators to Zellij.' },
621
624
  { name: 'mad-sks', usage: 'sks mad-sks plan|run|apply|sql|apply-migration|status|close|rollback-apply ... | sks --mad [--high]', description: 'Open or inspect MAD-SKS scoped permission workflows, merged SQL-plane execution, and the Zellij permission launcher.' },
622
625
  { name: 'auto-review', usage: 'sks auto-review status|enable|start [--high] | sks --Auto-review --high', description: 'Enable Codex automatic approval review and launch SKS Zellij with the auto-review profile.' },
@@ -652,7 +655,6 @@ export const COMMAND_CATALOG = [
652
655
  { name: 'goal', usage: 'sks goal create|pause|resume|clear|status ...', description: 'Prepare and control the fast SKS bridge overlay for Codex native persisted /goal workflows.' },
653
656
  { name: 'seo-geo-optimizer', usage: 'sks seo-geo-optimizer [seo|geo] doctor|audit|research|strategy|plan|apply|verify|status|rollback|fixture [mission|latest] [--mode seo|geo] [--target auto|website|docs|package] [--include-marketing] [--json]', description: 'Run the unified SEO/GEO optimizer on the shared search-visibility kernel with mode-specific gates, marketing research/strategy, safe apply, and proof.' },
654
657
  { name: 'research', usage: 'sks research prepare|run|status ...', description: 'Run long-form real research missions with xhigh agent Eureka ideas, debate, layered sources, paper, novelty, and falsification gates.' },
655
- { name: 'db', usage: 'sks db policy|scan|mcp-config|classify|check ...', description: 'Inspect and enforce database/Supabase safety policy.' },
656
658
  { name: 'eval', usage: 'sks eval run|compare|thresholds ...', description: 'Run deterministic context-quality and performance evidence checks.' },
657
659
  { name: 'harness', usage: 'sks harness fixture|review [--json]', description: 'Run Harness Growth Factory fixtures for forgetting, skills, experiments, tool taxonomy, permissions, MultiAgentV2, and Zellij views.' },
658
660
  { name: 'perf', usage: 'sks perf run|workflow|cold-start [--json] [--iterations N]', description: 'Measure structured GPT-5.6/SKS performance budgets, including cold-start, Proof Field workflow decisions, and fast-lane evidence.' },
@@ -668,8 +670,9 @@ export const COMMAND_CATALOG = [
668
670
  { name: 'wiki', usage: 'sks wiki coords|pack|refresh|publish|rebuild-index|validate|validate-shared|wrongness ...', description: 'Build, refresh, publish shared shards, rebuild ignored indexes, validate, and attach wrongness-memory context to RGBA/trig LLM Wiki packs with attention.use_first and attention.hydrate_first for compact recall plus source hydration.' },
669
671
  { name: 'memory', usage: 'sks memory build [--json] | sks memory gc [--dry-run]', description: 'Project TriWiki context-pack memory into managed AGENTS.md blocks or run bounded memory cleanup.' },
670
672
  { name: 'hproof', usage: 'sks hproof check [mission-id|latest]', description: 'Evaluate the H-Proof done gate for a mission.' },
671
- { name: 'agent', usage: 'sks agent run|status|close|cleanup <mission-id|latest> [--agents N] [--work-items N] [--target-active-slots N] [--mock] [--apply|--dry-run] [--drain] [--stale-ms N] [--json] | sks agent rollback-patches [mission-id|latest] [--patch-entry-id id] [--dry-run|--apply] [--json]', description: 'Run, inspect, close, clean, or rollback native multi-session agent missions with agents as target active slots, work items as the route queue size, cleanup executor proof for stale runtime resources, and patch rollback proof for applied patch entries.' },
672
- { name: 'team', usage: 'sks team \"task\" | sks team log|tail|watch|lane|status|dashboard|event|message|open-zellij|attach-zellij|cleanup-zellij ...', description: 'Deprecated compatibility command: new tasks redirect to Naruto; observation subcommands remain for old Team missions.' },
673
+ { name: 'agent', usage: 'sks agent run|status|close|cleanup <mission-id|latest> [--agents N] [--work-items N] [--target-active-slots N] [--mock] [--apply|--dry-run] [--drain] [--stale-ms N] [--json] | sks agent rollback-patches [mission-id|latest] [--patch-entry-id id] [--dry-run|--apply] [--json]', description: 'Run, inspect, close, clean, or roll back Codex subagent missions with an explicit requested-agent/thread budget, disjoint work ownership, official event evidence, and parent-owned integration.' },
674
+ { name: 'naruto', usage: 'sks naruto run \"task\" [--agents N] [--max-threads N] [--json] | sks naruto status|subagents|proof [latest|M-...] [--json]', description: 'Run or inspect the Codex official subagent workflow with a Sol Max parent and fixed Luna Max mechanical, Sol High implementation, Sol Max judgment, and Terra Medium long-context/tool profiles, max_depth=1, and structured parent-thread completion evidence.' },
675
+ { name: 'team', usage: 'sks team \"task\" | sks team log|tail|watch|lane|status ...', description: 'Deprecated compatibility command: new tasks redirect to Naruto; only read-only observation subcommands remain for old Team missions.' },
673
676
  { name: 'reasoning', usage: 'sks reasoning ["prompt"] [--json]', description: 'Show SKS temporary reasoning-effort routing: medium for simple tasks, high for logic, xhigh for research.' },
674
677
  { name: 'gx', usage: 'sks gx init|render|validate|drift|snapshot [name]', description: 'Create and verify deterministic SVG/HTML visual context cartridges.' },
675
678
  { name: 'profile', usage: 'sks profile show|set <model>', description: 'Inspect or set the current SKS model profile metadata.' },
@@ -804,10 +807,14 @@ export function looksLikeSuperSearchRequest(prompt = '') {
804
807
  export function routePrompt(prompt) {
805
808
  const text = stripVisibleDecisionAnswerBlocks(prompt);
806
809
  const intentScores = scorePromptIntent(text);
807
- const select = (route) => withPromptIntentScores(route, intentScores);
810
+ const taskProfile = classifyTaskProfile(text);
811
+ const explicitCommand = Boolean(dollarCommand(text)) || /^\$?(?:plan|swarm)\b/i.test(text);
812
+ const select = (route) => withTaskProfile(withPromptIntentScores(route, intentScores), taskProfile, explicitCommand);
813
+ if (!explicitCommand && taskProfile === 'passthrough')
814
+ return null;
808
815
  if (/^\$?plan\b/i.test(text))
809
816
  return select(routeById('Planner'));
810
- if (/^\$?work\b/i.test(text))
817
+ if (/^\$work\b/i.test(text))
811
818
  return select(routeById('Naruto'));
812
819
  if (/^\$?swarm\b/i.test(text))
813
820
  return select(routeById('Naruto'));
@@ -844,10 +851,18 @@ export function routePrompt(prompt) {
844
851
  return select(routeById('ComputerUse'));
845
852
  if (looksLikeTinyDirectFix(text))
846
853
  return select(routeById('DFix'));
847
- if (/\b(SQL|Supabase|Postgres|migration|RLS|Prisma|Drizzle|Knex|database|DB|execute_sql)\b/i.test(text))
854
+ if (looksLikeDatabaseWorkRequest(text))
848
855
  return select(routeById('DB'));
849
856
  if (looksLikeSuperSearchRequest(text) && !looksLikeCodeChangingWork(text))
850
857
  return select(routeById('SuperSearch'));
858
+ if (taskProfile === 'answer' && !looksLikeSpecializedAnswerRouteSignal(text) && !looksLikeDirectWorkRequest(text))
859
+ return select(routeById('Answer'));
860
+ if (/\bautoresearch\b/i.test(text) && !looksLikeCodeChangingWork(text))
861
+ return select(routeById('AutoResearch'));
862
+ if (/\b(research|hypothesis|falsify|novelty|frontier)\b|조사|연구/i.test(text) && !looksLikeCodeChangingWork(text))
863
+ return select(routeById('Research'));
864
+ if (taskProfile === 'parallel-read' || taskProfile === 'parallel-write')
865
+ return select(routeById('Naruto'));
851
866
  if (looksLikeQuestionShapedDirective(text))
852
867
  return select(routeById('Naruto'));
853
868
  if (looksLikeDirectWorkRequest(text))
@@ -876,8 +891,14 @@ export function routePrompt(prompt) {
876
891
  return select(routeById('GX'));
877
892
  if (looksLikeTeamDefaultWork(text))
878
893
  return select(routeById('Naruto'));
894
+ if (taskProfile === 'answer')
895
+ return select(routeById('Answer'));
879
896
  return select(routeById('SKS'));
880
897
  }
898
+ function looksLikeSpecializedAnswerRouteSignal(prompt = '') {
899
+ const text = String(prompt || '');
900
+ return /\b(qa[-\s]?loop|qaloop|autoresearch|research|hypothesis|falsify|novelty|frontier|wiki|triwiki|GX|vgraph|visual context|render cartridge|wiki coordinate|rgba|trig|llm wiki|SEO|GEO|generative engine optimization)\b|조사|연구|위키|트라이위키|검색\s*엔진\s*최적화|생성형\s*엔진\s*최적화/i.test(text);
901
+ }
881
902
  export function scorePromptIntent(prompt = '') {
882
903
  const text = String(prompt || '').trim();
883
904
  const reasons = new Set();
@@ -929,7 +950,7 @@ export function scorePromptIntent(prompt = '') {
929
950
  researchScore += 2;
930
951
  reasons.add('research');
931
952
  }
932
- if (/\b(SQL|Supabase|Postgres|migration|RLS|Prisma|Drizzle|Knex|database|DB|execute_sql)\b/i.test(text)) {
953
+ if (looksLikeDatabaseWorkRequest(text)) {
933
954
  dbScore += 3;
934
955
  reasons.add('db');
935
956
  }
@@ -952,6 +973,11 @@ function withPromptIntentScores(route, intentScores) {
952
973
  return route;
953
974
  return { ...route, intent_scores: intentScores };
954
975
  }
976
+ function withTaskProfile(route, taskProfile, explicitInvocation = false) {
977
+ if (!route)
978
+ return route;
979
+ return { ...route, task_profile: taskProfile, explicit_invocation: explicitInvocation };
980
+ }
955
981
  export function looksLikeComputerUseFastLane(prompt = '') {
956
982
  const text = String(prompt || '');
957
983
  const computerUseCue = /\b(computer\s*use|codex\s+computer\s+use|computer-use)\b|컴퓨터\s*유즈|컴퓨터\s*사용|컴퓨터유즈/i.test(text);
@@ -1000,6 +1026,8 @@ export function looksLikeDirectWorkRequest(prompt = '') {
1000
1026
  const text = String(prompt || '');
1001
1027
  if (/(?:설명만|설명\s*만|just\s+explain|explain\s+only|only\s+explain)/i.test(text))
1002
1028
  return false;
1029
+ if (looksLikePureExplanationRequest(text))
1030
+ return false;
1003
1031
  const explicitDirective = looksLikeExplicitDirectWorkDirective(text);
1004
1032
  if (looksLikeDirectFixQuestion(text) && !explicitDirective)
1005
1033
  return false;
@@ -1013,6 +1041,14 @@ export function looksLikeDirectWorkRequest(prompt = '') {
1013
1041
  || /(작업|파이프라인|구현|수정|변경|추가|적용|반영|처리|수행|검수|설치|해결|리드미|README).*(해줘|해달|해라|해야|되게|줘야|줘야지|달라)/i.test(text)
1014
1042
  || /(진행해|수행해|작업해|처리해|적용해|반영해|검수해|고쳐줘|바꿔줘|해결해줘|만들어줘|해줘야|해줘야지|해달라|해야지|되게 해|install|run|execute|test|deploy|commit|push)/i.test(text);
1015
1043
  }
1044
+ function looksLikePureExplanationRequest(prompt = '') {
1045
+ const text = String(prompt || '').trim();
1046
+ const explanationEnding = /(?:설명|알려)\s*(?:해\s*줘|해\s*주세요|해달라|줘)\s*[.!?]*$/i.test(text)
1047
+ || /^(?:can|could|would) you explain\b/i.test(text);
1048
+ if (!explanationEnding)
1049
+ return false;
1050
+ return !/\b(fix|implement|change|edit|add|remove|delete|modify|refactor|build|create|write|update|rename|rewrite|patch|apply|execute|repair|resolve|publish|release|deploy|migrate)\b|고쳐|수정|변경|추가|삭제|구현|리팩터|작성|생성|업데이트|적용|실행|해결|배포|출시|마이그레이션/i.test(text);
1051
+ }
1016
1052
  function looksLikeConditionalWorkRequest(prompt = '') {
1017
1053
  const text = String(prompt || '').trim();
1018
1054
  if (!text)
@@ -1034,6 +1070,7 @@ function looksLikeExplicitDirectWorkDirective(prompt = '') {
1034
1070
  return false;
1035
1071
  const koreanDirective = /(해\s*줘|해\s*주세요|해달|달라|진행해|수행해|작업해|처리해|적용해|반영해|검수해|고쳐줘|수정해줘|변경해줘|바꿔줘|해결해줘|만들어줘|준비해줘|완료해줘|배포\s*준비|릴리즈\s*준비|다음\s*버전)/i.test(text);
1036
1072
  const englishDirective = /\b(?:please\s+)?(?:fix|repair|resolve|solve|implement|patch|update|change|modify|prepare|ship|release|publish|deploy)\b[\s\S]{0,180}\b(?:for\s+me|now|release|deployment|publish|next\s+version|ship|deploy|prepare)\b/i.test(text)
1073
+ || /^(?:please\s+)?work\s+on\b/i.test(text)
1037
1074
  || /\b(?:prepare|make)\b[\s\S]{0,120}\b(?:next\s+version|release|deployment|publish|ship)\b/i.test(text)
1038
1075
  || /\b(?:fix|repair|resolve|solve|implement|patch|update|change|modify)\b[\s\S]{0,180}\b(?:prepare|ship|release|publish|deploy)\b/i.test(text);
1039
1076
  return koreanDirective || englishDirective;
@@ -1047,34 +1084,80 @@ export function routeNeedsContext7(route, prompt = '') {
1047
1084
  return false;
1048
1085
  return /\b(package|library|framework|SDK|API|MCP|Supabase|React|Next|Vue|Svelte|Vite|Prisma|Drizzle|Knex|Postgres|npm|node_modules|docs?|documentation)\b/i.test(String(prompt || ''));
1049
1086
  }
1050
- export function routeRequiresSubagents(route, prompt = '') {
1051
- if (!route)
1052
- return false;
1053
- if (route.id === 'Team' || route.id === 'Naruto')
1054
- return true;
1055
- if (route.id === 'SKS')
1056
- return looksLikeTeamDefaultWork(prompt);
1057
- if (route.id === 'Help' || route.id === 'Answer' || route.id === 'Wiki' || route.id === 'ComputerUse' || route.id === 'Commit' || route.id === 'CommitAndPush')
1058
- return false;
1059
- if (route.id === 'PPT')
1060
- return false;
1061
- if (route.id === 'ImageUXReview')
1062
- return false;
1063
- if (route.id === 'SuperSearch')
1064
- return false;
1065
- if (route.id === 'SEOGEOOptimizer')
1066
- return false;
1067
- if (route.id === 'MadDB')
1068
- return false;
1069
- if (route.id === 'Research' || route.id === 'AutoResearch')
1070
- return true;
1071
- if (route.id === 'Goal')
1072
- return looksLikeExecutionWork(prompt) || looksLikeTeamDefaultWork(stripDollarCommand(prompt));
1073
- if (route.id === 'DB' || route.id === 'GX')
1074
- return looksLikeExecutionWork(prompt);
1075
- if (route.id === 'DFix')
1076
- return looksLikeCodeChangingWork(prompt) && !looksLikeTinyDirectFix(prompt);
1077
- return looksLikeExecutionWork(prompt);
1087
+ const NARUTO_GATE_BYPASS_ROUTE_IDS = new Set([
1088
+ 'Answer',
1089
+ 'DFix',
1090
+ 'Help',
1091
+ 'Wiki',
1092
+ 'ComputerUse',
1093
+ 'Goal',
1094
+ 'Commit',
1095
+ 'CommitAndPush',
1096
+ 'FastMode',
1097
+ 'LocalModel',
1098
+ 'Planner'
1099
+ ]);
1100
+ const NARUTO_GATE_ROUTE_OWNED_IDS = new Set([
1101
+ 'Research',
1102
+ 'AutoResearch',
1103
+ 'QALoop'
1104
+ ]);
1105
+ const NARUTO_GATE_SPECIALIZED_PARALLEL_ROUTE_IDS = new Set([
1106
+ 'Review',
1107
+ 'ReleaseReview',
1108
+ 'PPT',
1109
+ 'ImageUXReview',
1110
+ 'SuperSearch',
1111
+ 'SEOGEOOptimizer',
1112
+ 'DB',
1113
+ 'MadDB',
1114
+ 'MadSKS',
1115
+ 'GX'
1116
+ ]);
1117
+ export function narutoDecisionForRoute(route, prompt = '', profile = classifyTaskProfile(prompt)) {
1118
+ const routeId = route?.id ? String(route.id) : null;
1119
+ if (!routeId) {
1120
+ return narutoRouteDecision('none', null, profile, 'no_route_or_task_context', true);
1121
+ }
1122
+ if (NARUTO_GATE_ROUTE_OWNED_IDS.has(routeId)) {
1123
+ // These routes already own their orchestration lifecycle. The common
1124
+ // Naruto gate records that fact but must not add a second generic fanout.
1125
+ return narutoRouteDecision('route_owned', routeId, profile, `route_owned_orchestration:${routeId}`, false);
1126
+ }
1127
+ if (NARUTO_GATE_BYPASS_ROUTE_IDS.has(routeId)) {
1128
+ return narutoRouteDecision('none', routeId, profile, `lightweight_route_bypass:${routeId}`, true);
1129
+ }
1130
+ if ((routeId === 'Team' || routeId === 'Naruto') && route.explicit_invocation !== false) {
1131
+ return narutoRouteDecision('generic_naruto', routeId, profile, 'explicit_official_subagent_route', false);
1132
+ }
1133
+ if (/(?:^|\s)--(?:agents|clones)(?:=|\s+)\d+\b/i.test(String(prompt || ''))) {
1134
+ return narutoRouteDecision('generic_naruto', routeId, profile, 'explicit_subagent_count', false);
1135
+ }
1136
+ if (NARUTO_GATE_SPECIALIZED_PARALLEL_ROUTE_IDS.has(routeId)) {
1137
+ return narutoRouteDecision('generic_naruto', routeId, profile, `specialized_route_default_parallel:${routeId}`, false);
1138
+ }
1139
+ if (profile === 'passthrough' || profile === 'answer' || profile === 'tiny-change') {
1140
+ return narutoRouteDecision('none', routeId, profile, `task_profile_${profile}_bypass`, true);
1141
+ }
1142
+ if (profile === 'bounded-work' || profile === 'parallel-read' || profile === 'parallel-write' || profile === 'high-risk') {
1143
+ return narutoRouteDecision('generic_naruto', routeId, profile, `task_profile_${profile}_default_parallel`, false);
1144
+ }
1145
+ return narutoRouteDecision('none', routeId, profile, `task_profile_${profile}_bypass`, true);
1146
+ }
1147
+ export function routeRequiresSubagents(route, prompt = '', profile = classifyTaskProfile(prompt)) {
1148
+ return narutoDecisionForRoute(route, prompt, profile).mode === 'generic_naruto';
1149
+ }
1150
+ function narutoRouteDecision(mode, routeId, profile, reason, trivial) {
1151
+ const required = mode === 'generic_naruto';
1152
+ return {
1153
+ mode,
1154
+ required,
1155
+ route_id: routeId,
1156
+ task_profile: profile,
1157
+ reason,
1158
+ trivial,
1159
+ default_parallel: required
1160
+ };
1078
1161
  }
1079
1162
  export function simpleGitOnlyRouteId(prompt = '') {
1080
1163
  const text = stripVisibleDecisionAnswerBlocks(String(prompt || '')).trim();
@@ -1115,23 +1198,22 @@ export function subagentExecutionPolicyText(route, prompt = '') {
1115
1198
  const required = routeRequiresSubagents(route, prompt);
1116
1199
  if (route?.id === 'Goal') {
1117
1200
  if (!required)
1118
- return 'Native session policy: Goal itself is a lightweight native /goal persistence overlay; extra worker sessions are not required for bridge creation/control.';
1201
+ return 'Subagent policy: Goal is a lightweight native /goal persistence overlay; a subagent workflow is not required for bridge creation or control.';
1119
1202
  return [
1120
- 'Native session policy: Goal itself remains a lightweight native /goal persistence overlay.',
1121
- 'Because the prompt also asks for code-changing or execution work, continue that work through the selected SKS execution route and apply that route\'s worker/reviewer policy there.',
1203
+ 'Subagent policy: Goal remains a lightweight native /goal persistence overlay.',
1204
+ 'Because the prompt also requests explicitly parallel execution, continue through the selected SKS execution route and use that route\'s Codex subagent workflow.',
1122
1205
  noUnrequestedFallbackCodePolicyText()
1123
1206
  ].join(' ');
1124
1207
  }
1125
1208
  if (!required) {
1126
- return 'Native session policy: optional for this route; open extra native sessions only when parallel exploration materially helps.';
1209
+ return 'Subagent policy: not required for this task profile. Keep the work parent-owned unless a later, concrete decomposition reveals independent slices.';
1127
1210
  }
1128
1211
  return [
1129
- 'Native multi-session policy: REQUIRED for code-changing or execution work in this route.',
1130
- 'The selected SKS route itself authorizes route-owned worker/reviewer native sessions; the user does not need to separately ask for helper sessions when the default Naruto pipeline is active.',
1131
- 'Before editing, the parent orchestrator must visibly state the SKS route, split independent write scopes, and run worker/reviewer native sessions whenever the route can be split safely.',
1132
- 'Determine native tool availability from the callable tool manifest in the current turn and from actual call results. If functions.exec or functions.collaboration.spawn_agent is exposed, use it; never report those tools unavailable because an obsolete CLI alias is missing.',
1133
- 'Run workers in parallel only with disjoint ownership. The parent owns integration, verification, and final evidence.',
1134
- 'If native sessions are unavailable or the work cannot be safely split, record explicit unavailable/unsplittable native-session evidence before editing.',
1212
+ 'Codex subagent workflow: required for this explicit Naruto or parallel task.',
1213
+ 'The parent agent owns decomposition, integration, scoped verification, and the final answer.',
1214
+ 'Delegate only genuinely independent slices. Use Luna Max only for tiny short-context mechanical work, Sol High for ordinary implementation, Sol Max for review/debug/planning/architecture/integration/risk judgment, and Terra Medium for long-context or Computer Use, Browser/Chrome, and image-generation execution.',
1215
+ 'Parallel writes require disjoint paths; serialize overlapping paths, prohibit nested delegation, avoid duplicate work, wait for all requested agent threads, and close completed threads after collecting results.',
1216
+ 'Completion evidence comes from official SubagentStart/SubagentStop events plus the parent integration summary, not process counts or PID evidence.',
1135
1217
  noUnrequestedFallbackCodePolicyText()
1136
1218
  ].join(' ');
1137
1219
  }
@@ -1162,10 +1244,8 @@ export function routeReasoning(route, prompt = '') {
1162
1244
  return reasoning('low', 'route_policy_low');
1163
1245
  return reasoning('medium', 'simple_fulfillment');
1164
1246
  }
1165
- function narutoRouteReasoning(text = '') {
1166
- if (/(frontier|autoresearch|novelty|hypothesis|falsify|forensic|from-chat-img|research|current docs?|library|framework|sdk|api|database|supabase|sql|migration|security|permission|mad|release|publish|deploy|commit|push|architecture|algorithm|strategy|planning|integration|refactor|가설|포렌식|리서치|문서|데이터베이스|마이그레이션|보안|권한|배포|커밋|푸쉬|전략|기획|통합|리팩터)/i.test(text))
1167
- return reasoning('max', 'naruto_complex_or_high_risk_signal');
1168
- return reasoning('xhigh', 'naruto_gpt56_baseline');
1247
+ function narutoRouteReasoning(_text = '') {
1248
+ return reasoning('max', 'naruto_parent_sol_max');
1169
1249
  }
1170
1250
  export function reasoningProfileName(effort) {
1171
1251
  if (effort === 'low')