2026-11-27 16:22 UTC

Pi-cowboy coordinates coding agents across harnesses in isolated worktrees

state: expiredheat: lowuncertainty: mediumrelevance: mediummulti-agent-orchestration durable-execution harness-interop copy-on-write git-worktrees herdr pielectric-dragon-80000vsuoloordi

What is this?

Pi-cowboy is an open-source orchestrator for Pi, built to delegate work to parallel coding agents running in separate Git worktrees through Herdr. Its README says it can also launch other harnesses, including Codex, Claude Code and OpenCode, and provides live terminal panes, concurrency controls and branch merging. The project claims copy-on-write worktrees reduce disk use substantially; its example compares 75 MiB with 27 GiB for a repository including untracked files. These are project-reported features and measurements, not independently verified results. The supplied sources establish a tool release and its advertised capabilities, not evidence of broad adoption or improved coding outcomes.

Why it matters

A useful developer tool for people who want one workflow to delegate coding tasks across multiple agent harnesses, while keeping edits isolated, visible and reviewable. It reflects a broader shift from choosing a single coding agent to coordinating several, and could help users balance model availability, cost and task specialization. Its practical value depends on a Pi/Herdr setup and a copy-on-write-capable filesystem for the advertised disk savings; there is no supplied evidence of adoption or better coding outcomes.

Current assessment

The project README and Show HN post describe pi-cowboy as a Pi orchestrator that delegates parallel subtasks to agents in isolated Git worktrees via Herdr. It advertises support for Pi, Codex, Claude Code, OpenCode and other harnesses; live terminal panes, configurable concurrency limits, model selection, branch merging and cleanup; and copy-on-write worktrees. The README reports 75 MiB on disk for its copy-on-write method versus 27 GiB for classic worktrees plus untracked files in one repository (153,607 files; 479 MiB tracked, 27 GiB including untracked). Treat that comparison as a project-reported, repository-specific result, not an independent benchmark. Requirements include Herdr 0.8+, Linux or macOS, and a copy-on-write filesystem for the feature; the README says ext4 falls back to checkout. The notable development is harness interoperability combined with isolation and resource controls, potentially making parallel agent work easier to manage and letting users route tasks among available models. Evidence is limited to project materials and a Show HN listing; it does not establish reliability, security properties beyond the documented cleanup behavior, adoption, or quality gains. Web results also surface multiple release pages, including v0.16.0, but the supplied results do not provide release details sufficient to establish what changed or when those versions appeared.

Measured heat

no measured readings yet β€” the hourly heat pass fills this in

How the heat travelled

10-17 13:00⭐ origin echo-reconstructedpi-cowboy is a multi-agent orchestrator for Pi that can run Codex, Claude Code, OpenCode, and more as subagents in isolated copy-on-write Gi
electric-dragon-80000v on github (echo) Β· attributed from hn.story.50142277
β€”
10-18 16:04first on hacker news Β· published Β· +27.1hShow HN: Pi-cowboy – use Codex, Claude Code, OpenCode as subagents
suoloordi
β€”
10-18 16:04amplified on hacker news πŸ‘‘hn.story.50142277
suoloordi
peak 7 Β· 3 comments Β· 100% of case engagement
10-18 16:20our radar first saw it Β· +27.4hdiscovery anchor: hn.story.50142277β€”

Evidence (2) β€” ⭐ canonical anchor

sourceobjectauthorscorecomments
🟧 hnShow HN: Pi-cowboy – use Codex, Claude Code, OpenCode as subagents
Retrieved article excerpt

Open article Β· Retrieved 2026-10-18T16:23:22.572867+00:00

[pi-cowboy](https://raw.githubusercontent.com/electric-dragon-80000v/pi-cowboy/main/docs/assets/logo-labeled-readme.png)

readme-video.mp4

[
](https://private-user-images.githubusercontent.com/578304/674568639-a063b266-9079-4e3a-adcf-8ca78711bba1.mp4?jwt=eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3OTIzNDA5MDEsIm5iZiI6MTc5MjM0MDYwMSwicGF0aCI6Ii81NzgzMDQvNjc0NTY4NjM5LWEwNjNiMjY2LTkwNzktNGUzYS1hZGNmLThjYTc4NzExYmJhMS5tcDQ_WC1BbXotQWxnb3JpdGhtPUFXUzQtSE1BQy1TSEEyNTYmWC1BbXotQ3JlZGVudGlhbD1BS0lBVkNPRFlMU0E1M1BRSzRaQSUyRjIwMjYxMDE4JTJGdXMtZWFzdC0xJTJGczMlMkZhd3M0X3JlcXVlc3QmWC1BbXotRGF0ZT0yMDI2MTAxOFQxNjIzMjFaJlgtQW16LUV4cGlyZXM9MzAwJlgtQW16LVNpZ25hdHVyZT02MmZkZjkyY2UyZTgzMjZiNDU5OGMwMDliNjcwYmFjMDlhZmRmZTQ3Mjg4YTkxMjdhMjc5YmYzNTM3Y2VmZTY0JlgtQW16LVNpZ25lZEhlYWRlcnM9aG9zdCZyZXNwb25zZS1jb250ZW50LXR5cGU9dmlkZW8lMkZtcDQifQ.PgLfTtA2rfKgZuWQ2RnI7RNRwC9AYOJNC34YoQXylvg)

[License: MIT](https://opensource.org/licenses/MIT)

**License:** MIT

`pi-cowboy` is a multi-agent orchestrator for [pi](https://pi.dev). Break a large job into focused subtasks, hand them off to background agents running in parallel, and consolidate them when they finish.

Each agent runs in its own terminal pane inside [Herdr](https://github.com/electric-dragon-80000v/herdr) and works in an isolated copy-on-write Git worktree. You can watch agents work in real time, jump into any pane to steer them, or mix and match harnesses like Pi, Claude Code, OpenCode, and Codex in the same session. When the work is finished, `pi-cowboy` cleans up the leftovers for you.

## Why should I use it?

### Focused tasks produce better code

Give each agent a smaller, isolated subtask. A single task with clear instructions leaves little room for error, whereas a long list of expectations invites drift and over-engineering. Because each agent commits to its own branch, you can review and merge each subtask on its own.

### Foreign harness support

`pi-cowboy` can orchestrate Claude Code, Codex, OpenCode, and more: start work on Pi, continue on Claude Code, finish on OpenCode. Do you need support for something else? Create an issue on [GitHub](https://github.com/electric-dragon-80000v/pi-cowboy/issues/new).

### Parallel work with minimal disk overhead

Multiple agents can edit, build, and run tests at the same time without interfering with each other. Copy-on-write worktrees make high parallelism practical by keeping disk usage small even when your repository is in the magnitude of gigabytes.

The numbers below come from a Git repository with 153,607 files in total (479 MiB tracked, 27 GiB total including untracked files):

| Method | Including untracked | Size on disk |
| --- | --- | --- |
| Pi-cowboy's copy-on-write | yes | 75 MiB |
| Classic `git worktree add` | no | 479 MiB |
| Classic `git worktree add` + copy of untracked | yes | 27 GiB |

### Live visibility in Herdr

Each task gets its own shell, a visible terminal pane you can open at any time, and notifications when an agent needs your attention.

### Custom workflows

Define reusable [agent templates](https://github.com/electric-dragon-80000v/pi-cowboy#agent-templates) for specialist roles and [orchestrator templates](https://github.com/electric-dragon-80000v/pi-cowboy#orchestrator-templates) to adapt how agents work and report back.

### Grazing cows and a cowboy on your screen

[image-20260930022747492](https://raw.githubusercontent.com/electric-dragon-80000v/pi-cowboy/main/docs/assets/grazing.png)

Who wouldn’t want their agents visualized as cow emojis? Go on… guess. That's exactly right. No one.

## Requirements

- Linux or macOS
- `herdr` 0.8 or later, with the `herdr` pi integration enabled
- `python3` on macOS (used for copy-on-write worktrees; macOS has not shipped `python3` since 12.3, so install the Xcode Command Line Tools with `xcode-select --install`)
- Copy-on-write capable filesystem (APFS on macOS; BTRFS or ZFS on Linux)
  - `ext4` does not support copy-on-write. On `ext4`, `agent.worktreeMaterialization` falls back to `checkout`.

## Install

Install from npm:

`pi install npm:pi-cowboy`

## Usage

`pi-cowboy` activates automatically whenever you run `pi` inside a Git repository.

##### 1. Delegating a task

---

`Based on the security audit, group the relevant files into 10 groups, and launch parallel cowboy agents to address their audit results.`


---

`pi-cowboy` spawns background agents for the subtasks right away:

`βœ“ Spawned agent b7g2nspx (general-purpose)`  
`βœ“ Spawned agent 5m1xx7fa (general-purpose)`  
`...`

If you spawn more agents than your concurrency limit allows, the extras wait in a queue. With the default global limit of 4, the first 4 agents start immediately and the remaining 6 start as slots open up.

##### 2. Agent isolation

[herdr-containers](https://raw.githubusercontent.com/electric-dragon-80000v/pi-cowboy/main/docs/assets/herdr-containers.png)

Each agent runs as a separate process in its own Herdr workspace, inside its own tab and terminal pane. You can switch to an agent's workspace at any time to watch its progress or steer it directly.

On disk, each agent works in a dedicated Git worktree under `<agent dir>/pi-cowboy/worktrees/` (`~/.pi/agent` by default).

##### 3. Agent completion

When an agent finishes its turn (settles), its report arrives as a message in the parent session:

`βœ“ [Cowboy agent "general-purpose" b7g2nspx completed]`  
  
`Addressed all the points raised in the security audit for the given set of files.`  
  
`(Worktree: $HOME/.pi/agent/pi-cowboy/worktrees/cow-audit-perms-b7g2nspx (branch cow-audit-perms-b7g2nspx). The agent process and its herdr pane stay until you call cleanup_cowboy_agent β€” its pane is closed, which ends that process. The worktree stays until you call cleanup_cowboy_agent to remove it β€” call it once the branch is merged or rejected.)`

The parent session can then review the report, steer the agent if something needs another pass, or merge the branch.

##### 4. Merging

To bring the changes in, the orchestrator calls `merge_cowboy_branch`, which merges the agent's branch into your repository's main working tree:

`βœ“ Merged "cow-audit-perms-b7g2nspx" into "main" in pi-mono.`

##### 5. Cleanup

Once the work is merged, the orchestrator cleans up the agent's resources (or you can ask it to):

---

`Clean up perms audit agent.`


---

`cleanup_cowboy_agent` closes the Herdr pane and tab, removes the worktree, and deletes the branch:

`βœ“ Cleaned up agent b7g2nspx:`  
`agent status: completed`  
`pane: closed`  
`worktree: removed ($HOME/.pi/agent/pi-cowboy/worktrees/cow-audit-perms-b7g2nspx)`  
`branch: deleted (cow-audit-perms-b7g2nspx)`

Cleanup is safe by default: it refuses to touch an agent that is still running, keeps any worktree that still has uncommitted changes, and deletes the branch only if it has already been merged. If one step cannot be completed, `pi-cowboy` reports the reason and finishes the rest.

When the `/cowboy status` menu refuses to remove a worktree because of uncommitted changes or an unreadable state, it offers to `Force` the removal. Force deletes the worktree and discards anything uncommitted in it, so it asks for a confirmation that names the checkout and what will be lost. Forced removals are reported as `forced β€” <reason>`. This override lives in the menu only β€” the `cleanup_cowboy_agent` tool never forces, and the menu only offers it for a settled agent, never one it still lists as running.

## Customizing your workflow

### Agent templates

If you find yourself repeating the same instructions for recurring jobs, you can package them into an agent template with its own system prompt, model, harness, and tool permissions.

For example, a `release-notes` template looks like this:

```
name = "release-notes"
description = "Prepares release notes."
system_prompt = '''
You prepare release notes for this repository. Read the history and tags
(git log, git tag) and report the changes as a message.
'''
```

You can then ask for it by name in the parent session:

---

`> Spawn a cowboy agent using release notes template to prepare the release notes for the most recent changes.`


---

See [Agent Templates](https://github.com/electric-dragon-80000v/pi-cowboy/blob/main/docs/Agent%20Templates.md) for all template fields and directory locations.

### Orchestrator templates

While agent templates specialize individual workers, orchestrator templates apply rules across every agent you spawn. They also let you customize the status messages ("cues") sent to the parent session when agents spawn, queue, or settle.

For instance, if you use an adversarial review tool, you can define an orchestrator template that requires every agent to run it before committing:

```
name = "adversarial-review"
guidance = '''
Run the adversarial-review tool before you commit, and fix any glaring mistakes that the review finds and then commit.
'''
```

You can switch the active orchestrator at any time from `/cowboy` > `Default orchestrator`. See [Orchestrator Templates](https://github.com/electric-dragon-80000v/pi-cowboy/blob/main/docs/Orchestrator%20Templates.md) for details.

### Foreign harnesses

`pi-cowboy` auto-detects Codex, Claude Code, OpenCode, PiG, and Pi-Bolt when they are installed on your `PATH`. You can request a specific harness directly in your prompt (for example, "Launch an OpenCode agent for this task") or set defaults in your [configuration](https://github.com/electric-dragon-80000v/pi-cowboy/blob/main/docs/Configuration.md#agentharnesstype) and [agent templates](https://github.com/electric-dragon-80000v/pi-cowboy/blob/main/docs/Agent%20Templates.md).

## Concurrency

You can cap how many agents run at the same time across four independent levels:

- Global: `concurrency.default` (default `4`), which applies to every agent
- Per harness: `concurrency.harnesses.<harness-id>`
- Per provider: `concurrency.providers.<provider>`
- Per model: `concurrency.models["<provider>/<model-id>"]`

A running agent occupies a slot in every limit that applies to it. When the agent settles, it releases those slots and `pi-cowboy` starts the next queued agent that has room at all of its levels. An agent waiting on a busy model limit will not block a queued agent behind it that uses a different model.

If you steer a settled agent, it wakes up in its existing pane and runs immediately, even if that temporarily puts a limit over capacity.

Configure these limits in `config.json` or live in your session via `/cowboy` > `Settings` > `Concurrency Settings`. See [Configuration](https://github.com/electric-dragon-80000v/pi-cowboy/blob/main/docs/Configuration.md#concurrency) for details.

## Model resolution

When `pi-cowboy` spawns an agent, it picks the model using the first match in this order:

1. The `model` parameter passed to the `cowboy_agent` tool call
2. The session per-type model override (`/cowboy` > `Model overrides`)
3. The config per-type override (`agent.<agent-type>`)
4. The model set in the [agent template](https://github.com/electric-dragon-80000v/pi-cowboy/blob/main/docs/Agent%20Templates.md) for the launching harness family
5. The session default model (`/cowboy model`)
6. The launching harness's configured default (`agent.default` for the Pi family, or `agent.defaultModelByHarness` for foreign harnesses)
7. For Pi-family launches, the parent session's active model

See [Configuration](https://github.com/electric-dragon-80000v/pi-cowboy/blob/main/docs/Configuration.md#model-keys) for the full rules.

## Commands

Run `/cowboy` to open the interactive menu, or pass a subcommand directly. See [Menu](https://github.com/electric-dragon-80000v/pi-cowboy/blob/main/docs/Menu.md) for a guide to every screen.

```
/cowboy                         # Open the pi-cowboy menu
/cowboy status                  # List spawned, queued, and settled agents
/cowboy spawn                   # Spawn an agent man
suoloordi73
🟧 echo.github ⭐pi-cowboy is a multi-agent orchestrator for Pi that can run Codex, Claude Code, OpenCode, and more as subagents in isolated copy-on-write Gielectric-dragon-80000vβ€”β€”

Interpretation history

Decision trace