feat: import and resume Claude Code CLI sessions (closes #10)#28
Merged
op7418 merged 1 commit intoop7418:mainfrom Feb 9, 2026
Merged
Conversation
Add ability to browse and import conversation history from Claude Code CLI into CodePilot, with full resume support via SDK session ID. Features: - JSONL parser for Claude Code session files (~/.claude/projects/) - REST API: GET /api/claude-sessions (list) + POST /api/claude-sessions/import - Import dialog UI accessible from sidebar 'Import CLI Session' button - Imported sessions bind sdk_session_id for seamless resume in CodePilot - Duplicate import protection (409 with redirect to existing session) - File size guard (50MB max) to prevent memory issues Files changed: - src/lib/claude-session-parser.ts — JSONL parser core - src/app/api/claude-sessions/route.ts — list API - src/app/api/claude-sessions/import/route.ts — import API with dedup - src/components/layout/ImportSessionDialog.tsx — browse & import UI - src/components/layout/ChatListPanel.tsx — sidebar integration - src/__tests__/unit/claude-session-parser.test.ts — 17 unit tests
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Implements the ability to browse and import conversation history from Claude Code CLI into CodePilot, with full resume support. This closes #10.
Problem
Users who have been using Claude Code CLI have accumulated conversation history stored as JSONL files in
~/.claude/projects/. There was no way to view or continue these conversations in CodePilot.Solution
JSONL Parser (
src/lib/claude-session-parser.ts)~/.claude/projects/<encoded-project-path>/<session-uuid>.jsonlqueue-operation,user,assistantcwdfield from JSONL entries as authoritative working directory (encoded folder names are lossy for paths containing hyphens)REST API
GET /api/claude-sessions— Lists all available CLI sessions with metadata (project name, git branch, message counts, timestamps, file size)POST /api/claude-sessions/import— Imports a session into CodePilot databasesdk_session_idso imported conversations can be resumed via the Claude Agent SDKexistingSessionIdif already importedUI (
src/components/layout/ImportSessionDialog.tsx)How It Works
~/.claude/projects/and displays available sessionsTesting
decodeProjectPath)listClaudeSessions)Files Changed
src/lib/claude-session-parser.tssrc/app/api/claude-sessions/route.tssrc/app/api/claude-sessions/import/route.tssrc/components/layout/ImportSessionDialog.tsxsrc/components/layout/ChatListPanel.tsxsrc/__tests__/unit/claude-session-parser.test.tsKnown Limitations
listClaudeSessionsreads all JSONL files on each call; users with hundreds of CLI sessions may see a brief delay when opening the dialog (rare in practice, and only triggered on dialog open)-root-my-projectcould decode to/root/my-projector/root/my/project), but this is mitigated by using thecwdfield from JSONL entries as the authoritative path