Skip to main content

Core Concepts

StateCore Cloud wraps the StateCore memory engine. Understanding these four building blocks is enough to integrate it into your agent loop.


Scopes

A scope is a named memory partition. Think of it as a project, a user, or a context window — everything stored in StateCore lives inside a scope.

# Create a scope
curl -X POST https://api.statecore.io/v1/scopes \
-H "Authorization: Bearer sc_live_..." \
-H "Content-Type: application/json" \
-d '{"name": "my-project", "goal": "Build a CLI tool", "stage": "build"}'
FieldTypeDescription
namestringHuman-readable label
goalstring (optional)One-line purpose statement
stageenumidea | build | test | launch
templateenum (optional)project | personal | health | learning

Active scope

One scope per account can be marked active. This is the default scope used when an agent does not specify scopeId explicitly.

curl -X POST https://api.statecore.io/v1/scopes/{id}/active \
-H "Authorization: Bearer sc_live_..."

Get the current active scope via GET /v1/state:

curl https://api.statecore.io/v1/state \
-H "Authorization: Bearer sc_live_..."
# → { "activeScopeId": "f47ac10b-..." }

Memory Events

A memory event is a single unit of information written to a scope. Events are the raw input to the memory engine.

curl -X POST https://api.statecore.io/v1/memory/events \
-H "Authorization: Bearer sc_live_..." \
-H "Content-Type: application/json" \
-d '{
"scopeId": "f47ac10b-...",
"type": "stream",
"source": "api",
"content": "The database schema was finalized today."
}'
FieldTypeDescription
scopeIdUUIDWhich scope to write to
typeenumstream (conversational) | document (long-form)
sourceenumapi | sdk | cli | telegram
contentstringThe text to store
keystring (optional)Deduplication key for document-type events

Events are stored as-is. The memory engine processes them asynchronously into facts (see below).


Memory Retrieval and Facts

Retrieve

POST /v1/memory/retrieve returns the most relevant events and extracted facts for a query:

curl -X POST https://api.statecore.io/v1/memory/retrieve \
-H "Authorization: Bearer sc_live_..." \
-H "Content-Type: application/json" \
-d '{"scopeId": "f47ac10b-...", "query": "database decisions"}'

Response structure

{
"digest": "A consolidated summary of recent activity...",
"events": [...],
"factRegistry": [
{
"id": "fact-uuid",
"content": "The database schema was finalized on 2026-06-22.",
"type": "decision",
"confidence": 0.95,
"addedAt": "2026-06-22T12:00:00Z",
"evidenceId": "event-uuid",
"evidenceType": "event"
}
]
}

Facts

Facts are durable, structured pieces of knowledge extracted from events. They have:

  • type: decision | constraint | profile
  • confidence: 0–1 float
  • supersededBy: links to a newer fact that replaced this one

Facts are maintained automatically by the digest process — you do not write them directly.

A correction never overwrites: it supersedes, and the previous version stays on the record. See Auditing Memory for how to read a fact's full history, and what a digest discarded and why.

Digest

POST /v1/memory/digest triggers an explicit digest job that processes raw events into facts:

curl -X POST https://api.statecore.io/v1/memory/digest \
-H "Authorization: Bearer sc_live_..." \
-H "Content-Type: application/json" \
-d '{"scopeId": "f47ac10b-..."}'
# → { "jobId": "..." }

Digest runs automatically when certain write thresholds are crossed (configurable via policy).


Runtime Turn

POST /v1/memory/runtime/turn is the highest-level operation: it accepts a message, retrieves relevant context, generates an answer, and writes the turn back to memory — all in one request. Use this for agent loops.

curl -X POST https://api.statecore.io/v1/memory/runtime/turn \
-H "Authorization: Bearer sc_live_..." \
-H "Content-Type: application/json" \
-d '{
"scopeId": "f47ac10b-...",
"message": "What decisions have we made about the database?",
"source": "api"
}'

Response

{
"answer": "The database schema was finalized on 2026-06-22...",
"answerMode": "llm_fast_path",
"writeTier": "ephemeral",
"digestTriggered": false
}

Write tiers (writeTier) control memory durability:

TierDescription
ephemeralNot persisted beyond the session
candidateStaged for promotion via digest
stablePersisted as a durable fact
documentedStored as a structured document

Reminders

Reminders are time-based notifications tied to a scope.

# Create a reminder
curl -X POST https://api.statecore.io/v1/reminders \
-H "Authorization: Bearer sc_live_..." \
-H "Content-Type: application/json" \
-d '{
"scopeId": "f47ac10b-...",
"dueAt": "2026-06-29T09:00:00Z",
"text": "Weekly review: check project status"
}'

# Cancel a reminder
curl -X POST https://api.statecore.io/v1/reminders/{id}/cancel \
-H "Authorization: Bearer sc_live_..."

Reminders have a status of scheduled, sent, or cancelled.


API Surface Summary

EndpointTagWhat it does
POST /v1/scopesscopesCreate a scope
GET /v1/scopesscopesList all scopes
POST /v1/scopes/{id}/activescopesSet active scope
GET /v1/statescopesGet active scope ID
POST /v1/memory/eventsmemoryWrite a memory event
POST /v1/memory/retrievememoryRetrieve relevant context
POST /v1/memory/answermemoryQ&A over memory
POST /v1/memory/digestmemoryTrigger digest job
POST /v1/memory/runtime/turnmemoryFull agent turn
POST /v1/remindersremindersCreate a reminder
GET /v1/remindersremindersList reminders
POST /v1/reminders/{id}/cancelremindersCancel a reminder
GET /v1/healthhealthHealth check (no auth)

See the API Reference for full request/response schemas.