pi-wakatime
v1.0.0
Published
WakaTime extension for pi coding agent - track AI coding activity and metrics
Maintainers
Readme
pi-wakatime
WakaTime plugin for pi coding agent.
Track your AI coding activity, including time spent prompting and lines of code generated by pi.
Features
- Automated CLI Management: Automatically downloads and installs
wakatime-clito~/.wakatime/if not present. - File Activity Tracking: Tracks file reads, writes, and edits performed by the agent.
- AI Coding Metrics: Tags write and edit operations as "ai coding" with line change counts, allowing you to see how much code is AI-generated on your WakaTime dashboard.
- Session Tracking: Sends heartbeats during conversation turns to track "thinking" and "planning" time even when no files are touched.
- Cross-Platform: Supports Windows, macOS, and Linux.
Installation
pi install npm:pi-wakatimePrerequisites
- Node.js (v16 or higher)
- pi coding agent
- A WakaTime account (free or paid)
Configuration
The plugin uses the standard WakaTime configuration file.
Create or edit ~/.wakatime.cfg in your home directory:
[settings]
api_key = your_wakatime_api_key
# debug = true # Optional: Enable debug loggingYou can get your API key from your WakaTime Settings.
Troubleshooting
Check if the extension is loaded
pi -e ~/.pi/agent/extensions/pi-wakatime/src/index.tsView logs
Logs are stored in ~/.wakatime/pi-wakatime.log:
tail -f ~/.wakatime/pi-wakatime.logThe plugin only logs errors by default. If you see no output, everything is working correctly.
Verify heartbeats are being sent
Check WakaTime dashboard at https://wakatime.com/dashboard - you should see:
- Project name from your working directory
.pi-sessionfor conversation activity- Individual files you've read/written
- "ai coding" category for AI-generated code
Common issues
No data on WakaTime dashboard:
- Verify your API key in
~/.wakatime.cfg - Check logs for errors:
cat ~/.wakatime/pi-wakatime.log - Ensure
wakatime-cliis installed:ls ~/.wakatime/
CLI download fails:
- Check your internet connection
- If behind a proxy, the CLI download might fail (manual installation needed)
- Download manually from https://github.com/wakatime/wakatime-cli/releases
Performance issues:
- The plugin uses 2-second debouncing to avoid spam
- Logs auto-rotate when exceeding 500KB
- Each heartbeat runs in background (non-blocking)
Credits
Based on the design of claude-code-wakatime.
