Your agent needs a personal wiki — here's how to build memory that survives restarts
Your agent forgets everything the moment its session ends. You've taught it your preferences, your project context, your team dynamics — then you restart it and you're back to square one.
Most people try to solve this with system prompts or context files. That's like trying to fit an encyclopedia into a Post-it note. Your agent needs persistent memory that builds over time, not context that gets crammed in fresh every session.
Here's the pattern that actually works: give your agent a personal wiki.
The Three-File Memory System
Your agent needs three persistent files that it can read and write:
memory/facts.md— Concrete information about you, your business, your preferencesmemory/patterns.md— Behavioral patterns it's learned about how you workmemory/context.md— Current project context and ongoing work
Here's what goes in each file:
Facts.md structure:
# Personal Facts - Timezone: PST - Prefers Python over JavaScript - Uses VS Code with Vim bindings - Company: TechCorp (50 employees) - Role: Engineering Manager # Project Facts - Main codebase: React + Node.js - Deploy via GitHub Actions - Database: PostgreSQL on AWS RDS - Staging environment: staging.techcorp.com
Patterns.md structure:
# Communication Patterns - Likes detailed explanations for complex topics - Wants code examples, not just theory - Prefers bullet points over paragraphs # Work Patterns - Reviews code in the morning (9-11am) - Batch processes emails at 2pm - Prefers async communication over meetings
Context.md gets updated every session:
# Current Focus (Updated: 2024-12-19) - Refactoring user authentication system - Deadline: End of sprint (Dec 22) - Blocked on: Database migration approval - Next: Write migration scripts # Recent Decisions - Chose JWT over sessions (Dec 18) - Will use bcrypt for password hashing - Migration will run during maintenance window
The Memory Update Protocol
Your agent needs rules for when and how to update these files:
Memory Rule: At the end of every meaningful interaction, update the relevant memory file. New facts go in facts.md, new behavioral insights go in patterns.md, project updates go in context.md.
Give your agent this instruction:
Before ending our session, review what you learned: - Did I share new facts about myself or my work? Update facts.md - Did you notice new patterns in how I communicate or work? Update patterns.md - Did we make progress on current projects? Update context.md Always read these files at the start of new sessions.
Why This Works Better Than Context Injection
Context files are static. Memory files are living documents that improve over time. After a month, your agent knows that you prefer code reviews in the morning, that your team uses specific terminology, and that you're working toward quarterly goals it remembers from three weeks ago.
The files stay small because they contain distilled knowledge, not conversation transcripts. Your agent learns "prefers detailed technical explanations" instead of storing every time you asked for more detail.
Implementation Notes
Create a memory/ directory in your agent's working directory. Give it read/write access. Start with empty files — your agent will populate them as it learns.
Most importantly: these files live outside your agent's session. They survive restarts, updates, even switching between different agent implementations. Your memory investment compounds.
This turns your agent from a goldfish into an elephant. It remembers not just what you told it, but what it learned about you.