Logo vun Parallel Agent Worktree Skill

Parallel Agent Worktree Skill

Communautéit
TheAhmadOsman
parallel-agent-worktree-skill

Plan and execute complex work with parallel CLI agent-harness workers in git worktrees. Use for task decomposition, tmux worker spawning, deterministic loops, integration, verification, changelogs, and cleanup.

Iwwersiicht

EditeurTheAhmadOsman
Repositoryparallel-agent-worktree-skill
Skill-Nummparallel-agent-worktree-skill
Stären
34
Forks
5
Matgeliwwert Fichieren
21
LizenzApache-2.0
Linken
  • Instruktiounen am Markdown-Format

    Eng SKILL.md-Datei, déi de Modell bei Bedarf luet, soudatt nëmmen Token ufalen, wann eng Ufro tatsächlech dozou passt.

  • Funktionéiert mat all LLM

    KI-Skills si reng Markdown, keen ubidderspezifesche Code. Dofir funktionéiert dëse Skill mat GPT, Claude, Gemini, Grok oder engem lokale Modell.

  • 21 matgeliwwert Dateien

    Skripten, Virlagen a Referenzen, déi de Modell beim Schaffe liese kann. D'Dateie kënnen nëmme gelies ginn a ginn ni ausgeféiert.

  • Open Source

    Vum TheAhmadOsman op GitHub verëffentlecht. Liest de Quelltext, ier Dir de Skill installéiert.

Installatioun

Installéiert de KI-Skill Parallel Agent Worktree Skill an TypingMind, fir e mat all LLM ze benotzen, oder füügt en an en anere KI-Agent an, deen SKILL.md liest.

1

An TypingMind installéieren

TypingMind installéiert e Skill direkt aus sengem GitHub-Dossier — dobäi gëtt SKILL.md gelies, d'Ressourcedateie gi gebëndelt an d'Resultat gëtt lokal gespäichert.

  1. Maacht d'App op a gitt op Plugins → Skills.
  2. Wielt „Vun GitHub installéieren“.
  3. Pecht d'URL vum Skill-Dossier hei drënner an a bestätegt.
    https://github.com/TheAhmadOsman/parallel-agent-worktree-skill/tree/main
  4. Aktivéiert de Skill an all Chat, an deem Dir e benotze wëllt.
Plugins → Skills → Skill afügen → Vu GitHub-URL, pecht dann d'URL vum Dossier an a klickt op Weider.
2

An engem anere KI-Agent installéieren

All KI-Agent, deen d'Format Agent Skills liest, kann dëse Skill benotzen — kopéiert den Dossier an de Skill-Verzeechnes vun deem KI-Agent.

Claude Code — .claude/skills
git clone --depth 1 https://github.com/TheAhmadOsman/parallel-agent-worktree-skill.git \
  .claude/skills/parallel-agent-worktree-skill
Start Claude Code nom Kopéieren nei, fir datt den neie Skill erkannt gëtt.

An TypingMind benotzen

Aktivéiert Parallel Agent Worktree Skill an engem Chat vun TypingMind, an de Modell iwwerhëlt de Rescht. Den Numm an d'Beschreiwung stinn am System-Prompt. Soubal eng Ufro dozou passt, luet de Modell déi komplett Instruktioune selwer — Dir musst de Skill ni manuell opruffen, an et fale keng Token un, bis en tatsächlech benotzt gëtt.

De Modell luet Parallel Agent Worktree Skill automatesch, soubal eng Ufro dozou passt.

Funktionéiert mat all KI-Modell

KI-Skills si reng Markdown-Instruktiounen amplaz vun ubidderspezifeschem Code. Dofir ass Parallel Agent Worktree Skill net un de Modell gebonnen, fir deen de Skill geschriwwe gouf. Installéiert en eemol an TypingMind a benotzt e mat GPT-5, Claude, Gemini, Grok, DeepSeek, Mistral, Llama oder engem lokale Modell, deen Dir selwer bedreift — alles mat Ären eegenen API-Keys.

  • Gëtt nëmme gelueden, wann et néideg ass

    De System-Prompt enthält nëmmen den Numm an d'Beschreiwung. D'Instruktioune gi bei der éischter passender Ufro gelueden, soudatt en onbenotzte Skill näischt kascht.

  • De Modell am lafende Chat wiesselen

    Well de Skill aus Instruktiounen amplaz vu Code besteet, funktionéiert en och no engem Modellwiessel — den nächste Modell liest déi selwecht SKILL.md-Datei.

Skill-Instruktiounen

Dëst ass den Inhalt vu SKILL.md, deen de Modell luet. Liest e virun der Installatioun — e Skill besteet aus Instruktiounen, déi Äre Modell befollegt.

Parallel Agent Worktrees

Use this skill when a broad implementation request benefits from parallel workers run through any CLI-based agent harness. The helper scripts are generic; the bundled JSON examples use Kimi CLI only as one concrete harness mapping. The workflow is: plan independent tasks, run workers in isolated git worktrees, review their output rigorously, integrate only useful work, verify the final tree, update changelogs, and clean up after the run.

Non-Negotiables

  • Always verify the selected agent harness with <agent-cli> --help during preflight and follow the current CLI surface. Do not assume approval flags, prompt stdin, work-directory flags, sandboxing, or logging behavior transfer between harnesses.
  • For the bundled Kimi example only: as of 2026-04-11, --yolo/--yes/--dangerously-auto-approve automatically approves actions; --print is non-interactive and implicitly adds yolo. Prefer interactive kimi --yolo in tmux only after the user has approved that risk.
  • Keep every worker in its own branch and git worktree. Never let parallel workers edit the same checkout.
  • Do not start workers until you understand enough code, tests, docs, and constraints to write bounded task prompts with clear ownership.
  • Do not trust worker summaries. Review diffs, run tests, and inspect actual files before integrating anything.
  • Protect user work. Check for uncommitted changes up front and do not overwrite, stash, reset, or delete anything you did not intentionally create.
  • Integrate only reviewed work. Reject or send follow-up prompts for incomplete, speculative, conflicting, or unverified output.
  • Every parallel worker must update the repo-standard changelog or produce a per-worker changelog fragment for its change. The coordinator must reconcile fragments into the canonical changelog before final merge.
  • Final integration must merge accepted work back into the branch that was checked out at preflight. If that cannot be done, leave a clear report explaining why, where the work lives, what is still missing, and the exact next commands.
  • For self-hosted infrastructure, production-like services, or any work requiring backups, use deterministic loop generation with explicit backup gates instead of improvised parallel prompts.
  • When the user wants another agent harness, convert this skill recursively instead of doing a shallow search/replace. Update docs, scripts, examples, tests, poster copy, command equivalents, and edge-case guidance together.
  • For any non-Kimi harness, read references/harness-portability.md and resolve the installed target CLI at runtime. Do not assume Codex CLI, Claude Code, OpenCode, Droid Factory, Pi, or any other harness accepts Kimi-style flags or prompt stdin.

Preflight

Run:

sh
git status --short --branch
git rev-parse --show-toplevel
git branch --show-current
command -v uv
command -v tmux
AGENT_CLI="${AGENT_CLI:-kimi}"
AGENT_INTERACTIVE_ARGS="${AGENT_INTERACTIVE_ARGS:---yolo}"
AGENT_NONINTERACTIVE_ARGS="${AGENT_NONINTERACTIVE_ARGS:---print --yolo --input-format text}"
command -v "$AGENT_CLI"
"$AGENT_CLI" --help

If the main worktree has uncommitted changes, classify them before spawning workers:

  • If they are unrelated user changes, leave them alone and branch workers from HEAD.
  • If workers need those changes, either include the relevant diff in each prompt or ask the user how they want the changes made visible to worktrees.
  • If the tree is not a git repository, stop and use a non-worktree approach.

Set shared names:

sh
PROJECT_DIR="$(git rev-parse --show-toplevel)"
INTEGRATION_BRANCH="$(git branch --show-current)"
test -n "$INTEGRATION_BRANCH"
BASE_REF="$INTEGRATION_BRANCH"
WORKTREE_ROOT="${PROJECT_DIR}.worktrees"

Use a different BASE_REF only when there is a concrete reason, such as a feature branch or a known integration branch. Even then, keep INTEGRATION_BRANCH as the final merge target unless there is a clear blocker.

Find the changelog convention before spawning workers:

sh
find "$PROJECT_DIR" -maxdepth 3 \
  \( -iname 'CHANGELOG*' -o -iname '*release*notes*' -o -path '*/changes/*' \) \
  -print

If the repo has a single shared changelog that would create conflicts, require each worker to write a unique fragment such as .worker-runs/changelog/<task>.md and merge those fragments into the canonical changelog during integration.

Plan The Work

Read enough of the repo to make a real implementation plan. Cover architecture, entrypoints, tests, docs, build steps, and likely conflict points.

For each proposed worker task, write:

text
Task:
Branch/worktree name:
Owned files or modules:
May read:
Must not edit:
Goal:
Acceptance criteria:
Verification commands:
Changelog path or fragment:
Integration risk:
Dependencies:

Choose parallel tasks only when their write scopes are disjoint enough to review and merge independently. Keep tightly coupled design work, shared API changes, migrations, or cross-cutting refactors local or serial unless you deliberately split them into clear phases.

For competing approaches, spawn alternative workers with explicit branch names such as alt-router-state-a and alt-router-state-b, then integrate only the better result.

Spawn Workers

The bundled helper script avoids fragile tmux quoting and long-prompt problems. In this repository, run it through uv run python; in another environment, use the available Python 3 interpreter.

Interactive workers assume the selected harness can run in a TTY and accept pasted follow-up prompts after startup. If the harness only supports one-shot prompt arguments, use deterministic loop mode or write a wrapper script.

sh
uv run python .agents/skills/parallel-agent-worktree-skill/scripts/agent_workers.py spawn <name> \
  --base "$BASE_REF" \
  --prompt-file /tmp/<name>.prompt \
  --agent-cli "$AGENT_CLI" \
  --agent-args "$AGENT_INTERACTIVE_ARGS"

If this skill is installed somewhere else, locate scripts/agent_workers.py in the skill directory and run that path instead.

Worker prompt template:

text
You are a parallel agent worker running in an isolated git worktree. This worker is
using this agent harness:

Agent CLI: <agent-cli>
Agent args: <agent-args>

Task:
<one bounded task>

Ownership:
- You may edit: <owned files/modules>
- You may read: <supporting files/modules>
- You must not edit: <other worker scopes and unrelated files>

Context:
<relevant plan, constraints, AGENTS.md summary, API contracts, links to tests>

Requirements:
- First inspect the relevant AGENTS.md files, code, and tests.
- Keep changes scoped to your ownership.
- You are not alone in the codebase. Other workers are editing disjoint scopes.
  Do not revert or rewrite work outside your task.
- Use repo-standard commands such as `uv run ...`, `make format`, `make check`,
  or targeted pytest commands as appropriate.
- Add or update focused tests when behavior changes.
- Update the repo-standard changelog/release notes for your task. If the changelog is
  a shared conflict point, write a unique fragment at `.worker-runs/changelog/<task>.md`
  or the repo's standard fragment directory, then report the path.
- Commit your finished work on this branch with a Conventional Commit message.

Final response:
- Commit SHA
- Changed files
- Changelog file or fragment path
- Verification commands and results
- Known gaps or risks

Manual fallback:

sh
NAME="<task-name>"
BRANCH="$NAME"
WORKTREE="$WORKTREE_ROOT/$NAME"
SESSION="agent-worker-$NAME"

git worktree add "$WORKTREE" -b "$BRANCH" "$BASE_REF"
tmux new-session -d -s "$SESSION" -x 200 -y 50 \
  "cd '$WORKTREE' && '$AGENT_CLI' $AGENT_INTERACTIVE_ARGS"
sleep 5
tmux load-buffer -b "$SESSION-prompt" /tmp/$NAME.prompt
tmux paste-buffer -t "$SESSION" -b "$SESSION-prompt"
tmux send-keys -t "$SESSION" Enter

Generate Deterministic Loops

Use deterministic Bash or Python loops when task fan-out is driven by conditions, inventory, backup status, maintenance windows, or other logic that should be auditable and repeatable. This is the safer path for self-hosted upgrades, Docker/LXC/VM changes, database migrations, fleet-wide config edits, package bumps across services, or any task where a failed preflight must prevent every worker from starting.

Read references/deterministic-loops.md when the request involves backups, rollback, containers, VMs, LXC, Docker Compose, databases, remote hosts, generated task lists, or conditional execution.

Render a loop from a JSON plan:

sh
uv run python .agents/skills/parallel-agent-worktree-skill/scripts/render_worker_loop.py \
  --config .agents/skills/parallel-agent-worktree-skill/examples/self-hosted-upgrade.json \
  --language python \
  --output /tmp/run-agent-workers.py

uv run python .agents/skills/parallel-agent-worktree-skill/scripts/render_worker_loop.py \
  --config .agents/skills/parallel-agent-worktree-skill/examples/self-hosted-upgrade.json \
  --language bash \
  --output /tmp/run-agent-workers.sh

Generated loops:

  • Run preflight commands first.
  • Run backup commands only when their conditions pass, and fail closed when a required backup command fails.
  • Create one git branch and worktree per task.
  • Run the configured agent.cli, optional agent.work_dir_arg, agent.args, and agent.prompt_mode non-interactively in each worktree.
  • Capture prompts, agent output, verification logs, and a manifest under .worker-runs/. The default task output file is agent.log, configurable with agent.log_name.
  • Write rollback commands into the run log directory when tasks fail.
  • Respect DRY_RUN=1, RUN_ID=..., and LOG_ROOT=... environment overrides.

Prefer Python output when you need concurrent workers, timeouts, structured manifests, or clearer error handling. Prefer Bash output when the environment is minimal and the logic is mostly shell-native.

Convert This Skill To Another Harness

If the user asks to replace the example harness with another agent harness, read references/harness-portability.md and references/harness-conversion.md. Do not assume flag compatibility. Run the target harness help command, map interactive and non-interactive modes, approval bypass, work-dir handling, prompt delivery (stdin, argument, or file), sandboxing, auth, logging, and cleanup semantics, then update the whole skill package.

First-pass converter:

sh
uv run python .agents/skills/parallel-agent-worktree-skill/scripts/convert_harness.py \
  --config .agents/skills/parallel-agent-worktree-skill/examples/harness-codex.json \
  --output-dir /tmp/codex-worker

The converter copies this skill, renames the worker helper, rewrites generic defaults to target-harness defaults, and writes CONVERSION_REPORT.md. Treat the output as a draft. An agent must inspect and patch the converted package for target-specific semantics before it is used.

Self-recursive runtime update prompt:

text
Convert this skill to <target harness>. First run `<target harness> --help`.
Create a harness mapping JSON, run scripts/convert_harness.py into a new skill
directory, then comprehensively update README, SKILL.md, references, examples,
scripts, tests, poster copy, and validation commands with the target harness
equivalents. Cover interactive mode, non-interactive mode, approval bypass,
work-dir semantics, prompt delivery mode, logging, cleanup, failure modes, auth,
sandboxing, and edge cases. Run validation and report remaining manual checks.
Finish with:
› Let's unit test and integerate test comprehensively and extensively covering any
and all things + any and all possible edge cases.

The final stage / execution for every converted skill is:

text
› Let's unit test and integerate test comprehensively and extensively covering any and all things + any and all possible edge cases.

Monitor And Steer

Check workers regularly:

sh
uv run python .agents/skills/parallel-agent-worktree-skill/scripts/agent_workers.py status
uv run python .agents/skills/parallel-agent-worktree-skill/scripts/agent_workers.py capture <name> --lines 120

Send follow-up instructions instead of abandoning a worker at the first issue:

sh
uv run python .agents/skills/parallel-agent-worktree-skill/scripts/agent_workers.py send <name> \
  --prompt-file /tmp/<name>-followup.prompt

Use follow-ups for failed tests, overbroad edits, missed requirements, conflicts with another worker, or a better local discovery made after spawn. Keep follow-ups bounded.

Review Worker Output

For each worker, inspect the worktree from the main coordination session:

sh
WT="$WORKTREE_ROOT/<name>"
BRANCH="<name>"

git -C "$WT" status --short
git -C "$WT" log --oneline "$BASE_REF"..HEAD
git -C "$WT" diff --stat "$BASE_REF"...HEAD
git -C "$WT" diff "$BASE_REF"...HEAD

Run the worker's verification commands yourself in that worktree. Add targeted tests or broader checks when the blast radius is larger than the worker assumed.

Decision rules:

  • Accept when the diff is scoped, correct, tested, and compatible with the integration plan.
  • Accept only when the worker included a changelog update or fragment, unless the repository truly has no changelog convention. Record that exception explicitly.
  • Send back for fixes when the approach is sound but incomplete or tests fail.
  • Reject when the worker changed the wrong scope, invented APIs, ignored constraints, produced excessive churn, or overlaps a better accepted branch.
  • Keep notes on every accepted, rejected, and pending branch with the reason.

Integrate

Before integration, return to the main worktree and confirm it is clean except for changes you intentionally own:

sh
git status --short --branch
test "$(git branch --show-current)" = "$INTEGRATION_BRANCH"

Prefer one of these paths:

sh
# Integrate a whole reviewed branch.
git merge --no-ff <worker-branch>

# Integrate selected reviewed commits.
git cherry-pick <commit-sha>

Resolve conflicts in the integration worktree, not inside random worker checkouts. After each substantial merge or cherry-pick, run the relevant focused tests. After the full batch, run the repo-level checks appropriate to the change, usually some subset of:

sh
make format
make check
make test

If integration reveals a design conflict, either fix it locally after understanding both branches or send a precise follow-up to the relevant worker worktree.

Before the final merge is considered done, reconcile every accepted worker changelog entry into the canonical changelog/release notes. Then verify the integrated result is on the original checked-out branch:

sh
git branch --show-current
git status --short
git log --oneline "$BASE_REF"..HEAD

If accepted work was integrated on a temporary integration branch, merge that branch back into INTEGRATION_BRANCH before reporting completion:

sh
git switch "$INTEGRATION_BRANCH"
git merge --no-ff <integration-branch>

If final merge-back is impossible, do not imply completion. Leave a clear report with:

  • Original checked-out branch from preflight.
  • Current branch and all worker/integration branches containing accepted work.
  • Exact blocker: conflicts, failed tests, dirty user changes, missing changelog, or missing permissions.
  • Completed work, missing work, and validation already run.
  • Exact next commands for the user or next agent to resume safely.

Cleanup

After accepted work is integrated and rejected work has been recorded, stop sessions and remove worktrees:

sh
uv run python .agents/skills/parallel-agent-worktree-skill/scripts/agent_workers.py cleanup <name> --branch-delete
git worktree prune

Use --branch-delete for branches already merged. Use --force-branch-delete only when the branch is intentionally discarded, its useful details have been recorded, and no user work will be lost. If there is doubt, remove the worktree but keep the branch and report it.

Final Report

Report:

  • What was integrated, with worker branches and commit SHAs.
  • What was rejected or left out, with reasons.
  • Verification commands run and their results.
  • Remaining missing work, risks, or follow-up tasks.
  • Cleanup performed, including removed tmux sessions, worktrees, and branches.

Matgeliwwert Fichieren

De Modell liest dës Dateie bei Bedarf, wärend de Skill gelueden ass. Si ginn als liesbar Dateie bereetgestallt a ginn ni ausgeféiert.

Heefeg gestallte Froen

Wat mécht de KI-Skill Parallel Agent Worktree Skill?

Plan and execute complex work with parallel CLI agent-harness workers in git worktrees. Use for task decomposition, tmux worker spawning, deterministic loops, integration, verification, changelogs, and cleanup.

Firwat Parallel Agent Worktree Skill op TypingMind benotzen?

Well Dir en eemol installéiert a mat all Modell benotze kënnt. Parallel Agent Worktree Skill besteet aus einfachem Markdown amplaz vun ubidderspezifeschem Code. Dee selwechte Skill funktionéiert also mat GPT-5, Claude, Gemini, Grok oder engem lokale Modell – an Dir kënnt de Modell matzen am Chat wiesselen, ouni datt de Skill ophält ze funktionéieren. TypingMind benotzt Är eegen API-Schlësselen, sou datt Dir d'Ubidder direkt bezuelt amplaz vun engem Abonnement pro Benotzerplaz. Är Skills a Chats bleiwen an Ärem eegene Späicher.

Wéi installéieren ech Parallel Agent Worktree Skill an TypingMind?

Maacht an TypingMind Plugins → Skills → Vu GitHub installéieren op a setzt https://github.com/TheAhmadOsman/parallel-agent-worktree-skill/tree/main an. TypingMind liest d'Datei SKILL.md, bündelt déi zougehéiereg Dateien an installéiert dat Ganzt als Skill, deen Dir pro Chat aktivéiere kënnt.

Wéi eng KI-Modeller kënnen Parallel Agent Worktree Skill benotzen?

All Modell, deen Dir an TypingMind verbënnt. KI-Skills sinn einfach Markdown-Instruktiounen an net ubidderspezifesche Code. Dofir kënne GPT, Claude, Gemini, Grok a lokal Modeller dëse Skill lueden, wann eng Ufro dozou passt.

Wéi vill KI-Modeller kann ech mat Parallel Agent Worktree Skill benotzen?

Esou vill Dir wëllt. Soulaang e Modell Skills ënnerstëtzt, kënnt Dir Parallel Agent Worktree Skill domat benotzen – GPT, Claude, Gemini, Grok, DeepSeek, Mistral, Llama a méi – alles op TypingMind mat Ären eegenen API-Schlësselen.

Ass de KI-Skill Parallel Agent Worktree Skill gratis?

Jo. De Skill gëtt vum TheAhmadOsman ënner der Lizenz Apache-2.0 op GitHub publizéiert. Dir bezuelt nëmmen Ären eegene KI-Ubidder fir d'Token, déi Dir benotzt.

Wat si KI-Skills?

E KI-Skill ass e weiderverwendbaart Pak vun Instruktiounen, dat engem KI-Modell bäibréngt, wéi en eng bestëmmt Aufgab erfëllt. E follegt dem oppenen Agent Skills-Format: eng Datei SKILL.md mat engem Numm an enger Beschreiwung, plus all Scripten, Virlagen oder Referenzdateien, déi de Modell eventuell brauch. De Modell liest d'Instruktiounen eréischt, wann Är Ufro zum Skill passt. En installéierte Skill kascht also näischt, bis e benotzt gëtt.

Wéi ënnerscheede sech KI-Skills vu Plugins oder MCP-Serveren?

E Plugin oder MCP-Server gëtt engem Modell nei Tools, déi en opruffe kann – Code, deen iergendwou leeft an e Resultat zeréckgëtt. E KI-Skill gëtt dem Modell dogéint Wëssen an eng Virgoensweis: wéi en eng Aufgab ugeet, wéi eng Schrëtt en nokënnt a wéi eng gutt Ausgab ausgesäit. Skills bestinn aus einfachem Markdown, brauche kee Server, keen API-Schlëssel a keng Lafzäitëmfeld a funktionéiere mat all Modell.

All weisen

Elo Ären eegene KI-Workspace ariichten

Abonnéiert Iech op eisen Newsletter, fir iwwer nei Funktiounen an zukünfteg Gewënnspiller informéiert ze ginn 👇