Skip to main content

Cut a Feature Prompt from 42 to 12 ACUs

Walk through a real session that burned 3x the expected ACUs on a pagination task, pinpoint three root causes, and rewrite the prompt to save 70%.
AuthorCognition
CategoryDevin Optimization
FeaturesAdvanced
1

The session that triggered the investigation

A developer asked Devin to add pagination to an API endpoint. The prompt was short and reasonable-sounding:The session finished successfully — tests passed, the PR looked good. But it consumed 42 ACUs for what should have been a ~12 ACU task. Three-and-a-half times the expected cost, on a feature that already had a working pattern elsewhere in the codebase.Here’s how to find out what went wrong and make sure it doesn’t happen again.
2

Start with Session Insights

Every completed session has a free Session Insights analysis. Click the lightbulb icon in the top bar of any finished session to open it — no Advanced session required.For this pagination session, Session Insights flagged:
  • Issue Timeline — Red marks at the 14-minute and 28-minute marks where Devin changed approaches entirely.
  • Issues Detected — “Incorrect codebase assumption: built pagination from scratch when src/utils/paginate.ts already existed” and “Wrong implementation type: used cursor-based pagination, but tests expect offset-based.”
  • Improved Prompt — A rewritten version with the missing context filled in, ready to copy.
  • ACU Usage — 42 ACUs, flagged as disproportionate for the task scope.
For many sessions, this is enough. Copy the improved prompt, start a new session, and compare. But if you want the full phase-by-phase cost breakdown, go deeper.
3

Get a phase-by-phase breakdown with Advanced Devin

Click Investigate with Devin in the Session Insights panel to launch an Advanced Devin session pre-loaded with the original session’s full history. Or start a new Advanced session manually — select the session from the session dropdown and describe what you want analyzed:Advanced Devin reviews every action from the original session and identifies where Devin spent an abnormally long time or took inefficient approaches:
Session analysis | Task: Add pagination to GET /api/users
Actual: 42 ACUs | Expected: ~12 ACUs

Inefficiencies identified:

1. Unnecessary exploration — investigation phase took abnormally long
   Devin explored 23 files looking for a pagination helper.
   It built pagination from scratch, then discovered
   src/utils/paginate.ts and had to refactor everything.
   Fix: Mention existing utilities in the prompt.

2. Wrong approach — entire implementation had to be rewritten
   Devin implemented cursor-based pagination. Tests failed
   because the API uses offset-based. It rewrote the entire
   implementation from scratch.
   Fix: Specify "offset-based" in the prompt.

3. Environment issue — repeated failed installs
   npm install failed twice due to a missing .npmrc config
   for the private registry. Devin retried with workarounds.
   Fix: Add registry config to repo setup.
Three root causes, all preventable with a better prompt or repo configuration.
4

Rewrite the prompt and compare

You can ask Advanced Devin to start a new session with the improved prompt directly — no need to copy-paste. The analysis produces a structured prompt that includes exactly the context that was missing:Compare the two prompts side by side:
OriginalOptimized
Pagination typeNot specified”offset-based”
Existing utilityNot mentionedsrc/utils/paginate.ts
Reference patternNone”same as GET /api/projects”
Response shapeNot specifiedExplicit schema
Testing criteria”Run the tests”Specific edge cases
ACU result42 ACUs~12 ACUs
The optimized prompt eliminates all three root causes. Devin skips the 23-file exploration, picks the right pagination type on the first try, and follows a proven pattern.
5

Turn the findings into permanent fixes

A single prompt rewrite saves ACUs on one session. Turning the findings into permanent configuration saves ACUs on every future session.Add recurring context to Knowledge. The pagination analysis revealed two facts Devin needs repeatedly — the pagination type and the utility location. Add them as Knowledge entries so every session starts with that context automatically:
  • “All API endpoints use offset-based pagination. The shared utility is at src/utils/paginate.ts. See GET /api/projects for the reference implementation.”
  • “Run tests with npm test. Run type checks with npm run typecheck.”
Fix workspace issues in Repo Setup. The 3 ACUs wasted on npm install failures were caused by a missing .npmrc config for the private registry. Adding registry configuration to repo setup prevents every future session from hitting that error.Batch-analyze to find team-wide patterns. If multiple developers are seeing high-ACU sessions, analyze several at once to find shared root causes: