Skip to content

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”).

Terminal window
kcap import # everything detected
kcap import --all # every session/repo
kcap import --claude # only Claude sessions
kcap import --codex # only Codex sessions
kcap import --gemini # only Gemini CLI sessions
kcap import --pi # only Pi sessions
kcap import --copilot # only Copilot CLI sessions
kcap import --cursor # only Cursor agent sessions
kcap import --kiro # only Kiro agent sessions
kcap import --opencode # only OpenCode sessions
kcap import --antigravity # only Antigravity sessions
kcap import --org # narrow by scope: org repos
kcap import --repo owner/name # narrow by scope: one repo
kcap import --repo . # narrow by scope: current cwd's repo
kcap import --org --yes # skip confirmation
kcap import --org --private # mark as Only Visible to You
kcap import --org --since 2026-01-01 # on or after this date
kcap import --org --cwd /path/to/project # filter by working directory
kcap 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 the import_org config 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 an events.jsonl are failed-startup scaffolding and are skipped)
  • Cursor: ~/.cursor/projects/<workspace>/agent-transcripts/
  • Kiro: ~/.kiro/sessions/cli/
  • OpenCode: ~/.local/share/opencode/opencode.db (honours XDG_DATA_HOME)
  • Antigravity: ~/.gemini/antigravity/brain/ (shares the ~/.gemini home; honours GEMINI_CLI_HOME)

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 --private to keep it owner-only.
  • Skip it by scoping the import (--repo or --cwd) to exclude it.
  • After import, delete it from the server with kcap disable <sessionId> (irreversible server-side).