agent-memory-implementation

agent-memory-implementation is a skill for Claude Code, Codex from simbajigege/book2skills. It costs 129 tokens per session (2,179 once invoked), scanned A, original, MIT.

A tool for reorganizing a large MEMORY.md file into a small index and separate topic files. MEMORY.md is a file that stores information an agent should remember between conversations.

In plain words
What is it for?
Use it to split knowledge into easy-to-find topic files and remove or correct memories that are no longer true.
Why use it?
It prevents the always-loaded memory file from becoming too long, cluttered, or filled with outdated information.

Skill for Claude CodeCodex

Written for no agent in particular: nothing here depends on one. Also seen: mentions subagents; mentions Claude Code.

Good fit Use it to split knowledge into easy-to-find topic files and remove or correct memories that are no longer true.

Compare 6 skills from other repositories ↓
Install with agentmods
npx agentmods add skills/simbajigege/book2skills/agent-memory-implementation
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.

Any agent
npx skills add simbajigege/book2skills --skill agent-memory-implementation
Clone the repo
git clone --depth 1 https://github.com/simbajigege/book2skills

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-implementation

README.md
[![agentmods](https://agentmods.dev/badge/skills/simbajigege/book2skills/agent-memory-implementation.svg)](https://agentmods.dev/skills/simbajigege/book2skills/agent-memory-implementation)
Your own site
<a href="https://agentmods.dev/skills/simbajigege/book2skills/agent-memory-implementation"><img src="https://agentmods.dev/badge/skills/simbajigege/book2skills/agent-memory-implementation.svg" alt="Measured on agentmods" height="20"></a>
Per session 129 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 2,179 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. A grade says what 26 rules found in the file — not that it is safe. Third-party audits
  • NVIDIA SkillSpector pass 7 Sept 2026
How audits are shown
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.1 $0.00129 $0.02179
Opus 5 $0.00064 $0.01090
Sonnet 5 $0.00026 $0.00436
Haiku 4.5 $0.00013 $0.00218

Measured 8d ago against content hash ee9c772df586, method: parsed. Prices are Anthropic first-party input rates as of 2026-09-08, from the pricing page.

Security

Grade A, and why

agent-memory-implementation scanned grade A with 0 findings 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 8d ago.

The scan reads SKILL.md. This mod also ships 1 executable file (scripts/memory_audit.py), listed below but not scanned — reading those needs a real analyzer, not pattern matching.

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.

Nothing flagged

None of the 26 patterns this scan looks for appear in this file: no shell pipes, no recursive deletes, no credential paths, no hidden text, no instruction-override or anti-refusal phrasing, no agent-config snooping. That is not a guarantee, it is the absence of the things that are checkable.

skills/agent-memory-implementation/SKILL.md · 186 lines

How it starts

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

memory-architect

Restructures memory files into the 2-layer architecture that Claude Code's autoDream service uses internally — designed to keep the always-loaded index small while making deeper knowledge accessible on demand.

The 2-Layer Architecture

Claude Code's memory system (services/autoDream/) uses this structure:

MEMORY.md          ← Layer 1: Always loaded, pointer-only index (~200 lines max)
├── topic-file.md  ← Layer 2: Domain knowledge, loaded when relevant
└── another-topic.md

Layer 1 — MEMORY.md index: Loaded into every conversation. Must stay under ~200 lines (lines beyond 200 get truncated). Each entry is a one-line pointer: - [Title](file.md) — one-line hook. No content, just pointers. This is what Claude scans to decide what to load.

Layer 2 — Topic files: Contain the actual knowledge. Claude loads these on demand when their pointer appears relevant. Can be as long as needed. Each file has YAML frontmatter with name, description, and type.

No archive layer: The autoDream system does not maintain an archive directory. Stale, superseded, or contradicted memories are deleted or corrected in place (see consolidationPrompt.ts Phase 3–4). The memory directory is always the current truth, not a history log.

How Claude Code Writes Memories Automatically

Understanding the auto-extraction pipeline helps you restructure files in a way that works with the system rather than against it.

The extraction forked agent

At the end of every query loop (when the model returns a final response with no pending tool calls), Claude Code fires a forked agent in the background via executeExtractMemories() in services/extractMemories/extractMemories.ts. This agent:

  1. Receives the last N user/assistant messages as context
  2. Scans the memory directory for existing files (reads only frontmatter — the description field is the primary signal)
  3. Decides what is worth saving from this conversation
  4. Writes or updates .md files inside the memory directory, then updates MEMORY.md

Read the full file on GitHub · 186 lines

Files

What ships with it

4 files beside SKILL.md in the same directory: the scripts, references and assets a skill reads on demand. Not counted in the per-session cost; read them before you install if any of them is executable.

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. 8d ago First seen · 186 lines · 129 tokens per session scan A ee9c772df586

Subscribe to this mod's changes

agent-memory-implementation is a skill published in the GitHub repository simbajigege/book2skills (160 stars, last pushed 13d ago), licensed MIT. It adds 129 tokens to every session and 2,179 once invoked, about $0.0006 per session on Opus 5. A static security scan graded it A with 0 findings. 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

crewai-multi-agent

Multi-agent orchestration framework for autonomous AI collaboration. Use when building teams of specialized agents working together on complex tasks, when you need role-based agent collaboration with memory, or for production workflows requiring sequential/hierarchical execution. Built without LangChain dependencies…

davila7/claude-code-templates · 61 tokens

langchain

Framework for building LLM-powered applications with agents, chains, and RAG. Supports multiple providers (OpenAI, Anthropic, Google), 500+ integrations, ReAct agents, tool calling, memory management, and vector store retrieval. Use for building chatbots, question-answering systems, autonomous agents, or RAG…

davila7/claude-code-templates · 79 tokens

memory-search

Search conversation history and semantic memory to recall previous discussions, decisions, and context. Use when the user asks to "search memory", "what did we discuss", "remember when", "find previous conversation", "check history", or before starting work to recall prior decisions.

davila7/claude-code-templates · 57 tokens

agent-memory-mcp

A hybrid memory system that provides persistent, searchable knowledge management for AI agents (Architecture, Patterns, Decisions).

davila7/claude-code-templates · 26 tokens

agent-memory-systems

Memory is the cornerstone of intelligent agents. Without it, every interaction starts from zero. This skill covers the architecture of agent memory: short-term (context window), long-term (vector stores), and the cognitive architectures that organize them. Key insight: Memory isn't just storage - it's retrieval. A…

davila7/claude-code-templates · 100 tokens

conversation-memory

Persistent memory systems for LLM conversations including short-term, long-term, and entity-based memory Use when: conversation memory, remember, memory persistence, long-term memory, chat history.

davila7/claude-code-templates · 39 tokens