Skip to content

perf: provision executor worktrees warm — never cold-install - #24

Open
erkamdemirci wants to merge 1 commit into
shadcn:mainfrom
erkamdemirci:perf/warm-worktree-provisioning
Open

erkamdemirci wants to merge 1 commit into
shadcn:mainfrom
erkamdemirci:perf/warm-worktree-provisioning

Conversation

@erkamdemirci

Copy link
Copy Markdown

Problem

Every execute dispatch pays a cold-start tax. The fresh worktree shares git history but not node_modules or build artifacts, so before the first plan step the executor runs a cold install plus cold typecheck/build/test — minutes of pure overhead per plan on JS/TS repos, repeated for every plan executed. closing-the-loop.md currently documents the cost ("the executor must install dependencies first") but doesn't avoid it.

Change

Warm provisioning becomes part of the dispatch protocol:

  • The subagent prompt gains a provisioning block (new item 3): clone dependencies from the main checkout — cp -Rc (APFS clone) on macOS, cp -al (hardlinks) on Linux, robocopy /E on Windows; pnpm repos can pnpm install --prefer-offline against the machine store — and copy ignored cache dirs (.next/cache, .turbo, *.tsbuildinfo) before the first build. Clone or hardlink, never symlink node_modules (symlinks break .bin resolution and file watchers).
  • The executor verifies instead of installing by reflex: confirm the toolchain with the plan's typecheck command before reaching for any install.
  • The dist/ caveat moves to dispatch: "expect one build if check tooling resolves from dist/" lived at the top of Review, where it's read after dispatch already happened. It now travels with the provisioning block, and the stranded Review note is removed.
  • plan-template.md: the Install row is scoped to cold checkouts/worktrees, so executors dispatched into a provisioned tree stop re-installing into it.

What doesn't change

The isolation model. Same disposable worktree, same guarantees, same review flow — the worktree is simply warm when the executor starts.

🤖 Generated with Claude Code

Every execute dispatch pays a cold-start tax: the fresh worktree shares
git history but not node_modules or build caches, so the executor
cold-installs and cold-builds before the first plan step — minutes of
pure overhead per plan on JS/TS repos. The old note in
closing-the-loop.md documented the cost; this makes avoiding it part of
the dispatch protocol.

- Dispatch gains a provisioning block in the subagent prompt: clone deps
  from the main checkout (cp -Rc on macOS, cp -al on Linux, robocopy /E
  on Windows; pnpm: --prefer-offline), copy ignored caches (.next/cache,
  .turbo, *.tsbuildinfo), never symlink node_modules.
- The executor confirms the toolchain with the plan's typecheck command
  instead of installing by reflex; the "one build if checks resolve from
  dist/" caveat moves into the same block (it lived in Review, read too
  late to help).
- plan-template: the Install row is scoped to cold trees.

Same worktree, same isolation guarantees — just warm at step 1.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant