@xmemo/client 0.4.163 → 0.4.164
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 +34 -0
- package/package.json +1 -1
- package/plugins/kiro/steering/AGENTS.md +2 -2
- package/src/config/paths.js +1 -0
- package/src/mcp/clients/registry.js +8 -0
- package/src/mcp/clients.js +7 -1
- package/src/mcp/formats/toml.js +39 -3
- package/src/mcp/identity/paths.js +5 -0
- package/src/ui/setup.js +3 -0
package/README.md
CHANGED
|
@@ -43,6 +43,8 @@ xmemo setup antigravity
|
|
|
43
43
|
xmemo setup antigravity --dry-run
|
|
44
44
|
xmemo setup kiro
|
|
45
45
|
xmemo setup kiro --dry-run
|
|
46
|
+
xmemo setup grok
|
|
47
|
+
xmemo setup grok --dry-run
|
|
46
48
|
xmemo mcp add antigravity2
|
|
47
49
|
xmemo mcp add antigravity2 --write
|
|
48
50
|
xmemo doctor
|
|
@@ -447,6 +449,38 @@ After setup, restart Kiro or reload MCP servers for the changes to take effect.
|
|
|
447
449
|
The CLI refuses to overwrite an existing `XMemo`, `memory_os`, or `memory-os`
|
|
448
450
|
MCP server entry. Edit the config manually if you need to rotate the endpoint.
|
|
449
451
|
|
|
452
|
+
### Grok (xAI)
|
|
453
|
+
|
|
454
|
+
Recommended Grok setup:
|
|
455
|
+
|
|
456
|
+
```bash
|
|
457
|
+
xmemo setup grok
|
|
458
|
+
```
|
|
459
|
+
|
|
460
|
+
`setup grok` appends an XMemo MCP server to Grok's user config at
|
|
461
|
+
`~/.grok/config.toml` using Grok's TOML `[mcp_servers.XMemo]` format with `url`,
|
|
462
|
+
`bearer_token_env_var = "XMEMO_KEY"`, and an `[mcp_servers.XMemo.http_headers]`
|
|
463
|
+
table carrying `X-Memory-OS-Agent-ID`. Use `xmemo setup grok --dry-run` to
|
|
464
|
+
preview without writing.
|
|
465
|
+
|
|
466
|
+
Set your XMemo token with:
|
|
467
|
+
|
|
468
|
+
```bash
|
|
469
|
+
xmemo login
|
|
470
|
+
# or
|
|
471
|
+
printf '%s\n' 'your-token' | xmemo token add --from-stdin
|
|
472
|
+
```
|
|
473
|
+
|
|
474
|
+
Grok is also fully compatible with Claude Code: it automatically reads Claude
|
|
475
|
+
Code marketplaces, plugins, skills, and MCP servers. So `xmemo setup claude-code`
|
|
476
|
+
plus the repo's `.claude-plugin/`, `.mcp.json`, and `skills/` are discovered by
|
|
477
|
+
Grok with zero extra configuration. Use `xmemo setup grok` when you want the
|
|
478
|
+
server written directly into Grok's own `~/.grok/config.toml`.
|
|
479
|
+
|
|
480
|
+
After setup, restart Grok or run `/mcps` to reload MCP servers. The CLI refuses
|
|
481
|
+
to overwrite an existing `XMemo` MCP server entry; edit the config manually if
|
|
482
|
+
you need to rotate the endpoint.
|
|
483
|
+
|
|
450
484
|
### Antigravity 2.0
|
|
451
485
|
|
|
452
486
|
Recommended Antigravity 2.0 setup:
|
package/package.json
CHANGED
|
@@ -13,10 +13,10 @@ Use XMemo when the task may depend on prior memory, durable project context, cod
|
|
|
13
13
|
## Workflow
|
|
14
14
|
|
|
15
15
|
1. **Recall first** when prior context could change the answer. Use XMemo search/recall/context tools before making assumptions about preferences or past decisions.
|
|
16
|
-
2. **Save only durable information** that the user asks to remember or that is clearly useful across future
|
|
16
|
+
2. **Save only durable information** that the user asks to remember or that is clearly useful across future sessions.
|
|
17
17
|
3. **Keep memory content concise, scoped, and useful**. Prefer concrete facts, decisions, links to public docs, and action items over chat transcripts.
|
|
18
18
|
4. **For destructive memory actions**, confirm the exact target before deleting, forgetting, or overwriting.
|
|
19
|
-
5. **If authorization errors occur**,
|
|
19
|
+
5. **If authorization errors occur**, tell the user: "Run `xmemo login` or visit https://xmemo.dev to get your token, then set the `XMEMO_KEY` environment variable and restart Kiro."
|
|
20
20
|
|
|
21
21
|
## Good Memory Candidates
|
|
22
22
|
|
package/src/config/paths.js
CHANGED
|
@@ -11,6 +11,14 @@ export function createMcpClients(deps) {
|
|
|
11
11
|
configKind: 'toml'
|
|
12
12
|
});
|
|
13
13
|
|
|
14
|
+
clients.set('grok', {
|
|
15
|
+
label: 'Grok',
|
|
16
|
+
defaultConfigPath: deps.defaultGrokConfigPath,
|
|
17
|
+
buildSnippet: deps.grokTomlSnippet,
|
|
18
|
+
writeConfig: deps.appendGrokServerConfig,
|
|
19
|
+
configKind: 'toml'
|
|
20
|
+
});
|
|
21
|
+
|
|
14
22
|
for (const definition of deps.JSON_MCP_CLIENT_DEFINITIONS) {
|
|
15
23
|
if (definition.id === 'qwen') {
|
|
16
24
|
clients.set('hermes', hermesClient(deps));
|
package/src/mcp/clients.js
CHANGED
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
import {
|
|
2
2
|
appendTomlServerConfig,
|
|
3
|
-
|
|
3
|
+
appendGrokServerConfig,
|
|
4
|
+
codexTomlSnippet,
|
|
5
|
+
grokTomlSnippet
|
|
4
6
|
} from './formats/toml.js';
|
|
5
7
|
import {
|
|
6
8
|
hermesYamlSnippet,
|
|
@@ -23,6 +25,7 @@ import {
|
|
|
23
25
|
defaultContinueConfigPath,
|
|
24
26
|
defaultCursorConfigPath,
|
|
25
27
|
defaultGeminiConfigPath,
|
|
28
|
+
defaultGrokConfigPath,
|
|
26
29
|
defaultHermesConfigPath,
|
|
27
30
|
defaultJetbrainsConfigPath,
|
|
28
31
|
defaultKiroConfigPath,
|
|
@@ -45,6 +48,9 @@ export const MCP_CLIENTS = createMcpClients({
|
|
|
45
48
|
defaultCodexConfigPath,
|
|
46
49
|
codexTomlSnippet,
|
|
47
50
|
appendTomlServerConfig,
|
|
51
|
+
defaultGrokConfigPath,
|
|
52
|
+
grokTomlSnippet,
|
|
53
|
+
appendGrokServerConfig,
|
|
48
54
|
defaultHermesConfigPath,
|
|
49
55
|
hermesYamlSnippet,
|
|
50
56
|
mergeHermesMcpConfig,
|
package/src/mcp/formats/toml.js
CHANGED
|
@@ -3,6 +3,9 @@ import path from 'node:path';
|
|
|
3
3
|
|
|
4
4
|
import {
|
|
5
5
|
COMMAND_NAME,
|
|
6
|
+
AGENT_ID_HEADER,
|
|
7
|
+
AGENT_INSTANCE_ENV_VAR,
|
|
8
|
+
AGENT_INSTANCE_HEADER,
|
|
6
9
|
LEGACY_MCP_SERVER_NAMES,
|
|
7
10
|
MCP_SERVER_NAME,
|
|
8
11
|
TOKEN_ENV_VAR
|
|
@@ -18,13 +21,46 @@ import {
|
|
|
18
21
|
} from '../../core/runtime.js';
|
|
19
22
|
import { agentInstanceIdentityPath } from '../identity/device.js';
|
|
20
23
|
|
|
21
|
-
export function codexTomlSnippet(mcpUrl) {
|
|
24
|
+
export function codexTomlSnippet(mcpUrl, identity) {
|
|
25
|
+
const agentId = identity?.agentId ?? 'codex';
|
|
26
|
+
const agentInstanceId = identity?.agentInstanceId ?? `\${${AGENT_INSTANCE_ENV_VAR}}`;
|
|
22
27
|
return `[mcp_servers.${MCP_SERVER_NAME}]
|
|
23
28
|
url = "${escapeTomlString(mcpUrl)}"
|
|
24
29
|
bearer_token_env_var = "${TOKEN_ENV_VAR}"
|
|
30
|
+
|
|
31
|
+
[mcp_servers.${MCP_SERVER_NAME}.http_headers]
|
|
32
|
+
${AGENT_ID_HEADER} = "${escapeTomlString(agentId)}"
|
|
33
|
+
${AGENT_INSTANCE_HEADER} = "${escapeTomlString(agentInstanceId)}"
|
|
34
|
+
`;
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
export function grokTomlSnippet(mcpUrl, identity) {
|
|
38
|
+
const agentId = identity?.agentId ?? 'grok';
|
|
39
|
+
const agentInstanceId = identity?.agentInstanceId ?? `\${${AGENT_INSTANCE_ENV_VAR}}`;
|
|
40
|
+
return `[mcp_servers.${MCP_SERVER_NAME}]
|
|
41
|
+
url = "${escapeTomlString(mcpUrl)}"
|
|
42
|
+
bearer_token_env_var = "${TOKEN_ENV_VAR}"
|
|
43
|
+
|
|
44
|
+
[mcp_servers.${MCP_SERVER_NAME}.http_headers]
|
|
45
|
+
${AGENT_ID_HEADER} = "${escapeTomlString(agentId)}"
|
|
46
|
+
${AGENT_INSTANCE_HEADER} = "${escapeTomlString(agentInstanceId)}"
|
|
25
47
|
`;
|
|
26
48
|
}
|
|
27
49
|
|
|
50
|
+
export async function appendGrokServerConfig(configPath, mcpUrl, identity) {
|
|
51
|
+
const snippet = grokTomlSnippet(mcpUrl, identity);
|
|
52
|
+
const existing = await readTextIfExists(configPath);
|
|
53
|
+
const existingName = existingTomlMcpServerName(existing);
|
|
54
|
+
if (existingName) {
|
|
55
|
+
throw new UsageError(`MCP config already contains [mcp_servers.${existingName}]. Edit ${configPath} manually to avoid duplicate server definitions.`);
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
await fs.mkdir(path.dirname(configPath), { recursive: true, mode: 0o700 });
|
|
59
|
+
const prefix = existing.trim().length === 0 ? '' : '\n\n';
|
|
60
|
+
await fs.appendFile(configPath, `${prefix}${snippet}`, { mode: 0o600 });
|
|
61
|
+
await bestEffortChmod(configPath, 0o600);
|
|
62
|
+
}
|
|
63
|
+
|
|
28
64
|
export async function codexSmokeReport(configPath, env) {
|
|
29
65
|
const configText = await readTextIfExists(configPath);
|
|
30
66
|
const serverBlock = findTomlServerBlock(configText);
|
|
@@ -91,8 +127,8 @@ export async function codexSmokeReport(configPath, env) {
|
|
|
91
127
|
};
|
|
92
128
|
}
|
|
93
129
|
|
|
94
|
-
export async function appendTomlServerConfig(configPath, mcpUrl) {
|
|
95
|
-
const snippet = codexTomlSnippet(mcpUrl);
|
|
130
|
+
export async function appendTomlServerConfig(configPath, mcpUrl, identity) {
|
|
131
|
+
const snippet = codexTomlSnippet(mcpUrl, identity);
|
|
96
132
|
const existing = await readTextIfExists(configPath);
|
|
97
133
|
const existingName = existingTomlMcpServerName(existing);
|
|
98
134
|
if (existingName) {
|
|
@@ -153,3 +153,8 @@ export function defaultClaudecodeConfigPath(env) {
|
|
|
153
153
|
return path.join(home, '.claude.json');
|
|
154
154
|
}
|
|
155
155
|
|
|
156
|
+
export function defaultGrokConfigPath(env) {
|
|
157
|
+
const home = env.USERPROFILE || env.HOME || os.homedir();
|
|
158
|
+
return path.join(home, '.grok', 'config.toml');
|
|
159
|
+
}
|
|
160
|
+
|
package/src/ui/setup.js
CHANGED
|
@@ -15,6 +15,9 @@ import { profileClientConfig } from '../config/profile.js';
|
|
|
15
15
|
|
|
16
16
|
const SETUP_CLIENT_ALIASES = new Map([
|
|
17
17
|
['codex', 'codex'],
|
|
18
|
+
['grok', 'grok'],
|
|
19
|
+
['grok-cli', 'grok'],
|
|
20
|
+
['grok-build', 'grok'],
|
|
18
21
|
['cursor', 'cursor'],
|
|
19
22
|
['copilot', 'copilot-cli'],
|
|
20
23
|
['copilot-cli', 'copilot-cli'],
|