sync-setup

A command that synchronizes the live Claude Code configuration into a repository. It copies generated files, removes private sections, cleans stale files, updates documentation counts, and checks for leaks or unsafe overwrites.

In plain words
What is it for?
Use it to publish updated commands, agents, skills, hooks, and scripts from the live configuration into the setup repository.
Why use it?
It keeps the published repository aligned with the live configuration while protecting private content and detecting hand-edited generated files.

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/w2ur/claude-code-setup/sync-setup
Clone the repo
git clone --depth 1 https://github.com/w2ur/claude-code-setup
Per session 51 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,587 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.00051 $0.01587
Opus 5 $0.00026 $0.00794
Sonnet 5 $0.00010 $0.00317
Haiku 4.5 $0.00005 $0.00159

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

Security

Grade A, and why

sync-setup 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-setup.md · 119 lines

How it starts

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

Sync the claude-code-setup repo from the live ~/.claude/ configuration.

The rule that governs every step below

The arrow only points one way: ~/.claude/ → the repo. Everything under commands/, agents/, skills/, hooks/ and claude-scripts/ is generated, so fixing something by editing the repo's copy accomplishes nothing — the next sync reverts it, and until 2026-08-23 it did so silently. sync.py now refuses (exit 2) when a destination matches neither the incoming content nor HEAD, which is what a hand edit looks like; --allow-dirty discards them on purpose.

The same applies to the SYNC-PRIVATE markers (the BEGIN / END pair), which drop a private section from the published copy: they belong in the live file, never in the repo. Every run reports how many regions it removed and from where — if that count drops unexpectedly, a marker was lost in an edit to the live source. Note this file deliberately never spells the pair out contiguously: it is a sync SOURCE, so a literal marker here would be read as a real one. scripts/README.md in the repo is owner-maintained, never synced, and carries the full syntax.

Owner-maintained files are the exception and are never synced: README.md, docs/, hooks/README.md, claude-scripts/README.md, root-level files.

Step 1: Run sync.py

cd ~/Dev/claude-code-setup && ./scripts/sync.py $0

If $0 is --dry-run or --audit-only, stop after this step.

If it exits 2 refusing to overwrite hand edits, do not reach for --allow-dirty first. Read the named files: the change they carry is usually one that belongs in ~/.claude/, and porting it there is the fix.

Step 2: Verify stale-file cleanup

sync.py now prunes orphans automatically: any file under a synced root (commands/, agents/, skills/, hooks/, claude-scripts/) whose live source has disappeared is deleted on a real run (reported on --dry-run) and listed under the ── Orphans ── section of the output. Common cases: renamed agents (e.g., old architect.md after rename to troubleshooter.md), deleted commands, removed skills, retired hooks.

Read the full file on GitHub · 119 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 · 119 lines · 51 tokens per session scan A 2e333f18fb70

Subscribe to this mod's changes

sync-setup is a command published in the GitHub repository w2ur/claude-code-setup (2 stars, last pushed 9d ago), licensed MIT. It adds 51 tokens to every session and 1,587 once invoked, about $0.0003 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.