Moving Memory In and Out

brain port converts memories between brain and the formats other memory systems read. Your memory should not be locked into one vendor, including this one.

brain port export --format claude-memory --out ./memory     # Claude Code memory files + MEMORY.md
brain port export --format markdown > memories.txt          # one dated line per memory
brain port export --format agentcore --out batches.json     # AgentCore BatchCreateMemoryRecords bodies
brain port export --format agent-memory --out ./records     # draft shared agent-memory records
 
brain port import --from claude-memory ./memory             # imports wait for review
brain port import --from markdown memories.txt --trust      # your own memory: store as yours
brain port import --from agentcore batches.json --dry-run   # show what would be written

Formats

FormatShapeUse with
claude-memoryOne Markdown file per memory (name, description, metadata.type frontmatter) plus a MEMORY.md indexClaude Code's file-based memory directory
markdown[YYYY-MM-DD] - <title>: <text>, one per lineClaude.ai's memory import (paste), or any notes app
agentcore{ "batches": [ { "records": [...] } ] }, at most 100 records per batchAWS Bedrock AgentCore Memory BatchCreateMemoryRecords, sent with your own credentials. Import also accepts the memoryRecordSummaries a list call returns.
agent-memoryOne Markdown file per memory with the spec / id / address / key / kind / written_by / lifecycle / attributes envelopeTools that read the shared record LoreKit proposed in November 2026. It is a draft, so this format can change.

What survives a round trip

Every target holds less than brain does. These are the fields that come back after brain → target → brain:

Fieldclaude-memorymarkdownagentcoreagent-memory
title✓✓✓✓
content✓single lineup to 16,000 chars✓
typemapped (many-to-one)—✓✓
tags———✓
validity window———✓
related, strength, pins————
date—as source noteas source noteas source note

Associations and recall history stay in brain, and so do validity windows for every format except agent-memory. A recorded date comes back in the memory's source and never as valid_from, because the date something was saved is not the date it became true.

The shared agent-memory record

agent-memory follows the record LoreKit proposed as a common format for agent memory. The proposal is a draft: its post calls the field names illustrative, and there is no spec document or test suite yet.

  • What the envelope has no field for (brain's type, origin, tags, validity window, id) is written under brain.* attributes, so brain reads its own export back in full.
  • A record from another tool imports with its key as the title and learning as the type unless kind is a brain type. A record's expires_at becomes the memory's valid_until.
  • written_by never decides trust. It is kept as a note in the memory's source; the import is external unless you pass --trust.
  • Attributes from other tools are not kept, and superseded memories are not exported.

The field-by-field mapping lists every field and where brain differs from the proposal.

Into Codex

Codex can import another agent's memory, and it reads the same files claude-memory writes. Its importer copies the Markdown files under ~/.claude/projects/<project>/memory/ into $CODEX_HOME/memories_v2/. Export to an empty directory, then copy the memory files into the Claude Code project you want Codex to associate them with:

brain port export --format claude-memory --out ./brain-export
mkdir -p ~/.claude/projects/<project>/memory
cp -n ./brain-export/*.md ~/.claude/projects/<project>/memory/   # -n: never replace a file already there

Then run /import in Codex and select memory. Three things to know:

  • Codex only picks up a project that also has a Claude Code session, because it takes the project's working directory from the session. A memory directory on its own is not detected.
  • The files arrive unchanged, so what Codex receives is exactly what the table above lists for claude-memory: title, content and a mapped type. Tags, dates and validity windows are not in the files.
  • In Codex 0.169 the importer is behind the external_agent_memory_import feature flag, which is off by default (codex features enable external_agent_memory_import).
warning

Do not point --out at a memory directory Claude Code already uses. The export writes its own MEMORY.md and replaces any file with the same name, so the existing index would be lost.

Safety

  • Export writes only what recall could show. Memories pending verification, consent-hidden sensitive memories and expired memories are left out. The output counts each kind it skipped.
  • Imports go through brain memorize. Origin policy, content lint, the authorization rule and quarantine all apply, exactly as for any other write.
  • Imports are external by default, so they wait in brain verify until you approve them. Pass --trust only for an export of your own memory: it stores the memories as origin: user.
info

Gemini and ChatGPT memory exports are not supported yet. Neither documents a stable export format. Their text can still come in through --from markdown.