Skip to Content
API ReferenceMemory API

Memory API

Read and update working memory, observations, and monitoring status.

Endpoints

Get Working Memory

GET /api/memory/working Authorization: Bearer <token>

Returns the current working memory content, or null if no working memory exists yet.

{ "content": "<working_memory_data>\n- User's name is Alex\n- Prefers TypeScript\n</working_memory_data>" }

Update Working Memory

PUT /api/memory/working Authorization: Bearer <token> Content-Type: application/json

Overwrites working memory content.

{ "content": "<working_memory_data>\n- User's name is Alex\n- Prefers TypeScript\n</working_memory_data>" }

Get Observations

GET /api/memory/observations Authorization: Bearer <token>

Returns the current observation text, or null if memory is disabled or no observations exist yet.

{ "observations": "Date: 2026-03-06\n- User is building a Next.js app..." }

Get Record

GET /api/memory/record Authorization: Bearer <token>

Returns the full memory record and threshold configuration, or null values if memory is disabled.

{ "record": { "id": "a1b2c3d4-...", "scope": "resource", "generationCount": 2, "observationTokenCount": 12500, "pendingMessageTokens": 8200, "totalTokensObserved": 45000, "isObserving": false, "isReflecting": false, "lastObservedAt": "2026-03-06T10:30:00.000Z", "updatedAt": "2026-03-06T10:30:00.000Z" }, "thresholds": { "scope": "resource", "messageTokens": 30000, "observationTokens": 40000 } }

Record Fields

FieldTypeDescription
idstringRecord ID
scopestring"resource" (cross-thread) or "thread"
generationCountnumberNumber of reflections that have occurred
observationTokenCountnumberToken count of active observations
pendingMessageTokensnumberUnobserved message tokens waiting to be processed
totalTokensObservednumberLifetime total of all tokens observed
isObservingbooleanWhether the observer is currently running
isReflectingbooleanWhether the reflector is currently running
lastObservedAtstring | nullISO 8601 timestamp of the last observation
updatedAtstringISO 8601 timestamp of the last record update

Threshold Fields

FieldTypeDescription
scopestringMemory scope
messageTokensnumberToken threshold that triggers the observer
observationTokensnumberToken threshold that triggers the reflector

Monitoring

Use the record and thresholds together to calculate fill percentages:

  • Observer proximity: pendingMessageTokens / messageTokens — how close to triggering observation
  • Reflector proximity: observationTokenCount / observationTokens — how close to triggering reflection

SDK Types

These types are available from @pandorakit/sdk/api:

import type { OMRecord, OMThresholds, RecordResponse } from '@pandorakit/sdk/api'

See SDK Client for the typed client that wraps these endpoints.

Last updated on