Agent Memory skill for Claude

Use when an agent keeps relearning the same correction, CLAUDE.md has grown unreadable, or you need to trace where a remembered rule came from. Promotes facts through four tiers only on recurrence across sessions and days, with memory_promote.py and a human adopt step.

Agent Memory SKILL.md

The full skill file from alirezarezvani/claude-skills (MIT).

Agent Memory — promotion is earned, not asserted

Portability: stdlib only. No database, no embeddings, no network, no LLM calls.

The problem

A project's CLAUDE.md is a memory system with one tier and no eviction: every durable fact and every passing preference land in the same always-loaded file, until the important lines are diluted by the incidental ones. Facts learned mid-session vanish at teardown unless someone writes them down.

The fix is not more storage — it is a promotion ladder. A claim earns its way toward always-loaded context by recurring; a human confirms the last step.

The four tiers

Tiers are distinguished by injection policy, not storage format.

TierHoldsInjectedCommitted
L0raw session transcriptsneverno (already on disk)
L1candidate atomson relevance, at prompt timeno (gitignored)
L2this project's contextevery session startyes, after adopt
L3stable cross-project personaalwaysyes, after adopt

The gates

Nothing moves up because it sounded important. It moves up because it recurred.

  • L0 → L1 — an explicit marker fires (a directive, a correction, a stated preference, a named lesson, a reproducible failure). Rule-based, high precision, deliberately low recall.
  • L1 → L2 — ≥ 3 distinct sessions spanning ≥ 2 distinct calendar days. A claim stated outright needs 2 sessions; the distinct-day rule still applies. A verified claim promotes on one observation and is the only day-exempt path.
  • L2 → L3 — held in ≥ 2 distinct projects, aged ≥ 30 days, uncontested.

Two gates refuse rather than guess. A claim whose text was altered by redaction never promotes on evidence alone — the flag firing is evidence the source was sensitive, and a lexical filter finding one secret is not proof it found all of them. A claim with an open contradiction is frozen at L1 until a human resolves it; the incumbent is never silently overwritten.

Use it

# what is remembered, and what is blocking the next promotion
python3 scripts/memory_inspect.py --tier L1

# where did this line come from — sessions, days, transcript, quoted source
python3 scripts/memory_inspect.py --why "PR base branch is dev"

# every claim with an open contradiction, both directions of the join
python3 scripts/memory_inspect.py --contested

# dry-run the promotion pass; writes nothing
python3 scripts/memory_promote.py

Three hooks run the loop unattended: SessionStart injects L2 + L3, UserPromptSubmit recalls relevant L1 atoms, SessionEnd captures and stages. Each is disabled independently with AGENT_MEMORY_SESSIONSTART=0, AGENT_MEMORY_USERPROMPTSUBMIT=0, AGENT_MEMORY_SESSIONEND=0. Every hook fails open: a broken memory system costs you memory, never a session.

Hard rules

  1. Redact before writing. Every atom passes the filter before it reaches disk. Anything altered is quarantined from promotion.
  2. Propose, never apply. Promotions land in .memory/staged/. Only an explicit /cs-memory adopt touches a CLAUDE.md, and it backs both up first.
  3. Cite, don't invent. Every atom carries a back-pointer to the transcript line that produced it. --why resolving to ambiguous prints nothing rather than guess: a wrong citation is worse than a missing one.
  4. Never surface a contested claim as fact. It is still injected — hiding the conflict is worse — but always tagged.
  5. The committed tiers carry no paths. Promotion strips the back-pointer prefix, which embeds an OS username.

Forcing questions

Walk these one at a time before trusting the store.

  1. Which line in your CLAUDE.md did you last actually read before acting?
  2. Would you rather the agent forget a true thing, or remember a false one?
  3. When two remembered rules disagree, who decides — and when?
  4. What would make you delete .memory/ entirely?

Rationale, open decisions, field schema: ../../DESIGN.md.

More in this skill

Load these only when the task needs them.

How to install Agent Memory

Claude Code

Copy the skill into your personal skills folder (or into .claude/skills/ inside a project):

npx degit alirezarezvani/claude-skills/engineering/agent-memory/skills/agent-memory#main ~/.claude/skills/agent-memory

Codex

npx degit alirezarezvani/claude-skills/engineering/agent-memory/skills/agent-memory#main ~/.codex/skills/agent-memory

Claude.ai and Claude Desktop

Download the skill folder from GitHub, zip it, and upload it under Settings → Capabilities → Skills.

Frequently asked questions

+What does the Agent Memory skill do?

Use when an agent keeps relearning the same correction, CLAUDE.md has grown unreadable, or you need to trace where a remembered rule came from. Promotes facts through four tiers only on recurrence across sessions and days, with memory_promote.py and a human adopt step.

+How do I install Agent Memory in Claude Code?

Copy the skill folder into ~/.claude/skills/agent-memory, for example with "npx degit alirezarezvani/claude-skills/engineering/agent-memory/skills/agent-memory#main ~/.claude/skills/agent-memory". Claude Code loads it automatically and uses it when a task matches.

+Does Agent Memory work with ChatGPT or Codex?

Yes. Agent Memory uses the open SKILL.md format. In Codex, put the folder in ~/.codex/skills/agent-memory. In Claude.ai, zip the folder and upload it under Settings → Capabilities → Skills.

+Is Agent Memory free?

Agent Memory is published on GitHub by alirezarezvani under the MIT license, which allows free use.

Related ai agents & skills skills

  1. Grill Me

    A relentless interview to sharpen a plan or design.

    mattpocock/skills★ 327k
  2. Skill Creator

    Official

    Create new skills, modify and improve existing skills, and measure skill performance.

    anthropics/skills★ 197k
  3. Caveman

    Terse caveman voice: answer first, fluff gone, every technical fact kept.

    JuliusBrussee/caveman★ 121k
  4. Caveman

    Terse mode: drop filler, articles and pleasantries, keep technical accuracy, about 75% fewer tokens, and stay in it.

    alirezarezvani/claude-skills★ 30k
  5. Cinematic Shot Prompting

    Use when creating camera movement, cinematic angles, or motion prompts for AI video generators like Runway Gen-3, Kling, and Luma.

    alirezarezvani/claude-skills★ 30k
  6. Claude Coach

    Use when the user wants to get better at using Claude ('coach me', 'teach me Claude tricks', 'make me a power user').

    alirezarezvani/claude-skills★ 30k
  7. Fable Goal

    Use when the user wants a /goal prompt rather than the build itself ('/fable-goal', 'turn this into a goal prompt', 'write the prompt that…

    alirezarezvani/claude-skills★ 30k
  8. Grill Me

    Interview the user relentlessly about a plan or design until reaching shared understanding, resolving each branch of the decision tree.

    alirezarezvani/claude-skills★ 30k
  9. Grill With Docs

    Use when a plan should be stress-tested against the project's own docs (CONTEXT.md glossary, docs/adr decisions), or the user says 'grill…

    alirezarezvani/claude-skills★ 30k

See all ai agents & skills skills →

More skills from alirezarezvani

  1. Agent Protocol

    Use when C-suite advisor agents need to call each other or run a multi-role meeting.

    alirezarezvani/claude-skills★ 30k
  2. Agent Regression Evals

    Use before shipping any agent, prompt, model or tool change, or when a pass-rate drop needs a verdict.

    alirezarezvani/claude-skills★ 30k
  3. Agent Run Forensics

    Use when asked why an agent did something, what a past session or run changed, whether tests really passed, or to verify a session summary.

    alirezarezvani/claude-skills★ 30k

All skills by alirezarezvani →

Give your whole team an AI agent with skills

Cody runs managed AI agents your team can message in Slack, Teams, WhatsApp and the web, with 50+ business integrations, scheduled tasks and memory. No terminal required.