@cerefox/memory 1.13.0 → 1.13.2

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.
Files changed (39) hide show
  1. package/AGENT_GUIDE.md +33 -33
  2. package/AGENT_QUICK_REFERENCE.md +19 -19
  3. package/dist/bin/cerefox.js +124 -133
  4. package/dist/server-assets/_shared/ef-meta/index.ts +3 -3
  5. package/dist/server-assets/_shared/mcp-tools/audit-log.ts +10 -8
  6. package/dist/server-assets/_shared/mcp-tools/delete-document.ts +4 -10
  7. package/dist/server-assets/_shared/mcp-tools/feature-flags.ts +4 -3
  8. package/dist/server-assets/_shared/mcp-tools/get-document.ts +3 -6
  9. package/dist/server-assets/_shared/mcp-tools/get-help-content.ts +4 -4
  10. package/dist/server-assets/_shared/mcp-tools/get-help.ts +3 -6
  11. package/dist/server-assets/_shared/mcp-tools/identity.ts +48 -0
  12. package/dist/server-assets/_shared/mcp-tools/ingest.ts +3 -6
  13. package/dist/server-assets/_shared/mcp-tools/list-metadata-keys.ts +3 -6
  14. package/dist/server-assets/_shared/mcp-tools/list-projects.ts +3 -6
  15. package/dist/server-assets/_shared/mcp-tools/list-versions.ts +3 -6
  16. package/dist/server-assets/_shared/mcp-tools/metadata-search.ts +3 -6
  17. package/dist/server-assets/_shared/mcp-tools/partial-edits.ts +5 -10
  18. package/dist/server-assets/_shared/mcp-tools/relations.ts +11 -12
  19. package/dist/server-assets/_shared/mcp-tools/restore-document.ts +4 -10
  20. package/dist/server-assets/_shared/mcp-tools/search.ts +3 -6
  21. package/dist/server-assets/_shared/mcp-tools/set-document-metadata.ts +4 -10
  22. package/dist/server-assets/_shared/mcp-tools/set-document-projects.ts +3 -6
  23. package/dist/server-assets/db/migrations/0031_review_workflow_toggle.sql +4 -2
  24. package/dist/server-assets/db/rpcs.sql +19 -12
  25. package/dist/server-assets/db/schema.sql +4 -4
  26. package/dist/server-assets/supabase/functions/cerefox-get-audit-log/index.ts +7 -5
  27. package/dist/server-assets/supabase/functions/cerefox-get-document/index.ts +5 -4
  28. package/dist/server-assets/supabase/functions/cerefox-ingest/index.ts +7 -3
  29. package/dist/server-assets/supabase/functions/cerefox-list-projects/index.ts +6 -5
  30. package/dist/server-assets/supabase/functions/cerefox-list-versions/index.ts +5 -4
  31. package/dist/server-assets/supabase/functions/cerefox-mcp/index.ts +6 -6
  32. package/dist/server-assets/supabase/functions/cerefox-metadata/index.ts +5 -4
  33. package/dist/server-assets/supabase/functions/cerefox-metadata-search/index.ts +5 -4
  34. package/dist/server-assets/supabase/functions/cerefox-search/index.ts +7 -4
  35. package/docs/guides/cli.md +20 -20
  36. package/docs/guides/configuration.md +37 -25
  37. package/docs/guides/connect-agents.md +47 -31
  38. package/docs/guides/upgrading.md +11 -0
  39. package/package.json +1 -1
@@ -2,6 +2,7 @@ import "jsr:@supabase/functions-js/edge-runtime.d.ts";
2
2
  import { createClient } from "jsr:@supabase/supabase-js@2";
3
3
  import { isVersionRequest, versionResponse } from "../../../_shared/ef-meta/index.ts";
4
4
  import { efAuthGate } from "../../../_shared/ef-auth/index.ts";
5
+ import { callerIdentity } from "../../../_shared/mcp-tools/identity.ts";
5
6
  import { reviewWorkflowEnabled } from "../../../_shared/mcp-tools/feature-flags.ts";
6
7
 
7
8
  /**
@@ -110,9 +111,9 @@ Deno.serve(async (req: Request): Promise<Response> => {
110
111
  const supabaseKey = Deno.env.get("SUPABASE_SERVICE_ROLE_KEY")!;
111
112
  const supabase = createClient(supabaseUrl, supabaseKey);
112
113
 
113
- // Configurable requestor enforcement
114
- const identityField = "requestor";
115
- const identityValue = body[identityField];
114
+ // Configurable caller-identity enforcement: `author`, or `requestor` as the pre-1.13.2 alias (#244)
115
+ const identityField = "author";
116
+ const identityValue = callerIdentity(body as Record<string, unknown>);
116
117
  const { data: reqConfig } = await supabase.rpc("cerefox_get_config", { p_key: "require_requestor_identity" });
117
118
  if (reqConfig === "true") {
118
119
  if (!identityValue || (typeof identityValue === "string" && identityValue.trim() === "")) {
@@ -157,7 +158,7 @@ Deno.serve(async (req: Request): Promise<Response> => {
157
158
  Promise.resolve(supabase.rpc("cerefox_log_usage", {
158
159
  p_operation: "metadata_search",
159
160
  p_access_path: "edge-function",
160
- p_requestor: body.requestor ?? null,
161
+ p_requestor: identityValue ?? null,
161
162
  p_query_text: JSON.stringify(metadata_filter),
162
163
  p_result_count: (data ?? []).length,
163
164
  p_project_id: project_id,
@@ -2,6 +2,7 @@ import "jsr:@supabase/functions-js/edge-runtime.d.ts";
2
2
  import { createClient } from "jsr:@supabase/supabase-js@2";
3
3
  import { isVersionRequest, versionResponse } from "../../../_shared/ef-meta/index.ts";
4
4
  import { efAuthGate } from "../../../_shared/ef-auth/index.ts";
5
+ import { callerIdentity } from "../../../_shared/mcp-tools/identity.ts";
5
6
  import { capEmbeddingInput } from "../../../_shared/embeddings/index.ts";
6
7
 
7
8
  /**
@@ -67,6 +68,8 @@ interface SearchRequest {
67
68
  min_score?: number;
68
69
  metadata_filter?: Record<string, string> | null;
69
70
  max_bytes?: number;
71
+ author?: string;
72
+ /** Pre-1.13.2 spelling of `author`; still accepted. */
70
73
  requestor?: string;
71
74
  }
72
75
 
@@ -266,9 +269,9 @@ Deno.serve(async (req: Request) => {
266
269
  const supabaseKey = Deno.env.get("SUPABASE_SERVICE_ROLE_KEY")!;
267
270
  const supabase = createClient(supabaseUrl, supabaseKey);
268
271
 
269
- // Configurable requestor enforcement
270
- const identityField = "requestor";
271
- const identityValue = body[identityField as keyof SearchRequest] as string | undefined;
272
+ // Configurable caller-identity enforcement: `author`, or `requestor` as the pre-1.13.2 alias (#244)
273
+ const identityField = "author";
274
+ const identityValue = callerIdentity(body as unknown as Record<string, unknown>);
272
275
  const { data: reqConfig } = await supabase.rpc("cerefox_get_config", { p_key: "require_requestor_identity" });
273
276
  if (reqConfig === "true") {
274
277
  if (!identityValue || (typeof identityValue === "string" && identityValue.trim() === "")) {
@@ -377,7 +380,7 @@ Deno.serve(async (req: Request) => {
377
380
  Promise.resolve(supabase.rpc("cerefox_log_usage", {
378
381
  p_operation: "search",
379
382
  p_access_path: "edge-function",
380
- p_requestor: body.requestor ?? null,
383
+ p_requestor: identityValue ?? null,
381
384
  p_query_text: query,
382
385
  p_result_count: accepted.length,
383
386
  p_project_id: projectId,
@@ -50,7 +50,7 @@ cerefox document ingest --paste --title "<title>" [OPTIONS] # stdin
50
50
  | `--last-write-wins` | — | flag | off | Skip the concurrency check and overwrite regardless of concurrent changes. For re-sync flows where an external source of truth makes conflicts meaningless. Recorded in the audit log. |
51
51
  | `--source` | — | str | `paste` / `file` | Source label recorded on the document. |
52
52
  | `--author` | — | str | `CEREFOX_AUTHOR_NAME` or `unknown` | Audit-log author identity. |
53
- | `--author-type` | — | `user`\|`agent` | `CEREFOX_AUTHOR_TYPE` or `user` | Caller type. Agent writes land `pending_review` while the review workflow is on (`review_workflow_enabled`); `approved` otherwise. |
53
+ | `--author-type` | — | `user`\|`agent` | `CEREFOX_AUTHOR_TYPE` or `user` | Caller type. Agent writes are recorded `pending_review`, user writes `approved`; the store's `review_workflow_enabled` flag decides whether that status is shown. |
54
54
 
55
55
  **Examples**:
56
56
  ```bash
@@ -149,14 +149,14 @@ cerefox search [OPTIONS] QUERY
149
149
  | `--metadata-filter <json>` (`-f`) | JSON | _none_ | JSONB metadata containment filter, e.g. `'{"type":"decision"}'`. |
150
150
  | `--max-bytes <n>` | int | `200000` | Response size budget in bytes. |
151
151
  | `--only-metadata` | flag | off | List matching docs (id, score, chunks, chars) without content — a compact listing. |
152
- | `--requestor <name>` (`-r`) | str | `CEREFOX_REQUESTOR_NAME` or `user` | Identity recorded in the usage log. |
152
+ | `--author <name>` (`-a`) | str | `CEREFOX_REQUESTOR_NAME`, then `CEREFOX_AUTHOR_NAME`, else `unknown` | Your name (agent or user), recorded in the usage log. `--requestor` (`-r`) still works as a hidden alias (v1.13.2). |
153
153
  | `--json` | flag | off | Machine-readable JSON output. |
154
154
 
155
155
  **Examples**:
156
156
  ```bash
157
157
  cerefox search "OAuth design"
158
158
  cerefox search "decisions" --metadata-filter '{"type":"decision-log"}' --match-count 5
159
- cerefox search "what we tried" --mode hybrid --requestor "claude-code"
159
+ cerefox search "what we tried" --mode hybrid --author "claude-code"
160
160
  cerefox search "design docs" --only-metadata
161
161
  ```
162
162
 
@@ -182,7 +182,7 @@ cerefox document get [OPTIONS] DOCUMENT_ID
182
182
  | Flag | Type | Default | Description |
183
183
  |---|---|---|---|
184
184
  | `--version-id <uuid>` | UUID | _none_ (current) | Archived version UUID — get from `cerefox document version list`. |
185
- | `--requestor <name>` (`-r`) | str | `CEREFOX_REQUESTOR_NAME` or `user` | Identity recorded in the usage log. |
185
+ | `--author <name>` (`-a`) | str | `CEREFOX_REQUESTOR_NAME`, then `CEREFOX_AUTHOR_NAME`, else `unknown` | Your name (agent or user), recorded in the usage log. `--requestor` (`-r`) still works as a hidden alias (v1.13.2). |
186
186
  | `--json` | flag | off | Machine-readable JSON output. |
187
187
 
188
188
  **Examples**:
@@ -394,7 +394,7 @@ cerefox document version list [OPTIONS] DOCUMENT_ID
394
394
 
395
395
  | Flag | Type | Default | Description |
396
396
  |---|---|---|---|
397
- | `--requestor TEXT` | str | `CEREFOX_REQUESTOR_NAME` or `user` | Identity recorded in the usage log. |
397
+ | `--author TEXT` (`-a`) | str | `CEREFOX_REQUESTOR_NAME`, then `CEREFOX_AUTHOR_NAME`, else `unknown` | Your name (agent or user), recorded in the usage log. `--requestor` (`-r`) still works as a hidden alias (v1.13.2). |
398
398
 
399
399
  **Output**: table with version number, created timestamp, source, chunk/char counts, and version UUID. Pass the UUID to `cerefox document get --version-id <uuid>` to retrieve the archived content.
400
400
 
@@ -429,7 +429,7 @@ cerefox project list [OPTIONS]
429
429
 
430
430
  | Flag | Type | Default | Description |
431
431
  |---|---|---|---|
432
- | `--requestor TEXT` | str | `CEREFOX_REQUESTOR_NAME` or `user` | Identity recorded in the usage log. |
432
+ | `--author TEXT` (`-a`) | str | `CEREFOX_REQUESTOR_NAME`, then `CEREFOX_AUTHOR_NAME`, else `unknown` | Your name (agent or user), recorded in the usage log. `--requestor` (`-r`) still works as a hidden alias (v1.13.2). |
433
433
 
434
434
  **MCP equivalent**: [`cerefox_list_projects`](../../AGENT_GUIDE.md).
435
435
 
@@ -498,7 +498,7 @@ cerefox metadata search --metadata-filter '<json>' [OPTIONS]
498
498
  | `--created-since TEXT` | ISO-8601 | _none_ | Documents created after this timestamp. |
499
499
  | `--limit INTEGER` | int | `10` | Max results. |
500
500
  | `--include-content` | flag | off | Include full document content (slower; subject to byte budget). |
501
- | `--requestor TEXT` | str | `CEREFOX_REQUESTOR_NAME` or `user` | Identity recorded in the usage log. |
501
+ | `--author TEXT` (`-a`) | str | `CEREFOX_REQUESTOR_NAME`, then `CEREFOX_AUTHOR_NAME`, else `unknown` | Your name (agent or user), recorded in the usage log. `--requestor` (`-r`) still works as a hidden alias (v1.13.2). |
502
502
 
503
503
  **Examples**:
504
504
  ```bash
@@ -526,13 +526,13 @@ cerefox audit list [OPTIONS]
526
526
  | Flag | Type | Default | Description |
527
527
  |---|---|---|---|
528
528
  | `--document-id TEXT` | UUID | _none_ | Filter to a single document. |
529
- | `--author TEXT` | str | _none_ | Filter by author name (exact match). |
529
+ | `--by-author TEXT` | str | _none_ | Filter: only entries written by this author name (exact match). Until v1.13.2 this filter was `--author`; `--author` is now the caller identity here, as on every other command. |
530
530
  | `--operation TEXT` | choice | _none_ | Filter by operation type: `create`, `update-content`, `update-metadata`, `insert`, `replace-section`, `delete-section`, `rename-section`, `delete`, `restore`, `status-change`, `archive`, `unarchive`, `config-change`, `project-create`, `project-edit`, `project-delete`. |
531
531
  | `--since TEXT` | ISO-8601 | _none_ | Lower bound on `created_at`. |
532
532
  | `--until TEXT` | ISO-8601 | _none_ | Upper bound on `created_at`. |
533
533
  | `--limit INTEGER` | int | `50` | Max rows. |
534
534
  | `--json` | flag | off | Emit one JSON object per line (for piping to `jq` / scripts). |
535
- | `--requestor TEXT` | str | `CEREFOX_REQUESTOR_NAME` or `user` | Identity recorded in the usage log. |
535
+ | `--author TEXT` (`-a`) | str | `CEREFOX_REQUESTOR_NAME`, then `CEREFOX_AUTHOR_NAME`, else `unknown` | Your name (agent or user), recorded in the usage log. `--requestor` (`-r`) still works as a hidden alias (v1.13.2). |
536
536
 
537
537
  **Examples**:
538
538
  ```bash
@@ -791,7 +791,7 @@ The CLI reads its own runtime config from environment (or `.env`). See [`configu
791
791
  |---|---|---|
792
792
  | `CEREFOX_AUTHOR_NAME` | `unknown` | Default for `--author` on `ingest` / `ingest-dir`. |
793
793
  | `CEREFOX_AUTHOR_TYPE` | `user` | Default for `--author-type`. |
794
- | `CEREFOX_REQUESTOR_NAME` | `user` | Default for `--requestor` on read commands. |
794
+ | `CEREFOX_REQUESTOR_NAME` | `user` | Default for `--author` on read commands (falls back to `CEREFOX_AUTHOR_NAME`). |
795
795
 
796
796
  Precedence: **CLI flag > env var > built-in default**.
797
797
 
@@ -811,21 +811,21 @@ Every MCP parameter has an exact-name CLI flag (kebab-cased). Short forms exist
811
811
 
812
812
  | MCP tool | CLI command |
813
813
  |---|---|
814
- | `cerefox_search(query, match_count, project_name, metadata_filter, requestor)` | `cerefox search "<q>" --match-count N --project-name <name> --metadata-filter '<json>' --requestor <name>` |
814
+ | `cerefox_search(query, match_count, project_name, metadata_filter, author)` | `cerefox search "<q>" --match-count N --project-name <name> --metadata-filter '<json>' --author <name>` |
815
815
  | `cerefox_ingest(title, content, project_name, metadata, update_if_exists, document_id, expected_content_hash, last_write_wins, source, author, author_type)` (file) | `cerefox document ingest <path> --title <t> --project-name <n> --metadata '<json>' --update-if-exists\|--document-id <uuid> --expected-content-hash <hash>\|--last-write-wins --source <s> --author <a> --author-type <t>` |
816
816
  | `cerefox_ingest(...)` (paste) | `printf '...' \| cerefox document ingest --paste --title "<t>"` (same flags) |
817
- | `cerefox_get_document(document_id, version_id, outline, requestor)` | `cerefox document get <id> --version-id <vid> --outline --requestor <name>` |
818
- | `cerefox_insert(document_id, text, position, anchor_heading, section_part, expected_content_hash, requestor)` | `cerefox document insert <id> -t <text\|-\|@file> -p <position> -a <anchor> --section-part <part> --expected-hash <hash> --requestor <name>` |
819
- | `cerefox_edit(document_id, operations, expected_content_hash, requestor)` | `cerefox document edit-parts <id> -o <json\|-\|@file> --expected-hash <hash> --requestor <name>` |
820
- | `cerefox_list_versions(document_id, requestor)` | `cerefox document version list <id> --requestor <name>` |
821
- | `cerefox_list_projects(requestor)` | `cerefox project list --requestor <name>` |
817
+ | `cerefox_get_document(document_id, version_id, outline, author)` | `cerefox document get <id> --version-id <vid> --outline --author <name>` |
818
+ | `cerefox_insert(document_id, text, position, anchor_heading, section_part, expected_content_hash, author)` | `cerefox document insert <id> -t <text\|-\|@file> -p <position> -a <anchor> --section-part <part> --expected-hash <hash> --author <name>` |
819
+ | `cerefox_edit(document_id, operations, expected_content_hash, author)` | `cerefox document edit-parts <id> -o <json\|-\|@file> --expected-hash <hash> --author <name>` |
820
+ | `cerefox_list_versions(document_id, author)` | `cerefox document version list <id> --author <name>` |
821
+ | `cerefox_list_projects(author)` | `cerefox project list --author <name>` |
822
822
  | `cerefox_set_document_projects(document_id, project_names, author)` | `cerefox document set-projects <id> <name...> --author <a> --author-type <t>` (or `--clear` to remove all) |
823
823
  | `cerefox_list_metadata_keys()` | `cerefox metadata keys` |
824
- | `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>` |
825
- | `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 --requestor <name>` |
824
+ | `cerefox_metadata_search(metadata_filter, project_name, updated_since, created_since, limit, include_content, author)` | `cerefox metadata search --metadata-filter '<json>' --project-name <n> --updated-since <iso> --created-since <iso> --limit N --include-content --author <name>` |
825
+ | `cerefox_get_audit_log(document_id, by_author, operation, since, until, limit, author)` | `cerefox audit list --document-id <id> --by-author <a> --operation <op> --since <iso> --until <iso> --limit N --author <name>` |
826
826
  | `cerefox_set_document_metadata(document_id, metadata, replace, author)` | `cerefox document set-metadata <id> --set key=value` (also `--remove key`, `--json '<json>'`, `--replace`) |
827
- | `cerefox_delete_document(document_id, expected_content_hash, reason, author, requestor)` | `cerefox document delete <id> --reason <text> --author <a> --author-type <t> --yes` (confirms interactively instead of requiring the hash) |
828
- | `cerefox_restore_document(document_id, reason, author, requestor)` | `cerefox document restore <id> --reason <text> --author <a> --author-type <t>` |
827
+ | `cerefox_delete_document(document_id, expected_content_hash, reason, author)` | `cerefox document delete <id> --reason <text> --author <a> --author-type <t> --yes` (confirms interactively instead of requiring the hash) |
828
+ | `cerefox_restore_document(document_id, reason, author)` | `cerefox document restore <id> --reason <text> --author <a> --author-type <t>` |
829
829
 
830
830
  ## CLI ↔ MCP parity matrix
831
831
 
@@ -480,14 +480,23 @@ cerefox config get usage_tracking_enabled
480
480
 
481
481
  ## Requestor Identity Enforcement
482
482
 
483
- By default, the `requestor` parameter on MCP read tools (and `author` on ingest) is
484
- optional. When omitted, it defaults to `"mcp-agent"`. This means the usage log shows
485
- `"mcp-agent"` for all calls that don't explicitly identify themselves, making analytics
486
- less useful in multi-agent setups.
487
-
488
- You can optionally enforce caller identification so that MCP tool calls must include
489
- a requestor/author identity. Calls without identity receive a JSON-RPC `-32602` error
490
- with a helpful message telling the agent what to provide.
483
+ By default, the `author` parameter on the MCP tools is optional. When omitted, it
484
+ defaults to `"mcp-agent"`. This means the usage log shows `"mcp-agent"` for all calls
485
+ that don't explicitly identify themselves, making analytics less useful in
486
+ multi-agent setups.
487
+
488
+ Since v1.13.1 every MCP tool takes the caller's identity as **`author`**, reads and
489
+ writes alike; `requestor` (the pre-1.13.1 name on most tools) is still accepted as
490
+ a silent alias. (On `cerefox_get_audit_log` the entries filter, formerly `author`,
491
+ is now `by_author`.) Since v1.13.2 the CLI (`--author` on every command,
492
+ `--requestor` a hidden alias, `--by-author` the audit-list filter) and the
493
+ primitive Edge Functions used by GPT Actions (`author` in every request body,
494
+ `requestor` an alias, `by_author` on `cerefox-get-audit-log`) follow the same
495
+ rule, so there is one name on every surface.
496
+
497
+ You can optionally enforce caller identification so that tool calls must include
498
+ an identity. Calls without one receive a JSON-RPC `-32602` error with a helpful
499
+ message telling the agent what to provide.
491
500
 
492
501
  ### What it actually covers
493
502
 
@@ -516,7 +525,7 @@ tenth copy of the same block. Raise an issue rather than assuming it is there.
516
525
  ### Enabling enforcement
517
526
 
518
527
  ```bash
519
- # Require all MCP tool calls to include requestor/author
528
+ # Require all MCP tool calls to include author (or the requestor alias)
520
529
  cerefox config set require_requestor_identity true
521
530
 
522
531
  # Optionally override the default naming format (regex)
@@ -532,7 +541,7 @@ cerefox config set requestor_identity_format "^[a-z]+:[a-z]+$"
532
541
  | `^[a-z]+:[a-z]+$` | `conclave:agent` format only | Multi-conclave setups (e.g., `personal:steward`) |
533
542
  | (empty string) | Any non-empty string | No format restriction |
534
543
 
535
- The format is applied to both `requestor` (read tools) and `author` (ingest).
544
+ The format is applied to whichever identity field the call carries (`author`, or the `requestor` alias).
536
545
 
537
546
  ### Disabling enforcement
538
547
 
@@ -540,7 +549,7 @@ The format is applied to both `requestor` (read tools) and `author` (ingest).
540
549
  cerefox config set require_requestor_identity false
541
550
  ```
542
551
 
543
- When disabled, the requestor parameter remains optional with the `"mcp-agent"` default.
552
+ When disabled, the identity parameter remains optional with the `"mcp-agent"` default.
544
553
  This is the default state -- no configuration needed for backward compatibility.
545
554
 
546
555
  ---
@@ -570,20 +579,23 @@ cerefox config set review_workflow_enabled true # or false; also in Settings
570
579
  cerefox doctor # prints "review workflow ON …" / "OFF …"
571
580
  ```
572
581
 
573
- **With the workflow off, the feature is absent, not dimmed.** Every write lands
574
- `approved` whoever wrote it the decision is made once, inside the
575
- `cerefox_ingest_document` RPC, so every access path (CLI, local and remote MCP,
576
- Edge Functions, web) obeys the same setting, including older clients. No surface
577
- shows a `review_status`: the web pill, badges and search chip do not render;
578
- the CLI drops its `status` column; API, MCP and Edge Function rows carry no
579
- `review_status` key; `GET /api/v1/search?review_status=…` is a `400`; and
580
- `POST /api/v1/documents/{id}/review-status` is a `404`.
581
-
582
- **Toggling never touches stored data.** Flipping the flag off does not approve
583
- anything and flipping it on does not queue anything; documents that were
584
- `pending_review` are still pending, and are shown as such the moment the flag
585
- is on again. Attribution and the audit log are unaffected in both states — who
586
- wrote what is always recorded. Config changes are audited too.
582
+ **With the workflow off, the feature is hidden, not dimmed.** No surface
583
+ shows or enforces a `review_status`: the web pill, badges and search chip do
584
+ not render; the CLI drops its `status` column; API, MCP and Edge Function rows
585
+ carry no `review_status` key; `GET /api/v1/search?review_status=…` is a `400`;
586
+ and `POST /api/v1/documents/{id}/review-status` is a `404`.
587
+
588
+ **The flag hides; it never rewrites.** Writes are recorded the same way in
589
+ both states — agent writes `pending_review`, user writes `approved`, decided
590
+ once inside the `cerefox_ingest_document` RPC so every access path (CLI, local
591
+ and remote MCP, Edge Functions, web) behaves alike, including older clients.
592
+ Flipping the flag off does not approve anything and flipping it on does not
593
+ queue anything; documents that were `pending_review` are still pending, and a
594
+ document an agent wrote while the workflow was off is pending too, shown as
595
+ such the moment the flag is on again. (v1.13.0 stored `approved` for every
596
+ write while off; v1.13.1 corrected that.) Attribution and the audit log are
597
+ unaffected in both states — who wrote what is always recorded. Config changes
598
+ are audited too.
587
599
 
588
600
  Design: [`docs/specs/review-workflow-toggle.md`](../specs/review-workflow-toggle.md).
589
601
 
@@ -221,7 +221,7 @@ You have access to a personal knowledge base via Cerefox MCP tools.
221
221
  When answering questions, always call cerefox_search first with a relevant query.
222
222
  Cite doc_title for every claim drawn from the knowledge base.
223
223
  Use cerefox_ingest to save anything the user asks you to remember.
224
- Always set your requestor/author parameter to identify yourself.
224
+ Always set the author parameter to identify yourself.
225
225
  For the full tool reference, search Cerefox for "How AI Agents Use Cerefox".
226
226
  ```
227
227
 
@@ -638,7 +638,7 @@ In the action editor, paste this schema (replace `<your-project-ref>`):
638
638
  openapi: 3.1.0
639
639
  info:
640
640
  title: Cerefox Knowledge Base
641
- version: 3.4.0
641
+ version: 4.0.0
642
642
  servers:
643
643
  - url: https://<your-project-ref>.supabase.co/functions/v1
644
644
  paths:
@@ -698,11 +698,12 @@ paths:
698
698
  Whole results are dropped (never truncated mid-document) until
699
699
  the budget is met; the response sets `truncated: true` when this
700
700
  happens. Advanced; leave unset for the default.
701
- requestor:
701
+ author:
702
702
  type: string
703
703
  description: >
704
- Name of the agent making this request (e.g., "ChatGPT").
705
- Recorded in the usage log for attribution. Optional.
704
+ Your name (agent or user), e.g. "ChatGPT". Recorded in the
705
+ usage log for attribution. Optional. `requestor` is still
706
+ accepted as an alias.
706
707
  responses:
707
708
  '200':
708
709
  description: >
@@ -798,10 +799,10 @@ paths:
798
799
  default: agent
799
800
  description: >
800
801
  Whether this write is from a human user or an AI agent.
801
- Always recorded for attribution. While the store's review
802
- workflow is on (review_workflow_enabled), agent writes land
803
- pending_review and user writes approved; with it off every
804
- write lands approved.
802
+ Always recorded for attribution. Agent writes are recorded
803
+ pending_review and user writes approved; the store's review
804
+ workflow flag (review_workflow_enabled) only decides whether
805
+ that status is shown.
805
806
  responses:
806
807
  '200':
807
808
  description: >
@@ -847,9 +848,11 @@ paths:
847
848
  schema:
848
849
  type: object
849
850
  properties:
850
- requestor:
851
+ author:
851
852
  type: string
852
- description: Name of the agent making this request. Optional.
853
+ description: >
854
+ Your name (agent or user). Recorded in the usage log.
855
+ Optional. `requestor` is still accepted as an alias.
853
856
  responses:
854
857
  '200':
855
858
  description: Array of metadata keys with doc_count and example_values
@@ -875,9 +878,11 @@ paths:
875
878
  description: >
876
879
  UUID of a specific archived version to retrieve. Omit (or pass null)
877
880
  for the current version. Version UUIDs are returned by listVersions.
878
- requestor:
881
+ author:
879
882
  type: string
880
- description: Name of the agent making this request. Optional.
883
+ description: >
884
+ Your name (agent or user). Recorded in the usage log.
885
+ Optional. `requestor` is still accepted as an alias.
881
886
  responses:
882
887
  '200':
883
888
  description: >
@@ -905,9 +910,11 @@ paths:
905
910
  document_id:
906
911
  type: string
907
912
  description: UUID of the document whose version history to list
908
- requestor:
913
+ author:
909
914
  type: string
910
- description: Name of the agent making this request. Optional.
915
+ description: >
916
+ Your name (agent or user). Recorded in the usage log.
917
+ Optional. `requestor` is still accepted as an alias.
911
918
  responses:
912
919
  '200':
913
920
  description: >
@@ -929,9 +936,12 @@ paths:
929
936
  document_id:
930
937
  type: string
931
938
  description: Filter by document UUID (optional)
932
- author:
939
+ by_author:
933
940
  type: string
934
- description: Filter by author name (optional)
941
+ description: >
942
+ Filter: only entries written by this author name (optional).
943
+ Was `author` before v1.13.2; `author` is now the caller's
944
+ identity here, as on every other operation.
935
945
  operation:
936
946
  type: string
937
947
  description: >
@@ -949,9 +959,11 @@ paths:
949
959
  type: integer
950
960
  default: 50
951
961
  description: Max entries to return (max 200)
952
- requestor:
962
+ author:
953
963
  type: string
954
- description: Name of the agent making this request. Optional.
964
+ description: >
965
+ Your name (agent or user). Recorded in the usage log.
966
+ Optional. `requestor` is still accepted as an alias.
955
967
  responses:
956
968
  '200':
957
969
  description: >
@@ -969,9 +981,11 @@ paths:
969
981
  schema:
970
982
  type: object
971
983
  properties:
972
- requestor:
984
+ author:
973
985
  type: string
974
- description: Name of the agent making this request. Optional.
986
+ description: >
987
+ Your name (agent or user). Recorded in the usage log.
988
+ Optional. `requestor` is still accepted as an alias.
975
989
  responses:
976
990
  '200':
977
991
  description: >
@@ -1028,9 +1042,11 @@ paths:
1028
1042
  description: >
1029
1043
  Response size budget in bytes when include_content is true
1030
1044
  (whole results dropped to fit). Advanced; leave unset for the default.
1031
- requestor:
1045
+ author:
1032
1046
  type: string
1033
- description: Name of the agent making this request. Optional.
1047
+ description: >
1048
+ Your name (agent or user). Recorded in the usage log.
1049
+ Optional. `requestor` is still accepted as an alias.
1034
1050
  responses:
1035
1051
  '200':
1036
1052
  description: >
@@ -1258,7 +1274,7 @@ You have access to a personal Cerefox knowledge base via a local CLI.
1258
1274
  Identify yourself on every call:
1259
1275
  - Writes (document ingest, document ingest-dir): pass --author "<your-name>" --author-type agent
1260
1276
  - Reads (search, document get, document version list, project list,
1261
- metadata search, audit list): pass --requestor "<your-name>"
1277
+ metadata search, audit list): pass --author "<your-name>" (the same flag as on writes)
1262
1278
 
1263
1279
  When answering questions, search Cerefox first. When the user asks you to
1264
1280
  remember something, ingest it. Cite document titles for every claim drawn
@@ -1271,17 +1287,17 @@ The agent docs are written around MCP tool names. **CLI flag names match MCP par
1271
1287
 
1272
1288
  | MCP tool | CLI command |
1273
1289
  |---|---|
1274
- | `cerefox_search` | `cerefox search "<query>" --match-count N --project-name <n> --metadata-filter '<json>' --requestor <name>` (CLI-only: `--mode`, `--alpha`, `--min-score`, `--only-metadata`) |
1290
+ | `cerefox_search` | `cerefox search "<query>" --match-count N --project-name <n> --metadata-filter '<json>' --author <name>` (CLI-only: `--mode`, `--alpha`, `--min-score`, `--only-metadata`) |
1275
1291
  | `cerefox_ingest` (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` |
1276
1292
  | `cerefox_ingest` (paste) | `printf '...' \| cerefox document ingest --paste --title "<title>"` (same flags) |
1277
- | `cerefox_get_document` | `cerefox document get <document-id> --version-id <vid> --requestor <name>` |
1278
- | `cerefox_list_versions` | `cerefox document version list <document-id> --requestor <name>` |
1279
- | `cerefox_list_projects` | `cerefox project list --requestor <name>` |
1293
+ | `cerefox_get_document` | `cerefox document get <document-id> --version-id <vid> --author <name>` |
1294
+ | `cerefox_list_versions` | `cerefox document version list <document-id> --author <name>` |
1295
+ | `cerefox_list_projects` | `cerefox project list --author <name>` |
1280
1296
  | `cerefox_set_document_metadata` | `cerefox document set-metadata <document-id> --set key=value` (also `--remove key`, `--json '{...}'`, `--replace`) |
1281
1297
  | `cerefox_set_document_projects` | `cerefox document set-projects <document-id> <name...> --author <a> --author-type user\|agent` (or `--clear`) |
1282
1298
  | `cerefox_list_metadata_keys` | `cerefox metadata keys` |
1283
- | `cerefox_metadata_search` | `cerefox metadata search --metadata-filter '<json>' --project-name <n> --requestor <name>` |
1284
- | `cerefox_get_audit_log` | `cerefox audit list --document-id <id> --author <a> --operation <op> --since <iso> --until <iso> --limit N --json --requestor <name>` |
1299
+ | `cerefox_metadata_search` | `cerefox metadata search --metadata-filter '<json>' --project-name <n> --author <name>` |
1300
+ | `cerefox_get_audit_log` | `cerefox audit list --document-id <id> --by-author <a> --operation <op> --since <iso> --until <iso> --limit N --json --author <name>` |
1285
1301
 
1286
1302
  > CLI verbs with no MCP equivalent: `cerefox document edit`, `cerefox project create` / `cerefox project edit`, `cerefox config list`.
1287
1303
 
@@ -1301,7 +1317,7 @@ After pointing your agent at the repo, ask it:
1301
1317
  ### Caveats
1302
1318
 
1303
1319
  - **Privilege level**: the CLI uses the **service-role key** (`CEREFOX_SUPABASE_KEY`), which bypasses Row Level Security. An agent with Bash access has the same full read/write power you do. Only enable Path C for agents you trust to act on your behalf — the same trust level you'd grant Cursor/Claude Code for editing your source code.
1304
- - **Audit attribution**: Path C records `access_path = "cli"` in usage logs, distinct from `"local-mcp"` / `"remote-mcp"`. **Agents must set `--author <name> --author-type agent` on writes and `--requestor <name>` on reads** (or rely on `CEREFOX_AUTHOR_NAME` / `CEREFOX_AUTHOR_TYPE` / `CEREFOX_REQUESTOR_NAME` env vars). Without these flags, writes attribute to `"unknown"` / `"user"`, which under-reports agent activity. See the 2026-05-18 Decision Log Q2 entry for the design rationale (`author_type` is caller-declared on ambiguous channels — CLI and Edge Functions — but `access_path` is always derived from the code layer).
1320
+ - **Audit attribution**: Path C records `access_path = "cli"` in usage logs, distinct from `"local-mcp"` / `"remote-mcp"`. **Agents must set `--author <name> --author-type agent` on writes and `--author <name>` on reads** (or rely on `CEREFOX_AUTHOR_NAME` / `CEREFOX_AUTHOR_TYPE` / `CEREFOX_REQUESTOR_NAME` env vars). Without these flags, writes attribute to `"unknown"` / `"user"`, which under-reports agent activity. See the 2026-05-18 Decision Log Q2 entry for the design rationale (`author_type` is caller-declared on ambiguous channels — CLI and Edge Functions — but `access_path` is always derived from the code layer).
1305
1321
  - **Soft-delete and restore are reachable; permanent purge is not** — by design. `cerefox document delete` / `cerefox document restore` on the CLI, `cerefox_delete_document` / `cerefox_restore_document` over MCP (v1.7.0, #208/#210): both audited with author attribution. **Permanent purge** (irreversible) stays web-UI-only with human-in-the-loop confirmation. If an agent deletes or restores content, it should surface that to the user explicitly so they can follow it in the audit trail. See [`access-paths.md` → Destructive operations and the trust model](access-paths.md#destructive-operations-and-the-trust-model) for the full rationale and contributor guidance.
1306
1322
  - **Cross-doc links in content you ingest** become clickable when the user views them in the Cerefox web UI. **Always author them as `[Text](uuid)`** — the server validates these on every write (v1.7.0) and rejects links to nonexistent ids, which catches mangled UUIDs at write time. `[Text](docs/path.md)` exists for repo-ingested files; do not write title-based links (fragile, and `AGENT_GUIDE.md` says never in agent-authored content). See [`AGENT_GUIDE.md` → "Writing linkable content"](../../AGENT_GUIDE.md#writing-linkable-content) for the full set of rules.
1307
1323
  - **CLI install per machine**: the agent needs the `cerefox` binary installed (`npm install -g @cerefox/memory`) with a resolvable `.env`. If you skip the local install entirely, Path A-Remote or Path B is the only option.
@@ -77,6 +77,14 @@ schema-requiring release.
77
77
  > `cerefox config set review_workflow_enabled false` (or Settings → Governance)
78
78
  > if nobody reviews the queue. See
79
79
  > [configuration.md → Review Workflow](configuration.md#review-workflow).
80
+ >
81
+ > **v1.13.1** (schema 0.16.1) corrects one thing in the above: the flag
82
+ > governs only what is *shown*. v1.13.0 also stored `approved` for every
83
+ > write while the flag was off; v1.13.1 records agent writes as
84
+ > `pending_review` regardless, so turning the workflow back on shows the
85
+ > statuses the store would have had all along. It is an RPC-only change —
86
+ > `cerefox server deploy` (or `--schema-only`) picks it up; nothing refuses
87
+ > to run until you do, but a 0.16.0 server keeps the v1.13.0 write behaviour.
80
88
 
81
89
  > ### Upgrading to v1.1.0 — `cerefox server deploy` is required
82
90
  >
@@ -186,6 +194,9 @@ knowing about:
186
194
  document must be restored before its content can be updated.
187
195
  - **v1.13.0 — the review workflow is a store setting.** Upgraded stores keep
188
196
  it on; fresh installs start with it off. See the callout above.
197
+ - **v1.13.1 — the flag hides, it does not rewrite.** Agent writes are
198
+ recorded `pending_review` whether or not the workflow is shown (v1.13.0
199
+ stored `approved` while off). Redeploy to pick it up.
189
200
 
190
201
  ## Notable: v1.8.0 storage reclaim (migration 0027)
191
202
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cerefox/memory",
3
- "version": "1.13.0",
3
+ "version": "1.13.2",
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",