pi-usage-maintenancelisted
Install: claude install-skill vraj-ai/skills
# Pi usage maintenance
This is a manual-only runbook for maintaining Pi usage reporting. Do not
invoke it from an ordinary coding prompt, and do not silently collect or
upload telemetry.
## Invariants
- Treat Pi's append-only JSONL/session records as the source of truth. SQLite,
caches, charts, and summaries are rebuildable indexes, never the only copy.
- Preserve raw records and timestamps; normalize only in derived tables.
- Separate observed provider-reported usage from estimates. Label missing,
sampled, or inferred values instead of filling them with guesses.
- Keep historical pages immutable while allowing a bounded live tail to update.
- Aggregate by default. Do not expose prompts, responses, paths, account
identifiers, or secrets in reports unless the user explicitly requests a
redacted sample.
## Procedure
1. Confirm the requested scope, Pi data root, timezone, retention policy, and
whether this is a dry run. Resolve paths explicitly; never scan a home
directory or delete by a broad glob.
2. Snapshot or checksum the input files before changing derived state. Record
the highest source offset/timestamp processed so a rerun is idempotent.
3. Rebuild or incrementally sync the index from JSONL. Use stable event IDs;
tolerate truncated final lines and report them for later repair.
4. Recompute daily and monthly aggregates, including request counts, tokens
(input/output/cache when available), latency, errors, and provider/model
dimensions. Keep