@cerefox/memory 0.7.1 → 0.8.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.
Files changed (48) hide show
  1. package/README.md +62 -25
  2. package/dist/bin/cerefox.js +1163 -344
  3. package/dist/frontend/assets/{index-HNlMcvli.js → index-CAp2_lFX.js} +2 -2
  4. package/dist/frontend/assets/index-CAp2_lFX.js.map +1 -0
  5. package/dist/frontend/index.html +1 -1
  6. package/dist/server-assets/_shared/ef-meta/index.ts +97 -0
  7. package/dist/server-assets/_shared/embeddings/index.ts +175 -0
  8. package/dist/server-assets/_shared/mcp-tools/_chunker.ts +187 -0
  9. package/dist/server-assets/_shared/mcp-tools/_projects.ts +121 -0
  10. package/dist/server-assets/_shared/mcp-tools/_utils.ts +73 -0
  11. package/dist/server-assets/_shared/mcp-tools/audit-log.ts +95 -0
  12. package/dist/server-assets/_shared/mcp-tools/get-document.ts +73 -0
  13. package/dist/server-assets/_shared/mcp-tools/get-help-content.ts +26 -0
  14. package/dist/server-assets/_shared/mcp-tools/get-help.ts +90 -0
  15. package/dist/server-assets/_shared/mcp-tools/index.ts +67 -0
  16. package/dist/server-assets/_shared/mcp-tools/ingest.ts +315 -0
  17. package/dist/server-assets/_shared/mcp-tools/list-metadata-keys.ts +55 -0
  18. package/dist/server-assets/_shared/mcp-tools/list-projects.ts +59 -0
  19. package/dist/server-assets/_shared/mcp-tools/list-versions.ts +72 -0
  20. package/dist/server-assets/_shared/mcp-tools/metadata-search.ts +154 -0
  21. package/dist/server-assets/_shared/mcp-tools/search.ts +193 -0
  22. package/dist/server-assets/_shared/mcp-tools/set-document-projects.ts +163 -0
  23. package/dist/server-assets/_shared/mcp-tools/types.ts +92 -0
  24. package/dist/server-assets/db/migrations/0003_add_document_versions.sql +91 -0
  25. package/dist/server-assets/db/migrations/0004_add_audit_log_review_status_archived.sql +71 -0
  26. package/dist/server-assets/db/migrations/0005_metadata_search.sql +628 -0
  27. package/dist/server-assets/db/migrations/0006_usage_log.sql +255 -0
  28. package/dist/server-assets/db/migrations/0007_usage_log_requestor.sql +178 -0
  29. package/dist/server-assets/db/migrations/0008_soft_delete.sql +130 -0
  30. package/dist/server-assets/db/migrations/0009_audit_log_restore_operation.sql +20 -0
  31. package/dist/server-assets/db/migrations/0010_requestor_enforcement_config.sql +12 -0
  32. package/dist/server-assets/db/migrations/0011_title_boosting.sql +48 -0
  33. package/dist/server-assets/db/rpcs.sql +1723 -0
  34. package/dist/server-assets/db/schema.sql +380 -0
  35. package/dist/server-assets/supabase/functions/cerefox-get-audit-log/index.ts +117 -0
  36. package/dist/server-assets/supabase/functions/cerefox-get-document/index.ts +138 -0
  37. package/dist/server-assets/supabase/functions/cerefox-ingest/index.ts +819 -0
  38. package/dist/server-assets/supabase/functions/cerefox-list-projects/index.ts +96 -0
  39. package/dist/server-assets/supabase/functions/cerefox-list-versions/index.ts +113 -0
  40. package/dist/server-assets/supabase/functions/cerefox-mcp/index.ts +294 -0
  41. package/dist/server-assets/supabase/functions/cerefox-mcp/shared.ts +42 -0
  42. package/dist/server-assets/supabase/functions/cerefox-metadata/index.ts +99 -0
  43. package/dist/server-assets/supabase/functions/cerefox-metadata-search/index.ts +146 -0
  44. package/dist/server-assets/supabase/functions/cerefox-search/index.ts +382 -0
  45. package/docs/guides/connect-agents.md +58 -3
  46. package/docs/guides/migration-v0.5.md +50 -0
  47. package/package.json +3 -2
  48. package/dist/frontend/assets/index-HNlMcvli.js.map +0 -1
package/README.md CHANGED
@@ -5,12 +5,20 @@
5
5
  curated knowledge layer that multiple AI tools can read and write.
6
6
 
7
7
  > **Cerefox is BYO-storage.** This package is the *client* — the CLI + local
8
- > MCP server. The knowledge base itself lives in **your own Supabase project**
9
- > (Postgres + pgvector; free tier works). Installing this npm package does
10
- > **not** give you a working KB on its own; you also need a Supabase project +
11
- > an embedding API key. The first-run `cerefox init` wires everything together
12
- > in ~2 minutes once you have those in hand. **See "Before you install"
13
- > below.**
8
+ > MCP server + local web UI. The knowledge base itself lives in **your own
9
+ > Supabase project** (Postgres + pgvector; free tier works). Installing this
10
+ > npm package does **not** give you a working KB on its own; you also need a
11
+ > Supabase project + an embedding API key, and a one-time server-side deploy
12
+ > from the source repo. **See "Before you install" below.**
13
+
14
+ **Why cloud-backed?** Cerefox is designed as a *cloud-backed* memory layer so
15
+ the same knowledge is reachable from every agent you run — Claude Code on
16
+ your laptop, Cursor on a second machine, ChatGPT on the web, a script in CI.
17
+ Postgres + pgvector deliver hybrid (semantic + full-text) search across that
18
+ shared memory; Supabase provides the always-on endpoint that makes "same
19
+ memory, any device, any agent" work. You own the data and the endpoint; this
20
+ package bundles **everything you run locally** — CLI, MCP server, web UI,
21
+ and the in-process ingestion + retrieval pipeline — that talks to it.
14
22
 
15
23
  This package contains a single binary, **`cerefox`**:
16
24
 
@@ -18,6 +26,7 @@ This package contains a single binary, **`cerefox`**:
18
26
  |---|---|
19
27
  | `cerefox <command>` | CLI — search, ingest, list, version-history, audit-log, lifecycle (`init`, `doctor`, `configure-agent`, `self-update`). Callable from any directory. |
20
28
  | `cerefox mcp` | Local stdio MCP server. Drop-in for Claude Code, Cursor, Claude Desktop, Codex CLI, Gemini CLI. Exposes the same 10 MCP tools as the remote `cerefox-mcp` Edge Function. |
29
+ | `cerefox web` | Local web app at `http://localhost:8000` — React UI for browsing, searching, editing, and ingesting documents. Backed by an in-process Hono server that exposes the same `/api/v1/*` REST surface as the bundled Edge Functions. |
21
30
 
22
31
  > **What this package isn't:** the source of truth for Cerefox's architecture
23
32
  > or docs. Those live in the [GitHub repo](https://github.com/fstamatelopoulos/cerefox).
@@ -27,14 +36,42 @@ This package contains a single binary, **`cerefox`**:
27
36
 
28
37
  ## Before you install
29
38
 
30
- Cerefox is a self-hosted memory layer. To use it you need three things, none
31
- of which this npm package brings with it:
39
+ Cerefox is a self-hosted memory layer with two halves you set up independently:
40
+
41
+ **Server side** (lives in your Supabase project, runs ~24/7):
42
+ - Postgres schema + RPCs (search, ingest, audit log, version history)
43
+ - Edge Functions (server-side embedding, remote `cerefox-mcp` MCP server, Custom-GPT actions)
44
+
45
+ **Client side** (this npm package, runs on your machine):
46
+ - `cerefox` CLI + `cerefox mcp` (local stdio MCP) + `cerefox web` (local UI at `http://localhost:8000`)
47
+
48
+ The server side ships with the source repo, not this npm package. Both halves are required for a working install.
49
+
50
+ ### What you need
32
51
 
33
52
  | Prerequisite | Why | How |
34
53
  |---|---|---|
35
- | A **Supabase project** | The knowledge base (documents + chunks + embeddings) lives in your Supabase project's Postgres database, with pgvector for semantic search. Free tier is enough for most personal use. | Sign up at [supabase.com](https://supabase.com), create a project, then follow the [Supabase setup guide](https://github.com/fstamatelopoulos/cerefox/blob/main/docs/guides/setup-supabase.md) — deploy the Cerefox schema (one script), then deploy the Edge Functions (one command). Estimate: 10–15 minutes the first time. |
36
- | An **embedding API key** | Cerefox embeds your documents for semantic search. OpenAI's `text-embedding-3-small` is the default; Fireworks AI is an alternative. | Get an [OpenAI API key](https://platform.openai.com/api-keys) — costs are pennies/month for typical personal use (see [operational-cost.md](https://github.com/fstamatelopoulos/cerefox/blob/main/docs/guides/operational-cost.md)). |
37
- | **Node ≥ 20** or **Bun ≥ 1.0** | Runtime for the `cerefox` bin (and the bundled `cerefox mcp` server). | [nodejs.org](https://nodejs.org) or [bun.sh](https://bun.sh). The one-line installer below bootstraps Bun for you if neither is present. |
54
+ | A **Supabase project** | Hosts Postgres + pgvector + Edge Functions. Free tier is enough for most personal use. | [supabase.com](https://supabase.com) New project |
55
+ | An **embedding API key** | OpenAI `text-embedding-3-small` (default) or Fireworks AI. Pennies/month for typical personal use (see [operational-cost.md](https://github.com/fstamatelopoulos/cerefox/blob/main/docs/guides/operational-cost.md)). | Get an [OpenAI API key](https://platform.openai.com/api-keys). |
56
+ | **Node ≥ 20** or **Bun ≥ 1.0** | Runtime for the `cerefox` bin (and the bundled `cerefox mcp` server). | [nodejs.org](https://nodejs.org) · [bun.sh](https://bun.sh). The one-line installer below bootstraps Bun if neither is present. |
57
+
58
+ ### One-time server-side setup (~10 min — clone required)
59
+
60
+ The schema, RPCs, and Edge Functions ship with the source repo, not this npm package. Clone once, configure, deploy:
61
+
62
+ ```bash
63
+ git clone https://github.com/fstamatelopoulos/cerefox.git
64
+ cd cerefox && cp .env.example .env # fill in CEREFOX_SUPABASE_* + OPENAI_API_KEY + CEREFOX_DATABASE_URL
65
+ bun install # workspace deps for the deploy scripts
66
+ bun scripts/db_deploy.ts # creates tables, indexes, RPCs in your Supabase
67
+ npx supabase functions deploy cerefox-mcp cerefox-search cerefox-ingest \
68
+ cerefox-metadata cerefox-get-document \
69
+ cerefox-list-versions cerefox-get-audit-log \
70
+ cerefox-metadata-search cerefox-list-projects
71
+ npx supabase secrets set OPENAI_API_KEY=sk-...
72
+ ```
73
+
74
+ Full walkthrough (connection-pooling quirks, Supabase API-key flavors, troubleshooting): [setup-supabase.md](https://github.com/fstamatelopoulos/cerefox/blob/main/docs/guides/setup-supabase.md).
38
75
 
39
76
  If you don't yet have Supabase + an OpenAI key, the [Cerefox
40
77
  quickstart](https://github.com/fstamatelopoulos/cerefox/blob/main/docs/guides/quickstart.md)
@@ -64,7 +101,7 @@ yarn global add @cerefox/memory
64
101
  ```bash
65
102
  cerefox init # 5-step interactive bootstrap (asks for Supabase URL,
66
103
  # Supabase key, OpenAI key, optional Postgres URL, identity)
67
- cerefox doctor # verify everything reaches
104
+ cerefox doctor # end-to-end health check against the live services
68
105
  ```
69
106
 
70
107
  `cerefox init` prompts for the credentials you collected above, validates them
@@ -73,11 +110,10 @@ optionally wires up an MCP client. **It does not create the Supabase project
73
110
  for you** — you'll be asked for the URL + key, so make sure those are
74
111
  already provisioned (see "Before you install").
75
112
 
76
- > **Schema deploy (v0.5):** if your Supabase project is fresh, `cerefox init`
77
- > tells you to run `uv run python scripts/db_deploy.py` from a Cerefox repo
78
- > clone to install the schema. This last manual step goes away in v0.6 when
79
- > the deploy logic is ported to the TS CLI. For now, the setup-supabase
80
- > guide walks through it.
113
+ > **Already ran the server-side setup above?** Then your schema is in place and
114
+ > `cerefox init` only needs the URL + keys. If you skipped that step,
115
+ > `cerefox doctor` will flag it and point you back to
116
+ > `bun scripts/db_deploy.ts` from a repo clone.
81
117
 
82
118
  > **Upgrading from the Python `cerefox` CLI?** If you have a working
83
119
  > `.env` in your repo clone, init detects it and offers to **copy** it to
@@ -92,13 +128,15 @@ already provisioned (see "Before you install").
92
128
 
93
129
  ```bash
94
130
  # Run the configure-agent commands that apply to your setup:
95
- cerefox configure-agent --tool claude-code # writes ~/.claude/mcp.json
96
- cerefox configure-agent --tool claude-desktop # writes Claude Desktop config
131
+ cerefox configure-agent --tool claude-code # ~/.claude.json via `claude mcp add`
132
+ cerefox configure-agent --tool claude-desktop # Claude Desktop config
133
+ cerefox configure-agent --tool cursor # ~/.cursor/mcp.json
134
+ cerefox configure-agent --tool codex # ~/.codex/config.toml
135
+ cerefox configure-agent --tool gemini # ~/.gemini/settings.json
97
136
  ```
98
137
 
99
- Phase 1 supports Claude Code + Claude Desktop. Cursor, Codex CLI, and Gemini
100
- CLI ship in a follow-up. For manual configuration, the canonical MCP entry
101
- is:
138
+ All five writers landed in v0.6. For manual configuration, the canonical MCP
139
+ entry is:
102
140
 
103
141
  ```json
104
142
  {
@@ -147,9 +185,8 @@ its own. The rest of the `cerefox` CLI is useful for:
147
185
  `cerefox metadata-search --metadata-filter …`, `cerefox backup`.
148
186
  - **Setup + diagnostics**: `cerefox init`, `cerefox doctor`,
149
187
  `cerefox configure-agent`, `cerefox self-update`.
150
- - **Agents via local Bash tool** (Path C in the architecture): some
151
- coding agents prefer running `cerefox <subcommand>` over a Bash tool
152
- rather than configuring MCP.
188
+ - **Agents via local Bash tool**: some coding agents prefer running
189
+ `cerefox <subcommand>` from a shell rather than configuring MCP.
153
190
 
154
191
  ---
155
192