Skip to content
Code Insights
Documentation

Claude Code Setup

Zero-config session analysis for Claude Code users. Install a hook once — every session gets analyzed automatically using your Claude subscription.

Install Code Insights

If you haven't already, install and run Code Insights to sync your sessions:

npx @code-insights/cli

This syncs all your Claude Code sessions and opens the dashboard at http://localhost:7890.

Install the Session Hook

Run this once to enable automatic analysis:

code-insights install-hook

This installs two Claude Code hooks:

  • Stop hook — syncs the session to your local database when it ends
  • SessionEnd hook — analyzes the session using your Claude subscription via claude -p

No API key needed. No configuration. The analysis uses the same Claude subscription that powers your Claude Code sessions.

Hook options

# Install both hooks (default)
code-insights install-hook
 
# Install only the sync hook (no analysis)
code-insights install-hook --sync-only
 
# Install only the analysis hook
code-insights install-hook --analysis-only

Verify It Works

  1. Start a Claude Code session and do some work
  2. End the session (type /exit or close the terminal)
  3. Run: code-insights dashboard
  4. Open the session — you should see analysis results: a summary, decisions, learnings, and prompt quality scores

The analysis typically takes 30-60 seconds after the session ends. If you open the dashboard immediately, the session may appear without analysis — refresh after a minute.

Next Steps

Backfill existing sessions

If you have sessions that were synced before installing the hook, you can analyze them in bulk:

# Check how many unanalyzed sessions exist
code-insights insights check
 
# Analyze all unanalyzed sessions (last 7 days)
code-insights insights check --analyze
 
# Custom lookback window
code-insights insights check --days 30

Analyze a specific session manually

# Using your Claude subscription (native mode)
code-insights insights <session_id> --native
 
# Using a configured LLM provider
code-insights insights <session_id>

Explore weekly reflections

Once you have several analyzed sessions, try cross-session synthesis:

code-insights reflect

Configure a different LLM provider

If you prefer to use a different model or want analysis for non-Claude-Code sessions, configure any LLM provider:

code-insights config llm

Supported providers: OpenAI, Anthropic, Google Gemini, and Ollama (free, local). See Insights & Analysis for details on what each insight type contains.

Troubleshooting

Hook didn't fire

Verify the hook is installed:

cat ~/.claude/settings.json | grep -A2 SessionEnd

You should see an entry containing code-insights insights --hook --native -q. If not, re-run code-insights install-hook.

Session shows but no analysis

Check that the claude CLI is available on your PATH:

which claude

The native runner calls claude -p as a subprocess. If Claude Code is installed but not on your PATH, the analysis hook will fail silently.

Want to use an API key instead?

If you prefer API-key-based analysis (or use Cursor, Codex CLI, or Copilot), configure a provider:

code-insights config llm

See the Configuration reference for all provider options.