agentleFS
vmobifystudiovmobifystudio/app-dev-team/skills/agent-isolation/SKILL.md

agent-isolation

Skill5 starsChanged 8 days agoMITView on GitHub

On an app-dev-team project, use before spawning any agent that writes files, and as every IC's first and last action — one git worktree per writer, explicit-path staging, confirm the mutation landed. Used by the /app-build orchestrator and every IC.

  • Deletes or force-pushes

The file

We split this skill into the rules it gives an agent

3 rules. About 0 are common, 2 are distinctive, and 1 is very specific to this project.

  • ≈0

    Common · estimate

    Many files like this have a rule of this kind.

  • ≈2

    Distinctive · estimate

    This author's own choices. Worth a look.

  • 1

    Very specific

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

  • Common
  • Distinctive
  • Very specific
  1. Distinctive:

    If a path you didn't touch appears, stop and unstage it.

    line 54
  2. Distinctive:

    Never believe an edit worked because the tool returned success.

    line 58
  3. Very specific:

    If HEAD is not where you left it, or files you did not write have appeared, stop.

    line 78

≈ “Common” is an estimate: at least 1 in 5 of the 383,637 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

Agent isolation

Parallel agents that share one working tree corrupt each other, silently: every agent reports DONE, the tests pass, and the review reads a diff that contains someone else's changes. A read-only agent is not exempt — one git add -A ships whatever another agent left in the tree.

Everything below applies to every agent. The spawning half (leases, the spawn-gate.sh check, reaping, which shared-tree writes are safe, a project that cannot use worktrees) is references/orchestrator.md — the /app-build loop already runs its commands, so read it only when one of those questions comes up.

Rule 1 — work only in the worktree you were given

Your spawn prompt names your worktree (.agent-wt/<owner>-<n>). It is your project root; never leave it. Before you write anything, cut the ticket's branch from the integration branch the prompt names: git checkout -b feat/APP-NNN-short-slug <integration branch> (a QA- ticket: the qa/QA-<sprint>-w<n> branch the prompt prints). Given no worktree? Say so in your first line, branch in the repo root, and treat Rule 5 as live.

Shared-tree files are the exception, and only these: your review verdict (docs/53-reviews/APP-NNN-cycle-N.md, unique per ticket and cycle) and the append-only logs written through their CLI. docs/31-board.md is generated, CLI-only — never edit it; board.mjs move is its only writer.

Rule 2 — never stage blindly, and never run a repo-wide destructive command

Banned, without exception:

git add -A        git add .        git add --all        git commit -a
git reset         git stash        git checkout -- .    git clean

The top row attributes someone else's work to your ticket. The bottom row destroys it, and none of those can be undone from inside your run — one git stash + git reset for "a clean tree" once discarded 22 files of another agent's live work.

If you need a clean tree to test, copy the repo to a temp dir and dirty that — cp -R . "$TMP", or git worktree add a scratch worktree. Never clean the tree you are standing in.

Stage by explicit path, every time, then look at what you staged before committing:

git add android/app/src/main/java/com/sandbox/todo/ui/TodoListScreen.kt \
        android/app/src/test/java/com/sandbox/todo/ui/TodoListViewModelTest.kt
git diff --cached --numstat

If a path you didn't touch appears, stop and unstage it.

Rule 3 — confirm the mutation landed

Never believe an edit worked because the tool returned success. A pattern that didn't match, a path that didn't exist, a write to a stale worktree — all look identical to success.

git diff --numstat            # something changed, and it is what you think
git diff -- <the one file>    # the change is the change you intended

For destructive checks, prefer deleting a guarded call to renaming it: a rename is a compile error the moment it is wrong; a deletion still compiles and 0 failures looks like success.

Rule 4 — verify agents by running their work, not by reading their reports

  • A developer's DONE is checked with verify-done.sh — branch, commits, files, test exit code.
  • A rule, guard, or test an agent wrote is checked by making it fail on purpose (defect-hunting §3).
  • An audit finding is checked by reproducing it, not by re-reading it.

Rule 5 — if HEAD moved under you, stop and report

If HEAD is not where you left it, or files you did not write have appeared, stop. Do not git reset --hard, git checkout -- ., git stash drop, or delete an untracked file to "clean up" — another agent's uncommitted work may be in that tree. Write a blocker naming what moved and let tech-manager resolve it. A stalled ticket is cheap; a discarded working tree is not recoverable.

Rule 6 — you never compose or mint

spawn-prompt.mjs compose and board.mjs actor mint are the orchestrator's; your token is the one in your spawn prompt. A token refusal, or a hook saying a prompt must be composed → stop and return BLOCKED: naming it; the orchestrator re-spawns you with a freshly composed prompt. Never work around it.

Output contract

Report Worktree: .agent-wt/<owner>-<n>, Branch:, Staged (explicit paths): and Mutation confirmed: inside your role's output contract (spawn-prompt.mjs inlines it; team-protocol is the reference).

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.