Skip to content
Agent Memory
Command

/export

Export memories to CLAUDE.md

BOOST
From plugin
nemp
13924 skills24 commands
Install
> /plugin marketplace add SukinShetty/Nemp-memory
> /plugin install nemp@nemp-memory

How it fires

How this command gets triggered: by you, by Claude, or both.

  • Fires itselfClaude auto-loads it when your prompt matches the work.
  • You can call itInvoke it directly when you want it.
  • Slash command/export

Context preview

What this command does when you run it.

Export memories to CLAUDE.md

Command definition

export.md
description: "Export memories to CLAUDE.md"
argument-hint: "[--replace]"

/nemp:export

Export all project memories to `CLAUDE.md`. Use `--replace` to overwrite the entire file, or run without flags to append/update the Nemp section only.

Usage

/nemp:export           # Append or update Nemp section in CLAUDE.md
/nemp:export --replace # Replace entire CLAUDE.md with Nemp content only

Arguments

  • (no args): Append or update the Nemp section in `CLAUDE.md`
  • `--replace`: Replace the entire `CLAUDE.md` instead of appending/updating

Instructions

When the user invokes `/nemp:export`, follow these steps:

Step 1: Parse Arguments

Identify which flag (if any) the user provided:

(no args)    → Export to CLAUDE.md (append/update)
--replace    → Export to CLAUDE.md (full replace)

If the argument is unrecognised, display the Usage block above and stop.

---

Memory Loading (shared by all export paths)

Before generating any export file, perform these steps to load and prepare memories.

Step 2: Read memories.json

Read `.nemp/memories.json`:

[ -f ".nemp/memories.json" ] && cat .nemp/memories.json

If the file does not exist, stop and show:

❌ No memories to export.

Save some memories first:
  /nemp:save stack Next.js 15 with TypeScript
  /nemp:init  (auto-detect project stack)

Step 3: Parse Format (with Backward Compatibility)

The file may use either format:

**New array format:**

{
  "memories": [
    {
      "key": "version",
      "value": "0.3.0",
      "created": "2026-02-26T16:00:00.000Z",
      "updated": "2026-02-26T16:00:00.000Z",
      "tags": ["auto-detected"],
      "type": "fact",
      "vitality": { "state": "active" }
    }
  ]
}

**Legacy flat-object format:**

{
  "stack": { "value": "Next.js", "created": "...", "updated": "..." },
  "auth":  { "value": "NextAuth", "created": "...", "updated": "..." }
}

If the parsed JSON does not have a `memories` array, treat each top-level key as a memory entry with:

key      = the JSON key name
value    = entry.value
created  = entry.created
updated  = entry.updated
type     = entry.type (if present, else undefined)
vitality = entry.vitality (if present, else undefined)

Step 4: Filter Out Extinct Memories

Skip any memory where `vitality.state === "extinct"`. Absent `vitality` means the memory is active — do not skip it.

If `memories.json` cannot be parsed as valid JSON, stop and report:

❌ memories.json is not valid JSON. Check the file for syntax errors.

---

/nemp:export (no args) and /nemp:export --replace

Step 5a: Parse and Organize Memories for CLAUDE.md

Group memories by semantic key names:

  • **Tech Stack**: keys containing `stack`, `framework`, `database`, `auth`, `styling`, `orm`, `testing`, `deployment`
  • **Project Info**: keys containing `project`, `description`, `name`, `structure`, `version`, `type`, `subproject`
  • **Global Preferences**: keys containing `prefer`, `style`, `convention`, `no-`, `favorite`, `team`, `workspace`
  • **Other**: everything else

Step 6a: Generate CLAUDE.md Section Content

Create a clean, professional markdown section.

Use the **table format** for short values (< 80 chars):

## Project Context (via Nemp Memory)

> Auto-generated by Nemp Memory. Last updated: [YYYY-MM-DD HH:MM]

### Tech Stack

| Key | Value |
|-----|-------|
| **stack** | Next.js 15, TypeScript, Prisma, PostgreSQL |
| **auth** | NextAuth with JWT |

---

Use the **prose format** for longer values:

**project-description:** A SaaS starter kit for building subscription-based applications.

**structure:**
- Commands defined in /commands/*.md
- Plugin config in .claude-plugin/

Use the table format for short values (< 80 chars) and the prose format for longer values. Emit a section heading (`### Tech Stack`, etc.) only for groups that have at least one memory.

Step 7a: Check for Existing CLAUDE.md

[ -f "CLAUDE.md" ] && cat CLAUDE.md

Step 8a: Handle CLAUDE.md Updates

**If `--replace` flag:** Write the Nemp section as the entire CLAUDE.md, replacing all existing content.

**If no flag (append/update mode):**

  • **CLAUDE.md does not exist:** Create a new file with just the Nemp section.
  • **CLAUDE.md exists with a Nemp section:** Find `## Project Context (via Nemp Memory)`, find where the section ends (next `## ` heading, a line containing only `---`, or end of file), and replace only that section. Preserve all other content.
  • **CLAUDE.md exists without a Nemp section:** Append the Nemp section at the end with a blank line before it for clean separation.

Step 9a: Write CLAUDE.md

Use the Write tool to save the updated content.

Step 10a: Confirm to User

✅ Exported to CLAUDE.md

   Memories exported: 5
   File: ./CLAUDE.md

   Exported keys:
   • stack
   • auth
   • styling
   • database
   • project-description

💡 CLAUDE.md is automatically read by Claude Code at session start.

---

Example

User: `/nemp:export`

Given `.nemp/memories.json` with 2 memories:

{
  "stack": { "value": "Next.js 15 with TypeScript, Prisma, PostgreSQL", "created": "2024-01-20T10:00:00Z", "updated": "2024-01-20T10:00:00Z" },
  "auth":  { "value": "NextAuth with JWT", "created": "2024-01-20T10:00:00Z", "updated": "2024-01-20T10:00:00Z" }
}

Creates/updates CLAUDE.md:

## Project Context (via Nemp Memory)

> Auto-generated by Nemp Memory. Last updated: 2024-01-20 10:00

**stack:** Next.js 15 with TypeScript, Prisma, PostgreSQL

**auth:** NextAuth with JWT

---

Response:

✅ Exported to CLAUDE.md

   Memories exported: 2
   File: ./CLAUDE.md

   Exported keys:
   • stack
   • auth

💡 CLAUDE.md is automatically read by Claude Code at session start.

---

Section Detection Logic (CLAUDE.md update)

To find and replace an existing Nemp section:

1. Search for the line: `## Project Context (via Nemp Memory)` 2. Find where t

Read more
Ships withnemp

Nemp - The memory plugin for Claude Code that remembers everything.

Get the whole plugin
Stats
139
Stars
34
Forks
Active
Maintenance
Python
Language
MIT
License
20d ago
Last commit
8mo ago
Created
2h ago
Added

Repo: SukinShetty/Nemp-memory

Other commands on nemp.