transcript

package
v0.6.2 Latest Latest
Warning

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

Go to latest
Published: Jun 29, 2026 License: MIT Imports: 5 Imported by: 0

Documentation

Overview

Package transcript reads Claude Code session transcript JSONL files and extracts the structural metadata and text body the capture uploader needs.

The transcript format is one JSON object per line. We tolerate unknown shapes: each line is parsed leniently and we pull what we recognize (role/type, text content, tool name + tool input paths/commands). Lines we cannot parse are skipped, never fatal — a hook must never fail the session.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Parsed

type Parsed struct {
	// Text is the concatenated human-readable conversation (user + assistant
	// text), suitable for redaction + distillation.
	Text string
	// FilesTouched are unique file paths created/edited by Write/Edit/MultiEdit/
	// NotebookEdit tools (CAPQ-7). Read is deliberately NOT a touch.
	FilesTouched []string
	// Commands are unique shell commands referenced by Bash tools.
	Commands []string
	// MessageCount is the number of transcript lines parsed.
	MessageCount int
	// UserTexts is the ordered list of candidate user-turn texts (raw, not yet
	// sanitized): lines with type/role "user", non-empty string content, and
	// isMeta/isSidechain not set. Callers sanitize each and apply the "real user
	// turn" predicate (FR-Q4) to find the first real prompt and detect low-signal
	// sessions.
	UserTexts []string
	// AITitle is a best-effort transcript-provided session title, when present
	// (the §10-0 meta-line shape is UNVERIFIED — empty when absent; callers MUST
	// degrade to the deterministic title fallback chain).
	AITitle string
}

Parsed is the distilled structural view of a transcript.

func Read

func Read(path string) (*Parsed, error)

Read parses a transcript file at path. A missing/unreadable file returns an empty Parsed and the error, so callers can decide whether to spool.

Jump to

Keyboard shortcuts

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