subagent-conflict-detection — independently scanned and version-tracked by SaferSkills.
SaferSkills independently audited subagent-conflict-detection (Agent Skill) and scored it 100/100 (green). The audit ran 55 deterministic rules across Security, Supply Chain, Maintenance, Transparency, and Community; it found 0 high-severity and 0 lower-severity findings. The full rule-by-rule trace and per-finding evidence are below. Free, methodology-open.
Findings & checks · 0 flagged
Every scanned point with the score it earned and what moved between them.
First recorded scan — no prior version to compare against.
The primary manifest — the file an agent reads to learn what this artifact does.
Before dispatching a new subagent via the Agent tool — especially with isolation: "worktree" — if ANY other subagent is currently running or has an active worktree.
Trigger phrases / situations:
Agent tool when git worktree list shows non-main worktrees[in_progress] tasks in TaskList that involve subagent workSkip when: dispatching the first subagent in a session, or all prior subagents have completed AND their worktrees are cleaned/merged.
git worktree list | grep -v "\[main\]" | awk '{print $1}'For each worktree path, capture:
git -C <path> status --shortgit -C <path> log -1 --format=%sRead the planned subagent's task prompt. Extract:
Sources/.../Settings/)For each in-flight subagent's dirty-file set vs the new dispatch's likely scope:
isolation: "worktree". Note in dispatch prompt: "in-flight subagent X is editing target Y; do not touch files Z."isolation: "worktree" branches the subagent's worktree from the current HEAD of the dispatching checkout at dispatch time. So WHAT HEAD points at is part of the dispatch contract — get it wrong and the agent silently works against the wrong base.
The classic failure: you merge PR A to main, then immediately dispatch a subagent for follow-up work that depends on A. If HEAD is not actually on the post-merge main (e.g. a background build left it detached, you forgot to git checkout main && git reset --hard origin/main, or the branch you're on predates A), the worktree branches from a pre-A base. The agent then can't see A's new symbols/files — it fails to compile against APIs that "should exist", or worse, re-implements against the old shape. Code review may not catch it (the agent's local build can pass on the stale base); it surfaces only when you try to build the integrated result.
Before dispatching, confirm the base:
git rev-parse --abbrev-ref HEAD # on the branch you think you are?
git log --oneline -3 # does it include the commit/PR this work depends on?
git merge-base --is-ancestor <dep-sha> HEAD && echo "base OK" || echo "STALE BASE"If the work depends on a just-merged PR, sync first (git checkout main && git fetch && git reset --hard origin/main — reset --hard discards uncommitted local changes, so stash them first) THEN dispatch. <dep-sha> above is the commit your work depends on (e.g. the merged PR's commit on main). State the expected base SHA in the dispatch prompt and tell the agent to verify it (git log --oneline -5; confirm a key file/symbol exists) before coding.
Real incident: a DEBUG test-hook subagent was dispatched right after a fix merged tomain, but the dispatching HEAD was a pre-merge commit. The worktree branched from the stale base, so the new code referenced aninitparameter and a file that only existed post-merge → 2 compile errors that the agent's own package build hadn't surfaced. Cost a full cherry-pick-onto-correct-base + rebuild cycle.
When ANOTHER Claude session (or human) is actively editing the same working checkout — or a git submodule vendored into your repo (e.g. a shared .claude/skills/<plugin> submodule) — do NOT edit that shared checkout in place. Two writers on one working tree clobber each other's uncommitted edits, fight over branch HEAD, and produce confusing diffs.
Instead, collaborate through isolation + PR:
origin/main (not the shared checkout's possibly-dirty local state):git -C <shared-repo-or-submodule-path> fetch origin && git -C <…> worktree add /tmp/<name> -b <branch> origin/main
This is the cross-session mirror of the within-session conflict check: same goal (no two writers on one tree), different scope (independent sessions / submodules rather than your own in-flight subagents). When unsure whether another agent is on a path, treat it as occupied and use the worktree+PR path — it's cheap insurance.
When overlap detected, present to user:
⚠️ Conflict detected between new dispatch and in-flight subagent:
In-flight: <subagent-id> editing:
- <file 1>
- <file 2>
New dispatch would touch:
- <file 1> ← OVERLAP
- <file 3>
Options:
1. Serialize — wait for in-flight to merge, then dispatch
2. Carve — rewrite new dispatch prompt to exclude overlapping files
3. Proceed anyway — risk: subagent commits compete on push--force-with-lease does NOT silently overwrite — it rejects the push when the remote ref has moved since the client last fetched. The real footgun is a different one: worktree B rebases onto a stale base (e.g. the main SHA from before worktree A pushed), producing a divergent history; resolving it then requires a force-push that can drop worktree A's commits. Prevent this by serializing or carving scopes before dispatch.This skill operationalizes docs/methodology.md §派發契約 item 9 (Leader pre-flight). The pre-flight checklist explicitly lists "kill orphan procs" + "rebase WIP onto main" + "mise trust" — this skill adds the conflict-detection step before those.
If git worktree list shows stale entries (worktree dir gone but git registration alive), they are NOT a conflict source — they just need git worktree prune. Don't block dispatch on stale registrations; check ls <worktree-path> to confirm the directory actually exists before computing dirty-file intersection.
Leader is about to dispatch: "Senior Developer for error funnel refactor — files: AppComposition/Live.swift, AppUI/Root/RootViewModel.swift, Tests/RootViewModelTests.swift"
`git worktree list` shows in-flight subagent `agent-abc123` editing:
M Sources/AppUI/Components/MonetizationStateController.swift
Intersection: NONE (different AppUI subdir).
Verdict: dispatch safely. Note in prompt: "in-flight subagent on MonetizationStateController — do not touch that file."~30 seconds. Free. No account. Every finding cites a rule and a line of evidence.