Behind jackin❯ — crates

jackin-usage

Usage, pricing, telemetry, and token monitors for the jackin-capsule daemon. Owns the in-capsule accounting of agent token spend/cost and the telemetry store that persists it.

What this crate owns

  • Token monitoring (token_monitor) and usage accounting (usage) for running agents.
  • Telemetry emission + store (telemetry, telemetry_store, logging) — the capsule-side observability tier.
  • Usage output shaping (output). (clog!/cdebug! logging infrastructure is re-exported from jackin-diagnostics.)

Architecture tier and allowed dependencies

Infrastructure (capsule-side observability/accounting). Allowed inward dependencies: jackin-core, jackin-protocol, jackin-diagnostics. No dependency on jackin-capsule (would be circular), jackin-tui, jackin-console, or any presentation crate. Logging infrastructure (logging, clog!, cdebug!) lives here so both binaries share one tier.

Structure

ModuleOwnsTests
lib.rscrate root, re-exports
token_monitor.rs · token_monitor/token spend monitoringtests.rs
usage.rs · usage/usage/pricing accountingtests.rs
telemetry.rstelemetry emission
telemetry_store.rs · telemetry_store/persistent telemetry storetests.rs
store_backend.rsturso SQLite import chokepoint
logging.rs · logging/shared logging tier (clog!/cdebug!)tests.rs
output.rsusage output shaping

Public API

Token-monitor + usage-accounting types consumed by jackin-capsule; the shared clog!/cdebug! logging tier re-exported across the workspace. Avoid cloning full usage views during account materialization — serialize from borrowed views/iterators (tracked perf item).

How to verify

cargo nextest run -p jackin-usage
cargo clippy -p jackin-usage --all-targets -- -D warnings

On this page