memorix 1.8.8 → 1.8.9
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/CHANGELOG.md +18 -0
- package/README.md +8 -1
- package/README.zh-CN.md +9 -1
- package/dist/cli/index.js +465 -255
- package/dist/cli/memcode.js +0 -0
- package/dist/index.js +313 -179
- package/dist/memcode-runtime/CHANGELOG.md +18 -0
- package/dist/sdk.js +306 -172
- package/docs/AGENT_OPERATOR_PLAYBOOK.md +4 -2
- package/docs/INTEGRATIONS.md +1 -0
- package/docs/hooks-architecture.md +18 -13
- package/llms-full.txt +3 -1
- package/llms.txt +2 -1
- package/package.json +2 -1
- package/plugins/antigravity/memorix/plugin.json +1 -1
- package/plugins/claude/memorix/.claude-plugin/plugin.json +1 -1
- package/plugins/codebuddy/memorix/.codebuddy-plugin/plugin.json +1 -1
- package/plugins/codex/memorix/.codex-plugin/plugin.json +1 -1
- package/plugins/copilot/memorix/plugin.json +1 -1
- package/plugins/gemini/memorix/gemini-extension.json +1 -1
- package/plugins/hermes/memorix/plugin.yaml +1 -1
- package/plugins/omp/memorix/package.json +1 -1
- package/plugins/openclaw/memorix/.codex-plugin/plugin.json +1 -1
- package/plugins/pi/memorix/package.json +1 -1
- package/server.json +2 -2
- package/src/cli/commands/agent-integrations.ts +2 -1
- package/src/cli/commands/hooks-install.ts +2 -0
- package/src/cli/commands/integrate.ts +2 -0
- package/src/cli/commands/setup.ts +11 -4
- package/src/hooks/handler.ts +6 -0
- package/src/hooks/installers/index.ts +181 -6
- package/src/hooks/normalizer.ts +60 -1
- package/src/hooks/types.ts +3 -1
- package/src/integrations/registry.ts +9 -0
|
@@ -23,7 +23,7 @@ It supports:
|
|
|
23
23
|
- HTTP MCP service + dashboard (`memorix background start` or `memorix serve-http --port 3211`)
|
|
24
24
|
- bundled terminal agent (`memorix` or `memcode`) that uses the same shared memory pool
|
|
25
25
|
- local-first project-scoped memory
|
|
26
|
-
- cross-agent recall across Cursor, Claude Code, Codex, CodeBuddy Code, Windsurf, Gemini CLI, GitHub Copilot, OpenCode, OpenClaw, Hermes Agent, Oh-my-Pi, Pi, Kiro, Antigravity, Trae,
|
|
26
|
+
- cross-agent recall across Cursor, Claude Code, Codex, CodeBuddy Code, Windsurf, Gemini CLI, GitHub Copilot, OpenCode, Grok Build, OpenClaw, Hermes Agent, Oh-my-Pi, Pi, Kiro, Antigravity, Trae, DeepSeek Harness, and WorkBuddy
|
|
27
27
|
|
|
28
28
|
### Current 1.4 Baseline
|
|
29
29
|
|
|
@@ -41,7 +41,7 @@ For the 1.4 release line, the visible product shape is:
|
|
|
41
41
|
- `memorix_project_context` / `memorix context "..."` is the normal black-box entry for non-trivial coding work: it assembles a bounded task Workset instead of injecting a generic memory dump; `memorix resume "..."` is the explicit CLI continuation projection
|
|
42
42
|
- Code State keeps local snapshots and freshness links; a healthy pre-existing local CodeGraph index can add a bounded semantic outline, but Memorix never initializes or synchronizes that external index itself
|
|
43
43
|
- `memorix knowledge` is an explicit review path for source-backed Markdown knowledge and canonical workflows. Do not initialize a versioned workspace or apply a proposal unless the user asks for that managed artifact
|
|
44
|
-
- integration surfaces are agent-specific: Claude Code, Codex, GitHub Copilot CLI, Antigravity, and Hermes receive plugin packages; OpenClaw receives a compatible bundle; Pi and Oh-my-Pi receive package entries; Gemini CLI receives an extension package; OpenCode receives a plugin file and skill; DeepSeek Harness receives an MCP patch row, AGENTS.md guidance, and skills; Cursor and other agents receive MCP/rules/hooks where supported
|
|
44
|
+
- integration surfaces are agent-specific: Claude Code, Codex, GitHub Copilot CLI, Antigravity, and Hermes receive plugin packages; OpenClaw receives a compatible bundle; Pi and Oh-my-Pi receive package entries; Gemini CLI receives an extension package; OpenCode receives a plugin file and skill; Grok Build receives native hooks and `AGENTS.md` guidance while keeping MCP host-owned; DeepSeek Harness receives an MCP patch row, AGENTS.md guidance, and skills; Cursor and other agents receive MCP/rules/hooks where supported
|
|
45
45
|
- privacy-safe diagnostics and receipts avoid raw chat, memory text, query text, tool payloads, and local file paths
|
|
46
46
|
|
|
47
47
|
---
|
|
@@ -245,6 +245,7 @@ memorix setup --agent opencode --global
|
|
|
245
245
|
memorix setup --agent openclaw --global
|
|
246
246
|
memorix setup --agent hermes --global
|
|
247
247
|
memorix setup --agent omp --global
|
|
248
|
+
memorix setup --agent grok --global
|
|
248
249
|
```
|
|
249
250
|
|
|
250
251
|
What this installs depends on the target agent:
|
|
@@ -256,6 +257,7 @@ What this installs depends on the target agent:
|
|
|
256
257
|
- Pi: user Pi package with extension-based hook capture and a Memorix skill, registered through `pi install <path> --approve`; project-local setup uses `-l`.
|
|
257
258
|
- Gemini CLI: local extension package under `~/.gemini/extensions/memorix`, extension-bundled stdio MCP, `GEMINI.md` context, hooks, commands, and skills. Antigravity CLI has an official Gemini CLI migration path, but Gemini CLI remains a separate target.
|
|
258
259
|
- OpenCode: local plugin file, `opencode.json` MCP config, OpenCode skill, plus `AGENTS.md` guidance.
|
|
260
|
+
- Grok Build: native hooks in `~/.grok/hooks/memorix.json` and guidance in `~/.grok/AGENTS.md`. Global hooks are trusted; project hooks require Grok `/hooks-trust` or `--trust`. Memorix does not write Grok's `config.toml` or MCP entries.
|
|
259
261
|
- Antigravity: native plugin under `~/.gemini/config/plugins/memorix` or `.agents/plugins/memorix`, with `plugin.json`, `mcp_config.json`, `hooks.json`, rules, and skills.
|
|
260
262
|
- OpenClaw: OpenClaw-compatible bundle under `~/.openclaw/extensions/memorix`, bundled `.mcp.json`, skills, and OpenClaw `HOOK.md`/`handler.ts` hook pack.
|
|
261
263
|
- Hermes Agent: Hermes plugin under Hermes home (`%LOCALAPPDATA%\hermes` on native Windows, `~/.hermes` elsewhere, or `HERMES_HOME`), enabled in `config.yaml`, with plugin hooks, slash command, CLI command, skills, and MCP config.
|
package/docs/INTEGRATIONS.md
CHANGED
|
@@ -53,6 +53,7 @@ Generated guidance also has scope:
|
|
|
53
53
|
| CodeBuddy Code | `memorix setup --agent codebuddy --global` | CodeBuddy local marketplace plugin | `~/.codebuddy/memorix-local` marketplace with `.codebuddy-plugin`, bundled stdio MCP, skills, and hooks | Setup attempts `codebuddy plugin marketplace add` then user-scope install. It does not alter existing CodeBuddy settings, permissions, or model configuration; review third-party hooks in CodeBuddy's `/hooks` flow before enabling them. |
|
|
54
54
|
| GitHub Copilot CLI | `memorix setup --agent copilot --global` | Copilot CLI plugin package | Local plugin under `~/.copilot/plugins/local/memorix` with MCP, skills, and hooks | Setup attempts `copilot plugin install <local-path>` when Copilot CLI is available. |
|
|
55
55
|
| Cursor | `memorix setup --agent cursor --global` | Cursor MCP and rules config | Cursor MCP config, `.cursor/rules/memorix.mdc`, skills, and hook guidance | Reload Cursor after setup so it can pick up project config changes. |
|
|
56
|
+
| Grok Build | `memorix setup --agent grok --global` | `~/.grok/hooks/memorix.json` + `~/.grok/AGENTS.md` | Lifecycle hooks on SessionStart, SessionEnd, UserPromptSubmit, PostToolUse, PostToolUseFailure, PreCompact, PostCompact, Stop, and StopFailure, plus Grok project/global guidance | Uses Grok's own JSON hook directory and never writes `~/.grok/config.toml` or MCP entries. Global hooks are trusted; project hooks require Grok `/hooks-trust`. Set `GROK_HOME` to use a custom Grok home. The command is `memorix hook --agent grok`. |
|
|
56
57
|
| Gemini CLI | `memorix setup --agent gemini-cli --global` | Gemini CLI extension | Extension under `~/.gemini/extensions/memorix` with MCP, `GEMINI.md` context, hooks, commands, and skills | Antigravity CLI has an official Gemini CLI migration path, but Gemini CLI remains an active standalone Google CLI target. |
|
|
57
58
|
| OpenCode | `memorix setup --agent opencode --global` | OpenCode local plugin file | Global setup writes `~/.config/opencode/plugins/memorix.js`, `~/.config/opencode/opencode.json`, skills, and `AGENTS.md` guidance; repo-local setup writes the `.opencode/` equivalents. | OpenCode loads local plugin and skill files from its config scope. |
|
|
58
59
|
| OpenClaw | `memorix setup --agent openclaw --global` | OpenClaw compatible bundle | `~/.openclaw/extensions/memorix` with `.mcp.json`, skills, and OpenClaw `HOOK.md`/`handler.ts` hook pack | Setup attempts `openclaw plugins install <path> --force` and `openclaw hooks enable memorix` when OpenClaw is available. |
|
|
@@ -9,17 +9,18 @@
|
|
|
9
9
|
|
|
10
10
|
### 事件映射表
|
|
11
11
|
|
|
12
|
-
| 语义 | VS Code Copilot | Claude Code | Codex | Windsurf | Cursor (Beta) | Kiro |
|
|
13
|
-
|
|
14
|
-
| 会话开始 | SessionStart | SessionStart | SessionStart | — | — | — |
|
|
15
|
-
| 用户输入 | UserPromptSubmit | UserPromptSubmit | UserPromptSubmit | pre_user_prompt | beforeSubmitPrompt | user prompt |
|
|
16
|
-
| 工具调用前 | PreToolUse | PreToolUse | — | pre_mcp_tool_use | beforeMCPExecution | — |
|
|
17
|
-
| 工具调用后 | PostToolUse | PostToolUse | PostToolUse | post_mcp_tool_use | — | — |
|
|
18
|
-
| 文件编辑后 | PostToolUse(write) | PostToolUse(write) | PostToolUse(apply_patch) | post_write_code | afterFileEdit | file save |
|
|
19
|
-
| 命令执行后 | PostToolUse(cmd) | PostToolUse(cmd) | PostToolUse(Bash) | post_run_command | — | — |
|
|
20
|
-
| AI 回复后 | — | — | Stop | post_cascade_response | — | agent turn |
|
|
21
|
-
| 上下文压缩前 | PreCompact | PreCompact | PreCompact | — | — | — |
|
|
22
|
-
|
|
|
12
|
+
| 语义 | VS Code Copilot | Claude Code | Codex | Windsurf | Cursor (Beta) | Kiro | Grok Build |
|
|
13
|
+
|------|----------------|-------------|-------|----------|---------------|------|------------|
|
|
14
|
+
| 会话开始 | SessionStart | SessionStart | SessionStart | — | — | — | SessionStart |
|
|
15
|
+
| 用户输入 | UserPromptSubmit | UserPromptSubmit | UserPromptSubmit | pre_user_prompt | beforeSubmitPrompt | user prompt | UserPromptSubmit |
|
|
16
|
+
| 工具调用前 | PreToolUse | PreToolUse | — | pre_mcp_tool_use | beforeMCPExecution | — | PreToolUse(仅观察) |
|
|
17
|
+
| 工具调用后 | PostToolUse | PostToolUse | PostToolUse | post_mcp_tool_use | — | — | PostToolUse / PostToolUseFailure |
|
|
18
|
+
| 文件编辑后 | PostToolUse(write) | PostToolUse(write) | PostToolUse(apply_patch) | post_write_code | afterFileEdit | file save | PostToolUse(search_replace) |
|
|
19
|
+
| 命令执行后 | PostToolUse(cmd) | PostToolUse(cmd) | PostToolUse(Bash) | post_run_command | — | — | PostToolUse(run_terminal_command) |
|
|
20
|
+
| AI 回复后 | — | — | Stop | post_cascade_response | — | agent turn | Stop / StopFailure |
|
|
21
|
+
| 上下文压缩前 | PreCompact | PreCompact | PreCompact | — | — | — | PreCompact |
|
|
22
|
+
| 上下文压缩后 | — | — | — | — | — | — | PostCompact |
|
|
23
|
+
| 会话结束 | Stop | Stop | Stop | — | stop | — | SessionEnd |
|
|
23
24
|
|
|
24
25
|
### 配置文件位置
|
|
25
26
|
|
|
@@ -29,7 +30,8 @@
|
|
|
29
30
|
| Claude Code | `.claude/settings.json` | 原生 |
|
|
30
31
|
| Codex | 用户级 Memorix 插件内 `hooks/hooks.json` | Codex plugin hooks;通过 `memorix setup --agent codex --global` 安装,不写项目 `.codex/hooks.json` |
|
|
31
32
|
| Windsurf | `.windsurf/cascade.json` | Windsurf 格式 |
|
|
32
|
-
| Cursor | `.cursor/hooks.json` |
|
|
33
|
+
| Cursor | `.cursor/hooks.json` |
|
|
34
|
+
| Grok Build | `~/.grok/hooks/memorix.json` | Cursor 格式 |
|
|
33
35
|
| Kiro | `.kiro/hooks/*.hook.md` | Markdown + YAML |
|
|
34
36
|
|
|
35
37
|
### stdin/stdout 通信协议
|
|
@@ -48,6 +50,9 @@
|
|
|
48
50
|
|
|
49
51
|
// Cursor
|
|
50
52
|
{ "hook_event_name": "afterFileEdit", "conversation_id": "...", "generation_id": "...", ... }
|
|
53
|
+
|
|
54
|
+
// Grok Build
|
|
55
|
+
{ "hookEventName": "PostToolUse", "sessionId": "...", "cwd": "...", "workspaceRoot": "...", "toolName": "search_replace", "toolInput": { "path": "..." }, "toolResult": { ... } }
|
|
51
56
|
```
|
|
52
57
|
|
|
53
58
|
## Memorix Hook Handler 设计
|
|
@@ -85,7 +90,7 @@ memorix hook <normalized_event> [--agent <agent_name>]
|
|
|
85
90
|
```bash
|
|
86
91
|
memorix hooks install
|
|
87
92
|
# 自动检测已安装的 Agent → 生成对应配置文件
|
|
88
|
-
# 支持: --agent claude|codex|cursor|windsurf|copilot|opencode|kiro|antigravity|gemini-cli|trae
|
|
93
|
+
# 支持: --agent claude|codex|cursor|windsurf|copilot|opencode|kiro|antigravity|gemini-cli|trae|grok
|
|
89
94
|
# openclaw/hermes/omp/codex 的 hooks 随插件包安装,使用 `memorix setup --agent <agent>`
|
|
90
95
|
# 支持: --project (仅当前项目) | --global (全局)
|
|
91
96
|
```
|
package/llms-full.txt
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
> Local-first shared memory layer for AI coding agents.
|
|
4
4
|
|
|
5
|
-
Memorix is a TypeScript/Node.js project that gives AI coding agents persistent, project-aware memory. It targets software development workflows, not generic chat. It works across Claude Code, Codex, CodeBuddy Code, Cursor, Windsurf, GitHub Copilot CLI, Gemini CLI, OpenCode, OpenClaw, Hermes Agent, Oh-my-Pi, Pi, Kiro, Antigravity, Trae, DeepSeek Harness, and any agent that can speak MCP over stdio or HTTP. Integrations usually start with `memorix setup --agent <agent> --global`, which installs the recommended user-level package or config for that agent: plugin packages when supported, package or extension entries, MCP config, generated guidance, hooks, skills, or the bundled terminal agent.
|
|
5
|
+
Memorix is a TypeScript/Node.js project that gives AI coding agents persistent, project-aware memory. It targets software development workflows, not generic chat. It works across Claude Code, Codex, CodeBuddy Code, Cursor, Windsurf, GitHub Copilot CLI, Gemini CLI, OpenCode, Grok Build, OpenClaw, Hermes Agent, Oh-my-Pi, Pi, Kiro, Antigravity, Trae, DeepSeek Harness, WorkBuddy, and any agent that can speak MCP over stdio or HTTP. Integrations usually start with `memorix setup --agent <agent> --global`, which installs the recommended user-level package or config for that agent: plugin packages when supported, package or extension entries, MCP config, generated guidance, hooks, skills, or the bundled terminal agent.
|
|
6
6
|
|
|
7
7
|
If you are an AI coding agent helping a user install, operate, or troubleshoot Memorix, read `docs/AGENT_OPERATOR_PLAYBOOK.md` before taking action. It is the main reference for install, runtime selection, Git/project binding, MCP integration, hooks, and troubleshooting.
|
|
8
8
|
|
|
@@ -35,6 +35,7 @@ It installs the recommended Memorix integration for the target agent:
|
|
|
35
35
|
- Pi: user Pi package with a Memorix extension and skill. Setup also attempts `pi install <path> --approve`; project-local setup uses `-l`.
|
|
36
36
|
- Gemini CLI: local Gemini extension package with MCP and `GEMINI.md` context.
|
|
37
37
|
- OpenCode: local plugin file, `opencode.json` MCP config, OpenCode skill, and `AGENTS.md` guidance.
|
|
38
|
+
- Grok Build: native lifecycle hooks in `~/.grok/hooks/memorix.json` and `~/.grok/AGENTS.md` guidance. Grok owns its MCP configuration; project hooks require `/hooks-trust`.
|
|
38
39
|
- Windsurf, Kiro, Antigravity, Trae: MCP config plus rules/hooks where supported.
|
|
39
40
|
- DeepSeek Harness: MCP patch row (`$DSH_HOME/cordis.patch.yml`) plus `AGENTS.md` guidance and official skills.
|
|
40
41
|
|
|
@@ -50,6 +51,7 @@ memorix setup --agent cursor --global
|
|
|
50
51
|
memorix setup --agent pi --global
|
|
51
52
|
memorix setup --agent gemini-cli --global
|
|
52
53
|
memorix setup --agent opencode --global
|
|
54
|
+
memorix setup --agent grok --global
|
|
53
55
|
```
|
|
54
56
|
|
|
55
57
|
Manual `memorix integrate --agent <agent>` and `memorix hooks install --agent <agent>` are fallback commands for updating one generated integration without running the full setup package. Run setup without `--global` only when you intentionally want repo-local guidance, rules, or hooks for one project.
|
package/llms.txt
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
> Local-first shared memory layer for AI coding agents.
|
|
4
4
|
|
|
5
|
-
Memorix gives coding agents persistent, project-aware memory across sessions, IDEs, terminals, and MCP clients. It stores project knowledge once so multiple agents can retrieve it through plugin packages, MCP, CLI, SDK, generated rules/instructions, hooks, skills, local plugins, or the bundled terminal agent. It works with Claude Code, Codex, CodeBuddy Code, Cursor, Windsurf, GitHub Copilot CLI, Gemini CLI, OpenCode, OpenClaw, Hermes Agent, Oh-my-Pi, Pi, Kiro, Antigravity, Trae, DeepSeek Harness, and other MCP-capable agents.
|
|
5
|
+
Memorix gives coding agents persistent, project-aware memory across sessions, IDEs, terminals, and MCP clients. It stores project knowledge once so multiple agents can retrieve it through plugin packages, MCP, CLI, SDK, generated rules/instructions, hooks, skills, local plugins, or the bundled terminal agent. It works with Claude Code, Codex, CodeBuddy Code, Cursor, Windsurf, GitHub Copilot CLI, Gemini CLI, OpenCode, Grok Build, OpenClaw, Hermes Agent, Oh-my-Pi, Pi, Kiro, Antigravity, Trae, DeepSeek Harness, WorkBuddy, and other MCP-capable agents.
|
|
6
6
|
|
|
7
7
|
## Entry Points
|
|
8
8
|
|
|
@@ -14,6 +14,7 @@ Memorix gives coding agents persistent, project-aware memory across sessions, ID
|
|
|
14
14
|
- `memorix integrate --agent <agent>` and `memorix hooks install --agent <agent>` are manual/fallback generation commands.
|
|
15
15
|
- `memorix` and `memcode` open memcode, the bundled terminal agent that uses the same project memory pool.
|
|
16
16
|
- `memorix dashboard` opens the local read-mostly dashboard.
|
|
17
|
+
- `memorix setup --agent grok --global` installs Grok's native lifecycle hooks and `AGENTS.md` guidance; Grok keeps MCP configuration under its own control.
|
|
17
18
|
|
|
18
19
|
## Memory Model
|
|
19
20
|
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "memorix",
|
|
3
3
|
"mcpName": "io.github.AVIDS2/memorix",
|
|
4
|
-
"version": "1.8.
|
|
4
|
+
"version": "1.8.9",
|
|
5
5
|
"description": "Local-first shared memory layer for AI coding agents across MCP clients, Git history, reasoning context, and project sessions.",
|
|
6
6
|
"type": "module",
|
|
7
7
|
"sideEffects": false,
|
|
@@ -105,6 +105,7 @@
|
|
|
105
105
|
"cross-agent-memory",
|
|
106
106
|
"context-persistence",
|
|
107
107
|
"agent-memory",
|
|
108
|
+
"grok-build",
|
|
108
109
|
"memcode",
|
|
109
110
|
"coding-agent",
|
|
110
111
|
"terminal-agent",
|
package/server.json
CHANGED
|
@@ -7,7 +7,7 @@
|
|
|
7
7
|
"url": "https://github.com/AVIDS2/memorix",
|
|
8
8
|
"source": "github"
|
|
9
9
|
},
|
|
10
|
-
"version": "1.8.
|
|
10
|
+
"version": "1.8.9",
|
|
11
11
|
"websiteUrl": "https://mem.rglens.com",
|
|
12
12
|
"icons": [
|
|
13
13
|
{
|
|
@@ -22,7 +22,7 @@
|
|
|
22
22
|
{
|
|
23
23
|
"registryType": "npm",
|
|
24
24
|
"identifier": "memorix",
|
|
25
|
-
"version": "1.8.
|
|
25
|
+
"version": "1.8.9",
|
|
26
26
|
"runtimeHint": "npx",
|
|
27
27
|
"packageArguments": [
|
|
28
28
|
{
|
|
@@ -126,6 +126,7 @@ const GUIDANCE_AGENTS = new Set<AgentName>([
|
|
|
126
126
|
'trae',
|
|
127
127
|
'dsh',
|
|
128
128
|
'workbuddy',
|
|
129
|
+
'grok',
|
|
129
130
|
]);
|
|
130
131
|
|
|
131
132
|
const CODEX_PLUGIN_NAME = 'memorix';
|
|
@@ -167,7 +168,7 @@ function worstStatus(statuses: AgentIntegrationStatus[]): AgentIntegrationStatus
|
|
|
167
168
|
}
|
|
168
169
|
|
|
169
170
|
function isMcpConfigAgent(agent: AgentName): agent is McpConfigAgent {
|
|
170
|
-
return agent !== 'pi';
|
|
171
|
+
return agent !== 'pi' && agent !== 'grok';
|
|
171
172
|
}
|
|
172
173
|
|
|
173
174
|
function isActionableMcpRepairIssue(issue: string): boolean {
|
|
@@ -166,6 +166,7 @@ function getAgentLabel(agent: string): string {
|
|
|
166
166
|
trae: 'Trae',
|
|
167
167
|
dsh: 'DeepSeek Harness',
|
|
168
168
|
workbuddy: 'WorkBuddy',
|
|
169
|
+
grok: 'Grok Build',
|
|
169
170
|
};
|
|
170
171
|
return labels[agent] || agent;
|
|
171
172
|
}
|
|
@@ -186,6 +187,7 @@ function getAgentHint(agent: string): string {
|
|
|
186
187
|
trae: '.trae/rules/project_rules.md (rules only, no hooks system)',
|
|
187
188
|
dsh: '~/.dsh/cordis.patch.yml MCP row via `memorix setup --agent dsh` (no hooks system)',
|
|
188
189
|
workbuddy: '~/.workbuddy/mcp.json MCP row via `memorix setup --agent workbuddy` (no hooks system)',
|
|
190
|
+
grok: '~/.grok/hooks/memorix.json (own file, not RuleSync dest)',
|
|
189
191
|
codex: 'Codex plugin hooks; use `memorix setup --agent codex`',
|
|
190
192
|
};
|
|
191
193
|
return hints[agent] || '';
|
|
@@ -116,6 +116,7 @@ function getAgentLabel(agent: string): string {
|
|
|
116
116
|
trae: 'Trae',
|
|
117
117
|
dsh: 'DeepSeek Harness',
|
|
118
118
|
workbuddy: 'WorkBuddy',
|
|
119
|
+
grok: 'Grok Build',
|
|
119
120
|
};
|
|
120
121
|
return labels[agent] || agent;
|
|
121
122
|
}
|
|
@@ -134,6 +135,7 @@ function getAgentHint(agent: string): string {
|
|
|
134
135
|
trae: 'rules',
|
|
135
136
|
dsh: 'MCP patch + AGENTS.md + skills',
|
|
136
137
|
workbuddy: 'MCP + AGENTS.md',
|
|
138
|
+
grok: 'hooks file (~/.grok/hooks/memorix.json)',
|
|
137
139
|
};
|
|
138
140
|
return hints[agent] || 'integration files';
|
|
139
141
|
}
|
|
@@ -195,6 +195,7 @@ const SUPPORTED_SETUP_AGENTS: AgentName[] = [
|
|
|
195
195
|
'dsh',
|
|
196
196
|
'workbuddy',
|
|
197
197
|
'pi',
|
|
198
|
+
'grok',
|
|
198
199
|
];
|
|
199
200
|
|
|
200
201
|
export function getSetupAgentTargets(): AgentName[] {
|
|
@@ -211,7 +212,9 @@ export function buildSetupPlan(options: {
|
|
|
211
212
|
plugin?: boolean;
|
|
212
213
|
global?: boolean;
|
|
213
214
|
}): SetupPlan {
|
|
214
|
-
|
|
215
|
+
// Grok owns its MCP configuration through `grok mcp`; Memorix setup only
|
|
216
|
+
// installs the independent hooks/rules integration for this target.
|
|
217
|
+
const mcp = options.agent === 'grok' ? 'none' : options.mcp ?? 'stdio';
|
|
215
218
|
const actions: SetupAction[] = [];
|
|
216
219
|
const isPackageOwnedAgent = options.agent !== 'all' && PACKAGE_OWNED_INTEGRATION_AGENTS.has(options.agent);
|
|
217
220
|
const includeHooks = options.hooks ?? true;
|
|
@@ -388,7 +391,7 @@ function relativePosix(from: string, to: string): string {
|
|
|
388
391
|
return rel;
|
|
389
392
|
}
|
|
390
393
|
|
|
391
|
-
export type McpConfigAgent = Exclude<AgentName, 'pi'>;
|
|
394
|
+
export type McpConfigAgent = Exclude<AgentName, 'pi' | 'grok'>;
|
|
392
395
|
|
|
393
396
|
export function getMcpAdapter(agent: McpConfigAgent): MCPConfigAdapter {
|
|
394
397
|
const adapters: Record<McpConfigAgent, MCPConfigAdapter> = {
|
|
@@ -1453,7 +1456,7 @@ export async function installAgentSetup(agent: AgentName, plan: SetupPlan, globa
|
|
|
1453
1456
|
const hasCodeBuddyPlugin = plan.actions.includes('codebuddy-plugin') && agent === 'codebuddy';
|
|
1454
1457
|
// Codex's supported default is the user-level plugin. Never create a
|
|
1455
1458
|
// project-local .codex/config.toml as an implicit fallback.
|
|
1456
|
-
const wantsMcpConfig = plan.mcp !== 'none' && agent !== 'pi' && !(agent === 'codex' && !global);
|
|
1459
|
+
const wantsMcpConfig = plan.mcp !== 'none' && agent !== 'pi' && agent !== 'grok' && !(agent === 'codex' && !global);
|
|
1457
1460
|
|
|
1458
1461
|
if (PLUGIN_PACKAGE_AGENTS.has(agent) && plan.includePlugin && !global) {
|
|
1459
1462
|
p.log.info(`${agent}: project setup leaves user-level plugins untouched. Run \`memorix setup --agent ${agent} --global\` to install its plugin, skills, and lifecycle hooks.`);
|
|
@@ -1633,6 +1636,9 @@ export async function installAgentSetup(agent: AgentName, plan: SetupPlan, globa
|
|
|
1633
1636
|
|
|
1634
1637
|
if (agent === 'pi') {
|
|
1635
1638
|
p.log.info('pi: Pi has no MCP config lane in the current CLI; use the installed package extension and skill.');
|
|
1639
|
+
} else if (agent === 'grok') {
|
|
1640
|
+
p.log.info('grok: lifecycle hooks write ~/.grok/hooks/memorix.json. MCP stays host-owned (do not write config.toml).');
|
|
1641
|
+
if (!global) p.log.info('grok: project hooks require `/hooks-trust` or launching Grok with `--trust`.');
|
|
1636
1642
|
} else if (plan.mcp === 'stdio') {
|
|
1637
1643
|
p.log.info(`${agent}: MCP server command is \`memorix serve\``);
|
|
1638
1644
|
} else if (plan.mcp === 'http') {
|
|
@@ -1669,7 +1675,7 @@ export default defineCommand({
|
|
|
1669
1675
|
args: {
|
|
1670
1676
|
agent: {
|
|
1671
1677
|
type: 'string',
|
|
1672
|
-
description: 'Target agent (claude, codex, codebuddy, opencode, cursor, windsurf, copilot, gemini-cli, antigravity, openclaw, hermes, omp, kiro, trae, dsh, pi, all)',
|
|
1678
|
+
description: 'Target agent (claude, codex, codebuddy, opencode, cursor, windsurf, copilot, gemini-cli, antigravity, openclaw, hermes, omp, kiro, trae, dsh, pi, grok, all)',
|
|
1673
1679
|
required: false,
|
|
1674
1680
|
},
|
|
1675
1681
|
mcp: {
|
|
@@ -1738,6 +1744,7 @@ export default defineCommand({
|
|
|
1738
1744
|
{ value: 'codex', label: 'Codex', hint: 'plugin package + marketplace + MCP' },
|
|
1739
1745
|
{ value: 'copilot', label: 'GitHub Copilot CLI', hint: 'plugin package + hooks + MCP' },
|
|
1740
1746
|
{ value: 'cursor', label: 'Cursor', hint: 'MCP + rules + skills' },
|
|
1747
|
+
{ value: 'grok', label: 'Grok Build', hint: 'hooks file; MCP stays host-owned' },
|
|
1741
1748
|
{ value: 'gemini-cli', label: 'Gemini CLI', hint: 'extension + MCP' },
|
|
1742
1749
|
{ value: 'openclaw', label: 'OpenClaw', hint: 'bundle + hook pack + skills + MCP' },
|
|
1743
1750
|
{ value: 'hermes', label: 'Hermes Agent', hint: 'plugin + hooks + commands + skills + MCP' },
|
package/src/hooks/handler.ts
CHANGED
|
@@ -737,6 +737,12 @@ export function formatHookOutput(
|
|
|
737
737
|
};
|
|
738
738
|
}
|
|
739
739
|
|
|
740
|
+
// Grok's documented hook contract only gives passive hooks a success exit
|
|
741
|
+
// signal; it does not define a Claude-style additionalContext response.
|
|
742
|
+
// Returning an empty object keeps Memorix capture-only and never changes
|
|
743
|
+
// Grok's prompt, tool, or stop decisions.
|
|
744
|
+
if (agent === 'grok') return {};
|
|
745
|
+
|
|
740
746
|
const finalOutput: Record<string, unknown> = { ...output };
|
|
741
747
|
const hookSpecificOutputEvents = new Set([
|
|
742
748
|
'PreToolUse',
|