@neruva/mcp 0.28.2 → 0.30.0
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/bin/install-hooks.js +142 -0
- package/binaries/neruva-record-hook-linux-arm64 +0 -0
- package/binaries/neruva-record-hook-linux-x64 +0 -0
- package/binaries/neruva-record-hook-mac-arm64 +0 -0
- package/binaries/neruva-record-hook-mac-x64 +0 -0
- package/binaries/neruva-record-hook-win-arm64.exe +0 -0
- package/binaries/neruva-record-hook-win-x64.exe +0 -0
- package/package.json +4 -3
|
@@ -0,0 +1,142 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
// neruva-mcp-install -- wire the bundled Rust hook into ~/.claude/settings.json
|
|
3
|
+
// in FULL-TAKEOVER mode (no Python, no daemon). Run via:
|
|
4
|
+
//
|
|
5
|
+
// npx -p @neruva/mcp neruva-mcp-install
|
|
6
|
+
// npx -p @neruva/mcp neruva-mcp-install --uninstall
|
|
7
|
+
//
|
|
8
|
+
// Topology (mirrors the daemon+async-recorder split, all-Rust):
|
|
9
|
+
// PreToolUse[*] sync -> context (never records)
|
|
10
|
+
// UserPromptSubmit sync -> context + record prompt
|
|
11
|
+
// PostToolUse[records_ingest] sync -> extract/consistency (--context-only)
|
|
12
|
+
// PostToolUse[*] async -> record tool_call (--record-only)
|
|
13
|
+
// Stop / SessionEnd / Subagent* / Task* async -> record (--record-only)
|
|
14
|
+
// SessionStart sync -> boot recall + record
|
|
15
|
+
//
|
|
16
|
+
// The async record entries keep recording OFF the latency path; --context-only
|
|
17
|
+
// on the records_ingest entry prevents double-recording. Idempotent: re-running
|
|
18
|
+
// strips our prior entries first. Backs settings up before writing.
|
|
19
|
+
|
|
20
|
+
import { readFileSync, writeFileSync, existsSync, mkdirSync, chmodSync, copyFileSync } from 'node:fs';
|
|
21
|
+
import { dirname, join } from 'node:path';
|
|
22
|
+
import { fileURLToPath } from 'node:url';
|
|
23
|
+
import { homedir, platform, arch } from 'node:os';
|
|
24
|
+
|
|
25
|
+
const __dirname = dirname(fileURLToPath(import.meta.url));
|
|
26
|
+
const SETTINGS = join(homedir(), '.claude', 'settings.json');
|
|
27
|
+
|
|
28
|
+
function pickBinary() {
|
|
29
|
+
const p = platform();
|
|
30
|
+
const platSeg = p === 'win32' ? 'win' : p === 'darwin' ? 'mac' : 'linux';
|
|
31
|
+
const archSeg = arch() === 'arm64' ? 'arm64' : 'x64';
|
|
32
|
+
const ext = p === 'win32' ? '.exe' : '';
|
|
33
|
+
return join(__dirname, '..', 'binaries', `neruva-record-hook-${platSeg}-${archSeg}${ext}`);
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
// Default auto-pilot env. Forced: NERUVA_RUST_FULL_TAKEOVER. Others are set only
|
|
37
|
+
// when absent so we never clobber a user's existing tuning.
|
|
38
|
+
const ENV_FORCE = { NERUVA_RUST_FULL_TAKEOVER: '1' };
|
|
39
|
+
const ENV_DEFAULTS = {
|
|
40
|
+
NERUVA_AUTO_RECORD: 'claude_code',
|
|
41
|
+
NERUVA_AUTO_RECALL: '20',
|
|
42
|
+
NERUVA_PER_TURN_RECALL: '5',
|
|
43
|
+
NERUVA_AUTO_EXTRACT: '1',
|
|
44
|
+
NERUVA_AUTO_ROUTE: '1',
|
|
45
|
+
NERUVA_AUTO_REFLECT: '1',
|
|
46
|
+
NERUVA_PRE_ACTION_RECALL: '1',
|
|
47
|
+
NERUVA_PRE_ACTION_THRESHOLD: '0.08',
|
|
48
|
+
NERUVA_POST_INGEST_CONSISTENCY: '1',
|
|
49
|
+
};
|
|
50
|
+
|
|
51
|
+
const isOurEntry = (entry) =>
|
|
52
|
+
(entry?.hooks || []).some((h) => typeof h?.command === 'string' && h.command.includes('neruva-record-hook'));
|
|
53
|
+
|
|
54
|
+
function buildHooks(cmd) {
|
|
55
|
+
const sync = (extra) => ({ hooks: [{ type: 'command', command: extra ? `${cmd} ${extra}` : cmd }] });
|
|
56
|
+
const async_ = (extra, matcher) => {
|
|
57
|
+
const e = { hooks: [{ type: 'command', command: extra ? `${cmd} ${extra}` : cmd, async: true }] };
|
|
58
|
+
if (matcher) e.matcher = matcher;
|
|
59
|
+
return e;
|
|
60
|
+
};
|
|
61
|
+
const syncM = (matcher, extra) => ({ matcher, hooks: [{ type: 'command', command: extra ? `${cmd} ${extra}` : cmd }] });
|
|
62
|
+
return {
|
|
63
|
+
PreToolUse: [syncM('*')],
|
|
64
|
+
UserPromptSubmit: [sync()],
|
|
65
|
+
PostToolUse: [syncM('mcp__neruva__records_ingest', '--context-only'), async_('--record-only', '*')],
|
|
66
|
+
Stop: [async_('--record-only')],
|
|
67
|
+
SessionStart: [sync()],
|
|
68
|
+
SessionEnd: [async_('--record-only')],
|
|
69
|
+
SubagentStart: [async_('--record-only')],
|
|
70
|
+
SubagentStop: [async_('--record-only')],
|
|
71
|
+
TaskCreated: [async_('--record-only')],
|
|
72
|
+
TaskCompleted: [async_('--record-only')],
|
|
73
|
+
};
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
function readSettings() {
|
|
77
|
+
if (!existsSync(SETTINGS)) return {};
|
|
78
|
+
try { return JSON.parse(readFileSync(SETTINGS, 'utf8')); } catch { return {}; }
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
function stripOurs(hooks) {
|
|
82
|
+
const out = {};
|
|
83
|
+
for (const [evt, entries] of Object.entries(hooks || {})) {
|
|
84
|
+
const kept = (entries || []).filter((e) => !isOurEntry(e));
|
|
85
|
+
if (kept.length) out[evt] = kept;
|
|
86
|
+
}
|
|
87
|
+
return out;
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
function main() {
|
|
91
|
+
const uninstall = process.argv.includes('--uninstall');
|
|
92
|
+
const binary = pickBinary();
|
|
93
|
+
|
|
94
|
+
if (!uninstall && !existsSync(binary)) {
|
|
95
|
+
console.error(`[neruva] bundled binary missing: ${binary}\n` +
|
|
96
|
+
`Reinstall @neruva/mcp so the platform binary is present.`);
|
|
97
|
+
process.exit(1);
|
|
98
|
+
}
|
|
99
|
+
if (!uninstall && platform() !== 'win32') {
|
|
100
|
+
try { chmodSync(binary, 0o755); } catch {}
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
const settings = readSettings();
|
|
104
|
+
if (existsSync(SETTINGS)) {
|
|
105
|
+
try { copyFileSync(SETTINGS, `${SETTINGS}.bak`); } catch {}
|
|
106
|
+
} else {
|
|
107
|
+
mkdirSync(dirname(SETTINGS), { recursive: true });
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
// Always start from a clean slate of OUR entries (idempotent re-runs).
|
|
111
|
+
settings.hooks = stripOurs(settings.hooks);
|
|
112
|
+
|
|
113
|
+
if (uninstall) {
|
|
114
|
+
if (settings.env) delete settings.env.NERUVA_RUST_FULL_TAKEOVER;
|
|
115
|
+
writeFileSync(SETTINGS, JSON.stringify(settings, null, 2));
|
|
116
|
+
console.log('[neruva] full-takeover hooks removed from', SETTINGS);
|
|
117
|
+
return;
|
|
118
|
+
}
|
|
119
|
+
|
|
120
|
+
const cmd = `"${binary.replace(/\\/g, '/')}"`;
|
|
121
|
+
const ours = buildHooks(cmd);
|
|
122
|
+
for (const [evt, entries] of Object.entries(ours)) {
|
|
123
|
+
settings.hooks[evt] = [...(settings.hooks[evt] || []), ...entries];
|
|
124
|
+
}
|
|
125
|
+
|
|
126
|
+
settings.env = settings.env || {};
|
|
127
|
+
Object.assign(settings.env, ENV_FORCE);
|
|
128
|
+
for (const [k, v] of Object.entries(ENV_DEFAULTS)) {
|
|
129
|
+
if (settings.env[k] === undefined) settings.env[k] = v;
|
|
130
|
+
}
|
|
131
|
+
|
|
132
|
+
writeFileSync(SETTINGS, JSON.stringify(settings, null, 2));
|
|
133
|
+
console.log('[neruva] full-takeover auto-pilot wired into', SETTINGS);
|
|
134
|
+
console.log('[neruva] binary:', binary);
|
|
135
|
+
if (!settings.env.NERUVA_API_KEY) {
|
|
136
|
+
console.log('\n NEXT: set your API key (free at https://neruva.io):');
|
|
137
|
+
console.log(' add "NERUVA_API_KEY": "nv_..." to the "env" block in', SETTINGS);
|
|
138
|
+
}
|
|
139
|
+
console.log(' Then restart Claude Code. Memory + reasoning auto-pilot is now active with zero Python.');
|
|
140
|
+
}
|
|
141
|
+
|
|
142
|
+
main();
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
package/package.json
CHANGED
|
@@ -1,12 +1,13 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@neruva/mcp",
|
|
3
|
-
"version": "0.
|
|
4
|
-
"description": "MCP server for Neruva -- reliability infrastructure for production AI agents. One install, agent stops forgetting / drifting / repeating mistakes, every failure replayable bit-for-bit. v0.27 ships the qbound KG engine -- pick engine='qbound' on hd_kg_add_facts when document-stated facts must override LLM training-time priors. Now 6 KG engines (hadamard, opb, qbound, multishard, quorum, feature_bundle). v0.26 ships agent_recall_full -- 7-layer federated semantic recall across records, KG, learned rules, CBR episodes, SCM variables, belief tracking, and continual learners in parallel (one question, seven buckets, ~150ms p95). INSTALL: npx -y -p @neruva/mcp@latest neruva-mcp.
|
|
3
|
+
"version": "0.30.0",
|
|
4
|
+
"description": "MCP server for Neruva -- reliability infrastructure for production AI agents. One install, agent stops forgetting / drifting / repeating mistakes, every failure replayable bit-for-bit. v0.27 ships the qbound KG engine -- pick engine='qbound' on hd_kg_add_facts when document-stated facts must override LLM training-time priors. Now 6 KG engines (hadamard, opb, qbound, multishard, quorum, feature_bundle). v0.26 ships agent_recall_full -- 7-layer federated semantic recall across records, KG, learned rules, CBR episodes, SCM variables, belief tracking, and continual learners in parallel (one question, seven buckets, ~150ms p95). INSTALL: npx -y -p @neruva/mcp@latest neruva-mcp. BUNDLES the neruva-record-hook native binary (Rust, in-binary HTTPS hot path, ~1.5-2MB) for all 6 platforms. v0.30 adds ONE-COMMAND full-takeover install (npx -p @neruva/mcp neruva-mcp-install) -- wires the complete memory+reasoning auto-pilot (per-turn recall, auto-route, auto-reflect, code-graph, consistency, secret redaction, recording) with ZERO Python or daemon. Cache-hit p95 ~80ms via warm daemon + TTL cache. AUTO-PILOT: agent_route_intent_prompt + agent_reflect_prompt + auto-extract on records_ingest. Plus typed Records, federated agent_remember/recall/context, counterfactual rollouts, rule induction, code_kg_* navigation, .neruva V3 container. Pattern-C: substrate stays $0/call. Free tier, no card.",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"type": "module",
|
|
7
7
|
"bin": {
|
|
8
8
|
"neruva-mcp": "dist/server.js",
|
|
9
|
-
"neruva-record-hook": "bin/neruva-record-hook.js"
|
|
9
|
+
"neruva-record-hook": "bin/neruva-record-hook.js",
|
|
10
|
+
"neruva-mcp-install": "bin/install-hooks.js"
|
|
10
11
|
},
|
|
11
12
|
"files": [
|
|
12
13
|
"dist",
|