Help us shape the future of Go! Take the 2026 Go Developer Survey

handoff

package
v0.12.0 Latest Latest
Warning

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

Go to latest
Published: Oct 31, 2026 License: MIT Imports: 12 Imported by: 0

Documentation

Overview

Package handoff implements the opt-in session handoff file (issue #251): each run leaves a short Markdown note with what it was asked, how it ended and what comes next, and the next fresh run reads it as data.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Preamble

func Preamble(l *Loaded, s *Startup, path string) string

Preamble returns the text placed before the task in the run's first user message: the previous handoff and startup output wrapped as data, and a request to end the final answer with next steps. path is shown relative to the workspace.

func Render

func Render(s Summary) string

Render returns the handoff file content for s.

func Resolve

func Resolve(root, path string) string

Resolve returns the absolute handoff path for root.

func Write

func Write(path, content string) error

Write saves content to path atomically, creating its directory.

Types

type Loaded

type Loaded struct {
	// Path is the file that was read.
	Path string
	// Text is its content, cut to the byte limit.
	Text string
	// Bytes is the file's full size.
	Bytes int
	// Truncated reports that Text is shorter than the file.
	Truncated bool
}

Loaded is a handoff file read at run start.

func Load

func Load(path string, maxBytes int) (*Loaded, error)

Load reads the handoff file at path, keeping at most maxBytes. A missing file returns nil and no error.

type Startup

type Startup struct {
	Command  string
	ExitCode int
	Output   string
	// Truncated reports that Output keeps only the tail.
	Truncated bool
	TimedOut  bool
	Duration  time.Duration
}

Startup is the result of the configured startup command.

func RunStartup

func RunStartup(ctx context.Context, dir, command string, timeout time.Duration, maxOutput int) (Startup, error)

RunStartup runs command with the platform shell in dir, bounded by timeout, and returns its combined output (the last maxOutput bytes). A non-zero exit is reported in the result, not as an error; err is set only when the command couldn't be started.

type Summary

type Summary struct {
	Task           string
	Status         string
	Answer         string
	Model          string
	At             time.Time
	StartupCommand string
	Trajectory     string
	// Untrusted reports that untrusted content (web_fetch, MCP results)
	// entered the run's context, so the answer may be steered by it.
	Untrusted bool
}

Summary is what a finished run records in the handoff file.

Jump to

Keyboard shortcuts

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