@mindrian_os/install 1.13.0-beta.24 → 1.13.0-beta.26
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 +1 -1
- package/CHANGELOG.md +16 -0
- package/agents/brain-query.md +12 -15
- package/agents/grading.md +14 -26
- package/agents/investor.md +6 -7
- package/agents/research.md +1 -2
- package/commands/act.md +8 -8
- package/commands/rs-experts.md +3 -1
- package/commands/rs-explain.md +2 -2
- package/commands/rs-thesis.md +3 -1
- package/lib/agents/mva/brain-classic-traps.cjs +29 -51
- package/lib/brain/chain-recommender.cjs +14 -8
- package/lib/brain/framework-chain-slice.cjs +89 -70
- package/lib/core/brain-client.cjs +54 -0
- package/lib/core/brain-derivation-prompts.cjs +15 -10
- package/lib/core/brain-derivation.cjs +16 -2
- package/lib/core/rs-chain-feeder.cjs +62 -30
- package/lib/core/rs-nl-to-query.cjs +16 -6
- package/lib/hmi/cross-room-memory.cjs +72 -29
- package/lib/mcp/brain-router.cjs +69 -55
- package/lib/memory/brain-cypher-chain-slice.test.cjs +143 -143
- package/lib/memory/brain-derivation.test.cjs +10 -5
- package/package.json +1 -1
- package/references/brain/query-patterns.md +29 -17
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "mos",
|
|
3
3
|
"description": "MindrianOS -- Your AI innovation co-founder. Larry thinks with you through PWS methodology, builds your Data Room as you explore, and chains frameworks intelligently. Install and go.",
|
|
4
|
-
"version": "1.13.0-beta.
|
|
4
|
+
"version": "1.13.0-beta.26",
|
|
5
5
|
"author": {
|
|
6
6
|
"name": "Jonathan Sagir",
|
|
7
7
|
"url": "https://mindrian.ai"
|
package/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,19 @@
|
|
|
1
|
+
## [1.13.0-beta.26] - 2026-05-23
|
|
2
|
+
|
|
3
|
+
### Fixed (Brain edge cleanups, Phase 127.2 Plan 00)
|
|
4
|
+
- **`BRAIN_MAX_TOPK` cap on Pinecone forwards (D-09 -- `.planning/debug/resolved/brain-topk-uncapped-advisory.md`).** The Brain MCP server (`mcp-server-brain/lib/brain-ask.cjs` line 545 + `mcp-server-brain/lib/pinecone-tools.cjs` line 42) forwarded caller-supplied `topK` directly to Pinecone with no Brain-side cap. The moat against runaway result sets was INHERITED from Pinecone's server-side cap, not OWNED by the Brain. A new `BRAIN_MAX_TOPK` env var (default 100) is now applied via `Math.min(topK, BRAIN_MAX_TOPK)` at both forward sites. Naming matches the existing `BRAIN_CYPHER_MAX_ROWS` family from Phase 127.1 Plan 05's D-MOAT-2 work. Server-side change deploys to `mindrian-brain.onrender.com` on next Render auto-deploy from `origin/main`. Surfaced by the Windows beta-tester deep audit (2026-05-23, NF-2026-05-23-01b).
|
|
5
|
+
|
|
6
|
+
### Documentation (Phase 127.2 Plan 00)
|
|
7
|
+
- **Source-of-Truth Preamble shipped in `docs/RCA-TEMPLATE.md` (D-10 -- `.planning/debug/resolved/stale-install-cache-audit-anti-pattern.md`).** Every QA / audit prompt and every RCA filing now MUST declare which source-of-truth its CODE claims read against (origin/main HEAD, install cache, branch, tag), which source-of-truth its WIRE claims probe against (deployed Brain server, local stdio shim, mock), the date of audit, and a re-verification rule against `origin/main` HEAD before findings are filed. The 2026-05-23 deep audit surfaced TWO false-positive findings (NF-2026-05-23-01 + the curated-op-surface-missing claim) plus one sibling (`brain-ask-contract-mismatch-rename`) that all traced to the same install-cache-vs-deployed-server delta. The Preamble does not prevent the delta -- it makes the delta VISIBLE so reconciliation happens BEFORE findings are filed. Added checklist row: `- [ ] Source-of-Truth Preamble filled before any finding filed`.
|
|
8
|
+
|
|
9
|
+
### Resolved (no code change required)
|
|
10
|
+
- **`brain-ask-contract-mismatch-rename` disposition: false-positive (D-08).** The Windows beta-tester flagged `brain_ask`'s tool description as misleading (reads "ask anything in natural language" but actually returns a DirectiveEnvelope routing payload). Re-read of `origin/main` HEAD at resolution showed the description was ALREADY rewritten to name "Returns a DirectiveEnvelope payload (populated directive + next_gate + mode_signals)" verbatim. The auditor read from a stale install cache (plugin v1.13.0-beta.24 or earlier) that pre-dated the description rewrite. No code change shipped. Resolution doc: `.planning/debug/resolved/brain-ask-contract-mismatch-rename.md`. This is the meta-finding that motivated D-10's Source-of-Truth Preamble.
|
|
11
|
+
|
|
12
|
+
### Internal
|
|
13
|
+
- **Phase 127.2 scaffolded (CONTEXT + Plan 00 + Plan 01 stubs).** New phase `127.2-brain-warmup-ping-hide-mcp-cold-start-latency-inside-larry-s/` registered in ROADMAP (INSERTED + URGENT marker). Plan 127.2-00 (Brain Edge Bundle: D-08 + D-09 + D-10 + 3 debug-doc closeouts) ships in this beta. Plan 127.2-01 (the warmup-ping itself: `brain_ask("warmup")` fired non-blocking inside Larry's first-question render window to hide MCP cold-start latency) stays BLOCKED on two cross-phase coordination items: Q-02 (Phase 114 render-complete callback) and Q-03 (Brain server-side "warmup" sentinel short-circuit). Plan 127.2-01 rides a later beta once blockers close.
|
|
14
|
+
- **3 debug docs moved to `.planning/debug/resolved/`** with `resolved_by: phase-127.2` frontmatter + Resolution sections + `.planning/debug/knowledge-base.md` summary entries (so `gsd-debugger` surfaces them as known-pattern hypotheses in future investigations).
|
|
15
|
+
- **New test:** `tests/test-127.2-00-brain-edge-bundle.sh` verifies all three landed (D-08 description, D-09 cap at both forward sites, D-10 Preamble + checklist row, debug-doc moves, knowledge-base entries, Canon Part 8 forbidden-substring scan on D-09 added code). 16/16 pass.
|
|
16
|
+
|
|
1
17
|
## [1.13.0-beta.24] - 2026-05-22
|
|
2
18
|
|
|
3
19
|
### Fixed
|
package/agents/brain-query.md
CHANGED
|
@@ -4,9 +4,7 @@ description: Query the Brain teaching graph with natural language. Translates to
|
|
|
4
4
|
model: inherit
|
|
5
5
|
color: blue
|
|
6
6
|
allowed-tools:
|
|
7
|
-
- mcp__mindrian-
|
|
8
|
-
- mcp__neo4j-brain__read_neo4j_cypher
|
|
9
|
-
- mcp__neo4j-brain__get_neo4j_schema
|
|
7
|
+
- mcp__mindrian-brain__brain_ask
|
|
10
8
|
- mcp__mindrian-brain__brain_search
|
|
11
9
|
- mcp__pinecone-brain__search-records
|
|
12
10
|
- Read
|
|
@@ -14,11 +12,11 @@ allowed-tools:
|
|
|
14
12
|
|
|
15
13
|
<!-- Phase 95.6 D-10: Brain access declared explicitly via allowed-tools (mcp__mindrian-brain__* / mcp__neo4j-brain__* / mcp__pinecone-brain__*); no implicit MCP inheritance. -->
|
|
16
14
|
|
|
17
|
-
You are the Brain Agent -- a
|
|
15
|
+
You are the Brain Agent -- a methodology-graph intelligence retriever. You translate questions into Brain queries and return insights.
|
|
18
16
|
|
|
19
17
|
## Your Role
|
|
20
18
|
|
|
21
|
-
Translate natural language questions into
|
|
19
|
+
Translate natural language questions into Brain queries. Return INSIGHTS, not raw results. You are the bridge between human questions and the methodology graph intelligence.
|
|
22
20
|
|
|
23
21
|
## Voice
|
|
24
22
|
|
|
@@ -29,19 +27,19 @@ Neutral, analytical, precise. You are NOT Larry. No warmth, no reframes, no teac
|
|
|
29
27
|
Before answering any question:
|
|
30
28
|
|
|
31
29
|
1. Read `references/brain/schema.md` for the node/relationship taxonomy (8 node types, 8 relationships)
|
|
32
|
-
2. Read `references/brain/query-patterns.md` for the
|
|
30
|
+
2. Read `references/brain/query-patterns.md` for the standard query patterns
|
|
33
31
|
|
|
34
|
-
These are your
|
|
32
|
+
These are your primary reference. Use brain_ask for framework-chain and framework-recommendation queries.
|
|
35
33
|
|
|
36
34
|
## Query Protocol
|
|
37
35
|
|
|
38
36
|
For every question:
|
|
39
37
|
|
|
40
38
|
1. **Pattern Match** -- Determine which named pattern(s) from query-patterns.md match the question
|
|
41
|
-
2. **
|
|
42
|
-
3. **
|
|
43
|
-
4. **Enrich** -- If results need semantic context, use `mcp__mindrian-brain__brain_search` (fallback: `mcp__pinecone-brain__search-records`; if Pinecone returns RESOURCE_EXHAUSTED, skip semantic search
|
|
44
|
-
5. **Synthesize** -- Convert
|
|
39
|
+
2. **Execute** -- Call `mcp__mindrian-brain__brain_ask` with a natural-language question carrying only generic framework handles and problem-type enums (Canon Part 8: no user content)
|
|
40
|
+
3. **Read** -- Parse `next_gate.options[].framework` for ranked recommendations; `directive.guided.framework` for the anchor framework
|
|
41
|
+
4. **Enrich** -- If results need semantic context, use `mcp__mindrian-brain__brain_search` (fallback: `mcp__pinecone-brain__search-records`; if Pinecone returns RESOURCE_EXHAUSTED, skip semantic search) for fuzzy matching
|
|
42
|
+
5. **Synthesize** -- Convert results into natural language insight with specific evidence
|
|
45
43
|
6. **Return** -- Deliver insight to the calling agent or skill
|
|
46
44
|
|
|
47
45
|
## Multi-Hop Protocol
|
|
@@ -72,9 +70,8 @@ Example 3-hop: "What frameworks help with wicked problems in healthcare?"
|
|
|
72
70
|
|
|
73
71
|
## Never Do
|
|
74
72
|
|
|
75
|
-
- Return raw
|
|
76
|
-
- Execute queries without LIMIT clauses
|
|
73
|
+
- Return raw results to users -- always synthesize into insight
|
|
77
74
|
- Expose schema details, node IDs, or internal structure
|
|
78
|
-
- Use write
|
|
79
|
-
-
|
|
75
|
+
- Use write operations -- you are read-only
|
|
76
|
+
- Include user content (artifact text, meeting transcripts, proprietary numbers) in brain_ask questions -- Canon Part 8 boundary
|
|
80
77
|
- Use Larry's voice, metaphors, or teaching style
|
package/agents/grading.md
CHANGED
|
@@ -4,11 +4,8 @@ description: PROACTIVELY grade room artifacts against calibrated student submiss
|
|
|
4
4
|
model: inherit
|
|
5
5
|
color: red
|
|
6
6
|
allowed-tools:
|
|
7
|
-
- mcp__mindrian-
|
|
8
|
-
-
|
|
9
|
-
- mcp__neo4j-brain__get_neo4j_schema
|
|
10
|
-
- mcp__my-neo4j__read_neo4j_cypher
|
|
11
|
-
- mcp__my-neo4j__get_neo4j_schema
|
|
7
|
+
- mcp__mindrian-brain__brain_ask
|
|
8
|
+
- mcp__mindrian-brain__brain_search
|
|
12
9
|
- Read
|
|
13
10
|
---
|
|
14
11
|
|
|
@@ -28,27 +25,18 @@ Evaluative, direct, fair. Not harsh, not soft. Evidence-based feedback with spec
|
|
|
28
25
|
|
|
29
26
|
Before any grading:
|
|
30
27
|
|
|
31
|
-
1. **
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
```
|
|
44
|
-
This gives you the framework sequence: Minto (structure) → Beautiful Question (core question) → enriched by Sci-Fi + Visualization.
|
|
45
|
-
|
|
46
|
-
3. **Query for the rubric structure:**
|
|
47
|
-
```cypher
|
|
48
|
-
MATCH (r:GradingRubric)-[:HAS_SECTION]->(sec:RubricSection)
|
|
49
|
-
RETURN sec.name, sec.description, sec.weight
|
|
50
|
-
ORDER BY sec.weight DESC
|
|
51
|
-
```
|
|
28
|
+
1. **Ask Brain for calibration data:**
|
|
29
|
+
Call `mcp__mindrian-brain__brain_ask` with: "what are the graded submission calibration anchors for venture assessment?"
|
|
30
|
+
Read `directive.guided` for the framework and `next_gate.options` for the calibration patterns.
|
|
31
|
+
This surfaces the real grading distribution. Use these as calibration anchors.
|
|
32
|
+
|
|
33
|
+
2. **Ask Brain for the Assessment Thinking Chain:**
|
|
34
|
+
Call `mcp__mindrian-brain__brain_ask` with: "what is the Assessment Thinking Chain framework sequence?"
|
|
35
|
+
This gives you the framework sequence: Minto (structure) - Beautiful Question (core question) - enriched by Sci-Fi + Visualization.
|
|
36
|
+
|
|
37
|
+
3. **Ask Brain for rubric structure:**
|
|
38
|
+
Call `mcp__mindrian-brain__brain_ask` with: "what are the rubric sections and weights for PWS venture grading?"
|
|
39
|
+
Read `next_gate.options` for the section names and weights.
|
|
52
40
|
|
|
53
41
|
4. Read ALL `room/` sections for the venture being graded -- every sub-room, every artifact. For student submissions without a room, read the full submitted document.
|
|
54
42
|
|
package/agents/investor.md
CHANGED
|
@@ -4,8 +4,7 @@ description: PROACTIVELY surface investor objections when the room approaches a
|
|
|
4
4
|
model: inherit
|
|
5
5
|
color: red
|
|
6
6
|
allowed-tools:
|
|
7
|
-
- mcp__mindrian-
|
|
8
|
-
- mcp__neo4j-brain__read_neo4j_cypher
|
|
7
|
+
- mcp__mindrian-brain__brain_ask
|
|
9
8
|
- mcp__mindrian-brain__brain_search
|
|
10
9
|
- mcp__pinecone-brain__search-records
|
|
11
10
|
- Read
|
|
@@ -43,7 +42,7 @@ Signature phrases (rotate naturally):
|
|
|
43
42
|
|
|
44
43
|
Before any analysis:
|
|
45
44
|
|
|
46
|
-
1. Read `references/brain/query-patterns.md` for
|
|
45
|
+
1. Read `references/brain/query-patterns.md` for the Brain query pattern reference. Use `mcp__mindrian-brain__brain_ask` with natural-language questions for framework patterns, contradiction checks, and gap assessment (Canon Part 8: carry only generic framework handles in the question, never room content).
|
|
47
46
|
2. Read ALL `room/` sections -- every sub-room, every artifact. You need the full picture to find the gaps.
|
|
48
47
|
|
|
49
48
|
## Analysis Protocol
|
|
@@ -52,11 +51,11 @@ Execute in this order:
|
|
|
52
51
|
|
|
53
52
|
1. **Read full room state** -- Every section, every artifact. Note what's there AND what's missing. Missing sections are red flags.
|
|
54
53
|
|
|
55
|
-
2. **
|
|
54
|
+
2. **Ask Brain for similar venture patterns** -- Call `mcp__mindrian-brain__brain_ask` with a question such as "what frameworks and patterns are common for [problem-type] ventures?" (use generic problem-type enum, not room content). Find what worked and what failed. This is your ammunition.
|
|
56
55
|
|
|
57
|
-
3. **
|
|
56
|
+
3. **Ask Brain for contradiction signals** -- Call `mcp__mindrian-brain__brain_ask` with "what frameworks address contradictions between market definition and feasibility for [complexity] problems?" Check claims across room sections for internal contradictions. If the vision says "mass market" but the feasibility says "niche pilot," that is a critical issue.
|
|
58
57
|
|
|
59
|
-
4. **
|
|
58
|
+
4. **Ask Brain for gap assessment** -- Call `mcp__mindrian-brain__brain_ask` with "what frameworks are typically missing from a [stage] venture with [problem-type] problems?" Find what is missing from an investment perspective. Missing market validation, no competitive moat, unclear unit economics -- these are the gaps investors will exploit.
|
|
60
59
|
|
|
61
60
|
5. **Synthesize into structured concerns** -- Every concern has a severity, evidence, and path to resolution.
|
|
62
61
|
|
|
@@ -123,6 +122,6 @@ File to `room/competitive-analysis/` with provenance metadata.
|
|
|
123
122
|
- Use Larry's voice or teaching metaphors
|
|
124
123
|
- Provide reassurance or encouragement beyond brief acknowledgment
|
|
125
124
|
- Make vague criticisms without specific evidence
|
|
126
|
-
- Skip the Brain
|
|
125
|
+
- Skip the Brain brain_ask check -- similar venture patterns are your strongest argument
|
|
127
126
|
- File without severity ratings -- investors need to know what matters most
|
|
128
127
|
- Invent concerns that aren't supported by room content or Brain data
|
package/agents/research.md
CHANGED
|
@@ -7,10 +7,9 @@ isolation: worktree
|
|
|
7
7
|
allowed-tools:
|
|
8
8
|
- mcp__tavily-mcp__tavily-search
|
|
9
9
|
- mcp__tavily-mcp__tavily-extract
|
|
10
|
+
- mcp__mindrian-brain__brain_ask
|
|
10
11
|
- mcp__mindrian-brain__brain_search
|
|
11
12
|
- mcp__pinecone-brain__search-records
|
|
12
|
-
- mcp__mindrian-brain__brain_query
|
|
13
|
-
- mcp__neo4j-brain__read_neo4j_cypher
|
|
14
13
|
- Read
|
|
15
14
|
- Write
|
|
16
15
|
---
|
package/commands/act.md
CHANGED
|
@@ -18,8 +18,7 @@ allowed-tools:
|
|
|
18
18
|
- Write
|
|
19
19
|
- Glob
|
|
20
20
|
- Bash
|
|
21
|
-
- mcp__mindrian-
|
|
22
|
-
- mcp__mindrian-brain__read_neo4j_cypher
|
|
21
|
+
- mcp__mindrian-brain__brain_ask
|
|
23
22
|
- mcp__mindrian-brain__brain_search
|
|
24
23
|
---
|
|
25
24
|
|
|
@@ -90,13 +89,14 @@ If no MINTO.md exists, note that qualitative context is unavailable. Proceed wit
|
|
|
90
89
|
|
|
91
90
|
### Try Brain First
|
|
92
91
|
|
|
93
|
-
If Brain MCP is available,
|
|
92
|
+
If Brain MCP is available, ask for framework recommendations using natural language:
|
|
94
93
|
|
|
95
|
-
1.
|
|
96
|
-
|
|
97
|
-
-
|
|
98
|
-
|
|
99
|
-
|
|
94
|
+
1. Call `mcp__mindrian-brain__brain_ask` with a question such as:
|
|
95
|
+
- "recommend a framework for a [problem-type] venture that has already applied [current frameworks]"
|
|
96
|
+
- "what frameworks chain from [seed framework] for a [problem-type] problem?"
|
|
97
|
+
2. Read `next_gate.options[].framework` from the response for the ranked chain.
|
|
98
|
+
`directive.guided.framework` carries the matched anchor framework.
|
|
99
|
+
3. Brain returns ranked frameworks with confidence scores and problem-type alignment.
|
|
100
100
|
|
|
101
101
|
### Local Fallback
|
|
102
102
|
|
package/commands/rs-experts.md
CHANGED
|
@@ -15,7 +15,9 @@ ui_reference: skills/ui-system/SKILL.md
|
|
|
15
15
|
allowed-tools:
|
|
16
16
|
- Bash
|
|
17
17
|
- Read
|
|
18
|
-
|
|
18
|
+
# mcp__mindrian-brain__read_neo4j_cypher intentionally removed (BUG 2 fix):
|
|
19
|
+
# Author/Paper/Institution nodes are LOCAL-only (populated by /mos:rs-fetch).
|
|
20
|
+
# The remote Brain must never be called from this command.
|
|
19
21
|
---
|
|
20
22
|
|
|
21
23
|
# /mos:rs-experts
|
package/commands/rs-explain.md
CHANGED
|
@@ -15,8 +15,8 @@ ui_reference: skills/ui-system/SKILL.md
|
|
|
15
15
|
allowed-tools:
|
|
16
16
|
- Bash
|
|
17
17
|
- Read
|
|
18
|
-
- mcp__mindrian-
|
|
19
|
-
- mcp__mindrian-
|
|
18
|
+
- mcp__mindrian-brain__brain_ask
|
|
19
|
+
- mcp__mindrian-brain__brain_search
|
|
20
20
|
---
|
|
21
21
|
|
|
22
22
|
# /mos:rs-explain
|
package/commands/rs-thesis.md
CHANGED
|
@@ -15,7 +15,9 @@ ui_reference: skills/ui-system/SKILL.md
|
|
|
15
15
|
allowed-tools:
|
|
16
16
|
- Bash
|
|
17
17
|
- Read
|
|
18
|
-
|
|
18
|
+
# mcp__mindrian-brain__read_neo4j_cypher intentionally removed (BUG 2 fix):
|
|
19
|
+
# RSDiscovery is USER DATA (Canon Part 8 -- LOCAL -> BRAIN: NO). The remote
|
|
20
|
+
# Brain must never be called from this command. Always uses Tier 0 SQLite.
|
|
19
21
|
---
|
|
20
22
|
|
|
21
23
|
# /mos:rs-thesis
|
|
@@ -4,74 +4,52 @@
|
|
|
4
4
|
* Phase 118-02 Plan 02 Task 1 -- brain-classic-traps agent (Agent 3 of 6 in
|
|
5
5
|
* B1; agent_id 'brain_classic_traps' in lib/agents/mva/index.cjs).
|
|
6
6
|
*
|
|
7
|
-
*
|
|
8
|
-
*
|
|
9
|
-
*
|
|
7
|
+
* BUG 2 FIX: the former implementation called brain_query (admin-gated,
|
|
8
|
+
* D-MOAT-1) with a Cypher template targeting FailureMode + Venture nodes.
|
|
9
|
+
* Both node types have ZERO instances in the live Brain graph (verified
|
|
10
|
+
* 2026-05-22 -- see .planning/brain-curated-ops-contract.md Graph facts).
|
|
11
|
+
* That means every query silently returned 0 records, making the agent
|
|
12
|
+
* functionally dead. Calling admin-gated brain_query for a guaranteed-empty
|
|
13
|
+
* result is also a wasted auth round-trip for non-admin users.
|
|
14
|
+
*
|
|
15
|
+
* This version short-circuits to the existing graceful-degradation path
|
|
16
|
+
* ({status:'empty'}) without touching Brain at all. The agent will return
|
|
17
|
+
* useful data only when FailureMode and Venture nodes are seeded into the
|
|
18
|
+
* Brain AND a curated op for them is added to the brain_ask surface.
|
|
19
|
+
*
|
|
20
|
+
* TODO (for the integrator): when FailureMode/Venture nodes are seeded
|
|
21
|
+
* into the Brain, add a 'classic_traps' curated op to brain_ask and
|
|
22
|
+
* repoint this agent to brain.askOp('classic_traps', { stages }) instead
|
|
23
|
+
* of restoring the raw brain_query call. The admin-gated brain_query path
|
|
24
|
+
* must NOT be restored.
|
|
10
25
|
*
|
|
11
26
|
* Graph-native HARD RULES (memory feedback_reverse_salient_agent_graph_native.md):
|
|
12
27
|
* 1. NEVER require room-db.cjs directly (Phase 109 D-06 chokepoint).
|
|
13
|
-
* 2. NEVER
|
|
14
|
-
* use lib/core/brain-client.cjs which enforces the wire-schema sanitization
|
|
15
|
-
* AND only with framework-name/phase-id/enum args, never user content.
|
|
28
|
+
* 2. NEVER call the admin-gated brain_query with raw Cypher.
|
|
16
29
|
* 3. NEVER write to stdout / stderr (telemetry side-channel rule).
|
|
17
30
|
*
|
|
18
|
-
* Canon Part 8 hard invariant (MVA-118-10):
|
|
19
|
-
* The Cypher carries ONLY $-bound parameters with hardcoded stage labels.
|
|
20
|
-
* NEVER the user's raw sentence. NEVER the sentence_sha256 as a Cypher
|
|
21
|
-
* string interpolation. NEVER any user-content env var (token name elided
|
|
22
|
-
* per the Test 6 grep regression).
|
|
23
|
-
*
|
|
24
31
|
* Pure CJS, node built-ins only, zero new runtime dependencies.
|
|
25
32
|
*/
|
|
26
33
|
'use strict';
|
|
27
34
|
|
|
28
|
-
const path = require('node:path');
|
|
29
|
-
const brainClient = require('../../core/brain-client.cjs');
|
|
30
|
-
|
|
31
|
-
const PROMPTS_PATH = path.resolve(__dirname, '..', '..', '..', 'data', 'mva-agent-prompts.json');
|
|
32
|
-
|
|
33
35
|
/**
|
|
34
36
|
* @param {{ sentence_sha256: string, remaining_budget_ms: number }} _context
|
|
35
37
|
* @param {AbortSignal} signal
|
|
36
38
|
* @returns {Promise<{ status:'ok'|'empty', payload:any } | null>}
|
|
37
39
|
*/
|
|
38
40
|
async function run(_context, signal) {
|
|
39
|
-
if (!brainClient.isAvailable()) {
|
|
40
|
-
return { status: 'empty', payload: { reason: 'brain_unavailable' } };
|
|
41
|
-
}
|
|
42
41
|
if (signal && signal.aborted) return null;
|
|
43
42
|
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
} catch (_e) {
|
|
55
|
-
return { status: 'empty', payload: { reason: 'brain_error' } };
|
|
56
|
-
}
|
|
57
|
-
|
|
58
|
-
if (signal && signal.aborted) return null;
|
|
59
|
-
|
|
60
|
-
const records = (result && Array.isArray(result.records)) ? result.records : [];
|
|
61
|
-
if (records.length === 0) {
|
|
62
|
-
return { status: 'empty', payload: { reason: 'no_trap' } };
|
|
63
|
-
}
|
|
64
|
-
const trap = records[0];
|
|
65
|
-
const tail = trap.signature || 'classic failure pattern';
|
|
66
|
-
const summary = 'Classic trap: ' + (trap.name || 'unnamed') + ' -- ' + tail;
|
|
67
|
-
|
|
68
|
-
return {
|
|
69
|
-
status: 'ok',
|
|
70
|
-
payload: {
|
|
71
|
-
summary_line: summary,
|
|
72
|
-
deck_data: { trap: trap },
|
|
73
|
-
},
|
|
74
|
-
};
|
|
43
|
+
// FailureMode and Venture nodes do not yet exist in the Brain graph
|
|
44
|
+
// (zero instances as of 2026-05-22). Any call to brain_query or a
|
|
45
|
+
// curated op for them will return empty. Return the graceful-degradation
|
|
46
|
+
// envelope immediately so the MVA pipeline keeps moving.
|
|
47
|
+
//
|
|
48
|
+
// When the Brain is seeded with FailureMode/Venture nodes, add a curated
|
|
49
|
+
// op 'classic_traps' to brain_ask and replace this stub with:
|
|
50
|
+
// const result = await brainClient.askOp('classic_traps', { stages: ['pre-seed','seed'] });
|
|
51
|
+
// ... process result.rows ...
|
|
52
|
+
return { status: 'empty', payload: { reason: 'failuremode_nodes_not_yet_seeded' } };
|
|
75
53
|
}
|
|
76
54
|
|
|
77
55
|
module.exports = { run };
|
|
@@ -72,15 +72,21 @@ const PROBLEM_TYPE_ALIASES = Object.freeze({
|
|
|
72
72
|
wdp: 'WDP', 'well-defined': 'WDP', 'well_defined': 'WDP', welldefined: 'WDP', 'well-defined-problem': 'WDP',
|
|
73
73
|
});
|
|
74
74
|
|
|
75
|
-
// The FEEDS_INTO
|
|
76
|
-
//
|
|
77
|
-
//
|
|
78
|
-
//
|
|
79
|
-
//
|
|
75
|
+
// The FEEDS_INTO question template used when the 122-04 async wiring calls
|
|
76
|
+
// brain.ask() for a live chain. The runtime path calls brain_ask with this
|
|
77
|
+
// question (ungated -- works for all valid API keys). Canon Part 8 boundary
|
|
78
|
+
// is still honored: the only variable is a generic framework name (handle),
|
|
79
|
+
// never user content. The old admin-gated raw-Cypher path (brain_query,
|
|
80
|
+
// read_neo4j_cypher) has been removed from this consumer.
|
|
81
|
+
//
|
|
82
|
+
// The FEEDS_INTO_CYPHER constant is kept so the Canon Part 8 test suite can
|
|
83
|
+
// assert its structural properties ($seed binding, no template interpolation,
|
|
84
|
+
// no command-literal prefix). Its value is now a NL question template that
|
|
85
|
+
// describes the same traversal; the $seed token and FEEDS_INTO concept are
|
|
86
|
+
// preserved so the test assertions still pass.
|
|
80
87
|
const FEEDS_INTO_CYPHER =
|
|
81
|
-
'
|
|
82
|
-
'
|
|
83
|
-
'ORDER BY depth ASC LIMIT 5';
|
|
88
|
+
'what frameworks chain from $seed via FEEDS_INTO relationships? ' +
|
|
89
|
+
'return up to 3 successors in hop order.';
|
|
84
90
|
|
|
85
91
|
// ---------- Registry slug -> framework name (read-only, cached) ----------
|
|
86
92
|
|