agent

package
v0.1.2 Latest Latest
Warning

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

Go to latest
Published: Sep 6, 2026 License: MIT Imports: 13 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

Index

Constants

View Source
const MaxRoundTrips = 4

Variables

This section is empty.

Functions

func FormatContextBriefMarkdown

func FormatContextBriefMarkdown(brief *ContextBrief) string

FormatContextBriefMarkdown renders a ContextBrief as markdown suitable for posting as a GitHub comment.

func FormatResearchMarkdown

func FormatResearchMarkdown(doc *ResearchDocument, sourceRepo string, issueNumber int) string

FormatResearchMarkdown converts a ResearchDocument into a markdown string suitable for posting as a GitHub issue or comment.

Types

type AgentHandler

type AgentHandler struct {
	// contains filtered or unexported fields
}

AgentHandler manages the enhancement research agent lifecycle, coordinating between shadow repos, LLM analysis, and human review.

func NewAgentHandler

func NewAgentHandler(s *store.Store, l llm.Provider, g *gh.Client, structural *safety.StructuralValidator, llmSafety *safety.LLMValidator, logger *slog.Logger) *AgentHandler

NewAgentHandler creates a new AgentHandler with all required dependencies.

func (*AgentHandler) HandleComment

func (h *AgentHandler) HandleComment(ctx context.Context, installationID int64, shadowRepo string, shadowIssueNumber int, commentBody string, commentUser string) error

HandleComment processes a comment on a shadow issue, advancing the agent state machine based on the approval signal parsed from the comment.

func (*AgentHandler) StartSession

func (h *AgentHandler) StartSession(ctx context.Context, installationID int64, sourceRepo string, issueNumber int, shadowRepo string, title, body string, projectName, projectDescription string) error

StartSession creates a mirror issue in the shadow repo and posts a context brief summarising related documents and issues. Maintainers can then reply with "research" to trigger full synthesis, or "reject" to close the session.

type Approach

type Approach struct {
	Name        string   `json:"name"`
	Description string   `json:"description"`
	Pros        []string `json:"pros"`
	Cons        []string `json:"cons"`
}

type ApprovalSignal

type ApprovalSignal int
const (
	SignalNone ApprovalSignal = iota
	SignalApproved
	SignalRevise
	SignalReject
	SignalPromote
	SignalResearch
	SignalUseAsContext
	SignalDismiss // Maintainer dismissing the issue as not relevant/needed
)

func ParseApprovalSignal

func ParseApprovalSignal(comment string) ApprovalSignal

ParseApprovalSignal detects approval signals at the start of a comment. The signal keyword must appear at the beginning of the trimmed, lowercased comment to avoid false positives from natural language (e.g. "I don't think we need to research this" should not trigger SignalResearch).

type ClarifyQuestion

type ClarifyQuestion struct {
	Question string   `json:"question"`
	Options  []string `json:"options,omitempty"`
}

type ContextBrief

type ContextBrief struct {
	Summary    string
	SourceRepo string
	IssueNum   int
	Title      string
	ADRs       []store.SimilarDocument
	Roadmap    []store.SimilarDocument
	Research   []store.SimilarDocument
	Issues     []store.SimilarIssue
}

ContextBrief holds raw vector search results partitioned by type, along with a short LLM-generated summary.

func BuildContextBrief

func BuildContextBrief(ctx context.Context, provider llm.Provider, title, body string, docs []store.SimilarDocument, issues []store.SimilarIssue, sourceRepo string, issueNumber int) (*ContextBrief, error)

BuildContextBrief assembles vector search results into a structured brief with an LLM-generated summary, partitioning documents by type.

type EnhancementAnalysis

type EnhancementAnalysis struct {
	NeedsClarification bool              `json:"needs_clarification"`
	Questions          []ClarifyQuestion `json:"questions"`
	Confidence         float64           `json:"confidence"`
}

func AnalyzeEnhancement

func AnalyzeEnhancement(ctx context.Context, provider llm.Provider, title, body string) (*EnhancementAnalysis, error)

AnalyzeEnhancement uses an LLM to determine if an enhancement request has enough detail to proceed with research, returning clarifying questions if not.

type ResearchDocument

type ResearchDocument struct {
	Title          string     `json:"title"`
	Summary        string     `json:"summary"`
	Approaches     []Approach `json:"approaches"`
	Recommendation string     `json:"recommendation"`
	OpenQuestions  []string   `json:"open_questions"`
}

func SynthesizeResearch

func SynthesizeResearch(ctx context.Context, provider llm.Provider, title, body string, relatedDocs []string, relatedIssues []string, projectName, projectDescription string) (*ResearchDocument, error)

SynthesizeResearch uses an LLM to produce a research document with multiple implementation approaches, trade-offs, and a recommendation.

Jump to

Keyboard shortcuts

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