Documentation
¶
Index ¶
- Constants
- func NewBuiltinHandler(cfg Config) (scheduler.OnJobFunc, error)
- type CandidateGateConfig
- type CandidateGateDecision
- type CandidateGateInput
- type CandidateGateResult
- type CandidateGateSettings
- type CandidateRef
- type Config
- type RecentlyForgottenItems
- type RecentlyForgottenKnowledgeItem
- type RecentlyForgottenQuery
- type RejectReason
- type RestoreForgottenRequest
- type RestoreForgottenResult
- type ReviewSkip
- type ReviewSkipReason
- type ReviewUnit
- type SQLForgottenRestoreService
- type SQLRecentlyForgottenStore
- type Service
- type Store
- type UsageCuratorMode
- type UsageCuratorSettings
- type UsageCuratorStore
Constants ¶
const BuiltinJobName = "reflect-review"
BuiltinJobName is the scheduler builtin name reflect registers under. Exported so gateway wiring and operational tooling refer to one source.
const ( // RecentlyForgottenKindKnowledge identifies Reflect-owned world facts that // the usage curator deprecated. RecentlyForgottenKindKnowledge = "knowledge" )
Variables ¶
This section is empty.
Functions ¶
func NewBuiltinHandler ¶ added in v0.38.0
NewBuiltinHandler returns a scheduler.OnJobFunc that runs one reflect review cycle per fire. Cycle-level failures (store errors, ctx cancellation) surface as errors so the scheduler marks the run errored. Per-agent failures are still logged inside the service and do not fail the run.
Types ¶
type CandidateGateConfig ¶ added in v0.60.0
type CandidateGateDecision ¶ added in v0.60.0
type CandidateGateDecision struct {
Ref CandidateRef
NormalizedOverall float64
Scores map[string]int
Reason RejectReason
}
type CandidateGateInput ¶ added in v0.60.0
type CandidateGateInput struct {
Ref CandidateRef
Content string
Scores map[string]int
}
type CandidateGateResult ¶ added in v0.60.0
type CandidateGateResult struct {
Accepted []CandidateGateDecision
Rejected []CandidateGateDecision
}
type CandidateGateSettings ¶ added in v0.60.0
type CandidateGateSettings struct {
FactWeights map[string]float64
FactThreshold float64
FactSubjectCap int
SkillWeights map[string]float64
SkillThreshold float64
SkillCandidateCap int
}
CandidateGateSettings keeps #532 score gates configurable without exposing a persistent confidence field or coupling thresholds to prompt text.
type CandidateRef ¶ added in v0.60.0
type CandidateRef string
CandidateRef is a stable in-review identifier assigned after generation. It is intentionally sequential in #532; hash-based refs are deferred.
type Config ¶
type Config struct {
StateStore pkgplugins.StateStore
Memory memory.Provider
Store Store
SkillStore pkgplugins.SkillStore
// SkillAuthorizer applies Skill domain rules to reflect's staged writes (the
// reconciliation-plan/usage-curator path); when nil those fail closed.
SkillAuthorizer skillWriteAuthorizer
UsageCuratorStore UsageCuratorStore
Log *slog.Logger
Providers func(api, apiKey, baseURL string) (providers.StreamFunc, error)
CandidateGates CandidateGateSettings
// UsageCuratorSettings defaults to armed. Operators may switch to shadow to
// stop lifecycle writes while keeping scans and telemetry active.
UsageCuratorSettings UsageCuratorSettings
// Services provides per-agent session registries for review target listing.
// When set, reflect uses Registry.ListForReview and Registry.MemoryScope
// instead of calling memory.SessionManager directly.
Services agent.ServiceManager
}
Config holds dependencies for the reflect service.
type RecentlyForgottenItems ¶ added in v0.60.0
type RecentlyForgottenItems struct {
Knowledge []RecentlyForgottenKnowledgeItem
}
RecentlyForgottenItems contains the restorable curator-deprecated records.
type RecentlyForgottenKnowledgeItem ¶ added in v0.60.0
type RecentlyForgottenKnowledgeItem struct {
Kind string
FactID string
Content string
DeprecatedAt time.Time
CuratorRule string
LastUsedAt string
MemoryVersionAfterDeprecate int64
DeprecatedChangelogID string
}
RecentlyForgottenKnowledgeItem includes fact content so an admin can inspect exactly what would be restored.
type RecentlyForgottenQuery ¶ added in v0.60.0
RecentlyForgottenQuery scopes the internal/admin listing to one user-agent pair. Empty Kind returns Knowledge.
type RejectReason ¶ added in v0.60.0
type RejectReason string
type RestoreForgottenRequest ¶ added in v0.60.0
type RestoreForgottenRequest struct {
Kind string
ID string
UserID string
AgentID string
RestoredBy string
Reason string
}
RestoreForgottenRequest identifies one curator-deprecated record to restore.
type RestoreForgottenResult ¶ added in v0.60.0
RestoreForgottenResult returns the restored Knowledge item.
type ReviewSkip ¶ added in v0.60.0
type ReviewSkipReason ¶ added in v0.60.0
type ReviewSkipReason string
type ReviewUnit ¶ added in v0.60.0
type ReviewUnit struct {
Text string
LastIncludedAt time.Time
LastIncludedSeq int64
// Truncated means more fresh content exists after LastIncluded*, but it did
// not fit in this bounded window and must be picked up by a later cycle.
Truncated bool
Skipped []ReviewSkip
FreshCount int
PrivateOneToOne bool
SkillUsage []reviewSkillUsage
}
ReviewUnit is the bounded, fresh conversation window consumed by candidate generators. It keeps the watermark boundary explicit so each reflect line can advance independently after a successful review.
type SQLForgottenRestoreService ¶ added in v0.60.0
type SQLForgottenRestoreService struct {
// contains filtered or unexported fields
}
SQLForgottenRestoreService provides the internal/admin restore path for items returned by SQLRecentlyForgottenStore.
func NewSQLForgottenRestoreService ¶ added in v0.60.0
func NewSQLForgottenRestoreService(db *pgxpool.Pool, q *sqlc.Queries) SQLForgottenRestoreService
func (SQLForgottenRestoreService) RestoreForgotten ¶ added in v0.60.0
func (s SQLForgottenRestoreService) RestoreForgotten(ctx context.Context, in RestoreForgottenRequest) (RestoreForgottenResult, error)
RestoreForgotten is the internal/admin restore entrypoint for curator-deprecated Reflect-owned knowledge. It does not expose a user-facing API by itself; callers still decide authentication and authorization.
type SQLRecentlyForgottenStore ¶ added in v0.60.0
type SQLRecentlyForgottenStore struct {
// contains filtered or unexported fields
}
SQLRecentlyForgottenStore lists curator-deprecated Reflect records that are eligible for internal/admin restore.
func NewSQLRecentlyForgottenStore ¶ added in v0.60.0
func NewSQLRecentlyForgottenStore(q *sqlc.Queries) SQLRecentlyForgottenStore
func (SQLRecentlyForgottenStore) ListRecentlyForgotten ¶ added in v0.60.0
func (s SQLRecentlyForgottenStore) ListRecentlyForgotten(ctx context.Context, query RecentlyForgottenQuery) (RecentlyForgottenItems, error)
ListRecentlyForgotten returns only records whose latest deprecate changelog was written by the usage curator.
type Service ¶
type Service struct {
// contains filtered or unexported fields
}
Service runs background conversation review.
func (*Service) ReviewConversationReconciledCandidates ¶ added in v0.60.0
func (s *Service) ReviewConversationReconciledCandidates(ctx context.Context, snap *config.Snapshot, target reviewTarget) (candidatePipelineResult, error)
ReviewConversationReconciledCandidates runs structured candidate generation, evaluation, reconciliation, and writes. A line advances only after all work for that line completes.
func (*Service) RunOnce ¶
RunOnce executes the scheduler-owned review cycle across all enabled agents. Production and immediate operator runs must go through the registered scheduler builtin (using scheduler.RunJobNow for the latter) so concurrency control and run records are preserved. It returns the first cycle-level error; per-agent failures are logged inside runCycle and do not surface here.
type Store ¶ added in v0.38.0
type Store interface {
ListEnabledAgents(ctx context.Context) ([]config.Agent, error)
Snapshot(ctx context.Context, agentID string) (*config.Snapshot, error)
}
Store is the read-only subset of config.Store reflect needs to run a review cycle. Narrowed from config.Store so dispatcher tests can supply a fake without implementing the full config surface; satisfied by config.Store via structural typing.
type UsageCuratorMode ¶ added in v0.60.0
type UsageCuratorMode string
const ( UsageCuratorModeShadow UsageCuratorMode = "shadow" UsageCuratorModeArmed UsageCuratorMode = "armed" )
type UsageCuratorSettings ¶ added in v0.60.0
type UsageCuratorStore ¶ added in v0.60.0
type UsageCuratorStore interface {
ListReflectUsagePairs(ctx context.Context) ([]usageCuratorPair, error)
ListStaleReflectKnowledge(ctx context.Context, q usageCuratorKnowledgeQuery) ([]usageCuratorKnowledgeCandidate, error)
ListStaleReflectSkills(ctx context.Context, q usageCuratorSkillQuery) ([]usageCuratorSkillCandidate, error)
}
func NewSQLUsageCuratorStore ¶ added in v0.60.0
func NewSQLUsageCuratorStore(q *sqlc.Queries) UsageCuratorStore
func NewSQLUsageCuratorStoreForPool ¶ added in v0.60.0
func NewSQLUsageCuratorStoreForPool(pool *pgxpool.Pool) UsageCuratorStore
NewSQLUsageCuratorStoreForPool builds a UsageCuratorStore backed by the given connection pool, owning construction of its sqlc query set.
Source Files
¶
- candidate_gate_settings.go
- candidate_pipeline.go
- candidate_runner.go
- candidate_tools.go
- candidate_types.go
- capture.go
- conversation_review.go
- dispatcher.go
- fact_candidates.go
- fact_reconciliation.go
- fact_reconciliation_execute.go
- forgotten_restore.go
- gates.go
- loop.go
- prompts.go
- recently_forgotten.go
- reconciliation_capture.go
- reconciliation_pipeline.go
- reconciliation_runner.go
- reconciliation_service.go
- related_bundle.go
- related_discovery.go
- review_agent_cursor.go
- review_targets.go
- review_unit.go
- service.go
- skill_candidates.go
- skill_reconciliation.go
- skill_reconciliation_execute.go
- store.go
- trace.go
- usage_curator.go
- usage_curator_service.go
- usage_curator_sql.go
- watermark.go