Skip to content

AI Memory ​

Persistent memory entries that the AI uses to maintain context across sessions. Reading requires the ai.memory.read permission; creating requires ai.memory.write, in addition to authentication and any applicable entitlement. A valid token alone does not grant these permissions. A 403 response with auth_insufficient_permissions means the operation was refused before the body was processed; changing its content does not resolve that access failure.

Endpoints ​

MethodPathDescriptionAuth
GET/ai/memoryList memoriesJWT + Entitlement
POST/ai/memoryCreate a memory entryJWT + Entitlement

GET /ai/memory ​

List memory entries, optionally filtered by scope.

Authentication: JWT Bearer token + active AI entitlement required.

Request ​

ParameterTypeRequiredDescription
scopestringNoFilter by a supported scope listed below
originstringNoFilter by origin: user, inferred, imported, system
confidencestringNoFilter by confidence: low, medium, high
freshnessstringNoFilter by freshness: active, stale, archived
chainyIdstringNoFilter by Project ID (UUID)

Response ​

Response Example ​
json
{
  "data": [
    {
      "id": "cm5mem01",
      "content": "User prefers morning study sessions between 7-9 AM.",
      "scope": "user",
      "tags": ["preferences", "learning-style"],
      "type": "preference",
      "origin": "user",
      "confidence": "high",
      "freshness": "active",
      "chainyId": null,
      "importance": 5,
      "createdAt": "2026-03-17T10:00:00.000Z"
    }
  ]
}
Response Fields ​
FieldTypeDescription
idstringMemory ID
contentstringMemory content
scopestring | nullMemory scope; see the scope values below
tagsstring[]Tags
typestring | nullMemory type; see the supported type values below
originstring | nullMemory origin: user, inferred, imported, system
confidencestring | nullConfidence level: low, medium, high
freshnessstringMemory freshness: active, stale, archived
chainyIdstring | nullLinked Project ID
importanceinteger | nullStored importance value
createdAtstringISO 8601

Code Examples ​

curl "https://api.chainabit.com/api/v1/ai/memory?scope=user" \
  -H "Authorization: Bearer $TOKEN"

POST /ai/memory ​

Create a new memory entry.

Authentication: JWT Bearer token + active AI entitlement required.

Request ​

FieldTypeRequiredConstraintsDescription
contentstringYes20–2,000 characters, plus a 5–500 token content checkMemory content
scopestringNoSee scope values belowDefaults to account. This label does not expand access permissions.
tagsstring[]No—Tags for categorization
importancenumberNo—Importance value; defaults to 5
originstringNouser, inferred, imported, systemMemory origin. Defaults to user
confidencestringNolow, medium, highConfidence level. Defaults to medium
evidenceobject[]No—Supporting evidence objects
sourceEntityTypestringNochainy, chain, bit, sessionType of the source entity
sourceEntityIdstringNoUUIDID of the source entity
chainyIdstringNoUUIDLinked Project ID
typestringNoSee type values belowDefaults to fact

Response ​

Response Example ​
json
{
  "data": {
    "id": "cm5mem01",
    "content": "User prefers morning study sessions between 7-9 AM. Learns best with visual mnemonics.",
    "scope": "user",
    "tags": ["preferences", "learning-style"],
    "type": "preference",
    "origin": "user",
    "confidence": "medium",
    "freshness": "active",
    "chainyId": null,
    "importance": 5,
    "createdAt": "2026-03-17T10:00:00.000Z"
  }
}
Response Fields ​
FieldTypeDescription
idstringMemory ID
contentstringMemory content
scopestring | nullMemory scope; see the scope values below
tagsstring[]Tags
typestring | nullMemory type; see the supported type values below
originstring | nullMemory origin: user, inferred, imported, system
confidencestring | nullConfidence level: low, medium, high
freshnessstringMemory freshness: active, stale, archived
chainyIdstring | nullLinked Project ID
importanceinteger | nullStored importance value
createdAtstringISO 8601

Code Examples ​

curl -X POST https://api.chainabit.com/api/v1/ai/memory \
  -H "Authorization: Bearer $TOKEN" \
  -H "Content-Type: application/json" \
  -d '{
    "content": "User prefers morning study sessions between 7-9 AM. Learns best with visual mnemonics.",
    "scope": "user",
    "type": "preference",
    "tags": ["preferences", "learning-style"]
  }'

Memory Taxonomy ​

Each memory entry is classified along several dimensions:

Scope ​

Where the memory applies.

ValueDescription
accountDefault account-context label
userUser-context label
sessionSession-context label
conversationConversation-context label
agentAgent-context label
globalGlobal-context label; does not make the record public
chainyProject-context label; use chainyId to link the project

The supported scope values are labels on a memory record. Records remain bound to the caller’s authorized context. This endpoint does not accept a scopeId field, and setting a label does not attach a session, agent, or conversation. Use chainyId for an explicit project association. The wire value chainy is retained for compatibility.

Type ​

What kind of memory.

ValueDescription
preferenceUser preferences (e.g., study times, UI choices)
contextSituational context (e.g., current project, topic)
behavioralObserved patterns (e.g., learning work patterns, usage trends)
goalExplicit goals (e.g., targets, milestones)
factFactual context (the default)
instructionA reusable instruction
episodicContext about an event or experience
semanticGeneral knowledge
proceduralA process or sequence of steps
summaryCondensed context

Origin ​

How the memory was created.

ValueDescription
userExplicitly created by the user
inferredAI-derived from interactions
importedImported from an external source
systemPlatform-generated by the system

Freshness Lifecycle ​

Memories progress through freshness states over time:

active → stale → archived

ValueDescription
activeCurrent and relevant
staleNot recently accessed or updated — may need review
archivedNo longer active — retained for history

Confidence ​

How reliable the memory is considered to be.

ValueDescription
lowUncertain — may need verification
mediumReasonable confidence (default for new memories)
highWell-established and verified

Content Validation ​

INFO

Memory content is validated before storage. Requests that fail validation return a 400 Bad Request response.

  • Content length: 20–2,000 characters, with a separate 5–500 token check
  • Null bytes: Content containing null bytes (\0) is rejected
  • Empty content: The content field must be non-empty
  • Duplicates: An identical active memory in the same authorized context is rejected
  • Context limit: At most 10 active memories per project context, or per account/user context when no project is linked

Built with purpose. chainabit.com