omo-memory 0.1.5 → 0.1.7

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
@@ -67,7 +67,7 @@ Both hosts use the current project ledger at `<project-root>/.omo/memory/state.s
67
67
 
68
68
  ## Passive setup
69
69
 
70
- Install passive skills/rules/hooks with:
70
+ Install the host plugin-style bundles with:
71
71
 
72
72
  ```sh
73
73
  npx -y omo-memory hooks install --host all
@@ -76,7 +76,7 @@ npx -y omo-memory hooks install --host all
76
76
  This installs:
77
77
 
78
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
- - Grok: `~/.grok/skills/omo-memory/SKILL.md`, a global `~/.grok/AGENTS.md` lifecycle rule, and a `~/.grok/hooks/` SessionStart hook.
79
+ - Grok: `~/.grok/plugins/omo-memory` with `plugin.json`, skill, `SessionStart` hook, and `.mcp.json`, plus compatibility copies in `~/.grok/skills` and `~/.grok/hooks`.
80
80
 
81
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
 
@@ -82,9 +82,34 @@ try {
82
82
  }
83
83
  `;
84
84
  export const GROK_HOOK_SCRIPT = SESSION_BOOTSTRAP_SCRIPT.replace('?? "codex"', '?? "grok"').replace('?? "lazycodex"', '?? "lfg"');
85
+ export const GROK_PLUGIN_JSON = `{
86
+ "name": "omo-memory",
87
+ "version": "0.1.7",
88
+ "description": "Project-local OMO Memory bootstrap hook and MCP server for Grok.",
89
+ "author": {
90
+ "name": "islee23520"
91
+ },
92
+ "repository": "https://github.com/islee23520/omo-memory",
93
+ "homepage": "https://github.com/islee23520/omo-memory",
94
+ "license": "MIT",
95
+ "keywords": ["grok", "hooks", "memory", "mcp"],
96
+ "skills": "./skills/",
97
+ "hooks": "./hooks/hooks.json",
98
+ "mcpServers": "./.mcp.json"
99
+ }
100
+ `;
101
+ export const GROK_MCP_JSON = `{
102
+ "mcpServers": {
103
+ "omo-memory": {
104
+ "command": "npx",
105
+ "args": ["-y", "omo-memory", "mcp"]
106
+ }
107
+ }
108
+ }
109
+ `;
85
110
  export const CODEX_PLUGIN_JSON = `{
86
111
  "name": "omo-memory",
87
- "version": "0.1.5",
112
+ "version": "0.1.7",
88
113
  "description": "Session-start OMO Memory bootstrap hook for Codex.",
89
114
  "author": "islee23520",
90
115
  "homepage": "https://github.com/islee23520/omo-memory",
package/dist/hooks.js CHANGED
@@ -2,7 +2,7 @@ import { spawnSync } from "node:child_process";
2
2
  import { chmodSync, existsSync, mkdirSync, readFileSync, writeFileSync } from "node:fs";
3
3
  import { homedir } from "node:os";
4
4
  import { dirname, join } from "node:path";
5
- import { CODEX_AGENTS_BLOCK, CODEX_HOOKS_JSON, CODEX_MARKETPLACE, CODEX_PLUGIN, CODEX_PLUGIN_JSON, CODEX_SKILL, GROK_AGENTS_BLOCK, GROK_HOOK_SCRIPT, GROK_HOOKS_JSON, GROK_SKILL, SESSION_BOOTSTRAP_SCRIPT, } from "./hookTemplates.js";
5
+ import { CODEX_AGENTS_BLOCK, CODEX_HOOKS_JSON, CODEX_MARKETPLACE, CODEX_PLUGIN, CODEX_PLUGIN_JSON, CODEX_SKILL, GROK_AGENTS_BLOCK, GROK_HOOK_SCRIPT, GROK_HOOKS_JSON, GROK_MCP_JSON, GROK_PLUGIN_JSON, GROK_SKILL, SESSION_BOOTSTRAP_SCRIPT, } from "./hookTemplates.js";
6
6
  const BLOCK_START = "<!-- omo-memory:start -->";
7
7
  const BLOCK_END = "<!-- omo-memory:end -->";
8
8
  export function installHooks(input) {
@@ -58,15 +58,28 @@ function installGrok(home) {
58
58
  const agentsPath = join(home, ".grok", "AGENTS.md");
59
59
  const hookScriptPath = join(home, ".grok", "hooks", "omo-memory-session.mjs");
60
60
  const hookJsonPath = join(home, ".grok", "hooks", "omo-memory-hooks.json");
61
+ const pluginRoot = join(home, ".grok", "plugins", "omo-memory");
62
+ const pluginJsonPath = join(pluginRoot, "plugin.json");
63
+ const pluginSkillPath = join(pluginRoot, "skills", "omo-memory", "SKILL.md");
64
+ const pluginHookJsonPath = join(pluginRoot, "hooks", "hooks.json");
65
+ const pluginHookScriptPath = join(pluginRoot, "scripts", "omo-memory-session.mjs");
66
+ const pluginMcpPath = join(pluginRoot, ".mcp.json");
61
67
  writeText(skillPath, GROK_SKILL);
62
68
  upsertAgentsBlock(agentsPath, GROK_AGENTS_BLOCK);
63
69
  writeText(hookScriptPath, GROK_HOOK_SCRIPT);
64
70
  chmodSync(hookScriptPath, 0o755);
65
71
  writeText(hookJsonPath, GROK_HOOKS_JSON.replace("{{HOME}}", home));
72
+ writeText(pluginJsonPath, GROK_PLUGIN_JSON);
73
+ writeText(pluginSkillPath, GROK_SKILL);
74
+ writeText(pluginHookJsonPath, GROK_HOOKS_JSON.replace(`node \\"{{HOME}}/.grok/hooks/omo-memory-session.mjs\\"`, `node \\"${pluginHookScriptPath}\\"`));
75
+ writeText(pluginHookScriptPath, GROK_HOOK_SCRIPT);
76
+ chmodSync(pluginHookScriptPath, 0o755);
77
+ writeText(pluginMcpPath, GROK_MCP_JSON);
78
+ const pluginInstallNote = maybeInstallGrokPlugin(home, pluginRoot);
66
79
  return {
67
80
  host: "grok",
68
- files: [skillPath, agentsPath, hookScriptPath, hookJsonPath],
69
- notes: ["Grok discovers ~/.grok/skills and ~/.grok/hooks; run grok inspect to verify discovery."],
81
+ files: [skillPath, agentsPath, hookScriptPath, hookJsonPath, pluginJsonPath, pluginSkillPath, pluginHookJsonPath, pluginHookScriptPath, pluginMcpPath],
82
+ notes: ["Grok plugin bundle installed at ~/.grok/plugins/omo-memory.", pluginInstallNote],
70
83
  };
71
84
  }
72
85
  function writeText(path, text) {
@@ -135,6 +148,19 @@ function maybeInstallCodexPlugin(home) {
135
148
  const detail = result.error instanceof Error ? result.error.message : result.stderr.trim();
136
149
  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
150
  }
151
+ function maybeInstallGrokPlugin(home, pluginRoot) {
152
+ if (home !== homedir())
153
+ return "Skipped `grok plugin install` because OMO_MEMORY_INSTALL_HOME points at a test/alternate home.";
154
+ const result = spawnSync("grok", ["plugin", "install", pluginRoot, "--trust"], {
155
+ encoding: "utf8",
156
+ stdio: ["ignore", "pipe", "pipe"],
157
+ timeout: 15000,
158
+ });
159
+ if (result.status === 0)
160
+ return "`grok plugin install ~/.grok/plugins/omo-memory --trust` completed successfully.";
161
+ const detail = result.error instanceof Error ? result.error.message : result.stderr.trim();
162
+ return `Could not run \`grok plugin install ~/.grok/plugins/omo-memory --trust\`: ${detail || "unknown error"}. Run it manually if Grok still reports the plugin as not installed.`;
163
+ }
138
164
  function ensureTomlKey(text, table, keyValue) {
139
165
  if (text.includes(keyValue))
140
166
  return text;
@@ -83,7 +83,7 @@ grok mcp add omo-memory -- npx -y omo-memory mcp
83
83
 
84
84
  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.
85
85
 
86
- ## Passive Hook Install
86
+ ## Plugin-Style Host Install
87
87
 
88
88
  Install host-side passive behavior with:
89
89
 
@@ -94,10 +94,10 @@ npx -y omo-memory hooks install --host all
94
94
  Supported `--host` values:
95
95
 
96
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
- - `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.
97
+ - `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`.
98
98
  - `all`: installs both.
99
99
 
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.
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. For Grok, `~/.grok/plugins/omo-memory` is a user plugin and is trusted automatically by Grok.
101
101
 
102
102
  ## Session Bootstrap Flow
103
103
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "omo-memory",
3
- "version": "0.1.5",
3
+ "version": "0.1.7",
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": [