sync

An interactive command for reviewing memoir branches that have not been merged into the main Git branch. It can help choose which branches to promote and which to ignore or review later.

In plain words
What is it for?
Use it to list unmerged memoir branches, validate branch names, and promote selected branches into main. It also reports when branches are ignored or stale.
Why use it?
It gives you a guided way to sort unfinished branches instead of checking each branch manually. It also identifies stale branches and handles named branches supplied by the user.

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/zhangfengcdt/memoir/sync
Clone the repo
git clone --depth 1 https://github.com/zhangfengcdt/memoir
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 2,016 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.02016
Opus 5 $0.00006 $0.01008
Sonnet 5 $0.00002 $0.00403
Haiku 4.5 $0.00001 $0.00202

Measured 2d ago against content hash d78a7a4a860f, 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 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.

plugins/claude-code/commands/sync.md · 98 lines

How it starts

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

Guide the user through promoting unmerged memoir branches into main. Current state (JSON from the backing script — unmerged is sorted most-recent-first):

!bash "${CLAUDE_PLUGIN_ROOT}/scripts/sync-cmd.sh" list 2>&1

Arguments passed by the user (may be empty): $ARGUMENTS

Step 0 — Triage the state above

  • If the script output starts with ERROR: (or is not JSON): reply [mode=error] plus the error/install hint on the next line. Stop.
  • If $ARGUMENTS is non-empty: treat each whitespace-separated token as a branch name. Validate each against the unmerged list — warn about and skip unknown names. Jump straight to Step 3 with the valid ones (no questions). Power-user fast path.
  • If unmerged is empty: say "All memoir branches are merged into main." Add, when applicable: "N branch(es) are on your ignore list (delete a line in <store>/.git/plugin-ignored-branches to unignore)" and, if snoozed_until is a future epoch, when the session-start auto-offer resumes. Note that the currently-checked-out memoir branch is never listed. Then: if stale is also empty, reply [mode=clean] and stop; if stale is non-empty, ask one question (header "Stale branches"): Clean up <N> stale memoir branchesStep 5, or Not now[mode=clean].
  • If concurrent_warning is non-empty: print it as a one-line caution before any question (merging briefly moves the store's HEAD, which can collide with another live session).

Step 1 — Ask what to do (AskUserQuestion, single-select, header "Memoir sync")

Render the branch table in the question text, one line per branch: memoir/<branch> — <ahead> commits, last capture <age_days>d ago (if more than 6 branches, show the top 6 and "… (N more)"). If stale is non-empty, append one line: "Also: N stale branch(es) can be cleaned up (option 3)."

Multiple branches — options exactly:

  1. Merge all (Recommended) — promote every listed branch into main → Step 3 with all branches.
  2. Choose branches → Step 2.
  3. Ignore, snooze, or clean up → Step 4.
  4. Not now — reply [mode=cancelled], mention /memoir:sync works any time, change nothing. Stop.

Read the full file on GitHub · 98 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 · 98 lines · 12 tokens per session scan A d78a7a4a860f

Subscribe to this mod's changes

sync is a command published in the GitHub repository zhangfengcdt/memoir (610 stars, last pushed 7d ago), licensed Apache-2.0. It adds 12 tokens to every session and 2,016 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.