memory-export

A command that exports stored project memories into a Markdown or JSON file. Mnemosyne is the memory system it reads from.

In plain words
What is it for?
Use it to export memories for review, backup, or sharing, choosing the project area, output filename, and file format.
Why use it?
It creates a reviewable or shareable copy of saved project context and can include one project area or all stored areas.

Command for Claude Code

Install

Getting it into your agent

One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.

agentmods
npx agentmods add commands/rand/mnemosyne/memory-export
Clone the repo
git clone --depth 1 https://github.com/rand/mnemosyne

Made for: Claude Code.

Per session 11 Only the description is in the session, so the agent can decide to use it. The body loads when it is invoked.
When invoked 1,026 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. Scan, not verified.
Origin original No closer match found in the catalogue.
Token cost

What it costs to keep this loaded

Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.

ModelPer sessionOnce invoked
Fable 5 $0.00011 $0.01026
Opus 5 $0.00005 $0.00513
Sonnet 5 $0.00002 $0.00205
Haiku 4.5 $0.00001 $0.00103

Measured 2d ago against content hash 9ee273645b87, method: parsed. Prices are Anthropic first-party input rates as of 2026-08-30, from the pricing page.

Security

Grade A, and why

memory-export scanned grade A with 0 findings against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured 2d ago.

A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.

Nothing flagged

None of the 26 patterns this scan looks for appear in this file: no shell pipes, no recursive deletes, no credential paths, no hidden text, no instruction-override or anti-refusal phrasing, no agent-config snooping. That is not a guarantee, it is the absence of the things that are checkable.

.claude/commands/memory-export.md · 143 lines

What it actually says

I will export memories from Mnemosyne to a markdown file for review, backup, or sharing.

Usage:

  • /memory-export - Export current project to memories-.md
  • /memory-export --namespace <ns> - Export specific namespace
  • /memory-export --output <file> - Export to custom file
  • /memory-export --format <markdown|json> - Export format (default: markdown)
  • /memory-export --all - Export all namespaces

Instructions for me:

  1. Parse the arguments:

    • Extract --namespace flag if present (otherwise auto-detect)
    • Extract --output flag if present
    • Extract --format flag if present (default: "markdown")
    • Extract --all flag if present (exports all namespaces)
  2. Determine namespace:

    • If --all flag: set namespace to null (all)
    • If --namespace specified: use that
    • Otherwise auto-detect from git root + CLAUDE.md
  3. Fetch memories using MCP:

    {
      "name": "mnemosyne.list",
      "arguments": {
        "namespace": "<namespace or null>",
        "limit": 1000,
        "sort_by": "importance"
      }
    }
    
  4. Determine output filename:

    • If --output specified: use that
    • Otherwise: memories-<project-name>-<date>.md
    • Example: memories-ecommerce-2025-10-26.md
  5. Generate markdown content:

    # Memory Export - <Namespace>
    Generated: <date and time>
    Total Memories: <count>
    
    ## Table of Contents
    - [Architecture Decisions](#architecture-decisions) (<count>)
    - [Code Patterns](#code-patterns) (<count>)
    - [Bug Fixes](#bug-fixes) (<count>)
    - [Configurations](#configurations) (<count>)
    - [Constraints](#constraints) (<count>)
    - [Entities](#entities) (<count>)
    - [Insights](#insights) (<count>)
    - [References](#references) (<count>)
    - [Preferences](#preferences) (<count>)
    
    ---
    
    ## Architecture Decisions
    
    ### [<importance>/10] <summary>
    **ID**: `<memory_id>`
    **Date**: <created_at>
    **Tags**: <tags>
    **Context**: <context>
    
    <full content>
    
    **Related Files**:
    - <file>
    - <file>
    
    **Links**:
    - → <linked memory summary> (<link_type>, strength: <strength>)
    
    **Metadata**:
    - Importance: <importance>/10
    - Confidence: <confidence>
    - Access count: <access_count>
    - Last accessed: <last_accessed_at>
    
    ---
    
    <repeat for each memory, grouped by type>
    
  6. Generate JSON format (if --format json):

    {
      "export_date": "<ISO 8601>",
      "namespace": "<namespace>",
      "total_memories": <count>,
      "memories": [
        {
          "id": "<id>",
          "summary": "<summary>",
          "content": "<content>",
          "memory_type": "<type>",
          "importance": <importance>,
          ...full memory object...
        }
      ]
    }
    
  7. Write to file:

    • Use Write tool to create the file
    • Confirm to user: "✓ Exported memories to "
  8. Format the confirmation:

    ✓ Exported <count> memories to <filename>
    
    Breakdown by type:
    - Architecture Decisions: <count>
    - Code Patterns: <count>
    - Bug Fixes: <count>
    - Configurations: <count>
    - Constraints: <count>
    - Entities: <count>
    - Insights: <count>
    - References: <count>
    - Preferences: <count>
    
    File size: <size> KB
    Format: <markdown|json>
    
    You can now review, edit, or share this export file.
    To re-import (future feature): mnemosyne import <filename>
    
  9. Error handling:

    • If MCP server not available: "Error: Mnemosyne MCP server not running"
    • If no memories found: "No memories found for export"
    • If file write fails: "Error: Could not write to : "

Please export the memories with the provided options.

Changes

What this file has done since we first saw it

Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.

  1. 2d ago First seen · 143 lines · 11 tokens per session scan A 9ee273645b87

Subscribe to this mod's changes

memory-export is a command published in the GitHub repository rand/mnemosyne (84 stars, last pushed 9mo ago), licensed MIT. It adds 11 tokens to every session and 1,026 once invoked, about $0.0001 per session on Opus 5. A static security scan graded it A with 0 findings. No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-30.

Related

Other commands, from other repositories