@mindrian_os/install 1.13.0-beta.19 → 1.13.0-beta.22
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/.mcp.json +6 -1
- package/CHANGELOG.md +13 -0
- package/README.md +51 -56
- package/bin/mindrian-brain-mcp-client.cjs +152 -0
- package/commands/doctor.md +3 -2
- package/lib/core/directive-envelope.cjs +175 -0
- package/lib/core/directive-envelope.test.cjs +225 -0
- package/lib/core/doctor/class-m-brain-smoke.cjs +278 -0
- package/lib/core/doctor/class-m-brain-smoke.test.cjs +310 -0
- package/lib/core/mcp-profiles.cjs +1 -1
- package/lib/core/migration-snapshot.cjs +172 -0
- package/lib/core/migration-snapshot.test.cjs +174 -0
- package/lib/core/mindrian-brain-shim.test.cjs +214 -0
- package/lib/core/rs-nl-to-query.cjs +1 -1
- package/lib/core/telemetry/validator.cjs +5 -2
- package/lib/core/telemetry/validator.test.cjs +5 -5
- package/lib/core/tier0-messaging.cjs +109 -0
- package/lib/core/tier0-messaging.test.cjs +218 -0
- package/lib/memory/brain-derivation-graceful-degradation.test.cjs +2 -2
- package/lib/memory/mos-status-renderer.test.cjs +2 -2
- package/lib/memory/navigation-engine-core.test.cjs +1 -1
- package/lib/memory/run-feynman-tests.cjs +10 -0
- package/package.json +1 -1
|
@@ -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.22",
|
|
5
5
|
"author": {
|
|
6
6
|
"name": "Jonathan Sagir",
|
|
7
7
|
"url": "https://mindrian.ai"
|
package/.mcp.json
CHANGED
|
@@ -2,7 +2,12 @@
|
|
|
2
2
|
"mcpServers": {
|
|
3
3
|
"mindrian-os": {
|
|
4
4
|
"command": "node",
|
|
5
|
-
"args": ["bin/mindrian-mcp-server.cjs"],
|
|
5
|
+
"args": ["${CLAUDE_PLUGIN_ROOT}/bin/mindrian-mcp-server.cjs"],
|
|
6
|
+
"alwaysLoad": true
|
|
7
|
+
},
|
|
8
|
+
"mindrian-brain": {
|
|
9
|
+
"command": "node",
|
|
10
|
+
"args": ["${CLAUDE_PLUGIN_ROOT}/bin/mindrian-brain-mcp-client.cjs"],
|
|
6
11
|
"alwaysLoad": true
|
|
7
12
|
}
|
|
8
13
|
}
|
package/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,16 @@
|
|
|
1
|
+
## [1.13.0-beta.22] - 2026-05-21
|
|
2
|
+
|
|
3
|
+
### Documentation
|
|
4
|
+
- **Brain-query moat guard recorded (Phase 127.1 Plan 05).** The moat-guard code shipped inside the v1.13.0-beta.21 tag but beta.21's changelog never recorded it. Backfilled here: on the `mcp-server-brain` Brain server, `brain_query` is now gated to the `admin` plan (D-MOAT-1), and four Cypher execution safeguards ported from the official Neo4j `mcp-neo4j-cypher` recipe bound every read the gate permits (EXPLAIN estimated-row reject, row cap, byte cap, read timeout; D-MOAT-2). The Brain's Neo4j was confirmed on the Aura Free tier (D-MOAT-4); a scoped `neo4j_reader` credential (D-MOAT-3) is deferred because Aura Free has no role-based access control. `mcp-server-brain/CLAUDE.md` carries the full "Brain-query moat guard" section. This is a Brain-server change, not shipped-plugin code; no plugin behavior changes in this beta.
|
|
5
|
+
|
|
6
|
+
### Internal
|
|
7
|
+
- **Phase 128.1 (session isolation) parked on branch `phase-128.1`.** Phase 128.1 is a v1.13.1 milestone phase. It was pulled off the v1.13.0 release line so the line stays clean; `main` carries zero 128.1 code. 128.1 is complete on its branch (6 of 6 plans) and ships in the v1.13.1-beta.3 band with phases 128 and 129.
|
|
8
|
+
|
|
9
|
+
## [1.13.0-beta.21] - 2026-05-20
|
|
10
|
+
|
|
11
|
+
### Added
|
|
12
|
+
- (next-pre-release Commit B placeholder; Phase 127 Brain MCP Local Stdio Shim work ships here per `.planning/v1.13.1-EXECUTION-PLAN.md` AMENDMENT 2026-05-19)
|
|
13
|
+
|
|
1
14
|
## [1.13.0-beta.19] - 2026-05-19
|
|
2
15
|
|
|
3
16
|
### Promoted (2026-05-19 -- v1.13.0 milestone redefinition)
|
package/README.md
CHANGED
|
@@ -1,97 +1,94 @@
|
|
|
1
1
|
<div align="center">
|
|
2
|
-
<img src="https://mindrianos-jsagirs-projects.vercel.app/logo_dark.svg" alt="MindrianOS" width="
|
|
2
|
+
<img src="https://mindrianos-jsagirs-projects.vercel.app/logo_dark.svg" alt="MindrianOS" width="200" />
|
|
3
3
|
|
|
4
4
|
# MindrianOS
|
|
5
5
|
|
|
6
|
-
**
|
|
6
|
+
**When you are walking through a problem worth solving and you cannot yet name what is missing, MindrianOS is the thinking partner that walks beside you.**
|
|
7
7
|
|
|
8
|
-
Powered by PWS
|
|
9
|
-
|
|
10
|
-
Built by [Jonathan Sagir](https://www.linkedin.com/in/jonathansagir/).
|
|
8
|
+
Powered by PWS (Problems Worth Solving), an innovation methodology built and tested through 20 years of teaching by Prof. Lawrence Aronhime.
|
|
9
|
+
Engineered by Jonathan Sagir.
|
|
11
10
|
|
|
12
|
-
[](CHANGELOG.md)
|
|
12
|
+
[](LICENSE)
|
|
13
|
+
[](#three-surfaces)
|
|
15
14
|
|
|
16
|
-
[Website](https://mindrianos-jsagirs-projects.vercel.app)
|
|
17
|
-
[Marketplace](https://github.com/jsagir/mindrian-marketplace)
|
|
15
|
+
[Website](https://mindrianos-jsagirs-projects.vercel.app) ·
|
|
16
|
+
[Marketplace](https://github.com/jsagir/mindrian-marketplace) ·
|
|
18
17
|
[Brain Access](https://mindrianos-jsagirs-projects.vercel.app/brain-access)
|
|
19
|
-
|
|
20
18
|
</div>
|
|
21
19
|
|
|
22
20
|
---
|
|
23
21
|
|
|
24
|
-
## The
|
|
25
|
-
|
|
26
|
-
You are working on something that matters. A venture. A research direction. A grant. A pivot. The problem you are trying to solve is real, but it is undefined, and you keep getting lost in it. You take notes, but the notes pile up. You have meetings, but you forget what was said two weeks ago. You make decisions, but you cannot remember why.
|
|
22
|
+
## The answer first
|
|
27
23
|
|
|
28
|
-
|
|
24
|
+
> When you talk to Larry about what you are working on, MindrianOS turns the conversation into a structured room, remembers your decisions across sessions, and surfaces the contradictions you would otherwise miss.
|
|
29
25
|
|
|
30
|
-
|
|
26
|
+
You do not learn a tool. You talk. The room takes shape underneath the conversation. Whatever you said yesterday is still working for you today.
|
|
31
27
|
|
|
32
28
|
---
|
|
33
29
|
|
|
34
|
-
## How it works
|
|
30
|
+
## How it works (in three pieces)
|
|
31
|
+
|
|
32
|
+
### Larry is the thinking partner
|
|
33
|
+
|
|
34
|
+
Larry is the AI you talk to. Larry asks the questions that reframe the problem before you try to solve it, suggests the method that fits where you are, and files what you say into your room without making you stop to organize. You do not have to know the framework names. You describe what you are doing. Larry routes you.
|
|
35
|
+
|
|
36
|
+
### The Data Room is your venture made legible
|
|
35
37
|
|
|
36
|
-
|
|
38
|
+
Every conversation, every meeting, every decision lands in a folder structure organized by venture stage: the problem, the market, the solution, the team, the money, the IP, the meetings, the opportunities. You open it in your file manager. You back it up like any other folder. You own it.
|
|
37
39
|
|
|
38
|
-
|
|
40
|
+
### The room surfaces what you cannot see
|
|
41
|
+
|
|
42
|
+
Every time you add something new, the system compares it against everything already there. Larry tells you what just changed. What contradicts what. What connects to what. What is now missing. What you stopped checking weeks ago.
|
|
43
|
+
|
|
44
|
+
You decide: APPROVE, REJECT (with a reason), or DEFER. The reason becomes part of the room. The next scan is smarter.
|
|
45
|
+
|
|
46
|
+
---
|
|
39
47
|
|
|
40
|
-
|
|
48
|
+
## What v1.13.0 changed (The Closed Loop)
|
|
41
49
|
|
|
42
|
-
|
|
50
|
+
Before this release, MindrianOS could file your work and surface intelligence, but the loop did not always close. You would say something, the system would react, and nothing carried forward. v1.13.0 closes the loop:
|
|
43
51
|
|
|
44
|
-
**
|
|
52
|
+
- **Larry leads turn one.** The first thing you see is a conversation, not a command menu.
|
|
53
|
+
- **Your first sentence becomes a room.** Type a venture sentence, get a 30-second brief and a populated room before you have to commit anything else.
|
|
54
|
+
- **Tensions persist across sessions.** Larry remembers what was unresolved and brings it back when relevant.
|
|
55
|
+
- **Every conversation produces an artifact.** A first session leaves you with a real room, not an empty wizard.
|
|
56
|
+
- **Decisions teach the system.** Your approvals, your rejections, your reasons become part of the room's working memory.
|
|
45
57
|
|
|
46
|
-
|
|
58
|
+
Currently shipping as `v1.13.0-beta.19`. Final `v1.13.0` is imminent.
|
|
47
59
|
|
|
48
60
|
---
|
|
49
61
|
|
|
50
|
-
## What you
|
|
62
|
+
## What you do in a session
|
|
51
63
|
|
|
52
|
-
|
|
64
|
+
Talk. Type a command when you know the shortcut. Let Larry teach you when you do not.
|
|
53
65
|
|
|
54
66
|
```bash
|
|
55
67
|
/mos:new-project # tell Larry what you are exploring
|
|
56
68
|
/mos:beautiful-question # reframe the problem before solving it
|
|
57
69
|
/mos:analyze-needs # who has this problem, how badly, what they have tried
|
|
58
70
|
/mos:lean-canvas # one-page business model
|
|
59
|
-
/mos:file-meeting # paste a transcript, Larry files it
|
|
71
|
+
/mos:file-meeting # paste a transcript, Larry files it
|
|
60
72
|
/mos:opportunities # what grants match this room right now
|
|
61
73
|
/mos:query "what is the weakest assumption in my financial model?"
|
|
62
|
-
/mos:grade # honest assessment
|
|
74
|
+
/mos:grade # honest assessment against real ventures
|
|
63
75
|
```
|
|
64
76
|
|
|
65
|
-
You do not have to memorize these.
|
|
77
|
+
You do not have to memorize these. Describe what you are trying to do. Larry routes you.
|
|
66
78
|
|
|
67
79
|
---
|
|
68
80
|
|
|
69
|
-
##
|
|
70
|
-
|
|
71
|
-
This release is called **The Closed Loop**. Before this version, MindrianOS could file your work and surface intelligence, but the loop did not always close: you would say something, the system would react, and then nothing would carry forward to the next session.
|
|
81
|
+
## Why the room compounds
|
|
72
82
|
|
|
73
|
-
|
|
74
|
-
- **Larry leads turn one.** The first thing you see is a conversation, not a command menu.
|
|
75
|
-
- **The first file you write triggers a background scan.** You will see findings on your next turn: whitespace, contradictions, cross-domain analogies you could borrow from.
|
|
76
|
-
- **Contradictions persist across sessions.** Larry remembers what was unresolved and brings it back when relevant.
|
|
77
|
-
- **Every conversation produces a real artifact.** A first session leaves you with a populated room, not an empty wizard.
|
|
78
|
-
- **Your decisions are graph data.** The room learns from your approvals, your rejections, and the reasons you give.
|
|
83
|
+
Most tools get messier the more you put in. Search ranks worse. Folders bloat. The AI forgets what you told it last session. MindrianOS goes the other way.
|
|
79
84
|
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
---
|
|
83
|
-
|
|
84
|
-
## Why this gets better the longer you use it
|
|
85
|
-
|
|
86
|
-
MindrianOS is a thinking tool that compounds. Most tools get messier the more you put in -- the search ranks worse, the folder gets bigger, the AI forgets what you told it last session. MindrianOS goes the other way.
|
|
87
|
-
|
|
88
|
-
Here is the mechanism, in plain words: every conversation you have with Larry, every meeting you file, every decision you make and reason you give becomes part of your room. The room is searchable, structured, and remembered across sessions. Every NEW thing you add gets compared against everything already there.
|
|
85
|
+
The mechanism is plain. Everything you say to Larry, every meeting you file, every decision you make and reason you give becomes part of your room. The room is searchable, structured, and remembered. Every NEW entry compares against everything already there.
|
|
89
86
|
|
|
90
87
|
Day one, you have a folder.
|
|
91
88
|
|
|
92
89
|
Day thirty, you have a folder that catches the contradiction between yesterday's strategy call and last week's customer interview, because nothing about either was forgotten. Larry brings back the assumption you made in week two when you are about to make a decision in week eight that depends on it. The room finds the connection between two meetings that happened a month apart that nobody remembers being related.
|
|
93
90
|
|
|
94
|
-
|
|
91
|
+
Nothing forgets. Everything compares. Your own past work works for you.
|
|
95
92
|
|
|
96
93
|
---
|
|
97
94
|
|
|
@@ -125,37 +122,35 @@ mindrian-os update # marketplace + plugin update
|
|
|
125
122
|
mindrian-os doctor --all # diagnose drift, suggest fixes
|
|
126
123
|
```
|
|
127
124
|
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
Claude Code asks you to approve each shell command during install. 10+ prompts is normal. Pick "always allow" the first time you see one you are happy approving; the rest will not re-prompt.
|
|
125
|
+
A note on install prompts: Claude Code asks you to approve each shell command. 10+ prompts is normal. Pick "always allow" the first time you see one you are happy with; the rest will not re-prompt.
|
|
131
126
|
|
|
132
127
|
---
|
|
133
128
|
|
|
134
129
|
## Three surfaces
|
|
135
130
|
|
|
136
|
-
MindrianOS works wherever Claude works.
|
|
131
|
+
MindrianOS works wherever Claude works.
|
|
137
132
|
|
|
138
133
|
| Surface | What it gives you |
|
|
139
134
|
|---------|-------------------|
|
|
140
135
|
| **Claude Code CLI** | Full power. Hooks fire, scripts run, the room is on disk, Larry teaches with visible structure. |
|
|
141
|
-
| **Claude Desktop** | Same Larry, conversational. The Data Room shows up as inline
|
|
136
|
+
| **Claude Desktop** | Same Larry, conversational. The Data Room shows up as inline panels (dashboard, wiki, knowledge graph). |
|
|
142
137
|
| **Cowork** | Same plugin, shared room. Daily briefings, persistent perspectives, multi-user. |
|
|
143
138
|
|
|
144
139
|
---
|
|
145
140
|
|
|
146
141
|
## The privacy line
|
|
147
142
|
|
|
148
|
-
MindrianOS reads your workspace and writes only to your rooms (default: `~/MindrianRooms/`) and to session state (`./.mindrian/`). It does not
|
|
143
|
+
MindrianOS reads your workspace and writes only to your rooms (default: `~/MindrianRooms/`) and to session state (`./.mindrian/`). It does not push anything to the Brain. Brain queries carry methodology questions only, never your notes, never your decisions, never your meetings.
|
|
149
144
|
|
|
150
|
-
|
|
145
|
+
For zero permission prompts during a session: `claude --dangerously-skip-permissions`. The read/write surface is bounded to your workspace and your rooms. For granular control, copy the matcher set from [`docs/settings-template.json`](docs/settings-template.json) into `~/.claude/settings.json`.
|
|
151
146
|
|
|
152
147
|
---
|
|
153
148
|
|
|
154
149
|
## Why PWS, why Larry
|
|
155
150
|
|
|
156
|
-
PWS (Problems Worth Solving) is
|
|
151
|
+
PWS (Problems Worth Solving) is not a checklist. It is a way of thinking about ventures as wicked problems that need to be reframed before they can be solved, and that demand a working memory because nobody can hold the whole thing in their head.
|
|
157
152
|
|
|
158
|
-
Larry is the personality that delivers PWS in your terminal. The teaching is intrinsic
|
|
153
|
+
Larry is the personality that delivers PWS in your terminal. The teaching is intrinsic. You do not have to know the framework names. Larry asks the question, suggests the move, shows the chain. You decide.
|
|
159
154
|
|
|
160
155
|
---
|
|
161
156
|
|
|
@@ -0,0 +1,152 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
'use strict';
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* mindrian-brain MCP stdio shim (Phase 127, BRAIN-MCP-127-01)
|
|
6
|
+
*
|
|
7
|
+
* Local stdio MCP server that proxies the 6 canonical Brain tools to the
|
|
8
|
+
* remote Render-hosted Brain via lib/core/brain-client.cjs. Bundled with the
|
|
9
|
+
* plugin via .mcp.json so every new install gets mindrian-brain auto-loaded
|
|
10
|
+
* with zero user wiring beyond MINDRIAN_BRAIN_KEY in env / ~/.mindrian.env.
|
|
11
|
+
*
|
|
12
|
+
* Canon Part 7: ~85% reuse of brain-client.cjs -- this file is JUST a stdio
|
|
13
|
+
* transport wrapper. It contains zero network code; every Brain payload is
|
|
14
|
+
* constructed by brain-client.cjs (which inherits Phase 110 typed-packet
|
|
15
|
+
* enforcement on its typed-job entry; this shim proxies the 6
|
|
16
|
+
* tool-surface entry points which carry only generic methodology handles
|
|
17
|
+
* per Canon Part 8).
|
|
18
|
+
*
|
|
19
|
+
* Canon Part 8: adversarial scan against this file's active code MUST return
|
|
20
|
+
* zero matches for the network-surface token set (delegation property --
|
|
21
|
+
* every network call lives in brain-client.cjs).
|
|
22
|
+
*
|
|
23
|
+
* HARD RULE: no em-dashes anywhere in this file (hyphens only).
|
|
24
|
+
*/
|
|
25
|
+
|
|
26
|
+
const path = require('path');
|
|
27
|
+
const { McpServer } = require('@modelcontextprotocol/sdk/server/mcp.js');
|
|
28
|
+
const { StdioServerTransport } = require('@modelcontextprotocol/sdk/server/stdio.js');
|
|
29
|
+
const { z } = require('zod');
|
|
30
|
+
|
|
31
|
+
const brainClient = require('../lib/core/brain-client.cjs');
|
|
32
|
+
const { wrapDirective } = require('../lib/core/directive-envelope.cjs');
|
|
33
|
+
const { tier0Response: chokepointTier0 } = require('../lib/core/tier0-messaging.cjs');
|
|
34
|
+
|
|
35
|
+
const pluginRoot = path.resolve(__dirname, '..');
|
|
36
|
+
const pluginMeta = require('../.claude-plugin/plugin.json');
|
|
37
|
+
const version = pluginMeta.version;
|
|
38
|
+
|
|
39
|
+
// Tier-0 sentinel -- structured DIRECTOR_NOT_AVAILABLE response. Returned by
|
|
40
|
+
// the 5 tools that surface raw Brain payloads (query/schema/search/stats/write).
|
|
41
|
+
// brain_ask wraps Tier-0 differently (in a DirectiveEnvelope) so Larry's
|
|
42
|
+
// surface reads a uniform shape regardless of tier.
|
|
43
|
+
//
|
|
44
|
+
// Phase 127-02 BRAIN-MCP-127-09 refactor: this is now a one-line passthrough
|
|
45
|
+
// to the single chokepoint at lib/core/tier0-messaging.cjs. The local symbol
|
|
46
|
+
// is preserved so existing tests + tool closures keep their reference.
|
|
47
|
+
// Delegation property: zero duplicate sentinel-shape definition lives here.
|
|
48
|
+
function tier0Response(commandContext) {
|
|
49
|
+
return chokepointTier0(commandContext);
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
function asContent(obj) {
|
|
53
|
+
return { content: [{ type: 'text', text: JSON.stringify(obj) }] };
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
const server = new McpServer({ name: 'mindrian-brain', version: version });
|
|
57
|
+
|
|
58
|
+
// -- brain_ask: highest-level entry; wraps response in DirectiveEnvelope.
|
|
59
|
+
server.tool(
|
|
60
|
+
'brain_ask',
|
|
61
|
+
'Natural-language methodology question. Returns a DirectiveEnvelope (default mode: GUIDED) carrying the directive content. Auto-routes Pinecone/Neo4j server-side.',
|
|
62
|
+
{ question: z.string().describe('A methodology question (generic framework handles only -- never user artifacts or personal data per Canon Part 8).') },
|
|
63
|
+
async ({ question }) => {
|
|
64
|
+
if (!brainClient.isAvailable()) {
|
|
65
|
+
return asContent(wrapDirective(null, { brain_unreachable: true, command_context: 'brain_ask' }));
|
|
66
|
+
}
|
|
67
|
+
const raw = await brainClient.ask(question);
|
|
68
|
+
if (raw == null) {
|
|
69
|
+
return asContent(wrapDirective(null, { brain_unreachable: true, command_context: 'brain_ask' }));
|
|
70
|
+
}
|
|
71
|
+
const signals = (raw && typeof raw === 'object' && raw.mode_signals) ? raw.mode_signals : {};
|
|
72
|
+
return asContent(wrapDirective(raw, signals));
|
|
73
|
+
}
|
|
74
|
+
);
|
|
75
|
+
|
|
76
|
+
// -- brain_query: raw Cypher (generic methodology handles only).
|
|
77
|
+
server.tool(
|
|
78
|
+
'brain_query',
|
|
79
|
+
'Cypher query against the Brain teaching graph. Generic framework handles only (Canon Part 8). Returns { records: [...] } on success.',
|
|
80
|
+
{
|
|
81
|
+
cypher: z.string().describe('Cypher query string.'),
|
|
82
|
+
params: z.record(z.any()).optional().describe('Optional binding map -- generic handles only.'),
|
|
83
|
+
},
|
|
84
|
+
async ({ cypher, params }) => {
|
|
85
|
+
if (!brainClient.isAvailable()) return asContent(tier0Response('brain_query'));
|
|
86
|
+
const r = await brainClient.query(cypher, params);
|
|
87
|
+
return asContent(r == null ? tier0Response('brain_query') : r);
|
|
88
|
+
}
|
|
89
|
+
);
|
|
90
|
+
|
|
91
|
+
// -- brain_schema: cached 30 min in brain-client; passthrough here.
|
|
92
|
+
server.tool(
|
|
93
|
+
'brain_schema',
|
|
94
|
+
'Brain Neo4j schema (labels, relationship types, property keys). Memoized 30 minutes.',
|
|
95
|
+
{},
|
|
96
|
+
async () => {
|
|
97
|
+
if (!brainClient.isAvailable()) return asContent(tier0Response('brain_schema'));
|
|
98
|
+
const r = await brainClient.schema();
|
|
99
|
+
return asContent(r == null ? tier0Response('brain_schema') : r);
|
|
100
|
+
}
|
|
101
|
+
);
|
|
102
|
+
|
|
103
|
+
// -- brain_search: semantic via Pinecone (smartSearch handles Neo4j fallback).
|
|
104
|
+
server.tool(
|
|
105
|
+
'brain_search',
|
|
106
|
+
'Semantic search across the curriculum graph (Pinecone with Neo4j fulltext fallback).',
|
|
107
|
+
{
|
|
108
|
+
query: z.string().describe('Search query (generic methodology language -- Canon Part 8).'),
|
|
109
|
+
namespace: z.string().optional(),
|
|
110
|
+
topK: z.number().int().min(1).max(50).optional(),
|
|
111
|
+
},
|
|
112
|
+
async ({ query, namespace, topK }) => {
|
|
113
|
+
if (!brainClient.isAvailable()) return asContent(tier0Response('brain_search'));
|
|
114
|
+
const r = await brainClient.smartSearch(query, { namespace: namespace, topK: topK });
|
|
115
|
+
return asContent(r == null ? tier0Response('brain_search') : r);
|
|
116
|
+
}
|
|
117
|
+
);
|
|
118
|
+
|
|
119
|
+
// -- brain_stats: operational stats passthrough.
|
|
120
|
+
server.tool(
|
|
121
|
+
'brain_stats',
|
|
122
|
+
'Brain operational stats (Pinecone index size, last-update markers).',
|
|
123
|
+
{},
|
|
124
|
+
async () => {
|
|
125
|
+
if (!brainClient.isAvailable()) return asContent(tier0Response('brain_stats'));
|
|
126
|
+
const r = await brainClient.stats();
|
|
127
|
+
return asContent(r == null ? tier0Response('brain_stats') : r);
|
|
128
|
+
}
|
|
129
|
+
);
|
|
130
|
+
|
|
131
|
+
// -- brain_write: admin-tier; not user-surfaced but proxied for parity.
|
|
132
|
+
server.tool(
|
|
133
|
+
'brain_write',
|
|
134
|
+
'Write Cypher to the Brain. Admin-tier; requires a write-capable key. Generic methodology framework writes only (Canon Part 8).',
|
|
135
|
+
{ cypher: z.string().describe('Cypher write query (generic methodology only).') },
|
|
136
|
+
async ({ cypher }) => {
|
|
137
|
+
if (!brainClient.isAvailable()) return asContent(tier0Response('brain_write'));
|
|
138
|
+
const r = await brainClient.write(cypher);
|
|
139
|
+
return asContent(r == null ? tier0Response('brain_write') : r);
|
|
140
|
+
}
|
|
141
|
+
);
|
|
142
|
+
|
|
143
|
+
async function main() {
|
|
144
|
+
const transport = new StdioServerTransport();
|
|
145
|
+
await server.connect(transport);
|
|
146
|
+
process.stderr.write('[mindrian-brain] MCP server v' + version + ' started (stdio)\n');
|
|
147
|
+
}
|
|
148
|
+
|
|
149
|
+
main().catch((err) => {
|
|
150
|
+
process.stderr.write('[mindrian-brain] Fatal: ' + (err && err.message ? err.message : String(err)) + '\n');
|
|
151
|
+
process.exit(1);
|
|
152
|
+
});
|
package/commands/doctor.md
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
---
|
|
2
2
|
name: doctor
|
|
3
|
-
description: Diagnose and optionally repair MindrianOS install — detects install-cache drift, .room-root sentinel gaps, active-room guard silence, surface-verification gaps, ROOM.md/MINTO.md drift, UI Ruling System compliance,
|
|
3
|
+
description: Diagnose and optionally repair MindrianOS install — detects install-cache drift, .room-root sentinel gaps, active-room guard silence, surface-verification gaps, ROOM.md/MINTO.md drift, UI Ruling System compliance, statusline visibility drift, and Brain end-to-end smoke
|
|
4
4
|
help_jtbd: "Diagnose and optionally repair an off-feeling install."
|
|
5
|
-
argument-hint: "[--fix] [--cascade-rooms] [--verify-surface] [--room-md] [--ui-compliance] [--statusline-visibility] [--install-state] [--stale-first-touch] [--deprecated-usage] [--all] [--acceptance] [--pre-tag] [--light-npx] [--json]"
|
|
5
|
+
argument-hint: "[--fix] [--cascade-rooms] [--verify-surface] [--room-md] [--ui-compliance] [--statusline-visibility] [--install-state] [--stale-first-touch] [--deprecated-usage] [--brain-smoke] [--all] [--acceptance] [--pre-tag] [--light-npx] [--json]"
|
|
6
6
|
body_shape: E (Action Report)
|
|
7
7
|
body_shape_detail: per-class status rows with [before → after] pattern, summary totals, F.1 Next Move selector when drift detected without --fix
|
|
8
8
|
serves_jtbd: ["audit-room"]
|
|
@@ -45,6 +45,7 @@ Look at the user's invocation:
|
|
|
45
45
|
- `/mos:doctor --statusline-visibility` → class G — checks user-settings drift, plugin install integrity, and statusline-mos isolated execution
|
|
46
46
|
- `/mos:doctor --stale-first-touch` → class K (Phase 121.5-05; SEED-007 absorption) — scans `data/first-touch-surfaces.json`-declared greeting surfaces (banner, splash, onboard, sessionstart, operator-update, larry-extended) for stale version literals (older than the running plugin) and U+2014 em-dash violations on surfaces flagged `em_dash_check: true`
|
|
47
47
|
- `/mos:doctor --deprecated-usage` → class L (Phase 121.5-08 Sub-plan J) — scans last-7-days `~/.claude/projects/.../*.jsonl` session transcripts for `/mos:<deprecated>` patterns (heal/query/organize/hmi-status/visualize/diagnostics) and surfaces a per-command "use `/mos:<new>` instead" hint. Pure LOCAL scan; zero network, zero Brain. Also activated by `--all`.
|
|
48
|
+
- `/mos:doctor --brain-smoke` → class M (Phase 127-02 BRAIN-MCP-127-08): 5-layer Brain end-to-end probe (plugin root resolver, key resolver, HTTPS schema, MCP stdio handshake, e2e brain_schema via the bundled shim). Diagnostic-only; reports the exact failing layer with fail-fast cascade. Detects 12 Phase 126 failure-mode rows in one composable test (the doctor's single Brain smoke).
|
|
48
49
|
- `/mos:doctor --fix` → diagnostic + auto-recovery for any class that supports --fix (class A, B, E, G)
|
|
49
50
|
- `/mos:doctor --json` → machine-readable output (for hooks / regression tests)
|
|
50
51
|
|
|
@@ -0,0 +1,175 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
/*
|
|
4
|
+
* Phase 127-00 (Task 1) -- DirectiveEnvelope wrapper module.
|
|
5
|
+
*
|
|
6
|
+
* Builds the typed packet returned by `brain_ask` (via the stdio shim) and
|
|
7
|
+
* consumed by Larry's surface. CANONICAL DEFAULT mode: GUIDED.
|
|
8
|
+
*
|
|
9
|
+
* Default: GUIDED per feedback_larry_pedagogical_guided_first.md (HARD RULE).
|
|
10
|
+
* AUTONOMOUS only on explicit user invitation, non-judgment prep, or explicit
|
|
11
|
+
* "run" command. Cold start ALWAYS forces GUIDED. Mature-room commit-phase
|
|
12
|
+
* gates default to HYBRID.
|
|
13
|
+
*
|
|
14
|
+
* Canon parts: 2 (Larry pedagogy intrinsic, not Brain-dependent),
|
|
15
|
+
* 3 (Decision Gate F-shape next_gate handoff), 7 (pure data shaping,
|
|
16
|
+
* zero network surface; envelope wrapper sits ABOVE brain-client).
|
|
17
|
+
*
|
|
18
|
+
* Constraints: CJS, Node built-ins only, zero new runtime deps, ZERO network
|
|
19
|
+
* surface (no fetch/http/brain-client require). HARD RULE: no em-dashes.
|
|
20
|
+
*/
|
|
21
|
+
|
|
22
|
+
const DEFAULT_MODE = 'GUIDED';
|
|
23
|
+
|
|
24
|
+
/**
|
|
25
|
+
* Mode classifier. Signal precedence (first match wins; explicit user signals
|
|
26
|
+
* beat heuristic context):
|
|
27
|
+
* 1. user_said_just_tell_me | user_said_bottom_line -> AUTONOMOUS
|
|
28
|
+
* 2. is_first_material | is_cold_start -> GUIDED (forced)
|
|
29
|
+
* 3. session_count>=8 + room_mature + in_commit_phase -> HYBRID
|
|
30
|
+
* 4. is_prep_work && !requires_judgment -> AUTONOMOUS
|
|
31
|
+
* 5. user_explicitly_said_run -> AUTONOMOUS
|
|
32
|
+
* 6. default -> GUIDED
|
|
33
|
+
*
|
|
34
|
+
* Non-object input is coerced to empty signals (default GUIDED applies).
|
|
35
|
+
* @param {object} signals
|
|
36
|
+
* @returns {{mode: string, rationale: string}}
|
|
37
|
+
*/
|
|
38
|
+
function selectMode(signals) {
|
|
39
|
+
const s = (signals && typeof signals === 'object') ? signals : {};
|
|
40
|
+
|
|
41
|
+
// 1. Explicit user invitation (highest precedence).
|
|
42
|
+
if (s.user_said_just_tell_me || s.user_said_bottom_line) {
|
|
43
|
+
return { mode: 'AUTONOMOUS', rationale: 'explicit_user_invitation' };
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
// 2. Cold start FORCES GUIDED (per feedback_larry_pedagogical_guided_first.md).
|
|
47
|
+
if (s.is_first_material || s.is_cold_start) {
|
|
48
|
+
return { mode: 'GUIDED', rationale: 'cold_start_never_autonomous' };
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
// 3. Mature-room commit-phase: HYBRID for non-trivial methodology run.
|
|
52
|
+
if (typeof s.session_count === 'number' && s.session_count >= 8
|
|
53
|
+
&& s.room_mature && s.in_commit_phase) {
|
|
54
|
+
return { mode: 'HYBRID', rationale: 'mature_room_commit_gate' };
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
// 4. Non-judgment prep work.
|
|
58
|
+
if (s.is_prep_work && !s.requires_judgment) {
|
|
59
|
+
return { mode: 'AUTONOMOUS', rationale: 'non_judgment_prep_work' };
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
// 5. Explicit execute command.
|
|
63
|
+
if (s.user_explicitly_said_run) {
|
|
64
|
+
return { mode: 'AUTONOMOUS', rationale: 'explicit_execute_command' };
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
// 6. Default: GUIDED (Larry pedagogical canon).
|
|
68
|
+
return { mode: 'GUIDED', rationale: 'default_guided_pedagogical_canon' };
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
// The 3 documented user-override keys. Frozen template; envelope build
|
|
72
|
+
// shallow-copies so caller mutations do not leak across envelopes.
|
|
73
|
+
const USER_OVERRIDE_TEMPLATE = Object.freeze({
|
|
74
|
+
'just tell me': 'switch to AUTONOMOUS, run framework end-to-end',
|
|
75
|
+
'let me think': 'switch to GUIDED, ask the next reframing question',
|
|
76
|
+
'stop': 'halt, return control',
|
|
77
|
+
});
|
|
78
|
+
|
|
79
|
+
/**
|
|
80
|
+
* Build directive body. Pass through Brain-supplied `directive` when present;
|
|
81
|
+
* otherwise produce a mode-appropriate empty scaffold.
|
|
82
|
+
* @param {object|null} brainResponse
|
|
83
|
+
* @param {string} mode
|
|
84
|
+
* @returns {object}
|
|
85
|
+
*/
|
|
86
|
+
function buildDirective(brainResponse, mode) {
|
|
87
|
+
// Pass-through if Brain already supplied a typed directive payload.
|
|
88
|
+
if (brainResponse && typeof brainResponse === 'object'
|
|
89
|
+
&& brainResponse.directive && typeof brainResponse.directive === 'object') {
|
|
90
|
+
return brainResponse.directive;
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
if (mode === 'AUTONOMOUS') {
|
|
94
|
+
return { autonomous: { plan: [], framework: null } };
|
|
95
|
+
}
|
|
96
|
+
if (mode === 'HYBRID') {
|
|
97
|
+
return {
|
|
98
|
+
hybrid: {
|
|
99
|
+
autonomous_prep: [],
|
|
100
|
+
guided_commit: { questions: [] },
|
|
101
|
+
framework: null,
|
|
102
|
+
},
|
|
103
|
+
};
|
|
104
|
+
}
|
|
105
|
+
// GUIDED default scaffold.
|
|
106
|
+
return { guided: { questions: [], framework: null, stage: null } };
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
/**
|
|
110
|
+
* Build next_gate handoff. Brain-supplied next_gate passes through when its
|
|
111
|
+
* sub_shape matches F.[1-5]; otherwise defaults to F.1 Next Move (Canon Part 3).
|
|
112
|
+
* @param {object|null} brainResponse
|
|
113
|
+
* @returns {{sub_shape: string, options: Array}}
|
|
114
|
+
*/
|
|
115
|
+
function buildNextGate(brainResponse) {
|
|
116
|
+
if (brainResponse && typeof brainResponse === 'object'
|
|
117
|
+
&& brainResponse.next_gate && typeof brainResponse.next_gate === 'object') {
|
|
118
|
+
const ng = brainResponse.next_gate;
|
|
119
|
+
if (typeof ng.sub_shape === 'string' && /^F\.[1-5]$/.test(ng.sub_shape)) {
|
|
120
|
+
return {
|
|
121
|
+
sub_shape: ng.sub_shape,
|
|
122
|
+
options: Array.isArray(ng.options) ? ng.options : [],
|
|
123
|
+
};
|
|
124
|
+
}
|
|
125
|
+
}
|
|
126
|
+
return { sub_shape: 'F.1', options: [] };
|
|
127
|
+
}
|
|
128
|
+
|
|
129
|
+
/**
|
|
130
|
+
* Wrap a Brain response (or null) in a typed DirectiveEnvelope.
|
|
131
|
+
* brainResponse null/undefined => Tier-0 sentinel (mode GUIDED, rationale
|
|
132
|
+
* "brain_unreachable", directive.guided.stage "tier_0_brain_unreachable").
|
|
133
|
+
* Otherwise selectMode applies + directive/next_gate pass through when supplied.
|
|
134
|
+
* @param {object|null} brainResponse
|
|
135
|
+
* @param {object} signals
|
|
136
|
+
* @returns {object} DirectiveEnvelope per CAPABILITY-MAP spec.
|
|
137
|
+
*/
|
|
138
|
+
function wrapDirective(brainResponse, signals) {
|
|
139
|
+
if (brainResponse === null || brainResponse === undefined) {
|
|
140
|
+
// Tier-0 sentinel.
|
|
141
|
+
return {
|
|
142
|
+
packet_version: '1.0',
|
|
143
|
+
packet_type: 'DirectiveEnvelope',
|
|
144
|
+
mode: 'GUIDED',
|
|
145
|
+
mode_rationale: 'brain_unreachable',
|
|
146
|
+
directive: {
|
|
147
|
+
guided: {
|
|
148
|
+
questions: [],
|
|
149
|
+
framework: null,
|
|
150
|
+
stage: 'tier_0_brain_unreachable',
|
|
151
|
+
},
|
|
152
|
+
},
|
|
153
|
+
user_override: Object.assign({}, USER_OVERRIDE_TEMPLATE),
|
|
154
|
+
next_gate: { sub_shape: 'F.1', options: [] },
|
|
155
|
+
};
|
|
156
|
+
}
|
|
157
|
+
|
|
158
|
+
const { mode, rationale } = selectMode(signals || {});
|
|
159
|
+
|
|
160
|
+
return {
|
|
161
|
+
packet_version: '1.0',
|
|
162
|
+
packet_type: 'DirectiveEnvelope',
|
|
163
|
+
mode: mode,
|
|
164
|
+
mode_rationale: rationale,
|
|
165
|
+
directive: buildDirective(brainResponse, mode),
|
|
166
|
+
user_override: Object.assign({}, USER_OVERRIDE_TEMPLATE),
|
|
167
|
+
next_gate: buildNextGate(brainResponse),
|
|
168
|
+
};
|
|
169
|
+
}
|
|
170
|
+
|
|
171
|
+
module.exports = {
|
|
172
|
+
DEFAULT_MODE,
|
|
173
|
+
selectMode,
|
|
174
|
+
wrapDirective,
|
|
175
|
+
};
|