Skip to content

ContradictionDetectionService

Defined in: packages/memory-ltm/src/contradiction-detection.service.ts:10

new ContradictionDetectionService(): ContradictionDetectionService

Defined in: packages/memory-ltm/src/contradiction-detection.service.ts:15

ContradictionDetectionService

annotateContradicted(metadata, counterpartId, reason): Record<string, unknown>

Defined in: packages/memory-ltm/src/contradiction-detection.service.ts:108

Annotate a memory as contradicted-but-kept (G3-T4, policy flag). Applied symmetrically to BOTH rows of a contradicted pair; each points at its counterpart. Unlike supersededBy, this never hides the row — the recall filter keys on supersededBy/status === 'superseded' only, so a contradicted row still surfaces, carrying the review fields. As with the decay-rewritten status for superseded rows, contradictionWith is the durable marker: status may later be recomputed by the importance/decay pass, but the review fields are written once and never cleared.

Record<string, unknown> | null | undefined

string

string

Record<string, unknown>


annotateContradictor(metadata, match, existingContentSummary): Record<string, unknown>

Defined in: packages/memory-ltm/src/contradiction-detection.service.ts:61

Annotate the new memory’s metadata to record the contradiction it introduces.

Record<string, unknown> | null | undefined

ContradictionMatch

string

Record<string, unknown>


annotateSuperseded(metadata, supersededById, reason): Record<string, unknown>

Defined in: packages/memory-ltm/src/contradiction-detection.service.ts:85

Annotate the old memory’s metadata to record that it was superseded.

Record<string, unknown> | null | undefined

string

string

Record<string, unknown>


detect(newContent, candidates): ContradictionMatch | null

Defined in: packages/memory-ltm/src/contradiction-detection.service.ts:41

Find the first candidate that contradicts newContent using heuristics.

Candidates are filtered to the [thresholdLow, thresholdHigh) similarity band before heuristic checks run — high similarity ensures shared subject matter while staying below the duplicate zone.

The match’s action reflects the boot-configured policy (G3-T4): flagged under flag (default — both rows kept and marked), superseded under supersede (latest-wins).

string

ContradictionCandidate[]

ContradictionMatch | null


getHighThreshold(): number

Defined in: packages/memory-ltm/src/contradiction-detection.service.ts:125

number


getLowThreshold(): number

Defined in: packages/memory-ltm/src/contradiction-detection.service.ts:121

number


getPolicy(): ContradictionPolicy

Defined in: packages/memory-ltm/src/contradiction-detection.service.ts:129

ContradictionPolicy