WakaTime
WakaTime
WakaTime for OpenCode tracks your AI coding activity, lines of code, and time spent. It integrates with the WakaTime dashboard for detailed analytics about your AI-assisted development patterns.
Key Features
| Feature | Description |
|---|---|
| Automatic CLI management | Downloads and updates wakatime-cli automatically |
| Detailed file tracking | Tracks file reads and modifications (edit, write, patch, multiedit) |
| AI coding metrics | Sends --ai-line-changes for WakaTime AI coding analytics |
| Rate-limited heartbeats | 1 per minute per project to avoid API spam |
| Session lifecycle | Sends final heartbeat on session idle/end |
| Batch tool support | Tracks file operations executed via batch tool |
Prerequisites
Configure your WakaTime API key in ~/.wakatime.cfg (or $WAKATIME_HOME/.wakatime.cfg):
[settings]
api_key = waka_your_api_key_here
Get your API key from wakatime.com/settings.
Installation
Via opencode config (recommended)
{
"$schema": "https://opencode.ai/config.json",
"plugin": ["opencode-wakatime"]
}
Via npm
npm i -g opencode-wakatime
opencode-wakatime --install
From source
git clone https://github.com/angristan/opencode-wakatime
cd opencode-wakatime
npm install && npm run build
node bin/cli.js --install
What Gets Tracked
| Tool | Data Extracted |
|---|---|
read | File path (from title) |
edit | File path, additions, deletions (from filediff) |
write | File path, new file detection |
patch | File paths from output, diff count |
multiedit | File paths and changes from each edit result |
batch | Tracks all child tool operations |
Each heartbeat includes file path, project folder, AI line changes (additions - deletions), category “ai coding”, and plugin identifier.
Files
| File | Purpose |
|---|---|
~/.wakatime/opencode.log | Debug logs |
~/.wakatime/opencode-{hash}.json | Per-project state (last heartbeat timestamp) |
~/.wakatime/opencode-cli-state.json | CLI version tracking |
~/.wakatime/wakatime-cli-* | Auto-downloaded CLI binary |
Troubleshooting
Enable debug logging in ~/.wakatime.cfg:
[settings]
debug = true
Logs are written to ~/.wakatime/opencode.log.
Links
- GitHub Repository — Source code and issues
- WakaTime Dashboard — View your coding analytics
- Awesome OpenCode — Browse more plugins