cost-governor

cost-governor is an agent for Claude Code from Kastalien-Research/thoughtbox. It costs 46 tokens per session (1,199 once invoked), scanned A, original, MIT.

A cost-monitoring agent that combines token and API spending from agent runs and compares it with project budgets.

In plain words
What is it for?
Use it for daily cost summaries, budget checks, anomaly detection, and deciding how budgets should be distributed across agent work.
Why use it?
It helps reveal total spend and unusual costs that individual run reports may miss, and can enforce configured limits.

Agent for Claude Code

Written for Claude Code: installed under .claude/. Also seen: model in frontmatter; positional $N argument.

Good fit Use it for daily cost summaries, budget checks, anomaly detection, and deciding how budgets should be distributed across agent work.

Compare 6 agents from other repositories ↓
Install with agentmods
npx agentmods add agents/kastalien-research/thoughtbox/cost-governor
Install

Getting it into your agent

One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.

Clone the repo
git clone --depth 1 https://github.com/Kastalien-Research/thoughtbox

Made for: Claude Code.

Wrote this? Show the measurements

A badge with what this costs and how it scanned, read live from this page, so it follows the numbers instead of freezing them. Markdown for a README, HTML for a documentation site or a project page.

agentmods badge for cost-governor

README.md
[![agentmods](https://agentmods.dev/badge/agents/kastalien-research/thoughtbox/cost-governor.svg)](https://agentmods.dev/agents/kastalien-research/thoughtbox/cost-governor)
Your own site
<a href="https://agentmods.dev/agents/kastalien-research/thoughtbox/cost-governor"><img src="https://agentmods.dev/badge/agents/kastalien-research/thoughtbox/cost-governor.svg" alt="Measured on agentmods" height="20"></a>
Per session 46 Only the description is in the session, so the agent can decide to use it. The body loads when it is invoked.
When invoked 1,199 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. A grade says what 26 rules found in the file — not that it is safe.
Origin original No closer match found in the catalogue.
Token cost

What it costs to keep this loaded

Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.

ModelPer sessionOnce invoked
Fable 5.1 $0.00046 $0.01199
Opus 5 $0.00023 $0.00600
Sonnet 5 $0.00009 $0.00240
Haiku 4.5 $0.00005 $0.00120

Measured 8d ago against content hash 2cb9620d8b19, method: parsed. Prices are Anthropic first-party input rates as of 2026-09-07, from the pricing page.

Security

Grade A, and why

cost-governor scanned grade A with 0 findings against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured 8d ago.

A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.

Nothing flagged

None of the 26 patterns this scan looks for appear in this file: no shell pipes, no recursive deletes, no credential paths, no hidden text, no instruction-override or anti-refusal phrasing, no agent-config snooping. That is not a guarantee, it is the absence of the things that are checkable.

.claude/agents/cost-governor.md · 143 lines

How it starts

The opening of the file, as written. The whole thing — 143 lines — stays where its author put it; the contents beside it link to each section on GitHub.

You are the Cost Governor Agent (coordination-momentum-02). You are a Coordination & Momentum variant specialized for cost tracking and budget enforcement.

Why This Agent Exists

The continual improvement system runs agents on schedules — daily agentops, weekly SIL, weekly DGM evolution. Each agent reports total_cost_usd on completion. Nobody aggregates this or enforces the overall budget. Without cost governance, scheduled agents can silently overspend, and budget allocation across agent types can drift from optimal.

Data Sources

Agent SDK Cost Reports

Look for cost data in:

  • Agent SDK output logs (the Result: ... | cost: $X.XX lines)
  • historical run-log directories — run logs with cost data
  • .eval/metrics/session-*.json — session-level cost if captured
  • Git log messages — some automated commits include cost in the message

Budget Configuration

Read budget constraints from:

  • Spec 08 (compound integration): $80/week total budget, broken down by category
  • Any budget.json or cost config files in the project
  • .eval/baselines.json — if cost baselines are defined

Historical Data

Build cost history from:

  • historical run-log directories — past run results
  • .eval/metrics/ — session snapshots with cost data
  • Git history — git log --oneline --since="7 days ago" for activity volume

OODA Loop

Observe

Gather all cost data available:

  1. Scan historical run-log directories for recent run logs
  2. Read .eval/metrics/session-*.json for session costs
  3. Check any cost tracking files that exist
  4. Count agent invocations by type (from logs)

Orient

Build a cost model:

  • Daily spend: Sum of all agent costs today
  • Weekly spend: Rolling 7-day total
  • By agent type: Which agents are most expensive?
  • By schedule: Scheduled (automated) vs. on-demand (interactive)
  • Trend: Is spend increasing, stable, or decreasing?
  • Efficiency: Cost per useful output (commits, issues closed, assumptions verified)

Read the full file on GitHub · 143 lines

Changes

What this file has done since we first saw it

Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.

  1. 8d ago First seen · 143 lines · 46 tokens per session scan A 2cb9620d8b19

Subscribe to this mod's changes

cost-governor is an agent published in the GitHub repository Kastalien-Research/thoughtbox (64 stars, last pushed 1mo ago), licensed MIT. It adds 46 tokens to every session and 1,199 once invoked, about $0.0002 per session on Opus 5. A static security scan graded it A with 0 findings. No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-30.