extract

package
v0.4.0 Latest Latest
Warning

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

Go to latest
Published: Mar 14, 2026 License: MIT Imports: 4 Imported by: 0

Documentation

Overview

Package extract provides LLM-based observation extraction and XML validation for session backfill.

Index

Constants

View Source
const SystemPrompt = `` /* 1398-byte string literal not displayed */

SystemPrompt is the frozen poc-v1 extraction prompt for historical sessions.

View Source
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

View Source
var ValidOutcomes = map[string]bool{
	"active_pattern": true, "failed_experiment": true, "superseded": true,
}

ValidOutcomes contains allowed outcome classification values.

View Source
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

func BuildAlreadyExtracted(titles []string) string

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.

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.

Jump to

Keyboard shortcuts

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