Import your history
Once the CLI is set up and your first session is captured, you’ll usually want to backfill the work you ran before the hooks were in place. This is the last step in the standard onboarding flow.
One command imports from every coding-agent format installed on this machine: Claude (~/.claude/projects/), Codex (~/.codex/sessions/), Gemini CLI (~/.gemini/tmp/), Pi (~/.pi/agent/), GitHub Copilot CLI (~/.copilot/session-state/), Cursor IDE (per-session transcripts under ~/.cursor/projects/), Kiro (~/.kiro/), OpenCode (~/.local/share/opencode/opencode.db), and Antigravity (~/.gemini/antigravity/). The import is idempotent — re-run it as often as you like; only missing or incomplete sessions get uploaded.
You can also come back to this page later. Importing isn’t strictly an onboarding step; the same commands work for one-off backfills (“I’d forgotten about that session from last month, let me import just that one”).
kcap import
Section titled “kcap import”kcap import # everything detectedkcap import --all # every session/repokcap import --claude # only Claude sessionskcap import --codex # only Codex sessionskcap import --gemini # only Gemini CLI sessionskcap import --pi # only Pi sessionskcap import --copilot # only Copilot CLI sessionskcap import --cursor # only Cursor agent sessionskcap import --kiro # only Kiro agent sessionskcap import --opencode # only OpenCode sessionskcap import --antigravity # only Antigravity sessionskcap import --org # narrow by scope: org reposkcap import --repo owner/name # narrow by scope: one repokcap import --repo . # narrow by scope: current cwd's repokcap import --org --yes # skip confirmationkcap import --org --private # mark as Only Visible to Youkcap import --org --since 2026-01-01 # on or after this datekcap import --org --cwd /path/to/project # filter by working directorykcap import --org --session abc123 # single session (dashed or dashless GUID)You must pick an explicit scope. This is deliberate: without it, the command would happily upload your personal scratch repos, your private notes, and your client work to whichever Capacitor server you happened to be logged into. If you run with no scope on an interactive terminal, you’ll get a picker. In a non-interactive run (no TTY, e.g. CI), missing both a scope flag and --yes is an error.
--org scopes the import to a single repo owner — the GitHub org (or user) that owns each session’s git remote, matched case-insensitively. It has two forms:
--org <owner>— scope to that owner explicitly.- bare
--org— reuse the owner you last chose (remembered per-profile as theimport_orgconfig key) or, if none is remembered, pick one from the owners detected across your sessions in an interactive picker.
The remembered owner is per-profile, so it follows kcap use. A bare --org in a non-interactive run (no TTY) with nothing remembered is an error — pass --org <owner>, or run kcap import --org once interactively to choose and remember one.
Each run shows a confirmation summary (scope, matched count, repo samples, visibility) before uploading anything.
The command is resumable. Re-running with the same scope only uploads what’s missing or incomplete — there’s no “import was interrupted, start over” failure mode.
When the import doesn’t match as much as you expected
Section titled “When the import doesn’t match as much as you expected”At the start of every run, kcap import prints a one-shot report of transcripts whose working directory no longer exists on disk — typically because the local repo directory has been renamed (e.g. ~/dev/foo-cli → ~/dev/bar-cli). Those sessions silently fall out of an --org / --repo scope because the CLI can’t run git inside a path that isn’t there any more.
Sessions recorded inside an ephemeral worktree (<project>/.claude/worktrees/<slug>, <project>/.capacitor/worktrees/<slug>, or any <project>/.<anything>/worktrees/<slug> shape) are transparently attributed to <project> when the project directory still exists, so deleted-worktree paths never need a remap. The import surfaces a one-liner above the missing-cwds report when this happens:
Attributed N sessions to a parent project via worktree path.For the renamed-directory case, use kcap remap <old-path> <new-path>. See Renamed repo directories (kcap remap) for the command surface and matching rules.
For Cursor specifically: only Agent-mode sessions ship per-session transcripts, so that’s what gets imported — Chat (Ask), Inline Edit (Cmd+K), and Tab autocomplete don’t fit the session model. Re-running is safe — a server-side tracker deduplicates events on (stream, eventId), so previously imported turns don’t get re-appended.
Source paths:
- Claude:
~/.claude/projects/ - Codex:
~/.codex/sessions/ - Gemini CLI:
~/.gemini/tmp/<project>/chats/ - Pi:
~/.pi/agent/sessions/ - Copilot:
~/.copilot/session-state/(plus the pre-GA~/.copilot/history-session-state/; session dirs without anevents.jsonlare failed-startup scaffolding and are skipped) - Cursor:
~/.cursor/projects/<workspace>/agent-transcripts/ - Kiro:
~/.kiro/sessions/cli/ - OpenCode:
~/.local/share/opencode/opencode.db(honoursXDG_DATA_HOME) - Antigravity:
~/.gemini/antigravity/brain/(shares the~/.geminihome; honoursGEMINI_CLI_HOME)
What gets uploaded
Section titled “What gets uploaded”For each session, Capacitor uploads everything it would have captured live: lifecycle events, transcript turns, tool calls, token counts. There’s no separate sanitisation step — past sessions land in the dashboard exactly as new sessions do.
If a past session contains data you don’t want on the server, either:
- Run with
--privateto keep it owner-only. - Skip it by scoping the import (
--repoor--cwd) to exclude it. - After import, delete it from the server with
kcap disable <sessionId>(irreversible server-side).
Related
Section titled “Related”- Visibility & sharing — defaults and overrides for imported sessions.
- CLI commands — the full set, including
kcap disable.