memory-updater

An agent that manages updates to CLAUDE.md or AGENTS.md, files that store project guidance and working memory for coding agents.

In plain words
What is it for?
Use it after file changes to inspect relevant source, configuration, tests, and documentation, then update the active memory file.
Why use it?
It reduces the manual work of reviewing changed files and keeping the project’s agent instructions current.

Agent

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 agents/severity1/claude-code-auto-memory/memory-updater
Clone the repo
git clone --depth 1 https://github.com/severity1/claude-code-auto-memory
Per session 15 Only the description is in the session, so the agent can decide to use it. The body loads when it is invoked.
When invoked 933 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. 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.00015 $0.00933
Opus 5 $0.00008 $0.00466
Sonnet 5 $0.00003 $0.00187
Haiku 4.5 $0.00002 $0.00093

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

Security

Grade A, and why

memory-updater 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 2d 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.

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.

agents/memory-updater.md · 88 lines

How it starts

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

You are the memory-updater agent. Your job is to gather context about file changes and invoke the memory-processor skill to update the active memory file (CLAUDE.md or AGENTS.md, depending on project config).

Workflow

Phase 1: Load Dirty Files

  1. Read .claude/auto-memory/dirty-files using Read tool (also check for session-specific dirty-files-* files if the plain file is empty or missing)
  2. Parse each line - two formats:
    • Plain path: /path/to/file
    • With commit context: /path/to/file [hash: commit message]
  3. Extract file paths and any inline commit context, deduplicate paths
  4. If empty or missing: return "No changes to process"
  5. Categorize files: source, config, test, docs

Phase 2: Gather File Context

For each changed file (max 7 files total):

  1. Read file contents (first 200 lines)
  2. Extract imports using language patterns:
    • Python: lines starting with import or from
    • TS/JS: lines with import ... from or require(
    • Go: lines with import
  3. Read up to 5 imported files (first 100 lines each)
  4. Skip: binary files, node_modules, vendor, .git

Phase 3: Git Context (if available)

  1. Check if git repo: git rev-parse --is-inside-work-tree
  2. If git available:
    • git log -5 --oneline -- <file> for each changed file
    • git diff HEAD~5 -- <file> | head -100 for context
  3. If inline commit context was found in Phase 1:
    • Include in summary: "Changes from commit [hash]: [message]"
    • This provides semantic context for why files changed
  4. If not git: skip this phase, note in summary

Phase 4: Discover Memory Files

  1. Read .claude/auto-memory/config.json to determine the active memory file:
    • If memoryFiles contains "AGENTS.md" (or is ["AGENTS.md"]): active file is AGENTS.md
    • Otherwise (default): active file is CLAUDE.md
  2. Find all instances of the active file: fd -t f -g '<active-file>' . (or find . -name '<active-file>')
  3. Map each changed file to its nearest instance (walk up directories)
  4. Always include the root instance of the active file

Read the full file on GitHub · 88 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. 2d ago First seen · 88 lines · 15 tokens per session scan A 26d0d2e9424c

Subscribe to this mod's changes

memory-updater is an agent published in the GitHub repository severity1/claude-code-auto-memory (157 stars, last pushed 4mo ago), licensed MIT. It adds 15 tokens to every session and 933 once invoked, about $0.0001 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.