Memory Spine API v0.4.0

Complete reference for all 62 MCP tools. Memory Spine is ChaozCode's proprietary persistent memory system that enables AI to remember across sessions, build knowledge graphs, analyze codebases, and maintain intelligent context. This documentation covers every tool with parameters, examples, and best practices.

62 MCP Tools
8ms Avg Response
50k Vector Capacity
9 Categories

📑 Table of Contents

Overview & Connection

Memory Spine stores memories as vector embeddings, enabling semantic search and intelligent context retrieval. All ChaozCode AI interactions automatically use Memory Spine for context persistence.

Key Capabilities

Connection Details

# API Endpoints
HTTP API:  http://127.0.0.1:8788
MCP Server: http://127.0.0.1:8789

# Public API (via nginx proxy)
https://chaozcode.com/api/v1/memory/*

# Health Check
curl https://chaozcode.com/api/v1/memory/health

# Stats
curl https://chaozcode.com/api/v1/memory/stats

Authentication

All API requests require authentication via Bearer token:

Authorization: Bearer YOUR_API_KEY

Core Memory Operations (6 tools)

Essential tools for storing, retrieving, searching, and managing memories. These are the most frequently used tools.

memory_store

Core

Store a new memory with content, tags, and metadata. This is the primary way to persist information. Memories are automatically vectorized for semantic search.

Parameters: id required - Unique identifier for the memory
content required - The memory content (text, JSON, or markdown)
tags - Array of tags for categorization
importance - Priority level: "low", "medium", "high", "critical"
metadata - Additional key-value pairs

memory_search

Core

Search memories using semantic similarity. Returns memories ranked by relevance to the query. Supports filtering by tags and minimum score threshold.

Parameters: query required - Natural language search query
limit - Maximum results to return (default: 10, max: 100)
tags - Filter by specific tags
min_score - Minimum similarity score (0.0-1.0)

memory_retrieve

Core

Get a specific memory by its ID. Returns the full memory object including content, metadata, and version history.

Parameters: id required - The memory ID to retrieve

memory_recent

Core

Get the most recently created or updated memories. Useful for quick context checks and session awareness.

Parameters: count - Number of memories to return (default: 10)
tags - Filter by specific tags

memory_update

Core

Update an existing memory's content or metadata. Creates a new version while preserving history.

Parameters: id required - The memory ID to update
content - New content (optional)
tags - New tags (optional)
importance - New importance level (optional)

memory_delete

Core

Delete a memory by ID. This is a soft delete - the memory can be recovered within 30 days.

Parameters: id required - The memory ID to delete

Context & Intelligence (6 tools)

Tools for building context windows, summarization, and intelligent analysis. Essential for AI-powered workflows.

llm_context_window

Context

CRITICAL: Use at the START of every task. Builds an optimized context window for LLM queries by combining relevant memories, pinned context, and recent activity.

Parameters: query required - The user's question or task description
max_tokens - Maximum context size (default: 4000)

memory_context

Context

Build task-specific context from relevant memories. Similar to llm_context_window but more focused on specific memory retrieval.

Parameters: query required - Context query
max_tokens - Maximum tokens (default: 2000)

memory_summarize

Context

Generate a concise summary from multiple memories matching a query. Useful for condensing large amounts of information.

Parameters: query required - Topic to summarize
limit - Number of memories to include (default: 20)

memory_priority_score

Context

Calculate priority scores for memories based on relevance, recency, and importance. Helps rank memories for context building.

Parameters: query required - Query for scoring
limit - Number to score (default: 10)

memory_insights

Context

Extract patterns, trends, and insights from memory data. Analyzes memory usage, common topics, and relationships.

Parameters: limit - Number of memories to analyze (default: 100)

memory_analytics

Context

Get detailed analytics on memory usage including storage statistics, access patterns, and performance metrics.

Parameters: None required

Pinned Context (3 tools)

Critical information that should always be available. Pinned memories are included in every context window automatically.

memory_pin

Pins

Pin critical information for persistent, always-available access. Pinned content is automatically included in context windows.

Parameters: key required - Unique key for the pin
content required - Content to pin

memory_get_pin

Pins

Retrieve pinned information by key. Returns null if the pin doesn't exist.

Parameters: key required - The pin key to retrieve

memory_unpin

Pins

Remove a pinned memory. The content is not deleted, just unpinned.

Parameters: key required - The pin key to remove

Knowledge Graphs (3 tools)

Build and query relationships between memories. Knowledge graphs enable complex reasoning and relationship discovery.

knowledge_graph_build

Graph

Build a knowledge graph from existing memories. Automatically discovers relationships based on semantic similarity and explicit links.

Parameters: limit - Number of memories to include (default: 100)

knowledge_graph_query

Graph

Query the knowledge graph for relationships. Supports finding neighbors, paths, and clusters.

Parameters: memory_id required - Starting memory ID
operation - "neighbors", "paths", "cluster" (default: "neighbors")

memory_link

Graph

Create an explicit relationship between two memories. Useful for manual knowledge graph construction.

Parameters: source_id required - Source memory ID
target_id required - Target memory ID
relation - Relationship type (e.g., "related_to", "depends_on", "contradicts")

Codebase Analysis (6 tools)

Deep code understanding and context generation. Use before making code changes.

codebase_analyze

Codebase

Perform deep analysis of a codebase. Returns structure, dependencies, patterns, and quality metrics.

Parameters: path required - Path to analyze
include_patterns - File patterns to include (e.g., ["*.py", "*.js"])
exclude_patterns - File patterns to exclude

codebase_context

Codebase

Use before ANY code edit. Generates task-specific context from a codebase including relevant files, functions, and dependencies.

Parameters: path required - Codebase path
task required - Description of the task
max_tokens - Maximum context size (default: 5000)

codebase_suggest

Codebase

Get AI-powered improvement suggestions for a codebase. Identifies refactoring opportunities, bugs, and best practice violations.

Parameters: path required - Codebase path
focus_area - Specific area to focus on (e.g., "tests", "security", "performance")

codebase_generate

Codebase

Generate new code based on codebase context and task description. Follows existing patterns and conventions.

Parameters: path required - Codebase path
task required - What to generate (e.g., "test file for auth.py")

codebase_symbols

Codebase

Find functions, classes, and other symbols in a codebase. Useful for understanding code structure.

Parameters: path required - Codebase path
kind - Symbol type: "function", "class", "variable", "all"

codebase_dependencies

Codebase

Analyze import/dependency relationships in a codebase. Maps which files depend on which.

Parameters: path required - Codebase path

Conversations & Sessions (5 tools)

Manage conversation state and enable agent handoff between sessions.

conversation_start

Conversation

Begin a new tracked conversation. Maintains message history for context.

Parameters: system_prompt - Initial system prompt for the conversation

conversation_add_turn

Conversation

Add a message turn to the current conversation. Supports user, assistant, and system roles.

Parameters: role required - "user", "assistant", or "system"
content required - Message content

conversation_get_context

Conversation

Get the current conversation context including all message history up to token limit.

Parameters: max_tokens - Maximum context size (default: 4000)

conversation_save

Conversation

Persist the current conversation to memory for later retrieval.

Parameters: tags - Tags for the saved conversation

agent_handoff

Conversation

Critical for multi-agent workflows. Transfer conversation context to another agent including recent memories and state.

Parameters: target_agent required - Target agent identifier
include_recent - Number of recent memories to include (default: 20)

Batch Operations (3 tools)

Efficiently process multiple memories at once. Useful for bulk imports, tagging, and cleanup.

memory_batch_store

Batch

Store multiple memories in a single operation. More efficient than individual stores.

Parameters: memories required - Array of memory objects with id, content, tags

memory_batch_tag

Batch

Add or remove tags from multiple memories at once.

Parameters: memory_ids required - Array of memory IDs
add_tags - Tags to add
remove_tags - Tags to remove

memory_batch_delete

Batch

Delete multiple memories in a single operation. Requires confirmation.

Parameters: memory_ids required - Array of memory IDs to delete
confirm required - Must be true to proceed

Tagging & Organization (5 tools)

Tools for categorizing, linking, and organizing memories.

memory_auto_tag

Tagging

Automatically generate relevant tags for a memory using AI analysis.

Parameters: memory_id required - Memory to tag
auto_apply - Apply tags automatically (default: false)

memory_importance_boost

Tagging

Adjust the importance level of a memory. Affects priority in search results and context building.

Parameters: memory_id required - Memory ID
importance required - "low", "medium", "high", "critical"

memory_semantic_merge

Tagging

Merge multiple related memories into a single consolidated memory while preserving key information.

Parameters: memory_ids required - Array of memory IDs to merge

memory_merge_duplicates

Tagging

Merge identified duplicate memories, keeping the best version.

Parameters: primary_id required - Memory to keep
duplicate_ids required - Memories to merge into primary

memory_deduplicate_batch

Tagging

Automatically find and merge all duplicate memories in the system.

Parameters: dry_run - Preview changes without applying (default: true)

Version Control (4 tools)

Track changes to memories and revert to previous versions.

memory_version_history

Versioning

Get the complete version history of a memory including all changes and timestamps.

Parameters: memory_id required - Memory ID

memory_revert_version

Versioning

Revert a memory to a previous version. Creates a new version with the old content.

Parameters: memory_id required - Memory ID
version_id required - Version to revert to

memory_compress

Versioning

Compress a memory's content to reduce storage while preserving key information.

Parameters: memory_id required - Memory ID
strategy - "extractive" or "abstractive" (default: "extractive")

memory_archive

Versioning

Archive a memory to cold storage. Archived memories are searchable but not included in default context.

Parameters: memory_id required - Memory ID to archive

Maintenance & Health (9 tools)

System maintenance, health monitoring, and optimization tools.

memory_stats

Maintenance

Get comprehensive system statistics including vector count, storage usage, and performance metrics.

Parameters: None required

memory_statistics

Maintenance

Detailed statistics breakdown including per-tag counts, temporal distribution, and access patterns.

Parameters: None required

memory_health_check

Maintenance

Perform a comprehensive health check on the Memory Spine system. Reports issues and recommendations.

Parameters: None required

memory_consolidate

Maintenance

Consolidate old memories by merging related content and removing redundancy. Reduces storage and improves search.

Parameters: decay_threshold - Age threshold for consolidation (default: 0.3)

memory_run_maintenance

Maintenance

Run all maintenance tasks: cleanup, consolidation, deduplication, and optimization.

Parameters: dry_run - Preview without applying changes (default: true)

memory_lifecycle_rules

Maintenance

Manage automatic lifecycle rules for memory retention and archiving.

Parameters: action required - "list", "add", "remove", "update"

memory_benchmark

Maintenance

Run performance benchmarks on memory operations. Useful for optimization and monitoring.

Parameters: iterations - Number of test iterations (default: 50)

memory_session_summary

Maintenance

Generate a summary of memory operations in the current session including stores, searches, and modifications.

Parameters: None required

memory_webhook_register

Maintenance

Register a webhook to receive notifications for memory events.

Parameters: url required - Webhook endpoint URL
events required - Events to subscribe to: ["store", "update", "delete"]

Export & Lifecycle (4 tools)

Data export, permanent deletion, and lifecycle management.

memory_export

Export

Export memories matching a query to JSON format for backup or migration.

Parameters: query - Filter query (optional, exports all if empty)
limit - Maximum memories to export (default: 100)

memory_forget

Export

PERMANENT. Completely remove memories with no recovery option. Use for GDPR compliance or sensitive data.

Parameters: memory_ids required - Array of memory IDs
confirm required - Must be true to proceed

Code Examples

Store and Search Memories

// Store a memory
const result = await chaozcode.memory.store({
  id: "project-auth-v2",
  content: "Implemented OAuth2 authentication with refresh tokens and PKCE flow",
  tags: ["auth", "oauth", "security", "backend"],
  importance: "high"
});

// Search for relevant memories
const memories = await chaozcode.memory.search({
  query: "authentication implementation",
  limit: 10,
  min_score: 0.7
});

// Get context for a task
const context = await chaozcode.memory.contextWindow({
  query: "implement password reset flow",
  max_tokens: 4000
});

Codebase Analysis

// Analyze a codebase before making changes
const analysis = await chaozcode.codebase.analyze({
  path: "/project/src",
  include_patterns: ["*.ts", "*.tsx"]
});

// Get task-specific context
const context = await chaozcode.codebase.context({
  path: "/project/src",
  task: "add user profile page with avatar upload",
  max_tokens: 5000
});

// Get improvement suggestions
const suggestions = await chaozcode.codebase.suggest({
  path: "/project/src",
  focus_area: "security"
});

Knowledge Graph Operations

// Build a knowledge graph
await chaozcode.knowledge.build({ limit: 200 });

// Query relationships
const related = await chaozcode.knowledge.query({
  memory_id: "auth-system-design",
  operation: "neighbors"
});

// Create explicit link
await chaozcode.memory.link({
  source_id: "auth-system-design",
  target_id: "user-management-spec",
  relation: "depends_on"
});

Python SDK

from chaozcode import ChaozCode

client = ChaozCode(api_key="your-api-key")

# Store memory
client.memory.store(
    id="research-llm-benchmarks",
    content="Compared GPT-4, Claude, and Gemini on coding tasks...",
    tags=["research", "llm", "benchmarks"]
)

# Search with filters
results = client.memory.search(
    query="LLM performance comparison",
    limit=5,
    tags=["research"]
)

# Build context
context = client.memory.context_window(
    query="write a technical blog post about LLM performance",
    max_tokens=8000
)

Complete Tool Reference (62 Tools)

#CategoryTool NameDescription
1Corememory_storeStore new memory with content and tags
2Corememory_searchSemantic search for memories
3Corememory_retrieveGet memory by ID
4Corememory_recentGet recent memories
5Corememory_updateUpdate existing memory
6Corememory_deleteDelete memory (soft delete)
7Contextllm_context_windowBuild optimized LLM context
8Contextmemory_contextBuild task-specific context
9Contextmemory_summarizeGenerate summary from memories
10Contextmemory_priority_scoreCalculate priority scores
11Contextmemory_insightsExtract patterns and insights
12Contextmemory_analyticsUsage analytics and metrics
13Pinsmemory_pinPin critical information
14Pinsmemory_get_pinRetrieve pinned content
15Pinsmemory_unpinRemove pin
16Graphknowledge_graph_buildBuild knowledge graph
17Graphknowledge_graph_queryQuery graph relationships
18Graphmemory_linkCreate memory relationship
19Codebasecodebase_analyzeDeep codebase analysis
20Codebasecodebase_contextTask-specific code context
21Codebasecodebase_suggestGet improvement suggestions
22Codebasecodebase_generateGenerate new code
23Codebasecodebase_symbolsFind code symbols
24Codebasecodebase_dependenciesAnalyze dependencies
25Conversationconversation_startBegin tracked conversation
26Conversationconversation_add_turnAdd message turn
27Conversationconversation_get_contextGet conversation state
28Conversationconversation_savePersist conversation
29Conversationagent_handoffTransfer to another agent
30Batchmemory_batch_storeStore multiple memories
31Batchmemory_batch_tagTag multiple memories
32Batchmemory_batch_deleteDelete multiple memories
33Searchmemory_query_dslDSL query language
34Searchmemory_advanced_searchBoolean/fuzzy search
35Searchmemory_find_similarFind similar memories
36Searchmemory_timelineChronological view
37Searchmemory_clusterGroup by topic/tags
38Searchmemory_find_duplicatesFind duplicate memories
39Searchmemory_duplicate_checkPre-store duplicate check
40Searchmemory_check_duplicateText similarity check
41Taggingmemory_auto_tagAI-powered auto-tagging
42Taggingmemory_importance_boostAdjust importance level
43Taggingmemory_semantic_mergeMerge related memories
44Taggingmemory_merge_duplicatesMerge duplicate memories
45Taggingmemory_deduplicate_batchBatch deduplication
46Versioningmemory_version_historyGet version history
47Versioningmemory_revert_versionRevert to previous version
48Versioningmemory_compressCompress memory content
49Versioningmemory_archiveArchive to cold storage
50Maintenancememory_statsSystem statistics
51Maintenancememory_statisticsDetailed statistics
52Maintenancememory_health_checkHealth status report
53Maintenancememory_consolidateConsolidate old memories
54Maintenancememory_run_maintenanceRun all maintenance tasks
55Maintenancememory_lifecycle_rulesManage lifecycle rules
56Maintenancememory_benchmarkPerformance benchmarks
57Maintenancememory_session_summarySession operations summary
58Maintenancememory_webhook_registerRegister event webhook
59Exportmemory_exportExport to JSON
60Exportmemory_forgetPermanent deletion
61Analyticsmemory_priority_scoreCalculate relevance scores
62Analyticsmemory_session_summarySession activity summary