summary

package
v0.1.8 Latest Latest
Warning

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

Go to latest
Published: Nov 11, 2026 License: Apache-2.0 Imports: 15 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 summary builds rule-based session summaries from a session's events. No LLM is involved; every claim is backed by an event, and a test is reported as passing only when an event shows it succeeded.

Index

Constants

View Source
const Disclaimer = "Auto-generated from recorded events; may be incomplete."

Disclaimer accompanies every rendered summary.

View Source
const Generator = "rules-v1"

Generator identifies the summarizer version stored with each summary.

View Source
const JobKind = "session.summarize"

JobKind is the job queue kind for summarization.

Variables

View Source
var (
	IdleDelay = 3 * time.Minute
	MaxDelay  = 10 * time.Minute
)

Debounce: summarize once a session has been quiet for IdleDelay, but at least every MaxDelay while it stays busy.

View Source
var ErrNoSession = errors.New("summary: no such session")

ErrNoSession means the session does not exist.

Functions

func Enqueue

func Enqueue(ctx context.Context, x jobs.Execer, sessionID string, ended bool) error

Enqueue schedules (re)summarization of a session; immediate when it ended.

func Handler

func Handler(db *sql.DB) jobs.Handler

Handler is the job handler for JobKind.

func Memories

func Memories(sessionID, projectID string, s *Summary) []memory.Memory

Memories derives rule-based memories from a summary: one episodic memory for the session, and a procedural memory per fix.

func Requests added in v0.1.2

func Requests(ctx context.Context, db *sql.DB, sessionID string) (objective, latest string, err error)

Requests derives a session's objective and latest request from its prompts the way a summary does, for sessions whose summary is not generated yet (summaries wait until the session has been quiet for IdleDelay).

Types

type Event

type Event struct {
	EventID    string
	EventType  string
	OccurredAt time.Time
	Payload    []byte
}

Event is one session event, in occurrence order.

type Fix

type Fix struct {
	Title         string    `json:"title"`
	Error         string    `json:"error"`
	Files         []string  `json:"files"`
	FailedEventID string    `json:"failed_event_id"`
	FixedEventID  string    `json:"fixed_event_id"`
	FileEventIDs  []string  `json:"file_event_ids"`
	At            time.Time `json:"at"`
}

Fix is a failure that was resolved by changing files: the operation failed, files were modified, and the same operation then succeeded. A retry that succeeds without changes is not a fix (flaky, or transient).

type Issue

type Issue struct {
	Title   string    `json:"title"`
	Error   string    `json:"error"`
	At      time.Time `json:"at"`
	EventID string    `json:"event_id"`
}

Issue is a failure that was not followed by a successful retry.

type Summary

type Summary struct {
	Status        string       `json:"status"` // active | ended | interrupted
	Objective     string       `json:"objective"`
	LatestRequest string       `json:"latest_request"`
	CompletedWork string       `json:"completed_work"`
	ChangedFiles  []string     `json:"changed_files"`
	TestResults   []TestResult `json:"test_results"`
	Unresolved    []Issue      `json:"unresolved_issues"`
	NextSteps     []string     `json:"next_steps"`
	Evidence      []string     `json:"evidence"`
	Fixes         []Fix        `json:"fixes,omitempty"`
	EventCount    int          `json:"event_count"`
	FirstEventAt  time.Time    `json:"first_event_at"`
	LastEventAt   time.Time    `json:"last_event_at"`
	Generator     string       `json:"generator"`
	GeneratedAt   time.Time    `json:"generated_at"`
	Disclaimer    string       `json:"disclaimer"`
}

Summary of one session.

func Build

func Build(events []Event, now time.Time) Summary

Build summarizes a session's events, which must be sorted by time.

func Compute

func Compute(ctx context.Context, db *sql.DB, sessionID string) (*Summary, string, error)

Compute builds a fresh summary for a session without storing it.

func Generate

func Generate(ctx context.Context, db *sql.DB, sessionID string) (*Summary, error)

Generate computes, stores and indexes a session's summary.

func Load

func Load(ctx context.Context, db *sql.DB, sessionID string) (*Summary, bool, error)

Load returns a stored summary.

type TestResult

type TestResult struct {
	Command  string    `json:"command"`
	Passed   bool      `json:"passed"`
	ExitCode *int      `json:"exit_code,omitempty"`
	At       time.Time `json:"at"`
	EventID  string    `json:"event_id"`
}

TestResult is the latest outcome of one test command.

Jump to

Keyboard shortcuts

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