Jakob Christensen / Cases#001#002#003#004
6 Rules + 3 Habits to speed up Agent Sessions
Relevant skills: /lanes, /cheap-agents, /cold-case, /lie-detector
A session can feel slow for two reasons: the agent is busy working, or the agent is waiting for you to answer. I measured both across 2,659 of my own sessions, and they came out almost equal. That is why the rules below go after both. Some make the agent's work shorter, and some make it wait for you less often.
A session is one conversation with the agent, from your first message until you close it. It is made of back-and-forths: you send a message, the agent works, and it replies. Here is how the time adds up.
Rule of thumbSession time ≈ back-and-forths × (agent time + your reply time)One back-and-forth: you send a message, the agent works, it replies. Commands run inside the agent time.
Where the session time went
- Agent working 52 % (367 h of 703 h)
- Waiting for my reply 48 %
Speed rules mostly come down to cutting the checks. A check runs the project's tests, its lint (an automatic scan for style and coding errors) and its build. The agent often needs only the related tests, which are the tests that cover the changed files. Typically the related tests took 24 s and the full check 62 s. These were different changes, so the gap is not a saving per change, but it shows how much a check can cost.
Rules for your agent (paste into CLAUDE.md or AGENTS.md)
CLAUDE.md or AGENTS.md is the file of standing instructions your agent reads at the start of every session. Paste the rules there, or download them.
-
Test only what changed
Before a commit, run only the tests that cover the changed files (for example `vitest related --run <files>`), and the full check once, before merging.
A commit is a saved snapshot of your changes. The full check is the project's whole test, lint and build run, and the related tests are only the ones that cover the changed files. Vitest is a common JavaScript test runner.
Why
The commit has to wait until the tests are through, so a shorter test run means a shorter wait.
24 s vs 62 sis what the related tests and the full check typically took in my sessions.
-
Long commands go to the background
Run any command that may take more than about two minutes in the background, end your reply, and let the notification wake the session when it finishes. Never wait in a loop.
A background command runs on its own while the session carries on. When it finishes, a notification tells the session.
Why
While a command runs, the session stands still, and a long command can hold it up for minutes.
About halfof the time spent in shell calls (the commands the agent runs) went to calls of 2 to 15 minutes. Those calls were about 2 % of all calls, with longer calls left out.
-
No go-ahead questions for routine steps
Do not ask for a go-ahead on routine steps (a commit of your own work, a cleanup of your own background job). Ask only when the decision is mine, irreversible, or touches work that is not yours.
Why
Every question stops the session until I answer, even when the answer is a plain "yes".
About 4 %of my replies were nothing more than a go-ahead such as "yes".
-
Give new scripts a time limit
Give a new script that runs over a large folder tree a time limit, or run it in the background with progress lines.
Why
I cannot know in advance how long a new script takes on a large folder tree. Without a time limit or progress lines, a script that hangs looks just like one that is working slowly.
-
Copy node_modules into a new worktree
In an npm (JavaScript) project, create a worktree by copying `node_modules` from the main checkout when the lockfile and the Node version match, and run `npm ci` otherwise.
A worktree is a second folder for the same project, on its own branch (a separate line of changes), so parallel sessions do not collide.
node_modulesis the folder where npm keeps the installed packages.npm ciinstalls all of them from scratch. The lockfile lists the exact package versions.Why
The two checks, lockfile and Node version, guard against copying packages that do not fit the project. The copy is also quicker.
6 s vs 11 sis what the copy and
npm citook in a test of mine. -
Split parallel work by file
When several sessions work in one repository, split the work by file so two branches never touch the same file.
Why
Two branches that change the same file can end in a merge conflict, which means git cannot combine the two edits by itself and someone has to resolve it before the work lands.
Habits for you (an agent cannot do these)
-
Bundle decisions into one question
Have the agent put several decisions into one question.
Skill: /cold-case collects the open questions of all your sessions into one pass. A skill is a ready-made instruction file your agent follows when you type its name.
Why
A question that waits for you stops the session. My reply time was about half of all session time, so every question that can be avoided or bundled saves a wait.
-
Write a brief that needs no follow-up
Give the agent a brief (your description of the task) it can finish without follow-up questions.
Why
Each follow-up question is another wait for the agent.
60 sis what a reply typically took me in my sessions.
-
Batch small requests
Collect small requests and send them as one batch, and run the full check once per batch, not after every change.
Why
The full check runs everything, however small the change, so running it after every tiny change adds that wait every time.
62 sis what it typically took in my sessions, each time.
The details
Claims checked
Here are three statements about speed that sound plausible, and what the measurements say about each.
| Claim | Measured |
|---|---|
"A worktree from copied node_modules is faster than npm ci." | In a separate test on 2026-11-14: 6 s against 11 s (earlier runs: 16-20 s). The transcript values (8 s against 11 s) agree, but they come from different calls. |
| "Running only the related tests is faster than the full check." | Typical times 24 s against 62 s. These are different changes, not the same change run both ways, so the gap is not a saving per change. |
| "One project is much faster than the other." An agent once guessed this was due to old worktrees and large files, without measuring speed. | Agent time per back-and-forth: typically 45 s against 61 s, but on average 182 s against 180 s. Only the typical time differs. |
How the numbers were measured
Summary
- Across 2,659 of my Claude Code sessions in October and November 2026, the agent worked in 52 % of the session time (367 h of 703 h) and I took the rest to reply.
Measurements
| Sessions | 2,659, main conversations only, helper agents excluded |
|---|---|
| Agent time per back-and-forth (my message to the agent's last reply) | median 48 s, 90th percentile 516 s, 7,543 back-and-forths |
| My reply time per back-and-forth (agent's last reply to my next message) | median 60 s, 90th percentile 430 s, 7,437 back-and-forths |
| Share of agent time in agent time + reply time | 52 % (367 h of 703 h) |
Commands (time from the call to its result)
| Command | Calls | Median | 90th percentile |
|---|---|---|---|
npm run check (lint, all tests, build) | 1,207 | 62 s | 151 s |
npm run lint | 971 | 16 s | 66 s |
vitest related | 406 | 24 s | 48 s |
npm run worktree (new worktree) | 571 | 8 s | 14 s |
npm ci | 465 | 11 s | 19 s |
All numbers come from my local transcripts (the .jsonl files Claude Code stores under ~/.claude/projects) for October and November 2026. Pauses over 30 minutes are left out of both time rows, otherwise nights would count as waiting. Median means the middle value (half of the values are lower), 90th percentile means nine in ten are lower.
Method and limitations
- Times come from the timestamps of the transcript entries. A command's time includes any wait for a permission prompt, so it can be longer than the command itself.
- Agent time per back-and-forth includes my approvals of permission prompts and any time the agent waited for a background job. Reply time includes everything I did between back-and-forths, not only reading.
- I did not measure how much any rule saves. That would need the same work done twice, with and without the rule. The rules above come from experience. Only the worktree rule was tested on its own, with the same work done both ways.
- Only my work was measured: one person, one machine, two main projects and a website.
Sources
- Interactive mode: Background Bash commands
- Tools reference,
run_in_backgroundand the time limit for background commands