Skip to main content

Endpoints

MethodPathDescription
GET/memory/brainView all brain data
POST/memory/brain/factAdd a fact
DELETE/memory/brain/factRemove a fact
POST/memory/brain/prefSet a preference
DELETE/memory/brainClear all brain data

View Brain

GET /memory/brain
Returns all stored brain data and a preview of the context that gets injected into the system prompt. Response:
{
  "brain": {
    "facts": ["User's name is Arka", "Prefers TypeScript"],
    "preferences": { "editor": "VS Code", "style": "concise" },
    "patterns": [],
    "updatedAt": 1709384400000
  },
  "contextPreview": "Known facts about this user:\n- User's name is Arka\n- Prefers TypeScript\n\nUser preferences:\n- editor: VS Code\n- style: concise"
}

Add Fact

POST /memory/brain/fact
Teaches NIOM a new fact about you. Request body:
{
  "fact": "I work on the NIOM project"
}
Response:
{
  "status": "learned",
  "brain": { "facts": [...], "preferences": {...}, "patterns": [...], "updatedAt": 1709384400000 }
}

Remove Fact

DELETE /memory/brain/fact
Removes a specific fact from memory. Request body:
{
  "fact": "I work on the NIOM project"
}
Response (200):
{
  "status": "removed",
  "brain": { "facts": [...], "preferences": {...}, "patterns": [...], "updatedAt": 1709384400000 }
}
Response (404):
{
  "error": "Fact not found"
}

Set Preference

POST /memory/brain/pref
Sets a key-value preference. Overwrites if the key already exists. Request body:
{
  "key": "language",
  "value": "TypeScript"
}
Response:
{
  "status": "set",
  "brain": { "facts": [...], "preferences": {...}, "patterns": [...], "updatedAt": 1709384400000 }
}

Clear Brain

DELETE /memory/brain
Permanently deletes all brain data — facts, preferences, and patterns. This cannot be undone. Response:
{
  "status": "cleared"
}