promptdojo_

Tokenizers and context budget — step 7 of 7

Checkpoint

One last thing before we move on. Same surface as a write step — but the lesson doesn't complete until this passes.

Build the context-budget ledger. Walk the four line items, printing f"{name:<18} {cost:>3} (running total {used})" for each, then f"remaining for the answer: {remaining}" against the 100-token budget. Finally, try to admit chunk B (15 tokens): since it exceeds what's left, print f"cannot afford {name} ({cost} > {remaining}) - drop or compact first". The window is a shared budget — spend it deliberately.

full-screen editor opens — close anytime to keep reading.