@mindrian_os/cli 2.0.0-beta.3 → 2.0.0-beta.33

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 (1829) hide show
  1. package/.claude-plugin/plugin.json +21 -0
  2. package/.mcp.json +14 -0
  3. package/CHANGELOG.md +497 -0
  4. package/agents/analogy-query-fetcher.md +119 -0
  5. package/agents/brain-query.md +91 -0
  6. package/agents/competitor-watch-fetcher.md +94 -0
  7. package/agents/framework-runner.md +258 -0
  8. package/agents/grading.md +216 -0
  9. package/agents/grant-reviewer.md +191 -0
  10. package/agents/investor.md +141 -0
  11. package/agents/larry-extended.md +215 -0
  12. package/agents/meeting-perspective-extractor.md +94 -0
  13. package/agents/opportunity-scanner.md +105 -0
  14. package/agents/persona-analyst.md +201 -0
  15. package/agents/research.md +103 -0
  16. package/agents/reverse-salient-agent.md +42 -0
  17. package/agents/vault-section-reviewer.md +107 -0
  18. package/assets/banner-showcase.html +537 -0
  19. package/assets/fonts/BebasNeue-Regular.ttf +0 -0
  20. package/assets/fonts/Inter-Bold.ttf +0 -0
  21. package/assets/fonts/Inter-Regular.ttf +0 -0
  22. package/assets/logo.svg +10 -0
  23. package/bin/local-chain-recommender.cjs +256 -0
  24. package/bin/mindrian-brain-mcp-client.cjs +319 -0
  25. package/bin/mindrian-mcp-server.cjs +445 -0
  26. package/bin/mindrian-mcp-shim.cjs +100 -0
  27. package/bin/mindrian-tools.cjs +784 -0
  28. package/commands/act.md +529 -0
  29. package/commands/admin.md +439 -0
  30. package/commands/agentshield.md +49 -0
  31. package/commands/analyze-needs.md +78 -0
  32. package/commands/analyze-systems.md +73 -0
  33. package/commands/analyze-timing.md +98 -0
  34. package/commands/auto-explore.md +85 -0
  35. package/commands/beautiful-question.md +76 -0
  36. package/commands/bono.md +152 -0
  37. package/commands/brain-derive.md +137 -0
  38. package/commands/build-knowledge.md +121 -0
  39. package/commands/build-thesis.md +94 -0
  40. package/commands/causal.md +269 -0
  41. package/commands/challenge-assumptions.md +78 -0
  42. package/commands/compare-ventures.md +117 -0
  43. package/commands/correct-reference-now.md +88 -0
  44. package/commands/dashboard.md +144 -0
  45. package/commands/deck.md +117 -0
  46. package/commands/deep-grade.md +214 -0
  47. package/commands/diagnose.md +131 -0
  48. package/commands/diagnostics.md +195 -0
  49. package/commands/dial-memory-refresh.md +113 -0
  50. package/commands/diffusion.md +129 -0
  51. package/commands/discover.md +221 -0
  52. package/commands/doctor.md +271 -0
  53. package/commands/dogfood-flush.md +130 -0
  54. package/commands/dominant-designs.md +76 -0
  55. package/commands/eureka.md +315 -0
  56. package/commands/explain-decision.md +135 -0
  57. package/commands/explore-domains.md +78 -0
  58. package/commands/explore-futures.md +67 -0
  59. package/commands/explore-opportunity.md +172 -0
  60. package/commands/explore-trends.md +78 -0
  61. package/commands/export.md +128 -0
  62. package/commands/feynman-timeline-refresh.md +102 -0
  63. package/commands/file-meeting.md +1195 -0
  64. package/commands/find-analogies.md +369 -0
  65. package/commands/find-bottlenecks.md +108 -0
  66. package/commands/find-connections.md +111 -0
  67. package/commands/funding.md +114 -0
  68. package/commands/futures.md +128 -0
  69. package/commands/grade-grant.md +297 -0
  70. package/commands/grade.md +257 -0
  71. package/commands/graph.md +218 -0
  72. package/commands/hat-briefing.md +163 -0
  73. package/commands/heal.md +72 -0
  74. package/commands/help.md +176 -0
  75. package/commands/hmi-status.md +75 -0
  76. package/commands/ignite.md +229 -0
  77. package/commands/ingest-methodology.md +128 -0
  78. package/commands/intel-pipeline.md +133 -0
  79. package/commands/jtbd.md +262 -0
  80. package/commands/leadership.md +113 -0
  81. package/commands/lean-canvas.md +74 -0
  82. package/commands/macro-trends.md +88 -0
  83. package/commands/map-unknowns.md +76 -0
  84. package/commands/memory-cortex-reach.md +79 -0
  85. package/commands/memory.md +213 -0
  86. package/commands/models.md +200 -0
  87. package/commands/mos-reason.md +489 -0
  88. package/commands/mos.md +162 -0
  89. package/commands/mullins.md +155 -0
  90. package/commands/mva-brief.md +86 -0
  91. package/commands/mva-option.md +119 -0
  92. package/commands/mva-report.md +76 -0
  93. package/commands/new-project.md +633 -0
  94. package/commands/new-surface.md +116 -0
  95. package/commands/onboard.md +489 -0
  96. package/commands/operator.md +168 -0
  97. package/commands/opportunities.md +177 -0
  98. package/commands/organize.md +74 -0
  99. package/commands/persona.md +276 -0
  100. package/commands/pipeline.md +167 -0
  101. package/commands/present.md +125 -0
  102. package/commands/publish.md +227 -0
  103. package/commands/pws-brain.md +154 -0
  104. package/commands/qualify-opportunity.md +113 -0
  105. package/commands/query.md +70 -0
  106. package/commands/radar.md +110 -0
  107. package/commands/reanalyze.md +124 -0
  108. package/commands/research.md +467 -0
  109. package/commands/room.md +385 -0
  110. package/commands/rooms.md +682 -0
  111. package/commands/root-cause.md +77 -0
  112. package/commands/rs-experts.md +153 -0
  113. package/commands/rs-explain.md +134 -0
  114. package/commands/rs-fetch.md +119 -0
  115. package/commands/rs-thesis.md +131 -0
  116. package/commands/scenario-plan.md +80 -0
  117. package/commands/scheduled-tasks.md +308 -0
  118. package/commands/score-innovation.md +78 -0
  119. package/commands/scout.md +379 -0
  120. package/commands/setup.md +658 -0
  121. package/commands/show.md +71 -0
  122. package/commands/skill.md +108 -0
  123. package/commands/snapshot.md +179 -0
  124. package/commands/speakers.md +118 -0
  125. package/commands/splash.md +55 -0
  126. package/commands/stance.md +91 -0
  127. package/commands/status.md +109 -0
  128. package/commands/structure-argument.md +82 -0
  129. package/commands/suggest-next.md +141 -0
  130. package/commands/systems-thinking.md +224 -0
  131. package/commands/think-hats.md +86 -0
  132. package/commands/trending-to-absurd.md +151 -0
  133. package/commands/update.md +256 -0
  134. package/commands/user-needs.md +77 -0
  135. package/commands/validate.md +77 -0
  136. package/commands/value-proposition.md +116 -0
  137. package/commands/vault.md +330 -0
  138. package/commands/visualize.md +71 -0
  139. package/commands/whitespace.md +541 -0
  140. package/commands/wiki.md +96 -0
  141. package/data/ROOM.md +47 -0
  142. package/data/brain-census.generated.json +2617 -0
  143. package/data/brain-orchestration-projection.json +4973 -0
  144. package/data/brain-packet-schema.json +545 -0
  145. package/data/brain-surface-contract.json +32 -0
  146. package/data/capability-ledger.json +391 -0
  147. package/data/capability-map-registry.json +23 -0
  148. package/data/command-registry.json +2433 -0
  149. package/data/connector-coverage-ledger.json +1618 -0
  150. package/data/connector-out-of-spine-allowlist.json +71 -0
  151. package/data/connector-registry.json +3637 -0
  152. package/data/corpus-stats-source.json +11 -0
  153. package/data/corpus-stats.generated.json +10 -0
  154. package/data/cross-domain-analogues.json +15 -0
  155. package/data/deck-aliases.json +6 -0
  156. package/data/deck-styles.json +85 -0
  157. package/data/deployment-surfaces.json +69 -0
  158. package/data/dispatch-framework-map.json +18 -0
  159. package/data/doctor-modules.json +206 -0
  160. package/data/dual-graph-health-baseline.json +12 -0
  161. package/data/eureka-critic-tags.json +32 -0
  162. package/data/first-reward-surfaces.json +66 -0
  163. package/data/first-touch-surfaces.json +60 -0
  164. package/data/flagship-floor-set.json +37 -0
  165. package/data/framework-names.json +121 -0
  166. package/data/grant-rubric-fixtures/early-stage-pre-seed.json +18 -0
  167. package/data/grant-rubric-fixtures/early-stage-round-a.json +18 -0
  168. package/data/grant-rubric-fixtures/early-stage-seed.json +18 -0
  169. package/data/grant-rubric-fixtures/hybrid-seed-incentive.json +18 -0
  170. package/data/grant-rubric-fixtures/rd-fund.json +18 -0
  171. package/data/grant-rubric-fixtures/regional-innovation-incubators.json +18 -0
  172. package/data/grant-rubric-fixtures/technology-incubators.json +18 -0
  173. package/data/grant-rubric-fixtures/tnufa.json +167 -0
  174. package/data/grant-rubric-schema.json +33 -0
  175. package/data/harness-fixtures/converged-room/.context/ROOM.md +13 -0
  176. package/data/harness-fixtures/converged-room/.intelligence/ROOM.md +13 -0
  177. package/data/harness-fixtures/converged-room/.snapshots/ROOM.md +13 -0
  178. package/data/harness-fixtures/converged-room/MINTO.md +19 -0
  179. package/data/harness-fixtures/converged-room/STATE.md +73 -0
  180. package/data/harness-fixtures/converged-room/USER.md +23 -0
  181. package/data/harness-fixtures/converged-room/assets/ROOM.md +13 -0
  182. package/data/harness-fixtures/converged-room/business-model/CONTEXT.md +32 -0
  183. package/data/harness-fixtures/converged-room/business-model/ROOM.md +36 -0
  184. package/data/harness-fixtures/converged-room/competitive-analysis/CONTEXT.md +33 -0
  185. package/data/harness-fixtures/converged-room/competitive-analysis/ROOM.md +35 -0
  186. package/data/harness-fixtures/converged-room/financial-model/CONTEXT.md +30 -0
  187. package/data/harness-fixtures/converged-room/financial-model/ROOM.md +35 -0
  188. package/data/harness-fixtures/converged-room/funding/CONTEXT.md +41 -0
  189. package/data/harness-fixtures/converged-room/funding/ROOM.md +35 -0
  190. package/data/harness-fixtures/converged-room/legal-ip/CONTEXT.md +30 -0
  191. package/data/harness-fixtures/converged-room/legal-ip/ROOM.md +35 -0
  192. package/data/harness-fixtures/converged-room/market-analysis/CONTEXT.md +32 -0
  193. package/data/harness-fixtures/converged-room/market-analysis/ROOM.md +35 -0
  194. package/data/harness-fixtures/converged-room/opportunity-bank/CONTEXT.md +39 -0
  195. package/data/harness-fixtures/converged-room/opportunity-bank/ROOM.md +36 -0
  196. package/data/harness-fixtures/converged-room/problem-definition/CONTEXT.md +32 -0
  197. package/data/harness-fixtures/converged-room/problem-definition/ROOM.md +36 -0
  198. package/data/harness-fixtures/converged-room/references/ROOM.md +13 -0
  199. package/data/harness-fixtures/converged-room/references/SECTION-SCHEMA.md +213 -0
  200. package/data/harness-fixtures/converged-room/references/SUB-SCHEMAS.md +91 -0
  201. package/data/harness-fixtures/converged-room/solution-design/CONTEXT.md +36 -0
  202. package/data/harness-fixtures/converged-room/solution-design/ROOM.md +36 -0
  203. package/data/harness-fixtures/converged-room/strategy/CONTEXT.md +35 -0
  204. package/data/harness-fixtures/converged-room/strategy/ROOM.md +35 -0
  205. package/data/harness-fixtures/converged-room/team/ROOM.md +13 -0
  206. package/data/harness-fixtures/converged-room/team-execution/CONTEXT.md +36 -0
  207. package/data/harness-fixtures/converged-room/team-execution/ROOM.md +35 -0
  208. package/data/harness-manifest.json +74 -0
  209. package/data/harness-policies/CONTEXT.md +55 -0
  210. package/data/harness-policies/_schema.json +42 -0
  211. package/data/harness-policies/contract-parity-larry.json +63 -0
  212. package/data/harness-policies/gate-card-fire.json +13 -0
  213. package/data/harness-policies/gate-graph-derive-health.json +13 -0
  214. package/data/harness-policies/gate-shape-declaration.json +13 -0
  215. package/data/harness-policies/gate-tool-honesty.json +13 -0
  216. package/data/harness-policies/gate-worktree-hygiene.json +13 -0
  217. package/data/harness-policies/memory-write-policy.json +28 -0
  218. package/data/harness-policies/registry-drift.json +13 -0
  219. package/data/harness-policies/release-payload-ceiling.json +13 -0
  220. package/data/harness-policies/voice-backend-noun-free.json +13 -0
  221. package/data/harness-policies/voice-fork-as-card.json +13 -0
  222. package/data/harness-policies/voice-glyph-present.json +13 -0
  223. package/data/harness-policies/voice-hyphens-only.json +13 -0
  224. package/data/help-groups.json +236 -0
  225. package/data/hitl-shape-backfill.json +777 -0
  226. package/data/hitl-shape-declaration-fixtures/invalid-bad-shape.json +5 -0
  227. package/data/hitl-shape-declaration-fixtures/invalid-missing-why.json +4 -0
  228. package/data/hitl-shape-declaration-fixtures/invalid-ranker-contradiction.json +6 -0
  229. package/data/hitl-shape-declaration-fixtures/invalid-skill-gap.json +3 -0
  230. package/data/hitl-shape-declaration-fixtures/valid-multi-stage.json +7 -0
  231. package/data/hitl-shape-declaration-fixtures/valid-single-shape.json +5 -0
  232. package/data/hitl-shape-declaration-fixtures/valid-skill-exempt.json +5 -0
  233. package/data/hitl-shape-declaration-schema.json +34 -0
  234. package/data/hitl-stages-fixtures/bono.json +10 -0
  235. package/data/hitl-stages-fixtures/pipeline-1.json +9 -0
  236. package/data/hitl-stages-fixtures/pipeline-2.json +9 -0
  237. package/data/hitl-stages-fixtures/pipeline-3.json +10 -0
  238. package/data/hitl-stages-fixtures/research.json +10 -0
  239. package/data/hitl-stages-fixtures/rs-convergence.json +10 -0
  240. package/data/hitl-stages-fixtures/rs-family.json +11 -0
  241. package/data/hitl-stages-fixtures/rs-reverse-salient.json +10 -0
  242. package/data/hitl-stages-fixtures/trending-to-absurd.json +11 -0
  243. package/data/hitl-stages-schema.json +26 -0
  244. package/data/mcp-tool-connectors.json +464 -0
  245. package/data/mva-agent-prompts.json +31 -0
  246. package/data/mva-deck-template.html +15 -0
  247. package/data/mva-heuristic-keywords.json +35 -0
  248. package/data/orchestration-command-ledger.json +576 -0
  249. package/data/orchestration-unwired-allowlist.json +6 -0
  250. package/data/portfolio-ahp-matrix.json +16 -0
  251. package/data/publish-needs.json +76 -0
  252. package/data/render-coverage-registry.json +1152 -0
  253. package/data/research-sources.json +58 -0
  254. package/data/roadmap-type-chains.json +28 -0
  255. package/data/room-blueprints.json +156 -0
  256. package/data/subagent-dispatch-grants.json +150 -0
  257. package/hooks/hooks.json +493 -0
  258. package/hooks/run-hook.cmd +64 -0
  259. package/lib/__init__.py +0 -0
  260. package/lib/__pycache__/__init__.cpython-312.pyc +0 -0
  261. package/lib/agents/auto-explore-agent.cjs +1163 -0
  262. package/lib/agents/mva/brain-classic-traps.cjs +55 -0
  263. package/lib/agents/mva/brain-cross-domain.cjs +79 -0
  264. package/lib/agents/mva/brain-similar-ventures.cjs +93 -0
  265. package/lib/agents/mva/dashboard-graph-neighborhood.cjs +72 -0
  266. package/lib/agents/mva/index.cjs +42 -0
  267. package/lib/agents/mva/six-hats-red-black.cjs +137 -0
  268. package/lib/agents/mva/tavily-funding-scan.cjs +147 -0
  269. package/lib/agents/mva/test-all-six-agents.cjs +467 -0
  270. package/lib/agents/reverse-salient-agent.cjs +757 -0
  271. package/lib/agents/tension-hook-agent.cjs +586 -0
  272. package/lib/brain/ROOM.md +44 -0
  273. package/lib/brain/chain-recommender.cjs +784 -0
  274. package/lib/brain/curation-batch.cjs +519 -0
  275. package/lib/brain/framework-chain-slice.cjs +252 -0
  276. package/lib/brain/hypergraph-event-schema.cjs +184 -0
  277. package/lib/chat/chat-context.js +185 -0
  278. package/lib/chat/chat-panel.js +721 -0
  279. package/lib/chat/fabric-chat.cjs +288 -0
  280. package/lib/chat/generative-tools.js +219 -0
  281. package/lib/conversation/ROOM.md +39 -0
  282. package/lib/conversation/classifier-rules.json +38 -0
  283. package/lib/conversation/classifier.cjs +264 -0
  284. package/lib/conversation/operator-epistemic-cap.test.cjs +156 -0
  285. package/lib/conversation/operator.cjs +492 -0
  286. package/lib/conversation/operator.test.cjs +160 -0
  287. package/lib/copy/115-spec-strings.cjs +55 -0
  288. package/lib/core/__init__.py +0 -0
  289. package/lib/core/__nav-stub.cjs +14 -0
  290. package/lib/core/__pycache__/__init__.cpython-312.pyc +0 -0
  291. package/lib/core/__pycache__/rs-math.cpython-312.pyc +0 -0
  292. package/lib/core/__pycache__/rs_cache.cpython-312.pyc +0 -0
  293. package/lib/core/__pycache__/rs_corpus.cpython-312.pyc +0 -0
  294. package/lib/core/__pycache__/rs_corpus_exclude.cpython-312.pyc +0 -0
  295. package/lib/core/__pycache__/rs_hybrid.cpython-312.pyc +0 -0
  296. package/lib/core/__pycache__/rs_math.cpython-312.pyc +0 -0
  297. package/lib/core/__pycache__/rs_rooms.cpython-312.pyc +0 -0
  298. package/lib/core/abstraction-gate.cjs +133 -0
  299. package/lib/core/act-jtbd-blurb.cjs +231 -0
  300. package/lib/core/artifact-id.cjs +148 -0
  301. package/lib/core/asset-ops.cjs +151 -0
  302. package/lib/core/auto-commit-throttle.cjs +129 -0
  303. package/lib/core/bearer-token.cjs +199 -0
  304. package/lib/core/behavioral/observation-schema.cjs +86 -0
  305. package/lib/core/bono/cell-fanout.cjs +305 -0
  306. package/lib/core/bono/debate-composition.cjs +495 -0
  307. package/lib/core/bono/hat-governance.cjs +367 -0
  308. package/lib/core/bono/persona-research.cjs +288 -0
  309. package/lib/core/bono/reviewer-governance.cjs +331 -0
  310. package/lib/core/brain-client.cjs +2621 -0
  311. package/lib/core/brain-derivation-prompts.cjs +331 -0
  312. package/lib/core/brain-derivation-queue.cjs +535 -0
  313. package/lib/core/brain-derivation.cjs +740 -0
  314. package/lib/core/brain-md-schema.cjs +528 -0
  315. package/lib/core/brain-md-staleness.cjs +357 -0
  316. package/lib/core/brain-response-sanitize.cjs +396 -0
  317. package/lib/core/breakthrough/canary.cjs +134 -0
  318. package/lib/core/breakthrough/canary.test.cjs +136 -0
  319. package/lib/core/breakthrough/detectors.cjs +359 -0
  320. package/lib/core/breakthrough/detectors.test.cjs +333 -0
  321. package/lib/core/breakthrough/ethics-fence.cjs +129 -0
  322. package/lib/core/breakthrough/ethics-fence.test.cjs +178 -0
  323. package/lib/core/breakthrough/resurfacing.cjs +150 -0
  324. package/lib/core/breakthrough/resurfacing.test.cjs +233 -0
  325. package/lib/core/breakthrough/review-queue.cjs +168 -0
  326. package/lib/core/breakthrough/review-queue.test.cjs +160 -0
  327. package/lib/core/breakthrough/scanner-d17-d18.test.cjs +229 -0
  328. package/lib/core/breakthrough/scanner.cjs +435 -0
  329. package/lib/core/breakthrough/scanner.test.cjs +267 -0
  330. package/lib/core/breakthrough/schema.cjs +180 -0
  331. package/lib/core/breakthrough/schema.test.cjs +256 -0
  332. package/lib/core/breakthrough/scoring.cjs +293 -0
  333. package/lib/core/breakthrough/scoring.test.cjs +423 -0
  334. package/lib/core/breakthrough/verb-dispatch.cjs +230 -0
  335. package/lib/core/breakthrough/verb-dispatch.test.cjs +185 -0
  336. package/lib/core/breakthrough/voice-scaffold.cjs +249 -0
  337. package/lib/core/breakthrough/voice-scaffold.test.cjs +251 -0
  338. package/lib/core/bridge-writer.cjs +477 -0
  339. package/lib/core/cache-prune.cjs +314 -0
  340. package/lib/core/card-fire-gate.cjs +107 -0
  341. package/lib/core/card-fire-sidechannel.cjs +518 -0
  342. package/lib/core/chain-executor.cjs +939 -0
  343. package/lib/core/chain-retry.cjs +214 -0
  344. package/lib/core/chain-step-dispatcher.cjs +397 -0
  345. package/lib/core/chat-context-builder.cjs +253 -0
  346. package/lib/core/check-plugin-enabled.cjs +145 -0
  347. package/lib/core/close-loop-writer.cjs +492 -0
  348. package/lib/core/command-registration-check.cjs +246 -0
  349. package/lib/core/correlation-label-index.cjs +230 -0
  350. package/lib/core/correlation.cjs +112 -0
  351. package/lib/core/coverage-monitor.cjs +183 -0
  352. package/lib/core/coverage-rollup.cjs +232 -0
  353. package/lib/core/cross-room-aggregator.cjs +1127 -0
  354. package/lib/core/cross-room-store.cjs +292 -0
  355. package/lib/core/cross-room-triggers.cjs +222 -0
  356. package/lib/core/daily-briefing.cjs +438 -0
  357. package/lib/core/decision-axes.cjs +178 -0
  358. package/lib/core/decision-capture.cjs +618 -0
  359. package/lib/core/deck-design-rules.cjs +211 -0
  360. package/lib/core/deep-links.cjs +82 -0
  361. package/lib/core/directive-envelope.cjs +230 -0
  362. package/lib/core/directive-envelope.test.cjs +225 -0
  363. package/lib/core/dispatch-optimizer.cjs +354 -0
  364. package/lib/core/doc-text-extractor.cjs +133 -0
  365. package/lib/core/doctor/capability-ledger-module.cjs +170 -0
  366. package/lib/core/doctor/card-fire-health-module.cjs +159 -0
  367. package/lib/core/doctor/cascade-rooms-active-module.cjs +127 -0
  368. package/lib/core/doctor/cascade-rooms-module.cjs +184 -0
  369. package/lib/core/doctor/class-m-brain-smoke.cjs +479 -0
  370. package/lib/core/doctor/class-m-brain-smoke.test.cjs +448 -0
  371. package/lib/core/doctor/class-s-eureka-smoke.cjs +380 -0
  372. package/lib/core/doctor/deployment-surfaces-module.cjs +408 -0
  373. package/lib/core/doctor/deprecated-usage-module.cjs +155 -0
  374. package/lib/core/doctor/eureka-fts-health-module.cjs +236 -0
  375. package/lib/core/doctor/graph-derive-heal-retrofit-module.cjs +148 -0
  376. package/lib/core/doctor/graph-derive-health-module.cjs +486 -0
  377. package/lib/core/doctor/install-incomplete-module.cjs +320 -0
  378. package/lib/core/doctor/install-state-module.cjs +503 -0
  379. package/lib/core/doctor/mcp-surface-module.cjs +369 -0
  380. package/lib/core/doctor/mode-select-checkpoint-module.cjs +113 -0
  381. package/lib/core/doctor/plugin-enabled-state-module.cjs +86 -0
  382. package/lib/core/doctor/room-graph-density-module.cjs +181 -0
  383. package/lib/core/doctor/room-md-module.cjs +198 -0
  384. package/lib/core/doctor/shared.cjs +555 -0
  385. package/lib/core/doctor/stale-first-touch-copy-module.cjs +83 -0
  386. package/lib/core/doctor/statusline-visibility-module.cjs +295 -0
  387. package/lib/core/doctor/ui-compliance-module.cjs +223 -0
  388. package/lib/core/doctor/umbilical-module.cjs +486 -0
  389. package/lib/core/doctor/verify-surface-module.cjs +82 -0
  390. package/lib/core/doctor/voice-style-log-module.cjs +146 -0
  391. package/lib/core/domain-insight-sweep.cjs +224 -0
  392. package/lib/core/drift-baseline.cjs +362 -0
  393. package/lib/core/drift-runtime-reachability.cjs +283 -0
  394. package/lib/core/dual-path-detector.cjs +84 -0
  395. package/lib/core/dual-path-detector.test.cjs +334 -0
  396. package/lib/core/enrichment-queue.cjs +636 -0
  397. package/lib/core/eureka/ahp-weights.cjs +232 -0
  398. package/lib/core/eureka/analogy-fitness.cjs +326 -0
  399. package/lib/core/eureka/compression-meter.cjs +165 -0
  400. package/lib/core/eureka/embedding-classifier.cjs +226 -0
  401. package/lib/core/eureka/embedding-spine.cjs +563 -0
  402. package/lib/core/eureka/entity-classifier.cjs +232 -0
  403. package/lib/core/eureka/entity-extractor.cjs +356 -0
  404. package/lib/core/eureka/eureka-enable.cjs +228 -0
  405. package/lib/core/eureka/eureka-offer.cjs +225 -0
  406. package/lib/core/eureka/eureka-reach-runner.cjs +430 -0
  407. package/lib/core/eureka/explore-chain.cjs +834 -0
  408. package/lib/core/eureka/explored-artifact.cjs +456 -0
  409. package/lib/core/eureka/fts-index-lifecycle.cjs +265 -0
  410. package/lib/core/eureka/grade-grant-examine.cjs +544 -0
  411. package/lib/core/eureka/grade-grant.cjs +596 -0
  412. package/lib/core/eureka/hybrid-retrieve.cjs +256 -0
  413. package/lib/core/eureka/lateral-engine-adapter.cjs +118 -0
  414. package/lib/core/eureka/lexical-overlap.cjs +98 -0
  415. package/lib/core/eureka/online-pattern-query.cjs +142 -0
  416. package/lib/core/eureka/opportunity-harvest.cjs +752 -0
  417. package/lib/core/eureka/opportunity-statement.cjs +519 -0
  418. package/lib/core/eureka/portfolio-dimensions.cjs +255 -0
  419. package/lib/core/eureka/qualify-opportunity.cjs +607 -0
  420. package/lib/core/eureka/reasoning-mode.cjs +481 -0
  421. package/lib/core/eureka/report-html.cjs +368 -0
  422. package/lib/core/eureka/research-filing.cjs +547 -0
  423. package/lib/core/eureka/room-native-substrate.cjs +343 -0
  424. package/lib/core/eureka/tail-quadrant.cjs +177 -0
  425. package/lib/core/eureka/tri-modal-index.cjs +564 -0
  426. package/lib/core/eureka/vector-store.cjs +414 -0
  427. package/lib/core/eureka-critic.cjs +733 -0
  428. package/lib/core/eureka-deps-resolver.cjs +179 -0
  429. package/lib/core/expert-genesis.cjs +437 -0
  430. package/lib/core/expert-library.cjs +303 -0
  431. package/lib/core/exports-log.cjs +79 -0
  432. package/lib/core/feynman/ROOM.md +25 -0
  433. package/lib/core/feynman/dial-memory-renderer.cjs +279 -0
  434. package/lib/core/feynman/dial-memory-runner.cjs +173 -0
  435. package/lib/core/feynman/feynman-seed-writer.cjs +187 -0
  436. package/lib/core/feynman/timeline-renderer.cjs +197 -0
  437. package/lib/core/feynman/timeline-runner.cjs +281 -0
  438. package/lib/core/feynman-minto-invariants.cjs +609 -0
  439. package/lib/core/findings-wirer.cjs +360 -0
  440. package/lib/core/first-touch-version-stamper.cjs +113 -0
  441. package/lib/core/folder-memory-async.cjs +424 -0
  442. package/lib/core/folder-memory-shared.cjs +890 -0
  443. package/lib/core/folder-memory.cjs +546 -0
  444. package/lib/core/framework-chain-composer.cjs +583 -0
  445. package/lib/core/frontmatter-schemas.cjs +468 -0
  446. package/lib/core/fusion-router.cjs +540 -0
  447. package/lib/core/futures/causal-cue.cjs +91 -0
  448. package/lib/core/futures/orchestrator.cjs +1391 -0
  449. package/lib/core/futures/subsystem-render.cjs +164 -0
  450. package/lib/core/gate-relevance.cjs +278 -0
  451. package/lib/core/git-ops.cjs +141 -0
  452. package/lib/core/graph-backfill.cjs +562 -0
  453. package/lib/core/graph-candidate-producer.cjs +235 -0
  454. package/lib/core/graph-derivation.cjs +546 -0
  455. package/lib/core/graph-derive-classifier.cjs +352 -0
  456. package/lib/core/graph-ops.cjs +274 -0
  457. package/lib/core/graph-refine-loop.cjs +194 -0
  458. package/lib/core/graph-self-heal.cjs +289 -0
  459. package/lib/core/greeting-intent-detector.cjs +201 -0
  460. package/lib/core/grill-engine.cjs +459 -0
  461. package/lib/core/hat-persistence.cjs +274 -0
  462. package/lib/core/hsi-engine.cjs +439 -0
  463. package/lib/core/hsi-lsa.cjs +246 -0
  464. package/lib/core/hsi-spectral.cjs +554 -0
  465. package/lib/core/hsi-to-graph.test.cjs +168 -0
  466. package/lib/core/icm-forest.cjs +703 -0
  467. package/lib/core/ignite-branch-gate.cjs +66 -0
  468. package/lib/core/index.cjs +60 -0
  469. package/lib/core/insight-sensors.cjs +1000 -0
  470. package/lib/core/install-state.cjs +242 -0
  471. package/lib/core/integration-registry.cjs +232 -0
  472. package/lib/core/intel-pipeline.cjs +566 -0
  473. package/lib/core/intelligence-cascade.cjs +852 -0
  474. package/lib/core/issue-tree.cjs +269 -0
  475. package/lib/core/larry-thinness-acknowledgment.cjs +64 -0
  476. package/lib/core/larry-thinness-acknowledgment.test.cjs +97 -0
  477. package/lib/core/lazygraph-ops.cjs +1453 -0
  478. package/lib/core/lens-engine.cjs +434 -0
  479. package/lib/core/leverage-scan.cjs +218 -0
  480. package/lib/core/llm-name-suggester.cjs +194 -0
  481. package/lib/core/llm-name-suggester.test.cjs +132 -0
  482. package/lib/core/lru-cache.cjs +139 -0
  483. package/lib/core/mcp-dep-heal.cjs +475 -0
  484. package/lib/core/mcp-dep-heal.test.cjs +253 -0
  485. package/lib/core/mcp-profiles.cjs +185 -0
  486. package/lib/core/meeting-ops.cjs +54 -0
  487. package/lib/core/memory/governance-candidate-raiser.cjs +205 -0
  488. package/lib/core/memory/governance-candidate.cjs +95 -0
  489. package/lib/core/memory/reconcile-memory-runner.cjs +653 -0
  490. package/lib/core/memory-ops.cjs +641 -0
  491. package/lib/core/meter/gate-density-reader.cjs +112 -0
  492. package/lib/core/meter/transfer-reader.cjs +276 -0
  493. package/lib/core/meter/two-gauge.cjs +245 -0
  494. package/lib/core/methodology-ingest.cjs +346 -0
  495. package/lib/core/metrics/larryreach-loop-health.cjs +142 -0
  496. package/lib/core/migration-snapshot.cjs +287 -0
  497. package/lib/core/migration-snapshot.test.cjs +174 -0
  498. package/lib/core/migrations/ROOM.md +33 -0
  499. package/lib/core/migrations/phase-109-nodes-provenance.cjs +400 -0
  500. package/lib/core/migrations/phase-109-session-focus.cjs +99 -0
  501. package/lib/core/migrations/phase-160-nodes-bitemporal.cjs +168 -0
  502. package/lib/core/migrations/phase-160-nodes-bitemporal.test.cjs +140 -0
  503. package/lib/core/migrations/phase-162-section-nodes.cjs +156 -0
  504. package/lib/core/migrations/phase-222-ranker-weights.cjs +62 -0
  505. package/lib/core/migrations/phase-224-edge-review-status.cjs +87 -0
  506. package/lib/core/mindrian-brain-shim.test.cjs +221 -0
  507. package/lib/core/mode-select-sidechannel.cjs +259 -0
  508. package/lib/core/model-profiles.cjs +246 -0
  509. package/lib/core/mullins-scaffold.cjs +258 -0
  510. package/lib/core/mullins-scaffold.test.cjs +128 -0
  511. package/lib/core/mva-agent-contract.cjs +170 -0
  512. package/lib/core/mva-agent-contract.test.cjs +169 -0
  513. package/lib/core/mva-budget.cjs +75 -0
  514. package/lib/core/mva-budget.test.cjs +68 -0
  515. package/lib/core/mva-classifier.cjs +392 -0
  516. package/lib/core/mva-classifier.test.cjs +248 -0
  517. package/lib/core/mva-deck-builder.cjs +452 -0
  518. package/lib/core/mva-deck-builder.test.cjs +287 -0
  519. package/lib/core/mva-detect.smoke.test.cjs +209 -0
  520. package/lib/core/mva-dispatcher.cjs +110 -0
  521. package/lib/core/mva-dispatcher.test.cjs +216 -0
  522. package/lib/core/mva-option-router.cjs +414 -0
  523. package/lib/core/mva-option-router.test.cjs +483 -0
  524. package/lib/core/mva-orchestrator.cjs +365 -0
  525. package/lib/core/mva-orchestrator.test.cjs +916 -0
  526. package/lib/core/mva-progressive-renderer.cjs +194 -0
  527. package/lib/core/mva-progressive-renderer.test.cjs +157 -0
  528. package/lib/core/mva-rule-linter.cjs +458 -0
  529. package/lib/core/mva-rule-linter.test.cjs +484 -0
  530. package/lib/core/mva-state.cjs +159 -0
  531. package/lib/core/mva-telemetry.cjs +58 -0
  532. package/lib/core/mva-telemetry.test.cjs +196 -0
  533. package/lib/core/mva-vercel-deploy.cjs +168 -0
  534. package/lib/core/mva-vercel-deploy.test.cjs +239 -0
  535. package/lib/core/nav-dial.cjs +440 -0
  536. package/lib/core/navigation/ROOM.md +15 -0
  537. package/lib/core/navigation/abstraction-claim.cjs +185 -0
  538. package/lib/core/navigation/calibration-gate.cjs +284 -0
  539. package/lib/core/navigation/calibration-log.cjs +141 -0
  540. package/lib/core/navigation/confirm-node.cjs +73 -0
  541. package/lib/core/navigation/dashboard-helpers.cjs +145 -0
  542. package/lib/core/navigation/edges.cjs +1150 -0
  543. package/lib/core/navigation/evidence-claim.cjs +186 -0
  544. package/lib/core/navigation/explanation.cjs +48 -0
  545. package/lib/core/navigation/file-evidence-readback.cjs +242 -0
  546. package/lib/core/navigation/focus.cjs +155 -0
  547. package/lib/core/navigation/get-domains-for-trends.cjs +277 -0
  548. package/lib/core/navigation/governance.cjs +101 -0
  549. package/lib/core/navigation/grant-rubric.cjs +218 -0
  550. package/lib/core/navigation/graph-export.cjs +325 -0
  551. package/lib/core/navigation/ingestion.cjs +109 -0
  552. package/lib/core/navigation/insights-stale.test.cjs +127 -0
  553. package/lib/core/navigation/insights.cjs +574 -0
  554. package/lib/core/navigation/lens-nodes.cjs +315 -0
  555. package/lib/core/navigation/memory-artifacts.cjs +437 -0
  556. package/lib/core/navigation/memory-cortex-packet.cjs +274 -0
  557. package/lib/core/navigation/memory-events.cjs +811 -0
  558. package/lib/core/navigation/neighborhood.cjs +79 -0
  559. package/lib/core/navigation/packet.cjs +420 -0
  560. package/lib/core/navigation/planning-artifacts.cjs +219 -0
  561. package/lib/core/navigation/projections.cjs +295 -0
  562. package/lib/core/navigation/ranker-weights.cjs +133 -0
  563. package/lib/core/navigation/reasoning-write.cjs +211 -0
  564. package/lib/core/navigation/reconcile-guard.cjs +98 -0
  565. package/lib/core/navigation/reified-claim.cjs +287 -0
  566. package/lib/core/navigation/research-preflight.cjs +156 -0
  567. package/lib/core/navigation/room-birth.cjs +1213 -0
  568. package/lib/core/navigation/room-context.cjs +380 -0
  569. package/lib/core/navigation/room-home.cjs +142 -0
  570. package/lib/core/navigation/spine-events.cjs +548 -0
  571. package/lib/core/navigation/synthetic-expert.cjs +177 -0
  572. package/lib/core/navigation/transitions.cjs +253 -0
  573. package/lib/core/navigation/typed-claim.cjs +208 -0
  574. package/lib/core/navigation/typed-domain.cjs +249 -0
  575. package/lib/core/navigation/typed-entity.cjs +236 -0
  576. package/lib/core/navigation/typed-frame.cjs +257 -0
  577. package/lib/core/navigation/typed-open-question.cjs +130 -0
  578. package/lib/core/navigation/typed-opportunity.cjs +418 -0
  579. package/lib/core/navigation-engine-offer.cjs +776 -0
  580. package/lib/core/navigation-engine-shared.cjs +256 -0
  581. package/lib/core/navigation-engine.cjs +1696 -0
  582. package/lib/core/navigation.cjs +686 -0
  583. package/lib/core/nl-graph-queries.cjs +164 -0
  584. package/lib/core/node-insert-epistemic.test.cjs +212 -0
  585. package/lib/core/node-insert-overrides.test.cjs +273 -0
  586. package/lib/core/node-insert.cjs +274 -0
  587. package/lib/core/npm-cli-resolve.cjs +151 -0
  588. package/lib/core/npm-cli-resolve.test.cjs +153 -0
  589. package/lib/core/npm-install-lock.cjs +326 -0
  590. package/lib/core/npm-install-lock.test.cjs +379 -0
  591. package/lib/core/numeric/sklearn-stopwords-v1.json +325 -0
  592. package/lib/core/numeric/svd.cjs +377 -0
  593. package/lib/core/numeric/tfidf.cjs +241 -0
  594. package/lib/core/offer-presenter.cjs +406 -0
  595. package/lib/core/opportunity-extractor.cjs +183 -0
  596. package/lib/core/opportunity-ops.cjs +1423 -0
  597. package/lib/core/orchestration-candidate-lift.cjs +284 -0
  598. package/lib/core/part8-egress-guard.cjs +563 -0
  599. package/lib/core/part8-egress-guard.test.cjs +194 -0
  600. package/lib/core/part8-egress-ontology.cjs +174 -0
  601. package/lib/core/part8-egress-ontology.test.cjs +133 -0
  602. package/lib/core/persona-ops.cjs +692 -0
  603. package/lib/core/persona-override.cjs +327 -0
  604. package/lib/core/persona-taxonomy.cjs +328 -0
  605. package/lib/core/pinecone-inference.cjs +176 -0
  606. package/lib/core/pitch-feedback-schemas.cjs +303 -0
  607. package/lib/core/planning/artifact-brain-packet.cjs +212 -0
  608. package/lib/core/planning/reconcile-runner.cjs +347 -0
  609. package/lib/core/platform-gates.cjs +120 -0
  610. package/lib/core/platform.cjs +257 -0
  611. package/lib/core/proactive-intelligence.cjs +528 -0
  612. package/lib/core/problem-type-router.cjs +315 -0
  613. package/lib/core/publish-needs-default-lane.cjs +110 -0
  614. package/lib/core/ralph-loop-gate.cjs +48 -0
  615. package/lib/core/reader/ab-harness.cjs +177 -0
  616. package/lib/core/reader/decide-projection-reader.cjs +358 -0
  617. package/lib/core/reasoning-ops.cjs +639 -0
  618. package/lib/core/recipe-maps.cjs +442 -0
  619. package/lib/core/recovery/case-file.cjs +358 -0
  620. package/lib/core/recovery/controller.cjs +1008 -0
  621. package/lib/core/recovery/dispatcher.cjs +533 -0
  622. package/lib/core/recovery/result-semantics.cjs +488 -0
  623. package/lib/core/recovery/stage-envelope.cjs +338 -0
  624. package/lib/core/refusal-messaging.cjs +569 -0
  625. package/lib/core/refusal-messaging.test.cjs +220 -0
  626. package/lib/core/repo-version.cjs +134 -0
  627. package/lib/core/research-cache.cjs +165 -0
  628. package/lib/core/research-cache.test.cjs +137 -0
  629. package/lib/core/research-context-extractor.cjs +283 -0
  630. package/lib/core/research-corpus.cjs +814 -0
  631. package/lib/core/research-corpus.test.cjs +280 -0
  632. package/lib/core/research-filing-selector.cjs +189 -0
  633. package/lib/core/resolve-active-room.cjs +602 -0
  634. package/lib/core/resolve-brain-key.cjs +273 -0
  635. package/lib/core/resolve-umbilical-target.cjs +288 -0
  636. package/lib/core/resolve-vercel-key.cjs +107 -0
  637. package/lib/core/resolve-vercel-key.test.cjs +137 -0
  638. package/lib/core/reverse-salient-persona-suffix.cjs +115 -0
  639. package/lib/core/room-auto-create.cjs +318 -0
  640. package/lib/core/room-auto-create.test.cjs +198 -0
  641. package/lib/core/room-chooser.cjs +244 -0
  642. package/lib/core/room-classifier-strict-mode.cjs +235 -0
  643. package/lib/core/room-db.cjs +348 -0
  644. package/lib/core/room-discard-cascade.cjs +238 -0
  645. package/lib/core/room-discard-cascade.test.cjs +135 -0
  646. package/lib/core/room-name-validator.cjs +132 -0
  647. package/lib/core/room-name-validator.test.cjs +156 -0
  648. package/lib/core/room-naming-selector.cjs +357 -0
  649. package/lib/core/room-naming-selector.test.cjs +277 -0
  650. package/lib/core/room-open.cjs +259 -0
  651. package/lib/core/room-ops-async.cjs +92 -0
  652. package/lib/core/room-ops-shared.cjs +64 -0
  653. package/lib/core/room-ops-sync.cjs +70 -0
  654. package/lib/core/room-ops.cjs +32 -0
  655. package/lib/core/room-receipt-emit.cjs +63 -0
  656. package/lib/core/room-root.cjs +93 -0
  657. package/lib/core/room-skeleton-scaffold.cjs +669 -0
  658. package/lib/core/room-skeleton-scaffold.test.cjs +296 -0
  659. package/lib/core/room-type-detector.cjs +386 -0
  660. package/lib/core/rs-backend-dispatch.cjs +64 -0
  661. package/lib/core/rs-brain-substrate-prompts.cjs +129 -0
  662. package/lib/core/rs-brain-substrate.cjs +570 -0
  663. package/lib/core/rs-breakthrough-scorer.cjs +255 -0
  664. package/lib/core/rs-canon-violations.cjs +82 -0
  665. package/lib/core/rs-chain-feeder.cjs +381 -0
  666. package/lib/core/rs-commercial-assessor.cjs +280 -0
  667. package/lib/core/rs-corpus-quality-gate.cjs +62 -0
  668. package/lib/core/rs-differential-scorer.cjs +629 -0
  669. package/lib/core/rs-domain-analyzer.cjs +385 -0
  670. package/lib/core/rs-egress-prompts.cjs +113 -0
  671. package/lib/core/rs-egress-telemetry.cjs +225 -0
  672. package/lib/core/rs-egress-violations.cjs +53 -0
  673. package/lib/core/rs-engine.cjs +597 -0
  674. package/lib/core/rs-expert-brain-projection.cjs +280 -0
  675. package/lib/core/rs-expert-mapper.cjs +467 -0
  676. package/lib/core/rs-fetcher-academic.cjs +697 -0
  677. package/lib/core/rs-fetcher-experts.cjs +314 -0
  678. package/lib/core/rs-fetcher-industry.cjs +731 -0
  679. package/lib/core/rs-fetcher-patents.cjs +564 -0
  680. package/lib/core/rs-innovation-classifier.cjs +194 -0
  681. package/lib/core/rs-math.cjs +458 -0
  682. package/lib/core/rs-mind-map.cjs +656 -0
  683. package/lib/core/rs-neo4j-writer.cjs +388 -0
  684. package/lib/core/rs-nl-to-query.cjs +435 -0
  685. package/lib/core/rs-pinecone-bridge.cjs +344 -0
  686. package/lib/core/rs-preprocessor.cjs +350 -0
  687. package/lib/core/rs-query-matrix.cjs +316 -0
  688. package/lib/core/rs-query-to-text.cjs +438 -0
  689. package/lib/core/rs-sqlite-mirror.cjs +495 -0
  690. package/lib/core/rs-thesis-generator.cjs +188 -0
  691. package/lib/core/rs_cache.py +635 -0
  692. package/lib/core/rs_corpus.py +562 -0
  693. package/lib/core/rs_corpus_exclude.py +62 -0
  694. package/lib/core/rs_hybrid.py +589 -0
  695. package/lib/core/rs_math.py +287 -0
  696. package/lib/core/rs_rooms.py +196 -0
  697. package/lib/core/salient-governance.cjs +315 -0
  698. package/lib/core/scheduled-scanner.cjs +658 -0
  699. package/lib/core/scratchpad-ops.cjs +316 -0
  700. package/lib/core/seam-liveness.cjs +191 -0
  701. package/lib/core/seam-liveness.test.cjs +177 -0
  702. package/lib/core/section-8-trace-schema.cjs +138 -0
  703. package/lib/core/section-registry.cjs +167 -0
  704. package/lib/core/security/agentshield-adapters.test.cjs +104 -0
  705. package/lib/core/security/agentshield-run.cjs +343 -0
  706. package/lib/core/security/agentshield-scanner.cjs +314 -0
  707. package/lib/core/security/agentshield-scanner.test.cjs +259 -0
  708. package/lib/core/sensors/hat-scoping-table.cjs +103 -0
  709. package/lib/core/sensors/sensor-circularity.cjs +278 -0
  710. package/lib/core/sensors/sensor-content-relevance.cjs +407 -0
  711. package/lib/core/sensors/sensor-diffusion-adoption.cjs +230 -0
  712. package/lib/core/sensors/sensor-eureka.cjs +208 -0
  713. package/lib/core/sensors/sensor-expert-skill.cjs +293 -0
  714. package/lib/core/sensors/sensor-external-fact.cjs +184 -0
  715. package/lib/core/sensors/sensor-gate-approach.cjs +104 -0
  716. package/lib/core/sensors/sensor-jtbd-reweight.cjs +141 -0
  717. package/lib/core/sensors/sensor-lagging-component.cjs +115 -0
  718. package/lib/core/sensors/sensor-memory-cortex.cjs +111 -0
  719. package/lib/core/sensors/sensor-methodology-decision.cjs +131 -0
  720. package/lib/core/sensors/sensor-opportunity-harvest.cjs +195 -0
  721. package/lib/core/sensors/sensor-perspective-lock.cjs +174 -0
  722. package/lib/core/sensors/sensor-priority.cjs +183 -0
  723. package/lib/core/sensors/sensor-recency.cjs +151 -0
  724. package/lib/core/sensors/sensor-roadmap-type.cjs +421 -0
  725. package/lib/core/sensors/sensor-room-pick.cjs +238 -0
  726. package/lib/core/sensors/sensor-show-share.cjs +215 -0
  727. package/lib/core/sensors/sensor-temporal-blindness.cjs +123 -0
  728. package/lib/core/sensors/sensor-types.cjs +294 -0
  729. package/lib/core/sensors/sensor-url-ingest.cjs +234 -0
  730. package/lib/core/session-binding.cjs +208 -0
  731. package/lib/core/session-presence.cjs +404 -0
  732. package/lib/core/session-register.cjs +138 -0
  733. package/lib/core/session-state.cjs +144 -0
  734. package/lib/core/shallow-doc-parser.cjs +353 -0
  735. package/lib/core/shallow-doc-parser.test.cjs +226 -0
  736. package/lib/core/skill-activation-router.cjs +284 -0
  737. package/lib/core/skillopt-schemas.cjs +509 -0
  738. package/lib/core/stale-copy-scanner.cjs +190 -0
  739. package/lib/core/stance-state.cjs +153 -0
  740. package/lib/core/state-aware-router.cjs +78 -0
  741. package/lib/core/state-ops.cjs +80 -0
  742. package/lib/core/state-version.cjs +350 -0
  743. package/lib/core/statusline-cache.cjs +266 -0
  744. package/lib/core/statusline-liveness-gate.cjs +105 -0
  745. package/lib/core/surface-fence.cjs +127 -0
  746. package/lib/core/synthesizers/comparison-matrix.cjs +82 -0
  747. package/lib/core/synthesizers/convergence-map.cjs +107 -0
  748. package/lib/core/synthesizers/domain-hierarchy.cjs +138 -0
  749. package/lib/core/synthesizers/source-comparison.cjs +56 -0
  750. package/lib/core/synthesizers/tension-map.cjs +119 -0
  751. package/lib/core/synthetic-expert-behavior-gate.cjs +99 -0
  752. package/lib/core/synthetic-expert-construction-gate.cjs +170 -0
  753. package/lib/core/telemetry/schema.cjs +168 -0
  754. package/lib/core/telemetry/schema.test.cjs +124 -0
  755. package/lib/core/telemetry/validator.cjs +200 -0
  756. package/lib/core/telemetry/validator.test.cjs +188 -0
  757. package/lib/core/telemetry/writer.cjs +141 -0
  758. package/lib/core/telemetry/writer.test.cjs +331 -0
  759. package/lib/core/temporal/date-sync-gate.cjs +256 -0
  760. package/lib/core/temporal/date-sync-gate.test.cjs +191 -0
  761. package/lib/core/temporal/dual-stamp.cjs +172 -0
  762. package/lib/core/temporal/dual-stamp.test.cjs +172 -0
  763. package/lib/core/temporal/point-in-time.cjs +76 -0
  764. package/lib/core/temporal/point-in-time.test.cjs +169 -0
  765. package/lib/core/temporal/recency-decay.cjs +119 -0
  766. package/lib/core/temporal/recency-decay.test.cjs +140 -0
  767. package/lib/core/temporal/reference-now.cjs +281 -0
  768. package/lib/core/temporal/reference-now.test.cjs +225 -0
  769. package/lib/core/temporal/resolve-relative-time.cjs +116 -0
  770. package/lib/core/temporal/resolve-relative-time.test.cjs +138 -0
  771. package/lib/core/temporal/supersession.cjs +250 -0
  772. package/lib/core/temporal/supersession.test.cjs +103 -0
  773. package/lib/core/terminal-capability.cjs +88 -0
  774. package/lib/core/token-estimator.cjs +348 -0
  775. package/lib/core/tone-filter.cjs +147 -0
  776. package/lib/core/trending-to-absurd/orchestrator.cjs +341 -0
  777. package/lib/core/trending-to-absurd/stage7-roadmap.cjs +317 -0
  778. package/lib/core/trending-to-absurd/variance.cjs +169 -0
  779. package/lib/core/unknowns/bandit.cjs +332 -0
  780. package/lib/core/unknowns/corpus-adapter.cjs +327 -0
  781. package/lib/core/unknowns/dsp.cjs +356 -0
  782. package/lib/core/unknowns/edge-writer.cjs +211 -0
  783. package/lib/core/unknowns/iface.cjs +212 -0
  784. package/lib/core/unknowns/orchestrator.cjs +375 -0
  785. package/lib/core/unknowns/pattern-miner.cjs +214 -0
  786. package/lib/core/unknowns/rumsfeld-matrix.cjs +155 -0
  787. package/lib/core/unknowns/verdict.cjs +254 -0
  788. package/lib/core/update-path.cjs +57 -0
  789. package/lib/core/url-ingest.cjs +568 -0
  790. package/lib/core/user-archetype.cjs +284 -0
  791. package/lib/core/user-md-ops.cjs +578 -0
  792. package/lib/core/venture-shape-nudge.cjs +178 -0
  793. package/lib/core/venture-shape-nudge.test.cjs +266 -0
  794. package/lib/core/verb-reach-affinity.cjs +299 -0
  795. package/lib/core/visual-ops.cjs +692 -0
  796. package/lib/core/voice-transition-detector.cjs +125 -0
  797. package/lib/core/watched-sources.cjs +237 -0
  798. package/lib/core/write-lock.cjs +149 -0
  799. package/lib/graph/canvas-graph.js +467 -0
  800. package/lib/graph/constellation-config.cjs +299 -0
  801. package/lib/graph/graph-detail-panel.js +165 -0
  802. package/lib/hmi/ROOM.md +47 -0
  803. package/lib/hmi/across-session-memory.cjs +669 -0
  804. package/lib/hmi/agentshield-drift-gate.cjs +142 -0
  805. package/lib/hmi/brain-review-packet.cjs +221 -0
  806. package/lib/hmi/cortex-reach-adapter.cjs +271 -0
  807. package/lib/hmi/cross-room-memory.cjs +618 -0
  808. package/lib/hmi/decoy-tier.cjs +395 -0
  809. package/lib/hmi/depth-state.cjs +164 -0
  810. package/lib/hmi/dial-label-composer.cjs +410 -0
  811. package/lib/hmi/dial-presenter.cjs +508 -0
  812. package/lib/hmi/dial-reach-orchestrator.cjs +377 -0
  813. package/lib/hmi/dial-selector.cjs +239 -0
  814. package/lib/hmi/f1-pick-capture-cli.cjs +131 -0
  815. package/lib/hmi/f3-depth-capture-cli.cjs +77 -0
  816. package/lib/hmi/f4-scope-capture-cli.cjs +86 -0
  817. package/lib/hmi/f8-action-capture-cli.cjs +145 -0
  818. package/lib/hmi/f8-capture.test.cjs +77 -0
  819. package/lib/hmi/f9-ordered-capture-cli.cjs +138 -0
  820. package/lib/hmi/harvest-scope-state.cjs +202 -0
  821. package/lib/hmi/hats-persona-cache.cjs +142 -0
  822. package/lib/hmi/jtbd-classifier.cjs +219 -0
  823. package/lib/hmi/jtbd-state.cjs +263 -0
  824. package/lib/hmi/jtbd-taxonomy.json +402 -0
  825. package/lib/hmi/mindrian-ascii-logo.cjs +96 -0
  826. package/lib/hmi/part8-egress-gate.cjs +149 -0
  827. package/lib/hmi/reach-component-map.json +47 -0
  828. package/lib/hmi/reach-relevance-gate.cjs +147 -0
  829. package/lib/hmi/selector-dispatcher.cjs +1201 -0
  830. package/lib/hmi/selector-dispatcher.test.cjs +141 -0
  831. package/lib/hmi/selector-telemetry.cjs +269 -0
  832. package/lib/hmi/shape-f0-renderer.cjs +145 -0
  833. package/lib/hmi/shape-f1-fallback.cjs +80 -0
  834. package/lib/hmi/shape-f1-renderer.cjs +219 -0
  835. package/lib/hmi/shape-f2-renderer.cjs +132 -0
  836. package/lib/hmi/shape-f3-parity.test.cjs +64 -0
  837. package/lib/hmi/shape-f3-renderer.cjs +66 -0
  838. package/lib/hmi/shape-f4-parity.test.cjs +72 -0
  839. package/lib/hmi/shape-f4-renderer.cjs +72 -0
  840. package/lib/hmi/shape-f5-renderer.cjs +155 -0
  841. package/lib/hmi/shape-f6-plan-review-renderer.cjs +324 -0
  842. package/lib/hmi/shape-f6-renderer.cjs +144 -0
  843. package/lib/hmi/shape-f7-breakthrough-renderer.cjs +234 -0
  844. package/lib/hmi/shape-f7-breakthrough-renderer.test.cjs +233 -0
  845. package/lib/hmi/shape-f8-renderer.cjs +150 -0
  846. package/lib/hmi/shape-f8-renderer.test.cjs +70 -0
  847. package/lib/hmi/shape-f9-renderer.cjs +187 -0
  848. package/lib/hmi/shape-f9-renderer.test.cjs +80 -0
  849. package/lib/hmi/shape-g-renderer.cjs +219 -0
  850. package/lib/hmi/shape-h-renderer.cjs +222 -0
  851. package/lib/hmi/tier-check.cjs +63 -0
  852. package/lib/hmi/turn-text.cjs +268 -0
  853. package/lib/hmi/voice-color-mark.cjs +318 -0
  854. package/lib/hmi/voice-style-log.cjs +276 -0
  855. package/lib/import/PRECONDITIONS.md +41 -0
  856. package/lib/import/branding.cjs +210 -0
  857. package/lib/import/branding.test.cjs +235 -0
  858. package/lib/import/classifications-sync.cjs +104 -0
  859. package/lib/import/classifications-sync.test.cjs +129 -0
  860. package/lib/import/enricher.cjs +296 -0
  861. package/lib/import/enricher.test.cjs +273 -0
  862. package/lib/import/integration.test.cjs +376 -0
  863. package/lib/import/manifest.cjs +129 -0
  864. package/lib/import/manifest.schema.json +185 -0
  865. package/lib/import/manifest.test.cjs +123 -0
  866. package/lib/import/meeting-detector.cjs +92 -0
  867. package/lib/import/meeting-detector.test.cjs +100 -0
  868. package/lib/import/person-detector.cjs +229 -0
  869. package/lib/import/person-detector.test.cjs +149 -0
  870. package/lib/import/report.cjs +186 -0
  871. package/lib/import/report.test.cjs +186 -0
  872. package/lib/import/room-md-scaffolder.cjs +49 -0
  873. package/lib/import/router.cjs +224 -0
  874. package/lib/import/router.test.cjs +356 -0
  875. package/lib/import/run-all-tests.cjs +36 -0
  876. package/lib/import/smoke-test.cjs +213 -0
  877. package/lib/import/smoke-test.test.cjs +148 -0
  878. package/lib/import/undo.test.cjs +199 -0
  879. package/lib/import/vault-scanner.cjs +105 -0
  880. package/lib/import/vault-scanner.test.cjs +67 -0
  881. package/lib/lens-engine/correlation-resolver.cjs +174 -0
  882. package/lib/lens-engine/source-lens-driver.cjs +736 -0
  883. package/lib/mcp/adapter-client.cjs +103 -0
  884. package/lib/mcp/app-html/dashboard.html +316 -0
  885. package/lib/mcp/app-html/graph.html +428 -0
  886. package/lib/mcp/app-html/mindrian-platform.html +1841 -0
  887. package/lib/mcp/app-html/wiki.html +383 -0
  888. package/lib/mcp/app-views.cjs +322 -0
  889. package/lib/mcp/brain-composition-census.cjs +184 -0
  890. package/lib/mcp/brain-router.cjs +551 -0
  891. package/lib/mcp/capability-registry.cjs +62 -0
  892. package/lib/mcp/contract-version.cjs +59 -0
  893. package/lib/mcp/daemon-lifecycle.cjs +324 -0
  894. package/lib/mcp/gate-dedup.cjs +120 -0
  895. package/lib/mcp/gate-ledger.cjs +145 -0
  896. package/lib/mcp/gate-render.cjs +483 -0
  897. package/lib/mcp/hook-adapter-audit.cjs +199 -0
  898. package/lib/mcp/larry-context.cjs +42 -0
  899. package/lib/mcp/mcp-first-flag.cjs +147 -0
  900. package/lib/mcp/no-instructions.test.cjs +270 -0
  901. package/lib/mcp/pipeline-state.cjs +424 -0
  902. package/lib/mcp/prompts.cjs +421 -0
  903. package/lib/mcp/register-core-tools.cjs +78 -0
  904. package/lib/mcp/resources.cjs +359 -0
  905. package/lib/mcp/runtime-instructions.cjs +38 -0
  906. package/lib/mcp/session-catchup.cjs +349 -0
  907. package/lib/mcp/session-registry.cjs +113 -0
  908. package/lib/mcp/session-room.cjs +124 -0
  909. package/lib/mcp/sse-event-bus.cjs +98 -0
  910. package/lib/mcp/stop-gate-handler.cjs +589 -0
  911. package/lib/mcp/surface-detect.cjs +186 -0
  912. package/lib/mcp/tool-router.cjs +2115 -0
  913. package/lib/mcp/tools/chain.cjs +674 -0
  914. package/lib/mcp/tools/claim.cjs +180 -0
  915. package/lib/mcp/tools/context.cjs +92 -0
  916. package/lib/mcp/tools/dual-path.cjs +79 -0
  917. package/lib/mcp/tools/gate.cjs +392 -0
  918. package/lib/mcp/tools/graph-reason.cjs +130 -0
  919. package/lib/mcp/tools/graph.cjs +321 -0
  920. package/lib/mcp/tools/identity.cjs +174 -0
  921. package/lib/mcp/tools/room.cjs +449 -0
  922. package/lib/mcp/tools/sensors.cjs +450 -0
  923. package/lib/mcp/tools/status.cjs +183 -0
  924. package/lib/mcp/tools/stop-gate.cjs +103 -0
  925. package/lib/mcp/tools/views.cjs +382 -0
  926. package/lib/mcp/tree-watcher.cjs +199 -0
  927. package/lib/memory/.mindrian/auto-explore-mat-test-001.json +11 -0
  928. package/lib/memory/aaak-compress.cjs +403 -0
  929. package/lib/memory/aaak-compress.test.cjs +288 -0
  930. package/lib/memory/async-artifact-auto-commit.test.cjs +223 -0
  931. package/lib/memory/bearer-token.test.cjs +315 -0
  932. package/lib/memory/body-shape-coverage.test.cjs +268 -0
  933. package/lib/memory/brain-cache-lru.test.cjs +259 -0
  934. package/lib/memory/brain-client-query-shape.test.cjs +160 -0
  935. package/lib/memory/brain-cypher-chain-slice.test.cjs +368 -0
  936. package/lib/memory/brain-derivation-graceful-degradation.test.cjs +1019 -0
  937. package/lib/memory/brain-derivation-queue.test.cjs +553 -0
  938. package/lib/memory/brain-derivation.test.cjs +639 -0
  939. package/lib/memory/brain-derive-command.test.cjs +534 -0
  940. package/lib/memory/brain-derive-curation.test.cjs +243 -0
  941. package/lib/memory/brain-md-invariants-validator.test.cjs +704 -0
  942. package/lib/memory/brain-md-schema.test.cjs +467 -0
  943. package/lib/memory/brain-md-staleness.test.cjs +525 -0
  944. package/lib/memory/brain-server-resolution.test.cjs +314 -0
  945. package/lib/memory/brain-suggestion-template.test.cjs +200 -0
  946. package/lib/memory/chain-recommender-canonical.test.cjs +208 -0
  947. package/lib/memory/chain-recommender.test.cjs +233 -0
  948. package/lib/memory/chat-context.test.cjs +128 -0
  949. package/lib/memory/command-registry.test.cjs +220 -0
  950. package/lib/memory/connector-registry.test.cjs +94 -0
  951. package/lib/memory/correlation-label-index.test.cjs +119 -0
  952. package/lib/memory/correlation.test.cjs +253 -0
  953. package/lib/memory/cross-room-aggregator.test.cjs +909 -0
  954. package/lib/memory/curation-132-03-dedup-held-rename.test.cjs +251 -0
  955. package/lib/memory/curation-132-05-pseudonymize.test.cjs +205 -0
  956. package/lib/memory/curation-batch.test.cjs +213 -0
  957. package/lib/memory/dashboard-server.test.cjs +256 -0
  958. package/lib/memory/debouncer-drain-at-prompt.test.cjs +389 -0
  959. package/lib/memory/decision-capture.test.cjs +632 -0
  960. package/lib/memory/decision-capture.worker.cjs +70 -0
  961. package/lib/memory/doctor-deprecation-surface.test.cjs +188 -0
  962. package/lib/memory/dual-graph-health.test.cjs +485 -0
  963. package/lib/memory/explain-decision-command.test.cjs +521 -0
  964. package/lib/memory/explain-decision-footer.test.cjs +316 -0
  965. package/lib/memory/explored-materials-store.cjs +392 -0
  966. package/lib/memory/f-selector-ranker.test.cjs +593 -0
  967. package/lib/memory/feynman-minto-guardian.test.cjs +863 -0
  968. package/lib/memory/feynman-minto-invariants.test.cjs +554 -0
  969. package/lib/memory/feynman-prompts-drift.test.cjs +144 -0
  970. package/lib/memory/feynman-prompts.cjs +151 -0
  971. package/lib/memory/feynman-prompts.test.cjs +96 -0
  972. package/lib/memory/first-touch-version.test.cjs +198 -0
  973. package/lib/memory/folder-memory-quadruple.test.cjs +548 -0
  974. package/lib/memory/folder-memory.test.cjs +503 -0
  975. package/lib/memory/framework-chain-composer.test.cjs +549 -0
  976. package/lib/memory/frontmatter-schema-validator.test.cjs +344 -0
  977. package/lib/memory/guardian-onstop-reaches-user.test.cjs +396 -0
  978. package/lib/memory/heal-command.test.cjs +604 -0
  979. package/lib/memory/help-coverage.test.cjs +108 -0
  980. package/lib/memory/help-renderer.test.cjs +145 -0
  981. package/lib/memory/huji-run-one-async-parity.test.cjs +242 -0
  982. package/lib/memory/hypergraph-event-schema.test.cjs +116 -0
  983. package/lib/memory/index-artifact-transaction.test.cjs +333 -0
  984. package/lib/memory/lazygraph-rs-discoveries-view.test.cjs +122 -0
  985. package/lib/memory/local-chain-recommender.test.cjs +172 -0
  986. package/lib/memory/mcp-input-validation.test.cjs +240 -0
  987. package/lib/memory/mcp-server-brain-deps.test.cjs +270 -0
  988. package/lib/memory/mcp-stack-fallback.test.cjs +433 -0
  989. package/lib/memory/minto-debounce-consumer-census.test.cjs +567 -0
  990. package/lib/memory/minto-debouncer.test.cjs +407 -0
  991. package/lib/memory/minto-debouncer.worker.cjs +46 -0
  992. package/lib/memory/minto-migration-v88.test.cjs +265 -0
  993. package/lib/memory/minto-schema-v88.test.cjs +390 -0
  994. package/lib/memory/mos-status-renderer.test.cjs +631 -0
  995. package/lib/memory/narrative-schema.cjs +376 -0
  996. package/lib/memory/narrative-schema.test.cjs +209 -0
  997. package/lib/memory/nav-dial.test.cjs +414 -0
  998. package/lib/memory/navigation-engine-core.test.cjs +712 -0
  999. package/lib/memory/navigation-engine-offer.test.cjs +404 -0
  1000. package/lib/memory/navigation-hook-resolver.test.cjs +177 -0
  1001. package/lib/memory/navigation-invariants.test.cjs +483 -0
  1002. package/lib/memory/navigation-projections.test.cjs +241 -0
  1003. package/lib/memory/navigation-write-edge.test.cjs +206 -0
  1004. package/lib/memory/offer-closer.test.cjs +258 -0
  1005. package/lib/memory/offer-presenter.test.cjs +554 -0
  1006. package/lib/memory/on-stop-snapshot.test.cjs +404 -0
  1007. package/lib/memory/orchestration-projection.test.cjs +706 -0
  1008. package/lib/memory/packet-chain-hint.test.cjs +407 -0
  1009. package/lib/memory/packet-schema-validation.test.cjs +317 -0
  1010. package/lib/memory/palette-consistency.test.cjs +127 -0
  1011. package/lib/memory/pending-tension-store.cjs +453 -0
  1012. package/lib/memory/per-command-jtbd-derivation.test.cjs +130 -0
  1013. package/lib/memory/per-command-teaching.test.cjs +110 -0
  1014. package/lib/memory/post-compact-reinjection.test.cjs +854 -0
  1015. package/lib/memory/post-write-triple.test.cjs +317 -0
  1016. package/lib/memory/pre-compact-snapshot.test.cjs +495 -0
  1017. package/lib/memory/precommit-real-commit.test.cjs +301 -0
  1018. package/lib/memory/problem-type-router.test.cjs +656 -0
  1019. package/lib/memory/query-efficiency-telemetry.test.cjs +612 -0
  1020. package/lib/memory/recompile-room-references.test.cjs +392 -0
  1021. package/lib/memory/recompile-room-references.worker.cjs +42 -0
  1022. package/lib/memory/record-decision-dual-write.test.cjs +454 -0
  1023. package/lib/memory/render-v2-disposition.test.cjs +199 -0
  1024. package/lib/memory/room-classifier-strict-mode.test.cjs +430 -0
  1025. package/lib/memory/room-minto-hook.test.cjs +398 -0
  1026. package/lib/memory/rs-discovery-engine.test.cjs +323 -0
  1027. package/lib/memory/run-feynman-tests.cjs +2101 -0
  1028. package/lib/memory/security-trifecta.test.cjs +329 -0
  1029. package/lib/memory/selector-alias-map.test.cjs +172 -0
  1030. package/lib/memory/selector-decisions.test.cjs +417 -0
  1031. package/lib/memory/selector-miss.test.cjs +290 -0
  1032. package/lib/memory/session-start-brain-staleness.test.cjs +363 -0
  1033. package/lib/memory/session-start-triple-injection.test.cjs +514 -0
  1034. package/lib/memory/sessionstart-banner-formatter.cjs +318 -0
  1035. package/lib/memory/sessionstart-coordinator.test.cjs +446 -0
  1036. package/lib/memory/sessionstart-minto-banner.test.cjs +373 -0
  1037. package/lib/memory/skill-activation-router.test.cjs +465 -0
  1038. package/lib/memory/skill-vs-code-drift.test.cjs +257 -0
  1039. package/lib/memory/soft-alias.test.cjs +144 -0
  1040. package/lib/memory/spine-events-correlation.test.cjs +198 -0
  1041. package/lib/memory/stale-copy-scanner.test.cjs +294 -0
  1042. package/lib/memory/stamp-artifact-write.test.cjs +304 -0
  1043. package/lib/memory/state-aware-router.test.cjs +90 -0
  1044. package/lib/memory/statusline-active-room-write.test.cjs +245 -0
  1045. package/lib/memory/statusline-active-room.test.cjs +315 -0
  1046. package/lib/memory/statusline-minto-segment.test.cjs +292 -0
  1047. package/lib/memory/statusline-two-row.test.cjs +338 -0
  1048. package/lib/memory/suggest-next-workflow.test.cjs +176 -0
  1049. package/lib/memory/sync-async-entry-points.test.cjs +204 -0
  1050. package/lib/memory/terminal-capability.test.cjs +155 -0
  1051. package/lib/memory/test-bridge-writer-enhanced.cjs +452 -0
  1052. package/lib/memory/test-rs-brain-substrate-shape.cjs +529 -0
  1053. package/lib/memory/test-rs-brain-substrate.cjs +636 -0
  1054. package/lib/memory/test-rs-breakthrough-scorer.cjs +375 -0
  1055. package/lib/memory/test-rs-canon-violations.cjs +218 -0
  1056. package/lib/memory/test-rs-chain-feeder-core.cjs +344 -0
  1057. package/lib/memory/test-rs-chain-feeder-skill-spawn.cjs +297 -0
  1058. package/lib/memory/test-rs-commercial-assessor.cjs +385 -0
  1059. package/lib/memory/test-rs-differential-scorer.cjs +480 -0
  1060. package/lib/memory/test-rs-discovery-engine.cjs +648 -0
  1061. package/lib/memory/test-rs-domain-analyzer.cjs +492 -0
  1062. package/lib/memory/test-rs-egress-primitives.cjs +420 -0
  1063. package/lib/memory/test-rs-expert-mapper.cjs +547 -0
  1064. package/lib/memory/test-rs-explain-command.cjs +443 -0
  1065. package/lib/memory/test-rs-fetcher-academic.cjs +848 -0
  1066. package/lib/memory/test-rs-fetcher-experts.cjs +496 -0
  1067. package/lib/memory/test-rs-fetcher-industry.cjs +702 -0
  1068. package/lib/memory/test-rs-fetcher-patents.cjs +674 -0
  1069. package/lib/memory/test-rs-innovation-classifier.cjs +301 -0
  1070. package/lib/memory/test-rs-mind-map.cjs +646 -0
  1071. package/lib/memory/test-rs-neo4j-writer.cjs +518 -0
  1072. package/lib/memory/test-rs-nl-to-query.cjs +449 -0
  1073. package/lib/memory/test-rs-pinecone-bridge.cjs +282 -0
  1074. package/lib/memory/test-rs-preprocessor.cjs +433 -0
  1075. package/lib/memory/test-rs-query-matrix.cjs +391 -0
  1076. package/lib/memory/test-rs-query-to-text.cjs +551 -0
  1077. package/lib/memory/test-rs-sqlite-mirror.cjs +649 -0
  1078. package/lib/memory/test-rs-thesis-generator.cjs +360 -0
  1079. package/lib/memory/triple-context-formatter.cjs +473 -0
  1080. package/lib/memory/triple-context-formatter.test.cjs +442 -0
  1081. package/lib/memory/user-md-persona.test.cjs +565 -0
  1082. package/lib/memory/userpromptsubmit-integration.test.cjs +787 -0
  1083. package/lib/memory/validators/README.md +157 -0
  1084. package/lib/memory/validators/brain-md-invariants.cjs +475 -0
  1085. package/lib/memory/validators/brain-substrate-invariants.cjs +285 -0
  1086. package/lib/memory/validators/external-academic-invariants.cjs +249 -0
  1087. package/lib/memory/validators/external-industry-invariants.cjs +271 -0
  1088. package/lib/memory/validators/external-patents-invariants.cjs +266 -0
  1089. package/lib/memory/validators/minto-invariants.cjs +62 -0
  1090. package/lib/memory/validators/navigation-invariants.cjs +340 -0
  1091. package/lib/memory/validators/queue-health.cjs +95 -0
  1092. package/lib/memory/validators/snapshot-integrity.cjs +129 -0
  1093. package/lib/memory/validators/stale-lifecycle.cjs +116 -0
  1094. package/lib/memory/vault-section-minto-generator-atomic.test.cjs +556 -0
  1095. package/lib/memory/vault-section-minto-generator-atomic.worker.cjs +73 -0
  1096. package/lib/memory/workflow-layer-e2e.test.cjs +262 -0
  1097. package/lib/memory/write-lock-atomic.test.cjs +137 -0
  1098. package/lib/memory/write-lock-atomic.worker.cjs +55 -0
  1099. package/lib/parity/check-parity.cjs +83 -0
  1100. package/lib/presentation/presentation-server.cjs +101 -0
  1101. package/lib/presentation/presentation-watcher.cjs +123 -0
  1102. package/lib/quickview/hub-server.cjs +719 -0
  1103. package/lib/quickview/server.cjs +533 -0
  1104. package/lib/render/JTBD-PALETTES.md +145 -0
  1105. package/lib/render/ROOM.md +111 -0
  1106. package/lib/render/render-v2.cjs +532 -0
  1107. package/lib/render/render-v2.test.cjs +267 -0
  1108. package/lib/render/render.cjs +65 -0
  1109. package/lib/sessionstart/budget-compressor.cjs +130 -0
  1110. package/lib/sessionstart/contributor-interface.cjs +134 -0
  1111. package/lib/sessionstart/contributor-isolator.cjs +128 -0
  1112. package/lib/sessionstart/precedence-ladder.cjs +47 -0
  1113. package/lib/state/ROOM.md +46 -0
  1114. package/lib/state/state-md-parser.cjs +215 -0
  1115. package/lib/statusline/ROOM.md +38 -0
  1116. package/lib/statusline/banner-suppression.cjs +50 -0
  1117. package/lib/statusline/cockpit-renderer.cjs +443 -0
  1118. package/lib/statusline/cockpit-signals.cjs +312 -0
  1119. package/lib/statusline/cockpit-telemetry.cjs +152 -0
  1120. package/lib/statusline/ctx-window.cjs +135 -0
  1121. package/lib/statusline/governing-thought-truncator.cjs +45 -0
  1122. package/lib/statusline/next-move-cache.cjs +235 -0
  1123. package/lib/statusline/ratification-next.cjs +164 -0
  1124. package/lib/statusline/room-health-cache.cjs +200 -0
  1125. package/lib/statusline/surface-detect.cjs +85 -0
  1126. package/lib/statusline/two-row-renderer.cjs +207 -0
  1127. package/lib/statusline/version-resolver.cjs +81 -0
  1128. package/lib/ui/design-system.cjs +19 -0
  1129. package/lib/update-bootstrap.sh.template +145 -0
  1130. package/lib/vault/frontmatter-schema.cjs +297 -0
  1131. package/lib/vault/room-scanner.cjs +365 -0
  1132. package/lib/vault/wikilink-builder.cjs +231 -0
  1133. package/lib/vault/wikilink-builder.test.cjs +182 -0
  1134. package/lib/wiki/briefing.cjs +193 -0
  1135. package/lib/wiki/editor-dist/wiki-editor.css +1 -0
  1136. package/lib/wiki/editor-dist/wiki-editor.js +1327 -0
  1137. package/lib/wiki/graph-links.cjs +281 -0
  1138. package/lib/wiki/page-renderer.cjs +229 -0
  1139. package/lib/wiki/room-home.cjs +353 -0
  1140. package/lib/wiki/wiki-chat.cjs +81 -0
  1141. package/lib/wiki/wiki-export.cjs +364 -0
  1142. package/lib/wiki/wiki-layout.cjs +1143 -0
  1143. package/lib/wiki/wiki-search.cjs +142 -0
  1144. package/lib/wiki/wiki-server.cjs +748 -0
  1145. package/lib/wiki/wiki-watcher.cjs +105 -0
  1146. package/lib/workflow/ROOM.md +47 -0
  1147. package/lib/workflow/chain-source.cjs +179 -0
  1148. package/lib/workflow/command-resolver.cjs +155 -0
  1149. package/lib/workflow/command-resolver.test.cjs +235 -0
  1150. package/lib/workflow/cross-room-umbilical-closer.cjs +364 -0
  1151. package/lib/workflow/dial-close-reach.cjs +405 -0
  1152. package/lib/workflow/f-selector-ranker.cjs +1148 -0
  1153. package/lib/workflow/f1-pick-consumer.cjs +232 -0
  1154. package/lib/workflow/f3-depth-consumer.cjs +98 -0
  1155. package/lib/workflow/f4-scope-consumer.cjs +112 -0
  1156. package/lib/workflow/f8-consumer.test.cjs +82 -0
  1157. package/lib/workflow/f8-fanout-consumer.cjs +208 -0
  1158. package/lib/workflow/f9-consumer.test.cjs +71 -0
  1159. package/lib/workflow/f9-ordered-consumer.cjs +199 -0
  1160. package/lib/workflow/local-chain-recommender.cjs +330 -0
  1161. package/lib/workflow/memory-cascade-f9-adapter.cjs +273 -0
  1162. package/lib/workflow/memory-governance-closer.cjs +384 -0
  1163. package/lib/workflow/offer-closer.cjs +407 -0
  1164. package/lib/workflow/reach-hedge-ranker.cjs +809 -0
  1165. package/lib/workflow/reach-reject-reader.cjs +372 -0
  1166. package/lib/workflow/reconcile-f9-adapter.cjs +299 -0
  1167. package/lib/workflow/selector-decisions.cjs +478 -0
  1168. package/lib/workflow/session-binding-consumer.cjs +249 -0
  1169. package/npm-shrinkwrap.json +1544 -0
  1170. package/output-styles/destijl.md +67 -0
  1171. package/package.json +22 -4
  1172. package/pipelines/PWS_grading/01-deep-grade.md +48 -0
  1173. package/pipelines/PWS_grading/02-mullins.md +50 -0
  1174. package/pipelines/PWS_grading/03-build-thesis.md +60 -0
  1175. package/pipelines/PWS_grading/04-structure-argument.md +77 -0
  1176. package/pipelines/PWS_grading/CHAIN.md +79 -0
  1177. package/pipelines/analogy/01-decompose.md +80 -0
  1178. package/pipelines/analogy/02-abstract.md +87 -0
  1179. package/pipelines/analogy/03-search.md +135 -0
  1180. package/pipelines/analogy/04-transfer.md +101 -0
  1181. package/pipelines/analogy/05-validate.md +106 -0
  1182. package/pipelines/analogy/CHAIN.md +73 -0
  1183. package/pipelines/discovery/01-explore-domains.md +44 -0
  1184. package/pipelines/discovery/02-think-hats.md +50 -0
  1185. package/pipelines/discovery/03-analyze-needs.md +54 -0
  1186. package/pipelines/discovery/CHAIN.md +48 -0
  1187. package/pipelines/thesis/01-structure-argument.md +45 -0
  1188. package/pipelines/thesis/02-challenge-assumptions.md +48 -0
  1189. package/pipelines/thesis/03-build-thesis.md +54 -0
  1190. package/pipelines/thesis/CHAIN.md +48 -0
  1191. package/references/brain/causal-directives.md +91 -0
  1192. package/references/brain/causal-enrichment.cypher +165 -0
  1193. package/references/brain/command-triggers-schema.md +15 -0
  1194. package/references/brain/graph-architecture.md +317 -0
  1195. package/references/brain/query-patterns.md +504 -0
  1196. package/references/brain/room-hierarchy-schema.md +224 -0
  1197. package/references/brain/schema.md +86 -0
  1198. package/references/capability-radar/capabilities-index.md +269 -0
  1199. package/references/capability-radar/changelog-cache.md +95 -0
  1200. package/references/causal/causal-schema.md +103 -0
  1201. package/references/design/email-template-standard.md +169 -0
  1202. package/references/design/graph-visualization-standard.md +178 -0
  1203. package/references/design/newsletter-email-template.html +307 -0
  1204. package/references/document-generation.md +179 -0
  1205. package/references/hsi/HSI-TOOLS-REFERENCE.md +222 -0
  1206. package/references/import-config.md +141 -0
  1207. package/references/integrations/detection-patterns.md +101 -0
  1208. package/references/meeting/artifact-template.md +377 -0
  1209. package/references/meeting/cross-meeting-intelligence.md +216 -0
  1210. package/references/meeting/cross-relationship-patterns.md +202 -0
  1211. package/references/meeting/extraction-perspectives.md +225 -0
  1212. package/references/meeting/filing-protocol.md +222 -0
  1213. package/references/meeting/knowledge-typing.md +242 -0
  1214. package/references/meeting/live-join-interface.md +244 -0
  1215. package/references/meeting/section-mapping.md +192 -0
  1216. package/references/meeting/segment-classification.md +258 -0
  1217. package/references/meeting/speaker-profile-template.md +219 -0
  1218. package/references/meeting/summary-template.md +348 -0
  1219. package/references/meeting/transcript-patterns.md +226 -0
  1220. package/references/methodology/analyze-needs.md +135 -0
  1221. package/references/methodology/analyze-systems.md +121 -0
  1222. package/references/methodology/analyze-timing.md +149 -0
  1223. package/references/methodology/beautiful-question.md +109 -0
  1224. package/references/methodology/build-knowledge.md +161 -0
  1225. package/references/methodology/build-thesis-scored.md +60 -0
  1226. package/references/methodology/build-thesis.md +237 -0
  1227. package/references/methodology/causal-loop-diagrams.md +65 -0
  1228. package/references/methodology/challenge-assumptions.md +127 -0
  1229. package/references/methodology/diagnose.md +169 -0
  1230. package/references/methodology/dominant-designs.md +212 -0
  1231. package/references/methodology/explore-domains.md +147 -0
  1232. package/references/methodology/explore-futures.md +163 -0
  1233. package/references/methodology/explore-trends.md +129 -0
  1234. package/references/methodology/find-bottlenecks.md +131 -0
  1235. package/references/methodology/grade.md +211 -0
  1236. package/references/methodology/huji-stage-a-intake.md +246 -0
  1237. package/references/methodology/index.md +34 -0
  1238. package/references/methodology/leadership.md +200 -0
  1239. package/references/methodology/lean-canvas.md +116 -0
  1240. package/references/methodology/leverage-scan-signatures.md +83 -0
  1241. package/references/methodology/macro-trends.md +192 -0
  1242. package/references/methodology/map-unknowns.md +137 -0
  1243. package/references/methodology/mullins-7-domains.md +104 -0
  1244. package/references/methodology/problem-types.md +65 -0
  1245. package/references/methodology/root-cause.md +178 -0
  1246. package/references/methodology/rubric-huji.md +160 -0
  1247. package/references/methodology/sapphire-encoding.md +355 -0
  1248. package/references/methodology/scenario-plan.md +190 -0
  1249. package/references/methodology/score-innovation.md +154 -0
  1250. package/references/methodology/skillopt-judge-rubric.md +48 -0
  1251. package/references/methodology/skillopt-queries-rubric.md +60 -0
  1252. package/references/methodology/skillopt-refute-rubric.md +59 -0
  1253. package/references/methodology/skillopt-review-rubric.md +72 -0
  1254. package/references/methodology/skillopt-revise-rubric.md +48 -0
  1255. package/references/methodology/structure-argument.md +158 -0
  1256. package/references/methodology/systems-thinking.md +231 -0
  1257. package/references/methodology/think-hats.md +147 -0
  1258. package/references/methodology/triz-matrix.json +751 -0
  1259. package/references/methodology/triz-principles.md +501 -0
  1260. package/references/methodology/user-needs.md +199 -0
  1261. package/references/methodology/validate.md +163 -0
  1262. package/references/methodology/value-proposition.md +244 -0
  1263. package/references/opportunities/funding-lifecycle.md +103 -0
  1264. package/references/opportunities/grant-api-patterns.md +99 -0
  1265. package/references/opportunities/opportunity-template.md +84 -0
  1266. package/references/opportunities/tnufa-rubric.md +81 -0
  1267. package/references/personality/assessment-philosophy.md +72 -0
  1268. package/references/personality/lexicon.md +100 -0
  1269. package/references/personality/persona-chains.md +56 -0
  1270. package/references/personality/pws-lexicon-full.md +499 -0
  1271. package/references/personality/voice-dna.md +156 -0
  1272. package/references/personas/hat-perspectives.md +76 -0
  1273. package/references/personas/persona-template.md +63 -0
  1274. package/references/pipeline/act-output-contract.md +88 -0
  1275. package/references/pipeline/chains-index.md +39 -0
  1276. package/references/pws-profile-generation.md +79 -0
  1277. package/references/reasoning/reasoning-schema.md +143 -0
  1278. package/references/reasoning/reasoning-template.md +68 -0
  1279. package/references/reasoning/run-template.md +38 -0
  1280. package/references/research/RESEARCH_14_CLAUDE_CODE_SOURCE_ARCHITECTURE.md +209 -0
  1281. package/references/research/RESEARCH_15_V1.8_OPTIMIZATION_JTBD.md +375 -0
  1282. package/references/research/RESEARCH_16_NATIVE_FIRST_PLUGIN_ARCHITECTURE.md +575 -0
  1283. package/references/research/RESEARCH_17_MCP_UI_FRAMEWORKS.md +272 -0
  1284. package/references/security/agentshield-baseline.json +8 -0
  1285. package/references/security/cve-db.json +220 -0
  1286. package/references/taxonomy/TAXONOMY.md +192 -0
  1287. package/references/templates/MINTO.md +36 -0
  1288. package/references/user-research/2026-04-05-leah-lawrence-session.md +202 -0
  1289. package/references/vault-kit/README.md +35 -0
  1290. package/references/vault-kit/app.json +12 -0
  1291. package/references/vault-kit/appearance.json +12 -0
  1292. package/references/vault-kit/graph.json +35 -0
  1293. package/references/vault-kit/snippets/mindrian-destijl.css +297 -0
  1294. package/references/vault-kit/templates/new-artifact.md +37 -0
  1295. package/references/vault-kit/templates/new-meeting-note.md +35 -0
  1296. package/references/vault-kit/templates/new-team-profile.md +29 -0
  1297. package/references/vault-kit/templates/new-xref.md +35 -0
  1298. package/references/visual/ROOM.md +55 -0
  1299. package/references/visual/palette.json +54 -0
  1300. package/references/visual/symbol-system.md +151 -0
  1301. package/scripts/189-plurai-gate-check.cjs +88 -0
  1302. package/scripts/198-plurai-gate-check.cjs +118 -0
  1303. package/scripts/198-rollback-rehearsal.cjs +233 -0
  1304. package/scripts/83-scope-injection.test.cjs +648 -0
  1305. package/scripts/PYTHON_GATES.md +78 -0
  1306. package/scripts/__pycache__/compute-hsi.cpython-312.pyc +0 -0
  1307. package/scripts/__pycache__/detect-reverse-salients.cpython-312.pyc +0 -0
  1308. package/scripts/__pycache__/rs-engine.cpython-312.pyc +0 -0
  1309. package/scripts/act-command.cjs +518 -0
  1310. package/scripts/admin-brain-write.cjs +442 -0
  1311. package/scripts/admin-command-gate.cjs +178 -0
  1312. package/scripts/agentshield-scan-cli.cjs +226 -0
  1313. package/scripts/agentshield-sessionstart-scan.cjs +282 -0
  1314. package/scripts/analogy-fitness-report.cjs +266 -0
  1315. package/scripts/analyze-room +1079 -0
  1316. package/scripts/apply-teaching-content.cjs +298 -0
  1317. package/scripts/async-artifact-auto-commit.cjs +485 -0
  1318. package/scripts/audit-active-phase-resolver.cjs +160 -0
  1319. package/scripts/audit-body-shape-coverage.cjs +213 -0
  1320. package/scripts/auto-explore-drain.cjs +274 -0
  1321. package/scripts/auto-explore-fingerprint.cjs +354 -0
  1322. package/scripts/auto-explore-fire.cjs +359 -0
  1323. package/scripts/backfill-correlation-id.cjs +425 -0
  1324. package/scripts/backfill-hitl-shape.cjs +276 -0
  1325. package/scripts/backfill-hitl-shape.test.cjs +307 -0
  1326. package/scripts/backup-modifications +68 -0
  1327. package/scripts/banner +182 -0
  1328. package/scripts/brain-derivation-drain.cjs +291 -0
  1329. package/scripts/brain-derive-command.cjs +846 -0
  1330. package/scripts/brain-normalize-books.cypher +505 -0
  1331. package/scripts/brain-normalize-final.cypher +1355 -0
  1332. package/scripts/brain-normalize-problemtype.cypher +475 -0
  1333. package/scripts/brain-normalize-supplement.cypher +449 -0
  1334. package/scripts/brain-normalize-targeted.cypher +344 -0
  1335. package/scripts/brain-normalize-v194.cypher +61 -0
  1336. package/scripts/brain-normalize.cypher +530 -0
  1337. package/scripts/brain-response-sanitize-hook.cjs +165 -0
  1338. package/scripts/build-brain-census.cjs +957 -0
  1339. package/scripts/build-brain-packet-schema.cjs +225 -0
  1340. package/scripts/build-command-registry.cjs +587 -0
  1341. package/scripts/build-connector-registry.cjs +1331 -0
  1342. package/scripts/build-corpus-stats.cjs +408 -0
  1343. package/scripts/build-dist-bundles.cjs +495 -0
  1344. package/scripts/build-ecosystem-graph.cjs +490 -0
  1345. package/scripts/build-graph +1462 -0
  1346. package/scripts/build-graph-from-sqlite.cjs +97 -0
  1347. package/scripts/build-harness-manifest.cjs +1090 -0
  1348. package/scripts/build-jtbd-nudges +205 -0
  1349. package/scripts/build-new-surface.cjs +805 -0
  1350. package/scripts/build-orchestration-projection.cjs +1221 -0
  1351. package/scripts/build-render-coverage.cjs +637 -0
  1352. package/scripts/build-skill-mirrors.cjs +681 -0
  1353. package/scripts/cache-hitrate-report.cjs +216 -0
  1354. package/scripts/causal-to-graph.cjs +163 -0
  1355. package/scripts/check-abstraction-fixture-neutral.cjs +160 -0
  1356. package/scripts/check-admin-identity.cjs +212 -0
  1357. package/scripts/check-brain-tool-liveness.cjs +502 -0
  1358. package/scripts/check-card-fire.cjs +1809 -0
  1359. package/scripts/check-cirs-declaration.cjs +279 -0
  1360. package/scripts/check-deck-design.cjs +104 -0
  1361. package/scripts/check-dual-graph-health.cjs +645 -0
  1362. package/scripts/check-first-touch-drift.cjs +220 -0
  1363. package/scripts/check-flagship-floor.cjs +391 -0
  1364. package/scripts/check-framework-vocabulary-drift.cjs +563 -0
  1365. package/scripts/check-gate-seam.cjs +178 -0
  1366. package/scripts/check-graph-derive-health.cjs +208 -0
  1367. package/scripts/check-graph-export-typemap.cjs +118 -0
  1368. package/scripts/check-help-coverage.cjs +290 -0
  1369. package/scripts/check-hitl-stages.cjs +219 -0
  1370. package/scripts/check-hook-schema-compatibility.cjs +231 -0
  1371. package/scripts/check-hsi-deps +42 -0
  1372. package/scripts/check-kuzu-reintroduction.cjs +251 -0
  1373. package/scripts/check-onboard +43 -0
  1374. package/scripts/check-onboard-statusline.cjs +363 -0
  1375. package/scripts/check-palette-consistency.cjs +106 -0
  1376. package/scripts/check-pending-ambiguous.cjs +244 -0
  1377. package/scripts/check-pending-breakthrough.cjs +189 -0
  1378. package/scripts/check-pending-breakthrough.test.cjs +166 -0
  1379. package/scripts/check-pending-naming-decision.cjs +97 -0
  1380. package/scripts/check-plugin-path-anchoring.cjs +830 -0
  1381. package/scripts/check-publish-needs.cjs +126 -0
  1382. package/scripts/check-registry-drift.cjs +206 -0
  1383. package/scripts/check-release-payload-ceiling.cjs +269 -0
  1384. package/scripts/check-render-coverage.cjs +558 -0
  1385. package/scripts/check-research-isomorphism.cjs +446 -0
  1386. package/scripts/check-reward-before-investment.cjs +261 -0
  1387. package/scripts/check-room-blueprints.cjs +213 -0
  1388. package/scripts/check-schema-aliases.cjs +532 -0
  1389. package/scripts/check-shape-declaration.cjs +958 -0
  1390. package/scripts/check-shape-declaration.test.cjs +185 -0
  1391. package/scripts/check-skill-spec.cjs +312 -0
  1392. package/scripts/check-skill-vs-code-drift.cjs +178 -0
  1393. package/scripts/check-substrate.cjs +513 -0
  1394. package/scripts/check-tool-honesty.cjs +1601 -0
  1395. package/scripts/check-update +60 -0
  1396. package/scripts/check-version-and-sha.cjs +366 -0
  1397. package/scripts/check-voice-style.cjs +184 -0
  1398. package/scripts/check-worktree-hygiene.cjs +530 -0
  1399. package/scripts/classify-insight +59 -0
  1400. package/scripts/coherence-smoke-test.cjs +489 -0
  1401. package/scripts/collect-cold-install-evidence.cjs +411 -0
  1402. package/scripts/compute-bayesian-surprise.py +175 -0
  1403. package/scripts/compute-blindspot-mass.py +209 -0
  1404. package/scripts/compute-disruption-index.py +211 -0
  1405. package/scripts/compute-element-novelty.py +254 -0
  1406. package/scripts/compute-external-whitespace.py +563 -0
  1407. package/scripts/compute-hsi.py +947 -0
  1408. package/scripts/compute-meetings-intelligence +716 -0
  1409. package/scripts/compute-opportunity-state +17 -0
  1410. package/scripts/compute-state +393 -0
  1411. package/scripts/compute-team +1112 -0
  1412. package/scripts/compute-whitespace-embeddings.py +464 -0
  1413. package/scripts/compute-whitespace-gaps.py +562 -0
  1414. package/scripts/compute_topic_forest.py +684 -0
  1415. package/scripts/consolidate-pinecone.py +265 -0
  1416. package/scripts/context-monitor +943 -0
  1417. package/scripts/create-speaker-profile +311 -0
  1418. package/scripts/cross-room-detect.cjs +195 -0
  1419. package/scripts/csv-to-idea-graph.cjs +755 -0
  1420. package/scripts/ctxl-eval.cjs +846 -0
  1421. package/scripts/curation-132-03-dedup-held-rename.cjs +395 -0
  1422. package/scripts/curation-132-05-pseudonymize.cjs +189 -0
  1423. package/scripts/derive-verb-reach-affinity.cjs +507 -0
  1424. package/scripts/detect-reverse-salients.py +242 -0
  1425. package/scripts/diagnostics-command.cjs +345 -0
  1426. package/scripts/dial-memory-refresh-command.cjs +147 -0
  1427. package/scripts/discover-analogy-whitespace.py +433 -0
  1428. package/scripts/discover-hsi-whitespace.py +352 -0
  1429. package/scripts/discover-rs-whitespace.py +327 -0
  1430. package/scripts/discovery-cycle.cjs +625 -0
  1431. package/scripts/disposition-render-v2.cjs +229 -0
  1432. package/scripts/doctor-preflight-format.cjs +101 -0
  1433. package/scripts/doctor.cjs +4327 -0
  1434. package/scripts/dogfood-bridge/append-to-queue.sh +59 -0
  1435. package/scripts/dogfood-bridge/path-filter.cjs +86 -0
  1436. package/scripts/dogfood-derive.cjs +158 -0
  1437. package/scripts/dogfood-emit.cjs +126 -0
  1438. package/scripts/empathy-observation-emit.cjs +108 -0
  1439. package/scripts/enrichment-queue-append.cjs +157 -0
  1440. package/scripts/ensure-brain-baseline.cjs +117 -0
  1441. package/scripts/entity-extract.cjs +1135 -0
  1442. package/scripts/eureka-command.cjs +687 -0
  1443. package/scripts/eureka-critic-run.cjs +662 -0
  1444. package/scripts/eureka-portfolio-report.cjs +2038 -0
  1445. package/scripts/eureka-room-report.cjs +419 -0
  1446. package/scripts/explain-decision-command.cjs +499 -0
  1447. package/scripts/export-pinecone-embeddings.cjs +516 -0
  1448. package/scripts/extract-room-intelligence.cjs +714 -0
  1449. package/scripts/fetch-brain-baseline.cjs +190 -0
  1450. package/scripts/fetch-brain-baseline.py +360 -0
  1451. package/scripts/feynman-minto-guardian.cjs +672 -0
  1452. package/scripts/feynman-timeline-refresh-command.cjs +270 -0
  1453. package/scripts/file-asset +253 -0
  1454. package/scripts/fire-sensor-event.cjs +83 -0
  1455. package/scripts/first-install-router.cjs +968 -0
  1456. package/scripts/frontmatter-schema-validator.cjs +339 -0
  1457. package/scripts/fts-index-drain.cjs +221 -0
  1458. package/scripts/generate-chat-embed.cjs +179 -0
  1459. package/scripts/generate-deck.cjs +322 -0
  1460. package/scripts/generate-export.cjs +474 -0
  1461. package/scripts/generate-hub.cjs +2553 -0
  1462. package/scripts/generate-lobby.cjs +718 -0
  1463. package/scripts/generate-presentation.cjs +988 -0
  1464. package/scripts/generate-presentation.test.cjs +405 -0
  1465. package/scripts/generate-section-intelligence.cjs +330 -0
  1466. package/scripts/generate-snapshot.cjs +1410 -0
  1467. package/scripts/generate-standalone +159 -0
  1468. package/scripts/git-ops +211 -0
  1469. package/scripts/graph-heal-pipeline.cjs +321 -0
  1470. package/scripts/gsd-artifact-graph-hook.cjs +219 -0
  1471. package/scripts/gsd-graph-derive-drain.cjs +571 -0
  1472. package/scripts/gsd-graph-derive-sweep.cjs +195 -0
  1473. package/scripts/heal-command.cjs +1365 -0
  1474. package/scripts/hedge-refit-pipeline.cjs +207 -0
  1475. package/scripts/help-renderer.cjs +303 -0
  1476. package/scripts/hmi-compliance-poll.cjs +451 -0
  1477. package/scripts/hmi-status-command.cjs +510 -0
  1478. package/scripts/hooked-rescore-117.cjs +224 -0
  1479. package/scripts/hooks/pre-commit +533 -0
  1480. package/scripts/hooks/pre-commit-room-minto-guard.cmd +43 -0
  1481. package/scripts/hooks/pre-commit-room-minto-guard.sh +533 -0
  1482. package/scripts/hsi-to-graph.cjs +194 -0
  1483. package/scripts/huji-batch.cjs +821 -0
  1484. package/scripts/huji-eval.cjs +1158 -0
  1485. package/scripts/huji-intake.cjs +563 -0
  1486. package/scripts/huji-pin-smoketest.cjs +454 -0
  1487. package/scripts/huji-run-one-async.cjs +305 -0
  1488. package/scripts/huji-run-one.cjs +671 -0
  1489. package/scripts/install-pre-commit.sh +113 -0
  1490. package/scripts/intent-classifier +106 -0
  1491. package/scripts/intent-classifier.cjs +3620 -0
  1492. package/scripts/interpret-whitespace.cjs +691 -0
  1493. package/scripts/jtbd-command.cjs +810 -0
  1494. package/scripts/jtbd-update.cjs +299 -0
  1495. package/scripts/label-topic-forest.cjs +667 -0
  1496. package/scripts/learn-from-usage +168 -0
  1497. package/scripts/lib/__pycache__/ensure_ml_deps.cpython-312.pyc +0 -0
  1498. package/scripts/lib/ensure_ml_deps.py +97 -0
  1499. package/scripts/load-embeddings-into-neo4j.cjs +569 -0
  1500. package/scripts/memory-artifact-graph-hook.cjs +191 -0
  1501. package/scripts/memory-command.cjs +687 -0
  1502. package/scripts/memory-completion-detector.cjs +217 -0
  1503. package/scripts/memory-lifecycle.cjs +620 -0
  1504. package/scripts/memory-resume-nudge.cjs +233 -0
  1505. package/scripts/methodology-ingest-local.sh +36 -0
  1506. package/scripts/migrate-brain-mcp-from-http-to-stdio.cjs +190 -0
  1507. package/scripts/migrate-brain-mcp-from-http-to-stdio.test.cjs +242 -0
  1508. package/scripts/migrate-hats-to-roomdb.cjs +217 -0
  1509. package/scripts/migrate-lazygraph.cjs +250 -0
  1510. package/scripts/migrate-minto-schema-v88.cjs +296 -0
  1511. package/scripts/migrate-plugin-root-refs.cjs +168 -0
  1512. package/scripts/migrate-room-sections-v275.cjs +556 -0
  1513. package/scripts/migrate-rooms +417 -0
  1514. package/scripts/migrate-skill-frontmatter.cjs +472 -0
  1515. package/scripts/migrate-stale-user-settings.cjs +296 -0
  1516. package/scripts/migrate-telemetry-v1.cjs +384 -0
  1517. package/scripts/migrate-telemetry-v1.test.cjs +356 -0
  1518. package/scripts/minto-debouncer.cjs +428 -0
  1519. package/scripts/mos-status.cjs +622 -0
  1520. package/scripts/mva-detect.cjs +229 -0
  1521. package/scripts/mva-run.cjs +36 -0
  1522. package/scripts/on-agent-complete +163 -0
  1523. package/scripts/on-cwd-changed +149 -0
  1524. package/scripts/on-file-changed +68 -0
  1525. package/scripts/on-stop +617 -0
  1526. package/scripts/on-task-complete +194 -0
  1527. package/scripts/operator-command.cjs +858 -0
  1528. package/scripts/operator-update.cjs +308 -0
  1529. package/scripts/part8-egress-guard-hook.cjs +229 -0
  1530. package/scripts/pipeline-command.cjs +271 -0
  1531. package/scripts/post-compact +383 -0
  1532. package/scripts/post-update-activation.cjs +339 -0
  1533. package/scripts/post-write +283 -0
  1534. package/scripts/power-demo-prompt.md +621 -0
  1535. package/scripts/pre-compact +273 -0
  1536. package/scripts/preflight-auto-explore.cjs +314 -0
  1537. package/scripts/preflight-doctor.cjs +225 -0
  1538. package/scripts/preflight-release-drift.cjs +168 -0
  1539. package/scripts/preflight-tension-surface.cjs +414 -0
  1540. package/scripts/probe-brain-contract.cjs +502 -0
  1541. package/scripts/publish-ops +346 -0
  1542. package/scripts/query-efficiency-telemetry.cjs +364 -0
  1543. package/scripts/query-semantic-scholar.cjs +545 -0
  1544. package/scripts/reapply-modifications +49 -0
  1545. package/scripts/reassign-primary.cjs +125 -0
  1546. package/scripts/recompile-room-references.cjs +601 -0
  1547. package/scripts/release-beta-preflight.sh +69 -0
  1548. package/scripts/render-pdf +588 -0
  1549. package/scripts/render-viz +190 -0
  1550. package/scripts/research-speaker +239 -0
  1551. package/scripts/resolve-room +204 -0
  1552. package/scripts/restore-post-compact-context.cjs +320 -0
  1553. package/scripts/room-auto-create-nudge.cjs +136 -0
  1554. package/scripts/room-naming-selector.cjs +201 -0
  1555. package/scripts/room-registry +767 -0
  1556. package/scripts/rs-discovery-engine.cjs +725 -0
  1557. package/scripts/rs-engine.py +2073 -0
  1558. package/scripts/rs-experts-command.cjs +300 -0
  1559. package/scripts/rs-explain-command.cjs +323 -0
  1560. package/scripts/rs-fetch-command.cjs +170 -0
  1561. package/scripts/rs-thesis-command.cjs +203 -0
  1562. package/scripts/rs-vector-bridge.cjs +410 -0
  1563. package/scripts/run-harness.cjs +890 -0
  1564. package/scripts/scout-cadence-guard.cjs +323 -0
  1565. package/scripts/scout-cadence-runner.cjs +509 -0
  1566. package/scripts/scout-telemetry-aggregator.cjs +268 -0
  1567. package/scripts/sealed-walker.py +96 -0
  1568. package/scripts/seed-brain-commands.cjs +324 -0
  1569. package/scripts/self-update +105 -0
  1570. package/scripts/sentinel-deadline-monitor +241 -0
  1571. package/scripts/sentinel-health-check +198 -0
  1572. package/scripts/sentinel-snapshot +42 -0
  1573. package/scripts/serve-dashboard +103 -0
  1574. package/scripts/serve-dashboard-live +932 -0
  1575. package/scripts/serve-presentation +97 -0
  1576. package/scripts/serve-wiki +90 -0
  1577. package/scripts/session-end-presence.cjs +79 -0
  1578. package/scripts/session-start +1943 -0
  1579. package/scripts/sessionstart-coordinator.cjs +249 -0
  1580. package/scripts/sessionstart-npm-reconcile.cjs +111 -0
  1581. package/scripts/sessionstart-post-update-preflight.cjs +303 -0
  1582. package/scripts/sessionstart-reference-now-seed.cjs +137 -0
  1583. package/scripts/setup-hooks.sh +112 -0
  1584. package/scripts/skillopt-codereview.cjs +830 -0
  1585. package/scripts/skillopt-eval.cjs +519 -0
  1586. package/scripts/skillopt-funnel.cjs +1076 -0
  1587. package/scripts/skillopt-genqueries.cjs +571 -0
  1588. package/scripts/skillopt-inventory.cjs +319 -0
  1589. package/scripts/skillopt-merge.cjs +656 -0
  1590. package/scripts/skillopt-triggerloop.cjs +1126 -0
  1591. package/scripts/soft-alias-runner.cjs +116 -0
  1592. package/scripts/stamp-artifact-write.cjs +276 -0
  1593. package/scripts/stamp-firing-block.cjs +325 -0
  1594. package/scripts/state-write.cjs +97 -0
  1595. package/scripts/statusline-fallback-echo.cjs +297 -0
  1596. package/scripts/statusline-mos +116 -0
  1597. package/scripts/statusline-mos-dispatch +127 -0
  1598. package/scripts/suggest-next-command.cjs +416 -0
  1599. package/scripts/sweep-skill-descriptions.cjs +263 -0
  1600. package/scripts/sync-rooms-graph +264 -0
  1601. package/scripts/telemetry-command-invocation.cjs +120 -0
  1602. package/scripts/test-doctor-recovery.cjs +242 -0
  1603. package/scripts/test-fresh-install.md +140 -0
  1604. package/scripts/track-analytics +156 -0
  1605. package/scripts/transcribe-audio +148 -0
  1606. package/scripts/transcript-ingest.cjs +225 -0
  1607. package/scripts/update-icm-index +153 -0
  1608. package/scripts/v182-brain-optimize.cypher +1191 -0
  1609. package/scripts/validate-model-profiles +93 -0
  1610. package/scripts/vault-content-reformatter.cjs +581 -0
  1611. package/scripts/vault-export-orchestrator.cjs +400 -0
  1612. package/scripts/vault-footer-injector.cjs +315 -0
  1613. package/scripts/vault-import.cjs +839 -0
  1614. package/scripts/vault-integration-test.cjs +318 -0
  1615. package/scripts/vault-regenerate-all.cjs +216 -0
  1616. package/scripts/vault-regenerate-all.test.cjs +138 -0
  1617. package/scripts/vault-rules-generator.cjs +220 -0
  1618. package/scripts/vault-section-minto-generator.cjs +1642 -0
  1619. package/scripts/vault-section-minto-generator.integration.test.cjs +576 -0
  1620. package/scripts/vault-section-minto-generator.test.cjs +291 -0
  1621. package/scripts/vault-section-state-generator.cjs +385 -0
  1622. package/scripts/vault-welcome-generator.cjs +403 -0
  1623. package/scripts/vault-wikilink-injector.cjs +449 -0
  1624. package/scripts/verify-phase-132.cjs +338 -0
  1625. package/scripts/verify-release +744 -0
  1626. package/scripts/whitespace-command.cjs +831 -0
  1627. package/scripts/whitespace-to-brain.cjs +384 -0
  1628. package/scripts/whitespace-to-graph.cjs +220 -0
  1629. package/scripts/wikilink-batch.cjs +102 -0
  1630. package/scripts/wikilink-file.cjs +139 -0
  1631. package/scripts/write-bridge-artifacts.cjs +140 -0
  1632. package/scripts/write-scope-check +12 -0
  1633. package/scripts/write-scope-check.cjs +461 -0
  1634. package/scripts/write-whitespace-sections.cjs +483 -0
  1635. package/settings.json +7 -0
  1636. package/skills/act/SKILL.md +523 -0
  1637. package/skills/admin/SKILL.md +437 -0
  1638. package/skills/agentshield/SKILL.md +50 -0
  1639. package/skills/analyze-needs/SKILL.md +74 -0
  1640. package/skills/analyze-systems/SKILL.md +69 -0
  1641. package/skills/analyze-timing/SKILL.md +94 -0
  1642. package/skills/auto-explore/SKILL.md +84 -0
  1643. package/skills/beautiful-question/SKILL.md +72 -0
  1644. package/skills/bono/SKILL.md +146 -0
  1645. package/skills/brain-connector/SKILL.md +206 -0
  1646. package/skills/brain-derive/SKILL.md +140 -0
  1647. package/skills/build-knowledge/SKILL.md +118 -0
  1648. package/skills/build-thesis/SKILL.md +90 -0
  1649. package/skills/causal/SKILL.md +265 -0
  1650. package/skills/challenge-assumptions/SKILL.md +74 -0
  1651. package/skills/client-discovery-interview/SKILL.md +94 -0
  1652. package/skills/client-discovery-interview/discovery-scaffold.json +41 -0
  1653. package/skills/client-discovery-interview/question-bank.md +149 -0
  1654. package/skills/compare-ventures/SKILL.md +113 -0
  1655. package/skills/context-engine/SKILL.md +169 -0
  1656. package/skills/conversation-mode/SKILL.md +189 -0
  1657. package/skills/correct-reference-now/SKILL.md +86 -0
  1658. package/skills/dashboard/SKILL.md +142 -0
  1659. package/skills/deck/SKILL.md +113 -0
  1660. package/skills/deep-grade/SKILL.md +210 -0
  1661. package/skills/diagnose/SKILL.md +128 -0
  1662. package/skills/diagnostics/SKILL.md +193 -0
  1663. package/skills/dial-memory-refresh/SKILL.md +116 -0
  1664. package/skills/diffusion/SKILL.md +125 -0
  1665. package/skills/discover/SKILL.md +216 -0
  1666. package/skills/doctor/SKILL.md +269 -0
  1667. package/skills/dogfood-flush/SKILL.md +133 -0
  1668. package/skills/dominant-designs/SKILL.md +72 -0
  1669. package/skills/eureka/SKILL.md +313 -0
  1670. package/skills/explain-decision/SKILL.md +138 -0
  1671. package/skills/explore-domains/SKILL.md +74 -0
  1672. package/skills/explore-futures/SKILL.md +64 -0
  1673. package/skills/explore-opportunity/SKILL.md +168 -0
  1674. package/skills/explore-trends/SKILL.md +74 -0
  1675. package/skills/export/SKILL.md +126 -0
  1676. package/skills/feynman-timeline-refresh/SKILL.md +105 -0
  1677. package/skills/file-meeting/SKILL.md +1190 -0
  1678. package/skills/find-analogies/SKILL.md +360 -0
  1679. package/skills/find-bottlenecks/SKILL.md +104 -0
  1680. package/skills/find-connections/SKILL.md +108 -0
  1681. package/skills/funding/SKILL.md +110 -0
  1682. package/skills/futures/SKILL.md +124 -0
  1683. package/skills/grade/SKILL.md +252 -0
  1684. package/skills/grade-grant/SKILL.md +293 -0
  1685. package/skills/graph/SKILL.md +216 -0
  1686. package/skills/hat-briefing/SKILL.md +160 -0
  1687. package/skills/heal/SKILL.md +69 -0
  1688. package/skills/help/SKILL.md +172 -0
  1689. package/skills/hmi-status/SKILL.md +73 -0
  1690. package/skills/ignite/SKILL.md +225 -0
  1691. package/skills/ingest-methodology/SKILL.md +125 -0
  1692. package/skills/intel-pipeline/SKILL.md +128 -0
  1693. package/skills/intelligence-orchestrator/SKILL.md +262 -0
  1694. package/skills/jtbd/SKILL.md +261 -0
  1695. package/skills/larry-personality/SKILL.md +571 -0
  1696. package/skills/larry-personality/framework-chains.md +92 -0
  1697. package/skills/larry-personality/mode-engine.md +185 -0
  1698. package/skills/leadership/SKILL.md +109 -0
  1699. package/skills/lean-canvas/SKILL.md +70 -0
  1700. package/skills/macro-trends/SKILL.md +84 -0
  1701. package/skills/map-unknowns/SKILL.md +72 -0
  1702. package/skills/memory/SKILL.md +212 -0
  1703. package/skills/memory-cortex-reach/SKILL.md +80 -0
  1704. package/skills/models/SKILL.md +197 -0
  1705. package/skills/mos/SKILL.md +160 -0
  1706. package/skills/mos-deck-engine/SKILL.md +329 -0
  1707. package/skills/mos-reason/SKILL.md +484 -0
  1708. package/skills/mullins/SKILL.md +151 -0
  1709. package/skills/mullins-scaffold/SKILL.md +132 -0
  1710. package/skills/mullins-scaffold/scaffold.json +223 -0
  1711. package/skills/mva-brief/SKILL.md +87 -0
  1712. package/skills/mva-option/SKILL.md +120 -0
  1713. package/skills/mva-pipeline/SKILL.md +158 -0
  1714. package/skills/mva-report/SKILL.md +79 -0
  1715. package/skills/new-project/SKILL.md +629 -0
  1716. package/skills/new-surface/SKILL.md +112 -0
  1717. package/skills/onboard/SKILL.md +485 -0
  1718. package/skills/operator/SKILL.md +167 -0
  1719. package/skills/opportunities/SKILL.md +171 -0
  1720. package/skills/organize/SKILL.md +69 -0
  1721. package/skills/persona/SKILL.md +272 -0
  1722. package/skills/pipeline/SKILL.md +164 -0
  1723. package/skills/present/SKILL.md +123 -0
  1724. package/skills/publish/SKILL.md +224 -0
  1725. package/skills/pws-brain/SKILL.md +152 -0
  1726. package/skills/pws-methodology/SKILL.md +92 -0
  1727. package/skills/qualify-opportunity/SKILL.md +111 -0
  1728. package/skills/query/SKILL.md +68 -0
  1729. package/skills/radar/SKILL.md +106 -0
  1730. package/skills/reanalyze/SKILL.md +122 -0
  1731. package/skills/research/SKILL.md +462 -0
  1732. package/skills/room/SKILL.md +381 -0
  1733. package/skills/room-passive/SKILL.md +174 -0
  1734. package/skills/room-proactive/SKILL.md +344 -0
  1735. package/skills/rooms/SKILL.md +678 -0
  1736. package/skills/root-cause/SKILL.md +73 -0
  1737. package/skills/rs-experts/SKILL.md +151 -0
  1738. package/skills/rs-explain/SKILL.md +130 -0
  1739. package/skills/rs-fetch/SKILL.md +115 -0
  1740. package/skills/rs-thesis/SKILL.md +129 -0
  1741. package/skills/scenario-plan/SKILL.md +76 -0
  1742. package/skills/scheduled-tasks/SKILL.md +301 -0
  1743. package/skills/score-innovation/SKILL.md +74 -0
  1744. package/skills/scout/SKILL.md +370 -0
  1745. package/skills/setup/SKILL.md +654 -0
  1746. package/skills/show/SKILL.md +68 -0
  1747. package/skills/skill/SKILL.md +104 -0
  1748. package/skills/snapshot/SKILL.md +178 -0
  1749. package/skills/speakers/SKILL.md +116 -0
  1750. package/skills/splash/SKILL.md +54 -0
  1751. package/skills/stance/SKILL.md +89 -0
  1752. package/skills/status/SKILL.md +107 -0
  1753. package/skills/structure-argument/SKILL.md +78 -0
  1754. package/skills/suggest-next/SKILL.md +137 -0
  1755. package/skills/systems-thinking/SKILL.md +220 -0
  1756. package/skills/think-hats/SKILL.md +82 -0
  1757. package/skills/trending-to-absurd/SKILL.md +100 -0
  1758. package/skills/ui-system/SKILL.md +474 -0
  1759. package/skills/ui-system/design-system/M-OS-DESIGN-SYSTEM.md +273 -0
  1760. package/skills/ui-system/design-system/SPEC.md +72 -0
  1761. package/skills/ui-system/design-system/image-prompt-style.md +29 -0
  1762. package/skills/ui-system/design-system/mos-design-system.css +240 -0
  1763. package/skills/ui-system/rules/design-system.md +60 -0
  1764. package/skills/ui-system/rules/dual-palette.md +156 -0
  1765. package/skills/ui-system/rules/glyph-disambiguation.md +171 -0
  1766. package/skills/ui-system/rules/shape-f-zero-and-six.md +169 -0
  1767. package/skills/update/SKILL.md +254 -0
  1768. package/skills/user-needs/SKILL.md +73 -0
  1769. package/skills/validate/SKILL.md +73 -0
  1770. package/skills/value-proposition/SKILL.md +141 -0
  1771. package/skills/vault/SKILL.md +326 -0
  1772. package/skills/visualize/SKILL.md +69 -0
  1773. package/skills/whitespace/SKILL.md +539 -0
  1774. package/skills/wiki/SKILL.md +94 -0
  1775. package/templates/_base.html +20 -0
  1776. package/templates/chat-panel.html +205 -0
  1777. package/templates/constellation-chat-hooks.js +89 -0
  1778. package/templates/constellation.html +1272 -0
  1779. package/templates/destijl-base.css +268 -0
  1780. package/templates/discovery/discovery-brief-template.md +97 -0
  1781. package/templates/due-diligence.html +49 -0
  1782. package/templates/executive-summary.html +40 -0
  1783. package/templates/icm/CLAUDE.md +31 -0
  1784. package/templates/icm/GROUP-CLAUDE.md +33 -0
  1785. package/templates/icm/INDEX.md +26 -0
  1786. package/templates/import/stage-contracts/01-ingest.md +34 -0
  1787. package/templates/import/stage-contracts/02-classify.md +48 -0
  1788. package/templates/import/stage-contracts/03-route.md +42 -0
  1789. package/templates/import/stage-contracts/04-enrich.md +40 -0
  1790. package/templates/investment-thesis.html +25 -0
  1791. package/templates/meeting-report.html +361 -0
  1792. package/templates/presentation/dashboard.html +1150 -0
  1793. package/templates/presentation/deck.html +540 -0
  1794. package/templates/presentation/diagrams.html +437 -0
  1795. package/templates/presentation/graph.html +391 -0
  1796. package/templates/presentation/insights.html +548 -0
  1797. package/templates/presentation/wiki.html +533 -0
  1798. package/templates/profile.html +136 -0
  1799. package/templates/room-context/last-session.md +56 -0
  1800. package/templates/room-context/methodology-history.md +28 -0
  1801. package/templates/room-context/rejection-log.md +25 -0
  1802. package/templates/room-context/weekly-digest.md +54 -0
  1803. package/templates/room-skeleton/MINTO.md.tmpl +19 -0
  1804. package/templates/room-skeleton/ROOM.md.identity.tmpl +13 -0
  1805. package/templates/room-skeleton/ROOM.md.section.tmpl +33 -0
  1806. package/templates/room-skeleton/STATE.md.tmpl +33 -0
  1807. package/templates/room-skeleton/USER.md.tmpl +23 -0
  1808. package/templates/room-skeleton/references/.gitkeep +0 -0
  1809. package/templates/room-skeleton/references/SECTION-SCHEMA.md +213 -0
  1810. package/templates/room-skeleton/references/SUB-SCHEMAS.md +91 -0
  1811. package/templates/room-skeleton/section-contracts/.gitkeep +0 -0
  1812. package/templates/room-skeleton/section-contracts/business-model.md +32 -0
  1813. package/templates/room-skeleton/section-contracts/competitive-analysis.md +33 -0
  1814. package/templates/room-skeleton/section-contracts/financial-model.md +30 -0
  1815. package/templates/room-skeleton/section-contracts/funding.md +41 -0
  1816. package/templates/room-skeleton/section-contracts/legal-ip.md +30 -0
  1817. package/templates/room-skeleton/section-contracts/market-analysis.md +32 -0
  1818. package/templates/room-skeleton/section-contracts/opportunity-bank.md +39 -0
  1819. package/templates/room-skeleton/section-contracts/problem-definition.md +32 -0
  1820. package/templates/room-skeleton/section-contracts/solution-design.md +36 -0
  1821. package/templates/room-skeleton/section-contracts/strategy.md +35 -0
  1822. package/templates/room-skeleton/section-contracts/team-execution.md +36 -0
  1823. package/templates/shared.css +427 -0
  1824. package/templates/showcase/blueprint.html +432 -0
  1825. package/templates/showcase/library.html +571 -0
  1826. package/templates/showcase/narrative.html +361 -0
  1827. package/templates/showcase/overview.html +468 -0
  1828. package/templates/showcase/synthesis.html +473 -0
  1829. package/templates/signature-footer.html +34 -0
@@ -0,0 +1,2038 @@
1
+ #!/usr/bin/env node
2
+ 'use strict';
3
+ /*
4
+ * Copyright (c) 2026 Mindrian. BSL 1.1.
5
+ * Phase 215-04 -- the composed PORTFOLIO batch runner.
6
+ *
7
+ * ONE command turns a room.db + a cited idea-graph into a ranked, AHP-weighted,
8
+ * provenance-stamped portfolio report with a DISTINCT weak-signal tail section
9
+ * and critic-gated Opportunity Statements. This is COMPOSITION, not a new engine
10
+ * (Canon Part 7): every scoring primitive already ships. The runner wires the
11
+ * Wave-1 modules (ahp-weights, portfolio-dimensions, tail-quadrant,
12
+ * opportunity-statement) onto the reused Phase 211 spine (tri-modal index,
13
+ * scoreMeasured, the room-runner's backend-aware vector read + enumeration).
14
+ *
15
+ * Pipeline:
16
+ * (1) load the idea-graph JSON -> techMap (id -> node fields) + deduped
17
+ * CONVERGES pairs; cohort counts are read AT RUN TIME from what loaded,
18
+ * never a hardcoded substrate literal (the graph regenerates),
19
+ * (2) openRoomDb + tri-modal indexNodes; HARD GATE on idx.embedded === true so
20
+ * a stale-vector run can never masquerade as a live one (the 211 fix class),
21
+ * (3) read vectors back ONCE via the exported loadIndexVectors,
22
+ * (4) enumerate pairs: --pairs graph (the cited CONVERGES substrate, default)
23
+ * or --pairs full (the 211 cross-boundary enumeration over ALL room nodes),
24
+ * (5) score each pair with scoreMeasured (the Part 8 figure-guard skips + counts,
25
+ * never aborts),
26
+ * (6) three-dimension score keyed to the AHP CRITERIA, composed with the
27
+ * per-run-reloaded weight vector (a bad matrix aborts LOUDLY, never a
28
+ * silently mis-weighted report),
29
+ * (7) classify the low-attention / high-growth tail as its OWN category,
30
+ * (8) rank pairs, keep --top, and add every tail-flagged complementary pair as
31
+ * a statement candidate (the gems ride even when outranked),
32
+ * (9) render a markdown report + a JSON sibling (Plan 05 reads the JSON).
33
+ *
34
+ * --------------------------------------------------------------------------
35
+ * CANON PART 8 (Graph Boundary): ZERO network calls of any kind. No URL, no
36
+ * socket. The offline stub encoder is deterministic and local. Real-room content
37
+ * is verified by the HUMAN spot-check (the Plan 05 checkpoint), never by a
38
+ * network judge. The Part 8 K/M/B figure-guard inside scoreMeasured throws on a
39
+ * forbidden pattern; this runner skips + counts, so one tripping node never
40
+ * aborts the batch, and the skip count prints in provenance.
41
+ *
42
+ * CRITIC RESOLUTION (Phase 219 GAP-1 fix): the emitter's synchronous gate
43
+ * honestly leaves every live statement critic 'pending' (the real Phase 212
44
+ * stageA is async and a sync seam can never await it). AFTER the statements
45
+ * loop and BEFORE banking, this runner awaits oppmod.resolveCriticVerdicts -
46
+ * the bounded async pass (per-statement timeout + batch deadline, env
47
+ * MINDRIAN_CRITIC_RESOLVE_TIMEOUT_MS / MINDRIAN_CRITIC_RESOLVE_BATCH_MS) that
48
+ * resolves each pending statement's REAL stageA verdict and updates banked in
49
+ * place. Unresolvable statements stay honestly 'pending'. OFFLINE runs skip
50
+ * the pass: a stub-encoder verdict would be fixture-green lying about
51
+ * grounding, the exact failure class GAP-1's RCA documents.
52
+ *
53
+ * CANON PART 9 (Memory Locality): graph writes route EXCLUSIVELY through the
54
+ * lib/core/navigation.cjs chokepoint. The banking deferral this header carried
55
+ * since Phase 215 ("a later phase's governed wiring, not minted here") is
56
+ * IMPLEMENTED as of Phase 219 (REQ-1): after the statements loop resolves
57
+ * critic verdicts, ONE BEGIN/COMMIT/ROLLBACK batch (the 218 D-05 shape;
58
+ * node:sqlite has no .transaction() helper) mints each statement passing the
59
+ * banking predicate as a proposed `opportunity` node via
60
+ * navigation.writeOpportunityNode, with DERIVED_FROM evidence edges to the
61
+ * candidate pair's a/b nodes via navigation.linkOpportunityEvidence. NEVER a
62
+ * raw INSERT (the run-all-219.sh grep gate), NEVER graph-ops.indexOpportunity
63
+ * (the legacy raw-insert bypass). A mid-batch failure rolls back the WHOLE
64
+ * batch; the report files are unaffected either way. The room handle opens in
65
+ * a try/finally so it always closes.
66
+ *
67
+ * BANKING PREDICATE (env seam - the logged planner decision for live tuning
68
+ * on ador/corepower; start at 'critic'):
69
+ * MINDRIAN_OPPORTUNITY_BANK_PREDICATE =
70
+ * 'critic' (DEFAULT) bank statements with st.banked === true, i.e. a
71
+ * RESOLVED PASSING critic verdict (the honest gate; banked
72
+ * can never be true on the 'pending' path)
73
+ * 'critic+tail' also bank tail-flagged weak-signal candidates (the gems
74
+ * that ride even when outranked)
75
+ * 'all' every statement with a RESOLVED verdict (critic is not
76
+ * 'pending'), pass or fail
77
+ * NEVER gate banking on AHP rank: validated_demand is degree-centrality and
78
+ * buries low-degree families (219-RESEARCH finding 1 + Pitfall 2).
79
+ *
80
+ * A4 posture: single-process batch, no deep FUSION-engine call and no
81
+ * chain-executor fan-out in this loop. Per-tech DEEP analysis stays the reserved
82
+ * path the report's next_steps RECOMMEND (never trigger).
83
+ * --------------------------------------------------------------------------
84
+ *
85
+ * Usage:
86
+ * node scripts/eureka-portfolio-report.cjs [--db <roomDir>] [--graph <path>] \
87
+ * [--pairs graph|full] [--offline] [--top <n>] [--out <md>] [--json <json>] \
88
+ * [--brokerage <json>]
89
+ *
90
+ * Pure CJS, node built-ins + the shipped lib modules and the 211 runner. No
91
+ * Commander, no new npm dependency, no em-dashes.
92
+ */
93
+
94
+ const path = require('node:path');
95
+ const fs = require('node:fs');
96
+
97
+ const REPO_ROOT = path.resolve(__dirname, '..');
98
+
99
+ const { openRoomDb, closeRoomDb } = require(path.join(REPO_ROOT, 'lib/core/room-db.cjs'));
100
+ const triModal = require(path.join(REPO_ROOT, 'lib/core/eureka/tri-modal-index.cjs'));
101
+ const { scoreMeasured } = require(path.join(REPO_ROOT, 'lib/core/rs-differential-scorer.cjs'));
102
+ const spine = require(path.join(REPO_ROOT, 'lib/core/eureka/embedding-spine.cjs'));
103
+
104
+ // Reused 211 runner helpers (Part 7 composition; additively exported in Task 1).
105
+ const roomReport = require(path.join(REPO_ROOT, 'scripts/eureka-room-report.cjs'));
106
+ const buildRootDomainMap = roomReport.buildRootDomainMap;
107
+ const loadIndexVectors = roomReport.loadIndexVectors;
108
+ const stubEncode = roomReport.stubEncode;
109
+ const truncate = roomReport.truncate;
110
+
111
+ // The four Wave-1 modules composed into the pipeline.
112
+ const ahp = require(path.join(REPO_ROOT, 'lib/core/eureka/ahp-weights.cjs'));
113
+ const pdims = require(path.join(REPO_ROOT, 'lib/core/eureka/portfolio-dimensions.cjs'));
114
+ const tailmod = require(path.join(REPO_ROOT, 'lib/core/eureka/tail-quadrant.cjs'));
115
+ const oppmod = require(path.join(REPO_ROOT, 'lib/core/eureka/opportunity-statement.cjs'));
116
+
117
+ // The Plan 01 room-native substrate adapter (D-01): sources pairs + signals from
118
+ // room.db directly so the SAME four Wave-1 modules compose against a room with no
119
+ // CSV-derived idea-graph. Injected, never a require cycle (it never imports this
120
+ // runner). See lib/core/eureka/room-native-substrate.cjs.
121
+ const roomNative = require(path.join(REPO_ROOT, 'lib/core/eureka/room-native-substrate.cjs'));
122
+ // Phase 219 REQ-1: the navigation chokepoint - the ONLY door for the banking
123
+ // pass's node + edge writes (writeOpportunityNode / linkOpportunityEvidence).
124
+ const navigation = require(path.join(REPO_ROOT, 'lib/core/navigation.cjs'));
125
+ // Phase 218 fix (REQ-5 live-verification gap, T-218-VD): the closed, frozen
126
+ // entity-node type family, reused (never re-derived) from its one source of
127
+ // truth. See the "stratified cohort" comment at its call site below.
128
+ const { ENTITY_NODE_TYPES } = require(path.join(REPO_ROOT, 'lib/core/navigation/typed-entity.cjs'));
129
+ // Phase 226-02: the encoder-free reasoning-mode core (plan 01). The mode:reasoning
130
+ // branch below calls its readRoomMarkdown / proposeCandidatePairs / validateMappings /
131
+ // emitReasoningPrompts / scoreReasoningPairs / buildReasoningStatement /
132
+ // assertReasoningInvariants surface. Additive: never touched unless the embedded
133
+ // attempt genuinely degraded (idx.embedded !== true or scored.length === 0).
134
+ const reasoningMode = require(path.join(REPO_ROOT, 'lib/core/eureka/reasoning-mode.cjs'));
135
+
136
+ const DEFAULT_GRAPH = 'evals/eureka/jhtv-idea-graph.json';
137
+ const PROGRESS_EVERY = 100000; // full mode over a big room is ~millions of pairs
138
+
139
+ // ---------------------------------------------------------------------------
140
+ // argv -- switch/case router (the gsd-tools idiom), no dependency.
141
+ // ---------------------------------------------------------------------------
142
+
143
+ function parseArgv(argv) {
144
+ const opts = {
145
+ db: 'room',
146
+ graph: DEFAULT_GRAPH,
147
+ pairs: 'graph',
148
+ offline: false,
149
+ top: 25,
150
+ out: 'evals/eureka/215-portfolio-report.md',
151
+ json: 'evals/eureka/215-portfolio-report.json',
152
+ brokerage: '',
153
+ // Phase 226-02 reasoning-mode stage flags (all additive; default off/empty so
154
+ // a normal run is byte-identical).
155
+ reasoningEmit: false,
156
+ reasoningScore: false,
157
+ mappings: '',
158
+ answers: '',
159
+ reasoningWorkdir: '',
160
+ forceEncoderUnavailable: false,
161
+ };
162
+ for (let i = 0; i < argv.length; i += 1) {
163
+ const a = argv[i];
164
+ switch (a) {
165
+ case '--offline': opts.offline = true; break;
166
+ case '--db': opts.db = argv[i += 1]; break;
167
+ case '--graph': opts.graph = argv[i += 1]; break;
168
+ case '--pairs': opts.pairs = argv[i += 1]; break;
169
+ case '--top': opts.top = parseInt(argv[i += 1], 10); break;
170
+ case '--out': opts.out = argv[i += 1]; break;
171
+ case '--json': opts.json = argv[i += 1]; break;
172
+ case '--brokerage': opts.brokerage = argv[i += 1]; break;
173
+ // Phase 226-02: the reasoning-mode stage dispatch + its inputs.
174
+ case '--reasoning-emit': opts.reasoningEmit = true; break;
175
+ case '--reasoning-score': opts.reasoningScore = true; break;
176
+ case '--mappings': opts.mappings = argv[i += 1]; break;
177
+ case '--answers': opts.answers = argv[i += 1]; break;
178
+ case '--reasoning-workdir': opts.reasoningWorkdir = argv[i += 1]; break;
179
+ case '--force-encoder-unavailable': opts.forceEncoderUnavailable = true; break;
180
+ case '-h':
181
+ case '--help': opts.help = true; break;
182
+ default: break;
183
+ }
184
+ }
185
+ if (opts.pairs !== 'full' && opts.pairs !== 'room') opts.pairs = 'graph';
186
+ if (!Number.isFinite(opts.top) || opts.top <= 0) opts.top = 25;
187
+ return opts;
188
+ }
189
+
190
+ const HELP = [
191
+ 'eureka-portfolio-report.cjs -- the composed portfolio batch runner (Part 7).',
192
+ '',
193
+ 'Usage:',
194
+ ' node scripts/eureka-portfolio-report.cjs [flags]',
195
+ '',
196
+ 'Flags (defaults in brackets):',
197
+ ' --db <roomDir> [room] the room directory -> <db>/.mindrian/room.db',
198
+ ' --graph <path> [' + DEFAULT_GRAPH + '] the cited idea-graph JSON',
199
+ ' --pairs graph|full|room [graph] graph = the cited CONVERGES substrate (fast ranked loop);',
200
+ ' full = the 211 cross-boundary enumeration over ALL room nodes;',
201
+ ' room = room-native substrate from room.db nodes+edges (no idea-graph needed)',
202
+ ' --offline [live] deterministic stub encoder (no model, no network)',
203
+ ' --top <n> [25] keep the top N ranked pairs',
204
+ ' --out <md> [evals/eureka/215-portfolio-report.md] markdown report',
205
+ ' --json <json> [evals/eureka/215-portfolio-report.json] JSON sibling (Plan 05 reads this)',
206
+ ' --brokerage <json> [<none>] optional id -> [0,1] Burt-brokerage map (the DG-1 seam)',
207
+ '',
208
+ 'Reasoning-mode (Phase 226) - the encoder-free fallback stages (entered only AFTER a',
209
+ 'genuine embedded run degraded; the normal run seeds the workdir):',
210
+ ' --reasoning-emit stage 2: read pairs.json + the session-written mappings.json,',
211
+ ' write neutral/adversarial rubric prompts, then stop',
212
+ ' --reasoning-score stage 3: replay the session answers through the real rubric,',
213
+ ' write the SAME md+json report labeled mode:reasoning',
214
+ ' --mappings <path> [<workdir>/mappings.json] session-written mechanism+mapping per pair',
215
+ ' --answers <path> [<workdir>/answers.json] session-written neutral+adversarial answers',
216
+ ' --reasoning-workdir <dir> [<db>/.mindrian/eureka/reasoning] the reasoning stage state dir',
217
+ ' --force-encoder-unavailable test seam: force idx.embedded !== true so the degrade path runs',
218
+ ' --help show this help',
219
+ ].join('\n');
220
+
221
+ // ---------------------------------------------------------------------------
222
+ // Small local helpers.
223
+ // ---------------------------------------------------------------------------
224
+
225
+ function finiteOr0(v) {
226
+ const n = Number(v);
227
+ return Number.isFinite(n) ? n : 0;
228
+ }
229
+
230
+ // Numeric recency axis: strip the leading C (case-insensitive), parseInt. A
231
+ // higher cnumber is a MORE RECENT catalog entry (the growth proxy).
232
+ function cnumberNumeric(cnumber) {
233
+ const s = String(cnumber == null ? '' : cnumber).replace(/^[Cc]/, '');
234
+ const n = parseInt(s, 10);
235
+ return Number.isFinite(n) ? n : 0;
236
+ }
237
+
238
+ function nodeData(n) {
239
+ return (n && typeof n === 'object' && n.data && typeof n.data === 'object') ? n.data : n;
240
+ }
241
+
242
+ // catalogId: the PUBLIC catalog id (C-number / P-number) that joins a room node
243
+ // to the cited idea-graph. The 211 import (scripts/import-jhu-tech-csv.cjs) keys
244
+ // each room node with a synthetic `claim:<meeting>:<hash>` id and stamps the real
245
+ // catalog id as the trailing token of source_path (e.g.
246
+ // `meeting:jhu-tech-import-2026-07-05:jhu-tech:C16796`). The idea-graph keys its
247
+ // nodes by that SAME catalog id (C16796). Without this join the runner would emit
248
+ // opaque hash ids and match nothing in the graph (the id-space mismatch Plan 05
249
+ // surfaced at real-room scale; the 215-04 fixture used C-number ids directly so
250
+ // the gap was invisible until now). Falls back to the raw room id when no catalog
251
+ // token is present (memory_event / persona nodes) so those still enumerate.
252
+ function catalogId(row) {
253
+ const sp = String(row && row.source_path ? row.source_path : '');
254
+ const parts = sp.split(':');
255
+ const last = parts.length ? parts[parts.length - 1].trim() : '';
256
+ const m = last.match(/^([A-Za-z]\d+)/);
257
+ return m ? m[1] : (row && row.id);
258
+ }
259
+
260
+ // A room node with no graph entry (full mode ranges over the whole catalog,
261
+ // which may hold nodes the cited idea-graph never paired). Synthesize a minimal
262
+ // tech so the classifiers degrade honestly instead of throwing.
263
+ function techFor(techMap, id) {
264
+ const t = techMap.get(id);
265
+ if (t) return t;
266
+ return {
267
+ id: id,
268
+ cnumber: /^C0*[0-9]+$/i.test(id) ? id : '',
269
+ title: id,
270
+ primary_tier: undefined,
271
+ pair_count: 0,
272
+ degree: 0,
273
+ section: 'unknown',
274
+ primary_problem: '',
275
+ problems: [],
276
+ };
277
+ }
278
+
279
+ // The three Wave-1 entity relation edge types (typed-entity.cjs ENTITY_EDGE_SUBSET),
280
+ // mapped to the human bridge-label phrase they name. When an entity-entity pair is
281
+ // formed by one of these typed edges, the bridge label states the REAL relation
282
+ // instead of the generic "cross-domain bridge" (Phase 219 fix 3). Byte-mirrors the
283
+ // navigation enum without requiring that submodule into this report.
284
+ const RELATION_BRIDGE_LABEL = Object.freeze({
285
+ COMPETES_WITH: 'competes-with',
286
+ USES_COMPONENT: 'uses-component',
287
+ SUPPLIES_TO: 'supplies-to',
288
+ });
289
+
290
+ // shared_problems for a candidate: the intersection of the two techs' problem
291
+ // lists, else an honest single-item bridge label (the emitter requires a
292
+ // non-empty first string; never fabricate a market claim, just name the bridge).
293
+ // bridgeEdgeType (optional): the typed relation edge that formed the pair; when it
294
+ // is one of the entity relation edges the bridge is named for that relation.
295
+ function deriveSharedProblems(a, b, bridgeEdgeType) {
296
+ const pa = Array.isArray(a.problems) ? a.problems.filter(function (x) { return typeof x === 'string' && x.trim(); }) : [];
297
+ const setB = new Set(Array.isArray(b.problems) ? b.problems : []);
298
+ const shared = pa.filter(function (x) { return setB.has(x); });
299
+ if (shared.length) return shared;
300
+ if (a.primary_problem || b.primary_problem) return [a.primary_problem || b.primary_problem];
301
+ const rel = (typeof bridgeEdgeType === 'string') ? RELATION_BRIDGE_LABEL[bridgeEdgeType] : null;
302
+ const kind = rel ? (rel + ' bridge') : 'cross-domain bridge';
303
+ return ['a ' + (a.section || 'unknown') + ' x ' + (b.section || 'unknown') + ' ' + kind];
304
+ }
305
+
306
+ // ---------------------------------------------------------------------------
307
+ // Load the cited idea-graph: techMap + deduped CONVERGES pairs. Cohort counts
308
+ // are read from THIS load (never a frozen literal). meta.honest_nouns is prose
309
+ // quoted verbatim into provenance, never parsed into an asserted count.
310
+ // ---------------------------------------------------------------------------
311
+
312
+ function loadGraph(graphPath) {
313
+ const raw = fs.readFileSync(graphPath, 'utf8');
314
+ const g = JSON.parse(raw);
315
+ const meta = (g && g.meta && typeof g.meta === 'object') ? g.meta : {};
316
+ const els = (g && g.elements && typeof g.elements === 'object') ? g.elements : {};
317
+ const rawNodes = Array.isArray(els.nodes) ? els.nodes : [];
318
+ const rawEdges = Array.isArray(els.edges) ? els.edges : [];
319
+
320
+ const techMap = new Map();
321
+ for (let i = 0; i < rawNodes.length; i += 1) {
322
+ const d = nodeData(rawNodes[i]);
323
+ if (!d || typeof d.id !== 'string' || !d.id) continue;
324
+
325
+ // FIELD-CONTRACT ADAPTER (the 215-05 fix, tests/test-215-field-contract.cjs).
326
+ // scripts/csv-to-idea-graph.cjs -- the emitter that ALSO feeds the De Stijl
327
+ // dashboard viewer (dashboard/index.html + export-template.html read its
328
+ // section/label/summary fields) -- writes content-node fields named
329
+ // `edge_count`, `primary_label`, `labels`. This scorer's downstream contract
330
+ // (portfolio-dimensions.cjs, opportunity-statement.cjs, both unit-tested with
331
+ // these names) reads `pair_count`, `primary_problem`, `problems`. We reconcile
332
+ // HERE, in the single adapter, rather than renaming the emitter (which would
333
+ // ripple into the two dashboard templates). We still PREFER an explicit
334
+ // scorer-named field when a future graph provides one, then fall back to the
335
+ // emitter's actual name.
336
+
337
+ // pair_count (the demand/attention axis): prefer an explicit pair_count, else
338
+ // the emitter's edge_count (how many relationship rows cite this node). Absent
339
+ // -> the field was silently undefined, which pinned validated_demand at the
340
+ // degenerate 0.5 percentile for the whole cohort (the tie-block bug).
341
+ let pairCount = 0;
342
+ if (Number.isFinite(Number(d.pair_count))) pairCount = Number(d.pair_count);
343
+ else if (Number.isFinite(Number(d.edge_count))) pairCount = Number(d.edge_count);
344
+
345
+ // primary_problem (the domain the statement names): prefer primary_problem,
346
+ // else the emitter's primary_label (the district = clinical domain).
347
+ let primaryProblem = '';
348
+ if (typeof d.primary_problem === 'string' && d.primary_problem.trim()) primaryProblem = d.primary_problem;
349
+ else if (typeof d.primary_label === 'string') primaryProblem = d.primary_label;
350
+
351
+ // problems (the shared-domain intersection source): prefer problems, else labels.
352
+ let problems = [];
353
+ if (Array.isArray(d.problems)) problems = d.problems;
354
+ else if (Array.isArray(d.labels)) problems = d.labels;
355
+
356
+ // cnumber (the tail growth-recency proxy): prefer an explicit cnumber, else
357
+ // derive it from a C-number id. The emitter omits cnumber, so without this the
358
+ // cited graph techs (the ones that matter) had cnumber '' and a zeroed growth
359
+ // axis, while non-graph techFor() nodes derived theirs from the id -- an
360
+ // inconsistency that silently degraded the tail for exactly the wrong set.
361
+ let cnumber = '';
362
+ if ((typeof d.cnumber === 'string' || typeof d.cnumber === 'number') && String(d.cnumber).trim()) {
363
+ cnumber = String(d.cnumber);
364
+ } else if (/^C0*[0-9]+$/i.test(d.id)) {
365
+ cnumber = d.id;
366
+ }
367
+
368
+ techMap.set(d.id, {
369
+ id: d.id,
370
+ cnumber: cnumber,
371
+ title: (typeof d.title === 'string' && d.title.trim()) ? d.title : d.id,
372
+ primary_tier: d.primary_tier,
373
+ pair_count: pairCount,
374
+ degree: Number.isFinite(Number(d.degree)) ? Number(d.degree) : 0,
375
+ section: (typeof d.section === 'string' && d.section.trim()) ? d.section : 'unknown',
376
+ primary_problem: primaryProblem,
377
+ problems: problems,
378
+ });
379
+ }
380
+
381
+ const seen = new Set();
382
+ const convergesPairs = [];
383
+ for (let i = 0; i < rawEdges.length; i += 1) {
384
+ const d = nodeData(rawEdges[i]);
385
+ if (!d || d.type !== 'CONVERGES') continue;
386
+ const s = d.source;
387
+ const t = d.target;
388
+ if (typeof s !== 'string' || typeof t !== 'string' || !s || !t || s === t) continue;
389
+ const key = s < t ? s + ':' + t : t + ':' + s; // unordered dedupe
390
+ if (seen.has(key)) continue;
391
+ seen.add(key);
392
+ convergesPairs.push({
393
+ a: s,
394
+ b: t,
395
+ shared_problems: Array.isArray(d.shared_problems)
396
+ ? d.shared_problems.filter(function (x) { return typeof x === 'string' && x.trim(); })
397
+ : [],
398
+ // Idea-graph edges are the generic CONVERGES type (filtered above), so no
399
+ // typed relation label is available on this path; the room-native substrate
400
+ // is where the entity relation edges (COMPETES_WITH etc.) flow in.
401
+ edge_type: null,
402
+ });
403
+ }
404
+
405
+ return { meta: meta, techMap: techMap, convergesPairs: convergesPairs };
406
+ }
407
+
408
+ // Optional DG-1 brokerage map: a JSON file of id -> [0,1]. Surfaced at the CLI
409
+ // so a future Phase-212.5 Burt output plugs in with NO code change.
410
+ function loadBrokerage(brokeragePath) {
411
+ if (!brokeragePath) return null;
412
+ const raw = fs.readFileSync(brokeragePath, 'utf8');
413
+ const obj = JSON.parse(raw);
414
+ if (!obj || typeof obj !== 'object') return null;
415
+ const m = new Map();
416
+ const keys = Object.keys(obj);
417
+ for (let i = 0; i < keys.length; i += 1) {
418
+ const v = Number(obj[keys[i]]);
419
+ if (Number.isFinite(v)) m.set(keys[i], Math.max(0, Math.min(1, v)));
420
+ }
421
+ return m.size > 0 ? m : null;
422
+ }
423
+
424
+ // ---------------------------------------------------------------------------
425
+ // Report rendering.
426
+ // ---------------------------------------------------------------------------
427
+
428
+ function fmt(n, d) {
429
+ return (typeof n === 'number' && Number.isFinite(n)) ? n.toFixed(d) : 'n/a';
430
+ }
431
+
432
+ function renderReport(ctx) {
433
+ const L = [];
434
+ const p = ctx.provenance;
435
+
436
+ L.push('# Phase 215 Eureka Portfolio Report');
437
+ L.push('');
438
+ L.push('> ONE command, all shipped engines: a ranked, AHP-weighted, provenance-stamped');
439
+ L.push('> portfolio report with a DISTINCT weak-signal tail section. This is composition,');
440
+ L.push('> not a new engine (Canon Part 7). A high composite is NECESSARY not SUFFICIENT.');
441
+ L.push('');
442
+
443
+ L.push('## Provenance');
444
+ L.push('');
445
+ L.push('| Field | Value |');
446
+ L.push('| ----- | ----- |');
447
+ L.push('| Run mode | ' + p.run_mode + ' |');
448
+ L.push('| Pairs mode | ' + p.pairs_mode + ' |');
449
+ L.push('| Room dir | `' + ctx.roomDir + '` |');
450
+ L.push('| Graph | `' + ctx.graphRel + '` |');
451
+ L.push('| Encoder model | ' + p.encoder_model + ' |');
452
+ L.push('| Encoder dtype | ' + p.encoder_dtype + ' |');
453
+ L.push('| Vector backend | ' + p.vec_backend + ' |');
454
+ L.push('| AHP weights (strategic_fit / validated_demand / tech_econ_feasibility) | '
455
+ + fmt(p.ahp_weights.strategic_fit, 3) + ' / ' + fmt(p.ahp_weights.validated_demand, 3)
456
+ + ' / ' + fmt(p.ahp_weights.tech_econ_feasibility, 3) + ' |');
457
+ L.push('| AHP CR (Saaty Consistency Ratio) | ' + fmt(p.ahp_cr, 4) + ' |');
458
+ L.push('| AHP matrix source | `' + p.ahp_matrix_source + '` |');
459
+ L.push('| Tail composition | ' + p.tail_composition + ' |');
460
+ L.push('| Tail growth proxy | ' + p.growth_proxy + ' |');
461
+ L.push('| Tail thresholds (attnCut / growthCut) | ' + fmt(p.tail_thresholds.attnCut, 3)
462
+ + ' / ' + fmt(p.tail_thresholds.growthCut, 3) + ' |');
463
+ L.push('| Tail insufficient_structure | ' + String(p.tail_insufficient_structure) + ' |');
464
+ L.push('| Tail suspect_noise | ' + String(p.tail_suspect_noise) + ' |');
465
+ L.push('| Graph nodes loaded | ' + p.graph_nodes + ' |');
466
+ L.push('| CONVERGES pairs loaded | ' + p.converges_pairs + ' |');
467
+ L.push('| Cohort techs (room-indexed, run time) | ' + p.cohort_techs + ' |');
468
+ L.push('| Pairs scored | ' + p.pairs_scored + ' |');
469
+ L.push('| Scaffold pairs excluded (both endpoints memory_artifact / Artifact) | ' + p.scaffold_pairs_excluded + ' |');
470
+ L.push('| Container pairs excluded (either endpoint a Section folder node) | ' + p.container_pairs_excluded + ' |');
471
+ L.push('| Low-trust entity pairs excluded (either endpoint an unverified low_confidence entity) | ' + (p.low_trust_pairs_excluded || 0) + ' |');
472
+ L.push('| Pairs skipped (Part 8 figure-guard) | ' + p.figure_guard_skipped + ' |');
473
+ L.push('| Critic resolution (GAP-1 async pass) | ' + p.critic_resolution + ' |');
474
+ L.push('| Honest nouns (graph meta, verbatim) | ' + String(p.honest_nouns).replace(/\|/g, '/') + ' |');
475
+ L.push('| Run date | ' + p.run_date + ' |');
476
+ L.push('');
477
+
478
+ if (p.encoder_unavailable || p.degrade_cause) {
479
+ L.push('## Degraded run (cause named)');
480
+ L.push('');
481
+ // D7 (the David proving case): name the CAUSE, never the bare "not enough
482
+ // entries" symptom. Misdescribing WHY it degraded sends the navigator to fix
483
+ // the wrong thing (add content) when the real blocker is infrastructural.
484
+ if (p.degrade_cause === 'encoder_unavailable') {
485
+ L.push('Cause: `encoder_unavailable`. The embedding model is not installed or cached, so no');
486
+ L.push('semantic scores were produced. This is INFRASTRUCTURAL, not a content gap: adding more');
487
+ L.push('entries will NOT help. Fetch the model (re-run without `--offline` once the deps load),');
488
+ L.push('or run reasoning mode for an honest encoder-free short list.');
489
+ } else if (p.degrade_cause === 'below_floor') {
490
+ L.push('Cause: `below_floor`. The encoder ran, but the room scored zero pairs after a genuine');
491
+ L.push('attempt (the substrate is too thin for the embedded floor). Add cross-domain entries, or');
492
+ L.push('run reasoning mode for an honest encoder-free short list.');
493
+ } else {
494
+ L.push('The embedding spine returned `encoder_unavailable` (the transformers dependency is not');
495
+ L.push('installed, or the model could not load). No semantic scores were produced, so the ranked');
496
+ L.push('list and tail below are empty. This is a graceful degradation, not a pipeline failure.');
497
+ }
498
+ L.push('');
499
+ if (p.reasoning && typeof p.reasoning === 'object') {
500
+ L.push('Reasoning-mode next step: candidate pairs were seeded to `' + p.reasoning.workdir
501
+ + '` (state: ' + p.reasoning.state + ', ' + p.reasoning.pairs_selected + ' pairs). '
502
+ + p.reasoning.next_step + '.');
503
+ L.push('');
504
+ }
505
+ }
506
+
507
+ // SEED req 5 / D6: the reasoning -> embedded upgrade delta, in its OWN section,
508
+ // NEVER merged into the ranked table. Present only when this embedded run
509
+ // followed a prior reasoning-mode run over the same room.
510
+ if (p.upgrade && typeof p.upgrade === 'object') {
511
+ L.push('## Reasoning to embedded upgrade');
512
+ L.push('');
513
+ L.push('This room was previously scored in REASONING mode (' + p.upgrade.previous_run_date + '). This');
514
+ L.push('embedded run does NOT silently replace that result. Delta: ' + p.upgrade.survived + ' of the prior');
515
+ L.push('top pairs survived into the new embedded ranked list, ' + p.upgrade.demoted_or_absent + ' demoted or absent.');
516
+ L.push('');
517
+ const newSet = new Set();
518
+ for (let i = 0; i < ctx.ranked.length; i += 1) {
519
+ newSet.add(ctx.ranked[i].idA + '|' + ctx.ranked[i].idB);
520
+ newSet.add(ctx.ranked[i].idB + '|' + ctx.ranked[i].idA);
521
+ }
522
+ const prevTop = Array.isArray(p.upgrade.previous_top) ? p.upgrade.previous_top : [];
523
+ if (prevTop.length > 0) {
524
+ L.push('| prior pair (A x B) | in new embedded ranked |');
525
+ L.push('| ------------------ | ---------------------- |');
526
+ for (let i = 0; i < prevTop.length; i += 1) {
527
+ const pt = prevTop[i];
528
+ L.push('| ' + pt.a + ' x ' + pt.b + ' | ' + (newSet.has(pt.a + '|' + pt.b) ? 'yes' : 'no (demoted/absent)') + ' |');
529
+ }
530
+ L.push('');
531
+ }
532
+ }
533
+
534
+ // -- Ranked top N (score is a sort key; the tail is NOT) --
535
+ L.push('## Ranked top ' + ctx.top);
536
+ L.push('');
537
+ L.push('Ranked by the AHP composite score descending. `weak dims` are the dimensions strictly');
538
+ L.push('below the weak floor on either side (the combine rationale). `banked` is true ONLY on a');
539
+ L.push('resolved passing critic verdict.');
540
+ L.push('');
541
+ if (ctx.ranked.length === 0) {
542
+ L.push('_No ranked pairs (see the encoder note above, or the graph paired nothing in the room)._');
543
+ L.push('');
544
+ } else {
545
+ L.push('| rank | A (id: title) | B (id: title) | score | strat_fit | val_demand | feasibility | weak dims | banked |');
546
+ L.push('| ---- | ------------- | ------------- | ----- | --------- | ---------- | ----------- | --------- | ------ |');
547
+ for (let i = 0; i < ctx.ranked.length; i += 1) {
548
+ const r = ctx.ranked[i];
549
+ const weak = (r.weakA.concat(r.weakB));
550
+ const weakStr = weak.length ? Array.from(new Set(weak)).join(', ') : 'none';
551
+ L.push('| ' + r.rank
552
+ + ' | ' + r.idA + ': ' + truncate(r.techA.title, 30)
553
+ + ' | ' + r.idB + ': ' + truncate(r.techB.title, 30)
554
+ + ' | ' + fmt(r.score, 3)
555
+ + ' | ' + fmt(r.pairDims.strategic_fit, 2)
556
+ + ' | ' + fmt(r.pairDims.validated_demand, 2)
557
+ + ' | ' + fmt(r.pairDims.tech_econ_feasibility, 2)
558
+ + ' | ' + weakStr
559
+ + ' | ' + (r.banked ? 'yes' : 'no')
560
+ + ' |');
561
+ }
562
+ L.push('');
563
+ }
564
+
565
+ // -- Tail quadrant: its OWN section, never a sort key --
566
+ L.push('## Tail quadrant (weak signals)');
567
+ L.push('');
568
+ L.push('The low-attention / high-growth quadrant: under-watched technologies whose catalog');
569
+ L.push('recency is rising. These are the gems a top-N sort buries, which is exactly why they get');
570
+ L.push('their own section. Axes are per-cohort percentiles (scale-free); growth is a RECENCY');
571
+ L.push('proxy (cnumber), not a measured market-growth rate.');
572
+ L.push('');
573
+ if (ctx.provenance.pairs_mode === 'room') {
574
+ L.push('Room-native axes: attention is room-graph node degree, growth is created_at recency');
575
+ L.push('(still a proxy, still UNCALIBRATED).');
576
+ L.push('');
577
+ }
578
+ if (ctx.tail.insufficient_structure) {
579
+ L.push('**Verdict: INSUFFICIENT STRUCTURE.** The cohort (' + ctx.provenance.cohort_techs
580
+ + ' techs) is below the minimum needed to define a whitespace quadrant. No tail is');
581
+ L.push('classified. This is the honest degenerate verdict, printed INSTEAD of dressing up noise.');
582
+ if (ctx.provenance.pairs_mode === 'room') {
583
+ L.push('Not enough entries for a tail read (the cohort is below the MIN_COHORT 30 floor). The '
584
+ + 'ranked pairs and Opportunity Statements above still stand.');
585
+ }
586
+ L.push('');
587
+ } else if (ctx.tail.suspect_noise) {
588
+ L.push('**Verdict: SUSPECT NOISE.** The quadrant swallowed too large a fraction of the cohort to');
589
+ L.push('be a real weak signal. The list is kept below for transparency but is flagged as likely');
590
+ L.push('noise, not a curated gem set.');
591
+ L.push('');
592
+ }
593
+ if (!ctx.tail.insufficient_structure && ctx.tail.tail.length > 0) {
594
+ L.push('| # | tech | attention (pctile) | growth (pctile) |');
595
+ L.push('| - | ---- | ------------------ | --------------- |');
596
+ for (let i = 0; i < ctx.tail.tail.length; i += 1) {
597
+ const t = ctx.tail.tail[i];
598
+ const tech = ctx.techFor(t.id);
599
+ L.push('| ' + (i + 1) + ' | ' + t.id + ': ' + truncate(tech.title, 30)
600
+ + ' | ' + fmt(t.attention, 3) + ' | ' + fmt(t.growth, 3) + ' |');
601
+ }
602
+ L.push('');
603
+ } else if (!ctx.tail.insufficient_structure) {
604
+ L.push('_No technology fell into the low-attention / high-growth quadrant this run._');
605
+ L.push('');
606
+ }
607
+ L.push('### Tail-driven candidate pairs');
608
+ L.push('');
609
+ L.push('Pairs where at least one side is tail-flagged AND the two sides are complementary-weak');
610
+ L.push('(disjoint weak dimensions). These ride into the Opportunity Statements even when');
611
+ L.push('outranked, because surfacing them is the whole point of the tail category.');
612
+ L.push('');
613
+ if (ctx.tailPairs.length === 0) {
614
+ L.push('_No tail-driven complementary pairs this run._');
615
+ L.push('');
616
+ } else {
617
+ L.push('| rank | A | B | score | complementary |');
618
+ L.push('| ---- | - | - | ----- | ------------- |');
619
+ for (let i = 0; i < ctx.tailPairs.length; i += 1) {
620
+ const r = ctx.tailPairs[i];
621
+ L.push('| ' + r.rank + ' | ' + r.idA + ' | ' + r.idB + ' | ' + fmt(r.score, 3) + ' | yes |');
622
+ }
623
+ L.push('');
624
+ }
625
+
626
+ // -- Opportunity Statements --
627
+ L.push('## Opportunity Statements');
628
+ L.push('');
629
+ L.push('Each candidate rendered in the canonical Opportunity Statement shape. A `pending` critic');
630
+ L.push('verdict is labeled NOT YET BANKED (critic pending): the synchronous emitter never claims a');
631
+ L.push('verification it did not obtain. On LIVE runs a bounded async pass then resolves each');
632
+ L.push('pending verdict against the real Phase 212 critic (GAP-1 fix): a resolved pass is BANKED,');
633
+ L.push('a resolved fail is NOT BANKED (with the verdict named), and anything the pass cannot');
634
+ L.push('genuinely resolve stays honestly pending.');
635
+ L.push('');
636
+ if (ctx.statements.length === 0) {
637
+ L.push('_No statement candidates this run._');
638
+ L.push('');
639
+ } else {
640
+ for (let i = 0; i < ctx.statements.length; i += 1) {
641
+ const s = ctx.statements[i];
642
+ // Three honest states (GAP-1): banked on a resolved pass; still pending
643
+ // (sync degrade, offline run, or an unresolvable async pass); or
644
+ // RESOLVED-BUT-FAILED -- the critic really looked and said no, which is
645
+ // information, not a pending state.
646
+ let state;
647
+ if (s.statement.banked) {
648
+ state = 'BANKED (critic ' + (typeof s.statement.critic === 'object' && s.statement.critic
649
+ ? (s.statement.critic.verdict || 'pass') : 'pass') + ')';
650
+ } else if (s.statement.critic === 'pending') {
651
+ state = 'NOT YET BANKED (critic pending)';
652
+ } else {
653
+ const v = (typeof s.statement.critic === 'object' && s.statement.critic)
654
+ ? (s.statement.critic.verdict || s.statement.critic.route || s.statement.critic.tag || 'fail')
655
+ : String(s.statement.critic);
656
+ state = 'NOT BANKED (critic resolved: ' + v + ')';
657
+ }
658
+ L.push('### ' + (i + 1) + '. rank ' + s.pair.rank + ' -- ' + s.pair.idA + ' x ' + s.pair.idB
659
+ + (s.tailFlag ? ' [WEAK-SIGNAL TAIL]' : ''));
660
+ L.push('');
661
+ L.push(s.statement.text);
662
+ L.push('');
663
+ // SEED req 1: the mode label is render-visible on BOTH paths (embedded here,
664
+ // reasoning in renderReasoningReport).
665
+ L.push('- Mode: embedded');
666
+ L.push('- State: ' + state);
667
+ L.push('- Potential: ' + s.statement.fields.potential_tier);
668
+ L.push('- Next steps (deep analysis is RECOMMENDED, never auto-triggered): ' + s.statement.fields.next_steps);
669
+ L.push('');
670
+ }
671
+ }
672
+
673
+ // -- Mandatory caveat block --
674
+ L.push('## Caveat (necessary not sufficient)');
675
+ L.push('');
676
+ L.push('- A high AHP composite is NECESSARY, not SUFFICIENT. The top of this list may be');
677
+ L.push(' restatements; the Grounding Guard (Phase 212) is the filter, this runner only surfaces.');
678
+ L.push('- The score BANDS and the potential tiers are UNCALIBRATED defaults (202-APO tunes them).');
679
+ L.push('- Growth is a RECENCY PROXY (cnumber), not a measured market-growth rate. A rising catalog');
680
+ L.push(' number means newer, not proven to be growing demand.');
681
+ L.push('- Real-room content NEVER reaches a network judge. This report is verified by the human');
682
+ L.push(' spot-check at the Plan 05 checkpoint, not by Plurai.');
683
+ L.push('');
684
+ if (ctx.offline && !ctx.provenance.encoder_unavailable) {
685
+ L.push('> OFFLINE CAVEAT: the stub encoder scores semantic overlap as a hashed bag-of-tokens, so');
686
+ L.push('> the semantic leg TRACKS lexical overlap by construction. This run is a STRUCTURAL smoke');
687
+ L.push('> signal only; it is NOT embedding-quality evidence. The embedding-quality answer needs');
688
+ L.push('> the LIVE run.');
689
+ L.push('');
690
+ }
691
+
692
+ return L.join('\n') + '\n';
693
+ }
694
+
695
+ // ---------------------------------------------------------------------------
696
+ // Phase 226-02: the reasoning-mode render (a sibling of renderReport, NOT a
697
+ // duplicate of the embedded tables). It leads with the confidence caveat, shows
698
+ // the ONE surviving number (lsa_similarity), and NEVER renders a differential /
699
+ // semantic / AHP score column (a fabricated-number column is the D1 lie in render
700
+ // form). D6: every row it renders must be mode:'reasoning' (asserted below).
701
+ // ---------------------------------------------------------------------------
702
+
703
+ function renderReasoningReport(ctx) {
704
+ const L = [];
705
+ const p = ctx.provenance || {};
706
+ const ranked = Array.isArray(ctx.ranked) ? ctx.ranked : [];
707
+ const statements = Array.isArray(ctx.statements) ? ctx.statements : [];
708
+
709
+ // D6 never-merge guard (one line, in code): this render only ever shows
710
+ // reasoning-mode rows; an embedded row here would be a merged-list bug.
711
+ for (let i = 0; i < ranked.length; i += 1) {
712
+ if (ranked[i].mode !== 'reasoning') {
713
+ throw new Error('renderReasoningReport: ranked row ' + i + " is not mode:'reasoning' (D6 never-merge)");
714
+ }
715
+ }
716
+ for (let i = 0; i < statements.length; i += 1) {
717
+ if (statements[i].mode !== 'reasoning') {
718
+ throw new Error('renderReasoningReport: statement row ' + i + " is not mode:'reasoning' (D6 never-merge)");
719
+ }
720
+ }
721
+
722
+ L.push('# Phase 226 Eureka Portfolio Report (reasoning mode)');
723
+ L.push('');
724
+
725
+ // -- The PROMINENT caveat block, FIRST, before provenance (the anti-overconfidence
726
+ // antidote: stated once, up front, never a footer). Names all five elements. --
727
+ L.push('## Read this first (reasoning-mode caveat)');
728
+ L.push('');
729
+ L.push('1. This is a REASONING-MODE result: lower confidence BY BASIS, not a verdict. The pairs');
730
+ L.push(' below are a short working diagnosis, not a finished ranked list.');
731
+ L.push('2. WHY the basis is weak: the embedding encoder was unavailable (degrade cause: `'
732
+ + String(p.degrade_cause) + '`), so 2 of the critic\'s 3 numeric legs (differential_score and');
733
+ L.push(' semantic_similarity) are structurally null. Only the lexical overlap (Jaccard,');
734
+ L.push(' lsa_similarity) is a real number here.');
735
+ L.push('3. The analogy bar was NOT lowered: the SAME six-item structure-mapping rubric ran twice');
736
+ L.push(' (neutral + adversarial) and the verdict was computed by code, exactly as embedded mode.');
737
+ L.push('4. Nothing here is banked or confirmed. Acting on any pair is a human decision (Canon Part 9:');
738
+ L.push(' human-only promotion); banked is false on every row.');
739
+ L.push('5. Re-running after the encoder is installed upgrades this room to embedded mode and shows');
740
+ L.push(' the reasoning -> embedded delta, rather than silently replacing this result.');
741
+ L.push('');
742
+
743
+ // -- Provenance (reusing the renderReport table idiom, reasoning fields only). --
744
+ L.push('## Provenance');
745
+ L.push('');
746
+ L.push('| Field | Value |');
747
+ L.push('| ----- | ----- |');
748
+ L.push('| Run mode | ' + p.run_mode + ' |');
749
+ L.push('| Degrade cause | ' + p.degrade_cause + ' |');
750
+ L.push('| Formula version | ' + p.formula_version + ' |');
751
+ L.push('| Entries read | ' + p.entries_read + ' |');
752
+ L.push('| Pairs considered / sent / cap | ' + p.pairs_considered + ' / ' + p.pairs_sent + ' / ' + p.reasoning_cap + ' |');
753
+ L.push('| Rejected by rubric (pseudoscience / restatement / general_shallow) | '
754
+ + (p.pairs_rejected_by_rubric ? p.pairs_rejected_by_rubric.pseudoscience : 'n/a') + ' / '
755
+ + (p.pairs_rejected_by_rubric ? p.pairs_rejected_by_rubric.restatement : 'n/a') + ' / '
756
+ + (p.pairs_rejected_by_rubric ? p.pairs_rejected_by_rubric.general_shallow : 'n/a') + ' |');
757
+ L.push('| Banking | ' + p.banking + ' |');
758
+ L.push('| Run date | ' + p.run_date + ' |');
759
+ L.push('');
760
+
761
+ // -- Ranked (reasoning mode). NEVER a differential / semantic / AHP score column. --
762
+ L.push('## Ranked top ' + ctx.top + ' (reasoning mode)');
763
+ L.push('');
764
+ L.push('Ordered ascending by lexical overlap. LOW lexical overlap on a pair the rubric still');
765
+ L.push('cleared is the eureka signature: shared meaning the vocabulary hides.');
766
+ L.push('');
767
+ if (ranked.length === 0) {
768
+ L.push('_No pair cleared the two-pass rubric this run (an honest short/empty reasoning result)._');
769
+ L.push('');
770
+ } else {
771
+ L.push('| rank | pair (A x B) | lsa_similarity | verdict | mode |');
772
+ L.push('| ---- | ------------ | -------------- | ------- | ---- |');
773
+ for (let i = 0; i < ranked.length; i += 1) {
774
+ const r = ranked[i];
775
+ L.push('| ' + r.rank
776
+ + ' | ' + truncate(String(r.a_title || r.a), 30) + ' x ' + truncate(String(r.b_title || r.b), 30)
777
+ + ' | ' + fmt(r.lsa_similarity, 3)
778
+ + ' | ' + r.verdict
779
+ + ' | ' + r.mode
780
+ + ' |');
781
+ }
782
+ L.push('');
783
+ }
784
+
785
+ // -- Statements: each text with its mode + banked:false visible. --
786
+ L.push('## Statements');
787
+ L.push('');
788
+ if (statements.length === 0) {
789
+ L.push('_No statement candidates this run._');
790
+ L.push('');
791
+ } else {
792
+ for (let i = 0; i < statements.length; i += 1) {
793
+ const s = statements[i];
794
+ L.push('### ' + (i + 1) + '. rank ' + s.rank + ' -- ' + s.a + ' x ' + s.b);
795
+ L.push('');
796
+ L.push(s.text);
797
+ L.push('');
798
+ L.push('| Field | Value |');
799
+ L.push('| ----- | ----- |');
800
+ L.push('| Mode | ' + s.mode + ' |');
801
+ L.push('| Banked | ' + String(s.banked) + ' |');
802
+ L.push('| Critic verdict | ' + s.critic + ' |');
803
+ L.push('| lsa_similarity (' + s.lexical_method + ') | ' + fmt(s.lsa_similarity, 3) + ' |');
804
+ L.push('| Potential | ' + s.potential_tier + ' |');
805
+ L.push('');
806
+ }
807
+ }
808
+
809
+ return L.join('\n') + '\n';
810
+ }
811
+
812
+ // ---------------------------------------------------------------------------
813
+ // main
814
+ // ---------------------------------------------------------------------------
815
+
816
+ async function main(argv) {
817
+ const opts = parseArgv(argv);
818
+ if (opts.help) {
819
+ process.stdout.write(HELP + '\n');
820
+ return 0;
821
+ }
822
+
823
+ // Phase 226-02 stage dispatch (TOP of main, before the AHP load): the emit and
824
+ // score stages read the workdir a genuine degrade run already seeded; neither
825
+ // opens the encoder nor re-runs the embedded pipeline (SEED req 7: additive).
826
+ if (opts.reasoningEmit) return reasoningStageEmit(opts);
827
+ if (opts.reasoningScore) return reasoningStageScore(opts);
828
+
829
+ const roomDir = path.isAbsolute(opts.db) ? opts.db : path.join(REPO_ROOT, opts.db);
830
+ const graphPath = path.isAbsolute(opts.graph) ? opts.graph : path.join(REPO_ROOT, opts.graph);
831
+ const outPath = path.isAbsolute(opts.out) ? opts.out : path.join(REPO_ROOT, opts.out);
832
+ const jsonPath = path.isAbsolute(opts.json) ? opts.json : path.join(REPO_ROOT, opts.json);
833
+
834
+ let db = null;
835
+ try {
836
+ // (6, early) Reload the AHP weights PER RUN. An inconsistent matrix throws
837
+ // AHP_INCONSISTENT here and aborts LOUDLY with exit 1: a bad matrix must
838
+ // never produce a silently mis-weighted report.
839
+ const ahpConfig = ahp.loadAhpConfig();
840
+ const weights = ahpConfig.weights;
841
+ const weightsByCriteria = {
842
+ strategic_fit: weights[0],
843
+ validated_demand: weights[1],
844
+ tech_econ_feasibility: weights[2],
845
+ };
846
+ const matrixSource = ahp._test && ahp._test.DEFAULT_CONFIG_PATH
847
+ ? path.relative(REPO_ROOT, ahp._test.DEFAULT_CONFIG_PATH)
848
+ : 'data/portfolio-ahp-matrix.json';
849
+
850
+ // (1) Substrate. graph/full read the cited idea-graph from disk BEFORE the
851
+ // room opens (unchanged from Phase 215). room mode (D-01) reads NEITHER the
852
+ // graphPath NOR loadGraph: it builds pairs + signals from room.db via the
853
+ // adapter AFTER the room opens, so a nonexistent --graph never aborts a room
854
+ // run. techMap/convergesPairs/graph are hoisted so both paths fill them.
855
+ let graph = null;
856
+ let techMap;
857
+ let convergesPairs;
858
+ const brokerage = loadBrokerage(opts.brokerage ? (path.isAbsolute(opts.brokerage) ? opts.brokerage : path.join(REPO_ROOT, opts.brokerage)) : '');
859
+
860
+ if (opts.pairs !== 'room') {
861
+ // Counts read from THIS load (never a frozen literal).
862
+ graph = loadGraph(graphPath);
863
+ techMap = graph.techMap;
864
+ convergesPairs = graph.convergesPairs;
865
+ }
866
+
867
+ // (2) Open the room + build the tri-modal index.
868
+ db = openRoomDb(roomDir, { allowExtension: true });
869
+
870
+ if (opts.pairs === 'room') {
871
+ // Room-native substrate: the adapter keys techs by the SAME catalogId join
872
+ // the index uses below, so pair ids + techMap live in one id-space. No
873
+ // idea-graph file is read (Test 2 pins that graphPath is never touched).
874
+ const sub = roomNative.buildRoomNativeSubstrate(db, { canonicalId: catalogId });
875
+ graph = { meta: sub.meta };
876
+ techMap = sub.techMap;
877
+ convergesPairs = sub.convergesPairs;
878
+ }
879
+ const encodeFn = opts.offline ? stubEncode : undefined;
880
+ // Phase 226-02 degrade-test seam: forward _forceUnavailable ONLY when the flag
881
+ // is set, so an unset run passes undefined and stays byte-identical (the plan-01
882
+ // tri-modal forwarding). Set -> idx.embedded !== true even on a model-cached box.
883
+ const idx = await triModal.indexNodes(db, {
884
+ encodeFn: encodeFn,
885
+ roomDir: roomDir,
886
+ _forceUnavailable: opts.forceEncoderUnavailable ? true : undefined,
887
+ });
888
+
889
+ // (3) HARD GATE (T-215-09, the 211 fix class): score ONLY when this run
890
+ // freshly embedded. Stale eureka_vec rows from an earlier offline run must
891
+ // never be scored under a LIVE label. Gate on idx.embedded === true.
892
+ const rows = db.prepare('SELECT id, type, properties, source_path FROM nodes').all();
893
+ const rootOf = buildRootDomainMap(rows);
894
+ const vectors = idx.embedded === true ? loadIndexVectors(db, idx.vec_backend) : new Map();
895
+
896
+ // Index keyed by the PUBLIC catalog id (catalogId) so pair ids + graph-join
897
+ // speak the idea-graph's C-number id-space, NOT the room's opaque hash ids.
898
+ // The raw room id is retained for vector + text + root-domain lookups (those
899
+ // three tables are keyed by the room id). Last write wins on the (rare, here
900
+ // zero) canonical-id collision.
901
+ const indexed = new Map();
902
+ if (idx.embedded === true) {
903
+ for (let i = 0; i < rows.length; i += 1) {
904
+ const text = triModal.nodeText(rows[i], { roomDir: roomDir });
905
+ if (!text) continue;
906
+ const vec = vectors.get(rows[i].id);
907
+ if (!vec) continue;
908
+ const canonical = catalogId(rows[i]);
909
+ indexed.set(canonical, {
910
+ id: canonical,
911
+ rawId: rows[i].id,
912
+ type: rows[i].type || 'unknown',
913
+ text: text,
914
+ vec: vec,
915
+ root: rootOf(rows[i].id),
916
+ // quick 260719: precompute the low-trust flag once at index time so the
917
+ // step-4b exclusion pass reads it without re-parsing props per pair.
918
+ lowTrust: isLowTrustEntity(rows[i]),
919
+ });
920
+ }
921
+ }
922
+
923
+ // Cohort = the techs actually present in the room index (read at run time).
924
+ const cohortTechs = Array.from(indexed.keys()).map(function (id) { return techFor(techMap, id); });
925
+ const techForCtx = function (id) { return techFor(techMap, id); };
926
+
927
+ // Phase 218 fix (T-218-VD, traced live against aion-eureka-synergy):
928
+ // scoreTechDimensions' validated_demand/tech_econ_feasibility are PERCENTILE
929
+ // ranks of pair_count/degree WITHIN the cohort array passed in. Room-native
930
+ // degree is raw undirected edge count accumulated since the node was born
931
+ // (room-native-substrate.cjs::degreeMap). A memory_artifact scaffold node
932
+ // that has lived in the room for months accrues dozens of edges; a freshly
933
+ // written company/technology/market entity node starts at degree 1 (its
934
+ // single DESCRIBES link back to the artifact it came from) and gets WORSE
935
+ // as more entities point at the same hub. Pooling both families into ONE
936
+ // percentile population means every entity node's percentile is dragged to
937
+ // the floor by comparison against long-accumulated hub degree, regardless of
938
+ // how relevant the entity actually is - not a real weakness signal, an
939
+ // artifact-of-age signal. Verified live: pre-218-fix, aion-eureka-synergy's
940
+ // top-25 stayed 100% memory_artifact-vs-memory_artifact even after 149
941
+ // entity nodes were written (VERIFICATION.md, phase 218-03).
942
+ //
943
+ // Fix: stratify the percentile population by node-type family before
944
+ // ranking. Entity nodes are percentile-ranked against OTHER entity nodes
945
+ // (fair - a same-age peer group); everything else keeps the original
946
+ // mixed cohort. When a room has ZERO entity nodes, entityCohort stays
947
+ // empty and every tech routes to scaffoldCohort === the original
948
+ // cohortTechs array (byte-identical output to pre-fix behavior - this is
949
+ // the "no entity nodes -> unchanged" regression guard).
950
+ const entityCohort = [];
951
+ const scaffoldCohort = [];
952
+ for (let ci = 0; ci < cohortTechs.length; ci += 1) {
953
+ const cid = cohortTechs[ci].id;
954
+ const cnode = indexed.get(cid);
955
+ const cType = cnode && cnode.type;
956
+ if (ENTITY_NODE_TYPES.has(cType)) entityCohort.push(cohortTechs[ci]);
957
+ else scaffoldCohort.push(cohortTechs[ci]);
958
+ }
959
+ const cohortFor = function (id) {
960
+ const node = indexed.get(id);
961
+ const nodeType = node && node.type;
962
+ return ENTITY_NODE_TYPES.has(nodeType) ? entityCohort : scaffoldCohort;
963
+ };
964
+
965
+ // (4) Pair set per DG-2 mode.
966
+ const pairsToScore = [];
967
+ if (opts.pairs === 'full') {
968
+ // The 211 cross-boundary enumeration: differ in root-domain OR differ in type.
969
+ const arr = Array.from(indexed.values());
970
+ for (let i = 0; i < arr.length; i += 1) {
971
+ for (let j = i + 1; j < arr.length; j += 1) {
972
+ const a = arr[i];
973
+ const b = arr[j];
974
+ if (a.root === b.root && a.type === b.type) continue;
975
+ pairsToScore.push({ a: a.id, b: b.id, shared_problems: [] });
976
+ }
977
+ }
978
+ } else if (opts.pairs === 'room') {
979
+ // Room mode: the UNION of (a) the room's OWN cited edges (convergesPairs,
980
+ // both endpoints indexed) and (b) the full-mode cross-boundary enumeration.
981
+ // The room's typed edges are its cited convergences and must always score
982
+ // even same-type/same-root (the DG-2 cited-signal spirit) EXCEPT when both
983
+ // endpoints are scaffold types: those are caught by the post-enumeration
984
+ // both-scaffold exclusion below (quick task 260715-0nj). This exception is
985
+ // honest per the 260714-hzx finding that the 39-node memory_artifact
986
+ // CONVERGES clique refills the top-25 whenever the entity cohort thins, so
987
+ // a cited scaffold-vs-scaffold edge is document scaffolding, not a signal.
988
+ // Cross-boundary enumeration guarantees non-empty pairs on edge-sparse
989
+ // rooms. Edge pairs are pushed FIRST so their shared_problems survive the
990
+ // unordered dedupe.
991
+ const seenPairs = new Set();
992
+ const pushPair = function (a, b, shared, edgeType) {
993
+ const key = a < b ? a + '|' + b : b + '|' + a;
994
+ if (seenPairs.has(key)) return;
995
+ seenPairs.add(key);
996
+ pairsToScore.push({
997
+ a: a, b: b, shared_problems: Array.isArray(shared) ? shared : [], edge_type: edgeType || null,
998
+ });
999
+ };
1000
+ for (let i = 0; i < convergesPairs.length; i += 1) {
1001
+ const cp = convergesPairs[i];
1002
+ if (indexed.has(cp.a) && indexed.has(cp.b)) pushPair(cp.a, cp.b, cp.shared_problems, cp.edge_type);
1003
+ }
1004
+ const arr = Array.from(indexed.values());
1005
+ for (let i = 0; i < arr.length; i += 1) {
1006
+ for (let j = i + 1; j < arr.length; j += 1) {
1007
+ const a = arr[i];
1008
+ const b = arr[j];
1009
+ if (a.root === b.root && a.type === b.type) continue;
1010
+ pushPair(a.id, b.id, [], null);
1011
+ }
1012
+ }
1013
+ } else {
1014
+ // graph mode: the cited CONVERGES substrate, both ids present in the room.
1015
+ for (let i = 0; i < convergesPairs.length; i += 1) {
1016
+ const cp = convergesPairs[i];
1017
+ if (indexed.has(cp.a) && indexed.has(cp.b)) pairsToScore.push(cp);
1018
+ }
1019
+ }
1020
+
1021
+ // (4b) Candidate-pair exclusion pass (quick task 260715-0nj + Seam 3). A
1022
+ // single post-enumeration pass, chosen over per-mode inline checks so ALL
1023
+ // THREE modes (graph, full, room) are covered at exactly one insertion
1024
+ // point. Two ADDITIVE exclusion classes share this one pass:
1025
+ // (a) container (Seam 3): EITHER endpoint is a Section folder node - never a
1026
+ // valid opportunity endpoint (see CONTAINER_NODE_TYPES). Checked FIRST.
1027
+ // (b) both-scaffold (260715-0nj): BOTH endpoints are members of
1028
+ // SCAFFOLD_NODE_TYPES (memory_artifact / Artifact) - structural
1029
+ // scaffolding, never a real cross-domain opportunity (the
1030
+ // opportunity-harvest.cjs lines 519-521 precedent, extended to the
1031
+ // ranking candidate set). Pairs with only ONE scaffold side are NOT
1032
+ // touched (narrow scope, per the 260714-hzx disposition).
1033
+ // Both endpoints are always present in `indexed` for scoreable pairs, but
1034
+ // guard defensively: a missing indexed entry means the pair is NOT treated as
1035
+ // container or scaffold. Each class is counted honestly and surfaced in
1036
+ // provenance (never a silent suppression).
1037
+ let scaffoldPairsExcluded = 0;
1038
+ // Seam 3 (RCA eureka-domain-swap-invariant): the container-node exclusion, an
1039
+ // ADDITIVE branch at this same step-4b insertion point. See CONTAINER_NODE_TYPES
1040
+ // for the full rationale. Counted separately and surfaced in provenance, never a
1041
+ // silent suppression.
1042
+ let containerPairsExcluded = 0;
1043
+ // quick 260719 (RCA handoff-eureka-entity-noise): the low-trust entity exclusion,
1044
+ // a third ADDITIVE branch at this same step-4b insertion point. See
1045
+ // LOW_TRUST_EVIDENCE_TIERS for the full rationale. Counted separately and
1046
+ // surfaced in provenance, never a silent suppression.
1047
+ let lowTrustPairsExcluded = 0;
1048
+ // Decision-8 graceful-degradation guard (RCA handoff-eureka-entity-noise, REQ-5
1049
+ // reconciliation). The low-trust exclusion below only fires when the room has at
1050
+ // least one VERIFIED entity to surface instead. In a keyless, encoder-unavailable
1051
+ // Tier-0 room EVERY entity degrades to low_confidence/fallback; suppressing all of
1052
+ // them would rank the room EMPTY, which breaks Decision 8 ("Tier 0 fully
1053
+ // functional; graceful degradation everywhere") and the REQ-5 non-empty contract
1054
+ // (test-218-noise-reduction). So: denoise a MIXED room (drop the unverified regex
1055
+ // hits like the aion room's 206 low-confidence escalations, keep its 399 confident
1056
+ // ones), but keep a PURE-unverified room productive rather than emptying it. A
1057
+ // verified entity is a typed entity node NOT stamped low-trust.
1058
+ let hasVerifiedEntity = false;
1059
+ indexed.forEach(function (n) {
1060
+ if (!hasVerifiedEntity && n && ENTITY_NODE_TYPES.has(n.type) && !n.lowTrust) {
1061
+ hasVerifiedEntity = true;
1062
+ }
1063
+ });
1064
+ const filteredPairs = [];
1065
+ for (let i = 0; i < pairsToScore.length; i += 1) {
1066
+ const cp = pairsToScore[i];
1067
+ const na = indexed.get(cp.a);
1068
+ const nb = indexed.get(cp.b);
1069
+ // Container exclusion (EITHER endpoint). A Section node is a folder label,
1070
+ // never real content, so it is never a valid endpoint on either side - unlike
1071
+ // the both-endpoint scaffold rule below, where a single Artifact is still
1072
+ // legitimate content. This deliberate scope difference removes the whole
1073
+ // degenerate class (a content node ranked against its OWN containing section,
1074
+ // plus Section x Section folder-label pairings) that the critic otherwise
1075
+ // catches only as domain_swap_invariant after it has consumed a ranked slot.
1076
+ const aContainer = !!(na && CONTAINER_NODE_TYPES.has(na.type));
1077
+ const bContainer = !!(nb && CONTAINER_NODE_TYPES.has(nb.type));
1078
+ if (aContainer || bContainer) {
1079
+ containerPairsExcluded += 1;
1080
+ continue;
1081
+ }
1082
+ // Low-trust entity exclusion (EITHER endpoint, quick 260719). An entity node
1083
+ // stamped evidenceTier low_confidence (see LOW_TRUST_EVIDENCE_TIERS) is an
1084
+ // unverified tier-1 regex hit no semantic tier confirmed. Like a
1085
+ // container it is never a valid opportunity endpoint on EITHER side (deliberate
1086
+ // scope difference from the both-endpoint scaffold rule: a single low-trust
1087
+ // guess taints the pair). Checked AFTER container so a Section endpoint stays
1088
+ // counted as container. GUARDED on hasVerifiedEntity (see above) so a pure
1089
+ // Tier-0 room stays productive instead of ranking empty. Counted + surfaced in
1090
+ // provenance, never silent.
1091
+ const aLowTrust = !!(na && na.lowTrust);
1092
+ const bLowTrust = !!(nb && nb.lowTrust);
1093
+ if (hasVerifiedEntity && (aLowTrust || bLowTrust)) {
1094
+ lowTrustPairsExcluded += 1;
1095
+ continue;
1096
+ }
1097
+ const aScaffold = !!(na && SCAFFOLD_NODE_TYPES.has(na.type));
1098
+ const bScaffold = !!(nb && SCAFFOLD_NODE_TYPES.has(nb.type));
1099
+ if (aScaffold && bScaffold) {
1100
+ scaffoldPairsExcluded += 1;
1101
+ continue;
1102
+ }
1103
+ filteredPairs.push(cp);
1104
+ }
1105
+
1106
+ // (5) + (6) Score each pair; compose the three-dimension AHP score.
1107
+ const scored = [];
1108
+ let part8Skipped = 0;
1109
+ let progress = 0;
1110
+ for (let k = 0; k < filteredPairs.length; k += 1) {
1111
+ const cp = filteredPairs[k];
1112
+ const na = indexed.get(cp.a);
1113
+ const nb = indexed.get(cp.b);
1114
+ let r;
1115
+ try {
1116
+ // eslint-disable-next-line no-await-in-loop
1117
+ r = await scoreMeasured(na.text, nb.text, { vectors: [na.vec, nb.vec] });
1118
+ } catch (_e) {
1119
+ // Part 8 figure-guard (ExternalEgressViolation): skip + count, never abort.
1120
+ part8Skipped += 1;
1121
+ continue;
1122
+ }
1123
+ if (r.warning === 'encoder_unavailable' || r.signed_diff === null) continue;
1124
+
1125
+ const techA = techFor(techMap, cp.a);
1126
+ const techB = techFor(techMap, cp.b);
1127
+ const dimsA = pdims.scoreTechDimensions(techA, cohortFor(cp.a));
1128
+ const dimsB = pdims.scoreTechDimensions(techB, cohortFor(cp.b));
1129
+ const rs = { direction: r.direction, abs_diff: r.abs_diff, passes: r.passes };
1130
+ const pairDims = pdims.scorePairDimensions({ a: dimsA, b: dimsB, rs: rs });
1131
+ const score = ahp.composeScore(pairDims, weights);
1132
+ const weakA = pdims.weakDimensions(dimsA);
1133
+ const weakB = pdims.weakDimensions(dimsB);
1134
+ const isComp = pdims.complementary(dimsA, dimsB);
1135
+
1136
+ scored.push({
1137
+ idA: cp.a, idB: cp.b, techA: techA, techB: techB,
1138
+ dimsA: dimsA, dimsB: dimsB, pairDims: pairDims, score: score,
1139
+ weakA: weakA, weakB: weakB, isComp: isComp,
1140
+ shared_problems: cp.shared_problems, edge_type: cp.edge_type || null, rs: rs,
1141
+ });
1142
+
1143
+ progress += 1;
1144
+ if (opts.pairs === 'full' && progress % PROGRESS_EVERY === 0) {
1145
+ process.stderr.write(' scored ' + progress + ' pairs...\n');
1146
+ }
1147
+ }
1148
+
1149
+ // (7) Tail: per-TECH axes over the cohort. attention = pair_count percentile,
1150
+ // growth = cnumber-recency percentile. classifyTail owns the degeneracy guards.
1151
+ const pairCounts = cohortTechs.map(function (t) { return finiteOr0(t.pair_count); }).sort(function (a, b) { return a - b; });
1152
+ const cnums = cohortTechs.map(function (t) { return cnumberNumeric(t.cnumber); }).sort(function (a, b) { return a - b; });
1153
+ const tailItems = cohortTechs.map(function (t) {
1154
+ return {
1155
+ id: t.id,
1156
+ attention: pdims.percentileRank(finiteOr0(t.pair_count), pairCounts),
1157
+ growth: pdims.percentileRank(cnumberNumeric(t.cnumber), cnums),
1158
+ };
1159
+ });
1160
+ const tailResult = tailmod.classifyTail(tailItems, brokerage ? { brokerage: brokerage } : {});
1161
+ const tailIds = new Set(tailResult.tail.map(function (t) { return t.id; }));
1162
+
1163
+ // (8) Rank pairs; keep --top; add tail-flagged complementary pairs as candidates.
1164
+ scored.sort(function (x, y) { return y.score - x.score; });
1165
+ for (let i = 0; i < scored.length; i += 1) scored[i].rank = i + 1;
1166
+ const ranked = scored.slice(0, opts.top);
1167
+
1168
+ const candMap = new Map();
1169
+ for (let i = 0; i < ranked.length; i += 1) candMap.set(ranked[i].idA + '|' + ranked[i].idB, ranked[i]);
1170
+ const tailPairs = [];
1171
+ for (let i = 0; i < scored.length; i += 1) {
1172
+ const s = scored[i];
1173
+ if ((tailIds.has(s.idA) || tailIds.has(s.idB)) && s.isComp) {
1174
+ candMap.set(s.idA + '|' + s.idB, s);
1175
+ tailPairs.push(s);
1176
+ }
1177
+ }
1178
+ const candidates = Array.from(candMap.values()).sort(function (a, b) { return a.rank - b.rank; });
1179
+
1180
+ // Statements: buildOpportunityStatement per candidate. banked is honest.
1181
+ const statements = [];
1182
+ for (let i = 0; i < candidates.length; i += 1) {
1183
+ const s = candidates[i];
1184
+ const tailFlag = tailIds.has(s.idA) || tailIds.has(s.idB);
1185
+ const shared = (s.shared_problems && s.shared_problems.length)
1186
+ ? s.shared_problems
1187
+ : deriveSharedProblems(s.techA, s.techB, s.edge_type);
1188
+ const candidate = {
1189
+ a: {
1190
+ title: s.techA.title || s.idA,
1191
+ primary_problem: s.techA.primary_problem || ('unclassified problem for ' + s.idA),
1192
+ section: s.techA.section || 'unknown',
1193
+ weak_dimensions: s.weakA,
1194
+ },
1195
+ b: {
1196
+ title: s.techB.title || s.idB,
1197
+ primary_problem: s.techB.primary_problem || ('unclassified problem for ' + s.idB),
1198
+ section: s.techB.section || 'unknown',
1199
+ weak_dimensions: s.weakB,
1200
+ },
1201
+ shared_problems: shared,
1202
+ score: s.score,
1203
+ rank: s.rank,
1204
+ tail: tailFlag,
1205
+ };
1206
+ let st;
1207
+ try {
1208
+ st = oppmod.buildOpportunityStatement(candidate);
1209
+ } catch (_e) {
1210
+ // A malformed candidate must not abort the batch (skip + move on).
1211
+ continue;
1212
+ }
1213
+ // Reflect the resolved verdict back onto the ranked row for the banked column.
1214
+ s.banked = st.banked;
1215
+ statements.push({ pair: s, statement: st, tailFlag: tailFlag });
1216
+ }
1217
+
1218
+ // Phase 219 GAP-1 fix: the async critic-resolution pass (the "future
1219
+ // async runner" the emitter's sync gate always named). The synchronous
1220
+ // emission loop above honestly left every live statement critic 'pending'
1221
+ // because the real Phase 212 stageA is async; here, AFTER emission and
1222
+ // BEFORE banking, we actually await each pending statement's real verdict
1223
+ // under the module's per-statement timeout + batch deadline
1224
+ // (MINDRIAN_CRITIC_RESOLVE_TIMEOUT_MS / MINDRIAN_CRITIC_RESOLVE_BATCH_MS;
1225
+ // batch 0 = operator kill switch). Anything the pass cannot genuinely
1226
+ // resolve stays 'pending'/unbanked -- the ability to resolve is added,
1227
+ // the honesty floor is unchanged.
1228
+ //
1229
+ // OFFLINE runs SKIP resolution on purpose: a verdict computed against the
1230
+ // deterministic stub encoder would be fixture-green lying about grounding
1231
+ // (the exact GAP-1 failure class), so offline statements stay honestly
1232
+ // pending and the offline fixture behavior is byte-identical to pre-fix.
1233
+ let resolution = null;
1234
+ if (!opts.offline) {
1235
+ resolution = await oppmod.resolveCriticVerdicts(
1236
+ statements.map(function (s) { return s.statement; }),
1237
+ {}
1238
+ );
1239
+ // Re-sync the ranked rows' banked column with the now-resolved verdicts.
1240
+ for (let i = 0; i < statements.length; i += 1) {
1241
+ statements[i].pair.banked = statements[i].statement.banked === true;
1242
+ }
1243
+ process.stdout.write('eureka-portfolio-report: critic resolution - '
1244
+ + resolution.resolved + ' resolved (' + resolution.banked + ' passing), '
1245
+ + resolution.pending + ' still pending'
1246
+ + (resolution.deadline_hit ? ' (batch deadline hit)' : '') + '\n');
1247
+ }
1248
+
1249
+ for (let i = 0; i < ranked.length; i += 1) {
1250
+ if (typeof ranked[i].banked !== 'boolean') ranked[i].banked = false;
1251
+ }
1252
+
1253
+ // Phase 219 REQ-1: bank the statements passing the banking predicate as
1254
+ // proposed opportunity nodes (the header deferral, implemented). Reuses
1255
+ // the runner's already-open db handle; ONE batch, all-or-nothing. A
1256
+ // banking failure never aborts the report (the files still write) - it
1257
+ // logs honestly to stderr instead.
1258
+ const bank = bankStatements(db, BANK_SESSION_ID, statements);
1259
+ if (bank.ok) {
1260
+ process.stdout.write('eureka-portfolio-report: banked ' + bank.banked
1261
+ + ' opportunity node(s), ' + bank.edges + ' evidence edge(s), '
1262
+ + bank.skipped + ' skipped (predicate ' + bank.predicate + ')\n');
1263
+ } else {
1264
+ process.stderr.write('eureka-portfolio-report: banking pass failed ('
1265
+ + bank.reason + (bank.detail ? ': ' + bank.detail : '') + ') - rolled back, report files unaffected\n');
1266
+ }
1267
+
1268
+ // Phase 226-02 degrade seeding (SEED req 2: evaluated ONLY after the genuine
1269
+ // embedded attempt ran). degradeCause is derived from the SAME booleans the
1270
+ // embedded path already computed - idx.embedded and scored.length - never a
1271
+ // second gate variable. On a non-null cause it seeds pairs.json + a reasoning
1272
+ // provenance block; on a healthy run it is a no-op (degrade_cause null, no
1273
+ // workdir written).
1274
+ const seed = reasoningStageSeed(opts, { embedded: idx.embedded === true, scoredLength: scored.length });
1275
+
1276
+ const prov = spine.encoderProvenance();
1277
+ const provenance = {
1278
+ run_mode: opts.offline ? 'offline (deterministic stub encoder)' : 'live (local embedding spine)',
1279
+ pairs_mode: opts.pairs,
1280
+ encoder_model: opts.offline ? 'stub (deterministic hashed bag-of-tokens)' : prov.model,
1281
+ encoder_dtype: opts.offline ? 'stub' : prov.dtype,
1282
+ vec_backend: idx.vec_backend,
1283
+ ahp_weights: weightsByCriteria,
1284
+ ahp_cr: ahpConfig.cr,
1285
+ ahp_matrix_source: matrixSource,
1286
+ tail_composition: tailResult.composition,
1287
+ // Room mode overrides the growth-proxy label ONLY in provenance (the axis
1288
+ // math in tail-quadrant.cjs is untouched): the recency signal is created_at,
1289
+ // not a catalog cnumber.
1290
+ growth_proxy: opts.pairs === 'room' ? 'created_at-recency (room-native)' : tailResult.growth_proxy,
1291
+ tail_thresholds: tailResult.thresholds,
1292
+ tail_insufficient_structure: tailResult.insufficient_structure,
1293
+ tail_suspect_noise: tailResult.suspect_noise,
1294
+ cohort_techs: cohortTechs.length,
1295
+ graph_nodes: techMap.size,
1296
+ converges_pairs: convergesPairs.length,
1297
+ pairs_scored: scored.length,
1298
+ // Quick task 260715-0nj: how many both-scaffold candidate pairs the filter
1299
+ // removed before scoring. Read from the run, never a literal (honest nouns).
1300
+ scaffold_pairs_excluded: scaffoldPairsExcluded,
1301
+ // Seam 3 (RCA eureka-domain-swap-invariant): how many container-involving
1302
+ // candidate pairs (either endpoint a Section folder node) the filter removed
1303
+ // before scoring. Read from the run, never a literal.
1304
+ container_pairs_excluded: containerPairsExcluded,
1305
+ // quick 260719 (RCA handoff-eureka-entity-noise): how many candidate pairs the
1306
+ // filter removed because EITHER endpoint is a low-trust entity node (evidenceTier
1307
+ // low_confidence). Read from the run, never a literal.
1308
+ low_trust_pairs_excluded: lowTrustPairsExcluded,
1309
+ figure_guard_skipped: part8Skipped,
1310
+ // GAP-1: how the pending critic verdicts were (or were not) resolved.
1311
+ critic_resolution: opts.offline
1312
+ ? 'skipped (offline: a stub-encoder verdict would be fixture-green lying)'
1313
+ : (resolution
1314
+ ? (resolution.resolved + ' resolved (' + resolution.banked + ' passing) / '
1315
+ + resolution.pending + ' pending' + (resolution.deadline_hit ? ' (batch deadline hit)' : ''))
1316
+ : 'not run'),
1317
+ honest_nouns: (typeof graph.meta.honest_nouns === 'string' && graph.meta.honest_nouns.trim())
1318
+ ? graph.meta.honest_nouns.trim()
1319
+ : '(none stated in graph meta)',
1320
+ encoder_unavailable: idx.embedded !== true,
1321
+ run_date: new Date().toISOString().slice(0, 10),
1322
+ // Phase 226-02 (D7): name the CAUSE of a degrade, not just the symptom.
1323
+ // null on a healthy run (the render then shows no degrade block).
1324
+ degrade_cause: seed.degrade_cause,
1325
+ };
1326
+ // The reasoning next-step block (only when a genuine degrade seeded the workdir).
1327
+ if (seed.reasoning) provenance.reasoning = seed.reasoning;
1328
+
1329
+ // Phase 226-02 (SEED req 5), CR-01 fix: called unconditionally now, not just on
1330
+ // the embedded success path. If a prior report at jsonPath was written in
1331
+ // reasoning mode, surface the reasoning -> current delta instead of silently
1332
+ // replacing it - INCLUDING the case where this run is a second degrade
1333
+ // (idx.embedded !== true, ranked stays empty). buildUpgradeDelta's own
1334
+ // run_mode check is the guard; on a still-degraded run it attaches
1335
+ // provenance.upgrade with survived:0 and the prior top-5 pair ids, so the
1336
+ // overwrite is disclosed with a trace instead of leaving none. Never throws;
1337
+ // no upgrade key on any failure or when the prior file wasn't reasoning-mode.
1338
+ buildUpgradeDelta(jsonPath, provenance, ranked);
1339
+
1340
+ const report = renderReport({
1341
+ provenance: provenance,
1342
+ roomDir: opts.db,
1343
+ graphRel: opts.pairs === 'room' ? '(room-native: no idea-graph)' : (path.isAbsolute(opts.graph) ? opts.graph : opts.graph),
1344
+ offline: opts.offline,
1345
+ top: opts.top,
1346
+ ranked: ranked,
1347
+ tail: tailResult,
1348
+ tailPairs: tailPairs,
1349
+ statements: statements,
1350
+ techFor: techForCtx,
1351
+ });
1352
+
1353
+ // (9) Write the markdown report + the JSON sibling (Plan 05 reads the JSON).
1354
+ fs.mkdirSync(path.dirname(outPath), { recursive: true });
1355
+ fs.writeFileSync(outPath, report, 'utf8');
1356
+
1357
+ const jsonOut = {
1358
+ provenance: provenance,
1359
+ ranked: ranked.map(function (r) {
1360
+ return {
1361
+ rank: r.rank,
1362
+ a: r.idA,
1363
+ b: r.idB,
1364
+ a_title: r.techA.title,
1365
+ b_title: r.techB.title,
1366
+ score: r.score,
1367
+ dims: r.pairDims,
1368
+ weak_a: r.weakA,
1369
+ weak_b: r.weakB,
1370
+ complementary: r.isComp,
1371
+ tail_flag: tailIds.has(r.idA) || tailIds.has(r.idB),
1372
+ banked: r.banked === true,
1373
+ // WR-03 fix: field-parity with statements[] (which already carries
1374
+ // mode: 'embedded') and with the reasoning ranked[] rows (mode:
1375
+ // 'reasoning'). Previously report-html.cjs only survived this via an
1376
+ // `r.mode || 'embedded'` fallback.
1377
+ mode: 'embedded',
1378
+ };
1379
+ }),
1380
+ tail: {
1381
+ composition: tailResult.composition,
1382
+ growth_proxy: tailResult.growth_proxy,
1383
+ insufficient_structure: tailResult.insufficient_structure,
1384
+ suspect_noise: tailResult.suspect_noise,
1385
+ thresholds: tailResult.thresholds,
1386
+ items: tailResult.tail,
1387
+ },
1388
+ statements: statements.map(function (s) {
1389
+ return {
1390
+ rank: s.pair.rank,
1391
+ a: s.pair.idA,
1392
+ b: s.pair.idB,
1393
+ tail_flag: s.tailFlag,
1394
+ text: s.statement.text,
1395
+ banked: s.statement.banked,
1396
+ critic: s.statement.critic,
1397
+ weak_dimensions: s.statement.weak_dimensions,
1398
+ potential_tier: s.statement.fields.potential_tier,
1399
+ // SEED req 1: every statement carries its mode; embedded here, 'reasoning'
1400
+ // on the fallback writer. The JSON leg of the mandatory-label contract.
1401
+ mode: 'embedded',
1402
+ };
1403
+ }),
1404
+ };
1405
+ fs.mkdirSync(path.dirname(jsonPath), { recursive: true });
1406
+ fs.writeFileSync(jsonPath, JSON.stringify(jsonOut, null, 2) + '\n', 'utf8');
1407
+
1408
+ process.stdout.write('eureka-portfolio-report: wrote ' + outPath + ' + ' + jsonPath
1409
+ + ' (' + scored.length + ' pairs scored, ' + ranked.length + ' ranked, '
1410
+ + statements.length + ' statements, ' + tailResult.tail.length + ' tail techs, mode '
1411
+ + opts.pairs + '/' + (opts.offline ? 'offline' : 'live') + ')\n');
1412
+ return 0;
1413
+ } catch (err) {
1414
+ process.stderr.write('eureka-portfolio-report FAILED: ' + String(err && err.message ? err.message : err) + '\n');
1415
+ return 1;
1416
+ } finally {
1417
+ if (db) closeRoomDb(db);
1418
+ }
1419
+ }
1420
+
1421
+ // ---------------------------------------------------------------------------
1422
+ // Phase 219 REQ-1: the banking pass (the header deferral, implemented).
1423
+ // ---------------------------------------------------------------------------
1424
+
1425
+ // The session id every banked opportunity node mints under. A STABLE constant
1426
+ // (the entity-extract 'entity-extract' default idiom) so re-running the report
1427
+ // on the same room UPSERTs the same nodes instead of duplicating them
1428
+ // (OPPORTUNITY_NODE_ID is keyed on sessionId + name).
1429
+ const BANK_SESSION_ID = 'eureka-portfolio';
1430
+
1431
+ // The three documented predicate values (see the header BANKING PREDICATE
1432
+ // block). An unrecognized value falls back to 'critic' (the safe default).
1433
+ const BANK_PREDICATES = ['critic', 'critic+tail', 'all'];
1434
+
1435
+ function resolveBankPredicate(explicit) {
1436
+ const raw = (typeof explicit === 'string' && explicit)
1437
+ ? explicit
1438
+ : (process.env.MINDRIAN_OPPORTUNITY_BANK_PREDICATE || 'critic');
1439
+ return BANK_PREDICATES.indexOf(raw) === -1 ? 'critic' : raw;
1440
+ }
1441
+
1442
+ // Does this statement entry pass the banking predicate? entry is the in-memory
1443
+ // statements-loop shape { pair, statement, tailFlag }. NEVER rank-based.
1444
+ function passesBankPredicate(entry, mode) {
1445
+ const st = entry && entry.statement;
1446
+ if (!st) return false;
1447
+ switch (mode) {
1448
+ case 'critic+tail':
1449
+ return st.banked === true || entry.tailFlag === true;
1450
+ case 'all':
1451
+ return st.critic !== 'pending';
1452
+ case 'critic':
1453
+ default:
1454
+ return st.banked === true;
1455
+ }
1456
+ }
1457
+
1458
+ // The scaffold node-type family (quick task 260715-0nj). A candidate pair whose
1459
+ // BOTH endpoints are scaffold nodes (memory_artifact / Artifact) is structural
1460
+ // document scaffolding, never a real cross-domain opportunity. This is the SAME
1461
+ // 218 pin lib/core/eureka/opportunity-harvest.cjs lines 519-521 already applies
1462
+ // to the bridge + contradiction lanes ("a structural restatement of the room,
1463
+ // not a signal"); this constant extends that established predicate to the
1464
+ // portfolio ranking candidate set. Provenance: quick task 260714-hzx traced the
1465
+ // regression this closes - once tier-2 correctly thinned the entity cohort
1466
+ // (309 -> 46 company nodes), the 39-node memory_artifact CONVERGES clique
1467
+ // refilled the top-25 (18/25 = 72.0 percent structural share). Frozen so no
1468
+ // caller can mutate the family at run time.
1469
+ const SCAFFOLD_NODE_TYPES = Object.freeze(new Set(['memory_artifact', 'Artifact']));
1470
+
1471
+ // The container node-type family (Seam 3, RCA eureka-domain-swap-invariant). This
1472
+ // EXTENDS the 260715-0nj exclusion at the SAME step-4b insertion point - it is not
1473
+ // a second mechanism. A `Section` node is one of the room's OWN top-level folder
1474
+ // nodes (older-schema rooms materialized each top-level folder as a graph node);
1475
+ // its only text is the folder slug (props.name), so the encoder embeds it and it
1476
+ // enters the pairing pool. A real content node filed inside problem-definition/
1477
+ // then gets paired against the problem-definition FOLDER node itself: both sides
1478
+ // derive the same slug ("problem-definition x problem-definition") and the critic
1479
+ // correctly fires domain_swap_invariant, but only AFTER the degenerate pair has
1480
+ // consumed a ranked-list slot. Nothing upstream dropped it.
1481
+ //
1482
+ // SCOPE DIFFERENCE FROM THE SCAFFOLD PRECEDENT (deliberate, not an inconsistency):
1483
+ // the scaffold rule excludes a pair only when BOTH endpoints are scaffold, because
1484
+ // a single Artifact endpoint still carries real filed content (title + body) and a
1485
+ // one-Artifact pair is legitimate. A Section carries no content of its own - it is
1486
+ // only a folder label - so it is NEVER a valid opportunity endpoint on EITHER side.
1487
+ // Hence container exclusion is EITHER-endpoint, scaffold exclusion is both-endpoint.
1488
+ // Frozen so no caller can mutate the family at run time.
1489
+ const CONTAINER_NODE_TYPES = Object.freeze(new Set(['Section']));
1490
+
1491
+ // The low-trust evidence tier (quick 260719, RCA handoff-eureka-entity-noise). An
1492
+ // entity node (lib/core/navigation/typed-entity.cjs writeEntityNode) is stamped
1493
+ // props.evidenceTier 'low_confidence' when it arrived via the two-tier no-LLM
1494
+ // embedding best-guess (scripts/entity-extract.cjs runTier2): the embedding tier
1495
+ // could not confidently classify it AND no tier-2b LLM was available to adjudicate.
1496
+ // That is an unverified tier-1 regex hit no semantic tier confirmed ("Windows" /
1497
+ // "CSFs"), so it is never a valid eureka opportunity endpoint. Decision 8 keeps
1498
+ // writing it as a graph node (the extraction substrate is preserved); only pairing
1499
+ // excludes it.
1500
+ //
1501
+ // DELIBERATELY EXCLUDES 'fallback': a fallback-stamped entity comes from the
1502
+ // encoder-unavailable degrade (runDegradeHzx), where EVERY entity is a fallback
1503
+ // guess and they are the room's ONLY substrate. Excluding them would empty the
1504
+ // ranked list and break Decision 8 (proven by tests/test-218-noise-reduction.cjs).
1505
+ // A 'fallback' entity is honest provenance, NOT a pairing exclusion. Do NOT add
1506
+ // 'fallback' to this set. Frozen so no caller can mutate the family at run time.
1507
+ const LOW_TRUST_EVIDENCE_TIERS = Object.freeze(new Set(['low_confidence']));
1508
+
1509
+ // isLowTrustEntity(row) -> true when this node row is a typed entity node
1510
+ // (props.entityType in ENTITY_NODE_TYPES, the writeEntityNode stamp) whose
1511
+ // props.evidenceTier is a low-trust tier. Reads props.entityType + props.evidenceTier
1512
+ // ONLY (writeEntityNode always stamps both); a scaffold / artifact / Section node
1513
+ // never carries evidenceTier, so it can never be low-trust. A malformed props blob
1514
+ // degrades to false, never throws (the Part 3 tampering-guard posture).
1515
+ function isLowTrustEntity(row) {
1516
+ let props;
1517
+ try { props = JSON.parse(row && row.properties); } catch (_e) { return false; }
1518
+ if (!props || typeof props !== 'object' || Array.isArray(props)) return false;
1519
+ const et = typeof props.entityType === 'string' ? props.entityType : '';
1520
+ if (!ENTITY_NODE_TYPES.has(et)) return false;
1521
+ const tier = typeof props.evidenceTier === 'string' ? props.evidenceTier : '';
1522
+ return LOW_TRUST_EVIDENCE_TIERS.has(tier);
1523
+ }
1524
+
1525
+ // The 216 field contract (test-216-field-contract.cjs precedent): a banked
1526
+ // node's props.section must be a REAL domain slug or the honest 'unknown',
1527
+ // NEVER the ICM node type column leaking through as a pseudo-section. This
1528
+ // deny-list names the ICM/system type values that must never masquerade as a
1529
+ // section slug.
1530
+ const ICM_TYPE_DENY = new Set([
1531
+ 'section', 'artifact', 'memory_artifact', 'memory_event', 'causalclaim',
1532
+ 'causal_claim', 'whitespacezone', 'whitespace_zone', 'breakthrough',
1533
+ 'opportunity', 'company', 'technology', 'market', 'domain', 'subdomain',
1534
+ 'focus_area', 'frame', 'unknown',
1535
+ ]);
1536
+
1537
+ function isRealSectionSlug(v) {
1538
+ return typeof v === 'string' && v.length > 0
1539
+ && v.indexOf(':') === -1
1540
+ && !ICM_TYPE_DENY.has(v.toLowerCase());
1541
+ }
1542
+
1543
+ // Derive props.section for a banked opportunity from its EVIDENCE nodes: the
1544
+ // pair's techA/techB section fields first (room-native substrate already
1545
+ // carries the 216 contract), then the evidence nodes' props.section, then the
1546
+ // source_path first segment (a real room folder slug), else the honest
1547
+ // 'unknown'. READ-only db access; every WRITE stays behind navigation.
1548
+ function deriveBankSection(db, entry) {
1549
+ const pair = entry.pair || {};
1550
+ const candidates = [];
1551
+ if (pair.techA && pair.techA.section) candidates.push(pair.techA.section);
1552
+ if (pair.techB && pair.techB.section) candidates.push(pair.techB.section);
1553
+ for (const id of [pair.idA, pair.idB]) {
1554
+ if (typeof id !== 'string' || id.length === 0 || !db) continue;
1555
+ let row = null;
1556
+ try {
1557
+ row = db.prepare('SELECT properties, source_path FROM nodes WHERE id = ?').get(id);
1558
+ } catch (_e) { row = null; }
1559
+ if (!row) continue;
1560
+ try {
1561
+ const props = JSON.parse(row.properties || '{}');
1562
+ if (props && typeof props.section === 'string') candidates.push(props.section);
1563
+ } catch (_e) { /* unreadable props: fall through to source_path */ }
1564
+ if (typeof row.source_path === 'string' && row.source_path.indexOf('/') > 0
1565
+ && row.source_path.indexOf(':') === -1) {
1566
+ candidates.push(row.source_path.split('/')[0]);
1567
+ }
1568
+ }
1569
+ for (const c of candidates) {
1570
+ if (isRealSectionSlug(c)) return c;
1571
+ }
1572
+ return 'unknown';
1573
+ }
1574
+
1575
+ // bankStatements(db, sessionId, statements, opts?) -- the REQ-1 governed write.
1576
+ //
1577
+ // statements is the in-memory statements-loop array [{ pair, statement,
1578
+ // tailFlag }]. ONE explicit BEGIN/COMMIT/ROLLBACK batch (the 218 D-05
1579
+ // entity-extract shape) mints each entry passing the banking predicate as a
1580
+ // proposed `opportunity` node via navigation.writeOpportunityNode, then links
1581
+ // DERIVED_FROM evidence edges to the candidate pair's a and b node ids via
1582
+ // navigation.linkOpportunityEvidence (the Brain answer names DERIVED_FROM as
1583
+ // provenance). A failed node or edge write THROWS inside the batch so the
1584
+ // WHOLE batch rolls back (all-or-nothing); the function itself never throws -
1585
+ // it returns { ok:false, reason, detail } after ROLLBACK.
1586
+ //
1587
+ // Returns { ok:true, banked, edges, skipped, predicate } on success. Exported
1588
+ // so tests/test-219-banking.cjs drives it hermetically without a eureka run.
1589
+ function bankStatements(db, sessionId, statements, opts) {
1590
+ if (!db || !Array.isArray(statements)) {
1591
+ return { ok: false, reason: 'invalid_params' };
1592
+ }
1593
+ const sid = (typeof sessionId === 'string' && sessionId.length > 0) ? sessionId : BANK_SESSION_ID;
1594
+ const mode = resolveBankPredicate(opts && opts.predicate);
1595
+ let banked = 0;
1596
+ let edges = 0;
1597
+ let skipped = 0;
1598
+ try {
1599
+ db.exec('BEGIN');
1600
+ } catch (e) {
1601
+ return { ok: false, reason: 'begin_failed', detail: String(e.message || '').slice(0, 80) };
1602
+ }
1603
+ try {
1604
+ for (const entry of statements) {
1605
+ if (!passesBankPredicate(entry, mode)) { skipped += 1; continue; }
1606
+ const pair = entry.pair || {};
1607
+ const st = entry.statement || {};
1608
+ const titleA = (pair.techA && pair.techA.title) || pair.idA || '';
1609
+ const titleB = (pair.techB && pair.techB.title) || pair.idB || '';
1610
+ const name = (titleA && titleB) ? (titleA + ' x ' + titleB) : (titleA || titleB);
1611
+ const section = deriveBankSection(db, entry);
1612
+ const fields = st.fields || {};
1613
+ const w = navigation.writeOpportunityNode(db, {
1614
+ name: name,
1615
+ sessionId: sid,
1616
+ lifecycle: 'candidate',
1617
+ jtbd: typeof fields.audience === 'string' ? fields.audience : undefined,
1618
+ score: typeof pair.score === 'number' ? pair.score : undefined,
1619
+ section: section,
1620
+ actor: 'system',
1621
+ reason: 'eureka statement banked (predicate ' + mode + ')',
1622
+ evidence_ids: [pair.idA, pair.idB].filter(function (x) { return typeof x === 'string' && x.length > 0; }),
1623
+ formula_version: 'eureka-critic-v1',
1624
+ extraProps: {
1625
+ statement_text: typeof st.text === 'string' ? st.text : '',
1626
+ potential_tier: typeof fields.potential_tier === 'string' ? fields.potential_tier : '',
1627
+ critic: typeof st.critic === 'string' ? st.critic : 'resolved',
1628
+ rank: typeof pair.rank === 'number' ? pair.rank : null,
1629
+ tail_flag: entry.tailFlag === true,
1630
+ bank_predicate: mode,
1631
+ },
1632
+ });
1633
+ if (!w || w.ok !== true) {
1634
+ throw new Error('bank write failed: ' + ((w && w.reason) || 'unknown') + ' for "' + String(name).slice(0, 60) + '"');
1635
+ }
1636
+ banked += 1;
1637
+ // DERIVED_FROM provenance edges to the candidate pair's a and b nodes.
1638
+ for (const targetId of [pair.idA, pair.idB]) {
1639
+ if (typeof targetId !== 'string' || targetId.length === 0) continue;
1640
+ const r = navigation.linkOpportunityEvidence(db, {
1641
+ opportunity_id: w.node_id,
1642
+ target_id: targetId,
1643
+ edge_type: 'DERIVED_FROM',
1644
+ properties: { relation: 'derived_from', opportunity_node: w.node_id },
1645
+ });
1646
+ if (!r || r.ok !== true) {
1647
+ throw new Error('bank edge failed: ' + ((r && r.reason) || 'unknown') + ' -> ' + targetId);
1648
+ }
1649
+ edges += 1;
1650
+ }
1651
+ }
1652
+ db.exec('COMMIT');
1653
+ } catch (err) {
1654
+ try { db.exec('ROLLBACK'); } catch (_e) { /* already rolled back */ }
1655
+ return { ok: false, reason: 'banking_batch_failed', detail: String(err && err.message ? err.message : err).slice(0, 120) };
1656
+ }
1657
+ return { ok: true, banked: banked, edges: edges, skipped: skipped, predicate: mode };
1658
+ }
1659
+
1660
+ // ---------------------------------------------------------------------------
1661
+ // Phase 226-02: the mode:reasoning fallback branch (encoder-free).
1662
+ //
1663
+ // Three stages mirror the eureka-critic-run.cjs --emit-prompts / --score split (a
1664
+ // CLI cannot judge itself): (1) the NORMAL run's degrade SEED writes pairs.json
1665
+ // when the genuine embedded attempt proved idx.embedded !== true or scored 0
1666
+ // pairs; (2) --reasoning-emit reads the session-written mappings.json and writes
1667
+ // rubric prompts; (3) --reasoning-score replays the session answers through the
1668
+ // REAL critic rubric and writes the SAME { provenance, ranked, tail, statements }
1669
+ // md+json pair, labeled mode:reasoning with honest-null encoder legs.
1670
+ // ---------------------------------------------------------------------------
1671
+
1672
+ // Resolve the reasoning-stage paths from opts once (roomDir, workdir, mappings,
1673
+ // answers, and the SAME default report locations the embedded run writes so the
1674
+ // eureka-command report subcommand reads them unchanged - byte-parity of location).
1675
+ function resolveReasoningPaths(opts) {
1676
+ const roomDir = path.isAbsolute(opts.db) ? opts.db : path.join(REPO_ROOT, opts.db);
1677
+ const workdir = opts.reasoningWorkdir
1678
+ ? (path.isAbsolute(opts.reasoningWorkdir) ? opts.reasoningWorkdir : path.join(REPO_ROOT, opts.reasoningWorkdir))
1679
+ : path.join(roomDir, '.mindrian', 'eureka', 'reasoning');
1680
+ const mappingsPath = opts.mappings
1681
+ ? (path.isAbsolute(opts.mappings) ? opts.mappings : path.join(REPO_ROOT, opts.mappings))
1682
+ : path.join(workdir, 'mappings.json');
1683
+ const answersPath = opts.answers
1684
+ ? (path.isAbsolute(opts.answers) ? opts.answers : path.join(REPO_ROOT, opts.answers))
1685
+ : path.join(workdir, 'answers.json');
1686
+ const outPath = path.isAbsolute(opts.out) ? opts.out : path.join(REPO_ROOT, opts.out);
1687
+ const jsonPath = path.isAbsolute(opts.json) ? opts.json : path.join(REPO_ROOT, opts.json);
1688
+ return {
1689
+ roomDir: roomDir, workdir: workdir, mappingsPath: mappingsPath,
1690
+ answersPath: answersPath, outPath: outPath, jsonPath: jsonPath,
1691
+ };
1692
+ }
1693
+
1694
+ // reasoningStageSeed(opts, ctx) -- the degrade entry, called from the NORMAL run
1695
+ // AFTER the scoring loop and BEFORE provenance assembly. ctx = { embedded,
1696
+ // scoredLength }, both taken from the values the embedded path already computed
1697
+ // (no second gate variable). Returns { degrade_cause } (null on a healthy run,
1698
+ // nothing written) or { degrade_cause, reasoning } after seeding pairs.json.
1699
+ function reasoningStageSeed(opts, ctx) {
1700
+ const embedded = !!(ctx && ctx.embedded === true);
1701
+ const scoredLength = ctx && Number.isFinite(ctx.scoredLength) ? ctx.scoredLength : 0;
1702
+ // The cause code (D7): the encoder never ran, or it ran and scored nothing.
1703
+ let degradeCause = null;
1704
+ if (!embedded) degradeCause = 'encoder_unavailable';
1705
+ else if (scoredLength === 0) degradeCause = 'below_floor';
1706
+ if (degradeCause === null) {
1707
+ // CR-02 fix: a healthy embedded run supersedes any earlier degrade. Delete a
1708
+ // stale pairs.json left by a PRIOR degrade so reasoningStageEmit/reasoningStageScore's
1709
+ // existing "no pairs.json" guard naturally fires if the reasoning stages are
1710
+ // re-run afterward, instead of silently scoring a stale pair-set that could
1711
+ // overwrite this healthy (possibly already-banked) report.
1712
+ const staleP = resolveReasoningPaths(opts);
1713
+ const stalePairsPath = path.join(staleP.workdir, 'pairs.json');
1714
+ if (fs.existsSync(stalePairsPath)) {
1715
+ try { fs.unlinkSync(stalePairsPath); } catch (_e) { /* best-effort cleanup, never block a healthy run */ }
1716
+ }
1717
+ return { degrade_cause: null };
1718
+ }
1719
+
1720
+ const paths = resolveReasoningPaths(opts);
1721
+ const pairsPath = path.join(paths.workdir, 'pairs.json');
1722
+
1723
+ // CR-03 fix: don't reseed out from under an in-progress session. If mappings,
1724
+ // answers, or a prompts manifest already exist in this workdir alongside an
1725
+ // existing pairs.json, a navigator is mid-session against the CURRENT
1726
+ // pairs.json P000N ids - regenerating now (e.g. content changed between two
1727
+ // `run` invocations) can silently reassign those ids, orphaning whatever the
1728
+ // navigator already wrote. Skip re-seeding (idempotent no-op) and report the
1729
+ // existing session state instead.
1730
+ const promptsManifestPath = path.join(paths.workdir, 'prompts', 'manifest.json');
1731
+ const inProgress = fs.existsSync(pairsPath)
1732
+ && (fs.existsSync(paths.mappingsPath) || fs.existsSync(paths.answersPath) || fs.existsSync(promptsManifestPath));
1733
+ if (inProgress) {
1734
+ let existing;
1735
+ try {
1736
+ existing = JSON.parse(fs.readFileSync(pairsPath, 'utf8'));
1737
+ } catch (_e) {
1738
+ existing = { candidates: [] };
1739
+ }
1740
+ return {
1741
+ degrade_cause: degradeCause,
1742
+ reasoning: {
1743
+ state: 'await_mappings (in-progress session preserved - pairs.json NOT regenerated)',
1744
+ workdir: paths.workdir,
1745
+ pairs_selected: Array.isArray(existing.candidates) ? existing.candidates.length : 0,
1746
+ next_step: 'write mappings.json then run --reasoning-emit',
1747
+ },
1748
+ };
1749
+ }
1750
+
1751
+ const entries = reasoningMode.readRoomMarkdown(paths.roomDir);
1752
+ const proposed = reasoningMode.proposeCandidatePairs(entries, {});
1753
+ fs.mkdirSync(paths.workdir, { recursive: true });
1754
+ const pairsDoc = {
1755
+ generated_at: new Date().toISOString(),
1756
+ degrade_cause: degradeCause,
1757
+ cap: proposed.cap,
1758
+ entries_read: entries.length,
1759
+ pairs_considered: proposed.pairs_considered,
1760
+ candidates: proposed.candidates,
1761
+ };
1762
+ fs.writeFileSync(pairsPath, JSON.stringify(pairsDoc, null, 2) + '\n', 'utf8');
1763
+ return {
1764
+ degrade_cause: degradeCause,
1765
+ reasoning: {
1766
+ state: 'await_mappings',
1767
+ workdir: paths.workdir,
1768
+ pairs_selected: proposed.candidates.length,
1769
+ next_step: 'write mappings.json then run --reasoning-emit',
1770
+ },
1771
+ };
1772
+ }
1773
+
1774
+ // reasoningStageEmit(opts) -- stage 2. Read pairs.json (SEED req 2 guard: exit 1
1775
+ // if it is absent, meaning no genuine degrade ran first), validate the
1776
+ // session-written mappings, write the rubric prompt files, print the next step.
1777
+ function reasoningStageEmit(opts) {
1778
+ const paths = resolveReasoningPaths(opts);
1779
+ const pairsPath = path.join(paths.workdir, 'pairs.json');
1780
+ if (!fs.existsSync(pairsPath)) {
1781
+ process.stderr.write('eureka-portfolio-report --reasoning-emit: no pairs.json at ' + pairsPath + '\n');
1782
+ process.stderr.write('Reasoning mode is entered ONLY after a genuine embedded run degraded (SEED req 2:\n');
1783
+ process.stderr.write('never speculative). Run the normal report first so a real encoder_unavailable / below_floor attempt seeds pairs.json.\n');
1784
+ return 1;
1785
+ }
1786
+ const pairsDoc = JSON.parse(fs.readFileSync(pairsPath, 'utf8'));
1787
+ const mappings = fs.existsSync(paths.mappingsPath) ? JSON.parse(fs.readFileSync(paths.mappingsPath, 'utf8')) : {};
1788
+ const validation = reasoningMode.validateMappings(Array.isArray(pairsDoc.candidates) ? pairsDoc.candidates : [], mappings);
1789
+ const promptsDir = path.join(paths.workdir, 'prompts');
1790
+ const manifest = reasoningMode.emitReasoningPrompts(promptsDir, validation.valid);
1791
+ const emitted = manifest.candidates.filter(function (c) { return c.stage_a_pass === true; }).length;
1792
+ process.stdout.write('eureka-portfolio-report --reasoning-emit: '
1793
+ + validation.valid.length + ' mapped pair(s) (' + validation.excluded_count + ' excluded for missing/invalid mapping), '
1794
+ + emitted + ' rubric prompt set(s) written to ' + promptsDir + '\n');
1795
+ process.stdout.write('Next: answer each <id>.neutral.txt and <id>.adversarial.txt faithfully into answers.json,\n');
1796
+ process.stdout.write('then run: --reasoning-score --answers ' + paths.answersPath + ' --reasoning-workdir ' + paths.workdir + '\n');
1797
+ return 0;
1798
+ }
1799
+
1800
+ // reasoningStageScore(opts) -- stage 3. Replay the session answers through the
1801
+ // REAL rubric (verdict-by-code), assemble the byte-parity report, and write it.
1802
+ async function reasoningStageScore(opts) {
1803
+ const paths = resolveReasoningPaths(opts);
1804
+ const pairsPath = path.join(paths.workdir, 'pairs.json');
1805
+ const promptsDir = path.join(paths.workdir, 'prompts');
1806
+ const manifestPath = path.join(promptsDir, 'manifest.json');
1807
+ if (!fs.existsSync(pairsPath)) {
1808
+ process.stderr.write('eureka-portfolio-report --reasoning-score: no pairs.json at ' + pairsPath
1809
+ + ' (run the normal degrade + --reasoning-emit first)\n');
1810
+ return 1;
1811
+ }
1812
+ const pairsDoc = JSON.parse(fs.readFileSync(pairsPath, 'utf8'));
1813
+ const mappings = fs.existsSync(paths.mappingsPath) ? JSON.parse(fs.readFileSync(paths.mappingsPath, 'utf8')) : {};
1814
+ const answers = fs.existsSync(paths.answersPath) ? JSON.parse(fs.readFileSync(paths.answersPath, 'utf8')) : {};
1815
+ const manifest = fs.existsSync(manifestPath) ? JSON.parse(fs.readFileSync(manifestPath, 'utf8')) : { candidates: [] };
1816
+ const validation = reasoningMode.validateMappings(Array.isArray(pairsDoc.candidates) ? pairsDoc.candidates : [], mappings);
1817
+
1818
+ const rows = await reasoningMode.scoreReasoningPairs(validation.valid, answers, {});
1819
+
1820
+ // Max-1-retry latch (AI-SPEC 4b): if ANY candidate came back with a
1821
+ // missing/garbled answer AND the manifest has not yet spent its one retry,
1822
+ // stamp retry_used, name the pairs, and exit 2 (a distinct retriable code).
1823
+ // On a second failure we proceed with the bias-to-reject default, never guess.
1824
+ const missing = rows.filter(function (r) { return r.judge_answer_missing === true; });
1825
+ if (missing.length > 0 && manifest.retry_used !== true) {
1826
+ manifest.retry_used = true;
1827
+ // WR-01 fix: if --reasoning-score is run before --reasoning-emit ever created
1828
+ // <workdir>/prompts/, manifestPath's parent directory does not exist yet and
1829
+ // this write would throw a synchronous ENOENT with no surrounding try/catch
1830
+ // (see the top-level .catch() added below as the second half of this fix).
1831
+ fs.mkdirSync(path.dirname(manifestPath), { recursive: true });
1832
+ fs.writeFileSync(manifestPath, JSON.stringify(manifest, null, 2) + '\n', 'utf8');
1833
+ process.stderr.write('eureka-portfolio-report --reasoning-score: missing/garbled answers for pair id(s): '
1834
+ + missing.map(function (r) { return r.id; }).join(', ') + '\n');
1835
+ process.stderr.write('Re-answer ONLY those pairs faithfully into answers.json, then re-run --reasoning-score (one retry allowed).\n');
1836
+ return 2;
1837
+ }
1838
+
1839
+ // Ranking rule (plan 01 core): transferable rows only, ascending by
1840
+ // lsa_similarity (LOW overlap on a still-plausible pair is the eureka signature),
1841
+ // capped by --top. rank = index + 1.
1842
+ const cap = Number.isFinite(opts.top) && opts.top > 0 ? opts.top : 25;
1843
+ const transferable = rows
1844
+ .filter(function (r) { return r.verdict === 'transferable'; })
1845
+ .slice()
1846
+ .sort(function (x, y) { return x.lsa_similarity - y.lsa_similarity; })
1847
+ .slice(0, cap);
1848
+
1849
+ const statements = transferable.map(function (r, i) { return reasoningMode.buildReasoningStatement(r, i + 1); });
1850
+ const ranked = transferable.map(function (r, i) {
1851
+ return {
1852
+ // The exact embedded ranked field NAMES survive; the encoder-derived numbers
1853
+ // are honest-null (no fabricated score / dims - D2's no-blended-score rule).
1854
+ rank: i + 1,
1855
+ a: r.a,
1856
+ b: r.b,
1857
+ a_title: r.title_a,
1858
+ b_title: r.title_b,
1859
+ score: null,
1860
+ dims: null,
1861
+ weak_a: [],
1862
+ weak_b: [],
1863
+ complementary: false,
1864
+ tail_flag: false,
1865
+ banked: false,
1866
+ mode: 'reasoning',
1867
+ lsa_similarity: r.lsa_similarity,
1868
+ verdict: r.verdict,
1869
+ reasoning_tag: r.reasoning_tag,
1870
+ differential_score: null,
1871
+ semantic_similarity: null,
1872
+ };
1873
+ });
1874
+
1875
+ // Rubric-rejection accounting (per class) + the encoder-free Gate 1 trip count.
1876
+ const pairsRejectedByRubric = { pseudoscience: 0, restatement: 0, general_shallow: 0 };
1877
+ let gate1Trips = 0;
1878
+ for (let i = 0; i < rows.length; i += 1) {
1879
+ if (rows[i].stage_a_pass === false) gate1Trips += 1;
1880
+ const v = rows[i].verdict;
1881
+ if (v === 'pseudoscience') pairsRejectedByRubric.pseudoscience += 1;
1882
+ else if (v === 'restatement') pairsRejectedByRubric.restatement += 1;
1883
+ else if (v === 'general_shallow') pairsRejectedByRubric.general_shallow += 1;
1884
+ }
1885
+ // pairs_sent = candidates actually rubric-scored (a Gate-1 trip never reaches the
1886
+ // rubric, so it is not counted as sent).
1887
+ const pairsSent = rows.filter(function (r) { return r.stage_a_pass === true; }).length;
1888
+
1889
+ const provenance = {
1890
+ // Every key the embedded provenance object carries (lines ~975-1012), with
1891
+ // honest reasoning-mode values, so no existing consumer breaks (D4/G-5).
1892
+ run_mode: 'reasoning',
1893
+ pairs_mode: opts.pairs,
1894
+ encoder_model: 'none (reasoning mode)',
1895
+ encoder_dtype: 'none',
1896
+ vec_backend: 'none',
1897
+ ahp_weights: null,
1898
+ ahp_cr: null,
1899
+ ahp_matrix_source: 'not used (reasoning mode)',
1900
+ tail_composition: 'not computed (reasoning mode: no cohort axes without the embedded index)',
1901
+ growth_proxy: 'none',
1902
+ tail_thresholds: null,
1903
+ tail_insufficient_structure: true,
1904
+ tail_suspect_noise: false,
1905
+ cohort_techs: 0,
1906
+ graph_nodes: 0,
1907
+ converges_pairs: 0,
1908
+ pairs_scored: pairsSent,
1909
+ scaffold_pairs_excluded: 0,
1910
+ low_trust_pairs_excluded: 0,
1911
+ figure_guard_skipped: gate1Trips,
1912
+ critic_resolution: 'reasoning rubric (verdict-by-code)',
1913
+ honest_nouns: '(none: raw-markdown substrate)',
1914
+ encoder_unavailable: true,
1915
+ run_date: new Date().toISOString().slice(0, 10),
1916
+ // Reasoning-mode extensions.
1917
+ degrade_cause: pairsDoc.degrade_cause,
1918
+ formula_version: reasoningMode.REASONING_FORMULA_VERSION,
1919
+ reasoning_cap: pairsDoc.cap,
1920
+ pairs_considered: pairsDoc.pairs_considered,
1921
+ pairs_sent: pairsSent,
1922
+ pairs_rejected_by_rubric: pairsRejectedByRubric,
1923
+ entries_read: pairsDoc.entries_read,
1924
+ // BANKING HARD-SKIP (G-3): the reasoning path NEVER calls bankStatements - not
1925
+ // even with the default predicate - because MINDRIAN_OPPORTUNITY_BANK_PREDICATE=all
1926
+ // would otherwise bank a non-pending reasoning verdict (the exact G-3 breach
1927
+ // vector). Part 9 promotion is human-only; there is no write-back call site below.
1928
+ banking: 'skipped (reasoning mode: Part 9 human-only promotion)',
1929
+ };
1930
+
1931
+ const jsonOut = {
1932
+ provenance: provenance,
1933
+ ranked: ranked,
1934
+ tail: {
1935
+ composition: 'not computed (reasoning mode: no cohort axes without the embedded index)',
1936
+ growth_proxy: 'none',
1937
+ insufficient_structure: true,
1938
+ suspect_noise: false,
1939
+ thresholds: null,
1940
+ items: [],
1941
+ },
1942
+ statements: statements,
1943
+ };
1944
+
1945
+ // G-1 ENFORCEMENT AT THE WRITER: a deterministic node:assert (never a judge call)
1946
+ // that refuses the emit if any encoder leg is non-null, banked is true, or the
1947
+ // mode label is lost. Called immediately before BOTH fs.writeFileSync calls.
1948
+ const report = renderReasoningReport({
1949
+ provenance: provenance,
1950
+ roomDir: opts.db,
1951
+ top: cap,
1952
+ ranked: ranked,
1953
+ statements: statements,
1954
+ });
1955
+ reasoningMode.assertReasoningInvariants(jsonOut);
1956
+ fs.mkdirSync(path.dirname(paths.outPath), { recursive: true });
1957
+ fs.writeFileSync(paths.outPath, report, 'utf8');
1958
+
1959
+ reasoningMode.assertReasoningInvariants(jsonOut);
1960
+ fs.mkdirSync(path.dirname(paths.jsonPath), { recursive: true });
1961
+ fs.writeFileSync(paths.jsonPath, JSON.stringify(jsonOut, null, 2) + '\n', 'utf8');
1962
+
1963
+ process.stdout.write('eureka-portfolio-report --reasoning-score: wrote ' + paths.outPath + ' + ' + paths.jsonPath
1964
+ + ' (mode reasoning, ' + ranked.length + ' ranked, ' + statements.length + ' statements, '
1965
+ + pairsSent + ' rubric-scored, cause ' + provenance.degrade_cause + ')\n');
1966
+ return 0;
1967
+ }
1968
+
1969
+ // buildUpgradeDelta(jsonPath, provenance, rankedRows) -- SEED req 5. On the
1970
+ // EMBEDDED success path, if the prior report on disk was written in reasoning
1971
+ // mode, attach a provenance.upgrade delta (what survived into the new embedded
1972
+ // ranked list, what did not) instead of silently replacing it. Any read/parse
1973
+ // failure is a no-op (no upgrade key, byte-identical); never throws.
1974
+ function buildUpgradeDelta(jsonPath, provenance, rankedRows) {
1975
+ let prev;
1976
+ try {
1977
+ prev = JSON.parse(fs.readFileSync(jsonPath, 'utf8'));
1978
+ } catch (_e) {
1979
+ return; // no prior file / unreadable / unparseable -> byte-identical, no key
1980
+ }
1981
+ if (!prev || !prev.provenance || prev.provenance.run_mode !== 'reasoning') return;
1982
+ const prevStatements = Array.isArray(prev.statements) ? prev.statements : [];
1983
+ const previousTop = prevStatements.slice(0, 5).map(function (s) { return { a: s.a, b: s.b }; });
1984
+ const newSet = new Set();
1985
+ const rr = Array.isArray(rankedRows) ? rankedRows : [];
1986
+ for (let i = 0; i < rr.length; i += 1) {
1987
+ newSet.add(rr[i].idA + '|' + rr[i].idB);
1988
+ newSet.add(rr[i].idB + '|' + rr[i].idA);
1989
+ }
1990
+ let survived = 0;
1991
+ for (let i = 0; i < previousTop.length; i += 1) {
1992
+ if (newSet.has(previousTop[i].a + '|' + previousTop[i].b)) survived += 1;
1993
+ }
1994
+ provenance.upgrade = {
1995
+ previous_run_mode: 'reasoning',
1996
+ previous_run_date: prev.provenance.run_date,
1997
+ previous_top: previousTop,
1998
+ survived: survived,
1999
+ demoted_or_absent: previousTop.length - survived,
2000
+ };
2001
+ }
2002
+
2003
+ if (require.main === module) {
2004
+ main(process.argv.slice(2)).then(function (code) { process.exit(code); }, function (err) {
2005
+ // WR-01 fix: the --reasoning-emit/--reasoning-score stage dispatch (line ~806)
2006
+ // returns BEFORE main()'s own try/catch, so a throw on either path (e.g. an
2007
+ // ENOENT from a missing workdir) was previously an unhandled promise rejection
2008
+ // / hard crash. Degrade to the same clean-exit-code pattern main()'s own catch
2009
+ // uses, instead of a stack trace.
2010
+ process.stderr.write('eureka-portfolio-report FAILED: ' + String(err && err.message ? err.message : err) + '\n');
2011
+ process.exit(1);
2012
+ });
2013
+ }
2014
+
2015
+ module.exports = {
2016
+ parseArgv: parseArgv,
2017
+ loadGraph: loadGraph,
2018
+ loadBrokerage: loadBrokerage,
2019
+ techFor: techFor,
2020
+ catalogId: catalogId,
2021
+ cnumberNumeric: cnumberNumeric,
2022
+ deriveSharedProblems: deriveSharedProblems,
2023
+ main: main,
2024
+ // Phase 219 REQ-1: exported so tests/test-219-banking.cjs drives the banking
2025
+ // pass hermetically without a full eureka run.
2026
+ bankStatements: bankStatements,
2027
+ resolveBankPredicate: resolveBankPredicate,
2028
+ deriveBankSection: deriveBankSection,
2029
+ BANK_SESSION_ID: BANK_SESSION_ID,
2030
+ // Phase 226-02: the reasoning-mode stages, exported so the hermetic tests drive
2031
+ // them without a full CLI spawn.
2032
+ reasoningStageSeed: reasoningStageSeed,
2033
+ reasoningStageEmit: reasoningStageEmit,
2034
+ reasoningStageScore: reasoningStageScore,
2035
+ buildUpgradeDelta: buildUpgradeDelta,
2036
+ renderReasoningReport: renderReasoningReport,
2037
+ resolveReasoningPaths: resolveReasoningPaths,
2038
+ };