@xmemo/client 0.0.0 → 0.4.126

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,252 @@
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 status
29
+ xmemo token status
30
+ xmemo env example --shell bash
31
+ xmemo mcp list
32
+ xmemo mcp config --client generic
33
+ xmemo profile status codex
34
+ xmemo mcp add cursor --url "https://your-private-service.example"
35
+ xmemo privacy
36
+ ```
37
+
38
+ ## Enterprise privacy and security defaults
39
+
40
+ - No telemetry or analytics.
41
+ - `xmemo doctor`, `xmemo discovery show`, and `xmemo status` do not send tokens.
42
+ - MCP config generated by the CLI references `XMEMO_KEY`; it does not write
43
+ token values into project files.
44
+ - The CLI generates one stable non-secret `XMEMO_AGENT_INSTANCE_ID` per local
45
+ client profile and stores it in user-scoped config outside git.
46
+ - `xmemo token set` refuses plaintext credential storage unless
47
+ `--allow-plaintext` is explicitly provided.
48
+ - The npm package uses a `files` whitelist so only `bin`, `src`, `README.md`,
49
+ and `LICENSE` are published.
50
+
51
+ ## Token flow
52
+
53
+ Tokens should be created by the XMemo website or enterprise console, then
54
+ stored in a user environment variable or enterprise secret manager:
55
+
56
+ ```bash
57
+ export XMEMO_KEY="your-token"
58
+ ```
59
+
60
+ PowerShell:
61
+
62
+ ```powershell
63
+ [Environment]::SetEnvironmentVariable("XMEMO_KEY", "your-token", "User")
64
+ ```
65
+
66
+ Do not commit tokens to source control, MCP config files, `.env` files, logs, or
67
+ chat transcripts.
68
+
69
+ ## Hosted discovery setup
70
+
71
+ Hosted setup uses the XMemo public discovery contracts. The CLI reads
72
+ secret-free discovery and onboarding status documents, then tells the user where
73
+ the API, MCP endpoint, docs, and any server-advertised onboarding links are.
74
+
75
+ ```bash
76
+ xmemo doctor
77
+ xmemo discovery show
78
+ xmemo setup
79
+ ```
80
+
81
+ Discovery requests do not send `XMEMO_KEY` or any Authorization
82
+ header. Token creation still happens in the website or enterprise console; the
83
+ public service discovery document does not return token values.
84
+
85
+ The hosted default service/base URL is `https://xmemo.dev`, so normal users do
86
+ not need to type a service address. The MCP endpoint is discovered from that
87
+ base URL and written as `https://xmemo.dev/mcp`; `https://mcp.xmemo.dev` is not
88
+ the current canonical setup URL. Use `--url <service-url>` or `XMEMO_URL` only
89
+ for private, enterprise, or self-hosted deployments. `MEMORY_OS_URL` remains
90
+ accepted as a compatibility alias.
91
+
92
+ Generate and write a client config from discovery:
93
+
94
+ ```bash
95
+ xmemo setup codex --yes
96
+ xmemo setup codex --url "https://your-private-service.example" --yes
97
+ xmemo setup --url "https://your-private-service.example" --client codex --write
98
+ xmemo setup --url "https://your-private-service.example" --client cursor --write
99
+ ```
100
+
101
+ `--write` requires an explicit `--client` so the CLI never performs broad config
102
+ writes implicitly. Generated config references `XMEMO_KEY`; it does not embed
103
+ the token value. Write-capable client configs also include stable non-secret
104
+ agent identity headers where the client format supports them.
105
+
106
+ `xmemo setup codex` is the recommended Codex path. Without `--yes` it
107
+ previews the Codex MCP config and the project-scoped `AGENTS.md` memory profile.
108
+ With `--yes`, it writes the Codex MCP config and installs the profile into the
109
+ current project's `AGENTS.md` marker block. Use `--profile-target <path>` to
110
+ choose a different project instruction file, or `--no-profile` to configure MCP
111
+ only.
112
+
113
+ ## MCP setup
114
+
115
+ List supported client generators:
116
+
117
+ ```bash
118
+ xmemo mcp list
119
+ ```
120
+
121
+ Current write-capable clients:
122
+
123
+ ```text
124
+ codex ~/.codex/config.toml
125
+ cursor ~/.cursor/mcp.json
126
+ ```
127
+
128
+ For clients without a verified user-scoped write path, generate a read-only
129
+ template and apply it manually after review:
130
+
131
+ ```bash
132
+ xmemo mcp config --client copilot-cli --base-url "https://your-private-service.example"
133
+ xmemo mcp config --client generic --base-url "https://your-private-service.example" --json
134
+ ```
135
+
136
+ Only Codex and Cursor currently have write-capable helpers. Other client writes
137
+ should only be added after their official user-scoped config format is verified.
138
+
139
+ ### Codex
140
+
141
+ Recommended Codex setup:
142
+
143
+ ```bash
144
+ xmemo setup codex
145
+ xmemo setup codex --yes
146
+ xmemo smoke --client codex
147
+ ```
148
+
149
+ `setup codex` is visible and opt-in: the first command previews the writes, and
150
+ `--yes` performs them. The MCP config stays in user-scoped Codex config, while
151
+ the XMemo Codex behavior profile is installed into the current project's
152
+ `AGENTS.md` between these markers:
153
+
154
+ ```html
155
+ <!-- memory-os:codex-profile:start -->
156
+ <!-- memory-os:codex-profile:end -->
157
+ ```
158
+
159
+ Repeat installs update only that marker block. Remove it with:
160
+
161
+ ```bash
162
+ xmemo profile uninstall codex
163
+ ```
164
+
165
+ Advanced: generate a Codex MCP config snippet without touching files:
166
+
167
+ ```bash
168
+ xmemo mcp add codex --url "$XMEMO_URL"
169
+ ```
170
+
171
+ Write it to the default Codex config path:
172
+
173
+ ```bash
174
+ xmemo mcp add codex --url "$XMEMO_URL" --write
175
+ ```
176
+
177
+ The generated config references `XMEMO_KEY` and does not include the token
178
+ value. Codex custom identity headers are not written until the CLI format is
179
+ verified to support them.
180
+
181
+ Codex MCP-depth checks:
182
+
183
+ ```bash
184
+ xmemo mcp profile codex
185
+ xmemo profile install codex --dry-run
186
+ xmemo profile install codex
187
+ xmemo profile status codex
188
+ xmemo smoke --client codex
189
+ ```
190
+
191
+ `xmemo mcp profile codex` prints the recommended memory behavior profile:
192
+ recall/search at the start of non-trivial tasks, write back high-signal
193
+ decisions and fixes, and never store secrets. `xmemo smoke --client codex`
194
+ checks the local Codex TOML config for the `memory_os` MCP server,
195
+ `bearer_token_env_var = "XMEMO_KEY"`, token presence in the environment, and
196
+ absence of embedded token values.
197
+
198
+ ### Cursor
199
+
200
+ Generate a Cursor MCP config snippet:
201
+
202
+ ```bash
203
+ xmemo mcp add cursor --url "$XMEMO_URL"
204
+ ```
205
+
206
+ Merge it into the default Cursor user config path:
207
+
208
+ ```bash
209
+ xmemo mcp add cursor --url "$XMEMO_URL" --write
210
+ ```
211
+
212
+ The CLI refuses to overwrite an existing `memory_os` MCP server entry. Edit the
213
+ config manually if you need to rotate the endpoint. Cursor configs include
214
+ `X-Memory-OS-Agent-ID` and `X-Memory-OS-Agent-Instance-ID`; the instance ID is
215
+ non-secret and stored under the user's XMemo CLI config directory.
216
+
217
+ ## Release model
218
+
219
+ This repository is the source for the `@xmemo/client` npm package. Releases
220
+ should be published from GitHub Actions on tags or GitHub Releases, not from a
221
+ developer workstation.
222
+
223
+ Recommended flow:
224
+
225
+ ```text
226
+ develop -> test -> tag/release -> GitHub Actions -> npm publish --provenance
227
+ ```
228
+
229
+ ## Package boundary
230
+
231
+ Included in npm:
232
+
233
+ ```text
234
+ bin/
235
+ src/
236
+ README.md
237
+ LICENSE
238
+ ```
239
+
240
+ Excluded from npm:
241
+
242
+ ```text
243
+ .github/
244
+ test/
245
+ coverage/
246
+ server code
247
+ database migrations
248
+ deployment files
249
+ logs
250
+ local state
251
+ secrets
252
+ ```
@@ -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.126",
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
+ }