Start In A Fresh Worktree
Use this skill at the start of every session contributing to WarpDrive itself, before reading code or making any change. Each session gets its own git worktree branched from a freshly fetched origin/main — never the shared primary checkout, and never whatever commit that checkout's HEAD happens to be parked on.
Steps
Don't work in the primary checkout, even for a "quick" one-file change.
pnpm installin this repo also builds every package and rewrites hardlinks into thenode_modulesof every other package and test app that depends on it (see Setting Up The Project), so two sessions installing or building in the same checkout clobber each other's build output — and the failures show up later as stale or half-writtendistcontent, not as an obvious conflict.Branch from a freshly fetched
origin/main, not from the currentHEAD. Any long-lived checkout is usually sitting on an unrelated feature branch; branching off it silently folds someone else's unmerged commits into your diff and your PR.mainis also the branch PRs target, so branching anywhere else guarantees an unnecessary rebase.shgit fetch origin main git worktree add -b <branch-name> ../warp-drive-<topic> origin/mainAlways make the worktree a sibling of the repo (
../warp-drive-<topic>), never a directory nested inside it. This is not a tidiness preference — Node's resolution algorithm searches upward fornode_modules, so a worktree at<repo>/anything/my-worktreesilently resolves any dependency orbinits own install hasn't provided from<repo>/node_modules— the primary checkout's tree. Three properties of this repo turn that into a wrong answer rather than an error:pnpm-workspace.yamlsetshoist: falseand uses injected workspace packages specifically to keep each test app's dep tree isolated,pnpm installhardlinks built output into consumers'node_modules, and the packages lean on branded types. So a nested worktree gets the other checkout'sdist, mismatched versions, duplicate modules in a bundle, and private-brand type errors that point nowhere near the cause. A sibling has no shared ancestor holding anode_modules, so resolution can't cross over.Nesting is also the default for Claude Code's own worktree mechanisms —
--worktree,EnterWorktree, andAgentwithisolation: "worktree"all create under<repo>/.claude/worktrees/and currently offer no way to relocate that. In this repo, don't use them: create the sibling yourself withgit worktree addas above..gitignorecovers.claude/worktrees/so a nested one that slips in doesn't pollutegit status, but that entry is damage control, not permission.Install from the new worktree's root.
node_modulesis not shared between worktrees, so a fresh worktree has no dependencies and no built packages at all until you install:shcd ../warp-drive-<topic> pnpm installTwo setup steps are not per-worktree and don't need repeating:
mise installfetches the pinnednode/pnpm/buntoolchain globally, and@warp-drive/holodeck'sensure-certwritesholodeck-localhost.peminto your home directory. Only run those if you've never set the project up on this machine.Run every command from the worktree root for the rest of the session, and don't
cdback into the primary checkout to run tests, lint, or builds — that reintroduces exactly the cross-session build clobbering the worktree exists to prevent.Remember that some git state is shared across all worktrees of a repo, not isolated by one. The stash stack is global: a bare
git stash popcan restore another session's work into your tree, so set work aside with a temporary WIP commit instead, or usegit stash push -u -m "<unique-tag>"andgit stash apply <sha>against the entry you can identify by tag. Branch checkouts are also global — a branch already checked out in another worktree cannot be checked out in yours.Clean up once the PR merges, so the next session's
git worktree liststays readable:shgit worktree remove ../warp-drive-<topic> git worktree prune
Why "fresh" and "off main" are separate requirements
They fail in different ways. Reusing an existing worktree gets you a dirty tree, stale node_modules, and leftover build output from unrelated work — a green local test run there tells you nothing about your change. Branching off the wrong commit gets you a clean worktree whose diff against main contains commits you never wrote; that one survives all local verification and only surfaces in review, as a PR touching files the task never mentioned.