Skip to main content

Memory API

Memory API

import { CodeBoltClient } from '@codebolt/clientsdk';

const client = new CodeBoltClient();

Quick Reference

MethodDescription
addEpisodicEventsAppends new events to an episodic memory.
archiveContextThreadArchives a context thread to remove it from active listings.
archiveEpisodicMemoryArchives an episodic memory to remove it from active listings.
archiveJsonThreadArchives a JSON thread to remove it from active listings.
archiveMarkdownThreadArchives a markdown thread to remove it from active listings.
archiveThreadArchives a generic memory thread to remove it from active listings.
createContextThreadCreates a new context memory thread.
createEpisodicMemoryCreates a new episodic memory for tracking temporal events and experiences.
createJsonThreadCreates a new JSON-formatted memory thread.
createMarkdownThreadCreates a new markdown-formatted memory thread.
createThreadCreates a new generic memory thread.
getContextThreadRetrieves a specific context thread by its unique identifier.
getEpisodicAgentsRetrieves the distinct agents that have contributed events to an episodic memory.
getEpisodicEventsRetrieves events from an episodic memory with optional filtering.
getEpisodicEventTypesRetrieves the distinct event types used in an episodic memory.
getEpisodicMemoryRetrieves a specific episodic memory by its unique identifier.
getEpisodicTagsRetrieves the distinct tags applied to events in an episodic memory.
getJsonThreadRetrieves a specific JSON thread by its unique identifier.
getMarkdownThreadRetrieves a specific markdown thread by its unique identifier.
getThreadRetrieves a specific memory thread by its unique identifier.
listContextThreadsLists all context memory threads with optional filtering.
listEpisodicMemoriesLists all episodic memories with optional filtering.
listJsonThreadsLists all JSON memory threads with optional filtering.
listMarkdownThreadsLists all markdown memory threads with optional filtering.
listThreadsLists all generic memory threads with optional filtering.
saveContextFromChatSaves context extracted from a chat conversation into a context thread.
summarizeContextThreadGenerates a summary of the context stored in a thread.
unarchiveEpisodicMemoryRestores an archived episodic memory back to active status.
unarchiveJsonThreadRestores an archived JSON thread back to active status.
unarchiveMarkdownThreadRestores an archived markdown thread back to active status.
updateContextThreadUpdates the metadata of a context thread.
updateEpisodicMemoryUpdates the metadata of an episodic memory.
updateJsonThreadUpdates the metadata of a JSON thread (name, tags, etc.).
updateJsonThreadDataReplaces the JSON data payload of a thread.
updateMarkdownThreadUpdates the metadata of a markdown thread (name, tags, etc.).
updateMarkdownThreadContentReplaces the markdown content of a thread.
updateThreadUpdates the metadata or content of a generic memory thread.

Methods


addEpisodicEvents

client.memory.addEpisodicEvents(id: string, data: AddEpisodicEventsRequest): Promise<unknown>

Appends new events to an episodic memory.

Adds one or more event records to the episodic memory's timeline. Events capture discrete actions, observations, or state changes that occurred during an operation.

ParameterTypeRequiredDescription
idstringYesThe unique identifier of the episodic memory
dataAddEpisodicEventsRequestYesThe events to add

Returns: Promise<unknown> — A promise that resolves when the events have been added

Full reference →


archiveContextThread

client.memory.archiveContextThread(threadId: string): Promise<unknown>

Archives a context thread to remove it from active listings.

ParameterTypeRequiredDescription
threadIdstringYesThe unique identifier of the context thread to archive

Returns: Promise<unknown> — A promise that resolves when the thread has been archived

Full reference →


archiveEpisodicMemory

client.memory.archiveEpisodicMemory(id: string): Promise<unknown>

Archives an episodic memory to remove it from active listings.

ParameterTypeRequiredDescription
idstringYesThe unique identifier of the episodic memory to archive

Returns: Promise<unknown> — A promise that resolves when the memory has been archived

Full reference →


archiveJsonThread

client.memory.archiveJsonThread(threadId: string): Promise<unknown>

Archives a JSON thread to remove it from active listings.

ParameterTypeRequiredDescription
threadIdstringYesThe unique identifier of the JSON thread to archive

Returns: Promise<unknown> — A promise that resolves when the thread has been archived

Full reference →


archiveMarkdownThread

client.memory.archiveMarkdownThread(threadId: string): Promise<unknown>

Archives a markdown thread to remove it from active listings.

ParameterTypeRequiredDescription
threadIdstringYesThe unique identifier of the markdown thread to archive

Returns: Promise<unknown> — A promise that resolves when the thread has been archived

Full reference →


archiveThread

client.memory.archiveThread(threadId: string): Promise<unknown>

Archives a generic memory thread to remove it from active listings.

Moves the thread to an archived state where it is preserved but hidden from default queries. Archived threads can be restored later.

ParameterTypeRequiredDescription
threadIdstringYesThe unique identifier of the thread to archive

Returns: Promise<unknown> — A promise that resolves when the thread has been archived

Full reference →


createContextThread

client.memory.createContextThread(data: CreateContextThreadRequest): Promise<MemoryThread>

Creates a new context memory thread.

Initializes a thread designed to capture and store conversational context. Context threads preserve the state and knowledge gathered during chat interactions for later recall and summarization.

ParameterTypeRequiredDescription
dataCreateContextThreadRequestYesThe context thread creation payload

Returns: Promise<MemoryThread> — A promise that resolves to the newly created context thread

Full reference →


createEpisodicMemory

client.memory.createEpisodicMemory(data: CreateEpisodicMemoryRequest): Promise<MemoryThread>

Creates a new episodic memory for tracking temporal events and experiences.

Episodic memories store sequences of events that occurred during agent operations, similar to how human episodic memory records experiences. They are useful for learning from past actions and debugging agent behavior.

ParameterTypeRequiredDescription
dataCreateEpisodicMemoryRequestYesThe episodic memory creation payload

Returns: Promise<MemoryThread> — A promise that resolves to the newly created episodic memory thread

Full reference →


createJsonThread

client.memory.createJsonThread(data: CreateJsonThreadRequest): Promise<MemoryThread>

Creates a new JSON-formatted memory thread.

Initializes a thread optimized for storing structured JSON data. JSON threads are ideal for configuration, structured records, and data that needs programmatic access.

ParameterTypeRequiredDescription
dataCreateJsonThreadRequestYesThe JSON thread creation payload

Returns: Promise<MemoryThread> — A promise that resolves to the newly created JSON thread

Full reference →


createMarkdownThread

client.memory.createMarkdownThread(data: CreateMarkdownThreadRequest): Promise<MemoryThread>

Creates a new markdown-formatted memory thread.

Initializes a thread optimized for storing and rendering markdown content. Markdown threads are ideal for notes, documentation, and free-form text with formatting.

ParameterTypeRequiredDescription
dataCreateMarkdownThreadRequestYesThe markdown thread creation payload

Returns: Promise<MemoryThread> — A promise that resolves to the newly created markdown thread

Full reference →


createThread

client.memory.createThread(data: CreateMemoryThreadRequest): Promise<MemoryThread>

Creates a new generic memory thread.

Initializes a memory thread that can store arbitrary content. Generic threads are the base type from which specialized thread types (markdown, JSON, context) derive.

ParameterTypeRequiredDescription
dataCreateMemoryThreadRequestYesThe thread creation payload

Returns: Promise<MemoryThread> — A promise that resolves to the newly created memory thread

Full reference →


getContextThread

client.memory.getContextThread(threadId: string): Promise<MemoryThread>

Retrieves a specific context thread by its unique identifier.

Returns the full context thread including captured conversation data and metadata.

ParameterTypeRequiredDescription
threadIdstringYesThe unique identifier of the context thread to retrieve

Returns: Promise<MemoryThread> — A promise that resolves to the context memory thread

Full reference →


getEpisodicAgents

client.memory.getEpisodicAgents(id: string): Promise<string[]>

Retrieves the distinct agents that have contributed events to an episodic memory.

Returns the unique set of agent identifiers that recorded events in this memory.

ParameterTypeRequiredDescription
idstringYesThe unique identifier of the episodic memory

Returns: Promise<string[]> — A promise that resolves to an array of agent identifier strings

Full reference →


getEpisodicEvents

client.memory.getEpisodicEvents(id: string, params?: EpisodicEventsParams): Promise<unknown>

Retrieves events from an episodic memory with optional filtering.

Returns the sequence of events stored in the episodic memory, optionally filtered by event type, date range, or agent.

ParameterTypeRequiredDescription
idstringYesThe unique identifier of the episodic memory
paramsEpisodicEventsParamsNoOptional parameters to filter events

Returns: Promise<unknown> — A promise that resolves to the filtered list of events

Full reference →


getEpisodicEventTypes

client.memory.getEpisodicEventTypes(id: string): Promise<string[]>

Retrieves the distinct event types used in an episodic memory.

Returns the unique set of event type strings present in the memory, useful for building filter UIs or understanding the kinds of events that were recorded.

ParameterTypeRequiredDescription
idstringYesThe unique identifier of the episodic memory

Returns: Promise<string[]> — A promise that resolves to an array of event type strings

Full reference →


getEpisodicMemory

client.memory.getEpisodicMemory(id: string): Promise<MemoryThread>

Retrieves a specific episodic memory by its unique identifier.

Returns the episodic memory metadata. Use to access the individual events stored within the memory.

ParameterTypeRequiredDescription
idstringYesThe unique identifier of the episodic memory to retrieve

Returns: Promise<MemoryThread> — A promise that resolves to the episodic memory thread

Full reference →


getEpisodicTags

client.memory.getEpisodicTags(id: string): Promise<string[]>

Retrieves the distinct tags applied to events in an episodic memory.

Returns the unique set of tag strings used across all events in the memory.

ParameterTypeRequiredDescription
idstringYesThe unique identifier of the episodic memory

Returns: Promise<string[]> — A promise that resolves to an array of tag strings

Full reference →


getJsonThread

client.memory.getJsonThread(threadId: string): Promise<MemoryThread>

Retrieves a specific JSON thread by its unique identifier.

Returns the full JSON thread including its stored data payload and metadata.

ParameterTypeRequiredDescription
threadIdstringYesThe unique identifier of the JSON thread to retrieve

Returns: Promise<MemoryThread> — A promise that resolves to the JSON memory thread

Full reference →


getMarkdownThread

client.memory.getMarkdownThread(threadId: string): Promise<MemoryThread>

Retrieves a specific markdown thread by its unique identifier.

Returns the full markdown thread including its rendered content and metadata.

ParameterTypeRequiredDescription
threadIdstringYesThe unique identifier of the markdown thread to retrieve

Returns: Promise<MemoryThread> — A promise that resolves to the markdown memory thread

Full reference →


getThread

client.memory.getThread(threadId: string): Promise<MemoryThread>

Retrieves a specific memory thread by its unique identifier.

Returns the full thread object including metadata, content references, and status.

ParameterTypeRequiredDescription
threadIdstringYesThe unique identifier of the thread to retrieve

Returns: Promise<MemoryThread> — A promise that resolves to the memory thread details

Full reference →


listContextThreads

client.memory.listContextThreads(params?: ListMemoryThreadsParams): Promise<MemoryThread[]>

Lists all context memory threads with optional filtering.

Returns only threads of the context type, filtered by the provided parameters.

ParameterTypeRequiredDescription
paramsListMemoryThreadsParamsNoOptional filtering and pagination parameters

Returns: Promise<MemoryThread[]> — A promise that resolves to an array of context memory threads

Full reference →


listEpisodicMemories

client.memory.listEpisodicMemories(params?: ListMemoryThreadsParams): Promise<MemoryThread[]>

Lists all episodic memories with optional filtering.

Returns episodic memory records that match the provided criteria.

ParameterTypeRequiredDescription
paramsListMemoryThreadsParamsNoOptional filtering and pagination parameters

Returns: Promise<MemoryThread[]> — A promise that resolves to an array of episodic memory threads

Full reference →


listJsonThreads

client.memory.listJsonThreads(params?: ListMemoryThreadsParams): Promise<MemoryThread[]>

Lists all JSON memory threads with optional filtering.

Returns only threads of the JSON type, filtered by the provided parameters.

ParameterTypeRequiredDescription
paramsListMemoryThreadsParamsNoOptional filtering and pagination parameters

Returns: Promise<MemoryThread[]> — A promise that resolves to an array of JSON memory threads

Full reference →


listMarkdownThreads

client.memory.listMarkdownThreads(params?: ListMemoryThreadsParams): Promise<MemoryThread[]>

Lists all markdown memory threads with optional filtering.

Returns only threads of the markdown type, filtered by the provided parameters.

ParameterTypeRequiredDescription
paramsListMemoryThreadsParamsNoOptional filtering and pagination parameters

Returns: Promise<MemoryThread[]> — A promise that resolves to an array of markdown memory threads

Full reference →


listThreads

client.memory.listThreads(params?: ListMemoryThreadsParams): Promise<MemoryThread[]>

Lists all generic memory threads with optional filtering.

Returns memory threads that match the provided filter criteria. Use this to browse or search through stored memory threads.

ParameterTypeRequiredDescription
paramsListMemoryThreadsParamsNoOptional filtering and pagination parameters

Returns: Promise<MemoryThread[]> — A promise that resolves to an array of memory threads

Full reference →


saveContextFromChat

client.memory.saveContextFromChat(threadId: string, data: SaveContextFromChatRequest): Promise<unknown>

Saves context extracted from a chat conversation into a context thread.

Captures relevant information, decisions, and knowledge from an ongoing or completed chat session and persists it in the specified context thread for future reference.

ParameterTypeRequiredDescription
threadIdstringYesThe unique identifier of the context thread to save into
dataSaveContextFromChatRequestYesThe chat context extraction payload

Returns: Promise<unknown> — A promise that resolves when the context has been saved

Full reference →


summarizeContextThread

client.memory.summarizeContextThread(threadId: string, data?: SummarizeContextRequest): Promise<unknown>

Generates a summary of the context stored in a thread.

Uses LLM processing to create a concise summary of all the context captured in the thread. Useful for creating condensed knowledge bases from lengthy conversations.

ParameterTypeRequiredDescription
threadIdstringYesThe unique identifier of the context thread to summarize
dataSummarizeContextRequestNoOptional summarization parameters (e.g., max length, focus topics)

Returns: Promise<unknown> — A promise that resolves to the generated summary

Full reference →


unarchiveEpisodicMemory

client.memory.unarchiveEpisodicMemory(id: string): Promise<unknown>

Restores an archived episodic memory back to active status.

ParameterTypeRequiredDescription
idstringYesThe unique identifier of the episodic memory to unarchive

Returns: Promise<unknown> — A promise that resolves when the memory has been unarchived

Full reference →


unarchiveJsonThread

client.memory.unarchiveJsonThread(threadId: string): Promise<unknown>

Restores an archived JSON thread back to active status.

ParameterTypeRequiredDescription
threadIdstringYesThe unique identifier of the JSON thread to unarchive

Returns: Promise<unknown> — A promise that resolves when the thread has been unarchived

Full reference →


unarchiveMarkdownThread

client.memory.unarchiveMarkdownThread(threadId: string): Promise<unknown>

Restores an archived markdown thread back to active status.

ParameterTypeRequiredDescription
threadIdstringYesThe unique identifier of the markdown thread to unarchive

Returns: Promise<unknown> — A promise that resolves when the thread has been unarchived

Full reference →


updateContextThread

client.memory.updateContextThread(threadId: string, data: UpdateContextThreadRequest): Promise<MemoryThread>

Updates the metadata of a context thread.

Modifies thread-level properties such as name and tags without affecting the stored conversational context.

ParameterTypeRequiredDescription
threadIdstringYesThe unique identifier of the context thread to update
dataUpdateContextThreadRequestYesThe metadata fields to update

Returns: Promise<MemoryThread> — A promise that resolves to the updated context thread

Full reference →


updateEpisodicMemory

client.memory.updateEpisodicMemory(id: string, data: UpdateEpisodicMemoryRequest): Promise<MemoryThread>

Updates the metadata of an episodic memory.

ParameterTypeRequiredDescription
idstringYesThe unique identifier of the episodic memory to update
dataUpdateEpisodicMemoryRequestYesThe fields to update

Returns: Promise<MemoryThread> — A promise that resolves to the updated episodic memory thread

Full reference →


updateJsonThread

client.memory.updateJsonThread(threadId: string, data: UpdateJsonThreadRequest): Promise<MemoryThread>

Updates the metadata of a JSON thread (name, tags, etc.).

Modifies thread-level properties without changing the stored JSON data. Use to change the actual data payload.

ParameterTypeRequiredDescription
threadIdstringYesThe unique identifier of the JSON thread to update
dataUpdateJsonThreadRequestYesThe metadata fields to update

Returns: Promise<MemoryThread> — A promise that resolves to the updated JSON thread

Full reference →


updateJsonThreadData

client.memory.updateJsonThreadData(threadId: string, data: UpdateJsonDataRequest): Promise<unknown>

Replaces the JSON data payload of a thread.

Updates the structured data stored in the JSON thread. This is separate from metadata updates to allow efficient data-only writes.

ParameterTypeRequiredDescription
threadIdstringYesThe unique identifier of the JSON thread
dataUpdateJsonDataRequestYesThe new JSON data to store

Returns: Promise<unknown> — A promise that resolves when the data has been updated

Full reference →


updateMarkdownThread

client.memory.updateMarkdownThread(threadId: string, data: UpdateMarkdownThreadRequest): Promise<MemoryThread>

Updates the metadata of a markdown thread (name, tags, etc.).

Modifies thread-level properties without changing the markdown content itself. Use to change the actual markdown text.

ParameterTypeRequiredDescription
threadIdstringYesThe unique identifier of the markdown thread to update
dataUpdateMarkdownThreadRequestYesThe metadata fields to update

Returns: Promise<MemoryThread> — A promise that resolves to the updated markdown thread

Full reference →


updateMarkdownThreadContent

client.memory.updateMarkdownThreadContent(threadId: string, data: UpdateMarkdownContentRequest): Promise<unknown>

Replaces the markdown content of a thread.

Updates the actual markdown text content stored in the thread. This is separate from metadata updates to allow efficient content-only writes.

ParameterTypeRequiredDescription
threadIdstringYesThe unique identifier of the markdown thread
dataUpdateMarkdownContentRequestYesThe new markdown content

Returns: Promise<unknown> — A promise that resolves when the content has been updated

Full reference →


updateThread

client.memory.updateThread(threadId: string, data: UpdateMemoryThreadRequest): Promise<MemoryThread>

Updates the metadata or content of a generic memory thread.

Modifies an existing thread's properties such as name, tags, or stored data.

ParameterTypeRequiredDescription
threadIdstringYesThe unique identifier of the thread to update
dataUpdateMemoryThreadRequestYesThe fields to update on the thread

Returns: Promise<MemoryThread> — A promise that resolves to the updated memory thread

Full reference →