“What did this agent cost?” is an easy question to answer badly. A visible assistant reply may be preceded by a branch summary, a compaction pass, or a tool hook that called a model of its own. Pi's public coding-agent README says its maintainer regularly publishes Pi monorepo work sessions; its new usage-accounting patch shows the corresponding engineering discipline: carry the receipt with every operation that spent model work.
The repo evidence
The change reaches across the agent harness and coding-agent layer rather than adding a single counter. A branch-summary result now retains response usage. Compaction returns both summary text and usage; in the split-turn path, Pi combines the history-summary and turn-prefix receipts. Tool-result hooks can preserve usage supplied by a tool. Session entries retain it, and the coding-agent session code rolls it into totals. The accompanying tests check the combined record, while the patch's coding-agent tests follow the numbers into session statistics.
The transferable skill
Make cost and usage part of the event contract, not a dashboard calculation. When a system creates a summary, compacts history, calls a tool, or lets an extension patch a result, attach typed usage right there and aggregate it at the session boundary. That preserves a traceable answer when a user asks why a short response used more work than it appears to contain.
The limit
The public session statement is evidence that coding agents are part of Pi's work, not proof that an agent authored this exact commit. The tests show intended accounting behavior, not a cloud-provider invoice or universal extension support. The next useful signal is whether provider and extension adapters consistently return the metadata this ledger expects when a real session crosses multiple models.