# refactor\(pi\): report context usage on provider turns · stienswout/t3code

[View on GitCafe](https://git.cafe/stienswout/t3code/commit/530c68c165f17b44c297a5811d3107f662309322)

Repository: [stienswout/t3code](https://git.cafe/stienswout/t3code)

Visibility: public

Requested revision: 530c68c165f17b44c297a5811d3107f662309322

Requested commit: 530c68c165f17b44c297a5811d3107f662309322

Commit: 530c68c165f17b44c297a5811d3107f662309322

Tree: 2daf39256e9b25c92b34fed0328e821020ca0e0d

Author: Wout Stiens

Committer: Wout Stiens

## Message

```
refactor(pi): report context usage on provider turns

The base branch now carries live context usage on provider turns
(tokenUsage, #8144) and the web meter reads it from the projection. Pi
kept a second owner for the same data: a contextUsage snapshot on the
provider thread, refreshed after terminalization and invalidated by hand
on rollback.

Read Pi's session stats while the turn settles and attach them to the
completed provider turn instead, then drop the provider-thread field and
its generation bookkeeping. A turn without usable stats simply carries no
report, so the meter keeps the last reported turn without adapter-side
retention logic.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>

```

## Parents

- [8454e669dfd25ae898ce9fc593e4d5e38778149e](https://git.cafe/stienswout/t3code/commit/8454e669dfd25ae898ce9fc593e4d5e38778149e?format=markdown)

[Source at this commit](https://git.cafe/stienswout/t3code/tree/530c68c165f17b44c297a5811d3107f662309322?format=markdown)
