Codex Wakatime
Codex plugin for Wakatime
Install: npm install -g codex-wakatime
Works with Codex · 31 GitHub stars
Install
npm install -g codex-wakatimeInstall command taken from the project's README or registry entry. Always review code before running it.
README excerpt
Read full README on GitHub →codex-wakatime
WakaTime integration for OpenAI Codex CLI. Track AI coding activity and time spent.
[!TIP] Also check out opencode-wakatime for OpenCode!
Features
- Automatic time tracking for Codex CLI sessions
- File-level activity detection via message parsing
- 60-second heartbeat rate limiting
- Automatic WakaTime CLI installation and updates
- Cross-platform support (macOS, Linux, Windows)
Prerequisites
- WakaTime account and API key
- WakaTime API key configured in
~/.wakatime.cfg:[settings] api_key = your-api-key-here - Codex CLI installed
Installation
# Install the package
npm install -g codex-wakatime
# Configure Codex hooks
codex-wakatime --install
This enables Codex lifecycle hooks and adds Stop and PostToolUse hooks to
your ~/.codex/config.toml.
If an older notify = ["codex-wakatime"] entry exists, it is migrated to hooks.
Other notify commands are preserved.
How It Works
┌─────────────────────────────────────────────────────────────┐
│ Codex CLI Session │
└─────────────────────────┬───────────────────────────────────┘
│
▼
┌─────────────────────────────────────────────────────────────┐
│ Stop / PostToolUse hooks │
│ Codex sends hook payloads with: │
│ - session-id, turn-id │
│ - cwd (working directory) │
│ - last-assistant-message on Stop │
│ - apply_patch input on PostToolUse │
└─────────────────────────┬───────────────────────────────────┘
│
▼
┌─────────────────────────────────────────────────────────────┐
│ codex-wakatime │
│ 1. Parse hook JSON from stdin │
│ 2. Extract file paths from apply_patch or assistant text │
│ 3. Check 60-second rate limit │
│ 4. Send heartbeat(s) to WakaTime │
└─────────────────────────┬───────────────────────────────────┘
│
▼
┌─────────────────────────────────────────────────────────────┐
│ WakaTime Dashboard │
│ View your AI coding metrics at wakatime.com │
└─────────────────────────────────────────────────────────────┘
Codex Hooks
| Event | Purpose |
|---|---|
Stop |
Sends a turn-level heartbeat after each Codex turn completes |
PostToolUse (apply_patch) |
Sends file-level write heartbeats for patch edits |
Legacy agent-turn-complete notify payloads are still supported for existing
manual setups.
File Detection Patterns
The plugin extracts edited files directly from apply_patch hook payloads. For
turn-level fallback heartbeats, it extracts file paths from the assistant's
response using these patterns:
- Code block headers:
```typescript:src/index.ts - Backtick paths:
`src/file.ts` - Action patterns:
Created src/file.ts,Modified package.json - Quoted paths:
"src/file.ts"or'src/file.ts'
Similar plugs
CLI proxy that reduces LLM token consumption by 60-90% on common dev commands. Single Rust binary, zero dependencies
Bash is all you need - A nano claude code, like 「agent harness」, built from 0 to 1
Documented system prompts from Anthropic - Claude Fable 5.1, Opus 5.5, Claude Design, Claude Code. OpenAI - ChatGPT GPT-6-Astra, Codex. Google - Gemini 3.8 Flash, 3.1 Pro…
Wrap Antigravity, ChatGPT Codex, Claude Code, Grok Build, Muse Code, Devin as an OpenAI/Gemini/Claude/Codex compatible API service, allowing you to enjoy the free Gemini…