← Back to PRs

#15284: perf(workspace): lazy-load templates only for missing files

by Elarwei001 open 2026-02-13 07:24 View on GitHub →
agents size: S
## Summary Reduces unnecessary file I/O during workspace setup by only loading templates for files that are actually missing. **Supersedes #5927** (rebased on main, workspace optimization only; Chrome extension changes no longer needed). ### Problem Previously, `ensureAgentWorkspace` loaded all 7 template files on every startup, even when all workspace files already existed. This was wasteful for the common case (existing workspace). ### Solution 1. Check which workspace files are missing first 2. Only load templates for files that need to be created 3. Process missing files in parallel for efficiency ### Impact For existing workspaces (the common case), this eliminates ~7 template file reads per startup. ### Testing - [x] `pnpm run lint` passes - [x] `vitest run src/agents/workspace.test.ts` - all 4 tests pass ### AI Disclosure 🤖 This PR was AI-assisted (Claude via OpenClaw). I understand the changes and have tested them locally.

Most Similar PRs