@cerefox/memory 1.16.1 → 1.17.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/AGENT_GUIDE.md +6 -4
- package/AGENT_QUICK_REFERENCE.md +1 -1
- package/dist/bin/cerefox.js +186 -81
- package/dist/server-assets/_shared/ef-meta/index.ts +3 -3
- package/dist/server-assets/_shared/embeddings/onnx-embedder.ts +149 -6
- package/dist/server-assets/_shared/mcp-tools/_utils.ts +3 -32
- package/dist/server-assets/_shared/mcp-tools/escape-heuristic.ts +23 -0
- package/dist/server-assets/_shared/mcp-tools/get-help-content.ts +2 -2
- package/dist/server-assets/_shared/mcp-tools/ingest.ts +5 -4
- package/dist/server-assets/_shared/mcp-tools/search.ts +1 -1
- package/dist/server-assets/db/rpcs.sql +72 -20
- package/dist/server-assets/db/schema.sql +1 -1
- package/docs/guides/configuration.md +22 -5
- package/docs/guides/linking.md +2 -2
- package/docs/guides/ops-scripts.md +45 -0
- package/docs/guides/setup-local.md +4 -2
- package/docs/guides/upgrading.md +7 -0
- package/package.json +1 -1
package/AGENT_GUIDE.md
CHANGED
|
@@ -52,6 +52,8 @@ Find documents using hybrid search (full-text + semantic vector similarity).
|
|
|
52
52
|
**Results format**: Each result shows `## Title [id: <uuid>] (score: X.XXX)` followed by content (in `hybrid` and `fts` modes the heading also carries the section path and the chunk index: `## Title › Section › Subsection [id: <uuid>] (chunk 4) (score: …)`).
|
|
53
53
|
Save the `document_id` from `[id: ...]` -- you need it for `cerefox_get_document` and `cerefox_ingest` updates.
|
|
54
54
|
|
|
55
|
+
**Reading scores**: in `docs` and `hybrid` modes a score is between 0 and 1 (since v1.17.0; scores above 1 came from older servers). Use it to compare results within one response, not across queries: a short or unusual phrasing scores lower than a full title even when it finds the same document. If a search returns a below-confidence notice, the results are best guesses, so try another phrasing before concluding the knowledge isn't there.
|
|
56
|
+
|
|
55
57
|
For large documents, results may be partial (`is_partial` flag). Use `cerefox_get_document` with the ID to get the full text.
|
|
56
58
|
|
|
57
59
|
**Rule**: Always search before answering questions about stored knowledge. Always search before ingesting to check for duplicates.
|
|
@@ -557,7 +559,7 @@ Documents you ingest may contain markdown links to other Cerefox documents. The
|
|
|
557
559
|
**For any cross-reference you author, use the target document's UUID.** Period.
|
|
558
560
|
|
|
559
561
|
```markdown
|
|
560
|
-
[
|
|
562
|
+
[Q3 Goals](3f2b9c1e-8a47-4d2e-9b6a-1c5e7d0a4f82)
|
|
561
563
|
```
|
|
562
564
|
|
|
563
565
|
**The server validates these links on every write (v1.7.0, #214).** A write
|
|
@@ -606,7 +608,7 @@ The resolver also accepts three other link forms, but **agents should not write
|
|
|
606
608
|
|---|---|---|
|
|
607
609
|
| Repo-relative path | `[Quickstart](docs/guides/quickstart.md)` | Only when the target has a `source_path` from repo ingest. Don't construct manually. |
|
|
608
610
|
| Basename only | `[Quickstart](quickstart.md)` | Same — best-effort path fallback. Don't construct manually. |
|
|
609
|
-
| Angle-bracket title | `[
|
|
611
|
+
| Angle-bracket title | `[Release Notes](<Release Notes: Version 2>)` | **Fragile**. Breaks on titles containing colons, parentheses, ampersands, brackets, or other punctuation. Web UI's URL sanitizer strips suspicious-looking URLs (e.g. anything before a `:` that looks like a scheme) → link silently navigates to current page. **Never use this form in agent-authored content.** |
|
|
610
612
|
|
|
611
613
|
If you're tempted to write `[Title With Spaces](<Title With Spaces>)` because you don't have the ID, **do an extra `cerefox_search` and use the ID instead**. The one extra tool call is much cheaper than the user encountering a broken link.
|
|
612
614
|
|
|
@@ -617,8 +619,8 @@ The `[Link Text](target)` syntax has two halves:
|
|
|
617
619
|
- **Link text** (`[…]`): what the human reader sees. Use the actual title.
|
|
618
620
|
- **Target** (`(…)`): what the resolver consumes. Always a UUID for agent-authored content.
|
|
619
621
|
|
|
620
|
-
Bad: `[
|
|
621
|
-
Good: `[
|
|
622
|
+
Bad: `[3f2b9c1e-8a47-...](3f2b9c1e-8a47-...)` — opaque to the reader.
|
|
623
|
+
Good: `[Quarterly Planning - Q3 Goals](3f2b9c1e-8a47-4d2e-9b6a-1c5e7d0a4f82)`.
|
|
622
624
|
|
|
623
625
|
### What you don't need to do
|
|
624
626
|
|
package/AGENT_QUICK_REFERENCE.md
CHANGED
|
@@ -78,7 +78,7 @@ recoverable answer, not a failure: retry with what it gave you.
|
|
|
78
78
|
4. **Use `document_id` from search results** `[id: uuid]` for get_document and list_versions.
|
|
79
79
|
5. **`max_bytes` has to fit a whole document.** Search returns COMPLETE documents, so a budget smaller than the top hit fits nothing. You get a header-only list saying so (never "No results found." — that means the store really has nothing). Raise `max_bytes`, or read one document with `cerefox_get_document` using `outline: true` or `section`.
|
|
80
80
|
6. **Add metadata** -- at minimum `type` ("decision-log", "research", "design-doc") and `status` ("active", "draft").
|
|
81
|
-
7. **Write for retrieval: the title does real work.** The document title is indexed at the **highest weight** *and* prepended to every chunk before it is embedded, so it steers both halves of hybrid search (keyword and semantic) for every chunk in the document. Name the document with the distinctive terms someone would actually search for -- "Cerefox Response Size Limits", not "Notes" or "Update 3". Renaming re-indexes and re-embeds, so correcting a vague title is cheap and takes effect immediately. Inside the content, write structured Markdown with H1/H2/H3 headings: the chunker follows them, and a chunk's own heading carries the same weight as the title.
|
|
81
|
+
7. **Write for retrieval: the title does real work.** The document title is indexed at the **highest weight** *and* prepended to every chunk before it is embedded, so it steers both halves of hybrid search (keyword and semantic) for every chunk in the document. Name the document with the distinctive terms someone would actually search for -- "Cerefox Response Size Limits", not "Notes" or "Update 3". Renaming re-indexes and re-embeds, so correcting a vague title is cheap and takes effect immediately. Write the characters themselves: `&` and `<>`, never `&` or `<>` (entities are stored literally and the write reply will say so). Inside the content, write structured Markdown with H1/H2/H3 headings: the chunker follows them, and a chunk's own heading carries the same weight as the title.
|
|
82
82
|
8. **Deletes are soft (recoverable); permanent purge is web-UI-only.** `cerefox_delete_document` requires the document's `content_hash` as you read it (read before you delete) and takes a `reason` — give one; it is what the human reviewing the trash sees. `cerefox_restore_document` undoes a mistaken delete (also audited, also takes a `reason`). Always surface deletes AND restores to the user. Once a human purges from the web UI, the document is gone for good; so is one auto-purged after `trash_retention_days`, if the operator has turned trash auto-purge on.
|
|
83
83
|
9. **Cross-doc links inside content**: **always use `[Text](document-uuid)`.** UUIDs are the only fully reliable link form — stable across title changes, never ambiguous, no encoding gotchas. Every `cerefox_search` result shows `[id: <uuid>]` after the title; grab it and use it. Title-based linking (`[Text](<Title With Spaces>)`) is fragile (breaks on colons, parens, ampersands, brackets — silently navigates to wrong page) — **don't write title-based links**; do an extra search to get the UUID instead. Repo-path forms (`[Text](docs/path.md)`) exist for repo-ingested files; don't construct manually. **The server validates `](uuid)` links on every write** (v1.7.0): a link to a nonexistent id rejects the write, naming the offender — that means you mangled the UUID; re-read the source and correct it, do not retry unchanged. Example ids go in backticks (code is not validated). `[[Wikilinks]]` may dangle. See `AGENT_GUIDE.md → Writing linkable content` for the full rule.
|
|
84
84
|
10. **Concurrency: content updates require `expected_content_hash`.** Pass the `content_hash` you last saw — every read shows one (`cerefox_get_document` incl. outline mode, `cerefox_search`, `cerefox_metadata_search`) and **every write returns the new one, including create** (v1.3.0, #189), so after writing you already hold the token for your next edit; no re-read needed. If it's stale you get a **conflict** — re-read the document, merge your changes into the latest content, retry with the new hash. **Never resolve a conflict by overwriting blindly** — the current content includes another writer's work. `last_write_wins: true` skips the check; use it ONLY when an external source of truth makes conflicts meaningless (file re-sync), never to silence a conflict.
|