@minns/openclaw-minns 0.2.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/README.md +109 -0
- package/dist/config.d.ts +7 -0
- package/dist/config.js +22 -0
- package/dist/config.js.map +1 -0
- package/dist/mcp.d.ts +2 -0
- package/dist/mcp.js +70 -0
- package/dist/mcp.js.map +1 -0
- package/dist/tools.d.ts +196 -0
- package/dist/tools.js +318 -0
- package/dist/tools.js.map +1 -0
- package/package.json +33 -0
- package/skills/minns-memory/SKILL.md +37 -0
package/README.md
ADDED
|
@@ -0,0 +1,109 @@
|
|
|
1
|
+
# @minns/openclaw-minns
|
|
2
|
+
|
|
3
|
+
MCP stdio server that connects [OpenClaw](https://github.com/anthropics/openclaw) to [Minns EventGraphDB](https://github.com/minns/minns-sdk) for persistent agent memory, strategy recall, and claim search.
|
|
4
|
+
|
|
5
|
+
## Install
|
|
6
|
+
|
|
7
|
+
```bash
|
|
8
|
+
npm i @minns/openclaw-minns
|
|
9
|
+
```
|
|
10
|
+
|
|
11
|
+
Or clone and build locally:
|
|
12
|
+
|
|
13
|
+
```bash
|
|
14
|
+
cd openclaw-minns
|
|
15
|
+
npm install
|
|
16
|
+
npm run build
|
|
17
|
+
```
|
|
18
|
+
|
|
19
|
+
## Configure OpenClaw
|
|
20
|
+
|
|
21
|
+
Add the MCP server entry to your OpenClaw config (typically `~/.config/openclaw/config.json` or the `mcpServers` section of your project settings):
|
|
22
|
+
|
|
23
|
+
```json
|
|
24
|
+
{
|
|
25
|
+
"mcpServers": {
|
|
26
|
+
"minns": {
|
|
27
|
+
"command": "openclaw-minns-mcp",
|
|
28
|
+
"env": {
|
|
29
|
+
"MINNS_BASE_URL": "http://127.0.0.1:3000",
|
|
30
|
+
"MINNS_DEBUG": "false"
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
```
|
|
36
|
+
|
|
37
|
+
If your EventGraphDB instance requires authentication:
|
|
38
|
+
|
|
39
|
+
```json
|
|
40
|
+
{
|
|
41
|
+
"mcpServers": {
|
|
42
|
+
"minns": {
|
|
43
|
+
"command": "openclaw-minns-mcp",
|
|
44
|
+
"env": {
|
|
45
|
+
"MINNS_BASE_URL": "https://your-server.example.com",
|
|
46
|
+
"MINNS_API_KEY": "your-secret-key",
|
|
47
|
+
"MINNS_DEBUG": "false"
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
```
|
|
53
|
+
|
|
54
|
+
## Environment variables
|
|
55
|
+
|
|
56
|
+
| Variable | Default | Description |
|
|
57
|
+
| ---------------- | ------------------------- | ---------------------------------------------- |
|
|
58
|
+
| `MINNS_BASE_URL` | `http://127.0.0.1:3000` | EventGraphDB HTTP endpoint |
|
|
59
|
+
| `MINNS_API_KEY` | *(none)* | Optional Bearer token for authenticated access |
|
|
60
|
+
| `MINNS_DEBUG` | `false` | Set to `true` for verbose stderr logging |
|
|
61
|
+
|
|
62
|
+
## Available tools
|
|
63
|
+
|
|
64
|
+
| Tool | Description |
|
|
65
|
+
| ------------------------------ | ---------------------------------------------------- |
|
|
66
|
+
| `memory.search` | Semantic search over memories |
|
|
67
|
+
| `memory.capture` | Store a new memory (context event with embeddings) |
|
|
68
|
+
| `memory.memories` | List agent memories by strength |
|
|
69
|
+
| `memory.strategies` | List agent strategies by quality |
|
|
70
|
+
| `strategy.similar` | Find strategies matching a signature |
|
|
71
|
+
| `strategy.suggest_next_action` | Get next-action suggestions for a context |
|
|
72
|
+
| `claims.search` | Search extracted claims semantically |
|
|
73
|
+
| `stats.get` | System-wide EventGraphDB statistics |
|
|
74
|
+
| `health.check` | Verify EventGraphDB is reachable |
|
|
75
|
+
|
|
76
|
+
## Test locally
|
|
77
|
+
|
|
78
|
+
Start EventGraphDB, then run the binary directly. It speaks JSON-RPC 2.0 over stdio:
|
|
79
|
+
|
|
80
|
+
```bash
|
|
81
|
+
# Start the MCP server
|
|
82
|
+
MINNS_BASE_URL=http://127.0.0.1:3000 npx openclaw-minns-mcp
|
|
83
|
+
```
|
|
84
|
+
|
|
85
|
+
In another terminal, pipe a JSON-RPC request to test:
|
|
86
|
+
|
|
87
|
+
```bash
|
|
88
|
+
echo '{"jsonrpc":"2.0","id":1,"method":"tools/list","params":{}}' | npx openclaw-minns-mcp
|
|
89
|
+
```
|
|
90
|
+
|
|
91
|
+
To call a tool:
|
|
92
|
+
|
|
93
|
+
```bash
|
|
94
|
+
echo '{"jsonrpc":"2.0","id":2,"method":"tools/call","params":{"name":"health.check","arguments":{}}}' | npx openclaw-minns-mcp
|
|
95
|
+
```
|
|
96
|
+
|
|
97
|
+
Memory search example:
|
|
98
|
+
|
|
99
|
+
```bash
|
|
100
|
+
echo '{"jsonrpc":"2.0","id":3,"method":"tools/call","params":{"name":"memory.search","arguments":{"query":"user preferences","limit":5}}}' | npx openclaw-minns-mcp
|
|
101
|
+
```
|
|
102
|
+
|
|
103
|
+
## Fallback skill
|
|
104
|
+
|
|
105
|
+
If your agent runtime does not support MCP natively, copy `skills/minns-memory/SKILL.md` into your agent's skill/policy directory. It instructs the agent to call `memory.search` before answering and `memory.capture` after answering, with safety rules to avoid storing secrets.
|
|
106
|
+
|
|
107
|
+
## License
|
|
108
|
+
|
|
109
|
+
MIT
|
package/dist/config.d.ts
ADDED
package/dist/config.js
ADDED
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { createClient } from "minns-sdk";
|
|
2
|
+
export function loadConfig() {
|
|
3
|
+
return {
|
|
4
|
+
baseUrl: process.env.MINNS_BASE_URL ?? "http://127.0.0.1:3000",
|
|
5
|
+
debug: process.env.MINNS_DEBUG === "true",
|
|
6
|
+
apiKey: process.env.MINNS_API_KEY || undefined,
|
|
7
|
+
};
|
|
8
|
+
}
|
|
9
|
+
export function buildClient(cfg) {
|
|
10
|
+
const opts = {
|
|
11
|
+
baseUrl: cfg.baseUrl,
|
|
12
|
+
debug: cfg.debug,
|
|
13
|
+
};
|
|
14
|
+
if (cfg.apiKey) {
|
|
15
|
+
opts.headers = {
|
|
16
|
+
"Content-Type": "application/json",
|
|
17
|
+
Authorization: `Bearer ${cfg.apiKey}`,
|
|
18
|
+
};
|
|
19
|
+
}
|
|
20
|
+
return createClient(opts);
|
|
21
|
+
}
|
|
22
|
+
//# sourceMappingURL=config.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"config.js","sourceRoot":"","sources":["../src/config.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAiC,MAAM,WAAW,CAAC;AAQxE,MAAM,UAAU,UAAU;IACxB,OAAO;QACL,OAAO,EAAE,OAAO,CAAC,GAAG,CAAC,cAAc,IAAI,uBAAuB;QAC9D,KAAK,EAAE,OAAO,CAAC,GAAG,CAAC,WAAW,KAAK,MAAM;QACzC,MAAM,EAAE,OAAO,CAAC,GAAG,CAAC,aAAa,IAAI,SAAS;KAC/C,CAAC;AACJ,CAAC;AAED,MAAM,UAAU,WAAW,CAAC,GAAgB;IAC1C,MAAM,IAAI,GAA6B;QACrC,OAAO,EAAE,GAAG,CAAC,OAAO;QACpB,KAAK,EAAE,GAAG,CAAC,KAAK;KACjB,CAAC;IAEF,IAAI,GAAG,CAAC,MAAM,EAAE,CAAC;QACf,IAAI,CAAC,OAAO,GAAG;YACb,cAAc,EAAE,kBAAkB;YAClC,aAAa,EAAE,UAAU,GAAG,CAAC,MAAM,EAAE;SACtC,CAAC;IACJ,CAAC;IAED,OAAO,YAAY,CAAC,IAAI,CAAC,CAAC;AAC5B,CAAC"}
|
package/dist/mcp.d.ts
ADDED
package/dist/mcp.js
ADDED
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
import { Server } from "@modelcontextprotocol/sdk/server/index.js";
|
|
3
|
+
import { StdioServerTransport } from "@modelcontextprotocol/sdk/server/stdio.js";
|
|
4
|
+
import { CallToolRequestSchema, ListToolsRequestSchema, } from "@modelcontextprotocol/sdk/types.js";
|
|
5
|
+
import { ZodError } from "zod";
|
|
6
|
+
import { loadConfig, buildClient } from "./config.js";
|
|
7
|
+
import { TOOL_DEFS, dispatch } from "./tools.js";
|
|
8
|
+
const cfg = loadConfig();
|
|
9
|
+
const client = buildClient(cfg);
|
|
10
|
+
const server = new Server({ name: "openclaw-minns", version: "0.1.0" }, { capabilities: { tools: {} } });
|
|
11
|
+
// ---- tools/list -----------------------------------------------------------
|
|
12
|
+
server.setRequestHandler(ListToolsRequestSchema, async () => ({
|
|
13
|
+
tools: TOOL_DEFS.map((t) => ({
|
|
14
|
+
name: t.name,
|
|
15
|
+
description: t.description,
|
|
16
|
+
inputSchema: t.inputSchema,
|
|
17
|
+
})),
|
|
18
|
+
}));
|
|
19
|
+
// ---- tools/call -----------------------------------------------------------
|
|
20
|
+
server.setRequestHandler(CallToolRequestSchema, async (request) => {
|
|
21
|
+
const { name, arguments: args } = request.params;
|
|
22
|
+
try {
|
|
23
|
+
const result = await dispatch(client, name, args ?? {});
|
|
24
|
+
return {
|
|
25
|
+
content: [{ type: "text", text: JSON.stringify(result, null, 2) }],
|
|
26
|
+
};
|
|
27
|
+
}
|
|
28
|
+
catch (err) {
|
|
29
|
+
if (err instanceof ZodError) {
|
|
30
|
+
return {
|
|
31
|
+
isError: true,
|
|
32
|
+
content: [
|
|
33
|
+
{
|
|
34
|
+
type: "text",
|
|
35
|
+
text: JSON.stringify({
|
|
36
|
+
error: "validation_error",
|
|
37
|
+
issues: err.issues.map((i) => ({
|
|
38
|
+
path: i.path.join("."),
|
|
39
|
+
message: i.message,
|
|
40
|
+
})),
|
|
41
|
+
}),
|
|
42
|
+
},
|
|
43
|
+
],
|
|
44
|
+
};
|
|
45
|
+
}
|
|
46
|
+
const message = err instanceof Error ? err.message : String(err);
|
|
47
|
+
return {
|
|
48
|
+
isError: true,
|
|
49
|
+
content: [
|
|
50
|
+
{
|
|
51
|
+
type: "text",
|
|
52
|
+
text: JSON.stringify({ error: message }),
|
|
53
|
+
},
|
|
54
|
+
],
|
|
55
|
+
};
|
|
56
|
+
}
|
|
57
|
+
});
|
|
58
|
+
// ---- start ----------------------------------------------------------------
|
|
59
|
+
async function main() {
|
|
60
|
+
const transport = new StdioServerTransport();
|
|
61
|
+
await server.connect(transport);
|
|
62
|
+
if (cfg.debug) {
|
|
63
|
+
process.stderr.write(`[openclaw-minns] MCP server running -- base=${cfg.baseUrl}\n`);
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
main().catch((err) => {
|
|
67
|
+
process.stderr.write(`[openclaw-minns] Fatal: ${err}\n`);
|
|
68
|
+
process.exit(1);
|
|
69
|
+
});
|
|
70
|
+
//# sourceMappingURL=mcp.js.map
|
package/dist/mcp.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"mcp.js","sourceRoot":"","sources":["../src/mcp.ts"],"names":[],"mappings":";AAEA,OAAO,EAAE,MAAM,EAAE,MAAM,2CAA2C,CAAC;AACnE,OAAO,EAAE,oBAAoB,EAAE,MAAM,2CAA2C,CAAC;AACjF,OAAO,EACL,qBAAqB,EACrB,sBAAsB,GACvB,MAAM,oCAAoC,CAAC;AAC5C,OAAO,EAAE,QAAQ,EAAE,MAAM,KAAK,CAAC;AAC/B,OAAO,EAAE,UAAU,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AACtD,OAAO,EAAE,SAAS,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAC;AAEjD,MAAM,GAAG,GAAG,UAAU,EAAE,CAAC;AACzB,MAAM,MAAM,GAAG,WAAW,CAAC,GAAG,CAAC,CAAC;AAEhC,MAAM,MAAM,GAAG,IAAI,MAAM,CACvB,EAAE,IAAI,EAAE,gBAAgB,EAAE,OAAO,EAAE,OAAO,EAAE,EAC5C,EAAE,YAAY,EAAE,EAAE,KAAK,EAAE,EAAE,EAAE,EAAE,CAChC,CAAC;AAEF,8EAA8E;AAE9E,MAAM,CAAC,iBAAiB,CAAC,sBAAsB,EAAE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AAM,OAAO,GAAG,GAAG,YAAY,KAAK,CAAC,CAAC,CAAC,GAAG,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC;QACjE,OAAO;YACL,OAAO,EAAE,IAAI;YACb,OAAO,EAAE;gBACP;oBACE,IAAI,EAAE,MAAe;oBACrB,IAAI,EAAE,IAAI,CAAC,SAAS,CAAC,EAAE,KAAK,EAAE,OAAO,EAAE,CAAC;iBACzC;aACF;SACF,CAAC;IACJ,CAAC;AACH,CAAC,CAAC,CAAC;AAEH,8EAA8E;AAE9E,KAAK,UAAU,IAAI;IACjB,MAAM,SAAS,GAAG,IAAI,oBAAoB,EAAE,CAAC;IAC7C,MAAM,MAAM,CAAC,OAAO,CAAC,SAAS,CAAC,CAAC;IAEhC,IAAI,GAAG,CAAC,KAAK,EAAE,CAAC;QACd,OAAO,CAAC,MAAM,CAAC,KAAK,CAClB,+CAA+C,GAAG,CAAC,OAAO,IAAI,CAC/D,CAAC;IACJ,CAAC;AACH,CAAC;AAED,IAAI,EAAE,CAAC,KAAK,CAAC,CAAC,GAAG,EAAE,EAAE;IACnB,OAAO,CAAC,MAAM,CAAC,KAAK,CAAC,2BAA2B,GAAG,IAAI,CAAC,CAAC;IACzD,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;AAClB,CAAC,CAAC,CAAC"}
|
package/dist/tools.d.ts
ADDED
|
@@ -0,0 +1,196 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
import type { EventGraphDBClient } from "minns-sdk";
|
|
3
|
+
import { IntentSpecRegistry, type IntentSpec } from "minns-sdk";
|
|
4
|
+
declare const registry: IntentSpecRegistry;
|
|
5
|
+
declare const DEFAULT_MEMORY_SPEC: IntentSpec;
|
|
6
|
+
export declare const MemorySearchSchema: z.ZodObject<{
|
|
7
|
+
query: z.ZodString;
|
|
8
|
+
limit: z.ZodDefault<z.ZodOptional<z.ZodNumber>>;
|
|
9
|
+
min_similarity: z.ZodOptional<z.ZodNumber>;
|
|
10
|
+
agent_id: z.ZodOptional<z.ZodUnion<[z.ZodNumber, z.ZodString]>>;
|
|
11
|
+
session_id: z.ZodOptional<z.ZodUnion<[z.ZodNumber, z.ZodString]>>;
|
|
12
|
+
}, "strip", z.ZodTypeAny, {
|
|
13
|
+
query: string;
|
|
14
|
+
limit: number;
|
|
15
|
+
min_similarity?: number | undefined;
|
|
16
|
+
agent_id?: string | number | undefined;
|
|
17
|
+
session_id?: string | number | undefined;
|
|
18
|
+
}, {
|
|
19
|
+
query: string;
|
|
20
|
+
limit?: number | undefined;
|
|
21
|
+
min_similarity?: number | undefined;
|
|
22
|
+
agent_id?: string | number | undefined;
|
|
23
|
+
session_id?: string | number | undefined;
|
|
24
|
+
}>;
|
|
25
|
+
export declare const MemoryCaptureSchema: z.ZodObject<{
|
|
26
|
+
agent_type: z.ZodString;
|
|
27
|
+
agent_id: z.ZodUnion<[z.ZodNumber, z.ZodString]>;
|
|
28
|
+
session_id: z.ZodUnion<[z.ZodNumber, z.ZodString]>;
|
|
29
|
+
text: z.ZodString;
|
|
30
|
+
context_type: z.ZodDefault<z.ZodOptional<z.ZodString>>;
|
|
31
|
+
user_id: z.ZodOptional<z.ZodString>;
|
|
32
|
+
goals: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
33
|
+
text: z.ZodString;
|
|
34
|
+
priority: z.ZodDefault<z.ZodOptional<z.ZodUnion<[z.ZodLiteral<1>, z.ZodLiteral<2>, z.ZodLiteral<3>, z.ZodLiteral<4>, z.ZodLiteral<5>]>>>;
|
|
35
|
+
progress: z.ZodDefault<z.ZodOptional<z.ZodNumber>>;
|
|
36
|
+
}, "strip", z.ZodTypeAny, {
|
|
37
|
+
text: string;
|
|
38
|
+
priority: 1 | 5 | 2 | 3 | 4;
|
|
39
|
+
progress: number;
|
|
40
|
+
}, {
|
|
41
|
+
text: string;
|
|
42
|
+
priority?: 1 | 5 | 2 | 3 | 4 | undefined;
|
|
43
|
+
progress?: number | undefined;
|
|
44
|
+
}>, "many">>;
|
|
45
|
+
}, "strip", z.ZodTypeAny, {
|
|
46
|
+
text: string;
|
|
47
|
+
context_type: string;
|
|
48
|
+
agent_id: string | number;
|
|
49
|
+
session_id: string | number;
|
|
50
|
+
agent_type: string;
|
|
51
|
+
user_id?: string | undefined;
|
|
52
|
+
goals?: {
|
|
53
|
+
text: string;
|
|
54
|
+
priority: 1 | 5 | 2 | 3 | 4;
|
|
55
|
+
progress: number;
|
|
56
|
+
}[] | undefined;
|
|
57
|
+
}, {
|
|
58
|
+
text: string;
|
|
59
|
+
agent_id: string | number;
|
|
60
|
+
session_id: string | number;
|
|
61
|
+
agent_type: string;
|
|
62
|
+
context_type?: string | undefined;
|
|
63
|
+
user_id?: string | undefined;
|
|
64
|
+
goals?: {
|
|
65
|
+
text: string;
|
|
66
|
+
priority?: 1 | 5 | 2 | 3 | 4 | undefined;
|
|
67
|
+
progress?: number | undefined;
|
|
68
|
+
}[] | undefined;
|
|
69
|
+
}>;
|
|
70
|
+
export declare const MemoryMemoriesSchema: z.ZodObject<{
|
|
71
|
+
agent_id: z.ZodUnion<[z.ZodNumber, z.ZodString]>;
|
|
72
|
+
limit: z.ZodDefault<z.ZodOptional<z.ZodNumber>>;
|
|
73
|
+
}, "strip", z.ZodTypeAny, {
|
|
74
|
+
limit: number;
|
|
75
|
+
agent_id: string | number;
|
|
76
|
+
}, {
|
|
77
|
+
agent_id: string | number;
|
|
78
|
+
limit?: number | undefined;
|
|
79
|
+
}>;
|
|
80
|
+
export declare const MemoryStrategiesSchema: z.ZodObject<{
|
|
81
|
+
agent_id: z.ZodUnion<[z.ZodNumber, z.ZodString]>;
|
|
82
|
+
limit: z.ZodDefault<z.ZodOptional<z.ZodNumber>>;
|
|
83
|
+
}, "strip", z.ZodTypeAny, {
|
|
84
|
+
limit: number;
|
|
85
|
+
agent_id: string | number;
|
|
86
|
+
}, {
|
|
87
|
+
agent_id: string | number;
|
|
88
|
+
limit?: number | undefined;
|
|
89
|
+
}>;
|
|
90
|
+
export declare const StrategySimilarSchema: z.ZodObject<{
|
|
91
|
+
agent_id: z.ZodOptional<z.ZodUnion<[z.ZodNumber, z.ZodString]>>;
|
|
92
|
+
goal_ids: z.ZodOptional<z.ZodArray<z.ZodUnion<[z.ZodNumber, z.ZodString]>, "many">>;
|
|
93
|
+
tool_names: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
|
|
94
|
+
result_types: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
|
|
95
|
+
context_hash: z.ZodOptional<z.ZodUnion<[z.ZodNumber, z.ZodString]>>;
|
|
96
|
+
min_score: z.ZodOptional<z.ZodNumber>;
|
|
97
|
+
limit: z.ZodDefault<z.ZodOptional<z.ZodNumber>>;
|
|
98
|
+
}, "strip", z.ZodTypeAny, {
|
|
99
|
+
limit: number;
|
|
100
|
+
agent_id?: string | number | undefined;
|
|
101
|
+
goal_ids?: (string | number)[] | undefined;
|
|
102
|
+
tool_names?: string[] | undefined;
|
|
103
|
+
result_types?: string[] | undefined;
|
|
104
|
+
context_hash?: string | number | undefined;
|
|
105
|
+
min_score?: number | undefined;
|
|
106
|
+
}, {
|
|
107
|
+
limit?: number | undefined;
|
|
108
|
+
agent_id?: string | number | undefined;
|
|
109
|
+
goal_ids?: (string | number)[] | undefined;
|
|
110
|
+
tool_names?: string[] | undefined;
|
|
111
|
+
result_types?: string[] | undefined;
|
|
112
|
+
context_hash?: string | number | undefined;
|
|
113
|
+
min_score?: number | undefined;
|
|
114
|
+
}>;
|
|
115
|
+
export declare const StrategySuggestSchema: z.ZodObject<{
|
|
116
|
+
context_hash: z.ZodUnion<[z.ZodNumber, z.ZodString]>;
|
|
117
|
+
last_action_node: z.ZodOptional<z.ZodNumber>;
|
|
118
|
+
limit: z.ZodDefault<z.ZodOptional<z.ZodNumber>>;
|
|
119
|
+
}, "strip", z.ZodTypeAny, {
|
|
120
|
+
limit: number;
|
|
121
|
+
context_hash: string | number;
|
|
122
|
+
last_action_node?: number | undefined;
|
|
123
|
+
}, {
|
|
124
|
+
context_hash: string | number;
|
|
125
|
+
limit?: number | undefined;
|
|
126
|
+
last_action_node?: number | undefined;
|
|
127
|
+
}>;
|
|
128
|
+
export declare const ClaimsSearchSchema: z.ZodObject<{
|
|
129
|
+
query_text: z.ZodString;
|
|
130
|
+
top_k: z.ZodDefault<z.ZodOptional<z.ZodNumber>>;
|
|
131
|
+
min_similarity: z.ZodOptional<z.ZodNumber>;
|
|
132
|
+
}, "strip", z.ZodTypeAny, {
|
|
133
|
+
query_text: string;
|
|
134
|
+
top_k: number;
|
|
135
|
+
min_similarity?: number | undefined;
|
|
136
|
+
}, {
|
|
137
|
+
query_text: string;
|
|
138
|
+
min_similarity?: number | undefined;
|
|
139
|
+
top_k?: number | undefined;
|
|
140
|
+
}>;
|
|
141
|
+
export declare const StatsGetSchema: z.ZodObject<{}, "strip", z.ZodTypeAny, {}, {}>;
|
|
142
|
+
export declare const HealthCheckSchema: z.ZodObject<{}, "strip", z.ZodTypeAny, {}, {}>;
|
|
143
|
+
export declare const IntentInstructionSchema: z.ZodObject<{
|
|
144
|
+
agent_type: z.ZodDefault<z.ZodOptional<z.ZodString>>;
|
|
145
|
+
goals: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
146
|
+
description: z.ZodOptional<z.ZodString>;
|
|
147
|
+
}, "strip", z.ZodTypeAny, {
|
|
148
|
+
description?: string | undefined;
|
|
149
|
+
}, {
|
|
150
|
+
description?: string | undefined;
|
|
151
|
+
}>, "many">>;
|
|
152
|
+
}, "strip", z.ZodTypeAny, {
|
|
153
|
+
agent_type: string;
|
|
154
|
+
goals?: {
|
|
155
|
+
description?: string | undefined;
|
|
156
|
+
}[] | undefined;
|
|
157
|
+
}, {
|
|
158
|
+
agent_type?: string | undefined;
|
|
159
|
+
goals?: {
|
|
160
|
+
description?: string | undefined;
|
|
161
|
+
}[] | undefined;
|
|
162
|
+
}>;
|
|
163
|
+
export declare const IntentParseSchema: z.ZodObject<{
|
|
164
|
+
model_text: z.ZodString;
|
|
165
|
+
user_message: z.ZodString;
|
|
166
|
+
agent_type: z.ZodDefault<z.ZodOptional<z.ZodString>>;
|
|
167
|
+
goals: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
168
|
+
description: z.ZodOptional<z.ZodString>;
|
|
169
|
+
}, "strip", z.ZodTypeAny, {
|
|
170
|
+
description?: string | undefined;
|
|
171
|
+
}, {
|
|
172
|
+
description?: string | undefined;
|
|
173
|
+
}>, "many">>;
|
|
174
|
+
}, "strip", z.ZodTypeAny, {
|
|
175
|
+
agent_type: string;
|
|
176
|
+
model_text: string;
|
|
177
|
+
user_message: string;
|
|
178
|
+
goals?: {
|
|
179
|
+
description?: string | undefined;
|
|
180
|
+
}[] | undefined;
|
|
181
|
+
}, {
|
|
182
|
+
model_text: string;
|
|
183
|
+
user_message: string;
|
|
184
|
+
agent_type?: string | undefined;
|
|
185
|
+
goals?: {
|
|
186
|
+
description?: string | undefined;
|
|
187
|
+
}[] | undefined;
|
|
188
|
+
}>;
|
|
189
|
+
export interface ToolDef {
|
|
190
|
+
name: string;
|
|
191
|
+
description: string;
|
|
192
|
+
inputSchema: Record<string, unknown>;
|
|
193
|
+
}
|
|
194
|
+
export declare const TOOL_DEFS: ToolDef[];
|
|
195
|
+
export declare function dispatch(client: EventGraphDBClient, toolName: string, rawArgs: unknown): Promise<unknown>;
|
|
196
|
+
export { registry, DEFAULT_MEMORY_SPEC };
|
package/dist/tools.js
ADDED
|
@@ -0,0 +1,318 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
import { IntentSpecRegistry, buildSidecarInstruction, extractIntentAndResponse, } from "minns-sdk";
|
|
3
|
+
// ---------------------------------------------------------------------------
|
|
4
|
+
// Shared intent registry -- agents register specs, MCP resolves them
|
|
5
|
+
// ---------------------------------------------------------------------------
|
|
6
|
+
const registry = new IntentSpecRegistry();
|
|
7
|
+
const DEFAULT_MEMORY_SPEC = {
|
|
8
|
+
domain: "memory",
|
|
9
|
+
fallback_intent: "query",
|
|
10
|
+
intents: [
|
|
11
|
+
{ name: "recall", slots: { query: { freeText: true } } },
|
|
12
|
+
{
|
|
13
|
+
name: "capture",
|
|
14
|
+
slots: {
|
|
15
|
+
text: { freeText: true },
|
|
16
|
+
context_type: { optional: true, enum: ["preference", "fact", "decision", "constraint", "general"] },
|
|
17
|
+
},
|
|
18
|
+
},
|
|
19
|
+
{ name: "query", slots: { query: { freeText: true } } },
|
|
20
|
+
],
|
|
21
|
+
extensions: {
|
|
22
|
+
allow_claims_hint: true,
|
|
23
|
+
allowed_claim_types: ["preference", "fact", "decision", "constraint"],
|
|
24
|
+
max_claims_hint: 5,
|
|
25
|
+
},
|
|
26
|
+
enableSemantic: (intent) => intent.intent === "capture" ||
|
|
27
|
+
(intent.claims_hint !== undefined && intent.claims_hint.length > 0),
|
|
28
|
+
};
|
|
29
|
+
registry.registerAgentFallback("memory", DEFAULT_MEMORY_SPEC);
|
|
30
|
+
// ---------------------------------------------------------------------------
|
|
31
|
+
// Zod schemas
|
|
32
|
+
// ---------------------------------------------------------------------------
|
|
33
|
+
const IdField = z.union([z.number(), z.string()]);
|
|
34
|
+
export const MemorySearchSchema = z.object({
|
|
35
|
+
query: z.string().min(1, "query is required"),
|
|
36
|
+
limit: z.number().int().positive().optional().default(10),
|
|
37
|
+
min_similarity: z.number().min(0).max(1).optional(),
|
|
38
|
+
agent_id: IdField.optional(),
|
|
39
|
+
session_id: IdField.optional(),
|
|
40
|
+
});
|
|
41
|
+
export const MemoryCaptureSchema = z.object({
|
|
42
|
+
agent_type: z.string().min(1, "agent_type is required"),
|
|
43
|
+
agent_id: IdField,
|
|
44
|
+
session_id: IdField,
|
|
45
|
+
text: z.string().min(1, "text is required"),
|
|
46
|
+
context_type: z.string().optional().default("general"),
|
|
47
|
+
user_id: z.string().optional(),
|
|
48
|
+
goals: z.array(z.object({
|
|
49
|
+
text: z.string(),
|
|
50
|
+
priority: z.union([z.literal(1), z.literal(2), z.literal(3), z.literal(4), z.literal(5)]).optional().default(3),
|
|
51
|
+
progress: z.number().min(0).max(1).optional().default(0),
|
|
52
|
+
})).optional(),
|
|
53
|
+
});
|
|
54
|
+
export const MemoryMemoriesSchema = z.object({
|
|
55
|
+
agent_id: IdField,
|
|
56
|
+
limit: z.number().int().positive().optional().default(10),
|
|
57
|
+
});
|
|
58
|
+
export const MemoryStrategiesSchema = z.object({
|
|
59
|
+
agent_id: IdField,
|
|
60
|
+
limit: z.number().int().positive().optional().default(10),
|
|
61
|
+
});
|
|
62
|
+
export const StrategySimilarSchema = z.object({
|
|
63
|
+
agent_id: IdField.optional(),
|
|
64
|
+
goal_ids: z.array(IdField).optional(),
|
|
65
|
+
tool_names: z.array(z.string()).optional(),
|
|
66
|
+
result_types: z.array(z.string()).optional(),
|
|
67
|
+
context_hash: IdField.optional(),
|
|
68
|
+
min_score: z.number().min(0).max(1).optional(),
|
|
69
|
+
limit: z.number().int().positive().optional().default(10),
|
|
70
|
+
});
|
|
71
|
+
export const StrategySuggestSchema = z.object({
|
|
72
|
+
context_hash: IdField,
|
|
73
|
+
last_action_node: z.number().int().optional(),
|
|
74
|
+
limit: z.number().int().positive().optional().default(5),
|
|
75
|
+
});
|
|
76
|
+
export const ClaimsSearchSchema = z.object({
|
|
77
|
+
query_text: z.string().min(1, "query_text is required"),
|
|
78
|
+
top_k: z.number().int().positive().optional().default(5),
|
|
79
|
+
min_similarity: z.number().min(0).max(1).optional(),
|
|
80
|
+
});
|
|
81
|
+
export const StatsGetSchema = z.object({});
|
|
82
|
+
export const HealthCheckSchema = z.object({});
|
|
83
|
+
export const IntentInstructionSchema = z.object({
|
|
84
|
+
agent_type: z.string().optional().default("memory"),
|
|
85
|
+
goals: z.array(z.object({ description: z.string().optional() })).optional(),
|
|
86
|
+
});
|
|
87
|
+
export const IntentParseSchema = z.object({
|
|
88
|
+
model_text: z.string().min(1, "model_text is required"),
|
|
89
|
+
user_message: z.string().min(1, "user_message is required"),
|
|
90
|
+
agent_type: z.string().optional().default("memory"),
|
|
91
|
+
goals: z.array(z.object({ description: z.string().optional() })).optional(),
|
|
92
|
+
});
|
|
93
|
+
function zodToJsonSchema(schema) {
|
|
94
|
+
const shape = schema.shape;
|
|
95
|
+
const properties = {};
|
|
96
|
+
const required = [];
|
|
97
|
+
for (const [key, value] of Object.entries(shape)) {
|
|
98
|
+
const field = value;
|
|
99
|
+
properties[key] = zodFieldToJson(field);
|
|
100
|
+
if (!field.isOptional()) {
|
|
101
|
+
required.push(key);
|
|
102
|
+
}
|
|
103
|
+
}
|
|
104
|
+
return {
|
|
105
|
+
type: "object",
|
|
106
|
+
properties,
|
|
107
|
+
...(required.length > 0 ? { required } : {}),
|
|
108
|
+
};
|
|
109
|
+
}
|
|
110
|
+
function zodFieldToJson(field) {
|
|
111
|
+
if (field instanceof z.ZodOptional) {
|
|
112
|
+
return zodFieldToJson(field._def.innerType);
|
|
113
|
+
}
|
|
114
|
+
if (field instanceof z.ZodDefault) {
|
|
115
|
+
const inner = zodFieldToJson(field._def.innerType);
|
|
116
|
+
return { ...inner, default: field._def.defaultValue() };
|
|
117
|
+
}
|
|
118
|
+
if (field instanceof z.ZodString) {
|
|
119
|
+
return { type: "string" };
|
|
120
|
+
}
|
|
121
|
+
if (field instanceof z.ZodNumber) {
|
|
122
|
+
return { type: "number" };
|
|
123
|
+
}
|
|
124
|
+
if (field instanceof z.ZodLiteral) {
|
|
125
|
+
return { const: field._def.value };
|
|
126
|
+
}
|
|
127
|
+
if (field instanceof z.ZodUnion) {
|
|
128
|
+
return { oneOf: field._def.options.map((o) => zodFieldToJson(o)) };
|
|
129
|
+
}
|
|
130
|
+
if (field instanceof z.ZodArray) {
|
|
131
|
+
return { type: "array", items: zodFieldToJson(field._def.type) };
|
|
132
|
+
}
|
|
133
|
+
if (field instanceof z.ZodObject) {
|
|
134
|
+
return zodToJsonSchema(field);
|
|
135
|
+
}
|
|
136
|
+
return {};
|
|
137
|
+
}
|
|
138
|
+
// ---------------------------------------------------------------------------
|
|
139
|
+
// Tool definitions
|
|
140
|
+
// ---------------------------------------------------------------------------
|
|
141
|
+
export const TOOL_DEFS = [
|
|
142
|
+
{
|
|
143
|
+
name: "memory.search",
|
|
144
|
+
description: "Search memories by semantic similarity to a query string. Returns the most relevant memories.",
|
|
145
|
+
inputSchema: zodToJsonSchema(MemorySearchSchema),
|
|
146
|
+
},
|
|
147
|
+
{
|
|
148
|
+
name: "memory.capture",
|
|
149
|
+
description: "Capture a new memory via the fluent event builder. Sends a Context event with semantic indexing enabled. Optionally attach goals.",
|
|
150
|
+
inputSchema: zodToJsonSchema(MemoryCaptureSchema),
|
|
151
|
+
},
|
|
152
|
+
{
|
|
153
|
+
name: "memory.memories",
|
|
154
|
+
description: "List memories for a specific agent, sorted by strength.",
|
|
155
|
+
inputSchema: zodToJsonSchema(MemoryMemoriesSchema),
|
|
156
|
+
},
|
|
157
|
+
{
|
|
158
|
+
name: "memory.strategies",
|
|
159
|
+
description: "List strategies learned by a specific agent, sorted by quality score.",
|
|
160
|
+
inputSchema: zodToJsonSchema(MemoryStrategiesSchema),
|
|
161
|
+
},
|
|
162
|
+
{
|
|
163
|
+
name: "strategy.similar",
|
|
164
|
+
description: "Find strategies similar to a given signature (goals, tools, results, context).",
|
|
165
|
+
inputSchema: zodToJsonSchema(StrategySimilarSchema),
|
|
166
|
+
},
|
|
167
|
+
{
|
|
168
|
+
name: "strategy.suggest_next_action",
|
|
169
|
+
description: "Get action suggestions for a context hash based on learned strategies.",
|
|
170
|
+
inputSchema: zodToJsonSchema(StrategySuggestSchema),
|
|
171
|
+
},
|
|
172
|
+
{
|
|
173
|
+
name: "claims.search",
|
|
174
|
+
description: "Search claims extracted from events via semantic similarity.",
|
|
175
|
+
inputSchema: zodToJsonSchema(ClaimsSearchSchema),
|
|
176
|
+
},
|
|
177
|
+
{
|
|
178
|
+
name: "stats.get",
|
|
179
|
+
description: "Get system-wide statistics about EventGraphDB.",
|
|
180
|
+
inputSchema: zodToJsonSchema(StatsGetSchema),
|
|
181
|
+
},
|
|
182
|
+
{
|
|
183
|
+
name: "health.check",
|
|
184
|
+
description: "Health check -- verify that EventGraphDB is running.",
|
|
185
|
+
inputSchema: zodToJsonSchema(HealthCheckSchema),
|
|
186
|
+
},
|
|
187
|
+
{
|
|
188
|
+
name: "intent.instruction",
|
|
189
|
+
description: "Get the sidecar instruction prompt for a given agent type. Inject this into your system prompt so the LLM outputs structured intent JSON alongside its response.",
|
|
190
|
+
inputSchema: zodToJsonSchema(IntentInstructionSchema),
|
|
191
|
+
},
|
|
192
|
+
{
|
|
193
|
+
name: "intent.parse",
|
|
194
|
+
description: "Parse raw LLM output into a structured intent + assistant response using the sidecar extractor. Returns the parsed intent (with slots, goal_updates, claims_hint) and the clean assistant text.",
|
|
195
|
+
inputSchema: zodToJsonSchema(IntentParseSchema),
|
|
196
|
+
},
|
|
197
|
+
];
|
|
198
|
+
// ---------------------------------------------------------------------------
|
|
199
|
+
// Helpers
|
|
200
|
+
// ---------------------------------------------------------------------------
|
|
201
|
+
function resolveSpec(agentType, goals) {
|
|
202
|
+
return registry.resolve(agentType, goals) ?? DEFAULT_MEMORY_SPEC;
|
|
203
|
+
}
|
|
204
|
+
// ---------------------------------------------------------------------------
|
|
205
|
+
// Tool dispatch
|
|
206
|
+
// ---------------------------------------------------------------------------
|
|
207
|
+
export async function dispatch(client, toolName, rawArgs) {
|
|
208
|
+
switch (toolName) {
|
|
209
|
+
// ---- Memory tools ---------------------------------------------------
|
|
210
|
+
case "memory.search": {
|
|
211
|
+
const args = MemorySearchSchema.parse(rawArgs);
|
|
212
|
+
// Use the fluent builder to construct a minimal search context,
|
|
213
|
+
// then extract the built EventContext for the query API.
|
|
214
|
+
const builder = client
|
|
215
|
+
.event("memory", {
|
|
216
|
+
agentId: args.agent_id ?? 0,
|
|
217
|
+
sessionId: args.session_id ?? 0,
|
|
218
|
+
})
|
|
219
|
+
.context(args.query, "search")
|
|
220
|
+
.state({ query: args.query });
|
|
221
|
+
const searchContext = builder.build().context;
|
|
222
|
+
return client.getContextMemories(searchContext, {
|
|
223
|
+
limit: args.limit,
|
|
224
|
+
min_similarity: args.min_similarity,
|
|
225
|
+
agent_id: args.agent_id,
|
|
226
|
+
session_id: args.session_id,
|
|
227
|
+
});
|
|
228
|
+
}
|
|
229
|
+
case "memory.capture": {
|
|
230
|
+
const args = MemoryCaptureSchema.parse(rawArgs);
|
|
231
|
+
const builder = client
|
|
232
|
+
.event(args.agent_type, {
|
|
233
|
+
agentId: args.agent_id,
|
|
234
|
+
sessionId: args.session_id,
|
|
235
|
+
enableSemantic: true,
|
|
236
|
+
})
|
|
237
|
+
.context(args.text, args.context_type);
|
|
238
|
+
if (args.user_id) {
|
|
239
|
+
builder.state({ user_id: args.user_id });
|
|
240
|
+
}
|
|
241
|
+
if (args.goals) {
|
|
242
|
+
for (const g of args.goals) {
|
|
243
|
+
builder.goal(g.text, g.priority, g.progress);
|
|
244
|
+
}
|
|
245
|
+
}
|
|
246
|
+
return builder.send();
|
|
247
|
+
}
|
|
248
|
+
case "memory.memories": {
|
|
249
|
+
const args = MemoryMemoriesSchema.parse(rawArgs);
|
|
250
|
+
return client.getAgentMemories(args.agent_id, args.limit);
|
|
251
|
+
}
|
|
252
|
+
case "memory.strategies": {
|
|
253
|
+
const args = MemoryStrategiesSchema.parse(rawArgs);
|
|
254
|
+
return client.getAgentStrategies(args.agent_id, args.limit);
|
|
255
|
+
}
|
|
256
|
+
// ---- Strategy tools -------------------------------------------------
|
|
257
|
+
case "strategy.similar": {
|
|
258
|
+
const args = StrategySimilarSchema.parse(rawArgs);
|
|
259
|
+
return client.getSimilarStrategies({
|
|
260
|
+
agent_id: args.agent_id,
|
|
261
|
+
goal_ids: args.goal_ids,
|
|
262
|
+
tool_names: args.tool_names,
|
|
263
|
+
result_types: args.result_types,
|
|
264
|
+
context_hash: args.context_hash,
|
|
265
|
+
min_score: args.min_score,
|
|
266
|
+
limit: args.limit,
|
|
267
|
+
});
|
|
268
|
+
}
|
|
269
|
+
case "strategy.suggest_next_action": {
|
|
270
|
+
const args = StrategySuggestSchema.parse(rawArgs);
|
|
271
|
+
return client.getActionSuggestions(args.context_hash, args.last_action_node, args.limit);
|
|
272
|
+
}
|
|
273
|
+
// ---- Claims ---------------------------------------------------------
|
|
274
|
+
case "claims.search": {
|
|
275
|
+
const args = ClaimsSearchSchema.parse(rawArgs);
|
|
276
|
+
return client.searchClaims({
|
|
277
|
+
query_text: args.query_text,
|
|
278
|
+
top_k: args.top_k,
|
|
279
|
+
min_similarity: args.min_similarity,
|
|
280
|
+
});
|
|
281
|
+
}
|
|
282
|
+
// ---- System ---------------------------------------------------------
|
|
283
|
+
case "stats.get": {
|
|
284
|
+
StatsGetSchema.parse(rawArgs);
|
|
285
|
+
return client.getStats();
|
|
286
|
+
}
|
|
287
|
+
case "health.check": {
|
|
288
|
+
HealthCheckSchema.parse(rawArgs);
|
|
289
|
+
return client.healthCheck();
|
|
290
|
+
}
|
|
291
|
+
// ---- Intent sidecar tools -------------------------------------------
|
|
292
|
+
case "intent.instruction": {
|
|
293
|
+
const args = IntentInstructionSchema.parse(rawArgs);
|
|
294
|
+
const spec = resolveSpec(args.agent_type, args.goals);
|
|
295
|
+
return {
|
|
296
|
+
instruction: buildSidecarInstruction(spec),
|
|
297
|
+
domain: spec.domain,
|
|
298
|
+
intents: spec.intents.map((i) => i.name),
|
|
299
|
+
};
|
|
300
|
+
}
|
|
301
|
+
case "intent.parse": {
|
|
302
|
+
const args = IntentParseSchema.parse(rawArgs);
|
|
303
|
+
const spec = resolveSpec(args.agent_type, args.goals);
|
|
304
|
+
const { intent, assistantResponse } = extractIntentAndResponse(args.model_text, args.user_message, spec);
|
|
305
|
+
return {
|
|
306
|
+
intent,
|
|
307
|
+
assistant_response: assistantResponse,
|
|
308
|
+
};
|
|
309
|
+
}
|
|
310
|
+
default:
|
|
311
|
+
throw new Error(`Unknown tool: ${toolName}`);
|
|
312
|
+
}
|
|
313
|
+
}
|
|
314
|
+
// ---------------------------------------------------------------------------
|
|
315
|
+
// Public: allow external code to register custom intent specs
|
|
316
|
+
// ---------------------------------------------------------------------------
|
|
317
|
+
export { registry, DEFAULT_MEMORY_SPEC };
|
|
318
|
+
//# sourceMappingURL=tools.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"tools.js","sourceRoot":"","sources":["../src/tools.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,OAAO,EACL,kBAAkB,EAClB,uBAAuB,EAEvB,wBAAwB,GAGzB,MAAM,WAAW,CAAC;AAEnB,8EAA8E;AAC9E,qEAAqE;AACrE,8EAA8E;AAE9E,MAAM,QAAQ,GAAG,IAAI,kBAAkB,EAAE,CAAC;AAE1C,MAAM,mBAAmB,GAAe;IACtC,MAAM,EAAE,QAAQ;IAChB,eAAe,EAAE,OAAO;IACxB,OAAO,EAAE;QACP,EAAE,IAAI,EAAE,QAAQ,EAAE,KAAK,EAAE,EAAE,KAAK,EAAE,EAAE,QAAQ,EAAE,IAAI,EAAE,EAAE,EAAE;QACxD;YACE,IAAI,EAAE,SAAS;YACf,KAAK,EAAE;gBACL,IAAI,EAAE,EAAE,QAAQ,EAAE,IAAI,EAAE;gBACxB,YAAY,EAAE,EAAE,QAAQ,EAAE,IAAI,EAAE,IAAI,EAAE,CAAC,YAAY,EAAE,MAAM,EAAE,UAAU,EAAE,YAAY,EAAE,SAAS,CAAC,EAAE;aACpG;SACF;QACD,EAAE,IAAI,EAAE,OAAO,EAAE,KAAK,EAAE,EAAE,KAAK,EAAE,EAAE,QAAQ,EAAE,IAAI,EAAE,EAAE,EAAE;KACxD;IACD,UAAU,EAAE;QACV,iBAAiB,EAAE,IAAI;QACvB,mBAAmB,EAAE,CAAC,YAAY,EAAE,MAAM,EAAE,UAAU,EAAE,YAAY,CAAC;QACrE,eAAe,EAAE,CAAC;KACnB;IACD,cAAc,EAAE,CAAC,MAAM,EAAE,EAAE,CACzB,MAAM,CAAC,MAAM,KAAK,SAA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YACtD,MAAM,EAAE,MAAM,EAAE,iBAAiB,EAAE,GAAG,wBAAwB,CAC5D,IAAI,CAAC,UAAU,EACf,IAAI,CAAC,YAAY,EACjB,IAAI,CACL,CAAC;YACF,OAAO;gBACL,MAAM;gBACN,kBAAkB,EAAE,iBAAiB;aACtC,CAAC;QACJ,CAAC;QAED;YACE,MAAM,IAAI,KAAK,CAAC,iBAAiB,QAAQ,EAAE,CAAC,CAAC;IACjD,CAAC;AACH,CAAC;AAED,8EAA8E;AAC9E,8DAA8D;AAC9D,8EAA8E;AAE9E,OAAO,EAAE,QAAQ,EAAE,mBAAmB,EAAE,CAAC"}
|
package/package.json
ADDED
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@minns/openclaw-minns",
|
|
3
|
+
"version": "0.2.0",
|
|
4
|
+
"description": "MCP stdio server integrating Minns EventGraphDB into OpenClaw",
|
|
5
|
+
"type": "module",
|
|
6
|
+
"main": "./dist/mcp.js",
|
|
7
|
+
"types": "./dist/mcp.d.ts",
|
|
8
|
+
"bin": {
|
|
9
|
+
"openclaw-minns-mcp": "./dist/mcp.js"
|
|
10
|
+
},
|
|
11
|
+
"files": [
|
|
12
|
+
"dist",
|
|
13
|
+
"skills",
|
|
14
|
+
"README.md"
|
|
15
|
+
],
|
|
16
|
+
"scripts": {
|
|
17
|
+
"build": "tsc",
|
|
18
|
+
"prepublishOnly": "npm run build"
|
|
19
|
+
},
|
|
20
|
+
"dependencies": {
|
|
21
|
+
"@modelcontextprotocol/sdk": "^1.12.1",
|
|
22
|
+
"minns-sdk": "^0.4.2",
|
|
23
|
+
"zod": "^3.23.0"
|
|
24
|
+
},
|
|
25
|
+
"devDependencies": {
|
|
26
|
+
"@types/node": "^20.0.0",
|
|
27
|
+
"typescript": "^5.0.0"
|
|
28
|
+
},
|
|
29
|
+
"engines": {
|
|
30
|
+
"node": ">=18"
|
|
31
|
+
},
|
|
32
|
+
"license": "MIT"
|
|
33
|
+
}
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
# Minns Memory Skill
|
|
2
|
+
|
|
3
|
+
Fallback policy skill for agents that do not yet have native MCP tool support.
|
|
4
|
+
When active, the agent should follow these rules automatically.
|
|
5
|
+
|
|
6
|
+
## Before answering
|
|
7
|
+
|
|
8
|
+
1. Call `memory.search` with a short query derived from the user's message.
|
|
9
|
+
2. If relevant memories are returned, incorporate them into your response.
|
|
10
|
+
3. If no memories match, proceed without referencing memory.
|
|
11
|
+
|
|
12
|
+
## After answering
|
|
13
|
+
|
|
14
|
+
1. Decide whether the interaction produced a **durable fact or preference** worth keeping.
|
|
15
|
+
- Examples: user timezone, preferred language, project conventions, confirmed decisions.
|
|
16
|
+
2. If yes, call `memory.capture` with a concise summary of the fact.
|
|
17
|
+
3. If the interaction was ephemeral (greetings, small talk, transient debug output), do **not** capture it.
|
|
18
|
+
|
|
19
|
+
## Safety rules
|
|
20
|
+
|
|
21
|
+
- **Never** store secrets, passwords, API keys, tokens, or credentials.
|
|
22
|
+
- **Never** store personally identifiable information (PII) unless the user explicitly asks you to remember it.
|
|
23
|
+
- Only store facts that are likely to remain true across sessions.
|
|
24
|
+
- Prefer short, precise text over long paragraphs when capturing memories.
|
|
25
|
+
|
|
26
|
+
## Tool reference
|
|
27
|
+
|
|
28
|
+
| Tool | When to use |
|
|
29
|
+
| ---------------------------- | ------------------------------------------------ |
|
|
30
|
+
| `memory.search` | Before answering -- recall relevant context |
|
|
31
|
+
| `memory.capture` | After answering -- persist durable facts |
|
|
32
|
+
| `memory.memories` | When the user asks "what do you know about me?" |
|
|
33
|
+
| `memory.strategies` | When reviewing learned strategies for an agent |
|
|
34
|
+
| `strategy.similar` | When looking for reusable approaches |
|
|
35
|
+
| `strategy.suggest_next_action` | When deciding what to do next in a workflow |
|
|
36
|
+
| `claims.search` | When verifying factual claims from past events |
|
|
37
|
+
| `health.check` | When diagnosing connectivity to EventGraphDB |
|