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 ¶
const ( GoalActive = "active" GoalPaused = "paused" GoalMet = "met" )
Goal statuses.
Variables ¶
This section is empty.
Functions ¶
func AgentFiles ¶
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 ¶
ReadAgent reads a subagent of a session. A read of files that did not change since the last one is free.
func ReadAgentFiles ¶
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 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.