Skip to content
Agent Memory
Command

/forget

Delete a memory by key

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/forget

Context preview

What this command does when you run it.

Delete a memory by key

Command definition

forget.md
description: "Delete a memory by key"
argument-hint: "<key> [--force]"

/nemp:forget

Delete a memory by key.

Usage

/nemp:forget <key> /nemp:forget <key> --force # Skip confirmation

Arguments

  • `key`: The exact key of the memory to delete

Instructions

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

1. Find the Memory

Search for the memory in both storage locations:

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

# Check global memories
[ -f "$HOME/.nemp/memories.json" ] && cat $HOME/.nemp/memories.json

2. Handle Not Found

If no memory with that key exists: ❌ Memory not found: "<key>" Did you mean one of these?

auth-flow auth-config user-auth-prefs

Use /nemp:list to see all available keys.

3. Confirm Deletion (unless --force)

Show the memory content and ask for confirmation: ⚠️ Delete this memory? Key: <key> Value: "<full-value>" Agent: <agent_id who wrote it> Created: <date> Source: project/global Type 'yes' to confirm, or 'no' to cancel.

Use the AskUserQuestion tool with options:

  • "Yes, delete it"
  • "No, keep it"

4. Perform Deletion

If confirmed: 1. Read the appropriate memories.json file 2. Filter out the memory with the matching key 3. Write the updated array back to the file

5. Log the Delete Operation

echo "[$(date -u +%Y-%m-%dT%H:%M:%SZ)] DELETE key=<key> agent=${CLAUDE_AGENT_NAME:-main}" >> .nemp/access.log

6. Check Auto-Sync Config (REQUIRED)

**IMPORTANT: This step is MANDATORY. Always check and execute auto-sync if enabled.**

After deleting the memory, read the config file:

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

If `.nemp/config.json` exists and contains `"autoSync": true`:

**6a. Read all remaining memories** from `.nemp/memories.json`

**6b. Group memories by category** using these rules:

  • Keys containing "project", "workspace" → "Project Info"
  • Keys containing "stack", "storage", "structure" → "Technical Details"
  • Keys containing "feature", "command" → "Features"
  • All other keys → "Other"

**6c. Generate CLAUDE.md content:**

## Project Context (via Nemp Memory)

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

### [Category Name]

| Key | Value |
|-----|-------|
| **key-name** | value content |

---

**6d. Update CLAUDE.md:**

  • If CLAUDE.md exists with `## Project Context (via Nemp Memory)`: Replace everything from that heading to the next `---` (inclusive)
  • If no memories remain: Remove the Nemp section entirely or leave a minimal placeholder

**6e. Set `syncPerformed = true`** for the confirmation message

7. Update MEMORY.md Index

Regenerate `.nemp/MEMORY.md` with the remaining memories (same format as init.md Step 7).

8. Confirm to User

✓ Memory deleted: <key> Remaining memories: N ✓ MEMORY.md updated ✓ CLAUDE.md synced ← only if auto-sync enabled

**If auto-sync is disabled or config doesn't exist:** Do not update CLAUDE.md, do not show the sync note.

7. Handle Multiple Matches

If the same key exists in BOTH project and global storage (rare): ⚠️ Found "<key>" in multiple locations:

Project (.nemp/memories.json) Value: "<value>" Global (~/.nemp/memories.json) Value: "<value>"

Which would you like to delete?

Use AskUserQuestion with options:

  • "Delete from project only"
  • "Delete from global only"
  • "Delete from both"
  • "Cancel"

Error Handling

  • If key is missing: Ask user to provide a key
  • If file read/write fails: Report error with details
  • If user cancels: Acknowledge and do nothing

Example

User: `/nemp:forget old-api-endpoint` ⚠️ Delete this memory? Key: old-api-endpoint Value: "The legacy API was at api.example.com/v1" Created: 2024-01-05T08:00:00Z Source: project (.nemp/memories.json)

User confirms → Memory deleted: old-api-endpoint Remaining memories: 4 CLAUDE.md updated <-- only if auto-sync is enabled

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.