Deep dive · advanced topics · ~30 minInternal talk · September 2026
WIP — draft

Cost & Context.

What agents really cost — and how to spend the context window like the scarce resource it is.

cost → context
2
Agenda

Two parts, half an hour

PartTopicNote
01What agents really costsubscriptions, API, Bedrock
02Efficient work with contextmost important part · live demo

All pricing and product claims are date-stamped September 2026 and sourced — see the closing Sources slide.

01

What agents really cost

Tokens, priced. One real session's bill, traced line by line. Then: which plan for which team.

3
Cost · tokens, priced

Three meters, not one

Input

Everything sent with the request — prompt, files, tool results, history. The base meter: cheaper than output, pricier than cached.

Output

Everything the model generates — including thinking tokens. The priciest meter, often 5× input.

Cached input

Repeated context (system prompt, CLAUDE.md, tool schemas) served from cache — up to 97.5% cheaper.

output $10 /M input $2 /M cached input ~$0.20 /M ← same million tokens, 50× apart

September 2026 rates, e.g. Sonnet 5: $2/M input · $10/M output (intro price, now standard). Spot-check platform.claude.com/docs/en/about-claude/pricing before quoting externally.

4
Cost · output dominates

Why output tokens dominate

  • Thinking tokens are output tokens. The effort dial (deck 03) trades quality for real, billed spend — xhigh is not free.
  • Output is typically 5× the price of input per token — a verbose agent that narrates every step pays a premium for it.
  • Latency follows the same meter: output tokens are generated one at a time; input is processed in parallel. Long output = slow turn.
  • Practical lever: shorter, more decisive final answers and tighter thinking budgets cut both cost and wait time together.

Cost and latency are the same lever here — trimming output tokens helps both at once.

5
Cost · one session's bill

Anatomy of a session's bill

# a real agentic session, traced turn by turn system prompt + tool schemas › cached after turn 1 CLAUDE.md › cached, resent every turn file reads (×12) › input — the biggest line item re-reads of same file (×4) › avoidable — context got dropped thinking + final answer › output — priciest per token

The single biggest avoidable cost in most sessions is re-reading the same file because context was already lost or cleared badly — part 02's whole subject.

6
Cost · subscriptions today

Pro, Max — and no confirmed "next"

PlanPriceUsage
Pro$20/mo (~$17/mo annual)baseline
Max 5×$100/mo5× Pro's session limits
Max 20×$200/mo20× Pro's session limits, priority access at peak times

No confirmed statement of a new subscription "direction" beyond Pro/Max/Team/Enterprise as of September 2026 — treat any such claim as unconfirmed. Pricing moves periodically; verify at claude.com/pricing before presenting exact numbers.

7
Cost · API pricing, family-wide

API pricing across the model family

ModelInput /MOutput /MNotes
Fable 5.1$10$50highest-cost self-serve tier
Opus 5.5$4$20complex agentic coding, enterprise
Sonnet 5$2$10intro price now standard
Haiku 4.5$1$5classification, extraction, routing

Prompt caching: up to 97.5% off cached input. Batch API: flat 50% off. Checked against Anthropic's pricing page in September 2026, but spot-check it again before quoting on stage.

8
Cost · subscription vs API

When a subscription beats API — and vice versa

Subscription wins

Steady daily interactive coding, one person, usage inside the plan's cap. Predictable monthly bill.

API wins

Bursty or programmatic use — CI runs, batch jobs, evals, multi-agent fleets. Pay exactly for what runs.

Hybrid usage-pool models (Cursor's Auto mode — deck 07, Measuring What Works) sit in between: subscription price, usage-aware routing underneath.

9
Cost · Team & Enterprise

Team → Enterprise

  • Team: SSO plus central admin controls for connectors and desktop deployment.
  • Enterprise: $20/seat/month + usage billed at API rates, annual only.
  • Adds on top of Team: domain capture, SCIM provisioning, fine-grained roles, IP allowlisting, audit logs, custom retention, group spend limits.

Verified SSO paths: Okta, Microsoft Entra ID, Google Workspace.

10
Cost · Claude on AWS Bedrock

Why an org reaches for Bedrock

  • Data stays inside AWS infrastructure — not shared with Anthropic or third parties; regional inference profiles cover US/EU/JP/AU residency.
  • Single AWS bill, existing IAM/CloudTrail, and the ability to retire committed AWS spend (Enterprise Discount Program) against Claude usage.
  • Regional (single-region) endpoints carry a 10% pricing premium over global endpoints.
  • Reach for it when: AWS data-boundary requirements, Guardrails/Knowledge Bases, strict regional residency, unified AWS governance.
11
Cost · Cursor's model

Cursor: usage pools + Auto routing

  • Four tiers: Hobby (free), Pro ($20/mo, two usage pools), Pro+ ($60/mo), Ultra ($200/mo).
  • Auto mode: Cursor picks the model per request; billed at that model's list price from your usage pools.
  • Cursor Router (Teams/Enterprise, launched Jul 22, 2026): a decision layer that picks per-request which model runs — not a new model itself.

Cursor claims up to 60% cost savings at frontier quality in A/B tests — that number is Cursor's own marketing claim, not independently verified.

12
Cost · takeaway

Which plan or channel — for which team

Team shapeReach for
Solo engineer, daily interactive codingPro or Max, by usage volume
CI, batch jobs, scheduled evalsraw API + batch discount (50% off)
Regulated data / AWS-committed orgClaude on Bedrock (regional endpoint)
Team needing SSO/audit/spend limitsTeam or Enterprise
Wants routing across model vendorsCursor Router or OpenRouter (deck 07)
02

Efficient work with context

The most important part of today. Context is the scarce resource — spend it like one.

13
Context · the scarce resource

Context is scarce — spend it that way

  • Degrades with fill. Quality starts slipping well before the hard token limit — a full window is not a healthy window.
  • Costs on every turn. Most of what's in the window gets resent (and mostly re-billed) each time you send a message.
  • Cache invalidation. Edit anything near the start of the conversation and the prefix cache for everything after it is gone.

Three separate failure modes, one fix: be deliberate about what stays in the window.

14
Context · the lifecycle

The context lifecycle of a session

Everything left of "conversation" is fixed overhead, resent and re-billed every turn (cached, but not free). Only the conversation genuinely grows — and it's the part you control least by default.

15
Context · what's resent

What gets resent every turn

# turn N of a real session — before the user has typed anything: system prompt › ~4–5K tokens (cached) built-in tool schemas › ~10–15K tokens (cached — before a single MCP server is added) MCP tool schemas › variable (names only — full schemas load on demand) CLAUDE.md › variable (cached — but size still matters, see next slides) conversation › grows every turn (the part you actually control turn-to-turn)

Caching makes this cheaper, not free — and a cache miss (from any upstream edit) means the full price plus a write premium. Run /context in Claude Code to see your own session's exact breakdown.

16
Context · CLAUDE.md, what belongs

CLAUDE.md: what belongs

  • Constraints the repo can't express: "never touch the payments schema without a migration review."
  • Commands the agent needs every session: exact test runner, lint command, deploy steps.
  • Conventions that aren't derivable from code: naming rules, review process, who owns what.

Test: could this live as a code comment or README instead? If yes, it usually shouldn't be here.

17
Context · CLAUDE.md, what doesn't

CLAUDE.md: what doesn't belong

  • Anything derivable from the code. The agent can read the file; don't pre-digest it for every session, forever.
  • One-off notes. "Fixed the flaky test on Tuesday" belongs in a commit message, not a file resent every turn.
  • Essays. Rationale nobody needs turn-to-turn is a cost with no ongoing return.

Every line in CLAUDE.md is paid for on every turn, of every session, forever. Treat additions like you'd treat a hot-path dependency.

18
Context · measuring changes

Measure the effect — don't guess it

  • Token overhead per session: read it straight off the API usage response — before/after a CLAUDE.md change.
  • Behavioral spot-checks: does the agent still follow the constraint you kept, and stop repeating the one you cut?
  • Before/after evals on a fixed task set: the rigorous version — same tasks, same rubric, two CLAUDE.md variants (full method in deck 07, Measuring What Works).
19
Context · hygiene

/clear vs /compact

/clear

Full reset. Use when the task is genuinely done and the next one is unrelated — don't drag dead context into a fresh task.

/compact

Summarize and continue. Use mid-task when the window is filling but you still need the thread.

task A — done /clear empty fresh start, zero baggage task A — mid-flight /compact room summary + the thread continues

Wrong choice either direction costs you: /clear too early loses context you needed; /compact too rarely drags a bloated window into every remaining turn. And /compact isn't free — the summarization pass itself reads the whole window one more time.

20
Context · subagents as firewalls

Subagents as context firewalls

  • A subagent explores, searches, or reads in its own context window — the parent session never absorbs the raw noise.
  • Only the distilled report comes back. Ten files read in a subagent cost the parent session one summary.
  • Full mechanics: deck 04, Subagents & Prompt Caching.

This is context hygiene applied at the architecture level, not just a discipline you have to remember mid-session.

21
Context · reading selectively

Read selectively

  • Grep or search for the relevant span before reading a whole file.
  • Use line ranges on large files instead of loading them whole.
  • Push broad, exploratory reading into a subagent (previous slide) rather than the main thread.

"Read the whole file just in case" is exactly the re-read pattern that was the biggest avoidable cost line item back in part 01.

22
Context · live demo
Live

Same task, two CLAUDE.md files

  • Left: today's bloated CLAUDE.md. Right: a lean rewrite — same constraints, none of the derivable or one-off content.
  • Identical prompt, run live in both. Compare turns, total tokens, and outcome.

Live Watch the token counters, not just the transcripts — the difference is usually bigger than it feels.

23
Context · fallback

Fallback: recorded run

▢
Placeholder — screenshot or recording of the bloated-vs-lean CLAUDE.md comparison (turn count, token totals, outcome) goes here.

Use only if the live run stalls. Narrate the captured turn/token delta from rehearsal, then move on.

24
Context · recap

Context hygiene: the checklist

  • Measure first: run /context — know what your fixed overhead actually is.
  • Trim CLAUDE.md to what the repo genuinely can't express.
  • Choose /clear or /compact deliberately, not by habit.
  • Push broad exploration into subagents — keep the parent thread distilled.
  • Read selectively; grep before you load a whole file.

If this deck changes one habit, make it this one — it's the highest-leverage change available to most engineers this week.

25
Close · recap

Cost → context

01 cost
→
02 context
01 Cost

Three meters, not one — and output (thinking included) is the expensive one. Pick the channel by team shape, not by habit.

02 Context

The window degrades as it fills, re-bills every turn, and re-caches badly. Trim CLAUDE.md, clear deliberately, read selectively.

Of the two, context is the one to act on first — it's the highest-leverage habit change available this week.

26
Close · sources

Sources — all claims dated September 2026

Full source list with per-claim citations: deck05-facts.md (internal research doc). One item flagged unverified: any claim of a new announced subscription direction beyond Pro/Max/Team/Enterprise.