agent-usage
Skill10 starsChanged 56 days agoMITView on GitHub
Analyze agent token usage, costs, and subscriptions with dot and DuckDB queries.
In this repository101 other files it gives its agents.
- AGENTS.mdAGENTS.md
- dot_agents/AGENTS.mdAGENTS.md
- skills/agent-project/templates/AGENTS.mdAGENTS.md
- skills/repository-docs/references/agents.mdAGENTS.md
- chezmoiSkill
- dot-developmentSkill
- dot-releaseSkill
- dot-skillsSkill
- dot-verifySkill
- acliSkill
- agent-evaluationSkill
- agent-frameworksSkill
- agent-harnessesSkill
- agent-loopsSkill
- agent-projectSkill
- agent-protocolsSkill
- agySkill
- airflowSkill
- ai-security-assessmentSkill
- api-clientSkill
- ast-grepSkill
- auth-statusSkill
- awsSkill
- benchmarkSkill
- bfSkill
- chrome-devtoolsSkill
- cli-developmentSkill
- clipboardSkill
- cloud-runSkill
- code-securitySkill
- colabSkill
- containerizeSkill
- course-developmentSkill
- databricksSkill
- data-migrationSkill
- delegate-tasksSkill
- diagrams-as-codeSkill
- dockerSkill
- documentation-siteSkill
- dot-cliSkill
- dprintSkill
- draft-mailSkill
- duckdbSkill
- fact-checkSkill
- fmind-visualsSkill
- full-reviewSkill
- gcloudSkill
- ghSkill
- git-deliverySkill
- github-actionsSkill
- github-issuesSkill
- github-pull-requestSkill
- github-repositorySkill
- git-worktreeSkill
- google-developerSkill
- gwsSkill
- handoffSkill
- hfSkill
- implementation-planSkill
- incident-responseSkill
- The first 60 shown.
The file
Files
Agent Usage
Analyze the shared usage archive with dot and DuckDB. Preserve the difference between recorded token usage, estimated cost, and the provider's actual bill.
Workflow
- Bound the question: harnesses, time range, sessions, models, and the comparison needed; inspect the existing archive before collecting more data.
- Let dot own sync and schemas: dot owns source synchronization and archive schemas; read queries.md for layout, fields, DuckDB queries, and exports.
- Analyze comparable data: account for missing sessions, model aliases, cache tokens, provider accounting differences, and time zones before aggregating.
- Report: include period, sources, completeness, units, assumptions, and the query or artifact supporting the result; protect prompt and account data.
Quick total: dot agent stats --tokens-only (coverage dates and API equivalents). queries.md owns flags, pricing fields, and billing configuration. API equivalents are offline rate-card estimates, never the bill or verified savings.
Gotchas
- Unknown is not free: Claude can report cost through
cost-state; absent prices arenull/unknown, not zero. Readcost_known_sessionsandcost_completebefore comparing cost. A known zero is distinct from missing cost. - Attribution follows request samples: Claude/Codex/Grok request samples retain per-request models and timestamps, including model switches and month boundaries. Sources without reliable samples use whole-session timestamps; check
session_timestamp_sessions. Codex 0.153+ samples come from per-response records, including compaction requests; when they disagree with the thread total, or an older cumulative counter is corrected, the provider total stays without request allocation rather than inventing deltas. - Read the provenance:
measurement_kinddistinguishes provider-reported totals, Antigravity's byte-based estimate, and Grok's context-only fallback when turn usage is unavailable. Grok turn ledgers can instead provide real consumption measurements; inspect the record rather than assuming a measurement kind from the harness name. Statistics group these separately and do not combine unlike measurements into one total. - One copy per session: transcript and usage are replaced together, never by a shorter transcript or a failed extraction, so each session counts once. When only the measurement becomes unavailable, the longer transcript publishes with the archived measurement, counted as retained.
- Subagents are sidechains: their tokens join the parent session and project without another session or recorded cost; exclude
sidechainrecords when counting sessions. - Capture uses one write path:
session syncreads each harness's own store; hooks only notify. Checklegacy_accounting_sessionsbefore trusting older totals (contracts). syncfails loud, reports warn:dot agent session syncrecords each failed session, continues, and exits 1 at the end; the sync beforestatsandusageonly warns on stderr. A failed usage extraction keeps the archived measurement.
Documentation
- DuckDB JSON Functions
- Companion skills: dot-cli (every
dotcommand), duckdb (file-based SQL analysis).
Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

