Skip to content

[feat] Codex CLI token source #3

Description

@ikseong00

Goal

Add a TokenSource implementation that captures token usage from OpenAI's Codex CLI, so Tokie grows from Codex usage too — not just Claude Code.

Why

The project is designed around the TokenSource interface explicitly so multiple AI CLI tools can feed the same pet. Codex is the obvious next source. The pet's "diet" expands and users who use both tools get a unified view.

Acceptance

  • New file core/tokenSource/codex.ts implementing the TokenSource interface (id, start, stop, optional install).
  • Source emits TokenEvent for each detected Codex turn with tokens populated.
  • Dedup key uses Codex's message/request id (or sourceId-prefixed hash if unavailable).
  • Wired into SourceRegistry in electron/bootstrap.ts.
  • Unit tests in core/tokenSource/codex.test.ts — parser / cursor / dedup behavior.
  • docs/01-tokens.md updated with Codex section.

Hints

  • Reference implementations: core/tokenSource/claudeStatusLine.ts (push / HTTP) and core/tokenSource/claudeJsonl.ts (pull / file watch). Pick whichever pattern fits Codex's surfaces — probably JSONL-style log watching unless Codex has a hook similar to Claude's statusLine.
  • Codex CLI stores logs somewhere similar to ~/.config/codex/ or ~/.codex/ — investigate.
  • Make sure the cursor persistence path uses a distinct key (e.g. codex-jsonl-files) in lastCursors so it doesn't collide with Claude's.

Out of scope

  • UI changes (the pet sprite/badge already shows aggregate state — no Codex-specific visual indicator).
  • Multi-source per-AI breakdown in stats panel (separate issue if wanted).

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

    enhancementNew feature or request

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions