omo-memory 0.1.3 → 0.1.5

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 CHANGED
@@ -9,7 +9,7 @@ It gives lazycodex, omo-on-opencode, lfg, and future OMO adapters a shared local
9
9
 
10
10
  ## Product shape
11
11
 
12
- - Global local DB: `~/.omo/memory/state.sqlite`
12
+ - Project-local DB: `<project-root>/.omo/memory/state.sqlite`
13
13
  - Project namespacing: by git remote + project root hash
14
14
  - Privacy default: local-only, no network sync, no secrets by design
15
15
  - Intended adapters: Codex/lazycodex, OpenCode/OMO, GrokBuild/lfg
@@ -49,7 +49,7 @@ omo-memory init
49
49
 
50
50
  ## MCP registration
51
51
 
52
- Register the same MCP server in every host that should read/write the shared local memory DB.
52
+ Register the same MCP server in every host that should read/write the current project's memory DB.
53
53
 
54
54
  Codex:
55
55
 
@@ -63,7 +63,7 @@ Grok:
63
63
  grok mcp add omo-memory -- npx -y omo-memory mcp
64
64
  ```
65
65
 
66
- 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.
66
+ Both hosts use the current project ledger at `<project-root>/.omo/memory/state.sqlite` by default. The `host` value is recorded when an adapter calls `memory_start_session`, not by installing separate servers.
67
67
 
68
68
  ## Passive setup
69
69
 
@@ -75,10 +75,10 @@ npx -y omo-memory hooks install --host all
75
75
 
76
76
  This installs:
77
77
 
78
- - Codex: `~/.codex/skills/omo-memory/SKILL.md` plus a global `~/.codex/AGENTS.md` lifecycle rule.
78
+ - Codex: `~/.codex/skills/omo-memory/SKILL.md`, a global `~/.codex/AGENTS.md` lifecycle rule, and a local Codex plugin with a `SessionStart` hook.
79
79
  - Grok: `~/.grok/skills/omo-memory/SKILL.md`, a global `~/.grok/AGENTS.md` lifecycle rule, and a `~/.grok/hooks/` SessionStart hook.
80
80
 
81
- Codex currently exposes MCP and global instruction surfaces, but not a standalone user hook add command like Grok. The Codex passive behavior is therefore rule/skill-driven; Grok additionally gets an executable SessionStart hook.
81
+ The installer is idempotent. For Codex it also runs `codex plugin add omo-memory@islee23520 --json` when installing into the real home directory.
82
82
 
83
83
  ## Session bootstrap
84
84
 
@@ -84,7 +84,7 @@ try {
84
84
  export const GROK_HOOK_SCRIPT = SESSION_BOOTSTRAP_SCRIPT.replace('?? "codex"', '?? "grok"').replace('?? "lazycodex"', '?? "lfg"');
85
85
  export const CODEX_PLUGIN_JSON = `{
86
86
  "name": "omo-memory",
87
- "version": "0.1.3",
87
+ "version": "0.1.5",
88
88
  "description": "Session-start OMO Memory bootstrap hook for Codex.",
89
89
  "author": "islee23520",
90
90
  "homepage": "https://github.com/islee23520/omo-memory",
package/dist/hooks.js CHANGED
@@ -1,3 +1,4 @@
1
+ import { spawnSync } from "node:child_process";
1
2
  import { chmodSync, existsSync, mkdirSync, readFileSync, writeFileSync } from "node:fs";
2
3
  import { homedir } from "node:os";
3
4
  import { dirname, join } from "node:path";
@@ -40,12 +41,14 @@ function installCodex(home) {
40
41
  upsertMarketplace(marketplaceJsonPath, { withInterface: false });
41
42
  upsertMarketplace(agentsMarketplaceJsonPath, { withInterface: true });
42
43
  upsertCodexConfig(configPath, marketplacePath);
44
+ const pluginAddNote = maybeInstallCodexPlugin(home);
43
45
  return {
44
46
  host: "codex",
45
47
  files: [skillPath, agentsPath, pluginJsonPath, pluginSkillPath, hookJsonPath, hookScriptPath, marketplaceJsonPath, agentsMarketplaceJsonPath, configPath],
46
48
  notes: [
47
49
  "Codex MCP still needs `codex mcp add omo-memory -- npx -y omo-memory mcp` if it is not already present.",
48
50
  "Codex plugin hooks are installed through the local islee23520 marketplace and enabled in ~/.codex/config.toml.",
51
+ pluginAddNote,
49
52
  "Codex may ask to trust the new hook command on first execution unless hook trust has already been granted.",
50
53
  ],
51
54
  };
@@ -119,6 +122,19 @@ function upsertCodexConfig(path, marketplacePath) {
119
122
  const withMarketplace = ensureTomlTable(withHooks, `[marketplaces.${CODEX_MARKETPLACE}]`, `source_type = "local"\nsource = "${escapeTomlString(marketplacePath)}"`);
120
123
  writeText(path, ensureTomlTable(withMarketplace, `[plugins."${CODEX_PLUGIN}@${CODEX_MARKETPLACE}"]`, "enabled = true"));
121
124
  }
125
+ function maybeInstallCodexPlugin(home) {
126
+ if (home !== homedir())
127
+ return "Skipped `codex plugin add` because OMO_MEMORY_INSTALL_HOME points at a test/alternate home.";
128
+ const result = spawnSync("codex", ["plugin", "add", `${CODEX_PLUGIN}@${CODEX_MARKETPLACE}`, "--json"], {
129
+ encoding: "utf8",
130
+ stdio: ["ignore", "pipe", "pipe"],
131
+ timeout: 15000,
132
+ });
133
+ if (result.status === 0)
134
+ return "`codex plugin add omo-memory@islee23520 --json` completed successfully.";
135
+ const detail = result.error instanceof Error ? result.error.message : result.stderr.trim();
136
+ return `Could not run \`codex plugin add omo-memory@islee23520 --json\`: ${detail || "unknown error"}. Run it manually if Codex still reports the plugin as not installed.`;
137
+ }
122
138
  function ensureTomlKey(text, table, keyValue) {
123
139
  if (text.includes(keyValue))
124
140
  return text;
package/dist/memory.js CHANGED
@@ -1,7 +1,6 @@
1
1
  import Database from "better-sqlite3";
2
2
  import { createHash, randomUUID } from "node:crypto";
3
3
  import { mkdirSync } from "node:fs";
4
- import { homedir } from "node:os";
5
4
  import { dirname, join, resolve } from "node:path";
6
5
  import { execFileSync } from "node:child_process";
7
6
  import { redactSecrets, sanitizeGitRemote } from "./privacy.js";
@@ -13,7 +12,7 @@ export class PurgeConfirmationError extends Error {
13
12
  }
14
13
  const SCHEMA_VERSION = 1;
15
14
  export function defaultDbPath() {
16
- return process.env["OMO_MEMORY_DB"] ?? join(homedir(), ".omo", "memory", "state.sqlite");
15
+ return process.env["OMO_MEMORY_DB"] ?? join(resolveProjectContext().repoRoot, ".omo", "memory", "state.sqlite");
17
16
  }
18
17
  export function memoryPaths() {
19
18
  return { dbPath: defaultDbPath() };
@@ -1,6 +1,6 @@
1
1
  # Adapter Integration
2
2
 
3
- OMO Memory is the shared local work ledger for OMO adapters. It is host-neutral: lazycodex, omo-on-opencode, lfg, and future adapters all write summaries, decisions, QA evidence, task state, and handoffs to the same local SQLite database at `~/.omo/memory/state.sqlite` by default.
3
+ OMO Memory is the shared local work ledger for OMO adapters. It is host-neutral: lazycodex, omo-on-opencode, lfg, and future adapters all write summaries, decisions, QA evidence, task state, and handoffs to the same project-local SQLite database at `<project-root>/.omo/memory/state.sqlite` by default.
4
4
 
5
5
  No full transcript capture by default. Do not store API keys, tokens, `.env` contents, auth files, raw tool logs, auth headers, cookies, or any other secret-bearing material.
6
6
 
@@ -93,11 +93,11 @@ npx -y omo-memory hooks install --host all
93
93
 
94
94
  Supported `--host` values:
95
95
 
96
- - `codex`: installs `~/.codex/skills/omo-memory/SKILL.md` and an idempotent OMO Memory block in `~/.codex/AGENTS.md`.
96
+ - `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.
97
97
  - `grok`: installs `~/.grok/skills/omo-memory/SKILL.md`, an idempotent OMO Memory block in `~/.grok/AGENTS.md`, and `~/.grok/hooks/omo-memory-hooks.json` plus its SessionStart script.
98
98
  - `all`: installs both.
99
99
 
100
- The installer is idempotent and replaces only the marked `omo-memory` block in AGENTS files.
100
+ 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.
101
101
 
102
102
  ## Session Bootstrap Flow
103
103
 
@@ -17,7 +17,7 @@ Codegraph solves code intelligence, not work/session memory. OMO needs a separat
17
17
 
18
18
  ## Product direction
19
19
 
20
- - Global local DB: `~/.omo/memory/state.sqlite`
20
+ - Project-local DB: `<project-root>/.omo/memory/state.sqlite`
21
21
  - Project namespace: derive from git remote + repo root hash, with branch/head metadata
22
22
  - Local-first privacy: no cloud sync and no secret storage by default
23
23
  - Adapter-neutral schema: `host` and `adapter` are metadata, not separate products
@@ -58,7 +58,7 @@ Codegraph solves code intelligence, not work/session memory. OMO needs a separat
58
58
 
59
59
  ### CLI
60
60
 
61
- - `omo-memory init` creates or migrates `~/.omo/memory/state.sqlite`.
61
+ - `omo-memory init` creates or migrates `<project-root>/.omo/memory/state.sqlite`.
62
62
  - `omo-memory session start --host grok --adapter lfg` records a session for the current project.
63
63
  - `omo-memory event record --type decision --summary "..."` appends a project/session event.
64
64
  - `omo-memory recent` lists recent project events.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "omo-memory",
3
- "version": "0.1.3",
3
+ "version": "0.1.5",
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": [