Skip to main content
The memory skill provides a two-layer memory system for storing long-term facts and searchable event history.
This skill is always loaded into the agent’s context.

Structure

The memory system consists of two files:
  • memory/MEMORY.md - Long-term facts (preferences, project context, relationships). Always loaded into context.
  • memory/HISTORY.md - Append-only event log. NOT loaded into context. Search it with grep. Each entry starts with [YYYY-MM-DD HH:MM].

Search Past Events

Use grep to search historical events:
grep -i "keyword" memory/HISTORY.md
Combine patterns:
grep -iE "meeting|deadline" memory/HISTORY.md
Use the exec tool to run grep commands.

When to Update MEMORY.md

Write important facts immediately using edit_file or write_file:

User Preferences

- I prefer dark mode
- I use Python 3.11
- I prefer concise explanations

Project Context

- The API uses OAuth2 authentication
- Database is PostgreSQL 14
- Frontend is React with TypeScript

Relationships

- Alice is the project lead
- Bob handles DevOps
- Charlie reviews all PRs

Auto-consolidation

Old conversations are automatically summarized and appended to HISTORY.md when the session grows large. Long-term facts are extracted to MEMORY.md. You don’t need to manage this process manually.

Examples

Storing a Preference

When a user says “I prefer tabs over spaces”:
  1. Add to memory/MEMORY.md:
    ## Code Style Preferences
    - Prefers tabs over spaces for indentation
    

Searching for Past Meetings

grep -i "meeting" memory/HISTORY.md

Finding Deadlines

grep -iE "deadline|due date" memory/HISTORY.md

Best Practices

  1. Be selective - Only store truly important facts in MEMORY.md
  2. Be specific - Include context with preferences (“Prefers TypeScript for new projects”)
  3. Use grep - Search HISTORY.md instead of loading it into context
  4. Update immediately - Write facts when they’re mentioned, not later

Build docs developers (and LLMs) love