/mattpocock-extras:auto-wayfinder <map path, effort slug, or nothing to use the only map>from Matt Pocock Extras
Drain a wayfinder map autonomously — one subagent per frontier ticket, running in parallel in isolated worktrees, with handoff-and-resume at the context limit. This session orchestrates only; it never implements.
Ships in Matt Pocock Extras. Installing the plugin adds it to Claude Code.
What the skill costs in Claude's context, stage by stage
Name and description, though model invocation is off: only you can start it.
SKILL.md joins the conversation and stays.
None: SKILL.md is the whole skill.
/wayfinder resolves one ticket per session, by hand. This drains the whole map: fan the
frontier out across subagents, fold their answers back into the map, repeat until nothing is
left that an agent may decide alone.
You never implement. Not one line of the project. Your entire write surface is:
<effort>/map.md — Decisions so far, Not yet specified, Out of scope<effort>/issues/NN-*.md — Status: lines (claiming), Blocked by: lines, and new
tickets charted per §3b/§3e; subagents write the ## Answertmp/handoffs/*.mdgit worktree add / git merge / git commit (claims, squashes) / git worktree remove /
git branch -DAnything else is a subagent's job. If you catch yourself opening a source file to "just check", that's the pull to do the work — spawn instead.
The map lives in a project repo. Started from the home repo, find that repo through the home
repo's AGENTS.md pointers and work from its root: every path below (.scratch/, tmp/,
.claude/worktrees/) and every git command is relative to it. Read its AGENTS.md or CLAUDE.md
first. It defines what this skill leaves open: the checks (the commands that make the base
branch green, and which need the e2e lock), the commit rules (types, scopes, whether
wip: passes commitlint), the install command, and the base branch (develop below).
The argument is a map path, an effort slug, or absent. Resolve it against the tracker doc
(/setup-matt-pocock-skills, default local markdown: .scratch/<effort>/map.md). Absent and
exactly one map exists → use it. Several → ask which.
Read the map body only. Not the tickets — you read a ticket only to claim it.
If tmp/handoffs/ holds files, they are unfinished work from a cleared session. Read them
before anything else, act on what they say, and delete each one as its work lands. A handoff
for ticket NN means: that ticket is mid-flight, respawn an agent seeded with the file.
Then scan git worktree list, because handoffs are not enough. A rate limit or a session
restart kills an agent before it writes one. Every .claude/worktrees/NN-* that has no DONE
handoff is mid-flight, whatever its ticket's Status: line says. Seed a fresh agent from
git log develop..HEAD and git status in that worktree, and tell it the work there is
partial and unverified: keep what is sound, re-check every claim in any ## Answer already
written, and finish the rest. Always spawn a fresh agent. Do not SendMessage a dead agent
from an earlier session: its resume is unreliable.
Repeat until a stop condition fires.
Per the tracker doc: open, unblocked, unclaimed tickets. A ticket is unblocked when every
ticket in its Blocked by: line is resolved. Parallel means the whole frontier at once,
up to the cap. Unblocked does not mean their files do not overlap: sibling tickets
routinely edit the same registration files, mocks and generated docs. §3e absorbs that.
Halt the loop and report (§6) when any holds:
## Answer names new tickets
explicitly and concretely, create them (create-then-wire, per wayfinder) and clear the
graduated patch from the fog. Anything vaguer stops the loop. (A red develop is not fog:
§3e step 5 charts it whatever else is open.)Type: grilling or Type: prototype — HITL. An agent answering the
human's side of a HITL ticket has broken wayfinder. Drain the AFK tickets alongside it, then
stop and name it.Cap the wave at 3 agents; the rest wait for the next wave. Each agent runs real servers, exports and browsers, so more agents only queue on the e2e lock and time out (four agents each booting a real server and Playwright once pushed the load to about 30 and every suite timed out).
Claim first: set Status: claimed on each ticket and commit the claims on develop
(chore(repo): claim …) before creating any worktree. That way a concurrent session skips
those tickets, and each worktree's copy of its ticket already reads claimed. Then, for each
ticket:
git worktree add .claude/worktrees/<NN>-<slug> -b <type>/<scope>-<topic> develop
Branch names follow the map's Notes. Then install deps in the worktree — a fresh worktree
has no node_modules. Use the repo's install command (usually pnpm install --frozen-lockfile)
in a subshell, so your own working directory stays in the main worktree:
(cd .claude/worktrees/<NN>-<slug> && <install command>)
Run the installs in parallel (& … wait); each takes about a minute.
One Agent call per ticket, all in one message so they run in parallel. Do not pass
isolation — you made the worktree yourself, at the path the user wants them. Prompt template:
Resolve wayfinder ticket
<path to NN-*.md>end to end.Work only inside
<abs path to .claude/worktrees/NN-slug>.cdthere first. Never touch the main worktree, nevergit worktreeanything, never checkout or merge. You are on branch<branch>; commit there as conventional commits per the map's Notes.Read
<map.md>for Destination and Notes, and invoke every skill the Notes name. Read the ticket for the work and its acceptance criteria. Meet them — including the tests."Every check" means
<the repo's checks, for the projects you touch>(Nx's cache is fine here, since the wave's gate runs it fresh). A failure your ticket did not cause stays out of your diff: end your report withdevelop is red: <spec> — <sha that broke it>.Commit at every milestone, following the repo's commit rules (
<types and scopes; whether wip: passes>). They are squashed later. You can be killed without warning by a rate limit or a session restart, and only committed work survives that.Other agents run in sibling worktrees at the same time, sharing one scratch directory. Run every real
serve, export, browser or Playwright run underflock <abs path to main worktree>/tmp/e2e.lock <cmd>, so only one runs at a time; unit tests need no lock. Prefix your scratch files with<NN>-and pick a random free port. Record each process's pid as you start it ($!), and before you return, kill exactly those pids; matching by pattern (pkill -f) also hits the user's own processes. If you cannot kill one, put its pid in the handoff.Never edit
map.md. Write your## Answerand setStatus: resolvedlast: only after every check is green and the work is committed. The Answer states only what you verified.Before you return, always write
tmp/handoffs/<NN>-<slug>.md(in the main worktree, path<abs path>):
- Finished: a single line
DONEplus the commit shas.- Not finished: what you learned that isn't already in the ticket, commits, or the diff (reference those by path/sha, never restate them); exactly what remains; which skills the next agent should invoke. Redact secrets — this file becomes a prompt.
If a context guard note arrives telling you your window is nearly full, obey it immediately: no new work, write the handoff, return. Do not try to squeeze the ticket in.
Return a report of at most 15 lines: ticket name, done/partial, commits, what you decided, anything the map should know.
Agents return; now you do the serial parts they could not:
Merge, one at a time. Treat the ticket as partial if it is resolved but has
uncommitted changes, or if its handoff is not DONE. For a finished ticket:
Catch its branch up inside its own worktree:
git -C <worktree> merge develop -m "chore(repo): merge develop into <topic>", with the
message fitted to the repo's commit rules. develop has usually moved, because siblings
landed first. commitlint checks the merge message too.
On conflict, never resolve it yourself, and never in the main worktree. Spawn one
agent in that worktree with /resolving-merge-conflicts, with model: "sonnet". The
work is mechanical and short, and Sonnet costs half as much. Tell it:
## Answer of this ticket and of every ticket merged since its branch was cut;/** comment openers;Meanwhile the main worktree stays clean, so you can go on merging other tickets.
Squash into develop: git merge --squash <branch>. This is now conflict-free.
Write one conventional-commit message yourself, from the agent's commits and report:
the main scope, what landed, key decisions and the ADR number. End it with the
attribution line.
Append to Decisions so far: one entry per resolved ticket, at most two lines, the
gist plus a link. Do not repeat the ticket's ## Answer; the link carries the detail. Every
agent loads the whole map into a context it re-reads on each turn, so each extra line is
paid for again on every turn of every later agent. Name a trap only when later tickets must
act on it. You are the only writer of map.md; that is why subagents are forbidden it.
Clean up: git worktree remove, then git branch -D (the squash on develop is its
record), and delete the DONE handoffs. Keep partial handoffs. Surface to the user any
pid a handoff reports as still running. Do not kill it yourself if the agent was refused
permission to.
Partial tickets: leave Status: claimed, keep the handoff, and respawn from it next
wave — a fresh agent, empty context, seeded with the file. That is "clear and continue":
a subagent cannot clear itself, only be replaced.
Gate the wave. After its last squash, develop must be green. Add a detached worktree
(git worktree add .claude/worktrees/gate --detach develop, then install) and spawn one
agent there, model: "sonnet": run every one of the repo's checks across all projects with
--skip-nx-cache, the e2e ones under the e2e lock. Without --skip-nx-cache Nx replays
cached results, and the gate proves nothing. It fixes nothing and reports each failing spec
with the commit that broke it. Remove the worktree after.
Every failure it reports, and every develop is red: line in an agent's report, becomes a
fix/ ticket now (create-then-wire), even while other tickets are open: a red develop
taints every later ticket's checks. The ticket names the spec, the failure and the breaking
sha; it blocks the nearest open exit ticket and leads the next wave.
context-kit's ctx-guard hook, a PreToolUse hook (context-kit is a dependency of this plugin, so
the hook is on wherever this skill is), measures every session — yours and each
subagent's — and warns the one that is running out. No tool reports context usage directly
(/usage is plan rate limits, /context is interactive-only), but the hook payload carries
enough to derive it:
agent_id; yours does not — that is how sessions are told apart.<transcript_path sans .jsonl>/subagents/agent-<agent_id>.jsonl.usage is the context: input_tokens + both cache halves.Past the threshold the hook returns additionalContext, which lands in that session as a
<system-reminder> — so a subagent is told to hand off from inside its own run, without you
polling it. It fires once per session (a nag every tool call would burn the context it guards).
The denominator is the session's real window, resolved in this order: CLAUDE_CTX_WINDOW
if set, else the project's .claude/.ctx-window — which context-kit's statusline publishes from
context_window.context_window_size (see context-kit's README setup step) — else 200000. The statusline is the only place the
harness hands out that number: the Models API would answer a different question
(max_input_tokens, the model's ceiling — 1M on Opus 5), and a session can run a 1M-capable
model on a 200k window, or on anything from 100k up via --autocompact.
Set CLAUDE_CTX_WINDOW explicitly if you spawn subagents on a different model than this
session — the published number is the session's, and e.g. Haiku 4.5 caps at 200K where Opus 5
reaches 1M. Threshold override: CLAUDE_CTX_THRESHOLD (default 80).
Subagents also hand off at an absolute 200k tokens (CLAUDE_CTX_AGENT_MAX), whatever the
window. That cap is about cost, not space. Every turn re-reads the whole context from the
cache. On a 1M window, 80% never fires: one ticket ran 133 turns and reached 330k. A fresh
agent seeded from a handoff reloads for about 40k. A crash-resume is the expensive path:
resuming an old transcript writes all of it back into the cache at 2× the input price.
The guard tells you. Act between waves, never mid-wave: let the running agents finish, fold them in (§3e), then:
tmp/handoffs/_orchestrator.md: which map, which tickets are mid-flight and where
their handoffs are, which worktrees exist and on what branches, what stop condition (if
any) was pending. Reference the map and tickets by path — do not restate them./clear, then re-run /auto-wayfinder <map>. §2 picks it up from the file.You cannot clear your own context; that step is the user's.
Always end with it — clean finish, halt, or handoff:
| Ticket | Agent | Outcome | Commits | Notes |
Then: tickets resolved this session, whether develop is green (§3e step 5), what remains
open, why the loop stopped, and anything
needing the user: HITL tickets, fog to chart, merges that fought back, and processes left
running.
Tickets resolved by name, never by bare number. #04, #05, #09 is a wall; names read.
What SKILL.md sets; muted values are Claude Code's defaults
npx claudepluginhub tinesoft/ai-plugins --plugin mattpocock-extrasOther plugins' skills for the same job