Playtime
Steam-style playtime tracking for CLI agent harnesses: Claude Code, Codex,
OpenCode, Pi, Oh My Pi, Copilot CLI, Gemini CLI, Cline, Qwen Code, Goose and Factory
Droid.
Steam tells you that you have 412 hours in a game and which ones you played this
week. Nothing does that for agent harnesses. Playtime does.
PLAYTIME
[all time] this year this month today tab / shift-tab · q quits
open agent busy last used
Claude Code 386h 04m 141h 22m 36% today
Codex 21h 51m 6h 09m 28% 3 days ago
OpenCode 4h 23m 1h 02m 23% 2 weeks ago
Hours used
~/work/api 88h 12m ██████████████████
~/work/dashboard 63h 40m █████████████
~/work/infra 41h 05m ████████
412h 18m open, agent working 148h 33m of it (36%), 9h 12m of that waiting on you
1.4 sessions open at a time on average, 2,910h of session time in total
2,481 turns
open now Claude Code ~/work/api 2h 14m · working
Install
npm install -g agent-playtime
playtime install
playtime doctor
Or without installing anything:
npx agent-playtime install
npx agent-playtime
playtime install wires up every harness it finds, backing up each settings
file first, and skips any whose config directory does not exist. Restart running sessions to pick the hooks up. Limit it with
--harness codex, or preview with --dry-run.
Every harness has a manual route, playtime install --harness <id>, with <id>
one of claude-code, codex, opencode, pi, omp, copilot, gemini, cline,
qwen, goose or droid. Three can also be installed from inside the harness:
| Harness | From within the harness | Manual |
|---|
| Claude Code | /plugin marketplace add fmarcac/agent-playtime then /plugin install playtime | playtime install --harness claude-code |
| Codex | /plugin marketplace add fmarcac/agent-playtime then /plugin install playtime@playtime | playtime install --harness codex |
| OpenCode | add "plugin": ["agent-playtime"] to opencode.json | playtime install --harness opencode |
| Pi | | playtime install --harness pi |
| Oh My Pi | | playtime install --harness omp |
| Copilot CLI | | playtime install --harness copilot |
| Gemini CLI | | playtime install --harness gemini |
| Cline | | playtime install --harness cline |
| Qwen Code | | playtime install --harness qwen |
| Goose | | playtime install --harness goose |
| Factory Droid | | playtime install --harness droid |
Pick one route per harness. Doing both records every event twice. The plugin
route for Claude Code and Codex runs from a git checkout with no build, so it
starts the tracker through the playtime command: install the npm package too.
Harness support
| Harness | Mechanism | Measured |
|---|
| Claude Code | hooks in settings.json | open, busy, blocked |
| Codex | hooks in hooks.json | open, busy, blocked |
| OpenCode | in-process plugin | open, busy, blocked |
| Pi | in-process extension, agent-playtime/pi | open, busy |
| Oh My Pi | in-process extension, agent-playtime/omp | open, busy, blocked |
| Copilot CLI | hooks/playtime.json in its config directory | open, busy, blocked |
| Gemini CLI | hooks in settings.json | open, busy, blocked |
| Cline | one executable per event in ~/.cline/hooks/ | open, busy |
| Qwen Code | hooks in settings.json | open, busy, blocked |
| Goose | a plugin in ~/.agents/plugins/playtime/ | open, busy |
| Factory Droid | hooks in ~/.factory/hooks.json | open, busy, blocked |
Notes:
- Pi, Goose and Cline have no permission prompt event, so their blocked time is 0.
- Codex only runs hooks you have approved. After installing, approve them in
Codex's hooks review, and again after any change to them.
- Cline and Goose only report a session ending in some cases, so their
sessions usually end when the process exits, which Playtime watches anyway.
- Copilot CLI's
sessionEnd also fires after every turn in piped mode, so
sessions run that way are cut into short ones.
- Goose's config directory is a guess (
~/.config/goose or
~/.local/share/goose); install is skipped if neither exists.
- Pi's and Oh My Pi's extensions are installed as one-line files that re-export
agent-playtime/pi and agent-playtime/omp, so updating the package updates them.
- Oh My Pi's extension goes in
~/.omp/agent/extensions/. A profile
(OMP_PROFILE) or PI_CODING_AGENT_DIR points Oh My Pi elsewhere, and it
will not load it from there; copy playtime.js into that extensions/.
- Oh My Pi's subagents are not counted separately, since their time is already
the parent's turn, and approvals a subagent asks for count as busy, not
blocked. Blocked time comes from tool approvals, and listening for them turns
off Oh My Pi's speculative file reads.