Sync

From the-agency-ai/the-agency · View interactive version

Sync is an AI agent skill from the GitHub repository the-agency-ai/the-agency. Merge a target branch into the current branch and push to origin. The ONLY framework skill that pushes to a remote. Requires explicit confirmation. Never rebases. Default-actor skill (agents and captain both use it; captain for captain-* branches, agents for their worktree branches).

How to use this skill

Skill file

<!--

allowed-tools omitted — inherits Bash(*). Composes git-captain + git-safe

unsafe (flag #62/#63).

-->

sync

The framework's single authorized push path. Merges a target branch (default origin/master) into the current branch and pushes to origin. Every other push attempt is blocked by hookify (raw git push refused at the hook layer).

Name pattern: noun-verb (sync is both noun and verb by context). No actor qualifier because sync is default-actor — anyone on a non-master branch uses it.

Why this exists

Pushing is a privileged action. Without a single authorized path:

sync enforces: (a) not master, (b) clean tree, (c) single-worktree checkout, (d) confirmation before each destructive step, (e) merge not rebase. The underlying agency/tools/git-push tool adds its own layer of safety (blocks main/master, blocks bare --force).

Required reading

Before proceeding, Read the files listed in required_reading: frontmatter.

Usage

/sync                    # merge origin/master into current branch, push
/sync origin/main        # explicit target
/sync other-branch       # merge from a non-default target

Preconditions

Flow / Steps

Step 1: Safety checks

  1. Get current branch. If master, abort: "Never push directly to master. Use a PR."
  2. Verify clean working tree.
  3. Verify this branch is not checked out in another worktree (prevents dual-commit race).

Step 2: Fetch

./agency/tools/git-captain fetch

Step 3: Show what will be pushed

git log --oneline origin/<current-branch>..HEAD   # if tracking exists
git log --oneline <target>..HEAD                  # if no tracking

Captain shows commit list; principal verifies scope.

Step 4: Confirm

Prompt:

Merge <target> into <branch> and push to origin/<branch>?

Do not push without explicit confirmation.

Step 5: Merge target

git merge <target>

If conflicts: show conflict files, ask principal to resolve or abort. No auto-resolution.

Step 6: Push

./agency/tools/git-push <branch>

Never raw git push — blocked by hookify. git-push tool validates target (refuses main/master), checks force-with-lease semantics, and is the only authorized push path in the framework.

Step 7: Report

Sync complete:
  Branch: <branch>
  Pushed: N commits to origin/<branch>
  Base:   <target>

Failure modes

What this does NOT do

Explicit invocation only

Pushing is destructive and requires principal confirmation. This skill is intended to be invoked explicitly (principal/captain types /sync) rather than auto-invoked by the model. The skill's own Step 1–2 interactive confirmation is the operative gate; the paths: [] frontmatter keeps the skill out of file-path autocomplete but does not on its own block auto-invocation. If you need a hard per-skill auto-invocation block for a specific future case, disable-model-invocation: true is available per-skill (see REFERENCE-SKILL-CONVENTIONS.md §1).

Status

active (v2, refactored in-place from legacy sync 2026-04-19; name unchanged).

Related

OFFENDERS WILL BE FED TO THE — CUTE — ATTACK KITTENS!

Use this skill with your AI agent: Open on Skill Issue to copy, download, or add to your library. Works with Claude, ChatGPT, Gemini, Cursor, Windsurf and more.