omo-memory 0.1.0 → 0.1.1
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 +32 -0
- package/dist/cli.js +17 -6
- package/dist/mcp.js +11 -2
- package/dist/memory.js +4 -0
- package/docs/adapter-integration.md +38 -0
- package/package.json +2 -1
package/README.md
CHANGED
|
@@ -32,6 +32,7 @@ After the package is published to npm, use the same package for CLI and MCP:
|
|
|
32
32
|
|
|
33
33
|
```sh
|
|
34
34
|
npx -y omo-memory init
|
|
35
|
+
npx -y omo-memory session bootstrap --host codex --adapter lazycodex --limit 5
|
|
35
36
|
npx -y omo-memory recent --limit 5
|
|
36
37
|
npx -y omo-memory mcp
|
|
37
38
|
```
|
|
@@ -63,6 +64,36 @@ grok mcp add omo-memory -- npx -y omo-memory mcp
|
|
|
63
64
|
|
|
64
65
|
Both hosts use `~/.omo/memory/state.sqlite` by default. The `host` value is recorded when an adapter calls `memory_start_session`, not by installing separate servers.
|
|
65
66
|
|
|
67
|
+
## Session bootstrap
|
|
68
|
+
|
|
69
|
+
Adapters should call the bootstrap tool at the beginning of each host session:
|
|
70
|
+
|
|
71
|
+
```json
|
|
72
|
+
{
|
|
73
|
+
"tool": "memory_bootstrap_session",
|
|
74
|
+
"arguments": {
|
|
75
|
+
"host": "codex",
|
|
76
|
+
"adapter": "lazycodex",
|
|
77
|
+
"limit": 5
|
|
78
|
+
}
|
|
79
|
+
}
|
|
80
|
+
```
|
|
81
|
+
|
|
82
|
+
The response contains a new `sessionId` plus `recentEvents` for the current project. Reuse that `sessionId` when recording follow-up events:
|
|
83
|
+
|
|
84
|
+
```json
|
|
85
|
+
{
|
|
86
|
+
"tool": "memory_record_event",
|
|
87
|
+
"arguments": {
|
|
88
|
+
"type": "decision",
|
|
89
|
+
"summary": "Chose the npm MCP package as the shared local memory surface.",
|
|
90
|
+
"sessionId": "<sessionId>"
|
|
91
|
+
}
|
|
92
|
+
}
|
|
93
|
+
```
|
|
94
|
+
|
|
95
|
+
This is local routing, not transcript scraping. OMO Memory does not automatically read full Codex or Grok transcripts; the host or adapter must call these MCP tools.
|
|
96
|
+
|
|
66
97
|
## MCP tools
|
|
67
98
|
|
|
68
99
|
Initial stdio MCP tools:
|
|
@@ -70,6 +101,7 @@ Initial stdio MCP tools:
|
|
|
70
101
|
- `memory_init`
|
|
71
102
|
- `memory_project_context`
|
|
72
103
|
- `memory_start_session`
|
|
104
|
+
- `memory_bootstrap_session`
|
|
73
105
|
- `memory_record_event`
|
|
74
106
|
- `memory_recent_events`
|
|
75
107
|
- `memory_write_handoff`
|
package/dist/cli.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
import { readFileSync } from "node:fs";
|
|
3
|
-
import { doctorReport, exportMemory, initMemory, purgeMemory, recentEvents, recordEvent, startSession, writeHandoff } from "./memory.js";
|
|
3
|
+
import { bootstrapSession, doctorReport, exportMemory, initMemory, purgeMemory, recentEvents, recordEvent, startSession, writeHandoff } from "./memory.js";
|
|
4
4
|
import { runMcpServer } from "./mcp.js";
|
|
5
5
|
async function main(argv) {
|
|
6
6
|
const [command, subcommand, ...rest] = argv;
|
|
@@ -34,6 +34,11 @@ function runCommand(command, subcommand, rest) {
|
|
|
34
34
|
const adapter = readFlag(rest, "--adapter") ?? "unknown";
|
|
35
35
|
return { ok: true, ...startSession({ host, adapter }) };
|
|
36
36
|
}
|
|
37
|
+
if (command === "session" && subcommand === "bootstrap") {
|
|
38
|
+
const host = parseHost(readFlag(rest, "--host") ?? "unknown");
|
|
39
|
+
const adapter = readFlag(rest, "--adapter") ?? "unknown";
|
|
40
|
+
return { ok: true, ...bootstrapSession({ host, adapter, limit: readPositiveIntFlag(rest, "--limit", 5) }) };
|
|
41
|
+
}
|
|
37
42
|
if (command === "event" && subcommand === "record") {
|
|
38
43
|
const type = readFlag(rest, "--type") ?? fail("event record requires --type");
|
|
39
44
|
const summary = readFlag(rest, "--summary") ?? fail("event record requires --summary");
|
|
@@ -43,10 +48,7 @@ function runCommand(command, subcommand, rest) {
|
|
|
43
48
|
}
|
|
44
49
|
if (command === "recent") {
|
|
45
50
|
const limitRaw = readFlag([subcommand, ...rest].filter((value) => value !== undefined), "--limit");
|
|
46
|
-
|
|
47
|
-
if (!Number.isInteger(limit) || limit <= 0)
|
|
48
|
-
fail("recent --limit must be a positive integer");
|
|
49
|
-
return { ok: true, events: recentEvents(limit) };
|
|
51
|
+
return { ok: true, events: recentEvents(parsePositiveInt(limitRaw, "recent --limit")) };
|
|
50
52
|
}
|
|
51
53
|
if (command === "handoff" && subcommand === "write") {
|
|
52
54
|
const summary = readFlag(rest, "--summary");
|
|
@@ -71,11 +73,20 @@ function parseHost(value) {
|
|
|
71
73
|
return value;
|
|
72
74
|
fail("--host must be one of codex, opencode, grok, unknown");
|
|
73
75
|
}
|
|
76
|
+
function readPositiveIntFlag(args, name, defaultValue) {
|
|
77
|
+
return parsePositiveInt(readFlag(args, name) ?? String(defaultValue), name);
|
|
78
|
+
}
|
|
79
|
+
function parsePositiveInt(value, label) {
|
|
80
|
+
const limit = value === undefined ? 10 : Number(value);
|
|
81
|
+
if (!Number.isInteger(limit) || limit <= 0)
|
|
82
|
+
fail(`${label} must be a positive integer`);
|
|
83
|
+
return limit;
|
|
84
|
+
}
|
|
74
85
|
function fail(message) {
|
|
75
86
|
throw new Error(message);
|
|
76
87
|
}
|
|
77
88
|
function printHelp() {
|
|
78
|
-
process.stdout.write(`OMO Memory\n\nCommands:\n omo-memory init\n omo-memory doctor\n omo-memory export\n omo-memory purge --yes\n omo-memory session start --host <codex|opencode|grok|unknown> --adapter <name>\n omo-memory event record --type <type> --summary <text> [--session-id <id>]\n omo-memory recent [--limit <n>]\n omo-memory handoff write (--summary <text> | --summary-file <path>) [--session-id <id>]\n omo-memory mcp\n`);
|
|
89
|
+
process.stdout.write(`OMO Memory\n\nCommands:\n omo-memory init\n omo-memory doctor\n omo-memory export\n omo-memory purge --yes\n omo-memory session start --host <codex|opencode|grok|unknown> --adapter <name>\n omo-memory session bootstrap --host <codex|opencode|grok|unknown> --adapter <name> [--limit <n>]\n omo-memory event record --type <type> --summary <text> [--session-id <id>]\n omo-memory recent [--limit <n>]\n omo-memory handoff write (--summary <text> | --summary-file <path>) [--session-id <id>]\n omo-memory mcp\n`);
|
|
79
90
|
}
|
|
80
91
|
main(process.argv.slice(2)).catch((error) => {
|
|
81
92
|
const message = error instanceof Error ? error.message : String(error);
|
package/dist/mcp.js
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { McpServer } from "@modelcontextprotocol/sdk/server/mcp.js";
|
|
2
2
|
import { StdioServerTransport } from "@modelcontextprotocol/sdk/server/stdio.js";
|
|
3
3
|
import { z } from "zod";
|
|
4
|
-
import { exportMemory, initMemory, memoryPaths, purgeMemory, PurgeConfirmationError, recentEvents, recordEvent, resolveProjectContext, startSession, writeHandoff } from "./memory.js";
|
|
4
|
+
import { bootstrapSession, exportMemory, initMemory, memoryPaths, purgeMemory, PurgeConfirmationError, recentEvents, recordEvent, resolveProjectContext, startSession, writeHandoff } from "./memory.js";
|
|
5
5
|
export async function runMcpServer() {
|
|
6
|
-
const server = new McpServer({ name: "omo-memory", version: "0.1.
|
|
6
|
+
const server = new McpServer({ name: "omo-memory", version: "0.1.1" });
|
|
7
7
|
server.registerTool("memory_init", {
|
|
8
8
|
title: "Initialize OMO Memory",
|
|
9
9
|
description: "Create or migrate the local OMO memory SQLite database.",
|
|
@@ -44,6 +44,15 @@ export async function runMcpServer() {
|
|
|
44
44
|
adapter: z.string().min(1),
|
|
45
45
|
},
|
|
46
46
|
}, async ({ host, adapter }) => jsonResult(startSession({ host, adapter })));
|
|
47
|
+
server.registerTool("memory_bootstrap_session", {
|
|
48
|
+
title: "Bootstrap OMO Session",
|
|
49
|
+
description: "Start a host adapter session and return recent project memory in one call. Call this at the beginning of each Codex, OpenCode, or Grok session.",
|
|
50
|
+
inputSchema: {
|
|
51
|
+
host: z.enum(["codex", "opencode", "grok", "unknown"]),
|
|
52
|
+
adapter: z.string().min(1),
|
|
53
|
+
limit: z.number().int().positive().max(100).default(5),
|
|
54
|
+
},
|
|
55
|
+
}, async ({ host, adapter, limit }) => jsonResult(bootstrapSession({ host, adapter, limit })));
|
|
47
56
|
server.registerTool("memory_record_event", {
|
|
48
57
|
title: "Record OMO Memory Event",
|
|
49
58
|
description: "Append a summarized event to the current project's OMO memory ledger.",
|
package/dist/memory.js
CHANGED
|
@@ -145,6 +145,10 @@ export function startSession(input, dbPath = defaultDbPath()) {
|
|
|
145
145
|
db.close();
|
|
146
146
|
}
|
|
147
147
|
}
|
|
148
|
+
export function bootstrapSession(input, dbPath = defaultDbPath()) {
|
|
149
|
+
const session = startSession({ host: input.host, adapter: input.adapter }, dbPath);
|
|
150
|
+
return { ...session, recentEvents: recentEvents(input.limit, dbPath) };
|
|
151
|
+
}
|
|
148
152
|
export function recordEvent(input, dbPath = defaultDbPath()) {
|
|
149
153
|
const db = openMemoryDb(dbPath);
|
|
150
154
|
try {
|
|
@@ -27,6 +27,7 @@ After npm publish, adapters and users can invoke the packaged CLI directly:
|
|
|
27
27
|
|
|
28
28
|
```sh
|
|
29
29
|
npx -y omo-memory init
|
|
30
|
+
npx -y omo-memory session bootstrap --host codex --adapter lazycodex --limit 5
|
|
30
31
|
npx -y omo-memory session start --host codex --adapter lazycodex
|
|
31
32
|
npx -y omo-memory session start --host grok --adapter lfg
|
|
32
33
|
npx -y omo-memory recent --limit 10
|
|
@@ -81,10 +82,47 @@ grok mcp add omo-memory -- npx -y omo-memory mcp
|
|
|
81
82
|
|
|
82
83
|
Register the same MCP server in every host that needs memory access. Do not create separate Codex/Grok schemas or databases; host identity belongs in `memory_start_session` metadata.
|
|
83
84
|
|
|
85
|
+
## Session Bootstrap Flow
|
|
86
|
+
|
|
87
|
+
At the beginning of a Codex, OpenCode, or Grok adapter session, call `memory_bootstrap_session` instead of separately calling `memory_start_session` and `memory_recent_events`.
|
|
88
|
+
|
|
89
|
+
```json
|
|
90
|
+
{
|
|
91
|
+
"tool": "memory_bootstrap_session",
|
|
92
|
+
"arguments": {
|
|
93
|
+
"host": "grok",
|
|
94
|
+
"adapter": "lfg",
|
|
95
|
+
"limit": 5
|
|
96
|
+
}
|
|
97
|
+
}
|
|
98
|
+
```
|
|
99
|
+
|
|
100
|
+
The tool returns:
|
|
101
|
+
|
|
102
|
+
- `sessionId`: the new session row for subsequent event/handoff writes.
|
|
103
|
+
- `project`: the current git/project namespace.
|
|
104
|
+
- `recentEvents`: recent events from the same project namespace.
|
|
105
|
+
|
|
106
|
+
During the session, write concise task state and evidence with the returned `sessionId`:
|
|
107
|
+
|
|
108
|
+
```json
|
|
109
|
+
{
|
|
110
|
+
"tool": "memory_record_event",
|
|
111
|
+
"arguments": {
|
|
112
|
+
"type": "qa_evidence",
|
|
113
|
+
"summary": "npm-published MCP exposed memory_bootstrap_session and memory_recent_events.",
|
|
114
|
+
"sessionId": "<sessionId>"
|
|
115
|
+
}
|
|
116
|
+
}
|
|
117
|
+
```
|
|
118
|
+
|
|
119
|
+
This package is the local MCP-to-SQLite router. It does not scrape host transcripts or centralize cloud state. Hosts and adapters must call the MCP tools at their own lifecycle points.
|
|
120
|
+
|
|
84
121
|
Use these tools:
|
|
85
122
|
|
|
86
123
|
- `memory_init`
|
|
87
124
|
- `memory_project_context`
|
|
125
|
+
- `memory_bootstrap_session`
|
|
88
126
|
- `memory_start_session`
|
|
89
127
|
- `memory_record_event`
|
|
90
128
|
- `memory_recent_events`
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "omo-memory",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.1",
|
|
4
4
|
"description": "Host-neutral local SQLite memory and session ledger for OMO adapters, exposed through CLI and MCP.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"files": [
|
|
@@ -27,6 +27,7 @@
|
|
|
27
27
|
"typecheck": "tsc --noEmit",
|
|
28
28
|
"start": "node dist/cli.js",
|
|
29
29
|
"prepack": "npm run build",
|
|
30
|
+
"presmoke": "npm run build",
|
|
30
31
|
"smoke": "npm run smoke:cli && npm run smoke:mcp",
|
|
31
32
|
"smoke:cli": "node scripts/smoke-cli.mjs",
|
|
32
33
|
"smoke:mcp": "node scripts/smoke-mcp.mjs",
|