Repository navigation
feat: support Codex CLI session transcripts alongside Claude Code - #1
Open
qwqwd65-ui wants to merge 1 commit into
Open
qwqwd65-ui wants to merge 1 commit into
qwqwd65-ui wants to merge 1 commit into
Conversation
Add a source adapter so trans reads Codex CLI rollout logs
(~/.codex/sessions/YYYY/MM/DD/rollout-*.jsonl) in addition to Claude
Code transcripts. Same-project sessions from both tools merge into one
index namespace, keyed by real cwd.
Two structural differences are normalized in scripts/codex.mjs:
- Directory layout: Codex shards by date, not cwd. Project membership
is read from each file's first-line session_meta payload cwd
(verified stable across 405 real rollouts).
- Record schema / double-write: each line is {timestamp,type,payload};
event_msg and response_item duplicate the same content. Index stream
reads event_msg (naturally deduped); scan/expand read response_item
(full tool-call input).
lib.mjs dispatches by source, auto-detected from the file's first line
(Codex rollouts always start with session_meta; Claude never does).
Index state keys Codex sessions with a codex: prefix so existing Claude
cursors are untouched; chunk meta carries a source tag (absent = claude
for existing indexes, no migration needed).
Also hardens readMeta: reads to a real newline (4MB cap) instead of a
fixed 64KB buffer, and decodes UTF-8 once after concatenating -- a
truncated first line would otherwise silently drop a session, and a
chunk-boundary split would corrupt CJK paths/content (all platforms).
scan-transcript.ps1 (Windows-only fallback) gains a matching Codex
branch. New unit tests pin the two regressions hit during development:
event_msg-only dedup, and not over-filtering short human messages
("123" / "who are you") the way the Claude <=5-char filter would.
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
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.
What
Adds first-class support for Codex CLI session transcripts alongside Claude Code, in one merged index per project.
Codex differs from Claude Code in two structural ways, both absorbed by a new source adapter:
~/.codex/sessions/YYYY/MM/DD/rollout-<ts>-<uuid>.jsonl, sharded by date, unrelated to cwd. Project membership is read back from each file's first linesession_meta.payload.cwd(verified stable across 405 real rollouts).{timestamp, type, payload}, withevent_msgandresponse_itemdouble-writing the same content. Index stream readsevent_msg(naturally deduped); scan/expand stream readsresponse_item(full tool-call input).How
scripts/codex.mjs— read-only Codex adapter: discovery (first-line meta), dual-stream normalization, scan/expand/list.scripts/lib.mjs— source auto-detected from a file's first line; Claude + Codex sessions of the same real cwd merge into the sameindex/<enc>/namespace. Read paths, index path, and search hits all cover both sources. Codex state keys are prefixedcodex:so existing Claude incremental cursors are untouched — zero migration for existing indexes.scripts/scan-transcript.ps1— Windows fallback gains a Codex branch (source detection + Codex schema parsing).readMeta(64KB first-line truncation) and a chunk-boundary UTF-8 split bug (bit CJK paths/content specifically).Testing
npm test— 16 pass (11 existing + 5 new intest/codex.test.mjspinning dual-stream dedup and the short-message no-over-filter invariant).[codex]; ps1 scan/list/-Detail verified on a real rollout.Notes / caveats
os.homedir()+path.join), but macOS/Linux were not run live. Anpm test+ a discovery pass over a real~/.codex/sessionson either platform would fully confirm.prompt-hint.mjswording tweak (left in the working tree, untouched).