Skip to content

feat(import): add basou import claude-code for native transcripts - #16

Merged
takashi-matsuyama merged 1 commit into
mainfrom
feat/import-claude-code-transcripts
May 31, 2026
Merged

takashi-matsuyama merged 1 commit into
mainfrom
feat/import-claude-code-transcripts

Conversation

@takashi-matsuyama

Copy link
Copy Markdown
Member

What

Adds basou import claude-code: derive Basou sessions from Claude Code's
native transcripts (~/.claude/projects/<encoded-cwd>/*.jsonl) after the
fact, rather than wrapping a live process with basou run.

Sessions produced in any Claude Code surface — desktop app, IDE, or CLI —
write the same native transcript to disk, so this lets them be captured for
provenance without changing how the tool is launched.

How

  • A pure transform (transcript-importer.ts) maps a transcript's
    message-level records to Basou's provenance events, then hands the result
    to the existing importSessionFromJson pipeline — id minting, path
    sanitization and schema validation are reused unchanged.
  • MVP derives: session_started / session_ended, command_executed (from
    Bash tool uses, recorded as bash -c "<line>"), and file_changed (from
    Edit / Write / NotebookEdit). Events are sorted by occurred_at
    because transcripts are not timestamp-ordered on disk.
  • Adds the additive claude-code-import session source.kind.
  • Flags: --all, --session <id>, --project <path>, --dry-run, --json.
  • Transcripts with no observable command / file action are skipped.

Out of scope (future)

Approval / decision / task derivation, and other vendors' native logs.

Tests

  • Unit tests for the transform: lifecycle bounds, command/file mapping,
    ordering of unsorted records, skip-empty, malformed-record tolerance.
  • Integration tests for the CLI: import, dry-run, single session, skip,
    and error paths.
  • typecheck / build / full test suite / lint all green.

🤖 Generated with Claude Code

Derive Basou sessions from Claude Code native transcripts
(~/.claude/projects/<encoded-cwd>/*.jsonl) after the fact, rather than
wrapping a live process. Sessions produced in any Claude Code surface
(desktop, IDE, CLI) write the same transcript to disk, so they can be
captured for provenance without changing how the tool is launched.

- New pure transform (transcript-importer.ts) maps message-level records
  to Basou events, then reuses the existing importSessionFromJson pipeline
  (id minting, path sanitization, schema validation unchanged).
- Derives session_started/ended, command_executed (Bash -> bash -c) and
  file_changed (Edit/Write/NotebookEdit). Events are ordered by occurred_at
  because transcripts are not timestamp-sorted on disk.
- Adds the additive `claude-code-import` session source.kind.
- Flags: --all, --session <id>, --project <path>, --dry-run, --json.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@takashi-matsuyama
takashi-matsuyama merged commit a108cba into main May 31, 2026
7 checks passed
@takashi-matsuyama
takashi-matsuyama deleted the feat/import-claude-code-transcripts branch May 31, 2026 08:01
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant