sync

A command for updating CLAUDE.md after manual file changes are detected through Git, a tool for tracking code changes.

In plain words
What is it for?
Checking a Git repository for changed files, filtering excluded files, and incrementally updating the project’s CLAUDE.md memory.
Why use it?
It keeps the project’s guidance file aligned with changes made outside Claude Code and reports when no changes need syncing.

Command

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 commands/severity1/claude-code-auto-memory/sync
Clone the repo
git clone --depth 1 https://github.com/severity1/claude-code-auto-memory
Per session 12 Only the description is in the session, so the agent can decide to use it. The body loads when it is invoked.
When invoked 419 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.00012 $0.00419
Opus 5 $0.00006 $0.00210
Sonnet 5 $0.00002 $0.00084
Haiku 4.5 $0.00001 $0.00042

Measured yesterday against content hash 672d2837eb3f, method: parsed. Prices are Anthropic first-party input rates as of 2026-08-30, from the pricing page.

Security

Grade A, and why

sync 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 yesterday.

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.

commands/sync.md · 41 lines

What it actually says

Detect files changed outside Claude Code and update CLAUDE.md incrementally.

Use this when you've edited files manually (outside Claude Code) and want to update CLAUDE.md without a full recalibration.

Workflow

  1. Check if git repo: Run git rev-parse --is-inside-work-tree

    • If not a git repo: Report error and suggest /auto-memory:calibrate instead
  2. Detect changed files using git:

    git diff --name-only HEAD                    # Modified tracked files
    git diff --cached --name-only                # Staged files
    git ls-files --others --exclude-standard     # New untracked files
    
  3. Filter files (exclude from processing):

    • Files in .claude/ directory
    • Memory files: read memoryFiles from .claude/auto-memory/config.json (default ["CLAUDE.md"]) and exclude any file whose name appears in that list
    • Files outside project directory
  4. If no changes detected: Report "Already in sync - no manual changes found"

  5. If changes found:

    • Convert paths to absolute paths
    • Write to .claude/auto-memory/dirty-files (one path per line, or dirty-files-{session_id} if session_id is available from the environment)
    • Use the Task tool to spawn the memory-updater agent with prompt: "Update [active memory file] for manually changed files: [file list]" (use AGENTS.md or CLAUDE.md per the memoryFiles config)
  6. Report summary: List files that were processed

Notes

  • Requires a git repository for change detection
  • For non-git projects or full recalibration, use /auto-memory:calibrate instead
  • The memory-updater agent handles the actual CLAUDE.md updates
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. yesterday First seen · 41 lines · 12 tokens per session scan A 672d2837eb3f

Subscribe to this mod's changes

sync is a command published in the GitHub repository severity1/claude-code-auto-memory (157 stars, last pushed 4mo ago), licensed MIT. It adds 12 tokens to every session and 419 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.