claude-code-data
    Preparing search index...

    Function readSessionTurns

    • Streams the main-transcript turns of a session, one at a time.

      Yields user and assistant entries from the main JSONL file, in chronological order, skipping subagent turns (isSidechain && agentId !== undefined). Memory stays bounded — the consumer can break, filter, or accumulate at will.

      Parameters

      • projectDir: string

        Absolute path to the project directory under ~/.claude/projects/<slug>/

      • sessionId: string

        UUID of the session (without .jsonl extension)

      Returns AsyncGenerator<MessageEntry>

      // Render a transcript without holding all turns in memory
      for await (const turn of readSessionTurns(dir, id)) {
      render(turn);
      }