Files
ai-agent/runner/cli.mjs
Gabriel Vidal e429c9cde3 feat(ai-agent): conversation forking — /api/fork, CC transcript surgery, pi session fork
Branch a new conversation off any user message: POST /api/fork locates the
fork point by message ordinal (find_cut_line drives the real ParserState so
the cut can't drift from the viewer), the sidecar copies the CC session file
truncated at that line under a fresh session id (sessionId rewritten per
record, trailing queue-operation/last-prompt bookkeeping trimmed) and
resumes it; the pi runner branches pi's native session tree (--fork-from /
--cut-user-ord) and mirrors the truncated CC-schema prefix. forkedFrom is
stamped into the conversation meta; cutText canaries refuse a drifted slice.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
2026-07-13 23:13:39 +02:00

17 KiB
Executable File