{"slug": "where-the-time-actually-goes-in-an-ai-coding-agent-job", "title": "Where the time actually goes in an AI coding-agent job", "summary": "Andréas, a full-stack developer and CTO at a B2B SaaS, measured the runtime of AI coding-agent jobs on his agent-orchestration platform and found that infrastructure overhead costs 5–8 minutes per job, accounting for 20–30% of total runtime. By pre-warming worktrees, enabling persistent caches, and optimizing I/O, he reduced fixed overhead to under 60 seconds, leaving model inference as the dominant cost.", "body_md": "I run an agent-orchestration platform: it takes a ticket, spins up a git worktree, lets a Claude Code agent build the feature, and runs a deterministic verify gate before merging. A typical job takes 20–30 minutes.\n\nI used to blame slow model responses for the runtime, but stage-by-stage measurements proved that assumption wrong: **infrastructure overhead costs 5–8 minutes of every job before the agent even finishes.**\n\nHere is where the time actually goes and how to optimize it.\n\nOn a standard dev machine (Windows 11, Bun, Next.js), a single job pays a heavy infrastructure tax:\n\n| Stage | Measured Cost | Impact / Notes |\n|---|---|---|\n`git worktree add` |\nSeconds | Negligible overhead. |\n`bun install` |\n~91s (median) |\nCold worktree setup, even with a warm cache. |\nLint & Typecheck |\n~1–2 minutes |\n`eslint` + 2× `tsc` across the full repo with no shared cache. |\n`next build` |\nMinutes |\nThe longest gate leg due to a cold `.next` directory every run. |\nVitest |\n~26 seconds | Fast and acceptable. |\nModel Time |\n~15–22 minutes | Planning, execution, and review calls. |\n\nFixed infrastructure costs account for **20% to 30% of total runtime**. Eliminating this overhead reduces small job times from ~30 minutes to ~20 minutes, leaving the remaining time strictly bounded by model inference.\n\nInstead of creating a fresh worktree and running `bun install`\n\nfrom scratch for every job, maintain a small pool of pre-warmed directories containing:\n\n`node_modules`\n\ndirectory (invalidated only when the lockfile hash changes).`.next`\n\n, `tsconfig.tsbuildinfo`\n\n, `.eslintcache`\n\n).When a job starts, it claims a slot, checks out the target branch, and immediately executes. After completion, `git clean`\n\nresets the worktree while leaving cache directories intact. This eliminates the ~91-second install step on almost every job.\n\nNext.js supports persistent filesystem build caching. Combining this with a warm slot pool carries the `.next`\n\ncache between jobs, turning the longest gate step from minutes into tens of seconds for standard diffs.\n\nAdding `--incremental`\n\nto `tsc`\n\nand `--cache`\n\nto `eslint`\n\nwithin the persistent slot directory saves roughly 1 minute per job without changing verification outcomes.\n\nReal-time Defender scanning severely throttles small-file I/O operations (like `node_modules`\n\nand `.next`\n\nwrites). Adding directory exclusions or moving worktrees to a **ReFS Dev Drive** improves install and build I/O speeds by 2× to 5× with zero code changes.\n\nSwitching to `bun install --linker isolated`\n\nprovides pnpm-style symlinked stores, yielding faster warm installs. However, caution is required: symlinks spanning worktrees can cause catastrophic unintended deletions if cleanup commands traverse outside the worktree root.\n\n`tsc --incremental`\n\nand `eslint --cache`\n\n.By optimizing the infrastructure pipeline, fixed job overhead drops from **5–8 minutes to under 60 seconds**. The remaining runtime represents actual model reasoning—the exact phase worth waiting for.\n\n*I'm Andréas — full-stack dev, CTO at a B2B SaaS, building my own agent tooling. Portfolio: https://andreas-bodin.vercel.app*", "url": "https://wpnews.pro/news/where-the-time-actually-goes-in-an-ai-coding-agent-job", "canonical_source": "https://dev.to/arti0/where-the-time-actually-goes-in-an-ai-coding-agent-job-13ei", "published_at": "2026-08-15 14:16:18+00:00", "updated_at": "2026-08-15 14:43:02.164149+00:00", "lang": "en", "topics": ["ai-agents", "developer-tools", "mlops", "ai-infrastructure"], "entities": ["Andréas", "Claude Code", "Next.js", "Bun", "Vitest", "eslint", "tsc", "ReFS Dev Drive"], "alternates": {"html": "https://wpnews.pro/news/where-the-time-actually-goes-in-an-ai-coding-agent-job", "markdown": "https://wpnews.pro/news/where-the-time-actually-goes-in-an-ai-coding-agent-job.md", "text": "https://wpnews.pro/news/where-the-time-actually-goes-in-an-ai-coding-agent-job.txt", "jsonld": "https://wpnews.pro/news/where-the-time-actually-goes-in-an-ai-coding-agent-job.jsonld"}}