OpenProgram Docs

Importing other agents' sessions

Transcript .jsonl, read only Parse ExternalSession Sanitize host context, secrets Compare with ledger Write nodes ids from agent + source id + turn Ledger entry session, turns, last fingerprint, head
ModuleJob
claude_code.py, codex.pyFind, summarise and parse each format
model.pyNeutral shape: turns of user text and ordered reply blocks
sanitize.pyDrop host scaffolding, remove credentials
writer.pyWrite turns as the DAG a native turn produces
ledger.pyWhat was imported where
service.pylist_candidates, plan_imports, import_transcripts

Entry points: openprogram sessions import, /api/sessions/import, the Import settings tab. The CLI sends batches to a running Worker, else writes the store directly. Product page: Session import.

Reading the formats

Claude CodeCodex
Filesprojects/<slug>/<id>.jsonlsessions/YYYY/MM/DD/rollout-*.jsonl
Source idFile name; sessionId is copied into forkssession_meta.id
Conversation orderChain walked back from the newest record through parentUuid / logicalParentUuidFile order; compaction and forks do not rewrite it
Titlecustom-title, then ai-title, then summarysession_index.jsonl, latest rename
Model, cwdmessage.model, record cwdturn_context.model, session_meta.cwd
SkippedisMeta, isSidechain, compact summaries, API error recordsSub-agent rollouts, injected context blocks, encrypted reasoning

A line that is not a JSON object, or a record still being written, is skipped; the rest of the file still imports.

Decisions

ChoiceWhy
Read the conversation the way its own agent resumes itClaude Code's resume follows the parent chain from the newest record; Codex replays the rollout in order. The imported conversation is then the one the user last saw there, not abandoned branches.
Write native nodes, not an attachmentSearch, export, rewind and continuing the conversation work unchanged. Tool calls whose tools do not exist here are replayed to the model as text.
Ids derived from agent, source id and turn indexWriting a turn twice is a no-op, so a grown source appends in place. Same principle as OpenCode's import, which keys an imported session by its original id.
Ledger with last fingerprint and headUnchanged sources are skipped without a parse. A rewound source, or a session continued here, becomes a new session, so nothing already here is rewritten.
Recency from the last message, not file size or mtimeA running agent keeps appending bookkeeping records to a transcript whose conversation has not moved.
Credentials removed with the request-redaction shapesAn imported turn is replayed to whichever model continues it. The high-precision shapes from models/providers/utils/redaction.py catch keys and tokens without rewriting prose that only mentions a key or a token; export's broader rules would. A title is cleaned before it is cut to length, since a key cut short no longer matches its shape; the listing's scan cache keeps its first message and titles cleaned too. Sign-in files are never opened.
Placed in the folder's projectSame as opening that folder here; the original cwd stays in imported_from.cwd.
--dry-run beside --list--list shows every transcript and its state; --dry-run shows only what the same command would create or append to. It runs plan_imports, the same decision the import makes, so a rewound source shows as a new conversation, not an append.

Implementation status

  • Only the default homes (or $CLAUDE_CONFIG_DIR, $CODEX_HOME) are scanned; a copied folder from another machine cannot be named on the command line.
  • A session imported before credentials were removed keeps what it holds until its source grows; then only the last imported turn is rewritten clean. A turn's fingerprint is taken from its text as read, so redaction never turns such a source into a duplicate session.
Last updated · 2026-11-25