conflict

package
v0.1.3 Latest Latest
Warning

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

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

Documentation

Overview

Package conflict detects and resolves contradictory memories. When a new memory contradicts an existing one (same entity/topic, different fact), the old memory is auto-superseded. Based on Mem0's conflict resolution approach.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ContradictionDetail

type ContradictionDetail struct {
	OldNodeID    string   `json:"old_node_id"`
	NewNodeID    string   `json:"new_node_id"`
	OverlapRatio float64  `json:"overlap_ratio"`
	Signals      []string `json:"signals"`
	Confidence   float64  `json:"confidence"`
}

ContradictionDetail provides structured information about a detected contradiction.

type Resolver

type Resolver struct {
	// contains filtered or unexported fields
}

Resolver detects and resolves memory conflicts.

func New

func New(store storage.Storage) *Resolver

func (*Resolver) CheckAndResolve

func (r *Resolver) CheckAndResolve(ctx context.Context, newNode *storage.Node) ([]string, error)

CheckAndResolve checks if a new node contradicts existing nodes. If a contradiction is found, creates a supersedes edge and lowers the old node's confidence. Returns the list of superseded node IDs.

func (*Resolver) DetectContradictions

func (r *Resolver) DetectContradictions(ctx context.Context, newNode *storage.Node) ([]ContradictionDetail, error)

DetectContradictions performs deep contradiction analysis between a new node and existing nodes. Unlike CheckAndResolve (which auto-supersedes), this method returns structured details about each detected contradiction for callers that need richer information (e.g., UI display, audit logging).

Jump to

Keyboard shortcuts

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