Skip to content
Code Insights
Documentation

Syncing Sessions

Sync your AI coding sessions to a local SQLite database. Supports auto-sync, source filtering, force re-sync, and dry-run mode across all tools.

How do I sync my sessions?

code-insights sync

Discovers sessions from all supported tools and syncs new or updated sessions to the local SQLite database. The first sync processes your entire history; subsequent syncs are incremental.

How do I sync from a specific tool?

code-insights sync --source claude-code
code-insights sync --source cursor
code-insights sync --source codex-cli
code-insights sync --source copilot-cli
code-insights sync --source copilot

How do I force a re-sync?

code-insights sync --force

Re-processes all sessions even if they haven't changed. Useful after a CLI update.

Dry run

code-insights sync --dry-run

Shows what would be synced without writing to the database.

Quiet mode

code-insights sync -q

Suppresses all output. Used by the auto-sync hook.

How do I set up auto-sync?

Install a hook that automatically syncs when a Claude Code session ends:

code-insights install-hook

To remove it:

code-insights uninstall-hook

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

Troubleshooting

No sessions found — Check that your AI coding tool has been used and that session files exist in the expected location. Run code-insights status to see what the CLI has discovered.

SQLite locked error — Another process is using the database. Wait a moment and retry.