Upgrade and rebuild
In this tutorial we upgrade AI Ledger to its newest version and, when its release notes ask for it, run ai-ledger rebuild once. It takes a few minutes.
We start from the ai-ledger command that Install and first run installed with uv tool install.
Note the version we run
Section titled “Note the version we run”In a terminal, run:
ai-ledger --versionIt prints the version, for example ai-ledger 0.3.0. This works while the app is running.
Stop the app
Section titled “Stop the app”Go to the terminal where ai-ledger runs and press Ctrl+C. The app stops.
The app must be stopped for the rest of this tutorial: while it runs, it owns the store, and ai-ledger rebuild cannot open it.
Upgrade
Section titled “Upgrade”Run:
uv tool upgrade ai-ledgeruv installs the newest version. The upgrade also brings that version’s model prices.
Check the version again:
ai-ledger --versionIt prints the new version, for example ai-ledger 0.4.0.
Read what the upgrade asks for
Section titled “Read what the upgrade asks for”Open the Changelog and read the sections of every version newer than the one we ran. A version that needs a rebuild says so at the top of its section, for example:
Run
ai-ledger rebuildonce after upgrading, with the app stopped.
If none of those sections asks for it, skip the next step. A rebuild that was not needed does no harm; it only takes time.
Rebuild the derived tables
Section titled “Rebuild the derived tables”Run:
ai-ledger rebuildThe rebuild recomputes the sessions, requests, tool calls and the other figures the pages read, from the transcript lines the store already holds. It reads no transcript file. When it is done, it prints the number of transcript files it replayed and the time it took, for example:
{'files': 2140, 'seconds': 95.3}The rebuild keeps what we set on the pages: the Errors page’s fix markers and muted types stay as they were.
Start the app
Section titled “Start the app”Run:
ai-ledgerThe browser opens Activity, as before. Select the Context tab. Its heading reads as usual, and no notice says “The store holds sessions from before this version.” The Context page shows that notice while its figures still need a rebuild. Other figures a rebuild fixes show no notice, which is why we read the changelog first.
What we did
Section titled “What we did”We upgraded AI Ledger, rebuilt the derived tables when the changelog asked for it, and checked that the Context page no longer asks for a rebuild. The store kept every transcript line through the upgrade.
To learn more:
- How AI Ledger works: the raw lines, the derived tables, and why a rebuild is sometimes needed.
- CLI and options:
ingest,rebuildand their options. - Troubleshooting and FAQ: when a command says the app owns the store.