sync

A command for re-synchronizing a project that has already been initialized in a studio workspace. It updates the managed part of the Git ignore file and checks that symbolic links point into the correct workspace.

In plain words
What is it for?
Use it after updating studio settings, pulling changes to studio.yaml, or checking whether Git ignore rules and symbolic links still match the workspace.
Why use it?
It fixes configuration drift after workspace settings change or a Git ignore file is altered. It does not move project files or change workspace contents, and it supports a dry run.

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/koolamusic/claudefiles/sync
Clone the repo
git clone --depth 1 https://github.com/koolamusic/claudefiles
Per session 71 Only the description is in the session, so the agent can decide to use it. The body loads when it is invoked.
When invoked 3,274 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.00071 $0.03274
Opus 5 $0.00036 $0.01637
Sonnet 5 $0.00014 $0.00655
Haiku 4.5 $0.00007 $0.00327

Measured 2d ago against content hash d9329c8b8f94, 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/studio/commands/sync.md · 133 lines

How it starts

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

Re-sync the current project against its studio workspace. Unlike /studio:setup, this command assumes initialization has already happened — it re-applies the managed gitignore block and validates symlinks, but never moves project state. Run after pulling studio.yaml changes from the plugin, or when the project's .gitignore has drifted.

Optional flags:

  • --dry-run — print every command that would run; exit 0 with no side effects (no file writes, no commits).
  • --message <msg> — override the default commit message used when the managed gitignore block is updated. Does not change workspace-side commit message.

Memory archival (optional)

This section runs BEFORE the main step sequence below. It archives the current Claude project memory snapshot into the studio workspace. All sub-steps are gated by memory.enabled in studio.yaml — if disabled, the entire section skips silently and control flows straight to the main Steps below. Under --dry-run, every mutating sub-step (mkdir, cp, git add/commit) prints instead of executing.

Resolve WORKSPACE first (same as step 3 below): PROJECT_ROOT=$(git rev-parse --show-toplevel); read .workspacerc; expand leading ~. All sub-steps in this section assume $WORKSPACE is set.

  1. Read studio.yaml memory config. Resolve the studio config path the same way the main Steps do — but for memory archival we read from the workspace-local studio.yaml (copied there at /studio:setup time). Run:

    MEMORY_ENABLED=$(yq eval '.memory.enabled // false' "${WORKSPACE}/studio.yaml")
    

    If MEMORY_ENABLED is false or the key is missing (yq returns false for a missing path thanks to the // false default), print [studio] memory archival disabled; skipping. to stderr and jump to the main Steps section below. No exit code, no side effect.

  2. Resolve source path via PROJECT_HASH expansion. Capture the raw source template from studio.yaml and expand ${PROJECT_HASH} inline. ${PROJECT_HASH} is expanded by this command, not by Claude Code's plugin loader. The two-stage sed pipeline is load-bearing — it mirrors the directory-naming convention Claude Code uses under ~/.claude/projects/:

    RAW_SOURCE=$(yq eval '.memory.source' "${WORKSPACE}/studio.yaml")
    PROJECT_HASH=$(pwd | sed 's|/|-|g' | sed 's|\.|-|g')
    MEMORY_SOURCE="${RAW_SOURCE//\$\{PROJECT_HASH\}/$PROJECT_HASH}"
    # expand leading ~ to $HOME
    MEMORY_SOURCE="${MEMORY_SOURCE/#\~/$HOME}"
    

    If [[ ! -d "$MEMORY_SOURCE" ]], print [studio] no memory dir at $MEMORY_SOURCE; skipping archival. to stderr and jump to the main Steps section below. No exit code, no side effect.

  3. Build archive target from hostname + iso. Read memory.archive_dir (default memory/archive) and memory.path_template (default {hostname}/{iso}) from studio.yaml:

    archive_dir=$(yq eval '.memory.archive_dir // "memory/archive"' "${WORKSPACE}/studio.yaml")
    path_template=$(yq eval '.memory.path_template // "{hostname}/{iso}"' "${WORKSPACE}/studio.yaml")
    HOSTNAME_SHORT=$(hostname -s)
    ISO=$(date -u +%Y-%m-%dT%H-%M-%SZ)
    REL_PATH=$(echo "$path_template" | sed "s|{hostname}|$HOSTNAME_SHORT|g; s|{iso}|$ISO|g")
    ARCHIVE_TARGET="${WORKSPACE}/${archive_dir}/${REL_PATH}"
    

    Append-only guard. If [[ -e "$ARCHIVE_TARGET" ]], abort with [studio] archive target already exists: $ARCHIVE_TARGET — this violates append-only; aborting. and exit 1. This should be impossible given the second-resolution iso stamp, but the check is cheap and the invariant is load-bearing.

  4. Create and copy. Create the target directory and copy the full memory tree:

    mkdir -p "$ARCHIVE_TARGET"
    cp -R "$MEMORY_SOURCE/." "$ARCHIVE_TARGET/"
    

    Every file under $MEMORY_SOURCE is preserved, including MEMORY.md and any nested references.

  5. Report. Print the archive location and file count. Use a shell fallback for the relative path (avoids GNU-only realpath --relative-to):

    REL_OUT="${ARCHIVE_TARGET#$WORKSPACE/}"
    N=$(find "$ARCHIVE_TARGET" -type f | wc -l | tr -d ' ')
    echo "[studio] memory archived: $REL_OUT ($N files)"
    

Read the full file on GitHub · 133 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 · 133 lines · 0 tokens per session scan A d9329c8b8f94

Subscribe to this mod's changes

sync is a command published in the GitHub repository koolamusic/claudefiles (132 stars, last pushed 3d ago), licensed MIT. It adds 71 tokens to every session and 3,274 once invoked, about $0.0004 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.