Skip to content

Commit a2cbfce

Browse files
committed
Docs: skip the full Rust dep rebuild on a fresh worktree by cp -c-cloning target/
A fresh worktree gets its own `target/` and rebuilds every dependency from scratch on first build. An APFS copy-on-write clone of the main clone's `target/` reuses all crates.io dep artifacts (they're fingerprinted on version + features + rustc + profile, not the build path), leaving only the workspace members to rebuild. Instant and zero extra disk until files diverge. Documented in the AGENTS.md worktree playbook, mirroring the existing `.codegraph/` clone step.
1 parent 46829c2 commit a2cbfce

1 file changed

Lines changed: 7 additions & 0 deletions

File tree

AGENTS.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -256,6 +256,13 @@ shims on PATH; if `go` / `node` isn't found, check that `~/.local/share/mise/shi
256256
the dir from the main clone at `~/projects-git/vdavid/cmdr/` when its `.version` matches, and falls back to
257257
downloading otherwise. So raw `cargo check` Just Works in fresh worktrees. Don't paper over a missing `resources/ai/`
258258
with a placeholder file.
259+
- **Skip the full dep rebuild on a fresh worktree by cloning `target/`.** Right after creating the worktree and before
260+
the first build, run `cp -c ~/projects-git/vdavid/cmdr/target <worktree>/target` (APFS copy-on-write: instant, zero
261+
extra disk until files diverge). Dependency artifacts are fingerprinted on version + features + rustc + profile, not
262+
on the build path, so cargo reuses every crates.io dep (including `mtp-rs` and `smb2`); only the workspace members
263+
(`cmdr_lib`, the `Cmdr` bin, `fsevent-stream`, `index-query`) rebuild. Clone the whole `target/` (or at least all of
264+
`target/debug`) in one shot: a partial subset risks fingerprint mismatches that trigger the full rebuild anyway. This
265+
mirrors the `.codegraph/` clone in `~/.claude/docs/codegraph-worktree.md`.
259266
- When using worktrees, always branch off from _local_ `main` (not `origin/main`) and rebase and FF _local_ main.
260267
- To run two dev sessions in parallel from different worktrees, pass `--worktree <slug>` to `pnpm dev` in each. The
261268
wrapper picks per-instance ports (Vite, MCP, Tauri MCP bridge), a per-instance data dir

0 commit comments

Comments
 (0)