Agent Memory System transforms Claude Code (Anthropic's terminal-based AI assistant) into a manageable, organized, and memory-persistent software development team consisting of 37 specialized agents.
This repository solves the two biggest problems in standard Claude Code usage:
- Context Loss and Bloat: Instead of dumping everything into one massive log, the system divides work into modular memory-bank markdown files, saving tokens by pruning finalized tasks.
- High API Costs: The
claudecommand uses your Claude Pro subscription for quality work, whileccr coderoutes routine tasks to ultra-cheap models (DeepSeek, Qwen) via OpenRouter — dramatically cutting costs.
Based on the Everything Claude Code architecture, enhanced with OpenRouter/CCR support, 108 predefined skills, and 37 distinct expert agents.
- 37 Expert Agents: Frontend, Backend, Database, Security, DevOps, Java Reviewer, Rust Resolver...
- 108 Custom Skills: TDD loops, E2E test generation, Django/Laravel patterns, Architecture reviews.
- Persistent Memory (Memory-Bank): All architecture decisions (ADR) and tasks are stored under
.claude/. - Self-Learning (/learn): Extract patterns from a successful session to create a new reusable skill.
- Node.js 18+ installed.
- A terminal application (Mac Terminal, iTerm, Windows PowerShell, or WSL).
npm install -g @anthropic-ai/claude-codegit clone https://github.com/yusufcmg/Agent_Memory_System.git
cd Agent_Memory_System
bash install.shOnce complete, the .claude/ directory with all expert agents and Claude Code Router (CCR) will be ready on your machine.
This system uses two separate commands. Each requires its own one-time setup.
For complex, quality coding tasks, use the claude command. It connects directly to Anthropic and uses your Claude Pro subscription.
1. Go to any project folder and start Claude:
claude2. On first use, authenticate:
> /loginA browser will open → Log in with your Anthropic account (claude.ai) → Authorize → Return to terminal.
When you see "Login successful", type /exit to close.
⚠️ You only need to do this once. Next time you runclaude, you'll be logged in automatically.
For routine tasks like writing tests, reading logs, and code review, use ccr code. This routes everything to ultra-cheap models (DeepSeek, Qwen) via OpenRouter.
1. Go to openrouter.ai, create an account and generate an API Key (starts with sk-or-). Add some credit ($5-10 can last a very long time).
2. Open the config file created during installation:
nano ~/.claude-code-router/config.json3. Replace BURAYA-OPENROUTER-KEY-GIRIN with your actual key:
{
"Providers": [
{
"name": "openrouter",
"api_base_url": "https://openrouter.ai/api/v1/chat/completions",
"api_key": "sk-or-YOUR-ACTUAL-KEY-HERE",
"models": [
"deepseek/deepseek-chat",
"minimax/minimax-m2.5",
"minimax/minimax-m2.1"
],
"transformer": {
"use": ["openrouter"],
"deepseek/deepseek-chat": {
"use": ["openrouter", "tooluse", "enhancetool"]
},
"minimax/minimax-m2.5": {
"use": ["openrouter"]
}
}
}
],
"Router": {
"default": "openrouter,deepseek/deepseek-chat",
"background": "openrouter,minimax/minimax-m2.1",
"think": "openrouter,minimax/minimax-m2.5",
"longContext": "openrouter,minimax/minimax-m2.5"
}
}
⚠️ Important: Use OpenRouter model IDs in themodelslist (e.g.anthropic/claude-3-5-sonnet). Do NOT use Claude Code's internal aliases (e.g.claude-sonnet-4-6) here — they won't work with OpenRouter.
4. Press CTRL+X → Y → Enter to save.
5. After any config change, restart the CCR service:
ccr restartGo to any project folder. On first setup, initialize the memory-bank using the claude command:
claude
> /initThe onboarding agent will ask questions about your project (language, framework, database, etc.). Your answers will fill .claude/memory-bank/ with a permanent, project-specific constitution. You only need to do this once per project.
Once the memory-bank is set up, here's how to work with the agent team:
For complex coding, architecture decisions, and critical features:
claude -p "as backend agent, create POST /api/auth endpoint"
claude -p "as architect, review the current system design"For writing tests, reading logs, updating docs, small fixes.
⚠️ IMPORTANT: Always useccr codewith the-pflag for cheap models (DeepSeek, Qwen). Running it in interactive mode (justccr codeand hitting enter) can confuse these models and trap them in a tool loop.
# ✅ CORRECT — single-shot job
ccr code -p "as qa-backend agent, write tests for the auth endpoint"
ccr code -p "as docs agent, update the API documentation"
# ❌ WRONG — interactive mode may cause issues with cheap models
ccr code(The QA agent writes tests cheaply via OpenRouter and logs errors to memory-bank/state/tasks.md.)
| Command | What it does |
|---|---|
/model |
Switch the active model |
/init |
Initialize project memory (first time only per project) |
/tdd |
Start a Test-Driven Development loop |
/code-review |
Scan the entire codebase for security and performance issues |
/sync-memory |
Prune agent log directories to save tokens |
/new-adr |
Create a new Architecture Decision Record |
/learn |
Extract patterns from a session to create a new skill |
Open source — feel free to open an issue or submit a Pull Request!
MIT License