CLI

Set up a checkout, sign this machine in, correct the clock, and connect your AI agents — from the terminal.

The terminal side of Clocktopus. It signs this machine in, corrects the clock when a day needs it, shows your project's tasks, and connects your AI coding agents — the last of which can only be set up from here.

Install

npm install -g @blastin-dev/clocktopus-cli
clocktopus --version

The CLI is open source under MIT: its code, and the Claude Code plugin it installs, are on GitHub at blastin-dev/clocktopus-cli, where issues and pull requests are welcome.

When a newer CLI is out, a command that calls the server says so on stderr, once:

A newer Clocktopus CLI is available (0.9.0 → 0.10.0). Run: clocktopus upgrade

On a machine only agents use, such as a VM you reach through a remote harness, the next agent session hears of it instead, and can run the upgrade for you.

When the server stops supporting your CLI's version, any command that calls it prints Clocktopus CLI <version> is no longer supported; … with the upgrade command and exits with code 1.

Upgrade

clocktopus upgrade

It upgrades the CLI with whatever installed it: mise, or npm, pnpm, bun or yarn installing it globally. --yes upgrades without asking, which is how an agent runs it. Under mise, a config that pins a version keeps the upgrade inside it; clocktopus upgrade --bump moves past it and updates that config. A CLI too old to have upgrade upgrades with npm install -g @blastin-dev/clocktopus-cli@latest (or your tool's equivalent).

The new version then refreshes what agent setup installed, and only that: the hooks of the agents you set up, the Claude Code plugin with the parts you chose, and the skills, new ones included. A CLI you upgrade some other way does the same the first time it runs. clocktopus agent refresh runs it by hand. Hooks use the new version at once; sessions started afterwards load the new plugin and skills.

Your agents keep reporting cost in the meantime: their hooks and telemetry don't depend on the CLI's version.

Sign in

clocktopus login

The CLI uses the OAuth 2.0 device flow. It prints a URL and a code:

Starting device authorization...

Open this link to authorize:

  https://clocktopus.app/auth/device?user_code=ABCD1234

Or visit https://clocktopus.app/auth/device and enter code: ABCD-1234

Waiting for authorization...

Open the link, approve it, and the CLI picks it up on its own:

Waiting for authorization.....
Logged in as John Doe ([email protected])

The token is stored in your system's configuration directory. You log in once per device.

Command What it does
clocktopus login Authorise this machine
clocktopus logout Clear stored credentials from this device
clocktopus whoami Show who this machine is signed in as

Set up a checkout

clocktopus init

Run it inside a checkout of the repository you work in; anywhere else it stops before doing anything. It signs you in first if this machine is not, then walks through each step, every one of which you can confirm or skip. Ctrl-C at any question stops init, keeping the steps already done:

Step What it does
You Saves your timezone (this machine's by default) and working hours
Organisation and project If the repository already belongs to a project in one of your organisations, says which and creates nothing. Otherwise picks or creates the organisation and attaches the repository to a project you manage, or to a new one. Then declares the ticket prefixes that at least two of the checkout's commits and branches use as the project's tracker key prefixes, asking only when another project has one
Repository For GitHub, installs the GitHub App and waits until it covers the repository. Press m to add a webhook instead, which gh can create for you. Bitbucket gets the URL and secret to add by hand
Git email Compares the checkout's git config user.email with your sign-in email and commit addresses, and offers to track it or to set a different one for this repository only
Agents Runs agent setup for the coding agents installed here
Verify Reports the project, author, commits, pull requests and agents from what Clocktopus has actually received

It only says all set once a commit from the repository has arrived and been credited to you. Until then it offers to make an empty commit and push it, waits for the delivery, and prints the fix for whatever comes back: a wrong secret, a locked day, or a commit whose author email is not yours. It skips the commit when your branch is behind origin, and removes it again if the push fails.

After a GitHub webhook is added, by gh or by hand, init waits for the ping GitHub sends the moment it is saved, and reports the repository or organisation it was seen on, any of Pushes, Pull requests and Pull request reviews it leaves unticked, or a secret that does not match. It waits two minutes, or ten off a terminal where nobody presses Enter once the webhook is saved. Bitbucket sends no ping, so its webhook is proven by the first push.

When the GitHub App and a repository webhook both deliver the same repository, each push arrives twice; with gh installed, init offers to delete your webhook.

Every question has a flag, so init also runs unattended:

Option Description
-y, --yes Take every default without asking
--skip <steps> Skip you, project, repository, email, agents or verify
--only <steps> Run only the steps named, as in --only verify --test-push
--timezone <tz> Your timezone, such as Europe/Lisbon
--hours <start-end> Your usual day: 9-17 or 08:30-17:00
--working-hours / --no-working-hours Whether you work set hours
--organization <name> Use this organisation (id, slug or name)
--new-organization <name> Create an organisation with this name
--project <name> / --new-project <name> Attach the repository to this project, or create one
--connect <how> app, gh, manual or skip
--track-email / --no-track-email Whether to track this checkout's git email
-a, --agent <ids> Configure only these agents
-c, --component <names> Install only these besides telemetry and hooks
--test-push Push an empty commit to the current branch to verify delivery
--delete-old-hook Delete your repository webhook when the GitHub App also delivers

Without a terminal, or with --yes, nothing is installed, pushed or deleted unless its flag says so.

Clock in and out

clocktopus clock (in|out) [--ago <duration> | --at <time>]

Records the start or end of a work session. Defaults to now.

Option Description
--ago <duration> Backdate by a duration from now: 15m, 1h, 1h30m. Cannot be combined with --at
--at <time> Backdate to a wall-clock time today: HH:mm or HH:mm:ss
clocktopus clock status [-d <YYYY-MM-DD>]

Shows the clock signals for a date, defaulting to today.

What the signals actually change is covered in clock signals.

Tasks

clocktopus tasks [--json] [--repository <url>] [--org <id>] [--limit <n>]

Shows the open tasks of the project this checkout's repository belongs to, grouped as To do, In progress, In review and Ready to ship, with the agents working on each one now. To do lists your project's active goals' tasks first, in the goal's order, then the newest, up to --limit (30 by default). In progress leaves out a task nothing has touched for 30 days, unless an agent is working on it. Ready to ship lists the 20 tasks merged most recently and not yet delivered, so their sessions can still be found.

Option Description
--json Print the board as one JSON object, for tools and panels that show it
--repository <url> Read another repository's project instead of this checkout's origin
--org <id> The organisation to read, when several of yours link the repository
--limit <n> How many To do tasks to list, up to 500

With --json the board also carries your own agent sessions on each task and the folder each ran in, and the project's active goals with their tasks. When it can't read the board it still prints one object, whose status says why: signed_out, not_a_repository, no_project, choose_organization or error.

Realtime updates

clocktopus realtime watch [--detach]

Keeps panels in step with Clocktopus as things change, instead of on their next refresh. The watcher holds one connection to Clocktopus for the whole machine. Each time a task, a pull request, an agent session or a time entry changes in any of your organisations, it updates a file named after that kind of change in ~/.clocktopus/realtime: tasks, pull-requests, agent-sessions or time-entries. A panel waits on those files and reloads when one changes. After the connection drops and comes back it updates all of them, since changes made while it was down aren't replayed.

You rarely run it yourself. The Claude Code session panel starts it in the background with --detach, which starts one only when none is running. Only one runs per machine, and it stops by itself 15 minutes after no panel has asked for it. The status file in the same folder says whether it is connected, offline, stopped, or disabled when Clocktopus has no realtime updates to send; panels keep refreshing on their own timer as well, so nothing is missed when it isn't running. It needs Node 22 or later.

Agent telemetry

Records what your AI coding agents cost, so the cost of a piece of work is human time × rate plus agent spend. AI agents covers what is recorded and what is never collected.

clocktopus agent setup

clocktopus agent setup [--name <label>] [--force] [-a <ids>] [-c <components>]

Mints an ingest token for this machine, configures the agents you choose, installs the session hooks, and confirms the receiver accepts the token before reporting success.

In a terminal it asks two questions, each a checklist (arrow keys to move, space to toggle, enter to confirm): which agents to set up, with the ones installed on this machine already ticked, and which of the MCP server, the skills and the Claude Code session panel to install, all ticked. Telemetry and the session hooks are always installed: the hook is what tells Clocktopus which repository a session worked in. Anything you leave unticked is left as it is in the agent's configuration. --agent and --component answer the questions up front, and a non-interactive shell installs everything into every agent it finds.

Unless you untick them, it also installs the six agent skills and the MCP server they use. create-task notes a task for later in one line. start-work carries a task through to an open pull request, on a branch named after it, or works through a goal's tasks as stacked pull requests. review-work reviews each pull request start-work opens, fixes what it is sure of, has a second model settle what is still open, and leaves the rest inline, each with a recommended fix. refine gets a task, or a whole goal, ready for an agent to work without asking, applying only what you confirm. create-goal drafts a goal and the tasks its outcome needs, for you to confirm once. register-ticket records Linear or Jira tickets in Clocktopus for any workflow, your repository's own skills included. They create tasks in Clocktopus, unless your repository's agent instructions say to create them in Linear or Jira. A small SessionStart hook tells each Claude Code, Codex and Cursor session whether its branch carries a task. How they arrive depends on the agent:

Agent Skills MCP server Sign in once with
Claude Code the Clocktopus plugin the plugin /mcp in Claude Code
Codex CLI ~/.agents/skills/clocktopus-create-task, clocktopus-start-work, clocktopus-review-work, clocktopus-refine, clocktopus-create-goal, clocktopus-register-ticket [mcp_servers.clocktopus] in ~/.codex/config.toml codex mcp login clocktopus
OpenCode the same six folders mcp.servers.clocktopus in opencode.json (OpenCode 1: mcp.clocktopus) opencode mcp auth clocktopus
Cursor the same six folders mcpServers.clocktopus in ~/.cursor/mcp.json Cursor Settings → MCP

Cursor reports sessions through its hooks only: Clocktopus records when they ran, where, their commits, their task and the session duration Cursor reports, but not their tokens or cost. See AI agents.

The Claude Code session panel

In Claude Code only, the plugin also shows which task the session counts toward: a line in the footer under the prompt, and a pane with the task, its stage and its human and agent time, whether the session is attributed and to which task, its spend, and the goal's open tasks in order. /clocktopus-panel opens and closes the pane, /clocktopus-panel refresh reads the session again, and /clocktopus-panel band shows a one-line band above the prompt. In Claude Code's fullscreen layout the pane docks beside the conversation and opens by itself once a session; elsewhere it opens inline, only when asked. The panel reloads as soon as the session's task, its pull requests or its spend change, through realtime updates, and every two minutes besides.

The panel reads everything from the plugin's MCP server, so it is offered only with the MCP server and needs it signed in (/mcp). It is built on Claude Code's function hooks, so setup installs it only on Claude Code 2.1.310 or later: on an older version, or when claude --version can't be read, setup leaves it out and says why, and installs the rest of the plugin. To leave it out yourself, untick it, or pass -c mcp,skills. agent status and agent doctor say whether it is installed.

clocktopus upgrade updates them with the CLI. Cost tracking never depends on them: disabling the plugin or removing the skills leaves telemetry and hooks reporting.

Run it from a checkout of the repository you work in — it also checks that repository is attached to a project, since spend from an unattached repo lands in the unattributed row rather than against a client.

Option Description
--name <label> Label for this machine's token. Defaults to the hostname. Keep it recognisable, since revocation is per token
--force Mint a replacement token instead of reusing the one already installed
-a, --agent <ids> Configure only these agents: claude, codex, opencode, cursor. Repeatable or comma-separated
-c, --component <names> Install only these besides telemetry and hooks: mcp, skills, panel (needs mcp), or none. Repeatable or comma-separated

Re-running without --force is safe and idempotent. Restart your agent afterwards — the exporter and the hooks read their configuration once, at startup, so an open session picks up none of it. On Codex, also approve the hooks trust prompt in its own interface, or telemetry arrives without any repository context.

clocktopus agent status

Shows what the receiver has actually received, not what this machine believes it sent.

clocktopus agent doctor

Checks every link in the chain — token, exporter config, hooks, the Claude Code plugin and its session panel, repository mapping — and names the one that is broken. Start here when the report is empty.

clocktopus agent disable

clocktopus agent disable [--revoke] [-a <ids>]

Removes this machine's telemetry configuration, the Clocktopus plugin from Claude Code, the MCP server entries setup added for Codex, OpenCode and Cursor, and the shared skills once no agent left on the machine uses them. Add --revoke to invalidate the token everywhere, which is what you want if the machine is lost rather than just being turned off. -a narrows it to one agent, with the same ids as setup.

A lost machine can't run the command, so the web app lists every machine's token under Agents and CLI in your avatar menu, where you can revoke any of them.

Common errors

Clock commands exit with code 1 on failure and print to stderr.

Message Cause
You are not logged in. Use 'clocktopus login' to authenticate first. No credentials on this machine
Session expired. Use 'clocktopus login' to authenticate again. The stored token is no longer valid
Cannot use --ago and --at together. Pick one. Both backdating flags passed
Invalid duration "…". Use formats like 15m, 1h, or 1h30m. Unparseable --ago
Invalid time "…". Use HH:mm or HH:mm:ss format. Unparseable --at

Start measuring what your team ships

Output, cost and what your agents burn. Read from the commits, pull requests and agent runs you already have.

Start free

Free for single developers.