Repository navigation
Closed
Labels
dev-leadFor dev-lead agent pickupFor dev-lead agent pickupinitiativeEpic / initiative tracking issueEpic / initiative tracking issue
Description
Story
As a cost-reporting maintainer,
I want add two effective-dated claude-sonnet-5-* rows to model-pricing.tsv and lock them with regression tests,
so that every Sonnet 5 token record is priced at the rate in effect on its run date — capturing the introductory discount now and switching to standard pricing on 2026-09-01 automatically, with no code change.
Acceptance Criteria
scripts/lib/model-pricing.tsvgains exactly two APPENDEDclaude-sonnet-5-*rows (no existing row edited): effective_from2026-06-30= input 2.00, cache_read 0.20, cache_write 2.50, output 10.00; effective_from2026-09-01= input 3.00, cache_read 0.30, cache_write 3.75, output 15.00.- Both rows follow the tsv's documented derivation: cache_read = 0.1 x input and cache_write = 1.25 x input (identical to the existing
claude-sonnet-4-*row 3.00/0.30/3.75/15.00). price_for "claude-sonnet-5-<id>" "2026-07-15"returns2.00 0.20 2.50 10.00; the same lookup at2026-09-02returns3.00 0.30 3.75 15.00(effective-date selection picks the intro rate before Sep 1 and the standard rate after).tests/model_pricing.batsgains passing cases asserting both effective-dated lookups, and the full bats suite stays green.- No dollar rate is hardcoded in any script — prices remain data in the tsv per AGENTS.md;
shellcheckstays clean on any touched shell.
Tasks / Subtasks
- Append the two
claude-sonnet-5-*rows to model-pricing.tsv in the Anthropic (authoritative) block, TAB-separated, matching the existing column order (model_glob, effective_from, input, cache_read, cache_write, output). (AC: test issue from agent #1, Go-live improvements for PR review agent #2) - Verify selection: run
price_forfor a Sonnet 5 id at a July date and a September date and confirm the intro vs standard rows are chosen (most-specific glob, effective_from <= date). (AC: Add @claude delegation, auto-merge, and rebase handling #3) - Add bats cases to tests/model_pricing.bats mirroring the existing
price_for: sonnet 4.6test shape, one per effective window; runbats tests/model_pricing.bats. (AC: Optimize review: small-PR and incremental fast paths #4) - Confirm no script hardcodes a Sonnet 5 dollar rate and run
shellcheckon any touched shell. (AC: feat: add Copilot engine support via REVIEW_ENGINE toggle #5)
Dev Notes
- model-pricing.tsv selection is deterministic: for (model M, date T) pick the row whose glob matches M AND effective_from <= T, choosing the MOST SPECIFIC glob (most literal chars), ties -> latest effective_from. The header block in the file documents this — read it before editing.
- PRICE-CHANGE RULE (critical): never edit an existing row — APPEND a new dated row. You are adding a NEW glob (
claude-sonnet-5-*), so there is no conflict withclaude-sonnet-4-*; the two globs are equally specific but match different model strings. - The cache_read/cache_write columns are DERIVED, not quoted by Anthropic: cache_read = 0.1 x input, cache_write (5-min) = 1.25 x input. Every existing Claude row follows this (e.g. opus-4-* 5.00/0.50/6.25/25.00, sonnet-4-* 3.00/0.30/3.75/15.00). Apply the same to keep the table internally consistent (see epic untracked-prerequisite Go-live improvements for PR review agent #2 — confirm before trusting).
- Testing standard: tests/model_pricing.bats sources scripts/lib/model-pricing.sh and asserts
price_foroutput as the 4-field stringinput cache_read cache_write output. Copy the@test "price_for: sonnet 4.6 ..."case (approx lines 20-24) and adapt for each effective window; use a 2026-07 date for the intro row and a 2026-09-02 date for the standard row. - AGENTS.md: 'Prices are data, not code: keep per-model rates in scripts/lib/model-pricing.tsv (effective-dated) — never hardcode dollar rates in scripts.' Do NOT add Sonnet 5 rates anywhere else.
Project Structure Notes
Pure data + test change under scripts/lib/ and tests/. No script logic changes; consumers (model-pricing.sh price_for/cost_usd/et_multiplier_for) pick up the new rows automatically via the existing glob+date selection.
References
- scripts/lib/model-pricing.tsv#header-and-price-change-rule
- scripts/lib/model-pricing.sh#price_for
- tests/model_pricing.bats#price_for-sonnet-4-6
- AGENTS.md#prices-are-data
- 💡 Claude Sonnet 5 Engine Chain Integration with Introductory Pricing Capture #1039
Likely target surface
scripts/lib/model-pricing.tsvtests/model_pricing.bats
Story prepared by the BMAD Scrum Master (Bob) for epic #1095. Status: ready-for-dev.
Metadata
Metadata
Assignees
Labels
dev-leadFor dev-lead agent pickupFor dev-lead agent pickupinitiativeEpic / initiative tracking issueEpic / initiative tracking issue
Activity
don-petry commentedon Jul 4, 2026
Dev-Lead Implementation Plan
Issue: #1096 — [Phase 1] Add effective-dated claude-sonnet-5 pricing rows + lock them with a regression test
Scope
Append two effective-dated
claude-sonnet-5-*rows toscripts/lib/model-pricing.tsv(intro rate from 2026-06-30, standard rate from 2026-09-01) and lock the date-based selection with new bats regression cases. Pure data + test change; no script logic touched.Implementation Checklist
claude-sonnet-5-* 2026-06-30 2.00 0.20 2.50 10.00to the Anthropic (authoritative) block ofmodel-pricing.tsv(TAB-separated, existing column order)claude-sonnet-5-* 2026-09-01 3.00 0.30 3.75 15.00(standard rate; derivation cache_read=0.1×input, cache_write=1.25×input)Tests to Write
price_for: sonnet 5 intro window (2026-07-15) → 2.00 0.20 2.50 10.00intests/model_pricing.batsprice_for: sonnet 5 standard window (2026-09-02) → 3.00 0.30 3.75 15.00Test Command
bats tests/model_pricing.batsdon-petry commentedon Jul 4, 2026
Dev-Lead: Implementation Complete
Plan Execution
claude-sonnet-5-* 2026-06-30 2.00 0.20 2.50 10.00(intro rate) to the Anthropic block ofmodel-pricing.tsvclaude-sonnet-5-* 2026-09-01 3.00 0.30 3.75 15.00(standard rate)price_forbats regression cases (intro + standard windows)dev-lead-lint.sh(shellcheck + agent frontmatter) cleanTest Results
Boundary spot-check (effective-date selection):
Files Changed
scripts/lib/model-pricing.tsv: appended exactly two TAB-separatedclaude-sonnet-5-*rows; no existing row editedtests/model_pricing.bats: added twoprice_forcases asserting the intro (2026-07-15) and standard (2026-09-02) lookupsNotes
Full suite: 15/15 passing (13 pre-existing + 2 new). New glob
claude-sonnet-5-*is equally specific toclaude-sonnet-4-*but matches disjoint model strings, so no selection conflict. Pure data + test change — no consumer logic touched;price_for/cost_usd/et_multiplier_forpick up the rows automatically. No commit/push per workflow contract.feat: implement issue #1096 — [Phase 1] Add effective-dated claude-so…