memory-sync

A command that promotes a lasting lesson from an agent run into one appropriate place: repository notes, a CLAUDE.md file, or reference documentation. It is designed to keep shared guidance organised without copying the same lesson everywhere.

In plain words
What is it for?
Use it after an agent records a significant reusable lesson in its memory files. It helps publish that lesson for other agents or make it a canonical repository rule.
Why use it?
It prevents useful findings from being lost while also reducing duplicated instructions that can later disagree. The command chooses the appropriate level for a lesson's scope.

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/chris-dare-dev/agent-kit/memory-sync
Clone the repo
git clone --depth 1 https://github.com/chris-dare-dev/agent-kit
Per session 143 Only the description is in the session, so the agent can decide to use it. The body loads when it is invoked.
When invoked 1,255 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.00143 $0.01255
Opus 5 $0.00072 $0.00628
Sonnet 5 $0.00029 $0.00251
Haiku 4.5 $0.00014 $0.00126

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

Security

Grade A, and why

memory-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.

data/commands/memory-sync.md · 79 lines

How it starts

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

/memory-sync — promote a memory lesson to the right tier

Routes one durable learning to a SINGLE canonical tier per the memory-write protocol (full model: get_reference("agent-memory") → "The wiki tier" + "memory-write protocol"). It does NOT duplicate the same content across tiers — that is the drift trap the capability-scout internal-adversary warned about. Pick the lowest altitude that fits.

When to use / when NOT to

Use /memory-sync Don't
An agent captured a significant, durable lesson in .claude/agent-memory/<agent>/lessons.md that is useful beyond that one agent/run Routine per-run calibration — leave it in lessons.md
You want a repo finding visible to other agents/humans (wiki) or made canonical (CLAUDE.md) Re-recording something already in CLAUDE.md / data/references (dedupe instead)

The tiers (pick ONE)

  • wiki (default) — cross-agent, repo-scoped, human-browsable. Written to the repo's Field Notes via the gated append_repo_field_note MCP tool.
  • claude-md — a canonical invariant/decision for the repo. Edit platform/source/<repo>/CLAUDE.md (Decision Records / Pitfalls).
  • references — applies across repos. Edit data/references/*.md (queryable via search_platform_knowledge).

Steps (run in the main thread)

  1. Parse <repo>, the lesson text, optional --tier / --agent. If --tier is absent, classify: cross-agent-but-repo-scoped → wiki; durable repo invariant → claude-md; cross-repo → references. If genuinely ambiguous, ask the user.
  2. Dedupe FIRST (on-demand, token-safe — never eager-load):
    • wiki → search_repo_wiki({repo, query: <key terms>})
    • claude-md → grep platform/source/<repo>/CLAUDE.md
    • references → search_platform_knowledge(<key terms>) If a near-duplicate exists, update it in place (or skip) — do NOT append a duplicate.
  3. Route + gate:
    • wiki: call append_repo_field_note({repo, entry, agent, dry_run: true}) → show the returned preview + confirm_token to the USER → on explicit approval, call again with confirm_token + identical args to write. Sub-agents cannot self-approve; the human approves the preview (External Write Policy).
    • claude-md: dispatch the context-curator agent to draft the CLAUDE.md edit; present the diff; on approval commit and push it directly to the trunk (main). Create an MR only when Chris explicitly requests a review gate.
    • references: draft the data/references/ edit; present the diff; commit and push it directly to the trunk (main) after authorization. (Per the workspace "Sharing changes" rule, a data/ change is only live for the team once it reaches main.)
  4. Back-pointer: annotate the source lessons.md entry with the promotion, e.g. (promoted → wiki Field Notes 2026-06-06), so the same lesson is not re-promoted.

Read the full file on GitHub · 79 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. yesterday First seen · 79 lines · 143 tokens per session scan A 4687dec1ed26

Subscribe to this mod's changes

memory-sync is a command published in the GitHub repository chris-dare-dev/agent-kit (0 stars, last pushed 24d ago), licensed MIT. It adds 143 tokens to every session and 1,255 once invoked, about $0.0007 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-31.