Active working memory that survives compaction. Write-Ahead Log protocol.
# SESSION-STATE.md — Active Working Memory## Current Task
[What we're working on RIGHT NOW]
## Key Context- User preference: ...
- Decision made: ...
- Blocker: ...
## Pending Actions- [ ] ...
Rule: Write BEFORE responding. Triggered by user input, not agent memory.
Layer 2: WARM STORE (LanceDB Vectors)
From: lancedb-memory
Semantic search across all memories. Auto-recall injects relevant context.
# Auto-recall (happens automatically)
memory_recall query="project status"limit=5
# Manual store
memory_store text="User prefers dark mode" category="preference" importance=0.9
Layer 3: COLD STORE (Git-Notes Knowledge Graph)
From: git-notes-memory
Structured decisions, learnings, and context. Branch-aware.
# Store a decision (SILENT - never announce)
python3 memory.py -p $DIR remember '{"type":"decision","content":"Use React for frontend"}' -t tech -i h
# Retrieve context
python3 memory.py -p $DIR get "frontend"
cd ~/clawd
git init # if not already
python3 skills/git-notes-memory/memory.py -p . sync --start
4. Verify MEMORY.md Structure
# Ensure you have:# - MEMORY.md in workspace root# - memory/ folder for daily logsmkdir -p memory
5. (Optional) Setup SuperMemory
export SUPERMEMORY_API_KEY="your-key"# Add to ~/.zshrc for persistence
Agent Instructions
On Session Start
Read SESSION-STATE.md — this is your hot context
Run memory_search for relevant prior context
Check memory/YYYY-MM-DD.md for recent activity
During Conversation
User gives concrete detail? → Write to SESSION-STATE.md BEFORE responding
Important decision made? → Store in Git-Notes (SILENTLY)
Preference expressed? → memory_store with importance=0.9
On Session End
Update SESSION-STATE.md with final state
Move significant items to MEMORY.md if worth keeping long-term
Create/update daily log in memory/YYYY-MM-DD.md
Memory Hygiene (Weekly)
Review SESSION-STATE.md — archive completed tasks
Check LanceDB for junk: memory_recall query="*" limit=50
Clear irrelevant vectors: memory_forget id=<id>
Consolidate daily logs into MEMORY.md
The WAL Protocol (Critical)
Write-Ahead Log: Write state BEFORE responding, not after.
Trigger
Action
User states preference
Write to SESSION-STATE.md → then respond
User makes decision
Write to SESSION-STATE.md → then respond
User gives deadline
Write to SESSION-STATE.md → then respond
User corrects you
Write to SESSION-STATE.md → then respond
Why? If you respond first and crash/compact before saving, context is lost. WAL ensures durability.
Example Workflow
User: "Let's use Tailwind for this project, not vanilla CSS"
Agent (internal):
1. Write to SESSION-STATE.md: "Decision: Use Tailwind, not vanilla CSS"
2. Store in Git-Notes: decision about CSS framework
3. memory_store: "User prefers Tailwind over vanilla CSS" importance=0.9
4. THEN respond: "Got it — Tailwind it is..."