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/cliThis 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-hookThis 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-onlyVerify It Works
- Start a Claude Code session and do some work
- End the session (type
/exitor close the terminal) - Run:
code-insights dashboard - 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 30Analyze 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 reflectConfigure 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 llmSupported 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 SessionEndYou 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 claudeThe 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 llmSee the Configuration reference for all provider options.