Documentation
¶
Overview ¶
Package summarize provides AI-powered summarization of development sessions.
Index ¶
- Constants
- func FormatCondensedTranscript(input Input) string
- func GenerateFromTranscript(ctx context.Context, transcriptBytes redact.RedactedBytes, ...) (*checkpoint.Summary, error)
- func ResolveModel(name types.AgentName, model string) string
- type ClaudeGenerator
- type Entry
- type EntryType
- type Generator
- type Input
- type TextGeneratorAdapter
Constants ¶
const DefaultModel = "sonnet"
DefaultModel is the default model used for summarization. Sonnet provides a good balance of quality and cost, with 1M context window to handle long transcripts without truncation.
Variables ¶
This section is empty.
Functions ¶
func FormatCondensedTranscript ¶
FormatCondensedTranscript formats an Input into a human-readable string for LLM. The format is:
[User] user prompt here [Assistant] assistant response here [Tool] ToolName: description or file path
func GenerateFromTranscript ¶
func GenerateFromTranscript(ctx context.Context, transcriptBytes redact.RedactedBytes, filesTouched []string, agentType types.AgentType, generator Generator) (*checkpoint.Summary, error)
GenerateFromTranscript generates a summary from pre-redacted transcript bytes. This is the shared implementation used by both explain --generate and auto-summarize.
Parameters:
- ctx: context for cancellation
- transcriptBytes: pre-redacted transcript (JSONL or JSON format depending on agent)
- filesTouched: list of files modified during the session
- agentType: the agent type to determine transcript format
- generator: summary generator to use (if nil, uses default ClaudeGenerator)
Returns nil, error if transcript is empty or cannot be parsed.
func ResolveModel ¶ added in v0.5.6
ResolveModel returns the effective model to use for summary generation. When the provider is Claude Code and no model is configured, it falls back to DefaultModel ("sonnet") — the summarize package's quality/cost choice, which differs from Claude Code's own invocation default ("haiku"). For other providers, an empty model means "use the provider CLI's own default", so we leave it unchanged.
Types ¶
type ClaudeGenerator ¶
type ClaudeGenerator struct {
// TextGenerator is the primitive used to obtain raw model output.
// If nil, uses the built-in Claude Code text generator.
TextGenerator agent.TextGenerator
// Model is the Claude model to use for summarization.
// If empty, defaults to DefaultModel ("sonnet").
Model string
}
ClaudeGenerator generates summaries using the Claude CLI.
func (*ClaudeGenerator) Generate ¶
func (g *ClaudeGenerator) Generate(ctx context.Context, input Input) (*checkpoint.Summary, error)
Generate creates a summary from checkpoint data by calling the Claude CLI.
type Entry ¶
type Entry struct {
// Type is the entry type (user, assistant, tool)
Type EntryType
// Content is the text content for user/assistant entries
Content string
// ToolName is the name of the tool (for tool entries)
ToolName string
// ToolDetail is a description or file path (for tool entries)
ToolDetail string
}
Entry represents one item in the condensed transcript.
func BuildCondensedTranscript ¶
func BuildCondensedTranscript(lines []transcript.Line) []Entry
BuildCondensedTranscript extracts a condensed view of the transcript. It processes user prompts, assistant responses, and tool calls into a simplified format suitable for LLM summarization.
func BuildCondensedTranscriptFromBytes ¶
func BuildCondensedTranscriptFromBytes(content redact.RedactedBytes, agentType types.AgentType) ([]Entry, error)
BuildCondensedTranscriptFromBytes parses pre-redacted transcript bytes and extracts a condensed view. This is a convenience function that combines parsing and condensing. The agentType parameter determines which parser to use (Claude/OpenCode JSONL vs Gemini JSON).
type Generator ¶
type Generator interface {
// Generate creates a summary from checkpoint data.
// Returns the generated summary or an error if generation fails.
Generate(ctx context.Context, input Input) (*checkpoint.Summary, error)
}
Generator generates checkpoint summaries using an LLM.
type Input ¶
type Input struct {
// Transcript is the condensed transcript entries
Transcript []Entry
// FilesTouched are the files modified during the session
FilesTouched []string
}
Input contains condensed checkpoint data for summarization.
type TextGeneratorAdapter ¶ added in v0.5.6
type TextGeneratorAdapter struct {
TextGenerator agent.TextGenerator
Model string
}
TextGeneratorAdapter uses an agent.TextGenerator with Entire's shared summary prompt and response parser.
func (*TextGeneratorAdapter) Generate ¶ added in v0.5.6
func (g *TextGeneratorAdapter) Generate(ctx context.Context, input Input) (*checkpoint.Summary, error)
Generate creates a summary using the shared prompt, then delegates raw text generation to the configured agent provider.