Agent skill

Agent Memory

by alirezarezvani in alirezarezvani/claude-skills

A skill your agent uses when a project's CLAUDE.md has grown past what anyone reads and you want the agent to learn durable facts from its own sessions instead — or when asking why the agent keeps…

MITAuto-check passedAgent Workflows

Install Agent Memory

skills CLI
$ npx skills add alirezarezvani/claude-skills --skill agent-memory -a claude-code

Project install by default; add -g for ~/.claude/skills/.

GitHub CLI
$ gh skill install alirezarezvani/claude-skills agent-memory --agent claude-code

Project scope by default; add --scope user for a personal install. Needs GitHub CLI 2.90.0 or later (public preview).

Manual copy
$ git clone --depth 1 https://github.com/alirezarezvani/claude-skills.git skills-src && mkdir -p .claude/skills && cp -r skills-src/engineering/agent-memory/skills/agent-memory .claude/skills/agent-memory && rm -rf skills-src

Use ~/.claude/skills/ instead of .claude/skills for a personal install. The folder must contain SKILL.md.

Claude Code skills documentation · loads skills from .claude/skills/

Facts

Skill name
agent-memory
GitHub stars
28k
Token cost
~1.3k tokens
SKILL.md length
519 words
Files
10 (incl. scripts, references, assets)
Skills in repo
342
Repo updated
First seen
Licence
MIT

At a glance

A skill your agent uses when a project's CLAUDE.md has grown past what anyone reads and you want the agent to learn durable facts from its own sessions instead — or when asking why the agent keeps…

  • Works in 5 steps: Redact before writing. Every atom passes… → Propose, never apply. Promotions land in… → Cite, don't invent. Every atom carries a… → …
  • A projects CLAUDE.md has grown past what anyone reads and you want the agent to learn durable facts from its own sessions instead —
  • SKILL.md covers The problem, The four tiers, The gates and Use it, plus 2 more sections
  • Runs Python scripts from its folder; calls python3

What it does

Agent Memory is an agent skill from alirezarezvani/claude-skills. Use when a project's CLAUDE.md has grown past what anyone reads and you want the agent to learn durable facts from its own sessions instead — or when asking why the agent keeps re-learning the same correction, why a remembered rule is wrong, or where a memory line came from. Implements a four-tier store (L0 transcripts / L1 candidates / L2 project context / L3 stable persona) where promotion is earned by recurrence across sessions and days, never by one confident statement, and nothing reaches a committed file…

Its SKILL.md is about 1.3k tokens, which your agent loads only when the skill is triggered. The skill folder holds 12 other files, including scripts, reference files and assets (for example `assets/memory_schema.json`, `references/hook_capture_discipline.md` and `references/promotion_gate_design.md`).

It sits in Agent Workflows, covering Agent memory and Agent instruction files. The repository describes itself as: 380 Claude Code skills & agent skills & plugins (30+ Agents, 70+ custom commands, 380+ skills, customizable references, scripts)for Claude Code, Codex, Gemini CLI, Cursor, and 8… The licence is MIT.

When your agent uses it

  • A projects CLAUDE.md has grown past what anyone reads and you want the agent to learn durable facts from its own sessions instead —
  • Asking why the agent keeps re-learning the same correction
  • Why a remembered rule is wrong
  • Where a memory line came from

Example prompts

  • “/agent-memory”

Requirements

  • Python 3

Workflow steps

5 steps, taken from the first numbered list in SKILL.md.

  1. Redact before writing. Every atom passes the filter before it reaches
  2. Propose, never apply. Promotions land in .memory/staged/. Only an
  3. Cite, don't invent. Every atom carries a back-pointer to the transcript
  4. Never surface a contested claim as fact. It is still injected — hiding
  5. The committed tiers carry no paths. Promotion strips the back-pointer

What it can do on your machine

Read from SKILL.md and the folder at commit 19392f7. It shows what the files ask for, not the result of running them.

  • Tool permissions

    Pre-approves nothing: there is no allowed-tools line, so your agent's usual permission prompts apply.

    From allowed-tools in the SKILL.md frontmatter.

  • Runs code

    Ships 5 files in scripts/ (Python), which the agent can run.

    Shell commands in SKILL.md call:

    • python3

    From the folder's file list and the shell code blocks in SKILL.md.

  • Network

    No URLs in SKILL.md.

    From URLs in SKILL.md, links to its own repository left out.

  • Credentials

    Names no API keys, tokens, secrets or passwords.

    From names ending in _API_KEY, _TOKEN, _SECRET, _KEY or _PASSWORD in SKILL.md.

Context cost

Agent Memory loads about 1.3k tokens when it runs, and up to ~6.6k if it reads all its reference files. Until then it costs about 139 tokens; SKILL.md has 519 words of instructions outside code blocks.

Always · name and description, kept in context so the agent knows when to use it
~139
When it runs · the whole SKILL.md, loaded when a task matches
~1.3k
With references · SKILL.md plus every file in references/, read only if the agent opens them
~6.6k

Estimates: characters ÷ 4, the usual rule of thumb; real counts depend on the model's tokenizer. Scripts and assets cost tokens only if the agent reads them.

Safety

Auto-check passed

The automated check found no risky patterns in SKILL.md.

Automated static check — not a guarantee. Review scripts before installing. It scans the text of SKILL.md for risky patterns (piping downloads into a shell, reading credential files, hidden Unicode, destructive commands); the scripts in this folder are not scanned.

SKILL.md

The full file from alirezarezvani/claude-skills at commit 19392f7, republished under its MIT licence (© alirezarezvani). 519 words, ~1,297 tokens.

Download SKILL.mdSave it as .claude/skills/agent-memory/SKILL.md (or your agent's skills folder). This skill also uses 9 other files; get the full folder from GitHub.
name
agent-memory
description
Use when a project's CLAUDE.md has grown past what anyone reads and you want the agent to learn durable facts from its own sessions instead — or when asking why the agent keeps re-learning the same correction, why a remembered rule is wrong, or where a memory line came from. Implements a four-tier store (L0 transcripts / L1 candidates / L2 project context / L3 stable persona) where promotion is earned by recurrence across sessions and days, never by one confident statement, and nothing reaches a committed file without a human adopting it.
argument-hint
[optional: status | why "<claim>" | a tier name]
license
MIT
metadata.version
1.0.0
metadata.build_pattern
Tencent TencentDB-Agent-Memory's tiering concept rebuilt natively on Claude Code hooks; deterministic recurrence gates, no LLM, no database
metadata.distinct_from
llm-wiki (a vault you write on purpose; this writes itself from sessions); skillopt-sleep (replays tasks to improve a skill; this extracts facts to remember)…

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.

Show full SKILL.md (221 more words)Show less

Use it

bash
# 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.

© alirezarezvani, MIT. Rendered from Markdown: HTML in the file is shown as text, images as links, and headings moved down two levels. Raw file

Files

SKILL.md and 9 other files (scripts, references, assets) in engineering/agent-memory/skills/agent-memory of alirezarezvani/claude-skills.

  • SKILL.md
  • assets/memory_schema.json
  • references/hook_capture_discipline.md
  • references/promotion_gate_design.md
  • references/tiered_memory_canon.md
  • scripts/memory_core.py
  • scripts/memory_extract.py
  • scripts/memory_inspect.py
  • scripts/memory_promote.py
  • scripts/validate_examples.py

Open the folder on GitHubat commit 19392f7

Compare with similar skills

Agent Memory next to the 5 skills that share the most tags, products or categories with it. Stars are the repository's; “used in” counts other GitHub owners with a copy.

Agent Memory compared with similar skills
SkillStarsUsed inTokensAuto-checkLicenceRepo updated
Agent Memory this skillalirezarezvani/claude-skills28k—~1.3kAutomated safety check: PassMIT
Neat-Freak Knowledge CloseoutKKKKhazix/khazix-skills21k—~1.9kAutomated safety check: PassMIT
SkillOpt Sleep Cyclemicrosoft/SkillOpt18k—~2.3kAutomated safety check: PassMIT
CLAUDE.md Improveranthropics/claude-plugins-official37k5 repos~1.5kAutomated safety check: PassApache-2.0
Harness Engineering10xChengTu/harness-engineering1021 repos~1kAutomated safety check: PassNone
Codebase Analyzerseverity1/claude-code-auto-memory159—~1.5kAutomated safety check: PassMIT

Similar skills

  • Neat-Freak Knowledge Closeout

    KKKKhazix/khazix-skills

    Brings project docs, agent rule files, authorized memory and leftover workspace files back in line with what the code and runtime actually do at the end of a work session.

    21k GitHub stars~1.9k tokensUpdated 6 days ago
    Agent WorkflowsAuto-check passed
  • SkillOpt Sleep Cycle

    microsoft/SkillOpt

    Official

    Runs an on-demand or nightly sleep cycle that reviews past Claude Code sessions and proposes validated updates to CLAUDE.md and skills.

    18k GitHub stars~2.3k tokensUpdated yesterday
    Agent WorkflowsAuto-check passed
  • CLAUDE.md Improver

    anthropics/claude-plugins-official

    Official

    Finds every CLAUDE.md file in a repository, scores each against quality criteria, shows a report, then makes targeted updates after you approve.

    37k GitHub starsUsed in 5 repos~1.5k tokens
    Agent WorkflowsAuto-check passed
  • Harness Engineering

    10xChengTu/harness-engineering

    Set up and improve harness engineering (AGENTS.md, docs/, lint rules, eval systems, project-level prompt engineering) for AI-agent-friendly codebases.

    102 GitHub starsUsed in 1 repo~1k tokens
    Agent WorkflowsAuto-check passed
  • Codebase Analyzer

    severity1/claude-code-auto-memory

    This skill should be used when the user asks to "initialize auto-memory", "create CLAUDE.md", "set up project memory", or runs the /auto-memory:init command.

    159 GitHub stars~1.5k tokensUpdated 5 mo ago
    Agent WorkflowsAuto-check passed
  • Self Improving For Codex

    GODGOD126/self-improving-for-codex

    Build or maintain a Codex-native self-improving memory loop using global AGENTS.md, a persistent memories directory, and optional nightly refinement automation.

    130 GitHub stars~1.2k tokensUpdated 1 mo ago
    Agent WorkflowsAuto-check passed

More from alirezarezvani/claude-skills

All 342 skills in this repo
  • Agile Product Owner

    alirezarezvani/claude-skills

    Writes INVEST-checked user stories with acceptance criteria, splits epics, plans sprints from velocity and ranks the backlog with a weighted score.

    28k GitHub starsUsed in 3 repos~3.2k tokens
    Auto-check passed
  • Product Strategist

    alirezarezvani/claude-skills

    OKR cascade toolkit for product leaders: generates aligned company-to-team OKRs from five strategy types and scores how well they line up.

    28k GitHub starsUsed in 2 repos~1.8k tokens
    Auto-check passed
  • App Store Optimization

    alirezarezvani/claude-skills

    App Store Optimization (ASO) toolkit for researching keywords, analyzing competitor rankings, generating metadata suggestions, and improving app visibility on Apple App Store and Google Play Store.

    28k GitHub starsUsed in 1 repo~4.2k tokens
    Auto-check passed
  • AWS Solution Architect

    alirezarezvani/claude-skills

    Design AWS architectures for startups using serverless patterns and IaC templates.

    28k GitHub starsUsed in 1 repo~2.5k tokens
    Auto-check passed
  • Campaign Analytics

    alirezarezvani/claude-skills

    Calculates attribution, funnel and ROI figures for marketing campaigns with three Python scripts that need only the standard library.

    28k GitHub starsUsed in 1 repo~2.1k tokens
    Auto-check passed
  • Code to PRD

    alirezarezvani/claude-skills

    Reverse-engineers a frontend, backend or fullstack codebase into a product requirements document with per-page docs, an enum dictionary and an API inventory.

    28k GitHub starsUsed in 1 repo~4.9k tokens
    Auto-check passed

Categories

Questions about Agent Memory

What does Agent Memory do?

A skill your agent uses when a project's CLAUDE.md has grown past what anyone reads and you want the agent to learn durable facts from its own sessions instead — or when asking why the agent keeps…. Agent Memory is an agent skill from alirezarezvani/claude-skills.md has grown past what anyone reads and you want the agent to learn durable facts from its own sessions instead — or when asking why the agent keeps re-learning the same correction, why a remembered rule is wrong, or where a memory line came from.

When should I use Agent Memory?

Agent Memory fits situations like: A projects CLAUDE.md has grown past what anyone reads and you want the agent to learn durable facts from its own sessions instead —; asking why the agent keeps re-learning the same correction; why a remembered rule is wrong; where a memory line came from.

How do I install Agent Memory in Claude Code?

Run `npx skills add alirezarezvani/claude-skills --skill agent-memory -a claude-code`. Or copy the skill folder (engineering/agent-memory/skills/agent-memory in alirezarezvani/claude-skills) into .claude/skills/agent-memory in your project. Claude Code loads it when a task matches its description.

How do I install Agent Memory in Codex?

Run `npx skills add alirezarezvani/claude-skills --skill agent-memory -a codex`. Or copy the skill folder (engineering/agent-memory/skills/agent-memory in alirezarezvani/claude-skills) into .agents/skills/agent-memory in your project. Codex loads it when a task matches its description.

Can I use Agent Memory in Cursor, Gemini CLI or GitHub Copilot?

Cursor, Gemini CLI, GitHub Copilot and OpenCode also load SKILL.md folders. With the skills CLI, run `npx skills add alirezarezvani/claude-skills --skill agent-memory -a cursor` (or -a gemini-cli, github-copilot or opencode for the others). To copy it by hand, put the folder in .cursor/skills/agent-memory, .gemini/skills/agent-memory, .github/skills/agent-memory and .opencode/skills/agent-memory in your project.

What does Agent Memory need to run?

Going by SKILL.md and its folder, Agent Memory needs Python for the scripts in its folder and the command-line tools its instructions call (python3). Our summary lists: Python 3.

Does Agent Memory access the network?

SKILL.md contains no URLs. Any network use would come from the scripts or tools the agent runs. This is read from the text; nothing was executed.

Is Agent Memory safe to install?

Our automated static check of SKILL.md found no risky patterns, such as piping downloads into a shell, reading credential files or hidden Unicode. It is not a guarantee. The check reads SKILL.md only: the scripts in the folder are not scanned, so read them before running anything.

What licence does Agent Memory use?

Agent Memory is published under the MIT licence (declared in SKILL.md). It allows redistribution, so the full SKILL.md is shown on this page.

How many tokens does Agent Memory use?

About 1.3k tokens (SKILL.md is roughly 5.2k characters). Agents keep only the skill's name and description in context until a task matches; then they load SKILL.md in full. Its references folder adds about 5.3k tokens, read only when the agent opens those files.

What are the alternatives to Agent Memory?

Skills that share tags, products or a category with Agent Memory: Neat-Freak Knowledge Closeout (KKKKhazix/khazix-skills, 21k stars), SkillOpt Sleep Cycle (microsoft/SkillOpt, 18k stars), CLAUDE.md Improver (anthropics/claude-plugins-official, 37k stars) and Harness Engineering (10xChengTu/harness-engineering, 102 stars). The comparison table on this page puts their stars, adoption, token cost, safety result and licence side by side.

Who maintains Agent Memory?

alirezarezvani (a GitHub user) maintains it in alirezarezvani/claude-skills, which has 27,788 GitHub stars. The repository holds 342 skills in this directory. The repository was last updated on August 30, 2026.

Source: alirezarezvani/claude-skills on GitHub. Facts on this page come from the repository at the commit we read; the author's words are quoted as theirs.