Skip to content

Export .token-proctor/audit.jsonl to CSV and a Grafana-ready metrics format #4

Description

@navintkr

The JSONL audit log captures every routing decision (task, model,
cost, redactions, verdict) but it's only useful if someone opens it.
Teams want to push this into Grafana, a spreadsheet, or their finops
dashboard.

What to do

Option A (simplest, ship first): a new CLI subcommand
token-proctor-mcp --export-csv <out> that reads the JSONL file and
emits a CSV with columns:
timestamp,user,task,model,tier,inputTokens,outputTokens,turns,costUsd,planBurnPct,redactions,verdict.

Option B (nice to have): emit OpenTelemetry spans or Prometheus
gauges so the audit log can feed a real dashboard. Start simple;
this can be a follow-up issue.

Acceptance

  • node out/mcp-server.js --export-csv out.csv produces a valid
    CSV from the current .token-proctor/audit.jsonl.
  • README "Observability" section.
  • Ships without adding new dependencies (Node's fs + string
    joining is enough).

Why this matters

This is the feature team leads ask for after two weeks of use:
"cool, but how do I show my manager we saved money?" Without an
export path, the audit log is write-only.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions