@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.
- package/.claude-plugin/plugin.json +21 -0
- package/.mcp.json +14 -0
- package/CHANGELOG.md +497 -0
- package/agents/analogy-query-fetcher.md +119 -0
- package/agents/brain-query.md +91 -0
- package/agents/competitor-watch-fetcher.md +94 -0
- package/agents/framework-runner.md +258 -0
- package/agents/grading.md +216 -0
- package/agents/grant-reviewer.md +191 -0
- package/agents/investor.md +141 -0
- package/agents/larry-extended.md +215 -0
- package/agents/meeting-perspective-extractor.md +94 -0
- package/agents/opportunity-scanner.md +105 -0
- package/agents/persona-analyst.md +201 -0
- package/agents/research.md +103 -0
- package/agents/reverse-salient-agent.md +42 -0
- package/agents/vault-section-reviewer.md +107 -0
- package/assets/banner-showcase.html +537 -0
- package/assets/fonts/BebasNeue-Regular.ttf +0 -0
- package/assets/fonts/Inter-Bold.ttf +0 -0
- package/assets/fonts/Inter-Regular.ttf +0 -0
- package/assets/logo.svg +10 -0
- package/bin/local-chain-recommender.cjs +256 -0
- package/bin/mindrian-brain-mcp-client.cjs +319 -0
- package/bin/mindrian-mcp-server.cjs +445 -0
- package/bin/mindrian-mcp-shim.cjs +100 -0
- package/bin/mindrian-tools.cjs +784 -0
- package/commands/act.md +529 -0
- package/commands/admin.md +439 -0
- package/commands/agentshield.md +49 -0
- package/commands/analyze-needs.md +78 -0
- package/commands/analyze-systems.md +73 -0
- package/commands/analyze-timing.md +98 -0
- package/commands/auto-explore.md +85 -0
- package/commands/beautiful-question.md +76 -0
- package/commands/bono.md +152 -0
- package/commands/brain-derive.md +137 -0
- package/commands/build-knowledge.md +121 -0
- package/commands/build-thesis.md +94 -0
- package/commands/causal.md +269 -0
- package/commands/challenge-assumptions.md +78 -0
- package/commands/compare-ventures.md +117 -0
- package/commands/correct-reference-now.md +88 -0
- package/commands/dashboard.md +144 -0
- package/commands/deck.md +117 -0
- package/commands/deep-grade.md +214 -0
- package/commands/diagnose.md +131 -0
- package/commands/diagnostics.md +195 -0
- package/commands/dial-memory-refresh.md +113 -0
- package/commands/diffusion.md +129 -0
- package/commands/discover.md +221 -0
- package/commands/doctor.md +271 -0
- package/commands/dogfood-flush.md +130 -0
- package/commands/dominant-designs.md +76 -0
- package/commands/eureka.md +315 -0
- package/commands/explain-decision.md +135 -0
- package/commands/explore-domains.md +78 -0
- package/commands/explore-futures.md +67 -0
- package/commands/explore-opportunity.md +172 -0
- package/commands/explore-trends.md +78 -0
- package/commands/export.md +128 -0
- package/commands/feynman-timeline-refresh.md +102 -0
- package/commands/file-meeting.md +1195 -0
- package/commands/find-analogies.md +369 -0
- package/commands/find-bottlenecks.md +108 -0
- package/commands/find-connections.md +111 -0
- package/commands/funding.md +114 -0
- package/commands/futures.md +128 -0
- package/commands/grade-grant.md +297 -0
- package/commands/grade.md +257 -0
- package/commands/graph.md +218 -0
- package/commands/hat-briefing.md +163 -0
- package/commands/heal.md +72 -0
- package/commands/help.md +176 -0
- package/commands/hmi-status.md +75 -0
- package/commands/ignite.md +229 -0
- package/commands/ingest-methodology.md +128 -0
- package/commands/intel-pipeline.md +133 -0
- package/commands/jtbd.md +262 -0
- package/commands/leadership.md +113 -0
- package/commands/lean-canvas.md +74 -0
- package/commands/macro-trends.md +88 -0
- package/commands/map-unknowns.md +76 -0
- package/commands/memory-cortex-reach.md +79 -0
- package/commands/memory.md +213 -0
- package/commands/models.md +200 -0
- package/commands/mos-reason.md +489 -0
- package/commands/mos.md +162 -0
- package/commands/mullins.md +155 -0
- package/commands/mva-brief.md +86 -0
- package/commands/mva-option.md +119 -0
- package/commands/mva-report.md +76 -0
- package/commands/new-project.md +633 -0
- package/commands/new-surface.md +116 -0
- package/commands/onboard.md +489 -0
- package/commands/operator.md +168 -0
- package/commands/opportunities.md +177 -0
- package/commands/organize.md +74 -0
- package/commands/persona.md +276 -0
- package/commands/pipeline.md +167 -0
- package/commands/present.md +125 -0
- package/commands/publish.md +227 -0
- package/commands/pws-brain.md +154 -0
- package/commands/qualify-opportunity.md +113 -0
- package/commands/query.md +70 -0
- package/commands/radar.md +110 -0
- package/commands/reanalyze.md +124 -0
- package/commands/research.md +467 -0
- package/commands/room.md +385 -0
- package/commands/rooms.md +682 -0
- package/commands/root-cause.md +77 -0
- package/commands/rs-experts.md +153 -0
- package/commands/rs-explain.md +134 -0
- package/commands/rs-fetch.md +119 -0
- package/commands/rs-thesis.md +131 -0
- package/commands/scenario-plan.md +80 -0
- package/commands/scheduled-tasks.md +308 -0
- package/commands/score-innovation.md +78 -0
- package/commands/scout.md +379 -0
- package/commands/setup.md +658 -0
- package/commands/show.md +71 -0
- package/commands/skill.md +108 -0
- package/commands/snapshot.md +179 -0
- package/commands/speakers.md +118 -0
- package/commands/splash.md +55 -0
- package/commands/stance.md +91 -0
- package/commands/status.md +109 -0
- package/commands/structure-argument.md +82 -0
- package/commands/suggest-next.md +141 -0
- package/commands/systems-thinking.md +224 -0
- package/commands/think-hats.md +86 -0
- package/commands/trending-to-absurd.md +151 -0
- package/commands/update.md +256 -0
- package/commands/user-needs.md +77 -0
- package/commands/validate.md +77 -0
- package/commands/value-proposition.md +116 -0
- package/commands/vault.md +330 -0
- package/commands/visualize.md +71 -0
- package/commands/whitespace.md +541 -0
- package/commands/wiki.md +96 -0
- package/data/ROOM.md +47 -0
- package/data/brain-census.generated.json +2617 -0
- package/data/brain-orchestration-projection.json +4973 -0
- package/data/brain-packet-schema.json +545 -0
- package/data/brain-surface-contract.json +32 -0
- package/data/capability-ledger.json +391 -0
- package/data/capability-map-registry.json +23 -0
- package/data/command-registry.json +2433 -0
- package/data/connector-coverage-ledger.json +1618 -0
- package/data/connector-out-of-spine-allowlist.json +71 -0
- package/data/connector-registry.json +3637 -0
- package/data/corpus-stats-source.json +11 -0
- package/data/corpus-stats.generated.json +10 -0
- package/data/cross-domain-analogues.json +15 -0
- package/data/deck-aliases.json +6 -0
- package/data/deck-styles.json +85 -0
- package/data/deployment-surfaces.json +69 -0
- package/data/dispatch-framework-map.json +18 -0
- package/data/doctor-modules.json +206 -0
- package/data/dual-graph-health-baseline.json +12 -0
- package/data/eureka-critic-tags.json +32 -0
- package/data/first-reward-surfaces.json +66 -0
- package/data/first-touch-surfaces.json +60 -0
- package/data/flagship-floor-set.json +37 -0
- package/data/framework-names.json +121 -0
- package/data/grant-rubric-fixtures/early-stage-pre-seed.json +18 -0
- package/data/grant-rubric-fixtures/early-stage-round-a.json +18 -0
- package/data/grant-rubric-fixtures/early-stage-seed.json +18 -0
- package/data/grant-rubric-fixtures/hybrid-seed-incentive.json +18 -0
- package/data/grant-rubric-fixtures/rd-fund.json +18 -0
- package/data/grant-rubric-fixtures/regional-innovation-incubators.json +18 -0
- package/data/grant-rubric-fixtures/technology-incubators.json +18 -0
- package/data/grant-rubric-fixtures/tnufa.json +167 -0
- package/data/grant-rubric-schema.json +33 -0
- package/data/harness-fixtures/converged-room/.context/ROOM.md +13 -0
- package/data/harness-fixtures/converged-room/.intelligence/ROOM.md +13 -0
- package/data/harness-fixtures/converged-room/.snapshots/ROOM.md +13 -0
- package/data/harness-fixtures/converged-room/MINTO.md +19 -0
- package/data/harness-fixtures/converged-room/STATE.md +73 -0
- package/data/harness-fixtures/converged-room/USER.md +23 -0
- package/data/harness-fixtures/converged-room/assets/ROOM.md +13 -0
- package/data/harness-fixtures/converged-room/business-model/CONTEXT.md +32 -0
- package/data/harness-fixtures/converged-room/business-model/ROOM.md +36 -0
- package/data/harness-fixtures/converged-room/competitive-analysis/CONTEXT.md +33 -0
- package/data/harness-fixtures/converged-room/competitive-analysis/ROOM.md +35 -0
- package/data/harness-fixtures/converged-room/financial-model/CONTEXT.md +30 -0
- package/data/harness-fixtures/converged-room/financial-model/ROOM.md +35 -0
- package/data/harness-fixtures/converged-room/funding/CONTEXT.md +41 -0
- package/data/harness-fixtures/converged-room/funding/ROOM.md +35 -0
- package/data/harness-fixtures/converged-room/legal-ip/CONTEXT.md +30 -0
- package/data/harness-fixtures/converged-room/legal-ip/ROOM.md +35 -0
- package/data/harness-fixtures/converged-room/market-analysis/CONTEXT.md +32 -0
- package/data/harness-fixtures/converged-room/market-analysis/ROOM.md +35 -0
- package/data/harness-fixtures/converged-room/opportunity-bank/CONTEXT.md +39 -0
- package/data/harness-fixtures/converged-room/opportunity-bank/ROOM.md +36 -0
- package/data/harness-fixtures/converged-room/problem-definition/CONTEXT.md +32 -0
- package/data/harness-fixtures/converged-room/problem-definition/ROOM.md +36 -0
- package/data/harness-fixtures/converged-room/references/ROOM.md +13 -0
- package/data/harness-fixtures/converged-room/references/SECTION-SCHEMA.md +213 -0
- package/data/harness-fixtures/converged-room/references/SUB-SCHEMAS.md +91 -0
- package/data/harness-fixtures/converged-room/solution-design/CONTEXT.md +36 -0
- package/data/harness-fixtures/converged-room/solution-design/ROOM.md +36 -0
- package/data/harness-fixtures/converged-room/strategy/CONTEXT.md +35 -0
- package/data/harness-fixtures/converged-room/strategy/ROOM.md +35 -0
- package/data/harness-fixtures/converged-room/team/ROOM.md +13 -0
- package/data/harness-fixtures/converged-room/team-execution/CONTEXT.md +36 -0
- package/data/harness-fixtures/converged-room/team-execution/ROOM.md +35 -0
- package/data/harness-manifest.json +74 -0
- package/data/harness-policies/CONTEXT.md +55 -0
- package/data/harness-policies/_schema.json +42 -0
- package/data/harness-policies/contract-parity-larry.json +63 -0
- package/data/harness-policies/gate-card-fire.json +13 -0
- package/data/harness-policies/gate-graph-derive-health.json +13 -0
- package/data/harness-policies/gate-shape-declaration.json +13 -0
- package/data/harness-policies/gate-tool-honesty.json +13 -0
- package/data/harness-policies/gate-worktree-hygiene.json +13 -0
- package/data/harness-policies/memory-write-policy.json +28 -0
- package/data/harness-policies/registry-drift.json +13 -0
- package/data/harness-policies/release-payload-ceiling.json +13 -0
- package/data/harness-policies/voice-backend-noun-free.json +13 -0
- package/data/harness-policies/voice-fork-as-card.json +13 -0
- package/data/harness-policies/voice-glyph-present.json +13 -0
- package/data/harness-policies/voice-hyphens-only.json +13 -0
- package/data/help-groups.json +236 -0
- package/data/hitl-shape-backfill.json +777 -0
- package/data/hitl-shape-declaration-fixtures/invalid-bad-shape.json +5 -0
- package/data/hitl-shape-declaration-fixtures/invalid-missing-why.json +4 -0
- package/data/hitl-shape-declaration-fixtures/invalid-ranker-contradiction.json +6 -0
- package/data/hitl-shape-declaration-fixtures/invalid-skill-gap.json +3 -0
- package/data/hitl-shape-declaration-fixtures/valid-multi-stage.json +7 -0
- package/data/hitl-shape-declaration-fixtures/valid-single-shape.json +5 -0
- package/data/hitl-shape-declaration-fixtures/valid-skill-exempt.json +5 -0
- package/data/hitl-shape-declaration-schema.json +34 -0
- package/data/hitl-stages-fixtures/bono.json +10 -0
- package/data/hitl-stages-fixtures/pipeline-1.json +9 -0
- package/data/hitl-stages-fixtures/pipeline-2.json +9 -0
- package/data/hitl-stages-fixtures/pipeline-3.json +10 -0
- package/data/hitl-stages-fixtures/research.json +10 -0
- package/data/hitl-stages-fixtures/rs-convergence.json +10 -0
- package/data/hitl-stages-fixtures/rs-family.json +11 -0
- package/data/hitl-stages-fixtures/rs-reverse-salient.json +10 -0
- package/data/hitl-stages-fixtures/trending-to-absurd.json +11 -0
- package/data/hitl-stages-schema.json +26 -0
- package/data/mcp-tool-connectors.json +464 -0
- package/data/mva-agent-prompts.json +31 -0
- package/data/mva-deck-template.html +15 -0
- package/data/mva-heuristic-keywords.json +35 -0
- package/data/orchestration-command-ledger.json +576 -0
- package/data/orchestration-unwired-allowlist.json +6 -0
- package/data/portfolio-ahp-matrix.json +16 -0
- package/data/publish-needs.json +76 -0
- package/data/render-coverage-registry.json +1152 -0
- package/data/research-sources.json +58 -0
- package/data/roadmap-type-chains.json +28 -0
- package/data/room-blueprints.json +156 -0
- package/data/subagent-dispatch-grants.json +150 -0
- package/hooks/hooks.json +493 -0
- package/hooks/run-hook.cmd +64 -0
- package/lib/__init__.py +0 -0
- package/lib/__pycache__/__init__.cpython-312.pyc +0 -0
- package/lib/agents/auto-explore-agent.cjs +1163 -0
- package/lib/agents/mva/brain-classic-traps.cjs +55 -0
- package/lib/agents/mva/brain-cross-domain.cjs +79 -0
- package/lib/agents/mva/brain-similar-ventures.cjs +93 -0
- package/lib/agents/mva/dashboard-graph-neighborhood.cjs +72 -0
- package/lib/agents/mva/index.cjs +42 -0
- package/lib/agents/mva/six-hats-red-black.cjs +137 -0
- package/lib/agents/mva/tavily-funding-scan.cjs +147 -0
- package/lib/agents/mva/test-all-six-agents.cjs +467 -0
- package/lib/agents/reverse-salient-agent.cjs +757 -0
- package/lib/agents/tension-hook-agent.cjs +586 -0
- package/lib/brain/ROOM.md +44 -0
- package/lib/brain/chain-recommender.cjs +784 -0
- package/lib/brain/curation-batch.cjs +519 -0
- package/lib/brain/framework-chain-slice.cjs +252 -0
- package/lib/brain/hypergraph-event-schema.cjs +184 -0
- package/lib/chat/chat-context.js +185 -0
- package/lib/chat/chat-panel.js +721 -0
- package/lib/chat/fabric-chat.cjs +288 -0
- package/lib/chat/generative-tools.js +219 -0
- package/lib/conversation/ROOM.md +39 -0
- package/lib/conversation/classifier-rules.json +38 -0
- package/lib/conversation/classifier.cjs +264 -0
- package/lib/conversation/operator-epistemic-cap.test.cjs +156 -0
- package/lib/conversation/operator.cjs +492 -0
- package/lib/conversation/operator.test.cjs +160 -0
- package/lib/copy/115-spec-strings.cjs +55 -0
- package/lib/core/__init__.py +0 -0
- package/lib/core/__nav-stub.cjs +14 -0
- package/lib/core/__pycache__/__init__.cpython-312.pyc +0 -0
- package/lib/core/__pycache__/rs-math.cpython-312.pyc +0 -0
- package/lib/core/__pycache__/rs_cache.cpython-312.pyc +0 -0
- package/lib/core/__pycache__/rs_corpus.cpython-312.pyc +0 -0
- package/lib/core/__pycache__/rs_corpus_exclude.cpython-312.pyc +0 -0
- package/lib/core/__pycache__/rs_hybrid.cpython-312.pyc +0 -0
- package/lib/core/__pycache__/rs_math.cpython-312.pyc +0 -0
- package/lib/core/__pycache__/rs_rooms.cpython-312.pyc +0 -0
- package/lib/core/abstraction-gate.cjs +133 -0
- package/lib/core/act-jtbd-blurb.cjs +231 -0
- package/lib/core/artifact-id.cjs +148 -0
- package/lib/core/asset-ops.cjs +151 -0
- package/lib/core/auto-commit-throttle.cjs +129 -0
- package/lib/core/bearer-token.cjs +199 -0
- package/lib/core/behavioral/observation-schema.cjs +86 -0
- package/lib/core/bono/cell-fanout.cjs +305 -0
- package/lib/core/bono/debate-composition.cjs +495 -0
- package/lib/core/bono/hat-governance.cjs +367 -0
- package/lib/core/bono/persona-research.cjs +288 -0
- package/lib/core/bono/reviewer-governance.cjs +331 -0
- package/lib/core/brain-client.cjs +2621 -0
- package/lib/core/brain-derivation-prompts.cjs +331 -0
- package/lib/core/brain-derivation-queue.cjs +535 -0
- package/lib/core/brain-derivation.cjs +740 -0
- package/lib/core/brain-md-schema.cjs +528 -0
- package/lib/core/brain-md-staleness.cjs +357 -0
- package/lib/core/brain-response-sanitize.cjs +396 -0
- package/lib/core/breakthrough/canary.cjs +134 -0
- package/lib/core/breakthrough/canary.test.cjs +136 -0
- package/lib/core/breakthrough/detectors.cjs +359 -0
- package/lib/core/breakthrough/detectors.test.cjs +333 -0
- package/lib/core/breakthrough/ethics-fence.cjs +129 -0
- package/lib/core/breakthrough/ethics-fence.test.cjs +178 -0
- package/lib/core/breakthrough/resurfacing.cjs +150 -0
- package/lib/core/breakthrough/resurfacing.test.cjs +233 -0
- package/lib/core/breakthrough/review-queue.cjs +168 -0
- package/lib/core/breakthrough/review-queue.test.cjs +160 -0
- package/lib/core/breakthrough/scanner-d17-d18.test.cjs +229 -0
- package/lib/core/breakthrough/scanner.cjs +435 -0
- package/lib/core/breakthrough/scanner.test.cjs +267 -0
- package/lib/core/breakthrough/schema.cjs +180 -0
- package/lib/core/breakthrough/schema.test.cjs +256 -0
- package/lib/core/breakthrough/scoring.cjs +293 -0
- package/lib/core/breakthrough/scoring.test.cjs +423 -0
- package/lib/core/breakthrough/verb-dispatch.cjs +230 -0
- package/lib/core/breakthrough/verb-dispatch.test.cjs +185 -0
- package/lib/core/breakthrough/voice-scaffold.cjs +249 -0
- package/lib/core/breakthrough/voice-scaffold.test.cjs +251 -0
- package/lib/core/bridge-writer.cjs +477 -0
- package/lib/core/cache-prune.cjs +314 -0
- package/lib/core/card-fire-gate.cjs +107 -0
- package/lib/core/card-fire-sidechannel.cjs +518 -0
- package/lib/core/chain-executor.cjs +939 -0
- package/lib/core/chain-retry.cjs +214 -0
- package/lib/core/chain-step-dispatcher.cjs +397 -0
- package/lib/core/chat-context-builder.cjs +253 -0
- package/lib/core/check-plugin-enabled.cjs +145 -0
- package/lib/core/close-loop-writer.cjs +492 -0
- package/lib/core/command-registration-check.cjs +246 -0
- package/lib/core/correlation-label-index.cjs +230 -0
- package/lib/core/correlation.cjs +112 -0
- package/lib/core/coverage-monitor.cjs +183 -0
- package/lib/core/coverage-rollup.cjs +232 -0
- package/lib/core/cross-room-aggregator.cjs +1127 -0
- package/lib/core/cross-room-store.cjs +292 -0
- package/lib/core/cross-room-triggers.cjs +222 -0
- package/lib/core/daily-briefing.cjs +438 -0
- package/lib/core/decision-axes.cjs +178 -0
- package/lib/core/decision-capture.cjs +618 -0
- package/lib/core/deck-design-rules.cjs +211 -0
- package/lib/core/deep-links.cjs +82 -0
- package/lib/core/directive-envelope.cjs +230 -0
- package/lib/core/directive-envelope.test.cjs +225 -0
- package/lib/core/dispatch-optimizer.cjs +354 -0
- package/lib/core/doc-text-extractor.cjs +133 -0
- package/lib/core/doctor/capability-ledger-module.cjs +170 -0
- package/lib/core/doctor/card-fire-health-module.cjs +159 -0
- package/lib/core/doctor/cascade-rooms-active-module.cjs +127 -0
- package/lib/core/doctor/cascade-rooms-module.cjs +184 -0
- package/lib/core/doctor/class-m-brain-smoke.cjs +479 -0
- package/lib/core/doctor/class-m-brain-smoke.test.cjs +448 -0
- package/lib/core/doctor/class-s-eureka-smoke.cjs +380 -0
- package/lib/core/doctor/deployment-surfaces-module.cjs +408 -0
- package/lib/core/doctor/deprecated-usage-module.cjs +155 -0
- package/lib/core/doctor/eureka-fts-health-module.cjs +236 -0
- package/lib/core/doctor/graph-derive-heal-retrofit-module.cjs +148 -0
- package/lib/core/doctor/graph-derive-health-module.cjs +486 -0
- package/lib/core/doctor/install-incomplete-module.cjs +320 -0
- package/lib/core/doctor/install-state-module.cjs +503 -0
- package/lib/core/doctor/mcp-surface-module.cjs +369 -0
- package/lib/core/doctor/mode-select-checkpoint-module.cjs +113 -0
- package/lib/core/doctor/plugin-enabled-state-module.cjs +86 -0
- package/lib/core/doctor/room-graph-density-module.cjs +181 -0
- package/lib/core/doctor/room-md-module.cjs +198 -0
- package/lib/core/doctor/shared.cjs +555 -0
- package/lib/core/doctor/stale-first-touch-copy-module.cjs +83 -0
- package/lib/core/doctor/statusline-visibility-module.cjs +295 -0
- package/lib/core/doctor/ui-compliance-module.cjs +223 -0
- package/lib/core/doctor/umbilical-module.cjs +486 -0
- package/lib/core/doctor/verify-surface-module.cjs +82 -0
- package/lib/core/doctor/voice-style-log-module.cjs +146 -0
- package/lib/core/domain-insight-sweep.cjs +224 -0
- package/lib/core/drift-baseline.cjs +362 -0
- package/lib/core/drift-runtime-reachability.cjs +283 -0
- package/lib/core/dual-path-detector.cjs +84 -0
- package/lib/core/dual-path-detector.test.cjs +334 -0
- package/lib/core/enrichment-queue.cjs +636 -0
- package/lib/core/eureka/ahp-weights.cjs +232 -0
- package/lib/core/eureka/analogy-fitness.cjs +326 -0
- package/lib/core/eureka/compression-meter.cjs +165 -0
- package/lib/core/eureka/embedding-classifier.cjs +226 -0
- package/lib/core/eureka/embedding-spine.cjs +563 -0
- package/lib/core/eureka/entity-classifier.cjs +232 -0
- package/lib/core/eureka/entity-extractor.cjs +356 -0
- package/lib/core/eureka/eureka-enable.cjs +228 -0
- package/lib/core/eureka/eureka-offer.cjs +225 -0
- package/lib/core/eureka/eureka-reach-runner.cjs +430 -0
- package/lib/core/eureka/explore-chain.cjs +834 -0
- package/lib/core/eureka/explored-artifact.cjs +456 -0
- package/lib/core/eureka/fts-index-lifecycle.cjs +265 -0
- package/lib/core/eureka/grade-grant-examine.cjs +544 -0
- package/lib/core/eureka/grade-grant.cjs +596 -0
- package/lib/core/eureka/hybrid-retrieve.cjs +256 -0
- package/lib/core/eureka/lateral-engine-adapter.cjs +118 -0
- package/lib/core/eureka/lexical-overlap.cjs +98 -0
- package/lib/core/eureka/online-pattern-query.cjs +142 -0
- package/lib/core/eureka/opportunity-harvest.cjs +752 -0
- package/lib/core/eureka/opportunity-statement.cjs +519 -0
- package/lib/core/eureka/portfolio-dimensions.cjs +255 -0
- package/lib/core/eureka/qualify-opportunity.cjs +607 -0
- package/lib/core/eureka/reasoning-mode.cjs +481 -0
- package/lib/core/eureka/report-html.cjs +368 -0
- package/lib/core/eureka/research-filing.cjs +547 -0
- package/lib/core/eureka/room-native-substrate.cjs +343 -0
- package/lib/core/eureka/tail-quadrant.cjs +177 -0
- package/lib/core/eureka/tri-modal-index.cjs +564 -0
- package/lib/core/eureka/vector-store.cjs +414 -0
- package/lib/core/eureka-critic.cjs +733 -0
- package/lib/core/eureka-deps-resolver.cjs +179 -0
- package/lib/core/expert-genesis.cjs +437 -0
- package/lib/core/expert-library.cjs +303 -0
- package/lib/core/exports-log.cjs +79 -0
- package/lib/core/feynman/ROOM.md +25 -0
- package/lib/core/feynman/dial-memory-renderer.cjs +279 -0
- package/lib/core/feynman/dial-memory-runner.cjs +173 -0
- package/lib/core/feynman/feynman-seed-writer.cjs +187 -0
- package/lib/core/feynman/timeline-renderer.cjs +197 -0
- package/lib/core/feynman/timeline-runner.cjs +281 -0
- package/lib/core/feynman-minto-invariants.cjs +609 -0
- package/lib/core/findings-wirer.cjs +360 -0
- package/lib/core/first-touch-version-stamper.cjs +113 -0
- package/lib/core/folder-memory-async.cjs +424 -0
- package/lib/core/folder-memory-shared.cjs +890 -0
- package/lib/core/folder-memory.cjs +546 -0
- package/lib/core/framework-chain-composer.cjs +583 -0
- package/lib/core/frontmatter-schemas.cjs +468 -0
- package/lib/core/fusion-router.cjs +540 -0
- package/lib/core/futures/causal-cue.cjs +91 -0
- package/lib/core/futures/orchestrator.cjs +1391 -0
- package/lib/core/futures/subsystem-render.cjs +164 -0
- package/lib/core/gate-relevance.cjs +278 -0
- package/lib/core/git-ops.cjs +141 -0
- package/lib/core/graph-backfill.cjs +562 -0
- package/lib/core/graph-candidate-producer.cjs +235 -0
- package/lib/core/graph-derivation.cjs +546 -0
- package/lib/core/graph-derive-classifier.cjs +352 -0
- package/lib/core/graph-ops.cjs +274 -0
- package/lib/core/graph-refine-loop.cjs +194 -0
- package/lib/core/graph-self-heal.cjs +289 -0
- package/lib/core/greeting-intent-detector.cjs +201 -0
- package/lib/core/grill-engine.cjs +459 -0
- package/lib/core/hat-persistence.cjs +274 -0
- package/lib/core/hsi-engine.cjs +439 -0
- package/lib/core/hsi-lsa.cjs +246 -0
- package/lib/core/hsi-spectral.cjs +554 -0
- package/lib/core/hsi-to-graph.test.cjs +168 -0
- package/lib/core/icm-forest.cjs +703 -0
- package/lib/core/ignite-branch-gate.cjs +66 -0
- package/lib/core/index.cjs +60 -0
- package/lib/core/insight-sensors.cjs +1000 -0
- package/lib/core/install-state.cjs +242 -0
- package/lib/core/integration-registry.cjs +232 -0
- package/lib/core/intel-pipeline.cjs +566 -0
- package/lib/core/intelligence-cascade.cjs +852 -0
- package/lib/core/issue-tree.cjs +269 -0
- package/lib/core/larry-thinness-acknowledgment.cjs +64 -0
- package/lib/core/larry-thinness-acknowledgment.test.cjs +97 -0
- package/lib/core/lazygraph-ops.cjs +1453 -0
- package/lib/core/lens-engine.cjs +434 -0
- package/lib/core/leverage-scan.cjs +218 -0
- package/lib/core/llm-name-suggester.cjs +194 -0
- package/lib/core/llm-name-suggester.test.cjs +132 -0
- package/lib/core/lru-cache.cjs +139 -0
- package/lib/core/mcp-dep-heal.cjs +475 -0
- package/lib/core/mcp-dep-heal.test.cjs +253 -0
- package/lib/core/mcp-profiles.cjs +185 -0
- package/lib/core/meeting-ops.cjs +54 -0
- package/lib/core/memory/governance-candidate-raiser.cjs +205 -0
- package/lib/core/memory/governance-candidate.cjs +95 -0
- package/lib/core/memory/reconcile-memory-runner.cjs +653 -0
- package/lib/core/memory-ops.cjs +641 -0
- package/lib/core/meter/gate-density-reader.cjs +112 -0
- package/lib/core/meter/transfer-reader.cjs +276 -0
- package/lib/core/meter/two-gauge.cjs +245 -0
- package/lib/core/methodology-ingest.cjs +346 -0
- package/lib/core/metrics/larryreach-loop-health.cjs +142 -0
- package/lib/core/migration-snapshot.cjs +287 -0
- package/lib/core/migration-snapshot.test.cjs +174 -0
- package/lib/core/migrations/ROOM.md +33 -0
- package/lib/core/migrations/phase-109-nodes-provenance.cjs +400 -0
- package/lib/core/migrations/phase-109-session-focus.cjs +99 -0
- package/lib/core/migrations/phase-160-nodes-bitemporal.cjs +168 -0
- package/lib/core/migrations/phase-160-nodes-bitemporal.test.cjs +140 -0
- package/lib/core/migrations/phase-162-section-nodes.cjs +156 -0
- package/lib/core/migrations/phase-222-ranker-weights.cjs +62 -0
- package/lib/core/migrations/phase-224-edge-review-status.cjs +87 -0
- package/lib/core/mindrian-brain-shim.test.cjs +221 -0
- package/lib/core/mode-select-sidechannel.cjs +259 -0
- package/lib/core/model-profiles.cjs +246 -0
- package/lib/core/mullins-scaffold.cjs +258 -0
- package/lib/core/mullins-scaffold.test.cjs +128 -0
- package/lib/core/mva-agent-contract.cjs +170 -0
- package/lib/core/mva-agent-contract.test.cjs +169 -0
- package/lib/core/mva-budget.cjs +75 -0
- package/lib/core/mva-budget.test.cjs +68 -0
- package/lib/core/mva-classifier.cjs +392 -0
- package/lib/core/mva-classifier.test.cjs +248 -0
- package/lib/core/mva-deck-builder.cjs +452 -0
- package/lib/core/mva-deck-builder.test.cjs +287 -0
- package/lib/core/mva-detect.smoke.test.cjs +209 -0
- package/lib/core/mva-dispatcher.cjs +110 -0
- package/lib/core/mva-dispatcher.test.cjs +216 -0
- package/lib/core/mva-option-router.cjs +414 -0
- package/lib/core/mva-option-router.test.cjs +483 -0
- package/lib/core/mva-orchestrator.cjs +365 -0
- package/lib/core/mva-orchestrator.test.cjs +916 -0
- package/lib/core/mva-progressive-renderer.cjs +194 -0
- package/lib/core/mva-progressive-renderer.test.cjs +157 -0
- package/lib/core/mva-rule-linter.cjs +458 -0
- package/lib/core/mva-rule-linter.test.cjs +484 -0
- package/lib/core/mva-state.cjs +159 -0
- package/lib/core/mva-telemetry.cjs +58 -0
- package/lib/core/mva-telemetry.test.cjs +196 -0
- package/lib/core/mva-vercel-deploy.cjs +168 -0
- package/lib/core/mva-vercel-deploy.test.cjs +239 -0
- package/lib/core/nav-dial.cjs +440 -0
- package/lib/core/navigation/ROOM.md +15 -0
- package/lib/core/navigation/abstraction-claim.cjs +185 -0
- package/lib/core/navigation/calibration-gate.cjs +284 -0
- package/lib/core/navigation/calibration-log.cjs +141 -0
- package/lib/core/navigation/confirm-node.cjs +73 -0
- package/lib/core/navigation/dashboard-helpers.cjs +145 -0
- package/lib/core/navigation/edges.cjs +1150 -0
- package/lib/core/navigation/evidence-claim.cjs +186 -0
- package/lib/core/navigation/explanation.cjs +48 -0
- package/lib/core/navigation/file-evidence-readback.cjs +242 -0
- package/lib/core/navigation/focus.cjs +155 -0
- package/lib/core/navigation/get-domains-for-trends.cjs +277 -0
- package/lib/core/navigation/governance.cjs +101 -0
- package/lib/core/navigation/grant-rubric.cjs +218 -0
- package/lib/core/navigation/graph-export.cjs +325 -0
- package/lib/core/navigation/ingestion.cjs +109 -0
- package/lib/core/navigation/insights-stale.test.cjs +127 -0
- package/lib/core/navigation/insights.cjs +574 -0
- package/lib/core/navigation/lens-nodes.cjs +315 -0
- package/lib/core/navigation/memory-artifacts.cjs +437 -0
- package/lib/core/navigation/memory-cortex-packet.cjs +274 -0
- package/lib/core/navigation/memory-events.cjs +811 -0
- package/lib/core/navigation/neighborhood.cjs +79 -0
- package/lib/core/navigation/packet.cjs +420 -0
- package/lib/core/navigation/planning-artifacts.cjs +219 -0
- package/lib/core/navigation/projections.cjs +295 -0
- package/lib/core/navigation/ranker-weights.cjs +133 -0
- package/lib/core/navigation/reasoning-write.cjs +211 -0
- package/lib/core/navigation/reconcile-guard.cjs +98 -0
- package/lib/core/navigation/reified-claim.cjs +287 -0
- package/lib/core/navigation/research-preflight.cjs +156 -0
- package/lib/core/navigation/room-birth.cjs +1213 -0
- package/lib/core/navigation/room-context.cjs +380 -0
- package/lib/core/navigation/room-home.cjs +142 -0
- package/lib/core/navigation/spine-events.cjs +548 -0
- package/lib/core/navigation/synthetic-expert.cjs +177 -0
- package/lib/core/navigation/transitions.cjs +253 -0
- package/lib/core/navigation/typed-claim.cjs +208 -0
- package/lib/core/navigation/typed-domain.cjs +249 -0
- package/lib/core/navigation/typed-entity.cjs +236 -0
- package/lib/core/navigation/typed-frame.cjs +257 -0
- package/lib/core/navigation/typed-open-question.cjs +130 -0
- package/lib/core/navigation/typed-opportunity.cjs +418 -0
- package/lib/core/navigation-engine-offer.cjs +776 -0
- package/lib/core/navigation-engine-shared.cjs +256 -0
- package/lib/core/navigation-engine.cjs +1696 -0
- package/lib/core/navigation.cjs +686 -0
- package/lib/core/nl-graph-queries.cjs +164 -0
- package/lib/core/node-insert-epistemic.test.cjs +212 -0
- package/lib/core/node-insert-overrides.test.cjs +273 -0
- package/lib/core/node-insert.cjs +274 -0
- package/lib/core/npm-cli-resolve.cjs +151 -0
- package/lib/core/npm-cli-resolve.test.cjs +153 -0
- package/lib/core/npm-install-lock.cjs +326 -0
- package/lib/core/npm-install-lock.test.cjs +379 -0
- package/lib/core/numeric/sklearn-stopwords-v1.json +325 -0
- package/lib/core/numeric/svd.cjs +377 -0
- package/lib/core/numeric/tfidf.cjs +241 -0
- package/lib/core/offer-presenter.cjs +406 -0
- package/lib/core/opportunity-extractor.cjs +183 -0
- package/lib/core/opportunity-ops.cjs +1423 -0
- package/lib/core/orchestration-candidate-lift.cjs +284 -0
- package/lib/core/part8-egress-guard.cjs +563 -0
- package/lib/core/part8-egress-guard.test.cjs +194 -0
- package/lib/core/part8-egress-ontology.cjs +174 -0
- package/lib/core/part8-egress-ontology.test.cjs +133 -0
- package/lib/core/persona-ops.cjs +692 -0
- package/lib/core/persona-override.cjs +327 -0
- package/lib/core/persona-taxonomy.cjs +328 -0
- package/lib/core/pinecone-inference.cjs +176 -0
- package/lib/core/pitch-feedback-schemas.cjs +303 -0
- package/lib/core/planning/artifact-brain-packet.cjs +212 -0
- package/lib/core/planning/reconcile-runner.cjs +347 -0
- package/lib/core/platform-gates.cjs +120 -0
- package/lib/core/platform.cjs +257 -0
- package/lib/core/proactive-intelligence.cjs +528 -0
- package/lib/core/problem-type-router.cjs +315 -0
- package/lib/core/publish-needs-default-lane.cjs +110 -0
- package/lib/core/ralph-loop-gate.cjs +48 -0
- package/lib/core/reader/ab-harness.cjs +177 -0
- package/lib/core/reader/decide-projection-reader.cjs +358 -0
- package/lib/core/reasoning-ops.cjs +639 -0
- package/lib/core/recipe-maps.cjs +442 -0
- package/lib/core/recovery/case-file.cjs +358 -0
- package/lib/core/recovery/controller.cjs +1008 -0
- package/lib/core/recovery/dispatcher.cjs +533 -0
- package/lib/core/recovery/result-semantics.cjs +488 -0
- package/lib/core/recovery/stage-envelope.cjs +338 -0
- package/lib/core/refusal-messaging.cjs +569 -0
- package/lib/core/refusal-messaging.test.cjs +220 -0
- package/lib/core/repo-version.cjs +134 -0
- package/lib/core/research-cache.cjs +165 -0
- package/lib/core/research-cache.test.cjs +137 -0
- package/lib/core/research-context-extractor.cjs +283 -0
- package/lib/core/research-corpus.cjs +814 -0
- package/lib/core/research-corpus.test.cjs +280 -0
- package/lib/core/research-filing-selector.cjs +189 -0
- package/lib/core/resolve-active-room.cjs +602 -0
- package/lib/core/resolve-brain-key.cjs +273 -0
- package/lib/core/resolve-umbilical-target.cjs +288 -0
- package/lib/core/resolve-vercel-key.cjs +107 -0
- package/lib/core/resolve-vercel-key.test.cjs +137 -0
- package/lib/core/reverse-salient-persona-suffix.cjs +115 -0
- package/lib/core/room-auto-create.cjs +318 -0
- package/lib/core/room-auto-create.test.cjs +198 -0
- package/lib/core/room-chooser.cjs +244 -0
- package/lib/core/room-classifier-strict-mode.cjs +235 -0
- package/lib/core/room-db.cjs +348 -0
- package/lib/core/room-discard-cascade.cjs +238 -0
- package/lib/core/room-discard-cascade.test.cjs +135 -0
- package/lib/core/room-name-validator.cjs +132 -0
- package/lib/core/room-name-validator.test.cjs +156 -0
- package/lib/core/room-naming-selector.cjs +357 -0
- package/lib/core/room-naming-selector.test.cjs +277 -0
- package/lib/core/room-open.cjs +259 -0
- package/lib/core/room-ops-async.cjs +92 -0
- package/lib/core/room-ops-shared.cjs +64 -0
- package/lib/core/room-ops-sync.cjs +70 -0
- package/lib/core/room-ops.cjs +32 -0
- package/lib/core/room-receipt-emit.cjs +63 -0
- package/lib/core/room-root.cjs +93 -0
- package/lib/core/room-skeleton-scaffold.cjs +669 -0
- package/lib/core/room-skeleton-scaffold.test.cjs +296 -0
- package/lib/core/room-type-detector.cjs +386 -0
- package/lib/core/rs-backend-dispatch.cjs +64 -0
- package/lib/core/rs-brain-substrate-prompts.cjs +129 -0
- package/lib/core/rs-brain-substrate.cjs +570 -0
- package/lib/core/rs-breakthrough-scorer.cjs +255 -0
- package/lib/core/rs-canon-violations.cjs +82 -0
- package/lib/core/rs-chain-feeder.cjs +381 -0
- package/lib/core/rs-commercial-assessor.cjs +280 -0
- package/lib/core/rs-corpus-quality-gate.cjs +62 -0
- package/lib/core/rs-differential-scorer.cjs +629 -0
- package/lib/core/rs-domain-analyzer.cjs +385 -0
- package/lib/core/rs-egress-prompts.cjs +113 -0
- package/lib/core/rs-egress-telemetry.cjs +225 -0
- package/lib/core/rs-egress-violations.cjs +53 -0
- package/lib/core/rs-engine.cjs +597 -0
- package/lib/core/rs-expert-brain-projection.cjs +280 -0
- package/lib/core/rs-expert-mapper.cjs +467 -0
- package/lib/core/rs-fetcher-academic.cjs +697 -0
- package/lib/core/rs-fetcher-experts.cjs +314 -0
- package/lib/core/rs-fetcher-industry.cjs +731 -0
- package/lib/core/rs-fetcher-patents.cjs +564 -0
- package/lib/core/rs-innovation-classifier.cjs +194 -0
- package/lib/core/rs-math.cjs +458 -0
- package/lib/core/rs-mind-map.cjs +656 -0
- package/lib/core/rs-neo4j-writer.cjs +388 -0
- package/lib/core/rs-nl-to-query.cjs +435 -0
- package/lib/core/rs-pinecone-bridge.cjs +344 -0
- package/lib/core/rs-preprocessor.cjs +350 -0
- package/lib/core/rs-query-matrix.cjs +316 -0
- package/lib/core/rs-query-to-text.cjs +438 -0
- package/lib/core/rs-sqlite-mirror.cjs +495 -0
- package/lib/core/rs-thesis-generator.cjs +188 -0
- package/lib/core/rs_cache.py +635 -0
- package/lib/core/rs_corpus.py +562 -0
- package/lib/core/rs_corpus_exclude.py +62 -0
- package/lib/core/rs_hybrid.py +589 -0
- package/lib/core/rs_math.py +287 -0
- package/lib/core/rs_rooms.py +196 -0
- package/lib/core/salient-governance.cjs +315 -0
- package/lib/core/scheduled-scanner.cjs +658 -0
- package/lib/core/scratchpad-ops.cjs +316 -0
- package/lib/core/seam-liveness.cjs +191 -0
- package/lib/core/seam-liveness.test.cjs +177 -0
- package/lib/core/section-8-trace-schema.cjs +138 -0
- package/lib/core/section-registry.cjs +167 -0
- package/lib/core/security/agentshield-adapters.test.cjs +104 -0
- package/lib/core/security/agentshield-run.cjs +343 -0
- package/lib/core/security/agentshield-scanner.cjs +314 -0
- package/lib/core/security/agentshield-scanner.test.cjs +259 -0
- package/lib/core/sensors/hat-scoping-table.cjs +103 -0
- package/lib/core/sensors/sensor-circularity.cjs +278 -0
- package/lib/core/sensors/sensor-content-relevance.cjs +407 -0
- package/lib/core/sensors/sensor-diffusion-adoption.cjs +230 -0
- package/lib/core/sensors/sensor-eureka.cjs +208 -0
- package/lib/core/sensors/sensor-expert-skill.cjs +293 -0
- package/lib/core/sensors/sensor-external-fact.cjs +184 -0
- package/lib/core/sensors/sensor-gate-approach.cjs +104 -0
- package/lib/core/sensors/sensor-jtbd-reweight.cjs +141 -0
- package/lib/core/sensors/sensor-lagging-component.cjs +115 -0
- package/lib/core/sensors/sensor-memory-cortex.cjs +111 -0
- package/lib/core/sensors/sensor-methodology-decision.cjs +131 -0
- package/lib/core/sensors/sensor-opportunity-harvest.cjs +195 -0
- package/lib/core/sensors/sensor-perspective-lock.cjs +174 -0
- package/lib/core/sensors/sensor-priority.cjs +183 -0
- package/lib/core/sensors/sensor-recency.cjs +151 -0
- package/lib/core/sensors/sensor-roadmap-type.cjs +421 -0
- package/lib/core/sensors/sensor-room-pick.cjs +238 -0
- package/lib/core/sensors/sensor-show-share.cjs +215 -0
- package/lib/core/sensors/sensor-temporal-blindness.cjs +123 -0
- package/lib/core/sensors/sensor-types.cjs +294 -0
- package/lib/core/sensors/sensor-url-ingest.cjs +234 -0
- package/lib/core/session-binding.cjs +208 -0
- package/lib/core/session-presence.cjs +404 -0
- package/lib/core/session-register.cjs +138 -0
- package/lib/core/session-state.cjs +144 -0
- package/lib/core/shallow-doc-parser.cjs +353 -0
- package/lib/core/shallow-doc-parser.test.cjs +226 -0
- package/lib/core/skill-activation-router.cjs +284 -0
- package/lib/core/skillopt-schemas.cjs +509 -0
- package/lib/core/stale-copy-scanner.cjs +190 -0
- package/lib/core/stance-state.cjs +153 -0
- package/lib/core/state-aware-router.cjs +78 -0
- package/lib/core/state-ops.cjs +80 -0
- package/lib/core/state-version.cjs +350 -0
- package/lib/core/statusline-cache.cjs +266 -0
- package/lib/core/statusline-liveness-gate.cjs +105 -0
- package/lib/core/surface-fence.cjs +127 -0
- package/lib/core/synthesizers/comparison-matrix.cjs +82 -0
- package/lib/core/synthesizers/convergence-map.cjs +107 -0
- package/lib/core/synthesizers/domain-hierarchy.cjs +138 -0
- package/lib/core/synthesizers/source-comparison.cjs +56 -0
- package/lib/core/synthesizers/tension-map.cjs +119 -0
- package/lib/core/synthetic-expert-behavior-gate.cjs +99 -0
- package/lib/core/synthetic-expert-construction-gate.cjs +170 -0
- package/lib/core/telemetry/schema.cjs +168 -0
- package/lib/core/telemetry/schema.test.cjs +124 -0
- package/lib/core/telemetry/validator.cjs +200 -0
- package/lib/core/telemetry/validator.test.cjs +188 -0
- package/lib/core/telemetry/writer.cjs +141 -0
- package/lib/core/telemetry/writer.test.cjs +331 -0
- package/lib/core/temporal/date-sync-gate.cjs +256 -0
- package/lib/core/temporal/date-sync-gate.test.cjs +191 -0
- package/lib/core/temporal/dual-stamp.cjs +172 -0
- package/lib/core/temporal/dual-stamp.test.cjs +172 -0
- package/lib/core/temporal/point-in-time.cjs +76 -0
- package/lib/core/temporal/point-in-time.test.cjs +169 -0
- package/lib/core/temporal/recency-decay.cjs +119 -0
- package/lib/core/temporal/recency-decay.test.cjs +140 -0
- package/lib/core/temporal/reference-now.cjs +281 -0
- package/lib/core/temporal/reference-now.test.cjs +225 -0
- package/lib/core/temporal/resolve-relative-time.cjs +116 -0
- package/lib/core/temporal/resolve-relative-time.test.cjs +138 -0
- package/lib/core/temporal/supersession.cjs +250 -0
- package/lib/core/temporal/supersession.test.cjs +103 -0
- package/lib/core/terminal-capability.cjs +88 -0
- package/lib/core/token-estimator.cjs +348 -0
- package/lib/core/tone-filter.cjs +147 -0
- package/lib/core/trending-to-absurd/orchestrator.cjs +341 -0
- package/lib/core/trending-to-absurd/stage7-roadmap.cjs +317 -0
- package/lib/core/trending-to-absurd/variance.cjs +169 -0
- package/lib/core/unknowns/bandit.cjs +332 -0
- package/lib/core/unknowns/corpus-adapter.cjs +327 -0
- package/lib/core/unknowns/dsp.cjs +356 -0
- package/lib/core/unknowns/edge-writer.cjs +211 -0
- package/lib/core/unknowns/iface.cjs +212 -0
- package/lib/core/unknowns/orchestrator.cjs +375 -0
- package/lib/core/unknowns/pattern-miner.cjs +214 -0
- package/lib/core/unknowns/rumsfeld-matrix.cjs +155 -0
- package/lib/core/unknowns/verdict.cjs +254 -0
- package/lib/core/update-path.cjs +57 -0
- package/lib/core/url-ingest.cjs +568 -0
- package/lib/core/user-archetype.cjs +284 -0
- package/lib/core/user-md-ops.cjs +578 -0
- package/lib/core/venture-shape-nudge.cjs +178 -0
- package/lib/core/venture-shape-nudge.test.cjs +266 -0
- package/lib/core/verb-reach-affinity.cjs +299 -0
- package/lib/core/visual-ops.cjs +692 -0
- package/lib/core/voice-transition-detector.cjs +125 -0
- package/lib/core/watched-sources.cjs +237 -0
- package/lib/core/write-lock.cjs +149 -0
- package/lib/graph/canvas-graph.js +467 -0
- package/lib/graph/constellation-config.cjs +299 -0
- package/lib/graph/graph-detail-panel.js +165 -0
- package/lib/hmi/ROOM.md +47 -0
- package/lib/hmi/across-session-memory.cjs +669 -0
- package/lib/hmi/agentshield-drift-gate.cjs +142 -0
- package/lib/hmi/brain-review-packet.cjs +221 -0
- package/lib/hmi/cortex-reach-adapter.cjs +271 -0
- package/lib/hmi/cross-room-memory.cjs +618 -0
- package/lib/hmi/decoy-tier.cjs +395 -0
- package/lib/hmi/depth-state.cjs +164 -0
- package/lib/hmi/dial-label-composer.cjs +410 -0
- package/lib/hmi/dial-presenter.cjs +508 -0
- package/lib/hmi/dial-reach-orchestrator.cjs +377 -0
- package/lib/hmi/dial-selector.cjs +239 -0
- package/lib/hmi/f1-pick-capture-cli.cjs +131 -0
- package/lib/hmi/f3-depth-capture-cli.cjs +77 -0
- package/lib/hmi/f4-scope-capture-cli.cjs +86 -0
- package/lib/hmi/f8-action-capture-cli.cjs +145 -0
- package/lib/hmi/f8-capture.test.cjs +77 -0
- package/lib/hmi/f9-ordered-capture-cli.cjs +138 -0
- package/lib/hmi/harvest-scope-state.cjs +202 -0
- package/lib/hmi/hats-persona-cache.cjs +142 -0
- package/lib/hmi/jtbd-classifier.cjs +219 -0
- package/lib/hmi/jtbd-state.cjs +263 -0
- package/lib/hmi/jtbd-taxonomy.json +402 -0
- package/lib/hmi/mindrian-ascii-logo.cjs +96 -0
- package/lib/hmi/part8-egress-gate.cjs +149 -0
- package/lib/hmi/reach-component-map.json +47 -0
- package/lib/hmi/reach-relevance-gate.cjs +147 -0
- package/lib/hmi/selector-dispatcher.cjs +1201 -0
- package/lib/hmi/selector-dispatcher.test.cjs +141 -0
- package/lib/hmi/selector-telemetry.cjs +269 -0
- package/lib/hmi/shape-f0-renderer.cjs +145 -0
- package/lib/hmi/shape-f1-fallback.cjs +80 -0
- package/lib/hmi/shape-f1-renderer.cjs +219 -0
- package/lib/hmi/shape-f2-renderer.cjs +132 -0
- package/lib/hmi/shape-f3-parity.test.cjs +64 -0
- package/lib/hmi/shape-f3-renderer.cjs +66 -0
- package/lib/hmi/shape-f4-parity.test.cjs +72 -0
- package/lib/hmi/shape-f4-renderer.cjs +72 -0
- package/lib/hmi/shape-f5-renderer.cjs +155 -0
- package/lib/hmi/shape-f6-plan-review-renderer.cjs +324 -0
- package/lib/hmi/shape-f6-renderer.cjs +144 -0
- package/lib/hmi/shape-f7-breakthrough-renderer.cjs +234 -0
- package/lib/hmi/shape-f7-breakthrough-renderer.test.cjs +233 -0
- package/lib/hmi/shape-f8-renderer.cjs +150 -0
- package/lib/hmi/shape-f8-renderer.test.cjs +70 -0
- package/lib/hmi/shape-f9-renderer.cjs +187 -0
- package/lib/hmi/shape-f9-renderer.test.cjs +80 -0
- package/lib/hmi/shape-g-renderer.cjs +219 -0
- package/lib/hmi/shape-h-renderer.cjs +222 -0
- package/lib/hmi/tier-check.cjs +63 -0
- package/lib/hmi/turn-text.cjs +268 -0
- package/lib/hmi/voice-color-mark.cjs +318 -0
- package/lib/hmi/voice-style-log.cjs +276 -0
- package/lib/import/PRECONDITIONS.md +41 -0
- package/lib/import/branding.cjs +210 -0
- package/lib/import/branding.test.cjs +235 -0
- package/lib/import/classifications-sync.cjs +104 -0
- package/lib/import/classifications-sync.test.cjs +129 -0
- package/lib/import/enricher.cjs +296 -0
- package/lib/import/enricher.test.cjs +273 -0
- package/lib/import/integration.test.cjs +376 -0
- package/lib/import/manifest.cjs +129 -0
- package/lib/import/manifest.schema.json +185 -0
- package/lib/import/manifest.test.cjs +123 -0
- package/lib/import/meeting-detector.cjs +92 -0
- package/lib/import/meeting-detector.test.cjs +100 -0
- package/lib/import/person-detector.cjs +229 -0
- package/lib/import/person-detector.test.cjs +149 -0
- package/lib/import/report.cjs +186 -0
- package/lib/import/report.test.cjs +186 -0
- package/lib/import/room-md-scaffolder.cjs +49 -0
- package/lib/import/router.cjs +224 -0
- package/lib/import/router.test.cjs +356 -0
- package/lib/import/run-all-tests.cjs +36 -0
- package/lib/import/smoke-test.cjs +213 -0
- package/lib/import/smoke-test.test.cjs +148 -0
- package/lib/import/undo.test.cjs +199 -0
- package/lib/import/vault-scanner.cjs +105 -0
- package/lib/import/vault-scanner.test.cjs +67 -0
- package/lib/lens-engine/correlation-resolver.cjs +174 -0
- package/lib/lens-engine/source-lens-driver.cjs +736 -0
- package/lib/mcp/adapter-client.cjs +103 -0
- package/lib/mcp/app-html/dashboard.html +316 -0
- package/lib/mcp/app-html/graph.html +428 -0
- package/lib/mcp/app-html/mindrian-platform.html +1841 -0
- package/lib/mcp/app-html/wiki.html +383 -0
- package/lib/mcp/app-views.cjs +322 -0
- package/lib/mcp/brain-composition-census.cjs +184 -0
- package/lib/mcp/brain-router.cjs +551 -0
- package/lib/mcp/capability-registry.cjs +62 -0
- package/lib/mcp/contract-version.cjs +59 -0
- package/lib/mcp/daemon-lifecycle.cjs +324 -0
- package/lib/mcp/gate-dedup.cjs +120 -0
- package/lib/mcp/gate-ledger.cjs +145 -0
- package/lib/mcp/gate-render.cjs +483 -0
- package/lib/mcp/hook-adapter-audit.cjs +199 -0
- package/lib/mcp/larry-context.cjs +42 -0
- package/lib/mcp/mcp-first-flag.cjs +147 -0
- package/lib/mcp/no-instructions.test.cjs +270 -0
- package/lib/mcp/pipeline-state.cjs +424 -0
- package/lib/mcp/prompts.cjs +421 -0
- package/lib/mcp/register-core-tools.cjs +78 -0
- package/lib/mcp/resources.cjs +359 -0
- package/lib/mcp/runtime-instructions.cjs +38 -0
- package/lib/mcp/session-catchup.cjs +349 -0
- package/lib/mcp/session-registry.cjs +113 -0
- package/lib/mcp/session-room.cjs +124 -0
- package/lib/mcp/sse-event-bus.cjs +98 -0
- package/lib/mcp/stop-gate-handler.cjs +589 -0
- package/lib/mcp/surface-detect.cjs +186 -0
- package/lib/mcp/tool-router.cjs +2115 -0
- package/lib/mcp/tools/chain.cjs +674 -0
- package/lib/mcp/tools/claim.cjs +180 -0
- package/lib/mcp/tools/context.cjs +92 -0
- package/lib/mcp/tools/dual-path.cjs +79 -0
- package/lib/mcp/tools/gate.cjs +392 -0
- package/lib/mcp/tools/graph-reason.cjs +130 -0
- package/lib/mcp/tools/graph.cjs +321 -0
- package/lib/mcp/tools/identity.cjs +174 -0
- package/lib/mcp/tools/room.cjs +449 -0
- package/lib/mcp/tools/sensors.cjs +450 -0
- package/lib/mcp/tools/status.cjs +183 -0
- package/lib/mcp/tools/stop-gate.cjs +103 -0
- package/lib/mcp/tools/views.cjs +382 -0
- package/lib/mcp/tree-watcher.cjs +199 -0
- package/lib/memory/.mindrian/auto-explore-mat-test-001.json +11 -0
- package/lib/memory/aaak-compress.cjs +403 -0
- package/lib/memory/aaak-compress.test.cjs +288 -0
- package/lib/memory/async-artifact-auto-commit.test.cjs +223 -0
- package/lib/memory/bearer-token.test.cjs +315 -0
- package/lib/memory/body-shape-coverage.test.cjs +268 -0
- package/lib/memory/brain-cache-lru.test.cjs +259 -0
- package/lib/memory/brain-client-query-shape.test.cjs +160 -0
- package/lib/memory/brain-cypher-chain-slice.test.cjs +368 -0
- package/lib/memory/brain-derivation-graceful-degradation.test.cjs +1019 -0
- package/lib/memory/brain-derivation-queue.test.cjs +553 -0
- package/lib/memory/brain-derivation.test.cjs +639 -0
- package/lib/memory/brain-derive-command.test.cjs +534 -0
- package/lib/memory/brain-derive-curation.test.cjs +243 -0
- package/lib/memory/brain-md-invariants-validator.test.cjs +704 -0
- package/lib/memory/brain-md-schema.test.cjs +467 -0
- package/lib/memory/brain-md-staleness.test.cjs +525 -0
- package/lib/memory/brain-server-resolution.test.cjs +314 -0
- package/lib/memory/brain-suggestion-template.test.cjs +200 -0
- package/lib/memory/chain-recommender-canonical.test.cjs +208 -0
- package/lib/memory/chain-recommender.test.cjs +233 -0
- package/lib/memory/chat-context.test.cjs +128 -0
- package/lib/memory/command-registry.test.cjs +220 -0
- package/lib/memory/connector-registry.test.cjs +94 -0
- package/lib/memory/correlation-label-index.test.cjs +119 -0
- package/lib/memory/correlation.test.cjs +253 -0
- package/lib/memory/cross-room-aggregator.test.cjs +909 -0
- package/lib/memory/curation-132-03-dedup-held-rename.test.cjs +251 -0
- package/lib/memory/curation-132-05-pseudonymize.test.cjs +205 -0
- package/lib/memory/curation-batch.test.cjs +213 -0
- package/lib/memory/dashboard-server.test.cjs +256 -0
- package/lib/memory/debouncer-drain-at-prompt.test.cjs +389 -0
- package/lib/memory/decision-capture.test.cjs +632 -0
- package/lib/memory/decision-capture.worker.cjs +70 -0
- package/lib/memory/doctor-deprecation-surface.test.cjs +188 -0
- package/lib/memory/dual-graph-health.test.cjs +485 -0
- package/lib/memory/explain-decision-command.test.cjs +521 -0
- package/lib/memory/explain-decision-footer.test.cjs +316 -0
- package/lib/memory/explored-materials-store.cjs +392 -0
- package/lib/memory/f-selector-ranker.test.cjs +593 -0
- package/lib/memory/feynman-minto-guardian.test.cjs +863 -0
- package/lib/memory/feynman-minto-invariants.test.cjs +554 -0
- package/lib/memory/feynman-prompts-drift.test.cjs +144 -0
- package/lib/memory/feynman-prompts.cjs +151 -0
- package/lib/memory/feynman-prompts.test.cjs +96 -0
- package/lib/memory/first-touch-version.test.cjs +198 -0
- package/lib/memory/folder-memory-quadruple.test.cjs +548 -0
- package/lib/memory/folder-memory.test.cjs +503 -0
- package/lib/memory/framework-chain-composer.test.cjs +549 -0
- package/lib/memory/frontmatter-schema-validator.test.cjs +344 -0
- package/lib/memory/guardian-onstop-reaches-user.test.cjs +396 -0
- package/lib/memory/heal-command.test.cjs +604 -0
- package/lib/memory/help-coverage.test.cjs +108 -0
- package/lib/memory/help-renderer.test.cjs +145 -0
- package/lib/memory/huji-run-one-async-parity.test.cjs +242 -0
- package/lib/memory/hypergraph-event-schema.test.cjs +116 -0
- package/lib/memory/index-artifact-transaction.test.cjs +333 -0
- package/lib/memory/lazygraph-rs-discoveries-view.test.cjs +122 -0
- package/lib/memory/local-chain-recommender.test.cjs +172 -0
- package/lib/memory/mcp-input-validation.test.cjs +240 -0
- package/lib/memory/mcp-server-brain-deps.test.cjs +270 -0
- package/lib/memory/mcp-stack-fallback.test.cjs +433 -0
- package/lib/memory/minto-debounce-consumer-census.test.cjs +567 -0
- package/lib/memory/minto-debouncer.test.cjs +407 -0
- package/lib/memory/minto-debouncer.worker.cjs +46 -0
- package/lib/memory/minto-migration-v88.test.cjs +265 -0
- package/lib/memory/minto-schema-v88.test.cjs +390 -0
- package/lib/memory/mos-status-renderer.test.cjs +631 -0
- package/lib/memory/narrative-schema.cjs +376 -0
- package/lib/memory/narrative-schema.test.cjs +209 -0
- package/lib/memory/nav-dial.test.cjs +414 -0
- package/lib/memory/navigation-engine-core.test.cjs +712 -0
- package/lib/memory/navigation-engine-offer.test.cjs +404 -0
- package/lib/memory/navigation-hook-resolver.test.cjs +177 -0
- package/lib/memory/navigation-invariants.test.cjs +483 -0
- package/lib/memory/navigation-projections.test.cjs +241 -0
- package/lib/memory/navigation-write-edge.test.cjs +206 -0
- package/lib/memory/offer-closer.test.cjs +258 -0
- package/lib/memory/offer-presenter.test.cjs +554 -0
- package/lib/memory/on-stop-snapshot.test.cjs +404 -0
- package/lib/memory/orchestration-projection.test.cjs +706 -0
- package/lib/memory/packet-chain-hint.test.cjs +407 -0
- package/lib/memory/packet-schema-validation.test.cjs +317 -0
- package/lib/memory/palette-consistency.test.cjs +127 -0
- package/lib/memory/pending-tension-store.cjs +453 -0
- package/lib/memory/per-command-jtbd-derivation.test.cjs +130 -0
- package/lib/memory/per-command-teaching.test.cjs +110 -0
- package/lib/memory/post-compact-reinjection.test.cjs +854 -0
- package/lib/memory/post-write-triple.test.cjs +317 -0
- package/lib/memory/pre-compact-snapshot.test.cjs +495 -0
- package/lib/memory/precommit-real-commit.test.cjs +301 -0
- package/lib/memory/problem-type-router.test.cjs +656 -0
- package/lib/memory/query-efficiency-telemetry.test.cjs +612 -0
- package/lib/memory/recompile-room-references.test.cjs +392 -0
- package/lib/memory/recompile-room-references.worker.cjs +42 -0
- package/lib/memory/record-decision-dual-write.test.cjs +454 -0
- package/lib/memory/render-v2-disposition.test.cjs +199 -0
- package/lib/memory/room-classifier-strict-mode.test.cjs +430 -0
- package/lib/memory/room-minto-hook.test.cjs +398 -0
- package/lib/memory/rs-discovery-engine.test.cjs +323 -0
- package/lib/memory/run-feynman-tests.cjs +2101 -0
- package/lib/memory/security-trifecta.test.cjs +329 -0
- package/lib/memory/selector-alias-map.test.cjs +172 -0
- package/lib/memory/selector-decisions.test.cjs +417 -0
- package/lib/memory/selector-miss.test.cjs +290 -0
- package/lib/memory/session-start-brain-staleness.test.cjs +363 -0
- package/lib/memory/session-start-triple-injection.test.cjs +514 -0
- package/lib/memory/sessionstart-banner-formatter.cjs +318 -0
- package/lib/memory/sessionstart-coordinator.test.cjs +446 -0
- package/lib/memory/sessionstart-minto-banner.test.cjs +373 -0
- package/lib/memory/skill-activation-router.test.cjs +465 -0
- package/lib/memory/skill-vs-code-drift.test.cjs +257 -0
- package/lib/memory/soft-alias.test.cjs +144 -0
- package/lib/memory/spine-events-correlation.test.cjs +198 -0
- package/lib/memory/stale-copy-scanner.test.cjs +294 -0
- package/lib/memory/stamp-artifact-write.test.cjs +304 -0
- package/lib/memory/state-aware-router.test.cjs +90 -0
- package/lib/memory/statusline-active-room-write.test.cjs +245 -0
- package/lib/memory/statusline-active-room.test.cjs +315 -0
- package/lib/memory/statusline-minto-segment.test.cjs +292 -0
- package/lib/memory/statusline-two-row.test.cjs +338 -0
- package/lib/memory/suggest-next-workflow.test.cjs +176 -0
- package/lib/memory/sync-async-entry-points.test.cjs +204 -0
- package/lib/memory/terminal-capability.test.cjs +155 -0
- package/lib/memory/test-bridge-writer-enhanced.cjs +452 -0
- package/lib/memory/test-rs-brain-substrate-shape.cjs +529 -0
- package/lib/memory/test-rs-brain-substrate.cjs +636 -0
- package/lib/memory/test-rs-breakthrough-scorer.cjs +375 -0
- package/lib/memory/test-rs-canon-violations.cjs +218 -0
- package/lib/memory/test-rs-chain-feeder-core.cjs +344 -0
- package/lib/memory/test-rs-chain-feeder-skill-spawn.cjs +297 -0
- package/lib/memory/test-rs-commercial-assessor.cjs +385 -0
- package/lib/memory/test-rs-differential-scorer.cjs +480 -0
- package/lib/memory/test-rs-discovery-engine.cjs +648 -0
- package/lib/memory/test-rs-domain-analyzer.cjs +492 -0
- package/lib/memory/test-rs-egress-primitives.cjs +420 -0
- package/lib/memory/test-rs-expert-mapper.cjs +547 -0
- package/lib/memory/test-rs-explain-command.cjs +443 -0
- package/lib/memory/test-rs-fetcher-academic.cjs +848 -0
- package/lib/memory/test-rs-fetcher-experts.cjs +496 -0
- package/lib/memory/test-rs-fetcher-industry.cjs +702 -0
- package/lib/memory/test-rs-fetcher-patents.cjs +674 -0
- package/lib/memory/test-rs-innovation-classifier.cjs +301 -0
- package/lib/memory/test-rs-mind-map.cjs +646 -0
- package/lib/memory/test-rs-neo4j-writer.cjs +518 -0
- package/lib/memory/test-rs-nl-to-query.cjs +449 -0
- package/lib/memory/test-rs-pinecone-bridge.cjs +282 -0
- package/lib/memory/test-rs-preprocessor.cjs +433 -0
- package/lib/memory/test-rs-query-matrix.cjs +391 -0
- package/lib/memory/test-rs-query-to-text.cjs +551 -0
- package/lib/memory/test-rs-sqlite-mirror.cjs +649 -0
- package/lib/memory/test-rs-thesis-generator.cjs +360 -0
- package/lib/memory/triple-context-formatter.cjs +473 -0
- package/lib/memory/triple-context-formatter.test.cjs +442 -0
- package/lib/memory/user-md-persona.test.cjs +565 -0
- package/lib/memory/userpromptsubmit-integration.test.cjs +787 -0
- package/lib/memory/validators/README.md +157 -0
- package/lib/memory/validators/brain-md-invariants.cjs +475 -0
- package/lib/memory/validators/brain-substrate-invariants.cjs +285 -0
- package/lib/memory/validators/external-academic-invariants.cjs +249 -0
- package/lib/memory/validators/external-industry-invariants.cjs +271 -0
- package/lib/memory/validators/external-patents-invariants.cjs +266 -0
- package/lib/memory/validators/minto-invariants.cjs +62 -0
- package/lib/memory/validators/navigation-invariants.cjs +340 -0
- package/lib/memory/validators/queue-health.cjs +95 -0
- package/lib/memory/validators/snapshot-integrity.cjs +129 -0
- package/lib/memory/validators/stale-lifecycle.cjs +116 -0
- package/lib/memory/vault-section-minto-generator-atomic.test.cjs +556 -0
- package/lib/memory/vault-section-minto-generator-atomic.worker.cjs +73 -0
- package/lib/memory/workflow-layer-e2e.test.cjs +262 -0
- package/lib/memory/write-lock-atomic.test.cjs +137 -0
- package/lib/memory/write-lock-atomic.worker.cjs +55 -0
- package/lib/parity/check-parity.cjs +83 -0
- package/lib/presentation/presentation-server.cjs +101 -0
- package/lib/presentation/presentation-watcher.cjs +123 -0
- package/lib/quickview/hub-server.cjs +719 -0
- package/lib/quickview/server.cjs +533 -0
- package/lib/render/JTBD-PALETTES.md +145 -0
- package/lib/render/ROOM.md +111 -0
- package/lib/render/render-v2.cjs +532 -0
- package/lib/render/render-v2.test.cjs +267 -0
- package/lib/render/render.cjs +65 -0
- package/lib/sessionstart/budget-compressor.cjs +130 -0
- package/lib/sessionstart/contributor-interface.cjs +134 -0
- package/lib/sessionstart/contributor-isolator.cjs +128 -0
- package/lib/sessionstart/precedence-ladder.cjs +47 -0
- package/lib/state/ROOM.md +46 -0
- package/lib/state/state-md-parser.cjs +215 -0
- package/lib/statusline/ROOM.md +38 -0
- package/lib/statusline/banner-suppression.cjs +50 -0
- package/lib/statusline/cockpit-renderer.cjs +443 -0
- package/lib/statusline/cockpit-signals.cjs +312 -0
- package/lib/statusline/cockpit-telemetry.cjs +152 -0
- package/lib/statusline/ctx-window.cjs +135 -0
- package/lib/statusline/governing-thought-truncator.cjs +45 -0
- package/lib/statusline/next-move-cache.cjs +235 -0
- package/lib/statusline/ratification-next.cjs +164 -0
- package/lib/statusline/room-health-cache.cjs +200 -0
- package/lib/statusline/surface-detect.cjs +85 -0
- package/lib/statusline/two-row-renderer.cjs +207 -0
- package/lib/statusline/version-resolver.cjs +81 -0
- package/lib/ui/design-system.cjs +19 -0
- package/lib/update-bootstrap.sh.template +145 -0
- package/lib/vault/frontmatter-schema.cjs +297 -0
- package/lib/vault/room-scanner.cjs +365 -0
- package/lib/vault/wikilink-builder.cjs +231 -0
- package/lib/vault/wikilink-builder.test.cjs +182 -0
- package/lib/wiki/briefing.cjs +193 -0
- package/lib/wiki/editor-dist/wiki-editor.css +1 -0
- package/lib/wiki/editor-dist/wiki-editor.js +1327 -0
- package/lib/wiki/graph-links.cjs +281 -0
- package/lib/wiki/page-renderer.cjs +229 -0
- package/lib/wiki/room-home.cjs +353 -0
- package/lib/wiki/wiki-chat.cjs +81 -0
- package/lib/wiki/wiki-export.cjs +364 -0
- package/lib/wiki/wiki-layout.cjs +1143 -0
- package/lib/wiki/wiki-search.cjs +142 -0
- package/lib/wiki/wiki-server.cjs +748 -0
- package/lib/wiki/wiki-watcher.cjs +105 -0
- package/lib/workflow/ROOM.md +47 -0
- package/lib/workflow/chain-source.cjs +179 -0
- package/lib/workflow/command-resolver.cjs +155 -0
- package/lib/workflow/command-resolver.test.cjs +235 -0
- package/lib/workflow/cross-room-umbilical-closer.cjs +364 -0
- package/lib/workflow/dial-close-reach.cjs +405 -0
- package/lib/workflow/f-selector-ranker.cjs +1148 -0
- package/lib/workflow/f1-pick-consumer.cjs +232 -0
- package/lib/workflow/f3-depth-consumer.cjs +98 -0
- package/lib/workflow/f4-scope-consumer.cjs +112 -0
- package/lib/workflow/f8-consumer.test.cjs +82 -0
- package/lib/workflow/f8-fanout-consumer.cjs +208 -0
- package/lib/workflow/f9-consumer.test.cjs +71 -0
- package/lib/workflow/f9-ordered-consumer.cjs +199 -0
- package/lib/workflow/local-chain-recommender.cjs +330 -0
- package/lib/workflow/memory-cascade-f9-adapter.cjs +273 -0
- package/lib/workflow/memory-governance-closer.cjs +384 -0
- package/lib/workflow/offer-closer.cjs +407 -0
- package/lib/workflow/reach-hedge-ranker.cjs +809 -0
- package/lib/workflow/reach-reject-reader.cjs +372 -0
- package/lib/workflow/reconcile-f9-adapter.cjs +299 -0
- package/lib/workflow/selector-decisions.cjs +478 -0
- package/lib/workflow/session-binding-consumer.cjs +249 -0
- package/npm-shrinkwrap.json +1544 -0
- package/output-styles/destijl.md +67 -0
- package/package.json +22 -4
- package/pipelines/PWS_grading/01-deep-grade.md +48 -0
- package/pipelines/PWS_grading/02-mullins.md +50 -0
- package/pipelines/PWS_grading/03-build-thesis.md +60 -0
- package/pipelines/PWS_grading/04-structure-argument.md +77 -0
- package/pipelines/PWS_grading/CHAIN.md +79 -0
- package/pipelines/analogy/01-decompose.md +80 -0
- package/pipelines/analogy/02-abstract.md +87 -0
- package/pipelines/analogy/03-search.md +135 -0
- package/pipelines/analogy/04-transfer.md +101 -0
- package/pipelines/analogy/05-validate.md +106 -0
- package/pipelines/analogy/CHAIN.md +73 -0
- package/pipelines/discovery/01-explore-domains.md +44 -0
- package/pipelines/discovery/02-think-hats.md +50 -0
- package/pipelines/discovery/03-analyze-needs.md +54 -0
- package/pipelines/discovery/CHAIN.md +48 -0
- package/pipelines/thesis/01-structure-argument.md +45 -0
- package/pipelines/thesis/02-challenge-assumptions.md +48 -0
- package/pipelines/thesis/03-build-thesis.md +54 -0
- package/pipelines/thesis/CHAIN.md +48 -0
- package/references/brain/causal-directives.md +91 -0
- package/references/brain/causal-enrichment.cypher +165 -0
- package/references/brain/command-triggers-schema.md +15 -0
- package/references/brain/graph-architecture.md +317 -0
- package/references/brain/query-patterns.md +504 -0
- package/references/brain/room-hierarchy-schema.md +224 -0
- package/references/brain/schema.md +86 -0
- package/references/capability-radar/capabilities-index.md +269 -0
- package/references/capability-radar/changelog-cache.md +95 -0
- package/references/causal/causal-schema.md +103 -0
- package/references/design/email-template-standard.md +169 -0
- package/references/design/graph-visualization-standard.md +178 -0
- package/references/design/newsletter-email-template.html +307 -0
- package/references/document-generation.md +179 -0
- package/references/hsi/HSI-TOOLS-REFERENCE.md +222 -0
- package/references/import-config.md +141 -0
- package/references/integrations/detection-patterns.md +101 -0
- package/references/meeting/artifact-template.md +377 -0
- package/references/meeting/cross-meeting-intelligence.md +216 -0
- package/references/meeting/cross-relationship-patterns.md +202 -0
- package/references/meeting/extraction-perspectives.md +225 -0
- package/references/meeting/filing-protocol.md +222 -0
- package/references/meeting/knowledge-typing.md +242 -0
- package/references/meeting/live-join-interface.md +244 -0
- package/references/meeting/section-mapping.md +192 -0
- package/references/meeting/segment-classification.md +258 -0
- package/references/meeting/speaker-profile-template.md +219 -0
- package/references/meeting/summary-template.md +348 -0
- package/references/meeting/transcript-patterns.md +226 -0
- package/references/methodology/analyze-needs.md +135 -0
- package/references/methodology/analyze-systems.md +121 -0
- package/references/methodology/analyze-timing.md +149 -0
- package/references/methodology/beautiful-question.md +109 -0
- package/references/methodology/build-knowledge.md +161 -0
- package/references/methodology/build-thesis-scored.md +60 -0
- package/references/methodology/build-thesis.md +237 -0
- package/references/methodology/causal-loop-diagrams.md +65 -0
- package/references/methodology/challenge-assumptions.md +127 -0
- package/references/methodology/diagnose.md +169 -0
- package/references/methodology/dominant-designs.md +212 -0
- package/references/methodology/explore-domains.md +147 -0
- package/references/methodology/explore-futures.md +163 -0
- package/references/methodology/explore-trends.md +129 -0
- package/references/methodology/find-bottlenecks.md +131 -0
- package/references/methodology/grade.md +211 -0
- package/references/methodology/huji-stage-a-intake.md +246 -0
- package/references/methodology/index.md +34 -0
- package/references/methodology/leadership.md +200 -0
- package/references/methodology/lean-canvas.md +116 -0
- package/references/methodology/leverage-scan-signatures.md +83 -0
- package/references/methodology/macro-trends.md +192 -0
- package/references/methodology/map-unknowns.md +137 -0
- package/references/methodology/mullins-7-domains.md +104 -0
- package/references/methodology/problem-types.md +65 -0
- package/references/methodology/root-cause.md +178 -0
- package/references/methodology/rubric-huji.md +160 -0
- package/references/methodology/sapphire-encoding.md +355 -0
- package/references/methodology/scenario-plan.md +190 -0
- package/references/methodology/score-innovation.md +154 -0
- package/references/methodology/skillopt-judge-rubric.md +48 -0
- package/references/methodology/skillopt-queries-rubric.md +60 -0
- package/references/methodology/skillopt-refute-rubric.md +59 -0
- package/references/methodology/skillopt-review-rubric.md +72 -0
- package/references/methodology/skillopt-revise-rubric.md +48 -0
- package/references/methodology/structure-argument.md +158 -0
- package/references/methodology/systems-thinking.md +231 -0
- package/references/methodology/think-hats.md +147 -0
- package/references/methodology/triz-matrix.json +751 -0
- package/references/methodology/triz-principles.md +501 -0
- package/references/methodology/user-needs.md +199 -0
- package/references/methodology/validate.md +163 -0
- package/references/methodology/value-proposition.md +244 -0
- package/references/opportunities/funding-lifecycle.md +103 -0
- package/references/opportunities/grant-api-patterns.md +99 -0
- package/references/opportunities/opportunity-template.md +84 -0
- package/references/opportunities/tnufa-rubric.md +81 -0
- package/references/personality/assessment-philosophy.md +72 -0
- package/references/personality/lexicon.md +100 -0
- package/references/personality/persona-chains.md +56 -0
- package/references/personality/pws-lexicon-full.md +499 -0
- package/references/personality/voice-dna.md +156 -0
- package/references/personas/hat-perspectives.md +76 -0
- package/references/personas/persona-template.md +63 -0
- package/references/pipeline/act-output-contract.md +88 -0
- package/references/pipeline/chains-index.md +39 -0
- package/references/pws-profile-generation.md +79 -0
- package/references/reasoning/reasoning-schema.md +143 -0
- package/references/reasoning/reasoning-template.md +68 -0
- package/references/reasoning/run-template.md +38 -0
- package/references/research/RESEARCH_14_CLAUDE_CODE_SOURCE_ARCHITECTURE.md +209 -0
- package/references/research/RESEARCH_15_V1.8_OPTIMIZATION_JTBD.md +375 -0
- package/references/research/RESEARCH_16_NATIVE_FIRST_PLUGIN_ARCHITECTURE.md +575 -0
- package/references/research/RESEARCH_17_MCP_UI_FRAMEWORKS.md +272 -0
- package/references/security/agentshield-baseline.json +8 -0
- package/references/security/cve-db.json +220 -0
- package/references/taxonomy/TAXONOMY.md +192 -0
- package/references/templates/MINTO.md +36 -0
- package/references/user-research/2026-04-05-leah-lawrence-session.md +202 -0
- package/references/vault-kit/README.md +35 -0
- package/references/vault-kit/app.json +12 -0
- package/references/vault-kit/appearance.json +12 -0
- package/references/vault-kit/graph.json +35 -0
- package/references/vault-kit/snippets/mindrian-destijl.css +297 -0
- package/references/vault-kit/templates/new-artifact.md +37 -0
- package/references/vault-kit/templates/new-meeting-note.md +35 -0
- package/references/vault-kit/templates/new-team-profile.md +29 -0
- package/references/vault-kit/templates/new-xref.md +35 -0
- package/references/visual/ROOM.md +55 -0
- package/references/visual/palette.json +54 -0
- package/references/visual/symbol-system.md +151 -0
- package/scripts/189-plurai-gate-check.cjs +88 -0
- package/scripts/198-plurai-gate-check.cjs +118 -0
- package/scripts/198-rollback-rehearsal.cjs +233 -0
- package/scripts/83-scope-injection.test.cjs +648 -0
- package/scripts/PYTHON_GATES.md +78 -0
- package/scripts/__pycache__/compute-hsi.cpython-312.pyc +0 -0
- package/scripts/__pycache__/detect-reverse-salients.cpython-312.pyc +0 -0
- package/scripts/__pycache__/rs-engine.cpython-312.pyc +0 -0
- package/scripts/act-command.cjs +518 -0
- package/scripts/admin-brain-write.cjs +442 -0
- package/scripts/admin-command-gate.cjs +178 -0
- package/scripts/agentshield-scan-cli.cjs +226 -0
- package/scripts/agentshield-sessionstart-scan.cjs +282 -0
- package/scripts/analogy-fitness-report.cjs +266 -0
- package/scripts/analyze-room +1079 -0
- package/scripts/apply-teaching-content.cjs +298 -0
- package/scripts/async-artifact-auto-commit.cjs +485 -0
- package/scripts/audit-active-phase-resolver.cjs +160 -0
- package/scripts/audit-body-shape-coverage.cjs +213 -0
- package/scripts/auto-explore-drain.cjs +274 -0
- package/scripts/auto-explore-fingerprint.cjs +354 -0
- package/scripts/auto-explore-fire.cjs +359 -0
- package/scripts/backfill-correlation-id.cjs +425 -0
- package/scripts/backfill-hitl-shape.cjs +276 -0
- package/scripts/backfill-hitl-shape.test.cjs +307 -0
- package/scripts/backup-modifications +68 -0
- package/scripts/banner +182 -0
- package/scripts/brain-derivation-drain.cjs +291 -0
- package/scripts/brain-derive-command.cjs +846 -0
- package/scripts/brain-normalize-books.cypher +505 -0
- package/scripts/brain-normalize-final.cypher +1355 -0
- package/scripts/brain-normalize-problemtype.cypher +475 -0
- package/scripts/brain-normalize-supplement.cypher +449 -0
- package/scripts/brain-normalize-targeted.cypher +344 -0
- package/scripts/brain-normalize-v194.cypher +61 -0
- package/scripts/brain-normalize.cypher +530 -0
- package/scripts/brain-response-sanitize-hook.cjs +165 -0
- package/scripts/build-brain-census.cjs +957 -0
- package/scripts/build-brain-packet-schema.cjs +225 -0
- package/scripts/build-command-registry.cjs +587 -0
- package/scripts/build-connector-registry.cjs +1331 -0
- package/scripts/build-corpus-stats.cjs +408 -0
- package/scripts/build-dist-bundles.cjs +495 -0
- package/scripts/build-ecosystem-graph.cjs +490 -0
- package/scripts/build-graph +1462 -0
- package/scripts/build-graph-from-sqlite.cjs +97 -0
- package/scripts/build-harness-manifest.cjs +1090 -0
- package/scripts/build-jtbd-nudges +205 -0
- package/scripts/build-new-surface.cjs +805 -0
- package/scripts/build-orchestration-projection.cjs +1221 -0
- package/scripts/build-render-coverage.cjs +637 -0
- package/scripts/build-skill-mirrors.cjs +681 -0
- package/scripts/cache-hitrate-report.cjs +216 -0
- package/scripts/causal-to-graph.cjs +163 -0
- package/scripts/check-abstraction-fixture-neutral.cjs +160 -0
- package/scripts/check-admin-identity.cjs +212 -0
- package/scripts/check-brain-tool-liveness.cjs +502 -0
- package/scripts/check-card-fire.cjs +1809 -0
- package/scripts/check-cirs-declaration.cjs +279 -0
- package/scripts/check-deck-design.cjs +104 -0
- package/scripts/check-dual-graph-health.cjs +645 -0
- package/scripts/check-first-touch-drift.cjs +220 -0
- package/scripts/check-flagship-floor.cjs +391 -0
- package/scripts/check-framework-vocabulary-drift.cjs +563 -0
- package/scripts/check-gate-seam.cjs +178 -0
- package/scripts/check-graph-derive-health.cjs +208 -0
- package/scripts/check-graph-export-typemap.cjs +118 -0
- package/scripts/check-help-coverage.cjs +290 -0
- package/scripts/check-hitl-stages.cjs +219 -0
- package/scripts/check-hook-schema-compatibility.cjs +231 -0
- package/scripts/check-hsi-deps +42 -0
- package/scripts/check-kuzu-reintroduction.cjs +251 -0
- package/scripts/check-onboard +43 -0
- package/scripts/check-onboard-statusline.cjs +363 -0
- package/scripts/check-palette-consistency.cjs +106 -0
- package/scripts/check-pending-ambiguous.cjs +244 -0
- package/scripts/check-pending-breakthrough.cjs +189 -0
- package/scripts/check-pending-breakthrough.test.cjs +166 -0
- package/scripts/check-pending-naming-decision.cjs +97 -0
- package/scripts/check-plugin-path-anchoring.cjs +830 -0
- package/scripts/check-publish-needs.cjs +126 -0
- package/scripts/check-registry-drift.cjs +206 -0
- package/scripts/check-release-payload-ceiling.cjs +269 -0
- package/scripts/check-render-coverage.cjs +558 -0
- package/scripts/check-research-isomorphism.cjs +446 -0
- package/scripts/check-reward-before-investment.cjs +261 -0
- package/scripts/check-room-blueprints.cjs +213 -0
- package/scripts/check-schema-aliases.cjs +532 -0
- package/scripts/check-shape-declaration.cjs +958 -0
- package/scripts/check-shape-declaration.test.cjs +185 -0
- package/scripts/check-skill-spec.cjs +312 -0
- package/scripts/check-skill-vs-code-drift.cjs +178 -0
- package/scripts/check-substrate.cjs +513 -0
- package/scripts/check-tool-honesty.cjs +1601 -0
- package/scripts/check-update +60 -0
- package/scripts/check-version-and-sha.cjs +366 -0
- package/scripts/check-voice-style.cjs +184 -0
- package/scripts/check-worktree-hygiene.cjs +530 -0
- package/scripts/classify-insight +59 -0
- package/scripts/coherence-smoke-test.cjs +489 -0
- package/scripts/collect-cold-install-evidence.cjs +411 -0
- package/scripts/compute-bayesian-surprise.py +175 -0
- package/scripts/compute-blindspot-mass.py +209 -0
- package/scripts/compute-disruption-index.py +211 -0
- package/scripts/compute-element-novelty.py +254 -0
- package/scripts/compute-external-whitespace.py +563 -0
- package/scripts/compute-hsi.py +947 -0
- package/scripts/compute-meetings-intelligence +716 -0
- package/scripts/compute-opportunity-state +17 -0
- package/scripts/compute-state +393 -0
- package/scripts/compute-team +1112 -0
- package/scripts/compute-whitespace-embeddings.py +464 -0
- package/scripts/compute-whitespace-gaps.py +562 -0
- package/scripts/compute_topic_forest.py +684 -0
- package/scripts/consolidate-pinecone.py +265 -0
- package/scripts/context-monitor +943 -0
- package/scripts/create-speaker-profile +311 -0
- package/scripts/cross-room-detect.cjs +195 -0
- package/scripts/csv-to-idea-graph.cjs +755 -0
- package/scripts/ctxl-eval.cjs +846 -0
- package/scripts/curation-132-03-dedup-held-rename.cjs +395 -0
- package/scripts/curation-132-05-pseudonymize.cjs +189 -0
- package/scripts/derive-verb-reach-affinity.cjs +507 -0
- package/scripts/detect-reverse-salients.py +242 -0
- package/scripts/diagnostics-command.cjs +345 -0
- package/scripts/dial-memory-refresh-command.cjs +147 -0
- package/scripts/discover-analogy-whitespace.py +433 -0
- package/scripts/discover-hsi-whitespace.py +352 -0
- package/scripts/discover-rs-whitespace.py +327 -0
- package/scripts/discovery-cycle.cjs +625 -0
- package/scripts/disposition-render-v2.cjs +229 -0
- package/scripts/doctor-preflight-format.cjs +101 -0
- package/scripts/doctor.cjs +4327 -0
- package/scripts/dogfood-bridge/append-to-queue.sh +59 -0
- package/scripts/dogfood-bridge/path-filter.cjs +86 -0
- package/scripts/dogfood-derive.cjs +158 -0
- package/scripts/dogfood-emit.cjs +126 -0
- package/scripts/empathy-observation-emit.cjs +108 -0
- package/scripts/enrichment-queue-append.cjs +157 -0
- package/scripts/ensure-brain-baseline.cjs +117 -0
- package/scripts/entity-extract.cjs +1135 -0
- package/scripts/eureka-command.cjs +687 -0
- package/scripts/eureka-critic-run.cjs +662 -0
- package/scripts/eureka-portfolio-report.cjs +2038 -0
- package/scripts/eureka-room-report.cjs +419 -0
- package/scripts/explain-decision-command.cjs +499 -0
- package/scripts/export-pinecone-embeddings.cjs +516 -0
- package/scripts/extract-room-intelligence.cjs +714 -0
- package/scripts/fetch-brain-baseline.cjs +190 -0
- package/scripts/fetch-brain-baseline.py +360 -0
- package/scripts/feynman-minto-guardian.cjs +672 -0
- package/scripts/feynman-timeline-refresh-command.cjs +270 -0
- package/scripts/file-asset +253 -0
- package/scripts/fire-sensor-event.cjs +83 -0
- package/scripts/first-install-router.cjs +968 -0
- package/scripts/frontmatter-schema-validator.cjs +339 -0
- package/scripts/fts-index-drain.cjs +221 -0
- package/scripts/generate-chat-embed.cjs +179 -0
- package/scripts/generate-deck.cjs +322 -0
- package/scripts/generate-export.cjs +474 -0
- package/scripts/generate-hub.cjs +2553 -0
- package/scripts/generate-lobby.cjs +718 -0
- package/scripts/generate-presentation.cjs +988 -0
- package/scripts/generate-presentation.test.cjs +405 -0
- package/scripts/generate-section-intelligence.cjs +330 -0
- package/scripts/generate-snapshot.cjs +1410 -0
- package/scripts/generate-standalone +159 -0
- package/scripts/git-ops +211 -0
- package/scripts/graph-heal-pipeline.cjs +321 -0
- package/scripts/gsd-artifact-graph-hook.cjs +219 -0
- package/scripts/gsd-graph-derive-drain.cjs +571 -0
- package/scripts/gsd-graph-derive-sweep.cjs +195 -0
- package/scripts/heal-command.cjs +1365 -0
- package/scripts/hedge-refit-pipeline.cjs +207 -0
- package/scripts/help-renderer.cjs +303 -0
- package/scripts/hmi-compliance-poll.cjs +451 -0
- package/scripts/hmi-status-command.cjs +510 -0
- package/scripts/hooked-rescore-117.cjs +224 -0
- package/scripts/hooks/pre-commit +533 -0
- package/scripts/hooks/pre-commit-room-minto-guard.cmd +43 -0
- package/scripts/hooks/pre-commit-room-minto-guard.sh +533 -0
- package/scripts/hsi-to-graph.cjs +194 -0
- package/scripts/huji-batch.cjs +821 -0
- package/scripts/huji-eval.cjs +1158 -0
- package/scripts/huji-intake.cjs +563 -0
- package/scripts/huji-pin-smoketest.cjs +454 -0
- package/scripts/huji-run-one-async.cjs +305 -0
- package/scripts/huji-run-one.cjs +671 -0
- package/scripts/install-pre-commit.sh +113 -0
- package/scripts/intent-classifier +106 -0
- package/scripts/intent-classifier.cjs +3620 -0
- package/scripts/interpret-whitespace.cjs +691 -0
- package/scripts/jtbd-command.cjs +810 -0
- package/scripts/jtbd-update.cjs +299 -0
- package/scripts/label-topic-forest.cjs +667 -0
- package/scripts/learn-from-usage +168 -0
- package/scripts/lib/__pycache__/ensure_ml_deps.cpython-312.pyc +0 -0
- package/scripts/lib/ensure_ml_deps.py +97 -0
- package/scripts/load-embeddings-into-neo4j.cjs +569 -0
- package/scripts/memory-artifact-graph-hook.cjs +191 -0
- package/scripts/memory-command.cjs +687 -0
- package/scripts/memory-completion-detector.cjs +217 -0
- package/scripts/memory-lifecycle.cjs +620 -0
- package/scripts/memory-resume-nudge.cjs +233 -0
- package/scripts/methodology-ingest-local.sh +36 -0
- package/scripts/migrate-brain-mcp-from-http-to-stdio.cjs +190 -0
- package/scripts/migrate-brain-mcp-from-http-to-stdio.test.cjs +242 -0
- package/scripts/migrate-hats-to-roomdb.cjs +217 -0
- package/scripts/migrate-lazygraph.cjs +250 -0
- package/scripts/migrate-minto-schema-v88.cjs +296 -0
- package/scripts/migrate-plugin-root-refs.cjs +168 -0
- package/scripts/migrate-room-sections-v275.cjs +556 -0
- package/scripts/migrate-rooms +417 -0
- package/scripts/migrate-skill-frontmatter.cjs +472 -0
- package/scripts/migrate-stale-user-settings.cjs +296 -0
- package/scripts/migrate-telemetry-v1.cjs +384 -0
- package/scripts/migrate-telemetry-v1.test.cjs +356 -0
- package/scripts/minto-debouncer.cjs +428 -0
- package/scripts/mos-status.cjs +622 -0
- package/scripts/mva-detect.cjs +229 -0
- package/scripts/mva-run.cjs +36 -0
- package/scripts/on-agent-complete +163 -0
- package/scripts/on-cwd-changed +149 -0
- package/scripts/on-file-changed +68 -0
- package/scripts/on-stop +617 -0
- package/scripts/on-task-complete +194 -0
- package/scripts/operator-command.cjs +858 -0
- package/scripts/operator-update.cjs +308 -0
- package/scripts/part8-egress-guard-hook.cjs +229 -0
- package/scripts/pipeline-command.cjs +271 -0
- package/scripts/post-compact +383 -0
- package/scripts/post-update-activation.cjs +339 -0
- package/scripts/post-write +283 -0
- package/scripts/power-demo-prompt.md +621 -0
- package/scripts/pre-compact +273 -0
- package/scripts/preflight-auto-explore.cjs +314 -0
- package/scripts/preflight-doctor.cjs +225 -0
- package/scripts/preflight-release-drift.cjs +168 -0
- package/scripts/preflight-tension-surface.cjs +414 -0
- package/scripts/probe-brain-contract.cjs +502 -0
- package/scripts/publish-ops +346 -0
- package/scripts/query-efficiency-telemetry.cjs +364 -0
- package/scripts/query-semantic-scholar.cjs +545 -0
- package/scripts/reapply-modifications +49 -0
- package/scripts/reassign-primary.cjs +125 -0
- package/scripts/recompile-room-references.cjs +601 -0
- package/scripts/release-beta-preflight.sh +69 -0
- package/scripts/render-pdf +588 -0
- package/scripts/render-viz +190 -0
- package/scripts/research-speaker +239 -0
- package/scripts/resolve-room +204 -0
- package/scripts/restore-post-compact-context.cjs +320 -0
- package/scripts/room-auto-create-nudge.cjs +136 -0
- package/scripts/room-naming-selector.cjs +201 -0
- package/scripts/room-registry +767 -0
- package/scripts/rs-discovery-engine.cjs +725 -0
- package/scripts/rs-engine.py +2073 -0
- package/scripts/rs-experts-command.cjs +300 -0
- package/scripts/rs-explain-command.cjs +323 -0
- package/scripts/rs-fetch-command.cjs +170 -0
- package/scripts/rs-thesis-command.cjs +203 -0
- package/scripts/rs-vector-bridge.cjs +410 -0
- package/scripts/run-harness.cjs +890 -0
- package/scripts/scout-cadence-guard.cjs +323 -0
- package/scripts/scout-cadence-runner.cjs +509 -0
- package/scripts/scout-telemetry-aggregator.cjs +268 -0
- package/scripts/sealed-walker.py +96 -0
- package/scripts/seed-brain-commands.cjs +324 -0
- package/scripts/self-update +105 -0
- package/scripts/sentinel-deadline-monitor +241 -0
- package/scripts/sentinel-health-check +198 -0
- package/scripts/sentinel-snapshot +42 -0
- package/scripts/serve-dashboard +103 -0
- package/scripts/serve-dashboard-live +932 -0
- package/scripts/serve-presentation +97 -0
- package/scripts/serve-wiki +90 -0
- package/scripts/session-end-presence.cjs +79 -0
- package/scripts/session-start +1943 -0
- package/scripts/sessionstart-coordinator.cjs +249 -0
- package/scripts/sessionstart-npm-reconcile.cjs +111 -0
- package/scripts/sessionstart-post-update-preflight.cjs +303 -0
- package/scripts/sessionstart-reference-now-seed.cjs +137 -0
- package/scripts/setup-hooks.sh +112 -0
- package/scripts/skillopt-codereview.cjs +830 -0
- package/scripts/skillopt-eval.cjs +519 -0
- package/scripts/skillopt-funnel.cjs +1076 -0
- package/scripts/skillopt-genqueries.cjs +571 -0
- package/scripts/skillopt-inventory.cjs +319 -0
- package/scripts/skillopt-merge.cjs +656 -0
- package/scripts/skillopt-triggerloop.cjs +1126 -0
- package/scripts/soft-alias-runner.cjs +116 -0
- package/scripts/stamp-artifact-write.cjs +276 -0
- package/scripts/stamp-firing-block.cjs +325 -0
- package/scripts/state-write.cjs +97 -0
- package/scripts/statusline-fallback-echo.cjs +297 -0
- package/scripts/statusline-mos +116 -0
- package/scripts/statusline-mos-dispatch +127 -0
- package/scripts/suggest-next-command.cjs +416 -0
- package/scripts/sweep-skill-descriptions.cjs +263 -0
- package/scripts/sync-rooms-graph +264 -0
- package/scripts/telemetry-command-invocation.cjs +120 -0
- package/scripts/test-doctor-recovery.cjs +242 -0
- package/scripts/test-fresh-install.md +140 -0
- package/scripts/track-analytics +156 -0
- package/scripts/transcribe-audio +148 -0
- package/scripts/transcript-ingest.cjs +225 -0
- package/scripts/update-icm-index +153 -0
- package/scripts/v182-brain-optimize.cypher +1191 -0
- package/scripts/validate-model-profiles +93 -0
- package/scripts/vault-content-reformatter.cjs +581 -0
- package/scripts/vault-export-orchestrator.cjs +400 -0
- package/scripts/vault-footer-injector.cjs +315 -0
- package/scripts/vault-import.cjs +839 -0
- package/scripts/vault-integration-test.cjs +318 -0
- package/scripts/vault-regenerate-all.cjs +216 -0
- package/scripts/vault-regenerate-all.test.cjs +138 -0
- package/scripts/vault-rules-generator.cjs +220 -0
- package/scripts/vault-section-minto-generator.cjs +1642 -0
- package/scripts/vault-section-minto-generator.integration.test.cjs +576 -0
- package/scripts/vault-section-minto-generator.test.cjs +291 -0
- package/scripts/vault-section-state-generator.cjs +385 -0
- package/scripts/vault-welcome-generator.cjs +403 -0
- package/scripts/vault-wikilink-injector.cjs +449 -0
- package/scripts/verify-phase-132.cjs +338 -0
- package/scripts/verify-release +744 -0
- package/scripts/whitespace-command.cjs +831 -0
- package/scripts/whitespace-to-brain.cjs +384 -0
- package/scripts/whitespace-to-graph.cjs +220 -0
- package/scripts/wikilink-batch.cjs +102 -0
- package/scripts/wikilink-file.cjs +139 -0
- package/scripts/write-bridge-artifacts.cjs +140 -0
- package/scripts/write-scope-check +12 -0
- package/scripts/write-scope-check.cjs +461 -0
- package/scripts/write-whitespace-sections.cjs +483 -0
- package/settings.json +7 -0
- package/skills/act/SKILL.md +523 -0
- package/skills/admin/SKILL.md +437 -0
- package/skills/agentshield/SKILL.md +50 -0
- package/skills/analyze-needs/SKILL.md +74 -0
- package/skills/analyze-systems/SKILL.md +69 -0
- package/skills/analyze-timing/SKILL.md +94 -0
- package/skills/auto-explore/SKILL.md +84 -0
- package/skills/beautiful-question/SKILL.md +72 -0
- package/skills/bono/SKILL.md +146 -0
- package/skills/brain-connector/SKILL.md +206 -0
- package/skills/brain-derive/SKILL.md +140 -0
- package/skills/build-knowledge/SKILL.md +118 -0
- package/skills/build-thesis/SKILL.md +90 -0
- package/skills/causal/SKILL.md +265 -0
- package/skills/challenge-assumptions/SKILL.md +74 -0
- package/skills/client-discovery-interview/SKILL.md +94 -0
- package/skills/client-discovery-interview/discovery-scaffold.json +41 -0
- package/skills/client-discovery-interview/question-bank.md +149 -0
- package/skills/compare-ventures/SKILL.md +113 -0
- package/skills/context-engine/SKILL.md +169 -0
- package/skills/conversation-mode/SKILL.md +189 -0
- package/skills/correct-reference-now/SKILL.md +86 -0
- package/skills/dashboard/SKILL.md +142 -0
- package/skills/deck/SKILL.md +113 -0
- package/skills/deep-grade/SKILL.md +210 -0
- package/skills/diagnose/SKILL.md +128 -0
- package/skills/diagnostics/SKILL.md +193 -0
- package/skills/dial-memory-refresh/SKILL.md +116 -0
- package/skills/diffusion/SKILL.md +125 -0
- package/skills/discover/SKILL.md +216 -0
- package/skills/doctor/SKILL.md +269 -0
- package/skills/dogfood-flush/SKILL.md +133 -0
- package/skills/dominant-designs/SKILL.md +72 -0
- package/skills/eureka/SKILL.md +313 -0
- package/skills/explain-decision/SKILL.md +138 -0
- package/skills/explore-domains/SKILL.md +74 -0
- package/skills/explore-futures/SKILL.md +64 -0
- package/skills/explore-opportunity/SKILL.md +168 -0
- package/skills/explore-trends/SKILL.md +74 -0
- package/skills/export/SKILL.md +126 -0
- package/skills/feynman-timeline-refresh/SKILL.md +105 -0
- package/skills/file-meeting/SKILL.md +1190 -0
- package/skills/find-analogies/SKILL.md +360 -0
- package/skills/find-bottlenecks/SKILL.md +104 -0
- package/skills/find-connections/SKILL.md +108 -0
- package/skills/funding/SKILL.md +110 -0
- package/skills/futures/SKILL.md +124 -0
- package/skills/grade/SKILL.md +252 -0
- package/skills/grade-grant/SKILL.md +293 -0
- package/skills/graph/SKILL.md +216 -0
- package/skills/hat-briefing/SKILL.md +160 -0
- package/skills/heal/SKILL.md +69 -0
- package/skills/help/SKILL.md +172 -0
- package/skills/hmi-status/SKILL.md +73 -0
- package/skills/ignite/SKILL.md +225 -0
- package/skills/ingest-methodology/SKILL.md +125 -0
- package/skills/intel-pipeline/SKILL.md +128 -0
- package/skills/intelligence-orchestrator/SKILL.md +262 -0
- package/skills/jtbd/SKILL.md +261 -0
- package/skills/larry-personality/SKILL.md +571 -0
- package/skills/larry-personality/framework-chains.md +92 -0
- package/skills/larry-personality/mode-engine.md +185 -0
- package/skills/leadership/SKILL.md +109 -0
- package/skills/lean-canvas/SKILL.md +70 -0
- package/skills/macro-trends/SKILL.md +84 -0
- package/skills/map-unknowns/SKILL.md +72 -0
- package/skills/memory/SKILL.md +212 -0
- package/skills/memory-cortex-reach/SKILL.md +80 -0
- package/skills/models/SKILL.md +197 -0
- package/skills/mos/SKILL.md +160 -0
- package/skills/mos-deck-engine/SKILL.md +329 -0
- package/skills/mos-reason/SKILL.md +484 -0
- package/skills/mullins/SKILL.md +151 -0
- package/skills/mullins-scaffold/SKILL.md +132 -0
- package/skills/mullins-scaffold/scaffold.json +223 -0
- package/skills/mva-brief/SKILL.md +87 -0
- package/skills/mva-option/SKILL.md +120 -0
- package/skills/mva-pipeline/SKILL.md +158 -0
- package/skills/mva-report/SKILL.md +79 -0
- package/skills/new-project/SKILL.md +629 -0
- package/skills/new-surface/SKILL.md +112 -0
- package/skills/onboard/SKILL.md +485 -0
- package/skills/operator/SKILL.md +167 -0
- package/skills/opportunities/SKILL.md +171 -0
- package/skills/organize/SKILL.md +69 -0
- package/skills/persona/SKILL.md +272 -0
- package/skills/pipeline/SKILL.md +164 -0
- package/skills/present/SKILL.md +123 -0
- package/skills/publish/SKILL.md +224 -0
- package/skills/pws-brain/SKILL.md +152 -0
- package/skills/pws-methodology/SKILL.md +92 -0
- package/skills/qualify-opportunity/SKILL.md +111 -0
- package/skills/query/SKILL.md +68 -0
- package/skills/radar/SKILL.md +106 -0
- package/skills/reanalyze/SKILL.md +122 -0
- package/skills/research/SKILL.md +462 -0
- package/skills/room/SKILL.md +381 -0
- package/skills/room-passive/SKILL.md +174 -0
- package/skills/room-proactive/SKILL.md +344 -0
- package/skills/rooms/SKILL.md +678 -0
- package/skills/root-cause/SKILL.md +73 -0
- package/skills/rs-experts/SKILL.md +151 -0
- package/skills/rs-explain/SKILL.md +130 -0
- package/skills/rs-fetch/SKILL.md +115 -0
- package/skills/rs-thesis/SKILL.md +129 -0
- package/skills/scenario-plan/SKILL.md +76 -0
- package/skills/scheduled-tasks/SKILL.md +301 -0
- package/skills/score-innovation/SKILL.md +74 -0
- package/skills/scout/SKILL.md +370 -0
- package/skills/setup/SKILL.md +654 -0
- package/skills/show/SKILL.md +68 -0
- package/skills/skill/SKILL.md +104 -0
- package/skills/snapshot/SKILL.md +178 -0
- package/skills/speakers/SKILL.md +116 -0
- package/skills/splash/SKILL.md +54 -0
- package/skills/stance/SKILL.md +89 -0
- package/skills/status/SKILL.md +107 -0
- package/skills/structure-argument/SKILL.md +78 -0
- package/skills/suggest-next/SKILL.md +137 -0
- package/skills/systems-thinking/SKILL.md +220 -0
- package/skills/think-hats/SKILL.md +82 -0
- package/skills/trending-to-absurd/SKILL.md +100 -0
- package/skills/ui-system/SKILL.md +474 -0
- package/skills/ui-system/design-system/M-OS-DESIGN-SYSTEM.md +273 -0
- package/skills/ui-system/design-system/SPEC.md +72 -0
- package/skills/ui-system/design-system/image-prompt-style.md +29 -0
- package/skills/ui-system/design-system/mos-design-system.css +240 -0
- package/skills/ui-system/rules/design-system.md +60 -0
- package/skills/ui-system/rules/dual-palette.md +156 -0
- package/skills/ui-system/rules/glyph-disambiguation.md +171 -0
- package/skills/ui-system/rules/shape-f-zero-and-six.md +169 -0
- package/skills/update/SKILL.md +254 -0
- package/skills/user-needs/SKILL.md +73 -0
- package/skills/validate/SKILL.md +73 -0
- package/skills/value-proposition/SKILL.md +141 -0
- package/skills/vault/SKILL.md +326 -0
- package/skills/visualize/SKILL.md +69 -0
- package/skills/whitespace/SKILL.md +539 -0
- package/skills/wiki/SKILL.md +94 -0
- package/templates/_base.html +20 -0
- package/templates/chat-panel.html +205 -0
- package/templates/constellation-chat-hooks.js +89 -0
- package/templates/constellation.html +1272 -0
- package/templates/destijl-base.css +268 -0
- package/templates/discovery/discovery-brief-template.md +97 -0
- package/templates/due-diligence.html +49 -0
- package/templates/executive-summary.html +40 -0
- package/templates/icm/CLAUDE.md +31 -0
- package/templates/icm/GROUP-CLAUDE.md +33 -0
- package/templates/icm/INDEX.md +26 -0
- package/templates/import/stage-contracts/01-ingest.md +34 -0
- package/templates/import/stage-contracts/02-classify.md +48 -0
- package/templates/import/stage-contracts/03-route.md +42 -0
- package/templates/import/stage-contracts/04-enrich.md +40 -0
- package/templates/investment-thesis.html +25 -0
- package/templates/meeting-report.html +361 -0
- package/templates/presentation/dashboard.html +1150 -0
- package/templates/presentation/deck.html +540 -0
- package/templates/presentation/diagrams.html +437 -0
- package/templates/presentation/graph.html +391 -0
- package/templates/presentation/insights.html +548 -0
- package/templates/presentation/wiki.html +533 -0
- package/templates/profile.html +136 -0
- package/templates/room-context/last-session.md +56 -0
- package/templates/room-context/methodology-history.md +28 -0
- package/templates/room-context/rejection-log.md +25 -0
- package/templates/room-context/weekly-digest.md +54 -0
- package/templates/room-skeleton/MINTO.md.tmpl +19 -0
- package/templates/room-skeleton/ROOM.md.identity.tmpl +13 -0
- package/templates/room-skeleton/ROOM.md.section.tmpl +33 -0
- package/templates/room-skeleton/STATE.md.tmpl +33 -0
- package/templates/room-skeleton/USER.md.tmpl +23 -0
- package/templates/room-skeleton/references/.gitkeep +0 -0
- package/templates/room-skeleton/references/SECTION-SCHEMA.md +213 -0
- package/templates/room-skeleton/references/SUB-SCHEMAS.md +91 -0
- package/templates/room-skeleton/section-contracts/.gitkeep +0 -0
- package/templates/room-skeleton/section-contracts/business-model.md +32 -0
- package/templates/room-skeleton/section-contracts/competitive-analysis.md +33 -0
- package/templates/room-skeleton/section-contracts/financial-model.md +30 -0
- package/templates/room-skeleton/section-contracts/funding.md +41 -0
- package/templates/room-skeleton/section-contracts/legal-ip.md +30 -0
- package/templates/room-skeleton/section-contracts/market-analysis.md +32 -0
- package/templates/room-skeleton/section-contracts/opportunity-bank.md +39 -0
- package/templates/room-skeleton/section-contracts/problem-definition.md +32 -0
- package/templates/room-skeleton/section-contracts/solution-design.md +36 -0
- package/templates/room-skeleton/section-contracts/strategy.md +35 -0
- package/templates/room-skeleton/section-contracts/team-execution.md +36 -0
- package/templates/shared.css +427 -0
- package/templates/showcase/blueprint.html +432 -0
- package/templates/showcase/library.html +571 -0
- package/templates/showcase/narrative.html +361 -0
- package/templates/showcase/overview.html +468 -0
- package/templates/showcase/synthesis.html +473 -0
- package/templates/signature-footer.html +34 -0
|
@@ -0,0 +1,2115 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* MindrianOS MCP Hierarchical Tool Router
|
|
3
|
+
*
|
|
4
|
+
* Registers 9 high-level MCP tools that dispatch to all 64 CLI commands.
|
|
5
|
+
* Hierarchical design keeps total tool definition under 7000 tokens
|
|
6
|
+
* (vs 30-60K for flat 64-tool registration).
|
|
7
|
+
*
|
|
8
|
+
* Router tools:
|
|
9
|
+
* 1. room_state - room health, state, recommendations (5 commands)
|
|
10
|
+
* 2. room_content - projects, opportunities, funding, personas (15 commands)
|
|
11
|
+
* 3. room_graph - knowledge graph, Minto reasoning, visualization (13 commands)
|
|
12
|
+
* 4. methodology - PWS innovation frameworks (14 commands)
|
|
13
|
+
* 5. analysis - systems analysis and trend exploration (13 commands)
|
|
14
|
+
* 6. intelligence - connections, grading, research (7 commands)
|
|
15
|
+
* 7. meeting - meeting filing, pipeline, speakers (3 commands)
|
|
16
|
+
* 8. export - dashboards, wikis, presentations, snapshots (7 commands)
|
|
17
|
+
* 9. orchestration - autonomous execution, rooms, scout, admin (20 commands)
|
|
18
|
+
*
|
|
19
|
+
* Total: 64 unique CLI commands across 9 router tools (verified via ALL_TOOL_COMMANDS).
|
|
20
|
+
*
|
|
21
|
+
* Suggested Next: Every tool response includes a ## Suggested Next section
|
|
22
|
+
* with tool_name, args, and rationale for LLM-orchestrated pipeline chaining (MCP-05).
|
|
23
|
+
*
|
|
24
|
+
* Intelligence Cascade: Write-tools call runCascade after operations
|
|
25
|
+
* for surface parity between CLI hooks and MCP handlers.
|
|
26
|
+
*/
|
|
27
|
+
|
|
28
|
+
'use strict';
|
|
29
|
+
|
|
30
|
+
const path = require('path');
|
|
31
|
+
const { z } = require('zod');
|
|
32
|
+
const { safeReadFile } = require('../core/index.cjs');
|
|
33
|
+
const pipelineState = require('./pipeline-state.cjs');
|
|
34
|
+
// Phase 205-01 item 0b: the surface fence MUST hold on the MCP router surface
|
|
35
|
+
// (Desktop/Cowork), not only the CLI, or the fence leaks. The router runs every
|
|
36
|
+
// offered next-command through filterToNavigator at the suggest chokepoint.
|
|
37
|
+
const { filterToNavigator } = require('../core/surface-fence.cjs');
|
|
38
|
+
// Todo 2026-07-06-room-content-file-opportunity-misroutes-active-room: the MCP
|
|
39
|
+
// server resolves its write target ONCE at boot (bin/mindrian-mcp-server.cjs
|
|
40
|
+
// captures roomDir and freezes it into this router's closure via
|
|
41
|
+
// registerRouterTools). A mid-session `room-registry set-active X` never reaches
|
|
42
|
+
// the long-lived server, so room_content WRITES kept landing in the spawn-time
|
|
43
|
+
// room. Canon Part 7 (reuse before build): re-resolve per write call through the
|
|
44
|
+
// ONE canonical resolver instead of adding a 6th active-room guesser. Canon
|
|
45
|
+
// Part 8: the resolver reads LOCAL registry.json + env only, zero Brain
|
|
46
|
+
// egress. CLAUDE_ACTIVE_ROOM / MINDRIAN_ROOM still win (they are precedence leg 1
|
|
47
|
+
// inside resolveActiveRoom). The boot-time roomDir remains the miss-fallback.
|
|
48
|
+
//
|
|
49
|
+
// Phase 248-01 (CTX-01): resolveWriteTargetDir is now a thin delegate to
|
|
50
|
+
// lib/mcp/session-room.cjs, the ONE shared MCP resolver. It no longer reads
|
|
51
|
+
// MINDRIAN_MCP_FIRST at all -- a session's explicit room_bind is
|
|
52
|
+
// authoritative regardless of flag state (CTX-02); an unbound session still
|
|
53
|
+
// resolves byte-identically to legacy, since the resolver's own reg.active
|
|
54
|
+
// leg is the same demoted fallback resolveActiveRoom always was.
|
|
55
|
+
const { resolveEffectiveSessionId } = require('../core/session-binding.cjs');
|
|
56
|
+
const sessionRoom = require('./session-room.cjs');
|
|
57
|
+
// Phase 212-03: the portable Grounding Guard critic core (D4 thin-wrapper
|
|
58
|
+
// contract). criticRule is a PURE function of the D1 payload; requiring it here
|
|
59
|
+
// couples ONLY the disposable wrapper to this router, never the critic logic
|
|
60
|
+
// (SEED-014 lifts lib/core/eureka-critic.cjs unchanged). loadCriticTags supplies
|
|
61
|
+
// the closed domain-tag enum the eureka_critic zod schema is built from.
|
|
62
|
+
const eurekaCritic = require('../core/eureka-critic.cjs');
|
|
63
|
+
|
|
64
|
+
// Phase 212-03: eureka_critic wrapper state. Module-level (NOT per-registration)
|
|
65
|
+
// so dedupe + rate-limit persist across calls for the life of the process.
|
|
66
|
+
// Neither references a room closure (D5: pure function of the payload).
|
|
67
|
+
const _eurekaCriticDedupeCache = new Map(); // payloadHash -> { ruling, ts }
|
|
68
|
+
const _eurekaCriticRateWindow = []; // rolling-minute call timestamps
|
|
69
|
+
|
|
70
|
+
// Quick-260717-2vf (D-D): the eureka compute scan in-flight guard. Module-level
|
|
71
|
+
// (NOT per-registration) for the SAME reason _eurekaCriticDedupeCache is: under
|
|
72
|
+
// flag-ON the daemon mints a FRESH McpServer per session via createServer(), so a
|
|
73
|
+
// per-registration closure would NOT be shared across sessions -- module state is.
|
|
74
|
+
// A second eureka-run for a room already in flight returns already_running instead
|
|
75
|
+
// of double-running; the entry clears in .finally() when the in-process (http) scan
|
|
76
|
+
// settles. Maps roomDir -> { started_at }. The detached stdio path is not
|
|
77
|
+
// cross-process-tracked (today's CLI `start` does not guard either -- contract
|
|
78
|
+
// preserved).
|
|
79
|
+
//
|
|
80
|
+
// hitl_shape: none (D-H). RATIONALE mirrors eureka_critic's: the scan is compute
|
|
81
|
+
// plus a written report; it has no Decision-Gate fork of its own. The human gate on
|
|
82
|
+
// eureka verdicts is the navigator READING the report downstream, not a fork inside
|
|
83
|
+
// this tool. These subcommands are deliberately NOT in ALL_TOOL_COMMANDS (no CLI
|
|
84
|
+
// parity twin under these names -- the CLI twin is /mos:eureka through its own
|
|
85
|
+
// dispatcher, so the 65-pin parity array must never see them) and NOT in
|
|
86
|
+
// MCP_TOOL_CONNECTORS (they ride the already-registered `intelligence` tool, minting
|
|
87
|
+
// no new connector descriptor). Canon Part 8: ZERO network -- the scan is the same
|
|
88
|
+
// local compute the CLI runs, and the response carries only local file PATHS plus
|
|
89
|
+
// local report CONTENT to the local MCP client (the same trust boundary as CLI
|
|
90
|
+
// stdout; LOCAL -> BRAIN never happens, and this tool adds no wire eureka_critic
|
|
91
|
+
// does not already have).
|
|
92
|
+
const _eurekaScanInFlight = new Map(); // roomDir -> { started_at }
|
|
93
|
+
|
|
94
|
+
/**
|
|
95
|
+
* Re-resolve the live WRITE target per call, session-aware UNCONDITIONALLY as
|
|
96
|
+
* of Phase 248-01 (CTX-01/CTX-02) -- a thin delegate to
|
|
97
|
+
* lib/mcp/session-room.cjs, which now owns the MCP_FIRST_DEPRECATED_ACTIVE_WRITE
|
|
98
|
+
* stderr token (moved there, byte-identical, Task 2). Signature preserved
|
|
99
|
+
* exactly so every call site and the _test export survive unchanged.
|
|
100
|
+
*
|
|
101
|
+
* @param {string|undefined} sessionId - this connection's session id (undefined on stdio / unbound)
|
|
102
|
+
* @param {string} fallbackRoomDir - boot-time closure roomDir (miss-fallback)
|
|
103
|
+
* @param {string} [surface] - this process's detected surface name (still threaded through for logging context, no longer gates resolution)
|
|
104
|
+
* @returns {string} absolute directory the write should land in
|
|
105
|
+
*/
|
|
106
|
+
function resolveWriteTargetDir(sessionId, fallbackRoomDir, surface) {
|
|
107
|
+
return sessionRoom.resolveMcpSessionRoom({
|
|
108
|
+
sessionId: sessionId,
|
|
109
|
+
ctx: { fallbackRoomDir: fallbackRoomDir, surface: surface },
|
|
110
|
+
forWrite: true,
|
|
111
|
+
}).dir;
|
|
112
|
+
}
|
|
113
|
+
|
|
114
|
+
// ---------------------------------------------------------------------------
|
|
115
|
+
// 87-05: MCP input validation primitives (CASCADE-03 + CASCADE-05)
|
|
116
|
+
// ---------------------------------------------------------------------------
|
|
117
|
+
// Three coordinated guards protect the MCP tool surface:
|
|
118
|
+
// 1. SECTION_RE -- Zod regex whitelist for section parameters. No traversal
|
|
119
|
+
// tokens, no whitespace, no Unicode control codes, no caps.
|
|
120
|
+
// 2. safeResolveSection() -- path.resolve guard that rejects any input that
|
|
121
|
+
// escapes roomDir after resolution. Paired with SECTION_RE so a malformed
|
|
122
|
+
// section never reaches fs.readFile/writeFile.
|
|
123
|
+
// 3. opportunitySchema -- explicit Zod validation of the file-opportunity
|
|
124
|
+
// JSON payload (previously accepted raw).
|
|
125
|
+
//
|
|
126
|
+
// These primitives are exported via module.exports._test for unit tests in
|
|
127
|
+
// lib/memory/mcp-input-validation.test.cjs.
|
|
128
|
+
// ---------------------------------------------------------------------------
|
|
129
|
+
|
|
130
|
+
const SECTION_RE = /^[a-z0-9-]+$/;
|
|
131
|
+
const sectionOptional = z.string().regex(SECTION_RE, 'section must match [a-z0-9-]+').optional();
|
|
132
|
+
const sectionRequired = z.string().regex(SECTION_RE, 'section must match [a-z0-9-]+');
|
|
133
|
+
|
|
134
|
+
/**
|
|
135
|
+
* Resolve `section` relative to `roomDir` and refuse any path that escapes
|
|
136
|
+
* roomDir. Complements the SECTION_RE regex: even if a caller bypasses Zod
|
|
137
|
+
* (internal handler, test harness, future refactor), path traversal is still
|
|
138
|
+
* blocked at the I/O boundary.
|
|
139
|
+
*
|
|
140
|
+
* @param {string} roomDir - Absolute room directory path.
|
|
141
|
+
* @param {string|null|undefined} section - Section name.
|
|
142
|
+
* @returns {string} Resolved absolute path inside roomDir.
|
|
143
|
+
* @throws {Error} If resolved path escapes roomDir.
|
|
144
|
+
*/
|
|
145
|
+
function safeResolveSection(roomDir, section) {
|
|
146
|
+
const base = path.resolve(roomDir);
|
|
147
|
+
if (section === null || section === undefined || section === '') return base;
|
|
148
|
+
const resolved = path.resolve(base, section);
|
|
149
|
+
if (resolved !== base && !resolved.startsWith(base + path.sep)) {
|
|
150
|
+
throw new Error(`section path traversal rejected: ${section}`);
|
|
151
|
+
}
|
|
152
|
+
return resolved;
|
|
153
|
+
}
|
|
154
|
+
|
|
155
|
+
/**
|
|
156
|
+
* Zod schema for the file-opportunity payload. `passthrough()` preserves
|
|
157
|
+
* caller-supplied fields (source_url, opportunity_id, relevance_reasoning,
|
|
158
|
+
* etc.) that opportunity-ops.cjs reads dynamically.
|
|
159
|
+
*
|
|
160
|
+
* Aligned to the op it guards (fileOpportunity in opportunity-ops.cjs). That
|
|
161
|
+
* op treats `title` as OPTIONAL and derives the slug/frontmatter from
|
|
162
|
+
* `program || title`, so `title` here is optional too; a `.refine` requires at
|
|
163
|
+
* least one of title/program (matching the op's `program || title || 'unknown'`
|
|
164
|
+
* fallback intent while still rejecting a fully empty payload). Numeric fields
|
|
165
|
+
* use `z.coerce.number()` so stringified scores/amounts ("0.8", "50000") -- the
|
|
166
|
+
* shape LLM tool-callers routinely emit -- pass instead of being rejected as
|
|
167
|
+
* "Invalid opportunity payload" for a payload the op would file fine.
|
|
168
|
+
*/
|
|
169
|
+
const opportunitySchema = z.object({
|
|
170
|
+
title: z.string().min(1).max(500).optional(),
|
|
171
|
+
program: z.string().max(500).optional(),
|
|
172
|
+
funder: z.string().max(500).optional(),
|
|
173
|
+
source: z.string().max(200).optional(),
|
|
174
|
+
source_url: z.string().max(2000).optional(),
|
|
175
|
+
opportunity_id: z.string().max(200).optional(),
|
|
176
|
+
domain: z.string().max(200).optional(),
|
|
177
|
+
deadline: z.string().max(50).optional(),
|
|
178
|
+
amount: z.coerce.number().nonnegative().optional(),
|
|
179
|
+
amount_floor: z.coerce.number().nonnegative().optional(),
|
|
180
|
+
amount_ceiling: z.coerce.number().nonnegative().optional(),
|
|
181
|
+
relevance_score: z.coerce.number().min(0).max(1).optional(),
|
|
182
|
+
relevance_reasoning: z.string().max(5000).optional(),
|
|
183
|
+
confidence: z.coerce.number().min(0).max(1).optional(),
|
|
184
|
+
}).passthrough().refine(
|
|
185
|
+
(o) => Boolean(o.title || o.program),
|
|
186
|
+
{ message: 'title or program required' }
|
|
187
|
+
);
|
|
188
|
+
|
|
189
|
+
// ---------------------------------------------------------------------------
|
|
190
|
+
// Command groupings - authoritative mapping from 52-RESEARCH.md
|
|
191
|
+
// ---------------------------------------------------------------------------
|
|
192
|
+
|
|
193
|
+
// Router 1: room_state (5 commands)
|
|
194
|
+
const ROOM_STATE_COMMANDS = [
|
|
195
|
+
'status', 'analyze', 'compute-state', 'get-state', 'suggest-next'
|
|
196
|
+
];
|
|
197
|
+
|
|
198
|
+
// Router 2: room_content (15 commands)
|
|
199
|
+
//
|
|
200
|
+
// NOTE (organize-soft-alias-redirects-to-nonexistent-target, filed 2026-08-24):
|
|
201
|
+
// 'organize' USED to be advertised here, but the dispatcher switch below never
|
|
202
|
+
// had a matching case -- the schema promised a capability the server did not
|
|
203
|
+
// have, and any caller who trusted this enum got a raw "Unknown room_content
|
|
204
|
+
// command: organize" at call time instead of a validation-time rejection.
|
|
205
|
+
// Removed until a real handler exists (short-term patch per that RCA). If
|
|
206
|
+
// `/mos:rooms organize` (commands/rooms.md) ever gets a real tree/propose/
|
|
207
|
+
// view/move implementation, add 'organize' back here with a matching case in
|
|
208
|
+
// the switch below in the SAME change -- never one without the other again.
|
|
209
|
+
const ROOM_CONTENT_COMMANDS = [
|
|
210
|
+
'new-project', 'setup', 'update', 'help', 'detect-integrations',
|
|
211
|
+
'scan-opportunities', 'list-opportunities', 'file-opportunity',
|
|
212
|
+
'list-funding', 'create-funding', 'update-funding-stage',
|
|
213
|
+
'generate-personas', 'list-personas', 'invoke-persona', 'analyze-perspectives'
|
|
214
|
+
];
|
|
215
|
+
|
|
216
|
+
// Router 3: room_graph (13 commands)
|
|
217
|
+
const ROOM_GRAPH_COMMANDS = [
|
|
218
|
+
'graph-index', 'graph-rebuild', 'graph-query', 'graph-stats',
|
|
219
|
+
'reasoning-get', 'reasoning-generate', 'reasoning-verify',
|
|
220
|
+
'reasoning-run', 'reasoning-list', 'reasoning-frontmatter',
|
|
221
|
+
'visualize-room', 'visualize-graph', 'visualize-chain'
|
|
222
|
+
];
|
|
223
|
+
|
|
224
|
+
// Router 4: methodology (14 commands)
|
|
225
|
+
const METHODOLOGY_COMMANDS = [
|
|
226
|
+
'lean-canvas', 'think-hats', 'structure-argument', 'beautiful-question',
|
|
227
|
+
'build-knowledge', 'challenge-assumptions', 'validate', 'map-unknowns',
|
|
228
|
+
'diagnose', 'score-innovation', 'explore-domains', 'analyze-needs',
|
|
229
|
+
'user-needs', 'find-analogies'
|
|
230
|
+
];
|
|
231
|
+
|
|
232
|
+
// Router 5: analysis (13 commands)
|
|
233
|
+
const ANALYSIS_COMMANDS = [
|
|
234
|
+
'analyze-systems', 'analyze-timing', 'find-bottlenecks', 'root-cause',
|
|
235
|
+
'systems-thinking', 'macro-trends', 'explore-trends', 'explore-futures',
|
|
236
|
+
'dominant-designs', 'scenario-plan',
|
|
237
|
+
'causal-extract', 'causal-trace', 'causal-predict'
|
|
238
|
+
];
|
|
239
|
+
|
|
240
|
+
// Router 6: intelligence (8 commands)
|
|
241
|
+
const INTELLIGENCE_COMMANDS = [
|
|
242
|
+
'find-connections', 'build-thesis', 'compare-ventures', 'research',
|
|
243
|
+
'deep-grade', 'grade', 'leadership', 'whitespace'
|
|
244
|
+
];
|
|
245
|
+
|
|
246
|
+
// Quick-260717-2vf (D-A): the three eureka portfolio-scan compute subcommands.
|
|
247
|
+
// They register on the `intelligence` router tool's z.enum ONLY -- kept OUT of
|
|
248
|
+
// both INTELLIGENCE_COMMANDS and ALL_TOOL_COMMANDS on purpose: INTELLIGENCE_COMMANDS
|
|
249
|
+
// is spread into ALL_TOOL_COMMANDS, and tests/test-205-surface-fence.cjs pins that
|
|
250
|
+
// array's unique membership at exactly 65 (the CLI<->MCP parity guard for the 64
|
|
251
|
+
// routed CLI commands). eureka-run/status/report have NO CLI command twin under
|
|
252
|
+
// these names (the CLI twin is /mos:eureka via scripts/eureka-command.cjs's own
|
|
253
|
+
// dispatcher), so they are the exact eureka_critic precedent: registered on a router
|
|
254
|
+
// enum, never touching the parity array.
|
|
255
|
+
const EUREKA_COMPUTE_COMMANDS = ['eureka-run', 'eureka-status', 'eureka-report'];
|
|
256
|
+
|
|
257
|
+
// Quick-260717-2vf (D-E): the stable eureka path contract, taken verbatim (not
|
|
258
|
+
// re-derived through a new door) from scripts/eureka-command.cjs's own header
|
|
259
|
+
// ("Path contract: everything this command writes lives under here"). status.json
|
|
260
|
+
// and the report md+json all live under <room>/.mindrian/eureka/. eureka-status and
|
|
261
|
+
// eureka-report read these files DIRECTLY rather than calling cmdStatus/cmdReport,
|
|
262
|
+
// because those two write to process.stdout -- which is the JSON-RPC framing channel
|
|
263
|
+
// on a stdio transport (a foreign write would corrupt the MCP session).
|
|
264
|
+
function eurekaPaths(dir) {
|
|
265
|
+
const base = path.join(dir, '.mindrian', 'eureka');
|
|
266
|
+
return {
|
|
267
|
+
base: base,
|
|
268
|
+
status: path.join(base, 'status.json'),
|
|
269
|
+
md: path.join(base, 'portfolio-report.md'),
|
|
270
|
+
json: path.join(base, 'portfolio-report.json'),
|
|
271
|
+
};
|
|
272
|
+
}
|
|
273
|
+
|
|
274
|
+
// Router 7: meeting (3 commands)
|
|
275
|
+
const MEETING_COMMANDS = [
|
|
276
|
+
'file-meeting', 'pipeline', 'speakers'
|
|
277
|
+
];
|
|
278
|
+
|
|
279
|
+
// Router 8: export (7 commands)
|
|
280
|
+
const EXPORT_COMMANDS = [
|
|
281
|
+
'export', 'radar', 'dashboard', 'wiki', 'present', 'publish', 'snapshot'
|
|
282
|
+
];
|
|
283
|
+
|
|
284
|
+
// Router 9: orchestration (22 commands)
|
|
285
|
+
const ORCHESTRATION_COMMANDS = [
|
|
286
|
+
'act', 'act-chain', 'act-swarm', 'act-dry-run',
|
|
287
|
+
'rooms-list', 'rooms-new', 'rooms-open', 'rooms-close', 'rooms-archive', 'rooms-where',
|
|
288
|
+
'scout', 'scout-health', 'scout-deadlines', 'scout-competitors', 'scout-hsi', 'scout-snapshot',
|
|
289
|
+
'reanalyze', 'onboard', 'models', 'admin',
|
|
290
|
+
'hat-briefing', 'scheduled-tasks'
|
|
291
|
+
];
|
|
292
|
+
|
|
293
|
+
// RCA rooms-open-false-success (2026-07-27), structural half.
|
|
294
|
+
//
|
|
295
|
+
// 18 of the 22 orchestration commands above have no handler; they fall through
|
|
296
|
+
// to the generic reference-echo fallback at the bottom of the orchestration
|
|
297
|
+
// tool, which returns the command's markdown instruction sheet wrapped in a
|
|
298
|
+
// payload that used to end with "Room operation complete - check status". For a
|
|
299
|
+
// command that MUTATES STATE, that is a false success: it asserts a completed
|
|
300
|
+
// operation that was never attempted. That is exactly how rooms-open reported a
|
|
301
|
+
// verified-looking room switch while `room-registry get-active` still returned
|
|
302
|
+
// the previous room.
|
|
303
|
+
//
|
|
304
|
+
// rooms-open is now implemented and executes (see its branch below). rooms-new,
|
|
305
|
+
// rooms-close and rooms-archive remain unimplemented BY DESIGN in this RCA's
|
|
306
|
+
// scope -- rooms-new has its own separate open RCA with a different root cause
|
|
307
|
+
// (.planning/debug/intern-w1-rooms-new-silent-fail.md), and implementing it
|
|
308
|
+
// here would collide with that session. What changes is that they can no longer
|
|
309
|
+
// claim to have done something. They get an explicit NOT EXECUTED banner and a
|
|
310
|
+
// Suggested Next rationale that does not assert completion.
|
|
311
|
+
//
|
|
312
|
+
// Membership rule, corrected (quick 260903, F-1): a command belongs here if
|
|
313
|
+
// ITS DESCRIPTION CLAIMS a write or state change the handler does not perform,
|
|
314
|
+
// not, as the original rule read, "mutates persistent state AND has no
|
|
315
|
+
// executing branch." That original test silently exempted a family that
|
|
316
|
+
// mutates nothing but was still falsely DESCRIBED as an ordinary write (the
|
|
317
|
+
// scout family: orchestration's description used to say "the room and scout
|
|
318
|
+
// operations are ordinary reads and writes, so use them freely"), so the
|
|
319
|
+
// false-claim disease slipped through on a technicality. The honest test asks
|
|
320
|
+
// what the description PROMISES, not what the handler TOUCHES. rooms-list and
|
|
321
|
+
// rooms-where correctly stay out: their descriptions make no persistence
|
|
322
|
+
// claim, so returning documentation instead of data is a genuine capability
|
|
323
|
+
// gap, not a false claim about a state change. This set is also reused by the
|
|
324
|
+
// room_content tool's own reference-echo group (new-project, setup, update),
|
|
325
|
+
// which shares the identical false-completion shape under a different
|
|
326
|
+
// description; command names never collide across tools, so one Set safely
|
|
327
|
+
// gates both.
|
|
328
|
+
const UNIMPLEMENTED_MUTATING_ORCHESTRATION = new Set([
|
|
329
|
+
'rooms-new', 'rooms-close', 'rooms-archive',
|
|
330
|
+
'scout', 'scout-health', 'scout-deadlines', 'scout-competitors', 'scout-hsi', 'scout-snapshot',
|
|
331
|
+
// room_content's F-11..F-14 echo group (Task 3 of 276-08): new-project,
|
|
332
|
+
// setup and update fall through to the identical reference-echo shape
|
|
333
|
+
// (loadReference + loadRoomState + a fireCascade call that RESEARCH
|
|
334
|
+
// assumption A6 measured never reaches a leaf write). help stays out: its
|
|
335
|
+
// description makes no write claim, so returning documentation is its
|
|
336
|
+
// whole job, matching the rooms-list/rooms-where reasoning above.
|
|
337
|
+
'new-project', 'setup', 'update'
|
|
338
|
+
]);
|
|
339
|
+
|
|
340
|
+
/**
|
|
341
|
+
* Flat array of all 64 CLI command names for parity checking.
|
|
342
|
+
* Maps 1:1 to the 66 .md files in commands/ minus splash (banner-only)
|
|
343
|
+
* and funding (covered by room_content sub-commands) = 64 routed commands.
|
|
344
|
+
*
|
|
345
|
+
* CLI command names are used (not router sub-command names) for parity validation.
|
|
346
|
+
* Some CLI commands map to multiple router sub-commands (e.g., "room" -> status/analyze/etc).
|
|
347
|
+
*/
|
|
348
|
+
const ALL_TOOL_COMMANDS = [
|
|
349
|
+
// room_state (CLI names)
|
|
350
|
+
'status', 'room', 'suggest-next',
|
|
351
|
+
// room_content (CLI names)
|
|
352
|
+
'new-project', 'setup', 'update', 'help',
|
|
353
|
+
'opportunities', 'persona',
|
|
354
|
+
// room_graph (CLI names)
|
|
355
|
+
'graph', 'query', 'reason', 'visualize',
|
|
356
|
+
// methodology
|
|
357
|
+
...METHODOLOGY_COMMANDS,
|
|
358
|
+
// analysis - CLI names for causal subcommands
|
|
359
|
+
'analyze-systems', 'analyze-timing', 'find-bottlenecks', 'root-cause',
|
|
360
|
+
'systems-thinking', 'macro-trends', 'explore-trends', 'explore-futures',
|
|
361
|
+
'dominant-designs', 'scenario-plan', 'causal',
|
|
362
|
+
// intelligence
|
|
363
|
+
...INTELLIGENCE_COMMANDS,
|
|
364
|
+
// meeting - CLI names
|
|
365
|
+
'file-meeting', 'pipeline', 'speakers',
|
|
366
|
+
// export - CLI names
|
|
367
|
+
'export', 'radar', 'dashboard', 'wiki', 'present', 'publish', 'snapshot',
|
|
368
|
+
// orchestration - CLI names
|
|
369
|
+
'act', 'rooms', 'scout', 'reanalyze', 'onboard', 'models', 'admin',
|
|
370
|
+
'hat-briefing', 'scheduled-tasks'
|
|
371
|
+
];
|
|
372
|
+
|
|
373
|
+
// Write-tools that trigger intelligence cascade after operations
|
|
374
|
+
const WRITE_TOOLS = new Set([
|
|
375
|
+
'file-opportunity', 'create-funding', 'update-funding-stage',
|
|
376
|
+
'generate-personas', 'invoke-persona', 'new-project', 'setup', 'update',
|
|
377
|
+
'graph-index', 'graph-rebuild', 'reasoning-generate',
|
|
378
|
+
'file-meeting'
|
|
379
|
+
]);
|
|
380
|
+
|
|
381
|
+
// ---------------------------------------------------------------------------
|
|
382
|
+
// Helpers
|
|
383
|
+
// ---------------------------------------------------------------------------
|
|
384
|
+
|
|
385
|
+
/**
|
|
386
|
+
* Build a text response in MCP tool format.
|
|
387
|
+
* @param {string} text - Response text
|
|
388
|
+
* @param {boolean} [isError=false] - Whether this is an error response
|
|
389
|
+
*/
|
|
390
|
+
function textResponse(text, isError) {
|
|
391
|
+
const result = { content: [{ type: 'text', text }] };
|
|
392
|
+
if (isError) result.isError = true;
|
|
393
|
+
return result;
|
|
394
|
+
}
|
|
395
|
+
|
|
396
|
+
/**
|
|
397
|
+
* Quick 260903-kwl. Per `.planning/debug/meeting-file-meeting-false-success.md`,
|
|
398
|
+
* a model reading an ok-shaped tool response has no other way to tell a
|
|
399
|
+
* scaffolding tool (reference-only, writes nothing) apart from a write tool;
|
|
400
|
+
* false confidence in a completed write is worse than a visible gap, so every
|
|
401
|
+
* reference-only meeting branch leads with this exact, machine-checkable marker.
|
|
402
|
+
*/
|
|
403
|
+
const NO_WRITE_MARKER = '**filed: false**';
|
|
404
|
+
|
|
405
|
+
/**
|
|
406
|
+
* Build the leading no-write banner every meeting branch uses, so the
|
|
407
|
+
* NO_WRITE_MARKER literal appears exactly once in this file.
|
|
408
|
+
* @param {string} realPathSentence - names the real write path for this branch
|
|
409
|
+
* @returns {string} e.g. "**filed: false** Nothing was written; call artifact_file to file this content."
|
|
410
|
+
*/
|
|
411
|
+
function noWriteBanner(realPathSentence) {
|
|
412
|
+
return `${NO_WRITE_MARKER} ${realPathSentence}`;
|
|
413
|
+
}
|
|
414
|
+
|
|
415
|
+
/**
|
|
416
|
+
* Format a Suggested Next section for pipeline chaining (MCP-05).
|
|
417
|
+
* @param {string} tool - MCP tool name (e.g., 'room_state')
|
|
418
|
+
* @param {Object} args - Tool arguments
|
|
419
|
+
* @param {string} rationale - Why this is the logical next step
|
|
420
|
+
* @returns {string} Formatted markdown section
|
|
421
|
+
*/
|
|
422
|
+
function formatSuggestedNext(tool, args, rationale) {
|
|
423
|
+
// Phase 205-01 item 0b: enforce the surface fence on the MCP surface. The
|
|
424
|
+
// command being offered as the next move must be a navigator surface; a
|
|
425
|
+
// plumbing (surface:internal) command is never surfaced to Desktop/Cowork.
|
|
426
|
+
// filterToNavigator is the single-source-of-truth chokepoint (never re-derived
|
|
427
|
+
// recall). A suppressed suggestion emits nothing rather than a plumbing move.
|
|
428
|
+
const offered = args && args.command;
|
|
429
|
+
if (offered && filterToNavigator([offered]).length === 0) {
|
|
430
|
+
return '';
|
|
431
|
+
}
|
|
432
|
+
return `\n\n## Suggested Next\n\n**Tool:** \`${tool}\`\n**Args:** \`${JSON.stringify(args)}\`\n**Rationale:** ${rationale}`;
|
|
433
|
+
}
|
|
434
|
+
|
|
435
|
+
// Grouped orchestration sub-commands (rooms-new, scout-health, act-chain, ...)
|
|
436
|
+
// fall back to their command FAMILY base file. Closed map by design: dozens of
|
|
437
|
+
// unrelated commands contain hyphens (find-bottlenecks, act-on-insight class
|
|
438
|
+
// names, ...), so a generic split-on-hyphen would make unknown commands
|
|
439
|
+
// accidentally resolve and violate the null contract.
|
|
440
|
+
const GROUPED_PREFIX_FALLBACK = {
|
|
441
|
+
'rooms-': 'rooms',
|
|
442
|
+
'scout-': 'scout',
|
|
443
|
+
'act-': 'act',
|
|
444
|
+
};
|
|
445
|
+
|
|
446
|
+
/**
|
|
447
|
+
* Load a methodology/command reference file from references/methodology/.
|
|
448
|
+
* Falls back to the command's CLI reference in commands/, then to the
|
|
449
|
+
* command FAMILY base file for grouped sub-commands. Router 9 registers
|
|
450
|
+
* grouped sub-commands but instruction files ship per command FAMILY; the
|
|
451
|
+
* reference IS the instruction set, so a miss is a silent no-op.
|
|
452
|
+
*/
|
|
453
|
+
function loadReference(pluginRoot, command) {
|
|
454
|
+
// Try methodology references first
|
|
455
|
+
const methodRef = safeReadFile(path.join(pluginRoot, 'references', 'methodology', `${command}.md`));
|
|
456
|
+
if (methodRef) return methodRef;
|
|
457
|
+
|
|
458
|
+
// Fall back to CLI command reference
|
|
459
|
+
const cmdRef = safeReadFile(path.join(pluginRoot, 'commands', `${command}.md`));
|
|
460
|
+
if (cmdRef) return cmdRef;
|
|
461
|
+
|
|
462
|
+
// Grouped-prefix fallback: exact-name lookups stay first so a future
|
|
463
|
+
// per-subcommand file (e.g. commands/rooms-new.md) wins automatically.
|
|
464
|
+
for (const [prefix, base] of Object.entries(GROUPED_PREFIX_FALLBACK)) {
|
|
465
|
+
if (command.startsWith(prefix)) {
|
|
466
|
+
const familyRef = safeReadFile(path.join(pluginRoot, 'commands', `${base}.md`));
|
|
467
|
+
if (familyRef) return familyRef;
|
|
468
|
+
}
|
|
469
|
+
}
|
|
470
|
+
|
|
471
|
+
return null;
|
|
472
|
+
}
|
|
473
|
+
|
|
474
|
+
/**
|
|
475
|
+
* Load current room state (STATE.md contents). Returns empty string if unavailable.
|
|
476
|
+
*/
|
|
477
|
+
function loadRoomState(roomDir) {
|
|
478
|
+
const stateOps = require('../core/state-ops.cjs');
|
|
479
|
+
try {
|
|
480
|
+
return stateOps.getState(roomDir) || '';
|
|
481
|
+
} catch (_e) {
|
|
482
|
+
return '';
|
|
483
|
+
}
|
|
484
|
+
}
|
|
485
|
+
|
|
486
|
+
/**
|
|
487
|
+
* Build combined context: reference + room state + user focus.
|
|
488
|
+
*/
|
|
489
|
+
function buildContext(pluginRoot, roomDir, command, userContext) {
|
|
490
|
+
const ref = loadReference(pluginRoot, command);
|
|
491
|
+
const state = loadRoomState(roomDir);
|
|
492
|
+
|
|
493
|
+
const parts = [`## Command: ${command}`];
|
|
494
|
+
if (state) parts.push(`\n### Room State\n${state}`);
|
|
495
|
+
if (ref) parts.push(`\n### Reference\n${ref}`);
|
|
496
|
+
if (userContext) parts.push(`\n### Focus\n${userContext}`);
|
|
497
|
+
if (!ref) parts.push(`\n> Note: No reference file found for "${command}". Available commands in this group will still work.`);
|
|
498
|
+
|
|
499
|
+
return parts.join('\n');
|
|
500
|
+
}
|
|
501
|
+
|
|
502
|
+
/**
|
|
503
|
+
* Run the Stage 1-4 research pipeline (context extraction + web fetch) for
|
|
504
|
+
* the intelligence tool's `research` command.
|
|
505
|
+
*
|
|
506
|
+
* intern-w1-research-reach-broken: this command used to fall through to
|
|
507
|
+
* buildContext(), which only reads commands/research.md off disk and echoes
|
|
508
|
+
* it back - zero fetch, for any input. This wires the two modules
|
|
509
|
+
* commands/research.md itself documents as the MCP execution layer:
|
|
510
|
+
* Stage 1+2+3 research-context-extractor.cjs::extractContext()
|
|
511
|
+
* Stage 4 lib/lens-engine/source-lens-driver.cjs::runSourceLens()
|
|
512
|
+
*
|
|
513
|
+
* Stage 5 (presentation) is this function's return value. Stage 6 (F.1
|
|
514
|
+
* filing selector) and Stage 7 (findings-wirer) are NOT run here: filing a
|
|
515
|
+
* finding is a human decision (commands/research.md hitl_shape: F.8,
|
|
516
|
+
* plan_gated: true; Canon Part 9 role 5 - Larry proposes, the human
|
|
517
|
+
* decides), and a single synchronous MCP tool call has no channel to collect
|
|
518
|
+
* that decision. The response names the filing step as the next move instead
|
|
519
|
+
* of auto-wiring it.
|
|
520
|
+
*
|
|
521
|
+
* @param {string} roomDir - Active room directory
|
|
522
|
+
* @param {string} topic - The research question/topic
|
|
523
|
+
* @param {Object} [opts] - Optional overrides
|
|
524
|
+
* @param {Function} [opts._fetchCorpus] - Test seam forwarded to
|
|
525
|
+
* runSourceLens (mirrors the seam tests/test-131-source-lens-driver.cjs
|
|
526
|
+
* already uses) so this can be tested hermetically, no live network.
|
|
527
|
+
* @returns {Promise<string>} Formatted findings response
|
|
528
|
+
*/
|
|
529
|
+
async function runResearchPipeline(roomDir, topic, opts) {
|
|
530
|
+
const { extractContext } = require('../core/research-context-extractor.cjs');
|
|
531
|
+
const { runSourceLens } = require('../lens-engine/source-lens-driver.cjs');
|
|
532
|
+
// lib/mcp/tool-router.cjs is NOT on the room-db.cjs substrate allow-list
|
|
533
|
+
// (scripts/check-substrate.cjs), so it must never require room-db.cjs
|
|
534
|
+
// directly. navigation.cjs already re-exports the exact caller-owned-handle
|
|
535
|
+
// door built for this (Phase 135-01, the same pattern scripts/intent-
|
|
536
|
+
// classifier.cjs uses): openRoomDbForCaller returns null on a cold room
|
|
537
|
+
// instead of throwing or creating room.db as a read-only research call's
|
|
538
|
+
// side effect.
|
|
539
|
+
const navigation = require('../core/navigation.cjs');
|
|
540
|
+
const db = navigation.openRoomDbForCaller(roomDir);
|
|
541
|
+
const options = (opts && typeof opts === 'object') ? opts : {};
|
|
542
|
+
|
|
543
|
+
try {
|
|
544
|
+
// Same research pipe contract as lib/core/intel-pipeline.cjs defaultResearchFn
|
|
545
|
+
// (the second caller of extractContext + runSourceLens); change together.
|
|
546
|
+
const extracted = extractContext({ roomDir, topic, db });
|
|
547
|
+
let driverResult;
|
|
548
|
+
try {
|
|
549
|
+
driverResult = await runSourceLens({
|
|
550
|
+
roomDir,
|
|
551
|
+
topic,
|
|
552
|
+
lensSet: extracted.lens_set,
|
|
553
|
+
preflight: extracted.preflight,
|
|
554
|
+
stage: 'explore',
|
|
555
|
+
_fetchCorpus: options._fetchCorpus,
|
|
556
|
+
db,
|
|
557
|
+
});
|
|
558
|
+
} catch (_e) {
|
|
559
|
+
driverResult = { ok: false, reason: 'driver_threw' };
|
|
560
|
+
}
|
|
561
|
+
|
|
562
|
+
const parts = ['## research'];
|
|
563
|
+
if (extracted.context_summary) parts.push(`\n### Context\n${extracted.context_summary}`);
|
|
564
|
+
|
|
565
|
+
if (!driverResult || driverResult.ok === false) {
|
|
566
|
+
parts.push(`\n### Findings\nNo findings retrieved (${(driverResult && driverResult.reason) || 'fetch unavailable'}). Try again or give a more specific topic.`);
|
|
567
|
+
return parts.join('\n');
|
|
568
|
+
}
|
|
569
|
+
|
|
570
|
+
const findings = Array.isArray(driverResult.findings) ? driverResult.findings : [];
|
|
571
|
+
if (findings.length === 0) {
|
|
572
|
+
parts.push('\n### Findings\nNo findings cleared the evidence-tier threshold for this stage.');
|
|
573
|
+
} else {
|
|
574
|
+
parts.push('\n### Findings');
|
|
575
|
+
findings.forEach((f, i) => {
|
|
576
|
+
const title = f.title || '(untitled)';
|
|
577
|
+
const tier = f.evidence_tier || 'unknown-tier';
|
|
578
|
+
const summary = f.summary || '';
|
|
579
|
+
const source = f.source || 'unknown';
|
|
580
|
+
const url = f.url || 'no url';
|
|
581
|
+
const retrievedAt = f.retrieved_at || 'unknown';
|
|
582
|
+
parts.push(`\n${i + 1}. **${title}** [${tier}]\n ${summary}\n Source: ${source} - ${url} (retrieved ${retrievedAt})`);
|
|
583
|
+
});
|
|
584
|
+
parts.push('\n### Filing decision needed\nEach finding above needs a human filing decision (file to a section, defer, or reject) before it becomes room graph data - this pipeline surfaces findings, it does not auto-file them.');
|
|
585
|
+
}
|
|
586
|
+
|
|
587
|
+
return parts.join('\n');
|
|
588
|
+
} finally {
|
|
589
|
+
navigation.closeRoomDbForCaller(db);
|
|
590
|
+
}
|
|
591
|
+
}
|
|
592
|
+
|
|
593
|
+
/**
|
|
594
|
+
* Fire intelligence cascade after a write operation.
|
|
595
|
+
* Non-blocking - failures never break the tool response.
|
|
596
|
+
* @param {string} roomDir
|
|
597
|
+
* @param {string} command - The command that triggered the write
|
|
598
|
+
* @param {string} [section] - Section context
|
|
599
|
+
* @param {Object} [result] - Result from the write operation (may contain filePath)
|
|
600
|
+
*/
|
|
601
|
+
async function fireCascade(roomDir, command, section, result) {
|
|
602
|
+
try {
|
|
603
|
+
const { runCascade } = require('../core/intelligence-cascade.cjs');
|
|
604
|
+
const filePath = (result && result.filePath) || '';
|
|
605
|
+
await runCascade(roomDir, { trigger: 'mcp-tool', filePath, section: section || '' });
|
|
606
|
+
} catch (_e) {
|
|
607
|
+
// Cascade failures must never break tool responses
|
|
608
|
+
}
|
|
609
|
+
}
|
|
610
|
+
|
|
611
|
+
/**
|
|
612
|
+
* Phase 232.1 / D-07: the single-room density line folded into room_state.
|
|
613
|
+
*
|
|
614
|
+
* WHY THIS DOOR. Same in-file precedent as runResearchPipeline above:
|
|
615
|
+
* lib/mcp/tool-router.cjs is NOT on the room-db.cjs substrate allow-list
|
|
616
|
+
* (scripts/check-substrate.cjs), so it must never require room-db.cjs or
|
|
617
|
+
* node:sqlite directly; navigation.cjs already re-exports the door. But this
|
|
618
|
+
* function reaches for the READ-ONLY sibling door Plan 232.1-01 built
|
|
619
|
+
* (openRoomDbReadOnlyForCaller), NEVER openRoomDbForCaller. The reason is
|
|
620
|
+
* D-04's central finding: openRoomDbForCaller delegates to room-db.cjs's
|
|
621
|
+
* openRoomDb, which mkdirSync's, runs 13 CREATE TABLE IF NOT EXISTS statements
|
|
622
|
+
* and 5 migrations on EVERY open. A status line must never be able to trigger
|
|
623
|
+
* a schema migration as a side effect of merely being READ (T-232.1-06).
|
|
624
|
+
*
|
|
625
|
+
* WHY activeRoomDir. The caller MUST pass the per-call-resolved activeRoomDir
|
|
626
|
+
* (resolveWriteTargetDir's return value), never registerRouterTools' frozen
|
|
627
|
+
* boot-time roomDir closure. Reading the wrong variable is the documented root
|
|
628
|
+
* cause of the intern-w1-room-state-false-empty bug class (232.1-PATTERNS.md):
|
|
629
|
+
* a mid-session room switch would leave this line reporting a DIFFERENT room's
|
|
630
|
+
* counts as if they were the bound room's (T-232.1-07).
|
|
631
|
+
*
|
|
632
|
+
* COPY (D-06). Raw counts, one noun, no adjective. Never "density", never
|
|
633
|
+
* "dense"/"sparse"/"at risk"/"healthy" - a count is a measurement, not a
|
|
634
|
+
* health claim. Same guard the doctor module's rendered detail carries.
|
|
635
|
+
*
|
|
636
|
+
* The two count queries are fixed string literals against hardcoded table
|
|
637
|
+
* names with zero interpolation (T-232.1-09). The per-query try/catch is the
|
|
638
|
+
* repo's schema-less-safe idiom (D-05: a room.db with no nodes/edges tables
|
|
639
|
+
* reports 0, never throws). It is deliberately re-implemented here rather than
|
|
640
|
+
* imported from lib/core/doctor/room-graph-density-module.cjs's countTable:
|
|
641
|
+
* lib/mcp/ must not depend on lib/core/doctor/, so this two-line duplication
|
|
642
|
+
* is the intended Canon Part 8/9 layering cost, not an oversight.
|
|
643
|
+
*
|
|
644
|
+
* @param {string} activeRoomDir - the LIVE active room dir, not the boot-time one
|
|
645
|
+
* @returns {string} a leading-blank-line-prefixed line, or '' if anything fails
|
|
646
|
+
*/
|
|
647
|
+
function roomDensityLine(activeRoomDir) {
|
|
648
|
+
const navigation = require('../core/navigation.cjs');
|
|
649
|
+
let db = null;
|
|
650
|
+
try {
|
|
651
|
+
db = navigation.openRoomDbReadOnlyForCaller(activeRoomDir);
|
|
652
|
+
if (!db) return '\n\nLocal graph: 0 nodes, 0 edges (no room.db yet).';
|
|
653
|
+
let n = 0;
|
|
654
|
+
let e = 0;
|
|
655
|
+
try { n = db.prepare('SELECT count(*) AS c FROM nodes').get().c; } catch (_e) { n = 0; }
|
|
656
|
+
try { e = db.prepare('SELECT count(*) AS c FROM edges').get().c; } catch (_e) { e = 0; }
|
|
657
|
+
return '\n\nLocal graph: ' + n + ' nodes, ' + e + ' edges.';
|
|
658
|
+
} catch (_e) {
|
|
659
|
+
return '';
|
|
660
|
+
} finally {
|
|
661
|
+
navigation.closeRoomDbForCaller(db);
|
|
662
|
+
}
|
|
663
|
+
}
|
|
664
|
+
|
|
665
|
+
// ---------------------------------------------------------------------------
|
|
666
|
+
// Router registration
|
|
667
|
+
// ---------------------------------------------------------------------------
|
|
668
|
+
|
|
669
|
+
/**
|
|
670
|
+
* Register all 9 hierarchical router tools on the MCP server.
|
|
671
|
+
*
|
|
672
|
+
* @param {import('@modelcontextprotocol/sdk/server/mcp.js').McpServer} server
|
|
673
|
+
* @param {string} roomDir - Absolute path to the Data Room
|
|
674
|
+
* @param {string} pluginRoot - Absolute path to the plugin root
|
|
675
|
+
* @param {{ full: string }} larryContext - Larry personality context
|
|
676
|
+
* @param {string} [surface] - this process's detected surface name ('cli'|'desktop'|'cowork'),
|
|
677
|
+
* threaded into resolveWriteTargetDir so session-aware write resolution can
|
|
678
|
+
* be gated per-surface behind MINDRIAN_MCP_FIRST (D-07, Phase 198-02)
|
|
679
|
+
*/
|
|
680
|
+
function registerRouterTools(server, roomDir, pluginRoot, larryContext, surface) {
|
|
681
|
+
// -------------------------------------------------------------------------
|
|
682
|
+
// 1. room_state - room health, state, and recommendations (5 commands)
|
|
683
|
+
// -------------------------------------------------------------------------
|
|
684
|
+
// Phase 266-02: this description used to splice the first 80 characters of
|
|
685
|
+
// a trimmed voice-dna.md excerpt onto the end of a fixed prefix, which
|
|
686
|
+
// shipped a raw markdown H1 and a mid-word cut to every host on every
|
|
687
|
+
// surface. An arbitrary byte offset into a prose file cannot be made to
|
|
688
|
+
// land on a sentence boundary, so the description is authored, not
|
|
689
|
+
// borrowed. Pinned by tests/test-266-room-state-description.cjs.
|
|
690
|
+
server.tool(
|
|
691
|
+
'room_state',
|
|
692
|
+
'Check room health and state and get framework recommendations for a Data Room. Use command=status for a one-line health read, analyze for a full section-by-section room analysis, compute-state to recompute STATE.md from what is on disk, get-state to read the current STATE.md, and suggest-next for the recommended next move. Reach for this before proposing work in a room so the suggestion is grounded in the room\'s real state rather than the conversation.',
|
|
693
|
+
{
|
|
694
|
+
command: z.enum(ROOM_STATE_COMMANDS)
|
|
695
|
+
.describe('Room state operation to perform'),
|
|
696
|
+
section: sectionOptional
|
|
697
|
+
.describe('Section name for section-specific operations'),
|
|
698
|
+
},
|
|
699
|
+
async ({ command, section }, extra) => {
|
|
700
|
+
// Phase 87-04: MCP path MUST use the async entry point so analyzeRoom's
|
|
701
|
+
// subprocess call does not block the handler loop. Importing bare
|
|
702
|
+
// './room-ops.cjs' would trip the MOS_DEP_ROOM_OPS_LEGACY warning.
|
|
703
|
+
const roomOps = require('../core/room-ops-async.cjs');
|
|
704
|
+
const stateOps = require('../core/state-ops.cjs');
|
|
705
|
+
// intern-w1-room-state-false-empty: these 5 read branches used to read
|
|
706
|
+
// the boot-time closure roomDir directly, so a mid-session room switch
|
|
707
|
+
// (or a room created after the MCP daemon booted) was invisible here.
|
|
708
|
+
// Re-resolve per call so status/analyze/compute-state/get-state/
|
|
709
|
+
// suggest-next never report against a stale boot-time directory.
|
|
710
|
+
//
|
|
711
|
+
// Phase 248-01 (research pitfall 9): these are READS. They used to ride
|
|
712
|
+
// resolveWriteTargetDir (the WRITE resolver, whose forWrite semantics
|
|
713
|
+
// add a `.room-root` cwd walk-up leg that must never leak into a read
|
|
714
|
+
// -- the exact reason core resolveSessionRoom excludes it, per its own
|
|
715
|
+
// header). Split onto sessionRoom.resolveSessionRoomDir, the read-side
|
|
716
|
+
// wrapper, instead. `sessionId` (per-connection, undefined on
|
|
717
|
+
// stdio/legacy) and `surface` (this function's own outer parameter,
|
|
718
|
+
// already in scope) are threaded through as ctx.
|
|
719
|
+
const sessionId = resolveEffectiveSessionId(undefined, extra);
|
|
720
|
+
const activeRoomDir = sessionRoom.resolveSessionRoomDir(sessionId, { fallbackRoomDir: roomDir, surface: surface });
|
|
721
|
+
|
|
722
|
+
switch (command) {
|
|
723
|
+
case 'status': {
|
|
724
|
+
const state = stateOps.getState(activeRoomDir);
|
|
725
|
+
const response = state || 'No room initialized. Run new-project to create one.';
|
|
726
|
+
return textResponse(response + roomDensityLine(activeRoomDir) + formatSuggestedNext('room_state', { command: 'analyze' }, 'Room status retrieved - run full analysis to detect patterns and gaps'));
|
|
727
|
+
}
|
|
728
|
+
case 'analyze': {
|
|
729
|
+
const analysis = await roomOps.analyzeRoom(activeRoomDir);
|
|
730
|
+
return textResponse(analysis + formatSuggestedNext('room_graph', { command: 'graph-stats' }, 'Room analysis complete - check graph for relationship patterns'));
|
|
731
|
+
}
|
|
732
|
+
case 'compute-state': {
|
|
733
|
+
const computed = stateOps.computeState(activeRoomDir);
|
|
734
|
+
return textResponse(computed + formatSuggestedNext('room_state', { command: 'suggest-next' }, 'State updated - get framework recommendation for current stage'));
|
|
735
|
+
}
|
|
736
|
+
case 'get-state': {
|
|
737
|
+
const state = stateOps.getState(activeRoomDir);
|
|
738
|
+
return textResponse((state || 'No STATE.md found in room.') + roomDensityLine(activeRoomDir) + formatSuggestedNext('room_state', { command: 'analyze' }, 'State retrieved - run analysis to detect intelligence patterns'));
|
|
739
|
+
}
|
|
740
|
+
case 'suggest-next': {
|
|
741
|
+
const ref = loadReference(pluginRoot, 'suggest-next');
|
|
742
|
+
const state = loadRoomState(activeRoomDir);
|
|
743
|
+
const parts = ['## suggest-next'];
|
|
744
|
+
if (state) parts.push(`\n### Current Room State\n${state}`);
|
|
745
|
+
if (ref) parts.push(`\n### Reference\n${ref}`);
|
|
746
|
+
else parts.push('\n> Reference file for "suggest-next" not found.');
|
|
747
|
+
return textResponse(parts.join('\n') + formatSuggestedNext('methodology', { command: 'diagnose' }, 'Framework recommendation provided - diagnose room to identify starting point'));
|
|
748
|
+
}
|
|
749
|
+
default:
|
|
750
|
+
return textResponse(`Unknown room_state command: ${command}`, true);
|
|
751
|
+
}
|
|
752
|
+
}
|
|
753
|
+
);
|
|
754
|
+
|
|
755
|
+
// -------------------------------------------------------------------------
|
|
756
|
+
// 2. room_content - projects, opportunities, funding, personas (15 commands)
|
|
757
|
+
// -------------------------------------------------------------------------
|
|
758
|
+
server.tool(
|
|
759
|
+
'room_content',
|
|
760
|
+
'This tool manages the entities that live inside a room: projects, opportunities, funding stages, personas, and detected integrations. The genuine WRITE surface is file-opportunity, create-funding, update-funding-stage and generate-personas; the last routes to /mos:persona --parallel by default and only writes for an explicit preview, so reach for this tool when room content needs to be added or changed. new-project, setup and update return the operation\'s instructions plus current room context rather than performing it; run the matching /mos: CLI command (new-project, setup or update) for the actual step. invoke-persona READS an existing persona document and returns it; it performs no write of its own. Use room_state instead when you only need to READ the room: its health, computed stage, or a suggested next move. room_state never mutates anything; the four listed commands above do, and the rest of this tool\'s commands return references or reads.',
|
|
761
|
+
{
|
|
762
|
+
command: z.enum(ROOM_CONTENT_COMMANDS)
|
|
763
|
+
.describe('Room content operation to perform'),
|
|
764
|
+
section: sectionOptional
|
|
765
|
+
.describe('Section name or JSON data for operations'),
|
|
766
|
+
context: z.string().optional()
|
|
767
|
+
.describe('Additional context for the operation'),
|
|
768
|
+
},
|
|
769
|
+
async ({ command, section, context }, extra) => {
|
|
770
|
+
// Phase 198-02 (SPEC-1): this connection's sessionId, when the SDK
|
|
771
|
+
// transport supplies one (flag-ON HTTP path; undefined on stdio/legacy).
|
|
772
|
+
// Threaded into every WRITE call site below via resolveWriteTargetDir.
|
|
773
|
+
const sessionId = resolveEffectiveSessionId(undefined, extra);
|
|
774
|
+
|
|
775
|
+
switch (command) {
|
|
776
|
+
case 'new-project':
|
|
777
|
+
case 'setup':
|
|
778
|
+
case 'update':
|
|
779
|
+
case 'help': {
|
|
780
|
+
const ref = loadReference(pluginRoot, command);
|
|
781
|
+
const state = loadRoomState(roomDir);
|
|
782
|
+
const parts = [`## ${command}`];
|
|
783
|
+
// Task 3 of 276-08 (F-11..F-14). new-project/setup/update are
|
|
784
|
+
// DESCRIBED as instructions-only (Move 1 above) but this branch used
|
|
785
|
+
// to silently omit any disclosure; they now carry the shipped
|
|
786
|
+
// NOT-EXECUTED banner via the same corrected membership set Task 1
|
|
787
|
+
// extended. help stays out: it makes no write claim.
|
|
788
|
+
const unimplementedMutation = UNIMPLEMENTED_MUTATING_ORCHESTRATION.has(command);
|
|
789
|
+
if (unimplementedMutation) {
|
|
790
|
+
parts.push(`\n> **NOT EXECUTED.** This returns the \`${command}\` instructions, not a completed operation. Nothing has changed yet. Follow the Reference steps below and verify the result before reporting success.`);
|
|
791
|
+
}
|
|
792
|
+
if (state) parts.push(`\n### Current Room State\n${state}`);
|
|
793
|
+
// Rule 1 bug fix: the pre-existing code bound this "not found" line
|
|
794
|
+
// to `if (context) ... else ...`, so it fired whenever NO context
|
|
795
|
+
// was supplied, regardless of whether the reference was actually
|
|
796
|
+
// found - the inverse of Move 3's intent. Corrected to gate on `ref`.
|
|
797
|
+
if (ref) parts.push(`\n### Reference\n${ref}`);
|
|
798
|
+
else parts.push(`\n> Reference file for "${command}" not found.`);
|
|
799
|
+
if (context) parts.push(`\n### Focus\n${context}`);
|
|
800
|
+
const response = parts.join('\n');
|
|
801
|
+
// Fire cascade for write operations
|
|
802
|
+
if (WRITE_TOOLS.has(command)) {
|
|
803
|
+
await fireCascade(roomDir, command, section);
|
|
804
|
+
}
|
|
805
|
+
// Move 4: the shared "Content updated - analyze room..." rationale
|
|
806
|
+
// asserted a completion none of these four branches perform. help
|
|
807
|
+
// gets its own honest, non-mutation rationale; the other three get
|
|
808
|
+
// the same "Instructions returned" template used everywhere else
|
|
809
|
+
// in this file for the identical shape.
|
|
810
|
+
const suggestedNext = unimplementedMutation
|
|
811
|
+
? formatSuggestedNext('room_state', { command: 'status' }, 'Instructions returned - run them, then check status to confirm what actually changed')
|
|
812
|
+
: formatSuggestedNext('room_state', { command: 'status' }, 'Reference returned - check room status if you want to see current content');
|
|
813
|
+
return textResponse(response + suggestedNext);
|
|
814
|
+
}
|
|
815
|
+
case 'detect-integrations': {
|
|
816
|
+
const integrationRegistry = require('../core/integration-registry.cjs');
|
|
817
|
+
const integResult = integrationRegistry.detectIntegrations({ workDir: roomDir });
|
|
818
|
+
return textResponse(JSON.stringify(integResult, null, 2) + formatSuggestedNext('room_content', { command: 'setup' }, 'Integrations detected - run setup to configure discovered services'));
|
|
819
|
+
}
|
|
820
|
+
case 'scan-opportunities': {
|
|
821
|
+
const opportunityOps = require('../core/opportunity-ops.cjs');
|
|
822
|
+
const scanResult = await opportunityOps.scanOpportunities(roomDir);
|
|
823
|
+
return textResponse(JSON.stringify(scanResult, null, 2) + formatSuggestedNext('room_content', { command: 'list-opportunities' }, 'Scan complete - list discovered opportunities for review'));
|
|
824
|
+
}
|
|
825
|
+
case 'list-opportunities': {
|
|
826
|
+
const opportunityOps = require('../core/opportunity-ops.cjs');
|
|
827
|
+
const listResult = opportunityOps.listOpportunities(roomDir);
|
|
828
|
+
return textResponse(JSON.stringify(listResult, null, 2) + formatSuggestedNext('room_content', { command: 'file-opportunity' }, 'Opportunities listed - file the most promising one to your room'));
|
|
829
|
+
}
|
|
830
|
+
case 'file-opportunity': {
|
|
831
|
+
const opportunityOps = require('../core/opportunity-ops.cjs');
|
|
832
|
+
let oppData;
|
|
833
|
+
try {
|
|
834
|
+
oppData = section ? JSON.parse(section) : {};
|
|
835
|
+
} catch (_e) {
|
|
836
|
+
return textResponse('Invalid JSON in section parameter for file-opportunity', true);
|
|
837
|
+
}
|
|
838
|
+
// 87-05: validate opportunity payload structure before filing (CASCADE-05)
|
|
839
|
+
let validatedOpp;
|
|
840
|
+
try {
|
|
841
|
+
validatedOpp = opportunitySchema.parse(oppData);
|
|
842
|
+
} catch (zodErr) {
|
|
843
|
+
return textResponse('Invalid opportunity payload: ' + (zodErr && zodErr.message ? zodErr.message : String(zodErr)), true);
|
|
844
|
+
}
|
|
845
|
+
// Re-resolve the live active room per call so a mid-session
|
|
846
|
+
// set-active routes the write to the CURRENT room, not the frozen
|
|
847
|
+
// boot-time roomDir (todo room-content-file-opportunity-misroutes).
|
|
848
|
+
const targetDir = resolveWriteTargetDir(sessionId, roomDir, surface);
|
|
849
|
+
const fileResult = opportunityOps.fileOpportunity(targetDir, validatedOpp);
|
|
850
|
+
await fireCascade(targetDir, command, section, fileResult);
|
|
851
|
+
return textResponse(JSON.stringify(fileResult, null, 2) + formatSuggestedNext('room_state', { command: 'analyze' }, 'Opportunity filed - analyze room to detect cross-section patterns'));
|
|
852
|
+
}
|
|
853
|
+
case 'list-funding': {
|
|
854
|
+
const opportunityOps = require('../core/opportunity-ops.cjs');
|
|
855
|
+
const fundResult = opportunityOps.listFunding(roomDir);
|
|
856
|
+
return textResponse(JSON.stringify(fundResult, null, 2) + formatSuggestedNext('room_content', { command: 'create-funding' }, 'Funding listed - create a new funding tracker if needed'));
|
|
857
|
+
}
|
|
858
|
+
case 'create-funding': {
|
|
859
|
+
const opportunityOps = require('../core/opportunity-ops.cjs');
|
|
860
|
+
let fundData;
|
|
861
|
+
try {
|
|
862
|
+
fundData = section ? JSON.parse(section) : {};
|
|
863
|
+
} catch (_e) {
|
|
864
|
+
return textResponse('Invalid JSON in section parameter for create-funding', true);
|
|
865
|
+
}
|
|
866
|
+
if (!fundData.slug || !fundData.source) {
|
|
867
|
+
return textResponse('create-funding requires { slug, source } in section parameter', true);
|
|
868
|
+
}
|
|
869
|
+
// Same frozen-roomDir misroute as file-opportunity: re-resolve live.
|
|
870
|
+
const targetDir = resolveWriteTargetDir(sessionId, roomDir, surface);
|
|
871
|
+
const createResult = opportunityOps.createFunding(targetDir, fundData.slug, fundData.source);
|
|
872
|
+
await fireCascade(targetDir, command, section, createResult);
|
|
873
|
+
return textResponse(JSON.stringify(createResult, null, 2) + formatSuggestedNext('room_content', { command: 'update-funding-stage' }, 'Funding created - update its stage as progress is made'));
|
|
874
|
+
}
|
|
875
|
+
case 'update-funding-stage': {
|
|
876
|
+
const opportunityOps = require('../core/opportunity-ops.cjs');
|
|
877
|
+
let stageData;
|
|
878
|
+
try {
|
|
879
|
+
stageData = section ? JSON.parse(section) : {};
|
|
880
|
+
} catch (_e) {
|
|
881
|
+
return textResponse('Invalid JSON in section parameter for update-funding-stage', true);
|
|
882
|
+
}
|
|
883
|
+
if (!stageData.slug || !stageData.stage) {
|
|
884
|
+
return textResponse('update-funding-stage requires { slug, stage, note? } in section parameter', true);
|
|
885
|
+
}
|
|
886
|
+
// Same frozen-roomDir misroute as file-opportunity: re-resolve live.
|
|
887
|
+
const targetDir = resolveWriteTargetDir(sessionId, roomDir, surface);
|
|
888
|
+
const updateResult = opportunityOps.updateFundingStage(targetDir, stageData.slug, stageData.stage, stageData.note || '');
|
|
889
|
+
await fireCascade(targetDir, command, section, updateResult);
|
|
890
|
+
return textResponse(JSON.stringify(updateResult, null, 2) + formatSuggestedNext('room_state', { command: 'status' }, 'Funding stage updated - check room status for pipeline overview'));
|
|
891
|
+
}
|
|
892
|
+
case 'generate-personas': {
|
|
893
|
+
const personaOps = require('../core/persona-ops.cjs');
|
|
894
|
+
// Phase 265-16 (T-265-72): the DEFAULT is the ROUTE response (writes
|
|
895
|
+
// nothing, no personas/ dir) naming /mos:persona --parallel as the
|
|
896
|
+
// surface that actually reasons. The preview opt-in rides the SAME
|
|
897
|
+
// optional-JSON-via-`section` idiom invoke-persona already uses
|
|
898
|
+
// below (T-265-75: no new key added to this tool's schema) -- pass
|
|
899
|
+
// { "mode": "preview" } in `section` for the labelled template-only
|
|
900
|
+
// quick preview.
|
|
901
|
+
let genOpts;
|
|
902
|
+
try {
|
|
903
|
+
genOpts = section ? JSON.parse(section) : undefined;
|
|
904
|
+
} catch (_e) {
|
|
905
|
+
genOpts = undefined;
|
|
906
|
+
}
|
|
907
|
+
const genResult = personaOps.generatePersonas(roomDir, genOpts);
|
|
908
|
+
await fireCascade(roomDir, command, section, genResult);
|
|
909
|
+
return textResponse(JSON.stringify(genResult, null, 2) + formatSuggestedNext('room_content', { command: 'list-personas' }, 'Routed to /mos:persona --parallel for real six-agent analysis with a cross-agent tension map - list-personas only reads back personas that already exist'));
|
|
910
|
+
}
|
|
911
|
+
case 'list-personas': {
|
|
912
|
+
const personaOps = require('../core/persona-ops.cjs');
|
|
913
|
+
const personas = personaOps.listPersonas(roomDir);
|
|
914
|
+
return textResponse(JSON.stringify(personas, null, 2) + formatSuggestedNext('room_content', { command: 'invoke-persona' }, 'Personas available - invoke one for a specific perspective on your venture'));
|
|
915
|
+
}
|
|
916
|
+
case 'invoke-persona': {
|
|
917
|
+
const personaOps = require('../core/persona-ops.cjs');
|
|
918
|
+
let invokeParams;
|
|
919
|
+
try {
|
|
920
|
+
invokeParams = section ? JSON.parse(section) : {};
|
|
921
|
+
} catch (_e) {
|
|
922
|
+
invokeParams = { hat: section };
|
|
923
|
+
}
|
|
924
|
+
if (!invokeParams.hat) {
|
|
925
|
+
return textResponse('invoke-persona requires a hat color. Pass { "hat": "black", "artifact": "path" } in section parameter.', true);
|
|
926
|
+
}
|
|
927
|
+
const invokeResult = personaOps.invokePersona(roomDir, invokeParams.hat, invokeParams.artifact || null);
|
|
928
|
+
await fireCascade(roomDir, command, section, invokeResult);
|
|
929
|
+
return textResponse(JSON.stringify(invokeResult, null, 2) + formatSuggestedNext('room_content', { command: 'analyze-perspectives' }, 'Persona invoked - run full perspective analysis for all hats'));
|
|
930
|
+
}
|
|
931
|
+
case 'analyze-perspectives': {
|
|
932
|
+
const personaOps = require('../core/persona-ops.cjs');
|
|
933
|
+
let analyzeParams;
|
|
934
|
+
try {
|
|
935
|
+
analyzeParams = section ? JSON.parse(section) : {};
|
|
936
|
+
} catch (_e) {
|
|
937
|
+
analyzeParams = { artifact: section };
|
|
938
|
+
}
|
|
939
|
+
// Phase 130-03: analyzeAllPerspectives delegates to the lens-engine
|
|
940
|
+
// rotation loop and is async; await it.
|
|
941
|
+
const analyzeResult = await personaOps.analyzeAllPerspectives(roomDir, analyzeParams.artifact || null);
|
|
942
|
+
return textResponse(JSON.stringify(analyzeResult, null, 2) + formatSuggestedNext('room_state', { command: 'analyze' }, 'All perspectives analyzed - check room for new cross-section patterns'));
|
|
943
|
+
}
|
|
944
|
+
default:
|
|
945
|
+
return textResponse(`Unknown room_content command: ${command}`, true);
|
|
946
|
+
}
|
|
947
|
+
}
|
|
948
|
+
);
|
|
949
|
+
|
|
950
|
+
// -------------------------------------------------------------------------
|
|
951
|
+
// 3. room_graph - knowledge graph, Minto reasoning, visualization (13 cmds)
|
|
952
|
+
// -------------------------------------------------------------------------
|
|
953
|
+
server.tool(
|
|
954
|
+
'room_graph',
|
|
955
|
+
"Operate on the room's own knowledge graph: build and repair it (graph-index, graph-rebuild), interrogate it (graph-query, graph-stats), work the Minto reasoning layer over it (reasoning-get, reasoning-generate, reasoning-verify, reasoning-run, reasoning-list, reasoning-frontmatter), and render it (visualize-room, visualize-graph, visualize-chain). Prefer this over the standalone graph_query tool for anything beyond a single read: graph_query only answers a query, while this router also builds, verifies, explains, and draws the graph.",
|
|
956
|
+
{
|
|
957
|
+
command: z.enum(ROOM_GRAPH_COMMANDS)
|
|
958
|
+
.describe('Graph/reasoning/visualization operation'),
|
|
959
|
+
section: sectionOptional
|
|
960
|
+
.describe('Section name, file path, SQL query, or JSON params'),
|
|
961
|
+
query: z.string().optional()
|
|
962
|
+
.describe('SQL query for graph-query command'),
|
|
963
|
+
},
|
|
964
|
+
async ({ command, section, query }) => {
|
|
965
|
+
switch (command) {
|
|
966
|
+
case 'graph-index': {
|
|
967
|
+
const graphOps = require('../core/graph-ops.cjs');
|
|
968
|
+
if (!section) {
|
|
969
|
+
return textResponse('graph-index requires a file path in the section parameter', true);
|
|
970
|
+
}
|
|
971
|
+
const indexResult = await graphOps.indexArtifact(roomDir, section);
|
|
972
|
+
await fireCascade(roomDir, command, section, indexResult);
|
|
973
|
+
return textResponse(JSON.stringify(indexResult, null, 2) + formatSuggestedNext('room_graph', { command: 'graph-stats' }, 'Artifact indexed - check graph stats for new relationship patterns'));
|
|
974
|
+
}
|
|
975
|
+
case 'graph-rebuild': {
|
|
976
|
+
const graphOps = require('../core/graph-ops.cjs');
|
|
977
|
+
const rebuildResult = await graphOps.rebuildGraph(roomDir);
|
|
978
|
+
await fireCascade(roomDir, command, section, rebuildResult);
|
|
979
|
+
return textResponse(JSON.stringify(rebuildResult, null, 2) + formatSuggestedNext('room_graph', { command: 'graph-stats' }, 'Graph rebuilt - review stats to verify relationship coverage'));
|
|
980
|
+
}
|
|
981
|
+
case 'graph-query': {
|
|
982
|
+
const graphOps = require('../core/graph-ops.cjs');
|
|
983
|
+
const queryStr = query || section;
|
|
984
|
+
if (!queryStr) {
|
|
985
|
+
return textResponse(
|
|
986
|
+
'graph-query requires a SQL query in the query or section parameter.\n\n' +
|
|
987
|
+
'## SQLite LazyGraph Schema Reference\n' +
|
|
988
|
+
'Tables:\n' +
|
|
989
|
+
'- nodes(id TEXT PK, type TEXT, properties TEXT JSON)\n' +
|
|
990
|
+
' Node types: Artifact, Section, CausalClaim, WhitespaceZone\n' +
|
|
991
|
+
' Artifact properties: title, section, methodology, created, content_hash\n' +
|
|
992
|
+
' Section properties: name, label\n\n' +
|
|
993
|
+
'- edges(source TEXT, target TEXT, type TEXT, properties TEXT JSON)\n' +
|
|
994
|
+
' PK: (source, target, type)\n\n' +
|
|
995
|
+
'Edge types:\n' +
|
|
996
|
+
'- INFORMS (Artifact -> Artifact) - cross-section references via [[wikilinks]]\n' +
|
|
997
|
+
'- CONTRADICTS (Artifact -> Artifact, confidence) - conflicting claims\n' +
|
|
998
|
+
'- CONVERGES (Artifact -> Artifact, term) - themes in 3+ sections\n' +
|
|
999
|
+
'- ENABLES (Artifact -> Artifact) - unblocks another artifact\n' +
|
|
1000
|
+
'- INVALIDATES (Artifact -> Artifact) - makes another claim stale\n' +
|
|
1001
|
+
'- BELONGS_TO (Artifact -> Section) - section membership\n\n' +
|
|
1002
|
+
'Example: SELECT n1.id, n2.id FROM edges e JOIN nodes n1 ON n1.id=e.source JOIN nodes n2 ON n2.id=e.target WHERE e.type=\'CONTRADICTS\'',
|
|
1003
|
+
true
|
|
1004
|
+
);
|
|
1005
|
+
}
|
|
1006
|
+
const queryResult = await graphOps.queryGraph(roomDir, queryStr);
|
|
1007
|
+
return textResponse(JSON.stringify(queryResult, null, 2) + formatSuggestedNext('room_graph', { command: 'visualize-graph' }, 'Query results returned - visualize the graph to see structural patterns'));
|
|
1008
|
+
}
|
|
1009
|
+
case 'graph-stats': {
|
|
1010
|
+
const graphOps = require('../core/graph-ops.cjs');
|
|
1011
|
+
const statsResult = await graphOps.graphStats(roomDir);
|
|
1012
|
+
return textResponse(JSON.stringify(statsResult, null, 2) + formatSuggestedNext('room_state', { command: 'analyze' }, 'Graph stats reviewed - analyze room for actionable intelligence'));
|
|
1013
|
+
}
|
|
1014
|
+
case 'reasoning-get': {
|
|
1015
|
+
const reasoningOps = require('../core/reasoning-ops.cjs');
|
|
1016
|
+
if (!section) return textResponse('reasoning-get requires a section name in the section parameter', true);
|
|
1017
|
+
const getResult = reasoningOps.getReasoning(roomDir, section);
|
|
1018
|
+
return textResponse(JSON.stringify(getResult, null, 2) + formatSuggestedNext('room_graph', { command: 'reasoning-verify', section }, 'Reasoning retrieved - verify its structural integrity'));
|
|
1019
|
+
}
|
|
1020
|
+
case 'reasoning-generate': {
|
|
1021
|
+
const reasoningOps = require('../core/reasoning-ops.cjs');
|
|
1022
|
+
const genResult = reasoningOps.generateReasoning(roomDir, section || null);
|
|
1023
|
+
await fireCascade(roomDir, command, section, genResult);
|
|
1024
|
+
return textResponse(JSON.stringify(genResult, null, 2) + formatSuggestedNext('room_graph', { command: 'graph-index' }, 'Reasoning filed - index for cross-reference discovery'));
|
|
1025
|
+
}
|
|
1026
|
+
case 'reasoning-verify': {
|
|
1027
|
+
const reasoningOps = require('../core/reasoning-ops.cjs');
|
|
1028
|
+
if (!section) return textResponse('reasoning-verify requires a section name in the section parameter', true);
|
|
1029
|
+
const verifyResult = reasoningOps.verifyReasoning(roomDir, section);
|
|
1030
|
+
return textResponse(JSON.stringify(verifyResult, null, 2) + formatSuggestedNext('room_graph', { command: 'reasoning-run', section }, 'Reasoning verified - create a reasoning run to track execution'));
|
|
1031
|
+
}
|
|
1032
|
+
case 'reasoning-run': {
|
|
1033
|
+
const reasoningOps = require('../core/reasoning-ops.cjs');
|
|
1034
|
+
if (!section) return textResponse('reasoning-run requires a section name in the section parameter', true);
|
|
1035
|
+
const runResult = reasoningOps.createRun(roomDir, section);
|
|
1036
|
+
return textResponse(JSON.stringify(runResult, null, 2) + formatSuggestedNext('room_state', { command: 'analyze' }, 'Reasoning run created - analyze room for updated intelligence'));
|
|
1037
|
+
}
|
|
1038
|
+
case 'reasoning-list': {
|
|
1039
|
+
const reasoningOps = require('../core/reasoning-ops.cjs');
|
|
1040
|
+
const listResult = reasoningOps.listReasoning(roomDir);
|
|
1041
|
+
return textResponse(JSON.stringify(listResult, null, 2) + formatSuggestedNext('room_graph', { command: 'reasoning-get' }, 'Reasoning files listed - get a specific one for detailed review'));
|
|
1042
|
+
}
|
|
1043
|
+
case 'reasoning-frontmatter': {
|
|
1044
|
+
const reasoningOps = require('../core/reasoning-ops.cjs');
|
|
1045
|
+
if (!section) return textResponse('reasoning-frontmatter requires a section name or JSON in the section parameter', true);
|
|
1046
|
+
let fmParams;
|
|
1047
|
+
try {
|
|
1048
|
+
fmParams = JSON.parse(section);
|
|
1049
|
+
} catch (_e) {
|
|
1050
|
+
const fmResult = reasoningOps.getReasoningFrontmatter(roomDir, section);
|
|
1051
|
+
return textResponse(JSON.stringify(fmResult, null, 2) + formatSuggestedNext('room_graph', { command: 'reasoning-verify', section }, 'Frontmatter retrieved - verify reasoning structure'));
|
|
1052
|
+
}
|
|
1053
|
+
const { action, section: fmSection, field, value } = fmParams;
|
|
1054
|
+
let fmResult;
|
|
1055
|
+
switch (action) {
|
|
1056
|
+
case 'set':
|
|
1057
|
+
fmResult = reasoningOps.setReasoningFrontmatter(roomDir, fmSection, field, value);
|
|
1058
|
+
break;
|
|
1059
|
+
case 'merge':
|
|
1060
|
+
fmResult = reasoningOps.mergeReasoningFrontmatter(roomDir, fmSection, fmParams);
|
|
1061
|
+
break;
|
|
1062
|
+
case 'get':
|
|
1063
|
+
default:
|
|
1064
|
+
fmResult = reasoningOps.getReasoningFrontmatter(roomDir, fmSection, field || null);
|
|
1065
|
+
break;
|
|
1066
|
+
}
|
|
1067
|
+
return textResponse(JSON.stringify(fmResult, null, 2) + formatSuggestedNext('room_graph', { command: 'reasoning-verify', section: fmSection }, 'Frontmatter updated - verify reasoning integrity'));
|
|
1068
|
+
}
|
|
1069
|
+
case 'visualize-room': {
|
|
1070
|
+
const visualOps = require('../core/visual-ops.cjs');
|
|
1071
|
+
// Phase 87-04: async entry point; MCP handler is already async so
|
|
1072
|
+
// awaiting listSections is free. See 87-04 for sync/async split.
|
|
1073
|
+
const roomOpsViz = require('../core/room-ops-async.cjs');
|
|
1074
|
+
const stateOpsViz = require('../core/state-ops.cjs');
|
|
1075
|
+
let sections = [];
|
|
1076
|
+
try {
|
|
1077
|
+
const sectionData = await roomOpsViz.listSections(roomDir);
|
|
1078
|
+
let stage = 'discovery';
|
|
1079
|
+
try {
|
|
1080
|
+
const stContent = stateOpsViz.getState(roomDir);
|
|
1081
|
+
if (stContent) {
|
|
1082
|
+
const sm = stContent.match(/venture_stage:\s*(.+)/);
|
|
1083
|
+
if (sm) stage = sm[1].trim();
|
|
1084
|
+
}
|
|
1085
|
+
} catch (_e) {}
|
|
1086
|
+
if (sectionData && sectionData.sections) {
|
|
1087
|
+
sections = sectionData.sections.map(s => ({
|
|
1088
|
+
name: s.name || s,
|
|
1089
|
+
entryCount: s.entryCount || s.entries || 0,
|
|
1090
|
+
stage: stage,
|
|
1091
|
+
edges: s.edges || []
|
|
1092
|
+
}));
|
|
1093
|
+
}
|
|
1094
|
+
} catch (_e) {}
|
|
1095
|
+
if (sections.length === 0) {
|
|
1096
|
+
sections = [{ name: 'No room data', entryCount: 0, stage: 'discovery', edges: [] }];
|
|
1097
|
+
}
|
|
1098
|
+
const roomMermaid = visualOps.generateMermaidRoom(sections);
|
|
1099
|
+
return textResponse(visualOps.generateMermaidBlock(roomMermaid) + formatSuggestedNext('room_graph', { command: 'visualize-graph' }, 'Room structure visualized - see the knowledge graph relationships'));
|
|
1100
|
+
}
|
|
1101
|
+
case 'visualize-graph': {
|
|
1102
|
+
const visualOps = require('../core/visual-ops.cjs');
|
|
1103
|
+
const graphOpsViz = require('../core/graph-ops.cjs');
|
|
1104
|
+
let nodes = [];
|
|
1105
|
+
let edges = [];
|
|
1106
|
+
try {
|
|
1107
|
+
const stats = await graphOpsViz.graphStats(roomDir);
|
|
1108
|
+
if (stats && stats.nodes) { nodes = stats.nodes; edges = stats.edges || []; }
|
|
1109
|
+
} catch (_e) {}
|
|
1110
|
+
if (nodes.length === 0) {
|
|
1111
|
+
nodes = [{ id: 'empty', type: 'Section', label: 'No graph data' }];
|
|
1112
|
+
}
|
|
1113
|
+
const graphMermaid = visualOps.generateMermaidGraph(nodes, edges);
|
|
1114
|
+
return textResponse(visualOps.generateMermaidBlock(graphMermaid) + formatSuggestedNext('room_graph', { command: 'graph-query' }, 'Graph visualized - query for specific relationship patterns'));
|
|
1115
|
+
}
|
|
1116
|
+
case 'visualize-chain': {
|
|
1117
|
+
const visualOps = require('../core/visual-ops.cjs');
|
|
1118
|
+
const chainSteps = [
|
|
1119
|
+
{ name: 'Diagnose', framework: 'diagnose', status: 'pending' },
|
|
1120
|
+
{ name: 'Framework', framework: '', status: 'pending' },
|
|
1121
|
+
{ name: 'Apply', framework: '', status: 'pending' },
|
|
1122
|
+
{ name: 'File', framework: '', status: 'pending' },
|
|
1123
|
+
{ name: 'Cross-ref', framework: '', status: 'pending' },
|
|
1124
|
+
{ name: 'Graph Update', framework: '', status: 'pending' }
|
|
1125
|
+
];
|
|
1126
|
+
const rfs = require('fs');
|
|
1127
|
+
const rpath = require('path');
|
|
1128
|
+
if (section) {
|
|
1129
|
+
try {
|
|
1130
|
+
// 87-05: safeResolveSection guards against path traversal even if
|
|
1131
|
+
// a malformed section string bypassed the Zod regex at the MCP edge.
|
|
1132
|
+
const sectionDir = safeResolveSection(roomDir, section);
|
|
1133
|
+
const reasonDir = rpath.join(sectionDir, '.reasoning');
|
|
1134
|
+
if (rfs.existsSync(reasonDir)) {
|
|
1135
|
+
const runs = rfs.readdirSync(reasonDir).filter(f => f.endsWith('.md')).sort().reverse();
|
|
1136
|
+
if (runs.length > 0) {
|
|
1137
|
+
const content = rfs.readFileSync(rpath.join(reasonDir, runs[0]), 'utf-8');
|
|
1138
|
+
const stepMatches = content.match(/##\s+Step\s+\d+[^#]*/g) || [];
|
|
1139
|
+
if (stepMatches.length > 0) {
|
|
1140
|
+
chainSteps.length = 0;
|
|
1141
|
+
stepMatches.forEach((blk, i) => {
|
|
1142
|
+
const nm = blk.match(/##\s+Step\s+\d+:\s*(.+)/);
|
|
1143
|
+
const fw = blk.match(/framework:\s*(.+)/i);
|
|
1144
|
+
const st = blk.match(/status:\s*(.+)/i);
|
|
1145
|
+
chainSteps.push({
|
|
1146
|
+
name: nm ? nm[1].trim() : `Step ${i + 1}`,
|
|
1147
|
+
framework: fw ? fw[1].trim() : '',
|
|
1148
|
+
status: st ? st[1].trim() : 'pending'
|
|
1149
|
+
});
|
|
1150
|
+
});
|
|
1151
|
+
}
|
|
1152
|
+
}
|
|
1153
|
+
}
|
|
1154
|
+
} catch (_e) {}
|
|
1155
|
+
}
|
|
1156
|
+
const chainMermaid = visualOps.generateMermaidChain(chainSteps);
|
|
1157
|
+
return textResponse(visualOps.generateMermaidBlock(chainMermaid) + formatSuggestedNext('room_state', { command: 'suggest-next' }, 'Chain visualized - get framework recommendation for next step'));
|
|
1158
|
+
}
|
|
1159
|
+
// I-1 fix: removed dead cases (detect-integrations, suggest-next, new-project,
|
|
1160
|
+
// setup, update, help) that are unreachable -- not in ROOM_GRAPH_COMMANDS z.enum.
|
|
1161
|
+
// These commands are handled by room_state and orchestration routers.
|
|
1162
|
+
default:
|
|
1163
|
+
return textResponse(`Unknown room_graph command: ${command}`, true);
|
|
1164
|
+
}
|
|
1165
|
+
}
|
|
1166
|
+
);
|
|
1167
|
+
|
|
1168
|
+
// -------------------------------------------------------------------------
|
|
1169
|
+
// 4. methodology - PWS innovation frameworks (14 commands)
|
|
1170
|
+
// -------------------------------------------------------------------------
|
|
1171
|
+
server.tool(
|
|
1172
|
+
'methodology',
|
|
1173
|
+
'Run a PWS innovation methodology framework. Larry guides you through the selected framework and files results to your Data Room.',
|
|
1174
|
+
{
|
|
1175
|
+
command: z.enum(METHODOLOGY_COMMANDS)
|
|
1176
|
+
.describe('Which methodology to run'),
|
|
1177
|
+
context: z.string().optional()
|
|
1178
|
+
.describe('Focus area or venture aspect'),
|
|
1179
|
+
section: sectionOptional
|
|
1180
|
+
.describe('Section to focus on'),
|
|
1181
|
+
},
|
|
1182
|
+
async ({ command, context, section }) => {
|
|
1183
|
+
const response = buildContext(pluginRoot, roomDir, command, context);
|
|
1184
|
+
|
|
1185
|
+
// Record step in pipeline state and generate Pipeline Context header
|
|
1186
|
+
const outputPath = section
|
|
1187
|
+
? `${section}/${command}-output.md`
|
|
1188
|
+
: `methodology/${command}-output.md`;
|
|
1189
|
+
const updatedState = pipelineState.recordStep(roomDir, command, outputPath);
|
|
1190
|
+
const pipelineCtx = pipelineState.formatPipelineContext(roomDir, command, outputPath);
|
|
1191
|
+
|
|
1192
|
+
// Use pipeline-aware suggested next if available, otherwise default
|
|
1193
|
+
let suggestedNext;
|
|
1194
|
+
if (updatedState.suggested_next) {
|
|
1195
|
+
// Determine which router group the next tool belongs to
|
|
1196
|
+
const nextTool = updatedState.suggested_next;
|
|
1197
|
+
const routerGroup = ANALYSIS_COMMANDS.includes(nextTool) ? 'analysis'
|
|
1198
|
+
: METHODOLOGY_COMMANDS.includes(nextTool) ? 'methodology'
|
|
1199
|
+
: INTELLIGENCE_COMMANDS.includes(nextTool) ? 'intelligence'
|
|
1200
|
+
: 'room_state';
|
|
1201
|
+
const nextArgs = routerGroup === 'room_state'
|
|
1202
|
+
? { command: 'analyze' }
|
|
1203
|
+
: { command: nextTool };
|
|
1204
|
+
suggestedNext = formatSuggestedNext(routerGroup, nextArgs, `Pipeline step ${updatedState.chain_position + 2} of ${updatedState.chain.length} - run ${nextTool} next`);
|
|
1205
|
+
} else {
|
|
1206
|
+
suggestedNext = formatSuggestedNext('room_state', { command: 'analyze' }, 'Methodology complete - analyze room to detect new patterns from this framework');
|
|
1207
|
+
}
|
|
1208
|
+
|
|
1209
|
+
return textResponse(response + pipelineCtx + suggestedNext);
|
|
1210
|
+
}
|
|
1211
|
+
);
|
|
1212
|
+
|
|
1213
|
+
// -------------------------------------------------------------------------
|
|
1214
|
+
// 5. analysis - systems analysis and trend exploration (13 commands)
|
|
1215
|
+
// -------------------------------------------------------------------------
|
|
1216
|
+
server.tool(
|
|
1217
|
+
'analysis',
|
|
1218
|
+
'Run structured analysis over a venture or the system around it: analyze-systems, analyze-timing, find-bottlenecks, root-cause, systems-thinking, the trend family (macro-trends, explore-trends, explore-futures, dominant-designs, scenario-plan), and the causal family (causal-extract, causal-trace, causal-predict). Reach for this when the question is HOW something works, WHERE it breaks, or WHAT follows from it. Use the intelligence tool instead when the question is HOW GOOD something is, since that one returns a calibrated assessment rather than a structural map.',
|
|
1219
|
+
{
|
|
1220
|
+
command: z.enum(ANALYSIS_COMMANDS)
|
|
1221
|
+
.describe('Which analysis to run'),
|
|
1222
|
+
context: z.string().optional()
|
|
1223
|
+
.describe('Focus area or system boundary'),
|
|
1224
|
+
section: sectionOptional
|
|
1225
|
+
.describe('Section to focus on'),
|
|
1226
|
+
},
|
|
1227
|
+
async ({ command, context, section }) => {
|
|
1228
|
+
// Record step in pipeline state
|
|
1229
|
+
const outputPath = section
|
|
1230
|
+
? `${section}/${command}-output.md`
|
|
1231
|
+
: `analysis/${command}-output.md`;
|
|
1232
|
+
const updatedState = pipelineState.recordStep(roomDir, command, outputPath);
|
|
1233
|
+
const pipelineCtx = pipelineState.formatPipelineContext(roomDir, command, outputPath);
|
|
1234
|
+
|
|
1235
|
+
// Pipeline-aware suggested next: prefer chain ordering over hardcoded patterns
|
|
1236
|
+
let suggestedNext;
|
|
1237
|
+
if (updatedState.suggested_next) {
|
|
1238
|
+
const nextTool = updatedState.suggested_next;
|
|
1239
|
+
const routerGroup = ANALYSIS_COMMANDS.includes(nextTool) ? 'analysis'
|
|
1240
|
+
: METHODOLOGY_COMMANDS.includes(nextTool) ? 'methodology'
|
|
1241
|
+
: INTELLIGENCE_COMMANDS.includes(nextTool) ? 'intelligence'
|
|
1242
|
+
: 'room_state';
|
|
1243
|
+
const nextArgs = routerGroup === 'room_state'
|
|
1244
|
+
? { command: 'analyze' }
|
|
1245
|
+
: { command: nextTool };
|
|
1246
|
+
suggestedNext = formatSuggestedNext(routerGroup, nextArgs, `Pipeline step ${updatedState.chain_position + 2} of ${updatedState.chain.length} - run ${nextTool} next`);
|
|
1247
|
+
} else if (command === 'scenario-plan') {
|
|
1248
|
+
suggestedNext = formatSuggestedNext('analysis', { command: 'root-cause' }, 'Scenarios mapped - identify root causes of key risks');
|
|
1249
|
+
} else if (command === 'root-cause') {
|
|
1250
|
+
suggestedNext = formatSuggestedNext('analysis', { command: 'causal-trace' }, 'Root causes identified - trace causal chains for deeper understanding');
|
|
1251
|
+
} else if (command === 'causal-extract') {
|
|
1252
|
+
suggestedNext = formatSuggestedNext('analysis', { command: 'causal-trace' }, 'Causal factors extracted - trace their chain of influence');
|
|
1253
|
+
} else if (command === 'causal-trace') {
|
|
1254
|
+
suggestedNext = formatSuggestedNext('analysis', { command: 'causal-predict' }, 'Causal chains traced - predict outcomes based on these chains');
|
|
1255
|
+
} else if (command === 'causal-predict') {
|
|
1256
|
+
suggestedNext = formatSuggestedNext('room_state', { command: 'analyze' }, 'Predictions generated - analyze room to integrate causal intelligence');
|
|
1257
|
+
} else {
|
|
1258
|
+
suggestedNext = formatSuggestedNext('room_state', { command: 'analyze' }, 'Analysis complete - check room for new intelligence patterns');
|
|
1259
|
+
}
|
|
1260
|
+
const response = buildContext(pluginRoot, roomDir, command, context);
|
|
1261
|
+
return textResponse(response + pipelineCtx + suggestedNext);
|
|
1262
|
+
}
|
|
1263
|
+
);
|
|
1264
|
+
|
|
1265
|
+
// -------------------------------------------------------------------------
|
|
1266
|
+
// 6. intelligence - connections, grading, research (7 commands)
|
|
1267
|
+
// + 3 eureka compute subcommands (eureka-run/status/report, NOT in the
|
|
1268
|
+
// 64-command parity set -- they register on this enum only, D-A)
|
|
1269
|
+
// -------------------------------------------------------------------------
|
|
1270
|
+
server.tool(
|
|
1271
|
+
'intelligence',
|
|
1272
|
+
'Run intelligence operations: find connections, grade ventures, build thesis, research. Larry evaluates with calibrated assessment.',
|
|
1273
|
+
{
|
|
1274
|
+
command: z.enum([...INTELLIGENCE_COMMANDS, ...EUREKA_COMPUTE_COMMANDS])
|
|
1275
|
+
.describe('Which intelligence operation to run'),
|
|
1276
|
+
context: z.string().optional()
|
|
1277
|
+
.describe('Focus area or evaluation target'),
|
|
1278
|
+
},
|
|
1279
|
+
async ({ command, context }, extra) => {
|
|
1280
|
+
// Quick-260717-2vf: the eureka portfolio-scan compute branch. It runs the ONE
|
|
1281
|
+
// governed dispatcher scripts/eureka-command.cjs main(argv) IN-PROCESS on the
|
|
1282
|
+
// resident daemon (http transport) so embedding-spine.cjs's module-level
|
|
1283
|
+
// _pipelineCache stays warm across scans, and detaches a child on stdio (where
|
|
1284
|
+
// process.stdout IS the JSON-RPC channel and an in-process runner would corrupt
|
|
1285
|
+
// it). Fire-and-return with status-poll observability, mirroring the CLI
|
|
1286
|
+
// start/status/report contract. See D-A..D-H at the top of the plan.
|
|
1287
|
+
if (EUREKA_COMPUTE_COMMANDS.includes(command)) {
|
|
1288
|
+
const fs = require('node:fs');
|
|
1289
|
+
// D-F: the room dir resolves ONLY through the one existing session-aware
|
|
1290
|
+
// door (no new room parameter, no second guesser). extra.sessionId mirrors
|
|
1291
|
+
// the room_state precedent; `surface` is registerRouterTools' own 5th param.
|
|
1292
|
+
const sessionId = resolveEffectiveSessionId(undefined, extra);
|
|
1293
|
+
const targetDir = resolveWriteTargetDir(sessionId, roomDir, surface);
|
|
1294
|
+
const p = eurekaPaths(targetDir);
|
|
1295
|
+
|
|
1296
|
+
// D-G: flags ride the `context` string as optional JSON, the invoke-persona
|
|
1297
|
+
// try-parse precedent. Non-JSON or absent context means no flags (CLI defaults).
|
|
1298
|
+
let flags = {};
|
|
1299
|
+
try { flags = context ? JSON.parse(context) : {}; } catch (_e) { flags = {}; }
|
|
1300
|
+
if (!flags || typeof flags !== 'object') flags = {};
|
|
1301
|
+
const flagArgv = [];
|
|
1302
|
+
if (typeof flags.top === 'number' && Number.isFinite(flags.top) && flags.top > 0) flagArgv.push('--top', String(flags.top));
|
|
1303
|
+
if (flags.offline) flagArgv.push('--offline');
|
|
1304
|
+
if (typeof flags.graph === 'string' && flags.graph.length > 0) flagArgv.push('--graph', flags.graph);
|
|
1305
|
+
if (flags.noExtract) flagArgv.push('--no-extract');
|
|
1306
|
+
|
|
1307
|
+
if (command === 'eureka-status') {
|
|
1308
|
+
// D-E: return the status.json content verbatim, or {"state":"none"} on a
|
|
1309
|
+
// missing/corrupt file (cmdStatus's exact fallback).
|
|
1310
|
+
let parsed = null;
|
|
1311
|
+
try { parsed = JSON.parse(fs.readFileSync(p.status, 'utf8')); } catch (_e) { parsed = null; }
|
|
1312
|
+
if (parsed) {
|
|
1313
|
+
const done = parsed.state === 'done';
|
|
1314
|
+
const nextArgs = done ? { command: 'eureka-report' } : { command: 'eureka-status' };
|
|
1315
|
+
const nextWhy = done ? 'Scan complete - fetch the report' : 'Scan not finished - poll again';
|
|
1316
|
+
return textResponse(JSON.stringify(parsed) + formatSuggestedNext('intelligence', nextArgs, nextWhy));
|
|
1317
|
+
}
|
|
1318
|
+
return textResponse(JSON.stringify({ state: 'none' }) + formatSuggestedNext('intelligence', { command: 'eureka-status' }, 'No scan on record - start one with eureka-run, then poll'));
|
|
1319
|
+
}
|
|
1320
|
+
|
|
1321
|
+
if (command === 'eureka-report') {
|
|
1322
|
+
// D-E: return the report JSON file content verbatim (the CLI prints the raw
|
|
1323
|
+
// file -- no re-stringify), or the 3-line What/Why/Fix no-report error.
|
|
1324
|
+
let content = null;
|
|
1325
|
+
try { content = fs.readFileSync(p.json, 'utf8'); } catch (_e) { content = null; }
|
|
1326
|
+
if (content === null) {
|
|
1327
|
+
return textResponse(
|
|
1328
|
+
'eureka: no eureka report yet\n Why: no completed scan for this room\n Fix: run eureka-run (or /mos:eureka)',
|
|
1329
|
+
true
|
|
1330
|
+
);
|
|
1331
|
+
}
|
|
1332
|
+
return textResponse(content + formatSuggestedNext('room_state', { command: 'analyze' }, 'Report retrieved - analyze the room to fold these opportunities into its intelligence'));
|
|
1333
|
+
}
|
|
1334
|
+
|
|
1335
|
+
// command === 'eureka-run'
|
|
1336
|
+
// D-F guard 1: fire-and-return makes an async early failure invisible, so the
|
|
1337
|
+
// missing-room check runs SYNCHRONOUSLY, BEFORE firing (cmdRun's triple).
|
|
1338
|
+
if (!fs.existsSync(targetDir)) {
|
|
1339
|
+
return textResponse(
|
|
1340
|
+
'eureka: room directory not found\n Why: ' + String(targetDir) + ' is not a directory\n Fix: pass a valid room path, or run /mos:new-project',
|
|
1341
|
+
true
|
|
1342
|
+
);
|
|
1343
|
+
}
|
|
1344
|
+
// D-D guard 2: one scan per room at a time.
|
|
1345
|
+
if (_eurekaScanInFlight.has(targetDir)) {
|
|
1346
|
+
const inflight = _eurekaScanInFlight.get(targetDir);
|
|
1347
|
+
return textResponse(JSON.stringify({
|
|
1348
|
+
state: 'already_running',
|
|
1349
|
+
started_at: (inflight && inflight.started_at) || null,
|
|
1350
|
+
status: p.status,
|
|
1351
|
+
}));
|
|
1352
|
+
}
|
|
1353
|
+
// D-C: the per-call TRANSPORT gate (the load-bearing stdout-protocol safety).
|
|
1354
|
+
const transport = require('./surface-detect.cjs').detectSurface().transport;
|
|
1355
|
+
let mode;
|
|
1356
|
+
if (transport === 'http') {
|
|
1357
|
+
// Warm-daemon residency: the FIRST lazy require pulls eureka-command.cjs +
|
|
1358
|
+
// eureka-portfolio-report.cjs + embedding-spine.cjs into THIS daemon's
|
|
1359
|
+
// require cache, which is the warm _pipelineCache mechanism itself. Fire
|
|
1360
|
+
// UN-awaited (fire-and-return) with a .catch() so a rejection can never
|
|
1361
|
+
// crash the daemon (cmdRun already writes a failed status.json internally;
|
|
1362
|
+
// the catch is belt-and-braces), and clear the in-flight entry in .finally().
|
|
1363
|
+
_eurekaScanInFlight.set(targetDir, { started_at: new Date().toISOString() });
|
|
1364
|
+
const eurekaCommand = require('../../scripts/eureka-command.cjs');
|
|
1365
|
+
eurekaCommand.main([targetDir, 'run'].concat(flagArgv)).catch(() => {}).finally(() => { _eurekaScanInFlight.delete(targetDir); });
|
|
1366
|
+
mode = 'in-process';
|
|
1367
|
+
} else {
|
|
1368
|
+
// stdio (Desktop, flag-OFF CLI): the runner writes progress to process.stdout
|
|
1369
|
+
// (eureka-portfolio-report.cjs lines ~1180/1197/1337), and stdout IS the
|
|
1370
|
+
// JSON-RPC channel on stdio transport -- an in-process scan would corrupt the
|
|
1371
|
+
// protocol mid-session. So detach a child exactly like today's CLI `start`
|
|
1372
|
+
// (detached, stdio 'ignore'): same status.json observability, zero protocol
|
|
1373
|
+
// risk. The warm-cache win is scoped to the resident daemon by design.
|
|
1374
|
+
const { spawn } = require('node:child_process');
|
|
1375
|
+
const child = spawn(
|
|
1376
|
+
process.execPath,
|
|
1377
|
+
[path.join(pluginRoot, 'scripts', 'eureka-command.cjs'), targetDir, 'run'].concat(flagArgv),
|
|
1378
|
+
{ detached: true, stdio: 'ignore' }
|
|
1379
|
+
);
|
|
1380
|
+
child.unref();
|
|
1381
|
+
mode = 'detached';
|
|
1382
|
+
}
|
|
1383
|
+
return textResponse(JSON.stringify({
|
|
1384
|
+
state: 'started',
|
|
1385
|
+
mode: mode,
|
|
1386
|
+
status: p.status,
|
|
1387
|
+
report_md: p.md,
|
|
1388
|
+
report_json: p.json,
|
|
1389
|
+
}) + formatSuggestedNext('intelligence', { command: 'eureka-status' }, 'Eureka scan started - poll eureka-status until state is done, then eureka-report'));
|
|
1390
|
+
}
|
|
1391
|
+
|
|
1392
|
+
// intern-w1-research-reach-broken: research is a fetch operation, not a
|
|
1393
|
+
// reasoning-only doc+state echo like its INTELLIGENCE_COMMANDS siblings
|
|
1394
|
+
// (grade, whitespace, etc.) - it needs its own pipeline, not buildContext().
|
|
1395
|
+
if (command === 'research') {
|
|
1396
|
+
const researchOutput = await runResearchPipeline(roomDir, context || '');
|
|
1397
|
+
const nextResearch = formatSuggestedNext('room_state', { command: 'analyze' }, 'Research findings surfaced - review and file, then analyze room for new intelligence patterns');
|
|
1398
|
+
return textResponse(researchOutput + nextResearch);
|
|
1399
|
+
}
|
|
1400
|
+
let assessmentExtra = '';
|
|
1401
|
+
if (command === 'grade' || command === 'deep-grade') {
|
|
1402
|
+
const assessment = safeReadFile(path.join(pluginRoot, 'references', 'personality', 'assessment-philosophy.md'));
|
|
1403
|
+
if (assessment) assessmentExtra = `\n### Assessment Philosophy\n${assessment}`;
|
|
1404
|
+
}
|
|
1405
|
+
let suggestedNext;
|
|
1406
|
+
if (command === 'grade') {
|
|
1407
|
+
suggestedNext = formatSuggestedNext('intelligence', { command: 'deep-grade' }, 'Quick grade done - run deep grade for detailed component feedback');
|
|
1408
|
+
} else if (command === 'deep-grade') {
|
|
1409
|
+
suggestedNext = formatSuggestedNext('room_state', { command: 'analyze' }, 'Deep grade complete - analyze room to see grading impact on intelligence');
|
|
1410
|
+
} else {
|
|
1411
|
+
suggestedNext = formatSuggestedNext('room_state', { command: 'analyze' }, 'Intelligence operation complete - analyze room for new patterns');
|
|
1412
|
+
}
|
|
1413
|
+
return textResponse(buildContext(pluginRoot, roomDir, command, context) + assessmentExtra + suggestedNext);
|
|
1414
|
+
}
|
|
1415
|
+
);
|
|
1416
|
+
|
|
1417
|
+
// -------------------------------------------------------------------------
|
|
1418
|
+
// 7. meeting - meeting filing, pipeline, speakers (3 commands)
|
|
1419
|
+
// -------------------------------------------------------------------------
|
|
1420
|
+
// Plan 276-14 (TOOLHON-07): the meeting tool's file-meeting branch needs
|
|
1421
|
+
// navigation.KNOWLEDGE_TYPES at schema-definition time (the knowledge_type
|
|
1422
|
+
// param below), so navigation.cjs is required once here rather than
|
|
1423
|
+
// hardcoding a second copy of the 6-member enum. Same require-once-per-
|
|
1424
|
+
// section precedent as line ~646 above (a different tool's own section).
|
|
1425
|
+
const meetingNavigation = require('../core/navigation.cjs');
|
|
1426
|
+
server.tool(
|
|
1427
|
+
'meeting',
|
|
1428
|
+
'Turn a raw meeting transcript into structured Data Room content. By default this tool writes nothing: it returns protocol and room context only, so call artifact_file to actually file what it hands back. On file-meeting, when you also supply knowledge_type and claim_text, it instead writes that one typed claim at review_status proposed through the same writeClaimNode primitive claim_write uses, then renders a gate_render confirmation card; call gate_answer with the returned gate_id to ratify it, since only a human approval promotes a claim to confirmed. pipeline returns the meeting-intelligence pipeline reference and speakers returns the speaker-identification reference, both write nothing. The five-perspective subagent fan-out (Step 3a Dispatch) has no Agent tool or subagent registry to dispatch into on this surface, so it remains unavailable and unreachable here; for that fuller pipeline, use /mos:file-meeting on the CLI. Reach for this whenever the user pastes or points at a conversation: institutional knowledge lives in meetings rather than documents.',
|
|
1429
|
+
{
|
|
1430
|
+
command: z.enum(MEETING_COMMANDS)
|
|
1431
|
+
.describe('Meeting operation'),
|
|
1432
|
+
context: z.string().optional()
|
|
1433
|
+
.describe('Meeting transcript, date, or context'),
|
|
1434
|
+
knowledge_type: z.enum(Array.from(meetingNavigation.KNOWLEDGE_TYPES)).optional()
|
|
1435
|
+
.describe('Optional, file-meeting only. Supply together with claim_text to write one typed DIKW claim (fact, causal, heuristic, anomaly_cue, mental_model, or assumption) through the same writeClaimNode primitive claim_write uses, then render a gate_render confirmation card. Omit both to get the reference-only protocol response.'),
|
|
1436
|
+
claim_text: z.string().min(1).max(10000).optional()
|
|
1437
|
+
.describe('Optional, file-meeting only. The atomic claim sentence to write when paired with knowledge_type. Omit both to get the reference-only protocol response.'),
|
|
1438
|
+
},
|
|
1439
|
+
async ({ command, context, knowledge_type, claim_text }, extra) => {
|
|
1440
|
+
const state = loadRoomState(roomDir);
|
|
1441
|
+
|
|
1442
|
+
if (command === 'file-meeting') {
|
|
1443
|
+
// Plan 276-14 (TOOLHON-07): OPT-IN write+gate path, closing the F.8
|
|
1444
|
+
// filing-gate half of the Tri-Polar meeting gap
|
|
1445
|
+
// (references/meeting/filing-protocol.md:44-63, gap 2;
|
|
1446
|
+
// 276-DECISIONS.md OQ-276-2, option a: write-then-gate). Composes the
|
|
1447
|
+
// SAME two shipped primitives claim_write (lib/mcp/tools/claim.cjs)
|
|
1448
|
+
// and gate_render/gate_answer (lib/mcp/tools/gate.cjs) already use --
|
|
1449
|
+
// writeClaimNode (lib/core/navigation/typed-claim.cjs, the single
|
|
1450
|
+
// lib/core/node-insert.cjs write chokepoint) and gate-render.cjs's
|
|
1451
|
+
// renderGate plus the shared gate-ledger.cjs mint. This branch
|
|
1452
|
+
// defines NO new confirm/ratify function of its own and mints no
|
|
1453
|
+
// second ledger; ratification (promotion to confirmed) happens only
|
|
1454
|
+
// through the separately-called gate_answer tool, unchanged by this
|
|
1455
|
+
// plan. Both knowledge_type and claim_text are optional, so a call
|
|
1456
|
+
// that omits either -- every pre-existing caller, and every kwl
|
|
1457
|
+
// fixture assertion -- falls straight through to the byte-identical
|
|
1458
|
+
// reference-only response below.
|
|
1459
|
+
if (knowledge_type && claim_text) {
|
|
1460
|
+
const gateRender = require('./gate-render.cjs');
|
|
1461
|
+
const gateLedger = require('./gate-ledger.cjs');
|
|
1462
|
+
const sessionId = resolveEffectiveSessionId(undefined, extra);
|
|
1463
|
+
const targetDir = resolveWriteTargetDir(sessionId, roomDir, surface);
|
|
1464
|
+
const db = meetingNavigation.openRoomDbForCaller(targetDir);
|
|
1465
|
+
if (!db) {
|
|
1466
|
+
return textResponse(JSON.stringify({ ok: false, reason: 'no_room_db', room_dir: targetDir }), true);
|
|
1467
|
+
}
|
|
1468
|
+
let writeResult;
|
|
1469
|
+
try {
|
|
1470
|
+
// Pattern 3 (the rooms-open verified-result construction, the
|
|
1471
|
+
// same discipline claim.cjs already applies): the response below
|
|
1472
|
+
// is built FROM writeResult's own return value, never asserted
|
|
1473
|
+
// independently. A success shape is structurally impossible
|
|
1474
|
+
// without the write having actually happened.
|
|
1475
|
+
writeResult = meetingNavigation.writeClaimNode(db, {
|
|
1476
|
+
knowledge_type: knowledge_type,
|
|
1477
|
+
text: claim_text,
|
|
1478
|
+
sessionId: sessionId,
|
|
1479
|
+
sourceSegment: context,
|
|
1480
|
+
});
|
|
1481
|
+
} finally {
|
|
1482
|
+
meetingNavigation.closeRoomDbForCaller(db);
|
|
1483
|
+
}
|
|
1484
|
+
if (!writeResult || writeResult.ok !== true) {
|
|
1485
|
+
return textResponse('Claim write failed: ' + JSON.stringify(writeResult), true);
|
|
1486
|
+
}
|
|
1487
|
+
// Render the SAME governed gate every other Decision-Gate fork
|
|
1488
|
+
// composes from (gate-render.cjs's renderGate, gate-ledger.cjs's
|
|
1489
|
+
// mintGate) -- never a second gate mechanism. subject_node_id
|
|
1490
|
+
// carries the SOURCED_FROM provenance target gate_answer's own
|
|
1491
|
+
// approve branch already knows how to consume.
|
|
1492
|
+
const card = {
|
|
1493
|
+
header: 'Confirm claim: ' + claim_text.slice(0, 200),
|
|
1494
|
+
kind: 'general',
|
|
1495
|
+
selectMode: 'single',
|
|
1496
|
+
options: [
|
|
1497
|
+
{ id: 'approve', label: 'Approve', description: 'Confirm this claim through gate_answer.' },
|
|
1498
|
+
{ id: 'reject', label: 'Reject', description: 'Reject this claim; it stays at review_status proposed, unconfirmed.' },
|
|
1499
|
+
{ id: 'defer', label: 'Defer', description: 'Defer this claim for later review.' },
|
|
1500
|
+
],
|
|
1501
|
+
subject_node_id: writeResult.node_id,
|
|
1502
|
+
};
|
|
1503
|
+
let rendered;
|
|
1504
|
+
try {
|
|
1505
|
+
rendered = await gateRender.renderGate(card, { sessionId: sessionId });
|
|
1506
|
+
} catch (e) {
|
|
1507
|
+
return textResponse('Claim written (proposed, node_id ' + writeResult.node_id + ') but gate render failed: ' + String((e && e.message) || e), true);
|
|
1508
|
+
}
|
|
1509
|
+
gateLedger.mintGate(rendered.card.gate_id, {
|
|
1510
|
+
card: rendered.card,
|
|
1511
|
+
sessionId: sessionId,
|
|
1512
|
+
kind: (rendered.card && typeof rendered.card.kind === 'string' && rendered.card.kind.length > 0) ? rendered.card.kind : 'general',
|
|
1513
|
+
});
|
|
1514
|
+
const gateParts = [
|
|
1515
|
+
'## File Meeting: claim written, awaiting confirmation',
|
|
1516
|
+
'Claim node ' + writeResult.node_id + ' was written at review_status proposed through writeClaimNode; it is NOT confirmed.',
|
|
1517
|
+
'**gate_id:** ' + rendered.card.gate_id,
|
|
1518
|
+
'Call gate_answer with this gate_id to ratify it: an approve verdict writes a decision node sourced from this claim and promotes it to confirmed through navigation.confirmNode. The five-perspective subagent fan-out remains unreachable here (no Agent tool, no subagent registry on this surface); this is the MCP-reachable, reduced form of the CLI protocol.',
|
|
1519
|
+
'',
|
|
1520
|
+
'### Rendered Card',
|
|
1521
|
+
JSON.stringify(rendered.rendered, null, 2),
|
|
1522
|
+
];
|
|
1523
|
+
return textResponse(gateParts.join('\n') + formatSuggestedNext('gate_answer', { gate_id: rendered.card.gate_id, chosen: ['approve'], verdict: 'approve' }, 'Claim proposed and gate rendered - answer the gate to ratify it'));
|
|
1524
|
+
}
|
|
1525
|
+
|
|
1526
|
+
const meetingRef = safeReadFile(path.join(pluginRoot, 'references', 'meeting', 'filing-protocol.md'));
|
|
1527
|
+
const parts = [
|
|
1528
|
+
'## File Meeting (reference only, nothing written)',
|
|
1529
|
+
noWriteBanner('Nothing is written here; call artifact_file to actually file this content into the room.'),
|
|
1530
|
+
];
|
|
1531
|
+
if (state) parts.push(`\n### Room State\n${state}`);
|
|
1532
|
+
if (meetingRef) {
|
|
1533
|
+
parts.push(`\n### Filing Protocol\n${meetingRef}`);
|
|
1534
|
+
} else {
|
|
1535
|
+
parts.push('\n### Filing Protocol\n> references/meeting/filing-protocol.md was not found on disk. The calling model has no protocol to follow for this call.');
|
|
1536
|
+
}
|
|
1537
|
+
if (context) parts.push(`\n### Transcript/Context\n${context}`);
|
|
1538
|
+
if (!context) parts.push('\n> Provide a meeting transcript to file.');
|
|
1539
|
+
const response = parts.join('\n');
|
|
1540
|
+
// Quick 260903-kwl: fireCascade's empty filePath is pre-existing
|
|
1541
|
+
// cascade-dispatch behavior (noted as odd in the RCA) and not a write
|
|
1542
|
+
// path itself; changing it is out of this pass's scope.
|
|
1543
|
+
await fireCascade(roomDir, command, null, { filePath: '' });
|
|
1544
|
+
return textResponse(response + formatSuggestedNext('artifact_file', {}, 'Protocol and room context returned, nothing filed - call artifact_file first to persist any of it'));
|
|
1545
|
+
}
|
|
1546
|
+
|
|
1547
|
+
if (command === 'pipeline') {
|
|
1548
|
+
const pipelineRef = safeReadFile(path.join(pluginRoot, 'references', 'pipeline', 'index.md'))
|
|
1549
|
+
|| safeReadFile(path.join(pluginRoot, 'commands', 'pipeline.md'));
|
|
1550
|
+
const parts = [
|
|
1551
|
+
'## Pipeline',
|
|
1552
|
+
noWriteBanner('Nothing is written here; call artifact_file to file anything derived from this reference.'),
|
|
1553
|
+
];
|
|
1554
|
+
if (state) parts.push(`\n### Room State\n${state}`);
|
|
1555
|
+
if (pipelineRef) {
|
|
1556
|
+
parts.push(`\n### Reference\n${pipelineRef}`);
|
|
1557
|
+
} else {
|
|
1558
|
+
parts.push('\n### Reference\n> No pipeline reference was found on disk (checked references/pipeline/index.md and commands/pipeline.md).');
|
|
1559
|
+
}
|
|
1560
|
+
if (context) parts.push(`\n### Context\n${context}`);
|
|
1561
|
+
return textResponse(parts.join('\n') + formatSuggestedNext('meeting', { command: 'file-meeting' }, 'Pipeline reviewed - file a meeting to feed the intelligence pipeline'));
|
|
1562
|
+
}
|
|
1563
|
+
|
|
1564
|
+
if (command === 'speakers') {
|
|
1565
|
+
const speakersRef = loadReference(pluginRoot, 'speakers');
|
|
1566
|
+
const parts = [
|
|
1567
|
+
'## Speakers',
|
|
1568
|
+
noWriteBanner('Nothing is written here; call artifact_file to file anything derived from this reference.'),
|
|
1569
|
+
];
|
|
1570
|
+
if (state) parts.push(`\n### Room State\n${state}`);
|
|
1571
|
+
if (speakersRef) {
|
|
1572
|
+
parts.push(`\n### Reference\n${speakersRef}`);
|
|
1573
|
+
} else {
|
|
1574
|
+
parts.push('\n### Reference\n> No speaker-identification reference was found on disk.');
|
|
1575
|
+
}
|
|
1576
|
+
if (context) parts.push(`\n### Context\n${context}`);
|
|
1577
|
+
else parts.push('\n> Provide meeting text or speaker context.');
|
|
1578
|
+
return textResponse(parts.join('\n') + formatSuggestedNext('meeting', { command: 'file-meeting' }, 'Reference returned, no identification performed - file the meeting to route segments to sections'));
|
|
1579
|
+
}
|
|
1580
|
+
|
|
1581
|
+
return textResponse(`Unknown meeting command: ${command}`, true);
|
|
1582
|
+
}
|
|
1583
|
+
);
|
|
1584
|
+
|
|
1585
|
+
// -------------------------------------------------------------------------
|
|
1586
|
+
// 8. export - dashboards, wikis, presentations, snapshots (7 commands)
|
|
1587
|
+
// -------------------------------------------------------------------------
|
|
1588
|
+
server.tool(
|
|
1589
|
+
'export',
|
|
1590
|
+
'Return the export operation instructions plus current room context; this handler does not itself render anything. Run the matching CLI command for the format you chose (/mos:export, /mos:dashboard, /mos:wiki, /mos:present, /mos:radar, /mos:publish, or /mos:snapshot) to actually produce the artifact. Choose by audience: dashboard for a single-screen status view, wiki for a browsable cross-linked reference, present for a slide deck, radar for a scored-dimension chart, snapshot for a frozen point-in-time copy, publish to push an artifact outward, and export for a plain data dump. Reach for this only once the room has content worth showing, because every format reads from existing entries and invents nothing on its own.',
|
|
1591
|
+
{
|
|
1592
|
+
command: z.enum(EXPORT_COMMANDS)
|
|
1593
|
+
.describe('Export operation'),
|
|
1594
|
+
context: z.string().optional()
|
|
1595
|
+
.describe('Export options or context'),
|
|
1596
|
+
format: z.string().optional()
|
|
1597
|
+
.describe('Export format (e.g., html, pdf, md)'),
|
|
1598
|
+
},
|
|
1599
|
+
async ({ command, context, format }) => {
|
|
1600
|
+
const ref = loadReference(pluginRoot, command);
|
|
1601
|
+
const state = loadRoomState(roomDir);
|
|
1602
|
+
// Task 2 of 276-08 (F-2..F-8). Sentence 1's old "Render what is already
|
|
1603
|
+
// filed..." claim described a capability this handler does not have:
|
|
1604
|
+
// the branch below is loadReference + loadRoomState + echoes, exactly
|
|
1605
|
+
// the same reference-echo shape as the `meeting` fix's branches
|
|
1606
|
+
// (:1395, :1418, :1434). Leads with the shipped noWriteBanner() marker
|
|
1607
|
+
// naming the real per-format write path, same as those branches.
|
|
1608
|
+
const parts = [
|
|
1609
|
+
`## ${command}`,
|
|
1610
|
+
noWriteBanner(`Nothing is rendered here; run /mos:${command} on the CLI to actually produce the artifact.`),
|
|
1611
|
+
];
|
|
1612
|
+
if (state) parts.push(`\n### Room State\n${state}`);
|
|
1613
|
+
if (ref) parts.push(`\n### Reference\n${ref}`);
|
|
1614
|
+
else parts.push(`\n> Reference file for "${command}" not found.`);
|
|
1615
|
+
if (context) parts.push(`\n### Context\n${context}`);
|
|
1616
|
+
if (format) parts.push(`\n### Format\n${format}`);
|
|
1617
|
+
|
|
1618
|
+
// Task 2 of 276-08 (F-2..F-8) closed three false completion
|
|
1619
|
+
// assertions here, each claiming a render that never happened: the
|
|
1620
|
+
// snapshot branch's old "[artifact] generated" rationale, the
|
|
1621
|
+
// dashboard branch's matching one, and the fallback's "export
|
|
1622
|
+
// complete" claim. Honest template from the orchestration fallback
|
|
1623
|
+
// (:1659): instructions returned, run them, then verify.
|
|
1624
|
+
let suggestedNext;
|
|
1625
|
+
if (command === 'snapshot') {
|
|
1626
|
+
suggestedNext = formatSuggestedNext('export', { command: 'publish' }, 'Instructions returned - run /mos:snapshot, then verify the snapshot file exists before publishing it');
|
|
1627
|
+
} else if (command === 'dashboard') {
|
|
1628
|
+
suggestedNext = formatSuggestedNext('export', { command: 'wiki' }, 'Instructions returned - run /mos:dashboard, then verify it opened before creating a wiki for deeper navigation');
|
|
1629
|
+
} else {
|
|
1630
|
+
suggestedNext = formatSuggestedNext('room_state', { command: 'status' }, `Instructions returned - run /mos:${command}, then check room status to confirm the artifact now exists`);
|
|
1631
|
+
}
|
|
1632
|
+
return textResponse(parts.join('\n') + suggestedNext);
|
|
1633
|
+
}
|
|
1634
|
+
);
|
|
1635
|
+
|
|
1636
|
+
// -------------------------------------------------------------------------
|
|
1637
|
+
// 9. orchestration - autonomous execution, rooms, scout, admin (20 commands)
|
|
1638
|
+
// -------------------------------------------------------------------------
|
|
1639
|
+
server.tool(
|
|
1640
|
+
'orchestration',
|
|
1641
|
+
'Manage rooms (rooms-list, rooms-new, rooms-open, rooms-close, rooms-archive, rooms-where), run scout intelligence (scout, scout-health, scout-deadlines, scout-competitors, scout-hsi, scout-snapshot), and handle admin, onboarding, models and scheduled tasks. rooms-open genuinely switches the active room. scout and its variants only return the scout reference plus current room context, not gathered intelligence; run /mos:scout on the CLI for the real scan (a .snapshots/ state capture, a competitor report, the HSI pipeline). Treat act, act-chain and act-swarm differently: they execute multi-step work with little supervision, so prefer act-dry-run first and do not invoke them for a decision the user has not already framed.',
|
|
1642
|
+
{
|
|
1643
|
+
command: z.enum(ORCHESTRATION_COMMANDS)
|
|
1644
|
+
.describe('Orchestration operation'),
|
|
1645
|
+
context: z.string().optional()
|
|
1646
|
+
.describe('Operation context or parameters'),
|
|
1647
|
+
room: z.string().optional()
|
|
1648
|
+
.describe('Room name or path for room operations'),
|
|
1649
|
+
confirmArchived: z.boolean().optional()
|
|
1650
|
+
.describe('rooms-open only: the human has confirmed reopening an ARCHIVED room (commands/rooms.md open, Step 2). Without this, opening an archived room is refused rather than performed silently.'),
|
|
1651
|
+
},
|
|
1652
|
+
async ({ command, context, room, confirmArchived }, extra) => {
|
|
1653
|
+
// Brain-driven act* commands use brain-router
|
|
1654
|
+
//
|
|
1655
|
+
// Phase 254 (COMP-01): this dispatch is enumerated in
|
|
1656
|
+
// lib/mcp/brain-composition-census.cjs as the 'orchestration dispatch'
|
|
1657
|
+
// site -- reaches_brain: false (indirect; the actual Brain call is
|
|
1658
|
+
// one hop downstream in brain-router.cjs's Tier 3, also
|
|
1659
|
+
// census-declared with reaches_brain: true). A new composed Brain
|
|
1660
|
+
// call anywhere under lib/mcp/ requires an entry there or the build
|
|
1661
|
+
// fails (tests/test-254-composition-census.cjs).
|
|
1662
|
+
if (command === 'act' || command === 'act-chain' || command === 'act-dry-run' || command === 'act-swarm') {
|
|
1663
|
+
const brainRouter = require('./brain-router.cjs');
|
|
1664
|
+
const rec = await brainRouter.recommend(roomDir, { intent: context || 'general' });
|
|
1665
|
+
|
|
1666
|
+
if (command === 'act') {
|
|
1667
|
+
try { pipelineState.initChain(roomDir, rec.chain, rec.source || 'local'); } catch (_e) {}
|
|
1668
|
+
const parts = [
|
|
1669
|
+
`## Framework Recommendation`,
|
|
1670
|
+
`\n**Chain:** ${rec.chain.join(' -> ')}`,
|
|
1671
|
+
`**Confidence:** ${(rec.confidence * 100).toFixed(0)}%`,
|
|
1672
|
+
`**Source:** ${rec.source}`,
|
|
1673
|
+
`**Reasoning:** ${rec.reasoning}`,
|
|
1674
|
+
];
|
|
1675
|
+
const ref = loadReference(pluginRoot, rec.chain[0]);
|
|
1676
|
+
if (ref) parts.push(`\n### First Framework Reference\n${ref}`);
|
|
1677
|
+
return textResponse(parts.join('\n') + formatSuggestedNext('methodology', { command: rec.chain[0], context: rec.reasoning }, `Run ${rec.chain[0]} as recommended`));
|
|
1678
|
+
}
|
|
1679
|
+
if (command === 'act-chain') {
|
|
1680
|
+
try { pipelineState.initChain(roomDir, rec.chain, rec.source || 'local'); } catch (_e) {}
|
|
1681
|
+
const chainSteps = rec.chain.map((m, i) => `${i + 1}. **${m}**`).join('\n');
|
|
1682
|
+
return textResponse(`## Framework Chain\n\n**Full Sequence:**\n${chainSteps}\n\n**Confidence:** ${(rec.confidence * 100).toFixed(0)}%\n**Source:** ${rec.source}\n**Reasoning:** ${rec.reasoning}` + formatSuggestedNext('methodology', { command: rec.chain[0] }, 'Start chain with first framework'));
|
|
1683
|
+
}
|
|
1684
|
+
if (command === 'act-dry-run') {
|
|
1685
|
+
const validation = brainRouter.validateChain(roomDir, rec.chain);
|
|
1686
|
+
return textResponse(`## Dry Run\n\n**Chain:** ${rec.chain.join(' -> ')}\n**Confidence:** ${(rec.confidence * 100).toFixed(0)}%\n**Source:** ${rec.source}\n**Valid:** ${validation.valid ? 'Yes' : 'No - ' + validation.reason}\n\n> Dry run. No frameworks executed.`);
|
|
1687
|
+
}
|
|
1688
|
+
if (command === 'act-swarm') {
|
|
1689
|
+
try { pipelineState.initChain(roomDir, rec.chain, rec.source || 'local'); } catch (_e) {}
|
|
1690
|
+
const ref = loadReference(pluginRoot, 'act');
|
|
1691
|
+
const parts = [
|
|
1692
|
+
`## Autonomous Swarm Execution`,
|
|
1693
|
+
`\n**Chain:** ${rec.chain.join(' -> ')}`,
|
|
1694
|
+
`**Confidence:** ${(rec.confidence * 100).toFixed(0)}%`,
|
|
1695
|
+
`**Source:** ${rec.source}`,
|
|
1696
|
+
`**Reasoning:** ${rec.reasoning}`,
|
|
1697
|
+
`\n> Swarm mode: all frameworks in the chain will execute sequentially with automatic artifact filing.`,
|
|
1698
|
+
];
|
|
1699
|
+
if (ref) parts.push(`\n### Reference\n${ref}`);
|
|
1700
|
+
return textResponse(parts.join('\n') + formatSuggestedNext('room_state', { command: 'status' }, 'Swarm complete - check room status'));
|
|
1701
|
+
}
|
|
1702
|
+
}
|
|
1703
|
+
|
|
1704
|
+
// -----------------------------------------------------------------
|
|
1705
|
+
// rooms-open EXECUTES. It does not describe.
|
|
1706
|
+
//
|
|
1707
|
+
// RCA rooms-open-false-success (2026-07-27): this command used to fall
|
|
1708
|
+
// through to the reference-echo fallback below, which built a
|
|
1709
|
+
// confirmation-shaped payload out of (a) commands/rooms.md read off
|
|
1710
|
+
// disk, (b) STATE.md from the boot-frozen roomDir closure, and (c) a
|
|
1711
|
+
// verbatim echo of the caller's own `room` argument -- then appended
|
|
1712
|
+
// "Room operation complete". Not one byte of that derived from an
|
|
1713
|
+
// operation, because no operation was ever attempted: a repo-wide grep
|
|
1714
|
+
// found ZERO product-code callers of `room-registry set-active`. The
|
|
1715
|
+
// MCP surface advertised multi-room management while having no
|
|
1716
|
+
// room-switch capability at all.
|
|
1717
|
+
//
|
|
1718
|
+
// openRoom() is the Canon Part 7 chokepoint that wraps the one
|
|
1719
|
+
// authoritative writer and gates ok:true behind a `get-active`
|
|
1720
|
+
// read-back. The response below is constructed FROM that verified
|
|
1721
|
+
// result, so a success-shaped payload is now structurally impossible
|
|
1722
|
+
// without the switch having actually landed.
|
|
1723
|
+
// -----------------------------------------------------------------
|
|
1724
|
+
if (command === 'rooms-open') {
|
|
1725
|
+
const { openRoom } = require('../core/room-open.cjs');
|
|
1726
|
+
const result = openRoom({
|
|
1727
|
+
room: room,
|
|
1728
|
+
sessionId: resolveEffectiveSessionId(undefined, extra) || undefined,
|
|
1729
|
+
confirmArchived: confirmArchived === true,
|
|
1730
|
+
});
|
|
1731
|
+
|
|
1732
|
+
if (!result.ok) {
|
|
1733
|
+
const fixes = {
|
|
1734
|
+
no_room_specified: 'Supply the room slug: orchestration({ command: "rooms-open", room: "<slug>" }).',
|
|
1735
|
+
invalid_room_slug: 'Room slugs are simple names (no path separators). Run rooms-list to see valid slugs.',
|
|
1736
|
+
no_registry: 'No room registry exists yet. Create your first room before switching.',
|
|
1737
|
+
room_not_found: 'That room is not in the registry. Run rooms-list to see available rooms.',
|
|
1738
|
+
archived_needs_confirmation: 'This room is ARCHIVED. Opening it sets its status back to active. Ask the human to confirm, then retry with confirmArchived: true.',
|
|
1739
|
+
set_active_failed: 'The room-registry set-active call did not succeed. The active room is UNCHANGED.',
|
|
1740
|
+
verify_failed: 'set-active ran but the registry read-back does not match. The switch did NOT take effect.',
|
|
1741
|
+
};
|
|
1742
|
+
const failParts = [
|
|
1743
|
+
`## rooms-open FAILED`,
|
|
1744
|
+
`\n**The active room was NOT changed.**`,
|
|
1745
|
+
`\n- **Requested:** ${result.room || '(none)'}`,
|
|
1746
|
+
`- **Reason:** \`${result.reason}\``,
|
|
1747
|
+
];
|
|
1748
|
+
if (result.active !== undefined) failParts.push(`- **Active room is still:** ${result.active || '(unset)'}`);
|
|
1749
|
+
if (result.status) failParts.push(`- **Room status:** ${result.status}`);
|
|
1750
|
+
failParts.push(`\n**Fix:** ${fixes[result.reason] || 'Inspect the registry and retry.'}`);
|
|
1751
|
+
return textResponse(failParts.join('\n'), true);
|
|
1752
|
+
}
|
|
1753
|
+
|
|
1754
|
+
const okParts = [
|
|
1755
|
+
`## rooms-open`,
|
|
1756
|
+
`\n**Switched to: ${result.active}** (verified against the registry after the write)`,
|
|
1757
|
+
`\n- **Previous active room:** ${result.previous || '(none)'}`,
|
|
1758
|
+
`- **Status:** active`,
|
|
1759
|
+
`- **Session bound:** ${result.session_bound ? 'yes' : 'no (writes fall back to the global active room)'}`,
|
|
1760
|
+
];
|
|
1761
|
+
if (result.abs_path) okParts.push(`- **Path:** ${result.abs_path}`);
|
|
1762
|
+
// Read the SWITCHED room's state, not the boot-frozen closure's. The
|
|
1763
|
+
// wrong-room STATE.md in the old payload was half of why the false
|
|
1764
|
+
// success read as plausible.
|
|
1765
|
+
const switchedState = result.abs_path ? loadRoomState(result.abs_path) : '';
|
|
1766
|
+
if (switchedState) okParts.push(`\n### Room State\n${switchedState}`);
|
|
1767
|
+
return textResponse(
|
|
1768
|
+
okParts.join('\n')
|
|
1769
|
+
+ formatSuggestedNext('room_state', { command: 'status' }, 'Room switch verified - check the new room status')
|
|
1770
|
+
);
|
|
1771
|
+
}
|
|
1772
|
+
|
|
1773
|
+
// All other orchestration commands use reference-based pattern
|
|
1774
|
+
const ref = loadReference(pluginRoot, command);
|
|
1775
|
+
const state = loadRoomState(roomDir);
|
|
1776
|
+
const parts = [`## ${command}`];
|
|
1777
|
+
// Same RCA, structural half: rooms-new / rooms-close / rooms-archive are
|
|
1778
|
+
// ALSO declared-but-unimplemented state MUTATIONS reaching this same
|
|
1779
|
+
// fallback, and they used to receive the same "Room operation complete"
|
|
1780
|
+
// assertion. The fallback returns INSTRUCTIONS; saying so out loud is
|
|
1781
|
+
// what stops the shared pattern from minting more false successes.
|
|
1782
|
+
// These are deliberately not implemented here -- rooms-new has its own
|
|
1783
|
+
// open RCA with a different root cause
|
|
1784
|
+
// (.planning/debug/intern-w1-rooms-new-silent-fail.md).
|
|
1785
|
+
const unimplementedMutation = UNIMPLEMENTED_MUTATING_ORCHESTRATION.has(command);
|
|
1786
|
+
if (unimplementedMutation) {
|
|
1787
|
+
parts.push(`\n> **NOT EXECUTED.** This returns the \`${command}\` instructions, not a completed operation. Nothing has changed yet. Follow the Reference steps below and verify the result before reporting success.`);
|
|
1788
|
+
}
|
|
1789
|
+
if (state) parts.push(`\n### Room State\n${state}`);
|
|
1790
|
+
if (ref) parts.push(`\n### Reference\n${ref}`);
|
|
1791
|
+
if (context) parts.push(`\n### Context\n${context}`);
|
|
1792
|
+
if (room) parts.push(`\n### Requested Room (echo of your argument, not a confirmation)\n${room}`);
|
|
1793
|
+
if (!ref) parts.push(`\n> Reference file for "${command}" not found.`);
|
|
1794
|
+
|
|
1795
|
+
let suggestedNext;
|
|
1796
|
+
if (unimplementedMutation) {
|
|
1797
|
+
// Covers rooms-new/rooms-close/rooms-archive AND (F-1) the whole
|
|
1798
|
+
// scout family, now that both share the corrected membership rule
|
|
1799
|
+
// above. The old `command.startsWith('scout')` branch below this one
|
|
1800
|
+
// used to assert "Scout intelligence gathered - analyze room" for
|
|
1801
|
+
// every scout* command; that branch is now unreachable (scout* is
|
|
1802
|
+
// caught here first) and has been removed rather than left as dead,
|
|
1803
|
+
// misleading code a future edit could resurrect by accident.
|
|
1804
|
+
suggestedNext = formatSuggestedNext('room_state', { command: 'status' }, 'Instructions returned - run them, then check status to confirm what actually changed');
|
|
1805
|
+
} else if (command.startsWith('rooms-')) {
|
|
1806
|
+
// Reviewed against the same F-1 standard (rooms-list, rooms-where):
|
|
1807
|
+
// their descriptions make no write claim, and this fallback genuinely
|
|
1808
|
+
// does complete the one operation it performs (returning the
|
|
1809
|
+
// reference), so "Room operation complete" is not a false claim here
|
|
1810
|
+
// the way "Scout intelligence gathered" was for scout* -- left as-is.
|
|
1811
|
+
suggestedNext = formatSuggestedNext('room_state', { command: 'status' }, 'Room operation complete - check status');
|
|
1812
|
+
} else {
|
|
1813
|
+
suggestedNext = formatSuggestedNext('room_state', { command: 'status' }, 'Operation complete - check room status');
|
|
1814
|
+
}
|
|
1815
|
+
return textResponse(parts.join('\n') + suggestedNext);
|
|
1816
|
+
}
|
|
1817
|
+
);
|
|
1818
|
+
|
|
1819
|
+
// (Duplicate orchestration router from 52-03 merge removed -- brain routing now integrated above)
|
|
1820
|
+
|
|
1821
|
+
// -------------------------------------------------------------------------
|
|
1822
|
+
// 10. room_bind - the D-03 binding front door (Phase 198-02, SPEC-1)
|
|
1823
|
+
// -------------------------------------------------------------------------
|
|
1824
|
+
// D-03 precedence: explicit room arg WINS when supplied; else a `.room-root`
|
|
1825
|
+
// sentinel above process.cwd() auto-binds SILENTLY (cwd-default); a genuinely
|
|
1826
|
+
// ambiguous session (no explicit room, no cwd room) returns a structured
|
|
1827
|
+
// { needs_binding_card: true } signal instead of guessing -- the F.8 card
|
|
1828
|
+
// itself renders through gate_render (a later plan; this tool only emits the
|
|
1829
|
+
// signal). Wraps writeSessionBinding as-is (session-binding.cjs:107); does
|
|
1830
|
+
// NOT reimplement the binding store (Canon Part 7).
|
|
1831
|
+
//
|
|
1832
|
+
// RCA statusline-room-health-chip-never-updates: the statusline health chip
|
|
1833
|
+
// reads ~/.mindrian/room-health.json, whose write function had exactly ONE
|
|
1834
|
+
// caller in the tree - the manual `--bind-check <roomDir>` CLI flag, which
|
|
1835
|
+
// nothing in the shipped product ever invoked. The chip therefore froze at
|
|
1836
|
+
// whatever a past manual shell run wrote and a stale drift warning could never
|
|
1837
|
+
// clear. room_bind is the live binding front door, so it is where the honest
|
|
1838
|
+
// signal belongs. The check is IN-PROCESS (room-health-cache.runBindHealthCheck
|
|
1839
|
+
// composes session-presence.runBindCheck): an MCP tool handler must never spawn
|
|
1840
|
+
// a child process for a synchronous tool call. FAIL SOFT by construction - the
|
|
1841
|
+
// bind is the load-bearing operation and a health fault must never break or
|
|
1842
|
+
// block it. Canon Part 8: LOCAL only, zero Brain egress.
|
|
1843
|
+
function persistBindHealth(sessionId, slug, roomDir) {
|
|
1844
|
+
try {
|
|
1845
|
+
const roomHealthCache = require('../statusline/room-health-cache.cjs');
|
|
1846
|
+
roomHealthCache.runBindHealthCheck({
|
|
1847
|
+
sessionId: sessionId,
|
|
1848
|
+
room: slug,
|
|
1849
|
+
roomDir: roomDir || null,
|
|
1850
|
+
});
|
|
1851
|
+
} catch (_e) { /* advisory only: never break a successful bind */ }
|
|
1852
|
+
}
|
|
1853
|
+
|
|
1854
|
+
server.tool(
|
|
1855
|
+
'room_bind',
|
|
1856
|
+
'Bind this MCP session to a room (D-03: explicit room wins; cwd auto-bind when launched inside a room; a structured binding-card signal on genuine ambiguity). The room this session binds to becomes the target for every subsequent write this session makes.',
|
|
1857
|
+
{
|
|
1858
|
+
room: z.string().optional()
|
|
1859
|
+
.describe('Explicit room slug to bind this session to. Wins over cwd auto-bind when supplied.'),
|
|
1860
|
+
sessionId: z.string().optional()
|
|
1861
|
+
.describe('Explicit sessionId override; defaults to this connection\'s session id.'),
|
|
1862
|
+
},
|
|
1863
|
+
async ({ room, sessionId }, extra) => {
|
|
1864
|
+
// RCA registry-active-room-concurrent-session-collision, Change 1: on
|
|
1865
|
+
// stdio (the local Claude Code CLI transport), the MCP SDK never
|
|
1866
|
+
// populates extra.sessionId (confirmed live; see the RCA doc). Without a
|
|
1867
|
+
// third fallback, writeSessionBinding's ONLY call sites (below) were
|
|
1868
|
+
// unreachable for every CLI session, so session.primary could never be
|
|
1869
|
+
// written and every write-target resolution fell through to the shared,
|
|
1870
|
+
// unlocked, machine-wide registry.json `active` field (Leg 3), which
|
|
1871
|
+
// concurrent CLI sessions on one machine then raced to overwrite.
|
|
1872
|
+
// Precedence: explicit `sessionId` param > SDK `extra.sessionId`
|
|
1873
|
+
// (desktop/cowork, non-stdio) > process.env.CLAUDE_CODE_SESSION_ID (the
|
|
1874
|
+
// real per-process env var Claude Code sets for a CLI session, mirroring
|
|
1875
|
+
// the F-01 precedent already shipped in scripts/write-scope-check.cjs,
|
|
1876
|
+
// commit 0bec81b9) > no_session_id only when all three are absent. This
|
|
1877
|
+
// widens ONLY how a session id is obtained; it does not touch the
|
|
1878
|
+
// needs_binding_card/F.8 ambiguity signal below, which fires exactly as
|
|
1879
|
+
// before once a session id is in hand.
|
|
1880
|
+
const effectiveSessionId = resolveEffectiveSessionId(sessionId, extra);
|
|
1881
|
+
if (!effectiveSessionId) {
|
|
1882
|
+
return textResponse(JSON.stringify({ ok: false, reason: 'no_session_id' }, null, 2), true);
|
|
1883
|
+
}
|
|
1884
|
+
const { writeSessionBinding } = require('../core/session-binding.cjs');
|
|
1885
|
+
|
|
1886
|
+
// Phase 248-02 (CTX-02 return half): the write above can silently no-op
|
|
1887
|
+
// (an unsafe slug) or write a slug that has no directory on disk (the
|
|
1888
|
+
// room-not-on-disk lie this plan closes). Round-trip through the SAME
|
|
1889
|
+
// shared resolver, with the SAME sessionId, and report what a
|
|
1890
|
+
// subsequent read in this session will actually see. This doubles as
|
|
1891
|
+
// an in-process seam-liveness proof: the write end and the read end
|
|
1892
|
+
// are verified against each other on every call. Additive fields only
|
|
1893
|
+
// - the needs_binding_card branch below is untouched.
|
|
1894
|
+
function honestBindResult(baseFields, boundSlug) {
|
|
1895
|
+
const check = require('./session-room.cjs').resolveMcpSessionRoom({
|
|
1896
|
+
sessionId: effectiveSessionId,
|
|
1897
|
+
ctx: { fallbackRoomDir: roomDir, surface: surface },
|
|
1898
|
+
});
|
|
1899
|
+
const effective = check.source === 'session.primary' && check.slug === boundSlug;
|
|
1900
|
+
const result = Object.assign({}, baseFields, {
|
|
1901
|
+
effective: effective,
|
|
1902
|
+
resolved_dir: check.dir,
|
|
1903
|
+
resolved_source: check.source,
|
|
1904
|
+
});
|
|
1905
|
+
if (!effective) {
|
|
1906
|
+
// room_not_on_disk: a write of a safe slug that the resolver could
|
|
1907
|
+
// not turn into a session.primary hit (the existsSync gate in
|
|
1908
|
+
// registryRoomPath failed leg A). binding_not_effective is the
|
|
1909
|
+
// honest catch-all for any other silent no-op (e.g. an unsafe
|
|
1910
|
+
// slug writeSessionBinding rejected outright).
|
|
1911
|
+
result.reason = (check.slug !== boundSlug || check.source !== 'session.primary')
|
|
1912
|
+
? 'room_not_on_disk'
|
|
1913
|
+
: 'binding_not_effective';
|
|
1914
|
+
}
|
|
1915
|
+
return result;
|
|
1916
|
+
}
|
|
1917
|
+
|
|
1918
|
+
if (room) {
|
|
1919
|
+
writeSessionBinding(effectiveSessionId, { primary: room, bound: [room] });
|
|
1920
|
+
persistBindHealth(effectiveSessionId, room, null);
|
|
1921
|
+
const payload = honestBindResult({ ok: true, bound: true, primary: room, source: 'explicit' }, room);
|
|
1922
|
+
return textResponse(JSON.stringify(payload, null, 2)
|
|
1923
|
+
+ formatSuggestedNext('room_state', { command: 'status' }, 'Session bound - check room status for the newly bound room'));
|
|
1924
|
+
}
|
|
1925
|
+
|
|
1926
|
+
// cwd auto-bind: a `.room-root` sentinel above process.cwd() wins silently.
|
|
1927
|
+
try {
|
|
1928
|
+
const roomRoot = require('../core/room-root.cjs');
|
|
1929
|
+
const cwdRoomDir = roomRoot.resolveRoomRoot(process.cwd());
|
|
1930
|
+
if (cwdRoomDir) {
|
|
1931
|
+
const slug = path.basename(cwdRoomDir);
|
|
1932
|
+
writeSessionBinding(effectiveSessionId, { primary: slug, bound: [slug] });
|
|
1933
|
+
persistBindHealth(effectiveSessionId, slug, cwdRoomDir);
|
|
1934
|
+
const payload = honestBindResult({ ok: true, bound: true, primary: slug, source: 'cwd' }, slug);
|
|
1935
|
+
return textResponse(JSON.stringify(payload, null, 2)
|
|
1936
|
+
+ formatSuggestedNext('room_state', { command: 'status' }, 'Session auto-bound from cwd - check room status'));
|
|
1937
|
+
}
|
|
1938
|
+
} catch (_e) { /* fall through to the ambiguity signal */ }
|
|
1939
|
+
|
|
1940
|
+
// Genuine ambiguity: no explicit room, no cwd room. Signal the caller so
|
|
1941
|
+
// gate_render (a later plan) can fire the F.8 binding card ONCE per
|
|
1942
|
+
// session (D-03/D-05: never per-turn).
|
|
1943
|
+
return textResponse(JSON.stringify({ ok: true, bound: false, needs_binding_card: true }, null, 2));
|
|
1944
|
+
}
|
|
1945
|
+
);
|
|
1946
|
+
|
|
1947
|
+
// -------------------------------------------------------------------------
|
|
1948
|
+
// eureka_critic - the Grounding Guard calibration ruling (Phase 212-03).
|
|
1949
|
+
//
|
|
1950
|
+
// WHAT: a THIN MCP wrapper over lib/core/eureka-critic.cjs's criticRule -- the
|
|
1951
|
+
// ONLY phase-212 surface that crosses a process/network boundary. Scalars +
|
|
1952
|
+
// closed enums in, a coarse ruling out; NO room content ever (D1: the 20-60
|
|
1953
|
+
// bit payload is the moat-correct boundary from 02-moat-embedding-audit -- the
|
|
1954
|
+
// generator stays local/open, only the abstracted ruling call crosses).
|
|
1955
|
+
//
|
|
1956
|
+
// hitl_shape: none. RATIONALE: criticRule is a PURE ruling function with no
|
|
1957
|
+
// Decision-Gate fork of its own -- it returns {verdict, confidence,
|
|
1958
|
+
// reasoning_tag}, it never asks the human anything. The human gate on eureka
|
|
1959
|
+
// verdicts lives DOWNSTREAM in Phase 213's eureka-reach wiring (exactly where
|
|
1960
|
+
// CONTEXT scopes it), not on this abstracted ruling call. This declaration is a
|
|
1961
|
+
// no-drift proof: eureka_critic is deliberately NOT in MCP_TOOL_CONNECTORS (its
|
|
1962
|
+
// governance dial is "none", so it mints no connector descriptor and the
|
|
1963
|
+
// born-wired registry stays byte-stable); registration on this one governed MCP
|
|
1964
|
+
// path via registerRouterTools IS the Canon Part 11 wiring.
|
|
1965
|
+
//
|
|
1966
|
+
// NOT in ALL_TOOL_COMMANDS: eureka_critic has NO CLI command twin (its CLI
|
|
1967
|
+
// surface is scripts/eureka-critic-run.cjs, plan 05; its programmatic consumer
|
|
1968
|
+
// is Phase 213). The 65-pin in tests/test-205-surface-fence.cjs guards
|
|
1969
|
+
// CLI<->MCP command PARITY for the 64 routed CLI commands -- this tool is not
|
|
1970
|
+
// one of them, so it registers directly via server.tool and must never touch
|
|
1971
|
+
// that parity array.
|
|
1972
|
+
//
|
|
1973
|
+
// SEED-014 lift note: this wrapper is DISPOSABLE. When the critic lifts into the
|
|
1974
|
+
// separate Brain repo, criticRule moves unchanged and only this thin wrapper is
|
|
1975
|
+
// rewritten -- zero change to lib/core/eureka-critic.cjs (D4 portability).
|
|
1976
|
+
//
|
|
1977
|
+
// Rate-limit scope: D3b item 4's "per API key" rate-limit is DEFERRED to the
|
|
1978
|
+
// SEED-014 Brain-repo lift. The plugin-local tool has no per-key identity yet,
|
|
1979
|
+
// so this phase ships an honest per-PROCESS token count (EUREKA_CRITIC_RATE_LIMIT
|
|
1980
|
+
// per rolling minute) as the local equivalent; the per-key upgrade lands with
|
|
1981
|
+
// the key surface, not here.
|
|
1982
|
+
//
|
|
1983
|
+
// D5: the handler is a PURE function of the payload -- it references NEITHER
|
|
1984
|
+
// roomDir NOR pluginRoot NOR larryContext, so the addendum's stale-roomDir bug
|
|
1985
|
+
// cannot recur on a surface that never touches a room closure.
|
|
1986
|
+
// -------------------------------------------------------------------------
|
|
1987
|
+
const _eurekaCriticDomainTags = eurekaCritic.loadCriticTags().domain_tags;
|
|
1988
|
+
server.tool(
|
|
1989
|
+
'eureka_critic',
|
|
1990
|
+
'Grounding Guard calibration ruling: quantized scalars + closed enums in, a coarse verdict/confidence/reasoning_tag out; no room content ever crosses this boundary.',
|
|
1991
|
+
{
|
|
1992
|
+
differential_score: z.number().min(-1).max(1)
|
|
1993
|
+
.describe('Quantized differential score in [-1, 1]'),
|
|
1994
|
+
semantic_similarity: z.number().min(-1).max(1)
|
|
1995
|
+
.describe('Quantized semantic similarity in [-1, 1]'),
|
|
1996
|
+
lsa_similarity: z.number().min(0).max(1)
|
|
1997
|
+
.describe('Quantized LSA similarity in [0, 1]'),
|
|
1998
|
+
surprise_type: z.enum(['structural_transfer', 'semantic_implementation'])
|
|
1999
|
+
.describe('Closed surprise-type enum'),
|
|
2000
|
+
source_domain_tag: z.enum(_eurekaCriticDomainTags)
|
|
2001
|
+
.describe('Generic source domain tag (never a room artifact id or content)'),
|
|
2002
|
+
target_domain_tag: z.enum(_eurekaCriticDomainTags)
|
|
2003
|
+
.describe('Generic target domain tag (never a room artifact id or content)'),
|
|
2004
|
+
rubric_pattern: z.string().regex(/^[01x]{6}$/)
|
|
2005
|
+
.describe('The abstracted [01x]{6} rubric boolean pattern'),
|
|
2006
|
+
schema_version: z.number().int()
|
|
2007
|
+
.describe('Tags/enum schema version for the Part 9 versioned-packet guard'),
|
|
2008
|
+
},
|
|
2009
|
+
async (payload) => {
|
|
2010
|
+
// Env tunables read at CALL time (RS_SEMANTIC_FLOOR precedent) so an
|
|
2011
|
+
// operator retunes without a code change.
|
|
2012
|
+
const dedupeTtlMs = (function () {
|
|
2013
|
+
const v = parseInt(process.env.EUREKA_CRITIC_DEDUPE_TTL_MS, 10);
|
|
2014
|
+
return Number.isFinite(v) && v > 0 ? v : 60000;
|
|
2015
|
+
})();
|
|
2016
|
+
const rateLimit = (function () {
|
|
2017
|
+
const v = parseInt(process.env.EUREKA_CRITIC_RATE_LIMIT, 10);
|
|
2018
|
+
return Number.isFinite(v) && v > 0 ? v : 30;
|
|
2019
|
+
})();
|
|
2020
|
+
|
|
2021
|
+
// (1) Dedupe (D3b item 4): a sha256 over the canonical-JSON payload keyed
|
|
2022
|
+
// into a module-level Map. An identical payload within the TTL returns the
|
|
2023
|
+
// cached ruling without a recompute (and without spending a rate token).
|
|
2024
|
+
const crypto = require('crypto');
|
|
2025
|
+
const canonical = JSON.stringify(payload, Object.keys(payload).sort());
|
|
2026
|
+
const payloadHash = crypto.createHash('sha256').update(canonical).digest('hex');
|
|
2027
|
+
const now = Date.now();
|
|
2028
|
+
const cached = _eurekaCriticDedupeCache.get(payloadHash);
|
|
2029
|
+
if (cached && (now - cached.ts) < dedupeTtlMs) {
|
|
2030
|
+
return textResponse(JSON.stringify(cached.ruling));
|
|
2031
|
+
}
|
|
2032
|
+
|
|
2033
|
+
// (2) Rate-limit (D3b item 4): a per-process rolling-minute token count.
|
|
2034
|
+
// Prune the window to the last 60s; over the limit returns an error naming
|
|
2035
|
+
// the limit rather than recomputing (query-stream / shadow-model brake).
|
|
2036
|
+
while (_eurekaCriticRateWindow.length > 0 && (now - _eurekaCriticRateWindow[0]) >= 60000) {
|
|
2037
|
+
_eurekaCriticRateWindow.shift();
|
|
2038
|
+
}
|
|
2039
|
+
if (_eurekaCriticRateWindow.length >= rateLimit) {
|
|
2040
|
+
return textResponse(
|
|
2041
|
+
'eureka_critic rate limit exceeded (' + rateLimit + ' calls per minute, EUREKA_CRITIC_RATE_LIMIT)',
|
|
2042
|
+
true
|
|
2043
|
+
);
|
|
2044
|
+
}
|
|
2045
|
+
_eurekaCriticRateWindow.push(now);
|
|
2046
|
+
|
|
2047
|
+
// (3) The thin call: criticRule is PURE (D4) -- it takes the D1 payload and
|
|
2048
|
+
// returns {verdict, confidence, reasoning_tag}. No room-directory, no
|
|
2049
|
+
// plugin-root, no larry-context closure is referenced anywhere in this
|
|
2050
|
+
// handler (D5: the stale-room bug cannot recur on a surface it never touches).
|
|
2051
|
+
let ruling;
|
|
2052
|
+
try {
|
|
2053
|
+
ruling = eurekaCritic.criticRule(payload);
|
|
2054
|
+
} catch (err) {
|
|
2055
|
+
return textResponse('eureka_critic: ' + (err && err.message ? err.message : String(err)), true);
|
|
2056
|
+
}
|
|
2057
|
+
_eurekaCriticDedupeCache.set(payloadHash, { ruling: ruling, ts: now });
|
|
2058
|
+
return textResponse(JSON.stringify(ruling));
|
|
2059
|
+
}
|
|
2060
|
+
);
|
|
2061
|
+
|
|
2062
|
+
// -------------------------------------------------------------------------
|
|
2063
|
+
// 11. The tools/ auto-discovery seam (Phase 198-04, Task 1). LAZILY required
|
|
2064
|
+
// here -- never at module top -- so this file finishes assigning its own
|
|
2065
|
+
// module.exports (below) before lib/mcp/register-core-tools.cjs (which
|
|
2066
|
+
// requires lib/mcp/tools/*.cjs, and those modules require this file back for
|
|
2067
|
+
// SECTION_RE/safeResolveSection reuse) ever runs. By the time
|
|
2068
|
+
// registerRouterTools() is actually CALLED (from bin/mindrian-mcp-server.cjs,
|
|
2069
|
+
// after this module has fully loaded), the require cache already holds the
|
|
2070
|
+
// complete exports object, so there is no cycle. Room/graph/... tool modules
|
|
2071
|
+
// are DISJOINT files from this router; later plans add new
|
|
2072
|
+
// lib/mcp/tools/*.cjs modules without ever editing this function again.
|
|
2073
|
+
// -------------------------------------------------------------------------
|
|
2074
|
+
const { registerCoreTools } = require('./register-core-tools.cjs');
|
|
2075
|
+
registerCoreTools(server, { fallbackRoomDir: roomDir, pluginRoot, surface });
|
|
2076
|
+
}
|
|
2077
|
+
|
|
2078
|
+
// Phase 198-02 (SPEC-2 Part 11 born-wired seam): room_bind's connector
|
|
2079
|
+
// descriptor, exported as the SOURCE of truth. Plan 04 extends
|
|
2080
|
+
// build-connector-registry.cjs to discover this array (and every future tool
|
|
2081
|
+
// module's `connectors` export) and regenerate data/mcp-tool-connectors.json
|
|
2082
|
+
// from it -- this file is NEVER hand-edited (mirrors the existing
|
|
2083
|
+
// data/connector-registry.json "do not edit by hand" pattern). hitl_shape
|
|
2084
|
+
// F.8 names the binding-card-on-ambiguity fork room_bind can return.
|
|
2085
|
+
const MCP_TOOL_CONNECTORS = [
|
|
2086
|
+
{
|
|
2087
|
+
tool: 'room_bind',
|
|
2088
|
+
surface: 'room_bind',
|
|
2089
|
+
connector: 'mcp-tool',
|
|
2090
|
+
hitl_shape: 'F.8',
|
|
2091
|
+
hitl_why: 'A session with no explicit room and no cwd auto-bind is genuinely ambiguous; room_bind returns needs_binding_card:true instead of guessing, and the F.8 card asks the human which room this session writes to (fires once per session, D-03/D-05).',
|
|
2092
|
+
},
|
|
2093
|
+
];
|
|
2094
|
+
|
|
2095
|
+
module.exports = { registerRouterTools, ALL_TOOL_COMMANDS, MCP_TOOL_CONNECTORS };
|
|
2096
|
+
|
|
2097
|
+
// 87-05: Export validation primitives for unit tests
|
|
2098
|
+
// (kept out of the registerRouterTools surface area).
|
|
2099
|
+
module.exports._test = {
|
|
2100
|
+
SECTION_RE,
|
|
2101
|
+
sectionOptional,
|
|
2102
|
+
sectionRequired,
|
|
2103
|
+
safeResolveSection,
|
|
2104
|
+
opportunitySchema,
|
|
2105
|
+
loadReference,
|
|
2106
|
+
resolveWriteTargetDir,
|
|
2107
|
+
runResearchPipeline,
|
|
2108
|
+
// Phase 232.1 D-07: exported so the density line's counting/formatting can be
|
|
2109
|
+
// asserted in isolation, without spinning a fake MCP server.
|
|
2110
|
+
roomDensityLine,
|
|
2111
|
+
// Quick 260903-kwl: exported so tests/test-kwl-meeting-mcp-honesty.cjs can
|
|
2112
|
+
// drive every meeting sub-command off the module's own list rather than a
|
|
2113
|
+
// hand-typed literal, so a fourth command added later cannot escape the check.
|
|
2114
|
+
MEETING_COMMANDS,
|
|
2115
|
+
};
|