Skip to content
    ↑↓ select↵ openesc close
    wakatime

    Wakatime

    @wakatime/opencode-wakatime·v1.0.0·Other

    Official WakaTime plugin for OpenCode: Track your OpenCode usage with WakaTime

    GitHub stars

    6

    Monthly installs

    0

    Composite score

    26.7

    Multi-signal model

    Last commit

    10 days ago

    2026-09-24

    Install and configure

    opencode.json

    Writes to this project's opencode.json — applies to this repository only.

    opencode.json

    {
      "$schema": "https://opencode.ai/config.json",
      "plugin": ["@wakatime/opencode-wakatime@1.0.0"]
    }

    OpenCode loads npm dependencies through its embedded runtime on startup and caches them locally — no manual global install needed.

    Track AI coding activity, file changes, token usage, costs, and more from OpenCode v2 with WakaTime.

    Installation

    Add the official package to your ~/.config/opencode/opencode.json (or your project's opencode.json):

    {
      "$schema": "https://opencode.ai/config.json",
      "plugins": ["@wakatime/opencode-wakatime"]
    }
    

    Keep any existing entries in the plugins array. OpenCode installs npm plugins automatically at startup. Restart OpenCode after changing the config. See OpenCode's plugin documentation.

    Add your WakaTime API key to ~/.wakatime.cfg:

    [settings]
    api_key = waka_123
    

    The plugin automatically downloads wakatime-cli into ~/.wakatime/. No global npm install or manual CLI installation is required. The npm package must be published before the package-name installation above is available.

    What is tracked

    Like the official Claude Code and Codex CLI plugins, this plugin delegates transcript parsing and delivery to the official wakatime-cli. It requires CLI v2.26.6 or newer and automatically upgrades older installations.

    • File creation, edits, and deletions from successful write, edit, and apply_patch tools.
    • Added and deleted lines from OpenCode's diff metadata, reported as WakaTime's signed ai_line_changes (additions minus deletions). For example, +5/-2 is reported as 3; deleting 5 lines is -5.
    • Input tokens, cached input tokens, and output tokens. The CLI includes cache writes in input tokens and reasoning in output tokens.
    • User prompt lengths in Unicode characters, without sending prompt text as heartbeat data.
    • Session, model, project, and OpenCode version information (read directly from the v2 host).

    OpenCode v2's SQLite transcripts (session_v2 and session_message) are supported. The CLI honors XDG_DATA_HOME, OPENCODE_DATA_DIR, and OPENCODE_DB_PREFIX when locating transcripts.

    Syncs are coalesced and serialized, and wait for active turns (including subagents) to become idle so completed tools and token totals are persisted. Failed or interrupted executions and plugin cleanup also trigger pending syncs when no turn remains active. Network failures are logged without interrupting OpenCode; the CLI handles offline storage and deduplication.

    Configuration and troubleshooting

    The standard ~/.wakatime.cfg settings apply. Set debug = true under [settings] to enable debug logs. Downloader proxy settings (proxy, no_ssl_verify) follow the official Codex plugin. WAKATIME_HOME selects an alternate existing home directory containing .wakatime.cfg and .wakatime/.

    Plugin logs: ~/.wakatime/opencode.log. CLI logs: ~/.wakatime/wakatime.log. Update checks are cached for four hours; an unavailable update does not replace a working CLI.

    Optional diagnostic commands:

    npx @wakatime/opencode-wakatime --install
    npx @wakatime/opencode-wakatime --sync /path/to/project
    

    Development

    Node.js 20+; no npm dependencies or build step are required.

    npm test
    npm run check
    npm pack --dry-run
    

    Integration tests require Node.js 22.13+ and use a released CLI with isolated synthetic OpenCode storage. All HTTP requests are sent to a local mock WakaTime API:

    WAKATIME_CLI_TEST_PATH=/path/to/wakatime-cli npm run test:integration
    

    For local OpenCode testing before publication, add "file:///absolute/path/to/opencode-wakatime" to the plugins array in opencode.json.

    The downloader is adapted from the official Codex CLI plugin under the BSD-3-Clause license. The plugin uses the v2 default export, event subscription, and cleanup API described in OpenCode’s plugin documentation.

    Similar plugins