@xmemo/client 0.0.0 → 0.4.127

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/LICENSE ADDED
@@ -0,0 +1,7 @@
1
+ Copyright (c) Yonro.
2
+
3
+ All rights reserved.
4
+
5
+ This package is published as a client distribution artifact for XMemo.
6
+ No license is granted to copy, modify, distribute, sublicense, or use the source
7
+ code except as expressly permitted by Yonro in a separate written agreement.
package/README.md CHANGED
@@ -1,4 +1,301 @@
1
- # @xmemo/client
2
-
3
- Reserved client package name for XMemo by Memory OS. Official client package is coming soon.
1
+ # XMemo CLI
4
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
+ ## Commands
20
+
21
+ ```bash
22
+ xmemo setup codex
23
+ xmemo setup codex --yes
24
+ xmemo smoke --client codex
25
+ xmemo doctor
26
+ xmemo discovery show
27
+ xmemo setup
28
+ xmemo login
29
+ xmemo status
30
+ xmemo token status
31
+ xmemo token add --from-stdin
32
+ xmemo env example --shell bash
33
+ xmemo mcp list
34
+ xmemo mcp config --client generic
35
+ xmemo profile status codex
36
+ xmemo mcp add cursor --url "https://your-private-service.example"
37
+ xmemo privacy
38
+ ```
39
+
40
+ ## Enterprise privacy and security defaults
41
+
42
+ - No telemetry or analytics.
43
+ - `xmemo doctor`, `xmemo discovery show`, and `xmemo status` do not send tokens.
44
+ - MCP config generated by the CLI references `XMEMO_KEY`; it does not write
45
+ token values into project files.
46
+ - The CLI generates one stable non-secret `XMEMO_AGENT_INSTANCE_ID` per local
47
+ client profile and stores it in user-scoped config outside git.
48
+ - `xmemo login` and `xmemo token add` store tokens only in the user-scoped
49
+ XMemo CLI credential file outside git; token values are never printed.
50
+ - Legacy `xmemo token set` refuses plaintext credential storage unless
51
+ `--allow-plaintext` is explicitly provided.
52
+ - The npm package uses a `files` whitelist so only `bin`, `src`, `README.md`,
53
+ and `LICENSE` are published.
54
+
55
+ ## Token flow
56
+
57
+ Recommended personal-user flow:
58
+
59
+ ```bash
60
+ xmemo login
61
+ xmemo token status --verify
62
+ ```
63
+
64
+ `xmemo login` uses the hosted device-login flow when the service advertises it:
65
+ the CLI shows a browser URL and one-time code, the user authorizes in XMemo, and
66
+ the CLI stores the issued MCP token in the user-scoped credential file.
67
+
68
+ Users who already have a token can configure it directly without shell profiles:
69
+
70
+ ```bash
71
+ printf '%s\n' 'your-token' | xmemo token add --from-stdin
72
+ xmemo token status --verify
73
+ ```
74
+
75
+ This is the preferred fallback while a hosted service is rolling out device
76
+ login. It still avoids project files, MCP config files, logs, and chat
77
+ transcripts.
78
+
79
+ Tokens should be created by the XMemo website or enterprise console, then
80
+ stored with `xmemo login`, `xmemo token add`, a user environment variable, or an
81
+ enterprise secret manager:
82
+
83
+ ```bash
84
+ export XMEMO_KEY="your-token"
85
+ ```
86
+
87
+ PowerShell:
88
+
89
+ ```powershell
90
+ [Environment]::SetEnvironmentVariable("XMEMO_KEY", "your-token", "User")
91
+ ```
92
+
93
+ Do not commit tokens to source control, MCP config files, `.env` files, logs, or
94
+ chat transcripts.
95
+
96
+ ## Hosted discovery setup
97
+
98
+ Hosted setup uses the XMemo public discovery contracts. The CLI reads
99
+ secret-free discovery and onboarding status documents, then tells the user where
100
+ the API, MCP endpoint, docs, and any server-advertised onboarding links are.
101
+
102
+ ```bash
103
+ xmemo doctor
104
+ xmemo discovery show
105
+ xmemo setup
106
+ ```
107
+
108
+ Discovery requests do not send `XMEMO_KEY` or any Authorization
109
+ header. Token creation still happens in the website or enterprise console; the
110
+ public service discovery document does not return token values.
111
+
112
+ The hosted default service/base URL is `https://xmemo.dev`, so normal users do
113
+ not need to type a service address. The MCP endpoint is discovered from that
114
+ base URL and written as `https://xmemo.dev/mcp`; `https://mcp.xmemo.dev` is not
115
+ the current canonical setup URL. Use `--url <service-url>` or `XMEMO_URL` only
116
+ for private, enterprise, or self-hosted deployments. `MEMORY_OS_URL` remains
117
+ accepted as a compatibility alias.
118
+
119
+ Generate and write a client config from discovery:
120
+
121
+ ```bash
122
+ xmemo setup codex --yes
123
+ xmemo setup codex --url "https://your-private-service.example" --yes
124
+ xmemo setup --url "https://your-private-service.example" --client codex --write
125
+ xmemo setup --url "https://your-private-service.example" --client cursor --write
126
+ ```
127
+
128
+ `--write` requires an explicit `--client` so the CLI never performs broad config
129
+ writes implicitly. Generated config references `XMEMO_KEY`; it does not embed
130
+ the token value. Write-capable client configs also include stable non-secret
131
+ agent identity headers where the client format supports them.
132
+
133
+ `xmemo setup codex` is the recommended Codex path. Without `--yes` it
134
+ previews the Codex MCP config and the project-scoped `AGENTS.md` memory profile.
135
+ With `--yes`, it writes the Codex MCP config and installs the profile into the
136
+ current project's `AGENTS.md` marker block. Use `--profile-target <path>` to
137
+ choose a different project instruction file, or `--no-profile` to configure MCP
138
+ only.
139
+
140
+ ## MCP setup
141
+
142
+ List supported client generators:
143
+
144
+ ```bash
145
+ xmemo mcp list
146
+ ```
147
+
148
+ Current write-capable clients:
149
+
150
+ ```text
151
+ codex ~/.codex/config.toml
152
+ cursor ~/.cursor/mcp.json
153
+ ```
154
+
155
+ For clients without a verified user-scoped write path, generate a read-only
156
+ template and apply it manually after review:
157
+
158
+ ```bash
159
+ xmemo mcp config --client copilot-cli
160
+ xmemo mcp config --client generic --base-url "https://your-private-service.example" --json
161
+ ```
162
+
163
+ Only Codex and Cursor currently have write-capable helpers. Other client writes
164
+ should only be added after their official user-scoped config format is verified.
165
+
166
+ ### Copilot CLI
167
+
168
+ Copilot CLI has `/mcp` management, but it does not currently document a stable
169
+ cross-platform user config file path/format for third-party tools to edit
170
+ directly. The recommended personal-user path is therefore local proxy mode:
171
+
172
+ ```bash
173
+ xmemo login
174
+ xmemo mcp config --client copilot-cli
175
+ xmemo mcp proxy
176
+ ```
177
+
178
+ The generated Copilot CLI template points at `http://127.0.0.1:8765/mcp` and
179
+ does not include token or identity headers. `xmemo mcp proxy` reads the token
180
+ saved by `xmemo login` or `xmemo token add --from-stdin`, adds the XMemo bearer
181
+ token and local agent identity, then forwards requests to `https://xmemo.dev/mcp`.
182
+ If you specifically want the older environment-variable template, run:
183
+
184
+ ```bash
185
+ xmemo mcp config --client copilot-cli --remote-env
186
+ ```
187
+
188
+ ### Codex
189
+
190
+ Recommended Codex setup:
191
+
192
+ ```bash
193
+ xmemo setup codex
194
+ xmemo setup codex --yes
195
+ xmemo smoke --client codex
196
+ ```
197
+
198
+ `setup codex` is visible and opt-in: the first command previews the writes, and
199
+ `--yes` performs them. The MCP config stays in user-scoped Codex config, while
200
+ the XMemo Codex behavior profile is installed into the current project's
201
+ `AGENTS.md` between these markers:
202
+
203
+ ```html
204
+ <!-- memory-os:codex-profile:start -->
205
+ <!-- memory-os:codex-profile:end -->
206
+ ```
207
+
208
+ Repeat installs update only that marker block. Remove it with:
209
+
210
+ ```bash
211
+ xmemo profile uninstall codex
212
+ ```
213
+
214
+ Advanced: generate a Codex MCP config snippet without touching files:
215
+
216
+ ```bash
217
+ xmemo mcp add codex --url "$XMEMO_URL"
218
+ ```
219
+
220
+ Write it to the default Codex config path:
221
+
222
+ ```bash
223
+ xmemo mcp add codex --url "$XMEMO_URL" --write
224
+ ```
225
+
226
+ The generated config references `XMEMO_KEY` and does not include the token
227
+ value. Codex custom identity headers are not written until the CLI format is
228
+ verified to support them.
229
+
230
+ Codex MCP-depth checks:
231
+
232
+ ```bash
233
+ xmemo mcp profile codex
234
+ xmemo profile install codex --dry-run
235
+ xmemo profile install codex
236
+ xmemo profile status codex
237
+ xmemo smoke --client codex
238
+ ```
239
+
240
+ `xmemo mcp profile codex` prints the recommended memory behavior profile:
241
+ recall/search at the start of non-trivial tasks, write back high-signal
242
+ decisions and fixes, and never store secrets. `xmemo smoke --client codex`
243
+ checks the local Codex TOML config for the `memory_os` MCP server,
244
+ `bearer_token_env_var = "XMEMO_KEY"`, token presence in the environment, and
245
+ absence of embedded token values.
246
+
247
+ ### Cursor
248
+
249
+ Generate a Cursor MCP config snippet:
250
+
251
+ ```bash
252
+ xmemo mcp add cursor --url "$XMEMO_URL"
253
+ ```
254
+
255
+ Merge it into the default Cursor user config path:
256
+
257
+ ```bash
258
+ xmemo mcp add cursor --url "$XMEMO_URL" --write
259
+ ```
260
+
261
+ The CLI refuses to overwrite an existing `memory_os` MCP server entry. Edit the
262
+ config manually if you need to rotate the endpoint. Cursor configs include
263
+ `X-Memory-OS-Agent-ID` and `X-Memory-OS-Agent-Instance-ID`; the instance ID is
264
+ non-secret and stored under the user's XMemo CLI config directory.
265
+
266
+ ## Release model
267
+
268
+ This repository is the source for the `@xmemo/client` npm package. Releases
269
+ should be published from GitHub Actions on tags or GitHub Releases, not from a
270
+ developer workstation.
271
+
272
+ Recommended flow:
273
+
274
+ ```text
275
+ develop -> test -> tag/release -> GitHub Actions -> npm publish --provenance
276
+ ```
277
+
278
+ ## Package boundary
279
+
280
+ Included in npm:
281
+
282
+ ```text
283
+ bin/
284
+ src/
285
+ README.md
286
+ LICENSE
287
+ ```
288
+
289
+ Excluded from npm:
290
+
291
+ ```text
292
+ .github/
293
+ test/
294
+ coverage/
295
+ server code
296
+ database migrations
297
+ deployment files
298
+ logs
299
+ local state
300
+ secrets
301
+ ```
@@ -0,0 +1,12 @@
1
+ #!/usr/bin/env node
2
+ import { run } from '../src/cli.js';
3
+
4
+ const exitCode = await run(process.argv.slice(2), {
5
+ env: process.env,
6
+ stdin: process.stdin,
7
+ stdout: process.stdout,
8
+ stderr: process.stderr,
9
+ fetch: globalThis.fetch
10
+ });
11
+
12
+ process.exitCode = exitCode;
package/package.json CHANGED
@@ -1,24 +1,46 @@
1
- {
2
- "name": "@xmemo/client",
3
- "version": "0.0.0",
4
- "description": "Reserved client package name for XMemo by Memory OS.",
5
- "main": "index.js",
6
- "scripts": {
7
- "test": "echo \"Error: no test specified\" && exit 1"
8
- },
9
- "keywords": [],
10
- "author": "",
11
- "license": "MIT",
12
- "type": "module",
13
- "homepage": "https://xmemo.dev",
14
- "repository": {
15
- "type": "git",
16
- "url": "git+https://github.com/yonro/memory-os.git"
17
- },
18
- "bugs": {
19
- "url": "https://github.com/yonro/memory-os/issues"
20
- },
21
- "publishConfig": {
22
- "access": "public"
23
- }
24
- }
1
+ {
2
+ "name": "@xmemo/client",
3
+ "version": "0.4.127",
4
+ "description": "Privacy-first CLI and MCP setup helper for XMemo.",
5
+ "type": "module",
6
+ "bin": {
7
+ "xmemo": "bin/memory-os.js",
8
+ "memory-os": "bin/memory-os.js"
9
+ },
10
+ "files": [
11
+ "bin",
12
+ "src",
13
+ "README.md",
14
+ "LICENSE"
15
+ ],
16
+ "scripts": {
17
+ "lint": "node --check bin/memory-os.js && node --check src/cli.js && node --check test/cli.test.js",
18
+ "test": "node --test",
19
+ "pack:dry-run": "npm pack --dry-run",
20
+ "prepublishOnly": "npm run lint && npm test && npm run pack:dry-run"
21
+ },
22
+ "engines": {
23
+ "node": ">=20.0.0"
24
+ },
25
+ "publishConfig": {
26
+ "access": "public",
27
+ "provenance": true
28
+ },
29
+ "repository": {
30
+ "type": "git",
31
+ "url": "git+https://github.com/yonro/memory-os-cli.git"
32
+ },
33
+ "bugs": {
34
+ "url": "https://github.com/yonro/memory-os-cli/issues"
35
+ },
36
+ "homepage": "https://github.com/yonro/memory-os-cli#readme",
37
+ "keywords": [
38
+ "xmemo",
39
+ "memory-os",
40
+ "mcp",
41
+ "agent",
42
+ "cli",
43
+ "privacy"
44
+ ],
45
+ "license": "UNLICENSED"
46
+ }