Skip to main content

codebolt.memory

Memory operations for storing and retrieving data in various formats including JSON, todo items, markdown, episodic memories, and persistent memories.

Available Tools

Basic Memory Operations

  • memory_set - Store a value in memory
  • memory_get - Retrieve a value from memory

JSON Memory

  • memory_json_save - Saves a JSON object to memory storage
  • memory_json_update - Updates an existing JSON object in memory storage by its memory ID
  • memory_json_delete - Deletes a JSON object from memory storage by its memory ID
  • memory_json_list - Lists JSON objects from memory storage with optional filters

Todo Memory

  • memory_todo_save - Saves a todo item to memory storage with optional metadata
  • memory_todo_update - Updates an existing todo item in memory storage by its memory ID
  • memory_todo_delete - Deletes a todo item from memory storage by its memory ID
  • memory_todo_list - Lists todo items from memory storage with optional filters

Markdown Memory

  • memory_markdown_save - Saves markdown content to memory storage with optional metadata
  • memory_markdown_update - Updates existing markdown content in memory storage by its memory ID
  • memory_markdown_delete - Deletes markdown content from memory storage by its memory ID
  • memory_markdown_list - Lists markdown content from memory storage with optional filters

Episodic Memory

  • episodic_memory_create - Creates a new episodic memory container with a title
  • episodic_memory_list - Lists all episodic memories with their IDs, titles, and event counts
  • episodic_memory_get - Retrieves a specific episodic memory by its ID
  • episodic_memory_append_event - Appends a new event to an existing episodic memory
  • episodic_memory_query_events - Queries and filters events from an episodic memory
  • episodic_memory_get_event_types - Retrieves all unique event types from an episodic memory
  • episodic_memory_archive - Archives an episodic memory (marks as inactive)
  • episodic_memory_update_title - Updates the title of an existing episodic memory

Persistent Memory

  • persistent_memory_create - Creates a new persistent memory configuration with retrieval and contribution settings
  • persistent_memory_get - Retrieves a persistent memory configuration by its ID
  • persistent_memory_list - Lists all persistent memory configurations with optional filters
  • persistent_memory_update - Updates an existing persistent memory configuration
  • persistent_memory_retrieve - Executes a retrieval query on a persistent memory

Tool Parameters

JSON Memory Tools

memory_json_save

Saves a JSON object to memory storage. Returns the memory ID of the saved entry.

ParameterTypeRequiredDescription
jsonobjectYesThe JSON object to save to memory storage

memory_json_update

Updates an existing JSON object in memory storage by its memory ID.

ParameterTypeRequiredDescription
memoryIdstringYesThe unique identifier of the memory entry to update
jsonobjectYesThe new JSON object to replace the existing data

memory_json_delete

Deletes a JSON object from memory storage by its memory ID.

ParameterTypeRequiredDescription
memoryIdstringYesThe unique identifier of the memory entry to delete

memory_json_list

Lists JSON objects from memory storage with optional filters.

ParameterTypeRequiredDescription
filtersobjectNoOptional filters to apply when listing JSON entries

Todo Memory Tools

memory_todo_save

Saves a todo item to memory storage with optional metadata.

ParameterTypeRequiredDescription
todoobjectYesThe todo object to save (should contain task details like title, description, status)
metadataobjectNoOptional metadata to associate with the todo item

memory_todo_update

Updates an existing todo item in memory storage by its memory ID.

ParameterTypeRequiredDescription
memoryIdstringYesThe unique identifier of the memory entry to update
todoobjectYesThe new todo object to replace the existing data

memory_todo_delete

Deletes a todo item from memory storage by its memory ID.

ParameterTypeRequiredDescription
memoryIdstringYesThe unique identifier of the memory entry to delete

memory_todo_list

Lists todo items from memory storage with optional filters.

ParameterTypeRequiredDescription
filtersobjectNoOptional filters to apply when listing todo entries

Markdown Memory Tools

memory_markdown_save

Saves markdown content to memory storage with optional metadata.

ParameterTypeRequiredDescription
markdownstringYesThe markdown content string to save to memory storage
metadataobjectNoOptional metadata to associate with the markdown content

memory_markdown_update

Updates existing markdown content in memory storage by its memory ID.

ParameterTypeRequiredDescription
memoryIdstringYesThe unique identifier of the memory entry to update
markdownstringYesThe new markdown content to replace the existing data
metadataobjectNoOptional metadata to update along with the markdown content

memory_markdown_delete

Deletes markdown content from memory storage by its memory ID.

ParameterTypeRequiredDescription
memoryIdstringYesThe unique identifier of the memory entry to delete

memory_markdown_list

Lists markdown content from memory storage with optional filters.

ParameterTypeRequiredDescription
filtersobjectNoOptional filters to apply when listing markdown entries

Episodic Memory Tools

episodic_memory_create

Creates a new episodic memory container with a title.

ParameterTypeRequiredDescription
titlestringYesThe title for the new episodic memory (should be descriptive of the purpose or context)

episodic_memory_list

Lists all episodic memories with their IDs, titles, and event counts.

ParameterTypeRequiredDescription
filtersobjectNoOptional filters to apply when listing episodic memories

episodic_memory_get

Retrieves a specific episodic memory by its ID.

ParameterTypeRequiredDescription
memoryIdstringYesThe unique identifier of the episodic memory to retrieve

episodic_memory_append_event

Appends a new event to an existing episodic memory.

ParameterTypeRequiredDescription
memoryIdstringYesThe unique identifier of the episodic memory to append the event to
eventobjectYesThe event object to append (see Event Object Structure below)

Event Object Structure:

FieldTypeRequiredDescription
event_typestringYesThe type/category of the event (e.g., "message", "action", "state_change")
emitting_agent_idstringYesThe ID of the agent that is emitting/creating this event
team_idstringNoOptional team ID to associate with this event
tagsstring[]NoOptional array of tags for categorizing and filtering events
payloadstring or objectYesThe data payload of the event

episodic_memory_query_events

Queries and filters events from an episodic memory.

ParameterTypeRequiredDescription
memoryIdstringNoThe unique identifier of the episodic memory to query events from
swarmIdstringNoThe swarm ID to query events from (alternative to memoryId)
lastMinutesnumberNoFilter events from the last N minutes
lastCountnumberNoLimit the number of events returned
tagsstring[]NoFilter events that have any of the specified tags
event_typestringNoFilter events by event type
emitting_agent_idstringNoFilter events by the agent that emitted them
team_idstringNoFilter events by team ID
sincestringNoFilter events since a specific timestamp (ISO 8601 format)

Note: Either memoryId or swarmId must be provided.

episodic_memory_get_event_types

Retrieves all unique event types from an episodic memory.

ParameterTypeRequiredDescription
memoryIdstringNoThe unique identifier of the episodic memory to get event types from
swarmIdstringNoThe swarm ID to get event types from (alternative to memoryId)

Note: Either memoryId or swarmId must be provided.

episodic_memory_archive

Archives an episodic memory (marks as inactive).

ParameterTypeRequiredDescription
memoryIdstringYesThe unique identifier of the episodic memory to archive

episodic_memory_update_title

Updates the title of an existing episodic memory.

ParameterTypeRequiredDescription
memoryIdstringYesThe unique identifier of the episodic memory to update
titlestringYesThe new title for the episodic memory

Persistent Memory Tools

persistent_memory_create

Creates a new persistent memory configuration with retrieval and contribution settings.

ParameterTypeRequiredDescription
idstringNoOptional unique identifier for the memory (auto-generated if not provided)
labelstringYesA human-readable label/name for the persistent memory
descriptionstringNoOptional description explaining the purpose of this memory
inputs_scopestring[]NoArray of input scopes that determine when this memory should be activated
additional_variablesobjectNoAdditional variables for memory configuration as key-value pairs
retrievalobjectYesRetrieval configuration (see Retrieval Configuration below)
contributionobjectYesContribution configuration (see Contribution Configuration below)

Retrieval Configuration:

FieldTypeRequiredDescription
source_typestringYesType of data source: 'vectordb', 'kv', 'eventlog', or 'kg'
source_idstringYesIdentifier of the data source to retrieve from
query_templatestringNoOptional template for constructing queries
limitnumberNoMaximum number of results to retrieve
filtersobjectNoOptional filters to apply during retrieval

Contribution Configuration:

FieldTypeRequiredDescription
formatstringYesOutput format: 'text', 'json', or 'markdown'
templatestringNoOptional template for formatting the output
max_tokensnumberNoMaximum number of tokens for the output

persistent_memory_get

Retrieves a persistent memory configuration by its ID.

ParameterTypeRequiredDescription
memory_idstringYesThe unique identifier of the persistent memory to retrieve

persistent_memory_list

Lists all persistent memory configurations with optional filters.

ParameterTypeRequiredDescription
input_scopestringNoOptional input scope to filter memories by
active_onlybooleanNoIf true, only return memories with status 'active' (defaults to false)

persistent_memory_update

Updates an existing persistent memory configuration.

ParameterTypeRequiredDescription
memory_idstringYesThe unique identifier of the persistent memory to update
labelstringNoNew label/name for the memory
descriptionstringNoNew description for the memory
statusstringNoNew status: 'active', 'disabled', or 'draft'
inputs_scopestring[]NoUpdated array of input scopes
additional_variablesobjectNoUpdated additional variables as key-value pairs
retrievalobjectNoUpdated retrieval configuration
contributionobjectNoUpdated contribution configuration

persistent_memory_retrieve

Executes a retrieval query on a persistent memory.

ParameterTypeRequiredDescription
memory_idstringYesThe unique identifier of the persistent memory to query
keywordsstring[]NoOptional array of keywords to use in the retrieval query
actionstringNoOptional action context that helps focus the retrieval (e.g., "find", "summarize", "compare")
contextobjectNoOptional additional context as key-value pairs to guide the retrieval
querystringNoOptional direct query string for the retrieval

Sample Usage

Basic Memory Operations

// Store a value in memory
const setResult = await codebolt.tools.executeTool(
"codebolt.memory",
"memory_set",
{
key: "test-key-1",
value: "This is a test memory value"
}
);

// Retrieve a value from memory
const getResult = await codebolt.tools.executeTool(
"codebolt.memory",
"memory_get",
{
key: "test-key-1"
}
);

JSON Memory

// Save JSON to memory
const saveResult = await codebolt.tools.executeTool(
"codebolt.memory",
"memory_json_save",
{
json: {
name: "Project Config",
version: "1.0.0",
settings: { theme: "dark" }
}
}
);

// Update existing JSON
const updateResult = await codebolt.tools.executeTool(
"codebolt.memory",
"memory_json_update",
{
memoryId: "your-memory-id",
json: {
name: "Project Config",
version: "1.0.1",
settings: { theme: "light" }
}
}
);

// List all JSON entries
const listResult = await codebolt.tools.executeTool(
"codebolt.memory",
"memory_json_list",
{
filters: { /* optional filters */ }
}
);

// Delete JSON entry
const deleteResult = await codebolt.tools.executeTool(
"codebolt.memory",
"memory_json_delete",
{
memoryId: "your-memory-id"
}
);

Todo Memory

// Save a todo item to memory
const todoSaveResult = await codebolt.tools.executeTool(
"codebolt.memory",
"memory_todo_save",
{
todo: {
title: "Complete documentation",
status: "pending",
priority: "high"
},
metadata: {
category: "development",
dueDate: "2024-12-31"
}
}
);

// List all todos in memory
const todoListResult = await codebolt.tools.executeTool(
"codebolt.memory",
"memory_todo_list",
{}
);

Markdown Memory

// Save markdown content
const markdownSaveResult = await codebolt.tools.executeTool(
"codebolt.memory",
"memory_markdown_save",
{
markdown: "# Project Notes\n\n- Feature A completed\n- Feature B in progress",
metadata: {
category: "notes",
author: "developer"
}
}
);

// Update markdown content
const markdownUpdateResult = await codebolt.tools.executeTool(
"codebolt.memory",
"memory_markdown_update",
{
memoryId: "your-memory-id",
markdown: "# Updated Project Notes\n\n- All features completed",
metadata: {
category: "notes",
author: "developer"
}
}
);

Episodic Memory

// Create an episodic memory
const createResult = await codebolt.tools.executeTool(
"codebolt.memory",
"episodic_memory_create",
{
title: "User Session Log"
}
);

// Append an event to the memory
const appendResult = await codebolt.tools.executeTool(
"codebolt.memory",
"episodic_memory_append_event",
{
memoryId: "your-memory-id",
event: {
event_type: "user_action",
emitting_agent_id: "agent-123",
tags: ["navigation", "ui"],
payload: {
action: "button_click",
target: "submit-form"
}
}
}
);

// Query events from the memory
const queryResult = await codebolt.tools.executeTool(
"codebolt.memory",
"episodic_memory_query_events",
{
memoryId: "your-memory-id",
event_type: "user_action",
lastMinutes: 60,
lastCount: 10
}
);

// Get all event types
const eventTypesResult = await codebolt.tools.executeTool(
"codebolt.memory",
"episodic_memory_get_event_types",
{
memoryId: "your-memory-id"
}
);

// Archive the memory
const archiveResult = await codebolt.tools.executeTool(
"codebolt.memory",
"episodic_memory_archive",
{
memoryId: "your-memory-id"
}
);

Persistent Memory

// Create a persistent memory configuration
const persistentCreateResult = await codebolt.tools.executeTool(
"codebolt.memory",
"persistent_memory_create",
{
label: "User Preferences",
description: "Stores user preferences across sessions",
inputs_scope: ["user_settings", "preferences"],
retrieval: {
source_type: "kv",
source_id: "user-preferences-store",
limit: 10
},
contribution: {
format: "json",
max_tokens: 500
}
}
);

// List all persistent memories
const persistentListResult = await codebolt.tools.executeTool(
"codebolt.memory",
"persistent_memory_list",
{
active_only: true
}
);

// Execute a retrieval query
const retrieveResult = await codebolt.tools.executeTool(
"codebolt.memory",
"persistent_memory_retrieve",
{
memory_id: "your-memory-id",
keywords: ["theme", "preferences"],
action: "find",
query: "user display settings"
}
);

// Update a persistent memory
const persistentUpdateResult = await codebolt.tools.executeTool(
"codebolt.memory",
"persistent_memory_update",
{
memory_id: "your-memory-id",
label: "Updated User Preferences",
status: "active"
}
);
info

This functionality provides comprehensive memory storage through the MCP interface. JSON, Todo, and Markdown memory types support CRUD operations with unique memory IDs. Episodic memory is ideal for tracking time-series events and workflows. Persistent memory allows cross-session data storage with configurable retrieval from various data sources (vectordb, kv, eventlog, kg).