Skip to main content

Module memory_import

Module memory_import 

Source
Expand description

ultron memory import --from claude-code|codex: the notes other harnesses keep on disk become typed memory records (crate::memory_records), stored through memory.propose with the user’s evidence, so the same secret check refuses what holds a secret. Which files are read follows Mirror (memory/import/*.rs):

  • Claude Code: every <config>/projects/<encoded project>/memory/ directory (<config> is CLAUDE_CONFIG_DIR, else ~/.claude): one note per Markdown file, MEMORY.md (the index), dotfiles, symlinks and old/ left out. YAML frontmatter name gives the key, description the situation and metadata.type (or type) the record type: feedback → preference, user/project → fact, else reference. A project directory whose encoded name maps back to exactly one existing directory makes its notes project records of that directory; otherwise they are global.
  • Codex: <codex home>/memories/ (CODEX_HOME, else ~/.codex): memory_summary.md (User Profile → fact, User preferences → preference, General Tips → procedure) and MEMORY.md (per task group: User preferences, Reusable knowledge → fact, Failures and how to do differently → pitfall; [Task n] tags name the situation). Bullets are the unit. All global.

Every record is tagged with its source file (source: harness and home-relative path). Keys are the note’s slug plus a hash of what identifies it in its source (the file for Claude Code, file and text for Codex), so a rerun finds the same keys: a record whose key is already indexed with the same text and fields is unchanged, one with other text is replaced. Notes over their type’s cap, or holding a secret, are refused.

Structs§

Note
One note as a reader produced it.
Planned
One planned record.
Source
One directory of notes.

Enums§

Action
What an import does with one note.
Harness
Imported
What became of one planned note.

Functions§

claude_code_notes
Every note under a Claude Code memory directory, in path order.
codex_notes
Notes of a Codex memories directory: memory_summary.md, then MEMORY.md.
discover
The note directories of harness under root (notes_root), in path order.
home_relative
path with the home directory written as ~.
import_all
Import every planned note: one memory service per scope group, over the one import journal (each loads what the previous one wrote). each hears every note’s outcome, in order.
import_one
Store one planned record (an Add or Replace) through service: the written operation, or why not.
notes_root
Where a harness keeps its notes, given the injected environment.
plan
The plan for sources: every note with its key, scope and action against index.
project_path
The checkout a Claude Code project directory stands for, when its encoded name (-home-me-src-repo) maps back to exactly one existing directory (a - is a separator or a literal hyphen).
propose_payload
The memory.propose payload of a planned record: the user’s own notes, with the source file as evidence.
slug_key
A kebab-case key of at most 60 bytes from free text (Mirror slug_key).

Type Aliases§

BackendFor
The memory backend of one scope group (None: global notes; Some: a project’s).
ScopeTags
The identity tags a record of scope gets (as a session in project would tag it; hindsight worker_scope_tags): computed by the caller, which knows the server’s tagging.