Skip to main content

Memory Ingest

Claude Code maintains its own auto-memory — markdown it distills for itself — under:
<encoded-cwd> is the repo’s absolute path with every character other than a letter or digit replaced by - (e.g. /home/you/code/my_app → -home-you-code-my-app). Claude Code cuts a name longer than 200 characters to 200 and ends it with a short hash. claude-mem memory ingest imports those topic files directly into your memory database as observations.

Why it doesn’t cost anything

Auto-memory is already distilled — each topic file is the same kind of artifact the observation generator produces. So memory-ingest does not run the Haiku generation pipeline. It stores each file’s prose directly through claude-mem’s existing observation seam (content-hash dedup + Chroma sync). Re-running generation on already-distilled prose would be lossy and pay for negative value. The MEMORY.md index is skipped — it’s just links and carries no knowledge of its own.

Usage

Always dry-run first — it’s a zero-spend, DB-free scan + count:
Then run the real ingest:

Flags

How it runs

  • --dry-run is pure parse + count — it runs entirely in the CLI process, touches no worker and no database, and spends nothing.
  • The real ingest stores into the SQLite observation database, which lives in the worker. The CLI starts the worker if needed and drives the import over HTTP (POST /api/memory/ingest), as summaries reach the worker. Bulk imports are not time-limited.
  • A file that cannot be read is reported as failed; the rest of the import carries on. A symlinked note is never followed and a note over 64 KB is not read; both are reported as skipped, each named with its reason. A note swapped for a symlink mid-scan is refused when opened and reported as failed. A source outside the projects directory, or one that does not exist, is a 400 from the worker.
  • Only the memory notes are imported. A sibling transcript is read for its cwd, to key the project like live capture does; its content is never ingested.

Frontmatter

Topic files carry a small YAML frontmatter block, which is preserved as observation metadata:
metadata.type (e.g. project, feedback, reference, user) and metadata.originSessionId are carried through; files without frontmatter are stored using their body as-is.

Idempotency

Ingest is safe to re-run. Observations are content-hash deduplicated on insert, so already-imported files are reported as already-imported and skipped — only new or changed files are stored. Changed prose is stored even when the file keeps the same title and CLAUDE_MEM_DEDUP_ENABLED=true. Native notes use exact content deduplication; the title-only merge for generated observations does not discard note revisions or distinct topic files sharing a title. Earlier revisions remain available. The summary line reports the outcome: