Repository navigation
Description
Summary
A worktree-isolated agent (Agent with isolation: "worktree", or any subagent with a pinned cwd)
cannot invoke any skill that declares two or more ! precompute commands when at least one is a
git command. The invocation fails before the skill body is ever reached.
Discovered while running /session-flow:handoff at the end of an inbox item. It is not a
handoff-specific bug — handoff is just where it surfaced. 42 skills across this marketplace
match the pattern, including most of the core workflow: source-control:commit,
source-control:pull-request, source-control:worktree, implementation:implement,
verification:confirm, review:fanout, session-flow:retro, session-flow:handoff,
planning:plan, testing:plan, toolchain:check.
Reproduction
From an agent isolated in .claude/worktrees/<name>:
Skill(session-flow:handoff)
fails with:
This agent is isolated in the worktree
C:\...\.claude\worktrees\agent-a4324d31193dece2f, but this
command is too complex to verify that it stays inside the worktree; break it into plain, separate
commands. Refusing to run it — a worktree-isolated agent's git operations must target its own
worktree.
Identical failure with and without arguments. The skill body never runs.
Root cause
plugins/session-flow/skills/handoff/SKILL.md declares four precompute lines:
Current branch: !`git branch --show-current 2>/dev/null || echo "unknown"`
Claude session: !`echo "${CLAUDE_CODE_SESSION_ID:-unknown}" || echo "unknown"`
Uncommitted changes: !`git status --porcelain 2>/dev/null | head -20 || echo "clean"`
Recent commits: !`git log --oneline -5 2>/dev/null || echo "no commits"`
Each line passes the guard individually — verified one at a time:
| precompute line | result |
|---|---|
git branch --show-current 2>/dev/null || echo "unknown" |
ok — main |
git status --porcelain 2>/dev/null | head -20 || echo "clean" |
ok — (clean) |
git log --oneline -5 2>/dev/null || echo "no commits" |
ok — 5 commits |
Joined with ; into a single invocation, the exact guard error reproduces:
git branch --show-current 2>/dev/null || echo "unknown"; echo "${CLAUDE_CODE_SESSION_ID:-unknown}" || echo "unknown"; git status --porcelain 2>/dev/null | head -20 || echo "clean"; git log --oneline -5 2>/dev/null || echo "no commits"
…this command is too complex to verify that it stays inside the worktree…
So the skill runner appears to concatenate all ! precompute commands into one shell
invocation. The guard's complexity heuristic rejects the compound form, even though every component
is individually safe and every one of them is read-only.
Blast radius
Counted across plugins/**/SKILL.md:
- 172
!precompute lines across 62 skills - 123 git-bearing precompute lines across 49 skills
- 42 of those 49 declare two or more git precompute lines
Any skill with ≥2 precompute lines and ≥1 git command is affected, so the true count is at least 42.
This makes worktree-isolated agents unable to use the marketplace's own core workflow skills — which
is precisely the context those skills are most needed in, since CLAUDE.md and the worktree
convention push agents into worktrees for parallel work.
Impact
Fails closed and loudly, which is the good news — no silent degradation, no wrong output. But the
skill is simply unavailable, and the fallback is for the agent to hand-write whatever the skill would
have produced. In the session that found this, the handoff document had to be written by hand and
could not be placed in its canonical .work/handoffs/ location at all (see the second issue below).
Suggested directions (not verified end to end)
- Run precompute commands separately rather than joined. Each line already passes the guard on
its own; if the runner issued them as N invocations, the problem disappears with no change to any
skill. This looks like the correct fix and it is upstream of the marketplace. - Failing that, simplify the precompute lines in the affected skills so the joined form stays
within the guard's tolerance — e.g. drop the|| echo "…"fallbacks, which mostly guard against a
non-git directory that the guard itself already implies is not the case. - Degrade rather than abort. A precompute that cannot run could yield an empty value and let the
skill body proceed; every one of these lines is contextual, none is load-bearing for correctness.
Direction 1 is the only one that fixes all 42 skills at once, but it may live in the harness rather
than in this repository — worth confirming before any skill here is edited.
Related observation (separate, may warrant its own issue)
A cwd-pinned subagent also cannot call ExitWorktree:
ExitWorktree cannot be called from a subagent with a cwd override … This agent is already
isolated; use Bash withcdfor directory changes within it.
Combined with the guard refusing writes to the shared checkout, an isolated agent has no path to
write a file that is meant to live outside its worktree — such as a handoff in .work/handoffs/,
which is deliberately shared so it survives worktree cleanup. In this session the worktree was
reclaimed by cleanup within minutes of the merge, so a handoff written inside it would have been
destroyed anyway.
Activity
kyle-sexton commentedon Jul 26, 2026
Diagnosis completed — with a control experiment, and the "complexity" framing in the issue body was wrong
I went back and tested this properly rather than trusting the guard's own wording. Complexity is
not the trigger. The presence of
gitin the composed precompute command is.Control experiment
session-flow:handoff||, redirects)session-flow:find-handoff||, redirects)knowledge:course-digest||, two multi-statementnode -epayloads)course-digest's precompute is unambiguously more complex thanhandoff's — it embeds twoinline Node programs with
require,process.env, ternaries andfs.existsSynccalls — and itsails through. So the guard is not rejecting compound shell.
Why
find-handoffis the decisive casefind-handoffhas exactly one git precompute line among four:That single git line passes the guard when run on its own — I ran the exact string and got
main. The other three contain no git at all. Yet the skill is refused.If precompute commands were evaluated individually, nothing here would trip. They are therefore
not evaluated individually — the harness composes them into one shell invocation, that
invocation contains
git, and the worktree guard refuses a git-bearing command whose target itcannot statically verify.
Where the fix lives
Both halves are harness-owned, not marketplace-owned:
too complex to verify that it stays inside the worktree,isolated in the worktree) appears nowhere in this repository, and nowhere in~/.claude/settings.json,~/.claude/hooks, or~/.claude/references. It is not a plugin hook we control.https://code.claude.com/docs/en/skills#inject-dynamic-context — "The
!`<command>`syntaxruns shell commands before the skill content is sent to Claude… This is preprocessing, not
something Claude executes."
Notably the same page says "Each
!`<command>`executes immediately", which reads asper-command execution. The observed behaviour contradicts that, so either the composition is an
undocumented implementation detail or the docs are imprecise — worth raising upstream either way.
So the root fix is not actionable in this repository.
But there IS an actionable in-repo workaround, and it is now proven
Since a precompute block with no git runs fine under isolation, any affected skill can be made
isolation-safe without touching the harness:
calls. This is the cleanest option and loses nothing — a worktree-isolated agent can run
git branch --show-current,git status --porcelain, andgit log --oneline -5perfectly wellone at a time (I did so throughout the session that found this). Cost is one extra round-trip and
the model doing the acquisition rather than the preprocessor.
handoffspecifically, branch/status/log are nice-to-have framing, not load-bearing for correctness.
the worst option for exactly the 42 skills most needed in worktree workflows.
Option 1 is the one I would take, and it is a mechanical, testable change per skill.
Suggested split
This issue is really two:
42 skills at once, no marketplace change.
Happy to take the second on a per-plugin basis; the first needs to go to Anthropic.
[-]fix(skills): worktree-isolated agents cannot invoke any skill with 2+ git precompute commands (42 skills affected)[/-][+]fix(skills): worktree-isolated agents cannot invoke any skill whose precompute block contains a git command (42 skills affected)[/+]kyle-sexton commentedon Jul 26, 2026
This was generated by AI during triage.
Triage: the defect is real and reproducible — but the stated predicate is falsified, and 42 is not the blast radius
This was verified by running real worktree-isolated agents against real skills, not by re-reading the report. Three independent isolated agents, fresh contexts, different worktrees.
The bug reproduces exactly as described
Skill(session-flow:handoff)from a worktree-isolated agent errors before the skill body loads, with the guard text the report quotes verbatim. Confirmed 3 out of 3 attempts across 2 separate agents, including a same-agent repeat — deterministic, not a flake.The report's supporting reproduction also holds. In an isolated worktree:
;into one Bash call → refused, identical guard textSo the report is right that a joined form is refused where the components are individually fine, and right that the failure is loud and fails closed. That much is solid and needed no defence.
What the count claims actually check out to
The grep-level tallies mostly reproduce against
origin/main(fe331930), with drift consistent with the tree having moved since filing:So 42 is an honest count. It is just not a count of affected skills.
The predicate does not predict failure — this is the finding
The report states: "Any skill with ≥2 precompute lines and ≥1 git command is affected, so the true count is at least 42." Directly tested:
session-flow:handoffsession-flow:orientsession-flow:retroreview:fanoutsource-control:commitplanning:plandiscovery:exploredocs-hygiene:audit-noisetoolchain:checktoolchain:lintdocs-hygiene:compress7 of 11 skills satisfying the report's predicate load without incident. Every one of them is on the list of 42.
Order was ruled out as the confound: one agent invoked
commitas its very first tool call (loaded), thenhandoff(errored); another invokedorientfirst (errored). Results are stable per skill regardless of position.The stated root cause is therefore under-determined
The report infers the runner "concatenates all
!precompute commands into one shell invocation" and that the complexity heuristic rejects the compound form. If that were the whole story,source-control:commitwould be the first casualty — it has the largest precompute block in the marketplace and by far the hairiest lines, including command substitution,{ … }grouping, a${R:-}parameter expansion, and chained&&/||. It loads. Meanwhilehandoff's four comparatively plain lines are refused.Every simple discriminator was checked against the observed results and each is contradicted by at least one row: it is not the line count, not the git-command count, not the presence of
2>/dev/null, notgit status --porcelain | head, not||fallbacks, and not${VAR:-default}expansion. Whatever the guard is keying on, this triage could not isolate it, and neither the report's explanation nor any hypothesis tried here survives the data.That is not a reason to doubt the bug. It is a reason not to act on the stated mechanism.
Consequences for the suggested directions
Why human-gated rather than agent-ready
ExitWorktree, and combined with the write guard has no path to write a file outside its worktree, such as the deliberately-shared handoff location — is a different defect with a different owner. The report says it "may warrant its own issue"; it does. Splitting it is a maintainer call, not something to decide inside a fix PR.For whoever picks this up
session-flow:handoffone at a time and re-invoke until it loads. That identifies the offending construct in minutes and turns direction 2 from guesswork into a targeted change.session-flow:handoff,session-flow:orient,session-flow:retro,review:fanout. Three of the four are session-management skills, which is worth noting given they are most needed in exactly the isolated, disposable context where they fail.source-control:commit,planning:plan,discovery:explore,docs-hygiene:audit-noise,toolchain:check,toolchain:lint,docs-hygiene:compress.On priority
Filed
priority: medium. It fails closed and loudly with no silent degradation or wrong output, and the confirmed set is 4 skills rather than the reported 42 — but the impact on those 4 is total, and the worktree convention actively pushes agents into the context where they break. If the empirical enumeration comes back substantially larger than 4, this should be re-rated up rather than left at the tier this triage assigned on a 4-skill sample.Role labels resolved from
.work-item-tracker.json, which declares noconfig.role_labels— the canonical roles therefore run on their documented defaults (agent-ready/needs-human); both were confirmed present in this repo's live label set before use.kyle-sexton commentedon Jul 27, 2026
Probe results — the composition mechanism is now confirmed, not inferred
Run from a real
Agentwithisolation: "worktree"atmain=f6fda808. Everything below isobserved, not derived.
The decisive pair
code-tidying:batch-simplify2>/dev/null || echo)knowledge:course-digest||)session-flow:find-handoffsession-flow:handoffbatch-simplifyandfind-handoffare the discriminator: the same git precompute line passesalone and fails inside a multi-line block. That rules out per-line evaluation, and it also
falsifies the narrower "just simplify each git line" theory —
find-handoff's git line has no pipeand is about as simple as a git precompute line gets.
Refusal text, verbatim and identical for both refused skills:
Note the tail of that message: it names a redirect, but
course-digestis full of redirects andloads fine. The redirect is not the trigger; git inside a composed block is.
Rule, as observed: a skill is refused iff its precompute block contains a git command and
has more than one precompute line.
The fix is viable — this was the load-bearing unknown
Four ordinary git commands, each as its own Bash call from inside the isolation:
git rev-parse --show-toplevel— PASSgit branch --show-current— PASSgit status --porcelain— PASSgit log --oneline -5— PASSSo "delete the git precompute lines and re-acquire the values in the skill body, one command per
Bash call" works. That was previously inferred from the rejection reason and had never been tested.
Corrected blast radius
Repo-wide sweep of
plugins/**/SKILL.mdat9f73fc2e, classified by total precompute lines:code-tidying:batch-simplify,discovery:research,discovery:research-deep,planning:audit-answers,planning:design,planning:design-handoff.18 plugins: session-flow (7), planning (7), source-control (5), testing (4), docs-hygiene (4),
discovery (4), code-tidying (3), toolchain (2), review (2), prototype (2), claude-ops (2), and one
each in verification, repo-hygiene, implementation, debugging, codebase-health, bug-report,
architecture.
Two of the 43 were verified by direct invocation; the other 41 are classified by the confirmed
mechanism, not individually invoked.
This supersedes the ready-to-apply spec's file list, which covers
session-flow+source-controlonly — 12 of the 43. The spec's per-file rule and its verification method are both still correct;
only its scope was short.
Scoping consequence
Each plugin owns its own
plugin.jsonversion andCHANGELOG.md, so a full remediation is one PRper affected plugin — 18 PRs, not 2. Worth deciding explicitly whether to do the full sweep, do
the highest-traffic plugins first and track the rest, or hold.
Also worth noting:
research/research-deep/design/design-handoffsit in theloads-today set only because they have exactly one precompute line. Any future PR that adds a second
precompute line to one of them silently moves it into the refused set. That is a sharp edge no gate
currently catches.
[-]fix(skills): worktree-isolated agents cannot invoke any skill whose precompute block contains a git command (42 skills affected)[/-][+]fix(skills): worktree-isolated agents cannot invoke a skill whose multi-line precompute block contains a git command (43 skills refused, 18 plugins)[/+]fix(session-flow): address review — stale cross-reference, failure ha…
fix(session-flow): restore the dropped output bound and correct a fal…
fix(source-control): restore the dropped output bounds and state the …
fix(source-control): quote the substituted repository root in commit'…
fix(session-flow): move git out of skill pre-compute so worktree-isol…
fix(source-control): use a portable placeholder in the Windows path e…
10 remaining items
fix(claude-ops): hoist lanes/observability pre-compute shell expansio…
fix(education): hoist teach pre-compute workspace probe into a bundle…
fix(claude-memory): hoist audit pre-compute shell expansion into a bu…
fix(claude-ops,review,source-control): work the week-32 platform chan…
feat(scripts): add warn-only gate for git-bearing multi-line precompu…
kyle-sexton commentedon Aug 13, 2026
Frontier disposition (drain session)
Ruling: Close as not planned for this drain wave (frontier consensus).
Dual-panel drain ruling: advisory, superseded, folded into a program umbrella, or blocked on a host/design carrier without an actionable in-repo slice this session. Re-open with a concrete acceptance brief if a consumer needs the work.
KEEP set for this wave: standing telemetry; host-physical Class C (#631 family); program umbrellas #530/#531/#532/#535; live design carriers #1500/#1553/#1668/#1695/#1716/#1681/#1718; #1360.
docs(ssot): wave 3 — probe-ladder normalization; C13 deferred
docs(ssot): wave 3 — probe-ladder normalization; C13 deferred
chore(overengineering): de-duplicate the baseline spec and regenerate…
fix(overengineering): never give a detached checkout a branch identit…
fix: apply the three Codex review findings and pin the no-worktree-ba…
docs: record precompute injection sweep status on main (#3544) (#4830)
docs: remove agent-encoded decisions and correct decision records (#5288