These commands manage the full lifecycle of a CostHQ tracking session — from opening a session and annotating work in progress, to ending it and reviewing the resulting metrics. Use them together to capture time, file changes, git commits, and AI spend for any task.
cs start
Start a new tracking session. Only one session can be active at a time. The <description> you provide appears in cs list output and the dashboard, so specific descriptions make your history far more useful.
JSON output shape
cs end
End the active session and print a summary of time spent, files changed, commits made, and AI cost incurred.
JSON output shape
cs status
Show whether a session is currently active, and if so, its live duration and running AI spend. Use this mid-task to check costs without ending the session.
JSON output contract (active session)
When no session is active, cs status --json exits with code 1 and returns a structured error:
Always parse error.code — never string-compare error.message, which may change between versions.
cs show
Show detailed metrics for a session. Defaults to the most recent session when you omit [id].
Example table output
cs list
List recent sessions in a compact summary table, sorted from most recent to oldest.
Example table output
cs stats
Show aggregate statistics across all sessions: total sessions, total time, average session length, files changed, commits made, AI tokens used, and total AI cost.
Example output
cs note
Add a timestamped annotation to the active session. Use notes to mark sub-task boundaries, record decisions, or flag items for follow-up without ending the session.
Annotations appear in cs show --json under the annotations array, each with a message and timestamp field.
cs recover
Bulk-end all sessions older than a given age. Use this as a periodic cleanup command or in CI teardown scripts to avoid accumulating stale open sessions.
Run cs recover --max-age 1 at the top of CI jobs to ensure no stale session from a previous failed run blocks the new one.