sessionmeta

package
v0.16.521 Latest Latest
Warning

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

Go to latest
Published: Dec 2, 2026 License: AGPL-3.0 Imports: 11 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 sessionmeta reads what a Claude Code transcript says about the session itself, beside its messages: the reasoning effort it really runs on, the /goal it works toward, and the recap Claude writes for the person who comes back after being away. Claude writes them between the lines of the conversation: every model request is logged with its output_config (the effort the request went out with), the commands /effort and /goal answer in lines of their own, and the goal check leaves a goal_status attachment.

A transcript is read once from its tail and then only what it gained, as internal/background does: a busy agent's every write costs its new lines.

Index

Constants

View Source
const (
	GoalActive = "active"
	GoalPaused = "paused"
	GoalMet    = "met"
)

Goal statuses.

Variables

This section is empty.

Functions

func AgentFiles

func AgentFiles(transcript, id string) (jsonl, meta string)

AgentFiles are the files of a subagent: <session>/subagents/agent-<id>.{jsonl,meta.json} beside the transcript.

Types

type Agent

type Agent struct {
	// Model is the id its requests went out with (claude-sonnet-5-5), else the alias it was started with.
	Model string
	// Effort is the output_config of its last request.
	Effort string
	// Role is the kind of agent it was started as («Explore», «general-purpose», a teammate's name).
	Role string
	// Last is its last step in a line: «Read · web/app/next/shell.tsx», or the first words of its last text.
	Last string
	// Done is whether Claude marked it finished.
	Done bool
}

Agent is what a subagent's own files say about it. Every field is "" when they do not say.

func ReadAgent

func ReadAgent(transcript, id string) Agent

ReadAgent reads a subagent of a session. A read of files that did not change since the last one is free.

func ReadAgentFiles

func ReadAgentFiles(jsonl, metaFile string) Agent

ReadAgentFiles reads a subagent from its transcript and meta file wherever they are (a workflow keeps its agents in a folder of the run). A read of files that did not change since the last one is free.

type Goal

type Goal struct {
	Text   string
	Status string
	Since  int64
}

Goal is the /goal of a session. Since is when the goal was set, epoch milliseconds.

type Info

type Info struct {
	// Effort is the level the last model request of the main thread went out with, or the one a later /effort set;
	// "" when the transcript does not say (an agent that has no effort, a version that did not log requests).
	Effort string
	// Ultracode is the mode as the running process last said it, the last word winning: /effort ultracode on|off, the
	// /effort dialog's toggle, and the reminders Claude Code itself attaches when the mode takes effect or ends
	// (ultra_effort_enter, ultra_effort_exit). A process that started since (a SessionStart hook of startup or resume)
	// has said nothing yet: Unknown, and what it runs on is its launch's. The whole transcript counts, not only the
	// tail a cold read takes. Since Claude Code 2.1.310 it is a mode beside the effort: a level set leaves it as it is.
	Ultracode Tri
	Goal      *Goal
	// Recap is the latest away_summary of the transcript; nil when it has none.
	Recap *Recap
	// Title is the session's own name: the title the person gave it in the agent (/rename, a custom-title line), else
	// the one Claude wrote after the first answer (the last ai-title line); "" when the transcript has neither yet.
	Title string
}

Info is what a transcript says now.

type Reader

type Reader struct {
	// Index, when set, reads what a transcript gains for the reader and for the transcript's other readers at once:
	// the reader reads a transcript's tail itself and takes the lines after it from the index. nil has it read every
	// transcript itself.
	Index *transcriptindex.Index
	// contains filtered or unexported fields
}

Reader keeps one cursor per transcript.

func (*Reader) Cursors

func (r *Reader) Cursors() int

Cursors is how many transcripts the reader keeps a cursor of.

func (*Reader) Forget

func (r *Reader) Forget(path string)

Forget drops the cursor of a transcript no conversation shows any more.

func (*Reader) Read

func (r *Reader) Read(path string) Info

Read is what the transcript says now. Reads of one transcript take turns.

type Recap

type Recap struct {
	Text string
	At   int64
}

Recap is Claude's «while you were away» summary: the last one the transcript has. At is when Claude wrote it, epoch milliseconds.

type Tri

type Tri int

Tri is a fact a transcript may not state at all.

const (
	Unknown Tri = iota
	On
	Off
)

Jump to

Keyboard shortcuts

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