@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.
@@ -0,0 +1,231 @@
1
+ # Migrating to Cerefox v0.4.0
2
+
3
+ **TL;DR**: nothing urgent. Your existing `cerefox mcp` configs keep
4
+ working unchanged. The Python `cerefox mcp` command is now a soft
5
+ wrapper that transparently uses the new TypeScript MCP server if it's
6
+ installed, falling back to the legacy Python implementation otherwise.
7
+ Switch to the npm-installed TS server at your convenience for faster
8
+ boot times and fewer Python dependencies.
9
+
10
+ This guide is for **existing users** of `cerefox mcp` who want to
11
+ optionally upgrade. **New users** should follow
12
+ [`docs/guides/connect-agents.md`](connect-agents.md) instead — that's
13
+ the canonical configuration recipe per MCP client.
14
+
15
+ ## What changed in v0.4.0
16
+
17
+ - **`@cerefox/memory`** is a new npm package containing the Cerefox
18
+ local stdio MCP server. Same 10 MCP tools, same protocol, faster
19
+ boot.
20
+ - **The Edge Function (`cerefox-mcp`) shares tool handlers** with the
21
+ new local server via `_shared/mcp-tools/`. One source of truth; no
22
+ drift.
23
+ - **`cerefox_get_help`** is a new MCP tool (10 total now, was 9). Layer
24
+ 3 of MCP discoverability — agents can now retrieve
25
+ `AGENT_QUICK_REFERENCE.md` content over MCP without filesystem
26
+ access.
27
+ - **`cerefox mcp` (Python CLI) is a soft wrapper**: tries to delegate
28
+ to `npx --package=@cerefox/memory cerefox-mcp` first; falls back to the legacy
29
+ Python implementation if npm/Bun isn't available.
30
+
31
+ ## The optional one-time upgrade
32
+
33
+ If you have Node 20+ installed, install `@cerefox/memory` globally:
34
+
35
+ ```bash
36
+ npm install -g @cerefox/memory
37
+ # or, if you have Bun:
38
+ bun install -g @cerefox/memory
39
+ ```
40
+
41
+ After this, your existing `cerefox mcp` configs automatically use the
42
+ TS server (the soft wrapper detects the package and delegates).
43
+
44
+ You can also point your MCP client directly at `cerefox-mcp` (the bin
45
+ shipped by the package) and bypass the Python wrapper entirely:
46
+
47
+ ### Claude Code
48
+
49
+ **Old:**
50
+
51
+ ```bash
52
+ claude mcp add cerefox -- uv run --directory /path/to/cerefox cerefox mcp
53
+ ```
54
+
55
+ **New (optional):**
56
+
57
+ ```bash
58
+ claude mcp add cerefox -- npx -y --package=@cerefox/memory cerefox-mcp
59
+ ```
60
+
61
+ ### Cursor
62
+
63
+ **Old** (`mcp.json` in your project or `~/.cursor/mcp.json`):
64
+
65
+ ```json
66
+ {
67
+ "mcpServers": {
68
+ "cerefox": {
69
+ "command": "uv",
70
+ "args": ["run", "--directory", "/path/to/cerefox", "cerefox", "mcp"]
71
+ }
72
+ }
73
+ }
74
+ ```
75
+
76
+ **New (optional):**
77
+
78
+ ```json
79
+ {
80
+ "mcpServers": {
81
+ "cerefox": {
82
+ "command": "npx",
83
+ "args": ["-y", "--package=@cerefox/memory", "cerefox-mcp"]
84
+ }
85
+ }
86
+ }
87
+ ```
88
+
89
+ ### Claude Desktop
90
+
91
+ **Old** (`claude_desktop_config.json`):
92
+
93
+ ```json
94
+ {
95
+ "mcpServers": {
96
+ "cerefox": {
97
+ "command": "uv",
98
+ "args": ["--directory", "/path/to/cerefox", "run", "cerefox", "mcp"]
99
+ }
100
+ }
101
+ }
102
+ ```
103
+
104
+ **New (optional):**
105
+
106
+ ```json
107
+ {
108
+ "mcpServers": {
109
+ "cerefox": {
110
+ "command": "npx",
111
+ "args": ["-y", "--package=@cerefox/memory", "cerefox-mcp"]
112
+ }
113
+ }
114
+ }
115
+ ```
116
+
117
+ ### Codex CLI
118
+
119
+ **Old** (`~/.codex/config.toml`):
120
+
121
+ ```toml
122
+ [mcp_servers.cerefox]
123
+ command = "uv"
124
+ args = ["--directory", "/path/to/cerefox", "run", "cerefox", "mcp"]
125
+ ```
126
+
127
+ **New (optional):**
128
+
129
+ ```toml
130
+ [mcp_servers.cerefox]
131
+ command = "npx"
132
+ args = ["-y", "--package=@cerefox/memory", "cerefox-mcp"]
133
+ ```
134
+
135
+ ## Environment
136
+
137
+ The new TS server reads `.env` the same way the Python CLI does (per
138
+ v0.3.0's `_resolve_config_dir()`):
139
+
140
+ 1. `CEREFOX_CONFIG_DIR` env var override.
141
+ 2. `./.env` in the current working directory.
142
+ 3. `~/.cerefox/.env`.
143
+
144
+ For most users with an existing Cerefox install, your `.env` is already
145
+ where it needs to be. If you want to verify:
146
+
147
+ ```bash
148
+ npx --package=@cerefox/memory cerefox-mcp --help
149
+ ```
150
+
151
+ (That's the help text, not a server start — safe to run anywhere.)
152
+
153
+ ## Schema-version-mismatch banner
154
+
155
+ The new server prints a one-line warning to stderr at boot if the
156
+ bundled `@cerefox/memory` schema version doesn't match what's deployed
157
+ to your Supabase. Run `uv run python scripts/db_deploy.py` from the
158
+ repo to update.
159
+
160
+ ## Falling back
161
+
162
+ If the npm path doesn't work for any reason (npx missing, package not
163
+ installed, network issue during `npx` resolution), `cerefox mcp` falls
164
+ back to the legacy Python server with a one-line stderr nudge. Your
165
+ MCP client never notices — same stdio interface, same tools.
166
+
167
+ To force the legacy path even when `@cerefox/memory` is installed:
168
+ uninstall it (`npm uninstall -g @cerefox/memory`) or invoke the Python
169
+ CLI from a shell without `npx` in `$PATH`.
170
+
171
+ ## `cerefox_get_help` — the new tool
172
+
173
+ If you use Cerefox through an MCP client and ever wonder "wait, what's
174
+ the right way to do X in Cerefox?", you can now ask the server
175
+ directly:
176
+
177
+ - `cerefox_get_help()` — returns the full `AGENT_QUICK_REFERENCE.md`
178
+ plus a section index.
179
+ - `cerefox_get_help(topic: "links")` — returns just the cross-document
180
+ linking section.
181
+ - `cerefox_get_help(topic: "update")` — returns the update workflow
182
+ sections.
183
+
184
+ The topic match is a case-insensitive substring against H2 headings.
185
+ Both the new TS server AND the legacy Python fallback expose this tool
186
+ — consistent surface regardless of which path serves your session.
187
+
188
+ ## When v0.5.0 ships
189
+
190
+ The TypeScript CLI lands in v0.5.0. At that point `@cerefox/memory`
191
+ will gain a second binary (`cerefox`) for the full CLI surface
192
+ (`cerefox search`, `cerefox ingest`, etc.) plus a `cerefox
193
+ configure-agent` command that writes the right MCP config for each
194
+ client automatically. For now, the manual recipes above are the way.
195
+
196
+ ## Known gotchas
197
+
198
+ - **`npx` from inside an npm workspace can fail with "command not
199
+ found"** even when the package is correctly published. Running
200
+ `npx -y --package=@cerefox/memory cerefox-mcp` from the root of a
201
+ surrounding npm-workspace monorepo (your own project) confuses npx's
202
+ bin-resolution path. Symptoms: `sh: cerefox-mcp: command not found`
203
+ even though the published package has the bin entry. Workarounds —
204
+ any one of these works:
205
+ - Use `bunx` instead: `bunx --package @cerefox/memory cerefox-mcp` —
206
+ cleanly handles workspace contexts.
207
+ - Run from a non-workspace directory (e.g. `cd /tmp` first).
208
+ - Install globally and invoke from PATH:
209
+ `npm install -g @cerefox/memory` then `cerefox-mcp`.
210
+ - When configuring an MCP client (Claude Code, Cursor, Claude
211
+ Desktop, Codex CLI), the launched process inherits the client's
212
+ own working directory rather than your shell's, so this gotcha
213
+ usually doesn't bite real MCP usage — only manual `npx` smoke
214
+ tests run from a project root.
215
+
216
+ - **The minimum npm version for OIDC publish is 11.5.1.** The shipped
217
+ `release.yml` workflow already pins this; only relevant if you're
218
+ forking the project for your own publish target.
219
+
220
+ ## What didn't change
221
+
222
+ - The Edge Function (remote MCP) URL and auth: unchanged. Same
223
+ Bearer-with-anon-JWT pattern; the EF just shares its tool handlers
224
+ with the local TS server now.
225
+ - The Postgres RPC contracts: unchanged. v0.4.0 ships zero schema
226
+ changes — the `cerefox_schema_version()` RPC introduced in v0.3.0
227
+ still returns `0.3.1`. (The mismatch warning at TS server startup
228
+ fires until you redeploy from `main`, which is what you'd do
229
+ whenever the schema version actually bumps.)
230
+ - Web UI, ingestion pipeline, CLI subcommands: all unchanged in v0.4.
231
+ Those migrate in v0.6 and v0.7.
@@ -0,0 +1,165 @@
1
+ # Migrating to Cerefox v0.5.0
2
+
3
+ **TL;DR:** the Cerefox CLI is now a TypeScript binary published to npm.
4
+ You can keep using the Python CLI through v0.7.x (it just prints a
5
+ one-line ⚠ banner now), but the npm path is faster, doesn't need a
6
+ local clone, and adds new lifecycle commands (`init`, `doctor`,
7
+ `configure-agent`, `self-update`).
8
+
9
+ > **Existing v0.4.x users:** your MCP client configs keep working.
10
+ > v0.4.0 already shipped the `cerefox-mcp` bin on npm; v0.5 adds the
11
+ > `cerefox` CLI bin **inside the same `@cerefox/memory` package**. One
12
+ > install, both bins.
13
+
14
+ ---
15
+
16
+ ## What changed
17
+
18
+ ### `cerefox` is now an npm-installable binary
19
+
20
+ ```bash
21
+ npm install -g @cerefox/memory # or: bun install -g @cerefox/memory
22
+ cerefox doctor # callable from any directory
23
+ ```
24
+
25
+ The Python `cerefox` CLI (installed via `uv sync` in a Cerefox checkout)
26
+ keeps working, but now prints a deprecation banner. Removal is v0.8 /
27
+ v0.9 — see iter-23 plan / Decision Log Q2 for the schedule.
28
+
29
+ ### New lifecycle commands
30
+
31
+ | Command | What it does |
32
+ |---|---|
33
+ | `cerefox init` | Interactive 5-step bootstrap (Supabase URL, key, OpenAI, Postgres URL, identity). Writes `~/.cerefox/.env`, validates credentials, ingests bundled self-docs, optionally wires Claude Code or Claude Desktop. |
34
+ | `cerefox doctor` | 9 diagnostic checks (runtime, config, Supabase, OpenAI, schema version, MCP clients, …). |
35
+ | `cerefox status` | Fast 3-check subset of `doctor`. |
36
+ | `cerefox configure-agent --tool claude-code` | Writes `~/.claude/mcp.json` (or merges) to wire up the `cerefox` MCP server. Phase 1: Claude Code + Claude Desktop. Cursor / Codex / Gemini ship in v0.5.x. |
37
+ | `cerefox self-update` (alias `cerefox upgrade`) | Detects installer (bun / npm / yarn / pnpm) and upgrades in place. Also refreshes the bundled-docs ingest. |
38
+ | `cerefox sync-self-docs` | Ingests bundled `AGENT_GUIDE.md` + `AGENT_QUICK_REFERENCE.md` + curated `docs/guides/*.md` under the `_cerefox-self-docs` project. Layer 2 of the MCP discoverability story (§10d in the design doc). |
39
+
40
+ ### Improved help + tab completion
41
+
42
+ ```bash
43
+ cerefox --help # commands grouped READS / WRITES / SERVERS / LIFECYCLE / OPS
44
+ cerefox completion bash > ~/.cerefox-completion.bash
45
+ echo 'source ~/.cerefox-completion.bash' >> ~/.bashrc
46
+ ```
47
+
48
+ ### Documented exit codes
49
+
50
+ | Code | Meaning |
51
+ |---|---|
52
+ | 0 | Success |
53
+ | 1 | User error (bad flag, missing arg, malformed JSON) |
54
+ | 2 | System error (Supabase unreachable, RPC failure) |
55
+ | 3 | Not found (document / version / project) |
56
+
57
+ ---
58
+
59
+ ## Install paths
60
+
61
+ ### Option A — one-line install (recommended for new machines)
62
+
63
+ ```bash
64
+ curl -fsSL https://github.com/fstamatelopoulos/cerefox/releases/latest/download/install.sh | sh
65
+ ```
66
+
67
+ The script detects Bun first, falls back to npm, bootstraps Bun if
68
+ neither is available. Then runs `<runtime> install -g @cerefox/memory`.
69
+
70
+ ### Option B — direct npm install
71
+
72
+ ```bash
73
+ npm install -g @cerefox/memory # Node ≥ 20 required
74
+ # or
75
+ bun install -g @cerefox/memory # faster install + bin start
76
+ # or
77
+ pnpm add -g @cerefox/memory
78
+ yarn global add @cerefox/memory
79
+ ```
80
+
81
+ ### Option C — keep the Python install (no change required)
82
+
83
+ Your existing `uv run cerefox …` keeps working. You'll see a one-line ⚠
84
+ banner pointing at the migration path; suppress with
85
+ `CEREFOX_NO_DEPRECATION_BANNER=1`.
86
+
87
+ ---
88
+
89
+ ## What's NOT in v0.5
90
+
91
+ Three commands are deliberately Python-only (or deferred) for v0.5:
92
+
93
+ - **`cerefox web`** — the TypeScript web server lands in v0.6. For now,
94
+ the npm-installed `cerefox web` prints a "use `uv run cerefox web` from
95
+ a clone" message and exits 0. The Python web server keeps working.
96
+ - **`cerefox reindex`** — depends on the v0.7 TS ingestion pipeline.
97
+ Same "use uv" message; exit 0.
98
+ - **Schema deploy in `cerefox init`** — needs a Postgres direct
99
+ connection that v0.5 doesn't ship. `init` prints the
100
+ `uv run python scripts/db_deploy.py` command at the right moment; v0.6
101
+ ports the deploy step.
102
+
103
+ If your usage hits any of these, keep your Python install around for now.
104
+
105
+ ---
106
+
107
+ ## Upgrading an existing MCP client config
108
+
109
+ The v0.4.x config you may have written looked like:
110
+
111
+ ```json
112
+ {
113
+ "mcpServers": {
114
+ "cerefox": {
115
+ "command": "npx",
116
+ "args": ["-y", "--package=@cerefox/memory", "cerefox-mcp"]
117
+ }
118
+ }
119
+ }
120
+ ```
121
+
122
+ **That keeps working.** v0.5 ships the **same** `cerefox-mcp` bin in
123
+ the **same** npm package. No change required.
124
+
125
+ If you want the v0.5 `cerefox configure-agent` to (re)write the config
126
+ for you, the command is non-destructive: it backs up the existing file
127
+ to `<file>.pre-cerefox.bak` and merges. Existing `mcpServers` entries
128
+ are preserved.
129
+
130
+ ```bash
131
+ cerefox configure-agent --tool claude-code --dry-run # preview
132
+ cerefox configure-agent --tool claude-code # apply
133
+ ```
134
+
135
+ ---
136
+
137
+ ## Known gotchas
138
+
139
+ ### `npx` from inside an npm workspace
140
+
141
+ The v0.4 gotcha still applies: running `npx -y --package=@cerefox/memory
142
+ cerefox-mcp` from inside another npm workspace can fail with "command
143
+ not found." Use `bunx` instead, run from outside any workspace, or
144
+ `npm install -g`.
145
+
146
+ Doesn't affect MCP-client launches (the client controls the launched
147
+ process's CWD).
148
+
149
+ ### Schema-version banner in the web UI
150
+
151
+ If you upgrade `@cerefox/memory` but haven't redeployed the schema, the
152
+ v0.3.0+ schema-version-mismatch banner fires. Run
153
+ `uv run python scripts/db_deploy.py` to sync.
154
+
155
+ This isn't unique to v0.5 — it's the same banner v0.3.0 introduced.
156
+
157
+ ---
158
+
159
+ ## Where to go next
160
+
161
+ - `cerefox docs --list` — bundled docs, offline.
162
+ - `cerefox doctor` — see what's missing / configured.
163
+ - [`docs/guides/connect-agents.md`](connect-agents.md) — full MCP client guide.
164
+ - [`docs/guides/cli.md`](cli.md) — every command and flag, in detail.
165
+ - [`CHANGELOG.md`](../../CHANGELOG.md) — what shipped in v0.5.0.
@@ -0,0 +1,113 @@
1
+ # Operational Cost
2
+
3
+ Cerefox is designed to be cheap to run. This page explains what you will (and won't) pay for,
4
+ and gives rough estimates for two common deployment scenarios.
5
+
6
+ > **Disclaimer**: Pricing for third-party services (Supabase, OpenAI, GCP) changes over time
7
+ > and varies by region and usage pattern. Treat the figures here as order-of-magnitude guidance
8
+ > for a typical single-user personal knowledge base, not as a billing guarantee. Check each
9
+ > provider's current pricing page before committing to a setup.
10
+
11
+ ---
12
+
13
+ ## What costs money
14
+
15
+ | Component | Cost driver |
16
+ |-----------|-------------|
17
+ | **Supabase** | Database storage and API calls. The free tier is generous and covers a typical personal knowledge base indefinitely. |
18
+ | **OpenAI embeddings** | Charged per token when ingesting content or running searches. The default model (`text-embedding-3-small`) is among the cheapest available. |
19
+ | **Cloud Run** (optional) | Compute for the web UI if you deploy it to GCP rather than running it locally. |
20
+ | **Artifact Registry** (optional) | Docker image storage on GCP, if you deploy to Cloud Run. |
21
+
22
+ ---
23
+
24
+ ## Scenario A — Local webapp (lean setup)
25
+
26
+ The web UI and CLI run on your own machine. Supabase is the only cloud service.
27
+
28
+ ```
29
+ Your machine
30
+ ├── cerefox CLI + web UI (free — runs locally)
31
+ └── Supabase (cloud) (free tier)
32
+ └── PostgreSQL + pgvector
33
+ Embeddings via OpenAI API (pay-per-use)
34
+ ```
35
+
36
+ **Typical cost for personal use**: a few cents to a couple of dollars per month, almost entirely
37
+ from OpenAI embedding calls. Light users (a few hundred documents ingested and searched
38
+ occasionally) will see costs well under a dollar a month. Heavier usage — thousands of documents
39
+ with frequent AI agent queries — might reach a few dollars a month.
40
+
41
+ You only pay for embeddings when:
42
+ - Ingesting new or updated content (one embedding call per chunk, typically a few hundred tokens)
43
+ - Searching via `cerefox mcp` or the CLI (one embedding call per query)
44
+
45
+ The web UI's built-in search bar and document browser make no embedding calls.
46
+
47
+ ### Supabase free tier limits
48
+
49
+ Supabase's free tier is sufficient for a personal knowledge base. Key limits as of early 2026:
50
+
51
+ - 500 MB database storage (text + vectors; a typical knowledge base is well under this)
52
+ - 50,000 API calls/month (for queries via supabase-py)
53
+ - 2 active projects
54
+
55
+ If you exceed these limits, Supabase's Pro plan is the next step — check
56
+ [supabase.com/pricing](https://supabase.com/pricing) for current rates.
57
+
58
+ ---
59
+
60
+ ## Scenario B — Cloud Run webapp
61
+
62
+ The web UI is deployed to Google Cloud Run so it's accessible from any browser without keeping
63
+ your laptop on. Everything else is the same as Scenario A.
64
+
65
+ ```
66
+ Your machine / any browser
67
+ └── Cloud Run (GCP) (free tier; small charge if exceeded)
68
+ └── cerefox web UI
69
+ Supabase (cloud) (free tier)
70
+ └── PostgreSQL + pgvector
71
+ Embeddings via OpenAI API (pay-per-use)
72
+ ```
73
+
74
+ **Typical cost for personal use**: similar to Scenario A for embeddings, plus a small amount
75
+ for Cloud Run and image storage. Cloud Run has a generous always-free tier (2 million requests
76
+ and 360,000 vCPU-seconds per month) that easily covers low-traffic personal use. Docker image
77
+ storage in Artifact Registry costs a small amount per GB per month.
78
+
79
+ In practice, most single users running Cerefox on Cloud Run pay roughly the same as Scenario A
80
+ — a few cents to a couple of dollars per month in total.
81
+
82
+ ### GCP free tier limits
83
+
84
+ Cloud Run's free tier limits as of early 2026:
85
+
86
+ - 2 million requests/month
87
+ - 360,000 GB-seconds of memory/month
88
+ - 180,000 vCPU-seconds/month
89
+
90
+ These limits comfortably cover personal-use traffic. Check
91
+ [cloud.google.com/run/pricing](https://cloud.google.com/run/pricing) for current rates.
92
+
93
+ ---
94
+
95
+ ## Controlling embedding costs
96
+
97
+ If you want to keep costs as low as possible:
98
+
99
+ - **Fireworks AI** is an OpenAI-compatible alternative that offers competitive embedding prices.
100
+ See `docs/guides/configuration.md` for how to switch.
101
+ - **Batch ingest, don't re-ingest**: Cerefox deduplicates by content hash — re-ingesting the
102
+ same file twice costs nothing. Only new or changed content triggers embedding calls.
103
+ - **`cerefox reindex`**: Re-embeds all existing chunks if you switch embedders. Run this once
104
+ after switching, not repeatedly.
105
+
106
+ ---
107
+
108
+ ## What is always free
109
+
110
+ - The Cerefox application itself (Apache 2.0 open source, no license fees)
111
+ - Local CLI and web UI (runs on your machine)
112
+ - All search RPCs and FTS queries (Supabase free tier covers personal-scale usage)
113
+ - Backups and restores (JSON snapshots, no cloud storage required)