kagura-memory 0.10.1 → 0.12.0
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 +648 -76
- package/dist/cli.js +6680 -2747
- package/dist/cli.js.map +1 -1
- package/dist/index.cjs +1004 -146
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +546 -36
- package/dist/index.d.ts +546 -36
- package/dist/index.js +1000 -146
- package/dist/index.js.map +1 -1
- package/dist-mcp/mcp.cjs +1851 -0
- package/package.json +8 -2
package/README.md
CHANGED
|
@@ -14,10 +14,15 @@ This SDK connects your TypeScript/JavaScript code to [Kagura Memory Cloud](https
|
|
|
14
14
|
| **`WorkspaceClient`** | REST API | Workspace member, invitation, and API key management |
|
|
15
15
|
| **`SecretClient`** | REST API | [Zero-knowledge secrets](#zero-knowledge-secrets) — age-encrypted on your machine, opaque to the server |
|
|
16
16
|
| **`AgentsClient`** | REST API | Agent bootstrap for API-key-only callers (no MCP session) |
|
|
17
|
+
| **`MemoryClient`** | REST API | [Tool guardrails](#tool-guardrails-over-rest-memory-cloud-v0740) for API-key-only callers — the `AGENTS.md` export digest and the guardrail set |
|
|
17
18
|
|
|
18
19
|
A `kagura-memory` command-line tool ships alongside it, mirroring the Python
|
|
19
20
|
CLI's `kagura` command — see [Command line](#command-line).
|
|
20
21
|
|
|
22
|
+
For Claude Desktop, the [MCPB extension](docs/mcpb.md) provides browser sign-in
|
|
23
|
+
and a refresh-aware connection without Python or a global CLI install. The npm
|
|
24
|
+
package also includes `kagura-memory-mcp`, a transparent stdio/HTTP proxy.
|
|
25
|
+
|
|
21
26
|
## Installation
|
|
22
27
|
|
|
23
28
|
```bash
|
|
@@ -32,8 +37,10 @@ unless you ask for it.
|
|
|
32
37
|
Targets memory-cloud **v0.75.0** (`MIN_SERVER_VERSION`).
|
|
33
38
|
`checkServerVersion()` warns, and never throws, on an older server, which
|
|
34
39
|
still answers: it ignores options it predates, leaves out fields it
|
|
35
|
-
predates, and reports a tool it predates as not found.
|
|
36
|
-
|
|
40
|
+
predates, and reports a tool it predates as not found. A pre-release of
|
|
41
|
+
the minimum (`0.75.0-rc1`) counts as older, and a version it cannot read
|
|
42
|
+
(`0.75`, `main-abc123`) gets no warning, as in the Python SDK. The method
|
|
43
|
+
notes below say which server version a feature needs.
|
|
37
44
|
|
|
38
45
|
## Quick Start
|
|
39
46
|
|
|
@@ -88,11 +95,52 @@ Four ways to authenticate, in resolution order:
|
|
|
88
95
|
}
|
|
89
96
|
```
|
|
90
97
|
|
|
98
|
+
Credentials travel over HTTPS only. Every client, `login()`, `auth login
|
|
99
|
+
--server` and the URL every `setup` subcommand puts in a harness entry
|
|
100
|
+
(`setup claude`, `setup codex`, `setup hermes` and `setup openclaw`)
|
|
101
|
+
refuse a plain-HTTP URL unless its host is `localhost`, `127.0.0.1` or
|
|
102
|
+
`[::1]`, and `doctor` fails a configured `mcp_url` like that. The URL is
|
|
103
|
+
read as `fetch` reads it, so the scheme in any case (`HTTP://`), without
|
|
104
|
+
its slashes (`http:host`), or with whitespace or control characters
|
|
105
|
+
around it or a tab or newline inside it is refused all the same, as in
|
|
106
|
+
the Python SDK.
|
|
107
|
+
|
|
91
108
|
### Command line
|
|
92
109
|
|
|
93
|
-
`kagura-memory` mirrors the Python CLI's `kagura` command
|
|
94
|
-
|
|
95
|
-
a usage error, 1 for a runtime
|
|
110
|
+
`kagura-memory` mirrors the Python CLI's `kagura` command: its subcommands
|
|
111
|
+
and flags take the Python CLI's names, and it prints the same JSON on
|
|
112
|
+
stdout and exits with the same codes (2 for a usage error, 1 for a runtime
|
|
113
|
+
failure). An option a command, a group or the root does not take is
|
|
114
|
+
refused in the words of click 8.3, the version the Python CLI's lockfile
|
|
115
|
+
pins: `Error: No such option: --x`, naming the option without any value
|
|
116
|
+
given in it, and for a long option close to one the command takes,
|
|
117
|
+
click's suggestion after it (`Did you mean --json?`, or `(Possible
|
|
118
|
+
options: --end, --period)` for more than one); click 8.4 and later write
|
|
119
|
+
`No such option '--x'.`. An option given no value is `Error: Option '-w'
|
|
120
|
+
requires an argument.`. Either error wins over `--help`, as click reads
|
|
121
|
+
the whole command line first, and only the first one is reported,
|
|
122
|
+
followed by the command's help (where click prints its usage line and a
|
|
123
|
+
`Try '… --help'` hint first). An unknown option does not win over
|
|
124
|
+
`--help` where the Python CLI passes such options on
|
|
125
|
+
(`ignore_unknown_options`: `secret exec`, and `measure record` for a
|
|
126
|
+
negative VALUE), so `secret exec --help --bogus` prints the help; without
|
|
127
|
+
`--help`, `secret exec` still refuses an unknown option before the child
|
|
128
|
+
command rather than running it as that command. The one command not
|
|
129
|
+
ported, the few options only this bin has, and the deliberate
|
|
130
|
+
differences are listed below.
|
|
131
|
+
|
|
132
|
+
Values are read as click reads them. A choice matches exactly, as click's
|
|
133
|
+
`Choice` does, except where the Python CLI declares one case-insensitive
|
|
134
|
+
(`--source-type`, `--progress`), casefolded as click folds it; a number
|
|
135
|
+
is read as Python's `int()` and `float()` read it, `1_000`, any decimal
|
|
136
|
+
digit (`١٢`, `12`) and the whitespace they skip included (a BOM is no
|
|
137
|
+
whitespace to them); an integer id argument (`TOKEN_ID`,
|
|
138
|
+
`INVITATION_ID`, `KEY_ID`) is sent exactly, however large; and an
|
|
139
|
+
out-of-range value is echoed as click converted it (`files upload
|
|
140
|
+
--importance 2` is refused as `2.0 is not in the range 0.0<=x<=1.0.`).
|
|
141
|
+
A failure prints `Error: <message>` on stderr, and a quota or plan
|
|
142
|
+
refusal adds the lines the Python CLI adds: ` Resets at: <time>`, in
|
|
143
|
+
Python's `isoformat()` form, and ` Required plan: <label> (<key>)`.
|
|
96
144
|
|
|
97
145
|
```bash
|
|
98
146
|
npx kagura-memory --help
|
|
@@ -100,22 +148,27 @@ npx kagura-memory --help
|
|
|
100
148
|
|
|
101
149
|
| Group | Commands |
|
|
102
150
|
|---|---|
|
|
103
|
-
| `auth` | `login` `logout` `refresh` `status` `use` `list` `token` |
|
|
151
|
+
| `auth` | `login` `logout` `refresh` `status` `use` `list` `token` `create-key` `list-keys` `revoke-key` |
|
|
104
152
|
| `context` | `list` `create` `update` `delete` `search-config` (plus the `contexts` alias) |
|
|
105
153
|
| memory | `remember` `recall` `reference` `forget` `update-memory` `explore` |
|
|
106
154
|
| `edge` | `list` `create` `update` `delete` |
|
|
107
155
|
| `sleep` | `history` `report` `rollback` |
|
|
156
|
+
| `measure` | `record` `series` |
|
|
108
157
|
| `files` | `upload` `list` `delete` `download-url` |
|
|
158
|
+
| `guardrails` | `load` `digest` |
|
|
109
159
|
| `resource` | `tokens {list,create,update,revoke}` `list` `setup` `schema` `stats` `indexer-status` `events` `ingest` `ingest-batch` `import` |
|
|
110
160
|
| `secret` | `keygen` `list` `put` `get` `grant` `revoke` `rotate` `delete` `pubkeys` `approve` `audit-verify` `exec` |
|
|
111
161
|
| `setup` | `claude` `codex` `hermes` `openclaw` |
|
|
162
|
+
| `workspace` | `member {list,add,set-role,remove}` `invite {create,list,revoke}` |
|
|
112
163
|
| other | `config show` `doctor` |
|
|
113
164
|
|
|
114
165
|
```bash
|
|
115
166
|
npx kagura-memory auth login --profile work --read-only
|
|
116
167
|
npx kagura-memory recall "OAuth setup" -c dev -k 10
|
|
168
|
+
npx kagura-memory recall "dependency injection" --no-rerank # skip reranking; no flag follows the context config (v0.69.0+)
|
|
117
169
|
npx kagura-memory remember -s "FastAPI DI" --content "Use Depends()" --tags "python,fastapi"
|
|
118
|
-
npx kagura-memory
|
|
170
|
+
npx kagura-memory measure record <context-id> weight_kg 71.5 --unit kg
|
|
171
|
+
npx kagura-memory setup codex --dry-run # show the command and the entry; change nothing
|
|
119
172
|
npx kagura-memory doctor
|
|
120
173
|
```
|
|
121
174
|
|
|
@@ -124,48 +177,218 @@ The context id comes from `-c/--context-id`, or from `context_id` in
|
|
|
124
177
|
shared with the Python CLI, so either tool can create a profile the other
|
|
125
178
|
then uses.
|
|
126
179
|
|
|
127
|
-
|
|
128
|
-
(
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
180
|
+
**`resource setup`** names the new context after the resource, or `-n/--name`
|
|
181
|
+
(lowercase letters, digits, `-` and `_`, at most 100), which a workspace
|
|
182
|
+
that already has a context of that name needs. It prints Python's six
|
|
183
|
+
fields, `context_id`, `context_name`, `resource_id`, `token`, `token_id`
|
|
184
|
+
and `warning` (null when the server sends none); the token is shown this
|
|
185
|
+
once. `--summary` is accepted and ignored, with a note on stderr, since
|
|
186
|
+
the server's `setup_resource` has no summary: the context's owner sets it
|
|
187
|
+
afterwards with `kagura-memory context update <context_id> --summary …`.
|
|
188
|
+
As in Python, `resource tokens revoke` prints `Token revoked.`, and
|
|
189
|
+
`resource schema` prints `No schema registered for this resource.` when
|
|
190
|
+
there is none.
|
|
191
|
+
|
|
192
|
+
**Files and imports.** The `files` commands take their workspace from the
|
|
193
|
+
credential's own source, as the Python CLI does (its #115): `-c` when
|
|
194
|
+
given, else the OAuth profile's workspace, else the `context_id` of the
|
|
195
|
+
`.kagura.json` that holds the key; a `KAGURA_API_KEY` key needs `-c`.
|
|
196
|
+
`files delete` prints `Deleted <file_id>` and `files download-url` the bare
|
|
197
|
+
URL. `files upload --remember` writes the memory the Python CLI writes
|
|
198
|
+
(`source_uri` the file's `file://` URI, `details` the file's id, sha256,
|
|
199
|
+
size and type). `resource import` detects the format by the file's
|
|
200
|
+
extension, so stdin needs `--format`, and reads CSV and JSON the way
|
|
201
|
+
Python's `csv` and `json` modules read them, with their error messages
|
|
202
|
+
(exit 1). A row keeps its keys in the order read, and a doc_id taken from
|
|
203
|
+
a number is Python's `str()` of it as written (`1234567890123456789`,
|
|
204
|
+
`10.0`, `1e+20`). A `NaN` or `Infinity` in the input fails the batch
|
|
205
|
+
holding it, as the Python CLI's request encoding does (`Out of range float
|
|
206
|
+
values are not JSON compliant: nan`), rather than being sent as `null`. A
|
|
207
|
+
doc_id outside 1-255 characters and a CSV row with more cells than the
|
|
208
|
+
header are refused before anything is sent, where the Python CLI stops
|
|
209
|
+
with a traceback. Two limits of JavaScript numbers remain: a number in the
|
|
210
|
+
payload is sent as JavaScript reads it, so an integer past 2^53 loses its
|
|
211
|
+
last digits and `10.0` is sent as `10`, where Python sends them as
|
|
212
|
+
written; and `-V` above 2^53 is refused as too large (exit 2), where
|
|
213
|
+
Python sends it.
|
|
214
|
+
|
|
215
|
+
**Progress.** `files upload` and `resource import` take `-v/--verbose`
|
|
216
|
+
(repeatable) and `--progress rich|json|none`. Progress goes to stderr, one
|
|
217
|
+
line per event, so stdout carries the same result either way.
|
|
218
|
+
`--progress json` writes the Python CLI's NDJSON,
|
|
219
|
+
`{"v": 1, "ts": …, "stage": …, "kind": …, "msg": …, "detail": …}`, whose
|
|
220
|
+
last event is the operation's single `success` or `error`; `-v`, or
|
|
221
|
+
`--progress rich`, writes the lines the Python CLI shows
|
|
222
|
+
(`→ Reserving upload report.pdf (1234 bytes)`, `✓ Upload complete`,
|
|
223
|
+
`✗ Upload failed: …`); `--progress none` is silent even with `-v`. Two
|
|
224
|
+
streams end more reliably than Python's: `files upload --remember`
|
|
225
|
+
reports success only once the linked memory is written (a failed write
|
|
226
|
+
ends the stream with that error), and `resource import` ends with an
|
|
227
|
+
error when the credential fails after its start event. A stderr closed
|
|
228
|
+
early (`2>&1 | head -1`) does not stop the upload or the import. Ctrl-C
|
|
229
|
+
ends the process without a final event.
|
|
230
|
+
|
|
231
|
+
**Connecting a harness.** Each `setup` subcommand sets up an MCP entry
|
|
232
|
+
named `kagura-memory`: the URL plus a Bearer header. The key is never
|
|
233
|
+
printed, and no harness CLI gets it on its command line.
|
|
234
|
+
|
|
235
|
+
`setup claude` also writes `.kagura.json` (0600, gitignored). Its key
|
|
236
|
+
comes from `--api-key`, else the `api_key` in the project's own
|
|
237
|
+
`.kagura.json` (the one in `--project-dir`), else `KAGURA_API_KEY`; the
|
|
238
|
+
URL likewise from `--mcp-url`, else that file's `mcp_url`, else
|
|
239
|
+
`KAGURA_MCP_URL`, an empty `--mcp-url` counting as none, as Python's `or`
|
|
240
|
+
reads it. It never takes them from `~/.kagura.json`, nor, with
|
|
241
|
+
`--project-dir`, from the current directory's `.kagura.json`: those are
|
|
242
|
+
another project's credentials. `.kagura.json` gets the URL as given; the
|
|
243
|
+
parameters that `--guardrails` and `--tool-profile` set go on the entry's
|
|
244
|
+
URL only. A plain-HTTP URL to a host other than localhost is refused,
|
|
245
|
+
whichever of the three it came from, before anything is written or run
|
|
246
|
+
(exit 1, `Connection failed: MCP URL must use HTTPS for security …`, the
|
|
247
|
+
Python CLI's words, whose connection test refuses it).
|
|
248
|
+
|
|
249
|
+
Without `--agents-md`, `setup codex`, `setup hermes` and `setup openclaw`
|
|
250
|
+
never see, write, print or pass the key, as in the Python CLI. The entry
|
|
251
|
+
names the environment variable the harness reads the key from, and the
|
|
252
|
+
notes say where to put it; a missing key is no error. These three write
|
|
253
|
+
no config file themselves: no `.kagura.json`, no `.gitignore` line, no
|
|
254
|
+
harness `.env`. The harness's own CLI writes the entry, or you add the
|
|
255
|
+
printed block. The one file they may write is the AGENTS.md export
|
|
256
|
+
(`--agents-md`, below), which is fetched with the usual credential: with
|
|
257
|
+
it, a missing credential stops setup (exit 1).
|
|
258
|
+
|
|
259
|
+
| Subcommand | How the entry is applied | Where the key goes |
|
|
137
260
|
|---|---|---|
|
|
138
|
-
| `setup claude` | `.mcp.json` (`--scope project`, the default), or `claude mcp add-json --scope user …` | in
|
|
139
|
-
| `setup codex` | `codex mcp add … --bearer-token-env-var KAGURA_API_KEY` | `KAGURA_API_KEY
|
|
140
|
-
| `setup hermes` | the `config.yaml` block is printed; `hermes mcp add`
|
|
141
|
-
| `setup openclaw` | `openclaw mcp add … --transport streamable-http --no-probe` | `$OPENCLAW_STATE_DIR/.env` (default `~/.openclaw/.env`),
|
|
261
|
+
| `setup claude` | `.mcp.json` (`--scope project`, the default), or `claude mcp add-json --scope user …` | `--scope project`: in `.mcp.json`; `--scope user`: `KAGURA_MCP_API_KEY`, exported where Claude Code starts |
|
|
262
|
+
| `setup codex` | `codex mcp add … --bearer-token-env-var KAGURA_API_KEY` | `export KAGURA_API_KEY=…` in the shell profile that starts Codex |
|
|
263
|
+
| `setup hermes` | the `config.yaml` block is printed; `hermes mcp add` is interactive, and this port never prompts | `MCP_KAGURA_MEMORY_API_KEY=…` (`MCP_<NAME>_API_KEY` with `--name`) in the `.env` beside `config.yaml`, added with an editor |
|
|
264
|
+
| `setup openclaw` | `openclaw mcp add … --transport streamable-http --no-probe`, or `openclaw mcp set` to replace an entry | `KAGURA_API_KEY=…` in `$OPENCLAW_STATE_DIR/.env` (default `~/.openclaw/.env`), added with an editor |
|
|
265
|
+
|
|
266
|
+
`--api-key-env VAR` renames `KAGURA_API_KEY` for Codex and OpenClaw
|
|
267
|
+
(an upper-case letter or `_`, then upper-case letters, digits or `_`).
|
|
268
|
+
Hermes names its variable itself, so `setup hermes` refuses the option
|
|
269
|
+
(exit 2). The entry goes into Codex's `$CODEX_HOME/config.toml` (default
|
|
270
|
+
`~/.codex/config.toml`), into Hermes's `config.yaml` in `$HERMES_HOME` or
|
|
271
|
+
else the active Hermes profile's directory (`~/.hermes/profiles/<name>`
|
|
272
|
+
when `~/.hermes/active_profile` names one, else `~/.hermes`), or into
|
|
273
|
+
OpenClaw's `$OPENCLAW_CONFIG_PATH` (default `openclaw.json` in the state
|
|
274
|
+
directory). The closing notes name the command that checks it:
|
|
275
|
+
`codex mcp get kagura-memory`, `hermes mcp test kagura-memory` or
|
|
276
|
+
`openclaw mcp doctor kagura-memory --probe`. `--mcp-url` defaults to the
|
|
277
|
+
configured `mcp_url`, then `https://memory.kagura-ai.com/mcp`. It is read
|
|
278
|
+
as a URL parser reads it, as in Python (python-sdk#279): whitespace and
|
|
279
|
+
control characters around it, and any tab or newline inside it, are
|
|
280
|
+
dropped before the checks, and the entry gets that URL. A plain `http://`
|
|
281
|
+
`--mcp-url` other than localhost, in any spelling, is a usage error
|
|
282
|
+
(exit 2), since the entry sends the key there with every request; so is
|
|
283
|
+
anything but an http(s) URL with a host (`--mcp-url=--help`,
|
|
284
|
+
`memory.kagura-ai.com/mcp`, `https://[::1/mcp`), which would go on the
|
|
285
|
+
harness's command line after `--url`. A configured `mcp_url` gets the same
|
|
286
|
+
checks, and exits 1 saying to pass `--mcp-url`. `$OPENCLAW_STATE_DIR`,
|
|
287
|
+
`$OPENCLAW_CONFIG_PATH` and `$OPENCLAW_WORKSPACE_DIR` are read as OpenClaw
|
|
288
|
+
reads them: stripped, with a leading `~` expanded.
|
|
142
289
|
|
|
143
290
|
This package has no TOML, YAML or JSON5 parser, so it never rewrites those
|
|
144
291
|
files. When the harness's CLI is not on `PATH`, the block is printed on
|
|
145
|
-
stderr with the file it belongs in
|
|
146
|
-
|
|
147
|
-
`
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
292
|
+
stderr with the file it belongs in, and stdout stays one JSON document.
|
|
293
|
+
When Hermes's `config.yaml` already has an `mcp_servers:` key, only the
|
|
294
|
+
`kagura-memory` entry is printed, to go under it: a second top-level
|
|
295
|
+
`mcp_servers:` would replace the first, and every server in it. An entry
|
|
296
|
+
of the same name, which setup finds by scanning the file, stops the run
|
|
297
|
+
(exit 1, nothing changed) unless you pass `--force`. For Codex that holds
|
|
298
|
+
always; for Hermes and OpenClaw only with their CLI on `PATH`, since the
|
|
299
|
+
Python CLI finds their entries only through it. Without the CLI, setup
|
|
300
|
+
prints the block to go in place of the old entry and exits 0. A
|
|
301
|
+
`config.toml` that cannot be read stops `setup codex` (exit 1), as in
|
|
302
|
+
Python. A Hermes `config.yaml` that cannot be read, or is not UTF-8,
|
|
303
|
+
stops nothing: setup prints the whole block with Python's note to put
|
|
304
|
+
only the entry under an `mcp_servers:` key the file may have. An OpenClaw
|
|
305
|
+
file that cannot be read stops nothing either, since Python never reads
|
|
306
|
+
it, and a note says setup could not look there.
|
|
151
307
|
On Windows, a CLI installed only as an npm `.cmd` shim counts as not
|
|
152
308
|
found: Node runs one only through a shell, which would re-parse the
|
|
153
309
|
arguments.
|
|
154
310
|
|
|
155
|
-
`--
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
the
|
|
161
|
-
|
|
311
|
+
With `--scope user`, the Claude Code entry does not hold the key: it
|
|
312
|
+
sends `Authorization: Bearer ${KAGURA_MCP_API_KEY}`, which Claude Code
|
|
313
|
+
fills in from its own environment each time it connects. The key is never
|
|
314
|
+
on the `claude mcp add-json` command line, where any local user could read
|
|
315
|
+
it in the process list, and never in `~/.claude.json`. Set the variable in
|
|
316
|
+
the environment that starts Claude Code, e.g. `export
|
|
317
|
+
KAGURA_MCP_API_KEY=kagura_xxx` in your shell profile; setup says whether
|
|
318
|
+
the current shell has it, and `doctor` warns when it is unset. It is a
|
|
319
|
+
separate variable from `KAGURA_API_KEY`, which the SDK ranks above
|
|
320
|
+
`.kagura.json` and OAuth profiles for every command. The entry is the one
|
|
321
|
+
the Python CLI writes, so a run of either CLI finds the other's entry up
|
|
322
|
+
to date. `--scope project` still writes the key into `.mcp.json`, so keep
|
|
323
|
+
that file out of version control (setup adds it to `.gitignore`). A
|
|
324
|
+
user-scope entry this CLI wrote before 0.11.0 still holds the key in
|
|
325
|
+
`~/.claude.json`: re-run `setup claude --scope user` with
|
|
326
|
+
`KAGURA_MCP_API_KEY` exported to replace it (`doctor` warns about one).
|
|
327
|
+
|
|
328
|
+
`--guardrails <context-id|off>` (memory-cloud v0.74.0+) sets the URL's
|
|
329
|
+
`guardrails` parameter on `setup claude` and `setup codex`. On `setup
|
|
330
|
+
codex`, when neither the flag nor the MCP URL (`--mcp-url` or the
|
|
331
|
+
configured `mcp_url`) sets one, it defaults to `off` while the Kagura
|
|
332
|
+
plugin's Codex hooks are on for the entry (their `config.json` names its
|
|
333
|
+
table in `mcp_server`, `kagura-memory` by default), and otherwise to
|
|
334
|
+
`-c`. With a context there, the notes give the `kagura-memory guardrails
|
|
335
|
+
digest … --target instructions` command, which previews what Codex
|
|
336
|
+
receives. Hermes and OpenClaw do not read the server's instructions.
|
|
337
|
+
There `--guardrails off` is refused (exit 2), and a context id is not
|
|
338
|
+
written, whether it comes from the flag or from the URL: one warning
|
|
339
|
+
names what was dropped. A first `?guardrails=off` in the URL, the value
|
|
340
|
+
the server reads, is kept, alone and with a warning of its own. Names
|
|
341
|
+
compare decoded, as the server reads them (`guard%72ails` is
|
|
342
|
+
`guardrails`). All of this is as in Python. `--tool-profile` (claude,
|
|
343
|
+
codex; memory-cloud v0.73.0+) sets `profile` and refuses an empty name.
|
|
344
|
+
The server knows
|
|
345
|
+
`full` and `core` (case-sensitive) and fails `tools/list` for any other
|
|
346
|
+
name, which leaves the harness with no Kagura tools. It applies a
|
|
347
|
+
`?tools=` allowlist already on the URL instead, so that case gets a
|
|
348
|
+
warning. Both go at the end of the query, `guardrails`
|
|
162
349
|
first, replacing any value already there, as the Python CLI writes them.
|
|
163
350
|
A `setup claude` run that leaves out a `guardrails` or `profile` value
|
|
164
351
|
the entry it replaces had says so in a note. `--name`, `--force` and
|
|
165
352
|
`--dry-run` (codex, hermes, openclaw) name the entry, replace an existing
|
|
166
|
-
one, and show
|
|
167
|
-
|
|
168
|
-
`openclaw`, which would read
|
|
353
|
+
one, and show the command or block without changing anything. A name is
|
|
354
|
+
1-64 letters, digits, `-` or `_`, starting with a letter or digit, as in
|
|
355
|
+
Python: it is a bare argument to `codex` and `openclaw`, which would read
|
|
356
|
+
`--help` as an option. Their `--context-id` must be a context UUID
|
|
357
|
+
(exit 2 otherwise, a padded or empty one included), as in Python without
|
|
358
|
+
`--profile`: this port lists no contexts.
|
|
359
|
+
|
|
360
|
+
**The AGENTS.md export.** `--agents-md [PATH]` on `setup codex`, `setup
|
|
361
|
+
hermes` and `setup openclaw` (memory-cloud v0.74.0+) fetches the
|
|
362
|
+
context's tool guardrail export block (`MemoryClient.getGuardrailDigest`)
|
|
363
|
+
and splices it into a file the harness loads every session, between its
|
|
364
|
+
`kagura-memory:guardrails` marker lines: an earlier block is replaced in
|
|
365
|
+
place, an unchanged set rewrites nothing, and the rest of the file is
|
|
366
|
+
kept, line endings and a symlink included. Without PATH the file is the
|
|
367
|
+
harness's own: `$CODEX_HOME/AGENTS.md` (`AGENTS.override.md` when that
|
|
368
|
+
exists); for Hermes the first of `.hermes.md`, `HERMES.md`,
|
|
369
|
+
`AGENTS.override.md`, `AGENTS.md` and `CLAUDE.md` in the current
|
|
370
|
+
directory, else `AGENTS.md`; for OpenClaw `AGENTS.md` in its workspace,
|
|
371
|
+
`$OPENCLAW_WORKSPACE_DIR`, else `workspace/` in the state directory. A
|
|
372
|
+
leading `~` or `~/` in PATH is expanded to your home directory (a
|
|
373
|
+
`~user` is left as written; see below), and missing directories are
|
|
374
|
+
created. The context is `--context-id`, else a `--guardrails` context
|
|
375
|
+
UUID, never the
|
|
376
|
+
URL's `?guardrails=` or `.kagura.json`; without one, `--agents-md` is a
|
|
377
|
+
usage error (exit 2). The block is fetched on the usual credential chain
|
|
378
|
+
(`KAGURA_API_KEY`, the OAuth profile, `.kagura.json`), which setup
|
|
379
|
+
settles before it runs anything, a dry run included: no credential, or
|
|
380
|
+
one for another server than the entry's, stops setup (exit 1) with
|
|
381
|
+
nothing run. The export comes after the entry is applied or printed.
|
|
382
|
+
`wrote` lists the file, and the notes carry Python's lines: the refresh
|
|
383
|
+
command (`kagura-memory guardrails digest <ctx> --out <file>`), a warning
|
|
384
|
+
past the 32 KiB Codex reads or the 20,000 characters OpenClaw reads, and
|
|
385
|
+
Hermes's prompt-injection note. An empty digest writes nothing and says
|
|
386
|
+
so; setup never removes a block, which `guardrails digest --out` does. A
|
|
387
|
+
failed export prints the report, then the error (exit 1). `--dry-run`
|
|
388
|
+
names what the export would do to the file (create it, append the block,
|
|
389
|
+
replace the block, or update a file it cannot read). On Hermes and
|
|
390
|
+
OpenClaw a run without the export ends with Python's "Re-run with
|
|
391
|
+
--agents-md --context-id <id> …" hint.
|
|
169
392
|
|
|
170
393
|
Claude Code uses the `kagura-memory` entry from the strongest scope
|
|
171
394
|
(local > project > user). It keys local scope by the git repository root
|
|
@@ -176,26 +399,63 @@ any parent; `setup claude` and `doctor` read them the same way.
|
|
|
176
399
|
and prints the `claude mcp remove --scope …` command for it, after a `cd`
|
|
177
400
|
into the directory that command must run in when that is not the current
|
|
178
401
|
one. An entry the new one hides, in a weaker scope or in a parent's
|
|
179
|
-
`.mcp.json`, is noted.
|
|
402
|
+
`.mcp.json`, is noted. Messages name `~/.claude.json` by the file actually
|
|
403
|
+
read: `$CLAUDE_CONFIG_DIR/.claude.json` when that is set.
|
|
180
404
|
With `--scope user`, an identical user-scope entry is left as it is and a
|
|
181
405
|
different one is replaced: `claude mcp remove` runs before `claude mcp
|
|
182
|
-
add-json`, and if the add then fails, the old entry is put back
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
406
|
+
add-json`, and if the add then fails, the old entry is put back. An old
|
|
407
|
+
entry that holds a key (as this CLI wrote before 0.11.0) is never put
|
|
408
|
+
back, since that would pass the key on a command line; when it is not put
|
|
409
|
+
back, or putting it back fails, setup prints the command that re-adds it,
|
|
410
|
+
the key masked as `<your-api-key>`.
|
|
411
|
+
Without `claude` on `PATH`, `--scope user` prints the commands to run, and
|
|
412
|
+
where to set `KAGURA_MCP_API_KEY`, and writes nothing, unless the
|
|
413
|
+
user-scope entry is already identical. When `claude plugin list --json`
|
|
414
|
+
shows the Kagura Memory plugin enabled, the notes list the plugin settings
|
|
415
|
+
to enter, and say that the plugin has one guardrail context for every
|
|
416
|
+
project and authenticates only with a user API key. `setup claude` writes
|
|
417
|
+
`.kagura.json` and the MCP entry only; it installs none of the Python
|
|
418
|
+
CLI's hooks or `/kagura-recall` and `/kagura-remember` commands. Their
|
|
419
|
+
flags (`--[no-]session-hook`, `--[no-]sync-hook`, `--[no-]commands`) and
|
|
420
|
+
`--no-auto-context` are accepted, so a script written for the Python CLI
|
|
421
|
+
still runs, and change nothing. `doctor` reports the entry Claude Code
|
|
422
|
+
uses in the current directory, with its scope and file, and warns about
|
|
423
|
+
each entry that one hides. It also warns when a header of that entry
|
|
424
|
+
sends a `${VAR}` that is unset in the current environment, or when that
|
|
425
|
+
entry is in user or local scope and holds the key itself, in
|
|
426
|
+
`~/.claude.json`, saying how to replace it; and for a
|
|
427
|
+
`kagura-mcp` stdio entry (the Python CLI's `--profile` form) checks that
|
|
428
|
+
`kagura-mcp` is on `PATH`. For a `type: "url"` entry, which earlier
|
|
429
|
+
releases wrote and Claude Code skips, it names the fix for the entry's
|
|
430
|
+
scope.
|
|
192
431
|
|
|
193
432
|
**Not ported.** `kagura ingest` needs the text-extraction pipeline (PDF,
|
|
194
|
-
Office, EPUB, audio)
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
433
|
+
Office, EPUB, audio), which does not exist in this package and would cost
|
|
434
|
+
the zero-dependency promise; use the Python CLI for it. The Claude Code
|
|
435
|
+
extras of `kagura setup claude` are not ported either: its SessionStart
|
|
436
|
+
and PostToolUse hooks and its `/kagura-recall` and `/kagura-remember`
|
|
437
|
+
commands. `setup claude` here writes `.kagura.json` and the MCP entry
|
|
438
|
+
only, and takes their flags as inert (see above). Every other command of
|
|
439
|
+
the Python CLI is here as of 0.12.0
|
|
440
|
+
([#57](https://github.com/kagura-ai/kagura-memory-typescript-sdk/issues/57)),
|
|
441
|
+
with the differences in options and output this section lists.
|
|
442
|
+
|
|
443
|
+
**Only in this bin.** `secret keygen --reveal`: keygen prints the private
|
|
444
|
+
key (see key custody below) and refuses to print it to a terminal without
|
|
445
|
+
`--reveal`. `-c` is short for `--context-id` on every `setup` subcommand.
|
|
446
|
+
`setup codex` also takes `--tool-profile`, which the Python CLI has only on
|
|
447
|
+
`setup claude`. `auth refresh --no-browser`: a refresh that widens
|
|
448
|
+
`--scope` re-runs the device flow here too, and this skips opening the
|
|
449
|
+
browser, as on `auth login`; Python's `auth refresh` takes only
|
|
450
|
+
`--profile` and `--scope`. `-h` is short for `--help` everywhere, where
|
|
451
|
+
the Python CLI takes only `--help`. `setup codex`, `setup hermes` and
|
|
452
|
+
`setup openclaw` still
|
|
453
|
+
accept `--api-key` and `--project-dir`, which they took before 0.11.0, so
|
|
454
|
+
older scripts still run. Neither does anything now, and a note says so.
|
|
455
|
+
`--api-key` beside `--profile` is still the usage error (exit 2) it was,
|
|
456
|
+
with `--url-form` too.
|
|
457
|
+
|
|
458
|
+
**Five deliberate divergences.**
|
|
199
459
|
|
|
200
460
|
- `secret` needs the optional `age-encryption` peer (`npm install
|
|
201
461
|
age-encryption`), exactly as Python's `[secret]` extra works. Key
|
|
@@ -205,18 +465,134 @@ promise. Use the Python CLI for those.
|
|
|
205
465
|
closed when neither is set. **A key custodied by the Python CLI is not
|
|
206
466
|
readable here, and vice versa.**
|
|
207
467
|
- `setup … --profile` (the OAuth path) writes an entry that launches
|
|
208
|
-
Python's `kagura-mcp` stdio proxy, which this package does not install
|
|
209
|
-
|
|
210
|
-
|
|
468
|
+
Python's `kagura-mcp` stdio proxy, which this package does not install.
|
|
469
|
+
Every `setup` subcommand reports the fact, and names the Python CLI's
|
|
470
|
+
`kagura setup <harness> --profile` command, instead of writing a config
|
|
471
|
+
that would fail at launch. The `--api-key` path of `setup claude` works
|
|
472
|
+
here, and so does the URL form of the other three. With `--url-form`,
|
|
473
|
+
those three ignore `--profile`, with a note: the Python CLI uses it
|
|
474
|
+
there to check the login, list contexts and fetch the `AGENTS.md`
|
|
475
|
+
export with that profile alone. This port lists nothing and checks no
|
|
476
|
+
login, and fetches the export on the usual credential chain, where
|
|
477
|
+
`KAGURA_PROFILE` picks a profile.
|
|
211
478
|
- `config show` does not reproduce Python's key mask
|
|
212
479
|
(`key[:8] + "..." + key[-4:]`), whose halves overlap below 12 characters
|
|
213
480
|
and print the whole secret twice.
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
481
|
+
- `--progress rich`, and `-v` without `--progress`, print the Python CLI's
|
|
482
|
+
`→` / `✓` / `✗` lines as plain text, the text Rich writes when stderr is
|
|
483
|
+
not a terminal: no colours even on a terminal, no wrapping at its width,
|
|
484
|
+
and no Rich markup, so `report[bold].pdf` prints as written (Rich drops
|
|
485
|
+
the `[bold]`, and a `[/…]` in an error message makes it fail). `-vv` and
|
|
486
|
+
`-vvv` show one line per detail or debug event, where Rich draws a panel;
|
|
487
|
+
neither command emits one. `--progress json` is the same NDJSON.
|
|
488
|
+
- With no `.kagura.json`, the MCP-backed commands (`recall`, `guardrails
|
|
489
|
+
load`, `measure`, …) and `doctor` reach an OAuth profile's own server.
|
|
490
|
+
The Python CLI takes the default URL its config loader fills in for the
|
|
491
|
+
server, and sends the profile's token there. A `KAGURA_API_KEY` goes to
|
|
492
|
+
`KAGURA_MCP_URL`, else the default, in both.
|
|
493
|
+
|
|
494
|
+
**`setup codex`, `setup hermes` and `setup openclaw`** also differ from
|
|
495
|
+
the Python CLI in these ways, each on purpose:
|
|
496
|
+
|
|
497
|
+
- Every entry here is the URL form, so `--url-form` is accepted and
|
|
498
|
+
changes nothing, and `--mcp-url` falls back to the configured URL where
|
|
499
|
+
Python requires it. Only that fallback needs the configuration: without
|
|
500
|
+
`--mcp-url`, a `.kagura.json` that cannot be loaded stops setup (exit 1);
|
|
501
|
+
with it, setup goes on with a note, as Python never reads that file.
|
|
502
|
+
- `-c` must be a context UUID with `--url-form --profile` too (exit 2),
|
|
503
|
+
where Python looks a name up through the profile.
|
|
504
|
+
- `setup hermes` never runs `hermes mcp add`, which prompts; it prints the
|
|
505
|
+
block, as Python does under `-y`.
|
|
506
|
+
- An existing entry is found by scanning the file, and not described by
|
|
507
|
+
kind. A readable but malformed `config.toml` does not stop
|
|
508
|
+
`setup codex`.
|
|
509
|
+
- On Codex, a `?guardrails=` already in the MCP URL (`--mcp-url` or the
|
|
510
|
+
configured `mcp_url`) beats the hooks and `-c` defaults.
|
|
511
|
+
- Nothing prompts, so `--agents-md` always needs a context, and the
|
|
512
|
+
export is never offered: a dry run of Hermes or OpenClaw says "not
|
|
513
|
+
offered: this port never prompts" (or "not offered with -y").
|
|
514
|
+
- When the entry was only printed (always for Hermes), a failed export
|
|
515
|
+
says "The MCP entry is printed for you to add", where Python says it is
|
|
516
|
+
set up. When the export credential is for another server, the message
|
|
517
|
+
says what moves it here, where Python's points at `--profile`: for
|
|
518
|
+
`KAGURA_API_KEY`, which outranks every profile, `KAGURA_MCP_URL` or
|
|
519
|
+
unsetting the key; otherwise `KAGURA_PROFILE`.
|
|
520
|
+
- `--agents-md=VALUE` takes VALUE literally even when it begins with a
|
|
521
|
+
dash, where click reads `--agents-md=-y` as the default file plus `-y`.
|
|
522
|
+
- The Codex size warning counts the bytes on disk, CRLFs included, where
|
|
523
|
+
Python counts the text with its line endings folded.
|
|
524
|
+
- A `~user` in an `OPENCLAW_*` variable or in `--agents-md PATH` is left
|
|
525
|
+
as written (`--agents-md '~root/x.md'` names `~root/x.md` in the
|
|
526
|
+
current directory), where Python looks the user up (`/root/x.md`) and
|
|
527
|
+
fails the whole setup for an unknown one. File errors of the export are
|
|
528
|
+
Node's words, not Python's `[Errno …]`.
|
|
529
|
+
- Output is one JSON document on stdout, with Python's sentences in
|
|
530
|
+
`notes` and the block on stderr. A non-ASCII URL is written as UTF-8
|
|
531
|
+
where Python writes `\uXXXX` escapes; both are valid.
|
|
532
|
+
|
|
533
|
+
Some small divergences run the other way: this CLI refuses what click
|
|
534
|
+
would accept.
|
|
535
|
+
|
|
536
|
+
- `--profile=` and `--scope=` reject an explicitly empty value. An empty
|
|
537
|
+
profile name would create a nameless profile and an empty scope would go
|
|
538
|
+
to the server verbatim. Other options take `--flag=` as Python does,
|
|
539
|
+
apart from `--external-id=` in the `update-memory` case below.
|
|
540
|
+
- `context update --lock --unlock` is a usage error (exit 2, "mutually
|
|
541
|
+
exclusive; pick one"), where click takes whichever flag comes last.
|
|
542
|
+
- `setup … --agents-md=' '` (a path of only whitespace) is a usage error
|
|
543
|
+
(exit 2), where Python writes a file named `" "`.
|
|
544
|
+
- `--rerank --no-rerank` is the same usage error, on `recall` and on
|
|
545
|
+
`context search-config`.
|
|
546
|
+
- `auth logout --all --profile NAME` is the same usage error, where click
|
|
547
|
+
ignores `--profile` and logs out every profile.
|
|
548
|
+
- `update-memory --dismiss-supersede-candidate` exits 1 beside any
|
|
549
|
+
`--external-id`, before anything is sent. The Python CLI refuses only a
|
|
550
|
+
non-empty one, and sends an empty `--external-id=` to the server; this
|
|
551
|
+
CLI refuses that too, as `updateMemory` does.
|
|
552
|
+
- `-k=5` (a short option, `=`, a value) reads `5`, where click reads `=5`
|
|
553
|
+
as the value and then refuses it.
|
|
554
|
+
- A float range such as `files upload --importance` refuses `nan`, which
|
|
555
|
+
click's `FloatRange` lets through (every comparison with NaN is false).
|
|
556
|
+
- An option that takes a value does not take a following argument that
|
|
557
|
+
begins with a dash and is not a number (a lone `-` is still a value):
|
|
558
|
+
`--name-contains -auth` is a missing value here (`Error: Option
|
|
559
|
+
'--name-contains' requires an argument.`), where click takes `-auth`.
|
|
560
|
+
Write `--name-contains=-auth`. A number is anything `float()` reads,
|
|
561
|
+
so `-١` is one. `auth login --invite` is the exception, since an invite
|
|
562
|
+
token may begin with a dash.
|
|
563
|
+
- `guardrails digest --out ''` is a usage error (exit 2). Click takes the
|
|
564
|
+
empty path as the current directory, and the Python CLI then fails to
|
|
565
|
+
write to it (exit 1).
|
|
566
|
+
|
|
567
|
+
**`guardrails load` and `guardrails digest`** (memory-cloud v0.74.0+)
|
|
568
|
+
take the context as an optional argument, else `context_id` from
|
|
569
|
+
`.kagura.json`. `load` calls the MCP `load_guardrails` tool and prints the
|
|
570
|
+
set as the Python CLI prints it: the model's fifteen keys in its order,
|
|
571
|
+
without the `context_display_name`, `context_is_private` and
|
|
572
|
+
`context_is_locked` the tool adds, each item's eleven keys, and `null` for
|
|
573
|
+
a `tool_trigger` the Python SDK cannot read (`match: null` is filled in
|
|
574
|
+
when a trigger has none). A set missing a required field, a truncation
|
|
575
|
+
flag above all, is refused with the Python SDK's `KaguraResponseError`
|
|
576
|
+
text (exit 1) rather than printed as complete. `--cap` takes 1-1000.
|
|
577
|
+
`digest` reads the REST digest route with the credential chain (an API
|
|
578
|
+
key or an OAuth profile) and prints the text: the `AGENTS.md` export
|
|
579
|
+
block, or with `--target instructions` the MCP server instructions this
|
|
580
|
+
credential would receive, where `--profile` and `--tools` repeat an MCP
|
|
581
|
+
URL's `?profile=` and `?tools=`. A context with no tool guardrails prints
|
|
582
|
+
nothing, and says so on stderr. With `--out FILE`, it splices the block
|
|
583
|
+
into FILE between its marker lines: an earlier block is replaced in place,
|
|
584
|
+
an unchanged set rewrites nothing, and an empty set removes an earlier
|
|
585
|
+
block. It then prints one JSON line, `{"path": …, "status":
|
|
586
|
+
"written"|"unchanged"|"removed", "tool_triggered_version": …}`, with the
|
|
587
|
+
path as Python's `pathlib` writes it (`./x/../X.md` reads `x/../X.md`).
|
|
588
|
+
As in Python, `--out` does not expand `~`, never creates a missing parent
|
|
589
|
+
directory, and keeps a symlink, the file's mode and its line endings.
|
|
590
|
+
Beside JSON's `1` for Python's `1.0` (an `importance`), two differences
|
|
591
|
+
remain: an item's `created_at` / `updated_at` is printed as
|
|
592
|
+
the server sent it, where Python reformats it and refuses one it cannot
|
|
593
|
+
parse; and a failed read or write of the `--out` file reads in Node's
|
|
594
|
+
words (`ENOENT: no such file or directory, open '…'`) rather than
|
|
595
|
+
Python's (`[Errno 2] No such file or directory: '…'`).
|
|
220
596
|
|
|
221
597
|
**Sign-in rate limit.** memory-cloud v0.76.0 and later limit device sign-in
|
|
222
598
|
requests per client address. When the server refuses one with HTTP 429,
|
|
@@ -226,6 +602,87 @@ server's reason, when it gives one, on the next line.
|
|
|
226
602
|
`login()` and `authorizeDevice` throw the same message as a
|
|
227
603
|
`KaguraAuthError`.
|
|
228
604
|
|
|
605
|
+
**`auth` subcommands.** Each takes only the options it reads, as in the
|
|
606
|
+
Python CLI: any other is refused with click's `Error: No such option: --x`
|
|
607
|
+
(exit 2), except `--invite`, which every subcommand but `login` refuses
|
|
608
|
+
with `--invite applies only to 'auth login'.` (exit 2, where click says
|
|
609
|
+
`No such option: --invite`), with a value or without and before
|
|
610
|
+
`--help`, as click's error would be, so that a token beginning with a
|
|
611
|
+
dash is not read as options. `--help` lists only a subcommand's own
|
|
612
|
+
options. `auth status` ends with the `kagura-memory` entry Claude Code uses in the
|
|
613
|
+
current directory and each entry it hides, in the Python CLI's words
|
|
614
|
+
(nothing when no scope defines one). `auth list --json` emits Python's fields per profile (`profile`,
|
|
615
|
+
`default`, `user_email`, `workspace_name`, `workspace_id`, `server`,
|
|
616
|
+
`scope`, `expired`, `refreshable`, `expires_at`), never a token, and `[]`
|
|
617
|
+
when there is none, with non-ASCII escaped as `\uXXXX`, as Python's
|
|
618
|
+
`json.dumps` default writes it. `auth list` and `auth status` without
|
|
619
|
+
profiles exit 1. `auth logout`
|
|
620
|
+
revokes the access
|
|
621
|
+
token on the server before it deletes the profile, best effort: the
|
|
622
|
+
profile is deleted even when that fails, with Python's warning (with
|
|
623
|
+
`--all`, silently, as in Python). It notes when `KAGURA_API_KEY` is still
|
|
624
|
+
set. Unlike the Python CLI, it asks before removing anything unless
|
|
625
|
+
`--yes` (`-y`) is given, rather than refusing `--all` without it; a
|
|
626
|
+
logout that names no profile succeeds when nothing is stored, so
|
|
627
|
+
`logout --yes` stays idempotent in setup scripts; and `--all` with
|
|
628
|
+
`--profile` is a usage error (exit 2), where Python ignores `--profile`
|
|
629
|
+
and removes every profile. `auth login` with both `--read-only` and
|
|
630
|
+
`--scope` exits 1, as Python does. `auth use NAME` prints Python's line,
|
|
631
|
+
`Default profile set to '<name>' (workspace '<workspace>').`, and a note
|
|
632
|
+
when `KAGURA_PROFILE` is set and still overrides the new default; an
|
|
633
|
+
unknown name exits 1 and lists the stored profiles, and a missing or
|
|
634
|
+
extra argument is a usage error (exit 2).
|
|
635
|
+
|
|
636
|
+
**`workspace` and the `auth` key commands** (memory-cloud v0.42.0+)
|
|
637
|
+
manage a workspace's members, invitations and member API keys:
|
|
638
|
+
`workspace member list|add|set-role|remove`, `workspace invite
|
|
639
|
+
create|list|revoke`, and `auth create-key|list-keys|revoke-key`, which
|
|
640
|
+
mint, list and revoke a key for another member. The server takes only
|
|
641
|
+
the workspace owner's static API key here; an OAuth profile gets an
|
|
642
|
+
access-denied error that says so. As in the Python CLI, the workspace
|
|
643
|
+
comes from the same source as the key
|
|
644
|
+
([#115](https://github.com/kagura-ai/kagura-memory-python-sdk/issues/115)):
|
|
645
|
+
`-w/--workspace` when given, else the OAuth profile's workspace, else
|
|
646
|
+
`context_id` in the `.kagura.json` that holds the key. A `KAGURA_API_KEY`
|
|
647
|
+
key needs `-w`, since nothing binds it to a workspace:
|
|
648
|
+
`KAGURA_API_KEY=<owner key> kagura-memory workspace member list -w
|
|
649
|
+
<workspace-uuid>`. An empty or `auto` `-w` is refused (exit 1) rather
|
|
650
|
+
than falling back to the source's workspace. `member remove` and `auth
|
|
651
|
+
revoke-key` ask first, naming the workspace, unless `--yes` (`-y`).
|
|
652
|
+
`create-key` prints the key, and `invite create` the invitation URL,
|
|
653
|
+
once on stdout, after a warning on stderr. `list-keys` and `invite list`
|
|
654
|
+
never show either; their `--json`, like `member list --json`, prints
|
|
655
|
+
the Python model's fields in its order, `null` or `false` for what the
|
|
656
|
+
server left out, and drops any other. A record the model refuses (a
|
|
657
|
+
required field missing, a scalar, list or mapping of the wrong type)
|
|
658
|
+
exits 1 with its `KaguraResponseError` text; timestamps are printed as
|
|
659
|
+
the server wrote them. `--role` matches exactly, as
|
|
660
|
+
click's `Choice` does (`Admin` is refused). Four things differ from the
|
|
661
|
+
Python CLI, each on purpose: a workspace that is not a UUID is refused
|
|
662
|
+
before `member remove` or `revoke-key` asks, where Python asks first;
|
|
663
|
+
each `invite create -c` must be a context UUID (exit 1, `context_id must
|
|
664
|
+
be a UUID, got '…'`), where Python sends it as typed and the server
|
|
665
|
+
answers `HTTP 500`; a user id of `.` or `..` (`USER_ID` or `--user`) is
|
|
666
|
+
refused (exit 2) before anything is asked or sent, where Python sends it
|
|
667
|
+
and URL resolution turns `member remove ..` into a `DELETE` of the
|
|
668
|
+
workspace's own URL; and an invitation with no email prints `-`, as
|
|
669
|
+
`invite list` does, where Python prints `None`.
|
|
670
|
+
|
|
671
|
+
**`measure record` and `measure series`** take the context as their
|
|
672
|
+
first argument, never from `.kagura.json`: an observation recorded in the
|
|
673
|
+
wrong context cannot be deleted. As in the Python CLI, a negative VALUE
|
|
674
|
+
needs no `--` (`measure record <context-id> pnl_usd -120`). The price is
|
|
675
|
+
that `record` reads any option it does not declare as an argument: after
|
|
676
|
+
VALUE it is an extra argument, and in the CONTEXT_ID or METRIC slot it is
|
|
677
|
+
refused as `No such option: <token>`, even after `--`, as the Python CLI
|
|
678
|
+
refuses it. These errors name a `--name=value` token `--name`, as every
|
|
679
|
+
other command does, where click prints the whole token: the value may be
|
|
680
|
+
a key. `--period` and `--agg` match exactly (`Week` is refused).
|
|
681
|
+
When both are bad, the error names `--period`, where click names
|
|
682
|
+
whichever comes first. The result prints as the Python CLI prints the
|
|
683
|
+
model: its keys in its order, and `unit` `null` when there is none. A
|
|
684
|
+
whole-number float prints without its `.0` (`72` for `72.0`).
|
|
685
|
+
|
|
229
686
|
#### Signing up with an invite
|
|
230
687
|
|
|
231
688
|
On a deployment that admits new accounts only by beta invite, pass the
|
|
@@ -243,7 +700,8 @@ the server how to present the invite (`GET /api/v1/system/info`, which
|
|
|
243
700
|
takes no credentials, allowed 5 seconds):
|
|
244
701
|
|
|
245
702
|
- **The server supports the hand-off** (memory-cloud 0.76.0 or later,
|
|
246
|
-
`v0.76.0` and build suffixes included
|
|
703
|
+
`v0.76.0` and build suffixes included; a pre-release of 0.76.0 such as
|
|
704
|
+
`0.76.0-rc1` comes before it, as in the Python CLI): one link,
|
|
247
705
|
`<frontend>/join/<token>?return_to=%2Fdevice%3Fuser_code%3D<code>`, that
|
|
248
706
|
signs up with the invite and lands on the approval page with the code
|
|
249
707
|
filled in. The browser opens that link. Below it, "If you land on the
|
|
@@ -253,7 +711,9 @@ takes no credentials, allowed 5 seconds):
|
|
|
253
711
|
order. The plain `/join/<token>` link, which the browser opens, then the
|
|
254
712
|
approval URL, and how long the code stays valid.
|
|
255
713
|
- **The server does not take invites** (a `features` object without
|
|
256
|
-
`beta_invites: true
|
|
714
|
+
`beta_invites: true`: invites are turned off, or the server is older than
|
|
715
|
+
memory-cloud 0.70.0, which has no `/join`): a one-line note, then the
|
|
716
|
+
ordinary prompt. A body
|
|
257
717
|
with no `features` object says nothing about invites, so the version
|
|
258
718
|
decides.
|
|
259
719
|
|
|
@@ -420,8 +880,9 @@ keyed on the error code and the envelope's fields, never on the message:
|
|
|
420
880
|
|-------|------------|---------|
|
|
421
881
|
| `KaguraNotFoundError` | missing contexts/memories/reports/agents/bindings (on `updateSearchConfig`, a missing context is a `KaguraPermissionError` instead) | — |
|
|
422
882
|
| `KaguraFeatureNotAvailableError` | MCP `plan_required` / `feature_not_available`; REST 403 `FEAT-001` — the plan lacks a feature, or it is switched off | `feature`, `requiredPlan`, `requiredPlanDisplay`, `currentPlan`, `gate` |
|
|
423
|
-
| `KaguraQuotaError` | MCP `quota_exceeded` / `CONNECTOR-001
|
|
883
|
+
| `KaguraQuotaError` | MCP `quota_exceeded` / `CONNECTOR-001`, and `rate_limit_exceeded`, the daily MCP call cap every non-read-only tool checks (`quotaType` `api_mcp_daily`, `resetsAt` the next UTC midnight); REST `QUOTA-001`, `QUOTA-002` and `CONNECTOR-001` (the resource-token and connector seat caps answer **403**); any other 429 from a REST client but `SecretClient` | `quotaType`, `current`, `limit`, `usedToday`, `resetsAt`, `retryAfter`, and the plan fields above |
|
|
424
884
|
| `KaguraPartialRollbackError` | `rollbackSleepRun` reversed some actions but not all | `reportId`, `summary` |
|
|
885
|
+
| `KaguraResponseError` | a successful response the SDK cannot read, usually because the server is newer than this SDK. The message reads as the Python SDK's: the call, then the failing fields, never their values (`<operation>: unexpected server response for <Model> (<field>: Field required). …`), then a suggestion to upgrade. It is not a `KaguraConnectionError`: a retry fails the same way | `operation` |
|
|
425
886
|
| `KaguraPermissionError` | MCP `permission_denied` — usually the caller's role is too low. `updateSearchConfig` also sends it for a context that does not exist or that the caller cannot see. Only some tools send a role — `updateSearchConfig`, `updateContext`, `deleteContext`, the file tools and the analysis tools do not — so `requiredRole` is often `null`, and on `updateSearchConfig` it cannot tell a missing context from a role denial | `requiredRole` |
|
|
426
887
|
| `KaguraError` | any other code | — |
|
|
427
888
|
|
|
@@ -454,7 +915,9 @@ An HTTP 429 keeps the class it always had on two surfaces.
|
|
|
454
915
|
per-minute rate limit and the daily call quota alike; from v0.75.0 the
|
|
455
916
|
quota also sets the `KaguraQuotaError` fields on it (`quotaType` is
|
|
456
917
|
`api_mcp_daily` or `api_rest_daily`), and they stay `null` on a
|
|
457
|
-
per-minute limit.
|
|
918
|
+
per-minute limit. A tool that refuses the daily MCP cap itself, in its
|
|
919
|
+
reply rather than with a 429, raises the `KaguraQuotaError` above.
|
|
920
|
+
`SecretClient` renders a 429 as `KaguraConnectionError`.
|
|
458
921
|
|
|
459
922
|
```ts
|
|
460
923
|
import { KaguraFeatureNotAvailableError, KaguraQuotaError } from "kagura-memory";
|
|
@@ -492,7 +955,7 @@ when `undefined`.
|
|
|
492
955
|
| `reference` | Full detail for one memory, under `result.memory`. |
|
|
493
956
|
| `updateMemory` | Update in place by `memoryId`, or upsert by `externalId`. `details` **replaces** the stored object wholesale — round-trip keys you want to keep; dropping `tool_trigger` turns a guardrail off. `dismissSupersedeCandidate: true` rejects the server's `supersede_candidate` suggestion; it needs `memoryId` and throws locally with `externalId`. |
|
|
494
957
|
| `forget` | Soft-delete by `memoryId` or by `query`. The rows are kept, but not restorable through the API, until the deployment's cleanup window passes (`CLEANUP_DELETED_MEMORIES_RETENTION_DAYS`, default 30 days). For a caller who may write to the workspace, a target it may not delete, or one already gone, is skipped silently — including every guardrail for a caller below context editor or on an agent credential — so `deleted_count` can be 0. A workspace viewer may not delete at all and is refused with `KaguraPermissionError` (`requiredRole: "member"`). |
|
|
495
|
-
| `listMemories` | Browse with substring, facet,
|
|
958
|
+
| `listMemories` | Browse with substring, facet, time-window and bounding-box filters. Omit `contextId` for the caller's cross-context view. `latMin` / `latMax` / `lonMin` / `lonMax` (server v0.54.0+) keep only memories with a location, each then carrying `location: { lat, lon }`; see [the WHERE axis](#the-where-axis--geospatial-memories). |
|
|
496
959
|
|
|
497
960
|
### Deterministic lanes
|
|
498
961
|
|
|
@@ -505,12 +968,14 @@ the counterpart to `recall`'s probabilistic search.
|
|
|
505
968
|
| `loadGuardrails` | The set a client-side tool hook matches against (server v0.74.0+): the pinned set plus every memory carrying `details.tool_trigger`, in two separately capped lanes — `cap` bounds only the tool-triggered one, so pins never crowd guardrails out. Check `tool_triggered_truncated` / `pinned_truncated`. |
|
|
506
969
|
| `recallUpcoming` | WHEN — `type: "time"` memories whose window overlaps `from`/`until`, soonest first. Items carry `trigger`, not `details` (server v0.73.0+); `includeDetails: true` returns the full `details` object instead. |
|
|
507
970
|
| `recallNearby` | WHERE — memories near a point, nearest first with `distance_m`. See [the WHERE axis](#the-where-axis--geospatial-memories). |
|
|
971
|
+
| `recordMeasurement` | HOW-MUCH — append one number to a metric's series (server v0.54.0+). Not a memory: never embedded, recalled or consolidated. Append-only, with no delete. See [the HOW-MUCH axis](#the-how-much-axis--measurement-series). |
|
|
972
|
+
| `recallSeries` | HOW-MUCH — one metric's series, bucketed by `period` (`day`, `week`, `month`) and aggregated by `agg` (`avg`, `min`, `max`, `sum`, `count`, `last`), UTC-aligned, empty buckets omitted. `count` is buckets, not observations. |
|
|
508
973
|
|
|
509
974
|
### Tags and the neural graph
|
|
510
975
|
|
|
511
976
|
| Method | What it does |
|
|
512
977
|
|--------|--------------|
|
|
513
|
-
| `listTags` | Tag vocabulary with counts and recency. `prefix` narrows by spelling; `withTags` is a multi-tag AND drill-down that also excludes those tags from the result — the two compose into server-side faceted browsing with no local index. A drill-down calls the REST tags endpoint, because the MCP tool ignores `withTags` (through server v0.76.0); the result has the same shape. Its values are trimmed and blank ones dropped, and at most 50 of up to 200 characters each are accepted. |
|
|
978
|
+
| `listTags` | Tag vocabulary with counts and recency. `prefix` narrows by spelling; `withTags` is a multi-tag AND drill-down that also excludes those tags from the result — the two compose into server-side faceted browsing with no local index. A drill-down calls the REST tags endpoint, because the MCP tool ignores `withTags` (through server v0.76.0); the result has the same shape. Its `context_name` is the one the endpoint sends (server v0.77.0+), else one MCP `list_tags` call names the context, once per client. Its values are trimmed and blank ones dropped, and at most 50 of up to 200 characters each are accepted. |
|
|
514
979
|
| `explore` | Graph traversal from a seed memory (`depth` 1–5, `minWeight`). |
|
|
515
980
|
| `listEdges` | Edges touching a memory, incoming and outgoing, deduplicated. |
|
|
516
981
|
| `createEdge` / `updateEdge` / `deleteEdge` | Manual edge curation. `(sourceId, targetId)` is the identity; self-loops are rejected. |
|
|
@@ -551,7 +1016,7 @@ Ephemeral, TTL-bounded, and excluded from recall — deliberately not memories.
|
|
|
551
1016
|
| Method | What it does |
|
|
552
1017
|
|--------|--------------|
|
|
553
1018
|
| `getServerInfo` | Version, deployment feature flags, and (v0.69.0+) the reranker defaults new contexts start with, under `search_defaults`. |
|
|
554
|
-
| `checkServerVersion` | Compare against `MIN_SERVER_VERSION` (0.75.0). Advisory: logs, never throws. |
|
|
1019
|
+
| `checkServerVersion` | Compare against `MIN_SERVER_VERSION` (0.75.0). Advisory: logs, never throws. Reads the version as the Python SDK does: `v0.75.0`, `0.75.0+build` and `0.75.0.post1` meet it, a pre-release of it (`0.75.0-rc1`, `0.75.0rc1`, `0.75.0.dev1`) does not, and a version it cannot read (`0.75`, or not a string) is not compared. |
|
|
555
1020
|
| `getUsage` | Workspace quota and usage: `used` / `limit` for memories, contexts, members and today's MCP calls. |
|
|
556
1021
|
| `getMemoryStats` | Per-memory usage stats, sortable and paged. |
|
|
557
1022
|
| `getEmbeddingStatus` / `listEmbeddingModels` | Embedding backend state and the models available for `createContext`. |
|
|
@@ -607,6 +1072,38 @@ Requires memory-cloud **v0.49.0+** — older servers return MCP "tool not
|
|
|
607
1072
|
found" / REST 404 on this surface. The SDK as a whole targets v0.75.0
|
|
608
1073
|
(see [Installation](#installation)).
|
|
609
1074
|
|
|
1075
|
+
## Tool guardrails over REST (memory-cloud v0.74.0+)
|
|
1076
|
+
|
|
1077
|
+
`MemoryClient` serves a context's tool guardrails to a caller holding only
|
|
1078
|
+
an API key, an agent-bound key included, with no MCP session:
|
|
1079
|
+
|
|
1080
|
+
| Method | What it does |
|
|
1081
|
+
|--------|--------------|
|
|
1082
|
+
| `getGuardrailDigest` | The rendered tool-triggered set for clients without tool hooks (`GET /api/v1/memory/guardrails/digest`). `target: "export"` (the default) returns the `AGENTS.md` block, between its marker lines, or `""` when the context has none; `"instructions"` returns the exact MCP server instructions this credential would receive, and `profile` / `tools` repeat the MCP URL's `?profile=` / `?tools=`. `tool_triggered_version` is the response header, `null` when absent. The text is returned as is. |
|
|
1083
|
+
| `loadGuardrails` | The REST twin of `KaguraClient.loadGuardrails` (`POST /api/v1/memory/guardrails`): the same two lanes and truncation flags, without the context block (`context_id` and `context_name` are `null`). The set is read as the Python SDK's `GuardrailSet` model reads it, by the same reader `guardrails load` prints with: the model's fields only, in its order, `null` for an optional one left out (so `GuardrailItem`'s optional fields and `ToolTrigger.match` are typed nullable), and a `tool_trigger` that is no trigger `null`. A set missing a required field, a truncation flag included, or holding one of the wrong type (`pinned.0.type: Input should be a valid string`) raises `KaguraResponseError` (`operation` `MemoryClient.load_guardrails`) rather than read as complete. |
|
|
1084
|
+
|
|
1085
|
+
Both refuse a `contextId` that is not a UUID before any request, in the
|
|
1086
|
+
Python SDK's words (`context_id must be a UUID, got '…'`), and send its
|
|
1087
|
+
canonical form. The 404 (`KaguraNotFoundError`) is uniform: an unknown
|
|
1088
|
+
context, one in another workspace, and one the credential may not read
|
|
1089
|
+
all look the same, and so does a server older than v0.74.0 answering
|
|
1090
|
+
`getGuardrailDigest`. That older server answers `loadGuardrails` with
|
|
1091
|
+
`HTTP 405` instead, a `KaguraConnectionError`, so a caller that detects
|
|
1092
|
+
an older server by catching `KaguraNotFoundError` must also expect the
|
|
1093
|
+
405. An OAuth token's scope follows the HTTP method, so
|
|
1094
|
+
`loadGuardrails`, a `POST`, needs `memory:write`: a `--read-only` login
|
|
1095
|
+
loads the set over MCP instead.
|
|
1096
|
+
|
|
1097
|
+
```ts
|
|
1098
|
+
import { MemoryClient } from "kagura-memory";
|
|
1099
|
+
|
|
1100
|
+
const memory = MemoryClient.fromMcpUrl();
|
|
1101
|
+
const digest = await memory.getGuardrailDigest("ctx-uuid");
|
|
1102
|
+
if (digest.text) {
|
|
1103
|
+
// The block between the kagura-memory:guardrails marker lines for AGENTS.md.
|
|
1104
|
+
}
|
|
1105
|
+
```
|
|
1106
|
+
|
|
610
1107
|
## The WHERE axis — geospatial memories
|
|
611
1108
|
|
|
612
1109
|
Any memory can carry a location under `details.location`, which makes it
|
|
@@ -630,10 +1127,83 @@ into `details`, so `"35.68"` is rejected server-side with HTTP 422.
|
|
|
630
1127
|
(`results[].distance_m`); `MemoryLocation` and `NearbyMemory` are exported
|
|
631
1128
|
too. Out-of-range coordinates throw locally rather than round-tripping.
|
|
632
1129
|
|
|
1130
|
+
`listMemories()` filters by a bounding box instead (server v0.54.0+):
|
|
1131
|
+
`latMin`, `latMax`, `lonMin` and `lonMax`, in any combination, keep only
|
|
1132
|
+
memories with a location, and each item carries `location: { lat, lon }`
|
|
1133
|
+
(`null` without one). `lonMin > lonMax` is the box across the
|
|
1134
|
+
antimeridian. A server older than v0.54.0 ignores the bounds and returns
|
|
1135
|
+
an unfiltered page.
|
|
1136
|
+
|
|
1137
|
+
```ts
|
|
1138
|
+
const pacific = await client.listMemories({ contextId, lonMin: 170, lonMax: -170 });
|
|
1139
|
+
```
|
|
1140
|
+
|
|
633
1141
|
> **Gotcha:** `updateMemory()` replaces `details` **wholesale** — the
|
|
634
1142
|
> server does not deep-merge. Round-trip `location` when updating details
|
|
635
1143
|
> or the memory silently drops off the spatial axis.
|
|
636
1144
|
|
|
1145
|
+
## The HOW-MUCH axis — measurement series
|
|
1146
|
+
|
|
1147
|
+
Numbers such as a weight, a daily revenue or a rep count go to a lane of
|
|
1148
|
+
their own (server v0.54.0+): never embedded, never returned by `recall()`,
|
|
1149
|
+
never merged or rewritten by Sleep. Keep prose ("hit goal weight") in
|
|
1150
|
+
`remember()`.
|
|
1151
|
+
|
|
1152
|
+
```ts
|
|
1153
|
+
await client.recordMeasurement({ contextId, metric: "weight_kg", value: 71.5, unit: "kg" });
|
|
1154
|
+
|
|
1155
|
+
const weekly = await client.recallSeries({ contextId, metric: "weight_kg", period: "week", agg: "avg" });
|
|
1156
|
+
// weekly.series: [{ bucket: "2026-08-24T00:00:00Z", value: 72, count: 3 }, ...]
|
|
1157
|
+
```
|
|
1158
|
+
|
|
1159
|
+
The lane is append-only: recording the same point twice stores two rows,
|
|
1160
|
+
and nothing deletes one, except the retention window an operator can set
|
|
1161
|
+
on the server (v0.55.0+, `SLEEP_MEASUREMENT_RETENTION_DAYS`), which Sleep
|
|
1162
|
+
rollback cannot undo. `measuredAt`, `start` and `end` take an ISO 8601
|
|
1163
|
+
string, sent as given (naive means UTC), or a `Date`. A series window
|
|
1164
|
+
defaults to the last 30 days and spans at most 365; the server refuses a
|
|
1165
|
+
wider one. The metric (1-64 characters), the value (a finite number) and
|
|
1166
|
+
the unit (1-32 characters) are checked before any request, with the Python
|
|
1167
|
+
SDK's messages. Both methods return the Python SDK's model, and a result
|
|
1168
|
+
that does not read as one throws `KaguraResponseError`. On the command
|
|
1169
|
+
line: `measure record` and `measure series`.
|
|
1170
|
+
|
|
1171
|
+
## Upload and ingest progress
|
|
1172
|
+
|
|
1173
|
+
`FilesClient.upload` and `ResourceClient.ingestEvents` take an
|
|
1174
|
+
`onProgress` callback, the Python SDK's `logger=` hook. Each event is the
|
|
1175
|
+
Python CLI's NDJSON line without its `v` and `ts`: `stage`, `kind`
|
|
1176
|
+
(`action`, then one `success` or `error`, the last event, even when the
|
|
1177
|
+
call throws), and `msg` and `detail` when they are not empty. Without a
|
|
1178
|
+
callback nothing is emitted, and a callback that throws, or an `async` one
|
|
1179
|
+
that rejects, is ignored; its promise is not awaited.
|
|
1180
|
+
|
|
1181
|
+
```ts
|
|
1182
|
+
import { FilesClient, type ProgressEvent } from "kagura-memory";
|
|
1183
|
+
|
|
1184
|
+
const files = FilesClient.fromMcpUrl();
|
|
1185
|
+
await files.upload({
|
|
1186
|
+
contextId: "workspace-uuid",
|
|
1187
|
+
source: "./report.pdf",
|
|
1188
|
+
onProgress: (e: ProgressEvent) => console.error(e.stage, e.kind, e.msg),
|
|
1189
|
+
});
|
|
1190
|
+
```
|
|
1191
|
+
|
|
1192
|
+
An upload reports `reserve`, `upload` and `confirm`, then `complete`: a
|
|
1193
|
+
`success` with `{ file_id, size_bytes }` (`{ file_id, deduped: true }` for
|
|
1194
|
+
a 409 dedup hit), or an `error` with how far it got,
|
|
1195
|
+
`{ reserved_file_id, uploaded, confirm_started, confirmed }`;
|
|
1196
|
+
`confirm_started` without `confirmed` means the file may be finalized
|
|
1197
|
+
after all, so check before uploading again. A batch reports
|
|
1198
|
+
`ingest_events`, then `{ created, failed }` or
|
|
1199
|
+
`{ events_attempted, resource_id }`. A 2xx answer neither call can read (a
|
|
1200
|
+
batch answered with `null`, a confirm with no file `id`) ends the stream
|
|
1201
|
+
with that `error` and throws a `KaguraResponseError` in the Python SDK's
|
|
1202
|
+
words; such a confirm is not `confirmed`. Every `FilesClient` method
|
|
1203
|
+
refuses a `contextId` that is not a UUID in the Python SDK's words
|
|
1204
|
+
(`context_id must be a UUID; got '…'`), and sends a `{braced}`,
|
|
1205
|
+
`urn:uuid:` or dashless one in its canonical form.
|
|
1206
|
+
|
|
637
1207
|
## Zero-knowledge secrets
|
|
638
1208
|
|
|
639
1209
|
`SecretClient` is the fourth REST client, alongside Files, Resource and
|
|
@@ -735,20 +1305,22 @@ Python uses, so a shared backend interoperates.
|
|
|
735
1305
|
## Relationship to the Python SDK
|
|
736
1306
|
|
|
737
1307
|
This package ports the Python SDK's core (client, auth, REST clients,
|
|
738
|
-
models, the zero-knowledge secret client) and, since 0.8.0,
|
|
739
|
-
`kagura
|
|
1308
|
+
models, the zero-knowledge secret client) and, since 0.8.0, its `kagura`
|
|
1309
|
+
CLI as `kagura-memory`: 20 of the 21 top-level commands, counting the
|
|
1310
|
+
`contexts` alias. Only `kagura ingest` is not ported (below);
|
|
1311
|
+
[Command line](#command-line) lists where the two CLIs still differ.
|
|
740
1312
|
|
|
741
|
-
|
|
1313
|
+
One thing is deliberately not ported, because it would cost the
|
|
742
1314
|
zero-dependency promise:
|
|
743
1315
|
|
|
744
1316
|
- **The document-ingestion pipeline** (`FileIngestor`, `kagura ingest`),
|
|
745
1317
|
which needs text extraction from PDF, Office, EPUB and audio plus LLM
|
|
746
1318
|
providers.
|
|
747
|
-
- **`kagura process`**, which needs the litellm-backed agent.
|
|
748
1319
|
|
|
749
|
-
(`KaguraAgent`
|
|
750
|
-
lives in the
|
|
751
|
-
package, so
|
|
1320
|
+
(`KaguraAgent` and `kagura process` were removed from the Python SDK in
|
|
1321
|
+
v0.37.0 — the actor role lives in the
|
|
1322
|
+
[kagura-agent](https://pypi.org/project/kagura-agent/) package, so neither
|
|
1323
|
+
will be ported here.)
|
|
752
1324
|
|
|
753
1325
|
Use the Python SDK for those. Both SDKs share the same credential files
|
|
754
1326
|
and server APIs, so they interoperate — with one exception, noted above:
|