chore(economy): rip token-economy stubs, keep raw token counts (#449) #467
No reviewers
Labels
No labels
area:agents
area:dashboard
area:database
area:design
area:design-review
area:flows
area:infra
area:meta
area:security
area:sessions
area:webhook
area:workdir
security
type:bug
type:chore
type:meta
type:user-story
No milestone
No project
No assignees
2 participants
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
charles/claude-hooks!467
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "chore/449-rip-economy"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Closes #449.
Summary
max_cost_usd_per_task,warn_at_pct,DEFAULT_MODEL_PRICES,/raise-cap,agent.raise_capflow node,cost_cappedstatus,cost_warning/cost_cappedSSE, fleet cost burn, per-agent cost sparkline.input_tokens,output_tokens,cache_creation_tokens,cache_read_tokens) per task — already intask_history. Pro Max quota is the real ceiling; tokens are what matters.token_economyblock into a top-levelcaveman: { enabled, labels }field per agent type. Same behaviour, cleaner schema./statsper-agent table swaps cost columns for Tokens (in) / Tokens (out) viaSUM(input_tokens + output_tokens) GROUP BY agentover the existing window.Surface
domain/analytics/token-economy.ts(.test.ts); guttedagent-runner.ts,dispatch/registry.ts,event-log.ts,worker.ts,slash-commands.ts(.test.ts),flows/agent-nodes.ts(.test.ts)TokenEconomyConfig→CavemanConfig { enabled, labels };TaskStatuslostcost_capped;TriggerEventTaskCostCappeddeleted (TRIGGER_KINDSnow 19 members);FleetHealthResponselost burn/sparkline/last-hour fieldscost-sparkline.tsx;fmtCostremoved; cost rendering stripped fromtask-list,task-detail,pipeline-gantt,pipeline-graph,stage-pill,agents.tsx;routes/stats.tsxlost the "Cost caps" tab +CapsPanelconfig/agents.jsonper-typetoken_economyblock replaced — boss/dev/reviewer getcaveman: { labels: ["type:chore"] }; designer/design-reviewer/foreman drop the blockdocs/token-economy.md+docs/token-economy-overview.md;CLAUDE.mdToC prunedDatabase
task_history.cost_usdcolumn kept for legacy data. New rows writeNULL. No migration. Code comment marks it deprecated.Notable corrections (post-review)
listZeroOutputSuccessespredicate dropscost_usd IS NULL— every new row writes NULL post-rip, so the original predicate would have flagged 100% of successful tasks as silent bail-outs. Turns alone remains the signal.slash-commands-other-graph.jsondrops"raise-cap"from its router predicate + description so flow dispatch doesn't silently no-op on stale commands.Out of scope (future tickets)
StageEntry.cost_usdis now a dead synthetic aggregate — kept for API-shape stability; can be dropped in a follow-up.Test plan
just qapasses (typecheck + lint + format)window.localStorage.clear is not a function) confirmed unrelated by stashing the branchtask_history.cost_usdis NULL but token counts are populated/statsquota tab, confirm Tokens (in) / Tokens (out) columns renderReview
Implementation by general-purpose subagent; reviewed by code-review subagent before commit. Two critical issues found by reviewer (janitor predicate regression + stale flow descriptor) fixed before commit. Ship.
🤖 Generated with Claude Code
Removes the placeholder cost-cap subsystem (max_cost_usd_per_task, warn_at_pct, DEFAULT_MODEL_PRICES, /raise-cap, agent.raise_cap node, cost_capped status, cost_warning/cost_capped SSE, fleet cost burn, per-agent cost sparkline) that never matured past stubs. Pro Max quota is the real ceiling and that is already tracked in tokens. What stays: - task_history.{input_tokens, output_tokens, cache_creation_tokens, cache_read_tokens} — already raw per-task counts - task_history.cost_usd column kept (legacy data; new rows write NULL) - Caveman appendix logic — split out of the token_economy block into a top-level `caveman: { enabled, labels }` field per agent type What's added: - /stats per-agent table swaps cost columns for Tokens (in) / Tokens (out) using SUM(input_tokens + output_tokens) GROUP BY agent Notable: - listZeroOutputSuccesses predicate drops `cost_usd IS NULL` — every new row writes NULL post-rip, so the predicate would flag 100% of successes. Turns alone remains the silent-bail signal. - slash-commands-other-graph.json drops "raise-cap" from its router predicate + description. - TRIGGER_KINDS now 19 members (was 20); flow node-types now 18 (was 19). - StageEntry.cost_usd kept as a synthetic aggregate field for now — UI no longer renders it; can be dropped in a follow-up. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>937c27828d265a08bc11