Documentation
¶
Index ¶
- Constants
- func FormatContextBriefMarkdown(brief *ContextBrief) string
- func FormatResearchMarkdown(doc *ResearchDocument, sourceRepo string, issueNumber int) string
- type AgentHandler
- type Approach
- type ApprovalSignal
- type ClarifyQuestion
- type ContextBrief
- type EnhancementAnalysis
- type ResearchDocument
Constants ¶
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 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 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.