@cerefox/memory 0.9.0 → 0.9.1

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/AGENT_GUIDE.md CHANGED
@@ -15,8 +15,8 @@ It is not a message bus -- it is curated, versioned, searchable memory backed by
15
15
 
16
16
  You'll be using **one** of these — whichever your user (or the harness) has configured:
17
17
 
18
- 1. **MCP tools (default)** — ten named tools (`cerefox_search`, `cerefox_ingest`, …, `cerefox_get_help`) exposed by either a local MCP server (`@cerefox/memory` via npm, or `cerefox mcp` as a soft wrapper) or the remote `cerefox-mcp` Edge Function. Tool names and parameters are documented in **The 10 Tools** below. This is the recommended path for purpose-built agent clients.
19
- 2. **Shell CLI (Bash tool)** — the same operations exposed as a local `uv run cerefox …` command, invoked via your Bash tool. Used when your user prefers not to install/configure an MCP server. The semantics are identical; only the surface differs. See **Using Cerefox via the CLI** near the bottom of this guide for the MCP-tool → CLI-command mapping and the small list of behavioural differences.
18
+ 1. **MCP tools (default)** — ten named tools (`cerefox_search`, `cerefox_ingest`, …, `cerefox_get_help`) exposed by either a local MCP server (`@cerefox/memory` via npm, run as `cerefox mcp`) or the remote `cerefox-mcp` Edge Function. Tool names and parameters are documented in **The 10 Tools** below. This is the recommended path for purpose-built agent clients. (A frozen Python MCP server still exists as a standalone fallback, invoked explicitly with `uv run cerefox mcp` from a repo clone.)
19
+ 2. **Shell CLI (Bash tool)** — the same operations exposed as a local `cerefox …` command (the TypeScript CLI from `@cerefox/memory`, resource-verb shape — e.g. `cerefox document get`, `cerefox project list`), invoked via your Bash tool. Used when your user prefers not to install/configure an MCP server. The semantics are identical; only the surface differs. See **Using Cerefox via the CLI** near the bottom of this guide for the MCP-tool → CLI-command mapping and the small list of behavioural differences.
20
20
 
21
21
  If you're not sure which mode you're in: check whether `cerefox_search` shows up in your tool list. If yes, use MCP. If no, ask your user where the Cerefox checkout lives — they'll have told you, typically in `CLAUDE.md`, `AGENTS.md`, or an equivalent project memory file.
22
22
 
@@ -359,7 +359,7 @@ If you're using Cerefox via the local CLI (Path C from `connect-agents.md`), the
359
359
  ## Governance
360
360
 
361
361
  - **Review status**: agent writes set `pending_review`; human edits set `approved`. Both are searchable.
362
- - **Soft delete**: deleted documents go to trash (recoverable). They are excluded from search. You can soft-delete via MCP (`cerefox_delete_document` if your client exposes it) or CLI (`cerefox delete-doc --yes --author <you> --author-type agent`).
362
+ - **Soft delete**: deleted documents go to trash (recoverable). They are excluded from search. You can soft-delete via MCP (`cerefox_delete_document` if your client exposes it) or CLI (`cerefox document delete --yes --author <you> --author-type agent`).
363
363
  - **Permanent purge and restore-from-trash are web-UI-only**, by design. If you decide to delete something, **tell the user explicitly** that you soft-deleted it and that they can review or restore it via the Cerefox web UI. You cannot un-do your own soft-delete from agent code; only the human can. See [`docs/guides/access-paths.md` → Destructive operations and the trust model](docs/guides/access-paths.md#destructive-operations-and-the-trust-model).
364
364
  - **Versioning**: every update via `update_if_exists` creates an archived version. Old content is always recoverable.
365
365
  - **Audit log**: all write operations are recorded with author, timestamp, and size changes.
@@ -374,9 +374,9 @@ Read this section only if you do **not** have MCP tools available (no `cerefox_s
374
374
 
375
375
  ### Setup
376
376
 
377
- Your user will have told you where their Cerefox checkout lives (commonly `/Users/<name>/src/cerefox`, but check `CLAUDE.md` / `AGENTS.md` / project memory for the exact path). Run every command from that directory, or use `cd /path/to/cerefox && uv run cerefox …` in your Bash tool call.
377
+ The Cerefox CLI is the TypeScript binary from `@cerefox/memory` (`npm install -g @cerefox/memory`), invoked as plain `cerefox <subcommand>` on your `PATH` no repo checkout or `uv` required. It uses a resource-verb shape (`cerefox document get`, `cerefox project list`, `cerefox metadata search`, ). Credentials come from a `.env` file resolved from the working directory, or from environment variables.
378
378
 
379
- If a command fails with `command not found: cerefox`, run it as `uv run cerefox <subcommand>` (the project's `uv` environment provides the binary).
379
+ The legacy Python `uv run cerefox` is a frozen husk as of v0.9 — only `uv run cerefox mcp` (the standalone Python MCP fallback) still works; every other verb has moved to the TypeScript `cerefox` binary.
380
380
 
381
381
  > Full per-flag reference lives in [`docs/guides/cli.md`](docs/guides/cli.md). The mapping table below is the agent-facing summary. **CLI flag names match MCP parameter names exactly** (kebab-case); short forms like `--project`, `--filter`, `--count`, `--update`, `--version` are accepted as aliases.
382
382
 
@@ -384,28 +384,30 @@ If a command fails with `command not found: cerefox`, run it as `uv run cerefox
384
384
 
385
385
  | MCP tool | CLI command |
386
386
  |---|---|
387
- | `cerefox_search(query, match_count, project_name, metadata_filter, requestor)` | `uv run cerefox search "<query>" --match-count N --project-name <n> --metadata-filter '<json>' --requestor <name>` (also `--mode`, `--alpha`, `--min-score` — CLI-only) |
388
- | `cerefox_ingest(title, content, project_name, metadata, update_if_exists, document_id, source, author, author_type)` (file) | `uv run cerefox ingest <path> --title <t> --project-name <n> --metadata '<json>' --update-if-exists\|--document-id <uuid> --source <s> --author <a> --author-type user\|agent` |
389
- | `cerefox_ingest(...)` (paste) | `printf '%s' "<content>" \| uv run cerefox ingest --paste --title "<title>"` (same flags) |
390
- | `cerefox_get_document(document_id, version_id, requestor)` | `uv run cerefox get-doc <document-id> --version-id <vid> --requestor <name>` |
391
- | `cerefox_list_versions(document_id, requestor)` | `uv run cerefox list-versions <document-id> --requestor <name>` |
392
- | `cerefox_list_projects(requestor)` | `uv run cerefox list-projects --requestor <name>` |
393
- | `cerefox_list_metadata_keys()` | `uv run cerefox list-metadata-keys` |
394
- | `cerefox_metadata_search(metadata_filter, project_name, updated_since, created_since, limit, include_content, requestor)` | `uv run cerefox metadata-search --metadata-filter '<json>' --project-name <n> --updated-since <iso> --created-since <iso> --limit N --include-content --requestor <name>` |
395
- | `cerefox_get_audit_log(document_id, author, operation, since, until, limit, requestor)` | `uv run cerefox get-audit-log --document-id <id> --author <a> --operation <op> --since <iso> --until <iso> --limit N --json --requestor <name>` |
387
+ | `cerefox_search(query, match_count, project_name, metadata_filter, requestor)` | `cerefox search "<query>" --match-count N --project-name <n> --metadata-filter '<json>' --requestor <name>` (also `--mode`, `--alpha`, `--min-score`, `--only-metadata` — CLI-only) |
388
+ | `cerefox_ingest(title, content, project_name, metadata, update_if_exists, document_id, source, author, author_type)` (file) | `cerefox document ingest <path> --title <t> --project-name <n> --metadata '<json>' --update-if-exists\|--document-id <uuid> --source <s> --author <a> --author-type user\|agent` |
389
+ | `cerefox_ingest(...)` (paste) | `printf '%s' "<content>" \| cerefox document ingest --paste --title "<title>"` (same flags) |
390
+ | `cerefox_get_document(document_id, version_id, requestor)` | `cerefox document get <document-id> --version-id <vid> --requestor <name>` |
391
+ | `cerefox_list_versions(document_id, requestor)` | `cerefox document version list <document-id> --requestor <name>` |
392
+ | `cerefox_list_projects(requestor)` | `cerefox project list --requestor <name>` |
393
+ | `cerefox_list_metadata_keys()` | `cerefox metadata keys` |
394
+ | `cerefox_metadata_search(metadata_filter, project_name, updated_since, created_since, limit, include_content, requestor)` | `cerefox metadata search --metadata-filter '<json>' --project-name <n> --updated-since <iso> --created-since <iso> --limit N --include-content --requestor <name>` |
395
+ | `cerefox_get_audit_log(document_id, author, operation, since, until, limit, requestor)` | `cerefox audit list --document-id <id> --author <a> --operation <op> --since <iso> --until <iso> --limit N --json --requestor <name>` |
396
+
397
+ > Other CLI verbs with no MCP equivalent: `cerefox document edit` (title/metadata patch), `cerefox document delete` / `cerefox document restore`, `cerefox project create` / `cerefox project edit`, `cerefox config list/get/set`, `cerefox server reindex`, `cerefox guides list/show`.
396
398
 
397
399
  ### Caller-identity flags (set these the same way you would on MCP)
398
400
 
399
401
  You **MUST** identify yourself on every CLI invocation, exactly as you do via MCP:
400
402
 
401
- - **Writes** (`ingest`, `ingest-dir`): set `--author "<your-agent-name>" --author-type "agent"`. The `author_type=agent` value auto-routes the write to `pending_review` (governance signal), matching the MCP path.
402
- - **Reads** (`search`, `get-doc`, `list-versions`, `list-projects`, `metadata-search`, `get-audit-log`): set `--requestor "<your-agent-name>"`.
403
+ - **Writes** (`document ingest`, `document ingest-dir`): set `--author "<your-agent-name>" --author-type "agent"`. The `author_type=agent` value auto-routes the write to `pending_review` (governance signal), matching the MCP path.
404
+ - **Reads** (`search`, `document get`, `document version list`, `project list`, `metadata search`, `audit list`): set `--requestor "<your-agent-name>"`.
403
405
 
404
406
  Alternative: have your user set `CEREFOX_AUTHOR_NAME`, `CEREFOX_AUTHOR_TYPE`, `CEREFOX_REQUESTOR_NAME` in their `.env` once. The CLI picks them up automatically — see [`docs/guides/cli.md`](docs/guides/cli.md) for the precedence rules.
405
407
 
406
408
  ### Behavioural differences worth knowing
407
409
 
408
- 1. **CLI output is human-formatted by default.** `cerefox search` returns a numbered, indented text block with title, score, and a 300-char preview per result. To extract document IDs reliably, parse the `Doc: <title> (<source>)` lines or fall back to `cerefox list-docs` for a clean tabular listing. `cerefox get-doc <id>` prints raw Markdown to stdout. **For scripted access to audit data**, use `cerefox get-audit-log --json` — one JSON object per line, ideal for piping to `jq`.
410
+ 1. **CLI output is human-formatted by default.** `cerefox search` returns a numbered, indented text block with title, score, and a 300-char preview per result. To extract document IDs reliably, parse the `Doc: <title> (<source>)` lines or fall back to `cerefox document list` for a clean tabular listing. `cerefox document get <id>` prints raw Markdown to stdout. **For scripted access to audit data**, use `cerefox audit list --json` — one JSON object per line, ideal for piping to `jq`.
409
411
 
410
412
  2. **Every invocation is independent.** With MCP, your tool framework can pass `requestor` once per session. With the CLI, every command is a separate process — pass `--requestor` / `--author` / `--author-type` on every relevant invocation, or set the env-var defaults once at the start.
411
413
 
@@ -415,20 +417,20 @@ Alternative: have your user set `CEREFOX_AUTHOR_NAME`, `CEREFOX_AUTHOR_TYPE`, `C
415
417
 
416
418
  **Search before answering:**
417
419
  ```bash
418
- uv run cerefox search "OAuth design notes" --match-count 5 --requestor "claude-code"
420
+ cerefox search "OAuth design notes" --match-count 5 --requestor "claude-code"
419
421
  ```
420
422
 
421
423
  **Search then read full content of a hit:**
422
424
  ```bash
423
- uv run cerefox search "OAuth design" --match-count 3 --requestor "claude-code"
424
- # Note the [n] entries. Pick one and grab the doc id from `list-docs` or the result preview.
425
- uv run cerefox get-doc <document-id> --requestor "claude-code"
425
+ cerefox search "OAuth design" --match-count 3 --requestor "claude-code"
426
+ # Note the [n] entries. Pick one and grab the doc id from `cerefox document list` or the result preview.
427
+ cerefox document get <document-id> --requestor "claude-code"
426
428
  ```
427
429
 
428
430
  **Ingest a note (agent identity):**
429
431
  ```bash
430
432
  printf '# Title\n\nBody markdown with H2s for chunking.\n' \
431
- | uv run cerefox ingest --paste \
433
+ | cerefox document ingest --paste \
432
434
  --title "Stable Title" \
433
435
  --project-name "Cerefox" \
434
436
  --metadata '{"type":"decision-log","status":"active"}' \
@@ -438,11 +440,11 @@ printf '# Title\n\nBody markdown with H2s for chunking.\n' \
438
440
  **ID-based update (preferred — deterministic):**
439
441
  ```bash
440
442
  # Step 1: search and note the [id: abc12345-...] in the result
441
- uv run cerefox search "the exact doc" --match-count 1 --requestor "claude-code"
443
+ cerefox search "the exact doc" --match-count 1 --requestor "claude-code"
442
444
 
443
445
  # Step 2: update by ID
444
446
  printf '...new content...' \
445
- | uv run cerefox ingest --paste \
447
+ | cerefox document ingest --paste \
446
448
  --title "Exact Same Title" \
447
449
  --document-id "abc12345-..." \
448
450
  --author "claude-code" --author-type "agent"
@@ -451,12 +453,12 @@ printf '...new content...' \
451
453
  **Title-based update (fallback when ID isn't available):**
452
454
  ```bash
453
455
  printf '...new content...' \
454
- | uv run cerefox ingest --paste --title "Exact Same Title" --update-if-exists \
456
+ | cerefox document ingest --paste --title "Exact Same Title" --update-if-exists \
455
457
  --author "claude-code" --author-type "agent"
456
458
  ```
457
459
 
458
460
  **Audit-log access (scripted, JSON):**
459
461
  ```bash
460
- uv run cerefox get-audit-log --json --limit 1000 --requestor "claude-code" \
462
+ cerefox audit list --json --limit 1000 --requestor "claude-code" \
461
463
  | jq 'select(.author_type == "agent")'
462
464
  ```
@@ -51,26 +51,26 @@ metadata_search(metadata_filter={"type": "decision-log"}, updated_since="2026-03
51
51
 
52
52
  ## CLI fallback (when MCP is unavailable)
53
53
 
54
- If `cerefox_search` is not in your tool list, your user has likely installed the Cerefox CLI. From v0.5+ the canonical invocation is plain **`cerefox <subcommand>`** (installed via `npm install -g @cerefox/memory`). The legacy `uv run cerefox <subcommand>` (Python CLI in a Cerefox checkout) still works through v0.7 but emits a deprecation banner.
54
+ If `cerefox_search` is not in your tool list, your user has likely installed the Cerefox CLI. The canonical invocation is plain **`cerefox <subcommand>`** (the TypeScript CLI, installed via `npm install -g @cerefox/memory`). It uses a resource-verb shape (`cerefox document get`, `cerefox project list`, …). The legacy Python `uv run cerefox` is now a frozen husk as of v0.9 only `uv run cerefox mcp` still works.
55
55
 
56
56
  Same operations, same conventions. Full reference: [`docs/guides/cli.md`](docs/guides/cli.md). CLI flag names match MCP parameter names exactly (e.g. `metadata_filter` ↔ `--metadata-filter`); short forms (`--filter`, `--project`, `--count`, `--update`, `--version`) work as aliases.
57
57
 
58
- | MCP tool | CLI (v0.5+ canonical) |
58
+ | MCP tool | CLI |
59
59
  |---|---|
60
60
  | `cerefox_search` | `cerefox search "<q>" --requestor "<your-name>"` |
61
- | `cerefox_ingest` (paste) | `printf '...' \| cerefox ingest --paste --title "<t>" --author "<your-name>" --author-type agent` |
62
- | `cerefox_ingest` (update by ID) | `printf '...' \| cerefox ingest --paste --title "<t>" --document-id "<uuid>" --author "<your-name>" --author-type agent` |
63
- | `cerefox_get_document` | `cerefox get-doc <id> --version-id <vid> --requestor "<your-name>"` |
64
- | `cerefox_list_versions` | `cerefox list-versions <id> --requestor "<your-name>"` |
65
- | `cerefox_list_projects` | `cerefox list-projects --requestor "<your-name>"` |
66
- | `cerefox_list_metadata_keys` | `cerefox list-metadata-keys` |
67
- | `cerefox_metadata_search` | `cerefox metadata-search --metadata-filter '<json>' --requestor "<your-name>"` |
61
+ | `cerefox_ingest` (paste) | `printf '...' \| cerefox document ingest --paste --title "<t>" --author "<your-name>" --author-type agent` |
62
+ | `cerefox_ingest` (update by ID) | `printf '...' \| cerefox document ingest --paste --title "<t>" --document-id "<uuid>" --author "<your-name>" --author-type agent` |
63
+ | `cerefox_get_document` | `cerefox document get <id> --version-id <vid> --requestor "<your-name>"` |
64
+ | `cerefox_list_versions` | `cerefox document version list <id> --requestor "<your-name>"` |
65
+ | `cerefox_list_projects` | `cerefox project list --requestor "<your-name>"` |
66
+ | `cerefox_list_metadata_keys` | `cerefox metadata keys` |
67
+ | `cerefox_metadata_search` | `cerefox metadata search --metadata-filter '<json>' --requestor "<your-name>"` |
68
68
  | `cerefox_set_document_projects` | _MCP-only; a CLI command will be added in a future release. Until then, run via MCP if available._ |
69
- | `cerefox_get_audit_log` | `cerefox get-audit-log --requestor "<your-name>"` (add `--json` for scripted access) |
70
- | `cerefox_get_help` | `cerefox docs agent-quick-reference --print` (or `cerefox docs --list` for the full bundled-docs index) |
69
+ | `cerefox_get_audit_log` | `cerefox audit list --requestor "<your-name>"` (add `--json` for scripted access) |
70
+ | `cerefox_get_help` | `cerefox guides show agent-quick-reference` (or `cerefox guides list` for the full bundled-docs index) |
71
71
 
72
72
  **Set identity on every call**, exactly as you would on MCP:
73
- - Writes (`ingest`, `ingest-dir`): `--author "<your-name>" --author-type agent`
73
+ - Writes (`document ingest`, `document ingest-dir`): `--author "<your-name>" --author-type agent`
74
74
  - Reads: `--requestor "<your-name>"`
75
75
 
76
76
  Or have your user set `CEREFOX_AUTHOR_NAME` / `CEREFOX_AUTHOR_TYPE` / `CEREFOX_REQUESTOR_NAME` in their `.env` to apply defaults once.