brief

package
v0.181.2 Latest Latest
Warning

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

Go to latest
Published: Oct 21, 2026 License: MIT Imports: 18 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 brief assembles the handoff brief (接手包, design 2026-10-10-handoff-brief-and-knowledge-loop §一): everything a fresh agent session needs to take over an issue or a plan, in one bounded text.

It reads the repository tracker, git and docs/ directly, and the server through the narrow Client interface; a section that needs the server is skipped with a note when there is none. Like internal/focusremote it sits between the command layer and tracker (tracker must not import client), so `gofer issue|plan brief` and the MCP gofer_issue_brief / gofer_plan_brief tools only bind inputs and print.

Index

Constants

View Source
const ClientTimeout = 8 * time.Second

ClientTimeout bounds every server request a brief makes, so an unreachable server costs seconds, not the client's default 30s per call. 3s proved too tight while the host was busy (a 200-job list timed out under a full test run); a refused connection still fails at once, so only a hung server pays the full bound.

View Source
const DefaultMaxLines = 400

DefaultMaxLines caps the rendered brief (`--max-lines`).

Variables

This section is empty.

Functions

func PrimePlanLines

func PrimePlanLines(p client.Plan, issues []tracker.Issue) []string

PrimePlanLines renders one open plan for the prime 「进行中 plan」 section: the plan line with the brief hint, then its doing / ready todos with the issues they name.

Types

type Brief

type Brief struct {
	Kind     string    `json:"kind"` // issue | plan
	ID       string    `json:"id"`
	Sections []Section `json:"sections"`
}

Brief is a rendered handoff brief.

func IssueBrief

func IssueBrief(id string, opts Options) (Brief, error)

IssueBrief assembles the brief of one repository issue (design §一, sections in order: issue → 上下文树 → 设计稿 → 相关提交 → 相关 job / plan → 适用记忆 → 接手提示).

func PlanBrief

func PlanBrief(id string, opts Options) (Brief, error)

PlanBrief assembles the brief of a server plan: its fields, the todo list (status, dependencies, acceptance, the latest job and its outcome), the handoff note, and a short brief of every repository issue the plan or its todos name.

func (Brief) Text

func (b Brief) Text() string

Text renders the brief as markdown-ish text.

type Client

type Client interface {
	ListJobs(opts job.ListOpts) ([]job.JobResult, error)
	ListPlans(opts client.PlanListOpts) (client.PlanList, error)
	GetPlan(id string) (client.Plan, error)
	GetPlanHandoff(id string, version int) (client.PlanHandoff, error)
	ListScopedMemories(opts client.ScopedMemoryListOpts) ([]client.ScopedMemory, error)
}

Client is the slice of the server API a brief reads.

func Connect

func Connect(cli *client.Client) (Client, string)

Connect re-binds cli with ClientTimeout and probes the server once. It returns (nil, reason) when the server does not answer, so the server sections are skipped with that reason instead of each one waiting on its own timeout.

type Options

type Options struct {
	// Store is the repository tracker (required for an issue brief; optional for a
	// plan brief, where it resolves the issues the todos mention).
	Store *tracker.Store
	// Root is the repository root for git and docs/ (default Store.RepoRoot()).
	Root string
	// Client is the server; nil skips the server sections with ClientNote.
	Client     Client
	ClientNote string
	// ProjectKey scopes job / plan / project-memory lookups ("" = all projects for
	// jobs and plans, no project memories).
	ProjectKey string
	// GlobalMemories reads the global memories from this machine's copy (no
	// network). nil, or tracker.ErrGlobalNotSynced from it, reads them from Client.
	GlobalMemories func() ([]tracker.Memory, error)
	// AgentName filters `agent:<name>` tagged memories (tracker.MemoryForAgent).
	AgentName string
	MaxLines  int
	Now       time.Time
}

Options are the inputs of a brief.

type Section

type Section struct {
	Title string   `json:"title"`
	Lines []string `json:"lines,omitempty"`
	// Note says why the section is empty or partial (e.g. no server).
	Note string `json:"note,omitempty"`
	// More is the command that shows what the brief left out.
	More string `json:"more,omitempty"`
	// Truncated counts the lines cut to fit max-lines.
	Truncated int `json:"truncated,omitempty"`
}

Section is one titled part of a brief.

Jump to

Keyboard shortcuts

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