sessiontitle

package
v0.2.9 Latest Latest
Warning

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

Go to latest
Published: Jun 21, 2026 License: Apache-2.0 Imports: 9 Imported by: 0

Documentation

Overview

Package sessiontitle resolves human-readable Claude Code session titles from transcript metadata. It is read-only and best-effort: callers fall back to the session UUID when no title can be resolved.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CleanTitle

func CleanTitle(title string) string

CleanTitle sanitizes a Claude session title for display in the TUI board header. It drops every non-whitespace control rune (unicode.IsControl && !IsSpace — the ESC byte that introduces an ANSI sequence, plus BEL and OSC terminators) so a /rename title can't inject escape sequences into the terminal. Once ESC is gone, any leftover body (e.g. "[31m") is inert text. Whitespace control runes (space/tab/newline/CR) are KEPT so strings.Fields collapses them to single spaces rather than gluing words together.

func FindAgentTranscript added in v0.1.6

func FindAgentTranscript(cwd, team, agent string, notBefore time.Time) (string, bool)

FindAgentTranscript locates a teammate's own session transcript: the newest *.jsonl under cwd's project directory whose head records the (team, agent) markers. cwd is the lead session's recorded working directory — the spawn cwd, which is where native Claude Code files the teammate's transcript too. A live teammate's transcript keeps being appended, so candidates modified before notBefore (its spawn time) are skipped — that prunes a prior same-named teammate's transcript and bounds the scan; a zero notBefore disables the filter.

func Lookup

func Lookup(sessionID string) string

Lookup returns the best display title for one Claude session id.

func Resolve

func Resolve(ids []string) map[string]string

Resolve returns title metadata for ids. custom-title entries written by /rename win over ai-title entries; missing or malformed transcripts simply omit that session from the returned map.

func ResolveMeta added in v0.1.6

func ResolveMeta(ids []string) map[string]Meta

ResolveMeta returns title + working-directory metadata for ids. A session with neither a title nor a cwd is omitted from the returned map.

Types

type Meta added in v0.1.6

type Meta struct {
	Title string
	Cwd   string
}

Meta is one session's resolved display metadata: its /rename (or AI) title and the working directory its transcript records. Either field may be empty.

func LookupMeta added in v0.1.6

func LookupMeta(sessionID string) Meta

LookupMeta returns the best display title + recorded working directory for one Claude session id, merging across transcript candidates first-wins per field and stopping once both are known.

Jump to

Keyboard shortcuts

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