core/skills/sw-sync/SKILL.md
Syncs the local repository by fetching all remotes, updating the base branch, and removing stale local branches that are not protected by live sessions or helper worktrees.
npx skillsauth add obsidian-owl/specwright sw-syncInstall this skill globally with one command. Works with Claude Code, Cursor, and Windsurf.
3 of 9 scanners reported clean
Some scanners were skipped, did not run, or reported a non-clean status. Review each row below.
Keep the local repository current without deleting branches that are still claimed by a live Specwright session or a subordinate helper worktree.
{projectArtifactsRoot}/config.json{worktreeStateRoot}/session.json{repoStateRoot}/work/*/workflow.jsongit worktree list --porcelainsw-sync may report stale active works against
their recorded targets and latest known freshness state.sw-sync never rebases, merges, retargets, or clears a freshness block on
behalf of sw-build, sw-verify, or sw-ship.Fetch (HIGH freedom):
git fetch --all --prune.State-aware protection set (LOW freedom):
session.json files across git worktree listworkflow.json.branchworktree-* and specwright-wt-*git worktree list --porcelain
as protected branch owners even when they are not user-facing sessions.Stale branch detection (HIGH freedom):
git branch -vv entries with [gone]git branch --merged against the configured base branchsafe-delete for branches that should still use git branch -dforce-delete-candidate for [gone] branches only when they are not protected,
not invalid, and not claimed by a live session or subordinate helper worktreeSafety checks (LOW freedom):
git check-ref-format --branch before
passing it to shell commands.-, contain shell metacharacters or control
whitespace, or fail ref-format validation.--.config.git.cleanupBranch is false, skip deletion entirely and say so.Confirmation (LOW freedom):
protocols/headless.md.git branch -d as the default delete path.git branch -D only for a force-delete-candidate.force-delete-candidate requires an explicit second confirmation before
running git branch -D.git branch -D for merged-only, protected, invalid, or
live-session-owned branches.Base branch sync (MEDIUM freedom):
--ff-only.--ff-only reports divergence, warn and continue without creating a merge
commit.No state mutation (LOW freedom):
sw-sync never writes Specwright state.protocols/git.md -- branch lifecycle and cleanup rulesprotocols/git-freshness.md -- freshness result shape and status semantics for advisory reportingprotocols/context.md -- logical roots and session loadingprotocols/state.md -- per-work workflow fields used for protectionprotocols/headless.md -- non-interactive behavior| Condition | Action |
|---|---|
| no remotes configured | stop with a remote-setup error |
| git fetch fails | surface the error and skip deletion |
| no stale branch candidates | report that nothing is deletable |
| worktree/session inspection fails | skip deletion and warn |
| current session's attached work is building or verifying | abort and tell the user to finish or reset that work first |
| base branch cannot fast-forward | warn and continue without merging or resetting |
testing
Explicitly adopt an existing work into the current worktree after validating live ownership, stale sessions, and branch consistency.
testing
Orchestrates quality gates for the current work unit. Runs enabled gates in dependency order, produces an aggregate evidence report with gate handoff.
data-ai
Shows current Specwright state for this worktree, the attached work, repo-wide active works, gate results, and lock status. Supports --reset, --cleanup, and --repair {unitId}.
tools
Ships the current work unit. Verifies all gates passed, creates a PR with evidence-mapped body, updates workflow state to shipped.