@jc4649/pi-usage-recorder

pi coding-agent extension: pi-usage-recorder

Packages

Package details

extension

Install @jc4649/pi-usage-recorder from npm and Pi will load the resources declared by the package manifest.

$ pi install npm:@jc4649/pi-usage-recorder
Package
@jc4649/pi-usage-recorder
Version
0.1.0
Published
Jun 26, 2026
Downloads
94/mo · 6/wk
Author
jimmyc4649
License
MIT
Types
extension
Size
12.3 KB
Dependencies
0 dependencies · 0 peers
Pi manifest JSON
{
  "extensions": [
    "./index.ts"
  ]
}

Security note

Pi packages can execute code and influence agent behavior. Review the source before installing third-party packages.

README

@jc4649/pi-usage-recorder

Observe-only token & context telemetry for a pi coding-agent session. Changes nothing the model sees — it only records.

What it does

Appends one row per assistant turn to <cwd>/.pi/usage/usage.jsonl: full token counts, cache read/write split, cost, and context-fill %. This lets you analyze a session's spend trend offline, or A/B a context-management extension (compare usage.jsonl with it off vs on).

It registers no context/prompt rewrite — purely a measurement foundation. Fail-open everywhere: a dropped row or failed command never disrupts the agent.

Commands

  • /usage — usage for the current session.
  • /usage all — every recorded session.

Configuration

  • USAGE_RECORDER_DISABLE — set to disable recording entirely.

Install

pi install @jc4649/pi-usage-recorder

MIT