Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
var ( // ErrTiebreakerDisabled tells the rule-first controller to keep its // deterministic ambiguity fallback without recording a failed model call. ErrTiebreakerDisabled = errors.New("memory controller: tiebreaker is disabled") )
Functions ¶
func CandidateHash ¶
func CandidateHash(candidate memcontract.Candidate) string
CandidateHash returns the stable hash used for decision audit rows.
func FrontmatterHash ¶
func FrontmatterHash(header memcontract.Header) string
FrontmatterHash returns a stable hash for a decision's frontmatter material.
func IdempotencyKey ¶
func IdempotencyKey(decision memcontract.Decision) string
IdempotencyKey returns the write-ahead-log uniqueness key for a decision.
Types ¶
type Controller ¶
type Controller struct {
// contains filtered or unexported fields
}
Controller decides Memory v2 write outcomes with deterministic Slice 1 rules.
func New ¶
func New(index TargetIndex, opts ...Option) *Controller
New constructs a rule-first controller over the provided target index.
func (*Controller) Decide ¶
func (c *Controller) Decide(ctx context.Context, candidate memcontract.Candidate) (memcontract.Decision, error)
Decide returns a deterministic Decision. Mutation and WAL persistence are owned by Store.ApplyDecision.
type Option ¶
type Option func(*Controller)
Option customizes a Controller.
func WithDefaultOpOnFail ¶
func WithDefaultOpOnFail(op memcontract.Op) Option
WithDefaultOpOnFail selects the deterministic operation used when the configured tiebreaker fails. Only noop and reject are safe failure outcomes.
func WithPromptVersion ¶
WithPromptVersion pins the decision prompt version recorded in WAL rows.
func WithTiebreaker ¶
func WithTiebreaker(tiebreaker Tiebreaker) Option
WithTiebreaker installs the bounded model call used only for genuine ambiguity.
type Target ¶
type Target struct {
ID string
WorkspaceID string
Scope memcontract.Scope
AgentName string
AgentTier memcontract.AgentTier
TargetFilename string
Frontmatter memcontract.Header
Entity string
Attribute string
Content string
RawContent string
ContentHash string
LastUpdatedAt time.Time
}
Target is one existing curated memory entry visible to the controller.
type TargetIndex ¶
type TargetIndex interface {
ListTargets(ctx context.Context, candidate memcontract.Candidate) ([]Target, error)
}
TargetIndex supplies current curated memory candidates for rule decisions.
type Tiebreaker ¶
type Tiebreaker interface {
BreakTie(context.Context, TiebreakerRequest) (TiebreakerResult, error)
}
Tiebreaker resolves only genuine ambiguity left by deterministic rules.
type TiebreakerRequest ¶
type TiebreakerRequest struct {
Candidate memcontract.Candidate
Targets []Target
RuleTrace []memcontract.RuleHit
}
TiebreakerRequest contains the bounded ambiguity context supplied to a model.
type TiebreakerResult ¶
type TiebreakerResult struct {
Op memcontract.Op
TargetID string
Confidence float32
Reason string
Call *memcontract.LLMCall
}
TiebreakerResult is the validated semantic result of one model call.