sync

sync is a command for Claude Code from zhangfengcdt/memoir. It costs 12 tokens per session (2,016 once invoked), scanned A, original, Apache-2.0.

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 for Claude Code

Written for Claude Code: allowed-tools in frontmatter. Also seen: names the AskUserQuestion tool.

Runs only inside its plugin — its command needs a path that Claude Code sets for a plugin’s own hooks and for nothing else. Install the plugin, not this.

Part of the memoir plugin — 2 skills, 8 commands, 4 hooks shipped together

Good fit 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.

Compare 6 commands from other repositories ↓
Install

Getting it into your agent

This one installs as part of its plugin. Adding the marketplace and installing the plugin brings it with everything else the plugin ships.

Claude Code
/plugin marketplace add zhangfengcdt/memoir
Claude Code
/plugin install memoir

Made for: Claude Code.

Or install memoir, the plugin that ships this one along with the rest of its 2 skills, 8 commands, 4 hooks.

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 sync

README.md
[![agentmods](https://agentmods.dev/badge/commands/zhangfengcdt/memoir/sync/github.svg)](https://agentmods.dev/commands/zhangfengcdt/memoir/sync)
Your own site
<a href="https://agentmods.dev/commands/zhangfengcdt/memoir/sync"><img src="https://agentmods.dev/badge/commands/zhangfengcdt/memoir/sync/github.svg" alt="Measured on agentmods" height="20"></a>

Or the 80×15 button, for a site that already has a row of RSS and ATOM ones. Only the verdict fits; the numbers stay here.

agentmods 80×15 button for sync

Your own site · 80×15
<a href="https://agentmods.dev/commands/zhangfengcdt/memoir/sync"><img src="https://agentmods.dev/badge/commands/zhangfengcdt/memoir/sync.svg" alt="Reviewed on agentmods" width="80" height="20"></a>
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. A grade says what 26 rules found in the file — not that it is safe.
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.00012 $0.02016
Opus 5.5 $0.00005 $0.00806
Sonnet 5.5 $0.00002 $0.00403
Haiku 4.5 $0.00001 $0.00202

Measured 1mo ago against content hash d78a7a4a860f, method: parsed. Prices are Anthropic first-party input rates as of 2026-10-07, 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 1mo 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 branches → Step 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. 1mo 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 (625 stars, last pushed today), licensed Apache-2.0. It adds 12 tokens to every session and 2,016 once invoked, about $0.0000 per session on Opus 5.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.