Skip to content

memory: keep a raw input log of /add requests, independent of extraction #537

Closed

Description

@gloryfromca

Problem

EverOS keeps no record of what a client actually sent to POST /api/v2/memory/add. The closest things are by-products of extraction:

  • unprocessed_buffer holds messages only until boundary detection folds them into a memcell.
  • memcell.payload_json keeps the conversation text, but not as it was sent. Attachments have already been replaced by their parsed text (service/_boundary.py builds the cell from CanonicalMessage.text), and the messages are grouped the way boundary detection cut them. It also lives in .index/sqlite/system.db, inside the directory that docs/how-memory-works.md says can be deleted without losing anything.
  • In async mode, memorize_inbox.payload_json is cleared as soon as the row is delivered.

So once extraction has run, the original input can no longer be inspected, replayed or audited. (EverOS Cloud reports every request body to a request log outside the engine.)

Proposal

An input log that has nothing to do with extraction:

  • What: every /add request that passes validation, as the client sent it (model_dump(mode="json", exclude_unset=True)), plus its request_id and receive time. One JSON line per request. /flush and /search are not logged.
  • When: in the route, before the sync / async split. Each accepted request is logged exactly once, whatever happens to extraction afterwards; queue retries do not log it again.
  • Where: <root>/<app>/<project>/.input_log/YYYY-MM-DD.jsonl. The date is in the display timezone, the same as the daily-log Markdown files. The directory is outside .index/, so deleting the index does not lose it. No memory kind matches the path, so the cascade scanner and watcher ignore it.
  • Retention: retention_days, default 30. A file whose date is older than that is deleted. The sweep runs when a scope writes its first line of a day, including the first line after a restart.
  • Large attachments: if a line would exceed max_inline_bytes (default 1 MiB), the base64 of each content item is replaced by its length and SHA-256. Text is always kept verbatim.
  • Failure: a failed log write is logged at error level and does not fail /add.
  • Config: [memorize.input_log] with enabled = true, retention_days = 30 and max_inline_bytes = 1048576.

Relation to #483

A session-only delete must also remove that session's lines from the input log. Otherwise "forget this conversation" leaves the raw text on disk for up to retention_days. That work belongs to #483.

Out of scope

  • Reading the log through the API.
  • Moving memcell / unprocessed_buffer out of .index/. The docs' claim that SQLite is rebuildable from Markdown already does not hold for them.

Activity

  1. chuiwenwei commented on Nov 7, 2026

    @chuiwenwei
    Contributor

    I'd like to take this. Before I start: should the session-delete hook from #483 be part of the same PR, or a follow-up? I'd implement the route-level JSONL log first (enabled / retention_days / max_inline_bytes, one line per accepted /add, outside .index), then wire deletion separately.

  2. gloryfromca commented on Nov 19, 2026

    @gloryfromca
    MemberAuthor

    @chuiwenwei Yes, please take it, and two PRs are fine. Since this issue was written, #483 was closed by #555 (POST /api/v2/memory/delete) and #594 added online purge, so the deletion side now belongs to this issue rather than #483.

    So that the first PR doesn't leave deleted conversations on disk:

    1. First PR: the route-level log as proposed, with enabled = false by default. Everything else stays as in the description: one line per accepted /add, written before the sync/async split, outside .index/, with the retention sweep and max_inline_bytes, and a failed write never fails /add. Please base it on current main (1.7.0+); the code has moved a lot since this was filed.
    2. Second PR: deletion. A /memory/delete that covers a session removes that session's lines, and purge (feat(purge): online purge of a memory root, app or project #594) removes .input_log/ for the purged scope. The default can go back to enabled = true in that PR.

    Reading the log through the API stays out of scope.

  3. chuiwenwei commented on Nov 19, 2026

    @chuiwenwei
    Contributor

    Opened #611 for the first PR (log only, enabled = false). The second PR will wire session delete + purge and flip the default.

  4. gloryfromca commented on Nov 23, 2026

    @gloryfromca
    MemberAuthor

    Done: #611 added the /add input log, #617 removes a session's lines on /memory/delete and a purged scope's .input_log/, and turned the log on by default.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

enhancementNew feature or request

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions