| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
| Name | Name | Last commit date | ||
|---|---|---|---|---|
The official CLI for codetime. It detects local AI-agent installs, wires up their hooks, and ships pre-aggregated session rollups to /v3/agent/ingest — so the same dashboard that tracks your editor time also tracks your agent time.
Privacy: only metadata leaves your machine. Prompt text, command output, source code, and diffs are never imported or uploaded. See Privacy & data collected for the full field-level breakdown.
| Agent | id | Source |
|---|---|---|
| Claude Code | claude | ~/.claude/projects/** |
| Codex CLI | codex | ~/.codex/sessions/** |
| OpenCode | opencode | ~/.local/share/opencode/** |
| Pi | pi | ~/.pi/sessions/** |
| Amp | amp | ~/.local/share/amp/threads/** (backfill only) |
npm i -g codetime-cli # bin: `codetime`Requires Node.js ≥ 20.
# 1. Copy your upload token from https://codetime.dev/dashboard/settings
codetime token set <token>
# 2. See which agents are installed locally
codetime detect
# 3. Wire up the hooks (auto-detects, or pass --target / --all)
codetime install
# 4. (Optional) Backfill past sessions
codetime backfill import --source allIdentity is sent on each upload via the X-Machine-Id header — a UUID minted once and persisted at ~/.codetime/machine-id. Rename machines from codetime machine rename --name "..." or the dashboard.
| Command | Purpose |
|---|---|
| codetime detect | List supported targets and install status. |
| codetime install [--target <id>] [--all] [--force] [--dry-run] | Install hooks into detected or requested targets. |
| codetime backfill <plan|import|discover|verify> [--source <id>] [--since] [--until] [--project] [--force] | Import local agent history. |
| codetime token <set|show|clear> | Manage the upload token (stored in ~/.codetime/config.json). |
| codetime machine <ls|rename|delete> | Manage registered machines. |
| codetime hook --agent <name> | Internal — invoked by installed hook files. |
| codetime version / codetime help | Self-explanatory. |
Add --json to most commands for machine-readable output, or --dry-run to preview without writing or uploading.
codetime-cli is metadata-only. We never read or upload the contents of your code, prompts, or tool output. Below is the exact set of fields that leave your machine.
Identity & host
Session shape (per agent session)
File activity (per touched file)
Every command supports a dry-run that prints the exact payload without sending it:
codetime backfill plan --source all --json # see planned events
codetime backfill import --source all --dry-run # see, don't upload
echo '{}' | codetime hook --agent claude --dry-runSource of truth for the wire format: packages/shared/src/index.ts (CanonicalEvent, SessionRollup, FileActivityRecord). If a field isn't in those interfaces, it isn't uploaded.
| Variable | Purpose | Default |
|---|---|---|
| CODETIME_API_URL | Override API host. | https://codetime.dev |
| CODETIME_TOKEN | Bearer token (same value as the upload token). | — |
| CODETIME_DEBUG | Print verbose hook + import logs. | — |
Token precedence (highest first): --token flag → CODETIME_TOKEN env → saved config in ~/.codetime/config.json.
pnpm install
pnpm build
pnpm testPoint the CLI at a local codetime dev server:
CODETIME_API_URL=http://localhost:3002 \
tsx packages/cli/src/main.ts detectLink the in-repo build globally:
pnpm hooks:link # build + link as `codetime`
pnpm hooks:unlink # undocd packages/cli
pnpm prepublishOnly # bundles shared into bin/codetime.mjs
pnpm publishSee scripts/release.sh for the automated release flow (pnpm release).
MIT © codetime
| Back | FazBrowse Home | New Git URL |