Skip to main content

Overview

When RecallrAI processes sessions, it may detect conflicts between new memories and existing ones. The SDK provides tools to handle these merge conflicts through clarifying questions.

List Merge Conflicts

import { MergeConflictStatus } from "recallrai";

const user = await client.getUser("user123");
const conflicts = await user.listMergeConflicts({
  offset: 0,
  limit: 10,
  status: MergeConflictStatus.PENDING,
  sortBy: "created_at",
  sortOrder: "desc",
});

console.log(`Total conflicts: ${conflicts.total}`);
status
MergeConflictStatus
Filter by status: PENDING, IN_QUEUE, RESOLVING, RESOLVED, or FAILED.

Resolve a Merge Conflict

import { MergeConflictAnswer } from "recallrai";

const conflict = await user.getMergeConflict("conflict-uuid");
const answers: MergeConflictAnswer[] = conflict.clarifyingQuestions.map((q) => ({
  question: q.question,
  answer: q.options[0],
  message: "User prefers this option based on recent conversation",
}));

await conflict.resolve(answers);
Raises: MergeConflictNotFoundError, MergeConflictAlreadyResolvedError, MergeConflictInvalidQuestionsError, MergeConflictMissingAnswersError, MergeConflictInvalidAnswerError.

MergeConflict Object Fields

Each conflict object contains:
  • id: Unique conflict identifier
  • projectUserSessionId: Session that triggered the conflict
  • proposedMemoryContent: The proposed memory content that caused the conflict (optional)
  • conflictingMemories: Array of existing memories that conflict, each containing:
    • memoryId: ID of the conflicting memory
    • content: Memory content
    • reason: Why this memory conflicts with the new one
    • eventDateStart: UTC Date when the event started
    • eventDateEnd: UTC Date when the event ended
    • createdAt: UTC Date when the memory was recorded
  • clarifyingQuestions: Array of questions to help resolve the conflict, each containing:
    • question: The question text
    • options: Array of possible answer strings
  • status: Current conflict status (PENDING, IN_QUEUE, RESOLVING, RESOLVED, FAILED)
  • createdAt: UTC Date when the conflict was created
  • resolvedAt: UTC Date when resolved (optional)