Pi Source
Default locations
Section titled “Default locations”~/.pi/agent/sessions/**/*.jsonl~/.omp/agent/sessions/**/*.jsonl(Oh-My-Pi fork)
Override
Section titled “Override”llm-usage daily --pi-dir /path/to/pi/sessions# orllm-usage daily --source-dir pi=/path/to/pi/sessionsParsing notes
Section titled “Parsing notes”The adapter reads session, model_change, and message records and extracts token/cost usage from message usage payloads.
Forked sessions start with a copy of the parent’s entries, keeping their original ids and timestamps. When a session header carries parentSession and the same report counts that parent (the file exists under a scanned pi directory), entries timestamped before the fork are skipped because the parent already counts them. Otherwise the fork’s copies are counted, since they are the only live record of that usage, under the parent’s session id, taken from pi’s <timestamp>_<session id>.jsonl file name (a parent file named otherwise leaves them under the fork’s id). After the parent file is deleted, they then match the events history kept for it, so that usage is counted once, also when the parent kept being used after the fork. When several forks of a deleted parent copy the same entries, each copied entry is counted once.