@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,1696 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
'use strict';
|
|
3
|
+
|
|
4
|
+
/*
|
|
5
|
+
* Copyright (c) 2026 Mindrian. BSL 1.1.
|
|
6
|
+
*
|
|
7
|
+
* Phase 91-00 -- Navigation Engine core (L5 Decision layer)
|
|
8
|
+
* ==========================================================
|
|
9
|
+
* Single export `decide(turn, context) -> decision` composes the five
|
|
10
|
+
* input signals (ICM scope + SQL relations + Feynman-MINTO reasoning +
|
|
11
|
+
* BRAIN.md derivations + intent/persona) through a structured decision
|
|
12
|
+
* function (NOT a weighted score per locked decision D-02) and returns
|
|
13
|
+
* a typed decision struct with full trace.
|
|
14
|
+
*
|
|
15
|
+
* Contract source of truth:
|
|
16
|
+
* .planning/research/navigation-engine-brain-interface.md (v1, frozen
|
|
17
|
+
* at Phase 90-09).
|
|
18
|
+
*
|
|
19
|
+
* Canon Part 8 posture (READ THIS FIRST):
|
|
20
|
+
* This module is a PURE LOCAL READER. It NEVER queries Brain. It
|
|
21
|
+
* NEVER reads BRAIN.md directly via fs.readFileSync; the only allowed
|
|
22
|
+
* read path is folder-memory.cjs readQuadruple. It NEVER constructs
|
|
23
|
+
* Cypher queries. It NEVER embeds BRAIN.md body strings in network
|
|
24
|
+
* payloads. The two PERMITTED brain-client touches are
|
|
25
|
+
* brain-client.isAvailable() (boolean, no network when cached) and
|
|
26
|
+
* brain-client.schema() (scalar, no user content leaves the local
|
|
27
|
+
* process). Both are optional; the engine works fully offline.
|
|
28
|
+
*
|
|
29
|
+
* Per Section 2.4: a single readQuadruple result MAY be cached for the
|
|
30
|
+
* duration of one decide() call. Cross-call caching is FORBIDDEN.
|
|
31
|
+
*
|
|
32
|
+
* Per locked decision D-02: this engine is NOT a weighted score across
|
|
33
|
+
* the five signals. Brain's section weights (0.35 + 0.20 + 0.15 + ...)
|
|
34
|
+
* stay INSIDE the BRAIN.md contribution block; the staleness multiplier
|
|
35
|
+
* scales that block as a whole. Inter-signal composition is rule-based
|
|
36
|
+
* with explicit precedence, not arithmetic.
|
|
37
|
+
*
|
|
38
|
+
* License: BSL 1.1.
|
|
39
|
+
*/
|
|
40
|
+
|
|
41
|
+
const shared = require('./navigation-engine-shared.cjs');
|
|
42
|
+
const folderMemory = require('./folder-memory.cjs'); // for readQuadruple
|
|
43
|
+
// CASC-02 (Phase 142): the navigation.cjs chokepoint is the ONLY allowed local
|
|
44
|
+
// graph read path (Canon Part 9: SQL is the local mind). decide() reads the
|
|
45
|
+
// navigated neighborhood (getRoomContext's Leg C, getNeighborhood-ranked) that the
|
|
46
|
+
// caller threaded onto context.roomContext through this same chokepoint. We require
|
|
47
|
+
// it here as the Part-8 wiring anchor; the caller owns the db handle, so this module
|
|
48
|
+
// never opens room.db and adds ZERO new Brain egress surface (the neighborhood rides
|
|
49
|
+
// in via context as scalars/slugs/scores only).
|
|
50
|
+
const navigation = require('./navigation.cjs'); // chokepoint anchor (Part 9)
|
|
51
|
+
// Phase 144 (NAV-01): the Phase 143 sensor spine. decide() CONSUMES the
|
|
52
|
+
// candidate reaches dispatchSensors PRODUCES; a fired reach maps to a CANONICAL
|
|
53
|
+
// VERB so the router (READ-ONLY for 144) flips routing_source legacy -> engine as
|
|
54
|
+
// a pure consequence (its Precedence Rule 1: validateVerb===true). dispatchSensors
|
|
55
|
+
// is pure / sync / LOCAL-first (no Brain, no network), so this require adds ZERO
|
|
56
|
+
// Brain egress surface. We never edit the sensor module (Phase 143 fence).
|
|
57
|
+
const { dispatchSensors } = require('./insight-sensors.cjs');
|
|
58
|
+
// Phase 203-03: the reusable-expert ctx-assembly producer. Reads CONFIRMED
|
|
59
|
+
// SyntheticExpert nodes from a caller-threaded room.db handle at ctx-assembly time
|
|
60
|
+
// and threads the closed reusable-expert scalars onto sensorCtx (mirroring the
|
|
61
|
+
// MED-01 cortex producer below), so the registered sensorExpertSkill can fire the
|
|
62
|
+
// context_block save-as-skill offer. The db read is the producer's job; the sensor
|
|
63
|
+
// stays pure. The engine never OPENS room.db -- it uses the caller-threaded handle.
|
|
64
|
+
const { detectExpertSkillCandidates } = require('./sensors/sensor-expert-skill.cjs');
|
|
65
|
+
// Phase 244 Plan 05 (TRIG-01): the content-relevance ctx-assembly producer.
|
|
66
|
+
// Queries the ALREADY-SHIPPED tri-modal-index.lexicalSearch (bm25 FTS5) over a
|
|
67
|
+
// caller-threaded room.db handle at ctx-assembly time and threads the closed
|
|
68
|
+
// content-relevance scalars onto sensorCtx (mirroring the SENS-11 producer
|
|
69
|
+
// above), so the registered sensorContentRelevance can fire the context_block
|
|
70
|
+
// content-relevance offer. The db read is the producer's job; the sensor
|
|
71
|
+
// stays pure. The engine never OPENS room.db -- it uses the caller-threaded handle.
|
|
72
|
+
const { detectContentRelevance } = require('./sensors/sensor-content-relevance.cjs');
|
|
73
|
+
// Phase 177-09 (BCH-07): the SEAM 3 behavioral-channel kill-switch is read from
|
|
74
|
+
// calibration-gate.cjs (default LOCKED, shipped in 177-08) via the require idiom
|
|
75
|
+
// -- NEVER a re-typed `false` literal. The require is LAZY (inside
|
|
76
|
+
// readBehavioralChannelArmed, called from resolveFireSkill) to avoid the import
|
|
77
|
+
// cycle: calibration-gate requires f-selector-ranker, which requires THIS module
|
|
78
|
+
// for RECOMMENDED_CONFIDENCE_FLOOR -- a top-level require here would force
|
|
79
|
+
// f-selector-ranker to load before this module finishes exporting, leaving its
|
|
80
|
+
// computed CEILING NaN. Lazy require lets this module finish loading first.
|
|
81
|
+
// calibration-gate.cjs is pure-local (no Brain, no network) -> ZERO Brain egress.
|
|
82
|
+
function readBehavioralChannelArmed() {
|
|
83
|
+
return require('./navigation/calibration-gate.cjs').BEHAVIORAL_CHANNEL_ARMED;
|
|
84
|
+
}
|
|
85
|
+
// brain-client is OPTIONAL: required only if downstream callers want to
|
|
86
|
+
// pass an explicit brainAvailable hint, but isAvailable() is also fine
|
|
87
|
+
// from the call site. We do NOT require() it here to keep the dependency
|
|
88
|
+
// graph minimal and to make grep-guards trivially passable.
|
|
89
|
+
|
|
90
|
+
const STALENESS_MULTIPLIERS = shared.STALENESS_MULTIPLIERS;
|
|
91
|
+
// The dead weighted-section-score import was removed (Phase 150-04 MEM-07):
|
|
92
|
+
// composition stays rule-based per 150-CONTEXT D-03; it had no live consumer.
|
|
93
|
+
const REQUIRED_SECTION_KEYS = shared.REQUIRED_SECTION_KEYS;
|
|
94
|
+
const OPTIONAL_SECTION_KEYS = shared.OPTIONAL_SECTION_KEYS;
|
|
95
|
+
const CANONICAL_VERBS = shared.CANONICAL_VERBS;
|
|
96
|
+
|
|
97
|
+
// Wicked-score escalation threshold per Canon Appendix E rule R4.
|
|
98
|
+
const WICKED_ESCALATION_THRESHOLD = 8;
|
|
99
|
+
|
|
100
|
+
// Confidence floor for Section 6 RECOMMENDED gate.
|
|
101
|
+
const RECOMMENDED_CONFIDENCE_FLOOR = 0.7;
|
|
102
|
+
|
|
103
|
+
// ---------- Pattern parsers (tolerant; never throw) ----------
|
|
104
|
+
|
|
105
|
+
/**
|
|
106
|
+
* Parse pattern_matches body for `confidence: <float>` candidates.
|
|
107
|
+
* Returns the highest confidence found in [0, 1], or null when no
|
|
108
|
+
* candidate is parseable. Tolerant of body whitespace, multi-line, and
|
|
109
|
+
* forward-compat extra fields.
|
|
110
|
+
*/
|
|
111
|
+
function extractHighestConfidence(body) {
|
|
112
|
+
if (typeof body !== 'string' || body.length === 0) return null;
|
|
113
|
+
const re = /confidence\s*:\s*([01](?:\.\d+)?|0?\.\d+)/gi;
|
|
114
|
+
let best = null;
|
|
115
|
+
let m;
|
|
116
|
+
while ((m = re.exec(body)) !== null) {
|
|
117
|
+
const v = parseFloat(m[1]);
|
|
118
|
+
if (!isNaN(v) && v >= 0.0 && v <= 1.0) {
|
|
119
|
+
if (best === null || v > best) best = v;
|
|
120
|
+
}
|
|
121
|
+
}
|
|
122
|
+
return best;
|
|
123
|
+
}
|
|
124
|
+
|
|
125
|
+
/**
|
|
126
|
+
* Extract the verb associated with the highest-confidence candidate in
|
|
127
|
+
* pattern_matches. Returns null when no candidate is parseable. Verbs
|
|
128
|
+
* MUST appear before the `(confidence: ...)` parenthetical, matching
|
|
129
|
+
* Canon Part 3 vocabulary.
|
|
130
|
+
*
|
|
131
|
+
* Body shape (per Plan 90-01 deriveSection emit):
|
|
132
|
+
* - Run Methodology (confidence: 0.85, source: SWOT)
|
|
133
|
+
* - Reformulate (confidence: 0.72, source: 5 Whys)
|
|
134
|
+
*/
|
|
135
|
+
function extractTopCandidateVerb(body) {
|
|
136
|
+
if (typeof body !== 'string' || body.length === 0) return null;
|
|
137
|
+
const lines = body.split(/\r?\n/);
|
|
138
|
+
let bestConf = -1;
|
|
139
|
+
let bestVerb = null;
|
|
140
|
+
for (const line of lines) {
|
|
141
|
+
// Match `<prefix> <verb> (confidence: 0.NN ...)`
|
|
142
|
+
const m = /^[\s\-*]*(.+?)\s*\(\s*confidence\s*:\s*([01](?:\.\d+)?|0?\.\d+)/i.exec(line);
|
|
143
|
+
if (!m) continue;
|
|
144
|
+
const verb = m[1].trim();
|
|
145
|
+
const conf = parseFloat(m[2]);
|
|
146
|
+
if (isNaN(conf)) continue;
|
|
147
|
+
// Resolve verb against canonical vocabulary (case-insensitive
|
|
148
|
+
// contains-match; closed set).
|
|
149
|
+
let resolved = null;
|
|
150
|
+
for (const v of CANONICAL_VERBS) {
|
|
151
|
+
if (verb.toLowerCase() === v.toLowerCase()) {
|
|
152
|
+
resolved = v;
|
|
153
|
+
break;
|
|
154
|
+
}
|
|
155
|
+
}
|
|
156
|
+
if (resolved !== null && conf > bestConf) {
|
|
157
|
+
bestConf = conf;
|
|
158
|
+
bestVerb = resolved;
|
|
159
|
+
}
|
|
160
|
+
}
|
|
161
|
+
return bestVerb;
|
|
162
|
+
}
|
|
163
|
+
|
|
164
|
+
/**
|
|
165
|
+
* Phase 245 (245-05) -- the Brain pattern_matches OBSERVATION, computed
|
|
166
|
+
* UNCONDITIONALLY on every decide() turn where a parseable candidate exists.
|
|
167
|
+
*
|
|
168
|
+
* WHY THIS EXISTS (D-25, 245-RESEARCH.md F-2). resolveFireSkill() below has a
|
|
169
|
+
* strict precedence order, and its step (2) -- a fired sensor reach -- RETURNS
|
|
170
|
+
* EARLY. Step (3), the Brain pattern_matches branch, is therefore UNREACHABLE on
|
|
171
|
+
* any turn where a sensor fired, which is essentially every observed turn. D-24
|
|
172
|
+
* diagnosed the Brain verb as STARVED: the only two pre-existing callers of
|
|
173
|
+
* extractTopCandidateVerb are that unreachable step (3) and the RECOMMENDED-marker
|
|
174
|
+
* gate, which is itself gated on tierMode === 'mode_a' && !attributionBreach &&
|
|
175
|
+
* confidence >= 0.70 and which discards the verb after using it as a boolean. On a
|
|
176
|
+
* normal sensor-fires turn the verb string existed NOWHERE downstream.
|
|
177
|
+
*
|
|
178
|
+
* This observation is deliberately UNGATED: not on tierMode, not on weightApplied,
|
|
179
|
+
* not on attributionBreach, not on RECOMMENDED_CONFIDENCE_FLOOR. Those gates govern
|
|
180
|
+
* whether the verb may FIRE a skill or RENDER a marker. This is an observation of
|
|
181
|
+
* what Brain suggested; the consumer (245-07's fusion) applies its own tier policy.
|
|
182
|
+
*
|
|
183
|
+
* NOT a substitute for, and not derivable from, fire_skill or
|
|
184
|
+
* context_assembly.decision_grounding: 245-RESEARCH.md Pitfall 2 is explicit that
|
|
185
|
+
* on a sensor-fires turn decision_grounding reads the SENSOR's reach_id, never
|
|
186
|
+
* 'brain_verb'. Reading the Brain verb off either would silently re-implement the
|
|
187
|
+
* exact starvation this function exists to fix. These fields are the ONLY source.
|
|
188
|
+
*
|
|
189
|
+
* Part 8: verb is a frozen CANONICAL_VERBS member or null (extractTopCandidateVerb
|
|
190
|
+
* resolves by exact case-insensitive match against the closed set, so injected free
|
|
191
|
+
* prose yields null); confidence is a bare number or null. No body text, no source
|
|
192
|
+
* string, no section name is copied out.
|
|
193
|
+
*
|
|
194
|
+
* Soft-fail: a malformed brain object can never throw out of decide(), matching the
|
|
195
|
+
* discipline every other trace builder in this file uses.
|
|
196
|
+
*
|
|
197
|
+
* @param {object|null} brain quadruple.brain, or null
|
|
198
|
+
* @returns {{verb: (string|null), confidence: (number|null)}}
|
|
199
|
+
*/
|
|
200
|
+
function brainPatternVerbObservation(brain) {
|
|
201
|
+
try {
|
|
202
|
+
const pm = brain && brain.sections && brain.sections.pattern_matches;
|
|
203
|
+
if (pm && typeof pm.body === 'string' && pm.body.length > 0) {
|
|
204
|
+
return {
|
|
205
|
+
verb: extractTopCandidateVerb(pm.body),
|
|
206
|
+
confidence: extractHighestConfidence(pm.body),
|
|
207
|
+
};
|
|
208
|
+
}
|
|
209
|
+
} catch (_e) {
|
|
210
|
+
// fall through to the null observation
|
|
211
|
+
}
|
|
212
|
+
return { verb: null, confidence: null };
|
|
213
|
+
}
|
|
214
|
+
|
|
215
|
+
/**
|
|
216
|
+
* Parse wicked_indicators body for `wicked_score: <int>`. Returns 0 when
|
|
217
|
+
* no score is parseable.
|
|
218
|
+
*/
|
|
219
|
+
function extractWickedScore(body) {
|
|
220
|
+
if (typeof body !== 'string' || body.length === 0) return 0;
|
|
221
|
+
const m = /wicked_score\s*:\s*(\d+)/i.exec(body);
|
|
222
|
+
if (!m) return 0;
|
|
223
|
+
const v = parseInt(m[1], 10);
|
|
224
|
+
if (isNaN(v) || v < 0) return 0;
|
|
225
|
+
return v;
|
|
226
|
+
}
|
|
227
|
+
|
|
228
|
+
// ---------- Trace builders ----------
|
|
229
|
+
|
|
230
|
+
function buildIcmScope(quadruple, turn) {
|
|
231
|
+
const room = quadruple && quadruple.room;
|
|
232
|
+
return {
|
|
233
|
+
section_path: turn && turn.sectionPath ? turn.sectionPath : null,
|
|
234
|
+
room_exists: room && room.exists ? true : false,
|
|
235
|
+
artifact_count: quadruple && quadruple.state ? (quadruple.state.artifact_count || 0) : 0,
|
|
236
|
+
};
|
|
237
|
+
}
|
|
238
|
+
|
|
239
|
+
function buildSqlSignals(_quadruple, _turn) {
|
|
240
|
+
// Phase 91-00 ships the engine surface; the SQL signal is consumed
|
|
241
|
+
// from a future plan that wires room.db edge counts. For this plan
|
|
242
|
+
// the slot is structural (so /mos:explain-decision can render it) but
|
|
243
|
+
// contributes no rules. Returning an object (not null) keeps the
|
|
244
|
+
// five-signal capture invariant met (Test 20).
|
|
245
|
+
return { edges_consulted: 0, contradictions_detected: 0 };
|
|
246
|
+
}
|
|
247
|
+
|
|
248
|
+
function buildMintoReasoning(quadruple) {
|
|
249
|
+
const r = quadruple && quadruple.reasoning;
|
|
250
|
+
if (!r) {
|
|
251
|
+
return { exists: false, reasoning_health_score: 0, governing_thought: null, is_stale: true };
|
|
252
|
+
}
|
|
253
|
+
return {
|
|
254
|
+
exists: r.exists === true,
|
|
255
|
+
reasoning_health_score:
|
|
256
|
+
typeof r.reasoning_health_score === 'number' ? r.reasoning_health_score : 0,
|
|
257
|
+
governing_thought: typeof r.governing_thought === 'string' ? r.governing_thought : null,
|
|
258
|
+
is_stale: r.is_stale === true,
|
|
259
|
+
};
|
|
260
|
+
}
|
|
261
|
+
|
|
262
|
+
function buildIntentPersona(context) {
|
|
263
|
+
const persona = context && context.userPersona ? context.userPersona : null;
|
|
264
|
+
const intent = context && context.intentSignal ? context.intentSignal : null;
|
|
265
|
+
return {
|
|
266
|
+
archetype: persona && persona.archetype ? persona.archetype : null,
|
|
267
|
+
problem_type: persona && persona.problem_type ? persona.problem_type : null,
|
|
268
|
+
venture_stage: persona && persona.venture_stage ? persona.venture_stage : null,
|
|
269
|
+
intent: intent && intent.intent ? intent.intent : null,
|
|
270
|
+
intent_confidence: intent && typeof intent.confidence === 'number' ? intent.confidence : null,
|
|
271
|
+
};
|
|
272
|
+
}
|
|
273
|
+
|
|
274
|
+
// ---------- CASC-02: navigated-neighborhood trace builder ----------
|
|
275
|
+
|
|
276
|
+
/**
|
|
277
|
+
* buildNavigatedNeighborhood(roomContext) -> { ranked: [...] } | null
|
|
278
|
+
*
|
|
279
|
+
* CASC-02 (Phase 142): reflect the getNeighborhood-ranked Leg C of a getRoomContext
|
|
280
|
+
* fusion (threaded onto context.roomContext by the caller through the navigation.cjs
|
|
281
|
+
* chokepoint) into the decision trace. This is what makes the Phase 109 spine
|
|
282
|
+
* NAVIGATE: routing reflects the ranked graph neighborhood, not merely stored-edge
|
|
283
|
+
* presence.
|
|
284
|
+
*
|
|
285
|
+
* Canon Part 8 (HARD): the projection carries SCALARS / SLUGS / SCORES ONLY -- node
|
|
286
|
+
* id, type, incoming edge type, depth, and ranking score. It NEVER copies a node's
|
|
287
|
+
* raw body / prose / properties. The neighborhood is a LOCAL routing signal; it never
|
|
288
|
+
* rides toward the Brain.
|
|
289
|
+
*
|
|
290
|
+
* Defensive: a null / malformed / Promise / empty roomContext returns null so decide()
|
|
291
|
+
* falls through to the legacy behavior with the trace field at its safe default. Never
|
|
292
|
+
* throws. A thenable (un-awaited getRoomContext Promise) has no synchronous
|
|
293
|
+
* relevantNodes, so it degrades to null -- the caller is expected to await and pass the
|
|
294
|
+
* RESOLVED fusion object (the Task-1 contract).
|
|
295
|
+
*/
|
|
296
|
+
function buildNavigatedNeighborhood(roomContext) {
|
|
297
|
+
if (!roomContext || typeof roomContext !== 'object') return null;
|
|
298
|
+
// A bare Promise / thenable cannot be read synchronously here; degrade to null.
|
|
299
|
+
if (typeof roomContext.then === 'function' && !Array.isArray(roomContext.relevantNodes)) {
|
|
300
|
+
return null;
|
|
301
|
+
}
|
|
302
|
+
const nodes = roomContext.relevantNodes;
|
|
303
|
+
if (!Array.isArray(nodes) || nodes.length === 0) return null;
|
|
304
|
+
|
|
305
|
+
const ranked = [];
|
|
306
|
+
for (const n of nodes) {
|
|
307
|
+
if (!n || typeof n !== 'object') continue;
|
|
308
|
+
// Scalars / slugs / scores ONLY (Part 8). No properties, no claim/summary prose.
|
|
309
|
+
ranked.push({
|
|
310
|
+
id: typeof n.id === 'string' ? n.id : null,
|
|
311
|
+
type: typeof n.type === 'string' ? n.type : null,
|
|
312
|
+
edgeTypeIn: typeof n.edgeTypeIn === 'string' ? n.edgeTypeIn : null,
|
|
313
|
+
depth: typeof n.depth === 'number' ? n.depth : null,
|
|
314
|
+
score: typeof n.score === 'number' ? n.score : null,
|
|
315
|
+
});
|
|
316
|
+
}
|
|
317
|
+
if (ranked.length === 0) return null;
|
|
318
|
+
|
|
319
|
+
const seedNodeId = roomContext._meta && typeof roomContext._meta.seedNodeId === 'string'
|
|
320
|
+
? roomContext._meta.seedNodeId
|
|
321
|
+
: null;
|
|
322
|
+
|
|
323
|
+
return {
|
|
324
|
+
ranked: ranked,
|
|
325
|
+
count: ranked.length,
|
|
326
|
+
seed_node_id: seedNodeId,
|
|
327
|
+
// top_node_id is the highest-ranked neighbor slug -- a scalar routing handle.
|
|
328
|
+
top_node_id: ranked[0].id,
|
|
329
|
+
};
|
|
330
|
+
}
|
|
331
|
+
|
|
332
|
+
// ---------- Phase 144 Task 2: Zep-shaped LOCAL trace.context_assembly ----------
|
|
333
|
+
|
|
334
|
+
/**
|
|
335
|
+
* buildContextAssembly(navigatedNeighborhood, sensorReaches, decisionGrounding)
|
|
336
|
+
* -> { user_summary, facts, decision_grounding }
|
|
337
|
+
*
|
|
338
|
+
* Phase 144 (Task 2): adopt Zep's Smart-Context-Assembly OUTPUT SHAPE inside the
|
|
339
|
+
* decision TRACE ONLY. Every byte is LOCAL trace JSON; NOTHING reaches the Brain.
|
|
340
|
+
*
|
|
341
|
+
* user_summary top-3 navigatedNeighborhood node SCALARS (id / type / score)
|
|
342
|
+
* each carrying LOCAL temporal scalars { first_seen, last_updated }
|
|
343
|
+
* read ONLY from the neighborhood scalars (null when the source
|
|
344
|
+
* did not supply them -- never a fabricated value).
|
|
345
|
+
* facts the fired sensor reach_ids + evidence SCALARS
|
|
346
|
+
* (counts / enums / phase ids only -- makeReach already froze
|
|
347
|
+
* evidence to a flat primitive bag), each with the same LOCAL
|
|
348
|
+
* temporal scalars (null when the reach did not supply them).
|
|
349
|
+
* decision_grounding which fact (reach_id | 'brain_verb' | 'wicked' |
|
|
350
|
+
* 'neighborhood' | null) justified the chosen fire_skill.
|
|
351
|
+
*
|
|
352
|
+
* Part 8 (HARD): user_summary + facts carry SCALARS / SLUGS / ENUMS only. No
|
|
353
|
+
* node body, no reach.signal user value, no reach.dispatch beyond the handle, no
|
|
354
|
+
* prose. This mirrors buildNavigatedNeighborhood's projection discipline.
|
|
355
|
+
*/
|
|
356
|
+
function buildContextAssembly(navigatedNeighborhood, sensorReaches, decisionGrounding) {
|
|
357
|
+
const userSummary = [];
|
|
358
|
+
if (navigatedNeighborhood && Array.isArray(navigatedNeighborhood.ranked)) {
|
|
359
|
+
const top = navigatedNeighborhood.ranked.slice(0, 3);
|
|
360
|
+
for (const n of top) {
|
|
361
|
+
if (!n || typeof n !== 'object') continue;
|
|
362
|
+
userSummary.push({
|
|
363
|
+
id: typeof n.id === 'string' ? n.id : null,
|
|
364
|
+
type: typeof n.type === 'string' ? n.type : null,
|
|
365
|
+
score: typeof n.score === 'number' ? n.score : null,
|
|
366
|
+
// LOCAL temporal scalars read ONLY from the neighborhood scalars; null
|
|
367
|
+
// when the source did not supply them (never fabricated).
|
|
368
|
+
first_seen: typeof n.first_seen === 'number' || typeof n.first_seen === 'string' ? n.first_seen : null,
|
|
369
|
+
last_updated: typeof n.last_updated === 'number' || typeof n.last_updated === 'string' ? n.last_updated : null,
|
|
370
|
+
});
|
|
371
|
+
}
|
|
372
|
+
}
|
|
373
|
+
|
|
374
|
+
const facts = [];
|
|
375
|
+
if (Array.isArray(sensorReaches)) {
|
|
376
|
+
for (const r of sensorReaches) {
|
|
377
|
+
if (!r || typeof r !== 'object') continue;
|
|
378
|
+
const ev = (r.evidence && typeof r.evidence === 'object') ? r.evidence : {};
|
|
379
|
+
// evidence is already a frozen flat scalar bag (makeReach guarantees it).
|
|
380
|
+
facts.push({
|
|
381
|
+
reach_id: typeof r.reach_id === 'string' ? r.reach_id : null,
|
|
382
|
+
posture: typeof r.posture === 'string' ? r.posture : null,
|
|
383
|
+
evidence: ev,
|
|
384
|
+
// LOCAL temporal scalars sourced ONLY from the reach evidence scalars;
|
|
385
|
+
// null when the reach did not supply them (never fabricated).
|
|
386
|
+
first_seen: typeof ev.first_seen === 'number' || typeof ev.first_seen === 'string' ? ev.first_seen : null,
|
|
387
|
+
last_updated: typeof ev.last_updated === 'number' || typeof ev.last_updated === 'string' ? ev.last_updated : null,
|
|
388
|
+
});
|
|
389
|
+
}
|
|
390
|
+
}
|
|
391
|
+
|
|
392
|
+
return {
|
|
393
|
+
user_summary: userSummary,
|
|
394
|
+
facts: facts,
|
|
395
|
+
decision_grounding: decisionGrounding !== undefined ? decisionGrounding : null,
|
|
396
|
+
};
|
|
397
|
+
}
|
|
398
|
+
|
|
399
|
+
/**
|
|
400
|
+
* groundingForFireSkill(fireSkill, sensorReaches, brain, navigatedNeighborhood)
|
|
401
|
+
* -> reach_id | 'wicked' | 'brain_verb' | 'neighborhood' | null
|
|
402
|
+
*
|
|
403
|
+
* Phase 144 (Task 2): name which LOCAL fact justified the chosen fire_skill, for
|
|
404
|
+
* trace.context_assembly.decision_grounding. Mirrors the resolveFireSkill
|
|
405
|
+
* precedence order (wicked > sensor reach > brain verb > fallback). Pure scalar
|
|
406
|
+
* reasoning; reads no prose.
|
|
407
|
+
*/
|
|
408
|
+
function groundingForFireSkill(fireSkill, sensorReaches, brain, navigatedNeighborhood) {
|
|
409
|
+
if (fireSkill === null || fireSkill === undefined) return null;
|
|
410
|
+
// Wicked soft-systems return is the only family-slug the sensor/verb paths
|
|
411
|
+
// never produce, so a 'soft-systems' fire_skill is grounded in wicked.
|
|
412
|
+
if (fireSkill === 'soft-systems') return 'wicked';
|
|
413
|
+
// A fired sensor reach grounds the canonical-verb fire_skill: the top reach
|
|
414
|
+
// (canonical REACH_IDS order) drove it per resolveFireSkill step (2).
|
|
415
|
+
if (Array.isArray(sensorReaches) && sensorReaches.length > 0) {
|
|
416
|
+
const top = sensorReaches[0];
|
|
417
|
+
if (top && typeof top === 'object' && reachIdToSkillFamily(top.reach_id) === fireSkill) {
|
|
418
|
+
return typeof top.reach_id === 'string' ? top.reach_id : null;
|
|
419
|
+
}
|
|
420
|
+
}
|
|
421
|
+
// Otherwise the BRAIN.md pattern_matches / context-engine path set it.
|
|
422
|
+
if (brain && brain.sections) return 'brain_verb';
|
|
423
|
+
// Last resort: a neighborhood-only contribution.
|
|
424
|
+
if (navigatedNeighborhood !== null) return 'neighborhood';
|
|
425
|
+
return null;
|
|
426
|
+
}
|
|
427
|
+
|
|
428
|
+
// ---------- Section consumption ----------
|
|
429
|
+
|
|
430
|
+
function consumedSections(brain) {
|
|
431
|
+
if (!brain || typeof brain !== 'object' || !brain.sections) return [];
|
|
432
|
+
const out = [];
|
|
433
|
+
// Required first (canonical order), then optional.
|
|
434
|
+
for (const k of REQUIRED_SECTION_KEYS) {
|
|
435
|
+
const v = brain.sections[k];
|
|
436
|
+
if (v !== null && v !== undefined && typeof v === 'object' && typeof v.body === 'string' && v.body.length > 0 && !/^\s*\(no signal\)\s*$/i.test(v.body)) {
|
|
437
|
+
out.push(k);
|
|
438
|
+
}
|
|
439
|
+
}
|
|
440
|
+
for (const k of OPTIONAL_SECTION_KEYS) {
|
|
441
|
+
const v = brain.sections[k];
|
|
442
|
+
if (v !== null && v !== undefined && typeof v === 'object' && typeof v.body === 'string' && v.body.length > 0 && !/^\s*\(no signal\)\s*$/i.test(v.body)) {
|
|
443
|
+
out.push(k);
|
|
444
|
+
}
|
|
445
|
+
}
|
|
446
|
+
return out;
|
|
447
|
+
}
|
|
448
|
+
|
|
449
|
+
// ---------- Five-signal composition (rule-based per D-02) ----------
|
|
450
|
+
|
|
451
|
+
/**
|
|
452
|
+
* reachIdToSkillFamily(reachId) -> canonical-verb | null
|
|
453
|
+
*
|
|
454
|
+
* Phase 144 (NAV-01): map the 5 FROZEN reach_ids
|
|
455
|
+
* (lib/core/sensors/sensor-types.cjs REACH_IDS) to one of the closed 10
|
|
456
|
+
* CANONICAL_VERBS. This is the keystone of the legacy -> engine flip: the router
|
|
457
|
+
* (lib/core/skill-activation-router.cjs::validateVerb) validates fire_skill
|
|
458
|
+
* against CANONICAL_VERBS, NOT against skill-family slugs. So a sensor reach must
|
|
459
|
+
* resolve to a CANONICAL VERB for the router's Precedence Rule 1
|
|
460
|
+
* (validateVerb===true) to flip routing_source to engine. (Mirrors the
|
|
461
|
+
* verbToSkillFamily switch shape; the table is closed -- a non-member key returns
|
|
462
|
+
* null and the engine never invents a reach.)
|
|
463
|
+
*
|
|
464
|
+
* context_block -> 'Run Methodology'
|
|
465
|
+
* contradiction -> "Devil's Advocate"
|
|
466
|
+
* cross_room -> 'Navigate Graph'
|
|
467
|
+
* brain_consult -> 'Run Methodology'
|
|
468
|
+
* deep_research -> 'Spawn Sub-Agent'
|
|
469
|
+
* hats -> 'Synthesize'
|
|
470
|
+
*
|
|
471
|
+
* The `hats` case (Phase 172-05) fills the missing engine MAPPING for the
|
|
472
|
+
* already-frozen 6th reach (minted by the Phase-148 D-09 amendment). A fired
|
|
473
|
+
* `hats` reach runs a Six Thinking Hats / Blue-Hat synthesis pass, so it maps
|
|
474
|
+
* to the EXISTING canonical verb 'Synthesize' (verbToSkillFamily resolves it to
|
|
475
|
+
* the 'blue-hat' skill family -- the Blue Hat that wraps a hats pass). NO new
|
|
476
|
+
* canonical verb is minted; 'Synthesize' is a member of the frozen Part-3
|
|
477
|
+
* CANONICAL_VERBS set. This is purely the engine-side mapping so a fired hats
|
|
478
|
+
* reach can flip routing_source legacy->engine; it does NOT add a sensor that
|
|
479
|
+
* FIRES `hats` at runtime (that is out of scope, deferred by the projection
|
|
480
|
+
* contract).
|
|
481
|
+
*/
|
|
482
|
+
function reachIdToSkillFamily(reachId) {
|
|
483
|
+
switch (reachId) {
|
|
484
|
+
case 'context_block': return 'Run Methodology';
|
|
485
|
+
case 'contradiction': return "Devil's Advocate";
|
|
486
|
+
case 'cross_room': return 'Navigate Graph';
|
|
487
|
+
case 'brain_consult': return 'Run Methodology';
|
|
488
|
+
case 'deep_research': return 'Spawn Sub-Agent';
|
|
489
|
+
case 'hats': return 'Synthesize';
|
|
490
|
+
default: return null;
|
|
491
|
+
}
|
|
492
|
+
}
|
|
493
|
+
|
|
494
|
+
// ---------------------------------------------------------------------------
|
|
495
|
+
// Phase 177-09 -- the SEAM 3 behavioral-channel modifier (BCH-07 / BCH-08).
|
|
496
|
+
//
|
|
497
|
+
// WIRED-BUT-SHADOWED contract (read this first):
|
|
498
|
+
// The modifier is inserted INSIDE resolveFireSkill(), between the sensor-reach
|
|
499
|
+
// branch (ends :466) and the mode_a Brain-verb path (:468). It is GATED by
|
|
500
|
+
// BEHAVIORAL_CHANNEL_ARMED (default LOCKED). When the flag is false -- which is
|
|
501
|
+
// ALWAYS, today, because no real calibration PASS has armed it -- the modifier
|
|
502
|
+
// returns null UNCONDITIONALLY, the legacy Brain path runs unchanged, and the
|
|
503
|
+
// decide() output is BYTE-IDENTICAL to the pre-seam engine (D-177-BCH-07). The
|
|
504
|
+
// seam fires nothing semantic when unarmed; routing_source stays legacy.
|
|
505
|
+
// This dormant-when-unarmed property is the SAFETY INVARIANT the test asserts.
|
|
506
|
+
//
|
|
507
|
+
// The LIVE flip (a SIGNAL-tier cue actually outranking the graph) happens ONLY
|
|
508
|
+
// when a real calibration PASS arms the flag. That arming is DATA-GATED (it
|
|
509
|
+
// needs ground-truth-labeled shadow data, deferred per 177-08 fit.method
|
|
510
|
+
// 'deferred') AND requires a Canon Custodian / brain-boundary review before any
|
|
511
|
+
// live arming (Canon Part 8 PR gate). We build the mechanism dormant; we do
|
|
512
|
+
// NOT fire it. Frozen sets untouched (6 reaches, 3 postures); no 7th reach.
|
|
513
|
+
//
|
|
514
|
+
// Canon Part 8: the modifier ROUTES (it picks a verb from a fired reach via the
|
|
515
|
+
// existing reachIdToSkillFamily); it adds ZERO new Brain egress. It reads only
|
|
516
|
+
// enum/scalar handles (reach_id, posture, tier, confidence) and the ARMED
|
|
517
|
+
// boolean -- NEVER user prose, an artifact body, or a meeting transcript.
|
|
518
|
+
|
|
519
|
+
/**
|
|
520
|
+
* Compare two calibrated cues by TRIGGER_TIERS precedence first (signal above
|
|
521
|
+
* keyword, read from sensor-types -- never a re-typed literal order), confidence
|
|
522
|
+
* second. Pure helper, separately testable so BCH-08 can assert tier precedence
|
|
523
|
+
* WITHOUT arming the live flag. Returns the winning cue (the one that should be
|
|
524
|
+
* preferred). Defensive; never throws.
|
|
525
|
+
*
|
|
526
|
+
* @param {object} cueA -- { tier, confidence }
|
|
527
|
+
* @param {object} cueB -- { tier, confidence }
|
|
528
|
+
* @returns {object|null} the preferred cue, or null when neither is usable
|
|
529
|
+
*/
|
|
530
|
+
function rankBehavioralCue(cueA, cueB) {
|
|
531
|
+
const { TRIGGER_TIERS } = require('./sensors/sensor-types.cjs');
|
|
532
|
+
// Lower index = stronger tier (signal=0, context=1, keyword=2).
|
|
533
|
+
const rankOf = (cue) => {
|
|
534
|
+
if (!cue || typeof cue !== 'object') return Infinity;
|
|
535
|
+
const idx = TRIGGER_TIERS.indexOf(cue.tier);
|
|
536
|
+
return idx === -1 ? Infinity : idx;
|
|
537
|
+
};
|
|
538
|
+
const a = rankOf(cueA);
|
|
539
|
+
const b = rankOf(cueB);
|
|
540
|
+
if (a === Infinity && b === Infinity) return null;
|
|
541
|
+
if (a < b) return cueA;
|
|
542
|
+
if (b < a) return cueB;
|
|
543
|
+
// Same tier: higher confidence wins (defensive on non-number).
|
|
544
|
+
const confA = (cueA && typeof cueA.confidence === 'number') ? cueA.confidence : -1;
|
|
545
|
+
const confB = (cueB && typeof cueB.confidence === 'number') ? cueB.confidence : -1;
|
|
546
|
+
return confA >= confB ? cueA : cueB;
|
|
547
|
+
}
|
|
548
|
+
|
|
549
|
+
/**
|
|
550
|
+
* Pure predicate: does a protected-band cue LOSE to a Brain RECOMMENDED
|
|
551
|
+
* confidence? A cue inside the protected band [BEHAVIORAL_CHANNEL_FLOOR,
|
|
552
|
+
* BEHAVIORAL_CHANNEL_CEILING] CANNOT override a Brain RECOMMENDED confidence
|
|
553
|
+
* >= RECOMMENDED_CONFIDENCE_FLOOR (0.70). All three thresholds are READ via the
|
|
554
|
+
* require idiom (floor/ceiling from f-selector-ranker, the Brain floor from this
|
|
555
|
+
* module's own const) -- NO threshold literal lands here (BCH-05). The
|
|
556
|
+
* f-selector-ranker require is LAZY (inside the fn) to avoid the import cycle
|
|
557
|
+
* (f-selector-ranker requires this module for RECOMMENDED_CONFIDENCE_FLOOR).
|
|
558
|
+
*
|
|
559
|
+
* @param {object} cue -- { tier, confidence }
|
|
560
|
+
* @param {number} brainConfidence -- the Brain RECOMMENDED confidence (or null)
|
|
561
|
+
* @returns {boolean} true when the band cue loses to Brain >= 0.70
|
|
562
|
+
*/
|
|
563
|
+
function bandCueLosesToBrain(cue, brainConfidence) {
|
|
564
|
+
if (!cue || typeof cue !== 'object' || typeof cue.confidence !== 'number') return false;
|
|
565
|
+
if (typeof brainConfidence !== 'number') return false;
|
|
566
|
+
const {
|
|
567
|
+
BEHAVIORAL_CHANNEL_FLOOR,
|
|
568
|
+
BEHAVIORAL_CHANNEL_CEILING,
|
|
569
|
+
} = require('../workflow/f-selector-ranker.cjs');
|
|
570
|
+
const inBand =
|
|
571
|
+
cue.confidence >= BEHAVIORAL_CHANNEL_FLOOR &&
|
|
572
|
+
cue.confidence < BEHAVIORAL_CHANNEL_CEILING;
|
|
573
|
+
if (!inBand) return false;
|
|
574
|
+
// A band cue loses when Brain meets or exceeds the RECOMMENDED floor.
|
|
575
|
+
return brainConfidence >= RECOMMENDED_CONFIDENCE_FLOOR;
|
|
576
|
+
}
|
|
577
|
+
|
|
578
|
+
/**
|
|
579
|
+
* The SEAM 3 modifier. Takes the fired top reach object (sensorReaches[0], or
|
|
580
|
+
* null), the calibrated cue (a scalar { tier, confidence } the sensor spine
|
|
581
|
+
* already surfaced -- NEVER user prose; Part 8), and the armed boolean.
|
|
582
|
+
*
|
|
583
|
+
* FIRST statement is the constitutional kill-switch: if `armed` is not strictly
|
|
584
|
+
* true, return null. When BEHAVIORAL_CHANNEL_ARMED is false the function is
|
|
585
|
+
* provably inert, so resolveFireSkill falls through to the existing :468 Brain
|
|
586
|
+
* path byte-identical.
|
|
587
|
+
*
|
|
588
|
+
* The armed-true body (which NEVER runs today) maps the fired reach to its
|
|
589
|
+
* canonical verb via reachIdToSkillFamily and returns { verb, confidence,
|
|
590
|
+
* reason }; when the reach does not map, or the cue is below
|
|
591
|
+
* BEHAVIORAL_CHANNEL_FLOOR, it returns null (defer to Brain).
|
|
592
|
+
*
|
|
593
|
+
* @param {object|null} topReach -- the fired top reach { reach_id, posture }
|
|
594
|
+
* @param {object|null} cue -- the calibrated cue { tier, confidence }
|
|
595
|
+
* @param {boolean} armed -- BEHAVIORAL_CHANNEL_ARMED (false today)
|
|
596
|
+
* @returns {{verb:string, confidence:number, reason:string}|null}
|
|
597
|
+
*/
|
|
598
|
+
function behavioralChannelModifier(topReach, cue, armed) {
|
|
599
|
+
// Constitutional kill-switch (D-177-BCH-07). Unarmed -> provably inert.
|
|
600
|
+
if (armed !== true) return null;
|
|
601
|
+
|
|
602
|
+
// --- armed-true body: NEVER reached today (the flag is false). ---
|
|
603
|
+
if (!topReach || typeof topReach !== 'object') return null;
|
|
604
|
+
if (!cue || typeof cue !== 'object' || typeof cue.confidence !== 'number') return null;
|
|
605
|
+
|
|
606
|
+
// Below the protected-band floor -> defer to Brain (read the floor, never type it).
|
|
607
|
+
const { BEHAVIORAL_CHANNEL_FLOOR } = require('../workflow/f-selector-ranker.cjs');
|
|
608
|
+
if (cue.confidence < BEHAVIORAL_CHANNEL_FLOOR) return null;
|
|
609
|
+
|
|
610
|
+
// Map the fired reach to its canonical verb; a non-mapping reach defers.
|
|
611
|
+
const verb = reachIdToSkillFamily(topReach.reach_id);
|
|
612
|
+
if (verb === null) return null;
|
|
613
|
+
|
|
614
|
+
return {
|
|
615
|
+
verb: verb,
|
|
616
|
+
confidence: cue.confidence,
|
|
617
|
+
reason: 'behavioral_channel:' + topReach.reach_id + '/' + topReach.posture,
|
|
618
|
+
};
|
|
619
|
+
}
|
|
620
|
+
|
|
621
|
+
/**
|
|
622
|
+
* Resolve the best fire_skill given Brain signal state, the wicked escalation
|
|
623
|
+
* rule, and the Phase 143 sensor candidate reaches.
|
|
624
|
+
*
|
|
625
|
+
* Multi-signal precedence (Phase 144 -- the core design decision, documented):
|
|
626
|
+
*
|
|
627
|
+
* 1. wicked_escalation wicked_score >= WICKED_ESCALATION_THRESHOLD (8)
|
|
628
|
+
* returns the soft-systems family FIRST (Canon
|
|
629
|
+
* Appendix E rule R4). Outranks everything.
|
|
630
|
+
* 2. sensor reach the TOP reach by canonical REACH_IDS order maps via
|
|
631
|
+
* reachIdToSkillFamily to a CANONICAL VERB and fires in
|
|
632
|
+
* ANY TIER (tier_0 / mode_b included). This is the
|
|
633
|
+
* legacy -> engine flip: a non-null canonical verb makes
|
|
634
|
+
* the router validate true. NOT gated on mode_a.
|
|
635
|
+
* 3. BRAIN.md verb the existing mode_a pattern_matches top verb path
|
|
636
|
+
* (unchanged; family-slug return, pre-144 behavior).
|
|
637
|
+
* 4. weightApplied>=0.9 the existing context-engine fresh-Brain fallback
|
|
638
|
+
* (unchanged).
|
|
639
|
+
*
|
|
640
|
+
* The sensor branch runs BEFORE the mode_a BRAIN gate so sensors fire even in
|
|
641
|
+
* tier_0/mode_b (the legacy-on-every-turn behavior is gone when a reach fires).
|
|
642
|
+
* dispatchSensors returning [] (or throwing -> caught upstream -> []) degrades
|
|
643
|
+
* resolveFireSkill EXACTLY to the pre-144 engine: no sensor contribution.
|
|
644
|
+
*
|
|
645
|
+
* Returns null when no signal warrants firing.
|
|
646
|
+
*/
|
|
647
|
+
function resolveFireSkill(brain, weightApplied, tierMode, sensorReaches) {
|
|
648
|
+
// (1) Wicked escalation takes precedence over normal routing (Canon
|
|
649
|
+
// Appendix E rule R4) -- it even outranks a fired sensor reach.
|
|
650
|
+
const wickedSection = brain && brain.sections && brain.sections.wicked_indicators;
|
|
651
|
+
if (wickedSection && wickedSection.body) {
|
|
652
|
+
const score = extractWickedScore(wickedSection.body);
|
|
653
|
+
if (score >= WICKED_ESCALATION_THRESHOLD) {
|
|
654
|
+
return 'soft-systems';
|
|
655
|
+
}
|
|
656
|
+
}
|
|
657
|
+
|
|
658
|
+
// (2) Sensor reach -> canonical verb (ANY tier). The top reach is already in
|
|
659
|
+
// canonical REACH_IDS order: dispatchSensors iterates SENSOR_REGISTRY in
|
|
660
|
+
// canonical order and the registry mirrors REACH_IDS, so sensorReaches[0] is
|
|
661
|
+
// the top reach by the documented tie-break. Map it to a canonical verb; a
|
|
662
|
+
// non-mapping reach falls through to the BRAIN path.
|
|
663
|
+
if (Array.isArray(sensorReaches) && sensorReaches.length > 0) {
|
|
664
|
+
const top = sensorReaches[0];
|
|
665
|
+
if (top && typeof top === 'object') {
|
|
666
|
+
const verb = reachIdToSkillFamily(top.reach_id);
|
|
667
|
+
if (verb !== null) {
|
|
668
|
+
return verb;
|
|
669
|
+
}
|
|
670
|
+
}
|
|
671
|
+
}
|
|
672
|
+
|
|
673
|
+
// (2.5) SEAM 3 -- the behavioral-channel modifier, WIRED-BUT-SHADOWED (BCH-07).
|
|
674
|
+
// Inserted between the sensor-reach branch (above) and the mode_a Brain path
|
|
675
|
+
// (below). The cue is a scalar { tier, confidence } drawn from the top reach
|
|
676
|
+
// the sensor spine already surfaced (enum/scalar handles ONLY -- never user
|
|
677
|
+
// prose; Part 8). BEHAVIORAL_CHANNEL_ARMED is false today, so the modifier
|
|
678
|
+
// returns null UNCONDITIONALLY and this branch is byte-identical to the
|
|
679
|
+
// pre-seam fall-through (the seam is dormant). When a non-null seam EVER
|
|
680
|
+
// returns (only after a Canon-Custodian-reviewed, data-gated arming), it
|
|
681
|
+
// routes to seam.verb. Today it cannot.
|
|
682
|
+
if (Array.isArray(sensorReaches) && sensorReaches.length > 0) {
|
|
683
|
+
const top = sensorReaches[0];
|
|
684
|
+
const cue = (top && typeof top === 'object')
|
|
685
|
+
? { tier: top.tier, confidence: top.confidence }
|
|
686
|
+
: null;
|
|
687
|
+
const seam = behavioralChannelModifier(top, cue, readBehavioralChannelArmed());
|
|
688
|
+
if (seam !== null) {
|
|
689
|
+
return seam.verb;
|
|
690
|
+
}
|
|
691
|
+
}
|
|
692
|
+
|
|
693
|
+
// (3) Mode A + non-zero weight + parseable verb -> fire that verb's skill.
|
|
694
|
+
if (tierMode === 'mode_a' && weightApplied > 0) {
|
|
695
|
+
const pm = brain && brain.sections && brain.sections.pattern_matches;
|
|
696
|
+
if (pm && pm.body) {
|
|
697
|
+
const verb = extractTopCandidateVerb(pm.body);
|
|
698
|
+
if (verb !== null) {
|
|
699
|
+
// Map canonical verb to skill family. v1 ships a minimal mapping
|
|
700
|
+
// sufficient to satisfy "fire_skill non-null when fresh" (Test 20).
|
|
701
|
+
return verbToSkillFamily(verb);
|
|
702
|
+
}
|
|
703
|
+
}
|
|
704
|
+
// (4) Fresh Brain but no pattern_matches verb: fall back to context
|
|
705
|
+
// skill so Test 20 still has a non-null fire_skill.
|
|
706
|
+
if (weightApplied >= 0.9) {
|
|
707
|
+
return 'context-engine';
|
|
708
|
+
}
|
|
709
|
+
}
|
|
710
|
+
return null;
|
|
711
|
+
}
|
|
712
|
+
|
|
713
|
+
function verbToSkillFamily(verb) {
|
|
714
|
+
// Closed mapping. Future plans can extend the table; the engine
|
|
715
|
+
// never invents skill names from prose.
|
|
716
|
+
switch (verb) {
|
|
717
|
+
case 'Run Methodology': return 'methodology-router';
|
|
718
|
+
case 'Reformulate': return 'beautiful-question';
|
|
719
|
+
case 'Spawn Sub-Agent': return 'subagent-dispatcher';
|
|
720
|
+
case 'Navigate Graph': return 'graph-navigator';
|
|
721
|
+
case "Devil's Advocate": return 'red-team';
|
|
722
|
+
case 'Scenario Plan': return 'scenario-planner';
|
|
723
|
+
case 'Synthesize': return 'blue-hat';
|
|
724
|
+
case 'Bank Opportunity': return 'opportunity-bank';
|
|
725
|
+
case 'Defer': return 'defer';
|
|
726
|
+
case 'Free-Text': return 'larry-default';
|
|
727
|
+
default: return null;
|
|
728
|
+
}
|
|
729
|
+
}
|
|
730
|
+
|
|
731
|
+
/**
|
|
732
|
+
* Compose suppress_skills based on intent and persona signals. v1
|
|
733
|
+
* ships an empty array; future plans will populate from intent
|
|
734
|
+
* heuristics. Returning [] keeps Test 31 honoring the array invariant.
|
|
735
|
+
*/
|
|
736
|
+
function resolveSuppressSkills(_context, _brain) {
|
|
737
|
+
return [];
|
|
738
|
+
}
|
|
739
|
+
|
|
740
|
+
/**
|
|
741
|
+
* persona_updates: returns null when no threshold crossed; otherwise an
|
|
742
|
+
* object with allowed keys archetype/problem_type/venture_stage.
|
|
743
|
+
*
|
|
744
|
+
* v1 ships null (no auto-update). Plan 91-01 owns the durability layer.
|
|
745
|
+
*/
|
|
746
|
+
function resolvePersonaUpdates(_context, _brain) {
|
|
747
|
+
return null;
|
|
748
|
+
}
|
|
749
|
+
|
|
750
|
+
/**
|
|
751
|
+
* offer_next_step: returns null OR a six-key offer
|
|
752
|
+
* { command, framework, jtbd, confidence, reason, scope }. Max 1 per turn
|
|
753
|
+
* is enforced trivially (we never return more than one).
|
|
754
|
+
*
|
|
755
|
+
* v1 behavior is now LIVE (Phase 135): delegates to the abstention-gated
|
|
756
|
+
* resolver in lib/core/navigation-engine-offer.cjs, which returns exactly one
|
|
757
|
+
* calibrated offer or null computed from real local memory (operator-state x
|
|
758
|
+
* confidence-margin x rejection-backoff, plus SC2 graph neighborhood / SC4
|
|
759
|
+
* FEYNMAN temporal + MINTO governing thought + active JTBD). The resolver is
|
|
760
|
+
* LOCAL-ONLY and SYNCHRONOUS (A3): no awaited Brain packet here; _brain stays
|
|
761
|
+
* unused. Wrapped in try/catch so the engine never throws and the
|
|
762
|
+
* framework-chain-composer fallback (which fires only when offer_next_step is
|
|
763
|
+
* null) still applies on any failure.
|
|
764
|
+
*/
|
|
765
|
+
function resolveOfferNextStep(context, _brain) {
|
|
766
|
+
try {
|
|
767
|
+
const offerHelper = require('./navigation-engine-offer.cjs');
|
|
768
|
+
return offerHelper.resolveOffer(context);
|
|
769
|
+
} catch (_e) {
|
|
770
|
+
return null;
|
|
771
|
+
}
|
|
772
|
+
}
|
|
773
|
+
|
|
774
|
+
/**
|
|
775
|
+
* Phase 148-05 Task 1 (IRW-05): render the offer-resolver output through the ONE
|
|
776
|
+
* F.1 host. The offer is computed by resolveOfferNextStep (the calibration that
|
|
777
|
+
* stays untouched); the RENDER door is selector-dispatcher.pickShape via
|
|
778
|
+
* navigation-engine-offer.renderOfferThroughHost -- the IDENTICAL host the
|
|
779
|
+
* suggest-next surface uses. There is no second bespoke renderer on the engine
|
|
780
|
+
* side; both surfaces converge on pickShape. Never throws.
|
|
781
|
+
*/
|
|
782
|
+
function renderOfferNextStep(context, _brain) {
|
|
783
|
+
try {
|
|
784
|
+
const offerHelper = require('./navigation-engine-offer.cjs');
|
|
785
|
+
const offer = resolveOfferNextStep(context, _brain);
|
|
786
|
+
return offerHelper.renderOfferThroughHost(offer, context);
|
|
787
|
+
} catch (_e) {
|
|
788
|
+
return { shape: 'error', rendered: { error: 'render_offer_next_step_failed' } };
|
|
789
|
+
}
|
|
790
|
+
}
|
|
791
|
+
|
|
792
|
+
/**
|
|
793
|
+
* Phase 148-05 Task 1 (IRW-05): the suggest-next surface, unified onto the SAME
|
|
794
|
+
* F.1 host as the offer-resolver. Delegates to
|
|
795
|
+
* navigation-engine-offer.suggestNext so suggest-next and offer-resolver share
|
|
796
|
+
* one ranking and one render path (no divergent renderer). Never throws.
|
|
797
|
+
*/
|
|
798
|
+
function suggestNext(context, _brain) {
|
|
799
|
+
try {
|
|
800
|
+
const offerHelper = require('./navigation-engine-offer.cjs');
|
|
801
|
+
return offerHelper.suggestNext(context);
|
|
802
|
+
} catch (_e) {
|
|
803
|
+
return { shape: 'error', rendered: { error: 'suggest_next_failed' } };
|
|
804
|
+
}
|
|
805
|
+
}
|
|
806
|
+
|
|
807
|
+
/**
|
|
808
|
+
* Phase 191 (191-03, D-01/D-02/D-06): apply the lift module's candidate onto
|
|
809
|
+
* an ALREADY-COMPUTED decision + trace, in place. Fills decision.fire_skill
|
|
810
|
+
* ONLY when no higher-precedence signal (resolveFireSkill's step ladder, or
|
|
811
|
+
* the problem-type / chain-composer post-hoc contributions on the main path)
|
|
812
|
+
* has already set it -- the lift never overrides an existing verb. This
|
|
813
|
+
* keeps the wicked-escalation (step 1) and sensor-reach (step 2) precedence
|
|
814
|
+
* inside resolveFireSkill completely untouched (191-IFACE.md section 5), and
|
|
815
|
+
* treats the projection-sourced candidate as the LOWEST-precedence source in
|
|
816
|
+
* the ladder: it only fires when every other signal stayed silent this turn.
|
|
817
|
+
*
|
|
818
|
+
* Enriches trace.projection_offer IN PLACE with the lift's lifted_option +
|
|
819
|
+
* command_recommendation. B2 (R3): no new top-level decision or trace key is
|
|
820
|
+
* added here -- only the existing projection_offer object's own fields
|
|
821
|
+
* change, and only the existing fire_skill field's VALUE (never its
|
|
822
|
+
* existence or type contract, string-or-null).
|
|
823
|
+
*
|
|
824
|
+
* A null liftResult (a caught lift fault, R7) is a full no-op: fire_skill
|
|
825
|
+
* and projection_offer stay exactly what the pre-191 engine produced.
|
|
826
|
+
*/
|
|
827
|
+
function applyProjectionLift(decision, trace, liftResult) {
|
|
828
|
+
if (!liftResult || typeof liftResult !== 'object') return;
|
|
829
|
+
if (trace.projection_offer && typeof trace.projection_offer === 'object') {
|
|
830
|
+
trace.projection_offer.lifted_candidate = liftResult.lifted_option;
|
|
831
|
+
trace.projection_offer.command_recommendation = liftResult.command_recommendation;
|
|
832
|
+
}
|
|
833
|
+
if (decision.fire_skill === null && typeof liftResult.fire_skill_verb === 'string') {
|
|
834
|
+
decision.fire_skill = liftResult.fire_skill_verb;
|
|
835
|
+
// Part 8: name reach_id + command_slug + confidence ONLY -- never user
|
|
836
|
+
// prose, mirroring the existing sensor-reach rationale style.
|
|
837
|
+
const reachId = (liftResult.lifted_option && typeof liftResult.lifted_option.reach_id === 'string')
|
|
838
|
+
? liftResult.lifted_option.reach_id : 'unknown';
|
|
839
|
+
const cr = liftResult.command_recommendation;
|
|
840
|
+
const commandSlug = (cr && typeof cr.command_slug === 'string') ? cr.command_slug : 'unknown';
|
|
841
|
+
const conf = (typeof liftResult.confidence === 'number') ? liftResult.confidence.toFixed(2) : '0.00';
|
|
842
|
+
const existing = trace.chosen_rationale || '';
|
|
843
|
+
const sep = existing.length > 0 ? ' ' : '';
|
|
844
|
+
trace.chosen_rationale = existing + sep +
|
|
845
|
+
'Projection candidate lifted: ' + reachId + '/' + commandSlug + ' (confidence ' + conf + ').';
|
|
846
|
+
}
|
|
847
|
+
}
|
|
848
|
+
|
|
849
|
+
// ---------- decide() main entry ----------
|
|
850
|
+
|
|
851
|
+
/**
|
|
852
|
+
* decide(turn, context) -> decision
|
|
853
|
+
*
|
|
854
|
+
* Inputs:
|
|
855
|
+
* turn = { userText, sectionPath, sessionId }
|
|
856
|
+
* context = {
|
|
857
|
+
* quadruple, // pre-read quadruple (caller responsibility)
|
|
858
|
+
* brainAvailable, // boolean from brain-client.isAvailable()
|
|
859
|
+
* userPersona, // { archetype, problem_type, venture_stage }
|
|
860
|
+
* intentSignal // { intent, confidence }
|
|
861
|
+
* }
|
|
862
|
+
*
|
|
863
|
+
* Returns: typed decision struct with complete trace.
|
|
864
|
+
*
|
|
865
|
+
* Never throws. Every internal failure falls through to a safe
|
|
866
|
+
* emptyDecision() with chosen_rationale noting the fault.
|
|
867
|
+
*
|
|
868
|
+
* Per-turn cache: a single quadruple lookup may be cached within this
|
|
869
|
+
* call only. This implementation expects context.quadruple to be
|
|
870
|
+
* pre-read (the standard Phase 91-02 hook integration pattern), so the
|
|
871
|
+
* cache is implicit. If context.quadruple is absent, decide() falls
|
|
872
|
+
* back to readQuadruple(turn.sectionPath) once and caches the result
|
|
873
|
+
* for the duration of THIS call only. Cross-call caching FORBIDDEN per
|
|
874
|
+
* Section 2.4.
|
|
875
|
+
*/
|
|
876
|
+
function decide(turn, context) {
|
|
877
|
+
// Phase 144 (Task 2): LOCAL monotonic clock for the decide()-body latency
|
|
878
|
+
// budget telemetry. Date.now() is LOCAL and never transmitted; the resulting
|
|
879
|
+
// _meta.latencies_ms is LOCAL trace JSON only (guards the 1200ms NAV budget).
|
|
880
|
+
const decideStartMs = Date.now();
|
|
881
|
+
|
|
882
|
+
// Safe defaults.
|
|
883
|
+
const ctx = context || {};
|
|
884
|
+
const t = turn || {};
|
|
885
|
+
const decision = shared.emptyDecision();
|
|
886
|
+
const trace = decision.decision_trace;
|
|
887
|
+
|
|
888
|
+
// Phase 144 (NAV-01): consume the Phase 143 sensors ONCE, before any return
|
|
889
|
+
// path, so EVERY decision (tier_0 / legacy / mode_a) sees the same candidate
|
|
890
|
+
// reaches and the legacy-on-every-turn behavior is gone when a reach fires.
|
|
891
|
+
// tuple = the /mos:diagnose classification { problem_type, complexity, stage }
|
|
892
|
+
// read from context (defaulting to {} per field when absent). ctx handles are
|
|
893
|
+
// LOCAL ({ roomDir, lowFillSections }). dispatchSensors is pure / sync /
|
|
894
|
+
// LOCAL-first; wrapped in try/catch so a sensor fault degrades to [] and
|
|
895
|
+
// resolveFireSkill behaves exactly like the pre-144 engine. Never throws.
|
|
896
|
+
const sensorTuple = {
|
|
897
|
+
problem_type: ctx.problem_type !== undefined ? ctx.problem_type : undefined,
|
|
898
|
+
complexity: ctx.complexity !== undefined ? ctx.complexity : undefined,
|
|
899
|
+
stage: ctx.stage !== undefined ? ctx.stage : undefined,
|
|
900
|
+
};
|
|
901
|
+
const sensorCtx = {
|
|
902
|
+
roomDir: typeof ctx.roomDir === 'string' ? ctx.roomDir : null,
|
|
903
|
+
lowFillSections: Array.isArray(ctx.lowFillSections) ? ctx.lowFillSections : null,
|
|
904
|
+
};
|
|
905
|
+
// MED-01 producer: derive the two LOCAL cortex ctx scalars sensorMemoryCortex
|
|
906
|
+
// reads (staleGoverningThought / freshContradictions) from the projected cortex
|
|
907
|
+
// the caller threaded onto context.roomContext.cortexNodes (legD). Presence +
|
|
908
|
+
// closed-enum reads ONLY -- a 'stale' governing_thought freshness enum or a
|
|
909
|
+
// 'contradiction' decision kind enum; never prose (Canon Part 8). Inlined here
|
|
910
|
+
// (rather than importing the hmi adapter) to keep the engine's dependency graph
|
|
911
|
+
// and Part-8 require-surface minimal. Caller-threaded ctx.* overrides win when
|
|
912
|
+
// explicitly provided (the test seam). Defensive; never throws.
|
|
913
|
+
{
|
|
914
|
+
const cortexNodes = (ctx.roomContext && Array.isArray(ctx.roomContext.cortexNodes))
|
|
915
|
+
? ctx.roomContext.cortexNodes
|
|
916
|
+
: [];
|
|
917
|
+
let stale = false;
|
|
918
|
+
let fresh = 0;
|
|
919
|
+
for (const node of cortexNodes) {
|
|
920
|
+
if (!node || typeof node !== 'object') continue;
|
|
921
|
+
const props = (node.properties && typeof node.properties === 'object') ? node.properties : null;
|
|
922
|
+
if (!props) continue;
|
|
923
|
+
if (node.type === 'governing_thought' && props.freshness === 'stale') stale = true;
|
|
924
|
+
else if (node.type === 'decision' && props.kind === 'contradiction') fresh += 1;
|
|
925
|
+
}
|
|
926
|
+
sensorCtx.staleGoverningThought = (ctx.staleGoverningThought === true) || stale;
|
|
927
|
+
sensorCtx.freshContradictions =
|
|
928
|
+
(typeof ctx.freshContradictions === 'number' && ctx.freshContradictions > 0)
|
|
929
|
+
? ctx.freshContradictions
|
|
930
|
+
: fresh;
|
|
931
|
+
}
|
|
932
|
+
// Phase 203-03 producer (SENS-11): derive the reusable-expert scalars
|
|
933
|
+
// sensorExpertSkill reads (reusableExpertCandidate / reusableExpertInvocationMax /
|
|
934
|
+
// reusableExpertTierSignal / reusableExpertCandidateCount) from CONFIRMED
|
|
935
|
+
// SyntheticExpert nodes in room.db, mirroring the MED-01 cortex producer above.
|
|
936
|
+
// The db read runs HERE (ctx-assembly), NEVER inside the pure sensor (Part 8/9).
|
|
937
|
+
// The engine does not OPEN room.db; it uses a caller-threaded handle (ctx.roomDb)
|
|
938
|
+
// when present, exactly as MED-01 consumes the caller-threaded cortex projection.
|
|
939
|
+
// The LOCAL candidate list (node ids) is threaded onto sensorCtx for the gate
|
|
940
|
+
// APPROVE handler ONLY -- it is never ridden on the reach. Caller-threaded ctx.*
|
|
941
|
+
// scalar overrides win (the test seam). Defensive; never throws.
|
|
942
|
+
{
|
|
943
|
+
let reusable = false;
|
|
944
|
+
let invocationMax = 0;
|
|
945
|
+
let tierSignal = false;
|
|
946
|
+
let candidateCount = 0;
|
|
947
|
+
const roomDb = (ctx.roomDb && typeof ctx.roomDb.prepare === 'function') ? ctx.roomDb : null;
|
|
948
|
+
if (roomDb) {
|
|
949
|
+
try {
|
|
950
|
+
const threshold = (typeof ctx.reusableExpertThreshold === 'number')
|
|
951
|
+
? ctx.reusableExpertThreshold
|
|
952
|
+
: undefined;
|
|
953
|
+
const sig = detectExpertSkillCandidates(roomDb, threshold !== undefined ? { threshold: threshold } : {});
|
|
954
|
+
if (sig && sig.reusable === true) {
|
|
955
|
+
reusable = true;
|
|
956
|
+
invocationMax = sig.invocationMax;
|
|
957
|
+
tierSignal = sig.tierSignal;
|
|
958
|
+
candidateCount = Array.isArray(sig.candidates) ? sig.candidates.length : 0;
|
|
959
|
+
// LOCAL candidate list for the gate APPROVE handler only (never on the reach).
|
|
960
|
+
sensorCtx.reusableExpertCandidates = Array.isArray(sig.candidates) ? sig.candidates : [];
|
|
961
|
+
}
|
|
962
|
+
} catch (_e) {
|
|
963
|
+
// soft-fail: degrade to no reusable-expert signal
|
|
964
|
+
}
|
|
965
|
+
}
|
|
966
|
+
sensorCtx.reusableExpertCandidate = (ctx.reusableExpertCandidate === true) || reusable;
|
|
967
|
+
sensorCtx.reusableExpertInvocationMax =
|
|
968
|
+
(typeof ctx.reusableExpertInvocationMax === 'number' && ctx.reusableExpertInvocationMax > 0)
|
|
969
|
+
? ctx.reusableExpertInvocationMax
|
|
970
|
+
: invocationMax;
|
|
971
|
+
sensorCtx.reusableExpertTierSignal = (ctx.reusableExpertTierSignal === true) || tierSignal;
|
|
972
|
+
sensorCtx.reusableExpertCandidateCount =
|
|
973
|
+
(typeof ctx.reusableExpertCandidateCount === 'number' && ctx.reusableExpertCandidateCount > 0)
|
|
974
|
+
? ctx.reusableExpertCandidateCount
|
|
975
|
+
: candidateCount;
|
|
976
|
+
}
|
|
977
|
+
// Phase 244 Plan 05 producer (SENS-16, TRIG-01): derive the content-relevance
|
|
978
|
+
// scalars sensorContentRelevance reads (contentHitCount / contentCoverage /
|
|
979
|
+
// contentIndexState / contentCandidates) by querying the ALREADY-SHIPPED
|
|
980
|
+
// tri-modal-index.lexicalSearch (bm25 FTS5) against room.db, mirroring the
|
|
981
|
+
// MED-01 cortex producer and the SENS-11 expert producer above. The db read
|
|
982
|
+
// runs HERE (ctx-assembly), NEVER inside the pure sensor (Part 8/9). The
|
|
983
|
+
// engine does not OPEN room.db; it uses a caller-threaded handle (ctx.roomDb)
|
|
984
|
+
// when present, exactly as the SENS-11 producer consumes ctx.roomDb. The
|
|
985
|
+
// LOCAL candidate list (node ids) is threaded onto sensorCtx for the gate
|
|
986
|
+
// handler ONLY -- it is never ridden on the reach. Caller-threaded ctx.*
|
|
987
|
+
// scalar overrides win (the test seam that lets a unit test fire the
|
|
988
|
+
// sensor with no db, no FTS index, and no fixture at all). Defensive; never
|
|
989
|
+
// throws. lexicalSearch is sync and measured at 0-1 ms on a warm index, so
|
|
990
|
+
// this block is free against the 1200ms NAV budget; the expensive
|
|
991
|
+
// indexNodes call (async, reads artifact bodies off disk) NEVER runs here
|
|
992
|
+
// -- the producer only ENQUEUES a build request and spawns a detached
|
|
993
|
+
// drain, both sync (lib/core/eureka/fts-index-lifecycle.cjs).
|
|
994
|
+
{
|
|
995
|
+
let contentHitCount = 0;
|
|
996
|
+
let contentCoverage = 0;
|
|
997
|
+
let contentIndexState = 'unavailable';
|
|
998
|
+
const roomDb = (ctx.roomDb && typeof ctx.roomDb.prepare === 'function') ? ctx.roomDb : null;
|
|
999
|
+
if (roomDb) {
|
|
1000
|
+
try {
|
|
1001
|
+
// Full canonical text precedence (insight-sensors.cjs:347-352). The
|
|
1002
|
+
// 244-RESEARCH.md example read only t.userText, which sees empty text
|
|
1003
|
+
// on every caller that already normalizes -- corrected here.
|
|
1004
|
+
const turnText = (typeof t.text === 'string' && t.text)
|
|
1005
|
+
? t.text
|
|
1006
|
+
: (typeof t.utterance === 'string' && t.utterance)
|
|
1007
|
+
? t.utterance
|
|
1008
|
+
: (typeof t.userText === 'string' && t.userText)
|
|
1009
|
+
? t.userText
|
|
1010
|
+
: '';
|
|
1011
|
+
const roomDirForContent = sensorCtx.roomDir
|
|
1012
|
+
|| (ctx.roomState && typeof ctx.roomState.roomDir === 'string' ? ctx.roomState.roomDir : null);
|
|
1013
|
+
const sig = detectContentRelevance(roomDb, {
|
|
1014
|
+
turnText: turnText,
|
|
1015
|
+
roomDir: roomDirForContent || undefined,
|
|
1016
|
+
});
|
|
1017
|
+
if (sig && typeof sig === 'object') {
|
|
1018
|
+
contentHitCount = (typeof sig.hits === 'number' && Number.isFinite(sig.hits)) ? sig.hits : 0;
|
|
1019
|
+
contentCoverage = (typeof sig.coverage === 'number' && Number.isFinite(sig.coverage)) ? sig.coverage : 0;
|
|
1020
|
+
contentIndexState = (typeof sig.state === 'string' && sig.state) ? sig.state : 'unavailable';
|
|
1021
|
+
// LOCAL candidate list for the gate handler only (never on the reach).
|
|
1022
|
+
sensorCtx.contentCandidates = Array.isArray(sig.candidates) ? sig.candidates : [];
|
|
1023
|
+
}
|
|
1024
|
+
} catch (_e) {
|
|
1025
|
+
// soft-fail: degrade to no content-relevance signal
|
|
1026
|
+
}
|
|
1027
|
+
}
|
|
1028
|
+
sensorCtx.contentHitCount =
|
|
1029
|
+
(typeof ctx.contentHitCount === 'number' && ctx.contentHitCount >= 0)
|
|
1030
|
+
? ctx.contentHitCount
|
|
1031
|
+
: contentHitCount;
|
|
1032
|
+
sensorCtx.contentCoverage =
|
|
1033
|
+
(typeof ctx.contentCoverage === 'number' && ctx.contentCoverage >= 0)
|
|
1034
|
+
? ctx.contentCoverage
|
|
1035
|
+
: contentCoverage;
|
|
1036
|
+
sensorCtx.contentIndexState =
|
|
1037
|
+
(typeof ctx.contentIndexState === 'string' && ctx.contentIndexState)
|
|
1038
|
+
? ctx.contentIndexState
|
|
1039
|
+
: contentIndexState;
|
|
1040
|
+
if (!Array.isArray(sensorCtx.contentCandidates)) sensorCtx.contentCandidates = [];
|
|
1041
|
+
}
|
|
1042
|
+
let sensorReaches = [];
|
|
1043
|
+
let dispatchSensorsMs = 0;
|
|
1044
|
+
{
|
|
1045
|
+
const dispatchStartMs = Date.now();
|
|
1046
|
+
try {
|
|
1047
|
+
const reaches = dispatchSensors(t, sensorTuple, sensorCtx);
|
|
1048
|
+
sensorReaches = Array.isArray(reaches) ? reaches : [];
|
|
1049
|
+
} catch (_e) {
|
|
1050
|
+
sensorReaches = []; // soft-fail: degrade to pre-144 behavior
|
|
1051
|
+
}
|
|
1052
|
+
dispatchSensorsMs = Date.now() - dispatchStartMs;
|
|
1053
|
+
}
|
|
1054
|
+
|
|
1055
|
+
// Phase 222 (D-01): re-order the fired subset by the shared scored selection
|
|
1056
|
+
// BEFORE any [0] read - resolveFireSkill, the trace, and the rationale clause
|
|
1057
|
+
// all read [0] and now transparently see the scored winner. Lazy-require inside
|
|
1058
|
+
// decide() (the :510 f-selector-ranker idiom) keeps this engine-to-workflow
|
|
1059
|
+
// require function-local, avoiding module-load cycles. Wrapped in try/catch that
|
|
1060
|
+
// leaves sensorReaches untouched on any error (belt-and-suspenders on the hot
|
|
1061
|
+
// path; the ranker also self-guards and passes 0/1-candidate arrays through by
|
|
1062
|
+
// reference). The engine never OPENS room.db - it threads the caller's ctx.roomDb
|
|
1063
|
+
// handle (may be null; the ranker then degrades to equal weights, no event).
|
|
1064
|
+
try {
|
|
1065
|
+
const reachHedgeRanker = require('../workflow/reach-hedge-ranker.cjs');
|
|
1066
|
+
sensorReaches = reachHedgeRanker.rankFiredCandidates(sensorReaches, {
|
|
1067
|
+
cortexNodes: (ctx.roomContext && Array.isArray(ctx.roomContext.cortexNodes))
|
|
1068
|
+
? ctx.roomContext.cortexNodes
|
|
1069
|
+
: [],
|
|
1070
|
+
db: ctx.roomDb || null,
|
|
1071
|
+
});
|
|
1072
|
+
} catch (_e) {
|
|
1073
|
+
// soft-fail: leave the unranked fired subset in place
|
|
1074
|
+
}
|
|
1075
|
+
|
|
1076
|
+
// CASC-02 (Phase 142): reflect the navigated neighborhood (getRoomContext Leg C,
|
|
1077
|
+
// getNeighborhood-ranked) the caller threaded onto context.roomContext through the
|
|
1078
|
+
// navigation.cjs chokepoint. Computed once, before any return path, so EVERY
|
|
1079
|
+
// decision (Tier 0 / legacy / mode_a) carries it when present and the safe-default
|
|
1080
|
+
// null when absent. Scalars/slugs/scores only (Part 8). Never throws.
|
|
1081
|
+
let navigatedNeighborhood = null;
|
|
1082
|
+
try {
|
|
1083
|
+
navigatedNeighborhood = buildNavigatedNeighborhood(ctx.roomContext);
|
|
1084
|
+
} catch (_e) {
|
|
1085
|
+
navigatedNeighborhood = null;
|
|
1086
|
+
}
|
|
1087
|
+
// Reference the chokepoint export so the Part-8 anchor require is load-bearing
|
|
1088
|
+
// (the navigated neighborhood ARRIVES through navigation.cjs's getRoomContext leg).
|
|
1089
|
+
void navigation.getRoomContext;
|
|
1090
|
+
|
|
1091
|
+
// Phase 184 (READER-01..04): the decide-time projection OFFER. The THIRD READER --
|
|
1092
|
+
// it RANKS the LOCAL orchestration-projection capabilities for this navigator
|
|
1093
|
+
// context and SURFACES them as Shape F Decision-Gate OPTION CONTENT. It calls
|
|
1094
|
+
// NEITHER runChain NOR any act-command: a reader, never a firer (READER-04, proved
|
|
1095
|
+
// structurally by tests/test-reader-r4-structural-184.cjs). Computed ONCE before
|
|
1096
|
+
// any return path so EVERY decision (tier_0 / legacy / mode_a) carries the same
|
|
1097
|
+
// offer (or the null safe-default when skipped). The R2 gate inside the reader
|
|
1098
|
+
// validates the projection BEFORE the read and FAILS CLOSED on a malformed
|
|
1099
|
+
// projection (the read is skipped, decide() still returns). Part 8: the projection
|
|
1100
|
+
// is a LOCAL derived machinery cache (a local file read); ZERO Brain read/write,
|
|
1101
|
+
// ZERO network. Never throws -- a fault degrades to a null offer.
|
|
1102
|
+
let projectionOffer = null;
|
|
1103
|
+
try {
|
|
1104
|
+
const projectionReader = require('./reader/decide-projection-reader.cjs');
|
|
1105
|
+
projectionOffer = projectionReader.offerProjectionCapabilities(
|
|
1106
|
+
{
|
|
1107
|
+
reach_id: (sensorReaches[0] && typeof sensorReaches[0] === 'object'
|
|
1108
|
+
? sensorReaches[0].reach_id : null) || (typeof ctx.reach_id === 'string' ? ctx.reach_id : null),
|
|
1109
|
+
firingSensors: Array.isArray(ctx.firingSensors) ? ctx.firingSensors : null,
|
|
1110
|
+
sensorReaches: sensorReaches,
|
|
1111
|
+
},
|
|
1112
|
+
{ projection: ctx.projectionOverride, projectionPath: ctx.projectionPath }
|
|
1113
|
+
);
|
|
1114
|
+
} catch (_e) {
|
|
1115
|
+
projectionOffer = null;
|
|
1116
|
+
}
|
|
1117
|
+
|
|
1118
|
+
// Phase 191 (191-03, D-01/D-02/D-06): lift the firing candidate from the
|
|
1119
|
+
// projection offer computed above. Computed ONCE, before any return path
|
|
1120
|
+
// (mirrors projectionOffer itself, above). liftFiringCandidate (Wave 2,
|
|
1121
|
+
// orchestration-candidate-lift.cjs) is pure/sync/LOCAL (R2): it reads only
|
|
1122
|
+
// the already-loaded LOCAL projectionOffer + the LOCAL command subgraph via
|
|
1123
|
+
// its own rankFn seam (default f-selector-ranker.rankForSelector). D-01:
|
|
1124
|
+
// the Phase-184 reader above is NOT touched by this wire; the lift consumes
|
|
1125
|
+
// its output only. D-02: the gate is the lift module's own imported
|
|
1126
|
+
// RECOMMENDED_CONFIDENCE_FLOOR -- never re-typed here. R7: never throws --
|
|
1127
|
+
// a fault degrades to a null liftResult, which applyProjectionLift() below
|
|
1128
|
+
// treats as a full no-op (pre-191 fire_skill + projection_offer untouched).
|
|
1129
|
+
let liftResult = null;
|
|
1130
|
+
try {
|
|
1131
|
+
const candidateLift = require('./orchestration-candidate-lift.cjs');
|
|
1132
|
+
liftResult = candidateLift.liftFiringCandidate({
|
|
1133
|
+
projectionOffer: projectionOffer,
|
|
1134
|
+
sensorReaches: sensorReaches,
|
|
1135
|
+
context: {
|
|
1136
|
+
roomState: ctx.roomState,
|
|
1137
|
+
packetOptional: ctx.packetOptional,
|
|
1138
|
+
problem_type: ctx.problem_type,
|
|
1139
|
+
},
|
|
1140
|
+
});
|
|
1141
|
+
} catch (_e) {
|
|
1142
|
+
liftResult = null;
|
|
1143
|
+
}
|
|
1144
|
+
|
|
1145
|
+
try {
|
|
1146
|
+
// Per-turn cache scope: read quadruple if not provided. The local
|
|
1147
|
+
// `quadruple` binding is the cache; it never escapes this function.
|
|
1148
|
+
let quadruple = ctx.quadruple;
|
|
1149
|
+
if (!quadruple) {
|
|
1150
|
+
const sectionPath = t.sectionPath;
|
|
1151
|
+
if (typeof sectionPath === 'string' && sectionPath.length > 0) {
|
|
1152
|
+
quadruple = folderMemory.readQuadruple(sectionPath);
|
|
1153
|
+
}
|
|
1154
|
+
}
|
|
1155
|
+
|
|
1156
|
+
// If we still have no quadruple, return empty decision in tier_0.
|
|
1157
|
+
if (!quadruple) {
|
|
1158
|
+
trace.brain_md_tier_mode = 'tier_0';
|
|
1159
|
+
trace.brain_md_staleness = 'absent';
|
|
1160
|
+
trace.brain_md_weight_applied = 0.0;
|
|
1161
|
+
trace.icm_scope = buildIcmScope(null, t);
|
|
1162
|
+
trace.sql_signals = buildSqlSignals(null, t);
|
|
1163
|
+
trace.minto_reasoning = buildMintoReasoning(null);
|
|
1164
|
+
trace.intent_persona = buildIntentPersona(ctx);
|
|
1165
|
+
trace.navigated_neighborhood = navigatedNeighborhood;
|
|
1166
|
+
// Phase 245 (245-05): the Brain pattern_matches observation rides the tier_0
|
|
1167
|
+
// early-return path too, so EVERY decision carries both fields. There is no
|
|
1168
|
+
// quadruple here, hence no brain, hence the explicit null observation. Set
|
|
1169
|
+
// explicitly rather than left to the emptyDecisionTrace() default, so this
|
|
1170
|
+
// path states its answer instead of inheriting one.
|
|
1171
|
+
{
|
|
1172
|
+
const bpv = brainPatternVerbObservation(null);
|
|
1173
|
+
trace.brain_pattern_verb = bpv.verb;
|
|
1174
|
+
trace.brain_pattern_verb_confidence = bpv.confidence;
|
|
1175
|
+
}
|
|
1176
|
+
// Phase 184 (READER): the decide-time projection offer rides the tier_0 path too.
|
|
1177
|
+
trace.projection_offer = projectionOffer;
|
|
1178
|
+
trace.chosen_rationale = 'Tier 0 fallback: no quadruple available for sectionPath.';
|
|
1179
|
+
if (navigatedNeighborhood !== null) {
|
|
1180
|
+
trace.chosen_rationale +=
|
|
1181
|
+
' Routing reflected the navigated neighborhood (' +
|
|
1182
|
+
navigatedNeighborhood.count + ' ranked neighbor' +
|
|
1183
|
+
(navigatedNeighborhood.count === 1 ? '' : 's') + ', top ' +
|
|
1184
|
+
navigatedNeighborhood.top_node_id + ').';
|
|
1185
|
+
}
|
|
1186
|
+
|
|
1187
|
+
// Phase 144 (NAV-01): sensors fire in ANY tier -- including this tier_0
|
|
1188
|
+
// early-return path. A fired reach -> a CANONICAL VERB so the router flips
|
|
1189
|
+
// routing_source to engine even with no quadruple.
|
|
1190
|
+
decision.fire_skill = resolveFireSkill(null, 0.0, 'tier_0', sensorReaches);
|
|
1191
|
+
if (sensorReaches.length > 0) {
|
|
1192
|
+
const top = sensorReaches[0];
|
|
1193
|
+
if (top && typeof top === 'object' && reachIdToSkillFamily(top.reach_id) !== null) {
|
|
1194
|
+
// Part 8: name reach_id + posture ONLY. Never reach.signal's
|
|
1195
|
+
// user-derived value, evidence bodies, or the dispatch handle.
|
|
1196
|
+
trace.chosen_rationale +=
|
|
1197
|
+
' Sensor reach fired: ' + top.reach_id + '/' + top.posture + '.';
|
|
1198
|
+
}
|
|
1199
|
+
}
|
|
1200
|
+
|
|
1201
|
+
// Phase 191 (191-03): the tier_0 early-return path rides the same lift
|
|
1202
|
+
// wire as the main path (191-IFACE.md section 5). A fault-safe no-op
|
|
1203
|
+
// when liftResult is null (R7).
|
|
1204
|
+
applyProjectionLift(decision, trace, liftResult);
|
|
1205
|
+
|
|
1206
|
+
// Phase 144 (Task 2): LOCAL trace.context_assembly + latency telemetry on
|
|
1207
|
+
// the tier_0 early-return path too (both return paths carry the shape).
|
|
1208
|
+
trace.context_assembly = buildContextAssembly(
|
|
1209
|
+
navigatedNeighborhood,
|
|
1210
|
+
sensorReaches,
|
|
1211
|
+
groundingForFireSkill(decision.fire_skill, sensorReaches, null, navigatedNeighborhood)
|
|
1212
|
+
);
|
|
1213
|
+
trace._meta = {
|
|
1214
|
+
latencies_ms: {
|
|
1215
|
+
dispatchSensors_ms: dispatchSensorsMs,
|
|
1216
|
+
decide_total_ms: Date.now() - decideStartMs,
|
|
1217
|
+
},
|
|
1218
|
+
};
|
|
1219
|
+
return decision;
|
|
1220
|
+
}
|
|
1221
|
+
|
|
1222
|
+
const brainAvailable = ctx.brainAvailable === true;
|
|
1223
|
+
const brain = quadruple.brain || null;
|
|
1224
|
+
|
|
1225
|
+
// Section 5 tier-mode resolver (re-evaluated every turn; no cache).
|
|
1226
|
+
const tierMode = shared.resolveTierMode(quadruple, brainAvailable);
|
|
1227
|
+
trace.brain_md_tier_mode = tierMode;
|
|
1228
|
+
|
|
1229
|
+
// Section 4 staleness multiplier (BRAIN.md contribution scaler).
|
|
1230
|
+
// The result is later assigned to trace.brain_md_weight_applied per
|
|
1231
|
+
// Section 8.1. Multiplier source rows:
|
|
1232
|
+
// null brain -> 0.0
|
|
1233
|
+
// staleness:fresh -> 1.0
|
|
1234
|
+
// stale_reason:brain_offline -> 0.9 (EXEMPT)
|
|
1235
|
+
// stale_reason:age_exceeded -> 0.7
|
|
1236
|
+
// stale_reason:brain_graph_version_mismatch -> 0.5
|
|
1237
|
+
// stale_reason:governing_thought_changed -> 0.3
|
|
1238
|
+
// stale_reason:derivation_timeout -> 0.2
|
|
1239
|
+
// stale_reason:parse_failed -> 0.0
|
|
1240
|
+
// staleness:unavailable -> 0.0
|
|
1241
|
+
let weightApplied = shared.applyStalenessMultiplier(brain);
|
|
1242
|
+
|
|
1243
|
+
// Section 3.1 attribution guard. brain.author MUST equal 'brain';
|
|
1244
|
+
// any other value indicates a Canon Part 2 attribution breach and
|
|
1245
|
+
// demotes the BRAIN.md weight to 0.0 with a trace note. The
|
|
1246
|
+
// resulting brain_md_weight_applied is observable in the decision
|
|
1247
|
+
// trace by /mos:explain-decision (Plan 91-05).
|
|
1248
|
+
let attributionBreach = false;
|
|
1249
|
+
if (brain !== null && brain.author !== undefined && brain.author !== 'brain') {
|
|
1250
|
+
attributionBreach = true;
|
|
1251
|
+
weightApplied = 0.0; // brain_md_weight_applied demotion target
|
|
1252
|
+
}
|
|
1253
|
+
// Section 8.1 trace.brain_md_weight_applied final assignment.
|
|
1254
|
+
trace.brain_md_weight_applied = weightApplied;
|
|
1255
|
+
|
|
1256
|
+
// Section 8 trace fields (always emitted, even with brain null).
|
|
1257
|
+
if (brain === null) {
|
|
1258
|
+
trace.brain_md_version = null;
|
|
1259
|
+
trace.brain_md_staleness = 'absent';
|
|
1260
|
+
trace.brain_md_stale_reason = null;
|
|
1261
|
+
} else {
|
|
1262
|
+
trace.brain_md_version = typeof brain.brain_graph_version === 'number'
|
|
1263
|
+
? brain.brain_graph_version
|
|
1264
|
+
: null;
|
|
1265
|
+
trace.brain_md_staleness = typeof brain.staleness === 'string'
|
|
1266
|
+
? brain.staleness
|
|
1267
|
+
: 'absent';
|
|
1268
|
+
trace.brain_md_stale_reason = typeof brain.stale_reason === 'string'
|
|
1269
|
+
? brain.stale_reason
|
|
1270
|
+
: null;
|
|
1271
|
+
}
|
|
1272
|
+
|
|
1273
|
+
// Section 3.2 sections_consumed list (non-null bodies only).
|
|
1274
|
+
trace.brain_md_sections_consumed = consumedSections(brain);
|
|
1275
|
+
|
|
1276
|
+
// Section 6 RECOMMENDED gate evaluation (record confidence even
|
|
1277
|
+
// when gate fails; render marker only when ALL conditions hold).
|
|
1278
|
+
let recommendedConfidence = null;
|
|
1279
|
+
let recommendedRendered = false;
|
|
1280
|
+
if (brain !== null && brain.sections) {
|
|
1281
|
+
const pm = brain.sections.pattern_matches;
|
|
1282
|
+
if (pm && typeof pm.body === 'string') {
|
|
1283
|
+
recommendedConfidence = extractHighestConfidence(pm.body);
|
|
1284
|
+
}
|
|
1285
|
+
}
|
|
1286
|
+
trace.brain_md_recommended_confidence = recommendedConfidence;
|
|
1287
|
+
|
|
1288
|
+
if (
|
|
1289
|
+
tierMode === 'mode_a' &&
|
|
1290
|
+
!attributionBreach &&
|
|
1291
|
+
recommendedConfidence !== null &&
|
|
1292
|
+
recommendedConfidence >= RECOMMENDED_CONFIDENCE_FLOOR
|
|
1293
|
+
) {
|
|
1294
|
+
// Section 6 condition 4: candidate verb must match a Canon Part 3
|
|
1295
|
+
// vocabulary entry. extractTopCandidateVerb returns the resolved
|
|
1296
|
+
// canonical verb or null.
|
|
1297
|
+
const pm = brain.sections.pattern_matches;
|
|
1298
|
+
const verb = extractTopCandidateVerb(pm.body);
|
|
1299
|
+
if (verb !== null) {
|
|
1300
|
+
recommendedRendered = true;
|
|
1301
|
+
}
|
|
1302
|
+
}
|
|
1303
|
+
trace.brain_md_recommended_marker_rendered = recommendedRendered;
|
|
1304
|
+
|
|
1305
|
+
// Phase 245 (245-05, D-25 / 245-RESEARCH.md F-2): the Brain pattern_matches
|
|
1306
|
+
// OBSERVATION on the populated (mode_a / mode_b / legacy) return path.
|
|
1307
|
+
//
|
|
1308
|
+
// Placed here, NOT inside the RECOMMENDED gate directly above, and NOT inside
|
|
1309
|
+
// resolveFireSkill. The gate above discards its verb after using it as a
|
|
1310
|
+
// boolean and only runs at all when tierMode === 'mode_a' && !attributionBreach
|
|
1311
|
+
// && confidence >= 0.70. resolveFireSkill's step (3) is unreachable whenever a
|
|
1312
|
+
// sensor fired, because step (2) returns early -- which is essentially every
|
|
1313
|
+
// observed turn (D-24: the Brain verb is STARVED). This computation is
|
|
1314
|
+
// deliberately ungated so Requirement 1's third fusion input EXISTS at all.
|
|
1315
|
+
//
|
|
1316
|
+
// resolveFireSkill is byte-unchanged by this plan. This adds an observation; it
|
|
1317
|
+
// does not reorder routing. decision.fire_skill and
|
|
1318
|
+
// trace.context_assembly.decision_grounding stay exactly as they were.
|
|
1319
|
+
{
|
|
1320
|
+
const bpv = brainPatternVerbObservation(brain);
|
|
1321
|
+
trace.brain_pattern_verb = bpv.verb;
|
|
1322
|
+
trace.brain_pattern_verb_confidence = bpv.confidence;
|
|
1323
|
+
}
|
|
1324
|
+
|
|
1325
|
+
// Five-signal triangulation (structural; rule-based per D-02).
|
|
1326
|
+
trace.icm_scope = buildIcmScope(quadruple, t);
|
|
1327
|
+
trace.sql_signals = buildSqlSignals(quadruple, t);
|
|
1328
|
+
trace.minto_reasoning = buildMintoReasoning(quadruple);
|
|
1329
|
+
trace.intent_persona = buildIntentPersona(ctx);
|
|
1330
|
+
|
|
1331
|
+
// CASC-02: reflect the navigated neighborhood (computed once above). When a
|
|
1332
|
+
// non-empty getNeighborhood-ranked neighborhood arrived via context.roomContext,
|
|
1333
|
+
// the spine NAVIGATED -- the field carries the ranked neighbor scalars and the
|
|
1334
|
+
// rationale notes it (below). routing_source is NOT assigned here; flipped at
|
|
1335
|
+
// the router layer when fire_skill is non-null (Phase 144).
|
|
1336
|
+
trace.navigated_neighborhood = navigatedNeighborhood;
|
|
1337
|
+
|
|
1338
|
+
// Phase 184 (READER-01..04): surface the decide-time projection offer (ranked
|
|
1339
|
+
// LOCAL orchestration-projection capabilities as Shape F OPTION CONTENT). READER
|
|
1340
|
+
// is a third READER, never a firer: it does not touch fire_skill, suppress_skills,
|
|
1341
|
+
// or any frozen Part 3 contract -- it only populates this trace field.
|
|
1342
|
+
trace.projection_offer = projectionOffer;
|
|
1343
|
+
|
|
1344
|
+
// Compose chosen_rationale from active rules.
|
|
1345
|
+
const rationale = [];
|
|
1346
|
+
if (tierMode === 'tier_0') {
|
|
1347
|
+
if (brain === null) {
|
|
1348
|
+
rationale.push('Tier 0 fallback: BRAIN.md absent.');
|
|
1349
|
+
} else if (brain.parse_failed === true) {
|
|
1350
|
+
rationale.push('brain_parse_failed fell through to tier_0.');
|
|
1351
|
+
} else if (brain.staleness === 'unavailable') {
|
|
1352
|
+
rationale.push('Tier 0 fallback: BRAIN.md staleness unavailable.');
|
|
1353
|
+
} else {
|
|
1354
|
+
rationale.push('Tier 0 fallback: brain unreachable and not offline-exempt.');
|
|
1355
|
+
}
|
|
1356
|
+
} else if (tierMode === 'mode_b') {
|
|
1357
|
+
rationale.push('Mode B local-only: brain unreachable; brain_offline exemption applied (weight 0.9).');
|
|
1358
|
+
rationale.push('mode_b suppresses RECOMMENDED per Canon Part 3.');
|
|
1359
|
+
} else {
|
|
1360
|
+
// mode_a
|
|
1361
|
+
if (recommendedRendered) {
|
|
1362
|
+
rationale.push('Mode A: RECOMMENDED rendered (confidence >= 0.7).');
|
|
1363
|
+
} else if (recommendedConfidence !== null) {
|
|
1364
|
+
rationale.push('Mode A: pattern_matches confidence ' + recommendedConfidence + ' below 0.7 floor; RECOMMENDED suppressed.');
|
|
1365
|
+
} else {
|
|
1366
|
+
rationale.push('Mode A: no pattern_matches candidate available.');
|
|
1367
|
+
}
|
|
1368
|
+
}
|
|
1369
|
+
if (attributionBreach) {
|
|
1370
|
+
rationale.unshift('canon_part_2_attribution_breach: brain.author is not "brain"; weight demoted to 0.0.');
|
|
1371
|
+
}
|
|
1372
|
+
|
|
1373
|
+
// Wicked escalation note (added to rationale when triggered).
|
|
1374
|
+
const wickedSection = brain && brain.sections && brain.sections.wicked_indicators;
|
|
1375
|
+
if (wickedSection && wickedSection.body) {
|
|
1376
|
+
const score = extractWickedScore(wickedSection.body);
|
|
1377
|
+
if (score >= WICKED_ESCALATION_THRESHOLD) {
|
|
1378
|
+
rationale.push('wicked_escalation: wicked_score >= ' + WICKED_ESCALATION_THRESHOLD + ' triggers soft-systems family.');
|
|
1379
|
+
}
|
|
1380
|
+
}
|
|
1381
|
+
|
|
1382
|
+
// CASC-02: append the navigated-neighborhood clause so /mos:explain-decision
|
|
1383
|
+
// surfaces that routing reflected the graph walk (not just stored edges).
|
|
1384
|
+
if (navigatedNeighborhood !== null) {
|
|
1385
|
+
rationale.push(
|
|
1386
|
+
'Routing reflected the navigated neighborhood (' +
|
|
1387
|
+
navigatedNeighborhood.count + ' ranked neighbor' +
|
|
1388
|
+
(navigatedNeighborhood.count === 1 ? '' : 's') + ', top ' +
|
|
1389
|
+
navigatedNeighborhood.top_node_id + ').'
|
|
1390
|
+
);
|
|
1391
|
+
}
|
|
1392
|
+
|
|
1393
|
+
// Phase 144 (NAV-01): when a sensor reach drives fire_skill, append a clause
|
|
1394
|
+
// naming reach_id + posture ONLY (Part 8: never reach.signal's user-derived
|
|
1395
|
+
// value, evidence bodies, the dispatch handle, or any user content).
|
|
1396
|
+
if (sensorReaches.length > 0) {
|
|
1397
|
+
const topReach = sensorReaches[0];
|
|
1398
|
+
if (topReach && typeof topReach === 'object' && reachIdToSkillFamily(topReach.reach_id) !== null) {
|
|
1399
|
+
rationale.push('Sensor reach fired: ' + topReach.reach_id + '/' + topReach.posture + '.');
|
|
1400
|
+
}
|
|
1401
|
+
}
|
|
1402
|
+
|
|
1403
|
+
trace.chosen_rationale = rationale.join(' ');
|
|
1404
|
+
|
|
1405
|
+
// Compose decision outputs (rule-based, not weighted score). Phase 144: the
|
|
1406
|
+
// sensor reaches are threaded in so a fired reach -> a CANONICAL VERB (ANY
|
|
1407
|
+
// tier), flipping routing_source legacy -> engine at the router as a
|
|
1408
|
+
// consequence.
|
|
1409
|
+
decision.fire_skill = resolveFireSkill(brain, weightApplied, tierMode, sensorReaches);
|
|
1410
|
+
decision.suppress_skills = resolveSuppressSkills(ctx, brain);
|
|
1411
|
+
decision.persona_updates = resolvePersonaUpdates(ctx, brain);
|
|
1412
|
+
decision.offer_next_step = resolveOfferNextStep(ctx, brain);
|
|
1413
|
+
|
|
1414
|
+
// Phase 91-07: problem-type routing contribution. Lazy-require so a
|
|
1415
|
+
// missing module does not crash the engine -- problem-type routing
|
|
1416
|
+
// BIASES the rationale (and may inform fire_skill when no
|
|
1417
|
+
// higher-priority signal has set one), but is never load-bearing.
|
|
1418
|
+
// Per locked decision D-08 + Canon Appendix E rule R4.
|
|
1419
|
+
try {
|
|
1420
|
+
if (brain !== null && brain.sections) {
|
|
1421
|
+
const ptRouter = require('./problem-type-router.cjs');
|
|
1422
|
+
const ptSection = brain.sections.problemtype_classification;
|
|
1423
|
+
const wkSection = brain.sections.wicked_indicators;
|
|
1424
|
+
const parsed = ptRouter.parseProblemTypeSection(ptSection);
|
|
1425
|
+
let routing = null;
|
|
1426
|
+
if (parsed !== null) {
|
|
1427
|
+
routing = ptRouter.routeByProblemType(parsed.type, parsed.confidence);
|
|
1428
|
+
}
|
|
1429
|
+
const wickedEscalate = ptRouter.detectWickedEscalation(wkSection);
|
|
1430
|
+
if (wickedEscalate) {
|
|
1431
|
+
// Wicked override applies regardless of base type. If we have
|
|
1432
|
+
// no base routing, synthesize a stub so applyWickedOverride
|
|
1433
|
+
// has a baseline to overlay.
|
|
1434
|
+
if (routing === null) {
|
|
1435
|
+
routing = {
|
|
1436
|
+
recommended_skills: [],
|
|
1437
|
+
suppressed_skills: [],
|
|
1438
|
+
reason: '',
|
|
1439
|
+
wicked_override: false,
|
|
1440
|
+
};
|
|
1441
|
+
}
|
|
1442
|
+
routing = ptRouter.applyWickedOverride(routing);
|
|
1443
|
+
}
|
|
1444
|
+
|
|
1445
|
+
if (routing !== null && routing.reason && routing.reason.length > 0) {
|
|
1446
|
+
// Append routing reason to chosen_rationale so /mos:explain-
|
|
1447
|
+
// decision can surface the contribution.
|
|
1448
|
+
const existing = trace.chosen_rationale || '';
|
|
1449
|
+
const sep = existing.length > 0 ? ' ' : '';
|
|
1450
|
+
trace.chosen_rationale = existing + sep + 'ProblemType routing: ' + routing.reason;
|
|
1451
|
+
|
|
1452
|
+
// If no higher-priority signal set fire_skill AND routing
|
|
1453
|
+
// recommends a primary skill AND confidence is usable, set
|
|
1454
|
+
// fire_skill to the primary recommendation. Wicked override
|
|
1455
|
+
// always wins when present (its first skill is the soft-
|
|
1456
|
+
// systems entry point).
|
|
1457
|
+
const conf = parsed && typeof parsed.confidence === 'number' ? parsed.confidence : null;
|
|
1458
|
+
const confOk = routing.wicked_override || (typeof conf === 'number' && conf >= 0.5);
|
|
1459
|
+
if (
|
|
1460
|
+
decision.fire_skill === null &&
|
|
1461
|
+
confOk &&
|
|
1462
|
+
Array.isArray(routing.recommended_skills) &&
|
|
1463
|
+
routing.recommended_skills.length > 0
|
|
1464
|
+
) {
|
|
1465
|
+
decision.fire_skill = routing.recommended_skills[0];
|
|
1466
|
+
}
|
|
1467
|
+
}
|
|
1468
|
+
}
|
|
1469
|
+
} catch (_e) {
|
|
1470
|
+
// Routing is biasing-only; never block the decision on a routing
|
|
1471
|
+
// module fault. Leave decision + trace untouched.
|
|
1472
|
+
}
|
|
1473
|
+
|
|
1474
|
+
// Phase 91-08: framework-chain-composer contribution. Lazy-require
|
|
1475
|
+
// so a missing module never crashes the engine -- chain composition
|
|
1476
|
+
// is one signal among five and biases offer_next_step when no higher-
|
|
1477
|
+
// priority signal has populated it. Per locked decision D-09 + Canon
|
|
1478
|
+
// Part 2 Engine 1 + Appendix E. Reads BRAIN.md framework_chain_
|
|
1479
|
+
// predictions section (FEEDS_INTO edges authored by Phase 90-01).
|
|
1480
|
+
// Canon Part 8: zero Brain queries at engine time -- composer reads
|
|
1481
|
+
// only the LOCAL section body passed in via quadruple.
|
|
1482
|
+
try {
|
|
1483
|
+
if (brain !== null && brain.sections) {
|
|
1484
|
+
const chainComposer = require('./framework-chain-composer.cjs');
|
|
1485
|
+
const chainSection = brain.sections.framework_chain_predictions;
|
|
1486
|
+
if (chainSection !== null && chainSection !== undefined) {
|
|
1487
|
+
const edges = chainComposer.parseFrameworkChainSection(chainSection);
|
|
1488
|
+
if (edges.length > 0) {
|
|
1489
|
+
const completed = chainComposer.detectCompletedFramework(
|
|
1490
|
+
null, // roomDir is not needed when reasoning carries the signal
|
|
1491
|
+
t.sectionPath || null,
|
|
1492
|
+
quadruple.reasoning || null
|
|
1493
|
+
);
|
|
1494
|
+
if (completed !== null) {
|
|
1495
|
+
const proposal = chainComposer.proposeNextFramework(completed, edges);
|
|
1496
|
+
if (proposal !== null) {
|
|
1497
|
+
// User override detection: if lastTurnOffer was the chain
|
|
1498
|
+
// proposal AND current turn invokes a DIFFERENT /mos:
|
|
1499
|
+
// command, record REJECTED chain suggestion as graph data
|
|
1500
|
+
// per Canon Part 4. The override check runs BEFORE we
|
|
1501
|
+
// overwrite offer_next_step so the user's intent (in
|
|
1502
|
+
// userText) gets recorded against the prior offer.
|
|
1503
|
+
const lastOffer = ctx.lastTurnOffer;
|
|
1504
|
+
const userText = typeof t.userText === 'string' ? t.userText : '';
|
|
1505
|
+
if (
|
|
1506
|
+
lastOffer &&
|
|
1507
|
+
typeof lastOffer === 'object' &&
|
|
1508
|
+
typeof lastOffer.command === 'string' &&
|
|
1509
|
+
lastOffer.command.length > 0 &&
|
|
1510
|
+
userText.length > 0
|
|
1511
|
+
) {
|
|
1512
|
+
// Match a /mos: command in the user text.
|
|
1513
|
+
const userCmdMatch = /\/mos:[a-z][a-z0-9-]*/i.exec(userText);
|
|
1514
|
+
if (userCmdMatch !== null) {
|
|
1515
|
+
const userCmd = userCmdMatch[0];
|
|
1516
|
+
if (userCmd !== lastOffer.command) {
|
|
1517
|
+
// Override recorded as graph data per Canon Part 4.
|
|
1518
|
+
const existing = trace.chosen_rationale || '';
|
|
1519
|
+
const sep = existing.length > 0 ? ' ' : '';
|
|
1520
|
+
trace.chosen_rationale =
|
|
1521
|
+
existing + sep +
|
|
1522
|
+
'REJECTED chain suggestion: user invoked ' + userCmd +
|
|
1523
|
+
' instead of ' + lastOffer.command + '.';
|
|
1524
|
+
trace.chain_override_recorded = true;
|
|
1525
|
+
}
|
|
1526
|
+
}
|
|
1527
|
+
}
|
|
1528
|
+
|
|
1529
|
+
// Set offer_next_step ONLY when no higher-priority signal
|
|
1530
|
+
// has already populated it. Chain composition is one
|
|
1531
|
+
// signal among five; it never overwrites a stronger one.
|
|
1532
|
+
if (decision.offer_next_step === null) {
|
|
1533
|
+
decision.offer_next_step = {
|
|
1534
|
+
command: proposal.command,
|
|
1535
|
+
reason: proposal.reason,
|
|
1536
|
+
};
|
|
1537
|
+
// Surface chain-specific eligibility flag in trace so
|
|
1538
|
+
// offer-presenter (Plan 91-04) can render the
|
|
1539
|
+
// RECOMMENDED marker per Canon Part 3 Section 6 when
|
|
1540
|
+
// Mode A holds AND chain confidence >= 0.7.
|
|
1541
|
+
trace.chain_recommended_eligible = proposal.recommended_eligible === true;
|
|
1542
|
+
// When the engine's RECOMMENDED gate already fired
|
|
1543
|
+
// (e.g. via pattern_matches), the chain proposal piggy-
|
|
1544
|
+
// backs on the existing marker. When pattern_matches
|
|
1545
|
+
// had no candidate (the common case in Wave 3 fixtures)
|
|
1546
|
+
// and Mode A holds and the chain proposal is eligible,
|
|
1547
|
+
// promote the marker so the presenter renders it.
|
|
1548
|
+
if (
|
|
1549
|
+
tierMode === 'mode_a' &&
|
|
1550
|
+
proposal.recommended_eligible === true &&
|
|
1551
|
+
trace.brain_md_recommended_marker_rendered === false
|
|
1552
|
+
) {
|
|
1553
|
+
trace.brain_md_recommended_marker_rendered = true;
|
|
1554
|
+
trace.brain_md_recommended_confidence =
|
|
1555
|
+
typeof trace.brain_md_recommended_confidence === 'number' &&
|
|
1556
|
+
trace.brain_md_recommended_confidence > proposal.confidence
|
|
1557
|
+
? trace.brain_md_recommended_confidence
|
|
1558
|
+
: proposal.confidence;
|
|
1559
|
+
}
|
|
1560
|
+
// Append chain rationale for /mos:explain-decision.
|
|
1561
|
+
const existing2 = trace.chosen_rationale || '';
|
|
1562
|
+
const sep2 = existing2.length > 0 ? ' ' : '';
|
|
1563
|
+
trace.chosen_rationale =
|
|
1564
|
+
existing2 + sep2 +
|
|
1565
|
+
'Framework chain: ' + completed + ' FEEDS_INTO ' + proposal.next +
|
|
1566
|
+
' (Brain confidence ' + proposal.confidence.toFixed(2) + ').';
|
|
1567
|
+
}
|
|
1568
|
+
}
|
|
1569
|
+
}
|
|
1570
|
+
}
|
|
1571
|
+
}
|
|
1572
|
+
}
|
|
1573
|
+
} catch (_e) {
|
|
1574
|
+
// Chain composition is biasing-only; never block the decision on
|
|
1575
|
+
// a composer fault. Leave decision + trace untouched.
|
|
1576
|
+
}
|
|
1577
|
+
|
|
1578
|
+
// Phase 191 (191-03): the main-path lift application, placed AFTER every
|
|
1579
|
+
// existing fire_skill contribution (sensor / brain / problem-type /
|
|
1580
|
+
// chain) so the projection-sourced candidate is the LOWEST-precedence
|
|
1581
|
+
// source in the ladder -- it only fires when every other signal stayed
|
|
1582
|
+
// silent this turn (191-IFACE.md section 5). A fault-safe no-op when
|
|
1583
|
+
// liftResult is null (R7).
|
|
1584
|
+
applyProjectionLift(decision, trace, liftResult);
|
|
1585
|
+
|
|
1586
|
+
// Phase 144 (Task 2): the Zep-shaped LOCAL trace.context_assembly + LOCAL
|
|
1587
|
+
// latency telemetry on the populated return path. Computed AFTER all
|
|
1588
|
+
// fire_skill contributions (sensor / brain / problem-type / chain) so
|
|
1589
|
+
// decision_grounding names the FINAL justification. LOCAL trace JSON only;
|
|
1590
|
+
// nothing reaches the Brain. No await / I/O (pure scalar shaping) -- the
|
|
1591
|
+
// 1200ms NAV budget is untouched.
|
|
1592
|
+
trace.context_assembly = buildContextAssembly(
|
|
1593
|
+
navigatedNeighborhood,
|
|
1594
|
+
sensorReaches,
|
|
1595
|
+
groundingForFireSkill(decision.fire_skill, sensorReaches, brain, navigatedNeighborhood)
|
|
1596
|
+
);
|
|
1597
|
+
trace._meta = {
|
|
1598
|
+
latencies_ms: {
|
|
1599
|
+
dispatchSensors_ms: dispatchSensorsMs,
|
|
1600
|
+
decide_total_ms: Date.now() - decideStartMs,
|
|
1601
|
+
},
|
|
1602
|
+
};
|
|
1603
|
+
|
|
1604
|
+
return decision;
|
|
1605
|
+
} catch (err) {
|
|
1606
|
+
// Graceful degradation: never throw out of decide().
|
|
1607
|
+
const safe = shared.emptyDecision();
|
|
1608
|
+
safe.decision_trace.chosen_rationale =
|
|
1609
|
+
'engine_fault: ' + (err && err.message ? err.message : String(err));
|
|
1610
|
+
safe.decision_trace.brain_md_tier_mode = 'tier_0';
|
|
1611
|
+
safe.decision_trace.brain_md_staleness = 'absent';
|
|
1612
|
+
return safe;
|
|
1613
|
+
}
|
|
1614
|
+
}
|
|
1615
|
+
|
|
1616
|
+
// ---------------------------------------------------------------------------
|
|
1617
|
+
// Phase 205 (item 7) -- the frozen-six drift-guard READ-ONLY accessor.
|
|
1618
|
+
//
|
|
1619
|
+
// The whole 205 phase rides on ONE floor invariant: GRILL / REFRAME / FUSION are
|
|
1620
|
+
// nav-dial POSITIONS and existing-reach routing, they mint NO new reach_id. This
|
|
1621
|
+
// accessor gives the drift guard a single read point ON THE decide() SPINE MODULE
|
|
1622
|
+
// to assert the frozen constitutional set holds after the 205 machinery runs. It
|
|
1623
|
+
// is strictly READ-ONLY: it re-reads the canonical values from their source
|
|
1624
|
+
// modules and returns a FROZEN snapshot, changing no value and adding no reach.
|
|
1625
|
+
// - REACH_IDS : the six frozen reach_ids (sensor-types.cjs)
|
|
1626
|
+
// - MAX_K : the chooser-row cap = 3 (f-selector-ranker.cjs)
|
|
1627
|
+
// - DIAL_REACH_K : the reach-bank size = 6 (dial-reach-orchestrator.cjs)
|
|
1628
|
+
// - RECOMMEND_FLOOR : the 0.70 recommend detent (dial-reach-orchestrator.cjs)
|
|
1629
|
+
// - MARGIN_THRESHOLD : the 0.15 margin detent (dial-reach-orchestrator.cjs)
|
|
1630
|
+
// A require fault degrades to a null field (the guard then fails loudly, which is
|
|
1631
|
+
// the correct behavior for a tamper/floor test).
|
|
1632
|
+
function frozenConstitutionalSet() {
|
|
1633
|
+
let reachIds = null;
|
|
1634
|
+
let maxK = null;
|
|
1635
|
+
let dialReachK = null;
|
|
1636
|
+
let recommendFloor = null;
|
|
1637
|
+
let marginThreshold = null;
|
|
1638
|
+
try {
|
|
1639
|
+
const st = require('./sensors/sensor-types.cjs');
|
|
1640
|
+
reachIds = Array.isArray(st.REACH_IDS) ? Object.freeze(st.REACH_IDS.slice()) : null;
|
|
1641
|
+
} catch (_e) { reachIds = null; }
|
|
1642
|
+
try {
|
|
1643
|
+
const ranker = require('../workflow/f-selector-ranker.cjs');
|
|
1644
|
+
maxK = ranker.MAX_K;
|
|
1645
|
+
} catch (_e) { maxK = null; }
|
|
1646
|
+
try {
|
|
1647
|
+
const orch = require('../hmi/dial-reach-orchestrator.cjs');
|
|
1648
|
+
dialReachK = orch.DIAL_REACH_K;
|
|
1649
|
+
recommendFloor = orch.RECOMMEND_FLOOR;
|
|
1650
|
+
marginThreshold = orch.MARGIN_THRESHOLD;
|
|
1651
|
+
} catch (_e) { /* leave nulls */ }
|
|
1652
|
+
return Object.freeze({
|
|
1653
|
+
REACH_IDS: reachIds,
|
|
1654
|
+
MAX_K: maxK,
|
|
1655
|
+
DIAL_REACH_K: dialReachK,
|
|
1656
|
+
RECOMMEND_FLOOR: recommendFloor,
|
|
1657
|
+
MARGIN_THRESHOLD: marginThreshold,
|
|
1658
|
+
});
|
|
1659
|
+
}
|
|
1660
|
+
|
|
1661
|
+
module.exports = {
|
|
1662
|
+
decide: decide,
|
|
1663
|
+
// Phase 205 (item 7): the read-only frozen-six drift-guard accessor.
|
|
1664
|
+
frozenConstitutionalSet: frozenConstitutionalSet,
|
|
1665
|
+
// Phase 177-01 (BCH-06): the Brain RECOMMENDED-gate confidence floor (0.70),
|
|
1666
|
+
// exported so downstream engine-side consumers can COMPUTE thresholds relative
|
|
1667
|
+
// to it rather than hand-typing the number. The behavioral-channel ceiling in
|
|
1668
|
+
// lib/workflow/f-selector-ranker.cjs derives from this const (ceiling = floor +
|
|
1669
|
+
// 0.15 == 0.85), so the >= 15-point invariant is computed, not duplicated.
|
|
1670
|
+
RECOMMENDED_CONFIDENCE_FLOOR: RECOMMENDED_CONFIDENCE_FLOOR,
|
|
1671
|
+
// Phase 148-05 (IRW-05): offer-resolver + suggest-next unified onto the ONE
|
|
1672
|
+
// selector-dispatcher.pickShape F.1 host (single render path, no bespoke
|
|
1673
|
+
// renderer).
|
|
1674
|
+
resolveOfferNextStep: resolveOfferNextStep,
|
|
1675
|
+
renderOfferNextStep: renderOfferNextStep,
|
|
1676
|
+
suggestNext: suggestNext,
|
|
1677
|
+
// Internal helpers exposed for downstream Phase 91 plans + testing:
|
|
1678
|
+
reachIdToSkillFamily: reachIdToSkillFamily,
|
|
1679
|
+
// Phase 172-05: exposed so the hats engine-flip contract test can exercise the
|
|
1680
|
+
// sensor-reach -> canonical-verb resolution directly (resolveFireSkill step 2).
|
|
1681
|
+
resolveFireSkill: resolveFireSkill,
|
|
1682
|
+
// Phase 177-09 (BCH-07 / BCH-08): the SEAM 3 behavioral-channel modifier + its
|
|
1683
|
+
// two pure helpers, exported so the BCH-07 dormant-byte-identical suite and the
|
|
1684
|
+
// BCH-08 tier-ordering suite can assert the contract WITHOUT arming the flag.
|
|
1685
|
+
behavioralChannelModifier: behavioralChannelModifier,
|
|
1686
|
+
rankBehavioralCue: rankBehavioralCue,
|
|
1687
|
+
bandCueLosesToBrain: bandCueLosesToBrain,
|
|
1688
|
+
resolveTierMode: shared.resolveTierMode,
|
|
1689
|
+
applyStalenessMultiplier: shared.applyStalenessMultiplier,
|
|
1690
|
+
evaluateRecommendedGate: function (decision, quadruple) {
|
|
1691
|
+
// Convenience accessor matching plan frontmatter contract.
|
|
1692
|
+
return decision &&
|
|
1693
|
+
decision.decision_trace &&
|
|
1694
|
+
decision.decision_trace.brain_md_recommended_marker_rendered === true;
|
|
1695
|
+
},
|
|
1696
|
+
};
|