Skip to content

Commit 596ba15

Browse files
author
Sukin Shetty
committed
feat: v0.2.0 - agent tracking, access logs, token optimization, MEMORY.md
- Agent ID on every write (tracks which agent wrote each memory) - Read/write/delete access logs in .nemp/access.log - New /nemp:log command for audit trail - Token compression (~70% smaller stored values) - /nemp:init optimized: single scan, single write - Auto-generated MEMORY.md index file - Backward compatible with v0.1.0
1 parent 87ba5ee commit 596ba15

File tree

6 files changed

+349
-358
lines changed

6 files changed

+349
-358
lines changed

commands/forget.md

Lines changed: 38 additions & 48 deletions
Original file line numberDiff line numberDiff line change
@@ -8,10 +8,8 @@ argument-hint: "<key> [--force]"
88
Delete a memory by key.
99

1010
## Usage
11-
```
1211
/nemp:forget <key>
1312
/nemp:forget <key> --force # Skip confirmation
14-
```
1513

1614
## Arguments
1715
- `key`: The exact key of the memory to delete
@@ -23,7 +21,6 @@ When the user invokes `/nemp:forget`, follow these steps:
2321
### 1. Find the Memory
2422

2523
Search for the memory in both storage locations:
26-
2724
```bash
2825
# Check project memories
2926
[ -f ".nemp/memories.json" ] && cat .nemp/memories.json
@@ -35,30 +32,25 @@ Search for the memory in both storage locations:
3532
### 2. Handle Not Found
3633

3734
If no memory with that key exists:
38-
```
3935
❌ Memory not found: "<key>"
40-
4136
Did you mean one of these?
42-
- auth-flow
43-
- auth-config
44-
- user-auth-prefs
4537

46-
Use `/nemp:list` to see all available keys.
47-
```
38+
auth-flow
39+
auth-config
40+
user-auth-prefs
41+
42+
Use /nemp:list to see all available keys.
4843

4944
### 3. Confirm Deletion (unless --force)
5045

5146
Show the memory content and ask for confirmation:
52-
```
5347
⚠️ Delete this memory?
54-
55-
Key: <key>
56-
Value: "<full-value>"
57-
Created: <date>
58-
Source: project/global
59-
48+
Key: <key>
49+
Value: "<full-value>"
50+
Agent: <agent_id who wrote it>
51+
Created: <date>
52+
Source: project/global
6053
Type 'yes' to confirm, or 'no' to cancel.
61-
```
6254

6355
Use the AskUserQuestion tool with options:
6456
- "Yes, delete it"
@@ -71,7 +63,12 @@ If confirmed:
7163
2. Filter out the memory with the matching key
7264
3. Write the updated array back to the file
7365

74-
### 5. Check Auto-Sync Config (REQUIRED)
66+
### 5. Log the Delete Operation
67+
```bash
68+
echo "[$(date -u +%Y-%m-%dT%H:%M:%SZ)] DELETE key=<key> agent=${CLAUDE_AGENT_NAME:-main}" >> .nemp/access.log
69+
```
70+
71+
### 6. Check Auto-Sync Config (REQUIRED)
7572

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

@@ -82,15 +79,15 @@ After deleting the memory, read the config file:
8279

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

85-
**5a. Read all remaining memories** from `.nemp/memories.json`
82+
**6a. Read all remaining memories** from `.nemp/memories.json`
8683

87-
**5b. Group memories by category** using these rules:
84+
**6b. Group memories by category** using these rules:
8885
- Keys containing "project", "workspace" → "Project Info"
8986
- Keys containing "stack", "storage", "structure" → "Technical Details"
9087
- Keys containing "feature", "command" → "Features"
9188
- All other keys → "Other"
9289

93-
**5c. Generate CLAUDE.md content:**
90+
**6c. Generate CLAUDE.md content:**
9491
```markdown
9592
## Project Context (via Nemp Memory)
9693

@@ -105,36 +102,35 @@ If `.nemp/config.json` exists and contains `"autoSync": true`:
105102
---
106103
```
107104

108-
**5d. Update CLAUDE.md:**
105+
**6d. Update CLAUDE.md:**
109106
- If CLAUDE.md exists with `## Project Context (via Nemp Memory)`: Replace everything from that heading to the next `---` (inclusive)
110107
- If no memories remain: Remove the Nemp section entirely or leave a minimal placeholder
111108

112-
**5e. Set `syncPerformed = true`** for the confirmation message
109+
**6e. Set `syncPerformed = true`** for the confirmation message
113110

114-
### 6. Confirm to User
111+
### 7. Update MEMORY.md Index
115112

116-
```
113+
Regenerate `.nemp/MEMORY.md` with the remaining memories (same format as init.md Step 7).
114+
115+
### 8. Confirm to User
117116
✓ Memory deleted: <key>
118-
Remaining memories: N
119-
✓ CLAUDE.md synced <-- only show if syncPerformed is true
120-
```
117+
Remaining memories: N
118+
✓ MEMORY.md updated
119+
✓ CLAUDE.md synced ← only if auto-sync enabled
121120

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

124123
### 7. Handle Multiple Matches
125124

126125
If the same key exists in BOTH project and global storage (rare):
127-
```
128126
⚠️ Found "<key>" in multiple locations:
129127

130-
1. Project (.nemp/memories.json)
131-
Value: "<value>"
132-
133-
2. Global (~/.nemp/memories.json)
134-
Value: "<value>"
128+
Project (.nemp/memories.json)
129+
Value: "<value>"
130+
Global (~/.nemp/memories.json)
131+
Value: "<value>"
135132

136133
Which would you like to delete?
137-
```
138134

139135
Use AskUserQuestion with options:
140136
- "Delete from project only"
@@ -150,19 +146,13 @@ Use AskUserQuestion with options:
150146
## Example
151147

152148
User: `/nemp:forget old-api-endpoint`
153-
154-
```
155149
⚠️ Delete this memory?
156-
157-
Key: old-api-endpoint
158-
Value: "The legacy API was at api.example.com/v1"
159-
Created: 2024-01-05T08:00:00Z
160-
Source: project (.nemp/memories.json)
161-
```
150+
Key: old-api-endpoint
151+
Value: "The legacy API was at api.example.com/v1"
152+
Created: 2024-01-05T08:00:00Z
153+
Source: project (.nemp/memories.json)
162154

163155
User confirms →
164-
```
165156
Memory deleted: old-api-endpoint
166-
Remaining memories: 4
167-
CLAUDE.md updated <-- only if auto-sync is enabled
168-
```
157+
Remaining memories: 4
158+
CLAUDE.md updated <-- only if auto-sync is enabled

0 commit comments

Comments
 (0)