A production-tested, five-layer memory architecture for building AI assistants with persistent identity and context
Created: September 2025 | Status: Production (4+ months) | Lead Time: 78 days ahead of Claude Skills
The Problem: AI assistants forget everything between sessions. Every conversation starts from scratch, requiring you to re-explain context, preferences, and established patterns.
Existing Solutions:
- ChatGPT Memory: Mixed, unorganized memories
- Claude Projects: Project-isolated, no cross-project core identity
- Claude Skills: Cloud-based, limited customization
This Solution: A local, file-based, five-layer memory architecture that gives your AI assistant:
- β Persistent core identity across all sessions
- β Clear separation between identity, skills, and projects
- β Complete transparency and control (local files, Git-tracked)
- β Cross-project shared core with project-specific context
- β Production-validated (4+ months of real use)
βββββββββββββββββββββββββββββββββββββββββββββββββββββββ
β L1: Core Identity (WHO the AI is) β
β ββ identity.md - Role and purpose β
β ββ values.md - Guiding principles β
β ββ principles.md - Behavioral guidelines β
β [Auto-loaded every session] β
βββββββββββββββββββββββββββββββββββββββββββββββββββββββ
β
βββββββββββββββββββββββββββββββββββββββββββββββββββββββ
β L2: User Profile (WHO you are) β
β ββ profile.md - Your preferences and context β
β [Auto-loaded every session] β
βββββββββββββββββββββββββββββββββββββββββββββββββββββββ
β
βββββββββββββββββββββββββββββββββββββββββββββββββββββββ
β L3: Method Library (HOW to do things) β
β ββ code-review.md β
β ββ debugging-process.md β
β ββ [Your reusable methods] β
β [Load on-demand when needed] β
βββββββββββββββββββββββββββββββββββββββββββββββββββββββ
β
βββββββββββββββββββββββββββββββββββββββββββββββββββββββ
β L4: Project Memory (WHAT you're working on) β
β ββ ProjectA/ β
β ββ ProjectB/ β
β ββ [Project-specific context] β
β [Load on-demand per project] β
βββββββββββββββββββββββββββββββββββββββββββββββββββββββ
β
βββββββββββββββββββββββββββββββββββββββββββββββββββββββ
β L5: Activity Logs (Historical record) β
β ββ 2026-01/ β
β ββ [Important decisions and discussions] β
β [Reference when needed] β
βββββββββββββββββββββββββββββββββββββββββββββββββββββββ
- Separation of Concerns: Clear boundaries between identity, skills, projects, and history
- Persistence Hierarchy: Core (L1) rarely changes, projects (L4) are temporary
- Local-First: All files on your machine, Git-tracked, fully transparent
- On-Demand Loading: Heavy context loaded only when needed
- Cross-Project Core: L1/L2 shared globally, L4 project-specific
- Claude Code (Desktop CLI app)
- Git (for version control)
- Basic command line familiarity
-
Clone this repository:
git clone https://github.com/[your-username]/claude-memory-system.git cd claude-memory-system -
Choose your memory storage location:
# Recommended: Dedicated memory folder mkdir -p ~/Documents/AI_Memory_Core # Copy templates cp -r templates/* ~/Documents/AI_Memory_Core/
-
Configure paths:
# Copy template to Claude Code config cp templates/CLAUDE.md.template ~/.claude/CLAUDE.md # Edit paths to match your location # Change /path/to/your/Memory_Core/ to ~/Documents/AI_Memory_Core/ nano ~/.claude/CLAUDE.md
-
Customize your core identity:
# Edit L1 files to match your needs nano ~/Documents/AI_Memory_Core/L1-Core/identity.md nano ~/Documents/AI_Memory_Core/L1-Core/values.md nano ~/Documents/AI_Memory_Core/L1-Core/principles.md # Fill in your profile nano ~/Documents/AI_Memory_Core/L2-User/profile.md
-
Test it:
# Start Claude Code claude # In the conversation, ask: # "What is your core identity?" # "What are your guiding values?"
Purpose: Define the fundamental "who" of your AI assistant
Files:
identity.md: Role, purpose, core characteristicsvalues.md: Guiding principles and prioritiesprinciples.md: Specific behavioral guidelines
When to edit:
- Initial setup
- Major changes in how you want the AI to behave
- Rarely after that (core identity should be stable)
Example:
# identity.md
I am an AI assistant specialized in full-stack development.
I prioritize clean architecture, security, and maintainability.Purpose: Store information about you and your preferences
Files:
profile.md: Your role, skills, preferences, working style
When to edit:
- When your preferences change
- When you learn new technologies
- When your work focus shifts
Example:
# profile.md
Name: Alex Chen
Role: Senior Backend Engineer
Preferred Languages: Go, Python
Coding Style: Prefer explicit over cleverPurpose: Store reusable approaches and best practices
How to use:
You: "Load the code review method from L3"
AI: [Reads L3-Methods/code-review.md]
"I've loaded the code review checklist. Ready to review your PR."
When to create:
- When you establish a process worth reusing
- When you solve a problem you'll face again
- When you want consistent approach across projects
Examples:
- Code review checklists
- Debugging workflows
- Architecture decision processes
- Deployment procedures
Purpose: Store project-specific context
Structure:
L4-Projects/
ββ ProjectAlpha/
β ββ architecture.md
β ββ conventions.md
β ββ tech-stack.md
ββ ProjectBeta/
ββ context.md
How to use:
You: "Load ProjectAlpha context from L4"
AI: [Reads all files in L4-Projects/ProjectAlpha/]
"Loaded: Using microservices architecture,
Node.js/TypeScript, PostgreSQL..."
When to use:
- At the start of work on a project
- When context switching between projects
- For project-specific conventions
Purpose: Historical record of decisions and important discussions
Structure:
L5-Logs/
ββ 2026-01/
β ββ 2026-01-15-auth-decision.md
β ββ 2026-01-20-api-redesign.md
ββ 2025-12/
How to use:
You: "Check L5 for decisions about authentication"
AI: [Searches through L5-Logs/]
"Found: On 2026-01-15, we decided to use JWT
with Redis for session storage because..."
What to log:
- Architecture decisions
- Why certain approaches were chosen
- Lessons learned
- Important discussions
| Feature | This System | ChatGPT Memory | Claude Projects | Claude Skills |
|---|---|---|---|---|
| Startup Loading | β Auto L1/L2 | β Auto all | β Project-only | |
| Core Identity | β L1 persistent | β Mixed in all | β Per-project | |
| Cross-Project | β L1/L2 shared | β Global | β Isolated | |
| Transparency | β Local files | β Cloud | β Cloud | |
| Customization | β Unlimited | β Limited | β Templates | |
| Version Control | β Git-tracked | β Not available | β Not available | β Cloud |
| Local Storage | β 100% local | β Cloud | β Cloud | |
| Launch Date | Sep 2025 | Apr 2024 | Jun 2024 | Dec 2025 |
| Lead Time | 78 days ahead | β | β | (vs Skills) |
When to use this system:
- β You want complete control and transparency
- β You work across multiple projects with shared core values
- β You're comfortable with file-based configuration
- β You want Git-tracked memory history
- β You need clear separation between identity and projects
When official solutions might be better:
- β You want zero configuration
- β You prefer automated memory management
- β You don't want to manage files manually
- Core identity shouldn't change frequently
- Think carefully before editing L1 files
- Version control L1 changes carefully
- As your preferences evolve, update profile
- Keep tech stack current
- Reflect changes in working style
- Don't create methods upfront
- Extract methods when you notice patterns
- Document as you develop workflows
- Clear separation between projects
- Archive completed projects
- Keep active projects lean
- Not everything needs logging
- Focus on "why" decisions
- Date-organized for easy reference
cd ~/Documents/AI_Memory_Core
git init
git add .
git commit -m "Initial memory setup"
# After important changes
git add L1-Core/values.md
git commit -m "Updated core values: added security-first principle"Runtime: September 2025 - Present (4+ months)
Key Metrics:
- β 100% session consistency (L1 loaded every time)
- β Zero data loss (Git-tracked, local storage)
- β Cross-project core identity maintained
- β 78-day head start over Claude Skills
- β Minimal maintenance cost (L1 updated 3 times in 4 months)
Use Cases Validated:
- Long-term software development projects
- Design collaboration workflows
- Cross-project method libraries
- Historical decision tracking
- Check that
~/.claude/CLAUDE.mdexists - Verify paths in CLAUDE.md are correct
- Ensure L1 files exist at specified paths
- Restart Claude Code
- Restart Claude Code after editing
- Check file paths are absolute, not relative
- Verify @ syntax is correct in CLAUDE.md
- Start with only L1 and L2
- Add L3 methods gradually
- L4/L5 are optional
- Don't over-engineer
- Architecture Deep Dive
- Comparison with Official Solutions
- Best Practices Guide
- Migration from Claude Projects
Contributions welcome! Please read CONTRIBUTING.md first.
Areas we'd love help with:
- Example methods for common workflows
- Project templates for different domains
- Integration guides for other AI systems
- Documentation improvements
MIT License - see LICENSE for details
- Built on Claude Code by Anthropic
- Inspired by the need for persistent AI identity
- Validated through real-world production use
- Issues: GitHub Issues
- Discussions: GitHub Discussions
- Creator: [Your Name] - [Your Professional Link]
- Templates for popular use cases (developers, designers, writers)
- Migration scripts from Claude Projects
- Integration examples with local AI (Ollama, etc.)
- Memory health check tool
- Automated backup solutions
Built with care by someone who needed it to work π