API Reference
What this page covers
The Stigmem reference node exposes a REST API owned by
Spec-03-HTTP-API, with endpoint semantics split across the
component specs listed below. The interactive API reference is
auto-generated from the OpenAPI schema served at
http://localhost:8000/openapi.json.
Endpoint groups
/v1/facts/v1/federation/*/v1/conflicts/v1/gardens/*/v1/lint/v1/decay/sweep/v1/synthesis/v1/auth/keys/*/v1/auth/audit/v1/admin/billing/events/v1/jobs/:id/v1/me/.well-known/stigmem/healthz/v1/recall/v1/cards/*/v1/graph/*/v1/facts/:id/provenance/v1/agents/:id/instruction-manifestGraph and recall endpoints
GET /v1/recall · POST /v1/recall
Returns a token-budget-bounded, salience-ranked slice of the fact store relevant to a natural-language or structured query. Uses a three-stage hybrid pipeline: lexical (FTS5/BM25), dense vector (ANN via sqlite-vec), and graph expansion (BFS on entity_edges). Results are packed with Maximal Marginal Relevance (MMR).
POST is preferred when query exceeds 1000 characters.
Key parameters:
querytoken_budgetdepthweightsentityrelationscopelambda_mmrmin_confidenceforce_refreshinclude_contradictedExample — open-ended query:
curl -s -X POST http://localhost:8000/v1/recall \
-H 'Authorization: Bearer <api-key>' \
-H 'Content-Type: application/json' \
-d '{
"query": "what is the current project status for phase 9?",
"token_budget": 2000,
"depth": 1
}'
Example — entity-centric query (card-first):
curl -s "http://localhost:8000/v1/recall?entity=stigmem%3A%2F%2Fcompany.example%2Fagent%2Fcto&token_budget=1500" \
-H 'Authorization: Bearer <api-key>'
GET /v1/cards/{entity_uri}
Fetch (and optionally force-refresh) the synthesized memory card for a specific entity. Returns 404 when the entity has no live facts.
Memory cards are pre-aggregated summaries.
Marked stale on every assert_fact call and refreshed on the next
read. When a fresh card is available during POST /v1/recall, the
recall pipeline uses it as a single synthetic fact instead of
re-ranking all raw facts for that entity.
Path parameter: entity_uri — URL-encoded entity URI.
Query parameters:
scoperefreshAuth: read permission required.
# Fetch card (auto-refreshes if stale)
curl -s "http://localhost:8000/v1/cards/stigmem%3A%2F%2Fcompany.example%2Fuser%2Falice?scope=local" \
-H 'Authorization: Bearer <api-key>'
# Force refresh
curl -s "http://localhost:8000/v1/cards/stigmem%3A%2F%2Fcompany.example%2Fuser%2Falice?scope=local&refresh=true" \
-H 'Authorization: Bearer <api-key>'
Error responses:
scope value or malformed entity_uri.GET /v1/graph/neighbors
Returns the graph neighbors of one or more seed entities by traversing the materialized entity_edges adjacency index.
entitydepthrelationmin_confidencelimitcursorSTIGMEM_CURSOR_TTL_S, default 300s).POST /v1/subscriptions
Register a push subscription to receive events when facts matching a scope or entity change. Requires a capability token covering the subscribe verb on the target.
curl -s -X POST http://localhost:8000/v1/subscriptions \
-H 'Authorization: Bearer <api-key>' \
-H 'Content-Type: application/json' \
-d '{
"target": "stigmem://company.example/project/phase9",
"target_type": "entity",
"on_change": "webhook",
"webhook_url": "https://your-agent.example/hook",
"idempotency_key": "sub-phase9-agent-assistant"
}'
Events are delivered with subscription_id, event_type (fact_asserted | fact_retracted | conflict_opened | conflict_resolved), fact_id, and hlc.
Delivery security: garden ACL + capability revocation re-checked on every event.
Event content is not populated until the ACL check passes —
preventing cross-garden fact leakage via standing event streams. If
access has been revoked since subscription creation, delivery is
silently dropped and the subscription is cancelled with event type
subscription_cancelled_access_revoked.