@xmemo/client 0.4.135 → 0.4.137

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.
Files changed (5) hide show
  1. package/LICENSE +7 -7
  2. package/README.md +422 -329
  3. package/bin/memory-os.js +12 -12
  4. package/package.json +46 -46
  5. package/src/cli.js +2673 -2244
package/README.md CHANGED
@@ -1,329 +1,422 @@
1
- # XMemo CLI
2
-
3
- `@xmemo/client` is the privacy-first command line entry point for XMemo client
4
- setup. It is intentionally small: the npm package contains only the CLI and
5
- setup helper code needed on a user's machine.
6
-
7
- `@yonro/xmemo-client` is reserved as a Yonro fallback package. The CLI exposes
8
- `xmemo` as the primary command and keeps `memory-os` as a compatibility alias.
9
-
10
- The XMemo server, database, token registry, deployment files, logs, and
11
- internal scripts are not part of this npm package.
12
-
13
- ## Install
14
-
15
- ```bash
16
- npm install -g @xmemo/client
17
- ```
18
-
19
- Upgrade an existing global install:
20
-
21
- ```bash
22
- xmemo update
23
- ```
24
-
25
- This runs `npm install -g @xmemo/client@latest`. Use `xmemo update --dry-run`
26
- to print the exact command without changing anything.
27
-
28
- ## Commands
29
-
30
- ```bash
31
- xmemo update
32
- xmemo setup codex
33
- xmemo setup codex --dry-run
34
- xmemo setup cursor
35
- xmemo setup cursor --dry-run
36
- xmemo setup copilot
37
- xmemo setup copilot --dry-run
38
- xmemo doctor
39
- xmemo discovery show
40
- xmemo setup
41
- xmemo login
42
- xmemo auth status
43
- xmemo status
44
- xmemo token status
45
- xmemo token add --from-stdin
46
- xmemo env example --shell bash
47
- xmemo mcp list
48
- xmemo mcp config --client generic
49
- xmemo profile status codex
50
- xmemo smoke --client codex
51
- xmemo privacy
52
- ```
53
-
54
- ## Enterprise privacy and security defaults
55
-
56
- - No telemetry or analytics.
57
- - `xmemo doctor`, `xmemo discovery show`, and `xmemo status` do not send tokens.
58
- - MCP config generated by the CLI references `XMEMO_KEY`; it does not write
59
- token values into project files.
60
- - The CLI generates one stable non-secret `XMEMO_AGENT_INSTANCE_ID` per local
61
- client profile and stores it in user-scoped config outside git.
62
- - `xmemo login` stores the issued credential in the user-scoped XMemo CLI
63
- config directory, shows the approved account when the server provides it,
64
- and does not require extra token configuration afterward.
65
- - `xmemo token add` remains available for existing tokens and still avoids
66
- project files, shell history, and printed token values.
67
- - Legacy `xmemo token set` refuses plaintext credential storage unless
68
- `--allow-plaintext` is explicitly provided.
69
- - The npm package uses a `files` whitelist so only `bin`, `src`, `README.md`,
70
- and `LICENSE` are published.
71
-
72
- ## Token flow
73
-
74
- Recommended personal-user flow:
75
-
76
- ```bash
77
- xmemo login
78
- xmemo auth status
79
- xmemo token status --verify
80
- ```
81
-
82
- `xmemo login` uses the hosted device-login flow when the service advertises it:
83
- the CLI shows a browser URL and one-time code, the user authorizes in XMemo, and
84
- the CLI stores the issued MCP token in the user-scoped credential file. When the
85
- service returns approved account metadata, the CLI prints the account label so
86
- users can confirm which XMemo account was connected. No manual token setup is
87
- needed after a successful `xmemo login`; `xmemo token status --verify` is only
88
- an optional connectivity check. The CLI waits for the full browser authorization
89
- window by default; use `--timeout-ms` only to shorten or extend that approval
90
- window, and `--http-timeout-ms` only for individual service requests.
91
-
92
- Users who already have a token can configure it directly without shell profiles:
93
-
94
- ```bash
95
- printf '%s\n' 'your-token' | xmemo token add --from-stdin
96
- xmemo token status --verify
97
- ```
98
-
99
- This is the preferred fallback while a hosted service is rolling out device
100
- login. It still avoids project files, MCP config files, logs, and chat
101
- transcripts.
102
-
103
- Tokens should be created by the XMemo website or enterprise console, then
104
- stored with `xmemo login`, `xmemo token add`, a user environment variable, or an
105
- enterprise secret manager:
106
-
107
- ```bash
108
- export XMEMO_KEY="your-token"
109
- ```
110
-
111
- PowerShell:
112
-
113
- ```powershell
114
- [Environment]::SetEnvironmentVariable("XMEMO_KEY", "your-token", "User")
115
- ```
116
-
117
- Do not commit tokens to source control, MCP config files, `.env` files, logs, or
118
- chat transcripts.
119
-
120
- ## Hosted discovery setup
121
-
122
- Hosted setup uses the XMemo public discovery contracts. The CLI reads
123
- secret-free discovery and onboarding status documents, then tells the user where
124
- the API, MCP endpoint, docs, and any server-advertised onboarding links are.
125
-
126
- ```bash
127
- xmemo doctor
128
- xmemo discovery show
129
- xmemo setup
130
- ```
131
-
132
- Discovery requests do not send `XMEMO_KEY` or any Authorization
133
- header. Token creation still happens in the website or enterprise console; the
134
- public service discovery document does not return token values.
135
-
136
- The hosted default service/base URL is `https://xmemo.dev`, so normal users do
137
- not need to type a service address. The MCP endpoint is discovered from that
138
- base URL and written as `https://xmemo.dev/mcp`; `https://mcp.xmemo.dev` is not
139
- the current canonical setup URL. Use `--url <service-url>` or `XMEMO_URL` only
140
- for private, enterprise, or self-hosted deployments. `MEMORY_OS_URL` remains
141
- accepted as a compatibility alias.
142
-
143
- Generate and write a client config from discovery:
144
-
145
- ```bash
146
- xmemo setup codex
147
- xmemo setup codex --url "https://your-private-service.example"
148
- xmemo setup cursor
149
- xmemo setup copilot
150
- ```
151
-
152
- `xmemo setup <client>` is the unified setup entry point. For write-capable
153
- clients, it applies the user-scoped config directly; use `--dry-run` to preview
154
- without writing. Generated config references `XMEMO_KEY`; it does not embed the
155
- token value. Write-capable client configs also include stable non-secret agent
156
- identity headers where the client format supports them. `--yes` remains accepted
157
- for Codex and Cursor as a compatibility no-op.
158
-
159
- `xmemo setup codex` is the recommended Codex path. It writes the Codex MCP
160
- config and installs the profile into the current project's `AGENTS.md` marker
161
- block. Use `--dry-run` to preview, `--profile-target <path>` to choose a
162
- different project instruction file, or `--no-profile` to configure MCP only.
163
-
164
- ## MCP setup
165
-
166
- List supported client generators:
167
-
168
- ```bash
169
- xmemo mcp list
170
- ```
171
-
172
- Current write-capable clients:
173
-
174
- ```text
175
- codex ~/.codex/config.toml
176
- cursor ~/.cursor/mcp.json
177
- copilot ~/.copilot/mcp-config.json
178
- ```
179
-
180
- For clients without a verified user-scoped write path, generate a read-only
181
- template and apply it manually after review:
182
-
183
- ```bash
184
- xmemo mcp config --client generic --base-url "https://your-private-service.example" --json
185
- ```
186
-
187
- Codex, Cursor, and Copilot CLI have write-capable setup helpers. Other client
188
- writes should only be added after their official user-scoped config format is
189
- verified.
190
-
191
- ### Copilot CLI
192
-
193
- Copilot CLI has `/mcp` management and reads user MCP configuration from
194
- `~/.copilot/mcp-config.json` (or `$COPILOT_HOME/mcp-config.json`). XMemo writes
195
- a local proxy server entry there:
196
-
197
- ```bash
198
- xmemo login
199
- xmemo setup copilot
200
- xmemo mcp proxy
201
- ```
202
-
203
- `xmemo setup copilot` writes `memory-os` to Copilot CLI's user MCP config and
204
- does not include token or identity headers. Use `xmemo setup copilot --dry-run`
205
- to preview without writing. `xmemo mcp proxy` reads the token saved by
206
- `xmemo login` or `xmemo token add --from-stdin`, adds the XMemo bearer token and
207
- local agent identity, then forwards requests to `https://xmemo.dev/mcp`. If
208
- Copilot CLI is already open, reload MCP config or restart Copilot CLI after
209
- setup.
210
- If you specifically want the older environment-variable template, run:
211
-
212
- ```bash
213
- xmemo mcp config --client copilot-cli --remote-env
214
- ```
215
-
216
- ### Codex
217
-
218
- Recommended Codex setup:
219
-
220
- ```bash
221
- xmemo setup codex
222
- xmemo smoke --client codex
223
- ```
224
-
225
- `setup codex` writes the MCP config to user-scoped Codex config and installs the
226
- XMemo Codex behavior profile into the current project's `AGENTS.md` between
227
- these markers. Use `xmemo setup codex --dry-run` to preview without writing.
228
-
229
- ```html
230
- <!-- memory-os:codex-profile:start -->
231
- <!-- memory-os:codex-profile:end -->
232
- ```
233
-
234
- Repeat installs update only that marker block. Remove it with:
235
-
236
- ```bash
237
- xmemo profile uninstall codex
238
- ```
239
-
240
- Advanced: generate a Codex MCP config snippet without touching files:
241
-
242
- ```bash
243
- xmemo mcp add codex --url "$XMEMO_URL"
244
- ```
245
-
246
- Write it to the default Codex config path:
247
-
248
- ```bash
249
- xmemo mcp add codex --url "$XMEMO_URL" --write
250
- ```
251
-
252
- The generated config references `XMEMO_KEY` and does not include the token
253
- value. Codex custom identity headers are not written until the CLI format is
254
- verified to support them.
255
-
256
- Codex MCP-depth checks:
257
-
258
- ```bash
259
- xmemo mcp profile codex
260
- xmemo profile install codex --dry-run
261
- xmemo profile install codex
262
- xmemo profile status codex
263
- xmemo smoke --client codex
264
- ```
265
-
266
- `xmemo mcp profile codex` prints the recommended memory behavior profile:
267
- recall/search at the start of non-trivial tasks, write back high-signal
268
- decisions and fixes, and never store secrets. `xmemo smoke --client codex`
269
- checks the local Codex TOML config for the `memory_os` MCP server,
270
- `bearer_token_env_var = "XMEMO_KEY"`, token presence in the environment, and
271
- absence of embedded token values.
272
-
273
- ### Cursor
274
-
275
- Recommended Cursor setup:
276
-
277
- ```bash
278
- xmemo setup cursor
279
- ```
280
-
281
- `setup cursor` merges the Cursor MCP config into the default Cursor user config
282
- path. Use `xmemo setup cursor --dry-run` to preview without writing. The
283
- lower-level equivalent remains:
284
-
285
- ```bash
286
- xmemo mcp add cursor --url "$XMEMO_URL" --write
287
- ```
288
-
289
- The CLI refuses to overwrite an existing `memory_os` MCP server entry. Edit the
290
- config manually if you need to rotate the endpoint. Cursor configs include
291
- `X-Memory-OS-Agent-ID` and `X-Memory-OS-Agent-Instance-ID`; the instance ID is
292
- non-secret and stored under the user's XMemo CLI config directory.
293
-
294
- ## Release model
295
-
296
- This repository is the source for the `@xmemo/client` npm package. Releases
297
- should be published from GitHub Actions on tags or GitHub Releases, not from a
298
- developer workstation.
299
-
300
- Recommended flow:
301
-
302
- ```text
303
- develop -> test -> tag/release -> GitHub Actions -> npm publish --provenance
304
- ```
305
-
306
- ## Package boundary
307
-
308
- Included in npm:
309
-
310
- ```text
311
- bin/
312
- src/
313
- README.md
314
- LICENSE
315
- ```
316
-
317
- Excluded from npm:
318
-
319
- ```text
320
- .github/
321
- test/
322
- coverage/
323
- server code
324
- database migrations
325
- deployment files
326
- logs
327
- local state
328
- secrets
329
- ```
1
+ # XMemo CLI
2
+
3
+ `@xmemo/client` is the privacy-first command line entry point for XMemo client
4
+ setup. It is intentionally small: the npm package contains only the CLI and
5
+ setup helper code needed on a user's machine.
6
+
7
+ `@yonro/xmemo-client` is reserved as a Yonro fallback package. The CLI exposes
8
+ `xmemo` as the primary command and keeps `memory-os` as a compatibility alias.
9
+
10
+ The XMemo server, database, token registry, deployment files, logs, and
11
+ internal scripts are not part of this npm package.
12
+
13
+ ## Install
14
+
15
+ ```bash
16
+ npm install -g @xmemo/client
17
+ ```
18
+
19
+ Upgrade an existing global install:
20
+
21
+ ```bash
22
+ xmemo update
23
+ ```
24
+
25
+ This runs `npm install -g @xmemo/client@latest`. Use `xmemo update --dry-run`
26
+ to print the exact command without changing anything.
27
+
28
+ ## Commands
29
+
30
+ ```bash
31
+ xmemo update
32
+ xmemo setup codex
33
+ xmemo setup codex --dry-run
34
+ xmemo setup cursor
35
+ xmemo setup cursor --dry-run
36
+ xmemo setup copilot
37
+ xmemo setup copilot --dry-run
38
+ xmemo setup gemini
39
+ xmemo setup gemini --dry-run
40
+ xmemo setup antigravity
41
+ xmemo setup antigravity --dry-run
42
+ xmemo doctor
43
+ xmemo discovery show
44
+ xmemo setup
45
+ xmemo login
46
+ xmemo auth status
47
+ xmemo status
48
+ xmemo token status
49
+ xmemo token add --from-stdin
50
+ xmemo env example --shell bash
51
+ xmemo mcp list
52
+ xmemo mcp config --client generic
53
+ xmemo mcp config --client antigravity
54
+ xmemo mcp add antigravity --write
55
+ xmemo profile status codex
56
+ xmemo profile install gemini
57
+ xmemo profile install antigravity
58
+ xmemo smoke --client codex
59
+ xmemo privacy
60
+ ```
61
+
62
+ ## Enterprise privacy and security defaults
63
+
64
+ - No telemetry or analytics.
65
+ - `xmemo doctor`, `xmemo discovery show`, and `xmemo status` do not send tokens.
66
+ - MCP config generated by the CLI references `XMEMO_KEY` or uses the client's
67
+ MCP OAuth flow; it does not write token values into project files.
68
+ - The CLI generates one stable non-secret `XMEMO_AGENT_INSTANCE_ID` per local
69
+ client profile and stores it in user-scoped config outside git.
70
+ - `xmemo setup <client>` can install a marker-scoped XMemo memory behavior
71
+ profile for the selected agent. The profile contains instructions only; it
72
+ never embeds token values.
73
+ - `xmemo login` stores the issued credential in the user-scoped XMemo CLI
74
+ config directory, shows the approved account when the server provides it,
75
+ and does not require extra token configuration afterward.
76
+ - `xmemo token add` remains available for existing tokens and still avoids
77
+ project files, shell history, and printed token values.
78
+ - Legacy `xmemo token set` refuses plaintext credential storage unless
79
+ `--allow-plaintext` is explicitly provided.
80
+ - The npm package uses a `files` whitelist so only `bin`, `src`, `README.md`,
81
+ and `LICENSE` are published.
82
+
83
+ ## Token flow
84
+
85
+ Recommended personal-user flow:
86
+
87
+ ```bash
88
+ xmemo login
89
+ xmemo auth status
90
+ xmemo token status --verify
91
+ ```
92
+
93
+ `xmemo login` uses the hosted device-login flow when the service advertises it:
94
+ the CLI shows a browser URL and one-time code, the user authorizes in XMemo, and
95
+ the CLI stores the issued MCP token in the user-scoped credential file. When the
96
+ service returns approved account metadata, the CLI prints the account label so
97
+ users can confirm which XMemo account was connected. No manual token setup is
98
+ needed after a successful `xmemo login`; `xmemo token status --verify` is only
99
+ an optional connectivity check. The CLI waits for the full browser authorization
100
+ window by default; use `--timeout-ms` only to shorten or extend that approval
101
+ window, and `--http-timeout-ms` only for individual service requests.
102
+
103
+ Users who already have a token can configure it directly without shell profiles:
104
+
105
+ ```bash
106
+ printf '%s\n' 'your-token' | xmemo token add --from-stdin
107
+ xmemo token status --verify
108
+ ```
109
+
110
+ This is the preferred fallback while a hosted service is rolling out device
111
+ login. It still avoids project files, MCP config files, logs, and chat
112
+ transcripts.
113
+
114
+ Tokens should be created by the XMemo website or enterprise console, then
115
+ stored with `xmemo login`, `xmemo token add`, a user environment variable, or an
116
+ enterprise secret manager:
117
+
118
+ ```bash
119
+ export XMEMO_KEY="your-token"
120
+ ```
121
+
122
+ PowerShell:
123
+
124
+ ```powershell
125
+ [Environment]::SetEnvironmentVariable("XMEMO_KEY", "your-token", "User")
126
+ ```
127
+
128
+ Do not commit tokens to source control, MCP config files, `.env` files, logs, or
129
+ chat transcripts.
130
+
131
+ ## Hosted discovery setup
132
+
133
+ Hosted setup uses the XMemo public discovery contracts. The CLI reads
134
+ secret-free discovery and onboarding status documents, then tells the user where
135
+ the API, MCP endpoint, docs, and any server-advertised onboarding links are.
136
+
137
+ ```bash
138
+ xmemo doctor
139
+ xmemo discovery show
140
+ xmemo setup
141
+ ```
142
+
143
+ Discovery requests do not send `XMEMO_KEY` or any Authorization
144
+ header. Token creation still happens in the website or enterprise console; the
145
+ public service discovery document does not return token values.
146
+
147
+ The hosted default service/base URL is `https://xmemo.dev`, so normal users do
148
+ not need to type a service address. The MCP endpoint is discovered from that
149
+ base URL and written as `https://xmemo.dev/mcp`; `https://mcp.xmemo.dev` is not
150
+ the current canonical setup URL. Use `--url <service-url>` or `XMEMO_URL` only
151
+ for private, enterprise, or self-hosted deployments. `MEMORY_OS_URL` remains
152
+ accepted as a compatibility alias.
153
+
154
+ Generate and write a client config from discovery:
155
+
156
+ ```bash
157
+ xmemo setup codex
158
+ xmemo setup codex --url "https://your-private-service.example"
159
+ xmemo setup cursor
160
+ xmemo setup copilot
161
+ xmemo setup gemini
162
+ xmemo setup antigravity
163
+ ```
164
+
165
+ `xmemo setup <client>` is the unified setup entry point. For write-capable
166
+ clients, it applies the user-scoped config directly; use `--dry-run` to preview
167
+ without writing. Codex/Cursor configs reference `XMEMO_KEY`; OAuth-native
168
+ clients such as Gemini CLI and Antigravity use the client's MCP OAuth flow
169
+ instead. No generated config embeds a token value. Write-capable client configs
170
+ also include stable non-secret agent identity headers where the client format
171
+ supports them. `--yes` remains accepted for Codex and Cursor as a compatibility
172
+ no-op.
173
+
174
+ After writing MCP config, `xmemo setup <client>` prompts:
175
+
176
+ ```text
177
+ Write XMemo memory behavior profile to <path>? [Y/n]
178
+ ```
179
+
180
+ The default is `Y`, so pressing Enter writes a marker-scoped profile that nudges
181
+ the agent to recall/search XMemo at the start of non-trivial work and remember
182
+ high-signal decisions after meaningful changes. Use `n` or `--no-profile` to
183
+ configure MCP only. Use `--dry-run` to preview without writing config or profile
184
+ files, and `--profile-target <path>` to choose a different behavior profile
185
+ target.
186
+
187
+ Default behavior profile targets:
188
+
189
+ ```text
190
+ codex ./AGENTS.md
191
+ cursor ~/.cursor/memory-profile.md
192
+ gemini ~/.gemini/GEMINI.md
193
+ antigravity ~/.gemini/antigravity/MEMORY.md
194
+ ```
195
+
196
+ ## MCP setup
197
+
198
+ List supported client generators:
199
+
200
+ ```bash
201
+ xmemo mcp list
202
+ ```
203
+
204
+ Current write-capable clients:
205
+
206
+ ```text
207
+ codex ~/.codex/config.toml
208
+ cursor ~/.cursor/mcp.json
209
+ copilot ~/.copilot/mcp-config.json
210
+ gemini ~/.gemini/settings.json
211
+ antigravity ~/.gemini/antigravity/mcp_config.json
212
+ ```
213
+
214
+ For clients without a verified user-scoped write path, generate a read-only
215
+ template and apply it manually after review:
216
+
217
+ ```bash
218
+ xmemo mcp config --client generic --base-url "https://your-private-service.example" --json
219
+ ```
220
+
221
+ Codex, Cursor, Copilot CLI, Gemini CLI, and Antigravity have write-capable setup
222
+ helpers.
223
+ Other client writes should only be added after their official user-scoped config
224
+ format is verified.
225
+
226
+ ### Copilot CLI
227
+
228
+ Copilot CLI has `/mcp` management and reads user MCP configuration from
229
+ `~/.copilot/mcp-config.json` (or `$COPILOT_HOME/mcp-config.json`). XMemo writes
230
+ a local proxy server entry there:
231
+
232
+ ```bash
233
+ xmemo login
234
+ xmemo setup copilot
235
+ xmemo mcp proxy
236
+ ```
237
+
238
+ `xmemo setup copilot` writes `memory-os` to Copilot CLI's user MCP config and
239
+ does not include token or identity headers. Use `xmemo setup copilot --dry-run`
240
+ to preview without writing. `xmemo mcp proxy` reads the token saved by
241
+ `xmemo login` or `xmemo token add --from-stdin`, adds the XMemo bearer token and
242
+ local agent identity, then forwards requests to `https://xmemo.dev/mcp`. If
243
+ Copilot CLI is already open, reload MCP config or restart Copilot CLI after
244
+ setup.
245
+ If you specifically want the older environment-variable template, run:
246
+
247
+ ```bash
248
+ xmemo mcp config --client copilot-cli --remote-env
249
+ ```
250
+
251
+ ### Codex
252
+
253
+ Recommended Codex setup:
254
+
255
+ ```bash
256
+ xmemo setup codex
257
+ xmemo smoke --client codex
258
+ ```
259
+
260
+ `setup codex` writes the MCP config to user-scoped Codex config and, by default,
261
+ installs the XMemo Codex behavior profile into the current project's `AGENTS.md`
262
+ between these markers. Use `xmemo setup codex --dry-run` to preview without
263
+ writing or `xmemo setup codex --no-profile` to skip the behavior profile.
264
+
265
+ ```html
266
+ <!-- memory-os:codex-profile:start -->
267
+ <!-- memory-os:codex-profile:end -->
268
+ ```
269
+
270
+ Repeat installs update only that marker block. Remove it with:
271
+
272
+ ```bash
273
+ xmemo profile uninstall codex
274
+ ```
275
+
276
+ Advanced: generate a Codex MCP config snippet without touching files:
277
+
278
+ ```bash
279
+ xmemo mcp add codex --url "$XMEMO_URL"
280
+ ```
281
+
282
+ Write it to the default Codex config path:
283
+
284
+ ```bash
285
+ xmemo mcp add codex --url "$XMEMO_URL" --write
286
+ ```
287
+
288
+ The generated config references `XMEMO_KEY` and does not include the token
289
+ value. Codex custom identity headers are not written until the CLI format is
290
+ verified to support them.
291
+
292
+ Codex MCP-depth checks:
293
+
294
+ ```bash
295
+ xmemo mcp profile codex
296
+ xmemo profile install codex --dry-run
297
+ xmemo profile install codex
298
+ xmemo profile status codex
299
+ xmemo smoke --client codex
300
+ ```
301
+
302
+ `xmemo mcp profile codex` prints the recommended memory behavior profile:
303
+ recall/search at the start of non-trivial tasks, write back high-signal
304
+ decisions and fixes, and never store secrets. `xmemo smoke --client codex`
305
+ checks the local Codex TOML config for the `memory_os` MCP server,
306
+ `bearer_token_env_var = "XMEMO_KEY"`, token presence in the environment, and
307
+ absence of embedded token values.
308
+
309
+ ### Cursor
310
+
311
+ Recommended Cursor setup:
312
+
313
+ ```bash
314
+ xmemo setup cursor
315
+ ```
316
+
317
+ `setup cursor` merges the Cursor MCP config into the default Cursor user config
318
+ path. Use `xmemo setup cursor --dry-run` to preview without writing. The
319
+ lower-level equivalent remains:
320
+
321
+ ```bash
322
+ xmemo mcp add cursor --url "$XMEMO_URL" --write
323
+ ```
324
+
325
+ The CLI refuses to overwrite an existing `memory_os` MCP server entry. Edit the
326
+ config manually if you need to rotate the endpoint. Cursor configs include
327
+ `X-Memory-OS-Agent-ID` and `X-Memory-OS-Agent-Instance-ID`; the instance ID is
328
+ non-secret and stored under the user's XMemo CLI config directory. By default,
329
+ the setup prompt also installs a Cursor behavior profile at
330
+ `~/.cursor/memory-profile.md`; answer `n` or pass `--no-profile` to skip it.
331
+
332
+ ### Gemini CLI
333
+
334
+ Recommended Gemini CLI setup:
335
+
336
+ ```bash
337
+ xmemo setup gemini
338
+ ```
339
+
340
+ `setup gemini` merges an XMemo MCP server into Gemini CLI's user settings at
341
+ `~/.gemini/settings.json`. It writes a remote HTTP server using Gemini's
342
+ `httpUrl` key plus `X-Memory-OS-Agent-ID` and `X-Memory-OS-Agent-Instance-ID`
343
+ headers. Use `xmemo setup gemini --dry-run` to preview without writing.
344
+
345
+ Unlike Codex/Cursor, the Gemini config carries **no token**: authentication uses
346
+ Gemini CLI's built-in MCP OAuth flow (a one-time browser login on first use).
347
+ This is deliberate — Gemini redacts environment variables matching
348
+ `*KEY*`/`*TOKEN*`/`*AUTH*` during header expansion, so an `${XMEMO_KEY}`
349
+ reference would not survive. OAuth avoids storing any secret in the config and
350
+ still grants the full XMemo tool profile. After setup, restart Gemini CLI and
351
+ run `/mcp` (or the first XMemo tool call) to complete the OAuth login. By
352
+ default, the setup prompt also installs a Gemini behavior profile at
353
+ `~/.gemini/GEMINI.md`; answer `n` or pass `--no-profile` to skip it.
354
+
355
+ The CLI refuses to overwrite an existing `memory_os` MCP server entry. Edit the
356
+ config manually if you need to rotate the endpoint.
357
+
358
+ ### Antigravity
359
+
360
+ Recommended Antigravity setup:
361
+
362
+ ```bash
363
+ xmemo setup antigravity
364
+ ```
365
+
366
+ `setup antigravity` merges an XMemo MCP server into Antigravity's user MCP config
367
+ at `~/.gemini/antigravity/mcp_config.json`. It writes Antigravity's
368
+ `serverUrl` shape plus `X-Memory-OS-Agent-ID` and
369
+ `X-Memory-OS-Agent-Instance-ID` headers. Like Gemini CLI, the config carries
370
+ **no token**: restart Antigravity and complete the MCP OAuth flow on first use.
371
+ By default, the setup prompt also installs an Antigravity behavior profile at
372
+ `~/.gemini/antigravity/MEMORY.md`; answer `n` or pass `--no-profile` to skip it.
373
+
374
+ The lower-level equivalent is:
375
+
376
+ ```bash
377
+ xmemo mcp add antigravity --write
378
+ ```
379
+
380
+ Use `xmemo setup antigravity` for normal installs because it performs discovery
381
+ and chooses the recommended Antigravity path automatically. Use
382
+ `xmemo mcp add antigravity --write` when you want the generic MCP writer
383
+ directly, for example with `--url` or `--config` in advanced/multi-client setup.
384
+ The CLI refuses to overwrite an existing `memory_os` MCP server entry. Edit the
385
+ config manually if you need to rotate the endpoint.
386
+
387
+ ## Release model
388
+
389
+ This repository is the source for the `@xmemo/client` npm package. Releases
390
+ should be published from GitHub Actions on tags or GitHub Releases, not from a
391
+ developer workstation.
392
+
393
+ Recommended flow:
394
+
395
+ ```text
396
+ develop -> test -> tag/release -> GitHub Actions -> npm publish --provenance
397
+ ```
398
+
399
+ ## Package boundary
400
+
401
+ Included in npm:
402
+
403
+ ```text
404
+ bin/
405
+ src/
406
+ README.md
407
+ LICENSE
408
+ ```
409
+
410
+ Excluded from npm:
411
+
412
+ ```text
413
+ .github/
414
+ test/
415
+ coverage/
416
+ server code
417
+ database migrations
418
+ deployment files
419
+ logs
420
+ local state
421
+ secrets
422
+ ```