Skip to main content

pi usage data provider for `mngr usage` (reader + writer gate; the per-message writer lives in mngr_pi_coding's lifecycle extension)

Project description

imbue-mngr-pi-coding-usage

pi data provider for mngr usage. pi loads a single explicit extension (mngr_pi_coding's lifecycle extension, via pi -e), so the per-message usage writer lives there -- it already holds each assistant message's cost and tokens. This package owns the two usage-specific pieces:

  • The reader: an aggregate_usage_source hookimpl claiming the pi-coding source, aggregated session-incrementally (pi reports cost per message, summed per session).
  • The writer gate: on_after_provisioning drops a pi_emit_usage marker in each pi agent's state dir. The lifecycle extension only emits usage events when that marker is present -- so the events are written exactly when their reader (this package) is installed.

What gets captured

pi computes per-message cost client-side (usage.cost.total), so cost is REPORTED (no estimation). Each assistant message_end appends one cost_snapshot to events/pi-coding/usage/events.jsonl with the reported cost, tokens (input/output/cacheRead/cacheWrite), the provider-qualified model (<provider>/<model>), and the session id (the pi session file's basename). cost_mode is API_KEY (pi bills a real provider key).

Why the writer is in the harness extension

Unlike Claude (statusline shim) or OpenCode (auto-loaded plugin/*.ts), pi loads exactly one explicit extension owned by mngr_pi_coding. A standalone writer would require a harness change either way, so the writer is folded into the lifecycle extension (which already extracts the message usage), and this package stays the reader + gate.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

imbue_mngr_pi_coding_usage-0.1.0.tar.gz (10.1 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

imbue_mngr_pi_coding_usage-0.1.0-py3-none-any.whl (3.8 kB view details)

Uploaded Python 3

File details

Details for the file imbue_mngr_pi_coding_usage-0.1.0.tar.gz.

File metadata

File hashes

Hashes for imbue_mngr_pi_coding_usage-0.1.0.tar.gz
Algorithm Hash digest
SHA256 db211e8c79fbbfe4e791864b529a58b1ffebf6420e1f45037b07995542f1c710
MD5 1562e40447b72c75e199c0508b8d4af1
BLAKE2b-256 9a94386b8e5591103f3fa236eb97f6e928f2d0c67bcc940d78038c3c0eadf931

See more details on using hashes here.

Provenance

The following attestation bundles were made for imbue_mngr_pi_coding_usage-0.1.0.tar.gz:

Publisher: publish.yml on imbue-ai/mngr

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file imbue_mngr_pi_coding_usage-0.1.0-py3-none-any.whl.

File metadata

File hashes

Hashes for imbue_mngr_pi_coding_usage-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 d14caf4cf9aadf18b3779a9a35665886f54fdf31cc4b1d2bd75a707a82eda871
MD5 6bb31e4d2cf6deec6e84b96a5289d3ce
BLAKE2b-256 bd331bcb9ee7c6d1157280efa7d3763efc725885d0b2a39454f7cf66ea5fc436

See more details on using hashes here.

Provenance

The following attestation bundles were made for imbue_mngr_pi_coding_usage-0.1.0-py3-none-any.whl:

Publisher: publish.yml on imbue-ai/mngr

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page