session

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: May 26, 2026 License: MIT Imports: 11 Imported by: 0

Documentation

Index

Constants

View Source
const LabelMaxLen = 200

LabelMaxLen is the max length of the label string after sanitization.

View Source
const TailReadBytes int64 = 64 * 1024

TailReadBytes is the upper bound on how many bytes we read from the end of a JSONL file.

Variables

This section is empty.

Functions

func ProjectsDir

func ProjectsDir() (string, error)

ProjectsDir returns the directory where Claude Code stores transcripts.

Types

type Session

type Session struct {
	ID          string
	ProjectDir  string
	JSONLPath   string
	CWD         string
	CWDBasename string
	Label       string
	LastTime    time.Time
	LastEpoch   int64
	CWDExists   bool
}

Session is a parsed view of one Claude Code session transcript.

func FindByID

func FindByID(id string) (*Session, error)

FindByID scans every project directory looking for a session whose filename matches the given UUID. Returns the parsed session or nil.

func ParseSessionTail

func ParseSessionTail(path string, maxBytes int64) (*Session, error)

ParseSessionTail reads the tail of one JSONL transcript and returns a Session, or (nil, nil) when the session should be excluded (no user messages / no label).

func Scan

func Scan() ([]*Session, error)

Scan walks every project directory under ~/.claude/projects and parses each session JSONL in parallel. Sessions returned are sorted by last activity (newest first).

func ScanFiltered

func ScanFiltered(allow map[string]struct{}) ([]*Session, error)

ScanFiltered behaves like Scan but only parses files whose path is in the allow-set. Empty allow returns nothing.

Jump to

Keyboard shortcuts

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