transcript

package
v0.5.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jul 26, 2026 License: MIT Imports: 7 Imported by: 0

Documentation

Overview

Package transcript reads Claude Code session transcripts (JSONL) and extracts deterministic signal windows for the learning miner — the zero-LLM stage 0 that decides whether a session is worth any model call at all.

The transcript format is undocumented and shifts across Claude Code versions, so all format knowledge is isolated here and every decode is permissive: unknown line types are skipped, a malformed line never fails the file (plan §learning risk).

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Render

func Render(entries []Entry, wins []Window, maxBytes int) string

Render serializes windows for the miner prompt, hard-capped at maxBytes. Entry text and tool errors are truncated per-entry so one giant paste cannot crowd out every other window.

Types

type Entry

type Entry struct {
	Role       string   // "user" | "assistant"
	Text       string   // concatenated text content (typed prompts, replies)
	ToolErrors []string // is_error tool_result payloads (rejections, failures)
}

Entry is one normalized conversation turn.

func ReadFrom

func ReadFrom(path string, offset int64) ([]Entry, int64, error)

ReadFrom parses entries starting at byte offset and returns them with the new offset (end of the last complete line — a partial trailing line is left for the next run). An offset past EOF means the file was truncated or replaced: parsing restarts from 0.

type Window

type Window struct {
	Reason string // correction | rejection | repeated | tool_error
	Start  int
	End    int
}

Window is one signal region: entries [Start, End] around a trigger.

func Extract

func Extract(entries []Entry) []Window

Extract runs the deterministic trigger scan and returns merged windows, capped at maxWindows with tool_error windows dropped first (corrections and repeats carry more signal per token).

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL