sneakoscope 6.0.3 → 6.1.2

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 (378) hide show
  1. package/README.md +29 -12
  2. package/config/codex-releases/{rust-v0.142.0.json → rust-v0.144.1.json} +6 -6
  3. package/crates/sks-core/Cargo.lock +1 -1
  4. package/crates/sks-core/Cargo.toml +1 -1
  5. package/dist/bin/fast-inline.js +18 -14
  6. package/dist/bin/sks-dispatch.js +2 -4
  7. package/dist/cli/args.js +2 -0
  8. package/dist/cli/command-manifest-lite.js +2 -3
  9. package/dist/cli/command-registry.js +3 -4
  10. package/dist/cli/help-fast.js +1 -1
  11. package/dist/cli/install-helpers.js +348 -763
  12. package/dist/cli/install-tool-helpers.js +287 -0
  13. package/dist/cli/router.js +91 -6
  14. package/dist/commands/codex-lb.js +188 -53
  15. package/dist/commands/codex.js +44 -5
  16. package/dist/commands/doctor.js +302 -46
  17. package/dist/commands/tmux.js +5 -1
  18. package/dist/commands/versioning.js +7 -0
  19. package/dist/commands/zellij-monitor-pane.js +2 -0
  20. package/dist/commands/zellij-viewport-pane.js +3 -1
  21. package/dist/commands/zellij.js +1 -1
  22. package/dist/config/skills-manifest.json +59 -59
  23. package/dist/core/agent-bridge/agent-manifest.js +48 -0
  24. package/dist/core/agents/agent-central-ledger.js +9 -0
  25. package/dist/core/agents/agent-cleanup-executor.js +334 -41
  26. package/dist/core/agents/agent-cleanup.js +20 -1
  27. package/dist/core/agents/agent-command-surface.js +3 -1
  28. package/dist/core/agents/agent-effort-policy.js +30 -38
  29. package/dist/core/agents/agent-janitor.js +9 -10
  30. package/dist/core/agents/agent-namespace-safety.js +56 -0
  31. package/dist/core/agents/agent-orchestrator.js +25 -3
  32. package/dist/core/agents/agent-output-validator.js +1 -1
  33. package/dist/core/agents/agent-plan.js +100 -21
  34. package/dist/core/agents/agent-role-config.js +43 -49
  35. package/dist/core/agents/agent-runner-codex-exec.js +18 -3
  36. package/dist/core/agents/agent-runner-process.js +1 -0
  37. package/dist/core/agents/agent-schema.js +3 -2
  38. package/dist/core/agents/fast-mode-policy.js +3 -5
  39. package/dist/core/agents/native-cli-session-swarm.js +1 -1
  40. package/dist/core/agents/native-worker-backend-router.js +2 -1
  41. package/dist/core/agents/work-partition/repo-inventory.js +68 -7
  42. package/dist/core/agents/zellij-right-lane-cockpit.js +2 -2
  43. package/dist/core/code-structure.js +5 -4
  44. package/dist/core/codex/agent-config-file-repair.js +94 -193
  45. package/dist/core/codex/codex-cli-update.js +723 -0
  46. package/dist/core/codex/codex-config-guard.js +38 -11
  47. package/dist/core/codex/codex-project-config-policy.js +3 -6
  48. package/dist/core/codex/codex-startup-config-postcheck.js +52 -42
  49. package/dist/core/codex-adapter.js +35 -22
  50. package/dist/core/codex-app/codex-agent-role-sync.js +13 -54
  51. package/dist/core/codex-app/codex-app-fast-ui-repair.js +51 -20
  52. package/dist/core/codex-app/codex-app-launcher.js +48 -17
  53. package/dist/core/codex-app/codex-app-restart.js +23 -2
  54. package/dist/core/codex-app/codex-app-ui-state-snapshot.js +11 -3
  55. package/dist/core/codex-app/sks-menubar.js +136 -5
  56. package/dist/core/codex-app.js +35 -14
  57. package/dist/core/codex-compat/codex-hook-warning-detector.js +10 -1
  58. package/dist/core/codex-compat/codex-release-manifest.js +6 -6
  59. package/dist/core/codex-control/codex-0139-doctor-real-probe.js +7 -1
  60. package/dist/core/codex-control/codex-0139-image-path-real-probe.js +29 -12
  61. package/dist/core/codex-control/codex-0139-probe-runner.js +103 -28
  62. package/dist/core/codex-control/codex-0139-real-probe-summary.js +7 -3
  63. package/dist/core/codex-control/codex-0139-real-probes.js +21 -6
  64. package/dist/core/codex-control/codex-0139-sandbox-real-probe.js +39 -13
  65. package/dist/core/codex-control/codex-0139-web-search-probe.js +28 -14
  66. package/dist/core/codex-control/{codex-0142-capability.js → codex-0144-capability.js} +22 -22
  67. package/dist/core/codex-control/codex-0144-collab-agent-real-probe.js +63 -0
  68. package/dist/core/codex-control/codex-lb-launch-recovery.js +278 -0
  69. package/dist/core/codex-control/codex-multi-agent-event-normalizer.js +5 -1
  70. package/dist/core/codex-control/codex-reliability-shield.js +93 -30
  71. package/dist/core/codex-control/codex-sdk-adapter.js +96 -13
  72. package/dist/core/codex-control/codex-sdk-config-policy.js +2 -1
  73. package/dist/core/codex-control/codex-sdk-sandbox-policy.js +6 -3
  74. package/dist/core/codex-control/codex-task-runner.js +62 -9
  75. package/dist/core/codex-control/python-codex-sdk-adapter.js +30 -3
  76. package/dist/core/codex-exec-output-schema.js +35 -6
  77. package/dist/core/codex-lb/codex-lb-env.js +30 -1
  78. package/dist/core/codex-lb/codex-lb-tool-catalog.js +478 -0
  79. package/dist/core/codex-lb/codex-lb-tool-output-recovery.js +291 -0
  80. package/dist/core/codex-native/codex-native-feature-broker.js +31 -38
  81. package/dist/core/codex-native/codex-native-feature-matrix.js +2 -2
  82. package/dist/core/codex-native/codex-native-repair-transaction.js +1 -1
  83. package/dist/core/codex-native/core-skill-manifest.js +8 -4
  84. package/dist/core/codex-native/native-capability-postcheck.js +16 -8
  85. package/dist/core/codex-native/native-capability-repair-matrix.js +76 -27
  86. package/dist/core/codex-plugins/codex-plugin-json.js +67 -21
  87. package/dist/core/codex-plugins/codex-plugin-repair.js +118 -0
  88. package/dist/core/codex-runtime/codex-desktop-config-policy.js +305 -0
  89. package/dist/core/commands/agent-bridge-command.js +23 -2
  90. package/dist/core/commands/agent-command.js +38 -5
  91. package/dist/core/commands/basic-cli.js +77 -30
  92. package/dist/core/commands/command-utils.js +1 -1
  93. package/dist/core/commands/gc-command.js +27 -4
  94. package/dist/core/commands/image-ux-review-command.js +55 -24
  95. package/dist/core/commands/mad-sks-command.js +182 -137
  96. package/dist/core/commands/naruto-command.js +643 -1153
  97. package/dist/core/commands/pipeline-command.js +1 -0
  98. package/dist/core/commands/research-command.js +293 -231
  99. package/dist/core/commands/run-command.js +100 -23
  100. package/dist/core/commands/team-command.js +2 -3
  101. package/dist/core/commands/team-legacy-observe-command.js +94 -359
  102. package/dist/core/commands/wiki-command.js +179 -83
  103. package/dist/core/computer-use-live-evidence.js +166 -3
  104. package/dist/core/computer-use-status.js +5 -2
  105. package/dist/core/daemon/sksd-hook-daemon-entrypoint.js +2 -2
  106. package/dist/core/daemon/sksd-hook-daemon.js +171 -28
  107. package/dist/core/daemon/sksd-hook-dispatch.js +2 -2
  108. package/dist/core/db-safety.js +2 -2
  109. package/dist/core/decision-lattice.js +6 -6
  110. package/dist/core/dfix/verification-selector.js +6 -4
  111. package/dist/core/doctor/browser-use-repair.js +54 -13
  112. package/dist/core/doctor/codex-0139-doctor.js +3 -2
  113. package/dist/core/doctor/codex-startup-config-repair.js +8 -3
  114. package/dist/core/doctor/computer-use-repair.js +28 -39
  115. package/dist/core/doctor/doctor-codex-startup-repair.js +24 -149
  116. package/dist/core/doctor/doctor-context7-repair.js +1 -1
  117. package/dist/core/doctor/doctor-dirty-planner.js +1 -1
  118. package/dist/core/doctor/doctor-native-capability-repair.js +74 -3
  119. package/dist/core/doctor/imagegen-repair.js +47 -12
  120. package/dist/core/doctor/legacy-global-hook-cleanup.js +179 -0
  121. package/dist/core/feature-fixture-executor.js +71 -7
  122. package/dist/core/feature-fixture-runner.js +53 -12
  123. package/dist/core/feature-fixtures.js +47 -14
  124. package/dist/core/feature-registry.js +53 -58
  125. package/dist/core/fsx.js +54 -6
  126. package/dist/core/harness-conflicts.js +19 -10
  127. package/dist/core/hooks-runtime/code-pack-freshness-preflight.js +5 -4
  128. package/dist/core/hooks-runtime/hook-invocation-dedupe.js +147 -0
  129. package/dist/core/hooks-runtime/hook-io.js +14 -4
  130. package/dist/core/hooks-runtime/light-turn.js +70 -0
  131. package/dist/core/hooks-runtime/payload-signals.js +270 -0
  132. package/dist/core/hooks-runtime/team-digest.js +0 -1
  133. package/dist/core/hooks-runtime/tool-output-quarantine.js +93 -0
  134. package/dist/core/hooks-runtime.js +418 -250
  135. package/dist/core/image/image-artifact-path-contract.js +8 -6
  136. package/dist/core/image/image-artifact-registry.js +5 -1
  137. package/dist/core/image-ux-review/imagegen-adapter.js +5 -2
  138. package/dist/core/imagegen/imagegen-capability.js +10 -13
  139. package/dist/core/imagegen/require-imagegen.js +37 -11
  140. package/dist/core/init/skills.js +16 -30
  141. package/dist/core/init.js +144 -36
  142. package/dist/core/managed-assets/managed-assets-manifest.js +417 -14
  143. package/dist/core/mission.js +24 -1
  144. package/dist/core/naruto/naruto-work-graph.js +70 -4
  145. package/dist/core/ops/reporting.js +3 -0
  146. package/dist/core/pipeline-internals/runtime-core.js +578 -180
  147. package/dist/core/pipeline-internals/runtime-gates.js +191 -49
  148. package/dist/core/ppt/style-tokens.js +1 -1
  149. package/dist/core/ppt-review/index.js +1 -1
  150. package/dist/core/ppt-review/slide-exporter.js +23 -17
  151. package/dist/core/ppt-review/slide-imagegen-review.js +1 -1
  152. package/dist/core/ppt-review/slide-issue-extraction.js +4 -2
  153. package/dist/core/preflight/parallel-preflight-engine.js +50 -1
  154. package/dist/core/product-design-plugin.js +2 -2
  155. package/dist/core/proof/route-finalizer.js +1 -1
  156. package/dist/core/proof/route-proof-gate.js +7 -2
  157. package/dist/core/proof-field.js +3 -3
  158. package/dist/core/provider/model-router.js +38 -32
  159. package/dist/core/recallpulse/policy.js +12 -28
  160. package/dist/core/recallpulse.js +11 -6
  161. package/dist/core/release/gate-manifest.js +18 -12
  162. package/dist/core/release/gate-pack-manifest.js +1 -1
  163. package/dist/core/release/npm-pack-proof.js +247 -0
  164. package/dist/core/release/package-dist-snapshot.js +151 -0
  165. package/dist/core/release/package-size-budget.js +5 -0
  166. package/dist/core/release/release-authorization-snapshot.js +115 -0
  167. package/dist/core/release/release-gate-affected-selector.js +15 -3
  168. package/dist/core/release/release-gate-cache-v2.js +30 -0
  169. package/dist/core/release/release-gate-contract.js +161 -0
  170. package/dist/core/release/release-gate-dag.js +44 -3
  171. package/dist/core/release/release-gate-hermetic-env.js +28 -17
  172. package/dist/core/release/release-real-contract.js +496 -0
  173. package/dist/core/release-parallel-full-coverage.js +31 -143
  174. package/dist/core/research/claim-evidence-matrix.js +41 -6
  175. package/dist/core/research/experiment-plan.js +14 -10
  176. package/dist/core/research/falsification.js +9 -2
  177. package/dist/core/research/implementation-blueprint-densifier.js +82 -60
  178. package/dist/core/research/implementation-blueprint.js +32 -26
  179. package/dist/core/research/mock-result.js +122 -11
  180. package/dist/core/research/replication-pack.js +15 -8
  181. package/dist/core/research/research-adversarial-review.js +1068 -0
  182. package/dist/core/research/research-claim-builder.js +69 -17
  183. package/dist/core/research/research-claim-synthesizer.js +343 -0
  184. package/dist/core/research/research-cycle-runner.js +53 -3
  185. package/dist/core/research/research-falsification-runner.js +176 -0
  186. package/dist/core/research/research-final-reviewer.js +44 -125
  187. package/dist/core/research/research-realistic-report.js +14 -6
  188. package/dist/core/research/research-review-artifact-digest.js +66 -0
  189. package/dist/core/research/research-source-evidence.js +144 -0
  190. package/dist/core/research/research-source-layer-catalog.js +68 -0
  191. package/dist/core/research/research-source-ledger-merge.js +250 -12
  192. package/dist/core/research/research-source-shards.js +26 -70
  193. package/dist/core/research/research-stage-runner.js +237 -247
  194. package/dist/core/research/research-super-search.js +184 -0
  195. package/dist/core/research/research-synthesis-prompt.js +20 -1
  196. package/dist/core/research/research-synthesis-writer.js +86 -5
  197. package/dist/core/research/research-work-graph.js +25 -18
  198. package/dist/core/research/source-quality-report.js +21 -0
  199. package/dist/core/research.js +429 -280
  200. package/dist/core/retention/retention-budget.js +25 -6
  201. package/dist/core/retention.js +980 -101
  202. package/dist/core/routes/constants.js +1 -1
  203. package/dist/core/routes/dollar-manifest-lite.js +11 -11
  204. package/dist/core/routes/evidence.js +4 -4
  205. package/dist/core/routes/ppt-policy.js +1 -1
  206. package/dist/core/routes.js +92 -64
  207. package/dist/core/runtime/task-profile.js +66 -0
  208. package/dist/core/runtime/verification-budget.js +12 -0
  209. package/dist/core/secret-redaction.js +4 -0
  210. package/dist/core/security/high-risk-contracts.js +6 -6
  211. package/dist/core/stop-gate/stop-gate-check.js +49 -12
  212. package/dist/core/subagents/agent-catalog.js +215 -0
  213. package/dist/core/subagents/model-policy.js +118 -0
  214. package/dist/core/subagents/naruto-help-contract.js +40 -0
  215. package/dist/core/subagents/official-subagent-config.js +488 -0
  216. package/dist/core/subagents/official-subagent-preparation.js +251 -0
  217. package/dist/core/subagents/official-subagent-prompt.js +137 -0
  218. package/dist/core/subagents/official-subagent-runner.js +129 -0
  219. package/dist/core/subagents/subagent-evidence.js +663 -0
  220. package/dist/core/subagents/terminology.js +16 -0
  221. package/dist/core/subagents/thread-budget.js +21 -0
  222. package/dist/core/subagents/triwiki-attention.js +65 -0
  223. package/dist/core/super-search/runtime-helpers.js +173 -19
  224. package/dist/core/super-search/runtime.js +140 -15
  225. package/dist/core/super-search/source-records.js +49 -8
  226. package/dist/core/team-review-policy.js +15 -0
  227. package/dist/core/triwiki/code-pack.js +8 -2
  228. package/dist/core/triwiki/triwiki-cache-key.js +108 -29
  229. package/dist/core/triwiki/triwiki-module-card.js +1 -1
  230. package/dist/core/triwiki-attention.js +13 -6
  231. package/dist/core/triwiki-provenance.js +274 -0
  232. package/dist/core/triwiki-runtime.js +21 -7
  233. package/dist/core/triwiki-wrongness/wrongness-ledger.js +187 -61
  234. package/dist/core/triwiki-wrongness/wrongness-retrieval.js +11 -2
  235. package/dist/core/triwiki-wrongness/wrongness-trust-policy.js +2 -0
  236. package/dist/core/update-check.js +23 -15
  237. package/dist/core/version-manager.js +51 -1
  238. package/dist/core/version.js +1 -1
  239. package/dist/core/wiki-coordinate.js +128 -12
  240. package/dist/core/work-order-ledger.js +208 -10
  241. package/dist/core/zellij/zellij-command.js +12 -1
  242. package/dist/core/zellij/zellij-dashboard-pane.js +3 -3
  243. package/dist/core/zellij/zellij-fake-adapter.js +3 -1
  244. package/dist/core/zellij/zellij-launcher.js +51 -21
  245. package/dist/core/zellij/zellij-layout-builder.js +14 -5
  246. package/dist/core/zellij/zellij-official-subagent-activity.js +477 -0
  247. package/dist/core/zellij/zellij-official-subagent-telemetry.js +264 -0
  248. package/dist/core/zellij/zellij-pane-proof.js +32 -6
  249. package/dist/core/zellij/zellij-slot-pane-renderer.js +17 -5
  250. package/dist/core/zellij/zellij-slot-telemetry.js +15 -3
  251. package/dist/core/zellij/zellij-ui-mode.js +1 -1
  252. package/dist/core/zellij/zellij-viewport-binder.js +3 -0
  253. package/dist/core/zellij/zellij-worker-pane-manager.js +5 -3
  254. package/dist/scripts/agent-fast-mode-default-check.js +48 -29
  255. package/dist/scripts/agent-role-config-repair-check.js +34 -15
  256. package/dist/scripts/agent-wiki-context-proof-check.js +16 -2
  257. package/dist/scripts/all-feature-deep-completion-check.js +14 -4
  258. package/dist/scripts/architecture-guard-check.js +8 -1
  259. package/dist/scripts/build-dist.js +17 -5
  260. package/dist/scripts/canonical-test-runner.js +188 -0
  261. package/dist/scripts/check-command-module-budget.js +38 -16
  262. package/dist/scripts/check-legacy-free.js +1 -1
  263. package/dist/scripts/check-route-modularity.js +0 -1
  264. package/dist/scripts/check-ts-contracts.js +1 -1
  265. package/dist/scripts/codex-0139-interrupt-agent-check.js +5 -1
  266. package/dist/scripts/{codex-0142-app-server-v2-check.js → codex-0144-app-server-v2-check.js} +11 -10
  267. package/dist/scripts/{codex-0142-binary-identity-check.js → codex-0144-binary-identity-check.js} +4 -4
  268. package/dist/scripts/codex-0144-capability-check.js +21 -0
  269. package/dist/scripts/{codex-0139-real-probes-check.js → codex-0144-core-real-probes-check.js} +19 -5
  270. package/dist/scripts/{codex-0142-doctor-wiring-check.js → codex-0144-doctor-wiring-check.js} +6 -6
  271. package/dist/scripts/{codex-0142-manifest-check.js → codex-0144-manifest-check.js} +11 -3
  272. package/dist/scripts/{codex-0142-policy-check.js → codex-0144-policy-check.js} +2 -2
  273. package/dist/scripts/{codex-0142-thread-store-check.js → codex-0144-thread-store-check.js} +3 -3
  274. package/dist/scripts/codex-app-provider-model-ui-check.js +53 -19
  275. package/dist/scripts/codex-app-ui-preservation-check.js +35 -4
  276. package/dist/scripts/codex-control-all-pipelines-check.js +7 -3
  277. package/dist/scripts/codex-control-side-effect-scope-check.js +2 -2
  278. package/dist/scripts/codex-control-tool-output-continuity-audit-check.js +27 -0
  279. package/dist/scripts/codex-effort-auto-discovery-check.js +1 -1
  280. package/dist/scripts/codex-lb-fast-mode-truth-check.js +1 -0
  281. package/dist/scripts/{codex-lb-gpt55-fast-profile-check.js → codex-lb-gpt56-fast-profile-check.js} +56 -5
  282. package/dist/scripts/codex-model-metadata-check.js +1 -1
  283. package/dist/scripts/codex-native-agent-role-content-check.js +15 -7
  284. package/dist/scripts/codex-native-repair-transaction-check.js +3 -1
  285. package/dist/scripts/codex-sdk-all-pipelines-check.js +7 -4
  286. package/dist/scripts/codex-sdk-research-pipeline-check.js +30 -8
  287. package/dist/scripts/codex-sdk-sandbox-policy-check.js +5 -1
  288. package/dist/scripts/codex-sdk-version-compat-check.js +2 -1
  289. package/dist/scripts/db-route-materialization-check.js +33 -0
  290. package/dist/scripts/dfix-fixture-check.js +1 -1
  291. package/dist/scripts/docs-truthfulness-check.js +4 -2
  292. package/dist/scripts/doctor-codex-startup-repair-check.js +47 -25
  293. package/dist/scripts/doctor-context7-repair-check.js +2 -1
  294. package/dist/scripts/doctor-fix-production-blackbox.js +12 -2
  295. package/dist/scripts/doctor-fixes-codex-app-fast-ui-check.js +34 -7
  296. package/dist/scripts/doctor-imagegen-repair-check.js +14 -4
  297. package/dist/scripts/doctor-startup-config-repair-blackbox.js +9 -3
  298. package/dist/scripts/doctor-startup-config-repair-check.js +13 -3
  299. package/dist/scripts/install-update-preserves-config-check.js +7 -2
  300. package/dist/scripts/legacy-gate-inventory-check.js +7 -5
  301. package/dist/scripts/legacy-strong-inventory-check.js +7 -5
  302. package/dist/scripts/legacy-upgrade-matrix-check.js +4 -4
  303. package/dist/scripts/lib/native-cli-session-swarm-check-lib.js +173 -13
  304. package/dist/scripts/mad-sks-app-ui-no-mutation-check.js +165 -6
  305. package/dist/scripts/managed-role-manifest-parity-check.js +5 -4
  306. package/dist/scripts/mutation-callsite-coverage-check.js +0 -11
  307. package/dist/scripts/naruto-codex-e2e-check.js +14 -7
  308. package/dist/scripts/naruto-shadow-clone-swarm-check.js +4 -201
  309. package/dist/scripts/npm-publish-performance-check.js +20 -12
  310. package/dist/scripts/official-subagent-workflow-check.js +145 -0
  311. package/dist/scripts/package-published-contract-check.js +6 -20
  312. package/dist/scripts/packlist-performance-check.js +17 -3
  313. package/dist/scripts/parallel-verification-engine-check.js +2 -2
  314. package/dist/scripts/postinstall-safe-side-effects-check.js +8 -3
  315. package/dist/scripts/ppt-no-mock-as-real-check.js +3 -1
  316. package/dist/scripts/prepublish-release-check-or-fast.js +23 -86
  317. package/dist/scripts/product-design-plugin-routing-check.js +1 -1
  318. package/dist/scripts/release-affected-selector-check.js +74 -1
  319. package/dist/scripts/release-check-stamp.js +324 -239
  320. package/dist/scripts/release-dag-full-coverage-check.js +7 -15
  321. package/dist/scripts/release-dynamic-presets-check.js +10 -1
  322. package/dist/scripts/release-gate-dag-runner-check.js +3 -3
  323. package/dist/scripts/release-gate-dag-runner.js +35 -11
  324. package/dist/scripts/release-gate-existence-audit.js +1 -2
  325. package/dist/scripts/release-gate-script-parity-check.js +1 -1
  326. package/dist/scripts/release-parallel-full-coverage-check.js +12 -6
  327. package/dist/scripts/release-parallel-speed-budget-check.js +18 -2
  328. package/dist/scripts/release-real-check.js +390 -157
  329. package/dist/scripts/release-registry-check.js +61 -16
  330. package/dist/scripts/release-runtime-truth-matrix-check.js +22 -0
  331. package/dist/scripts/research-blueprint-densifier-check.js +2 -2
  332. package/dist/scripts/research-real-cycle-no-legacy-final-md-check.js +11 -7
  333. package/dist/scripts/route-proof-artifact-structure-check.js +1 -0
  334. package/dist/scripts/search-visibility-gate-lib.js +1 -1
  335. package/dist/scripts/seo-geo-route-identity-check.js +30 -4
  336. package/dist/scripts/sizecheck.js +4 -4
  337. package/dist/scripts/sks-1-11-gate-lib.js +53 -6
  338. package/dist/scripts/sks-3-1-4-directive-check-lib.js +8 -2
  339. package/dist/scripts/sks-3-1-5-directive-check-lib.js +3 -2
  340. package/dist/scripts/sks-3-1-6-directive-check-lib.js +5 -3
  341. package/dist/scripts/sks-menubar-install-check.js +8 -0
  342. package/dist/scripts/sks-uninstall-regression-check.js +1 -1
  343. package/dist/scripts/sksd-daemon-check.js +16 -6
  344. package/dist/scripts/trust-fixture-check.js +32 -10
  345. package/dist/scripts/write-build-manifest.js +2 -1
  346. package/dist/scripts/wrongness-fixture-check.js +1 -1
  347. package/dist/scripts/zellij-layout-valid-check.js +36 -11
  348. package/dist/scripts/zellij-pane-proof-check.js +33 -2
  349. package/dist/scripts/zellij-real-session-cleanup-check.js +122 -2
  350. package/dist/scripts/zellij-real-session-launch-check.js +76 -5
  351. package/dist/scripts/zellij-slot-pane-renderer-check.js +4 -4
  352. package/dist/scripts/zellij-spawn-on-demand-layout-check.js +3 -3
  353. package/docs/demo.tape +1 -1
  354. package/infra-harness-gates.json +1486 -0
  355. package/package.json +32 -19
  356. package/release-gates.v2.json +4060 -0
  357. package/runtime-required-scripts.json +9 -0
  358. package/schemas/codex/{app-server-0.142 → app-server-0.144}/codex_app_server_protocol.v2.schemas.json +1146 -781
  359. package/schemas/codex/codex-0139-real-probe-result.schema.json +39 -5
  360. package/schemas/codex/ppt-slide-issue-ledger.schema.json +2 -1
  361. package/dist/commands/db.js +0 -6
  362. package/dist/core/codex-control/codex-0139-multi-agent-real-probe.js +0 -107
  363. package/dist/core/commands/db-command.js +0 -146
  364. package/dist/core/research/prompt.js +0 -15
  365. package/dist/scripts/agent-native-release-gate.js +0 -274
  366. package/dist/scripts/codex-0142-capability-check.js +0 -21
  367. package/dist/scripts/codex-control-tool-call-sequence-repair-check.js +0 -14
  368. package/dist/scripts/command-performance-scorecard-check.js +0 -204
  369. package/dist/scripts/config-managed-merge-callsite-coverage-check.js +0 -212
  370. package/dist/scripts/dollar-performance-scorecard-check.js +0 -257
  371. package/dist/scripts/gate-timing-check.js +0 -16
  372. package/dist/scripts/ops-maturity-scorecard-check.js +0 -12
  373. package/dist/scripts/performance-baseline-check.js +0 -12
  374. package/dist/scripts/performance-improvement-report-check.js +0 -58
  375. package/dist/scripts/release-parallel-check.js +0 -389
  376. package/dist/scripts/release-runner-efficiency-check.js +0 -15
  377. package/dist/scripts/retention-long-run-smoke-check.js +0 -299
  378. package/docs/assets/sneakoscope-architecture-pipeline.jpg +0 -0
@@ -2,8 +2,7 @@ import path from 'node:path';
2
2
  import { appendJsonlBounded, nowIso, readJson, readText, writeJsonAtomic, writeTextAtomic, exists } from './fsx.js';
3
3
  import { OUTCOME_RUBRIC } from './proof-field.js';
4
4
  import { RESEARCH_AGENT_PERSONA_CONTRACT, validateResearchAgentPersonas } from './recallpulse.js';
5
- import { appendAgentLedgerEvent, initializeAgentCentralLedger } from './agents/agent-central-ledger.js';
6
- import { CLAIM_EVIDENCE_MATRIX_ARTIFACT, buildClaimEvidenceMatrixFromLedgers, defaultClaimEvidenceMatrix, readClaimEvidenceMatrix, validateClaimEvidenceMatrix, writeClaimEvidenceMatrix } from './research/claim-evidence-matrix.js';
5
+ import { CLAIM_EVIDENCE_MATRIX_ARTIFACT, defaultClaimEvidenceMatrix, readClaimEvidenceMatrix, validateClaimEvidenceMatrix, writeClaimEvidenceMatrix } from './research/claim-evidence-matrix.js';
7
6
  import { EXPERIMENT_PLAN_JSON_ARTIFACT, EXPERIMENT_PLAN_MARKDOWN_ARTIFACT, defaultExperimentPlan, readExperimentPlan, validateExperimentPlan, writeExperimentPlan } from './research/experiment-plan.js';
8
7
  import { IMPLEMENTATION_BLUEPRINT_ARTIFACT, defaultImplementationBlueprint, readImplementationBlueprint, validateImplementationBlueprint, writeImplementationBlueprint } from './research/implementation-blueprint.js';
9
8
  import { IMPLEMENTATION_BLUEPRINT_MARKDOWN_ARTIFACT, renderImplementationBlueprintMarkdown } from './research/implementation-blueprint-markdown.js';
@@ -15,11 +14,22 @@ import { analyzeResearchReportQuality, countWords } from './research/research-re
15
14
  import { validateFalsificationCoverage } from './research/falsification.js';
16
15
  import { writeResearchHandoffArtifacts } from './research/research-handoff.js';
17
16
  import { RESEARCH_WORK_GRAPH_ARTIFACT, writeResearchWorkGraph } from './research/research-work-graph.js';
17
+ import { buildResearchReviewArtifactDigest, validateResearchReviewArtifactDigest } from './research/research-review-artifact-digest.js';
18
+ import { RESEARCH_SOURCE_LAYER_IDS, RESEARCH_SOURCE_LAYERS } from './research/research-source-layer-catalog.js';
19
+ import { eligibleResearchSourceIdSet } from './research/research-source-evidence.js';
18
20
  import { resolveCodexAppExecutionProfile } from './codex-app/codex-app-execution-profile.js';
19
21
  import { resolveCodexNativeInvocationPlan } from './codex-native/codex-native-invocation-router.js';
22
+ import { SUBAGENT_EVIDENCE_FILENAME, SUBAGENT_PARENT_SUMMARY_FILENAME, buildSubagentEvidence, normalizeSubagentParentSummary, readSubagentEvents } from './subagents/subagent-evidence.js';
23
+ export { RESEARCH_SOURCE_LAYER_IDS, RESEARCH_SOURCE_LAYERS } from './research/research-source-layer-catalog.js';
20
24
  export const RESEARCH_PAPER_ARTIFACT = 'research-paper.md';
21
25
  export const RESEARCH_SOURCE_SKILL_ARTIFACT = 'research-source-skill.md';
22
26
  export const RESEARCH_GENIUS_SUMMARY_ARTIFACT = 'genius-opinion-summary.md';
27
+ export const RESEARCH_REVIEWER_CUSTOM_AGENT = 'research_reviewer';
28
+ export const RESEARCH_REVIEWER_CONFIG_ARTIFACT = '.codex/agents/research-reviewer.toml';
29
+ const RESEARCH_ADVERSARIAL_REVIEW_LEDGER_ARTIFACT = 'research-adversarial-review.json';
30
+ const RESEARCH_ADVERSARIAL_CONVERGENCE_ARTIFACT = 'research-adversarial-convergence.json';
31
+ const RESEARCH_ADVERSARIAL_REVISION_LEDGER_ARTIFACT = 'research-revision-ledger.json';
32
+ const RESEARCH_HONEST_MODE_CANONICAL_ARTIFACT = 'research-honest-mode.json';
23
33
  export const RESEARCH_PAPER_SECTION_GROUPS = Object.freeze([
24
34
  ['abstract'],
25
35
  ['introduction'],
@@ -83,167 +93,51 @@ export const RESEARCH_AGENT_COUNCIL = Object.freeze(RESEARCH_AGENT_PERSONA_CONTR
83
93
  function validateResearchAgentLedger(agentLedger = {}, geniusSummaryText = '') {
84
94
  return validateResearchAgentPersonas({ ...agentLedger, agents: agentLedger.agents || [] }, geniusSummaryText);
85
95
  }
86
- export const RESEARCH_SOURCE_LAYERS = Object.freeze([
87
- {
88
- id: 'academic_literature',
89
- label: 'Academic literature',
90
- purpose: 'Find recent papers, preprints, formal reviews, citations, and open scholarly metadata before synthesis.',
91
- evidence_role: 'formal_evidence',
92
- examples: ['arXiv', 'Semantic Scholar', 'OpenAlex', 'Crossref', 'PubMed'],
93
- query_templates: ['"<topic>" arxiv', '"<topic>" site:semanticscholar.org', '"<topic>" OpenAlex Crossref PubMed']
94
- },
95
- {
96
- id: 'official_government_data',
97
- label: 'Official government and leading-institution knowledge',
98
- purpose: 'Ground claims in public datasets, policy papers, national statistics, and leading-country institutional sources.',
99
- evidence_role: 'authoritative_baseline',
100
- examples: ['World Bank', 'OECD', 'Eurostat', 'data.gov', 'data.gov.uk', 'NIST'],
101
- query_templates: ['"<topic>" site:worldbank.org OR site:oecd.org', '"<topic>" site:data.gov OR site:data.gov.uk', '"<topic>" site:nist.gov']
102
- },
103
- {
104
- id: 'standards_primary_docs',
105
- label: 'Standards and primary documents',
106
- purpose: 'Check primary specifications, standards, RFCs, policy originals, and official project documents before relying on summaries.',
107
- evidence_role: 'primary_source',
108
- examples: ['IETF RFCs', 'W3C', 'ISO abstracts', 'official standards bodies', 'project primary docs'],
109
- query_templates: ['"<topic>" RFC standard specification', '"<topic>" W3C IETF NIST standard', '"<topic>" official specification']
110
- },
111
- {
112
- id: 'news_current_events',
113
- label: 'Current news and global reporting',
114
- purpose: 'Capture recent events, public impact, and regional framing from reputable news and global news indices.',
115
- evidence_role: 'recency_signal',
116
- examples: ['GDELT', 'BBC', 'CNN', 'Reuters', 'AP', 'regional reputable outlets'],
117
- query_templates: ['"<topic>" BBC CNN latest', '"<topic>" GDELT news', '"<topic>" Reuters AP analysis']
118
- },
119
- {
120
- id: 'public_discourse',
121
- label: 'Public discourse',
122
- purpose: 'Sample public practitioner and community discourse without treating popularity as truth.',
123
- evidence_role: 'sentiment_and_edge_cases',
124
- examples: ['X/Twitter recent search', 'Reddit', 'Hacker News', 'public forums'],
125
- query_templates: ['"<topic>" site:x.com OR site:twitter.com', '"<topic>" site:reddit.com', '"<topic>" "Hacker News"']
126
- },
127
- {
128
- id: 'developer_practitioner',
129
- label: 'Developer and practitioner knowledge',
130
- purpose: 'Find implementation pitfalls, developer questions, bug reports, and operational lessons.',
131
- evidence_role: 'practice_feedback',
132
- examples: ['Stack Overflow', 'Stack Exchange', 'GitHub issues', 'release notes', 'engineering blogs'],
133
- query_templates: ['"<topic>" site:stackoverflow.com', '"<topic>" site:stackexchange.com', '"<topic>" site:github.com issues']
134
- },
135
- {
136
- id: 'counterevidence_factcheck',
137
- label: 'Counterevidence and fact-checking',
138
- purpose: 'Actively search for failures, critiques, null results, retractions, fact checks, and source conflicts.',
139
- evidence_role: 'falsification',
140
- examples: ['Google Fact Check Tools', 'Retraction Watch', 'critical reviews', 'benchmark failures', 'negative results'],
141
- query_templates: ['"<topic>" critique failure limitation', '"<topic>" fact check retraction', '"<topic>" counterevidence null result']
142
- }
143
- ]);
144
- export const RESEARCH_SOURCE_LAYER_IDS = Object.freeze(RESEARCH_SOURCE_LAYERS.map((layer) => layer.id));
145
- export const RESEARCH_NATIVE_AGENT_PERSONAS = Object.freeze([
146
- {
147
- id: 'research_source_miner',
148
- role: 'source_miner',
149
- label: 'Research Source Miner',
150
- replaces: 'legacy research intake runtime',
151
- read_only: true,
152
- mandate: 'Collect layered public sources, source quality notes, source blockers, and cross-layer triangulation inputs before synthesis.',
153
- outputs: [RESEARCH_SOURCE_SKILL_ARTIFACT, 'source-ledger.json']
154
- },
155
- {
156
- id: 'research_skeptic',
157
- role: 'skeptic',
158
- label: 'Research Skeptic',
159
- replaces: 'debate-ledger runtime',
160
- read_only: true,
161
- mandate: 'Attack the strongest claim with counterevidence, source-quality downgrades, missing controls, and falsification cases.',
162
- outputs: ['debate-ledger.json', 'falsification-ledger.json']
163
- },
164
- {
165
- id: 'research_synthesis',
166
- role: 'synthesis',
167
- label: 'Research Synthesis',
168
- replaces: 'manual paper/report assembly',
169
- read_only: true,
170
- mandate: 'Synthesize only cited, falsifiable claims that survived agent debate into the report and paper artifacts.',
171
- outputs: ['research-report.md']
172
- },
173
- {
174
- id: 'research_verifier',
175
- role: 'verifier',
176
- label: 'Research Verifier',
177
- replaces: 'unverified consensus closeout',
178
- read_only: true,
179
- mandate: 'Check source coverage, citation coverage, persona contract, claim support, falsification, and paper sections before proof.',
180
- outputs: ['research-gate.evaluated.json', 'research-gate.json']
181
- }
182
- ]);
183
96
  export function researchNativeAgentPlan(prompt = '', opts = {}) {
184
- const paperArtifact = opts.paperArtifact || RESEARCH_PAPER_ARTIFACT;
185
- const personas = RESEARCH_NATIVE_AGENT_PERSONAS.map((persona) => ({
186
- ...persona,
187
- session_id: opts.missionId ? `${opts.missionId}-${persona.id}` : `${persona.id}-session`,
188
- reasoning_effort: 'xhigh',
189
- service_tier: 'fast'
97
+ const personas = RESEARCH_AGENT_COUNCIL.map((persona) => ({
98
+ id: persona.id,
99
+ display_name: researchAgentAgentName(persona),
100
+ persona: persona.persona,
101
+ persona_boundary: persona.persona_boundary,
102
+ role: persona.role,
103
+ mandate: persona.mandate,
104
+ custom_agent: RESEARCH_REVIEWER_CUSTOM_AGENT,
105
+ model: 'gpt-5.6-sol',
106
+ reasoning_effort: 'max',
107
+ read_only: true
190
108
  }));
191
109
  const batches = [
192
110
  {
193
- id: 'research-source-mining-batch',
194
- cycle_phase: 'R2_SOURCE_SEARCH',
195
- agents: ['research_source_miner'],
196
- mode: 'native_agent_batch',
197
- read_only: true,
198
- outputs: [RESEARCH_SOURCE_SKILL_ARTIFACT, 'source-ledger.json']
199
- },
200
- {
201
- id: 'research-skeptic-falsification-batch',
202
- cycle_phase: 'R4_DEBATE_R5_FALSIFY',
203
- agents: ['research_skeptic'],
204
- mode: 'native_agent_batch',
205
- read_only: true,
206
- outputs: ['debate-ledger.json', 'falsification-ledger.json']
207
- },
208
- {
209
- id: 'research-synthesis-batch',
210
- cycle_phase: 'R6_APPLY_R7_PAPER',
211
- agents: ['research_synthesis'],
212
- mode: 'native_agent_batch',
213
- read_only: true,
214
- outputs: ['research-report.md', paperArtifact, 'novelty-ledger.json']
215
- },
216
- {
217
- id: 'research-verification-batch',
218
- cycle_phase: 'R8_VERIFY',
219
- agents: ['research_verifier'],
220
- mode: 'native_agent_batch',
111
+ id: 'research-official-adversarial-review',
112
+ cycle_phase: 'R8_ADVERSARIAL_REVIEW',
113
+ agents: personas.map((persona) => persona.id),
114
+ mode: 'official_codex_subagent',
221
115
  read_only: true,
222
- outputs: ['research-gate.evaluated.json', 'research-gate.json', RESEARCH_GENIUS_SUMMARY_ARTIFACT]
116
+ outputs: ['subagent-plan.json', 'subagent-events.jsonl', 'subagent-parent-summary.json', 'subagent-evidence.json', 'research-adversarial-convergence.json', RESEARCH_GENIUS_SUMMARY_ARTIFACT]
223
117
  }
224
118
  ];
225
119
  return {
226
- schema: 'sks.research-native-agent-plan.v1',
120
+ schema: 'sks.research-official-subagent-plan.v1',
227
121
  prompt,
228
- backend: 'native_multi_session_agent_kernel',
122
+ backend: 'official_codex_subagent',
229
123
  legacy_runtime: false,
230
124
  legacy_artifact_alias_policy: {
231
- 'agent-ledger.json': 'native research agent findings; not runtime proof from removed legacy infrastructure',
232
- 'debate-ledger.json': 'compatibility alias for native skeptical debate evidence; not old consensus runtime proof'
125
+ 'agent-ledger.json': 'compatibility projection from evidence-correlated official reviewer outcomes; not independent runtime proof',
126
+ 'debate-ledger.json': 'compatibility projection from official adversarial reviewer outcomes; not a custom debate scheduler'
233
127
  },
234
128
  session_count: personas.length,
235
129
  personas,
236
130
  batches,
237
131
  communication: {
238
- central_ledger: 'agents/agent-events.jsonl',
239
- messages: 'agents/agent-messages.jsonl',
240
- task_board: 'agents/agent-task-board.json',
241
- proof: 'agents/agent-proof-evidence.json'
132
+ plan: 'subagent-plan.json',
133
+ lifecycle: 'subagent-events.jsonl',
134
+ parent_summary: 'subagent-parent-summary.json',
135
+ proof: 'subagent-evidence.json'
242
136
  },
243
137
  autoresearch_cycle_policy: {
244
138
  uses_agent_batches: true,
245
139
  batch_template: batches.map((batch) => ({ id: batch.id, agents: batch.agents, outputs: batch.outputs })),
246
- rule: 'Every AutoResearch cycle runs source mining, skeptical falsification, synthesis, and verification as native agent batches before keep/discard.'
140
+ rule: 'Every AutoResearch synthesis is challenged by three distinct composite official reviewer threads; revisions are bounded and followed by a fresh full review cycle.'
247
141
  }
248
142
  };
249
143
  }
@@ -267,12 +161,17 @@ export function createResearchPlan(prompt, opts = {}) {
267
161
  prompt,
268
162
  depth,
269
163
  created_at: createdAt,
270
- methodology: opts.autoresearch ? 'native-agent-autoresearch-batch-frontier-loop' : 'native-agent-research-council-frontier-discovery-loop',
164
+ methodology: opts.autoresearch ? 'super-search-autoresearch-with-official-subagent-adversarial-convergence' : 'super-search-semantic-claims-with-official-subagent-adversarial-convergence',
271
165
  paper_artifact: paperArtifact,
272
166
  quality_contract: DEFAULT_RESEARCH_QUALITY_CONTRACT,
273
167
  native_agent_plan: nativeAgentPlan,
274
168
  codex_app_execution_profile: executionProfile ? compactExecutionProfile(executionProfile) : null,
275
169
  codex_native_invocation: codexNativeInvocation,
170
+ current_docs_policy: {
171
+ context7_required: opts.context7Required === true,
172
+ evidence_artifact: 'context7-evidence.jsonl',
173
+ rule: 'External library, SDK, API, MCP, package-manager, and generated-doc claims require resolve-library-id plus query-docs evidence before completion.'
174
+ },
276
175
  agent_sessions: nativeAgentPlan.personas,
277
176
  agent_batches: nativeAgentPlan.batches,
278
177
  autoresearch_cycle_policy: nativeAgentPlan.autoresearch_cycle_policy,
@@ -294,10 +193,10 @@ export function createResearchPlan(prompt, opts = {}) {
294
193
  },
295
194
  objective: 'Find the shortest useful mechanism that can be falsified or applied, grounded in maximum available source retrieval rather than broad summary.',
296
195
  execution_policy: {
297
- normal_run: 'real_long_running_research_until_unanimous_agent_consensus',
298
- default_cycle_timeout_minutes: 120,
299
- default_max_cycles: 12,
300
- safety_cap: 'Research repeats native agent source-mining, debate/falsification, synthesis, and verification batches until unanimous agent consensus or an explicit max-cycle safety cap pauses the run.',
196
+ normal_run: 'real_super_search_semantic_synthesis_and_official_subagent_review',
197
+ default_cycle_timeout_minutes: 20,
198
+ default_max_cycles: 3,
199
+ safety_cap: 'Research performs bounded source acquisition and up to three adversarial review/revision cycles. Any unresolved objection leaves the gate blocked.',
301
200
  mock_policy: '--mock is for selftests and dry harness checks only; normal Research must block rather than silently substitute mock output.'
302
201
  },
303
202
  outcome_rubric: OUTCOME_RUBRIC,
@@ -305,25 +204,27 @@ export function createResearchPlan(prompt, opts = {}) {
305
204
  mode: 'persona_inspired_agents_not_impersonation',
306
205
  policy: 'Use historical genius-inspired lenses as cognitive roles only. Do not claim to be, simulate private thoughts of, or speak as the real people.',
307
206
  effort_policy: {
308
- required_effort: 'xhigh',
309
- applies_to: 'every_research_agent_agent',
310
- rule: 'Every Research agent must run with xhigh reasoning effort; lower-effort agent findings cannot pass the research gate.'
207
+ custom_agent: RESEARCH_REVIEWER_CUSTOM_AGENT,
208
+ required_model: 'gpt-5.6-sol',
209
+ required_effort: 'max',
210
+ applies_to: 'every_official_adversarial_reviewer',
211
+ rule: 'Every adversarial reviewer uses the verified research_reviewer custom agent configuration with GPT-5.6 Sol Max. Bounded source extraction may use Luna Max; synthesis, falsification, and review use Sol Max.'
311
212
  },
312
213
  eureka_policy: {
313
214
  exclamation: 'Eureka!',
314
- rule: 'Every agent must record one literal Eureka! moment with a non-obvious idea before debate.'
215
+ rule: 'Every official reviewer must record one literal source-linked Eureka idea in its exact structured outcome.'
315
216
  },
316
217
  debate_policy: {
317
- mode: 'vigorous_evidence_bound_debate_until_unanimous_consensus',
318
- rule: 'Every agent must challenge at least one other agent or respond to a challenge before synthesis. The loop repeats until every agent records final agreement on the surviving mechanism or the safety cap pauses the run with an unpassed gate.'
218
+ mode: 'independent_adversarial_reviews_with_bounded_revision',
219
+ rule: 'Three distinct composite official reviewer threads independently attack the synthesized manuscript. Any objection triggers a bounded revision and a fresh full review; ambiguous lifecycle or outcomes fail closed.'
319
220
  },
320
221
  agents: RESEARCH_AGENT_COUNCIL,
321
222
  protocol: [
322
- 'Each agent drafts independent search queries and provisional findings before synthesis.',
323
- 'Each agent records effort=xhigh and one literal "Eureka!" idea before the council debate.',
324
- 'The council runs a vigorous evidence-bound debate where every agent challenges or responds.',
325
- 'The skeptic agent must run after the first four agents and attack the strongest surviving claim.',
326
- 'Synthesis may keep only claims with cited source-ledger ids, project evidence, or explicit hypothesis status.'
223
+ 'Super Search and semantic claim synthesis complete before the official reviewer threads start.',
224
+ 'Each official composite reviewer records one source-linked "Eureka!" idea, nonempty falsifiers, and a cheap decisive probe.',
225
+ 'Every reviewer attempts rejection independently; no reviewer lifecycle completion is treated as approval.',
226
+ 'Any critical, major, minor, or required revision prevents convergence and triggers a bounded revision when evidence integrity is intact.',
227
+ 'A fresh three-thread review must approve after every successful revision.'
327
228
  ]
328
229
  },
329
230
  web_research_policy: {
@@ -380,9 +281,9 @@ export function createResearchPlan(prompt, opts = {}) {
380
281
  'Do not modify code or project source files during Research. Research writes only route-local mission artifacts; implementation belongs to $Team or another execution route.',
381
282
  'Do not claim novelty without a novelty ledger entry.',
382
283
  'Separate facts, inferences, hypotheses, and speculations.',
383
- 'Run the genius-lens agent council independently before synthesis.',
384
- 'Every Research agent must run at reasoning_effort=xhigh, record one literal "Eureka!" idea, and participate in the debate.',
385
- 'The agent council must debate vigorously but stay evidence-bound; record challenges and responses in debate-ledger.json. Continue cycles until unanimous_consensus=true with every agent agreeing.',
284
+ 'Run three distinct evidence-correlated official composite reviewer subagent reviews after synthesis.',
285
+ 'Every reviewer must use the verified GPT-5.6 Sol Max research_reviewer policy, record one literal "Eureka!" idea, and return an exact structured outcome.',
286
+ 'Project official reviewer outcomes into debate-ledger.json for compatibility only; the canonical proof is the lifecycle-correlated adversarial review and convergence artifacts.',
386
287
  'Maximize safe web/source search as layered source retrieval and record queries, source layers, citations, quality notes, triangulation checks, and blockers in source-ledger.json.',
387
288
  `Create ${RESEARCH_SOURCE_SKILL_ARTIFACT} as a route-local source collection skill before synthesis; do not edit generated .agents/skills during the research run.`,
388
289
  'Actively seek disconfirming evidence before synthesis.',
@@ -396,8 +297,8 @@ export function createResearchPlan(prompt, opts = {}) {
396
297
  { id: 'R0_FRAME', goal: 'Frame the target outcome, constraints, and what would make the idea useful.' },
397
298
  { id: 'R1_SOURCE_SKILL', goal: `Create ${RESEARCH_SOURCE_SKILL_ARTIFACT} with layer-specific search routes, quality fields, and blockers before source gathering.` },
398
299
  { id: 'R2_SOURCE_SEARCH', goal: 'Run layered web/source retrieval across papers, official data, standards, news, public discourse, developer knowledge, and counterevidence.' },
399
- { id: 'R3_EUREKA', goal: 'Have each xhigh genius-lens agent shout Eureka! and record one non-obvious idea with source ids.' },
400
- { id: 'R4_DEBATE', goal: 'Run a vigorous evidence-bound council debate with every agent challenging or responding; repeat until unanimous agent consensus is recorded.' },
300
+ { id: 'R3_EUREKA', goal: 'Have each official Sol Max composite reviewer record one non-obvious source-linked Eureka idea without claiming historical-person identity or genius-level performance.' },
301
+ { id: 'R4_DEBATE', goal: 'Collect three independent composite adversarial reviewer outcomes, revise on any open objection, and require a fresh unanimous review before convergence.' },
401
302
  { id: 'R5_FALSIFY', goal: 'Attack each mechanism with counterexamples, missing evidence, source conflicts, and failure modes.' },
402
303
  { id: 'R6_APPLY', goal: 'Keep the smallest surviving mechanism, define a cheap probe, and write all ledgers.' },
403
304
  { id: 'R7_PAPER', goal: 'Convert the final research result into a concise paper manuscript with abstract, method, findings, limitations, and references.' },
@@ -441,7 +342,7 @@ export function researchPlanMarkdown(plan) {
441
342
  if (plan.execution_policy) {
442
343
  lines.push(`Execution: ${plan.execution_policy.normal_run}; default cycle timeout ${plan.execution_policy.default_cycle_timeout_minutes} minutes`);
443
344
  if (plan.execution_policy.default_max_cycles)
444
- lines.push(`Consensus loop: repeat until unanimous agent consensus; default safety cap ${plan.execution_policy.default_max_cycles} cycles`);
345
+ lines.push(`Adversarial review loop: run three independent official research_reviewer threads, revise on any objection, then run a fresh three-thread cycle; default safety cap ${plan.execution_policy.default_max_cycles} cycles`);
445
346
  lines.push(`Mock policy: ${plan.execution_policy.mock_policy}`);
446
347
  }
447
348
  if (plan.mutation_policy)
@@ -462,7 +363,7 @@ export function researchPlanMarkdown(plan) {
462
363
  lines.push('');
463
364
  }
464
365
  if (plan.native_agent_plan) {
465
- lines.push('## Native Agent Plan');
366
+ lines.push('## Official Subagent Review Plan');
466
367
  lines.push(`Backend: ${plan.native_agent_plan.backend}`);
467
368
  lines.push(`Sessions: ${plan.native_agent_plan.session_count}`);
468
369
  lines.push(`AutoResearch batches: ${plan.native_agent_plan.autoresearch_cycle_policy?.uses_agent_batches ? 'enabled' : 'disabled'}`);
@@ -523,7 +424,7 @@ export function researchSourceSkillMarkdown(plan) {
523
424
  lines.push('Real-run policy: collect live sources for as long as needed within the mission timeout; mock or fixture evidence is valid only for explicit --mock selftests.');
524
425
  lines.push('');
525
426
  lines.push('## Trigger');
526
- lines.push('- Any `$Research` run that must collect broad public evidence before creative synthesis, debate, falsification, or paper writing.');
427
+ lines.push('- Any `$Research` run that must collect broad public evidence before synthesis, adversarial review, falsification, or paper writing.');
527
428
  lines.push('');
528
429
  lines.push('## Source Layers');
529
430
  for (const layer of layers) {
@@ -539,10 +440,12 @@ export function researchSourceSkillMarkdown(plan) {
539
440
  lines.push('- If a layer cannot be searched with the available runtime or credentials, record the blocker and keep research-gate.json unpassed.');
540
441
  lines.push('- Do not modify repository source code or generated harness files during Research; write only route-local mission artifacts.');
541
442
  lines.push('');
542
- lines.push('## Debate Use');
543
- lines.push('- Every agent must cite source-ledger ids in findings and Eureka ideas.');
443
+ lines.push('## Official Reviewer Use');
444
+ lines.push('- Only source-ledger ids with correlated verified-content Super Search proof may support a real-run reviewer finding or Eureka idea.');
445
+ lines.push('- Run exactly three independent official `research_reviewer` threads on GPT-5.6 Sol Max: Einstein, von Neumann, and Skeptic composite lenses.');
544
446
  lines.push('- The skeptic lens must challenge the strongest claim using counterevidence or source-quality downgrades.');
545
- lines.push('- Continue agent/debate/falsification cycles until every agent agrees to the surviving mechanism. Record `unanimous_consensus=true`, `consensus_iterations`, and per-agent agreement in debate-ledger.json.');
447
+ lines.push('- Any objection triggers a mission-local `research_synthesizer` revision followed by a fresh three-thread review cycle; do not launch a custom scheduler or debate pool.');
448
+ lines.push('- `agent-ledger.json` and `debate-ledger.json` are compatibility projections from official reviewer outcomes. Canonical convergence requires three trustworthy parent outcomes and zero unresolved objections.');
546
449
  lines.push('- Synthesis keeps only claims that survive cross-layer triangulation and falsification.');
547
450
  lines.push('');
548
451
  return `${lines.join('\n')}\n`;
@@ -601,8 +504,6 @@ export async function writeResearchPlan(dir, prompt, opts = {}) {
601
504
  await writeJsonAtomic(path.join(dir, 'debate-ledger.json'), defaultDebateLedger(plan));
602
505
  await writeJsonAtomic(path.join(dir, 'falsification-ledger.json'), defaultFalsificationLedger());
603
506
  await writeJsonAtomic(path.join(dir, 'research-gate.json'), defaultResearchGate());
604
- if (opts.missionId)
605
- await writeResearchNativeAgentLedger(dir, plan, { missionId: opts.missionId });
606
507
  await appendJsonlBounded(path.join(dir, 'events.jsonl'), { ts: nowIso(), type: 'research.plan.created', depth: plan.depth });
607
508
  return plan;
608
509
  }
@@ -640,104 +541,6 @@ function compactExecutionProfile(profile) {
640
541
  artifact_path: profile.artifact_path || '.sneakoscope/reports/codex-app-execution-profile.json'
641
542
  } : null;
642
543
  }
643
- export async function writeResearchNativeAgentLedger(dir, plan, opts = {}) {
644
- const missionId = opts.missionId || plan?.mission_id;
645
- if (!missionId)
646
- return null;
647
- const rosterRows = (plan?.native_agent_plan?.personas || RESEARCH_NATIVE_AGENT_PERSONAS).map((persona) => ({
648
- id: persona.id,
649
- session_id: persona.session_id || `${missionId}-${persona.id}`,
650
- persona_id: persona.id,
651
- role: persona.role,
652
- read_only: persona.read_only !== false,
653
- status: 'planned',
654
- output_artifacts: persona.outputs || []
655
- }));
656
- const batches = plan?.native_agent_plan?.batches || [];
657
- const root = await initializeAgentCentralLedger(dir, {
658
- missionId,
659
- route: '$Research',
660
- prompt: plan?.prompt || '',
661
- roster: {
662
- schema: 'sks.research-agent-roster.v1',
663
- mission_id: missionId,
664
- backend: 'native_multi_session_agent_kernel',
665
- roster: rosterRows,
666
- personas: plan?.native_agent_plan?.personas || RESEARCH_NATIVE_AGENT_PERSONAS
667
- },
668
- partition: {
669
- slices: batches.map((batch) => ({
670
- id: batch.id,
671
- owner_agent_id: (batch.agents || [])[0] || 'research_verifier',
672
- domain: batch.cycle_phase || batch.id,
673
- write_paths: batch.outputs || [],
674
- read_only: batch.read_only !== false
675
- })),
676
- leases: batches.flatMap((batch) => (batch.outputs || []).map((artifact) => ({
677
- path: artifact,
678
- owner_agent_id: (batch.agents || [])[0] || 'research_verifier',
679
- mode: 'route-local-artifact'
680
- })))
681
- }
682
- });
683
- for (const batch of batches) {
684
- await appendAgentLedgerEvent(root, {
685
- agent_id: (batch.agents || [])[0] || 'orchestrator',
686
- session_id: `${missionId}-${(batch.agents || [])[0] || 'orchestrator'}`,
687
- event_type: 'research_batch_planned',
688
- payload: { batch_id: batch.id, outputs: batch.outputs || [] }
689
- });
690
- }
691
- await writeJsonAtomic(path.join(dir, 'research-agent-batches.json'), {
692
- schema: 'sks.research-agent-batches.v1',
693
- mission_id: missionId,
694
- backend: 'native_multi_session_agent_kernel',
695
- batches,
696
- status: 'planned'
697
- });
698
- return root;
699
- }
700
- export async function writeResearchNativeAgentBatchCompletion(dir, plan, opts = {}) {
701
- const missionId = opts.missionId || plan?.mission_id || null;
702
- const batches = plan?.native_agent_plan?.batches || [];
703
- const completedAt = nowIso();
704
- await writeJsonAtomic(path.join(dir, 'research-agent-batches.json'), {
705
- schema: 'sks.research-agent-batches.v1',
706
- mission_id: missionId,
707
- backend: 'native_multi_session_agent_kernel',
708
- batches: batches.map((batch) => ({ ...batch, status: 'completed_mock', completed_at: completedAt })),
709
- status: 'completed_mock',
710
- completed_at: completedAt
711
- });
712
- if (!missionId)
713
- return null;
714
- const agentRoot = path.join(dir, 'agents');
715
- const sessionsPath = path.join(agentRoot, 'agent-sessions.json');
716
- const sessions = await readJson(sessionsPath, null);
717
- if (sessions?.sessions) {
718
- for (const [agentId, session] of Object.entries(sessions.sessions)) {
719
- sessions.sessions[agentId] = {
720
- ...session,
721
- status: 'closed',
722
- opened_at: session.opened_at || completedAt,
723
- heartbeat_at: completedAt,
724
- closed_at: completedAt
725
- };
726
- }
727
- await writeJsonAtomic(sessionsPath, sessions);
728
- }
729
- if (await exists(path.join(agentRoot, 'agent-events.jsonl'))) {
730
- for (const batch of batches) {
731
- await appendAgentLedgerEvent(agentRoot, {
732
- agent_id: (batch.agents || [])[0] || 'research_verifier',
733
- session_id: `${missionId}-${(batch.agents || [])[0] || 'research_verifier'}`,
734
- event_type: 'research_batch_completed',
735
- payload: { batch_id: batch.id, outputs: batch.outputs || [], mock: true }
736
- });
737
- }
738
- }
739
- return { mission_id: missionId, status: 'completed_mock', batch_count: batches.length };
740
- }
741
544
  export function defaultSourceLedger(plan = null) {
742
545
  const sourceLayers = plan?.web_research_policy?.source_layers?.length ? plan.web_research_policy.source_layers : RESEARCH_SOURCE_LAYERS;
743
546
  return {
@@ -805,9 +608,14 @@ export function defaultAgentLedger(plan = null) {
805
608
  persona_boundary: agent.persona_boundary || 'persona-inspired cognitive lens only; do not impersonate the historical person',
806
609
  role: agent.role,
807
610
  mandate: agent.mandate,
808
- effort: 'xhigh',
809
- reasoning_effort: 'xhigh',
810
- service_tier: agent.service_tier || 'fast',
611
+ model_policy: {
612
+ custom_agent: RESEARCH_REVIEWER_CUSTOM_AGENT,
613
+ model: 'gpt-5.6-sol',
614
+ reasoning_effort: 'max',
615
+ enforcement_source: RESEARCH_REVIEWER_CONFIG_ARTIFACT
616
+ },
617
+ observed_model: null,
618
+ observed_reasoning_effort: null,
811
619
  eureka: {
812
620
  exclamation: 'Eureka!',
813
621
  idea: '',
@@ -944,6 +752,7 @@ export function defaultResearchGate() {
944
752
  triangulation_checks: 0,
945
753
  independent_agents: 0,
946
754
  xhigh_agents: 0,
755
+ sol_max_policy_agents: 0,
947
756
  eureka_moments: 0,
948
757
  agent_findings: 0,
949
758
  debate_participants: 0,
@@ -963,10 +772,316 @@ export function defaultResearchGate() {
963
772
  notes: []
964
773
  };
965
774
  }
775
+ export async function validateCanonicalResearchAdversarialEvidence(dir) {
776
+ const expectedPersonaIds = RESEARCH_AGENT_COUNCIL.map((agent) => String(agent.id));
777
+ const expectedReviewerCount = expectedPersonaIds.length;
778
+ const [reviewLedger, revisionLedger, convergenceGate, honestMode, researchPlan, sourceLedger] = await Promise.all([
779
+ readJson(path.join(dir, RESEARCH_ADVERSARIAL_REVIEW_LEDGER_ARTIFACT), null),
780
+ readJson(path.join(dir, RESEARCH_ADVERSARIAL_REVISION_LEDGER_ARTIFACT), null),
781
+ readJson(path.join(dir, RESEARCH_ADVERSARIAL_CONVERGENCE_ARTIFACT), null),
782
+ readJson(path.join(dir, RESEARCH_HONEST_MODE_CANONICAL_ARTIFACT), null),
783
+ readJson(path.join(dir, 'research-plan.json'), null),
784
+ readJson(path.join(dir, 'source-ledger.json'), null)
785
+ ]);
786
+ const blockers = [];
787
+ if (reviewLedger?.schema !== 'sks.research-adversarial-review-ledger.v1')
788
+ blockers.push('canonical_adversarial_review_ledger_invalid');
789
+ if (revisionLedger?.schema !== 'sks.research-revision-ledger.v1')
790
+ blockers.push('canonical_adversarial_revision_ledger_invalid');
791
+ if (convergenceGate?.schema !== 'sks.research-adversarial-convergence.v1')
792
+ blockers.push('canonical_adversarial_convergence_invalid');
793
+ if (honestMode?.schema !== 'sks.research-honest-mode.v1')
794
+ blockers.push('canonical_research_honest_mode_invalid');
795
+ const reviewCycles = Array.isArray(reviewLedger?.review_cycles) ? reviewLedger.review_cycles : [];
796
+ const revisions = Array.isArray(revisionLedger?.revisions) ? revisionLedger.revisions : [];
797
+ const finalReview = reviewCycles.at(-1) || null;
798
+ const finalCycle = Number(finalReview?.cycle || 0);
799
+ const executionClass = String(convergenceGate?.execution_class || reviewLedger?.execution_class || finalReview?.execution_class || '');
800
+ const mockOnly = executionClass === 'mock_fixture';
801
+ if (!['real', 'mock_fixture'].includes(executionClass))
802
+ blockers.push('canonical_adversarial_execution_class_invalid');
803
+ if (!finalReview)
804
+ blockers.push('canonical_adversarial_final_review_missing');
805
+ if (Number(reviewLedger?.final_cycle || 0) !== finalCycle || finalCycle < 1)
806
+ blockers.push('canonical_adversarial_final_cycle_mismatch');
807
+ if (reviewCycles.length !== finalCycle)
808
+ blockers.push('canonical_adversarial_review_cycle_sequence_invalid');
809
+ if (String(finalReview?.execution_class || '') !== executionClass)
810
+ blockers.push('canonical_adversarial_final_execution_class_mismatch');
811
+ if (normalizeResearchStrings(reviewLedger?.blockers).length)
812
+ blockers.push(...normalizeResearchStrings(reviewLedger.blockers).map((blocker) => `canonical_adversarial_ledger:${blocker}`));
813
+ if (normalizeResearchStrings(finalReview?.blockers).length)
814
+ blockers.push(...normalizeResearchStrings(finalReview.blockers).map((blocker) => `canonical_adversarial_final_review:${blocker}`));
815
+ const reviewers = Array.isArray(finalReview?.reviewers) ? finalReview.reviewers : [];
816
+ const currentReviewArtifacts = await buildResearchReviewArtifactDigest(dir, researchPlan);
817
+ const recordedReviewArtifacts = finalReview?.review_artifacts;
818
+ blockers.push(...validateResearchReviewArtifactDigest(recordedReviewArtifacts, currentReviewArtifacts).map((blocker) => `canonical_adversarial_${blocker}`));
819
+ const reviewedArtifactBundle = String(recordedReviewArtifacts?.bundle_sha256 || '');
820
+ if (String(convergenceGate?.review_artifact_bundle_sha256 || '') !== reviewedArtifactBundle)
821
+ blockers.push('canonical_adversarial_convergence_artifact_bundle_mismatch');
822
+ if (String(convergenceGate?.current_artifact_bundle_sha256 || '') !== currentReviewArtifacts.bundle_sha256)
823
+ blockers.push('canonical_adversarial_convergence_current_artifact_bundle_mismatch');
824
+ if (convergenceGate?.review_artifact_hashes_ok !== true)
825
+ blockers.push('canonical_adversarial_artifact_hashes_not_ok');
826
+ const currentSourceIds = await eligibleResearchSourceIdSet(dir, sourceLedger, executionClass);
827
+ const personaIds = reviewers.map((reviewer) => String(reviewer?.persona_id || '').trim()).filter(Boolean);
828
+ const threadIds = reviewers.map((reviewer) => String(reviewer?.thread_id || '').trim()).filter(Boolean);
829
+ if (reviewers.length !== expectedReviewerCount)
830
+ blockers.push(`canonical_adversarial_reviewer_count:${reviewers.length}/${expectedReviewerCount}`);
831
+ for (const personaId of expectedPersonaIds) {
832
+ if (!personaIds.includes(personaId))
833
+ blockers.push(`canonical_adversarial_reviewer_missing:${personaId}`);
834
+ }
835
+ for (const duplicate of duplicateResearchStrings(personaIds))
836
+ blockers.push(`canonical_adversarial_reviewer_duplicate:${duplicate}`);
837
+ for (const duplicate of duplicateResearchStrings(threadIds))
838
+ blockers.push(`canonical_adversarial_thread_duplicate:${duplicate}`);
839
+ if (new Set(threadIds).size !== expectedReviewerCount)
840
+ blockers.push('canonical_adversarial_distinct_threads_missing');
841
+ for (const reviewer of reviewers)
842
+ blockers.push(...canonicalResearchReviewerBlockers(reviewer, currentSourceIds, reviewedArtifactBundle));
843
+ if (convergenceGate?.passed !== true)
844
+ blockers.push('canonical_adversarial_convergence_not_passed');
845
+ if (convergenceGate?.official_subagent_workflow !== true)
846
+ blockers.push('canonical_adversarial_official_workflow_missing');
847
+ if (Number(convergenceGate?.reviewer_count_required || 0) !== expectedReviewerCount)
848
+ blockers.push('canonical_adversarial_required_reviewer_count_invalid');
849
+ if (Number(convergenceGate?.reviewer_count_observed || 0) !== expectedReviewerCount)
850
+ blockers.push('canonical_adversarial_observed_reviewer_count_invalid');
851
+ if (Number(convergenceGate?.review_cycles || 0) !== reviewCycles.length)
852
+ blockers.push('canonical_adversarial_review_cycle_count_mismatch');
853
+ if (Number(convergenceGate?.revision_cycles || 0) !== revisions.length)
854
+ blockers.push('canonical_adversarial_revision_cycle_count_mismatch');
855
+ if (convergenceGate?.all_reviewers_approved !== true)
856
+ blockers.push('canonical_adversarial_unanimity_missing');
857
+ if (Number(convergenceGate?.unresolved_critical_objections || 0) !== 0)
858
+ blockers.push('canonical_adversarial_critical_objections_open');
859
+ if (Number(convergenceGate?.unresolved_objections || 0) !== 0)
860
+ blockers.push('canonical_adversarial_objections_open');
861
+ if (convergenceGate?.honest_mode_ok !== true)
862
+ blockers.push('canonical_adversarial_honest_mode_not_ok');
863
+ if (normalizeResearchStrings(convergenceGate?.blockers).length)
864
+ blockers.push(...normalizeResearchStrings(convergenceGate.blockers).map((blocker) => `canonical_adversarial_convergence:${blocker}`));
865
+ if (convergenceGate?.genius_level_guaranteed !== false || convergenceGate?.novelty_guaranteed !== false || convergenceGate?.publication_acceptance_guaranteed !== false) {
866
+ blockers.push('canonical_adversarial_guarantee_overclaim');
867
+ }
868
+ if (honestMode?.ok !== true || normalizeResearchStrings(honestMode?.blockers).length)
869
+ blockers.push('canonical_research_honest_mode_not_ok');
870
+ if (String(honestMode?.execution_class || '') !== executionClass)
871
+ blockers.push('canonical_research_honest_mode_execution_class_mismatch');
872
+ if (honestMode?.guarantees?.genius_level !== false
873
+ || honestMode?.guarantees?.novelty !== false
874
+ || honestMode?.guarantees?.breakthrough !== false
875
+ || honestMode?.guarantees?.publication_acceptance !== false) {
876
+ blockers.push('canonical_research_honest_mode_guarantee_overclaim');
877
+ }
878
+ const finalReviewedAt = researchTimestamp(finalReview?.reviewed_at);
879
+ if (!finalReviewedAt)
880
+ blockers.push('canonical_adversarial_final_review_timestamp_invalid');
881
+ for (const revision of revisions) {
882
+ const revisionCycle = Number(revision?.cycle || 0);
883
+ if (revision?.ok !== true)
884
+ blockers.push(`canonical_adversarial_revision_not_ok:${revisionCycle || 'unknown'}`);
885
+ if (!researchTimestamp(revision?.revised_at))
886
+ blockers.push(`canonical_adversarial_revision_timestamp_invalid:${revisionCycle || 'unknown'}`);
887
+ if (revisionCycle < 1 || revisionCycle >= finalCycle)
888
+ blockers.push(`canonical_adversarial_revision_not_followed_by_review:${revisionCycle || 'unknown'}`);
889
+ }
890
+ if (finalCycle > 1) {
891
+ const revisionCycles = new Set(revisions.map((revision) => Number(revision?.cycle || 0)));
892
+ for (let cycle = 1; cycle < finalCycle; cycle += 1) {
893
+ if (!revisionCycles.has(cycle))
894
+ blockers.push(`canonical_adversarial_review_without_revision:${cycle + 1}`);
895
+ }
896
+ }
897
+ const latestRevisionAt = Math.max(0, ...revisions.map((revision) => researchTimestamp(revision?.revised_at)));
898
+ if (latestRevisionAt && (!finalReviewedAt || finalReviewedAt < latestRevisionAt))
899
+ blockers.push('canonical_adversarial_post_revision_review_not_fresh');
900
+ if (revisions.length) {
901
+ const priorThreadIds = new Set(reviewCycles.slice(0, -1).flatMap((cycle) => (Array.isArray(cycle?.reviewers) ? cycle.reviewers : []).map((reviewer) => String(reviewer?.thread_id || '').trim()).filter(Boolean)));
902
+ for (const threadId of threadIds) {
903
+ if (priorThreadIds.has(threadId))
904
+ blockers.push(`canonical_adversarial_post_revision_thread_reused:${threadId}`);
905
+ }
906
+ const revisionRunIds = new Set(revisions.map((revision) => String(revision?.workflow_run_id || '').trim()).filter(Boolean));
907
+ if (revisionRunIds.has(String(finalReview?.workflow_run_id || '').trim()))
908
+ blockers.push('canonical_adversarial_post_revision_run_reused');
909
+ }
910
+ let rebuiltEvidence = null;
911
+ let persistedEvidence = null;
912
+ let normalizedParent = null;
913
+ if (mockOnly) {
914
+ if (convergenceGate?.official_subagent_evidence_ok !== true)
915
+ blockers.push('canonical_adversarial_mock_contract_evidence_not_ok');
916
+ }
917
+ else if (executionClass === 'real') {
918
+ const [parentSummary, evidence, events] = await Promise.all([
919
+ readJson(path.join(dir, SUBAGENT_PARENT_SUMMARY_FILENAME), null),
920
+ readJson(path.join(dir, SUBAGENT_EVIDENCE_FILENAME), null),
921
+ readSubagentEvents(dir)
922
+ ]);
923
+ normalizedParent = normalizeSubagentParentSummary(parentSummary);
924
+ persistedEvidence = evidence;
925
+ const workflowRunId = String(finalReview?.workflow_run_id || convergenceGate?.workflow_run_id || '').trim();
926
+ if (!workflowRunId)
927
+ blockers.push('canonical_adversarial_workflow_run_id_missing');
928
+ if (!normalizedParent.trustworthy || normalizedParent.status !== 'completed')
929
+ blockers.push(...(normalizedParent.blockers.length ? normalizedParent.blockers.map((blocker) => `canonical_adversarial_parent:${blocker}`) : ['canonical_adversarial_parent_untrustworthy']));
930
+ if (normalizedParent.run_id !== workflowRunId)
931
+ blockers.push('canonical_adversarial_parent_run_id_mismatch');
932
+ rebuiltEvidence = buildSubagentEvidence({
933
+ requestedSubagents: expectedReviewerCount,
934
+ events,
935
+ parentSummary,
936
+ parentSummaryPresent: normalizedParent.present,
937
+ workflowStatus: 'parent_completed',
938
+ runId: workflowRunId
939
+ });
940
+ if (!rebuiltEvidence.ok)
941
+ blockers.push(...rebuiltEvidence.blockers.map((blocker) => `canonical_adversarial_evidence:${blocker}`));
942
+ if (evidence?.schema !== 'sks.subagent-evidence.v1' || evidence?.ok !== true || evidence?.status !== 'completed')
943
+ blockers.push('canonical_adversarial_persisted_evidence_invalid');
944
+ if (convergenceGate?.official_subagent_evidence_ok !== true)
945
+ blockers.push('canonical_adversarial_convergence_evidence_not_ok');
946
+ if (String(convergenceGate?.workflow_run_id || '') !== workflowRunId)
947
+ blockers.push('canonical_adversarial_convergence_run_id_mismatch');
948
+ if (String(evidence?.run_id || '') !== workflowRunId)
949
+ blockers.push('canonical_adversarial_persisted_evidence_run_id_mismatch');
950
+ if (!sameResearchStringSet(threadIds, rebuiltEvidence?.completed_thread_ids))
951
+ blockers.push('canonical_adversarial_rebuilt_thread_correlation_failed');
952
+ if (!sameResearchStringSet(threadIds, evidence?.completed_thread_ids))
953
+ blockers.push('canonical_adversarial_persisted_thread_correlation_failed');
954
+ if (Number(evidence?.requested_subagents || 0) !== expectedReviewerCount
955
+ || Number(evidence?.started_threads || 0) !== expectedReviewerCount
956
+ || Number(evidence?.completed_threads || 0) !== expectedReviewerCount
957
+ || Number(evidence?.failed_threads || 0) !== 0
958
+ || normalizeResearchStrings(evidence?.open_thread_ids).length
959
+ || normalizeResearchStrings(evidence?.ambiguous_stop_thread_ids).length
960
+ || normalizeResearchStrings(evidence?.unmatched_stop_thread_ids).length
961
+ || evidence?.parent_summary_trustworthy !== true
962
+ || evidence?.parent_summary_status !== 'completed') {
963
+ blockers.push('canonical_adversarial_persisted_evidence_counts_invalid');
964
+ }
965
+ const finalReviewerByThread = new Map(reviewers.map((reviewer) => [String(reviewer?.thread_id || ''), reviewer]));
966
+ for (const row of Array.isArray(normalizedParent.raw?.thread_outcomes) ? normalizedParent.raw.thread_outcomes : []) {
967
+ const threadId = String(row?.thread_id || '').trim();
968
+ const outcome = parseExactResearchJsonObject(row?.summary);
969
+ const reviewer = finalReviewerByThread.get(threadId);
970
+ if (!reviewer || row?.status !== 'completed' || !outcome) {
971
+ blockers.push(`canonical_adversarial_parent_outcome_invalid:${threadId || 'unknown'}`);
972
+ continue;
973
+ }
974
+ blockers.push(...canonicalResearchReviewerBlockers({ ...outcome, thread_id: threadId, thread_status: row.status }, currentSourceIds, reviewedArtifactBundle)
975
+ .map((blocker) => `canonical_adversarial_parent_outcome:${blocker}`));
976
+ if (outcome.schema !== 'sks.research-adversarial-reviewer-outcome.v1'
977
+ || String(outcome.persona_id || '') !== String(reviewer.persona_id || '')
978
+ || String(outcome.verdict || '') !== String(reviewer.verdict || '')) {
979
+ blockers.push(`canonical_adversarial_parent_outcome_mismatch:${threadId}`);
980
+ }
981
+ }
982
+ }
983
+ return {
984
+ schema: 'sks.research-canonical-adversarial-validation.v1',
985
+ ok: [...new Set(blockers)].length === 0,
986
+ execution_class: executionClass || null,
987
+ mock_only: mockOnly,
988
+ review_cycles: reviewCycles.length,
989
+ revision_cycles: revisions.length,
990
+ final_cycle: finalCycle || null,
991
+ reviewer_thread_ids: [...new Set(threadIds)].sort(),
992
+ workflow_run_id: String(finalReview?.workflow_run_id || convergenceGate?.workflow_run_id || '').trim() || null,
993
+ parent_summary_trustworthy: normalizedParent?.trustworthy ?? false,
994
+ official_subagent_evidence_ok: rebuiltEvidence?.ok ?? (mockOnly ? true : false),
995
+ blockers: [...new Set(blockers)]
996
+ };
997
+ }
998
+ function canonicalResearchReviewerBlockers(reviewer, currentSourceIds = new Set(), expectedArtifactBundle = '') {
999
+ const personaId = String(reviewer?.persona_id || 'unknown');
1000
+ const blockers = [];
1001
+ if (reviewer?.schema !== 'sks.research-adversarial-reviewer-outcome.v1')
1002
+ blockers.push(`canonical_adversarial_reviewer_schema:${personaId}`);
1003
+ if (!String(reviewer?.thread_id || '').trim())
1004
+ blockers.push(`canonical_adversarial_reviewer_thread_missing:${personaId}`);
1005
+ if (reviewer?.thread_status !== 'completed')
1006
+ blockers.push(`canonical_adversarial_reviewer_thread_not_completed:${personaId}`);
1007
+ if (reviewer?.verdict !== 'approve')
1008
+ blockers.push(`canonical_adversarial_reviewer_not_approved:${personaId}`);
1009
+ if (!String(reviewer?.strongest_challenge || '').trim())
1010
+ blockers.push(`canonical_adversarial_reviewer_challenge_missing:${personaId}`);
1011
+ if (!normalizeResearchStrings(reviewer?.evidence_source_ids).length)
1012
+ blockers.push(`canonical_adversarial_reviewer_evidence_missing:${personaId}`);
1013
+ if (!normalizeResearchStrings(reviewer?.falsifiers).length)
1014
+ blockers.push(`canonical_adversarial_reviewer_falsifier_missing:${personaId}`);
1015
+ if (!normalizeResearchStrings(reviewer?.cheap_probes).length)
1016
+ blockers.push(`canonical_adversarial_reviewer_probe_missing:${personaId}`);
1017
+ if (!/^[a-f0-9]{64}$/i.test(String(reviewer?.review_artifact_bundle_sha256 || '')))
1018
+ blockers.push(`canonical_adversarial_reviewer_artifact_bundle_missing:${personaId}`);
1019
+ if (expectedArtifactBundle && String(reviewer?.review_artifact_bundle_sha256 || '') !== expectedArtifactBundle)
1020
+ blockers.push(`canonical_adversarial_reviewer_artifact_bundle_mismatch:${personaId}`);
1021
+ if (reviewer?.eureka?.exclamation !== 'Eureka!' || !String(reviewer?.eureka?.idea || '').trim() || !normalizeResearchStrings(reviewer?.eureka?.source_ids).length)
1022
+ blockers.push(`canonical_adversarial_reviewer_eureka_missing:${personaId}`);
1023
+ for (const sourceId of normalizeResearchStrings(reviewer?.evidence_source_ids)) {
1024
+ if (!currentSourceIds.has(sourceId))
1025
+ blockers.push(`canonical_adversarial_reviewer_source_unknown:${personaId}:${sourceId}`);
1026
+ }
1027
+ for (const sourceId of normalizeResearchStrings(reviewer?.eureka?.source_ids)) {
1028
+ if (!currentSourceIds.has(sourceId))
1029
+ blockers.push(`canonical_adversarial_reviewer_eureka_source_unknown:${personaId}:${sourceId}`);
1030
+ }
1031
+ const objections = [
1032
+ ...(Array.isArray(reviewer?.critical_objections) ? reviewer.critical_objections : []),
1033
+ ...(Array.isArray(reviewer?.major_objections) ? reviewer.major_objections : []),
1034
+ ...(Array.isArray(reviewer?.minor_objections) ? reviewer.minor_objections : [])
1035
+ ];
1036
+ for (const objection of objections) {
1037
+ for (const sourceId of normalizeResearchStrings(objection?.source_ids)) {
1038
+ if (!currentSourceIds.has(sourceId))
1039
+ blockers.push(`canonical_adversarial_reviewer_objection_source_unknown:${personaId}:${sourceId}`);
1040
+ }
1041
+ }
1042
+ if (objections.length || normalizeResearchStrings(reviewer?.required_revisions).length)
1043
+ blockers.push(`canonical_adversarial_reviewer_objections_open:${personaId}`);
1044
+ return blockers;
1045
+ }
1046
+ function normalizeResearchStrings(value) {
1047
+ return [...new Set((Array.isArray(value) ? value : value == null ? [] : [value]).map((item) => String(item || '').trim()).filter(Boolean))];
1048
+ }
1049
+ function duplicateResearchStrings(values) {
1050
+ const seen = new Set();
1051
+ const duplicates = new Set();
1052
+ for (const value of values) {
1053
+ if (seen.has(value))
1054
+ duplicates.add(value);
1055
+ seen.add(value);
1056
+ }
1057
+ return [...duplicates];
1058
+ }
1059
+ function sameResearchStringSet(left, right) {
1060
+ const a = normalizeResearchStrings(left).sort();
1061
+ const b = normalizeResearchStrings(right).sort();
1062
+ return a.length === b.length && a.every((value, index) => value === b[index]);
1063
+ }
1064
+ function researchTimestamp(value) {
1065
+ const parsed = Date.parse(String(value || ''));
1066
+ return Number.isFinite(parsed) ? parsed : 0;
1067
+ }
1068
+ function parseExactResearchJsonObject(value) {
1069
+ if (typeof value !== 'string' || !value.trim())
1070
+ return null;
1071
+ try {
1072
+ const parsed = JSON.parse(value.trim());
1073
+ return parsed && typeof parsed === 'object' && !Array.isArray(parsed) ? parsed : null;
1074
+ }
1075
+ catch {
1076
+ return null;
1077
+ }
1078
+ }
966
1079
  export async function evaluateResearchGate(dir) {
967
1080
  const gate = await readJson(path.join(dir, 'research-gate.json'), defaultResearchGate());
968
1081
  const contract = await readResearchQualityContract(dir);
969
1082
  const plan = await readJson(path.join(dir, 'research-plan.json'), null);
1083
+ const context7Required = plan?.current_docs_policy?.context7_required === true;
1084
+ const context7Evidence = await researchContext7Evidence(dir);
970
1085
  const reportPresent = await exists(path.join(dir, 'research-report.md'));
971
1086
  const reportText = reportPresent ? await readText(path.join(dir, 'research-report.md'), '') : '';
972
1087
  const reportQuality = analyzeResearchReportQuality(reportText);
@@ -999,6 +1114,7 @@ export async function evaluateResearchGate(dir) {
999
1114
  const replicationPack = await readReplicationPack(dir);
1000
1115
  const replicationValidation = validateReplicationPack(replicationPack);
1001
1116
  const falsificationValidation = validateFalsificationCoverage(falsificationLedger, contract);
1117
+ const canonicalAdversarial = await validateCanonicalResearchAdversarialEvidence(dir);
1002
1118
  let sourceQualityReport = await readSourceQualityReport(dir);
1003
1119
  if (!sourceQualityReport && sourceLedger)
1004
1120
  sourceQualityReport = await writeSourceQualityReport(dir, sourceLedger, claimMatrix);
@@ -1013,7 +1129,12 @@ export async function evaluateResearchGate(dir) {
1013
1129
  const triangulationChecks = Array.isArray(sourceLedger?.triangulation?.cross_layer_checks) ? sourceLedger.triangulation.cross_layer_checks.length : 0;
1014
1130
  const agentRows = Array.isArray(agentLedger?.agents) ? agentLedger.agents : [];
1015
1131
  const independentAgents = agentRows.filter((agent) => Array.isArray(agent.findings) && agent.findings.length > 0).length;
1016
- const xhighAgents = agentRows.filter((agent) => agent.effort === 'xhigh').length;
1132
+ const solMaxPolicyAgents = agentRows.filter((agent) => {
1133
+ const policy = agent?.model_policy && typeof agent.model_policy === 'object' ? agent.model_policy : agent;
1134
+ return policy.custom_agent === RESEARCH_REVIEWER_CUSTOM_AGENT
1135
+ && policy.model === 'gpt-5.6-sol'
1136
+ && (policy.reasoning_effort === 'max' || policy.model_reasoning_effort === 'max');
1137
+ }).length;
1017
1138
  const eurekaMoments = agentRows.filter((agent) => agent.eureka?.exclamation === 'Eureka!' && String(agent.eureka?.idea || '').trim()).length;
1018
1139
  const agentFindings = agentRows.reduce((sum, agent) => sum + (Array.isArray(agent.findings) ? agent.findings.length : 0), 0);
1019
1140
  const debateRows = Array.isArray(debateLedger?.exchanges) ? debateLedger.exchanges : [];
@@ -1029,6 +1150,8 @@ export async function evaluateResearchGate(dir) {
1029
1150
  const reasons = [];
1030
1151
  if (!reportPresent && gate.report_present !== true)
1031
1152
  reasons.push('research_report_missing');
1153
+ if (context7Required && !context7Evidence.ok)
1154
+ reasons.push('context7_required_evidence_missing');
1032
1155
  if (reportWordCount < contract.min_report_words)
1033
1156
  reasons.push('research_report_too_short');
1034
1157
  if (!reportQuality.ok)
@@ -1067,13 +1190,13 @@ export async function evaluateResearchGate(dir) {
1067
1190
  reasons.push('cross_layer_triangulation_missing');
1068
1191
  if (Math.max(Number(gate.independent_agents || 0), independentAgents) < RESEARCH_AGENT_COUNCIL.length)
1069
1192
  reasons.push('independent_agents_missing');
1070
- if (Math.max(Number(gate.xhigh_agents || 0), xhighAgents) < RESEARCH_AGENT_COUNCIL.length)
1071
- reasons.push('agent_effort_not_xhigh');
1193
+ if (Math.max(Number(gate.sol_max_policy_agents || 0), solMaxPolicyAgents) < RESEARCH_AGENT_COUNCIL.length)
1194
+ reasons.push('agent_model_policy_not_sol_max');
1072
1195
  if (Math.max(Number(gate.eureka_moments || 0), eurekaMoments) < RESEARCH_AGENT_COUNCIL.length)
1073
1196
  reasons.push('eureka_missing');
1074
1197
  if (!personaValidation.ok)
1075
1198
  reasons.push(...personaValidation.issues.map((issue) => `agent_persona:${issue}`));
1076
- if (Math.max(Number(gate.agent_findings || 0), agentFindings) < 4)
1199
+ if (Math.max(Number(gate.agent_findings || 0), agentFindings) < RESEARCH_AGENT_COUNCIL.length)
1077
1200
  reasons.push('agent_findings_missing');
1078
1201
  if (Math.max(Number(gate.debate_participants || 0), debateParticipants) < RESEARCH_AGENT_COUNCIL.length)
1079
1202
  reasons.push('debate_participants_missing');
@@ -1123,6 +1246,8 @@ export async function evaluateResearchGate(dir) {
1123
1246
  reasons.push('replication_pack_missing');
1124
1247
  if (!replicationValidation.ok)
1125
1248
  reasons.push(...replicationValidation.blockers);
1249
+ if (!canonicalAdversarial.ok)
1250
+ reasons.push(...canonicalAdversarial.blockers);
1126
1251
  for (const artifact of contract.required_artifacts || []) {
1127
1252
  if (artifact === RESEARCH_FINAL_REVIEW_ARTIFACT)
1128
1253
  continue;
@@ -1196,7 +1321,8 @@ export async function evaluateResearchGate(dir) {
1196
1321
  claim_evidence_matrix_blockers: claimMatrixValidation.blockers,
1197
1322
  source_quality_report_ok: sourceQualityReport?.ok === true,
1198
1323
  independent_agents: Math.max(Number(gate.independent_agents || 0), independentAgents),
1199
- xhigh_agents: Math.max(Number(gate.xhigh_agents || 0), xhighAgents),
1324
+ xhigh_agents: 0,
1325
+ sol_max_policy_agents: Math.max(Number(gate.sol_max_policy_agents || 0), solMaxPolicyAgents),
1200
1326
  eureka_moments: Math.max(Number(gate.eureka_moments || 0), eurekaMoments),
1201
1327
  agent_persona_contract_ok: personaValidation.ok,
1202
1328
  agent_persona_issues: personaValidation.issues,
@@ -1214,11 +1340,15 @@ export async function evaluateResearchGate(dir) {
1214
1340
  implementation_blueprint_validation: blueprintValidation,
1215
1341
  experiment_plan_validation: experimentValidation,
1216
1342
  replication_pack_validation: replicationValidation,
1343
+ canonical_adversarial_validation: canonicalAdversarial,
1217
1344
  novelty_entries: Array.isArray(noveltyLedger?.entries) ? noveltyLedger.entries.length : null,
1218
1345
  final_review_approved: finalReview?.approved === true,
1219
1346
  final_review_blockers: Array.isArray(finalReview?.blockers) ? finalReview.blockers : [],
1220
1347
  citation_coverage: citationCoverage,
1221
- web_search_blockers: searchBlockers.length
1348
+ web_search_blockers: searchBlockers.length,
1349
+ context7_required: context7Required,
1350
+ context7_verified: context7Evidence.ok,
1351
+ context7_evidence_records: context7Evidence.count
1222
1352
  },
1223
1353
  gate: {
1224
1354
  ...gate,
@@ -1229,6 +1359,25 @@ export async function evaluateResearchGate(dir) {
1229
1359
  await writeJsonAtomic(path.join(dir, 'research-gate.evaluated.json'), result);
1230
1360
  return result;
1231
1361
  }
1362
+ async function researchContext7Evidence(dir) {
1363
+ const text = await readText(path.join(dir, 'context7-evidence.jsonl'), '');
1364
+ let resolve = false;
1365
+ let docs = false;
1366
+ let count = 0;
1367
+ for (const line of text.split(/\r?\n/)) {
1368
+ if (!line.trim())
1369
+ continue;
1370
+ count += 1;
1371
+ try {
1372
+ const row = JSON.parse(line);
1373
+ if (row?.stage === 'resolve-library-id')
1374
+ resolve = true;
1375
+ if (row?.stage === 'get-library-docs' || row?.stage === 'query-docs')
1376
+ docs = true;
1377
+ }
1378
+ catch { }
1379
+ }
1380
+ return { resolve, docs, ok: resolve && docs, count };
1381
+ }
1232
1382
  export { writeMockResearchResult } from './research/mock-result.js';
1233
- export { buildResearchPrompt } from './research/prompt.js';
1234
1383
  //# sourceMappingURL=research.js.map