Track your AI coding activity from Claude Code on your CodeTime dashboard — projects, languages, files, and git branches, the same way the CodeTime editor extensions do.
This is a Claude Code plugin modeled on
wakatime/claude-code-wakatime,
but it talks to the CodeTime API directly (CodeTime has no companion CLI, so the
plugin does the transcript parsing, git detection, throttling, and upload itself in
pure Node — zero runtime dependencies).
claude plugin marketplace add https://github.com/jianyuelab/claude-code-codetime.git
claude plugin i claude-code-codetime@codetimeUpdate later with:
claude plugin marketplace update codetimeGet your upload token from CodeTime → Settings at https://codetime.dev, then set it one of two ways:
-
Environment variable (takes precedence):
export CODETIME_TOKEN="your-token"
-
Config file
~/.codetime/config.json:{ "token": "your-token" }
Without a token the plugin does nothing (it never blocks Claude Code).
The plugin registers hooks for PreToolUse, PostToolUse, UserPromptSubmit,
PreCompact, and SessionEnd. On each event it:
- Reads the hook payload from stdin.
- Throttles to at most one heartbeat per 60 seconds (state stored next to the session transcript).
- Builds a CodeTime event — project (working-dir name), file + language (from
Edit/Write/Readtool input), git branch/origin, platform, and aread/writeoperation type. POSTs it tohttps://api.codetime.dev/v3/users/event-logwithAuthorization: Bearer <token>.
| Variable | Purpose |
|---|---|
CODETIME_TOKEN |
Upload token (overrides the config file). |
CODETIME_API_URL |
Override the API base URL (default https://api.codetime.dev). |
CODETIME_DEBUG |
Set to true for verbose logging. |
CODETIME_HOME |
Override the base dir for config/state/log (default $HOME). |
- Logs:
~/.codetime/codetime.log - Plugin load errors:
claude --debug, orclaude doctor - A
401in the log means the token is wrong or missing.
bun install
bun run build # bundles src/ → dist/index.js with esbuild
echo '{"hook_event_name":"PostToolUse","cwd":"'$PWD'","tool_name":"Write","tool_input":{"file_path":"'$PWD'/src/index.ts"}}' \
| CODETIME_DEBUG=true CODETIME_API_URL=http://localhost:8080 CODETIME_TOKEN=test node dist/index.jsMIT