Documentation
¶
Overview ¶
Package instincts provides parsing and importing of ECC instinct files.
Index ¶
- func ConvertToObservation(inst *Instinct) *models.ParsedObservation
- func DefaultBaseDir() (string, error)
- func InstinctImportanceScore(confidence float64) float64
- func IsDuplicate(ctx context.Context, vectorClient vector.Client, title string, ...) (bool, error)
- func ResolveDir(requested string) (string, error)
- type ImportResult
- type Instinct
- type InstinctFile
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ConvertToObservation ¶
func ConvertToObservation(inst *Instinct) *models.ParsedObservation
ConvertToObservation maps an instinct to a parsed guidance observation suitable for storage via ObservationStore.StoreObservation.
func DefaultBaseDir ¶
DefaultBaseDir returns the default base directory for instinct files: ~/.claude/homunculus/instincts/
func InstinctImportanceScore ¶
InstinctImportanceScore returns the importance score derived from an instinct's confidence value. The returned score is in the [0, 1] range, consistent with the system-wide importance score convention.
func IsDuplicate ¶
func IsDuplicate(ctx context.Context, vectorClient vector.Client, title string, threshold float64) (bool, error)
IsDuplicate checks if an observation with similar content already exists. It performs a vector similarity query filtered to observation vectors only, and returns true if a result with similarity >= threshold is found. Returns an error if vectorClient is nil, since without dedup the import cannot guarantee idempotency.
func ResolveDir ¶
ResolveDir validates and resolves a requested path against the allowed base directory. If requested is empty, returns the base directory. Returns an error if the resolved path escapes the base directory.
Types ¶
type ImportResult ¶
type ImportResult struct {
Total int `json:"total"`
Imported int `json:"imported"`
Skipped int `json:"skipped"`
Errors []string `json:"errors,omitempty"`
}
ImportResult summarizes the outcome of an import operation.
func Import ¶
func Import(ctx context.Context, dir string, vectorClient vector.Client, obsStore *gorm.ObservationStore) (*ImportResult, error)
Import reads all instinct files from dir, deduplicates, and creates observations.
func ImportFromContent ¶ added in v0.4.0
func ImportFromContent(ctx context.Context, files []InstinctFile, vectorClient vector.Client, obsStore *gorm.ObservationStore) (*ImportResult, error)
ImportFromContent imports instincts from file content sent over the wire. This is the client-server counterpart to Import() which reads from disk.
type Instinct ¶
type Instinct struct {
ID string `yaml:"id"`
Trigger string `yaml:"trigger"`
Confidence float64 `yaml:"confidence"`
Domain string `yaml:"domain"`
Source string `yaml:"source"`
Body string `yaml:"-"`
FilePath string `yaml:"-"`
}
Instinct represents a parsed ECC instinct file.
func ParseContent ¶ added in v0.4.0
ParseContent parses a single instinct from its raw markdown content.
type InstinctFile ¶ added in v0.4.0
InstinctFile represents a single instinct file sent over the wire.