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

agent

package
v0.6.0 Latest Latest
Warning

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

Go to latest
Published: Oct 29, 2026 License: Apache-2.0 Imports: 6 Imported by: 0

Documentation

Overview

Package agent runs AI code reviewers behind a common interface.

Index

Constants

View Source
const OutputContract = `` /* 530-byte string literal not displayed */

OutputContract is appended to every operator prompt. It is fixed so a custom prompt cannot change what Ghost parses.

View Source
const ResultSchema = `` /* 436-byte string literal not displayed */

ResultSchema is passed to agents that support structured output.

Variables

This section is empty.

Functions

func BuildPrompt

func BuildPrompt(rendered, diffPath, commitsPath string) string

BuildPrompt appends Ghost's fixed sections to the operator's rendered prompt: where the review materials are, then the output contract.

Types

type InlineComment

type InlineComment struct {
	Path     string `json:"path"`
	Line     int    `json:"line"`
	Body     string `json:"body"`
	Severity string `json:"severity"` // "blocking" or "nit"
	// OutsideDiff is set by Ghost (not the agent) when Line isn't part of
	// the PR's diff, so GitHub won't accept the comment inline.
	OutsideDiff bool `json:"outside_diff,omitempty"`
}

type ReviewRequest

type ReviewRequest struct {
	Dir        string  // PR worktree; the agent's working directory
	ContextDir string  // Ghost-written review materials (diff, commits), outside Dir
	Prompt     string  // BuildPrompt output
	MaxCostUSD float64 // 0 = no per-review cap
}

type ReviewResult

type ReviewResult struct {
	Summary  string          `json:"summary"`
	Verdict  Verdict         `json:"verdict"`
	Comments []InlineComment `json:"comments"`
	CostUSD  float64         `json:"-"`
	Raw      string          `json:"-"` // full agent output, for the audit trail
}

type Reviewer

type Reviewer interface {
	Name() string
	// Review runs one review. CostUSD is set whenever the agent reported a
	// cost, including when an error is returned.
	Review(ctx context.Context, req ReviewRequest) (ReviewResult, error)
}

func New

func New(name string, a config.Agent, r run.Func) (Reviewer, error)

type Verdict

type Verdict string
const (
	Approve        Verdict = "approve"
	Comment        Verdict = "comment"
	RequestChanges Verdict = "request_changes"
)

Jump to

Keyboard shortcuts

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