Structured context management system with granular memory files, decision records, and archived history for lean token usage
Automatically tracks your work and keeps everything organized, turning Claude into your smart token-tuned coding partner. This system maintains a structured memory bank with specialized context files, ensuring lean token usage and efficient project knowledge management.
Provides Claude Code with a standardized memory management system that:
The memory bank lives in `.claude/memory_bank/` with the following hierarchy:
**Authoritative Files (use these first):**
**Archive (read-only, last resort):**
1. **Keep tokens lean**: Use granular memory, scoped queries, minimal loads
2. **Context order**: Check memory bank → code search → archive (last resort)
3. **Never load archive** for routine tasks; it's historical reference only
4. **Always check relevant memory files** before starting work
5. **Update memory bank** as you make decisions or solve problems
6. **Exclude `.claude/memory_bank` from commits** (add to `.gitignore`)
**Query for Relevant Context:**
```bash
/context-query --path=".claude/memory_bank/decisions" --limit=3 "authentication"
/context-query --path=".claude/memory_bank/patterns" --limit=2 "error handling"
```
**Create New Decision Record:**
When making architectural decisions, create ADR in `decisions/` directory:
```markdown
Accepted
[What problem are we solving?]
[What did we decide?]
[What are the trade-offs?]
```
**Document Pattern:**
Record reusable patterns in `patterns/` directory:
```markdown
[When to use this]
[How to implement]
[Code examples]
```
**Record Troubleshooting Solution:**
Add solved issues to `troubleshooting/` directory:
```markdown
[What went wrong]
[Why it happened]
[How we fixed it]
```
**Backup Memory Bank:**
When asked to back up, copy granular directories and settings:
```bash
mkdir -p .claude/memory_backup
cp -r .claude/memory_bank/{decisions,patterns,architecture,troubleshooting} .claude/memory_backup/
cp -r @.claude .claude/memory_backup/
```
**Listing:**
```bash
fd . -t f # All files (fastest)
fd . -t d # All directories
rg --files # Respects .gitignore
ls -la # Current directory only
```
**Search Content:**
```bash
rg "pattern" # Basic search
rg -i "pattern" # Case-insensitive
rg -t py "pattern" # By file type
rg -g "*.md" "pattern" # By glob
rg -n "pattern" # Show line numbers
rg -A 3 -B 3 "error" # Show context (3 lines before/after)
rg "(foo|bar|baz)" # Batch patterns
rg "pattern" src/ # Limit scope by path
```
**Find by Name:**
```bash
fd "filename" # Fastest filename search
rg --files | rg "name" # Respects .gitignore
```
**Tools to NEVER Use:**
**Tools to ALWAYS Use:**
1. **Before any task:**
- Check memory bank for relevant context (use scoped `/context-query`)
- Start broad, then narrow with filters
- Use batch patterns where possible
2. **During work:**
- Run tools in parallel when possible
- Edit existing files; never create unless explicitly asked
- Do what's requested—nothing more, nothing less
3. **After completing work:**
- Update relevant memory bank files with new learnings
- Document decisions in `decisions/`
- Record solutions in `troubleshooting/`
- Verify results before finishing
4. **Never:**
- Load archive files for routine tasks
- Create docs/READMEs unless explicitly requested
- Commit `.claude/memory_bank` directory
- Use slow search tools (grep, find, tree)
**Scenario 1: Starting a New Feature**
```bash
/context-query --path=".claude/memory_bank/patterns" --limit=3 "feature implementation"
/context-query --path=".claude/memory_bank/architecture" --limit=2 "module structure"
```
**Scenario 2: Debugging an Issue**
```bash
/context-query --path=".claude/memory_bank/troubleshooting" --limit=5 "error message"
rg -n "error_code" src/
```
**Scenario 3: Understanding Architecture**
```bash
/context-query --path=".claude/memory_bank/architecture" --limit=3 "service"
fd . -t d src/services/
```
Leave a review
No reviews yet. Be the first to review this skill!
# Download SKILL.md from killerskills.ai/api/skills/claude-memory-bank-manager/raw