Memory Manager
Goal
Maintain persistent context across all sessions through a three-layer memory system.
Memory Layers
Layer 1: Daily Notes
Location: memory/daily/YYYY-MM-DD.md
Purpose: Raw session logs and interaction history
Update: After each significant interaction
Layer 2: Long-Term Memory
Location: memory/MEMORY.md
Purpose: Curated knowledge, preferences, decisions
Update: When learning important context
Layer 3: Semantic Index (Optional)
Location: memory/embeddings/
Purpose: Vector search for conceptual retrieval
Update: Periodically index memory content
Process
Writing to Daily Notes
After significant interactions, append:
## HH:MM - [Session Type] **User:** [Request summary] **Agent:** [Action taken] ### Details - Key decisions made - Files modified - Outcomes achieved ### Follow-up - Pending items - Questions to revisit
Updating Long-Term Memory
When learning important context:
## [Category] ### [Topic] - Key fact or preference - Supporting details - Date learned: YYYY-MM-DD
Categories to maintain:
- •User Preferences: Communication style, tool preferences, work patterns
- •Project Context: Tech stack, architecture decisions, key files
- •Important Decisions: What was decided and why
- •Learned Patterns: Shortcuts, conventions, recurring needs
Memory Retrieval
Before responding to any request:
- •Check if MEMORY.md has relevant context
- •Scan recent daily notes (today, yesterday)
- •For complex queries, search semantically if available
Memory Consolidation
Periodically (or when daily notes grow large):
- •Review recent daily notes
- •Extract patterns and important facts
- •Update MEMORY.md with distilled knowledge
- •Archive old daily notes if needed
Memory Templates
Initial MEMORY.md
# Agent Memory *Last updated: YYYY-MM-DD* ## User Profile ### Preferences - [To be learned] ### Work Patterns - [To be learned] ## Current Context ### Active Project - **Name:** [Project name] - **Stack:** [Technologies] - **Status:** [Current phase] ### Key Files - [To be discovered] ## Important Decisions *Decisions will be logged as they're made* ## Learned Patterns *Patterns will be captured from interactions*
Daily Note Template
# YYYY-MM-DD ## Summary [Brief overview of the day's work] ## Sessions ### HH:MM - [Type] [Session details] ## Key Learnings - [What was learned] ## Pending Items - [ ] [Items to follow up]
Auto-Flush Protocol
When context window approaches 80% capacity:
- •Trigger flush before compaction
- •Extract key information from current context:
- •Decisions made
- •Preferences expressed
- •Important facts mentioned
- •Write to MEMORY.md
- •Log summary to daily notes
- •Allow compaction to proceed
Memory Hygiene
Do
- •Update memory after learning something important
- •Be specific and factual in entries
- •Include dates for time-sensitive information
- •Cross-reference related entries
Don't
- •Store sensitive credentials in memory files
- •Log every trivial interaction
- •Duplicate information across layers
- •Let memory become stale without review
Integration with Other Skills
With skill-creator
When a new skill is created, log to memory:
## Learned Patterns ### Skills Acquired - **[skill-name]** (YYYY-MM-DD): [what it does]
With heartbeat
During heartbeat checks, consult memory for:
- •User's active hours and preferences
- •Pending items that need attention
- •Context for proactive actions
Commands
- •"Remember this" - Explicitly save current context to MEMORY.md
- •"What do you know about X" - Retrieve from memory
- •"Update memory" - Trigger consolidation
- •"Show memory" - Display current MEMORY.md
References
- •See
AUTONOMOUS_BOOTUP_SPEC.mdfor architecture - •See
skill-creatorfor skill persistence - •See
heartbeat-managerfor scheduled memory tasks