Skip to content

AI Memory ​

Persistent memory entries that the AI uses to maintain context across sessions.

Endpoints ​

MethodPathDescriptionAuthRate Limit
GET/ai/memoryList memoriesJWT + Entitlement60/min
POST/ai/memoryCreate a memory entryJWT + Entitlement30/min

GET /ai/memory ​

List memory entries, optionally filtered by scope.

Authentication: JWT Bearer token + active AI entitlement required. Rate limit: 60/min

Request ​

ParameterTypeRequiredDescription
scopestringNoFilter by scope: user, session, chain, workspace
originstringNoFilter by origin: user, inferred, imported, system
confidencestringNoFilter by confidence: low, medium, high
freshnessstringNoFilter by freshness: active, stale, archived
chainyIdstringNoFilter by Chainy ID (UUID)
typestringNoFilter by memory type: preference, context, behavioral, goal

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": 75,
      "createdAt": "2026-03-17T10:00:00.000Z"
    }
  ],
  "meta": {
    "total": 1
  }
}
Response Fields ​
FieldTypeDescription
idstringMemory ID
contentstringMemory content
scopestringuser, session, chain, workspace
tagsstring[]Tags
typestring | nullMemory type: preference, context, behavioral, goal
originstring | nullMemory origin: user, inferred, imported, system
confidencestring | nullConfidence level: low, medium, high
freshnessstringMemory freshness: active, stale, archived
chainyIdstring | nullLinked Chainy ID
importancenumberImportance score (0-100)
createdAtstringISO 8601

Code Examples ​

bash
curl "https://api.chainabit.com/api/v1/ai/memory?scope=user" \
  -H "Authorization: Bearer $TOKEN"
javascript
const params = new URLSearchParams({ scope: "user" });
const res = await fetch(`${BASE_URL}/ai/memory?${params}`, {
  headers: { Authorization: `Bearer ${TOKEN}` },
});
const { data, meta } = await res.json();
python
import requests

res = requests.get(
    f"{BASE_URL}/ai/memory",
    headers={"Authorization": f"Bearer {TOKEN}"},
    params={"scope": "user"},
)
body = res.json()

POST /ai/memory ​

Create a new memory entry.

Authentication: JWT Bearer token + active AI entitlement required. Rate limit: 30/min

Request ​

FieldTypeRequiredConstraintsDescription
contentstringYesNon-empty, max 10,000 charsMemory content
scopestringYesuser, session, chain, workspaceScope for this memory
scopeIdstringNo—ID of the scoped entity (e.g., chain ID)
tagsstring[]No—Tags for categorization
originstringNouser, inferred, imported, systemMemory origin. Defaults to user
confidencestringNolow, medium, highConfidence level. Defaults to medium
evidencestring[]NoMax 20 items, each max 2,000 charsSupporting evidence for this memory
sourceEntityTypestringNochainy, chain, bit, sessionType of the source entity
sourceEntityIdstringNoUUIDID of the source entity
chainyIdstringNoUUIDLinked Chainy ID
typestringNopreference, context, behavioral, goalMemory type

Response ​

Response Example ​
json
{
  "data": {
    "id": "cm5mem01",
    "content": "User prefers morning study sessions between 7-9 AM. Learns best with visual mnemonics.",
    "scope": "user",
    "scopeId": null,
    "tags": ["preferences", "learning-style"],
    "type": "preference",
    "origin": "user",
    "confidence": "medium",
    "freshness": "active",
    "chainyId": null,
    "importance": 50,
    "createdAt": "2026-03-17T10:00:00.000Z"
  }
}
Response Fields ​
FieldTypeDescription
idstringMemory ID
contentstringMemory content
scopestringuser, session, chain, workspace
scopeIdstring | nullScoped entity ID
tagsstring[]Tags
typestring | nullMemory type: preference, context, behavioral, goal
originstring | nullMemory origin: user, inferred, imported, system
confidencestring | nullConfidence level: low, medium, high
freshnessstringMemory freshness: active, stale, archived
chainyIdstring | nullLinked Chainy ID
importancenumberImportance score (0-100)
createdAtstringISO 8601

Code Examples ​

bash
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",
    "tags": ["preferences", "learning-style"]
  }'
javascript
const res = await fetch(`${BASE_URL}/ai/memory`, {
  method: "POST",
  headers: {
    Authorization: `Bearer ${TOKEN}`,
    "Content-Type": "application/json",
  },
  body: JSON.stringify({
    content:
      "User prefers morning study sessions between 7-9 AM. Learns best with visual mnemonics.",
    scope: "user",
    tags: ["preferences", "learning-style"],
  }),
});
const { data } = await res.json();
python
import requests

res = requests.post(
    f"{BASE_URL}/ai/memory",
    headers={
        "Authorization": f"Bearer {TOKEN}",
        "Content-Type": "application/json",
    },
    json={
        "content": "User prefers morning study sessions between 7-9 AM. Learns best with visual mnemonics.",
        "scope": "user",
        "tags": ["preferences", "learning-style"],
    },
)
data = res.json()["data"]

Memory Taxonomy ​

Each memory entry is classified along several dimensions:

Scope ​

Where the memory applies.

ValueDescription
userAccount-wide — applies across all sessions and chains
sessionSession-scoped — relevant only within a specific session
chainChain-scoped — tied to a specific chain
workspaceWorkspace-scoped — shared across a workspace
chainyChainy-scoped — tied to a specific Chainy

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)

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.

  • Max content length: 10,000 characters
  • Prompt injection: Content is validated against prompt injection patterns and rejected if suspicious
  • Null bytes: Content containing null bytes (\0) is rejected
  • Empty content: The content field must be non-empty

Built with purpose.