@xmemo/client 0.4.135 → 0.4.136

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