Skip to content

[feature]: Track MiniMax Code (desktop coding agent) usage from ~/.minimax/v2/sessions JSONL #655

Description

@Theoz001

What problem does this solve?

MiniMax Code (MiniMax's desktop coding agent, Electron app; CN bundle id com.minimax.agent.cn, verified on v3.0.73 / macOS) is not among the 39 tracked tools, so its token usage is invisible in the dashboard — even though the app writes complete per-message usage records to local disk.

This is complementary to #429, which covered MiniMax cloud quota polling and was closed pending a safe credential source. Local session parsing needs no credentials and no network calls, so it doesn't hit that blocker.

Proposed solution

Add MiniMax Code as a passive reader (same family as pi / OmO / Kimi Code — nothing gets installed into the tool).

Where the data lives (verified on a live install, macOS):

~/.minimax/v2/sessions/YYYY/MM/DD/<HH-MM-SS-mmm>-session_<base64>/messages.jsonl

One JSON object per line (redacted sample):

{
  "message_id": "",
  "turn_id": "",
  "message": {
    "role": "assistant",
    "model": "k3-256k",
    "provider": "",
    "timestamp": 1789743567882,
    "usage": {
      "input": 132719,
      "output": 16692,
      "cacheRead": 439298,
      "cacheWrite": 0,
      "totalTokens": 588709,
      "cost": { "input": 0, "output": 0, "cacheRead": 0, "cacheWrite": 0, "total": 0 }
    }
  }
}

Notes from inspecting a real install (290 session files spanning 2026-05 → today):

  • Only message.role === "assistant" entries carry usage. The usage shape is the pi-family input / output / cacheRead / cacheWrite convention with a ms-epoch message.timestamp — exactly what parsePiLikeIncremental already consumes.
  • The two format differences vs pi: there is no type: "message" wrapper, and the dedup id is message_id (top level) instead of id. Everything else matches, so a thin entry adapter over the existing pi-style engine should be sufficient.
  • Migrated legacy sessions replay with model: "historical-transcript" and all-zero usage — naturally skipped by the zero-token guard.
  • MiniMax Code is a router: the upstream model is recorded per message (MiniMax-M2.7, kimi-for-coding, glm-5.3, k3, …), so no global fallback model is needed (same situation as OmO).
  • There is no session-header line carrying cwd, so project attribution can be left out initially.
  • Suggested path override: TOKENTRACKER_MINIMAX_HOME following the TOKENTRACKER_OMO_HOME pattern.

Also present but apparently stale: ~/.minimax/sqlite.db has an ideal token_usage table (model, ts, input_tokens, output_tokens, reasoning_tokens, cache_read_tokens, cache_write_tokens, cost_usd), but on this install it only holds 2 rows from install day back in June — live data is in the v2 JSONL above. The v2 ~/.minimax/v2/sqlite/runtime-state.sqlite has no token tables at all. Session directories also contain subagent/task transcripts (*.readable.v1.jsonl) in case subagent attribution ever matters.

Privacy-wise this fits the house rule: the parser only needs message_id, role, model, timestamp, and usage — never any content.

Alternatives considered

Category

New AI tool integration

Anything else?

  • Verified on macOS; the Windows/Linux data directory (%USERPROFILE%\.minimax) is presumed but unverified.
  • Happy to turn this into a PR following CONTRIBUTING.md's 5-step integration checklist if welcome — it looks like a thin adapter over the pi-style engine plus a recursive messages.jsonl walker.

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

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions