Skip to main content

REST API

The Agent Brain brain-engine exposes a REST API on port 9090.

Base URL: http://localhost:9090

All request and response bodies are JSON. All write endpoints require Content-Type: application/json.


Memory operations

POST /api/v1/remember

Store a memory. The content is embedded and indexed for semantic recall.

Request body

FieldTypeRequiredDescription
contentstringYesText to store
typedecision | error | pattern | entity | preference | context | factYesMemory type
importancenumber (0–1)NoImportance score. Defaults to 0.5
projectstringNoProject name or ID to scope this memory to
tagsarray<string>NoFree-form tags

Example

curl -X POST http://localhost:9090/api/v1/remember \
  -H "Content-Type: application/json" \
  -d '{
    "content": "PostgreSQL is canonical. Qdrant stores vector indexes only.",
    "type": "decision",
    "importance": 0.9,
    "project": "agent-brain",
    "tags": ["database", "architecture"]
  }'

POST /api/v1/recall

Retrieve the most semantically relevant memories for a query.

Request body

FieldTypeRequiredDescription
querystringYesNatural-language query
limitintNoMaximum results to return (default: 10)
filterobjectNoFilter object (see Filter reference below)

Example

curl -X POST http://localhost:9090/api/v1/recall \
  -H "Content-Type: application/json" \
  -d '{
    "query": "how does the vector index stay in sync with postgres",
    "limit": 5,
    "filter": {
      "project_id": "agent-brain",
      "memory_type": "decision",
      "min_importance": 0.6
    }
  }'

POST /api/v1/search

Paginated search across all memories.

Request body

FieldTypeRequiredDescription
querystringYesSearch query
filterobjectNoFilter object (see Filter reference below)
pageintNoPage number, 1-indexed (default: 1)
page_sizeintNoResults per page (default: 20)

Example

curl -X POST http://localhost:9090/api/v1/search \
  -H "Content-Type: application/json" \
  -d '{
    "query": "redis caching",
    "filter": { "tags": ["redis"] },
    "page": 1,
    "page_size": 10
  }'

POST /api/v1/forget

Archive a memory. Archived memories are excluded from default recall and search.

Request body

FieldTypeRequiredDescription
memory_idstring (UUID)YesUUID of the memory to archive
include_archivedbooleanNoSearch archived memories too (default: false)

Example

curl -X POST http://localhost:9090/api/v1/forget \
  -H "Content-Type: application/json" \
  -d '{ "memory_id": "3f2a1b4c-0e9d-4f7a-8c3e-1a2b3c4d5e6f" }'

POST /api/v1/get

Fetch a single memory by UUID.

Request body

FieldTypeRequiredDescription
memory_idstring (UUID)YesUUID of the memory to fetch
include_archivedbooleanNoLook in archived memories too (default: false)

Example

curl -X POST http://localhost:9090/api/v1/get \
  -H "Content-Type: application/json" \
  -d '{
    "memory_id": "3f2a1b4c-0e9d-4f7a-8c3e-1a2b3c4d5e6f",
    "include_archived": true
  }'

GET /api/v1/memories

Browse memories for a project. All parameters are query string values.

Query parameters

ParameterTypeRequiredDescription
project_idstringNoFilter to a specific project
global_onlybooleanNoReturn only memories with no project scope
pageintNoPage number, 1-indexed (default: 1)
page_sizeintNoResults per page (default: 20)

Example

curl "http://localhost:9090/api/v1/memories?project_id=agent-brain&page=1&page_size=20"

POST /api/v1/share

Share a memory with one or more agents. Omit target_agents to share globally.

Request body

FieldTypeRequiredDescription
memory_idstring (UUID)YesUUID of the memory to share
target_agentsarray<string>NoAgent IDs to share with. Omit to broadcast globally

Example

curl -X POST http://localhost:9090/api/v1/share \
  -H "Content-Type: application/json" \
  -d '{
    "memory_id": "3f2a1b4c-0e9d-4f7a-8c3e-1a2b3c4d5e6f",
    "target_agents": ["cursor-agent", "claude-code-agent"]
  }'

Cache

POST /api/v1/cache/check

Check whether a semantically similar LLM response is cached for a given query and model.

Request body

FieldTypeRequiredDescription
querystringYesQuery or prompt to look up
modelstringYesModel identifier (e.g. "claude-sonnet-4-6")
context_depthintNoNumber of context turns to include in the cache key

Example

curl -X POST http://localhost:9090/api/v1/cache/check \
  -H "Content-Type: application/json" \
  -d '{
    "query": "explain the Qdrant hydration flow",
    "model": "claude-sonnet-4-6",
    "context_depth": 3
  }'

GET /api/v1/cache/stats

Return cache hit/miss statistics and storage usage. No request body.

Example

curl http://localhost:9090/api/v1/cache/stats

Status and health

GET /api/v1/status

Return full service health: PostgreSQL, Qdrant, Redis, NATS, Ollama, memory counts, and connected agents. No request body.

Example

curl http://localhost:9090/api/v1/status

GET /health

Lightweight liveness check. Returns 200 OK with a minimal JSON body when the process is running. Suitable for Docker health checks and load balancer probes.

Example

curl http://localhost:9090/health

Audit

POST /api/v1/memories/audit

Run a governance audit to detect duplicate memories, conflicting decisions, stale context, and unused skills.

Request body

FieldTypeRequiredDescription
scopeproject | global | crossYesAudit scope
project_idstringNoRequired when scope is project
skills_dirstringNoAbsolute path to skills directory to include in audit
config_dirstringNoAbsolute path to config directory to include in audit

Example

curl -X POST http://localhost:9090/api/v1/memories/audit \
  -H "Content-Type: application/json" \
  -d '{
    "scope": "project",
    "project_id": "agent-brain",
    "skills_dir": "/home/josh/.claude/skills"
  }'

GET /api/v1/memories/audit/history

List past audit runs.

Query parameters

ParameterTypeRequiredDescription
project_idstringNoFilter runs to a specific project
limitintNoMaximum results (default: 20)

Example

curl "http://localhost:9090/api/v1/memories/audit/history?project_id=agent-brain&limit=10"

GET /api/v1/memories/audit/

Fetch a single audit run by ID.

Path parameter: run_id — UUID of the audit run.

Example

curl http://localhost:9090/api/v1/memories/audit/7a3c9f01-12ab-4d56-8e90-fedcba987654

POST /api/v1/memories/audit/suppress

Suppress a specific finding from an audit run so it no longer appears in future reports.

Request body

FieldTypeRequiredDescription
run_idstring (UUID)YesUUID of the audit run containing the finding
finding_idstring (UUID)YesUUID of the specific finding to suppress

Example

curl -X POST http://localhost:9090/api/v1/memories/audit/suppress \
  -H "Content-Type: application/json" \
  -d '{
    "run_id": "7a3c9f01-12ab-4d56-8e90-fedcba987654",
    "finding_id": "b1c2d3e4-f5a6-7890-abcd-ef1234567890"
  }'

POST /api/v1/memories/audit/merge

Merge multiple duplicate memories into a single canonical memory.

Request body

FieldTypeRequiredDescription
memory_idsarray<string>YesUUIDs of the memories to merge (minimum 2)

Example

curl -X POST http://localhost:9090/api/v1/memories/audit/merge \
  -H "Content-Type: application/json" \
  -d '{
    "memory_ids": [
      "aaaa0000-0000-0000-0000-000000000001",
      "bbbb0000-0000-0000-0000-000000000002"
    ]
  }'

Project

GET /api/v1/project//context

Return stored context and active agent information for a project.

Path parameter: project_id — project UUID or name.

Example

curl http://localhost:9090/api/v1/project/agent-brain/context

Export and import

POST /api/v1/export

Export memories and metadata to a JSON archive file on the server filesystem. Pass a passphrase to encrypt the output with AES-256-GCM.

Request body

FieldTypeRequiredDescription
output_pathstringYesAbsolute path on the server where the file will be written
memoriesbooleanNoInclude memory records (default: true)
projectsbooleanNoInclude project records (default: true)
audit_runsbooleanNoInclude audit run history (default: false)
sincestring (ISO date)NoExport only records created after this date
untilstring (ISO date)NoExport only records created before this date
project_filterarray<string>NoRestrict export to these project IDs
passphrasestringNoEncrypt output with AES-256-GCM using this passphrase

Example

curl -X POST http://localhost:9090/api/v1/export \
  -H "Content-Type: application/json" \
  -d '{
    "output_path": "/home/josh/backups/brain-2026-04-30.json",
    "memories": true,
    "projects": true,
    "since": "2026-01-01",
    "passphrase": "correct-horse-battery-staple"
  }'

POST /api/v1/import

Import a previously exported Agent Brain archive. Use dry_run: true to preview without writing.

Request body

FieldTypeRequiredDescription
source_pathstringYesAbsolute path to the archive file on the server
dry_runbooleanNoPreview only, no writes (default: false)
passphrasestringNoDecryption passphrase if the archive is encrypted

Example

curl -X POST http://localhost:9090/api/v1/import \
  -H "Content-Type: application/json" \
  -d '{
    "source_path": "/home/josh/backups/brain-2026-04-30.json",
    "dry_run": true,
    "passphrase": "correct-horse-battery-staple"
  }'

POST /api/v1/import/foreign

Import memory files from other AI tools. Supports CLAUDE.md, OpenAI Codex agents.md, Gemini memory files, and the Claude memory format.

Request body

FieldTypeRequiredDescription
source_pathstringYesAbsolute path to the foreign file or directory
formatauto | claude-md | codex-agents | gemini-md | claude-memoryNoFile format. Defaults to auto
projectstringNoProject to assign imported memories to
dry_runbooleanNoPreview only, no writes (default: false)

Example

curl -X POST http://localhost:9090/api/v1/import/foreign \
  -H "Content-Type: application/json" \
  -d '{
    "source_path": "/home/josh/.claude/memory/MEMORY.md",
    "format": "claude-md",
    "project": "agent-brain",
    "dry_run": false
  }'

GET /api/v1/onboarding/scan

Scan the server filesystem for known memory file locations (CLAUDE.md, agents.md, Gemini memory files, etc.) and return the discovered paths. No request body.

Example

curl http://localhost:9090/api/v1/onboarding/scan

POST /api/v1/onboarding/import

Import a list of discovered memory files in one operation. Typically used after /api/v1/onboarding/scan.

Request body

FieldTypeRequiredDescription
file_pathsarray<string>YesAbsolute paths to the memory files to import
projectstringNoProject to assign all imported memories to

Example

curl -X POST http://localhost:9090/api/v1/onboarding/import \
  -H "Content-Type: application/json" \
  -d '{
    "file_paths": [
      "/home/josh/.claude/memory/MEMORY.md",
      "/home/josh/dev/myproject/CLAUDE.md"
    ],
    "project": "agent-brain"
  }'

Agents

POST /api/v1/agents/heartbeat

Register or refresh a connected agent. Used by agent integrations to signal that an agent is active.

Request body

FieldTypeRequiredDescription
agent_idstringYesUnique identifier for the agent
project_idstringYesProject the agent is currently working in

Example

curl -X POST http://localhost:9090/api/v1/agents/heartbeat \
  -H "Content-Type: application/json" \
  -d '{
    "agent_id": "claude-code-agent",
    "project_id": "agent-brain"
  }'

Filter reference

The filter object accepted by /recall, /search, and related endpoints supports the following fields. All fields are optional and combine with AND logic.

FieldTypeDescription
memory_typestringRestrict to one memory type (e.g. "decision")
source_agentstringRestrict to memories written by a specific agent ID
project_idstringRestrict to a specific project
date_rangeobject{ "from": "<ISO date>", "to": "<ISO date>" }
min_importancenumber (0–1)Exclude memories below this importance score
tagsarray<string>Memories must contain all listed tags
include_archivedbooleanInclude archived memories in results (default: false)