claude-fork-trace-identity

Public task · Field Engineering

← Field Engineering

Make the local trace uploader publish each forked Claude Code transcript as its own session, with its own trace id, parent link and normalized records, leaving cloud-worker captures unchanged.

Version
Category
Engineering
Model configurations
2
Attempts
9
Public trials
94 passed
Median runtime
20m 11s

Instruction

# Give each forked Claude Code session its own trace

The backend's local trace uploader (`backend/app/agents/traces/local.py`, run
as `just backend jobs upload_local_traces`) publishes a developer's Claude Code
sessions from `~/.claude/projects/<project>/<file>.jsonl` to the trace bucket,
one capture per session, replaced in place as the session grows. It names a
Claude Code session by the `sessionId` in its transcript.

That loses work. When Claude Code forks or resumes a conversation, it writes a
new transcript file, named by the new session's id, whose leading records are
copies of the parent's, `sessionId` included; only the records written after
the fork carry the new id. Every fork of a conversation therefore uploads under
the parent's session and trace id, and each upload replaces the last.

Make each transcript file publish as its own session:

- A Claude Code session's id is its transcript file's name without `.jsonl`.
  Its trace id is derived from that id the same way as now, so the session a
  conversation began in, whose file name is its `sessionId`, keeps the trace id
  it has today.
- When the `sessionId` a file's records start with differs from the file's
  name, the capture records that inherited id as its `parent_thread_id`;
  otherwise `parent_thread_id` stays null.
- Everything in a fork's capture names the fork as its session: the
  `native_session_id` in its manifest and in the archive's discovery metadata,
  and its normalized records, including those copied from the parent.
- Claude Code captures from cloud workers (the worker harness's Claude Code
  trace export) must come out exactly as they do now. Codex sessions are
  unaffected.

## Environment

PostgreSQL on localhost:5432 and the local database endpoint the app's
driver uses are running when you start, and the dev env files point at the
dev database.

Public trials

Claude Opus 5.51 of 1 passed

Results by model

Model · harnessMean rewardRange± SEAttempts
Claude Opus 5.5Grok Build100.0%100% – 100%—1
Frontier model ACursor CLI37.5%0% – 100%18.3 pp8