@cerefox/memory 1.5.0 → 1.6.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.
@@ -251,6 +251,59 @@ cerefox document edit <doc-id> --set-meta status=archived --unset-meta draft
251
251
 
252
252
  ---
253
253
 
254
+ ### `cerefox document set-metadata`
255
+
256
+ **Purpose**: change a document's metadata **without resending its content**. Before this existed, `cerefox document ingest` was the only way to set a tag, and it needs the whole document — so changing one key meant reproducing every untouched character, which is the transcription risk the partial-edit commands exist to remove.
257
+
258
+ **Merges by default.** The keys you pass are set; every other key is left alone. That means you do not need to read the document first, and you cannot accidentally drop a tag someone else set. Content, chunks and embeddings are untouched and no new version is created; the change is logged as an `update-metadata` audit entry.
259
+
260
+ CLI equivalent of the `cerefox_set_document_metadata` MCP tool. Both call the same RPC, so the semantics cannot drift between them.
261
+
262
+ **Synopsis**:
263
+
264
+ ```
265
+ cerefox document set-metadata [OPTIONS] DOCUMENT_ID
266
+ ```
267
+
268
+ **Options**:
269
+
270
+ | Flag | Meaning |
271
+ |---|---|
272
+ | `-s, --set <key=value...>` | Set a key. Repeatable. |
273
+ | `-r, --remove <key...>` | Remove a key. Repeatable. |
274
+ | `--json <object>` | A JSON object of keys to set; a `null` value removes that key. |
275
+ | `--replace` | Set the metadata to **exactly** what was given, discarding every key not listed. |
276
+ | `-a, --author <name>` | Caller identity (audit log). |
277
+ | `--author-type <type>` | `user` (default) or `agent`. |
278
+ | `--json-out` | Emit the result as JSON. |
279
+
280
+ **Examples**:
281
+
282
+ ```bash
283
+ # Add or update one tag; everything else is preserved
284
+ cerefox document set-metadata <id> --set status=active
285
+
286
+ # Several at once
287
+ cerefox document set-metadata <id> --set type=decision-log --set seq=8
288
+
289
+ # Remove a key
290
+ cerefox document set-metadata <id> --remove stale_key
291
+
292
+ # Set and remove in one call, from a script that already holds an object
293
+ cerefox document set-metadata <id> --json '{"status":"active","stale_key":null}'
294
+
295
+ # Reset a document's tags wholesale (rare)
296
+ cerefox document set-metadata <id> --replace --json '{"type":"note"}'
297
+ ```
298
+
299
+ **Values are stored as JSON strings**, matching the convention elsewhere: a `metadata_filter` matches JSONB as strings, so a stored boolean `true` would never match a filter looking for `"true"`.
300
+
301
+ **`--set key=null` is refused.** Over MCP a JSON null *removes* a key (RFC 7386), but on a command line the same text could equally mean the literal word "null" — so rather than guess, the command points you at `--remove key` (to delete) or `--json '{"key":"null"}'` (to store the word).
302
+
303
+ **Output**: reports what actually changed, not what was asked for. Setting a key to the value it already holds reports no change, so re-running a script is distinguishable from doing work.
304
+
305
+ ---
306
+
254
307
  ### `cerefox document set-projects`
255
308
 
256
309
  **Purpose**: replace a document's project memberships with **exactly** the given set (full-set replace — any project not listed is removed). This is the CLI equivalent of the `cerefox_set_document_projects` MCP tool; both share one membership-replace core, so they behave identically. Content is untouched; the change is logged as an `update-metadata` audit entry.
@@ -611,7 +664,7 @@ cerefox config set relations_enabled true # tools appear in every agent's lis
611
664
  cerefox config set relations_enabled false # hidden again; no data removed
612
665
  ```
613
666
 
614
- Agents see 12 tools with the flag off and 16 with it on. See
667
+ Agents see 13 tools with the flag off and 16 with it on. See
615
668
  [`configuration.md`](configuration.md) for the full runtime-config surface.
616
669
 
617
670
  ### `cerefox config list` / `cerefox config get` / `cerefox config set`
@@ -72,7 +72,7 @@ in the container.
72
72
  - **Easiest:** `cerefox-local configure-agent` wires it up (registers an MCP server named
73
73
  `cerefox-local` with Claude Code if the `claude` CLI is present, else prints the snippet).
74
74
  - **Manual:** point the client at `command: cerefox-local, args: ["mcp"]` (stdio). That proxies
75
- to `cerefox mcp` in the container; the same 12 core tools, identical behavior to every other path.
75
+ to `cerefox mcp` in the container; the same 13 core tools, identical behavior to every other path.
76
76
  - The cloud paths above (remote Edge Function, GPT Actions) **do not apply** to a local-only
77
77
  install — there are no Edge Functions.
78
78
 
@@ -131,7 +131,7 @@ in the container.
131
131
 
132
132
  ### What it is
133
133
 
134
- The local Cerefox MCP server runs on your machine and exposes the same 12 core tools as the remote
134
+ The local Cerefox MCP server runs on your machine and exposes the same 13 core tools as the remote
135
135
  Edge Function, communicating with clients over stdio.
136
136
 
137
137
  The local server ships as an npm package — **[`@cerefox/memory`](https://www.npmjs.com/package/@cerefox/memory)** — built with the official `@modelcontextprotocol/sdk`.
@@ -196,10 +196,11 @@ Once configured, every Path A client has these tools:
196
196
  | `cerefox_get_audit_log` | Query audit log entries with filters (document, author, operation, time range) |
197
197
  | `cerefox_list_projects` | List all projects with names and IDs. Use for discovering available projects. |
198
198
  | `cerefox_metadata_search` | Find documents by metadata key-value criteria without a text search term. Supports project, date, and content filters. |
199
+ | `cerefox_set_document_metadata` | Change a document's metadata without resending its content. **Merges** by default (keys you pass are set, others left alone); a `null` value removes a key (RFC 7386); `replace: true` sets exactly the object given. No re-chunk, no re-embed, no new version. |
199
200
  | `cerefox_set_document_projects` | Set a document's project memberships to exactly the given list (destructive replace; metadata-only, no content change). Use `cerefox_ingest` with singular `project_name` for non-destructive "add". |
200
201
  | `cerefox_get_help` | Retrieve Cerefox conventions (the same content as `AGENT_QUICK_REFERENCE.md`) over MCP. Optional `topic` parameter does a case-insensitive H2 substring match. Call this whenever you are uncertain. |
201
202
 
202
- > All 12 core tools are available on both Path A (local and remote MCP) and Path B (GPT Actions
203
+ > All 13 core tools are available on both Path A (local and remote MCP) and Path B (GPT Actions
203
204
  > via dedicated Edge Functions, except `cerefox_get_help` which is MCP-only). MCP tools use
204
205
  > `project_name` (human-readable); primitive Edge Functions (Path B) use `project_id` (UUID).
205
206
 
@@ -225,9 +226,10 @@ For the full tool reference, search Cerefox for "How AI Agents Use Cerefox".
225
226
  After setup, ask your client:
226
227
 
227
228
  > "What tools do you have available?"
228
- > Expected: 12 tools listed (`cerefox_search`, `cerefox_ingest`, `cerefox_insert`, `cerefox_edit`, `cerefox_get_document`,
229
+ > Expected: 13 tools listed (`cerefox_search`, `cerefox_ingest`, `cerefox_insert`, `cerefox_edit`, `cerefox_get_document`,
229
230
  > `cerefox_list_versions`, `cerefox_list_projects`, `cerefox_list_metadata_keys`,
230
- > `cerefox_metadata_search`, `cerefox_set_document_projects`, `cerefox_get_audit_log`,
231
+ > `cerefox_metadata_search`, `cerefox_set_document_projects`,
232
+ > `cerefox_set_document_metadata`, `cerefox_get_audit_log`,
231
233
  > `cerefox_get_help`).
232
234
 
233
235
  > "Use cerefox_search with query='second brain' and match_count=3. What did you find?"
@@ -319,7 +321,7 @@ pick it up automatically.
319
321
  to primitive Edge Functions. This means each MCP tool call costs a single Edge Function
320
322
  invocation.
321
323
 
322
- A single HTTPS URL gives any remote-capable MCP client all 12 core tools with full hybrid
324
+ A single HTTPS URL gives any remote-capable MCP client all 13 core tools with full hybrid
323
325
  search -- no Python, no `uv`, no local repository clone needed.
324
326
 
325
327
  **URL format:**
@@ -500,7 +502,7 @@ Replace `<your-project-ref>` with your Supabase project ref.
500
502
  **Step 3 — Verify:**
501
503
 
502
504
  Launch Codex and use the `/mcp` slash command to confirm the `cerefox` server is connected
503
- and all 12 tools are listed.
505
+ and all 13 tools are listed.
504
506
 
505
507
  **Notes:**
506
508
  - `bearer_token_env_var` is the **name** of the env var (e.g. `"CEREFOX_ACCESS_TOKEN"`), not the
@@ -1149,7 +1151,7 @@ user + `CEREFOX_OAUTH_OWNER_ID` pin, and register the Claude OAuth App
1149
1151
  Client Secret from the pre-registered OAuth App (setup-supabase Step 7d).
1150
1152
  5. Save. Claude runs the OAuth flow → redirects you to the **Cerefox consent page** (sign
1151
1153
  in with the owner email/password from Step 7c, then **Allow**) → returns to Claude. The
1152
- connector shows as connected with **12 tools** (16 if you have enabled document relations). (If you've approved before, Supabase
1154
+ connector shows as connected with **13 tools** (16 if you have enabled document relations). (If you've approved before, Supabase
1153
1155
  auto-consents and the page just flashes through — that's expected.)
1154
1156
  6. **Mobile**: connectors are account-level, so `CerefoxMCP` appears in the Claude mobile
1155
1157
  app automatically — run one search from your phone to confirm.
@@ -1245,6 +1247,7 @@ The agent docs are written around MCP tool names. **CLI flag names match MCP par
1245
1247
  | `cerefox_get_document` | `cerefox document get <document-id> --version-id <vid> --requestor <name>` |
1246
1248
  | `cerefox_list_versions` | `cerefox document version list <document-id> --requestor <name>` |
1247
1249
  | `cerefox_list_projects` | `cerefox project list --requestor <name>` |
1250
+ | `cerefox_set_document_metadata` | `cerefox document set-metadata <document-id> --set key=value` (also `--remove key`, `--json '{...}'`, `--replace`) |
1248
1251
  | `cerefox_set_document_projects` | `cerefox document set-projects <document-id> <name...> --author <a> --author-type user\|agent` (or `--clear`) |
1249
1252
  | `cerefox_list_metadata_keys` | `cerefox metadata keys` |
1250
1253
  | `cerefox_metadata_search` | `cerefox metadata search --metadata-filter '<json>' --project-name <n> --requestor <name>` |
@@ -74,7 +74,7 @@ paths go through **Edge Functions**, which the free tier caps at 500,000/month:
74
74
  500K/month is generous for a single human-driven agent. But **automated or
75
75
  high-frequency agents on the remote path** can approach it. The lever: point those
76
76
  agents at the **local stdio MCP server** (`cerefox mcp`) instead of the remote Edge
77
- Function — it exposes the identical 12 core tools (plus the 4 relation tools when enabled), talks to the Data API directly, and
77
+ Function — it exposes the identical 13 core tools (plus the 4 relation tools when enabled), talks to the Data API directly, and
78
78
  costs **zero** Edge Function invocations (bonus: lower latency, and it works offline
79
79
  against a reachable database). If you do exceed the free EF quota, Supabase's Pro
80
80
  plan ($25/mo, 2M invocations included) is the next step.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cerefox/memory",
3
- "version": "1.5.0",
3
+ "version": "1.6.1",
4
4
  "description": "Cerefox — user-owned shared memory for AI agents. CLI + stdio MCP server + web UI + ingestion for a knowledge base on your own Supabase project (or fully self-hosted with Cerefox Local).",
5
5
  "license": "Apache-2.0",
6
6
  "homepage": "https://github.com/fstamatelopoulos/cerefox",