chore(economy): rip token-economy stubs, keep raw token counts #449
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
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
charles/claude-hooks#449
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
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?
User story
As an operator, I want the fake cost/economy tracking removed and raw token counts (input/output/cache) kept per task and per agent, so that the service has no dead "cost cap" code paths and the metrics actually reflect Pro Max consumption rather than estimated USD.
Why: the economy stubs (
max_cost_usd_per_task,warn_at_pct,DEFAULT_MODEL_PRICES,cost_cappedstatus,/raise-capcommand, cost sparklines) are placeholders that never matured. They block schema work onagents.jsonand confuse the dashboard. Pro Max is the actual quota, and that's already tokens.Acceptance criteria
Server — delete
apps/server/src/domain/analytics/token-economy.tsdeletedapps/server/src/domain/analytics/token-economy.test.tsdeleted/raise-capslash command + tests removed fromdomain/workflow/slash-commands.ts(.test.ts)agent.raise_capflow node + tests removed fromdomain/flows/agent-nodes.ts(.test.ts)Server — gut
agent-runner.ts:524-530cost cap extraction + accumulator removed; cost-cap abort path dropped (line 857-864), terminal status falls back tofailuredispatch/registry.ts:370-397cost_warning/cost_cappedSSE emission removed;deleteTaskAccumulatorimport droppedevent-log.tstotal_cost_usdremoved from result-message summary stringbackground/worker.tsmax_cost_usd_overridefield removed fromTaskRequestShared types
TokenEconomyConfigandTokenEconomyPriceEntrydeleted frompackages/shared/src/resolved-agent.ts; exports removed frompackages/shared/src/index.ts"cost_capped"removed fromTaskStatusunion inpackages/shared/src/task-record.tsTriggerEventTaskCostCappedremoved frompackages/shared/src/trigger-event.ts(interface, union, kinds)cost_burn_usd_per_hour,cost_last_hour_usd,cost_sparklineremoved frompackages/shared/src/agents-health.tsWeb UI — delete
apps/web/src/components/cost-sparkline.tsxdeletedfmtCost()deleted fromapps/web/src/lib/format.tsCapsPaneland "Cost caps" tab deleted fromroutes/stats.tsxWeb UI — gut
cost_usdrendering removed fromtask-list.tsx,task-detail.tsx,pipeline-gantt.tsx,pipeline-graph.tsx,stage-pill.tsxcost_warning/cost_cappedSSE filters removed fromroutes/agents.tsxDatabase
task_history.cost_usdcolumn kept (legacy data preserved); new rows writeNULL. No migration. Document in code comment.Config
token_economy.{max_cost_usd_per_task, warn_at_pct, pricing}removed fromconfig/agents.jsonand Zod schema inshared/config/webhook-config.tscaveman/caveman_labelsretained but split out of thetoken_economyblock (top-levelcavemanfield or similar)Tests
just qapasses (typecheck + lint + format)Per-agent token rollup (small additive)
/statsquota tab shows per-agent token totals (SUM(input_tokens + output_tokens) GROUP BY agent) over the existing window selector. Reusestask_historycolumns; no new schema.Out of scope
cost_usdcolumn for anything elseReferences
docs/token-economy-overview.md— to be updated/deleted as part of thistask_historyschema ininfrastructure/database/task-store.ts