Skip to content

Chao Context ​

Chao is Chainabit's AI assistant. This endpoint resolves the authorized context available for a conversation, optionally scoped to a Project.

See also

Endpoints ​

MethodPathDescriptionAuth
GET/ai/chao/contextGet resolved Chao contextJWT + Entitlement

GET /ai/chao/context ​

Description ​

Retrieve the resolved Chao context. Behavior depends on whether chainyId is provided:

  • With chainyId — returns Project-scoped memories and chain productivity data for that specific project.
  • Without chainyId — returns general mode context: account-wide memories, near-term Tasks, and active Projects.

Authentication: JWT Bearer token + active AI entitlement required.

Request ​

Query Parameters ​
ParameterTypeRequiredDescription
chainyIdstring (UUID)NoThe Project to resolve context for. Must belong to the authenticated account. If omitted, general mode is returned.

Response ​

Response — Project Mode ​

Returned when chainyId is provided.

json
{
  "data": {
    "mode": "chainy",
    "chainyId": "550e8400-e29b-41d4-a716-446655440000",
    "memories": [
      {
        "content": "User prefers Morning work sessions before 8 AM.",
        "type": "preference",
        "scope": "chainy",
        "importance": 85,
        "origin": "inferred",
        "confidence": "high"
      }
    ],
    "productivitySnapshot": {
      "chains": [
        {
          "title": "Morning Run",
                    "successfulRuns": 30,
          "totalCompletions": 156,
          "status": "active"
        }
      ],
      "recentCompletions": [
        {
          "chainTitle": "Morning Run",
          "completedAt": "2026-03-20T07:30:00.000Z"
        }
      ]
    }
  }
}
Response — General Mode ​

Returned when chainyId is omitted. Chao surfaces near-term tasks and active projects across the full account.

json
{
  "data": {
    "mode": "general",
    "memories": [
      {
        "content": "User prefers concise, action-oriented advice.",
        "type": "preference",
        "scope": "account",
        "importance": 70,
        "origin": "inferred",
        "confidence": "high"
      }
    ],
    "bits": [
      {
        "id": "a1b2c3d4-...",
        "title": "Write unit tests",
        "description": "Cover edge cases for the auth module.",
        "priority": "p2",
        "scheduledFor": "2026-03-31",
        "score": 47
      }
    ],
    "chainies": [
      {
        "id": "550e8400-...",
        "title": "Morning Athlete",
        "description": "Build a consistent morning exercise executable workflow to feel energized daily.",
        "status": "active"
      }
    ]
  }
}
Response Fields — Project Mode ​
FieldTypeDescription
modestringAlways "chainy"
chainyIdstringThe Project UUID this context was resolved for
memoriesobject[]Project-scoped memory entries
memories[].contentstringHuman-readable memory content
memories[].typestringMemory type: preference, behavioral_pattern, goal, observation
memories[].scopestringMemory scope: chainy, account, workspace
memories[].importancenumberImportance score (0–100)
memories[].originstringHow the memory was created: inferred, explicit, system
memories[].confidencestringConfidence level: high, medium, low
productivitySnapshot.chains[].titlestringChain title
productivitySnapshot.chains[].totalCompletionsnumberCurrent active completion history
productivitySnapshot.chains[].successfulRunsnumberAll-time longest completion history
productivitySnapshot.chains[].totalCompletionsnumberTotal completions
productivitySnapshot.chains[].statusstringChain status: active, paused, archived
productivitySnapshot.recentCompletions[].chainTitlestringTitle of the completed chain
productivitySnapshot.recentCompletions[].completedAtstringISO 8601 completion timestamp
Response Fields — General Mode ​
FieldTypeDescription
modestringAlways "general"
memoriesobject[]Account-wide memory entries (same shape as project mode)
bitsobject[]Near-term tasks scored by date proximity and priority (max 10)
bits[].idstringTask UUID
bits[].titlestringTask title
bits[].descriptionstring | nullShort task description
bits[].prioritystringPriority: p1, p2, p3, p4
bits[].scheduledForstring | nullISO date the task is scheduled for
bits[].scorenumberComputed relevance score (higher = more urgent)
chainiesobject[]Active projects (max 5)
chainies[].idstringProject UUID
chainies[].titlestringProject title
chainies[].descriptionstring | nullProject description
chainies[].statusstringAlways "active" in this response
Error Responses ​
StatusCodeDescription
400bad_requestchainyId was provided but is not a valid UUID
401unauthorizedMissing or invalid JWT token
403entitlement_requiredNo active AI entitlement
404not_foundProject not found or does not belong to the authenticated account

Code Examples ​

In Project mode, chainyId must be the id of an existing Project — e.g. from Create Project, shown below as $CHAINY_ID.

curl "https://api.chainabit.com/api/v1/ai/chao/context?chainyId=$CHAINY_ID" \
  -H "Authorization: Bearer $TOKEN"

Built with purpose. chainabit.com