Skip to content
Code Insights
Documentation

CLI Commands

Complete reference for all code-insights CLI commands and flags — init, sync, stats, dashboard, config, reset, install-hook, and more.

Global

code-insights --version    # Print version
code-insights --help       # Show help

init

code-insights init

Interactive setup. Detects installed AI coding tools and initializes the local database at ~/.code-insights/data.db.

sync

code-insights sync [options]

Syncs sessions from all supported source tools to the local SQLite database.

FlagDescription
--forceRe-sync all sessions (ignores modification times)
--dry-runPreview what would be synced without writing
-q, --quietSuppress all output
--source <tool>Sync only from: claude-code, cursor, codex-cli, copilot-cli, copilot

open

code-insights open [options]

Opens the local dashboard in your default browser. If the dashboard server is already running, this opens a new browser tab to it.

FlagDescription
--projectOpen filtered to the current project

dashboard

code-insights dashboard [options]

Starts the embedded Hono server and opens localhost:7890 in your browser.

FlagDefaultDescription
-p, --port <number>7890Port number for the dashboard server
--no-openDo not open browser automatically

status

code-insights status

Shows sync statistics: total sessions, messages, last sync time, and source tool breakdown.

stats

code-insights stats [subcommand] [options]

Terminal analytics. See Terminal Analytics for details.

SubcommandDescription
(none)Overview dashboard
costCost breakdown by project and model
projectsPer-project detail cards
todayToday's sessions
modelsModel usage distribution

Shared flags:

FlagDefaultDescription
--period 7d|30d|90d|all7dTime range
--project <name>Scope to a specific project
--source <tool>Filter by source tool
--no-syncSkip auto-sync before showing stats

config

code-insights config

Shows the current configuration summary (sync paths, dashboard port, LLM provider, telemetry status).

config set

code-insights config set <key> <value>

Set a configuration value. Currently supported keys:

KeyValuesDescription
telemetrytrue / falseEnable or disable anonymous telemetry

config llm

code-insights config llm [options]

Configure the LLM provider for AI-powered session analysis. Without flags, runs an interactive wizard.

FlagDescription
--provider <provider>LLM provider (openai, anthropic, gemini, ollama)
--model <model>Model ID (e.g., gpt-4o, claude-sonnet-4-20250514)
--api-key <key>API key for the selected provider
--base-url <url>Custom base URL (for Ollama or local endpoints)
--showShow current LLM configuration

install-hook

code-insights install-hook

Adds a Stop hook to ~/.claude/settings.json that runs code-insights sync -q after every Claude Code session.

uninstall-hook

code-insights uninstall-hook

Removes the auto-sync hook from ~/.claude/settings.json.

reset

code-insights reset --confirm

Deletes all local data: ~/.code-insights/data.db, sync-state.json, and device-id. Requires the --confirm flag to prevent accidental deletion.

telemetry

code-insights telemetry [subcommand]

View and manage anonymous telemetry settings.

SubcommandDescription
statusShow current telemetry status and what data is collected
opt-outDisable anonymous telemetry
opt-inRe-enable anonymous telemetry

Telemetry can also be disabled via environment variables: CODE_INSIGHTS_TELEMETRY_DISABLED=1 or DO_NOT_TRACK=1.