Documentation
¶
Overview ¶
Package reflection implements the Engram Reflection Engine v1.
The Reflection Engine periodically synthesizes high-level insights from unreflected memories, inspired by the Generative Agents paper. It runs lighter and more frequently than the Dream Engine (1-3x/day vs 1x/day), and focuses on cross-domain pattern discovery rather than same-tag dedup.
Trigger: accumulated importance of unreflected memories >= threshold (default: 50). Min interval: 2h. Max per day: 3 runs.
Output: TypeInsight memories with source="system", tagged with metadata.reflection_source_ids and metadata.reflected=true on source memories.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type CheckResult ¶
type CheckResult struct {
ShouldTrigger bool `json:"should_trigger"`
SkipReason string `json:"skip_reason,omitempty"`
UnreflectedCount int `json:"unreflected_count"`
AccumulatedImportance float64 `json:"accumulated_importance"`
Threshold float64 `json:"threshold"`
HoursSinceLastRun float64 `json:"hours_since_last_run"`
RunsToday int `json:"runs_today"`
}
CheckResult is the output of a trigger check.
type Config ¶
type Config struct {
// Threshold is the cumulative importance of unreflected memories required
// to trigger a reflection run. Default: 50.
Threshold float64
// MaxInputSize is the maximum number of memories to feed into one reflection
// cycle. Default: 20.
MaxInputSize int
// MinIntervalH is the minimum hours between reflection runs. Default: 2.
MinIntervalH float64
// DryRun disables all writes (no new insights, no marking as reflected).
DryRun bool
}
Config holds Reflection Engine runtime configuration.
func DefaultConfig ¶
func DefaultConfig() Config
DefaultConfig returns the default Reflection Engine configuration.
type Engine ¶
type Engine struct {
// contains filtered or unexported fields
}
Engine orchestrates the reflection cycle.
type ParsedInsight ¶
ParsedInsight holds a single parsed insight from Haiku's response.
type RunResult ¶
type RunResult struct {
Triggered bool `json:"triggered"`
SkipReason string `json:"skip_reason,omitempty"`
InputCount int `json:"input_count"`
InsightsCreated int `json:"insights_created"`
SourcesMarked int `json:"sources_marked"`
Duration string `json:"duration"`
TriggerImportance float64 `json:"trigger_importance,omitempty"`
DryRun bool `json:"dry_run"`
Errors []string `json:"errors,omitempty"`
}
RunResult holds the output of a single reflection run.