Now liveThe Skillselion MCP - thousands of ranked skills, loaded into your agent mid-task. No install.Get it →
aojdevstudio avatar

Harness Worktrees

  • 1 installs
  • 1 repo stars
  • Updated July 30, 2026
  • aojdevstudio/agentic-utilities

Harness-worktrees is a Claude Code skill that resets a parallel git worktree to latest origin/main while keeping its branch identity.

About

Harness-worktrees is a Claude Code skill for maintaining Superconductor/pi parallel git worktrees. A developer uses it to reset, refresh, or sync the current worktree to latest origin/main after a PR merges, without switching to main. Its 'Mode C' fetches origin and resets the current branch to origin/main while preserving the worktree's branch identity, and it refuses dirty worktrees unless stashing is requested.

  • 'Mode C' resets the current worktree to origin/main while preserving its branch identity
  • Refuses dirty worktrees unless --stash is passed
  • Avoids git switch main because main may be checked out in another worktree

Harness Worktrees by the numbers

  • 1 all-time installs (skills.sh)
  • Ranked #527 of 733 Git & Pull Requests skills by installs in the Skillselion catalog
  • Data as of Jul 31, 2026 (Skillselion catalog sync)
At a glance

harness-worktrees capabilities & compatibility

Capabilities
harness worktrees · gitworkflow
Use cases
ci cd
From the docs

What harness-worktrees says it does

Manage Superconductor/pi parallel git worktrees.
SKILL.md
The reset script refuses dirty worktrees unless `--stash` is passed.
SKILL.md
npx skills add https://github.com/aojdevstudio/agentic-utilities --skill harness-worktrees

Add your badge

Show developers this skill is listed on Skillselion. Paste this into your README.

Listed on Skillselion
Installs1
repo stars1
Last updatedJuly 30, 2026
Repositoryaojdevstudio/agentic-utilities

What it does

Reset the current git worktree to latest origin/main after a PR merges without switching to main.

Who is it for?

Getting a per-harness worktree current with main after a PR merges.

Skip if: Single-worktree repos where git switch main and pull works fine.

When should I use this skill?

The user says 'mode C', 'get current with main', or 'reset this worktree to main'.

What you get

The current branch points at latest origin/main with ahead 0, behind 0, and a clean worktree.

By the numbers

  • single reset-worktree-to-main.sh script
  • requires --stash for dirty worktrees

Files

SKILL.mdMarkdownGitHub ↗

Harness Worktrees for Pi

Pi-native worktree maintenance for repos that use one git worktree per coding harness.

Mode C: get this worktree current with main

When the user says any of these, treat it as an explicit instruction to make the current worktree match latest origin/main:

  • "mode C"
  • "get current with me"
  • "get this worktree current"
  • "reset this worktree to main"
  • "refresh this worktree from main"
  • "sync this worktree with latest main"
  • "after merge, make this worktree current"
  • "update this worktree after my PR merged"

Do not only acknowledge. Do not stop at dry-run. Do not ask for another confirmation for a clean worktree, even if the branch is ahead or behind.

Run the reset directly:

~/.pi/agent/skills/harness-worktrees/scripts/reset-worktree-to-main.sh --confirm

Then verify sync:

~/.pi/agent/skills/harness-worktrees/scripts/reset-worktree-to-main.sh

Report only the useful facts: branch, HEAD, ahead count, behind count, dirty status.

Status-only check

If the user asks whether the worktree is behind, ahead, dirty, or in sync — without asking to get current — run dry-run only:

~/.pi/agent/skills/harness-worktrees/scripts/reset-worktree-to-main.sh

Why this is not git switch main && git pull

In a multi-worktree setup, main may already be checked out in another worktree. git switch main can fail or violate ownership expectations.

The safe operation is:

1. stay on the current worktree branch; 2. fetch origin; 3. reset the current branch to origin/main.

This makes the worktree contents match latest main while preserving the worktree's branch identity.

Dirty worktrees

The reset script refuses dirty worktrees unless --stash is passed.

For normal Mode C, run --confirm first. If it aborts because the worktree is dirty, report the dirty files and ask whether to preserve them with:

~/.pi/agent/skills/harness-worktrees/scripts/reset-worktree-to-main.sh --confirm --stash

Only use --stash when the user explicitly asks to preserve/stash local changes.

Safety rules

  • Do not switch to main.
  • Do not force-push.
  • Do not delete branches.
  • Do not run git reset --hard manually for this workflow; use the script.
  • For Mode C / get-current requests on a clean worktree, execute --confirm immediately.
  • Refuse dirty worktrees unless the user explicitly asks to stash.
  • Branch-local commits may be discarded by Mode C; that is expected when the user explicitly asks to get current with main.

Expected result

The current branch points at latest origin/main; ahead is 0, behind is 0, and the worktree is clean.

Related skills

This week in AI coding

Five minutes, every Monday - the tools, releases and tactics for developers.

unsubscribe anytime.