agentleFS
kienbui1995kienbui1995/magic-powers/skills/claude-memory/SKILL.md

claude-memory

Skill0 starsChanged 8 months agoMITView on GitHub

Use when leveraging Claude Code's auto-memory system — understanding what Claude saves to memory, writing good memory entries manually, structuring the memory directory, and using memory for project continuity across sessions.

1 other project uses a version of this.

Adopted by

Most recently taken up by

The file

We split this skill into the rules it gives an agent

5 rules. About 0 are common, 3 are distinctive, and 2 are very specific to this project.

  • ≈0

    Common · estimate

    Many files like this have a rule of this kind.

  • ≈3

    Distinctive · estimate

    This author's own choices. Worth a look.

  • 2

    Very specific

    Tied to their project's names, files or tools. Probably skip.

  • Common
  • Distinctive
  • Very specific
  1. Distinctive:

    Keep the index concise — it is loaded every session and truncated if too long:

    line 70
  2. Distinctive:

    Rule: Keep MEMORY.md under 200 lines or later lines get cut off at load time.

    line 80
  3. Distinctive:

    No feedback memories (Claude will repeat the same mistakes you've already corrected)

    line 129
  4. Very specific:

    Use with claude-md-authoring (CLAUDE.md = instructions.

    line 134
  5. Very specific:

    Use with claude-project-settings (memory location is configured alongside other project settings)

    line 135

≈ “Common” is an estimate: at least 1 in 5 of the 213,895 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.

Keep what fits and drop the rest. Your version, ready for your agents.
Files
SKILL.md

Claude Memory

Overview

Claude Code has a built-in memory system that persists context across sessions. Without it, every session starts cold — Claude has no knowledge of past decisions, your preferences, or what was built last week. With a well-managed memory directory, Claude picks up exactly where you left off: knowing your role, your stack, your conventions, and the current state of the project.

When to Use

  • Claude keeps forgetting important context between sessions
  • Starting a new session and want to pick up exactly where you left off
  • Building a system where Claude accumulates knowledge over time
  • Managing what Claude should and shouldn't remember

Core Jobs

1. How Claude Code Memory Works

Claude Code has an auto-memory system in ~/.claude/projects/[project-hash]/memory/:

~/.claude/
  CLAUDE.md                    ← global instructions (always loaded)
  projects/
    [project-hash]/
      memory/
        MEMORY.md              ← index of all memory files (always loaded)
        user_profile.md        ← who the user is, preferences
        project_context.md     ← what the project is about
        feedback_*.md          ← corrections and learned preferences
        reference_*.md         ← external resources and links

Claude loads MEMORY.md on every session start and follows pointers to load relevant memory files. Keep the index concise — it is always loaded in full.

2. Memory Types

TypeWhat to storeWhen auto-saved
userRole, skills, preferences, communication styleWhen user shares personal context
projectGoals, decisions, current work, deadlinesWhen project state changes
feedbackCorrections, do/don't preferencesWhen user corrects Claude
referenceExternal URLs, tool locations, docsWhen user mentions external resources

3. Writing Good Memory Entries Manually

---
name: user-coding-style
description: User's coding preferences and style requirements
type: user
---

User: Kien, Vietnamese communication preferred
Role: Solo AI builder, primarily Python + TypeScript
Experience: Senior, minimal explanation needed
Style: Direct, concise, no over-engineering
Key preference: Always use uv for Python package management, never pip
Test preference: pytest with fixtures, no mocking external services

Good memory entries are specific, actionable, and focused on preferences that change Claude's behavior. Avoid storing code snippets or file contents — those change and go stale.

4. Memory Index (MEMORY.md)

Keep the index concise — it is loaded every session and truncated if too long:

# Memory Index

- [User profile](user_profile.md) — Kien, solo AI builder, Python/TS
- [Project: magic-powers](project_magic_powers.md) — Claude Code plugin, v1.9.0
- [Preferences](feedback_coding.md) — uv not pip, direct comms, no over-engineering

Rule: Keep MEMORY.md under 200 lines or later lines get cut off at load time.

5. Project Continuity Pattern

At the end of significant sessions, update memory explicitly:

# project_context.md update (after a major session)

## Current State (updated 2026-04-08)
- Completed: MCP setup for postgres, github integrations
- In progress: Hook system for auto-testing on edit
- Blocked: Waiting for staging DB credentials from ops
- Next session: Wire up Stop hook to enforce pytest passing

This replaces the need to re-explain project state at the start of every session.

Key Concepts

  • Auto-memory — Claude Code automatically saves important context to ~/.claude/projects/[hash]/memory/
  • MEMORY.md — always-loaded index file; must stay under 200 lines
  • Memory types — user (preferences), project (state), feedback (corrections), reference (links)
  • Memory staleness — memories about code can go stale; always verify before acting on code-specific memories

Checklist

  • MEMORY.md index exists and is under 200 lines?
  • User profile memory set (role, communication style, key tools)?
  • Project context memory updated when major decisions are made?
  • Feedback memories added after correcting Claude's mistakes?
  • Memory files verified as current (not stale from months ago)?

Key Outputs

  • Memory directory structure with appropriate files per type
  • MEMORY.md index with concise pointers to each memory file
  • Project continuity entries capturing current state after major sessions

Output Format

  • 🔴 Critical — no memory system (Claude restarts cold every session), MEMORY.md over 200 lines (truncated at load)
  • 🟡 Warning — stale memories about code that no longer exists, no feedback memories (Claude repeats same mistakes)
  • 🟢 Suggestion — add project memory after major architectural decisions, add user memory for communication preferences, update "Current State" after complex sessions

Anti-Patterns

  • Storing code snippets in memory (code changes; reference files instead)
  • MEMORY.md over 200 lines (truncated at load time — later entries are invisible)
  • No feedback memories (Claude will repeat the same mistakes you've already corrected)
  • Memory entries that say "as of [old date]" but were never updated — stale context misleads Claude

Integration

  • Use with claude-md-authoring (CLAUDE.md = instructions; memory = accumulated context — they complement each other)
  • Use with claude-project-settings (memory location is configured alongside other project settings)
  • Agent: @technical-writer can help draft well-structured memory entries for complex projects

Download now (ZIP)

Does it work?

Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.

No reviews yet

People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.

  • It worked
  • Partly
  • It didn't
What did you use it for? e.g. Reviewing pull requests in a Rails app

Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.

Your trail

Files you open will collect here, so you can find them again.

Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.

Now do this for your own.

Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.