Documentation
¶
Overview ¶
Package summarize provides AI-powered summarization of development sessions.
Index ¶
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 []byte, filesTouched []string, agentType agent.AgentType, generator Generator) (*checkpoint.Summary, error)
GenerateFromTranscript generates a summary from raw transcript bytes. This is the shared implementation used by both explain --generate and auto-summarize.
Parameters:
- ctx: context for cancellation
- transcriptBytes: raw transcript bytes (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.
Types ¶
type ClaudeGenerator ¶
type ClaudeGenerator struct {
// ClaudePath is the path to the claude CLI executable.
// If empty, defaults to "claude" (expects it to be in PATH).
ClaudePath string
// Model is the Claude model to use for summarization.
// If empty, defaults to DefaultModel ("sonnet").
Model string
// CommandRunner allows injection of the command execution for testing.
// If nil, uses exec.CommandContext directly.
CommandRunner func(ctx context.Context, name string, args ...string) *exec.Cmd
}
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 ¶
BuildCondensedTranscriptFromBytes parses 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 JSONL vs Gemini JSON).