Skip to content

Function: clearHistory()

clearHistory(opts): Promise<{ cleared: number; }>

Wipe every persisted message tied to a thread. Returns the count of messages that were on the thread at delete time so the caller can render a “cleared N messages” affordance without an additional round-trip.

Agents without a configured Memory resolve to a no-op (count 0), matching loadHistory’s “stateless agents return an empty page” stance so callers don’t have to special-case them. Threads that don’t exist yet are also a successful no-op - the operation is idempotent so the UI can fire-and-forget without tracking thread existence.

ClearHistoryOptions

Promise<{ cleared: number; }>