agent-memory

agent-memory is a skill for Claude Code, Codex from JKHeadley/instar. It costs 78 tokens per session (1,878 once invoked), scanned B, original, MIT.

A set of instructions for giving Claude Code persistent project memory through a MEMORY.md file and optional topic files. Claude Code normally starts each session without knowledge of earlier conversations.

In plain words
What is it for?
It helps record project conventions, tools, scripts, user preferences, debugging notes, deployment details, and other information the agent should reuse later.
Why use it?
It prevents useful project facts, learned commands, preferences, and debugging discoveries from being forgotten when a session ends.

Skill for Claude CodeCodex

Install

Getting it into your agent

One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.

agentmods
npx agentmods add skills/jkheadley/instar/agent-memory
Any agent
npx skills add JKHeadley/instar --skill agent-memory
Clone the repo
git clone --depth 1 https://github.com/JKHeadley/instar

Made for: Claude Code, Codex.

Wrote this? Show the measurements

A badge with what this costs and how it scanned, read live from this page, so it follows the numbers instead of freezing them. Markdown for a README, HTML for a documentation site or a project page.

agentmods badge for agent-memory

README.md
[![agentmods](https://agentmods.dev/badge/skills/jkheadley/instar/agent-memory.svg)](https://agentmods.dev/skills/jkheadley/instar/agent-memory)
Your own site
<a href="https://agentmods.dev/skills/jkheadley/instar/agent-memory"><img src="https://agentmods.dev/badge/skills/jkheadley/instar/agent-memory.svg" alt="Measured on agentmods" height="20"></a>
Per session 78 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 1,878 The whole file, excluding the scripts and references it only reads on demand.
Security scan B 1 finding. Scan, not verified.
Origin original No closer match found in the catalogue.
Token cost

What it costs to keep this loaded

Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.

ModelPer sessionOnce invoked
Fable 5 $0.00078 $0.01878
Opus 5 $0.00039 $0.00939
Sonnet 5 $0.00016 $0.00376
Haiku 4.5 $0.00008 $0.00188

Measured 4d ago against content hash 35d6b194efbc, method: parsed. Prices are Anthropic first-party input rates as of 2026-08-30, from the pricing page.

Security

Grade B, and why

agent-memory scanned grade B with 1 finding against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured 4d ago.

A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.

Reads agent configuration directoriesmediumAgent snooping

.claude/, .codex/, .gemini/ hold keys, settings and other credentials a mod has no legitimate need for.

cat >> .claude/MEMORY.md << 'EOF'
skills/agent-memory/SKILL.md · 262 lines

How it starts

The opening of the file, as written. The whole thing — 262 lines — stays where its author put it; the contents beside it link to each section on GitHub.

agent-memory — Cross-Session Memory Patterns for Claude Code

Claude Code has no memory between sessions by default. Every conversation starts blank. But a project's knowledge accumulates — commands discovered, patterns debugged, preferences revealed, mistakes made and corrected. Without persistence, that knowledge is lost every time the window closes.

This skill establishes a simple, durable memory pattern using a single file: MEMORY.md.


The Core Pattern

One file. Written by the agent. Read at session start.

.claude/
  MEMORY.md          # The agent's persistent knowledge base
  identity/          # Optional: separate identity files (see agent-identity skill)
  memory/            # Optional: topic files as memory grows
    debugging.md
    deployment.md
    user-preferences.md

Setting Up MEMORY.md

Create .claude/MEMORY.md with this structure:

# [Project/Agent] Memory

> This file persists across sessions. Write here when you learn something
> worth remembering. Remove entries that become outdated. Keep it useful,
> not comprehensive.

## Project Patterns

[Commands, scripts, conventions specific to this project]

## Tools & Scripts

[Purpose-built scripts and how to invoke them]

## Lessons Learned

[Mistakes made and corrections. Dated entries.]

## User Preferences

[Communication style, workflow preferences, discovered through interaction]

## Open Questions

[Unresolved things to investigate — remove when resolved]

Then add this to your CLAUDE.md:

## Memory

At the start of every session, read `.claude/MEMORY.md` before doing any work.
After context compaction, re-read it immediately.

When you learn something worth keeping, write it to MEMORY.md before the session ends.

What to Write vs. What to Skip

The most common mistake: writing everything, making the file so long it stops being read carefully.

Write to MEMORY.md:

  • Project-specific commands, especially non-obvious ones
    • "Run npm run build:prod not npm run build — the latter overwrites staging"
  • Scripts you built and their locations
    • ".claude/scripts/check-email.py — reads Gmail unread, takes --limit flag"
  • Mistakes made once that shouldn't happen again
    • "2025-03-12: Pushed to main while on detached HEAD. Always verify branch before committing."
  • User preferences discovered through interaction, not assumed
    • "Prefers Telegram summaries over file links"
  • Patterns that took time to figure out
    • "Prisma requires explicit include for relations — no auto-eager-loading"

Read the full file on GitHub · 262 lines

Changes

What this file has done since we first saw it

Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.

  1. 4d ago First seen · 262 lines · 0 tokens per session scan B 35d6b194efbc

Subscribe to this mod's changes

agent-memory is a skill published in the GitHub repository JKHeadley/instar (77 stars, last pushed 4d ago), licensed MIT. It adds 78 tokens to every session and 1,878 once invoked, about $0.0004 per session on Opus 5. A static security scan graded it B with 1 finding (reads agent configuration directories). No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-30.

Related

Other skills, from other repositories

core-memory

Use when working with Core Memory from OpenClaw, including finalized-turn writes, memory retrieval, bridge behavior, semantic bead fields, promotion, claims, associations, or integration debugging.

JohnnyFiv3r/Core-Memory · 39 tokens

atomicmemory

Persistent semantic memory across Claude Code sessions — user preferences, project context, prior decisions, codebase facts. Call memorysearch before answering questions that reference past work. Call memoryingest after the user shares durable facts.

atomicstrata/atomicmemory · 50 tokens

atomicmemory-cli

Use the installed AtomicMemory CLI for memory search, ingestion, packaging, diagnostics, and agent-safe JSON output.

atomicstrata/atomicmemory · 26 tokens

alibabacloud-sysom-diagnosis

Use when troubleshooting Linux server performance or stability issues — CPU saturation, high load, scheduling delay, memory pressure, OOM events, high RSS, page cache / shared memory growth, memory cgroup residue, Java heap issues, disk IO saturation or latency, packet loss, network jitter, or a server that is slow…

alibaba/anolisa · 93 tokens

honcho

Configure and use Honcho memory with Zorro -- cross-session user modeling, multi-profile peer isolation, observation config, and dialectic reasoning. Use when setting up Honcho, troubleshooting memory, managing profiles with Honcho peers, or tuning observation and recall settings.

braxtonROSE4/zorro-agent · 55 tokens

openclaw-migration

Migrate a user's OpenClaw customization footprint into Zorro Agent. Imports Zorro-compatible memories, SOUL.md, command allowlists, user skills, and selected workspace assets from /.openclaw, then reports exactly what could not be migrated and why.

braxtonROSE4/zorro-agent · 58 tokens