pi-wakatime
v1.1.1
Published
WakaTime plugin for Pi Coding Agent
Maintainers
Readme
WakaTime for Pi
Track your Pi usage, lines of code generated, time spent prompting the agent, and file activity with WakaTime.
WakaTime is an open source plugin ecosystem for metrics, insights, and automatic time tracking generated from your programming activity.
This project is intentionally modeled after wakatime/claude-code-wakatime, adapted for Pi's extension event model.
Installation
pi install npm:pi-wakatimeThen add your WakaTime API key to ~/.wakatime.cfg:
[settings]
api_key = your_wakatime_api_keyHow It Works
Because Pi uses extension lifecycle events instead of Claude hook scripts, this plugin maps Pi events onto the same heartbeat concepts where possible:
turn_start→ prompt / AI activity heartbeattool_call→ pre-tool activity heartbeattool_result→ post-tool activity heartbeatsession_before_compact→ pre-compact activity heartbeatsession_shutdown→ session end heartbeatread/write/edittool results → file heartbeats
The plugin also:
- finds a global
wakatime-cliwhen available - installs a local
wakatime-cliinto~/.wakatime/when needed - checks for updates to the local CLI periodically
- respects WakaTime
proxyandno_ssl_verifysettings - stores throttle state in
~/.wakatime/pi-wakatime-state.json - writes extension logs to
~/.wakatime/pi-wakatime.log
Usage
Open Pi as usual and work normally. Once your API key is configured, heartbeats are sent in the background.
You should see activity on your WakaTime dashboard for:
- your current project folder
.pi-sessionsynthetic session activity- individual files read or modified by Pi
- AI-assisted line changes for
writeandedit
Development
Run the test suite:
npm testTroubleshooting
Check that Pi can load the extension:
pi -e ./src/index.tsEnable debug logging in ~/.wakatime.cfg:
[settings]
debug = trueThen inspect logs:
tail -f ~/.wakatime/pi-wakatime.logIf no activity appears in WakaTime:
- verify
~/.wakatime.cfgcontains a validapi_key - inspect
~/.wakatime/pi-wakatime.log - check whether
~/.wakatime/wakatime-cliexists - confirm Pi is actually loading the extension
If wakatime-cli download fails:
- verify network access to GitHub releases
- verify proxy settings in
~/.wakatime.cfg - install
wakatime-cliglobally as a fallback
Credits
- Inspired by wakatime/claude-code-wakatime
- Built for Pi Coding Agent
