Carol — back to Apps ← Apps

Carolopedia

A friendly guide to Carol, her ecosystem, and the agents who built her.

📖 CarolopediaServicesBuild InitiativesAll activitiesINI-999900618
📋

CAROL-INI-2318-00: LLM cost accounting: record tokens per execution, per-model rate card, compute DeepSeek costs, fix the Carol Cost Tracker

Initiative
Open in Initiatives →

📖About

Ninad direct order 2026-07-03, four connected gaps: (1) TOKENS NOT RECORDED - the bypass metrics writer hardcodes tokens=0 and its upsert never updates the tokens column, so the Activity Tracker listing always shows 0 tokens; fix: sum input+output tokens from the executions droid runs and update on conflict. (2) NO PER-MODEL COST - the DeepSeek provider records token usage but never computes cost_usd (9767 runs since Jul 1: ZERO have cost) while Claude CLI self-reports; fix: new shared rate-card module (per-model input/output/cache-hit rates per 1M tokens) used by the DeepSeek provider to compute cost per call, honoring cache-hit pricing. (3) RATE CARD - the same shared module renders as a rate-card table in the Carol Cost Monitor app (models x input/output/cache prices), one source of truth for display and computation. (4) COST TRACKER BROKEN - every data endpoint 500s because a helper function named _idb shadows the initiatives-db module import of the same name (broken INI-2038 relay-migration edit); fix the shadowing. Rates seeded: DeepSeek chat/reasoner unified pricing (input $0.56/M miss, $0.07/M cache hit, output $1.68/M), Claude Fable $10/$50, Opus 4.8 $5/$25, Sonnet 5 $3/$15, Haiku 4.5 $1/$5 per MTok - editable data in the shared module.

⚖️Decisions

  • Auto-detected remediation target INI-999900270 from title/description scan (matched CAROL-INI-2038 -> row id 999900270 (CAROL-INI-2038-00: Lock the initiatives data file to the writer daemon + route C)); override by setting remediates_initiative_id explicitly at bypass_start. (system-auto-detect)
  • Elrond's bypass methodology checklist (a reminder, not a gate -- you've got this): 0. File it requested_mode='bypass' (planner-vs-bypass is a deliberate choice). bypass_start REFUSES a non-bypass initiative (CAROL-INI-1846), and the dispatcher only skips the bypass lane when the mode says bypass -- a 'planner' mistag lets Merlin's pipeline grab the placeholder step and block your finished work. 1. Filed as planned status -- let the bypass claim/activate it; never file active. 2. Open the bypass (bypass_start) with your droid id + the remediation answer (remediates_initiative_id=NNN, or remediates_nothing=True). 3. Work the blocks for your work-type: template -> design -> code -> test -> review. Do the real work; record decisions on the initiative as you make them. 4. Reality is recorded for you at close -- code (files changed), each decision, and the twin-review verdict become real activities tied to this initiative and show in the Activity Tracker like a planner run (CAROL-INI-1840). No dummy rows. 5. Keep the initiative status moving; it parks in 'reviewing' and is tagged uat-pending for you at close (CAROL-INI-1836), so the stuck-watchdog leaves it alone until UAT. 6. Close runs the gates (design/architecture compliance + caller-audit). If a gate flags something pre-existing or unrelated to your change, waive it with a clear written rationale -- audit, don't skip. 7. Bypass skips the planner's auto-orchestration, NOT the standards. Same template checklist, same review, same observability as a planner run. (elrond)
  • [status-router] planned -> executing | event=bypass_executing | bypass transition (or-bx-01)
  • Rate card shipped as a shared module (per-model USD/1M: DeepSeek chat+reasoner 0.56 in / 0.07 cache-hit / 1.68 out; Claude Fable 10/50, Opus 4.8 5/25, Sonnet 5 3/15, Haiku 4.5 1/5 - Anthropic prices from the Claude API reference). ONE source of truth: DeepSeek provider computes from it, Cost Monitor displays it. (orion)
  • DeepSeek provider now computes cost_usd per call with cache-hit pricing - VERIFIED LIVE within minutes: production calls logging cost (e.g. 6297 in / 4844 out -> $0.0092, matches rates incl. cache hits). Was: 9767 runs since Jul 1 with zero cost recorded. (orion)
  • Bypass metrics writer now sums input+output tokens from the run records and updates the tokens column on conflict (was hardcoded 0 and never updated) - Activity Tracker token column fills from the next closes onward. (orion)
  • Cost Monitor 500s ROOT-CAUSED and fixed: a helper function named _idb shadowed the initiatives-db module import of the same name (broken INI-2038 relay edit) - every data endpoint crashed. Renamed the import; /api/summary returns real data; new /api/rate-card + UI table live. App relaunched. (orion)
  • [status-router] executing -> closed | event=operator_put | PUT /api/initiatives (operator)
  • Closed: superseded by follow-on INI 999900622 (CAROL-INI-2318-01: LLM cost accounting: record tokens per execution, per-model rate card, compute DeepSeek costs, fix the Carol Cost Tracker) (elrond.initiative_author)
  • Closed: superseded by follow-on INI 999900624 (CAROL-INI-2318-02: LLM cost accounting: record tokens per execution, per-model rate card, compute DeepSeek costs, fix the Carol Cost Tracker) (elrond.initiative_author)

Success criteria

  • Bypass metrics writer records real token sums per initiative (tokens column updated on conflict); new bypass closes show tokens in the Activity Tracker listing (must_have)
  • DeepSeek calls record computed cost_usd from the shared rate card (cache-hit pricing honored), verified with a live call or unit computation (must_have)
  • Carol Cost Monitor endpoints return data (shadowing bug fixed) and the UI shows the model rate-card table (must_have)