costroid

package module
v1.0.0-alpha.2 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 4, 2026 License: Apache-2.0 Imports: 1 Imported by: 1 module, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

README

Costroid

Costroid is the cost check for pull requests. It runs a coding agent under a budget, records what the run cost per token class as FOCUS rows, and posts the figure on the pull request.

Why it exists

An agent's own cost field is an estimate, and a budget flag can be weaker than it sounds. Costroid prices the agent's token counts against a pinned, dated catalog, and it writes down how the budget was enforced. A grade is never shown as stronger than it is.

Install

1.0.0-alpha.1 is the first release, a pre-release. Download the binary for your platform from the release and check it:

curl -fsSLO https://github.com/Costroid/costroid/releases/download/v1.0.0-alpha.1/costroid-linux-amd64
curl -fsSLO https://github.com/Costroid/costroid/releases/download/v1.0.0-alpha.1/SHA256SUMS
grep ' costroid-linux-amd64$' SHA256SUMS | sha256sum --check

Each file is signed with cosign, keyless, by this repository's release workflow. To check a signature, with cosign 3 or later:

cosign verify-blob --bundle costroid-linux-amd64.sigstore.json \
  --certificate-identity https://github.com/Costroid/costroid/.github/workflows/release.yml@refs/tags/v1.0.0-alpha.1 \
  --certificate-oidc-issuer https://token.actions.githubusercontent.com costroid-linux-amd64

In GitHub Actions, the recipes install it for you: set the repository variables COSTROID_VERSION to 1.0.0-alpha.1 and COSTROID_SHA256 to the line for costroid-linux-amd64 in SHA256SUMS. To build from a checkout instead, with Go 1.27 or later:

make build

To keep rows in your own ledger, docs/install.md has the container, Compose and Helm shapes.

First command

costroid run --budget-usd 5 --out rows.jsonl -- claude -p "Fix the failing test."

The agent's stream passes through to stdout. Costroid prints this to stderr, here for a recorded run with one subagent on a Claude subscription:

costroid: claude-code, 4 requests
costroid: 19 rows in rows.jsonl, catalog 0.1.0
costroid: USD 0.001619725 at list, List-equivalent, not billed
costroid: budget USD 5, agent-flag: client-side estimate, can pass the cap
costroid: warning: BillingAccountId reads unknown: pass --billing-account or set COSTROID_BILLING_ACCOUNT

rows.jsonl holds one FOCUS row per request per token class:

{"ChargeDescription":"claude-haiku-5-5 input_uncached tokens; agent-flag: client-side estimate, can pass the cap","ConsumedQuantity":"2","ListCost":"0.0000002","ListUnitPrice":"0.1","SkuMeter":"input_uncached","SkuPriceId":"anthropic:claude-haiku-5-5:global:standard:to-100000:input_uncached"}

That row is shortened. A full row has every column of the row contract, and every amount is a decimal string.

Next

Task Page
Run an agent on a pull request docs/recipes.md
Read the comment docs/comment-example.md
Configure a repository docs/configuration.md
Host the ledger docs/install.md, docs/serve.md
Compare a ledger with a provider's report docs/reconcile.md
See what a budget grade means docs/adapters.md

Licence

Apache-2.0. The CLI, the gate, the ledger schema, the plan schema, the FOCUS tag convention, the price catalog and the policy packs stay Apache-2.0 and are never relicensed. Contributions are under the Developer Certificate of Origin.

Documentation

Overview

Package costroid holds the published schema of costroid.yml.

Index

Constants

This section is empty.

Variables

View Source
var ConfigSchema []byte

ConfigSchema is the JSON Schema of costroid.yml.

Functions

This section is empty.

Types

This section is empty.

Directories

Path Synopsis
Package catalogdata embeds the pinned price sheets.
Package catalogdata embeds the pinned price sheets.
cmd
costroid command
Command costroid is the cost check for pull requests.
Command costroid is the cost check for pull requests.
internal
adapter
Package adapter holds what every agent adapter hands the wrapper.
Package adapter holds what every agent adapter hands the wrapper.
adapter/claudecode
Package claudecode reads Claude Code runs.
Package claudecode reads Claude Code runs.
adapter/codex
Package codex reads `codex exec --json` runs.
Package codex reads `codex exec --json` runs.
catalog
Package catalog prices token classes against the pinned sheets.
Package catalog prices token classes against the pinned sheets.
cicontext
Package cicontext reads what the CI system says about a run.
Package cicontext reads what the CI system says about a run.
comment
Package comment turns FOCUS rows into the check output and the sticky pull request comment.
Package comment turns FOCUS rows into the check output and the sticky pull request comment.
config
Package config checks a costroid.yml against the published schema.
Package config checks a costroid.yml against the published schema.
decimal
Package decimal is an exact base-10 number for money and quantities.
Package decimal is an exact base-10 number for money and quantities.
egress
Package egress is the one way out of costroid serve.
Package egress is the one way out of costroid serve.
fanout
Package fanout runs CPU-bound work over a list on every core the process has.
Package fanout runs CPU-bound work over a list on every core the process has.
focus
Package focus holds the Costroid FOCUS row, version 0.3, and its writer.
Package focus holds the Costroid FOCUS row, version 0.3, and its writer.
oidc
Package oidc verifies CI OIDC ID tokens and reads a run's identity from them.
Package oidc verifies CI OIDC ID tokens and reads a run's identity from them.
oidc/oidctest
Package oidctest is a stub OIDC issuer for tests: an RSA key, a JWKS endpoint and a signer.
Package oidctest is a stub OIDC issuer for tests: an RSA key, a JWKS endpoint and a signer.
otlp
Package otlp reads OTLP/HTTP traces and logs into per-request usage.
Package otlp reads OTLP/HTTP traces and logs into per-request usage.
recipelint
Package recipelint holds the shipped CI recipes to their security rules: no privileged trigger, every action pinned by SHA, and an agent's job that holds nothing but read access to the code.
Package recipelint holds the shipped CI recipes to their security rules: no privileged trigger, every action pinned by SHA, and an agent's job that holds nothing but read access to the code.
reconcile
Package reconcile compares the ledger with the provider's own reports, per credential per day, in two steps.
Package reconcile compares the ledger with the provider's own reports, per credential per day, in two steps.
run
Package run launches an agent under a budget and turns its usage into rows.
Package run launches an agent under a budget and turns its usage into rows.
scm
Package scm reaches a source-code host through one interface.
Package scm reaches a source-code host through one interface.
scm/scmtest
Package scmtest holds stub GitHub and GitLab APIs for tests.
Package scmtest holds stub GitHub and GitLab APIs for tests.
server
Package server is the ingest service behind costroid serve: the result-stream and OTLP paths, pricing against the pinned catalog, and the per-PR view.
Package server is the ingest service behind costroid serve: the result-stream and OTLP paths, pricing against the pinned catalog, and the per-PR view.
store
Package store is the ledger: FOCUS rows in Postgres, one tenant at a time.
Package store is the ledger: FOCUS rows in Postgres, one tenant at a time.
store/storetest
Package storetest runs Postgres in Docker for the packages that need it.
Package storetest runs Postgres in Docker for the packages that need it.
Package migrations embeds the forward-only schema migrations.
Package migrations embeds the forward-only schema migrations.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL