Skip to main content

Overview

The Memory API provides endpoints to retrieve and manage DeerFlow’s global memory system. Memory stores user context, conversation history, and facts across all threads for personalized AI interactions.

Get Memory Data

GET /api/memory

Retrieve the current global memory data including user context, history, and facts

Response

string
default:"1.0"
Memory schema version
string
Last update timestamp (ISO 8601 format)
object
User context sections
object
Historical context sections
array
List of memory facts

Example Request

Example Response


Reload Memory Data

POST /api/memory/reload

Reload memory data from the storage file, refreshing the in-memory cache

Response

Returns the reloaded memory data (same structure as GET /api/memory).

Example Request

Use Case

Use this endpoint when the memory file has been modified externally and you need to refresh the cached data without restarting the server.

Get Memory Configuration

GET /api/memory/config

Retrieve the current memory system configuration

Response

boolean
required
Whether memory is enabled
string
required
Path to memory storage file (relative to project root)
integer
required
Debounce time for memory updates (seconds)
integer
required
Maximum number of facts to store
number
required
Minimum confidence threshold for facts (0-1)
boolean
required
Whether memory injection is enabled
integer
required
Maximum tokens for memory injection into prompts

Example Request

Example Response


Get Memory Status

GET /api/memory/status

Retrieve both memory configuration and current data in a single request

Response

object
Memory configuration (same as GET /api/memory/config)
object
Memory data (same as GET /api/memory)

Example Request

Example Response


Memory System

How Memory Works

  1. Collection: Memory is collected from conversations across all threads
  2. Storage: Memory data is persisted to a JSON file (.deer-flow/memory.json)
  3. Injection: Memory is automatically injected into AI prompts when enabled
  4. Updates: Memory is updated with debouncing to prevent excessive writes

Memory Categories

User Context

  • workContext: Work-related information and current projects
  • personalContext: Personal preferences, communication style
  • topOfMind: Current priorities and focus areas

History Context

  • recentMonths: Recent development activities and conversations
  • earlierContext: Historical context from earlier periods
  • longTermBackground: Long-term background information

Facts

Structured facts extracted from conversations:
  • preference: User preferences (e.g., coding style, tools)
  • skill: User skills and expertise
  • context: General contextual information
  • goal: User goals and objectives

Confidence Scores

Facts have confidence scores (0-1) indicating reliability:
  • 0.9-1.0: High confidence (explicitly stated by user)
  • 0.7-0.9: Medium confidence (inferred from behavior)
  • 0.5-0.7: Low confidence (weak signals)
  • < 0.5: Very low confidence (filtered out by default)

Configuration

Memory can be configured in your application config:

Parameters

  • enabled: Enable/disable memory system
  • storage_path: Path to memory JSON file
  • debounce_seconds: Wait time before writing updates
  • max_facts: Maximum number of facts to store
  • fact_confidence_threshold: Minimum confidence to keep facts
  • injection_enabled: Enable/disable memory injection into prompts
  • max_injection_tokens: Maximum tokens to inject

Use Cases

Display Memory Data

Filter High-Confidence Facts

Check Memory Status

Reload Memory


Memory System

Learn about the memory system

Gateway Overview

Learn about the Gateway API