sneakoscope 2.0.14 → 2.0.16

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 (491) hide show
  1. package/README.md +6 -3
  2. package/crates/sks-core/Cargo.lock +1 -1
  3. package/crates/sks-core/Cargo.toml +1 -1
  4. package/crates/sks-core/src/main.rs +1 -1
  5. package/dist/.sks-build-stamp.json +4 -4
  6. package/dist/bin/sks.js +1 -1
  7. package/dist/cli/command-registry.js +2 -1
  8. package/dist/commands/mad-db.js +5 -0
  9. package/dist/commands/zellij-slot-pane.js +3 -1
  10. package/dist/core/agents/agent-orchestrator.js +66 -3
  11. package/dist/core/agents/agent-plan.js +3 -2
  12. package/dist/core/agents/agent-scheduler.js +204 -86
  13. package/dist/core/agents/agent-schema.js +1 -1
  14. package/dist/core/agents/native-cli-session-swarm.js +199 -15
  15. package/dist/core/agents/native-cli-worker.js +85 -0
  16. package/dist/core/agents/parallel-runtime-proof.js +217 -0
  17. package/dist/core/codex-control/codex-task-runner.js +32 -4
  18. package/dist/core/codex-control/model-call-concurrency.js +106 -0
  19. package/dist/core/commands/basic-cli.js +1 -1
  20. package/dist/core/commands/command-suggestions.js +1 -1
  21. package/dist/core/commands/mad-db-command.js +106 -0
  22. package/dist/core/commands/mad-sks-command.js +50 -13
  23. package/dist/core/commands/naruto-command.js +128 -5
  24. package/dist/core/commands/research-command.js +13 -1
  25. package/dist/core/commands/team-command.js +23 -175
  26. package/dist/core/db-safety.js +55 -1
  27. package/dist/core/fsx.js +1 -1
  28. package/dist/core/git/git-worktree-capability.js +18 -0
  29. package/dist/core/git/git-worktree-manager.js +80 -0
  30. package/dist/core/git/git-worktree-pool.js +4 -0
  31. package/dist/core/mad-db/mad-db-capability.js +116 -0
  32. package/dist/core/mad-db/mad-db-ledger.js +31 -0
  33. package/dist/core/mad-db/mad-db-policy-resolver.js +48 -0
  34. package/dist/core/naruto/naruto-concurrency-governor.js +14 -1
  35. package/dist/core/pipeline-internals/runtime-core.js +74 -8
  36. package/dist/core/pipeline-internals/runtime-gates.js +44 -0
  37. package/dist/core/proof/route-proof-gate.js +5 -3
  38. package/dist/core/proof/route-proof-policy.js +9 -1
  39. package/dist/core/release/release-gate-affected-selector.js +113 -0
  40. package/dist/core/release/release-gate-batch-runner.js +67 -0
  41. package/dist/core/release/release-gate-dag.js +22 -3
  42. package/dist/core/release/release-gate-resource-governor.js +23 -11
  43. package/dist/core/research/implementation-blueprint-densifier.js +1 -1
  44. package/dist/core/research/implementation-blueprint-markdown.js +1 -1
  45. package/dist/core/research/implementation-blueprint.js +68 -7
  46. package/dist/core/research/research-final-reviewer.js +27 -1
  47. package/dist/core/research/research-handoff.js +69 -5
  48. package/dist/core/research/research-realistic-report.js +162 -0
  49. package/dist/core/research/research-repetition-detector.js +75 -0
  50. package/dist/core/research/research-report-quality.js +27 -5
  51. package/dist/core/research/research-stage-runner.js +40 -13
  52. package/dist/core/research/research-synthesis-prompt.js +52 -0
  53. package/dist/core/research/research-synthesis-writer.js +208 -0
  54. package/dist/core/research.js +60 -48
  55. package/dist/core/routes.js +23 -19
  56. package/dist/core/update/update-notice.js +120 -0
  57. package/dist/core/version.js +1 -1
  58. package/dist/core/zellij/zellij-dashboard-renderer.js +2 -0
  59. package/dist/core/zellij/zellij-slot-column-anchor.js +35 -1
  60. package/dist/core/zellij/zellij-slot-pane-renderer.js +57 -0
  61. package/dist/core/zellij/zellij-slot-telemetry.js +237 -0
  62. package/dist/scripts/release-gate-dag-runner.js +5 -0
  63. package/dist/scripts/release-speed-summary.js +27 -0
  64. package/package.json +76 -5
  65. package/schemas/agents/parallel-runtime-proof.schema.json +48 -0
  66. package/schemas/mad-db/mad-db-capability.schema.json +31 -0
  67. package/schemas/mad-db/mad-db-ledger.schema.json +14 -0
  68. package/schemas/research/implementation-blueprint.schema.json +6 -1
  69. package/schemas/research/research-final-review.schema.json +10 -0
  70. package/schemas/research/research-synthesis-output.schema.json +62 -0
  71. package/schemas/update/update-notice.schema.json +19 -0
  72. package/schemas/zellij/zellij-slot-telemetry.schema.json +89 -0
  73. package/dist/scripts/agent-ast-aware-work-graph-check.js +0 -25
  74. package/dist/scripts/agent-backfill-replenishment-check.js +0 -13
  75. package/dist/scripts/agent-backfill-route-blackbox.js +0 -5
  76. package/dist/scripts/agent-background-terminals-check.js +0 -16
  77. package/dist/scripts/agent-cleanup-command-ux-check.js +0 -12
  78. package/dist/scripts/agent-cleanup-executor-check.js +0 -53
  79. package/dist/scripts/agent-cleanup-executor-v2-check.js +0 -39
  80. package/dist/scripts/agent-cli-options-to-task-graph-check.js +0 -5
  81. package/dist/scripts/agent-codex-app-cockpit-check.js +0 -91
  82. package/dist/scripts/agent-codex-child-overlap-check.js +0 -21
  83. package/dist/scripts/agent-dynamic-cockpit-check.js +0 -10
  84. package/dist/scripts/agent-dynamic-pool-check.js +0 -13
  85. package/dist/scripts/agent-dynamic-pool-route-blackbox.js +0 -5
  86. package/dist/scripts/agent-fast-mode-default-check.js +0 -62
  87. package/dist/scripts/agent-fast-mode-worker-propagation-check.js +0 -7
  88. package/dist/scripts/agent-follow-up-work-schema-check.js +0 -80
  89. package/dist/scripts/agent-goal-mode-propagation-check.js +0 -9
  90. package/dist/scripts/agent-intelligent-work-graph-check.js +0 -25
  91. package/dist/scripts/agent-janitor-check.js +0 -76
  92. package/dist/scripts/agent-main-no-scout-check.js +0 -11
  93. package/dist/scripts/agent-model-authored-patch-envelope-check.js +0 -15
  94. package/dist/scripts/agent-multi-project-isolation-check.js +0 -86
  95. package/dist/scripts/agent-native-cli-session-proof-check.js +0 -7
  96. package/dist/scripts/agent-native-cli-session-swarm-10-check.js +0 -7
  97. package/dist/scripts/agent-native-cli-session-swarm-20-check.js +0 -7
  98. package/dist/scripts/agent-native-cli-session-swarm-check.js +0 -7
  99. package/dist/scripts/agent-no-subagent-scaling-check.js +0 -7
  100. package/dist/scripts/agent-parallel-write-blackbox.js +0 -56
  101. package/dist/scripts/agent-parallel-write-kernel-check.js +0 -103
  102. package/dist/scripts/agent-patch-conflict-rebase-check.js +0 -198
  103. package/dist/scripts/agent-patch-envelope-extraction-check.js +0 -17
  104. package/dist/scripts/agent-patch-proof-check.js +0 -41
  105. package/dist/scripts/agent-patch-proof-runtime-check.js +0 -63
  106. package/dist/scripts/agent-patch-queue-runtime-check.js +0 -36
  107. package/dist/scripts/agent-patch-rollback-check.js +0 -38
  108. package/dist/scripts/agent-patch-rollback-dag-check.js +0 -14
  109. package/dist/scripts/agent-patch-swarm-route-blackbox.js +0 -10
  110. package/dist/scripts/agent-patch-swarm-runtime-check.js +0 -10
  111. package/dist/scripts/agent-patch-swarm-runtime-truth-check.js +0 -76
  112. package/dist/scripts/agent-patch-transaction-journal-check.js +0 -57
  113. package/dist/scripts/agent-patch-verification-dag-check.js +0 -14
  114. package/dist/scripts/agent-proof-contract-reconciled-check.js +0 -5
  115. package/dist/scripts/agent-real-codex-dynamic-smoke-check.js +0 -166
  116. package/dist/scripts/agent-real-codex-dynamic-smoke-v2-check.js +0 -14
  117. package/dist/scripts/agent-real-codex-in-zellij-worker-pane-check.js +0 -229
  118. package/dist/scripts/agent-real-codex-parallel-workers-10-check.js +0 -5
  119. package/dist/scripts/agent-real-codex-parallel-workers-20-check.js +0 -5
  120. package/dist/scripts/agent-real-codex-parallel-workers-5-check.js +0 -5
  121. package/dist/scripts/agent-real-codex-parallel-workers-check.js +0 -5
  122. package/dist/scripts/agent-role-config-repair-check.js +0 -33
  123. package/dist/scripts/agent-rollback-command-check.js +0 -86
  124. package/dist/scripts/agent-route-truth-backfill-check.js +0 -5
  125. package/dist/scripts/agent-scheduler-proof-check.js +0 -13
  126. package/dist/scripts/agent-scheduler-proof-hardening-check.js +0 -22
  127. package/dist/scripts/agent-session-generation-check.js +0 -21
  128. package/dist/scripts/agent-slot-pane-binding-proof-check.js +0 -64
  129. package/dist/scripts/agent-source-intelligence-propagation-check.js +0 -9
  130. package/dist/scripts/agent-strategy-to-lease-wiring-check.js +0 -32
  131. package/dist/scripts/agent-strategy-to-patch-strict-check.js +0 -54
  132. package/dist/scripts/agent-task-graph-expansion-check.js +0 -14
  133. package/dist/scripts/agent-terminal-generations-check.js +0 -23
  134. package/dist/scripts/agent-visual-consistency-check.js +0 -9
  135. package/dist/scripts/agent-wiki-context-proof-check.js +0 -62
  136. package/dist/scripts/agent-worker-backend-router-check.js +0 -63
  137. package/dist/scripts/agent-worker-scout-limited-check.js +0 -17
  138. package/dist/scripts/agent-zellij-dynamic-backfill-panes-check.js +0 -34
  139. package/dist/scripts/agent-zellij-runtime-check.js +0 -84
  140. package/dist/scripts/all-feature-deep-completion-check.js +0 -31
  141. package/dist/scripts/appshots-capability-check.js +0 -18
  142. package/dist/scripts/appshots-evidence-check.js +0 -48
  143. package/dist/scripts/appshots-operator-policy-check.js +0 -25
  144. package/dist/scripts/appshots-privacy-safety-check.js +0 -48
  145. package/dist/scripts/appshots-source-intelligence-check.js +0 -53
  146. package/dist/scripts/appshots-thread-attachment-discovery-check.js +0 -87
  147. package/dist/scripts/appshots-triwiki-voxel-check.js +0 -46
  148. package/dist/scripts/architecture-guard-check.js +0 -55
  149. package/dist/scripts/changelog-check.js +0 -47
  150. package/dist/scripts/codex-0-133-official-compat-report.js +0 -53
  151. package/dist/scripts/codex-0-134-official-compat-report.js +0 -110
  152. package/dist/scripts/codex-0-134-runner-truth-check.js +0 -66
  153. package/dist/scripts/codex-0-135-compat-check.js +0 -57
  154. package/dist/scripts/codex-0-136-compat-check.js +0 -30
  155. package/dist/scripts/codex-0-137-compat-check.js +0 -27
  156. package/dist/scripts/codex-app-fast-ui-preservation-check.js +0 -32
  157. package/dist/scripts/codex-app-provider-badge-check.js +0 -37
  158. package/dist/scripts/codex-app-ui-clobber-guard-check.js +0 -22
  159. package/dist/scripts/codex-app-ui-preservation-check.js +0 -96
  160. package/dist/scripts/codex-control-all-pipelines-check.js +0 -36
  161. package/dist/scripts/codex-control-capability-check.js +0 -10
  162. package/dist/scripts/codex-control-empty-result-retry-check.js +0 -43
  163. package/dist/scripts/codex-control-event-stream-ledger-check.js +0 -10
  164. package/dist/scripts/codex-control-keepalive-no-cot-leak-check.js +0 -14
  165. package/dist/scripts/codex-control-no-legacy-fallback-check.js +0 -31
  166. package/dist/scripts/codex-control-side-effect-scope-check.js +0 -26
  167. package/dist/scripts/codex-control-stream-idle-watchdog-check.js +0 -18
  168. package/dist/scripts/codex-control-structured-output-check.js +0 -11
  169. package/dist/scripts/codex-control-thread-registry-check.js +0 -11
  170. package/dist/scripts/codex-control-tool-call-sequence-repair-check.js +0 -14
  171. package/dist/scripts/codex-environment-scoped-approvals-check.js +0 -10
  172. package/dist/scripts/codex-exec-output-schema-actual-syntax-check.js +0 -33
  173. package/dist/scripts/codex-fast-mode-profile-propagation-check.js +0 -12
  174. package/dist/scripts/codex-history-search-check.js +0 -19
  175. package/dist/scripts/codex-hook-semantic-check.js +0 -15
  176. package/dist/scripts/codex-hook-strict-subset-check.js +0 -61
  177. package/dist/scripts/codex-lb-config-toml-safety-check.js +0 -85
  178. package/dist/scripts/codex-lb-persistence-truth-check.js +0 -96
  179. package/dist/scripts/codex-lb-setup-fixture-check.js +0 -91
  180. package/dist/scripts/codex-lb-setup-truthfulness-check.js +0 -84
  181. package/dist/scripts/codex-legacy-profile-consumers-removed-check.js +0 -24
  182. package/dist/scripts/codex-managed-proxy-env-check.js +0 -17
  183. package/dist/scripts/codex-output-schema-fixture-check.js +0 -25
  184. package/dist/scripts/codex-permission-profiles-check.js +0 -36
  185. package/dist/scripts/codex-plugin-list-json-check.js +0 -8
  186. package/dist/scripts/codex-profile-primary-check.js +0 -13
  187. package/dist/scripts/codex-project-config-policy-splitter-check.js +0 -51
  188. package/dist/scripts/codex-resume-cwd-truth-check.js +0 -17
  189. package/dist/scripts/codex-sdk-all-pipelines-check.js +0 -32
  190. package/dist/scripts/codex-sdk-backend-router-check.js +0 -65
  191. package/dist/scripts/codex-sdk-capability-check.js +0 -11
  192. package/dist/scripts/codex-sdk-core-skill-pipeline-check.js +0 -9
  193. package/dist/scripts/codex-sdk-dfix-pipeline-check.js +0 -9
  194. package/dist/scripts/codex-sdk-event-stream-ledger-check.js +0 -9
  195. package/dist/scripts/codex-sdk-no-legacy-fallback-check.js +0 -33
  196. package/dist/scripts/codex-sdk-qa-pipeline-check.js +0 -8
  197. package/dist/scripts/codex-sdk-real-smoke-check.js +0 -39
  198. package/dist/scripts/codex-sdk-release-review-pipeline-check.js +0 -13
  199. package/dist/scripts/codex-sdk-research-pipeline-check.js +0 -47
  200. package/dist/scripts/codex-sdk-sandbox-policy-check.js +0 -21
  201. package/dist/scripts/codex-sdk-structured-output-check.js +0 -10
  202. package/dist/scripts/codex-sdk-team-naruto-agent-pipeline-check.js +0 -12
  203. package/dist/scripts/codex-sdk-thread-registry-check.js +0 -11
  204. package/dist/scripts/codex-sdk-ux-ppt-review-pipeline-check.js +0 -9
  205. package/dist/scripts/codex-sdk-zellij-pane-binding-check.js +0 -13
  206. package/dist/scripts/codex-thread-runtime-choice-check.js +0 -10
  207. package/dist/scripts/codex-web-adapter-check.js +0 -12
  208. package/dist/scripts/computer-use-live-evidence-check.js +0 -55
  209. package/dist/scripts/computer-use-live-optional-check.js +0 -32
  210. package/dist/scripts/computer-use-policy-check.js +0 -69
  211. package/dist/scripts/computer-use-visual-route-fixture-check.js +0 -37
  212. package/dist/scripts/core-skill-card-schema-check.js +0 -61
  213. package/dist/scripts/core-skill-deployment-snapshot-check.js +0 -54
  214. package/dist/scripts/core-skill-heldout-validation-check.js +0 -49
  215. package/dist/scripts/core-skill-no-inference-optimizer-check.js +0 -75
  216. package/dist/scripts/core-skill-patch-check.js +0 -79
  217. package/dist/scripts/core-skill-promotion-side-effect-ledger-check.js +0 -64
  218. package/dist/scripts/core-skill-rollout-scoring-check.js +0 -72
  219. package/dist/scripts/core-skill-route-runtime-integration-check.js +0 -49
  220. package/dist/scripts/dfix-fast-blackbox-check.js +0 -37
  221. package/dist/scripts/dfix-fast-kernel-check.js +0 -26
  222. package/dist/scripts/dfix-fixture-check.js +0 -6
  223. package/dist/scripts/dfix-parallel-write-blackbox.js +0 -48
  224. package/dist/scripts/dfix-patch-handoff-check.js +0 -13
  225. package/dist/scripts/dfix-patch-swarm-route-blackbox.js +0 -10
  226. package/dist/scripts/dfix-performance-check.js +0 -15
  227. package/dist/scripts/dfix-verification-check.js +0 -9
  228. package/dist/scripts/dfix-verification-recommendation-check.js +0 -15
  229. package/dist/scripts/docs-truthfulness-check.js +0 -61
  230. package/dist/scripts/doctor-codex-doctor-parity-check.js +0 -17
  231. package/dist/scripts/doctor-fix-proves-codex-read-check.js +0 -64
  232. package/dist/scripts/doctor-fix-recovers-corrupted-config-check.js +0 -122
  233. package/dist/scripts/doctor-fixes-codex-app-fast-ui-check.js +0 -39
  234. package/dist/scripts/evidence-fixture-check.js +0 -26
  235. package/dist/scripts/evidence-flagship-coverage-check.js +0 -55
  236. package/dist/scripts/fake-real-proof-policy-v2-check.js +0 -27
  237. package/dist/scripts/fake-vs-real-proof-policy-check.js +0 -14
  238. package/dist/scripts/fast-codex-service-tier-proof-check.js +0 -42
  239. package/dist/scripts/flagship-proof-graph-v2-check.js +0 -48
  240. package/dist/scripts/flagship-proof-graph-v3-check.js +0 -67
  241. package/dist/scripts/flagship-proof-graph-v4-check.js +0 -61
  242. package/dist/scripts/git-precommit-fixture-check.js +0 -41
  243. package/dist/scripts/git-worktree-cache-performance-check.js +0 -25
  244. package/dist/scripts/git-worktree-capability-check.js +0 -27
  245. package/dist/scripts/git-worktree-checkpoint-check.js +0 -20
  246. package/dist/scripts/git-worktree-cleanup-check.js +0 -27
  247. package/dist/scripts/git-worktree-cross-rebase-check.js +0 -39
  248. package/dist/scripts/git-worktree-diff-envelope-check.js +0 -17
  249. package/dist/scripts/git-worktree-diff-export-check.js +0 -43
  250. package/dist/scripts/git-worktree-dirty-lock-check.js +0 -17
  251. package/dist/scripts/git-worktree-dirty-main-detection-check.js +0 -14
  252. package/dist/scripts/git-worktree-integration-primary-check.js +0 -24
  253. package/dist/scripts/git-worktree-integration-primary-runtime-check.js +0 -20
  254. package/dist/scripts/git-worktree-manager-check.js +0 -37
  255. package/dist/scripts/git-worktree-manifest-append-check.js +0 -18
  256. package/dist/scripts/git-worktree-merge-queue-check.js +0 -31
  257. package/dist/scripts/git-worktree-pool-performance-check.js +0 -20
  258. package/dist/scripts/git-worktree-untracked-diff-check.js +0 -18
  259. package/dist/scripts/goal-mode-official-default-check.js +0 -12
  260. package/dist/scripts/gpt-final-arbiter-check.js +0 -63
  261. package/dist/scripts/gpt-final-arbiter-performance-check.js +0 -36
  262. package/dist/scripts/gpt-image-2-request-validator-check.js +0 -35
  263. package/dist/scripts/hooks-0.134-context-parity-check.js +0 -20
  264. package/dist/scripts/hooks-actual-parity-check.js +0 -17
  265. package/dist/scripts/hooks-actual-parity-v2-check.js +0 -21
  266. package/dist/scripts/hooks-latest-schema-check.js +0 -20
  267. package/dist/scripts/hooks-managed-install-fixture-check.js +0 -21
  268. package/dist/scripts/hooks-official-hash-oracle-check.js +0 -35
  269. package/dist/scripts/hooks-official-hash-parity-check.js +0 -17
  270. package/dist/scripts/hooks-subagent-events-check.js +0 -17
  271. package/dist/scripts/hooks-trust-state-check.js +0 -14
  272. package/dist/scripts/image-fidelity-fixture-check.js +0 -24
  273. package/dist/scripts/imagegen-capability-check.js +0 -30
  274. package/dist/scripts/imagegen-real-smoke-check.js +0 -155
  275. package/dist/scripts/install-update-preserves-config-check.js +0 -87
  276. package/dist/scripts/json-schema-recursive-check.js +0 -78
  277. package/dist/scripts/legacy-multiagent-removal-check.js +0 -85
  278. package/dist/scripts/legacy-upgrade-matrix-check.js +0 -300
  279. package/dist/scripts/local-collab-all-pipelines-final-gpt-check.js +0 -21
  280. package/dist/scripts/local-collab-gpt-final-availability-check.js +0 -58
  281. package/dist/scripts/local-collab-no-local-only-final-check.js +0 -27
  282. package/dist/scripts/local-collab-policy-check.js +0 -17
  283. package/dist/scripts/local-collab-worktree-gpt-final-apply-policy-check.js +0 -63
  284. package/dist/scripts/local-llm-all-pipelines-check.js +0 -11
  285. package/dist/scripts/local-llm-cache-performance-check.js +0 -10
  286. package/dist/scripts/local-llm-capability-check.js +0 -14
  287. package/dist/scripts/local-llm-smoke-check.js +0 -23
  288. package/dist/scripts/local-llm-structured-output-check.js +0 -11
  289. package/dist/scripts/local-llm-throughput-check.js +0 -10
  290. package/dist/scripts/local-llm-tool-call-repair-check.js +0 -10
  291. package/dist/scripts/local-llm-warmup-check.js +0 -11
  292. package/dist/scripts/loop-blocker-check.js +0 -15
  293. package/dist/scripts/mad-preflight-blocks-unreadable-config-check.js +0 -35
  294. package/dist/scripts/mad-sks-actual-executor-blackbox.js +0 -5
  295. package/dist/scripts/mad-sks-app-ui-no-mutation-check.js +0 -92
  296. package/dist/scripts/mad-sks-audit-proof-check.js +0 -34
  297. package/dist/scripts/mad-sks-db-executor-check.js +0 -5
  298. package/dist/scripts/mad-sks-executor-proof-graph-check.js +0 -5
  299. package/dist/scripts/mad-sks-fast-mode-propagation-check.js +0 -24
  300. package/dist/scripts/mad-sks-file-write-executor-check.js +0 -5
  301. package/dist/scripts/mad-sks-immutable-harness-check.js +0 -36
  302. package/dist/scripts/mad-sks-no-harness-modification-check.js +0 -25
  303. package/dist/scripts/mad-sks-package-executor-check.js +0 -5
  304. package/dist/scripts/mad-sks-permission-model-check.js +0 -22
  305. package/dist/scripts/mad-sks-rollback-apply-check.js +0 -5
  306. package/dist/scripts/mad-sks-service-executor-check.js +0 -5
  307. package/dist/scripts/mad-sks-shell-executor-check.js +0 -5
  308. package/dist/scripts/mad-sks-write-guard-check.js +0 -28
  309. package/dist/scripts/mad-sks-zellij-default-pane-worker-check.js +0 -37
  310. package/dist/scripts/mad-sks-zellij-launch-check.js +0 -102
  311. package/dist/scripts/mcp-0-134-modernization-check.js +0 -55
  312. package/dist/scripts/mcp-readonly-concurrency-check.js +0 -17
  313. package/dist/scripts/mcp-readonly-runtime-scheduler-check.js +0 -20
  314. package/dist/scripts/mcp-tool-naming-parity-check.js +0 -16
  315. package/dist/scripts/memory-summary-rebuild-check.js +0 -22
  316. package/dist/scripts/mutation-callsite-coverage-check.js +0 -180
  317. package/dist/scripts/naruto-active-pool-check.js +0 -39
  318. package/dist/scripts/naruto-actual-worker-control-plane-check.js +0 -56
  319. package/dist/scripts/naruto-allocation-policy-check.js +0 -33
  320. package/dist/scripts/naruto-allocation-runtime-wiring-check.js +0 -92
  321. package/dist/scripts/naruto-concurrency-governor-check.js +0 -53
  322. package/dist/scripts/naruto-extreme-parallelism-check.js +0 -22
  323. package/dist/scripts/naruto-extreme-parallelism-real-check.js +0 -43
  324. package/dist/scripts/naruto-gpt-final-pack-check.js +0 -34
  325. package/dist/scripts/naruto-orchestrator-runtime-source-check.js +0 -70
  326. package/dist/scripts/naruto-parallel-patch-apply-check.js +0 -41
  327. package/dist/scripts/naruto-readonly-routing-check.js +0 -116
  328. package/dist/scripts/naruto-real-active-pool-check.js +0 -39
  329. package/dist/scripts/naruto-real-active-pool-runtime-check.js +0 -55
  330. package/dist/scripts/naruto-rebalance-policy-check.js +0 -41
  331. package/dist/scripts/naruto-role-distribution-check.js +0 -23
  332. package/dist/scripts/naruto-shadow-clone-swarm-check.js +0 -153
  333. package/dist/scripts/naruto-verification-pool-check.js +0 -36
  334. package/dist/scripts/naruto-work-graph-check.js +0 -24
  335. package/dist/scripts/naruto-worktree-coding-blackbox.js +0 -29
  336. package/dist/scripts/naruto-worktree-coding-check.js +0 -44
  337. package/dist/scripts/naruto-worktree-gpt-final-check.js +0 -45
  338. package/dist/scripts/naruto-worktree-zellij-ui-check.js +0 -28
  339. package/dist/scripts/naruto-zellij-dynamic-right-column-check.js +0 -48
  340. package/dist/scripts/naruto-zellij-massive-ui-check.js +0 -23
  341. package/dist/scripts/non-recursive-pipeline-check.js +0 -68
  342. package/dist/scripts/npm-publish-performance-check.js +0 -65
  343. package/dist/scripts/official-docs-compat-report.js +0 -304
  344. package/dist/scripts/packlist-performance-check.js +0 -83
  345. package/dist/scripts/parallel-verification-engine-check.js +0 -85
  346. package/dist/scripts/postinstall-safe-side-effects-check.js +0 -65
  347. package/dist/scripts/ppt-full-e2e-artifact-graph-check.js +0 -40
  348. package/dist/scripts/ppt-full-e2e-blackbox-check.js +0 -109
  349. package/dist/scripts/ppt-image-voxel-relations-check.js +0 -9
  350. package/dist/scripts/ppt-imagegen-blackbox-check.js +0 -46
  351. package/dist/scripts/ppt-imagegen-review-fixture-check.js +0 -6
  352. package/dist/scripts/ppt-issue-extraction-fixture-check.js +0 -7
  353. package/dist/scripts/ppt-no-mock-as-real-check.js +0 -8
  354. package/dist/scripts/ppt-no-text-fallback-check.js +0 -7
  355. package/dist/scripts/ppt-proof-trust-fixture-check.js +0 -10
  356. package/dist/scripts/ppt-real-export-adapter-check.js +0 -13
  357. package/dist/scripts/ppt-real-imagegen-smoke-check.js +0 -42
  358. package/dist/scripts/ppt-real-imagegen-wiring-check.js +0 -16
  359. package/dist/scripts/ppt-reexport-rereview-check.js +0 -19
  360. package/dist/scripts/ppt-slide-export-fixture-check.js +0 -7
  361. package/dist/scripts/prepublish-fast-check.js +0 -128
  362. package/dist/scripts/priority-full-closure-check.js +0 -12
  363. package/dist/scripts/product-design-auto-install-check.js +0 -119
  364. package/dist/scripts/product-design-plugin-routing-check.js +0 -101
  365. package/dist/scripts/prompt-placeholder-guard-check.js +0 -33
  366. package/dist/scripts/provider-badge-context-check.js +0 -26
  367. package/dist/scripts/provider-context-config-toml-check.js +0 -63
  368. package/dist/scripts/python-codex-sdk-all-pipelines-check.js +0 -47
  369. package/dist/scripts/python-codex-sdk-capability-check.js +0 -75
  370. package/dist/scripts/python-codex-sdk-sandbox-policy-check.js +0 -10
  371. package/dist/scripts/python-codex-sdk-stream-bridge-check.js +0 -12
  372. package/dist/scripts/python-tools-smoke-check.js +0 -71
  373. package/dist/scripts/qa-actual-route-backfill-check.js +0 -5
  374. package/dist/scripts/qa-backfill-route-blackbox.js +0 -5
  375. package/dist/scripts/qa-patch-swarm-route-blackbox.js +0 -10
  376. package/dist/scripts/readme-architecture-imagegen-official-check.js +0 -448
  377. package/dist/scripts/release-cache-glob-hashing-check.js +0 -42
  378. package/dist/scripts/release-dag-full-coverage-check.js +0 -66
  379. package/dist/scripts/release-dist-freshness-check.js +0 -8
  380. package/dist/scripts/release-dynamic-performance-check.js +0 -103
  381. package/dist/scripts/release-gate-budget-check.js +0 -36
  382. package/dist/scripts/release-gate-dag-runner-check.js +0 -17
  383. package/dist/scripts/release-metadata-1-11-check.js +0 -37
  384. package/dist/scripts/release-metadata-1-12-check.js +0 -48
  385. package/dist/scripts/release-metadata-1-13-check.js +0 -53
  386. package/dist/scripts/release-metadata-1-14-check.js +0 -63
  387. package/dist/scripts/release-metadata-1-16-check.js +0 -81
  388. package/dist/scripts/release-metadata-1-17-check.js +0 -51
  389. package/dist/scripts/release-metadata-1-19-check.js +0 -371
  390. package/dist/scripts/release-metadata-check.js +0 -7
  391. package/dist/scripts/release-native-agent-fixture-check.js +0 -41
  392. package/dist/scripts/release-parallel-check.js +0 -374
  393. package/dist/scripts/release-parallel-full-coverage-check.js +0 -13
  394. package/dist/scripts/release-parallel-speed-budget-check.js +0 -84
  395. package/dist/scripts/release-provenance-check.js +0 -150
  396. package/dist/scripts/release-real-check.js +0 -330
  397. package/dist/scripts/release-registry-check.js +0 -344
  398. package/dist/scripts/release-runtime-truth-matrix-check.js +0 -47
  399. package/dist/scripts/release-stability-report-check.js +0 -99
  400. package/dist/scripts/release-version-truth-check.js +0 -134
  401. package/dist/scripts/research-actual-route-backfill-check.js +0 -5
  402. package/dist/scripts/research-backfill-route-blackbox.js +0 -5
  403. package/dist/scripts/research-blueprint-densifier-check.js +0 -21
  404. package/dist/scripts/research-claim-builder-check.js +0 -19
  405. package/dist/scripts/research-complete-package-fixture-check.js +0 -23
  406. package/dist/scripts/research-final-reviewer-blackbox.js +0 -22
  407. package/dist/scripts/research-parallel-source-shards-check.js +0 -22
  408. package/dist/scripts/research-quality-gate-check.js +0 -111
  409. package/dist/scripts/research-real-cycle-no-legacy-final-md-check.js +0 -14
  410. package/dist/scripts/research-short-report-rejection-check.js +0 -46
  411. package/dist/scripts/research-source-ledger-merge-check.js +0 -26
  412. package/dist/scripts/research-stage-cycle-runtime-blackbox.js +0 -24
  413. package/dist/scripts/responses-retry-policy-centralized-check.js +0 -19
  414. package/dist/scripts/retention-cleanup-safety-check.js +0 -155
  415. package/dist/scripts/route-blackbox-realism-check.js +0 -21
  416. package/dist/scripts/route-proof-artifact-structure-check.js +0 -145
  417. package/dist/scripts/runtime-dist-parity-check.js +0 -78
  418. package/dist/scripts/runtime-no-mjs-scripts-check.js +0 -45
  419. package/dist/scripts/runtime-no-src-mjs-check.js +0 -32
  420. package/dist/scripts/runtime-no-tmux-check.js +0 -113
  421. package/dist/scripts/runtime-ts-python-boundary-check.js +0 -59
  422. package/dist/scripts/runtime-ts-rust-boundary-check.js +0 -74
  423. package/dist/scripts/runtime-ts-source-of-truth-check.js +0 -55
  424. package/dist/scripts/safety-check.js +0 -23
  425. package/dist/scripts/shared-memory-fixture-check.js +0 -27
  426. package/dist/scripts/side-effect-runtime-report-check.js +0 -19
  427. package/dist/scripts/side-effect-zero-gate-check.js +0 -226
  428. package/dist/scripts/sks-1-11-fixture-check.js +0 -130
  429. package/dist/scripts/source-intelligence-all-modes-check.js +0 -32
  430. package/dist/scripts/source-intelligence-policy-check.js +0 -13
  431. package/dist/scripts/strategy-adhd-orchestrating-gate-check.js +0 -22
  432. package/dist/scripts/strategy-file-ownership-plan-check.js +0 -18
  433. package/dist/scripts/strategy-parallel-modification-plan-check.js +0 -19
  434. package/dist/scripts/strategy-verification-rollback-dag-check.js +0 -19
  435. package/dist/scripts/team-actual-route-backfill-check.js +0 -5
  436. package/dist/scripts/team-backfill-route-blackbox.js +0 -5
  437. package/dist/scripts/team-parallel-write-blackbox.js +0 -55
  438. package/dist/scripts/team-patch-swarm-route-blackbox.js +0 -10
  439. package/dist/scripts/terminal-keyboard-enhancement-safety-check.js +0 -12
  440. package/dist/scripts/terminal-tui-output-stability-check.js +0 -35
  441. package/dist/scripts/test-no-orphan-dist-imports-check.js +0 -73
  442. package/dist/scripts/trust-fixture-check.js +0 -33
  443. package/dist/scripts/typescript-migration-report.js +0 -78
  444. package/dist/scripts/ultra-router-auto-router-check.js +0 -33
  445. package/dist/scripts/ultra-router-classification-check.js +0 -28
  446. package/dist/scripts/ux-patch-swarm-route-blackbox.js +0 -10
  447. package/dist/scripts/ux-ppt-structured-extraction-check.js +0 -21
  448. package/dist/scripts/ux-review-extract-real-callouts-fixture-check.js +0 -8
  449. package/dist/scripts/ux-review-extract-wires-real-extractor-check.js +0 -15
  450. package/dist/scripts/ux-review-generate-callouts-fixture-check.js +0 -9
  451. package/dist/scripts/ux-review-image-voxel-relations-check.js +0 -31
  452. package/dist/scripts/ux-review-imagegen-blackbox-check.js +0 -67
  453. package/dist/scripts/ux-review-no-fake-callouts-check.js +0 -8
  454. package/dist/scripts/ux-review-no-text-fallback-check.js +0 -25
  455. package/dist/scripts/ux-review-patch-diff-recheck-check.js +0 -20
  456. package/dist/scripts/ux-review-patch-handoff-fixture-check.js +0 -8
  457. package/dist/scripts/ux-review-real-imagegen-smoke-check.js +0 -31
  458. package/dist/scripts/ux-review-real-loop-fixture-check.js +0 -24
  459. package/dist/scripts/ux-review-recapture-recheck-fixture-check.js +0 -8
  460. package/dist/scripts/ux-review-run-wires-imagegen-check.js +0 -11
  461. package/dist/scripts/worker-pane-communication-contract-check.js +0 -54
  462. package/dist/scripts/wrongness-fixture-check.js +0 -65
  463. package/dist/scripts/xai-mcp-capability-check.js +0 -14
  464. package/dist/scripts/zellij-capability-check.js +0 -15
  465. package/dist/scripts/zellij-dashboard-pane-check.js +0 -70
  466. package/dist/scripts/zellij-developer-controls-check.js +0 -20
  467. package/dist/scripts/zellij-doctor-readiness-check.js +0 -63
  468. package/dist/scripts/zellij-dynamic-pane-lifecycle-check.js +0 -21
  469. package/dist/scripts/zellij-first-slot-down-stack-check.js +0 -20
  470. package/dist/scripts/zellij-first-slot-down-stack-real-check.js +0 -356
  471. package/dist/scripts/zellij-initial-main-only-blackbox.js +0 -28
  472. package/dist/scripts/zellij-lane-renderer-check.js +0 -65
  473. package/dist/scripts/zellij-launch-command-truth-check.js +0 -75
  474. package/dist/scripts/zellij-layout-valid-check.js +0 -90
  475. package/dist/scripts/zellij-pane-proof-check.js +0 -59
  476. package/dist/scripts/zellij-real-session-cleanup-check.js +0 -21
  477. package/dist/scripts/zellij-real-session-heartbeat-check.js +0 -49
  478. package/dist/scripts/zellij-real-session-launch-check.js +0 -57
  479. package/dist/scripts/zellij-right-column-headless-overflow-check.js +0 -22
  480. package/dist/scripts/zellij-right-column-manager-check.js +0 -27
  481. package/dist/scripts/zellij-screen-proof-check.js +0 -45
  482. package/dist/scripts/zellij-slot-column-anchor-check.js +0 -66
  483. package/dist/scripts/zellij-slot-only-ui-check.js +0 -26
  484. package/dist/scripts/zellij-slot-pane-renderer-check.js +0 -106
  485. package/dist/scripts/zellij-slot-renderer-proof-semantics-check.js +0 -59
  486. package/dist/scripts/zellij-spawn-on-demand-layout-check.js +0 -40
  487. package/dist/scripts/zellij-ui-design-check.js +0 -105
  488. package/dist/scripts/zellij-worker-pane-manager-check.js +0 -109
  489. package/dist/scripts/zellij-worker-pane-manager-single-owner-check.js +0 -47
  490. package/dist/scripts/zellij-worker-pane-real-ui-blackbox.js +0 -202
  491. package/dist/scripts/zellij-worker-pane-spawn-order-check.js +0 -35
@@ -4,7 +4,21 @@ import { ensureDir, nowIso, readJson, writeJsonAtomic } from '../fsx.js';
4
4
  import { evaluateGitWorktreeCapability } from './git-worktree-capability.js';
5
5
  import { gitBlocker, gitOutputLine, runGitCommand } from './git-worktree-runner.js';
6
6
  import { sanitizePathPart } from './git-worktree-root.js';
7
+ import { appendParallelRuntimeEvent } from '../agents/parallel-runtime-proof.js';
7
8
  export async function allocateWorkerWorktree(input) {
9
+ const eventRoot = input.repoRoot || process.cwd();
10
+ const writeProofEvents = await shouldWriteWorktreeAllocationProof(eventRoot, input.missionId);
11
+ if (writeProofEvents)
12
+ await appendParallelRuntimeEvent(eventRoot, input.missionId, {
13
+ event_type: 'worktree_allocation_started',
14
+ slot_id: input.slotId || input.workerId || null,
15
+ generation_index: input.generationIndex || 1,
16
+ session_id: null,
17
+ pid: null,
18
+ backend: 'git-worktree',
19
+ placement: 'unknown',
20
+ worktree_id: input.workerId || null
21
+ }).catch(() => undefined);
8
22
  const capability = await evaluateGitWorktreeCapability({
9
23
  root: input.repoRoot || process.cwd(),
10
24
  missionId: input.missionId,
@@ -64,8 +78,63 @@ export async function allocateWorkerWorktree(input) {
64
78
  blockers: [...new Set(blockers)]
65
79
  };
66
80
  await appendWorktreeManifest(allocation);
81
+ if (writeProofEvents)
82
+ await appendParallelRuntimeEvent(eventRoot, input.missionId, {
83
+ event_type: 'worktree_allocation_completed',
84
+ slot_id: allocation.slot_id,
85
+ generation_index: allocation.generation_index,
86
+ session_id: null,
87
+ pid: null,
88
+ backend: 'git-worktree',
89
+ placement: 'unknown',
90
+ worktree_id: `${allocation.slot_id}-gen-${allocation.generation_index}`,
91
+ meta: {
92
+ ok: allocation.ok,
93
+ worktree_path: allocation.worktree_path,
94
+ branch: allocation.branch,
95
+ blockers: allocation.blockers
96
+ }
97
+ }).catch(() => undefined);
67
98
  return allocation;
68
99
  }
100
+ export async function allocateWorkerWorktreesBatch(input) {
101
+ const maxParallel = Math.max(1, Math.floor(Number(input.maxParallel || 1)));
102
+ const queue = uniqueWorktreeAllocationInputs(input.workers);
103
+ const allocations = [];
104
+ const workers = Array.from({ length: Math.min(maxParallel, queue.length) }, async () => {
105
+ while (queue.length) {
106
+ const next = queue.shift();
107
+ if (!next)
108
+ continue;
109
+ allocations.push(await allocateWorkerWorktree({
110
+ repoRoot: input.root,
111
+ missionId: input.missionId,
112
+ workerId: next.workerId,
113
+ ...(next.slotId === undefined ? {} : { slotId: next.slotId }),
114
+ ...(next.generationIndex === undefined ? {} : { generationIndex: next.generationIndex }),
115
+ ...(next.baseRef === undefined ? {} : { baseRef: next.baseRef }),
116
+ ...(next.branchPrefix === undefined ? {} : { branchPrefix: next.branchPrefix })
117
+ }));
118
+ }
119
+ });
120
+ await Promise.all(workers);
121
+ return allocations;
122
+ }
123
+ function uniqueWorktreeAllocationInputs(workers = []) {
124
+ const seen = new Set();
125
+ const unique = [];
126
+ for (const worker of workers) {
127
+ const workerId = sanitizePathPart(worker.workerId || 'worker');
128
+ const slotId = sanitizePathPart(worker.slotId || workerId);
129
+ const generationIndex = Math.max(1, Math.floor(Number(worker.generationIndex || 1)));
130
+ const key = `${workerId}:${slotId}:${generationIndex}`;
131
+ if (seen.has(key))
132
+ continue;
133
+ seen.add(key);
134
+ unique.push({ ...worker, workerId, slotId, generationIndex });
135
+ }
136
+ return unique;
137
+ }
69
138
  async function appendWorktreeManifest(allocation) {
70
139
  const current = await readJson(allocation.manifest_path, null).catch(() => null);
71
140
  const allocations = Array.isArray(current?.allocations) ? current.allocations : [];
@@ -84,6 +153,17 @@ async function appendWorktreeManifest(allocation) {
84
153
  };
85
154
  await writeJsonAtomic(allocation.manifest_path, manifest);
86
155
  }
156
+ async function shouldWriteWorktreeAllocationProof(root, missionId) {
157
+ if (process.env.SKS_GIT_WORKTREE_ALLOCATION_PROOF === '0')
158
+ return false;
159
+ try {
160
+ const stat = await fsp.stat(path.join(root, '.sneakoscope', 'missions', missionId, 'agents'));
161
+ return stat.isDirectory();
162
+ }
163
+ catch {
164
+ return false;
165
+ }
166
+ }
87
167
  function sanitizeBranchPart(value) {
88
168
  return sanitizePathPart(value).replace(/\./g, '-').slice(0, 48) || 'item';
89
169
  }
@@ -1,4 +1,5 @@
1
1
  import { nowIso } from '../fsx.js';
2
+ import { allocateWorkerWorktreesBatch as allocateBatch } from './git-worktree-manager.js';
2
3
  export function planGitWorktreePool(input) {
3
4
  const reusable = [...(input.reusableWorktrees || [])];
4
5
  const assignments = input.workerIds.map((workerId) => {
@@ -20,4 +21,7 @@ export function planGitWorktreePool(input) {
20
21
  blockers: []
21
22
  };
22
23
  }
24
+ export async function allocateWorkerWorktreesBatch(input) {
25
+ return allocateBatch(input);
26
+ }
23
27
  //# sourceMappingURL=git-worktree-pool.js.map
@@ -0,0 +1,116 @@
1
+ import path from 'node:path';
2
+ import { appendJsonlBounded, nowIso, readJson, writeJsonAtomic } from '../fsx.js';
3
+ import { findLatestMission, missionDir } from '../mission.js';
4
+ export const MAD_DB_CAPABILITY_SCHEMA = 'sks.mad-db-capability.v1';
5
+ export const MAD_DB_CAPABILITY_FILE = 'mad-db-capability.json';
6
+ export const MAD_DB_ACK = 'I AUTHORIZE ONE-CYCLE DB BREAK-GLASS';
7
+ export const MAD_DB_MAX_TTL_MS = 2 * 60 * 60 * 1000;
8
+ export async function createMadDbCapability(root, input) {
9
+ if (input.ack !== MAD_DB_ACK)
10
+ throw new Error('mad_db_ack_phrase_mismatch');
11
+ const createdAt = nowIso();
12
+ const ttlMs = Math.min(MAD_DB_MAX_TTL_MS, Math.max(1, Math.floor(Number(input.ttlMs || MAD_DB_MAX_TTL_MS))));
13
+ const capability = {
14
+ schema: MAD_DB_CAPABILITY_SCHEMA,
15
+ mission_id: input.missionId,
16
+ cycle_id: input.cycleId || `mad-db-${Date.now().toString(36)}`,
17
+ enabled: true,
18
+ created_at: createdAt,
19
+ expires_at: new Date(Date.now() + ttlMs).toISOString(),
20
+ one_cycle_only: true,
21
+ priority: 'highest',
22
+ scope: 'all_database_mutations',
23
+ operator_ack: {
24
+ phrase: MAD_DB_ACK,
25
+ accepted_at: createdAt,
26
+ cwd: path.resolve(input.cwd || process.cwd())
27
+ },
28
+ consumed: false,
29
+ consumed_at: null,
30
+ consumed_by: null,
31
+ max_operations: Math.max(1, Math.floor(Number(process.env.SKS_MAD_DB_MAX_OPERATIONS || 20))),
32
+ operation_count: 0
33
+ };
34
+ const dir = missionDir(root, input.missionId);
35
+ await writeJsonAtomic(path.join(dir, MAD_DB_CAPABILITY_FILE), capability);
36
+ await appendJsonlBounded(path.join(dir, 'mad-db-ledger.jsonl'), { ts: nowIso(), type: 'capability.created', mission_id: capability.mission_id, cycle_id: capability.cycle_id, expires_at: capability.expires_at });
37
+ return capability;
38
+ }
39
+ export async function readMadDbCapability(root, missionId) {
40
+ const capability = await readJson(path.join(missionDir(root, missionId), MAD_DB_CAPABILITY_FILE), null);
41
+ return capability?.schema === MAD_DB_CAPABILITY_SCHEMA ? capability : null;
42
+ }
43
+ export async function resolveMadDbMissionId(root, state = {}, explicitMissionId = null) {
44
+ if (explicitMissionId && explicitMissionId !== 'latest')
45
+ return explicitMissionId;
46
+ if (state?.mission_id)
47
+ return String(state.mission_id);
48
+ return findLatestMission(root);
49
+ }
50
+ export function isMadDbCapabilityActive(capability, nowMs = Date.now()) {
51
+ if (!capability)
52
+ return false;
53
+ const expires = Date.parse(capability.expires_at || '');
54
+ return capability.enabled === true
55
+ && capability.consumed !== true
56
+ && capability.one_cycle_only === true
57
+ && Number(capability.operation_count || 0) < Number(capability.max_operations || 20)
58
+ && Number.isFinite(expires)
59
+ && expires > nowMs;
60
+ }
61
+ export async function recordMadDbOperation(root, missionId, input = {}) {
62
+ const capability = await readMadDbCapability(root, missionId);
63
+ if (!isMadDbCapabilityActive(capability))
64
+ return capability;
65
+ const operationCount = Number(capability.operation_count || 0) + 1;
66
+ const maxOperations = Math.max(1, Number(capability.max_operations || 20));
67
+ const updated = {
68
+ ...capability,
69
+ operation_count: operationCount,
70
+ max_operations: maxOperations
71
+ };
72
+ const dir = missionDir(root, missionId);
73
+ await writeJsonAtomic(path.join(dir, MAD_DB_CAPABILITY_FILE), updated);
74
+ await appendJsonlBounded(path.join(dir, 'mad-db-ledger.jsonl'), {
75
+ ts: nowIso(),
76
+ type: 'db_operation.counted',
77
+ mission_id: missionId,
78
+ cycle_id: updated.cycle_id,
79
+ operation_id: input.operationId || null,
80
+ tool_name: input.toolName || null,
81
+ sql_hash: input.sqlHash || null,
82
+ operation_count: operationCount,
83
+ max_operations: maxOperations
84
+ });
85
+ if (operationCount >= maxOperations) {
86
+ return consumeMadDbCapability(root, missionId, { consumedBy: 'db-safety-checkDbOperation', reason: 'mad_db_max_operations_reached' });
87
+ }
88
+ return updated;
89
+ }
90
+ export async function consumeMadDbCapability(root, missionId, input = {}) {
91
+ const capability = await readMadDbCapability(root, missionId);
92
+ if (!isMadDbCapabilityActive(capability))
93
+ return capability;
94
+ const consumed = {
95
+ ...capability,
96
+ consumed: true,
97
+ consumed_at: nowIso(),
98
+ consumed_by: input.consumedBy || input.reason || 'db-safety-policy-resolver'
99
+ };
100
+ const dir = missionDir(root, missionId);
101
+ await writeJsonAtomic(path.join(dir, MAD_DB_CAPABILITY_FILE), consumed);
102
+ await writeJsonAtomic(path.join(dir, 'mad-db-capability.consumed.json'), consumed);
103
+ await appendJsonlBounded(path.join(dir, 'mad-db-ledger.jsonl'), { ts: nowIso(), type: 'capability.consumed', mission_id: missionId, cycle_id: consumed.cycle_id, consumed_by: consumed.consumed_by });
104
+ return consumed;
105
+ }
106
+ export async function revokeMadDbCapability(root, missionId, reason = 'operator_revoked') {
107
+ const capability = await readMadDbCapability(root, missionId);
108
+ if (!capability)
109
+ return null;
110
+ const revoked = { ...capability, enabled: false, revoked_at: nowIso(), revoke_reason: reason };
111
+ const dir = missionDir(root, missionId);
112
+ await writeJsonAtomic(path.join(dir, MAD_DB_CAPABILITY_FILE), revoked);
113
+ await appendJsonlBounded(path.join(dir, 'mad-db-ledger.jsonl'), { ts: nowIso(), type: 'capability.revoked', mission_id: missionId, cycle_id: capability.cycle_id, reason });
114
+ return revoked;
115
+ }
116
+ //# sourceMappingURL=mad-db-capability.js.map
@@ -0,0 +1,31 @@
1
+ import path from 'node:path';
2
+ import { appendJsonlBounded, nowIso, writeJsonAtomic } from '../fsx.js';
3
+ import { missionDir } from '../mission.js';
4
+ export const MAD_DB_LEDGER_EVENT_SCHEMA = 'sks.mad-db-ledger-event.v1';
5
+ export async function appendMadDbLedgerEvent(root, missionId, event) {
6
+ const row = {
7
+ schema: MAD_DB_LEDGER_EVENT_SCHEMA,
8
+ ts: nowIso(),
9
+ mission_id: missionId,
10
+ ...event
11
+ };
12
+ const dir = missionDir(root, missionId);
13
+ await appendJsonlBounded(path.join(dir, 'mad-db-ledger.jsonl'), row);
14
+ await writeJsonAtomic(path.join(dir, 'mad-db-ledger.latest.json'), row).catch(() => undefined);
15
+ return row;
16
+ }
17
+ export async function appendMadDbOperationLifecycle(root, missionId, input) {
18
+ return appendMadDbLedgerEvent(root, missionId, {
19
+ type: input.type,
20
+ operation_id: input.operationId,
21
+ cycle_id: input.cycleId || null,
22
+ mcp_server: input.mcpServer || null,
23
+ tool_name: input.toolName || null,
24
+ sql_hash: input.sqlHash || null,
25
+ destructive: input.destructive === true,
26
+ result_status: input.resultStatus || 'unknown_pending_tool_result',
27
+ row_count: input.rowCount ?? null,
28
+ error: input.error || null
29
+ });
30
+ }
31
+ //# sourceMappingURL=mad-db-ledger.js.map
@@ -0,0 +1,48 @@
1
+ import { readMadDbCapability, isMadDbCapabilityActive } from './mad-db-capability.js';
2
+ export const MAD_DB_POLICY_DECISION_SCHEMA = 'sks.mad-db-policy-decision.v1';
3
+ export async function resolveMadDbMutationPolicy(root, state = {}, classification = {}) {
4
+ const missionId = state?.mission_id ? String(state.mission_id) : null;
5
+ if (!missionId)
6
+ return inactive('mission_id_missing');
7
+ const capability = await readMadDbCapability(root, missionId);
8
+ if (!isMadDbCapabilityActive(capability))
9
+ return inactive(capability?.consumed ? 'mad_db_capability_consumed' : 'mad_db_capability_inactive');
10
+ if (!isDbMutationOrDbTool(classification))
11
+ return inactive('not_a_database_mutation');
12
+ return {
13
+ schema: MAD_DB_POLICY_DECISION_SCHEMA,
14
+ allowed: true,
15
+ action: 'allow',
16
+ mode: 'mad-db-break-glass',
17
+ priority: 0,
18
+ priority_order: ['mad-db', 'mad-sks', 'sealed-contract', 'default-db-safety'],
19
+ reasons: ['mad_db_one_cycle_break_glass_capability_active'],
20
+ audit_required: true,
21
+ mission_id: missionId,
22
+ cycle_id: capability.cycle_id,
23
+ operation_count: capability.operation_count || 0,
24
+ max_operations: capability.max_operations || 20,
25
+ capability
26
+ };
27
+ }
28
+ function inactive(reason) {
29
+ return {
30
+ schema: MAD_DB_POLICY_DECISION_SCHEMA,
31
+ allowed: false,
32
+ action: 'defer',
33
+ mode: 'default-db-safety',
34
+ priority: 99,
35
+ reasons: [reason],
36
+ audit_required: false
37
+ };
38
+ }
39
+ function isDbMutationOrDbTool(classification = {}) {
40
+ if (classification.level === 'write' || classification.level === 'destructive')
41
+ return true;
42
+ if (classification.toolReasons?.includes?.('database_tool'))
43
+ return true;
44
+ if (classification.toolReasons?.includes?.('migration_apply_tool'))
45
+ return true;
46
+ return false;
47
+ }
48
+ //# sourceMappingURL=mad-db-policy-resolver.js.map
@@ -9,6 +9,7 @@ export function decideNarutoConcurrency(input = {}) {
9
9
  const hardware = probeHardwareCapacity(input.hardware || {});
10
10
  const zellijVisiblePaneCap = normalizePositiveInt(input.zellijVisiblePaneCap, Math.min(8, Math.max(4, Math.floor(hardware.terminal_rows / 5))));
11
11
  const backend = String(input.backend || 'codex-sdk');
12
+ const parallelismMode = normalizeParallelismMode(input.parallelismMode);
12
13
  const freeGb = hardware.free_memory_bytes / (1024 * 1024 * 1024);
13
14
  const totalGb = hardware.total_memory_bytes / (1024 * 1024 * 1024);
14
15
  const reclaimableFloorGb = totalGb >= 32 ? 16 : totalGb >= 16 ? 8 : totalGb >= 8 ? 4 : Math.max(1, freeGb);
@@ -33,7 +34,12 @@ export function decideNarutoConcurrency(input = {}) {
33
34
  const rawSafe = Math.max(1, Math.min(requestedClones, totalWorkItems, memoryCap, fdCap, cpuCap + ioCap, gitWorktreeCap + processCap, backendBudget, queueCap, leaseCap, 100));
34
35
  const pressure = monitorNarutoResourcePressure(hardware, { activeWorkers: rawSafe, zellijVisiblePaneCap });
35
36
  const backpressure = applyNarutoBackpressure(rawSafe, pressure);
36
- const safeActiveWorkers = Math.max(1, Math.min(rawSafe, backpressure.adjusted_active_workers));
37
+ const currentSafeActiveWorkers = Math.max(1, Math.min(rawSafe, backpressure.adjusted_active_workers));
38
+ const safeActiveWorkers = parallelismMode === 'extreme'
39
+ ? rawSafe
40
+ : parallelismMode === 'balanced'
41
+ ? Math.max(1, Math.min(rawSafe, Math.max(16, Math.floor(rawSafe * 0.75))))
42
+ : currentSafeActiveWorkers;
37
43
  const safeVisible = Math.min(safeActiveWorkers, zellijVisiblePaneCap);
38
44
  const reasons = [
39
45
  ...(memoryCap < requestedClones ? ['memory_cap'] : []),
@@ -60,11 +66,18 @@ export function decideNarutoConcurrency(input = {}) {
60
66
  git_worktree_parallel: gitWorktreeCap,
61
67
  cpu_io_parallel: cpuCap + ioCap,
62
68
  verification_parallel: Math.max(1, Math.min(hardware.cpu_core_count * 2, safeActiveWorkers, 16)),
69
+ parallelism_mode: parallelismMode,
63
70
  reasons: [...new Set(reasons)],
64
71
  backpressure: backpressure.backpressure,
65
72
  hardware
66
73
  };
67
74
  }
75
+ function normalizeParallelismMode(value) {
76
+ const text = String(value || process.env.SKS_NARUTO_PARALLELISM || 'extreme').toLowerCase();
77
+ if (text === 'safe' || text === 'balanced' || text === 'extreme')
78
+ return text;
79
+ return 'extreme';
80
+ }
68
81
  function normalizePositiveInt(value, fallback) {
69
82
  const parsed = Number(value);
70
83
  if (!Number.isFinite(parsed) || parsed < 1)
@@ -39,7 +39,7 @@ function ambientGoalContinuation() {
39
39
  mode: 'ambient_codex_native_goal_overlay',
40
40
  native_slash_command: '/goal',
41
41
  non_disruptive: true,
42
- rule: 'Use Codex native goal persistence when available to keep work resumable until completion; it never replaces the selected SKS route, Team, TriWiki, verification, reflection, or Honest Mode gates.'
42
+ rule: 'Use Codex native goal persistence when available to keep work resumable until completion; it never replaces the selected SKS route, Naruto, TriWiki, verification, reflection, or Honest Mode gates.'
43
43
  };
44
44
  }
45
45
  const REFLECTION_ARTIFACT = 'reflection.md';
@@ -279,7 +279,7 @@ function selectPipelineLane(route, task, proof) {
279
279
  if (LIGHTWEIGHT_ROUTES.has(route?.id))
280
280
  return { lane: `${String(route.id).toLowerCase()}_lightweight_lane`, source: 'route_policy', fast_lane_allowed: true, reason: 'Lightweight route bypasses full mission orchestration by design.', blockers: [], skip_when_fast: SPEED_LANE_POLICY.skip_when_fast, keep: ['focused_implementation', 'listed_verification', 'honest_mode'] };
281
281
  if (routeRequiresSubagents(route, task))
282
- return { lane: SPEED_LANE_POLICY.full_lane, source: 'route_policy', fast_lane_allowed: false, reason: 'No Proof Field attached and this route normally requires full Team evidence.', blockers: ['proof_field_not_attached'], skip_when_fast: [], keep: SPEED_LANE_POLICY.always_keep };
282
+ return { lane: SPEED_LANE_POLICY.full_lane, source: 'route_policy', fast_lane_allowed: false, reason: 'No Proof Field attached and this route normally requires full Naruto evidence.', blockers: ['proof_field_not_attached'], skip_when_fast: [], keep: SPEED_LANE_POLICY.always_keep };
283
283
  return { lane: SPEED_LANE_POLICY.balanced_lane, source: 'route_policy', fast_lane_allowed: false, reason: 'Balanced parent-owned route until Proof Field proves a narrower lane.', blockers: ['proof_field_not_attached'], skip_when_fast: [], keep: SPEED_LANE_POLICY.always_keep };
284
284
  }
285
285
  function buildPipelineStages(route, task, ambiguity, lane, context7Required, agentPolicy = normalizeAgentPolicy(route, task, {})) {
@@ -343,8 +343,11 @@ function planNextActions(route, task, ambiguity, lane, agentPolicy = normalizeAg
343
343
  const actions = ['read pipeline-plan.json before work', 'execute kept stages only', 'run listed verification'];
344
344
  if (agentPolicy.required)
345
345
  actions.splice(1, 0, 'run sks agents run latest --json before implementation');
346
- if (!lane.fast_lane_allowed && routeRequiresSubagents(route, task))
347
- actions.splice(1, 0, 'materialize full Team artifacts before implementation');
346
+ if (!lane.fast_lane_allowed && routeRequiresSubagents(route, task)) {
347
+ actions.splice(1, 0, route?.id === 'Naruto'
348
+ ? 'materialize Naruto clone roster, work graph, worker proof, and naruto-gate.json before implementation'
349
+ : 'materialize full Team artifacts before implementation');
350
+ }
348
351
  if (looksLikeProblemSolvingRequest(task))
349
352
  actions.splice(1, 0, 'run Solution Scout web search for similar fixes before editing');
350
353
  actions.push('refresh/validate TriWiki when required', 'finish with completion summary and Honest Mode');
@@ -372,10 +375,10 @@ export function promptPipelineContext(prompt, route = null) {
372
375
  'Ambient Goal continuation: even without an explicit $Goal keyword, use Codex native /goal persistence when it helps keep long work resumable and complete; do not let it replace or skip the selected SKS route gates.',
373
376
  'Route contract: execution routes infer contract answers from the prompt, TriWiki/current-code defaults, and conservative SKS policy. DFix and Answer bypass stateful execution because they do not start implementation.',
374
377
  'Plan-first interaction: when ambiguity questions are truly required, show the user only the missing human decision(s), then seal the decision contract internally and execute/verify.',
375
- 'Question-shaped directive policy: before using Answer, decide whether a question is a real information request or an implicit instruction/complaint about broken behavior. Rhetorical bug reports, mandatory-policy statements, and "why is this not happening?" execution complaints must route to Team, not Answer.',
378
+ 'Question-shaped directive policy: before using Answer, decide whether a question is a real information request or an implicit instruction/complaint about broken behavior. Rhetorical bug reports, mandatory-policy statements, and "why is this not happening?" execution complaints must route to Naruto, not Answer.',
376
379
  'Best-practice prompt shape: extract Goal, Context, Constraints, and Done-when before implementation; keep questions compact and only ask for answers that can change scope, safety, user-facing behavior, or acceptance criteria.',
377
380
  chatCaptureIntakeText(),
378
- 'Default execution routing: general implementation/code-changing prompts promote to Team so the normal path is parallel analysis, TriWiki refresh, debate/consensus, then fresh parallel executors. Answer, DFix, Help, Wiki maintenance, and safety-specific routes are intentional exceptions.',
381
+ 'Default execution routing: general implementation/code-changing prompts promote to Naruto so the normal path is shadow-clone fan-out, hardware-safe concurrency, patch envelopes, verification DAG, and GPT final arbitration. Answer, DFix, Help, Wiki maintenance, and safety-specific routes are intentional exceptions.',
379
382
  'Stance: infer the user intent aggressively from rough wording, local context, TriWiki, and conservative defaults; do not surface prequestion sheets before work.',
380
383
  subagentExecutionPolicyText(route, cleanPrompt),
381
384
  solutionScoutPolicyText(cleanPrompt),
@@ -397,8 +400,10 @@ export function promptPipelineContext(prompt, route = null) {
397
400
  ];
398
401
  if (reflectionRequiredForRoute(route))
399
402
  lines.push(reflectionInstructionText());
403
+ if (route?.id === 'Naruto')
404
+ lines.push(`Naruto route: build clone roster, massive work graph, hardware-safe governor, active pool, allocation/rebalance policy, parallel verification DAG, GPT final pack, per-clone proof, session cleanup, reflection, and Honest Mode. $Team is deprecated for new execution missions.`);
400
405
  if (route?.id === 'Team')
401
- lines.push(`Team route: agents, TriWiki refresh, debate, consensus, runtime graph compile with concrete task ids and worker inboxes, close planning agents, fresh executors, minimum ${MIN_TEAM_REVIEWER_LANES}-lane review/integration, ${TEAM_SESSION_CLEANUP_ARTIFACT}, reflection, and Honest Mode. ${MIN_TEAM_REVIEW_POLICY_TEXT}`);
406
+ lines.push(`Team route is a deprecated compatibility surface; use $Naruto for new execution missions. Existing Team mission observation commands remain available.`);
402
407
  if (route?.id === 'Goal')
403
408
  lines.push('Goal route: write SKS goal bridge artifacts, then use Codex native /goal persistence for create, pause, resume, and clear continuation controls.');
404
409
  if (route?.id === 'PPT')
@@ -473,8 +478,10 @@ export async function prepareRoute(root, prompt, state = {}) {
473
478
  const nativeSessionsRequired = routeRequiresSubagents(route, cleanPrompt);
474
479
  if (QUESTION_GATE_ROUTES.has(route.id) || route.id === 'MadSKS')
475
480
  return withSkillDreamContext(await prepareClarificationGate(root, route, task, required, { madSksAuthorization }), dreamContext);
481
+ if (route.id === 'Naruto')
482
+ return withSkillDreamContext(await prepareNaruto(root, route, task, required, { madSksAuthorization }), dreamContext);
476
483
  if (route.id === 'Team')
477
- return withSkillDreamContext(await prepareTeam(root, route, task, required, { madSksAuthorization }), dreamContext);
484
+ return withSkillDreamContext(await prepareNaruto(root, { ...route, id: 'Naruto', command: '$Naruto', mode: 'NARUTO', stopGate: 'naruto-gate.json', requiredSkills: ['naruto', 'pipeline-runner', 'prompt-pipeline', 'honest-mode'] }, task, required, { madSksAuthorization, teamAlias: true }), dreamContext);
478
485
  if (route.id === 'Research')
479
486
  return withSkillDreamContext(await prepareResearch(root, route, task, required), dreamContext);
480
487
  if (route.id === 'AutoResearch')
@@ -626,6 +633,10 @@ export async function activeRouteContext(root, state) {
626
633
  const roles = state.role_counts ? ` Role counts: ${formatRoleCounts(state.role_counts)}.` : '';
627
634
  return `Active Team mission ${state.mission_id || 'latest'} must keep the user-visible live transcript updated. Native session budget: ${state.agent_sessions || MIN_TEAM_REVIEWER_LANES}.${roles} Run native sessions, TriWiki refresh, debate, consensus, fresh development, minimum ${MIN_TEAM_REVIEWER_LANES}-lane review/integration, then close or account for every Team native session and write ${TEAM_SESSION_CLEANUP_ARTIFACT} before reflection/final. ${MIN_TEAM_REVIEW_POLICY_TEXT} After each native-session status/result/handoff, run: sks team event ${state.mission_id || 'latest'} --agent <name> --phase <phase> --message "...". Inspect with sks team log/watch ${state.mission_id || 'latest'}.${reasoningNote}${context7}${planNote}`;
628
635
  }
636
+ if (state.mode === 'NARUTO') {
637
+ const clones = state.clone_count ? ` Clone count: ${state.clone_count}.` : '';
638
+ return `Active Naruto mission ${state.mission_id || 'latest'} must keep clone/worker evidence current.${clones} Use sks naruto status ${state.mission_id || 'latest'} --json, inspect .sneakoscope/missions/${state.mission_id || 'latest'}/naruto-gate.json and agents/agent-proof-evidence.json, then continue until the Naruto gate passes or a hard blocker is recorded.${reasoningNote}${planNote}`;
639
+ }
629
640
  if (state.subagents_required && !(await hasSubagentEvidence(root, state))) {
630
641
  return `Active SKS route ${id} requires native multi-session evidence before code-changing work can be considered complete. Run worker/reviewer native sessions for disjoint write scopes, or record explicit unavailable/unsplittable native-session evidence before editing.${reasoningNote}${planNote}`;
631
642
  }
@@ -1069,6 +1080,61 @@ async function prepareLightRoute(root, route, task, required) {
1069
1080
  await setCurrent(root, routeState(id, route, 'ROUTE_CONTEXT_READY', required, { prompt: task, stop_gate: 'none', pipeline_plan_ready: validatePipelinePlan(pipelinePlan).ok, pipeline_plan_path: PIPELINE_PLAN_ARTIFACT }));
1070
1081
  return routeContext(route, id, task, required, 'Load the route skill context, execute the smallest matching action, and finish with Honest Mode.');
1071
1082
  }
1083
+ async function prepareNaruto(root, route, task, required, opts = {}) {
1084
+ const cleanTask = stripDollarCommand(task) || String(task || '').trim();
1085
+ const { id, dir } = await createMission(root, { mode: 'naruto', prompt: cleanTask });
1086
+ const routeContextPayload = {
1087
+ route: 'Naruto',
1088
+ command: '$Naruto',
1089
+ mode: 'NARUTO',
1090
+ task: cleanTask,
1091
+ required_skills: route.requiredSkills || ['naruto', 'pipeline-runner', 'prompt-pipeline', 'honest-mode'],
1092
+ context7_required: required,
1093
+ context_tracking: triwikiContextTracking(),
1094
+ stop_gate: 'naruto-gate.json',
1095
+ team_alias: opts.teamAlias === true,
1096
+ mad_sks_authorization: Boolean(opts.madSksAuthorization)
1097
+ };
1098
+ await writeJsonAtomic(path.join(dir, 'route-context.json'), routeContextPayload);
1099
+ await writeJsonAtomic(path.join(dir, 'naruto-gate.json'), {
1100
+ schema: 'sks.naruto-gate.v1',
1101
+ passed: false,
1102
+ mission_id: id,
1103
+ clone_roster_built: false,
1104
+ work_graph_ready: false,
1105
+ role_distribution_ready: false,
1106
+ allocation_ready: false,
1107
+ rebalance_ready: false,
1108
+ concurrency_governor_ready: false,
1109
+ active_pool_simulated: false,
1110
+ verification_dag_ready: false,
1111
+ gpt_final_pack_ready: false,
1112
+ zellij_dashboard_ready: false,
1113
+ native_agent_proof: false,
1114
+ final_arbiter_accepted: false,
1115
+ session_cleanup: false,
1116
+ blockers: ['naruto_run_not_started'],
1117
+ updated_at: nowIso()
1118
+ });
1119
+ const pipelinePlan = await writePipelinePlan(dir, { missionId: id, route, task: cleanTask, required, ambiguity: { required: false, status: opts.teamAlias ? 'team_alias_to_naruto' : 'direct_naruto' } });
1120
+ await setCurrent(root, routeState(id, route, 'NARUTO_READY', required, {
1121
+ prompt: cleanTask,
1122
+ route: 'Naruto',
1123
+ route_command: '$Naruto',
1124
+ mode: 'NARUTO',
1125
+ implementation_allowed: true,
1126
+ ambiguity_gate_required: false,
1127
+ ambiguity_gate_passed: true,
1128
+ stop_gate: 'naruto-gate.json',
1129
+ required_skills: routeContextPayload.required_skills,
1130
+ subagents_required: true,
1131
+ native_sessions_required: true,
1132
+ naruto_gate_file: 'naruto-gate.json',
1133
+ pipeline_plan_ready: validatePipelinePlan(pipelinePlan).ok,
1134
+ pipeline_plan_path: PIPELINE_PLAN_ARTIFACT
1135
+ }));
1136
+ return routeContext(route, id, cleanTask, required, `Run sks naruto run ${JSON.stringify(cleanTask)} --json (or continue with Codex native workers for the same mission), then update naruto-gate.json from the worker proof and verification DAG.`);
1137
+ }
1072
1138
  function routeState(id, route, phase, context7Required, extra = {}) {
1073
1139
  const reasoning = routeReasoning(route, extra.prompt || '');
1074
1140
  const nativeSessionsRequired = routeRequiresSubagents(route, extra.prompt || '');
@@ -371,6 +371,24 @@ function missingRequiredGateFields(file, state, gate = {}) {
371
371
  return required
372
372
  .filter((key) => gate[key] !== true);
373
373
  }
374
+ if (file === 'naruto-gate.json' || mode === 'NARUTO') {
375
+ const required = [
376
+ 'clone_roster_built',
377
+ 'work_graph_ready',
378
+ 'role_distribution_ready',
379
+ 'allocation_ready',
380
+ 'rebalance_ready',
381
+ 'concurrency_governor_ready',
382
+ 'active_pool_simulated',
383
+ 'verification_dag_ready',
384
+ 'gpt_final_pack_ready',
385
+ 'zellij_dashboard_ready',
386
+ 'native_agent_proof',
387
+ 'final_arbiter_accepted',
388
+ 'session_cleanup'
389
+ ];
390
+ return required.filter((key) => gate[key] !== true);
391
+ }
374
392
  if (file === 'qa-gate.json' || mode === 'QALOOP') {
375
393
  const required = ['clarification_contract_sealed', 'qa_report_written', 'qa_ledger_complete', 'checklist_completed', 'safety_reviewed', 'deployed_destructive_tests_blocked', 'credentials_not_persisted', 'honest_mode_complete'];
376
394
  if (gate.ui_e2e_required === true)
@@ -405,6 +423,8 @@ async function missingRequiredGateArtifacts(root, file, state, gate = {}) {
405
423
  }
406
424
  if (file === IMAGE_UX_REVIEW_GATE_ARTIFACT || mode === 'IMAGE_UX_REVIEW')
407
425
  return missingImageUxReviewArtifacts(root, state, gate);
426
+ if (file === 'naruto-gate.json' || mode === 'NARUTO')
427
+ return missingNarutoArtifacts(root, state, gate);
408
428
  if (file !== 'team-gate.json' && mode !== 'TEAM')
409
429
  return [];
410
430
  const missing = [];
@@ -611,6 +631,8 @@ function gateFilesForState(state) {
611
631
  return ['goal-workflow.json'];
612
632
  if (state.mode === 'RESEARCH')
613
633
  return ['research-gate.json', 'research-gate.evaluated.json'];
634
+ if (state.mode === 'NARUTO')
635
+ return ['naruto-gate.json'];
614
636
  if (state.mode === 'TEAM')
615
637
  return ['team-gate.json'];
616
638
  if (state.mode === 'AUTORESEARCH')
@@ -627,6 +649,28 @@ function gateFilesForState(state) {
627
649
  return [IMAGE_UX_REVIEW_GATE_ARTIFACT];
628
650
  return ['done-gate.json'];
629
651
  }
652
+ async function missingNarutoArtifacts(root, state = {}, gate = {}) {
653
+ const id = state?.mission_id;
654
+ if (!id)
655
+ return ['mission_id'];
656
+ const dir = missionDir(root, id);
657
+ const required = [
658
+ 'naruto-gate.json',
659
+ 'agents/naruto-work-graph.json',
660
+ 'agents/naruto-role-distribution.json',
661
+ 'agents/naruto-concurrency-governor.json',
662
+ 'agents/naruto-verification-dag.json',
663
+ 'agents/naruto-gpt-final-pack.json'
664
+ ];
665
+ const missing = [];
666
+ for (const file of required) {
667
+ if (!(await exists(path.join(dir, file))))
668
+ missing.push(file);
669
+ }
670
+ if (gate.native_agent_proof === true && !(await exists(path.join(dir, 'agents', 'agent-proof-evidence.json'))))
671
+ missing.push('agents/agent-proof-evidence.json');
672
+ return missing;
673
+ }
630
674
  function extractLastMessage(payload) {
631
675
  return payload.last_assistant_message || payload.assistant_message || payload.message || payload.response || payload.raw || '';
632
676
  }
@@ -1,7 +1,7 @@
1
1
  import { containsPlaintextSecret } from '../secret-redaction.js';
2
2
  import { readRouteProof } from './proof-reader.js';
3
3
  import { validateCompletionProof } from './validation.js';
4
- import { proofStatusBlocks, routeRequiresCompletionProof, routeRequiresImageVoxelAnchors } from './route-proof-policy.js';
4
+ import { normalizeProofRoute, proofStatusBlocks, routeRequiresCompletionProof, routeRequiresImageVoxelAnchors } from './route-proof-policy.js';
5
5
  import { routeRequiresAgentIntake } from '../agents/agent-plan.js';
6
6
  export async function validateRouteCompletionProof(root, { missionId = null, route = null, state = {}, visualClaim = undefined } = {}) {
7
7
  const proofRequired = state.proof_required === true || routeRequiresCompletionProof(route);
@@ -34,11 +34,13 @@ export async function validateRouteCompletionProof(root, { missionId = null, rou
34
34
  else {
35
35
  if (agents.status !== 'passed' || agents.ok !== true)
36
36
  issues.push('agent_gate_not_passed');
37
+ const normalizedRoute = normalizeProofRoute(route || proof.route);
38
+ const maxAgentCount = normalizedRoute === '$Naruto' ? 100 : 20;
37
39
  const agentCount = Number(agents.agent_count || 0);
38
40
  if (agentCount < 5)
39
41
  issues.push('agent_count_below_5');
40
- if (agentCount > 20)
41
- issues.push('agent_count_above_20');
42
+ if (agentCount > maxAgentCount)
43
+ issues.push(`agent_count_above_${maxAgentCount}`);
42
44
  if (agents.all_sessions_closed !== true)
43
45
  issues.push('agent_sessions_not_closed');
44
46
  if (agents.no_overlap_ok !== true)
@@ -1,5 +1,8 @@
1
1
  export const SERIOUS_ROUTE_ALIASES = Object.freeze([
2
2
  '$Team',
3
+ '$Naruto',
4
+ '$ShadowClone',
5
+ '$Kagebunshin',
3
6
  '$DFix',
4
7
  '$QA-LOOP',
5
8
  '$Research',
@@ -35,7 +38,12 @@ export const VISUAL_ROUTE_ALIASES = Object.freeze([
35
38
  '$GX'
36
39
  ]);
37
40
  const ROUTE_NORMALIZATION = Object.freeze({
38
- team: '$Team',
41
+ team: '$Naruto',
42
+ naruto: '$Naruto',
43
+ shadowclone: '$Naruto',
44
+ 'shadow-clone': '$Naruto',
45
+ kagebunshin: '$Naruto',
46
+ 'kage-bunshin': '$Naruto',
39
47
  dfix: '$DFix',
40
48
  qaloop: '$QA-LOOP',
41
49
  'qa-loop': '$QA-LOOP',