agentleFS
alexgrebeshok-coderalexgrebeshok-coder/dirigent-skills/skills/worktree-dispatch/SKILL.md

worktree-dispatch

Skill0 starsChanged 4 months agoMITView on GitHub

Use when writing a task prompt (наряд) for a subagent that runs with worktree isolation, or any isolated working copy — especially when the prompt must include concrete commands, test invocations, or file paths. Also use when reviewing why an "isolated" agent ended up mutating the main checkout. Triggers — isolation:"worktree", "работай в worktree", составление наряда исполнителю с изоляцией, npm --prefix in a dispatch prompt.

1 other project uses a version of this.

Adopted by

Most recently taken up by

  • Other versions1 project uses a version of this.

    Word for word · 0

    None found.

    Edited · 0

    None found.

    Wrote their own version · 1

    1. gonnarun/sdp★ 0same name

    How matches are found. Word for word: the exact same text. Edited: shares passages with this file (“99% same” means 99% of its five-word phrases also appear here; 10% or more counts). Their own version: similar meaning, or, weakest, the same name. We can’t tell which project had it first. Projects are counted among the 200 most-starred candidates, and mentions are links to the repository we found, up to 50 per site, so both counts are a floor.

  • In this repository9 other files it gives its agents.

The file

We split this skill into the rules it gives an agent

1 rule. About 0 are common, 1 is distinctive, and 0 are very specific to this project.

  • ≈0

    Common · estimate

    Many files like this have a rule of this kind.

  • ≈1

    Distinctive · estimate

    This author's own choices. Worth a look.

  • 0

    Very specific

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

  • Common
  • Distinctive
  • Very specific
  1. Distinctive:

    Acceptance closes the loop: before merging the agent's branch, confirm the reported pwd is the worktree, not the main checkout.

    line 21

≈ “Common” is an estimate: at least 1 in 5 of the 350,495 skill files we read have a rule of the same kind, not the same words. “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

worktree-dispatch — isolation dies in the prompt, not the runner

Overview

Worktree isolation is only as strong as the words in the dispatch prompt. The runner gives the agent an isolated copy as its cwd — and then one absolute path in your instructions (cd /path/to/main-repo && npm test) walks the agent right back into the main checkout. The isolation didn't fail; your prompt revoked it.

Real incident, twice in one day: a dispatch prompt said "you're in an isolated worktree of ~/repo — work in it" and later gave npm test --prefix ~/repo. The agent worked in the main tree on its own branch; the orchestrator then merged another branch into it blind. Baseline reproduction: asked to write a dispatch prompt "with concrete commands and paths", an agent produced cd /abs/path/to/main && npm test — step 3 of an otherwise perfect prompt.

The contract (write every worktree наряд this way)

  1. The main checkout path appears at most ONCE, descriptively: "an isolated copy of <main-path>" — never as a place to go or a command argument.
  2. Every command is cwd-relative. npm test, git status, node tools/x.mjs. The isolated copy IS the agent's cwd — relative commands are automatically correct in it.
  3. Files outside the repo (research notes, shared configs) — absolute paths are fine, but mark them read-only context: "read ~/.claude/research/x.md (outside the repo, read-only)".
  4. First-move contract: the agent's first command is pwd && git branch --show-current, and its report must state both. Costs one line; makes "where did this work actually happen" checkable at acceptance.
  5. Acceptance closes the loop: before merging the agent's branch, confirm the reported pwd is the worktree, not the main checkout.

Forbidden in the prompt body

Never writeBecauseWrite instead
cd <main-path> && <cmd>walks the agent out of isolation<cmd> (cwd-relative)
npm test --prefix <main-path>runs tests against the MAIN treenpm test
git -C <main-path> <verb>mutates the main checkout directlygit <verb>
"работай в <main-path>"names the main tree as the workplace"work in your working copy (already your cwd)"

Red flags — STOP and rewrite the наряд

  • Any absolute path to the main checkout inside a command line
  • The prompt says "isolated worktree of X — work in X" (second clause revokes the first)
  • You can't tell, reading the prompt, which directory a command will execute in
  • The agent's report has no pwd/branch declaration and you're about to accept anyway

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.

No reviews yet

People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.

  • It worked
  • Partly
  • It didn't
What did you use it for? e.g. Reviewing pull requests in a Rails app

Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.

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.