Skip to main content

Module auto_memory

Module auto_memory 

Source
Expand description

Auto-memory import — parse Claude Code’s per-project memory directory into dev notes (F10).

Claude Code writes free-form notes to ~/.claude/projects/<project-slug>/memory/: an index file MEMORY.md plus one .md file per memory, each with ----delimited frontmatter and a markdown body. That channel is model-authored and project-level, not file-scoped — this module turns each memory file into a dev_note:* record, queryable via mem_get/mem_query but never injected into bootstrap and never gated behind mati review. It never writes back to the source directory.

Earlier versions of this importer (F10, cacc778) wrote gotcha:auto-memory-* candidates instead. That was the wrong record type: unconfirmed gotchas sit in the mati review queue, and confirming one makes it eligible for global bootstrap injection with no affected_files gate, which risked crowding out real gotchas under the bootstrap token budget. import_auto_memory now writes dev_note:* only; see crate::store::gotcha_ops::apply_gotcha_tombstone callers in cli::show::export for the one-time cleanup of stores that already ran the old importer.

The frontmatter shape below was read directly off this project’s own memory directory, not off any spec:

---
name: project-store-daemon-single-owner
description: "Store/daemon single-owner invariant: defect found ..."
metadata:
  node_type: memory
  type: project
  originSessionId: 95126fa6-3d8c-49e1-90de-ca652782c6d1
  modified: 2026-08-02T03:33:27.084Z
---

body markdown...

modified and originSessionId are sometimes absent (older memories predate those fields). Frontmatter is parsed by hand instead of pulling in a YAML crate — the shape is a handful of flat key: value lines plus one nested metadata: block, and the format is unversioned upstream, so unrecognized keys are ignored rather than rejected. A file this parser can’t make sense of is skipped, not dropped silently — see AutoMemoryImport::skipped_files.

Structs§

AutoMemoryImport
Result of importing a project’s auto-memory directory.

Functions§

auto_memory_dir
Locate ~/.claude/projects/<project-slug>/memory/ for a project root.
import_auto_memory
Parse every memory file in dir into a dev-note record.