Documentation
¶
Overview ¶
Package extract provides LLM-based observation extraction and XML validation for session backfill.
Index ¶
Constants ¶
const SystemPrompt = `` /* 1398-byte string literal not displayed */
SystemPrompt is the frozen poc-v1 extraction prompt for historical sessions.
const UserPromptTemplate = `` /* 1055-byte string literal not displayed */
UserPromptTemplate is the template for building user prompts. Format args: projectPath, gitBranch, durationMin, exchangeCount, chunkInfo, alreadyExtracted, transcript.
Variables ¶
var ValidOutcomes = map[string]bool{ "active_pattern": true, "failed_experiment": true, "superseded": true, }
ValidOutcomes contains allowed outcome classification values.
var ValidTypes = map[string]bool{ "decision": true, "bugfix": true, "feature": true, "refactor": true, "discovery": true, "change": true, "design": true, }
ValidTypes contains allowed observation type values.
Functions ¶
func BuildAlreadyExtracted ¶
BuildAlreadyExtracted builds the <already_extracted> context block for multi-chunk dedup.
func BuildUserPrompt ¶
func BuildUserPrompt(projectPath, gitBranch string, durationMin, exchangeCount int, chunkInfo, alreadyExtracted, transcript string) string
BuildUserPrompt constructs the user prompt for LLM extraction. Transcript content is sanitized to prevent XML tag injection (AG06-005).
func ConvertToObservation ¶
func ConvertToObservation(xo XMLObservation, project string) *models.ParsedObservation
ConvertToObservation converts an XMLObservation to a ParsedObservation.
Types ¶
type ValidationResult ¶
type ValidationResult struct {
ObservationCount int
ValidCount int
Errors []string
IsNoObservations bool
IsMalformedXML bool
Observations []XMLObservation
}
ValidationResult holds the result of validating LLM XML output.
func ValidateXML ¶
func ValidateXML(raw string) ValidationResult
ValidateXML parses and validates the XML output from the LLM.
type XMLObservation ¶
type XMLObservation struct {
Type string `xml:"type"`
Outcome string `xml:"outcome"`
Title string `xml:"title"`
Narrative string `xml:"narrative"`
Concepts xmlConcepts `xml:"concepts"`
Files xmlFiles `xml:"files"`
}
XMLObservation represents a single observation parsed from LLM XML output.