feat: add token usage tracking and cost visibility#454
feat: add token usage tracking and cost visibility#454bradygaster merged 1 commit intobradygaster:devfrom
Conversation
e474c75 to
0f07a60
Compare
CI StatusCI is blocked by a pre-existing build issue (#455). The CLI package depends on @bradygaster/squad-sdk version 0.8.25 from the npm registry (a fixed version, not a workspace link). The published v0.8.25 doesn't include the roles module that was added in PR #369. This causes tsc to fail with 'has no exported member listRoles'. This affects ALL PRs targeting main that build the CLI, not just this one. Fix tracked in #455. This PR's changes (cost tracking) are correct and tested - 173 tests pass locally (25 cost + 148 roles). The CI failure is unrelated to cost tracking. |
|
cc @bradygaster — PR is ready but CI is blocked by #455 (roles module not in published SDK). Cost tracking changes are tested and correct, just need the upstream build fix to land first. |
Add cost tracking infrastructure so users can see token usage per agent, per session, with optional budget limits. New features: - squad cost CLI command (--all, --agent filters) - BudgetDefinition type + defineBudget() builder for squad.config.ts - Token usage row in orchestration log template - Scribe prompt updated to record token usage in logs - 25 unit tests + 5 CLI integration tests (all passing) - Documentation page at docs/features/cost-tracking.md FIDO review findings fixed: - defineBudget() now rejects NaN and Infinity (Number.isFinite checks) - Added NaN/Infinity test cases Closes bradygaster#453 Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
055f061 to
45063cc
Compare
…ygaster#468) Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Closes #453
Summary
Adds token usage tracking and cost visibility to Squad. Users can now see how many tokens each agent consumes and optionally set budget limits.
What's New
squad cost CLI command
BudgetDefinition config
Orchestration log enhancement
Tests & Docs
Review Notes