omo-memory 0.1.10 → 0.1.12

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.
@@ -28,11 +28,11 @@ After npm publish, adapters and users can invoke the packaged CLI directly:
28
28
 
29
29
  ```sh
30
30
  npx -y omo-memory init
31
- npx -y omo-memory hooks install --host all
32
31
  npx -y omo-memory session bootstrap --host codex --adapter lazycodex --limit 5
33
32
  npx -y omo-memory session start --host codex --adapter lazycodex
34
33
  npx -y omo-memory session start --host grok --adapter lfg
35
34
  npx -y omo-memory recent --limit 10
35
+ npx -y omo-memory recall --query "current roadmap decision" --limit 10
36
36
  ```
37
37
 
38
38
  For a source checkout:
@@ -46,6 +46,7 @@ node dist/cli.js event record --type decision --summary "Use OMO Memory as the s
46
46
  node dist/cli.js event record --type qa_evidence --summary "CLI smoke passed for init/session/event/recent."
47
47
  node dist/cli.js handoff write --summary "Continue from recent decision and qa_evidence events."
48
48
  node dist/cli.js recent --limit 10
49
+ node dist/cli.js recall --query "qa evidence" --limit 10
49
50
  node dist/cli.js export
50
51
  node dist/cli.js purge --yes
51
52
  ```
@@ -84,25 +85,9 @@ grok mcp add omo-memory -- npx -y omo-memory mcp
84
85
 
85
86
  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.
86
87
 
87
- ## Plugin-Style Host Install
88
-
89
- Install host-side passive behavior with:
90
-
91
- ```sh
92
- npx -y omo-memory hooks install --host all
93
- ```
94
-
95
- Supported `--host` values:
96
-
97
- - `codex`: installs `~/.codex/skills/omo-memory/SKILL.md`, an idempotent OMO Memory block in `~/.codex/AGENTS.md`, and a local Codex plugin with a `SessionStart` hook.
98
- - `grok`: installs `~/.grok/plugins/omo-memory` with `plugin.json`, a bundled skill, `hooks/hooks.json`, `.mcp.json`, and a SessionStart script. It also writes compatibility copies to `~/.grok/skills` and `~/.grok/hooks`.
99
- - `all`: installs both.
100
-
101
- The installer is idempotent and replaces only the marked `omo-memory` block in AGENTS files. For Codex it also registers the local plugin with `codex plugin add omo-memory@islee23520 --json` when installing into the real home directory. For Grok, `~/.grok/plugins/omo-memory` is a user plugin and is trusted automatically by Grok.
102
-
103
88
  ## Session Bootstrap Flow
104
89
 
105
- 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`.
90
+ At the beginning of a Codex, OpenCode, or Grok adapter session, call `memory_bootstrap_session` only when the adapter needs a session id for subsequent writes. Do not use bootstrap as a prompt-time memory injection hook.
106
91
 
107
92
  ```json
108
93
  {
@@ -119,9 +104,8 @@ The tool returns:
119
104
 
120
105
  - `sessionId`: the new session row for subsequent event/handoff writes.
121
106
  - `project`: the current git/project namespace.
122
- - `recentEvents`: recent events from the same project namespace.
123
107
 
124
- During the session, write concise task state and evidence with the returned `sessionId`:
108
+ During the session, hooks should write concise user-action summaries, task state, decisions, and evidence with the returned `sessionId`:
125
109
 
126
110
  ```json
127
111
  {
@@ -136,6 +120,13 @@ During the session, write concise task state and evidence with the returned `ses
136
120
 
137
121
  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.
138
122
 
123
+ Retrieval is opt-in or intent-gated:
124
+
125
+ - Use `memory_recent_events` only when the user explicitly asks for recent OMO Memory context.
126
+ - Use `memory_recall_events` when the current user input has a concrete query that can be matched to recorded summaries, decisions, or evidence.
127
+ - Do not automatically attach the last session to every user prompt.
128
+ - Do not store raw user prompts by default; record concise, redacted action summaries.
129
+
139
130
  Use these tools:
140
131
 
141
132
  - `memory_init`
@@ -144,9 +135,56 @@ Use these tools:
144
135
  - `memory_start_session`
145
136
  - `memory_record_event`
146
137
  - `memory_recent_events`
138
+ - `memory_recall_events`
147
139
  - `memory_write_handoff`
148
140
  - `memory_export`
149
141
  - `memory_purge`
142
+ - `memory_global_scan`
143
+ - `memory_global_migrate`
144
+ - `memory_global_list`
145
+ - `memory_ontology_candidates`
146
+ - `memory_ontology_extract`
147
+ - `memory_ontology_score`
148
+ - `memory_ontology_promote`
149
+ - `memory_ontology_demote`
150
+ - `memory_ontology_supersede`
151
+ - `memory_ontology_recall`
152
+
153
+ Global migration is copy/import only. Adapters may scan for existing project-local `.omo/memory/state.sqlite` databases and import them into a user-selected global SQLite file, but they must preserve source DBs and retain source provenance in the global store.
154
+
155
+ Global migration also materializes an aggregate OMO schema view inside the global SQLite file. This lets existing ontology extraction, retention scoring, recall, and OpenTUI graph code operate on integrated cross-project events while `global_*` tables retain source database provenance.
156
+
157
+ Example global second-brain flow:
158
+
159
+ ```sh
160
+ omo-memory global scan --root /Users/ilseoblee/workspace
161
+ omo-memory global migrate --root /Users/ilseoblee/workspace --global-db ~/.omo/memory/global.sqlite
162
+ OMO_MEMORY_DB=~/.omo/memory/global.sqlite omo-memory ontology candidates
163
+ OMO_MEMORY_DB=~/.omo/memory/global.sqlite omo-memory ontology score
164
+ bun --version
165
+ omo-memory graph tui --db ~/.omo/memory/global.sqlite --query linaforge
166
+ ```
167
+
168
+ `graph tui` requires `bun` on `PATH` for the OpenTUI terminal renderer. Other CLI and MCP commands run on Node.
169
+
170
+ Lifecycle commands:
171
+
172
+ - `memory_ontology_candidates`: derive candidate terms from concise summaries.
173
+ - `memory_ontology_extract`: explicitly extract candidates from one summary/event.
174
+ - `memory_ontology_score`: recompute deterministic scores and retention classes.
175
+ - `memory_ontology_promote`: curate a concept into durable memory.
176
+ - `memory_ontology_demote`: lower a durable memory's retention class.
177
+ - `memory_ontology_supersede`: preserve the old memory and create a replacement.
178
+ - `memory_ontology_recall`: retrieve ontology-backed memories only for an explicit query.
179
+
180
+ OpenTUI graph controls:
181
+
182
+ - `q`: quit.
183
+ - `Up` / `Down`: move selected concept.
184
+ - `Tab`: move to the next concept.
185
+ - `/` or `f`: focus filter input when supported by the terminal runtime.
186
+
187
+ The graph UI is local terminal UI. It does not require a browser, web server, cloud account, or vector service.
150
188
 
151
189
  Example session start:
152
190
 
@@ -179,3 +217,58 @@ Example QA evidence:
179
217
  - Store sanitized summaries and evidence references instead of full logs.
180
218
  - Host-specific values may appear only in small redacted metadata payloads and must not require schema branches.
181
219
  - Export and purge are explicit lifecycle commands; purge requires explicit confirmation.
220
+
221
+ ## Ontology Schema Boundary
222
+
223
+ OMO Memory's chronological ledger remains authoritative: sessions, events, and handoffs record what happened in a project. The ontology schema is an additive layer for durable memory derived from that ledger:
224
+
225
+ - `concepts` stores vocabulary entries such as project terms, practices, tools, and recurring ideas.
226
+ - `relations` stores typed links between concepts, decisions, events, sessions, and handoffs.
227
+ - `durable_memories` stores approved long-term facts, preferences, and working rules.
228
+ - `decision_records` stores important choices with rationale, evidence, status, reversibility, and provenance.
229
+
230
+ Adapters must treat ontology rows as curated local memory, not as raw capture. Do not write full transcripts, raw logs, `.env` contents, auth files, cookies, bearer headers, or secret-bearing payloads into ontology tables. User-authored text must pass through the same redaction boundary used by event and handoff writes before it is promoted into durable memory.
231
+
232
+ The ontology layer is intentionally not a new adapter surface by itself. CLI and MCP commands should continue to call shared core functions, and future concept/decision commands must not create host-specific schemas or side databases.
233
+
234
+ ## Retention Scoring Policy (Deterministic Contract)
235
+
236
+ Retention classification is strictly deterministic. There is no ML, embeddings, or hidden model. A pure function maps explicit signals to a numeric score and then to one of five classes.
237
+
238
+ Classes (in ascending durability):
239
+
240
+ - `forget`: score < 30 (or after decay/contradiction). Safe to drop.
241
+ - `temporary`: 30 <= score < 50. Short-term context only.
242
+ - `working`: 50 <= score < 75. Active task/iteration memory.
243
+ - `durable`: 75 <= score < 90. Cross-session value; survives typical decay.
244
+ - `permanent`: score >= 90, or any manually pinned item. Manual pin is a hard override.
245
+
246
+ Manual pin rule (critical): an item with `manualPin: true` is always classified `permanent` regardless of raw score, age, or frequency. Decay jobs and age-based expiration MUST NOT remove or downgrade pinned permanent memory; only explicit supersede/demote/purge may change it.
247
+
248
+ ### Score Formula (pure, exposed)
249
+
250
+ Exported constants (see `src/retentionPolicy.ts`):
251
+
252
+ - `RETENTION_CLASSES = ["forget", "temporary", "working", "durable", "permanent"] as const`
253
+ - `RETENTION_THRESHOLDS = { forget: 0, temporary: 30, working: 50, durable: 75, permanent: 90 } as const`
254
+ - `RETENTION_WEIGHTS = { frequency: 4.5, spread: 7, decision: 12, qa: 10, relation: 4, confidence: 10, recencyBase: 18, recencyPerDay: 0.55, agePerDay: 0.12, ageCap: 22, contradiction: 9 } as const`
255
+
256
+ ```
257
+ score = clamp(
258
+ frequency * 4.5
259
+ + spread * 7
260
+ + decisionWeight * 12
261
+ + qaWeight * 10
262
+ + relationDegree * 4
263
+ + confidence * 10
264
+ + max(0, 18 - recencyDays * 0.55)
265
+ - min(22, ageDays * 0.12)
266
+ - contradictionCount * 9
267
+ , 0, 110)
268
+ ```
269
+
270
+ `computeRetentionScore(input)` returns the rounded integer. `classifyRetention(score, manualPin)` returns the class, applying the pin override first.
271
+
272
+ Boundary cases (score, pin=false): 29→forget, 30→temporary, 49→temporary, 50→working, 74→working, 75→durable, 89→durable, 90→permanent. These are verified by the focused contract test.
273
+
274
+ All scoring inputs are derived from ledger signals (event counts, last-seen deltas, project spread from index, decision/qa event types, explicit relation degree, stored confidence, manual pin flag, contradiction markers). No raw transcripts or secrets are inputs.
@@ -1,13 +1,13 @@
1
- # Epic: OMO Memory — shared local session DB for OMO adapters
1
+ # Epic: OMO Memory — shared local second-brain DB for OMO adapters
2
2
 
3
3
  ## Goal
4
4
 
5
- Build a host-neutral local memory layer for OMO so lazycodex, omo-on-opencode, lfg, and future adapters can share task context across coding-tool sessions.
5
+ Build a host-neutral local memory layer for OMO so lazycodex, omo-on-opencode, lfg, and future adapters can share task context, durable decisions, and ontology-backed project knowledge across coding-tool sessions.
6
6
 
7
7
  The product ships as both:
8
8
 
9
- - CLI: install, inspect, search, export, purge, and handoff operations.
10
- - MCP server: standard stdio tools for agents and coding tools to read/write OMO memory.
9
+ - CLI: install, inspect, global migration, ontology lifecycle, graph, search, export, purge, and handoff operations.
10
+ - MCP server: standard stdio tools for agents and coding tools to explicitly read/write OMO memory.
11
11
 
12
12
  ## Problem
13
13
 
@@ -18,32 +18,64 @@ Codegraph solves code intelligence, not work/session memory. OMO needs a separat
18
18
  ## Product direction
19
19
 
20
20
  - Project-local DB: `<project-root>/.omo/memory/state.sqlite`
21
+ - Optional global DB: user-selected SQLite path such as `~/.omo/memory/global.sqlite`, populated by copy/import from local project ledgers
21
22
  - Project namespace: derive from git remote + repo root hash, with branch/head metadata
22
23
  - Local-first privacy: no cloud sync and no secret storage by default
23
24
  - Adapter-neutral schema: `host` and `adapter` are metadata, not separate products
24
25
  - Shared API: CLI and MCP use the same core DB layer
26
+ - Second-brain lifecycle: candidate extraction, deterministic retention scoring, promotion, demotion, supersession, explicit recall, and OpenTUI graph inspection
25
27
 
26
28
  ## In scope
27
29
 
28
30
  - SQLite schema and migrations
29
31
  - CLI commands:
30
32
  - `init`
33
+ - `global scan`
34
+ - `global migrate`
31
35
  - `session start`
36
+ - `session bootstrap`
32
37
  - `event record`
33
38
  - `recent`
39
+ - `recall`
34
40
  - `handoff write`
35
41
  - `doctor`
42
+ - `ontology candidates`
43
+ - `ontology score`
44
+ - `ontology promote`
45
+ - `ontology demote`
46
+ - `ontology supersede`
47
+ - `ontology recall`
48
+ - `graph tui`
36
49
  - MCP stdio server with tools:
37
50
  - `memory_init`
38
51
  - `memory_project_context`
52
+ - `memory_bootstrap_session`
53
+ - `memory_start_session`
39
54
  - `memory_record_event`
40
55
  - `memory_recent_events`
56
+ - `memory_recall_events`
41
57
  - `memory_write_handoff`
58
+ - `memory_global_scan`
59
+ - `memory_global_migrate`
60
+ - `memory_global_list`
61
+ - `memory_ontology_candidates`
62
+ - `memory_ontology_extract`
63
+ - `memory_ontology_score`
64
+ - `memory_ontology_promote`
65
+ - `memory_ontology_demote`
66
+ - `memory_ontology_supersede`
67
+ - `memory_ontology_recall`
42
68
  - Privacy guardrails:
43
69
  - local-only default
44
70
  - no API key/token/env capture
45
71
  - explicit purge/export commands
46
72
  - Adapter integration notes for lazycodex, omo-on-opencode, and lfg
73
+ - Retention classes:
74
+ - `forget`: safe to drop after low score or decay
75
+ - `temporary`: short-term task context
76
+ - `working`: active project memory
77
+ - `durable`: cross-session knowledge
78
+ - `permanent`: manual-pin or high-score knowledge; only explicit demote/supersede/purge changes it
47
79
 
48
80
  ## Out of scope
49
81
 
@@ -51,6 +83,8 @@ Codegraph solves code intelligence, not work/session memory. OMO needs a separat
51
83
  - Team sharing by default
52
84
  - Full transcript capture by default
53
85
  - Vector/embedding search in MVP
86
+ - Browser-only graph UI
87
+ - Automatic prompt injection from the last session
54
88
  - Replacing codegraph
55
89
  - Host-specific private APIs as required dependencies
56
90
 
@@ -59,33 +93,51 @@ Codegraph solves code intelligence, not work/session memory. OMO needs a separat
59
93
  ### CLI
60
94
 
61
95
  - `omo-memory init` creates or migrates `<project-root>/.omo/memory/state.sqlite`.
96
+ - `omo-memory global scan --root <path>` discovers project-local OMO DBs and reports schema versions.
97
+ - `omo-memory global migrate --root <path> --global-db <path>` copies source DB data into one global SQLite file without mutating source DBs.
62
98
  - `omo-memory session start --host grok --adapter lfg` records a session for the current project.
99
+ - `omo-memory session bootstrap --host codex --adapter lazycodex` returns a session id and project metadata without injecting recent events.
63
100
  - `omo-memory event record --type decision --summary "..."` appends a project/session event.
64
101
  - `omo-memory recent` lists recent project events.
102
+ - `omo-memory recall --query "..."` performs explicit query-gated event recall.
65
103
  - `omo-memory handoff write --summary-file path.md` stores a handoff summary.
104
+ - `omo-memory ontology candidates` extracts vocabulary candidates from concise summaries.
105
+ - `omo-memory ontology score` recomputes deterministic retention classes.
106
+ - `omo-memory ontology promote/demote/supersede/recall` supports curated durable memory lifecycle.
107
+ - `omo-memory graph tui --db <path> --query <term>` opens an OpenTUI graph with `q` quit, arrow/tab selection, retention class, score, provenance, and detail pane. It requires `bun` on `PATH`; other CLI and MCP commands run on Node.
66
108
 
67
109
  ### MCP
68
110
 
69
111
  - `omo-memory mcp` starts a stdio MCP server.
70
- - MCP tools can initialize the DB, read project context, record events, list recent events, and write handoffs.
112
+ - MCP tools can initialize the DB, read project context, record events, list/retrieve explicit memory, write handoffs, migrate global memory, and manage ontology lifecycle.
71
113
  - MCP tool responses are structured JSON text.
114
+ - `memory_bootstrap_session` remains write-only/session-only and does not return `recentEvents`.
72
115
 
73
116
  ### Privacy and safety
74
117
 
75
118
  - No secrets are read from `.env`, auth files, or host config by default.
76
119
  - DB path can be overridden only by explicit `OMO_MEMORY_DB`.
77
120
  - `doctor` reports DB path, schema version, and project identity without leaking sensitive values.
121
+ - Global migration is copy/import only; source project DB mtimes and row counts must remain unchanged.
122
+ - Graph and recall are local-first and explicit; no cloud sync, browser server, raw transcript capture, or embeddings are required.
78
123
 
79
124
  ### QA evidence
80
125
 
81
126
  - `npm run typecheck`
82
127
  - `npm run build`
128
+ - `npm run check`
83
129
  - CLI smoke:
84
130
  - `node dist/cli.js init`
131
+ - `node dist/cli.js global scan --root <tmp-workspace>`
132
+ - `node dist/cli.js global migrate --root <tmp-workspace> --global-db <tmp-global.sqlite>`
85
133
  - `node dist/cli.js session start --host grok --adapter lfg`
86
134
  - `node dist/cli.js event record --type decision --summary "smoke"`
135
+ - `node dist/cli.js ontology candidates`
136
+ - `node dist/cli.js ontology score`
137
+ - `bun dist/cli.js graph tui --db <tmp-db> --query smoke`
87
138
  - `node dist/cli.js recent`
88
139
  - MCP smoke: start `node dist/cli.js mcp` and verify `tools/list` includes memory tools.
140
+ - Backfill verifier: synthetic Linaforge/omo-memory/lfg/omo-phone DB replicas plus read-only scan of real local DB paths.
89
141
 
90
142
  ## Follow-up issue breakdown
91
143
 
@@ -94,5 +146,9 @@ Codegraph solves code intelligence, not work/session memory. OMO needs a separat
94
146
  3. MCP stdio server
95
147
  4. Project identity and git metadata
96
148
  5. Privacy/redaction/purge/export
97
- 6. Adapter integration docs for lazycodex, omo-on-opencode, and lfg
98
- 7. QA harness for CLI and MCP smoke tests
149
+ 6. Global SQLite migration and source provenance
150
+ 7. Deterministic ontology extraction and retention scoring
151
+ 8. Durable memory promote/demote/supersede lifecycle
152
+ 9. OpenTUI graph visualization
153
+ 10. Adapter integration docs for lazycodex, omo-on-opencode, and lfg
154
+ 11. QA harness for CLI, MCP, global backfill, and TUI smoke tests
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "omo-memory",
3
- "version": "0.1.10",
3
+ "version": "0.1.12",
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": [
@@ -24,6 +24,7 @@
24
24
  },
25
25
  "scripts": {
26
26
  "build": "tsc -p tsconfig.json",
27
+ "postbuild": "chmod 755 dist/cli.js",
27
28
  "typecheck": "tsc --noEmit",
28
29
  "lint": "biome check .",
29
30
  "format": "biome format --write .",
@@ -39,6 +40,7 @@
39
40
  },
40
41
  "dependencies": {
41
42
  "@modelcontextprotocol/sdk": "^1.29.0",
43
+ "@opentui/core": "0.4.2",
42
44
  "better-sqlite3": "^12.11.1",
43
45
  "zod": "^4.4.3"
44
46
  },
@@ -1,167 +0,0 @@
1
- export const CODEX_MARKETPLACE = "islee23520";
2
- export const CODEX_PLUGIN = "omo-memory";
3
- export const CODEX_SKILL = `---
4
- name: omo-memory
5
- description: "Use OMO Memory for concise local project memory: bootstrap recent events, record decisions, QA evidence, blockers, and handoffs without secrets."
6
- ---
7
-
8
- # OMO Memory
9
-
10
- For non-trivial workspace work, call \`memory_bootstrap_session\` before edits:
11
-
12
- - \`host\`: \`codex\`
13
- - \`adapter\`: \`lazycodex\`
14
- - \`limit\`: \`2\`
15
-
16
- Read \`recentEvents\`, keep the returned \`sessionId\`, and record only durable summaries with \`memory_record_event\`: decisions, QA evidence, task state, blockers, and handoffs.
17
-
18
- Use \`memory_write_handoff\` only for explicit handoff summaries. Never store transcripts, secrets, \`.env\`, auth files, cookies, bearer headers, or raw secret-bearing logs.
19
- `;
20
- export const GROK_SKILL = CODEX_SKILL.replace("Codex, Grok", "Grok, Codex")
21
- .replace("- `host`: `codex`", "- `host`: `grok`")
22
- .replace("- `adapter`: `lazycodex`", "- `adapter`: `lfg`");
23
- export const CODEX_AGENTS_BLOCK = `### OMO Memory lifecycle
24
-
25
- When the \`omo-memory\` MCP server is available, use it for concise local project memory. For non-trivial workspace work, call \`memory_bootstrap_session\` before edits:
26
-
27
- - \`host\`: \`codex\`
28
- - \`adapter\`: \`lazycodex\`
29
- - \`limit\`: \`2\`
30
-
31
- Read \`recentEvents\`, keep the returned \`sessionId\`, and record only durable summaries with \`memory_record_event\`: decisions, task state, QA evidence, blockers, and handoffs. Never store transcripts, secrets, \`.env\`, auth files, cookies, bearer headers, or raw secret-bearing logs.`;
32
- export const GROK_AGENTS_BLOCK = CODEX_AGENTS_BLOCK.replace("- `host`: `codex`", "- `host`: `grok`").replace("- `adapter`: `lazycodex`", "- `adapter`: `lfg`");
33
- export const SESSION_BOOTSTRAP_SCRIPT = `#!/usr/bin/env node
34
- import { spawnSync } from "node:child_process";
35
-
36
- const host = process.env["OMO_MEMORY_HOST"] ?? "codex";
37
- const adapter = process.env["OMO_MEMORY_ADAPTER"] ?? "lazycodex";
38
- const limit = process.env["OMO_MEMORY_LIMIT"] ?? "2";
39
- const args = ["session", "bootstrap", "--host", host, "--adapter", adapter, "--limit", limit];
40
-
41
- const direct = process.env["OMO_MEMORY_CLI"] ?? "omo-memory";
42
- const result = runBootstrap(direct, args) ?? runBootstrap("npx", ["-y", "omo-memory", ...args]);
43
-
44
- if (result === undefined || result.status !== 0) {
45
- process.stdout.write("OMO Memory: bootstrap unavailable; continue without blocking the session.\\n");
46
- process.exit(0);
47
- }
48
-
49
- try {
50
- const payload = JSON.parse(result.stdout);
51
- const recentEvents = Array.isArray(payload.recentEvents) ? payload.recentEvents : [];
52
- process.stdout.write(\`OMO Memory sessionId: \${payload.sessionId}\\n\`);
53
- if (recentEvents.length === 0) {
54
- process.exit(0);
55
- }
56
- process.stdout.write("OMO Memory recentEvents:\\n");
57
- for (const event of recentEvents.slice(0, Number(limit))) {
58
- process.stdout.write(\`- \${event.type}: \${event.summary}\\n\`);
59
- }
60
- } catch (error) {
61
- const detail = error instanceof Error ? error.message : String(error);
62
- process.stdout.write(\`OMO Memory: bootstrap returned unreadable output; \${detail}\\n\`);
63
- }
64
-
65
- function runBootstrap(command, commandArgs) {
66
- const result = spawnSync(command, commandArgs, {
67
- encoding: "utf8",
68
- stdio: ["ignore", "pipe", "pipe"],
69
- timeout: 2000
70
- });
71
- if (result.error && result.error.code === "ENOENT") return undefined;
72
- return result;
73
- }
74
- `;
75
- export const GROK_HOOK_SCRIPT = SESSION_BOOTSTRAP_SCRIPT.replace('?? "codex"', '?? "grok"').replace('?? "lazycodex"', '?? "lfg"');
76
- export const GROK_PLUGIN_JSON = `{
77
- "name": "omo-memory",
78
- "version": "0.1.10",
79
- "description": "Project-local OMO Memory bootstrap hook and MCP server for Grok.",
80
- "author": {
81
- "name": "islee23520"
82
- },
83
- "repository": "https://github.com/islee23520/omo-memory",
84
- "homepage": "https://github.com/islee23520/omo-memory",
85
- "license": "MIT",
86
- "keywords": ["grok", "hooks", "memory", "mcp"],
87
- "skills": "./skills/",
88
- "hooks": "./hooks/hooks.json",
89
- "mcpServers": "./.mcp.json"
90
- }
91
- `;
92
- export const GROK_MCP_JSON = `{
93
- "mcpServers": {
94
- "omo-memory": {
95
- "command": "npx",
96
- "args": ["-y", "omo-memory", "mcp"]
97
- }
98
- }
99
- }
100
- `;
101
- export const CODEX_PLUGIN_JSON = `{
102
- "name": "omo-memory",
103
- "version": "0.1.10",
104
- "description": "Session-start OMO Memory bootstrap hook for Codex.",
105
- "author": "islee23520",
106
- "homepage": "https://github.com/islee23520/omo-memory",
107
- "repository": "https://github.com/islee23520/omo-memory",
108
- "license": "MIT",
109
- "keywords": ["codex", "hooks", "memory", "mcp"],
110
- "skills": "./skills/",
111
- "hooks": "./hooks/hooks.json",
112
- "interface": {
113
- "displayName": "OMO Memory",
114
- "shortDescription": "Bootstraps local shared memory at Codex session start.",
115
- "longDescription": "OMO Memory records concise local session state and loads recent project memory through the omo-memory CLI and MCP server.",
116
- "developerName": "islee23520",
117
- "category": "Developer Tools",
118
- "capabilities": ["Hooks", "MCP Tools", "Workflow"],
119
- "websiteURL": "https://github.com/islee23520/omo-memory",
120
- "privacyPolicyURL": "https://github.com/islee23520/omo-memory#privacy",
121
- "termsOfServiceURL": "https://github.com/islee23520/omo-memory#license",
122
- "defaultPrompt": [
123
- "Use OMO Memory to load recent project memory before non-trivial workspace work.",
124
- "Record durable decisions, task state, QA evidence, blockers, and handoffs without storing secrets or full transcripts."
125
- ],
126
- "brandColor": "#0F766E",
127
- "screenshots": []
128
- },
129
- "capabilities": []
130
- }
131
- `;
132
- export const CODEX_HOOKS_JSON = `{
133
- "hooks": {
134
- "SessionStart": [
135
- {
136
- "hooks": [
137
- {
138
- "type": "command",
139
- "command": "node \\"\${PLUGIN_ROOT}/scripts/omo-memory-session.mjs\\"",
140
- "timeout": 2,
141
- "description": "omo-memory session bootstrap",
142
- "statusMessage": "OMO Memory: loading recent session memory"
143
- }
144
- ]
145
- }
146
- ]
147
- }
148
- }
149
- `;
150
- export const GROK_HOOKS_JSON = `{
151
- "hooks": {
152
- "SessionStart": [
153
- {
154
- "hooks": [
155
- {
156
- "type": "command",
157
- "command": "node \\"{{HOME}}/.grok/hooks/omo-memory-session.mjs\\"",
158
- "timeout": 2,
159
- "description": "omo-memory session bootstrap",
160
- "statusMessage": "OMO Memory: loading recent session memory"
161
- }
162
- ]
163
- }
164
- ]
165
- }
166
- }
167
- `;