You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Parent: #63. Methodology: docs/benchmarks/PUBLIC-BENCHMARK-METHODOLOGY.md (work package 6; "Token Measurement" section). Roadmap decision 5.8: Claude tokenizer, measured after client-side rewrap. Maintainer decision on record (PLAN.md Amendment 2026-07-08): the Anthropic count-tokens API is the counting mechanism, confined to the maintainer-run live phase — exact counts for headline claims, zero runtime network access or new dependencies in the server itself. Token records (merged #75) carry client_wrapped_tokens: None / raw_payload_tokens: None placeholders; benchmarks/model_matrix.py exposes METHODOLOGY_TOKEN_LABEL = "Claude Tokens (Normalized Payload)".
Status: NOT agent-ready. Filed by the orchestrator per PLAN.md T6(b); Vision must review, create the .planning/agent-context/ file (decision 5.14, mirrored as an issue comment), and apply agent-ready before any dispatch.
Goal
Add the Claude token-count integration: capture the client-rewrapped message envelope per cell, count it via the Anthropic count-tokens API behind the live-phase guard, and fill the runner's token records — with approximations clearly marked and barred from headline claims.
Acceptance criteria (draft — Vision edits before agent-ready)
Envelope capture: the counting path takes the same client-side wrapping used by the benchmark client (methodology "Token Measurement" steps 1–3); where a client cannot expose its exact wrapped envelope, the record is marked approximation: true and the report generator ([v0.5.0] benchmark reporting — generate raw report and README-safe summary #74) must exclude it from headline-eligible tables.
Completed token records fill client_wrapped_tokens and raw_payload_tokens (raw payload counted separately as diagnostic data), labeled Claude Tokens (Normalized Payload) via the exported constant — never confusable with provider billing tokens.
A new third-party runtime dependency (e.g. anthropic), if proposed, is a supervisor-review trigger: justify why a direct HTTPS call via existing deps is insufficient, and in any case the dependency must be an optional extra or dev/benchmark-only group — never a server runtime dependency.
Tests (additive, under tests/benchmarks/) cover fake-counter records, approximation marking, guard refusal without env config, and serialization-latency capture alongside counts (decision 5.8 reports tokens AND latency).
No README/benchmark claims; Refs #63, never Closes #63.
Scope boundaries
In scope: counting integration, guard, record filling, fake-counter tests. Out of scope: spending API credits (maintainer live phase only), report layout (#74), corpus, README.
Forbidden-territory reminder
Standard §2 list applies (notably: pyproject.toml[project] changes and new runtime deps are supervisor-review at minimum); merged tests additive-only; the server's offline-first runtime (principle 2.2) is untouchable — network lives only in the guarded benchmark live path.
Validation commands
uv run ruff check src/ tests/
uv run ruff check benchmarks/
uv run pyright src/
uv run pyright benchmarks/
uv run pytest --tb=short -q
uv run pytest tests/benchmarks -q
uv run python-docs-mcp-server doctor
uv lock --check # if any dependency/extras change is proposed
Recovery
If client-rewrap capture proves impossible for a given client, stop and comment here with the exact gap — the methodology requires marking that result as an approximation, not guessing.
Context
Parent: #63. Methodology:
docs/benchmarks/PUBLIC-BENCHMARK-METHODOLOGY.md(work package 6; "Token Measurement" section). Roadmap decision 5.8: Claude tokenizer, measured after client-side rewrap. Maintainer decision on record (PLAN.md Amendment 2026-07-08): the Anthropic count-tokens API is the counting mechanism, confined to the maintainer-run live phase — exact counts for headline claims, zero runtime network access or new dependencies in the server itself. Token records (merged #75) carryclient_wrapped_tokens: None/raw_payload_tokens: Noneplaceholders;benchmarks/model_matrix.pyexposesMETHODOLOGY_TOKEN_LABEL = "Claude Tokens (Normalized Payload)".Status: NOT agent-ready. Filed by the orchestrator per PLAN.md T6(b); Vision must review, create the
.planning/agent-context/file (decision 5.14, mirrored as an issue comment), and applyagent-readybefore any dispatch.Goal
Add the Claude token-count integration: capture the client-rewrapped message envelope per cell, count it via the Anthropic count-tokens API behind the live-phase guard, and fill the runner's token records — with approximations clearly marked and barred from headline claims.
Acceptance criteria (draft — Vision edits before agent-ready)
approximation: trueand the report generator ([v0.5.0] benchmark reporting — generate raw report and README-safe summary #74) must exclude it from headline-eligible tables.require_live_environment()(same guard as [v0.5.0] benchmark adapters — define OpenAI/Google model matrix #85) plus an Anthropic key env var; CI and unit tests never call it — tests use a fake counter.client_wrapped_tokensandraw_payload_tokens(raw payload counted separately as diagnostic data), labeledClaude Tokens (Normalized Payload)via the exported constant — never confusable with provider billing tokens.anthropic), if proposed, is a supervisor-review trigger: justify why a direct HTTPS call via existing deps is insufficient, and in any case the dependency must be an optional extra or dev/benchmark-only group — never a server runtime dependency.tests/benchmarks/) cover fake-counter records, approximation marking, guard refusal without env config, and serialization-latency capture alongside counts (decision 5.8 reports tokens AND latency).Refs #63, neverCloses #63.Scope boundaries
In scope: counting integration, guard, record filling, fake-counter tests. Out of scope: spending API credits (maintainer live phase only), report layout (#74), corpus, README.
Forbidden-territory reminder
Standard §2 list applies (notably:
pyproject.toml[project]changes and new runtime deps are supervisor-review at minimum); merged tests additive-only; the server's offline-first runtime (principle 2.2) is untouchable — network lives only in the guarded benchmark live path.Validation commands
uv run ruff check src/ tests/ uv run ruff check benchmarks/ uv run pyright src/ uv run pyright benchmarks/ uv run pytest --tb=short -q uv run pytest tests/benchmarks -q uv run python-docs-mcp-server doctor uv lock --check # if any dependency/extras change is proposedRecovery
If client-rewrap capture proves impossible for a given client, stop and comment here with the exact gap — the methodology requires marking that result as an approximation, not guessing.
Effort estimate
4–8 hours.
Refs #63.