Skip to documentation
Docs navigation
Docs/Messages are the raw source of conversation memory
Core concepts

Messages are the raw source of conversation memory.

A message is one system, user, or assistant turn that can be stored in the message buffer and used for segmentation.

Why messages matter

Messages are the only part of the system that exactly mirrors the chat transcript. MemoGrafter keeps them as source material, then derives more durable graph memory from them in the background.

A developer usually touches messages through invoke(), getHistory(), or direct ingestion tests. Most long-term behavior comes from the graph records created from these turns, not from replaying every raw message forever.

Shape

types.ts
// Messages preserve the original chat turn before graph memory is derived.
export interface Message {
  role: "system" | "user" | "assistant";
  content: string;
}

How MemoGrafter uses messages

The message buffer acts like an append-only staging area. The ingestion cursor records which ranges have already been processed so queue retries and repeated invokes do not duplicate graph memory.

MemoGrafterAgent keeps public chat history for the current session.
Ingestion stores messages in mg_message_buffer.
The ingest cursor tracks which message ranges have already produced graph memory.
Invoke-time prompts use recalled facts plus a recent raw history window.