@kevinzhangnothing/loop-cost
v1.0.3
Published
Estimate token budgets and daily costs for agent loops patterns. By cadence, readiness level (L1/L2/L3), and coding agent tool.
Maintainers
Readme
loop-cost
Estimate daily token spend for agent loops patterns by cadence and readiness level (L1–L3).
Uses cost metadata from patterns/registry.yaml.
Install & Run
npx @kevinzhangnothing/loop-cost --pattern ci-sweeper --cadence 15m --level L2
npx @kevinzhangnothing/loop-cost --pattern daily-triage --level L1 --json
npx @kevinzhangnothing/loop-cost --listFrom this repo:
cd tools/loop-cost
npm install
npm testOptions
| Flag | Description |
|------|-------------|
| --pattern | Pattern id (see --list) |
| --cadence | Override cadence (e.g. 15m, 1d) |
| --level | L1, L2, or L3 (default L1) |
| --conservative | Use slower cadence from ranges |
| --json | Machine-readable output |
Scenarios
Each estimate includes:
- Early-exit / no-op — empty watchlist, minimal tokens
- Full triage — every run does a full scan
- Action every run — implementer + verifier every time (worst case)
- Realistic blend — level-based mix (documented in output)
Pair with loop-budget.md (scaffolded by loop-init) and loop-audit cost observability checks.
Feed the circuit breaker
--json output resolves a realistic per-run token cap for
loop-context's breaker, so --token-budget reflects real
pattern cost instead of a hand-typed guess (the loop-guard skill wires this):
BUDGET=$(npx @kevinzhangnothing/loop-cost --pattern ci-sweeper --level L2 --json \
| node -e 'let d="";process.stdin.on("data",c=>d+=c).on("end",()=>process.stdout.write(String(JSON.parse(d).scenarios.realistic.tokensPerRun)))')
npx @kevinzhangnothing/loop-context --check --ledger loop-ledger.json --token-budget "$BUDGET"The tools stay independent — no runtime dependency, just shell wiring.
