nano-memory
Installation
SKILL.md
๐ง Memory Architecture
Each session is stateless. Your memory lives entirely within the local file system. You must rely on file operations to remember context, technical decisions, and history.
Core Memory Files
memory/YYYY-MM-DD.md(Daily Logs): Raw, chronological logs of what happened. Use this for daily tasks, scratchpad thinking, and immediate context.MEMORY.md(Long-Term Memory): Your curated, distilled knowledge base. Contains high-level project context, architecture decisions, technical setups, and important user preferences.
๐ ๏ธ Core Memory Operations
You have access to native file tools and standard OS commands. Use them strictly in these patterns to avoid data loss or hallucinations:
1. ๐ Search (OS-Specific Commands)
- When to use: ALWAYS use this before answering questions about past work, decisions, or dates to find where information is stored.
- Action: Detect your current Operating System and use the appropriate shell commands to search:
- Linux / macOS:
- Find files:
ls -la memory/ - Search content:
grep -rnI "your_keyword" memory/ MEMORY.md
- Find files:
- Windows (CMD / PowerShell):
- Find files:
dir memory\(CMD) orGet-ChildItem memory\(PowerShell) - Search content (CMD):
findstr /S /I /N "your_keyword" memory\* MEMORY.md - Search content (PowerShell):
Select-String -Pattern "your_keyword" -Path "memory\*", "MEMORY.md"
- Find files:
- Linux / macOS:
2. ๐ Read (Native read_file)
- When to use: After a successful search to get full context, OR crucially, before using the
edit_filetool. - Action: Use your native
read_filetool to load the exact state of a file. You must do this to understand its current structure and prevent accidental overwrites.
3. โ๏ธ Write (Native write_file)
- When to use: When creating new daily logs or saving entirely new files.
- Action: Use your native
write_filetool to save content. If your native tool supports an append mode, use that formemory/YYYY-MM-DD.md. Otherwise, make sure toread_filefirst, append the new text to the content in your context, and thenwrite_filethe whole chunk.
4. ๐ Edit (Native edit_file)
- When to use: When updating specific sections of
MEMORY.md. - CRITICAL RULE: NEVER guess the content. You MUST execute
read_filefirst to see the exact text or line numbers you are modifying. Then use your nativeedit_filetool to accurately replace or insert the updated information without destroying the surrounding context.
๐ฏ Proactive Recording - No "Mental Notes"!
- Memory is limited: "Mental notes" do not survive session restarts. If it is not written to a file, it does not exist.
- Record First, Answer Second: When you discover valuable information during a conversation, record it to the file system immediately, then answer the user.
- What to record proactively:
- Important conclusions, milestones, or raw thoughts reached today โก๏ธ append to
memory/YYYY-MM-DD.md. - Workflow preferences or long-term lessons learned โก๏ธ update the relevant section in
MEMORY.mdusingedit_file.
- Important conclusions, milestones, or raw thoughts reached today โก๏ธ append to
- Security & Privacy: Unless explicitly requested by the user, NEVER record sensitive information (passwords, tokens, personal medical/financial data).
๐ Memory Workflows (SOP)
Workflow A: Retrieving Memory
- Trigger: User asks about past context.
- Search: Run the appropriate search command for your OS (e.g.,
greporfindstr) to locate the keyword inmemory/orMEMORY.md. - Read: Run the native
read_filetool on the specific file found in step 2. - Respond: Answer the user accurately based only on the retrieved file contents.
Workflow B: Updating Long-Term Knowledge
- Trigger: You establish a new technical standard or learn a persistent user preference.
- Read: Run the native
read_filetool onMEMORY.mdto review its current structure and locate the target section. - Edit: Run the native
edit_filetool to seamlessly update or insert the new information intoMEMORY.md. - Respond: Continue the conversation, confirming the memory has been updated.
๐งน Memory Maintenance (During Heartbeats / Idle)
Periodically act like a human reviewing their journal:
- Check available logs using
lsordirand read recent ones usingread_file. - Identify significant events, finalized decisions, or insights worth keeping long-term.
- Update
MEMORY.mdwith these distilled learnings usingedit_file. - (Optional) Clear outdated info from
MEMORY.mdto keep your context clean.