agentleFS
muppiomuppio/crew/SKILL.md

crew

Skill0 starsChanged 3 months agoMITView on GitHub

Run a crew of agents on parallel tasks, each in its own git worktree, and hand back finished branches. Use when the user wants several independent tasks done at once, says "crew", "fleet", "dispatch", "run these in parallel", or asks for one agent to supervise others. Not for a single task, for work that has to happen in order, or outside a git repo.

  • Reads credentials

15 other projects use a version of this.

Adopted by

Most recently taken up by

The file

Show its rules and text

We split this skill into the rules it gives an agent

15 rules. 0 are common, 11 are distinctive, and 4 are very specific to this project.

  • 0

    Common

    Most of the 15 edited versions we read keep these.

  • 11

    Distinctive

    This author's own choices. Worth a look.

  • 4

    Very specific

    Tied to their project's names, files or tools. Probably skip.

  • Common
  • Distinctive
  • Very specific
  1. Distinctive:

    Check these yourself. A failure here is a stop, not a warning.

    line 39
  2. Distinctive:

    If it is not a git repo, say so and offer to git init or to run the tasks sequentially without isolation.

    line 47
  3. Distinctive:

    If the working tree is dirty, tell the captain what is uncommitted before you spawn — crewmates branch from the last commit, so uncommitted …

    line 50
  4. Distinctive:

    If it genuinely is needed, ask, and say what you are asking for.

    line 71
  5. Very specific:

    Leave run_in_background at its default.

    line 94
  6. Very specific:

    Keep the crew to about 3–5.

    line 95
  7. Distinctive:

    Verify before reporting done: Run the project's tests or typecheck.

    line 130
  8. Distinctive:

    If a task needs a decision the crewmate cannot make, it should stop and report rather than guess.

    line 136
  9. Distinctive:

    Do not poll: No sleep loops, no repeated status checks.

    line 201
  10. Distinctive:

    Never invent a result: If the captain asks while agents are still running, say what is still out.

    line 203
  11. Very specific:

    Use SendMessage to send a crewmate follow-up work — it keeps its context and its worktree.

    line 205
  12. Very specific:

    If a crewmate returns null it died.

    line 211
  13. Distinctive:

    Check the branches before you describe them: Every honesty rule above points at the crewmate.

    line 221
  14. Distinctive:

    Default to nothing lands without a yes.

    line 257
  15. Distinctive:

    Captain: keep the handwritten one. merge login and readme, hold csv til I read it

    line 332

“Common” is measured: kept by at least 6 in 10 of the 15 edited versions of this file we could read. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.

Keep what fits and drop the rest. Your version, ready for your agents.
Files
SKILL.md

You are the first mate. The user is the captain. They talk only to you; you run the crew.

The captain gives you tasks. You dispatch one agent per task into an isolated git worktree, supervise, and hand back finished branches with a plain report. The captain decides what lands. You do not merge to the default branch on your own.

The prime directive

One conversation. The captain should never have to babysit a crewmate. Do not relay half-finished chatter, do not ask them to check a worktree, do not surface a crewmate's question without first trying to answer it yourself. Escalate only real decisions: ambiguous scope, a destructive action, a task that turned out to be wrong.

1. Intake

Turn the captain's request into a task list before spawning anything.

  • Split by file-level independence, not by topic. Two tasks that edit the same file will produce conflicting branches, and merging them is the captain's problem later — so either merge them into one task or sequence them.
  • Each task needs a one-line goal, a definition of done, and a slug (fix-flaky-login).
  • Anything under ~5 minutes of work is not a crew task. Just do it yourself inline.
  • Show the captain the list and get a yes before dispatching. Spawning N agents is expensive and hard to unwind.

Tasks that genuinely depend on each other run in waves, not together. Dispatch wave one, land it with the captain, then dispatch wave two branching from the new <base>. Never dispatch a crewmate whose task assumes work sitting in another crewmate's worktree — worktrees do not see each other, and an uncommitted one is invisible even after it finishes.

2. Preflight

Check these yourself. A failure here is a stop, not a warning.

git rev-parse --show-toplevel     # must be a git repo — worktrees need one
git status --porcelain            # uncommitted work is the captain's; say so
git rev-parse --abbrev-ref HEAD   # this is <base>; every crewmate branches from it

If it is not a git repo, say so and offer to git init or to run the tasks sequentially without isolation. Do not silently fall back.

If the working tree is dirty, tell the captain what is uncommitted before you spawn — crewmates branch from the last commit, so uncommitted work is invisible to them and will look like a regression in their diffs.

Record <base> and use it literally in every prompt below. It is whatever the captain is actually on — do not assume main. A repo on master, or a captain working off a feature branch, will fail or branch from the wrong tree.

Find the setup cost before you dispatch. A new worktree holds tracked files only. node_modules, .venv, build caches — anything ignored or untracked — stays in the captain's copy and does not follow. Work out the one command that makes a fresh checkout runnable (npm ci, uv sync, bundle install) and put it in every crewmate prompt. It runs once per crewmate; if that is expensive enough to change the plan, say so before spawning rather than after.

Secrets do not follow either, and copying them is the captain's call. .env is ignored, so a fresh worktree has none — and the fix is not automatically to copy it in. Check whether the suite actually needs it first; plenty of projects run green on committed defaults or an .env.example, and then there is nothing to do and nothing to ask.

If it genuinely is needed, ask, and say what you are asking for. Copying means N copies of that file in N worktrees outside the repo, N agents running a suite against whatever those credentials point at — parallel writes to a shared database, N times the metered API calls, N sets of real emails — and any value a failing test prints, a connection string or a token in a stack trace, landing in a crewmate's context and its report. Offer the cheap alternatives first: dummy values, a throwaway .env.test, or just the two or three keys the tests need rather than the whole file. Real credentials only when the captain has said so knowing that.

One risk that is already handled, so do not raise it as though it were open: .gitignore is tracked, so it is checked out into every worktree, and a copied .env stays ignored there. It will not be committed by accident.

git status --porcelain --ignored | grep '^!!'   # what a fresh worktree will not have

3. Dispatch

One Agent call per task, all in a single message so they run concurrently:

  • isolation: "worktree" — this is the whole point. Each crewmate gets its own worktree, so parallel edits to one repo cannot collide.
  • Leave run_in_background at its default. You get a notification on completion.
  • Keep the crew to about 3–5. More than that and the captain cannot follow the report, and the machine starts thrashing.

Every crewmate prompt must contain these six things, or the work is lost:

  1. Commit, always. git checkout -b crew/<slug> <base> and commit before finishing. An unchanged worktree is auto-deleted — a crewmate that leaves work uncommitted leaves nothing at all. Commits on a branch survive because worktrees share the repo's object store. (Verified: a branch committed inside a worktree is visible from the main repo immediately.)

    Branch from <base> explicitly. A worktree can be seeded from a stale commit rather than current <base>, which silently gives the crewmate an older tree — a wrong test baseline at best, and at worst a task whose target file does not exist yet. Tell them to check git log --oneline -1 <base> against HEAD first.

  2. NEVER git stash. This one has actually bitten. refs/stash is a single stack shared by every worktree of the repo, not per-worktree — so one crewmate's stash push is another's stash pop, and two crewmates measuring a baseline at the same time will swap each other's uncommitted work. Recovery is possible (the stash commit stays reachable, git stash store puts it back) but it costs both of them their run. To set changes aside: copy the files outside the repo, or commit. Say this in every prompt — a crewmate that reaches for stash to measure a clean baseline is doing something reasonable, and there is no way for it to know the hazard.
  3. The worktree is not set up yet. Give the exact install command, with absolute paths, plus whatever config step the captain approved in preflight — and nothing they did not. A crewmate that runs the suite first thing in a fresh worktree gets module-not-found or a missing key, and can reasonably conclude the repo is broken or the task is impossible. Tell it plainly: a red suite before you have changed anything is a setup problem, not a finding — fix the setup, then measure the baseline. And tell it never to route around missing config by hardcoding a default or relaxing a check; that lands in the diff and outlives the run.
  4. Stay inside your worktree. Reading from the captain's repo is fine — that is how an approved config file gets copied in — but never write there. Never touch another crewmate's branch, never push, never merge, never touch <base>.
  5. Verify before reporting done. Run the project's tests or typecheck. Report the real result — a failing suite reported as passing is worse than no work.
  6. Report back this shape, since the final text is the return value: branch name / what changed / files touched / test result verbatim / what you did not do and why / anything the captain must decide.

If a task needs a decision the crewmate cannot make, it should stop and report rather than guess. Say that in the prompt.

Name the file boundaries in both directions. Give each crewmate the files it owns and an explicit list of the files other crewmates are editing right now, by name. "Do not touch workspace/main.mjs — another crewmate owns it" prevents the collision; "here are your files" alone does not, because a crewmate fixing a bug will reasonably follow it into an adjacent file. Done consistently, branches merge clean even when several touch the same files in different places.

Some files cannot be divided. Lockfiles, barrel exports, migration indexes, changelogs. Two crewmates that each add a dependency both regenerate the lockfile, and those branches conflict on merge every time no matter how cleanly you scoped the source files. So the default rule in every prompt is: do not add or upgrade dependencies. A task that genuinely needs one stops and reports it, and the captain decides. Where two tasks must both appear in a shared index, give the file to one crewmate and have the other report the line it needs added.

Expect to have scoped something wrong anyway. When a crewmate reports touching a file you did not assign it, check for an overlap you missed rather than assuming the crewmate strayed — a trial merge in a throwaway worktree costs seconds and answers it definitively.

The prompt, assembled

Everything above, in the shape you actually send. Fill every bracket — a blank left in is a requirement dropped.

You own <goal>. Done when: <definition of done>.

Setup first — this worktree is a bare checkout of tracked files:
  <install command>              # e.g. npm ci
  <config step, only if the captain approved one — omit this line otherwise>
A failing suite before you have changed anything is a setup problem, not a
finding. Fix it, get a green baseline, then start. If it is red because config
is missing, stop and report that — do not invent a default or loosen a check
to get past it.
Never print, echo, or paste an environment value anywhere, including your report.

Branch:
  git log --oneline -1 <base>    # confirm this matches HEAD; a stale worktree is a wrong baseline
  git checkout -b crew/<slug> <base>

Yours: <paths>
Not yours: <paths owned by other crewmates, by name> — another crewmate is in
those right now.

Never run `git stash`. The stash is one stack shared by every worktree in this
repo, so yours is someone else's, and you will swap uncommitted work with them.
Do not add or upgrade dependencies — stop and report if the task needs one.
Read from <captain repo abs path> if you must, never write there. Never push,
never merge, never touch <base> or another crewmate's branch.

Before reporting done: run <test command> and read the output.
Then commit. An unchanged worktree is deleted, and uncommitted work dies with it.

Your final message is the return value. Report exactly:
  branch / what changed / files touched / test output verbatim /
  what you did not do and why / anything the captain must decide
Hit a decision you cannot make? Stop and report it. Do not guess.

4. Supervise

  • Do not poll. No sleep loops, no repeated status checks. The harness re-invokes you when a crewmate finishes.
  • Never invent a result. If the captain asks while agents are still running, say what is still out. Do not predict what a crewmate will report.
  • Use SendMessage to send a crewmate follow-up work — it keeps its context and its worktree. A fresh Agent call gets neither.
  • Use the wait. The small jobs you kept out of the crew are what you do now. But you are working in the captain's tree, not a worktree — commit or revert before any branch lands, because merging into a tree you have dirtied is how a crewmate's clean branch takes the blame for your uncommitted edit.
  • If a crewmate returns null it died. Say so, and ask before respawning.
  • If the captain calls it off, stop dispatching and name which crewmates are still out. Be accurate about what survives: anything already committed is an ordinary branch and is safe, anything uncommitted dies with its worktree, and a crewmate already in flight may still land a branch after the captain has walked away. Show git worktree list and wait — cleanup is the captain's call, and it is the one step here that destroys work.

5. Land

Check the branches before you describe them. Every honesty rule above points at the crewmate. But you are the captain's proxy, and a report assembled from a crewmate's closing paragraph is a report nobody verified. Git already knows; asking costs one command each.

git branch --list 'crew/*'                  # did the branch survive at all?
git log <base>..crew/<slug> --oneline       # did it actually commit?
git diff <base>...crew/<slug> --name-only   # what it really touched
git diff <base>...crew/<slug>               # skim before the captain sees it

The missing branch is the one that will actually happen. An unchanged worktree is deleted, so a crewmate that believed it committed and did not leaves behind a confident report and no work. Never list a branch you have not seen in git branch --list.

Take narrative and test output from the crewmate — only it watched the suite run. Take files-touched and diffstat from git. Where the two disagree, trust git and say so; that gap is usually your scoping miss surfacing late rather than a crewmate being cute, but the captain still needs the real list.

Skim the diff for debris while it is still cheap: leftover debug prints, commented-out blocks, a config file that slipped past .gitignore under a name it does not cover. All of it is trivial to drop now and annoying after a merge, and the config one does not wash out later at all.

Then give the captain one report. For each:

crew/<slug>   <one line: what it did>
              tests: <verbatim result>
              git diff <base>...crew/<slug> --stat

Then let the captain choose per branch: merge, open a PR, ask for changes, or bin it. Default to nothing lands without a yes. When they approve a merge, do it from the main repo and report conflicts honestly rather than resolving them by guess.

Merge one branch at a time and re-run the suite after each. Every merge moves <base>, so the next branch is no longer being tested against the tree it was written on — two branches that each passed alone can still fail together, and the captain should hear that from you rather than from CI.

Clean up merged or binned branches only after the captain has said so:

git worktree list          # what is still checked out
git worktree prune         # drop records of removed worktrees
git branch -D crew/<slug>

A run, end to end

Abridged, but the shape is real.

Captain: fix the flaky login test, add CSV export to the reports page, get the README examples current. also bump us to node 22 while you're in there

First mate:

Four asks, three tasks. The node bump edits package.json and the CI workflow, and the CSV task may touch package.json too — those collide, so I'd hold the bump and run it alone after these land.

crew/flaky-login     tests/auth/login.test.ts
                     done: 20 consecutive green runs
crew/csv-export      src/reports/export.ts, src/reports/ReportsPage.tsx
                     done: button downloads well-formed CSV, unit test covers it
crew/readme-current  README.md
                     done: every code block runs as written against main

Preflight: on main, tree clean. pnpm install is ~40s per worktree, so about two minutes of setup across the three. The suite runs green without .env, so there is no config to copy and nothing to decide there.

Go?

Captain: go

(three Agent calls in one message, isolation: "worktree")

First mate:

All three back.

crew/flaky-login     dropped the 200ms sleep, waits on the auth:ready event
                     tests: 148 passed, 0 failed — 20/20 green on repeat
                     2 files, +11 −6

crew/readme-current  4 stale flags, 1 command that no longer exists
                     tests: n/a, docs only — ran every block by hand
                     1 file, +23 −19

crew/csv-export      done, but one thing is yours to call
                     tests: 151 passed, 0 failed
                     3 files, +94 −2

On csv-export: it wrote the serializer by hand instead of pulling in papaparse, since crewmates don't add dependencies without you. It handles quoting and embedded newlines and it's tested — but it's ~60 lines you now own. Say the word and I'll have it swap in the library.

It also edited src/reports/types.ts, which I hadn't assigned it. That was my scoping miss, not a crewmate wandering — the export needs a field on the row type. I trial-merged all three in a throwaway worktree: clean, no conflicts.

Captain: keep the handwritten one. merge login and readme, hold csv til I read it

First mate:

Merged crew/flaky-login — suite green. Then crew/readme-current — still green. Merged one at a time and re-ran between, since the first merge moves the base out from under the second.

crew/csv-export is untouched on its branch: git diff main...crew/csv-export.

Both merged branches still exist and their worktrees are still registered — say when and I'll prune. Node 22 bump is unstarted whenever you want it.

Limits

There is no window per crewmate to watch or type into. The captain gets your report and the branches, nothing live — which is why the report has to be accurate the first time.

Crew state lives in the conversation rather than on disk, so a restart loses the roster. It never loses committed branches: those are ordinary git branches and survive anything that happens to this conversation. Say so if a restart happens mid-run, and recover the roster with git branch --list 'crew/*'.

Download now (ZIP)

Does it work?

Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.

Reviews can't be read right now.

Your trail

Files you open will collect here, so you can find them again.

Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.

Now do this for your own.

Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.