@cerefox/memory 1.4.0 → 1.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 +79 -0
- package/AGENT_QUICK_REFERENCE.md +79 -0
- package/dist/bin/cerefox.js +532 -360
- package/dist/frontend/assets/{index-B1pgikxA.js → index-D9z5yV9u.js} +30 -30
- package/dist/frontend/assets/index-D9z5yV9u.js.map +1 -0
- package/dist/frontend/index.html +1 -1
- package/dist/server-assets/_shared/ef-meta/index.ts +20 -2
- package/dist/server-assets/_shared/mcp-tools/audit-log.ts +14 -1
- package/dist/server-assets/_shared/mcp-tools/get-help-content.ts +4 -2
- package/dist/server-assets/_shared/mcp-tools/get-help.ts +56 -0
- package/dist/server-assets/_shared/mcp-tools/list-versions.ts +12 -1
- package/dist/server-assets/_shared/partial-edits/index.ts +49 -0
- package/dist/server-assets/db/migrations/0022_rls_on_document_relations.sql +38 -0
- package/dist/server-assets/db/rpcs.sql +3 -1
- package/dist/server-assets/db/schema.sql +8 -1
- package/package.json +1 -1
- package/dist/frontend/assets/index-B1pgikxA.js.map +0 -1
package/AGENT_GUIDE.md
CHANGED
|
@@ -603,3 +603,82 @@ printf '...new content...' \
|
|
|
603
603
|
cerefox audit list --json --limit 1000 --requestor "claude-code" \
|
|
604
604
|
| jq 'select(.author_type == "agent")'
|
|
605
605
|
```
|
|
606
|
+
|
|
607
|
+
## Timestamps are UTC
|
|
608
|
+
|
|
609
|
+
Every timestamp Cerefox returns — `created_at` on audit entries, version
|
|
610
|
+
history, document metadata — is **UTC**, and now carries its `Z` marker so it
|
|
611
|
+
cannot be mistaken for local time.
|
|
612
|
+
|
|
613
|
+
**When you write a date into a document's CONTENT, use your own clock, not a
|
|
614
|
+
Cerefox timestamp.** These are different things: a timestamp records when the
|
|
615
|
+
server stored something; a date in a log entry or a heading is authored content
|
|
616
|
+
and belongs to your timezone. An agent working a Pacific afternoon read
|
|
617
|
+
`2026-08-11` from version history, wrote "8/11" into its entries, and put a
|
|
618
|
+
day's work in the future — the timestamp was correct, and copying it into
|
|
619
|
+
content was not.
|
|
620
|
+
|
|
621
|
+
Cerefox deliberately does not convert to local time on the API or MCP paths.
|
|
622
|
+
"Local" has no server-side meaning: the remote MCP server runs in a cloud
|
|
623
|
+
function whose local time *is* UTC, while a local MCP server runs in yours, so
|
|
624
|
+
the same document would report two different times depending on transport. The
|
|
625
|
+
web UI converts because a browser knows the viewer's timezone; nothing
|
|
626
|
+
server-side does.
|
|
627
|
+
|
|
628
|
+
## Mistakes that have actually happened
|
|
629
|
+
|
|
630
|
+
Each of these comes from a real agent session, and each is easy to make.
|
|
631
|
+
|
|
632
|
+
- **`cerefox_ingest` always replaces the ENTIRE document.** Never a section.
|
|
633
|
+
Before sending, check that the tool name matches the intent: if the intent is
|
|
634
|
+
"change one section", the call is `cerefox_edit` with `replace_section`. A
|
|
635
|
+
section-sized edit sent as a full ingest truncated a 13,000-character index to
|
|
636
|
+
a single word. It was recovered from version history within the minute, but
|
|
637
|
+
only because it was noticed immediately.
|
|
638
|
+
|
|
639
|
+
- **Do not include the anchor's own heading in your text.** `replace_section`
|
|
640
|
+
keeps the heading and `insert` places your text inside the section, so
|
|
641
|
+
including it produces two. This is now refused rather than silently applied,
|
|
642
|
+
but the shape is worth knowing: it happened twice in one session, the second
|
|
643
|
+
time while trying to repair the first. A *deeper* sub-heading inside your text
|
|
644
|
+
is fine.
|
|
645
|
+
|
|
646
|
+
- **Content between sections belongs to the section ABOVE it.** A section runs
|
|
647
|
+
to the next heading of the same or higher level, so a `---` rule, a note, or
|
|
648
|
+
any trailing text sitting just above the next heading is part of the section
|
|
649
|
+
before it — even when it visually reads as belonging below. Replacing that
|
|
650
|
+
section takes it too. An agent hit exactly this: a `---` that separated two
|
|
651
|
+
major sections disappeared when the section above it was replaced. The write
|
|
652
|
+
was correct by the addressing rules; the surprise is that "the end of this
|
|
653
|
+
section" is further down the page than it looks. Note the loss warning will
|
|
654
|
+
not catch it if your replacement text is longer than what it replaced, since
|
|
655
|
+
there is then no net loss to report.
|
|
656
|
+
|
|
657
|
+
- **Never partial-edit to fix a partial edit.** If a write leaves unexpected
|
|
658
|
+
structure, stop. Use `cerefox_list_versions`, retrieve the last good version,
|
|
659
|
+
and re-ingest cleanly. Repairing edits with more edits compounds the damage.
|
|
660
|
+
|
|
661
|
+
- **A rejected batch is safe.** Operations in one `cerefox_edit` are
|
|
662
|
+
all-or-nothing: if any is invalid, nothing is written. A refusal costs you a
|
|
663
|
+
retry, not data — so prefer one call for changes that belong together, and do
|
|
664
|
+
not split a batch to "make it more likely to succeed".
|
|
665
|
+
|
|
666
|
+
- **Read before replacing.** `cerefox_get_document(section: "## Heading")`
|
|
667
|
+
returns exactly what a `replace_section` on that anchor would overwrite. Use it
|
|
668
|
+
for any section you did not write in this session. The outline gives a
|
|
669
|
+
section's *size*, never its *text*.
|
|
670
|
+
|
|
671
|
+
- **Verify after writing** — read the result back before reporting success, and
|
|
672
|
+
report what the read actually shows.
|
|
673
|
+
|
|
674
|
+
- **Partial edits cannot change a document's stored TITLE.** `rename_section`
|
|
675
|
+
changes a heading inside the content; the title is a separate field and still
|
|
676
|
+
needs `cerefox_ingest`.
|
|
677
|
+
|
|
678
|
+
- **If a capability seems missing from one server, suspect your client first.**
|
|
679
|
+
Local and remote run the same code. Call `cerefox_get_help(topic: "server")`:
|
|
680
|
+
it reports the server's own version and the operations it registers. If that
|
|
681
|
+
disagrees with your tool list, the client is holding a list it fetched before
|
|
682
|
+
an upgrade — clients cache it at connect time. Ask the user to restart the
|
|
683
|
+
client. Do not record a capability difference between servers as a fact; every
|
|
684
|
+
such report so far has been a stale client.
|
package/AGENT_QUICK_REFERENCE.md
CHANGED
|
@@ -135,3 +135,82 @@ Same operations, same conventions. Full reference: [`docs/guides/cli.md`](docs/g
|
|
|
135
135
|
- Reads: `--requestor "<your-name>"`
|
|
136
136
|
|
|
137
137
|
Or have your user set `CEREFOX_AUTHOR_NAME` / `CEREFOX_AUTHOR_TYPE` / `CEREFOX_REQUESTOR_NAME` in their `.env` to apply defaults once.
|
|
138
|
+
|
|
139
|
+
## Timestamps are UTC
|
|
140
|
+
|
|
141
|
+
Every timestamp Cerefox returns — `created_at` on audit entries, version
|
|
142
|
+
history, document metadata — is **UTC**, and now carries its `Z` marker so it
|
|
143
|
+
cannot be mistaken for local time.
|
|
144
|
+
|
|
145
|
+
**When you write a date into a document's CONTENT, use your own clock, not a
|
|
146
|
+
Cerefox timestamp.** These are different things: a timestamp records when the
|
|
147
|
+
server stored something; a date in a log entry or a heading is authored content
|
|
148
|
+
and belongs to your timezone. An agent working a Pacific afternoon read
|
|
149
|
+
`2026-08-11` from version history, wrote "8/11" into its entries, and put a
|
|
150
|
+
day's work in the future — the timestamp was correct, and copying it into
|
|
151
|
+
content was not.
|
|
152
|
+
|
|
153
|
+
Cerefox deliberately does not convert to local time on the API or MCP paths.
|
|
154
|
+
"Local" has no server-side meaning: the remote MCP server runs in a cloud
|
|
155
|
+
function whose local time *is* UTC, while a local MCP server runs in yours, so
|
|
156
|
+
the same document would report two different times depending on transport. The
|
|
157
|
+
web UI converts because a browser knows the viewer's timezone; nothing
|
|
158
|
+
server-side does.
|
|
159
|
+
|
|
160
|
+
## Mistakes that have actually happened
|
|
161
|
+
|
|
162
|
+
Each of these comes from a real agent session, and each is easy to make.
|
|
163
|
+
|
|
164
|
+
- **`cerefox_ingest` always replaces the ENTIRE document.** Never a section.
|
|
165
|
+
Before sending, check that the tool name matches the intent: if the intent is
|
|
166
|
+
"change one section", the call is `cerefox_edit` with `replace_section`. A
|
|
167
|
+
section-sized edit sent as a full ingest truncated a 13,000-character index to
|
|
168
|
+
a single word. It was recovered from version history within the minute, but
|
|
169
|
+
only because it was noticed immediately.
|
|
170
|
+
|
|
171
|
+
- **Do not include the anchor's own heading in your text.** `replace_section`
|
|
172
|
+
keeps the heading and `insert` places your text inside the section, so
|
|
173
|
+
including it produces two. This is now refused rather than silently applied,
|
|
174
|
+
but the shape is worth knowing: it happened twice in one session, the second
|
|
175
|
+
time while trying to repair the first. A *deeper* sub-heading inside your text
|
|
176
|
+
is fine.
|
|
177
|
+
|
|
178
|
+
- **Content between sections belongs to the section ABOVE it.** A section runs
|
|
179
|
+
to the next heading of the same or higher level, so a `---` rule, a note, or
|
|
180
|
+
any trailing text sitting just above the next heading is part of the section
|
|
181
|
+
before it — even when it visually reads as belonging below. Replacing that
|
|
182
|
+
section takes it too. An agent hit exactly this: a `---` that separated two
|
|
183
|
+
major sections disappeared when the section above it was replaced. The write
|
|
184
|
+
was correct by the addressing rules; the surprise is that "the end of this
|
|
185
|
+
section" is further down the page than it looks. Note the loss warning will
|
|
186
|
+
not catch it if your replacement text is longer than what it replaced, since
|
|
187
|
+
there is then no net loss to report.
|
|
188
|
+
|
|
189
|
+
- **Never partial-edit to fix a partial edit.** If a write leaves unexpected
|
|
190
|
+
structure, stop. Use `cerefox_list_versions`, retrieve the last good version,
|
|
191
|
+
and re-ingest cleanly. Repairing edits with more edits compounds the damage.
|
|
192
|
+
|
|
193
|
+
- **A rejected batch is safe.** Operations in one `cerefox_edit` are
|
|
194
|
+
all-or-nothing: if any is invalid, nothing is written. A refusal costs you a
|
|
195
|
+
retry, not data — so prefer one call for changes that belong together, and do
|
|
196
|
+
not split a batch to "make it more likely to succeed".
|
|
197
|
+
|
|
198
|
+
- **Read before replacing.** `cerefox_get_document(section: "## Heading")`
|
|
199
|
+
returns exactly what a `replace_section` on that anchor would overwrite. Use it
|
|
200
|
+
for any section you did not write in this session. The outline gives a
|
|
201
|
+
section's *size*, never its *text*.
|
|
202
|
+
|
|
203
|
+
- **Verify after writing** — read the result back before reporting success, and
|
|
204
|
+
report what the read actually shows.
|
|
205
|
+
|
|
206
|
+
- **Partial edits cannot change a document's stored TITLE.** `rename_section`
|
|
207
|
+
changes a heading inside the content; the title is a separate field and still
|
|
208
|
+
needs `cerefox_ingest`.
|
|
209
|
+
|
|
210
|
+
- **If a capability seems missing from one server, suspect your client first.**
|
|
211
|
+
Local and remote run the same code. Call `cerefox_get_help(topic: "server")`:
|
|
212
|
+
it reports the server's own version and the operations it registers. If that
|
|
213
|
+
disagrees with your tool list, the client is holding a list it fetched before
|
|
214
|
+
an upgrade — clients cache it at connect time. Ask the user to restart the
|
|
215
|
+
client. Do not record a capability difference between servers as a fact; every
|
|
216
|
+
such report so far has been a stale client.
|