Skip to main content

ingest_pi_transcript_delta

Function ingest_pi_transcript_delta 

Source
pub fn ingest_pi_transcript_delta(
    project_dir: &Path,
    session_id: &str,
    cwd: &Path,
    transcript_path: &Path,
) -> Result<PiIngestStats>
Expand description

Ingest a Pi session transcript file incrementally into project_dir.

  1. Reads new lines using a session-specific cursor (pi_transcript_cursor.{session_id}.json).
  2. Appends raw transcript lines to transcripts/{session_id}.jsonl.
  3. Normalizes tool calls, tool results, and user prompts into ledger/{session_id}.jsonl.
  4. Updates state/usage.json with observed model and token totals.