transcript

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Oct 1, 2026 License: MIT Imports: 8 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Overview

Package transcript reads the tail of a Claude Code transcript (.jsonl) for display metadata: title, first prompt, model, branch, context size, and whether a turn is open. Transcripts can be tens of MB; only the last 64KB is read, and results are cached by file size and mtime so a 1s poll is cheap.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func MungeProjectDir

func MungeProjectDir(cwd string) string

MungeProjectDir converts a cwd into Claude Code's projects-dir name (slashes and dots become dashes).

func Newest

func Newest(projectsDir, cwd, sessionID string) string

Newest returns the transcript path for (cwd, sessionID): <sessionID>.jsonl under the cwd's project dir, else under any project dir (a session that cd'd into a worktree keeps its transcript where it started), else the most recently modified .jsonl in the cwd's project dir, or "" when none.

Types

type Info

type Info struct {
	Title          string // Claude's generated aiTitle
	FirstPrompt    string // first plain user prompt seen in the tail
	Model          string
	Branch         string
	PermissionMode string
	ContextTokens  int64
	LastActivity   time.Time // timestamp of the last substantive line, else file mtime
	TurnOpen       bool      // last substantive line was not a turn_duration
	Known          bool      // file existed and was parsed
}

Info is what the tail of a transcript tells us.

func Tail

func Tail(path string) Info

Tail parses the last chunk of the transcript at path. A missing or unreadable file yields Info{Known: false}.

type Meta

type Meta struct {
	Type        string `json:"agentType"`
	Description string `json:"description"`
	Model       string `json:"model"`
}

Meta is what Claude Code records about a subagent next to its transcript, in <session>/subagents/agent-<id>.meta.json.

func AgentMeta

func AgentMeta(transcriptPath, agentID string) Meta

AgentMeta reads the meta file of agent agentID belonging to the session whose transcript is at transcriptPath. Missing or unreadable yields a zero Meta: the file is written when the agent starts, but a hook can arrive first.

Jump to

Keyboard shortcuts

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