loop-worktree

A coding workflow command that gives each work unit its own Git worktree, an isolated working directory connected to a branch. It can create these workers and later bring their completed work back together.

In plain words
What is it for?
Use it to split a rubric into independent tasks, start isolated workers for those tasks, and integrate their finished changes.
Why use it?
It keeps independent changes separated while several tasks are worked on at the same time, reducing conflicts between branches.

Skill for Claude CodeCodex

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 skills/hhamja/claude-code-harness/loop-worktree
Any agent
npx skills add hhamja/claude-code-harness --skill loop-worktree
Clone the repo
git clone --depth 1 https://github.com/hhamja/claude-code-harness

Made for: Claude Code, Codex.

Per session 20 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 786 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.00020 $0.00786
Opus 5 $0.00010 $0.00393
Sonnet 5 $0.00004 $0.00157
Haiku 4.5 $0.00002 $0.00079

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

Security

Grade A, and why

loop-worktree 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.

skills/loop-worktree/SKILL.md · 38 lines

How it starts

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

loop-worktree — isolated parallel workers (spawn / integrate)

Implements the loop-engineering skill's references/worktree-guide.md: one work unit = one worktree = one branch. Parallelize ONLY file-disjoint rubric subsets — tasks touching the same files are NOT independent; run those serially in this tree. N worktrees ≈ N× token spend: justify with wall-clock need, not tidiness.

Arguments ($ARGUMENTS): <task> [R# ...] = spawn a worker. --integrate <task> [<task> ...] = fold finished workers back.

Spawn

Requires .claude/loop/ (else: run /loopy:loop-init first, stop).

  1. Verify every requested R# exists in rubric.md, and that this subset's implementation files are disjoint from every other planned/live task. Overlap → do not spawn; say why.
  2. git worktree add ../<repo>-<task> -b <type>/<task> — cut from the current work branch, never a protected one.
  3. Scaffold the worker's .claude/loop/ in the new worktree:
    • rubric.md: ONLY the requested R# lines, verify: commands byte-identical.
    • goal.md: one line describing the subset.
    • loop.config.md: copy of this tree's, then set worker: <task>, branch: <type>/<task>, auto_push: false, auto_pr: false — workers never push or open PRs; the orchestrator integrates locally.
    • state.md, memory.md, review.md: fresh from loop-init templates.
  4. Report the worktree path, branch, and next step: open a NEW session in that directory and run /loopy:loop-run. Each worktree has its own index/HEAD, so loop_lock and branch_guard are satisfied independently.

Worker contract (auto_commit's worker mode enforces the commit side): a worker commits its source changes plus .claude/loop/results/<task>.md ONLY — nothing else under .claude/loop/ (its local state.md, subset rubric/goal, and worker config stay uncommitted, so integrating the branch cannot overwrite the orchestrator's loop files). results/<task>.md records: subset criteria pass/fail, files touched, unresolved items.

Read the full file on GitHub · 38 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 · 38 lines · 20 tokens per session scan A a448203ac2ef

Subscribe to this mod's changes

loop-worktree is a skill published in the GitHub repository hhamja/claude-code-harness (1 stars, last pushed 1mo ago), licensed MIT. It adds 20 tokens to every session and 786 once invoked, about $0.0001 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.

Related

Other skills, from other repositories