Coding agents
What your developers' coding agents (Claude Code, Codex, Gemini CLI, GitHub Copilot, Cursor) cost, where the spend goes and where it is wasted, read from the telemetry the agents already send, with no proxy on a developer's machine and no code read.
It is a project kind. Switch it on for a project (PUT /orgs/:org/projects/:project/coding-agents/project,
or the toggle on the project's coding-agents page) and point the agents' OpenTelemetry exporters at
that project's DSN. A project that is not switched on gets no session rows from the same traffic.
What is stored, and what is not
One row per agent session per day, in coding_agent_sessions (day-partitioned, kept 13 months):
| Stored | How |
|---|---|
| team, repository | resource attributes (team.id, vcs.repository.url.full), reduced to a slug and owner/name |
| model, agent, session id | from the agent's own metric and event names (claude_code.*, codex.*, cursor.*, gemini_cli.*, github.copilot.*, copilot_chat.*) |
| spend and its basis | reported (the agent's own figure), estimated (tokens priced from the price list) or unpriced |
| tokens | input, output, cache read, cache creation |
| tool decisions | accept and reject counts, by source, and the counters the detectors read |
| commits, pull requests | counts, and a commit hash |
| member | a keyed pseudonym of the address: see below |
Never stored: the address, prompt text, assistant text, a command, a file path, error text, or a tool's arguments. Tool details, when you turn them on, are reduced at the door to booleans and hashes (a command ran tests, a hash of a path), and the originals are not written anywhere.
The session id is folded into the session row, never into a metric series, so a busy team does not exhaust the metric-series cap (1,000 series per metric per day): one series per model, not per session.
Members, and who can see them
A session's member is a keyed pseudonym of the address (keyedPseudonym, the respondent purpose):
a per-project keyed hash, so the same person in two projects is two unrelated keys, and a leaked
column joins nothing. Members are erased with the member: a data-subject erasure clears the key and
keeps the row, so a team's spend survives the person who produced it.
- Team aggregates are the default. The overview, session list, cost reads and detectors carry no member field. A team or repository with fewer than five distinct members is withheld: it is folded into one row and its name is not shown.
- The per-member view is a person's act.
GET .../coding-agents/members?reason=...is refused to every principal that is not a signed-in person (agents, services, OAuth clients, delegated callers), needs thepii:readscope andread_piion the project, needs a stated reason (10 to 500 characters), and writes acoding_agents.member.readledger row before it reads anything. If the row cannot be written, nothing is returned. - Member keys never leave over MCP.
ai_sessions_listandai_cost_getwithsource: coding_agentsreturn team aggregates only; no tool takes or returns a member.
Setting it up
GET .../coding-agents/snippets (and sdk_inventory_get) return the managed-settings snippets:
- Claude Code:
CLAUDE_CODE_ENABLE_TELEMETRY=1, the OTLP endpoint and anAuthorization: DSN ...header,OTEL_RESOURCE_ATTRIBUTESfor team and cost centre, delta temporality, and every content flag off (OTEL_LOG_USER_PROMPTS,OTEL_LOG_ASSISTANT_RESPONSES,OTEL_LOG_TOOL_CONTENT,OTEL_LOG_RAW_API_BODIES).OTEL_LOG_TOOL_DETAILSis off unless you ask for it, and two detectors need it (below). - Codex (
[otel]), Gemini CLI (logPrompts: false) and VS Code Copilot: documented shapes markedunverified; check the key names against the vendor's reference before rollout. - An MDM recipe: distribute the managed settings, set team and cost centre per device group, and install the wrapper that adds the repository on Claude Code versions that do not send it.
The DSN in a snippet is a placeholder. The project DSN is the only secret; put it in the profile as a secret variable.
Cursor and GitHub Copilot send no OpenTelemetry this console reads. Their daily aggregates arrive through an organization connection: a Cursor Admin API key (reads team usage, cannot create keys) or a GitHub token with the Copilot metrics scope. Those rows are team-level totals with no member column. The Claude Code Analytics API is never called: it needs an Anthropic Admin API key, which can mint keys, so its rows arrive through the customer-run push route instead and the key stays with you.
Waste detectors
Six deterministic rules over a session's counters. Each publishes its threshold and its waste formula beside every finding, and prices the waste in dollars a month (the window's waste scaled to 30 days). They are defaults, not tuned values.
| Detector | Fires when | Waste | Needs |
|---|---|---|---|
skipped_checks |
a commit or push in a session with zero test runs | session spend x 0.15 (an assumed rework share) | tool details |
retry_storm |
retries exhausted, or 5 or more retries for one prompt | session spend x retries / (requests + retries) | |
file_reread_loop |
one file read 5 or more times with no edit to it | session spend x extra reads / tool calls | tool details |
permission_fatigue |
20 or more prompts answered "allow" in one clock hour | prompts x 5 s x $90 per engineer-hour (human time, not tokens) | |
context_churn |
3 or more compactions in one session | session spend x compactions / (compactions + prompts) | |
idle_spend |
spend with no edit, no commit and no accepted tool call (under $0.05 ignored) | all of the session's spend |
A detector that needs tool details abstains without them, and the console says so; it never reads "no test runs" out of a session that could not have shown any. A finding comes with a fixed fix plan (a hook, a skill or a managed setting) that a person reviews and applies; the plan contains nothing a session sent.
Budgets
An alert-only monthly budget per team or per repository, in US cents, with an 80% soft line and a 100% line. Spend crossing a line sends one notice per budget, month and line to the organization's owners and admins. Nothing stops an agent, and a coding-agent budget carries no effect row.
- Creating a budget, or lowering one, needs
configure_cost. - Raising a budget, and deleting one, are a person's act on org
admin, refused to every agent, service and delegated client, and to a person outside their own dashboard session.
Reading it
| Route | Gives |
|---|---|
GET /orgs/:o/projects/:p/coding-agents/overview |
spend, sessions, accept rate, cost per pull request, attribution share, detectors |
GET .../sessions, .../cost, .../detectors |
the session list, spend by team, repository, model, agent or day, the detectors |
GET .../snippets |
the managed-settings snippets |
GET .../members |
the per-member view (a person, pii:read, a reason) |
GET /orgs/:o/coding-agents/daily |
vendor-API daily aggregates (Cursor, Copilot) |
GET/POST /orgs/:o/coding-agents/budgets, .../:id/lower, .../:id/raise, DELETE .../:id |
budgets |
Windows are at most 90 days. Every read names the number of sessions it scanned and says when the 20,000-session ceiling cut it short.