RepoOps
Open the app
06 / Cost

Find which spend lever is leaking

Spend efficiency grades six levers of AI spend (Defaults, Routing, Caching, Context, Visibility, ROI) from signals RepoOps already measures, averages the graded ones into one letter, shows a dash for any lever no signal backs, and opens the pull request that moves a lever from the row that names it.

Last updated

Watch it

30.0 s, captions on. Narration: Microsoft Zira Desktop (provisional voice; an approved narration source is pending).Transcript
Read the narration
  1. 0:00 The bill went up.
  2. 0:01 The bill does not say which lever moved.
  3. 0:06 Six levers set the cost.
  4. 0:08 RepoOps grades each one from telemetry you already hold.
  5. 0:13 A lever with no signal reads a dash, never a low grade.
  6. 0:17 The priced fix names the surface and opens its pull request.
  7. 0:23 Change one lever.
  8. 0:24 The saving is measured after the change lands.

Synthetic example. Read the guide

1

How to

A tracked repository whose application writes ai-calls rows, on a machine that holds the Claude Code history the Context lever reads.

To open a pull request: an origin remote, a clean working tree and an authenticated gh command line in that repository.

  1. Find the Spend efficiency card and pick one repository.

    Cost in the sidebar, then the Cost per outcome tab, and scroll to Spend efficiency. The picker opens on All repositories, a table with the worst grade first; the levers, the fixes and the usage cards are per repository.

  2. Read the dashes before the letters.

    A dash means the signal is missing, not that the lever is bad, and the composite averages only the graded levers. The note under Efficiency Grade says how many it averaged and how many still leak.

  3. Read The six levers.

    Defaults grades the share of priced surfaces with no downgrade recommendation. Routing grades the share that carry a task-phase mapping. Caching grades the cache hit rate. Context counts the rule engine's context findings. Visibility grades the share of spend tagged with a tenant. ROI counts routing changes where cost rose and quality fell.

  4. Work Top fixes from the top.

    Priced fixes come first. Only Defaults rows carry a dollar figure: the weekly spend already flowing through the surface the row names. The ROI guard row sorts last.

  5. Press Open PR on a row.

    Defaults, Routing and ROI write a change to the repository's .claude/brain/llm-routing.json and hand it to the routing proposer, which opens a pull request from a routing-update branch off origin/main and restores the branch you were on. Caching runs the cache-alignment lint over CLAUDE.md. Context and Visibility offer a link instead: Context health, and AI Security's Agent identity and caps tab. A refusal is printed in the row, starting No pull request opened.

  6. Publish the grade to your team, if it should see it.

    On Privacy and egress, under What this machine publishes to your team, turn on Spend Efficiency scorecard; the app then publishes every ready repository each hour. Publish to team on the card publishes the picked repository now, and asks for this machine's operator confirmation when one is set.

2

Use cases

A surface on a heavier model than it needs

Situation
Defaults grades low, and Top fixes lists a surface first with a weekly dollar figure.
You do
Press Open PR on that row.
You see
A pull request that changes the surface's tier in llm-routing.json, with the diff, the rationale and the eval-gate result in its body. Nothing merges. Once it lands and both 7-day windows hold 5 calls, Realized savings on App LLM calls reports the measured change per call, which can be negative.

What did the spend buy?

Situation
A lead asks what one developer's agent spend last month produced.
You do
Open Cost, then the Cost per outcome tab, and under Spend to outcome choose Last 30 days.
You see
One row per pull request author: spend, sessions, merged pull requests, dollars and active minutes per merged pull request, the session quality bands and lessons. Spend the join cannot tie to a person sits in the Unattributed row, and minutes no session recorded read not measured, never 0. The By what the pull request became card below it splits the same spend into merged, still open, closed without merging and no pull request, which add up to the total, also by conversation length and by work type. Open and closed pull requests are read with the GitHub CLI; if it cannot read a repository, the card says so and that spend stays under no pull request.
3

Expected outcome

WorkedA letter under Efficiency Grade with the count of graded levers, six lever rows, and a ranked fix list.
WorkedWhat is contributing to usage by model and MCP server for the last 24 hours, and subagent and skill spend by model for the last 30 days.
WorkedAn Open PR that answers with a link, and a line that the saving is measured after the change lands.
Did not workThe grade box reads a dash and no lever has a backing signal.

Next step: The repository has no priced ai-calls rows and no Claude Code telemetry here. Pick one with telemetry.

Did not workThe card shows a table of every repository.

Next step: The picker is on All repositories. Pick one repository.

Did not workOpen PR answers No pull request opened.

Next step: Read the reason: nothing to right-size, no regressed change, no CLAUDE.md, an invalid routing config, or uncommitted changes in the working tree.

Did not workRouting refuses because the repository already routes by task phase.

Next step: Edit the phases block in llm-routing.json by hand; the proposer will not overwrite it.

Did not workThe hosted Efficiency page shows its empty state.

Next step: Bind the device, turn the toggle on in Settings, and wait for the hourly publish.

4

What else to consider

Edit the routing by hand: LLM routing control

Open Cost in the sidebar, then the Budgets and caps tab. Its LLM routing card shows each tracked repository's routing config: change a surface's tier, adjust the Tier definitions and their max tokens, type a rationale if you want one, and press Open pull request. The app opens a pull request from a branch in that repository with gh, and the repository's own CI gates it; the change applies only when you merge. Regretted downgrades lists a downgrade that measurably regressed (truncation or failure spike) with its before and after, and its revert also opens a pull request once you confirm it on the card. Recent routing decisions lists what was proposed and decided. The same action is POST /api/llm-routing/propose. Routing control runs only in the desktop app; on repoops.ai, /team/llm-routing-control opens the Cost page.

Replay merged pull requests before a routing change

Before you merge a routing pull request that moves a tier to a cheaper model, you can try that model on your own recent work. In the desktop app, open Cost, Budgets and caps, change a tier's model on the Routing config card, and press Start in the Replay merged pull requests row that appears for it. The replay takes the newest merged pull requests that changed node --test files, checks out each one's base commit in a throwaway worktree, and gives its title and body to Claude Code on that model. The pull request's own tests are copied in after the agent finishes and run, and a judge compares the rebuild with the diff that merged. A case passes when the tests pass and the judge agrees. A pull request with no tests, only tests, two parents or too little text to rebuild from is skipped with the reason, and a run that could not start reads could not run; neither counts as a fail. The replay runs on your own Anthropic API key, set in Settings under Set or test a key; until one is set, Start is off and says so. It runs at most 5 pull requests and $5 each time; change either in the row before Start, or change the defaults in the two fields above the rows. It needs the claude CLI on the machine. While it runs the card says so, and when it ends the card lists the passed, failed, skipped and errored counts, the dollars spent, and each pull request with a link to its eval bar, named route-replay and the model. The next routing pull request that moves a tier to that model shows the verdict in its proof section, one row per pull request with its cost.

Spend to outcome in detail

The join rolls each session's cost up to the author of the pull requests it contributed to, beside merged pull requests, session quality bands and lessons produced. The headline says how much was attributed and unattributed, and on how many merged pull requests active minutes were measured. The same read is GET /api/spend-outcome. It reuses the cost-per-merged-PR attribution and adds no second cost model.

What it does not do

It caps, throttles and merges nothing. Realized savings measures a landed change only where it moved a surface to another tier, so a caching, task-phase, context or ROI change leaves no row there. The Caching action edits CLAUDE.md, the cacheable prefix it can reach, not a cache_control block in your application code. RepoOps does not undo a merged routing pull request; revert it in git.

Publishing, cost and data

No model call: every grade re-reads files already on disk, and the routing eval gate scores its dataset with a deterministic string compare. The published snapshot carries the grade, the six lever grades, the four trend numbers and at most five fix titles, redacted and cut to 120 characters; no hosted page draws it, and repoops.ai/team/efficiency opens Cost per outcome on the Cost page. A republish overwrites the team's row; no route deletes it. The two context caps are REPOOPS_CONTEXT_FRESH_INPUT_CAP (500000) and REPOOPS_CONTEXT_TOOL_CALL_CAP (1000) in the data directory's .env.