@cerefox/memory 0.4.3 → 0.5.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/AGENT_GUIDE.md +462 -0
- package/AGENT_QUICK_REFERENCE.md +76 -0
- package/README.md +134 -0
- package/dist/bin/cerefox-mcp.js +26866 -22608
- package/dist/bin/cerefox.js +40039 -0
- package/docs/guides/access-paths.md +235 -0
- package/docs/guides/agent-coordination.md +163 -0
- package/docs/guides/cli.md +481 -0
- package/docs/guides/configuration.md +460 -0
- package/docs/guides/connect-agents.md +1428 -0
- package/docs/guides/migration-v0.4.md +231 -0
- package/docs/guides/migration-v0.5.md +165 -0
- package/docs/guides/operational-cost.md +113 -0
- package/docs/guides/ops-scripts.md +271 -0
- package/docs/guides/quickstart.md +165 -0
- package/docs/guides/response-limits.md +151 -0
- package/docs/guides/setup-cloud-run.md +117 -0
- package/docs/guides/setup-local.md +178 -0
- package/docs/guides/setup-supabase.md +370 -0
- package/docs/guides/upgrading.md +275 -0
- package/package.json +19 -6
|
@@ -0,0 +1,481 @@
|
|
|
1
|
+
# Cerefox CLI Reference
|
|
2
|
+
|
|
3
|
+
Comprehensive reference for every `cerefox` subcommand. For tutorials and walkthroughs see [`quickstart.md`](quickstart.md); for the agent-via-CLI use case (Claude Code, Codex CLI, opencode, OpenClaw, Hermes, …) see [Path C in `connect-agents.md`](connect-agents.md#path-c--shell-cli-for-local-coding-agents).
|
|
4
|
+
|
|
5
|
+
> `--help` is canonical. If anything in this document disagrees with `cerefox <subcommand> --help`, trust `--help` and file an issue against this guide.
|
|
6
|
+
|
|
7
|
+
## Setup
|
|
8
|
+
|
|
9
|
+
Every command reads configuration from `.env` in the working directory (or environment variables — see [`configuration.md`](configuration.md)). Required at minimum:
|
|
10
|
+
|
|
11
|
+
- `CEREFOX_SUPABASE_URL` and `CEREFOX_SUPABASE_KEY` for any command that talks to Supabase
|
|
12
|
+
- `OPENAI_API_KEY` (or `CEREFOX_FIREWORKS_API_KEY`) for any command that embeds (ingest, search)
|
|
13
|
+
- `CEREFOX_DATABASE_URL` only for the `scripts/db_*.py` deployment scripts (not the `cerefox` CLI itself)
|
|
14
|
+
|
|
15
|
+
Invoke any command with `uv run cerefox <subcommand>`. Inside an activated venv, `cerefox <subcommand>` works too — but `uv run` is preferred (no venv activation needed; see Decision Log Q2 lesson on `uv` installation).
|
|
16
|
+
|
|
17
|
+
## Commands
|
|
18
|
+
|
|
19
|
+
### `cerefox ingest`
|
|
20
|
+
|
|
21
|
+
**Purpose**: ingest a markdown / PDF / DOCX file (or stdin) into the knowledge base.
|
|
22
|
+
|
|
23
|
+
**Synopsis**:
|
|
24
|
+
```
|
|
25
|
+
cerefox ingest [OPTIONS] [PATH]
|
|
26
|
+
cerefox ingest --paste --title "<title>" [OPTIONS] # stdin
|
|
27
|
+
```
|
|
28
|
+
|
|
29
|
+
**Options**:
|
|
30
|
+
|
|
31
|
+
> **Flag naming**: every flag below matches its MCP-tool parameter name (e.g. `project_name` → `--project-name`). Short forms (`--project`, `-p`) remain as aliases — the long form is the canonical name shown in `--help`.
|
|
32
|
+
|
|
33
|
+
| Flag (canonical) | Aliases | Type | Default | Description |
|
|
34
|
+
|---|---|---|---|---|
|
|
35
|
+
| `--title` | `-t` | str | filename stem | Document title. Required with `--paste`. |
|
|
36
|
+
| `--project-name` | `--project`, `-p` | str | _none_ | Project name to assign the document to (created if missing). |
|
|
37
|
+
| `--paste` | — | flag | off | Read markdown from stdin. Requires `--title`. |
|
|
38
|
+
| `--metadata` | `-m` | JSON | `{}` | Extra metadata as a JSON object, e.g. `'{"tags":["work"]}'`. |
|
|
39
|
+
| `--update-if-exists` | `--update` | flag | off | Title/source-path-based fallback update. Mutually exclusive with `--document-id`. |
|
|
40
|
+
| `--document-id` | — | UUID | _none_ | Deterministic ID-based update. Errors if the document doesn't exist. |
|
|
41
|
+
| `--source` | — | str | `paste` / `file` | Source label recorded on the document. |
|
|
42
|
+
| `--author` | — | str | `CEREFOX_AUTHOR_NAME` or `unknown` | Audit-log author identity. |
|
|
43
|
+
| `--author-type` | — | `user`\|`agent` | `CEREFOX_AUTHOR_TYPE` or `user` | Caller type. Agent writes auto-routed to `pending_review`. |
|
|
44
|
+
|
|
45
|
+
**Examples**:
|
|
46
|
+
```bash
|
|
47
|
+
# Minimal: ingest a file
|
|
48
|
+
cerefox ingest notes.md
|
|
49
|
+
|
|
50
|
+
# Paste from stdin
|
|
51
|
+
printf '# Title\n\nbody' | cerefox ingest --paste --title "Title"
|
|
52
|
+
|
|
53
|
+
# Agent ingestion with full attribution
|
|
54
|
+
cerefox ingest notes.md \
|
|
55
|
+
--author "claude-code" --author-type "agent" \
|
|
56
|
+
--project-name "research" --metadata '{"type":"design-doc"}'
|
|
57
|
+
|
|
58
|
+
# Deterministic update (preferred — agents should search → grab ID → ingest)
|
|
59
|
+
cerefox ingest --paste --title "Same Title" \
|
|
60
|
+
--document-id "abc12345-..." \
|
|
61
|
+
--author "claude-code" --author-type "agent"
|
|
62
|
+
```
|
|
63
|
+
|
|
64
|
+
**Output**: human-readable summary line(s) — "Ingested" or "Updated" with the document ID, chunk count, character count.
|
|
65
|
+
|
|
66
|
+
**Exit codes**: `0` success, `1` on validation error (missing `--title`, invalid JSON, document-not-found, mutually-exclusive flags, etc.).
|
|
67
|
+
|
|
68
|
+
**MCP equivalent**: [`cerefox_ingest`](../../AGENT_GUIDE.md).
|
|
69
|
+
|
|
70
|
+
---
|
|
71
|
+
|
|
72
|
+
### `cerefox ingest-dir`
|
|
73
|
+
|
|
74
|
+
**Purpose**: bulk-ingest every matching file in a directory.
|
|
75
|
+
|
|
76
|
+
**Synopsis**:
|
|
77
|
+
```
|
|
78
|
+
cerefox ingest-dir [OPTIONS] DIRECTORY
|
|
79
|
+
```
|
|
80
|
+
|
|
81
|
+
**Options**:
|
|
82
|
+
|
|
83
|
+
| Flag | Type | Default | Description |
|
|
84
|
+
|---|---|---|---|
|
|
85
|
+
| `--pattern TEXT` | glob | `*.md` | Glob pattern. Examples: `**/*.md`, `*.pdf`. |
|
|
86
|
+
| `--project-name TEXT` (alias: `--project`, `-p`) | str | _none_ | Project to assign every document to. |
|
|
87
|
+
| `--recursive / --no-recursive` | flag | `--no-recursive` | Recurse into sub-directories. |
|
|
88
|
+
| `--dry-run` | flag | off | Print files that would be ingested; do nothing. |
|
|
89
|
+
| `--update-if-exists` (alias: `--update`) | flag | off | Update existing documents by source path. |
|
|
90
|
+
| `-m, --metadata TEXT` | JSON | `{}` | JSON metadata applied to every file in the run. |
|
|
91
|
+
| `--author TEXT` | str | `CEREFOX_AUTHOR_NAME` or `unknown` | Audit-log author identity (applies to every write). |
|
|
92
|
+
| `--author-type [user\|agent]` | choice | `CEREFOX_AUTHOR_TYPE` or `user` | Caller type. |
|
|
93
|
+
|
|
94
|
+
**Examples**:
|
|
95
|
+
```bash
|
|
96
|
+
# Bulk import research notes with shared metadata
|
|
97
|
+
cerefox ingest-dir ./research-notes --recursive \
|
|
98
|
+
--project-name "research" --metadata '{"type":"research","status":"active"}'
|
|
99
|
+
|
|
100
|
+
# Re-ingest after editing files
|
|
101
|
+
cerefox ingest-dir ./notes --update-if-exists
|
|
102
|
+
```
|
|
103
|
+
|
|
104
|
+
**Output**: one line per file showing `✓` (ingested), `↑` (updated), `⏭` (skipped: hash match), or `❌` (error); summary at the end.
|
|
105
|
+
|
|
106
|
+
**Exit codes**: `0` even if some files errored — per-file errors are counted but the command itself does not fail unless argument validation fails.
|
|
107
|
+
|
|
108
|
+
---
|
|
109
|
+
|
|
110
|
+
### `cerefox search`
|
|
111
|
+
|
|
112
|
+
**Purpose**: search the knowledge base (hybrid FTS + semantic by default).
|
|
113
|
+
|
|
114
|
+
**Synopsis**:
|
|
115
|
+
```
|
|
116
|
+
cerefox search [OPTIONS] QUERY
|
|
117
|
+
```
|
|
118
|
+
|
|
119
|
+
**Options**:
|
|
120
|
+
|
|
121
|
+
| Flag | Type | Default | Description |
|
|
122
|
+
|---|---|---|---|
|
|
123
|
+
| `-m, --mode [hybrid\|fts\|semantic]` | choice | `hybrid` | Search mode. |
|
|
124
|
+
| `--match-count INTEGER` (alias: `--count`, `-n`) | int | `10` | Number of results. |
|
|
125
|
+
| `--project-name TEXT` (alias: `--project`, `-p`) | str | _none_ | Limit to a project by name. |
|
|
126
|
+
| `--alpha FLOAT` | float | `0.7` | FTS/semantic weight (hybrid only). |
|
|
127
|
+
| `--min-score FLOAT` | float | `CEREFOX_MIN_SEARCH_SCORE` or `0.50` | Minimum cosine similarity (hybrid/semantic only). |
|
|
128
|
+
| `--metadata-filter TEXT` (alias: `--filter`, `-f`) | JSON | _none_ | JSONB metadata containment filter, e.g. `'{"type":"decision"}'`. |
|
|
129
|
+
| `--requestor TEXT` | str | `CEREFOX_REQUESTOR_NAME` or `user` | Identity recorded in the usage log. |
|
|
130
|
+
|
|
131
|
+
**Examples**:
|
|
132
|
+
```bash
|
|
133
|
+
cerefox search "OAuth design"
|
|
134
|
+
cerefox search "decisions" --metadata-filter '{"type":"decision-log"}' --match-count 5
|
|
135
|
+
cerefox search "what we tried" --mode semantic --requestor "claude-code"
|
|
136
|
+
```
|
|
137
|
+
|
|
138
|
+
**Output**: numbered result list with title, score, and 300-char preview per hit. Final line shows total results + bytes.
|
|
139
|
+
|
|
140
|
+
**Exit codes**: `0` on success. Note: as of v0.1.17, the CLI logs usage in a try/except so a usage-logging error does not affect the user-visible output (closes the failure mode that produced cerefox#27).
|
|
141
|
+
|
|
142
|
+
**MCP equivalent**: [`cerefox_search`](../../AGENT_GUIDE.md).
|
|
143
|
+
|
|
144
|
+
---
|
|
145
|
+
|
|
146
|
+
### `cerefox get-doc`
|
|
147
|
+
|
|
148
|
+
**Purpose**: print the full markdown content of a document to stdout.
|
|
149
|
+
|
|
150
|
+
**Synopsis**:
|
|
151
|
+
```
|
|
152
|
+
cerefox get-doc [OPTIONS] DOCUMENT_ID
|
|
153
|
+
```
|
|
154
|
+
|
|
155
|
+
**Options**:
|
|
156
|
+
|
|
157
|
+
| Flag | Type | Default | Description |
|
|
158
|
+
|---|---|---|---|
|
|
159
|
+
| `--version-id TEXT` (alias: `--version`) | UUID | _none_ (current) | Archived version UUID — get from `cerefox list-versions`. |
|
|
160
|
+
| `--requestor TEXT` | str | `CEREFOX_REQUESTOR_NAME` or `user` | Identity recorded in the usage log. |
|
|
161
|
+
|
|
162
|
+
**Examples**:
|
|
163
|
+
```bash
|
|
164
|
+
cerefox get-doc abc12345-...
|
|
165
|
+
cerefox get-doc abc12345-... --version-id <version-uuid> # archived
|
|
166
|
+
cerefox get-doc abc12345-... | bat -l md # pipe to viewer
|
|
167
|
+
```
|
|
168
|
+
|
|
169
|
+
**Output**: title + metadata line, blank line, then raw markdown.
|
|
170
|
+
|
|
171
|
+
**MCP equivalent**: [`cerefox_get_document`](../../AGENT_GUIDE.md).
|
|
172
|
+
|
|
173
|
+
---
|
|
174
|
+
|
|
175
|
+
### `cerefox list-docs`
|
|
176
|
+
|
|
177
|
+
**Purpose**: list documents in the knowledge base.
|
|
178
|
+
|
|
179
|
+
**Synopsis**:
|
|
180
|
+
```
|
|
181
|
+
cerefox list-docs [OPTIONS]
|
|
182
|
+
```
|
|
183
|
+
|
|
184
|
+
**Options**:
|
|
185
|
+
|
|
186
|
+
| Flag | Type | Default | Description |
|
|
187
|
+
|---|---|---|---|
|
|
188
|
+
| `--project-name TEXT` (alias: `--project`, `-p`) | str | _none_ | Filter by project ID or name. |
|
|
189
|
+
| `-n, --limit INTEGER` | int | `20` | Max rows. |
|
|
190
|
+
|
|
191
|
+
**Output**: tabular `id | chunk_count | total_chars | title` listing. CLI-only — there is no MCP equivalent.
|
|
192
|
+
|
|
193
|
+
---
|
|
194
|
+
|
|
195
|
+
### `cerefox list-versions`
|
|
196
|
+
|
|
197
|
+
**Purpose**: list all archived versions of a document.
|
|
198
|
+
|
|
199
|
+
**Synopsis**:
|
|
200
|
+
```
|
|
201
|
+
cerefox list-versions [OPTIONS] DOCUMENT_ID
|
|
202
|
+
```
|
|
203
|
+
|
|
204
|
+
**Options**:
|
|
205
|
+
|
|
206
|
+
| Flag | Type | Default | Description |
|
|
207
|
+
|---|---|---|---|
|
|
208
|
+
| `--requestor TEXT` | str | `CEREFOX_REQUESTOR_NAME` or `user` | Identity recorded in the usage log. |
|
|
209
|
+
|
|
210
|
+
**Output**: table with version number, created timestamp, source, chunk/char counts, and version UUID. Pass the UUID to `cerefox get-doc --version-id <uuid>` to retrieve the archived content.
|
|
211
|
+
|
|
212
|
+
**MCP equivalent**: [`cerefox_list_versions`](../../AGENT_GUIDE.md).
|
|
213
|
+
|
|
214
|
+
---
|
|
215
|
+
|
|
216
|
+
### `cerefox list-projects`
|
|
217
|
+
|
|
218
|
+
**Purpose**: list all projects.
|
|
219
|
+
|
|
220
|
+
**Synopsis**:
|
|
221
|
+
```
|
|
222
|
+
cerefox list-projects [OPTIONS]
|
|
223
|
+
```
|
|
224
|
+
|
|
225
|
+
**Options**:
|
|
226
|
+
|
|
227
|
+
| Flag | Type | Default | Description |
|
|
228
|
+
|---|---|---|---|
|
|
229
|
+
| `--requestor TEXT` | str | `CEREFOX_REQUESTOR_NAME` or `user` | Identity recorded in the usage log. |
|
|
230
|
+
|
|
231
|
+
**MCP equivalent**: [`cerefox_list_projects`](../../AGENT_GUIDE.md).
|
|
232
|
+
|
|
233
|
+
---
|
|
234
|
+
|
|
235
|
+
### `cerefox list-metadata-keys`
|
|
236
|
+
|
|
237
|
+
**Purpose**: discover metadata keys used across all documents (with example values and document counts).
|
|
238
|
+
|
|
239
|
+
**Synopsis**: `cerefox list-metadata-keys`
|
|
240
|
+
|
|
241
|
+
**MCP equivalent**: [`cerefox_list_metadata_keys`](../../AGENT_GUIDE.md).
|
|
242
|
+
|
|
243
|
+
---
|
|
244
|
+
|
|
245
|
+
### `cerefox metadata-search`
|
|
246
|
+
|
|
247
|
+
**Purpose**: find documents by metadata key-value criteria (no text query needed).
|
|
248
|
+
|
|
249
|
+
**Synopsis**:
|
|
250
|
+
```
|
|
251
|
+
cerefox metadata-search --metadata-filter '<json>' [OPTIONS]
|
|
252
|
+
```
|
|
253
|
+
|
|
254
|
+
**Options**:
|
|
255
|
+
|
|
256
|
+
| Flag | Type | Default | Description |
|
|
257
|
+
|---|---|---|---|
|
|
258
|
+
| `--metadata-filter TEXT` (alias: `--filter`) | JSON | **required** | Metadata filter, e.g. `'{"type":"decision-log"}'`. |
|
|
259
|
+
| `--project-name TEXT` (alias: `--project`) | str | _none_ | Filter by project name. |
|
|
260
|
+
| `--updated-since TEXT` | ISO-8601 | _none_ | Documents updated after this timestamp. |
|
|
261
|
+
| `--created-since TEXT` | ISO-8601 | _none_ | Documents created after this timestamp. |
|
|
262
|
+
| `--limit INTEGER` | int | `10` | Max results. |
|
|
263
|
+
| `--include-content` | flag | off | Include full document content (slower; subject to byte budget). |
|
|
264
|
+
| `--requestor TEXT` | str | `CEREFOX_REQUESTOR_NAME` or `user` | Identity recorded in the usage log. |
|
|
265
|
+
|
|
266
|
+
**Examples**:
|
|
267
|
+
```bash
|
|
268
|
+
cerefox metadata-search --metadata-filter '{"type":"decision-log"}' --updated-since 2026-05-01
|
|
269
|
+
cerefox metadata-search --metadata-filter '{"status":"active"}' --project-name "research" --include-content
|
|
270
|
+
```
|
|
271
|
+
|
|
272
|
+
**MCP equivalent**: [`cerefox_metadata_search`](../../AGENT_GUIDE.md).
|
|
273
|
+
|
|
274
|
+
---
|
|
275
|
+
|
|
276
|
+
### `cerefox get-audit-log`
|
|
277
|
+
|
|
278
|
+
**Purpose**: query the immutable audit log (who changed what, when).
|
|
279
|
+
|
|
280
|
+
**Synopsis**:
|
|
281
|
+
```
|
|
282
|
+
cerefox get-audit-log [OPTIONS]
|
|
283
|
+
```
|
|
284
|
+
|
|
285
|
+
**Options**:
|
|
286
|
+
|
|
287
|
+
| Flag | Type | Default | Description |
|
|
288
|
+
|---|---|---|---|
|
|
289
|
+
| `--document-id TEXT` | UUID | _none_ | Filter to a single document. |
|
|
290
|
+
| `--author TEXT` | str | _none_ | Filter by author name (exact match). |
|
|
291
|
+
| `--operation [create\|update-content\|update-metadata\|delete\|status-change\|archive\|unarchive\|restore]` | choice | _none_ | Filter by operation type. |
|
|
292
|
+
| `--since TEXT` | ISO-8601 | _none_ | Lower bound on `created_at`. |
|
|
293
|
+
| `--until TEXT` | ISO-8601 | _none_ | Upper bound on `created_at`. |
|
|
294
|
+
| `--limit INTEGER` | int | `50` | Max rows. |
|
|
295
|
+
| `--json` | flag | off | Emit one JSON object per line (for piping to `jq` / scripts). |
|
|
296
|
+
| `--requestor TEXT` | str | `CEREFOX_REQUESTOR_NAME` or `user` | Identity recorded in the usage log. |
|
|
297
|
+
|
|
298
|
+
**Examples**:
|
|
299
|
+
```bash
|
|
300
|
+
# All audit entries in the last week
|
|
301
|
+
cerefox get-audit-log --since 2026-05-11
|
|
302
|
+
|
|
303
|
+
# All edits by a specific agent
|
|
304
|
+
cerefox get-audit-log --author "claude-code" --operation update-content
|
|
305
|
+
|
|
306
|
+
# JSON output, piped to jq
|
|
307
|
+
cerefox get-audit-log --json --limit 1000 | jq 'select(.author_type == "agent")'
|
|
308
|
+
```
|
|
309
|
+
|
|
310
|
+
**MCP equivalent**: [`cerefox_get_audit_log`](../../AGENT_GUIDE.md).
|
|
311
|
+
|
|
312
|
+
---
|
|
313
|
+
|
|
314
|
+
### `cerefox delete-doc`
|
|
315
|
+
|
|
316
|
+
**Purpose**: **soft-delete** a document — moves it to trash, recoverable. The CLI cannot permanently delete or restore; see [Destructive operations and the trust model](access-paths.md#destructive-operations-and-the-trust-model) for the rationale.
|
|
317
|
+
|
|
318
|
+
**Synopsis**: `cerefox delete-doc [OPTIONS] DOCUMENT_ID`
|
|
319
|
+
|
|
320
|
+
**Options**:
|
|
321
|
+
|
|
322
|
+
| Flag | Type | Default | Description |
|
|
323
|
+
|---|---|---|---|
|
|
324
|
+
| `-y, --yes` | flag | off | Skip confirmation prompt. Required for non-interactive use (agents, scripts). |
|
|
325
|
+
| `--author` | str | `CEREFOX_AUTHOR_NAME` or `unknown` | Identity recorded in the audit log. |
|
|
326
|
+
| `--author-type` | `user`\|`agent` | `CEREFOX_AUTHOR_TYPE` or `user` | Caller type, recorded in the audit log. |
|
|
327
|
+
|
|
328
|
+
**What this command does:**
|
|
329
|
+
- Sets `deleted_at` on the document row. The document stays in the database.
|
|
330
|
+
- Excludes the document from search and from `cerefox list-docs`.
|
|
331
|
+
- Writes an immutable `delete` audit-log entry with the resolved author / author_type and timestamp.
|
|
332
|
+
|
|
333
|
+
**What this command does NOT do:**
|
|
334
|
+
- Does NOT permanently delete the document.
|
|
335
|
+
- Does NOT free database storage.
|
|
336
|
+
- Versions, chunks, and audit entries remain intact under the trash.
|
|
337
|
+
|
|
338
|
+
**Recovery**: a soft-deleted document can be restored OR permanently purged **only from the Cerefox web UI** (Trash view). These destructive / restorative actions are intentionally web-UI-only to require human-in-the-loop confirmation. See [`access-paths.md` → Destructive operations and the trust model](access-paths.md#destructive-operations-and-the-trust-model).
|
|
339
|
+
|
|
340
|
+
**Agent usage**:
|
|
341
|
+
```bash
|
|
342
|
+
# Required: --yes (no TTY for confirmation) + identity flags
|
|
343
|
+
cerefox delete-doc <doc-id> --yes \
|
|
344
|
+
--author "claude-code" --author-type "agent"
|
|
345
|
+
```
|
|
346
|
+
The success message echoes the resolved author / author_type back so you can surface it to the user in your response.
|
|
347
|
+
|
|
348
|
+
**Exit codes**: `0` on success. `1` on confirmation abort, missing document, or auth failure.
|
|
349
|
+
|
|
350
|
+
---
|
|
351
|
+
|
|
352
|
+
### `cerefox reindex`
|
|
353
|
+
|
|
354
|
+
**Purpose**: re-embed chunks (e.g. after switching embedding models or pulling a schema change like title-boosting).
|
|
355
|
+
|
|
356
|
+
**Synopsis**: `cerefox reindex [OPTIONS]`
|
|
357
|
+
|
|
358
|
+
**Options**:
|
|
359
|
+
|
|
360
|
+
| Flag | Type | Default | Description |
|
|
361
|
+
|---|---|---|---|
|
|
362
|
+
| `--batch INTEGER` | int | `100` | Chunks per batch. |
|
|
363
|
+
| `--all` | flag | off | Reindex every chunk regardless of embedder. |
|
|
364
|
+
| `--dry-run` | flag | off | Count what would be re-embedded; do nothing. |
|
|
365
|
+
|
|
366
|
+
---
|
|
367
|
+
|
|
368
|
+
### `cerefox config-get` / `cerefox config-set`
|
|
369
|
+
|
|
370
|
+
**Purpose**: read/write runtime config in `cerefox_config` (e.g. `usage_tracking_enabled`).
|
|
371
|
+
|
|
372
|
+
**Synopsis**:
|
|
373
|
+
```
|
|
374
|
+
cerefox config-get KEY
|
|
375
|
+
cerefox config-set KEY VALUE
|
|
376
|
+
```
|
|
377
|
+
|
|
378
|
+
Used for toggling features at runtime without a redeploy — see [Decision Log Q1 Part 2 — usage tracking opt-in](https://github.com/fstamatelopoulos/cerefox) entry.
|
|
379
|
+
|
|
380
|
+
---
|
|
381
|
+
|
|
382
|
+
### `cerefox web`
|
|
383
|
+
|
|
384
|
+
**Purpose**: start the FastAPI web UI (React SPA + JSON API).
|
|
385
|
+
|
|
386
|
+
**Synopsis**: `cerefox web [OPTIONS]`
|
|
387
|
+
|
|
388
|
+
**Options**:
|
|
389
|
+
|
|
390
|
+
| Flag | Type | Default | Description |
|
|
391
|
+
|---|---|---|---|
|
|
392
|
+
| `--host TEXT` | str | `127.0.0.1` | Bind address. |
|
|
393
|
+
| `--port INTEGER` | int | `8000` | Listen port. |
|
|
394
|
+
| `--reload` | flag | off | Auto-reload on source changes (dev). |
|
|
395
|
+
|
|
396
|
+
Requires the frontend to be built: `cd frontend && npm install && npm run build`.
|
|
397
|
+
|
|
398
|
+
---
|
|
399
|
+
|
|
400
|
+
### `cerefox mcp`
|
|
401
|
+
|
|
402
|
+
**Purpose**: run the local MCP stdio server. Used by Claude Desktop / Cursor / Claude Code as a subprocess (Path A-Local in `connect-agents.md`).
|
|
403
|
+
|
|
404
|
+
**Synopsis**: `cerefox mcp`
|
|
405
|
+
|
|
406
|
+
No options. See [`connect-agents.md` → Path A-Local](connect-agents.md#path-a-local--local-mcp-server-cerefox-mcp).
|
|
407
|
+
|
|
408
|
+
---
|
|
409
|
+
|
|
410
|
+
## Environment variables
|
|
411
|
+
|
|
412
|
+
The CLI reads its own runtime config from environment (or `.env`). See [`configuration.md`](configuration.md) for the full list. Most relevant to CLI behaviour:
|
|
413
|
+
|
|
414
|
+
| Variable | Default | Effect |
|
|
415
|
+
|---|---|---|
|
|
416
|
+
| `CEREFOX_AUTHOR_NAME` | `unknown` | Default for `--author` on `ingest` / `ingest-dir`. |
|
|
417
|
+
| `CEREFOX_AUTHOR_TYPE` | `user` | Default for `--author-type`. |
|
|
418
|
+
| `CEREFOX_REQUESTOR_NAME` | `user` | Default for `--requestor` on read commands. |
|
|
419
|
+
|
|
420
|
+
Precedence: **CLI flag > env var > built-in default**.
|
|
421
|
+
|
|
422
|
+
## Exit codes
|
|
423
|
+
|
|
424
|
+
| Code | Meaning |
|
|
425
|
+
|---|---|
|
|
426
|
+
| `0` | Success |
|
|
427
|
+
| `1` | Validation error, missing config, document-not-found, etc. — see error message |
|
|
428
|
+
| `2` | Click argument-parsing error (invalid Choice value, missing required arg) |
|
|
429
|
+
|
|
430
|
+
## MCP tool ↔ CLI command mapping
|
|
431
|
+
|
|
432
|
+
Full table for Path C agents (see [`connect-agents.md`](connect-agents.md#path-c--shell-cli-for-local-coding-agents) for context).
|
|
433
|
+
|
|
434
|
+
Every MCP parameter has an exact-name CLI flag (kebab-cased). Short forms exist as aliases.
|
|
435
|
+
|
|
436
|
+
| MCP tool | CLI command |
|
|
437
|
+
|---|---|
|
|
438
|
+
| `cerefox_search(query, match_count, project_name, metadata_filter, requestor)` | `cerefox search "<q>" --match-count N --project-name <name> --metadata-filter '<json>' --requestor <name>` |
|
|
439
|
+
| `cerefox_ingest(title, content, project_name, metadata, update_if_exists, document_id, source, author, author_type)` (file) | `cerefox ingest <path> --title <t> --project-name <n> --metadata '<json>' --update-if-exists\|--document-id <uuid> --source <s> --author <a> --author-type <t>` |
|
|
440
|
+
| `cerefox_ingest(...)` (paste) | `printf '...' \| cerefox ingest --paste --title "<t>"` (same flags) |
|
|
441
|
+
| `cerefox_get_document(document_id, version_id, requestor)` | `cerefox get-doc <id> --version-id <vid> --requestor <name>` |
|
|
442
|
+
| `cerefox_list_versions(document_id, requestor)` | `cerefox list-versions <id> --requestor <name>` |
|
|
443
|
+
| `cerefox_list_projects(requestor)` | `cerefox list-projects --requestor <name>` |
|
|
444
|
+
| `cerefox_list_metadata_keys()` | `cerefox list-metadata-keys` |
|
|
445
|
+
| `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>` |
|
|
446
|
+
| `cerefox_get_audit_log(document_id, author, operation, since, until, limit, requestor)` | `cerefox get-audit-log --document-id <id> --author <a> --operation <op> --since <iso> --until <iso> --limit N --requestor <name>` |
|
|
447
|
+
|
|
448
|
+
## Known issues
|
|
449
|
+
|
|
450
|
+
None outstanding as of v0.1.17 (cerefox#27 — the `cerefox search` NameError — is resolved). When new bugs surface, they are tracked in the GitHub issues list; check there before relying on a behaviour the docs imply.
|
|
451
|
+
|
|
452
|
+
## Common recipes
|
|
453
|
+
|
|
454
|
+
### Bulk-import a directory with shared metadata
|
|
455
|
+
```bash
|
|
456
|
+
cerefox ingest-dir ./papers --recursive --pattern '*.pdf' \
|
|
457
|
+
--project-name "literature" \
|
|
458
|
+
--metadata '{"type":"paper","status":"reviewed"}'
|
|
459
|
+
```
|
|
460
|
+
|
|
461
|
+
### Update a document by ID (preferred pattern for agents)
|
|
462
|
+
```bash
|
|
463
|
+
# Step 1: find it
|
|
464
|
+
cerefox search "the OAuth design doc" --match-count 1
|
|
465
|
+
|
|
466
|
+
# Step 2: copy the id from `Doc: ... (id: <uuid>)` line
|
|
467
|
+
# Step 3: update in place
|
|
468
|
+
printf '%s' "$NEW_CONTENT" | cerefox ingest --paste \
|
|
469
|
+
--title "OAuth 2.1 Design Document" \
|
|
470
|
+
--document-id "<uuid>" \
|
|
471
|
+
--author "claude-code" --author-type "agent"
|
|
472
|
+
```
|
|
473
|
+
|
|
474
|
+
### Unattended sync job
|
|
475
|
+
```bash
|
|
476
|
+
# In a cron job / launchd plist. Set CEREFOX_AUTHOR_NAME=sync-script in env.
|
|
477
|
+
cd /path/to/cerefox && uv run cerefox ingest-dir ~/notes --recursive --update-if-exists
|
|
478
|
+
```
|
|
479
|
+
|
|
480
|
+
### Use the CLI from an agent's Bash tool
|
|
481
|
+
See [`connect-agents.md` → Path C](connect-agents.md#path-c--shell-cli-for-local-coding-agents) for the full setup and [`AGENT_GUIDE.md` → Using Cerefox via the CLI](../../AGENT_GUIDE.md) for the agent-facing conventions.
|