forget
The `/nemp:forget` command deletes a stored memory from the Nemp memory system by its key name. Use this command to remove outdated or incorrect project context information, with optional force flag to skip confirmation prompts. The command searches both project-level and global memory stores, confirms deletion with the user unless overridden, logs the operation, and automatically syncs remaining memories to CLAUDE.md if auto-sync is enabled in the config.
mkdir -p ~/.claude/commands && curl -fsSL https://raw.githubusercontent.com/SukinShetty/Nemp-memory/HEAD/commands/forget.md -o ~/.claude/commands/forget.mdforget.md
# /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:
```bash
# 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
```bash
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:
```bash
[ -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:**
```markdown
## 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 enabledPersistent local memory for AI agents. Use when starting a new session, when the user mentions remembering something, when you need project context, when making architecture decisions, or when working with other agents on the same project.
Activate Nemp Pro with your license key
View captured activity log
Enable or disable automatic activity capture
Enable or disable automatic cross-provider memory export
Enable or disable automatic syncing to CLAUDE.md
Search memories by keyword and show relevant context
Nemp Cortex — memory intelligence layer (Pro)