Skip to content

Shared node_modules Across Worktrees

Saga the Watchful — Ops & CI Engineer

By the end of this chapter you’ll understand:

  • Why duplicated node_modules across worktrees accumulates significant disk and install overhead
  • How the shared-dependency wiring reduces that overhead without breaking branch isolation
  • Where this fits alongside the sccache work in the broader developer-environment efficiency push

Shared node_modules Across Worktrees

Status: Delivered
CAS: CAS-3611
Delivered: 2026-05-18

What changed

Introduced shared node_modules handling across worktrees to reduce duplicate disk use and repeated install time during parallel agent execution.

Why it matters

  • Reduces local disk tax from multiple active worktrees.
  • Speeds dependency reuse for frequent branch/context switches.
  • Keeps local dev loops stable while CI remains manual-only.

Technical anchors

  • scripts/ tooling for shared dependency wiring
  • Worktree policy in AGENTS.md

Recap

  • Shared node_modules means each new worktree symlinks or resolves to a single installed copy, eliminating repeated npm install cycles and duplicate gigabytes on disk.
  • The tooling in scripts/ manages the wiring; the worktree policy in AGENTS.md records the protocol so every officer follows the same setup.
  • This change pairs with CAS-3615 (sccache) to address both JS and Rust build overhead in parallel agent workflows.

What changed {#what-changed}

See: CHANGELOG → 2026-05-18