CortexDB API Reference v1
Accuracy note (2026-10-27, 0.14.0; 2026-11-09, 0.15.0). This reference describes CortexDB 0.15.0: 0.14.0, the shared-memory release, which breaks compatibility with 0.13.x in the ways §1.1 lists, and, in the sections marked "new in 0.15.0", governed memory formation, which breaks compatibility with 0.14.x in the ways §1.2 lists. The machine-readable contract is served at
GET /v1/openapi.json: CI checks it against the router's live routes, and where this document and it disagree, it wins.API_ROUTES.mdis a hand-kept inventory, not generated from the router. A section a release changed says since which version; the early design sections (§17 to §19) record intent rather than the build.view=localis an alias ofview=granular.
Status: Draft for review
Last updated: 2026-10-27 (CortexDB 0.14.0)
Owner: pmalik
Scope: the precise external HTTP / SDK contract for CortexDB. This is the reference manual.
Companion: API_DESIGN_V1.md is the narrative walkthrough — read that first if you are new to CortexDB. This document is for implementers and SDK authors who need exact shapes, capability mappings, and error codes.
Normative source: the JSON schemas in docs/schemas/ are the authoritative contract. Where this document disagrees with a schema, the schema wins. Both documents are explanatory views into the schemas.
Predecessors: docs/ARCHITECTURE_REMEMBER_INDEX_RECALL.md, docs/storage-engine-architecture.md, docs/investor_deck/cortexdb_investor_deck_explainer.md.
Constraint: there are no production users on a prior API. We may break freely; we are not designing v2-compatible.
Table of Contents
- Glossary
- Executive Summary
- Design Philosophy
- Core Concepts
- Authentication & Identity
- Authorization Framework
- HTTP Conventions
- Layer Reference
- Endpoint Reference
- The Stratified Pack
- Streaming
- Forget Semantics
- Temporal Model
- Lifecycle Events Catalog
- Audit Log Schema
- Importer Mappings
- Error Catalog
- Compatibility Matrix
- Deferred Decisions
- Implementation Order
- Appendices
Plane sections (unnumbered, after §20):
- Code memory (
/v1/code/*) - Native commitments (
/v1/memory/commitments/*) - Native memory host (
/v1/memory/source-erasure/*,/v1/experience/status,/v1/experience/resume)
0. Glossary
| Term | Definition |
|---|---|
| Actor | The principal performing an operation. Typed: user:, agent:, service:, system:. |
| Bi-temporal | Records carry two independent time axes: when the fact was true in the world (event time) and when CortexDB learned of it (ingest time). |
| Capability | A discrete, named permission (e.g., forget.gdpr). Granted/denied by the four-tier policy stack. |
| Capture | The synchronous write of an event to the WAL. The only synchronous step in the write path. |
| Consolidate | The async stage where facts merge, beliefs revise, and understanding nodes synthesize. |
| Derived layer | Any layer whose contents are computed from events. Facts, Beliefs, Episodes, Understanding are derived; Events are not. |
| Experience envelope | The structured input payload to POST /v1/experience. Replaces messages in peer APIs. |
| Holistic view | On public recall, the requested scope plus authorized ancestors and authorized descendants, never siblings. Direct layer-list endpoints use holistic for the requested scope plus authorized ancestors only. |
| Layer | One of the five memory tiers: Events, Episodes, Facts, Beliefs, Understanding. |
| Memory | A polymorphic noun used in marketing. Internally we say "record at layer X." Avoid in API design. |
| Pack | The stratified output of POST /v1/recall: layers + context block + provenance + diagnostics. |
| Refcount | For an uploaded blob: how many surviving events still reference it (source_blob_ids, a blob_ref). An erasure deletes a blob only once none does. |
| Scope | A /-delimited path of type:id segments that names a memory partition. Workspaces are scopes too. |
| Stratified pack | See Pack. |
| Token | A signed bearer credential carrying actor identity and a capability set. |
| WAL | Write-Ahead Log. RocksDB-backed. The append-only source of truth. |
1. Executive Summary
CortexDB exposes a layer-aware, scope-unified, bi-temporal memory API for AI agents. It differs from peer systems on nine points:
- Five addressable memory layers, not one flat memory pool. Clients can read Beliefs, Facts, Episodes, Events, and Understanding separately or as a stratified pack.
- Unified scope paths that subsume "workspaces" — there is one namespace primitive, hierarchical with opt-in registration and ACLs.
- Four-tier authorization (deployment → tenant → scope → actor) with capability-level attribution on every denial.
- Signed-token identity mandatory on every call; tokens can only narrow what policy already allows.
- Async-first writes with an SSE lifecycle stream; sync available via
waitparameter. - Bi-temporal everywhere, with
as_of,valid_during,recorded_during, and natural-language temporal qualifiers across all layer reads. - Verifiable GDPR erasure —
/v1/erasuresdeletes the selected events and everything derived from them, keeps an uploaded blob only while another surviving event references it, and leaves a durable receipt that/verifyre-reads every store against (§8.6). - Streaming recall in both granular (per-layer-as-ready) and narrative (token-by-token) modes.
- Native importers for Mem0, Zep, Letta, OpenAI memory exports, and generic JSONL — in both
strict_temporalandbatch_throughputordering modes.
The public surface comprises about 260 operations on about 220 paths under /v1/, /access/v1/ (AuthZEN), /scim/v2/ (SCIM) and /mcp, plus SSE streams and a token verifier protocol; GET /v1/openapi.json lists every one.
1.1 What 0.14.0 changes (breaking)
0.14.0 is the shared-memory release, on the customer channel. It is one breaking release: a deployment that sets none of the new variables sees each change of the first list at its first boot. Back up the data directory before upgrading (scripts/cold_backup.py backup <data_dir> <archive>): that boot arms the directory one way, and the way back to 0.13.x is the backup, never the 0.13.x binary on the upgraded directory, which refuses it.
Breaking changes. What a deployment that sets nothing sees, and what turns each back where anything does:
- The data directory arms for shard apply format 10 at its first boot. The boot logs
SHARD_ARMED_ONE_WAY(at that boot and every later one), and a 0.13.x binary refuses the directory.CORTEX_FORMAT_CEILING=7([engine] format_ceilingon a cluster data node) keeps it unarmed; the routes that write a record of a newer format then answer503 FORMAT_UPGRADE_PENDING, which an armed node never answers (§16). A record at a reserved path also holds a node unarmed (reserved_path_in_use). - The operator key's data reads on
cloud_shared_saas.CORTEX_OPERATOR_DATA_READSdefaults to the preset's mode:denyoncloud_shared_saas, so the operator key's reads of stored rows, its content-returning admin routes, its reads of private regions and its in-band paths (minting data-capable tokens, registering scopes, writing into private regions and shared org-tree scopes) answer403 BREAK_GLASS_REQUIREDwithoutX-Cortex-Break-Glass;allowon the other presets and with auth disabled. An application that reads with the operator key setsallow(oraudit, which counts whatdenywould refuse) until its traffic moves to per-person tokens (§8.15.3). - Every
CORTEX_<CHECK>_ENFORCEswitch enforces by default.on, blank or unset enforces;offserves what the check would refuse and counts it under the access report's check of the same name (GET /v1/admin/access/report, §8.30); any other value refuses the boot (exit 78AUTH_CONFIG_INVALID). Each is read once at boot, and is an[engine]variable on a cluster data node:
| Switch | Refuses by default |
|---|---|
CORTEX_MINT_LIFETIME_ENFORCE | a mint above its subject's lifetime ceiling (422 INVALID_BODY, ttl_too_long), and a presented token this server's minter signed above it (401 INVALID_TOKEN_CLAIM, lifetime_over_ceiling): by default 90 days for a person (7 in 0.14.0), 7 for an agent, 30 for a service, each a setting since 0.14.1 (CORTEX_MINT_MAX_LIFETIME_PERSON, _AGENT, _SERVICE, _CHAIN; §4.7.4) |
CORTEX_TOKEN_CONFINEMENT_ENFORCE | a capability no scopes entry names, on a token that carries scopes (403 POLICY_DENIED, details.link: "confinement", §4.7.3) |
CORTEX_MINT_REACH_ENFORCE | a mint past its minter's reach (§8.16.3, "The mint's reach"): caps_exceed_minter, scopes_exceed_minter, deployment_mint_requires_operator and minted_token_cannot_mint (403 POLICY_DENIED), scopes_span_roots (422 INVALID_BODY). A deployment's minting service token, such as service:website-minter, holds auth.mint and, at *, every family the tokens it mints carry, and passes these rules like any minter, with no exemption |
CORTEX_MINTER_LINK_ENFORCE | a decision for a token another principal minted, where that minter could not act (403 POLICY_DENIED, details.link: "minter", §4.7.5) |
CORTEX_DUPLICATE_MEMBER_ENFORCE | a registry write whose roster lists a principal twice (422 INVALID_BODY, duplicate_member, §8.8) |
CORTEX_RESERVED_PATH_ENFORCE | a registration or a first write at a marker path, <tenant>/{orgtree,holds,access}:changes or <tenant>/self:* (422 INVALID_SCOPE_GRAMMAR, reserved_path) |
CORTEX_ROLE_BLIND_MEMBERSHIP_ENFORCE | nothing yet: GET /v1/scopes/list, the audit.read.cross_actor boundary and the commitment transport's read side ask for Reader by name, which changes no decision while no role below Reader exists |
CORTEX_PERSON_DISPLAY_NAME_ENFORCE, CORTEX_DISPLAY_NAME_IN_RECORD_ENFORCE | a version-1 registry write that sets tree.display_name (422 INVALID_SCOPE_TREE, person_display_name on a person or employee record, display_name on any other): a name lives in the directory (§8.27) |
CORTEX_AUDIT_RETENTION_ENFORCE | where the deployment names its preset (CORTEX_DEPLOYMENT_PRESET) or sets CORTEX_AUDIT_RETENTION, a daily sweep deletes the audit rows older than audit.retention: P2Y on cloud_shared_saas, P1Y on on_prem_enterprise, P3Y on cloud_private, P7D on dev_local (§8.10) |
CORTEX_DELIVERY_GATE_ENFORCE | a row whose home, or an atom of which, the reader may not read, on every route that returns rows: a lifecycle subscriber needs scope.read.local at each row's home, and a by-id read of a withheld row is 404 (§9) |
- Tokens (§4.7). A token that carries
scopesholds only the families its entries name (above), and one that carriesactorrun, orapporclientresolving to"agent", is confined so whatever the switch. Every token this server's minter signs carriesminter; one whose minter is not"operator", or that carries a chain field, is signed with the chain assertion, which 0.13.x refuses. A hosted mint (tenant) fordefault,devor the deployment audience's own tenant is422 INVALID_BODY,reserved_tenant. A tenant-audience token's<capability>:*entry reaches only its ownorg:<tenant>root, while a token signed elsewhere with such an entry, which 0.13.x confined to nowhere, now holds that family wherever its audience reaches. Revoking a token other than the presented one takes the trusted operator (§4.5). - The mint's reach (§8.16.3). A minted token reaches no more than its minter: it names one tenant root, its
capsandscopeslie within the minting credential's own, and a token another principal minted never mints. A deployment's minting service token, such asservice:website-minter, has no exemption: it holdsauth.mintand, at*, every family its account tokens carry (an account token is the customer's full credential: forget, import, export, audit, blobs, lifecycle and the rest, not only the scope families), and names the account token'scaps, so a hosted deployment re-mints its website token with every family its account tokens carry when it upgrades.CORTEX_MINT_REACH_ENFORCE=offmints as 0.13.x did and counts each mint the rules would refuse (checkmint_reach). CORTEX_REVOCATIONS_V2is on. Token ids are namespaced by their issuer, and a revocation sent withexpis pruned after it (§4.5).offkeeps 0.13.x's journal.- Strict forget and erasure selectors. A selector field the route does not apply is
422 INVALID_BODY,unknown_selector_field(key_selector_not_supportedforidempotency_keysorcapture_keyson an erasure route, which would otherwise leave the selector empty;field_not_appliedforconfirmwithoutsubjecton/v1/erasures, and on a forget underredact_eventsfor afact_orent_id inmemory_idsor any selector field whilelayersleaves the events out, withdetails.fields); a forget'slayersname outsideevents,episodes,facts,beliefs,understandingandcodeisunknown_layer;/v1/forget/previewrefuses afrom_preview_idthe forget would refuse (UNKNOWN_PREVIEW_ID) (§8.5, §8.6). - Companion paths. A registration or a first write whose leaf is a record-only type (
attrs,set,hold,policy) is422 UNREGISTERED_SCOPE_TYPEon every node, even where the deployment lists the type; such records come through change sets (§8.22). - Limits are enforced at their settings (§8.20). A change that would take an org past
brain_scopes(520,000),sources(16, at most 16),containers_per_source(50,000),sets(50,000) orpolicies(64) is409 ACCESS_LIMIT_REACHED, and pastapps(8)409 APP_LIMIT_REACHED, withdetails.limit,value,used,settingandscope.CORTEX_LIMIT_<NAME>(limits.<name>in a data node's[engine]) sets each. - A restored copy holds its roots (§8.24). A backup taken after the upgrade restores with its roots answering
503 ACCESS_RESTORE_PENDING(not retriable) until their access sources, or the trusted operator, acknowledge;cortexdb restore-check --access-state unchangedreleases a copy whose access state did not change since the backup. NON_HUMAN_WRITE_UNSUPPORTEDis retired. An agent's or a service's chain write carries the atoms and provenance of what its chain read, and is redirected to its writer's private space when it must be (redirected_to;403 ATOMS_REDIRECT_REFUSEDwhen it cannot be) (§8.1).CORTEX_DECISION_LOGdefaults todenials: every refused request writes a decision line under the tracing targetcortex_api::decision;reportkeeps the old output.- Audit rows'
headers_hashno longer covers the values ofAuthorization,X-Cortex-Subject-TokenandX-Cortex-Break-Glass, only their names (§14). - A retention sweep's or a WAL compaction's body is never ignored. A body sent without a JSON
Content-Typeis415 UNSUPPORTED_MEDIA_TYPE; 0.13.x ignored it, so{"dry_run": false}sent without the header ran as a dry run. No body at all is still the defaults, a dry run (§8.15.1). - Registered temporal phrases change reads. A
temporal.natural(or/v1/compose'stime) equal to thepatternof a phrase registered in the caller's namespace reads that phrase's window, before the built-in grammar (§8.17, §12.4); in 0.13.x registering a phrase changed no read. - One status and one flag per code (§6.6, §16).
INTERNALis retired for500 INTERNAL_ERROR, which is retriable (but withdetails.refusal), andSTORAGE_ERRORfor503 BLOB_STORE_ERROR;/v1/blobs' failures are 503s and its multipart refusal is415 UNSUPPORTED_MEDIA_TYPE. The rule stops at SCIM, whose statuses identity providers act on: thereCHANGESET_STAGING_FULLis503withRetry-After,ACCESS_RESTORE_PENDINGcarriesRetry-After: 30andTENANT_DELETEDis401(§8.28).DB_SATURATED,DB_UNAVAILABLE,PROVIDER_SATURATED,PROVIDER_UNAVAILABLE,ANSWER_PROVIDER_ERRORandMEMORY_INGESTION_UNAVAILABLEare retriable on every route, and a storage lane past its execution deadline is504 DB_TIMEOUTon every route;TENANT_MAPS_UNSUPPORTED,BIND_MISMATCHand a malformed entry's refusal are not retriable. The usage and plan routes answerINVALID_SCOPE,INVALID_RANGEandSCOPE_REQUIREDas 422s. A malformedX-Cortex-Actoris400 INVALID_HEADER, a wrong operator key401 MISSING_TOKENwith or without the header, a single node whose revocation journal failed503 REVOCATION_UNAVAILABLEfor every token, a path no route serves404 NOT_FOUND, and a method a path does not serve405 METHOD_NOT_ALLOWED, in the envelope.
New surfaces. Each is listed on GET /v1/admin/version under its capability; every name below is new in 0.14.0:
| Surface | Capability | Section |
|---|---|---|
Principal-chain token claims, the issuers file, the exact <path>! scopes entry | principal_chain_v1 | §4.7 |
Chain fields on a mint, the stamped minter | mint_chain_v1 | §4.7.5, §8.16.3 |
<capability>:* scopes entries | confinement_wildcard_v1 | §4.7.3 |
Consistency tokens: consistency, ?consistency=1, ?at_least= | consistency_tokens_v1 | §6.11 |
Operator modes and X-Cortex-Break-Glass; a tenant's own mode | operator_break_glass_v1, tenant_access_settings_v1 | §8.15.3 |
check, explain, the lookups, the limits, a scope's enrichment | access_check_v1, access_lookup_v1, access_limits_v1, enrich_backfill_v1 | §8.20 |
| AuthZEN 1.0 | authzen_v1 | §8.21 |
| Change sets | access_changesets_v1 | §8.22 |
watch and notices | access_watch_v1, access_notices_v1 | §8.23 |
| Restores: the registry listing and the acknowledgements | access_changesets_v1 | §8.24 |
| Source containers: rehomes, watermarks, account resolution | source_containers_v1 | §8.25 |
| Application records and mounts | app_records_v1, recall_mounts_v1 | §8.26 |
| The directory | directory_v1 | §8.27 |
| SCIM 2.0 | scim_v1 | §8.28 |
| Rollups and publish | rollups_v1, publish_v1 | §8.29 |
| Access administration: the access report and the subject-token shadow, tenant settings, the tenant rebind, the issuers file's reload | access_report_v1, subject_token_shadow_v1, tenant_access_settings_v1 | §8.30 |
The HTTP MCP server, behind CORTEX_MCP (off by default) | mcp_http_v1, flag-gated: listed only while CORTEX_MCP is on | §8.31 |
| A person's erasure; a tenant's deletion; an outside party's erasure | person_erasure_v1, tenant_erasure_v1, party_erasure_v1 | §8.6.9, §8.6.10, §8.6.3 |
| A forget by idempotency key or capture key | forget_by_key_v1 | §8.5 |
Read sets of up to 40 scopes, coverage, beliefs: "merged" | extra_scopes_40_v1, recall_coverage_v1, beliefs_merged_v1 | §8.3 |
A read's declared purpose: on the reads, on check and explain, and in AuthZEN's context | read_purpose_v1 | §8.3, §8.20.1, §8.21.1 |
provenance on writes, redirects | write_provenance_v1 | §8.1, §8.2 |
| The org trees 0.13.0 shipped, by name | org_tree_v1 | §8.8.7 |
New error codes (§16 has each in full):
| HTTP | Codes | Where |
|---|---|---|
| 400 | INVALID_HEADER | a request header that does not parse: an X-Cortex-Actor that is no principal id (§4.1), an operator-key request's or a deployment minter's mint's malformed, repeated or oversized X-Cortex-Break-Glass, in every mode (§8.15.3), a lifecycle stream's Last-Event-ID (§8.9), the If-Match of a directory or SCIM User write (§8.27, §8.28); details {part: "header", field, reason} |
| 401 | INVALID_TOKEN_CLAIM, CLAIM_NOT_PERMITTED, SUBJECT_UNMAPPED | token verification; SUBJECT_UNMAPPED deactivated on every route (§4.7.6) |
| 401 | FRESH_AUTH_REQUIRED, with WWW-Authenticate | a publish of a norm (§8.29) |
| 403 | BREAK_GLASS_REQUIRED | the operator key under deny (§8.15.3) |
| 403 | RUN_REQUIRED, APP_NOT_ADMITTED, ATOMS_REDIRECT_REFUSED, PUBLISH_PERSON_REQUIRED | §4.7.2, §8.26, §8.1, §8.29 |
| 405 | METHOD_NOT_ALLOWED, with Allow | a method a path does not serve, on every route (§6.6) |
| 408 | WAIT_TIMEOUT with details.waiting_on registry, indexer, declared or access_view (retriable) | a consistency demand (§6.11) |
| 409 | CHANGESET_NOT_STAGED, CHANGESET_STALE, CHANGESET_STAGING_FULL, CHANGESET_CONFLICT, CHANGESET_INCOMPLETE, PREVIEW_CHANGED, ACCESS_ASSERTION_FAILED, REGISTRY_NOT_REPLICATED | change sets (§8.22); SCIM answers CHANGESET_STAGING_FULL as 503 with Retry-After (§8.28) |
| 409 | ACCESS_LIMIT_REACHED, APP_LIMIT_REACHED | a change past a limit (§8.20, §8.26) |
| 409 | PROVENANCE_ERASED, HOLD_IN_FORCE, ERASURE_NOT_CANCELLABLE, RESTORE_NOT_PENDING, DIRECTORY_ACCOUNT_TAKEN, ACCESS_REPORT_OFF, ICE_FORK_UNSUPPORTED | §8.1, §8.6.10, §8.6.5, §8.24, §8.27, §8.30, §8.15.6 |
| 410 | TENANT_DELETED | every request of a tenant whose deletion began, but the trusted operator's (§8.6.10); 401 on SCIM (§8.28) |
| 410 | ROLLUP_SUPERSEDED | a rollup by id, or a publish of one, that is not part of its topic's current build (§8.29.3) |
| 412 | DIRECTORY_VERSION_CHANGED | a conditional directory write (§8.27) |
| 413 | CHANGESET_TOO_LARGE | §8.22 |
| 422 | CONSISTENCY_TOKEN_INVALID, INVALID_ACCESS_RECORD, INVALID_MOUNTS, CROSS_ROOT_PROVENANCE, PROVENANCE_UNKNOWN, DIRECTORY_MALFORMED, PUBLISH_TOO_LARGE | §6.11, §8.22, §8.26, §8.1, §8.27, §8.29 |
| 501 | COHORT_UNSUPPORTED | /v1/answer with cohort on a native answer host, which serves no cohort answer (§8.4.2) |
| 501 | SCIM_UNSUPPORTED | every SCIM route, on a deployment whose CORTEX_TENANT_DEPTH is above 1 (§8.28) |
| 503 | FORMAT_UPGRADE_PENDING (only on a node held below a format; retriable for members_behind), NOTICE_UNAVAILABLE (retriable but arming_disabled and reserved_path_in_use), ISSUER_KEYS_UNAVAILABLE (with Retry-After), TENANT_SETTINGS_UNAVAILABLE (retriable, §8.15.3), ACCESS_VIEW_UNAVAILABLE (building retriable), REHOME_TAIL_PENDING, TENANT_WRITES_IN_FLIGHT, and the erasure re-plans HOLD_CHANGED, ERASE_FORMAT_STALE, PROVENANCE_CLOSURE_CHANGED, ERASE_SCOPE_MOVED, DERIVED_CLOSURE_CHANGED | §16 |
| 503 | ACCESS_RESTORE_PENDING, not retriable: hold the request until the root's restore is acknowledged | every route naming a restored root (§8.24); a SCIM Group write answers it with Retry-After: 30, which its provider retries (§8.28) |
Existing codes with new uses: POLICY_DENIED (details.link confinement, tenant or minter, §5.1.2; details.reason on mints, identity accounts and reference roots, purpose_required (with details.purpose) on a read refused only for want of the purpose its roster path names, §8.3, and token_root_not_written for a ?consistency=1 write whose ?scope= or ?path= names a root its body does not write, §6.11), INVALID_BODY (the mint's chain rules, the strict selectors), NOT_FOUND (a path no route of this server serves, §6.6), SCOPE_MOVING (503, retriable: a change set, a registry route's change (§8.8, §8.26), a text erasure (§8.20.7), a source route, a directory or SCIM Users write, or a notice or restore acknowledgement, on a root moving between shards; details.roots, details.refusal), REVOCATION_UNAVAILABLE (a single node whose revocation journal failed, §4.5), DB_SATURATED and DB_TIMEOUT (also the usage, plan, export, maintenance and re-derivation routes, §16), INVALID_TOKEN_SIGNATURE, EXPIRED_TOKEN, REVOKED_TOKEN and WRONG_TENANT (with details.issuer on an issuers-file token or a chain token), WAL_UNAVAILABLE (a directory, a consistency token's state or the notices' state that did not read), ERASURE_JOB_CAPACITY (retriable, Retry-After: 30, §8.6.3), DESTRUCTIVE_OPERATION_IN_PROGRESS (a person's erasure while one of the same person runs, §8.6.9), INDEXING_FAILED (its details.remediation now says not to re-send, and GET /v1/experience/status answers its write resend: "no").
1.2 What 0.15.0 changes (breaking)
0.15.0 adds governed memory formation (RELEASE_NOTES_0.15.0.md), on the customer channel: derivation policies, recorded verdicts, corrections, review before commit, outside workers and a read-time use rule. Every new surface is experimental (§2.4.3). Its first boot arms the data directory one way, as 0.14.0's did: back up the data directory before upgrading. With no derivation policy, subject settings or correction, every recall pack, answer and default read is answered as 0.14.2 answers it, but for the changes below. Re-derivation (derivation_rederive_v1: regate and reextract, POST /v1/derivation/rederive*, §8.32.7; GET /v1/derivation/report, §8.32.8) brings what was learned before a policy change in line with it.
Breaking changes.
- The data directory arms for shard apply format 11 at its first boot (
SHARD_ARMED_ONE_WAY,format_armed.json{"format": 11}), and a 0.14.x binary then refuses it.CORTEX_FORMAT_CEILING=10([engine] format_ceilingon a cluster data node) holds it at 10, where the routes that write a record of format 11 answer503 FORMAT_UPGRADE_PENDING(arming_disabled); on a single node the console sets the ceiling as a one-way setting (§8.15.7). directives.extractlimits what is derived to the stages it names (§3.5.3):["entities"]no longer yields facts,["facts"]feeds no belief unlessbeliefsis named, an event with a list joins episodes only when it namesepisodes(so a rebuild changes those episodes' membership and ids), and[]derives nothing. A reference root builds no episodes. A typed triple's list is still ignored.- A write naming a directive nothing reads carries
directive_not_enforced:<name>in its ack'swarnings(§3.5.3). - A companion put that leaves
enrichout keeps the stored value;"inherit"clears it, and the staging answer and the preview warn (enrich_kept, §8.22.1, §8.22.3). - Entity-extraction calls are priced, each with its input and output tokens and its model (
GET /v1/admin/usage,entity_extraction), and the re-derivation estimates (§8.15.2), theenrichbackfill's budget (§8.20.6) and retention's distill (§8.15.1) add an entity term priced onCORTEX_LLM_MODEL(else the enrichment model): with that model unpriced the backfill waits (unpriced_model) and the distill keeps to its daily event cap. - Conflict resolution becomes corrections on a shard armed for 11, so recall,
/v1/factsand/v1/beliefssee it on every replica, and the answer gainscorrection_ids(§8.7.21). - The source importers' rows are idempotent (
import:<provider>:<id>keys), takecategory:,meta:andletta_kind:labels, amodeand the stampimport:<provider>@1(§8.11). - A cluster data node runs neither the fact sweeper nor the fact consolidator (boot warning
FACT_MAINTENANCE_OFF_DATA_NODE), since both wrote facts the leader alone held. /v1/vocabulariessteers no extraction (§7.3.1, §8.14): the promise is retracted; a derivation policy'spredicatesreplace it.
New surfaces (each listed on GET /v1/admin/version under its capability, §8.15):
| Surface | Capability | Section |
|---|---|---|
include=derivation on the fact and belief reads, GET /v1/derivation/decisions, the status's extraction block | derivation_provenance_v1 | §7.4.3, §8.7.22, §8.7.12 |
derived_by on typed triples and declared beliefs, and its status report | derived_by_v1 | §3.5.3, §8.7.15, §8.7.12 |
Derive records in change sets; the policy read, templates, taxonomy, subject settings, policy texts and the policy test; derivation.administer.scope | derivation_policy_v1 | §8.22.7, §8.32 |
Corrections, GET /v1/memory/about, conflict resolution as corrections | corrections_v1 | §8.7.24, §8.7.25, §8.7.21 |
| Review before commit | derivation_review_v1 | §8.7.27 |
The change feed, its consumer marks and GET /v1/derivation/feed/consumers | derivation_feed_v1 | §8.7.23, §8.7.28 |
| Declared episodes | declared_episodes_v1 | §8.7.26 |
session on the read routes and the read-time use rule | derivation_use_rules_v1 | §8.32.5 |
The shard's format and its ceiling (shard_format) | (none) | §8.15.7 |
New error codes (§16 has each in full; none is retriable): 409 CORRECTION_CONFLICT, REVIEW_ITEM_DECIDED, WRITER_NOT_ALLOWED, FORMAT_ARMED_ONE_WAY; 422 CORRECTION_TARGET_UNKNOWN, DERIVATION_POLICY_INVALID, DERIVATION_POLICY_WIDENS, DERIVATION_MODEL_NOT_ALLOWED, DERIVATION_TEXT_INVALID, POLICY_TEST_TOO_LARGE, DERIVED_BY_INVALID, FEED_CURSOR_INVALID, ONE_WAY_CONFIRMATION_REQUIRED; and the shard's GOVERNED_MALFORMED and LEARNED_MALFORMED. Existing codes with new uses: FORMAT_UPGRADE_PENDING (every route that writes a format-11 record), IDEMPOTENCY_CONFLICT (a correction's and a declared episode's keys, an import row changed under its id), PROVENANCE_ERASED and PROVENANCE_UNKNOWN (declared episodes, review decisions), EVENT_LIST_UNAVAILABLE (a feed page an erasure overtook) and COHORT_WARMING (a cohort read under a use rule).
2. Design Philosophy
2.1 Five non-negotiables
- Events are immutable. The WAL is the source of truth. Every derived layer is reproducible by replay. There is no API that mutates a stored event payload.
- Bi-temporal at the boundary. The API accepts and returns both
valid_*andrecorded_*timestamps on every layer record. Single-time-axis models are not interoperable with us. - Async writes are normal. Captures return immediately. Clients that need read-after-write must opt in via
wait. - Policy is observable. Every denial cites the tier and the specific capability. No opaque 403s.
- Forget means forget, but proportionally. Default forget wipes derived layers and keeps events. GDPR erasure (
/v1/erasures) deletes the events and what was derived from them, and proves it with a receipt.
2.2 What we explicitly reject
- Soft delete. No tombstones in the user-visible API. Records are either present or gone.
- A single flat memory bag. Mem0's pattern; we will not adopt it.
- Implicit tenancy. Every call carries a token whose
subandaudare explicit. - Opaque ranking. Recall responses include the plan, the filters applied, and the scoring contribution from each signal.
- Backwards-compat shims. There is no v0; there will be no v0-to-v1 adapter.
2.3 Inspirations and what we did differently
| Source | Borrowed | Did differently |
|---|---|---|
| Mem0 | Async writes; reference_date temporal anchor | Kept a graph; added layers; added bi-temporal; added verifiable GDPR erasure |
| Zep | Bi-temporal facts; synthesized context block | Extended bi-temporal to all layers; stratified pack with layers + context; added Belief layer |
| Letta | Shared blocks across agents | Scope = ACL primitive; no separate "blocks" concept |
| Cognee | ECL pipeline; partial+honest contract | Replaced ECL with our five-stage cycle; ECL bleeds implementation; ours bleeds purpose |
| LangMem | Tuple namespaces with template variables | String paths (operator-readable); hierarchical inheritance |
| Du et al. (arXiv:2505.00675) | Six atomic operations as observable | Surfaced as SSE lifecycle events, not separate verbs |
| Generative Agents | Citation pointers as explainability | Required in every recall response; the provenance block |
2.4 Stability Tiers
The full conceptual surface ships at v1. To remove ambiguity for implementers and SDK consumers, every endpoint and capability is assigned a stability tier. The tier governs change semantics, not feature completeness:
| Tier | Change policy | Response header |
|---|---|---|
| Stable | Additive only. Breaking changes require a major version bump (none planned pre-1.0). Capability defaults frozen in deployment presets. SDKs commit to these. | X-Cortex-Stability: stable |
| Beta | May break with one-release notice. Shapes tracked but not yet pinned. Capability defaults may shift between minor releases. | X-Cortex-Stability: beta |
| Experimental | May break or be removed without notice. Served on every preset (no setting gates the tier: a surface that needs one names its own flag). Documented and shipped — but not load-bearing for early adopters. | X-Cortex-Stability: experimental |
2.4.1 Stable surface (SDK-committed)
| Endpoint family | Notes |
|---|---|
POST /v1/experience (incl. /bulk) | Core write |
POST /v1/recall (non-streaming + granular streaming) | Core read |
POST /v1/answer (non-streaming) | Recall + LLM, with full provenance contract |
POST /v1/forget (cascades: derived_only, redact_events) | Non-GDPR forget |
GET /v1/events, /v1/episodes, /v1/facts, /v1/facts/timeline | Layer reads |
GET /v1/scopes, POST /v1/scopes, PUT /v1/scopes/members, PUT /v1/scopes/tree, DELETE /v1/scopes | Scope management (query-param addressed; see §8.8; org trees §8.8.7) |
GET /v1/lifecycle/stream (SSE), GET /v1/lifecycle/event/{lce_id}, GET /v1/lifecycle | Lifecycle |
GET /v1/policy/effective, GET /v1/policy/deployment | Policy introspection (read) |
GET /v1/audit, GET /v1/audit/{audit_id}, POST /v1/audit/verify | Audit |
POST /v1/blobs, GET /v1/blobs/{blob_id}, DELETE /v1/blobs/{blob_id} | Legacy fresh-ID blobs |
POST/DELETE /v1/blobs/idempotent, GET /v1/blobs/idempotent/status | Crash-safe keyed blobs (single-node only; §8.13.4) |
POST /v1/auth/revoke | Token revocation |
GET /v1/admin/health, GET /v1/admin/metrics, GET /v1/admin/version | Admin introspection |
2.4.2 Beta surface (shape solid, semantics maturing)
| Endpoint family | Maturity notes |
|---|---|
GET /v1/beliefs, GET /v1/beliefs/why | Confidence/CI math may shift; stance enum may extend |
GET /v1/understanding, GET /v1/understanding/{id}, GET /v1/understanding/{id}/related, GET /v1/understanding/coverage | Returns _partial: true until full synthesizer ships |
POST /v1/import, POST /v1/import/* (mem0, zep, letta, openai, jsonl) | Mapping tables evolve with source-system versions |
POST /v1/export | Export formats track import (an export answers in its own response; there is no GET /v1/export/{export_id}) |
POST /v1/vocabularies, GET /v1/vocabularies (list) | Vocabulary surface (register + list; no per-name GET/PUT in v1) |
POST /v1/temporal/phrases, GET /v1/temporal/phrases | Custom temporal phrase registration |
2.4.3 Experimental surface (documented, ship-with-flag)
No setting gates the tier (a surface that needs one names its own flag, as the cohort lanes' CORTEX_COHORT does). Calls return X-Cortex-Stability: experimental.
| Surface | Why experimental |
|---|---|
Governed memory formation (new in 0.15.0, §1.2): GET /v1/derivation/decisions, /feed, /feed/consumers, /policy, /templates, /taxonomy, /texts, /settings (PUT, GET, DELETE), POST /v1/derivation/policy/test and /texts/erase; /v1/corrections*; GET /v1/memory/about; GET /v1/review and POST /v1/review/decisions; POST /v1/episodes and DELETE /v1/episodes/{id} | Every capability of governed memory formation is experimental in 0.15.0; GET /v1/derivation/status's new extraction block and derived_by report ride that route's own answer and header |
POST /v1/erasures (GDPR erasure), POST /v1/erasures/preview, GET /v1/erasures/{erasure_id}, GET /v1/erasures/{erasure_id}/verify, GET /v1/erasures/{erasure_id}/receipt, POST /v1/erasures/{erasure_id}/cancel | Erasure semantics await legal-review feedback |
POST /v1/recall with view=narrative; POST /v1/answer with stream=true (token stream) | Narrative streaming — token-level UX and shape may evolve |
POST /v1/understanding/synthesize | Synthesizer not yet stable |
forget.gdpr.cross_workspace capability and propagation | Co-owned workspace propagation rules likely to refine |
POST /v1/scopes/prune | Cleanup automation |
POST /v1/admin/compaction/dedup, POST /v1/admin/index-audit | Operator surface beyond introspection |
2.4.4 Per-response signal
Every response carries X-Cortex-Stability with the tier of the endpoint hit. SDKs surface a one-time deprecation warning when calling non-Stable endpoints unless the caller has explicitly opted in via client.allow_unstable(true) or equivalent.
2.4.5 Tier promotion criteria
| From | To | Gate |
|---|---|---|
| Experimental → Beta | Two independent customer integrations exercising the surface for ≥30 days without semantic complaints. | |
| Beta → Stable | One full minor-release cycle with no breaking-change PRs touching the endpoint, plus an SDK type freeze. | |
| Stable → (next major) | Explicit X-Cortex-Deprecation header set for ≥90 days before removal. |
3. Core Concepts
3.1 The Five Memory Layers
| Layer | Purpose | Atomic unit | Mutability | Time semantics |
|---|---|---|---|---|
| Events | Lossless capture of experience | A WAL entry | Immutable | observed_at (event time) + recorded_at (ingest time) |
| Episodes | Bounded spans of related events | A causal chain with start/end | Sealed once consolidated | started_at / ended_at; bi-temporal at boundaries |
| Facts | Triple-shaped atemporal/temporal assertions | (subject, predicate, object, validity) | Supersedable | Full bi-temporal: (valid_from, valid_to, recorded_from, recorded_to) |
| Beliefs | Probabilistic claims about state of the world | A claim with confidence + supports | Continuously revisable | Bi-temporal + last_revised_at |
| Understanding | Synthesized conceptual model | A concept node + edges | Versioned | version + valid_from; revisions chained |
3.1.1 Why these five and not three
- Mem0 has "facts" only — they cannot distinguish "what I observed" (Events) from "what I concluded" (Beliefs), so they cannot answer "why do you think that?"
- Zep has facts + episodes — they collapse Belief into Fact, losing confidence as a first-class field.
- We separate lossless capture (Events), bounded recall (Episodes), structured assertion (Facts), probabilistic conclusion (Beliefs), and conceptual synthesis (Understanding). This is the minimum set that lets us answer every recall mode the deck promises.
3.1.2 Layer derivation graph
(synthesize)
Events ──(window)──▶ Episodes ──(extract)──▶ Facts ──(rank+revise)──▶ Beliefs
│ │ │
└──────────────────(group + abstract)────────────┴──────────────────────────┴──▶ Understanding
Every derived record carries a supports: [event_id, ...] field. Walking this is the "why" trail.
3.2 The Six Atomic Operations
Adopted from Du et al. (arXiv:2505.00675). They are not separate endpoints — they are observable lifecycle events that fire as the async view builder works.
| Operation | Fires when | Visible via |
|---|---|---|
| Capture | WAL append succeeds | event: captured on SSE; wait=captured returns |
| Index | Event indexed in BM25 + HNSW | event: indexed; wait=indexed returns |
| Update | Fact ADD/UPDATE/NOOP decision | event: extracted and event: consolidated |
| Consolidate | Beliefs revised; Understanding nodes touched | event: consolidated; wait=consolidated returns |
| Forget | Records deleted | event: forgotten |
| Compress | Episodes sealed; Understanding versions bumped | event: compressed |
Note: Retrieve is not in this list — recall is request/response, not a lifecycle event.
3.3 Bi-temporal Model
Every record (except Events, which carry only the two timestamps below as singletons) has four time fields:
| Field | Meaning |
|---|---|
valid_from | First moment in the world when the claim is true |
valid_to | First moment when the claim ceases to be true (exclusive). null means open-ended. |
recorded_from | First moment CortexDB learned the claim |
recorded_to | First moment CortexDB superseded its own record (exclusive). null means current. |
Events have observed_at and recorded_at as singletons — events are atomic in time and never superseded.
Why both axes: the question "what did the system believe about Acme on April 15 when looked at from May 1?" requires recorded_from ≤ May 1 AND valid_from ≤ Apr 15 < valid_to. Single-axis systems can only answer one or the other.
as_of queries (see §12.3) pin both axes. By default as_of pins recorded_* to now and valid_* to the query time.
3.4 Scope Paths
A scope is a /-delimited path of type:id segments. The path is the namespace. There is no separate "workspace" concept.
3.4.1 Grammar
scope := segment ("/" segment)*
segment := type ":" id
type := lowercase identifier, [a-z][a-z0-9_]*
id := URL-safe identifier, [A-Za-z0-9_\-]+
Maximum 32 segments. Maximum 4096 characters total.
Reserved types (the system attaches special semantics):
| Type | Semantics |
|---|---|
org | Top-level tenant |
dept | Department / business unit |
team | Smaller cross-functional unit |
app | Application instance |
user | End-user owner |
agent | Agent identity |
service | Service account |
ws | Workspace (collaborative, non-hierarchical conventionally) |
project | Time-bounded initiative |
global | Cross-tenant pool (gated; see §5) |
system | Reserved for internal CortexDB scopes |
Any other type is user-defined and treated as opaque. A user-defined type must still be registered in the deployment policy's allowed_scope_types before a path containing it can be created, or creation is rejected with 422 UNREGISTERED_SCOPE_TYPE. All four shipped presets register source, the type the CortexDB connectors write into (<root>/source:<connector>), and employee, chat and role, the segments CortexOS writes AI employees, conversations and project roles under (<root>/employee:<id>, <root>/user:<person>/chat:<id>, <root>/project:<id>/role:<id>).
The table above lists what each reserved type means, not what a deployment accepts. Which types a
new scope may use is the preset's allowed_scope_types (crates/cortexdb/presets/*.yaml, selected
by CORTEX_DEPLOYMENT_PRESET):
| Preset | Allowed scope types |
|---|---|
cloud_shared_saas (the hosted CortexDB cloud) | org, dept, team, app, user, agent, service, ws, project, source, employee, chat, role (13) |
on_prem_enterprise (the docker-compose.yml default), cloud_private | the 13 above plus global and system (15) |
dev_local (the binary's default when CORTEX_DEPLOYMENT_PRESET is unset) | the 15 above plus debug and temp (17) |
Every preset also lists version 2's record types, container, set, hold, policy and attrs,
under version_2_scope_types. They join allowed_scope_types only on a node armed for shard apply
format 8; on any other node a path that uses one is refused 422 UNREGISTERED_SCOPE_TYPE, as
before, and GET /v1/policy/deployment lists them only once the node is armed.
On the hosted service global and system are refused (they are not in its
allowed_scope_types, and the preset denies scope.create.global), and a source: scope is
created by the first write into it:
registering one by hand through POST /v1/scopes needs scope.create.custom, which
cloud_shared_saas denies. A type outside the list, such as channel: or repo:, is refused on
the first write into a new scope; put the name under an allowed type instead
(org:acme/source:slack/project:general).
3.4.2 Hierarchy and inheritance
Path order is hierarchical: ancestors precede descendants. Traversal depends on
the endpoint. On public recall, view=holistic includes the requested scope,
authorized ancestors, and authorized descendants; it never enters a sibling
subtree. On direct layer-list endpoints, view=holistic includes only the
requested scope and authorized ancestors. view=descend includes the requested
scope and authorized descendants.
view=local means exactly this scope — no traversal. It is the default for
direct layer-list endpoints; public recall defaults to holistic.
3.4.3 Workspaces as scopes
A scope like ws:acme-q3-launch is structurally identical to org:acme/user:alice. It differs only in:
- Convention: workspace scopes are typically not nested under user/org trees.
- Membership: workspaces usually have multiple members, declared via
POST /v1/scopes. - Policy: workspaces typically register a consolidation policy.
There is no API distinction. A scope is a scope.
3.4.4 Registration
A scope path becomes addressable when it is explicitly registered or when an authorized first write is eligible for auto-registration. Explicit registration grants:
- ACL enforcement (writers/readers/owners)
- Audit logging at scope granularity
- Custom consolidation policy
- Inheritance directives (which ancestors to read up to)
Unregistered scopes under a verified caller's own org:<billing_id> root are the "scratchpad" tier. An issuer-signed, explicitly matching scope.write:<scope-prefix>/* token constraint is also accepted as narrow ownership evidence (for example, self-serve tokens whose storage home is distinct from their billing audience). First write auto-registers these authorized paths with members=[caller] and role=owner when deployment scope.auto_register is enabled and every path segment type is in allowed_scope_types (see §8.8.1 for the auto-register schema). A registered nearest ancestor also controls descendant creation through policies.children.auto_register, and the caller must have Writer-or-higher membership there. Standalone roots such as ws:* without an explicit signed write grant must be registered before a verified tenant caller can write; their ownership is then established by the registered ACL, not inferred from the root string. Auth-disabled and static-operator self-hosted modes retain root-agnostic first-write registration for compatibility, subject to the same deployment creation policy.
3.5 The Experience Envelope
The input to POST /v1/experience. It generalizes over conversation messages, tool calls, document ingest, observations, and feedback.
3.5.1 The three identities
The envelope carries up to three distinct identities. Collapsing them is the most common API design error in this space; we keep them explicit:
| Identity | Source | Meaning |
|---|---|---|
caller | Token sub, verified by signature | The authenticated principal making the API call. Always present. Used for policy, audit, and rate-limit attribution. |
observed_actor | Envelope observed_actor field | Who performed the experience being recorded. May differ from caller (delegated agent, import job, admin write). Defaults to the agent the caller's token names (act, since 0.14.0) when it names one, else to caller. |
subject | Envelope subject field | Who or what the memory is about. May differ from both (a coach observing two players; an importer ingesting customer messages). Defaults to observed_actor, or to caller when observed_actor was taken from act. |
Examples of when these diverge:
- A user wires their agent to ingest Slack messages.
caller = agent:ingester,observed_actor = user:alice(the message author),subject = user:alice. - An admin writes a correction.
caller = user:admin_bob,observed_actor = user:admin_bob,subject = user:alice(whose memory is being corrected). - An import job replays Mem0 exports.
caller = service:importer_v1,observed_actor = user:alice(preserved from source),subject = user:alice.
3.5.2 Time fields
Two timestamps, with distinct ownership:
observed_at(client-supplied,context.observed_ator the top-level alias) — the moment in the world the experience occurred. This is event-time. When the envelope leaves it out the server uses its ownnow(); it is excluded from write identity, so a retry that leaves it out still replays.recorded_at(server-assigned) — when CortexDB ingested it: the leader's clock when it stamps the capture. It is not an envelope field: acontext.recorded_atin a body is refused with422 INVALID_BODY(unknown field). Clients in import flows passcontext.source_recorded_atto preserve the upstream system's ingest timestamp; the server stores it alongside its ownrecorded_at(an exported event re-imported through/v1/import/jsonlcarries its originalrecorded_atthere).
The previous spec used happened_at and required clients to supply recorded_at. Both are now retired. Use observed_at (event time) and let the server own recorded_at (ingest time).
3.5.3 Envelope shape
{
"scope": "org:acme/dept:eng/user:alice",
"observed_actor": {
"id": "user:alice",
"session": "run_abc"
},
"subject": {
"id": "user:alice",
"type": "user"
},
"modality": "conversation",
"source": {
"schema_version": 2,
"source_id": "crm:thread:42",
"modality": "conversation",
"content_kind": "message",
"source_fingerprint": "sha256:b494e46428851114fe0beb715d7408c07b46e104d9b9feb9188e02f41f22f8c5",
"fragments": [{
"fragment_id": "message-7",
"locator": {
"kind": "conversation",
"session_id": "thread-42",
"turn_index": 7,
"speaker": "user:alice"
},
"byte_range": {"start": 0, "end": 44},
"content_fingerprint": "sha256:b494e46428851114fe0beb715d7408c07b46e104d9b9feb9188e02f41f22f8c5"
}]
},
"content": {
"kind": "message",
"role": "user",
"text": "Acme moved to 200 seats and signed by 3:42pm",
"media": []
},
"context": {
"observed_at": "2026-05-13T15:42:00Z",
"source_recorded_at": null,
"location": null,
"preceded_by": ["evt_01H..."],
"intent": "deal_close",
"labels": ["sales", "q3-launch"]
},
"directives": {
"extract": ["facts", "entities", "beliefs"]
},
"idempotency_key": "alice-msg-1747147320-001"
}
| Field | Required | Type | Notes |
|---|---|---|---|
scope | yes | scope path | Must pass policy for scope.write |
observed_actor | no | object {id, session?} | Defaults to the agent the token names (act) when it names one, else to the token's sub. One that is neither the caller nor that agent requires scope.write.on_behalf_of. id is an actor id (user:, agent:, service: or system:); any other key in the object is ignored. |
observed_actor.session | no | string | Used for run/session grouping |
subject | no | object {id, type} | type is user, agent, entity or concept; an empty id is 422 INVALID_ENVELOPE. Defaults to observed_actor (to the caller when observed_actor came from act). One that is neither the resolved observed_actor nor, under act, the caller requires scope.write.about_other. |
modality | yes | string | Open set, stored verbatim: conversation, document, tool_result, observation, feedback and imported are the documented values. Empty is 422 INVALID_ENVELOPE. |
source | no | CanonicalSourceV2 | Provenance-bound authoritative source identity and exact represented fragment(s). source.modality must equal envelope modality; fragment byte ranges are half-open UTF-8 byte offsets and fingerprints cover exact bytes. See the normative schema. |
content.kind | yes | enum | One of message, text, json, blob_ref, triple. A bare {"text": ...} (read as text) or {"data": ...} (read as json) without kind is accepted too. |
content.text | conditional | string | Required for message and text; empty or only whitespace is 422 INVALID_ENVELOPE. The flattened content is at most 1 MiB (§6.10). |
content.role | conditional | enum | Required for message: user | assistant | tool | system |
content.media | no | array | {blob_id, alt?} entries on a message, stored as sent: they are neither resolved nor checked (§3.5.4) |
context.observed_at | no | RFC3339 | Event (occurrence) time; defaults to server now() if omitted. Also accepted as a top-level observed_at alias. |
context.source_recorded_at | no | RFC3339 | Upstream ingest timestamp (imports only); server preserves alongside its own recorded_at |
context.preceded_by | no | array | Causality hints (memory event IDs evt_...) |
context.intent | no | string | Free-text intent tag, stored and filterable. One value changes what is derived from the event: "documentation", with enrichment on, has three effects. It selects the documentation extraction prompt, which keeps only normative claims about the documented product and never extracts the examples a document shows (sample conversations and payloads, placeholder names and tokens); it isolates the event's batch group, so a documentation event shares an extraction call only with other documentation events of its scope; and the event is never consolidated. No other value changes what is derived. |
context.labels | no | array of strings | The app-metadata extension point. Arbitrary client tags; stored verbatim and filterable on GET /v1/events. The context object is otherwise strict — an unknown key (e.g. context.memory_owner) is rejected with 422 INVALID_BODY. Encode app metadata as labels ("owner:shrey"-style key:value strings work well). 0.10.5 announces label limits that a later release will enforce by default and that an operator can enforce now with CORTEX_LABEL_LIMITS=on (see "Label limits" below): at most 4096 labels, each at most 262,144 UTF-8 bytes (256 KiB), none empty or blank, and no ASCII control character other than tab, line feed and carriage return. |
directives.extract | no | array | The derived layers the event may feed. It is a list of stage names (facts, entities, beliefs, episodes, understanding), not an on/off flag: a boolean or a string ("extract": false, "extract": "none") is refused with 422 INVALID_BODY whose details.field_path ends in directives.extract (items[N].directives.extract on a bulk), and nothing is written. Omitted or null runs every stage. A list limits what is derived to the stages it names (since 0.15.0): [] derives nothing at all: no extraction call, the episode builder skips the event, and neither the entity sweeper nor concept reflection reads it, while the event stays indexed, embedded and searchable. That is the raw-index-only control ("index and embed me, derive nothing"): use it for documentation ingestion, tool output and runtime metadata that should be findable but never become memory about a person. entities yields entities and their vectors, the edges between them and the resolver's names; the knowledge and question-answer calls are skipped. facts yields facts, triples, their English glosses, the extraction summary and the question-answer pairs; the entity call is skipped, and the facts build no belief unless the list names beliefs too. beliefs extracts facts as well, because beliefs are built from them, and stores both. episodes: the episode builder takes the event only when the list names it, so a list without episodes keeps the event out of every episode; a rebuild therefore changes the membership, and so the ids, of the episodes that held such events. understanding: concept reflection reads the event only when the list names it. Before 0.15.0 a list that named any of facts, entities, beliefs and understanding ran the whole extraction (["entities"] yielded facts too), and episodes were built whatever the list said. Honored on POST /v1/experience, POST /v1/experience/bulk and /v1/import/jsonl: the stages are stored on the captured event (extract on GET /v1/events/{id}) and re-applied when the indexer builds the event's derived layers. Every write, single or bulk, is indexed that way from the replicated log (there is no inline indexing path), on every replica of a cluster shard, so each keeps the directive, and so does a replay. (0.10.1 honored it on bulk writes only and lost it on single writes, which ran every stage. Events written before 0.10.3 carry no stored directive, bulk-written "extract": [] events included, so when the indexer rebuilds them or a re-derivation runs, every stage runs for them.) Exception: a content.kind: "triple" event is always treated as "extract": [] for extraction on every path, single write included, whatever directives.extract says: its fact is written deterministically, and the LLM extractor never sees it. The episode builder and the fact sweeper take a typed triple as an event with no list, whatever its list says (v1/episode_builder.rs::takes_event). |
directives.consolidate_into | no | scope | Accepted, not enforced: the ack's warnings carries directive_not_enforced:consolidate_into (see below). It still requires scope.write and Writer on that scope (422 INVALID_ENVELOPE, details.field: "directives.consolidate_into", otherwise), and the write's admission registers it like its own scope; it is not stored, and nothing consolidates into it. |
directives.confidence_floor | no | number | Accepted, not enforced: the ack's warnings carries directive_not_enforced:confidence_floor. Read by nothing. |
directives.ttl_for_belief_layer | no | ISO-8601 duration | Accepted, not enforced: the ack's warnings carries directive_not_enforced:ttl_for_belief_layer. Validated (P30D, PT12H, P1DT6H30M; anything else is 422 INVALID_ENVELOPE), then read by nothing. |
directives.embed | no | enum eager, lazy, none | Accepted, not enforced: the ack's warnings carries directive_not_enforced:embed. Read by nothing, so the event is embedded as without it. |
directives.async | no | boolean | Accepted, not enforced: the ack's warnings carries directive_not_enforced:async. Read by nothing: ?wait= decides when a write answers (§8.1). |
idempotency_key | no | string | Client-generated; at most 64 bytes after Unicode NFC (empty or longer is 422 INVALID_ENVELOPE); replays return the same event_id (§6.3). If omitted, the server generates one (so the write is NOT deduplicated — supply your own for retry safety). |
language | no | BCP-47 | Capability capture_language_v1 (refused with 422 INVALID_BODY on a server that does not list it). Language of content, e.g. hi-Latn. Case is canonicalized (HI-latn → hi-Latn); a malformed tag is 422 INVALID_ENVELOPE. See "Language tags" below. |
scripts | no | array of ISO 15924 | Capability capture_language_v1. Scripts of content, dominant first, e.g. ["Latn", "Deva"]; at most 8, canonicalized and de-duplicated. Detected from the text when absent. |
context.timezone | no | IANA zone | Capability capture_language_v1. The zone the experience happened in, e.g. Asia/Kolkata. Exact, case-sensitive match against the vendored tzdata list (canonical zones and backward links such as Asia/Calcutta); IST, +05:30 or Asia/Mumbai are 422 INVALID_ENVELOPE. Cleared by erasure. With enrichment on, it also anchors fact extraction (M6 D0b; not in v0.9.13): the extractor reads the capture's observed_at as local wall time in this zone, [2026-09-24 02:00 Asia/Kolkata], so a relative date ("kal", "tomorrow") resolves against the local date. Without a zone the anchor is observed_at in UTC, and it is observed_at in both cases, never the write time, so a backdated capture anchors on its own date. |
context.refers_to | no | array | Capability refers_to_v1 (T1a). The times the experience refers to, at most 16 entries: {from, to?, zone?, precision?, expr_original?, ambiguous?, candidates?, confidence?}. See "Referenced times" below. Excluded from write identity; cleared by erasure. |
provenance | no | array of event ids | Capability write_provenance_v1 (since 0.14.0): at most 1,024 events of the request's root this write was made from (more is 422 INVALID_ENVELOPE); part of write identity. See §8.1, "Provenance and redirects". |
derived_by | no | object {name, version} | Capability derived_by_v1 (new in 0.15.0; refused with 422 INVALID_BODY on a server that does not list it). The write-back stamp of the pipeline that made this write: the name matches [a-z0-9][a-z0-9._-]{0,63}, the version is 1 to 32 printable ASCII bytes with no space. Taken on a typed triple (content.kind: "triple") only. See "Write-back stamps" below. null is no stamp |
observed_at | no | RFC3339 | Top-level alias of context.observed_at; it wins when both are sent |
metadata.labels | no | array of strings | Pre-0.8 alias, appended to context.labels (each label once) before validation; any other metadata key is ignored |
Write-back stamps (derived_by_v1, new in 0.15.0). A pipeline of the caller's own that derives something from
CortexDB's memories and writes it back names itself: "derived_by": {"name": "acme-profile-worker", "version": "1.4.0"}
on a typed triple, on POST /v1/experience, /v1/experience/bulk, /v1/experiences and a canonical line of
/v1/import/jsonl, and on a declared belief (POST /v1/beliefs, §8.7.15).
- How it is stored. The stamp is carried on the event as the reserved label
derived_by:<name>@<version>, after the write's own labels, and every replica's indexer copies it onto the fact it makes from the triple. That fact serves it only underinclude=derivation(§7.4.3):verdict: "declared",derived_by: {name, version}. The event's label is served wherever its labels are. - Only the field sets the label. A
context.labelsentry that starts withderived_by:is refused with422 DERIVED_BY_INVALID, with or without the field. - Refusals. Every refusal is
422 DERIVED_BY_INVALIDwithdetails: {field, reason}. The reasons arereserved_label(field: "context.labels[<i>]"),not_a_triple(field: "derived_by"),name_grammarandreserved_namespace(field: "derived_by.name"),version_invalid(field: "derived_by.version") andshape, for a value that is not an object of the two strings (field: "derived_by"). On a bulk the item'sdetails.failures[]entry carries the code, and nothing is written. - Write identity. The stamp is part of write identity, as every label is: a retry with the same
idempotency_keyand another stamp is409 IDEMPOTENCY_CONFLICT. - The importers' namespace. The Mem0, Zep, Letta and OpenAI importers stamp every row
import:<provider>@1(§15). The name grammar has no:, so no client can write that namespace (reason: "reserved_namespace"). - The server's namespace.
cortexdb:<name>is the server's own. The typed triple a correction'sreplacewrites (§8.7.24) is stampedcortexdb:correction@1, so its fact'sderivation.derived_byis{"name": "cortexdb:correction", "version": "1"}. No client can write that namespace either (reason: "reserved_namespace"). - What is out of date.
GET /v1/derivation/status?derived_by=<name>reports a name's latest version and the rows it leaves unsynced (§8.7.12). Writing them again is the pipeline's own work.
Directives nothing reads (since 0.15.0). consolidate_into, confidence_floor,
ttl_for_belief_layer, embed and async are accepted, validated where they have a shape, and part of write
identity, so a client that sends one keeps working, and directives refuses unknown keys (422 INVALID_BODY).
Nothing reads them, and a write that names one is told so: its ack's warnings carries
directive_not_enforced:<name> for each, in that order, after any other warning (on POST /v1/experience/bulk
in the item's results[].warnings; on an import once each in the job's warnings, on its 202 and on
GET /v1/import/{id}). A directive sent as null is absent and is not warned of, and an ack that names none
is unchanged: warnings is omitted when it is empty. A CI lint (crates/cortex-api/tests/unread_fields.rs)
fails when the server accepts a directive the list above does not classify, or when one of these gains a
reader without the list and this table changing.
Label limits (0.10.5: announced, not enforced by default). Before 0.10.5 nothing checked a
label, and by default 0.10.5 still checks none: a cap on what clients send is announced before
it applies. A later release will enforce these limits by default; an operator can enforce them
now with CORTEX_LABEL_LIMITS=on (no other change needed). While they are enforced, every new
write is checked: POST /v1/experience (inline text and blob-backed), every item of
POST /v1/experience/bulk, and every row of a /v1/import job. Events stored before are never
re-checked or rewritten; an export that holds such labels re-imports only while its labels fit
the limits (or while they are not enforced). The pre-0.8 top-level metadata.labels alias is
checked after it is folded into context.labels, so an index counts in the folded list. Check
your integrations now: a label that is empty or blank (some connectors write one when a provider
leaves a field out) or that holds a control character will be refused once the limits apply.
| Limit | Default | Setting | Error (422, not retriable) |
|---|---|---|---|
| Labels per memory | 4096 | CORTEX_LABELS_MAX_COUNT | LABELS_TOO_MANY, details: {field, count, limit, setting} |
| UTF-8 bytes per label | 262,144 (256 KiB) | CORTEX_LABEL_MAX_BYTES | LABEL_TOO_LONG, details: {field, index, bytes, limit, setting} |
| Not empty or only whitespace | always | none | LABEL_EMPTY, details: {field, index} |
| No ASCII control character (U+0000-U+001F, U+007F) except tab, line feed and carriage return | always | none | LABEL_INVALID_CHARACTER, details: {field, index, code_point, byte_offset} |
field is context.labels and index is the label's position in it; the message names the
same, and no error ever echoes a label's text. The count is checked first, then each label in
order (its size, then blank, then its characters); the first violation is the one reported, and
an envelope that also fails an older check reports that one, as before. On
/v1/experience/bulk the batch is refused before anything is written with INVALID_ENVELOPE,
and the item's entry in details.failures[] carries the label code and its details. An
import row that breaks a limit fails alone, and its job error starts with the code
(LABEL_TOO_LONG: envelope validation: context.labels[2] is ...).
Why these: an empty label and one holding U+001F did not read back as written (the legacy store
copy joins an event's labels with U+001F and drops empty parts), and size was bounded only by
the request body. The defaults are generous on purpose. One pilot's ingester writes at most
15 labels of at most 58 bytes; the first-party connectors write one label per entity (a Google
Calendar event: one attendee: label per guest) and carry metadata values in key=value
labels (the Notion connector's properties= label is a page's raw property JSON, Gmail's to=
and cc= are whole recipient lists), which reach tens of KiB. Tab, line feed and carriage return
stay allowed because connectors render free-text values (a Calendar location=) as they come.
An operator turns the checks on with CORTEX_LABEL_LIMITS=on and can lower or raise the two
limits; off, or unset, checks nothing (the 0.10.5 default), and an unusable value keeps its
default and is reported at boot (docs/generated/env-vars.md §14).
Referenced times (refers_to_v1). context.refers_to[] records what the experience talks
about, as resolved by the producer ("kal 4 baje call hai" captured on 2026-09-24 refers to
2026-09-25). Rules, each a 422 INVALID_ENVELOPE when broken:
fromandto(optional, inclusive) are local datesYYYY-MM-DDor local date-timesYYYY-MM-DDTHH:MM[:SS], with no offset;from <= to.- The zone is the entry's
zone, elsecontext.timezone; one of the two is required. Both are IANA names from the vendored tzdata list. precisionis one ofminute,hour,day,week,month,year.- An ambiguous phrase keeps every reading: an untensed kal is
{"from": "2026-09-25", "ambiguous": true, "candidates": [{"from": "2026-09-23"}, {"from": "2026-09-25"}]}. expr_originalis user text and is cleared by erasure with the rest of the entry.
The entries are stored as sent and returned on GET /v1/events/{id}, on recall layers.events
items (context.refers_to) and on /v1/export. Recall's temporal.refers_during matches them
(§12.2). Nothing is indexed: the match runs over the resolved candidates only (T1b adds an index).
Language tags (capture_language_v1). Every capture resolves one language tag with a single
precedence, highest first: the typed language field; source.language; a lang:<tag> label in
context.labels (the spelling CortexOS used before the typed field); script detection
(und-Deva, und-Arab, und-Beng, ...; Tamil, Telugu and Thai map to ta, te, th); a
Latin-script Hinglish word-share heuristic (hi-Latn); and en for any other Latin text. Mixed
text lists every script it contains. The stored event carries language, scripts and
language_source (hint, source, label or detected), and they come back on
GET /v1/events/{id}, recall layers.events items and /v1/export. Implicit English stores
nothing: a hint-free English capture (detected en, Latin only) has none of these keys, so its
event and recall bytes are unchanged. An explicit "language": "en" is stored. An English
source.language (en, en-US, ...) is not a signal: connectors send it on every descriptor, so
it is skipped and the lower tiers decide (English text stays implicit and stores nothing). A
non-English source.language counts as above.
None of the four fields is part of write identity. The same body with or without hints under one
idempotency_key replays the first write (no 409), and a body that hashed before these fields
existed hashes the same. The first write's hints win: a retry whose hints differ replays and the
ack carries warnings: ["conflicting_hint_on_replay: ..."]. A corrected hint on retry is
therefore ignored; write a new event (new key) to change it.
The server adds the following to the stored event:
| Server-assigned field | Source |
|---|---|
id | UUID v7, prefixed evt_ (32 lowercase hex digits) |
scope | The requested scope, or the home a redirect chose (redirected_to, §8.1) |
caller | From token sub |
observed_actor, subject | The resolved identities (§3.5.1); subject as {id, type} |
context.recorded_at | The leader's clock when it stamps the capture |
wal_offset | Monotonic position in the shard log, assigned by apply |
scope_key | The caller's billing tenant (also read under its old name tenant_id) |
language, scripts, language_source | The capture's language tags (capture_language_v1); absent for implicit English |
source_blob_ids | The blobs the content was inlined or transcribed from |
extract | The stored directives.extract stages |
atoms, provenance | What the write's chain read and declared (write_provenance_v1, since 0.14.0); absent when empty |
Modalities are open-set; unknown values are accepted with a 202 and stored verbatim. The label itself never gates derivation — every modality follows the same path. What decides whether an event is structurally extracted is directives.extract above, and whether background enrichment is configured at all.
3.5.4 Multimodal content in v1
content.media[] accepts blob references for multimodal payloads, but v1 ships text-only embeddings (§18.2 item 18). The semantic vector space is computed from content.text only. Blob references are indexed by metadata (content-type, size, perceptual hash for images) and reachable via blob_id — but not embedded into the recall vector space. Multimodal embedding is a v1.x add-on; the envelope shape is forward-compatible for that addition (content.media[] already accepts additional indexing hints when they arrive).
3.6 ID Namespaces
Different resources use different ID prefixes to make every identifier self-describing in logs, audit trails, and client code. Mixing namespaces is an error — evt_ IDs are not interchangeable with lce_ IDs.
| Prefix | Resource | Format | Notes |
|---|---|---|---|
evt_ | Memory event (WAL entry) | UUID v7 | Time-ordered, monotonic per node |
ep_ | Episode | UUID v7 | |
fact_ | Fact | UUID v7 | |
belief_ | Belief | UUID v7 | |
concept_ | Understanding concept | UUID v7 | Stable across versions |
lce_ | Lifecycle event (SSE event) | UUID v7 | Distinct from memory events; SSE resume uses these |
job_ | Generic async job | UUID v7 | Catch-all for jobs without a typed prefix |
batch_ | Bulk write batch | UUID v7 | |
imp_ | Import job | UUID v7 | |
exp_ | Export job | UUID v7 | |
ervw_ | Erasure preview | UUID v7 | |
erasure_ | Erasure execution | UUID v7 | |
pack_ | Recall pack | UUID v7 | 60s TTL; referenceable by /v1/answer |
audit_ | Audit log row | UUID v7 | |
blob_ | Uploaded blob | UUID v7 | |
ent_ | Resolved entity | UUID v7 | Tenant-scoped |
concept_alias_ | Concept alias mapping | UUID v7 | |
req_ | Request correlation ID | UUID v7 | Echoed in X-Cortex-Request-ID |
tok_ | Token revocation list entry | UUID v7 | Internal |
Lifecycle event IDs. SSE event resume uses since_lifecycle_id=lce_..., NOT memory event IDs. A memory event (evt_) progresses through multiple lifecycle events (lce_) as it moves through Capture → Extract → Index → Consolidate → Compress. Older drafts used since=evt_... for SSE resume; this was ambiguous and is retired.
4. Authentication & Identity
4.1 Signed Tokens
Every authenticated route takes a credential in Authorization: Bearer <credential>. A server accepts four:
| Credential | Signed by | Format | Notes |
|---|---|---|---|
| A minted token | This server's minter (§4.6), through POST /v1/auth/tokens, POST /v1/auth/signup and the mint_offline tool | PASETO v4 public (Ed25519) | Every one carries minter since 0.14.0 (§4.7.5) |
| An issuer's token (since 0.14.0) | An entry of the issuers file: an OIDC provider (Okta, Entra, Auth0, Keycloak), CortexOS, another deployment's signer (§4.7.1) | JWT (RS256, ES256) or PASETO v4 public | The entry maps its subject, audience and token id |
| The operator key | The static CORTEX_API_KEY | an opaque string | The trusted operator (§5): it acts as the principal X-Cortex-Actor names (default user:local), in billing tenant default; under CORTEX_OPERATOR_DATA_READS=deny its data reads need X-Cortex-Break-Glass (§8.15.3) |
| A commitment transport token | The admitted commitment profile's transport issuer | PASETO v4 public | /v1/memory/commitments/* only |
JWT HS256, none and every other symmetric algorithm are refused. With auth disabled (no operator key: CORTEX_API_KEY unset on a loopback bind, or CORTEX_INSECURE_NO_AUTH) no token is verified, and every request is served as the trusted operator, as the principal X-Cortex-Actor names or user:local.
Authorization: Bearer <token>
X-Cortex-Actor: agent:planner_v3
X-Cortex-Actor asserts the caller's identity and must equal the token's sub, so one identity acts per call: a token sent without it is verified first and, once it verifies, is 401 ACTOR_MISMATCH (a bad token answers its own refusal, as with the header: a mistyped operator key is 401 MISSING_TOKEN; since 0.14.0), and one whose sub differs is 401 ACTOR_MISMATCH once it is. Since 0.14.0 two callers may leave it out, and when they send it, it must match: a token of an issuers-file entry in prefix, hash or directory mode, whose client cannot know the id its subject maps to, and a call of the HTTP MCP server (/mcp, §8.31). With the operator key it names the actor, and a value that is not a principal id (on the operator key, an auth-disabled server or the unsigned development mode) is 400 INVALID_HEADER, details {part: "header", field, reason}, the header and the parse error (since 0.14.0; it was 401 INVALID_BODY).
Rust library choices (recorded here so engineers do not re-litigate): PASETO uses pasetors; JWT uses jsonwebtoken with the RS256/ES256 algorithms only.
4.2 Claims
| Claim | Required | Meaning |
|---|---|---|
iss | yes | The issuer: this server's minter (CORTEX_V1_MINTER_ISSUER), an issuers-file entry's iss (since 0.14.0), or the commitment transport issuer. A token is verified only with the keys of the issuer its iss names (§4.3). |
sub | yes | The actor identity, in our type:id form: user:, agent:, service: or system:, then 1 to 128 characters of [A-Za-z0-9_.@-]. An issuers-file entry maps its subject claim to it (§4.7.1). |
aud | yes | The tenant binding, cortexdb:tenant:<tenant>, whose <tenant> is the request's billing tenant. The minter's tokens carry CORTEX_V1_AUDIENCE (default cortexdb:tenant:dev) or, with CORTEX_V1_TENANT_AUDIENCES=1, a billing tenant's own audience; an issuers-file entry's tokens carry what its tenants admits (§4.7.1). |
exp | yes | Expiry as Unix timestamp. A token this server's minter signs has a lifetime ceiling (exp - iat), each a setting since 0.14.1 (§4.7.4): by default 90 days for a user: subject (7 days in 0.14.0), 7 days for an agent: one, 30 days for a service: or system: one, and 24 hours for a mint that carries a chain field. Since 0.14.0 both are refused by default: the mint 422 INVALID_BODY, details.reason: "ttl_too_long", and the token 401 INVALID_TOKEN_CLAIM, details.reason: "lifetime_over_ceiling". With CORTEX_MINT_LIFETIME_ENFORCE=off they are served and counted by GET /v1/admin/access/report (check mint_lifetime) instead. An issuers-file entry's tokens live at most its max_lifetime_s. |
iat | yes | Issue time: at most the issuer's leeway ahead of the server's clock (60 s for the minter; leeway_s for an issuers-file entry). |
jti | yes | Unique token ID (for revocation lists). Since 0.14.0 an issuers-file entry's token goes by <entry id>:<jti> (its jti_claim, default jti), and a commitment transport token by commitment:<jti> (§4.5). |
deployment | no | Optional hint; ignored. |
caps | no | Capability narrowing (see §5.2): every capability a route checks must be in the list, by exact name. Token can only restrict, not expand. |
scopes | no | Path-prefixed capability scoping: <capability-or-prefix>:<scope-path> (the subtree; a trailing /* changes nothing), <capability-or-prefix>:<scope-path>! (that one scope) or <capability-or-prefix>:* (every scope, and the checks made without one), e.g. scope.write:org:acme/*. Since 0.14.0 a token that carries scopes holds only the capabilities an entry names (§4.7.3). |
act, app, client, run, run_start, taint, auth_time, minter, cdb_crit | no | The principal chain (principal_chain_v1, since 0.14.0): the agent, the application, the client and the run the token acts for, and who minted it (§4.7.2). A token that carries none of them verifies as before. |
Any other claim is ignored.
4.3 Validation order
For every bearer:
- The operator key is compared first, in constant time; it authenticates with no token checks (§4.1).
- A token without
X-Cortex-Actoris verified as one with it; unless it is an issuers-file entry's inprefix,hashordirectorymode or a call of/mcp, step 10 refuses it once it verifies (since 0.14.0; it was refused here, so a mistyped operator key answered401 ACTOR_MISMATCH, not401 MISSING_TOKEN). - Its format: PASETO v4 public (
v4.public.) or a three-part JWT. Anything else is401 MISSING_TOKEN. - Its issuer, by its untrusted
iss. An issuers-file entry's token is verified by that entry alone, in the entry's order (§4.7.1). Every other token goes through steps 5 to 9. - The signature, with the keys of the issuer its
issnames (a PASETO token whoseissnames no registered issuer is tried against every key); a JWT's algorithm isRS256orES256. exp > now, andiat <= now + 60 s.- The issuer is registered, and its audience is
CORTEX_V1_AUDIENCEor, on the minter's own token withCORTEX_V1_TENANT_AUDIENCES=1, a billing tenant's. - A token the minter signed lives within its subject's ceiling (§4.7.4); then its
jtiis not revoked. - The principal-chain claims: the ones its issuer may assert, the
cdb_critlist, and each claim's form (§4.7.2). X-Cortex-Actoris sent, but by the callers step 2 names (else401 ACTOR_MISMATCH), and when sent equals the token's (mapped)sub;audnames a tenant.- Since 0.14.0, the credential's tenant, for every credential but the trusted operator: its tenant root is not being deleted (
410 TENANT_DELETED), itsactnames no AI employee (401 INVALID_TOKEN_CLAIM,act_not_delegable), and its principal's directory entry is not deactivated (401 SUBJECT_UNMAPPED,deactivated). - Since 0.14.0, for the operator key only, the operator plane:
X-Cortex-Break-Glassand the tenant's mode (§8.15.3). - Each route's checks: the token's
capsandscopeswith the policy stack give the effective capabilities (§5.1, §4.7.3), the capability the route needs must be among them, the scope's roster must admit the caller, and, for a token another principal minted, the minter too (§4.7.5).
Each failure answers the error envelope (§6.6) under its own code, listed in §4.7.6; a 503 there (REVOCATION_UNAVAILABLE, ISSUER_KEYS_UNAVAILABLE, WAL_UNAVAILABLE) is retriable, every 400, 401, 403 and 410 is not. A token that carries none of the 0.14.0 claims and is not an issuers-file entry's keeps the code and body each failure had in 0.13.x, with no details but a lifetime ceiling's; an entry's token, and one that carries a chain claim other than minter, gets details.issuer and the details §4.7.6 names.
4.4 Service accounts
For server-to-server calls (importer workers, scheduled jobs, connectors), sub is of form service:<name>. A token this server's minter signs for a service: or system: subject lives at most 30 days, one for a user: subject 90 days, one for an agent: subject 7 days, and one that carries a principal-chain field 24 hours, by default (each a setting, §4.7.4); an issuers-file entry names the service: principals it may map (subject.services, §4.7.1). A verified token whose sub is not a user: cannot perform forget.gdpr (403 POLICY_DENIED, "forget.gdpr requires a user-authenticated session"). Since 0.14.0 a write by a service:, system: or agent: token that carries a principal-chain claim is a non-human write: it carries the atoms and provenance of what its chain read (write_provenance_v1, §8.1). A token that carries none of act, app, client and run keeps 0.13.x's write rules until CORTEX_LEGACY_WRITE_CUTOFF (an RFC 3339 time; unset, no cutoff), and each such non-human write is counted (check legacy_write).
4.5 Revocation
POST /v1/auth/revoke {jti, exp?, reason?} (§8.16.1) adds a token's id to the revocation list: the presented token's own (its id or its bare jti), or, for the trusted operator (the static key or an auth-disabled server), any one; any other caller revoking another token gets 403 POLICY_DENIED, whatever its capabilities. On a native memory or commitment host, whose verifier accepts tokens of its one caller only, a token of that caller holding auth.revoke revokes any of its tokens: such a host has no static key, and no other principal's token is in its revocation list. Runtime acknowledgement follows durable journal synchronization (ADR-MEM-026). The journal retains at most 1,000,000 revocations (512 MiB). Capacity and storage failures do not return successful acknowledgement.
Since 0.14.0 CORTEX_REVOCATIONS_V2 is on by default. A token's id is then namespaced by its issuer: an issuers-file entry's token goes by <entry id>:<jti>, a commitment transport token by commitment:<jti> (when its issuer's iss is not the minter's; its bare jti still revokes it too), and the minter's tokens by their bare jti, so every revocation recorded before 0.14.0 still matches. A revocation sent with exp (the revoked token's expiry, epoch seconds above 0, else 400 INVALID_REQUEST) is pruned 60 s after it, since its token is refused as expired by then; one without exp, and every revocation recorded before 0.14.0, is kept for ever; a self-revocation stores the caller's own exp. CORTEX_REVOCATIONS_V2=off keeps 0.13.x's journal exactly: bare ids, no exp, no pruning (an issuers-file entry's tokens keep their <entry id>:<jti> ids). Any other value refuses the boot (exit 78 AUTH_CONFIG_INVALID). On a cluster a revocation travels through the metadata group, and a data node whose revocation lease lapsed answers every token 503 REVOCATION_UNAVAILABLE (retriable) until it renews. A single node whose revocation journal failed (a refused write latches the list) denies every token the same way, 503 REVOCATION_UNAVAILABLE (retriable), as an outage and never 401 REVOKED_TOKEN: it still fails closed (since 0.14.0).
4.6 Token issuer
Three issuers sign the tokens a server verifies:
- This server's minter. On under the default
dev_localpreset with noCORTEX_API_KEY, so the zero-config quickstart works, and withCORTEX_V1_MINTER_ENABLE=1otherwise; it mints throughPOST /v1/auth/signup(unlessCORTEX_DISABLE_ANON_SIGNUP=1) andPOST /v1/auth/tokens(§8.16.3), and offline withmint_offline. ItsissisCORTEX_V1_MINTER_ISSUER(defaulthttps://cortexdb.local/issuer); its key pair comes fromCORTEX_V1_MINTER_KEY_DIR(secret.keyandpublic.key, made withgen_minter_keys), else from<data_dir>/minter-keys/, made on the first start, so its tokens survive a restart either way and go with the data in a backup. Since 0.14.0 every token it signs carriesminterand lives within its subject's lifetime ceiling (§4.7). - An issuers-file entry (since 0.14.0,
principal_chain_v1): an existing OIDC provider (Okta, Entra, Auth0, Keycloak), CortexOS, or another deployment's signer, each an entry of the TOML fileCORTEX_AUTH_ISSUERS_FILE([auth] issuers_fileon a cluster data node). An entry names itsiss, its keys or JWKS, how its subjects and audiences map, and which principal-chain claims it may assert (§4.7.1).POST /v1/admin/auth/reloadre-reads the file with no restart (§8.30). This is the path for an enterprise that already runs an IdP. - The commitment transport issuer, when a commitment profile is admitted: its tokens serve
/v1/memory/commitments/*only (Native commitments).
No issuer, the minter included, may take the iss static-api-key, auth-disabled or dev_local-unsigned: the boot exits 78 RESERVED_ISSUER_NAME. A deployment policy's issuers list is parsed and not read, and there is no separate reference issuer binary. Once verified, the policy stack treats every issuer's tokens alike, but an issuers-file entry's token never mints (POST /v1/auth/tokens answers 403 POLICY_DENIED, details.reason: "issuer_token_cannot_mint").
4.7 Tokens in 0.14.0: confinement, lifetime ceilings, delegation and issuers
Capabilities: principal_chain_v1, mint_chain_v1 and confinement_wildcard_v1, listed on GET /v1/admin/version since 0.14.0.
0.14.0 changes what a token may do, whoever signed it. A token that carries scopes holds only the capabilities its entries name (§4.7.3). A token this server's minter signs lives within a ceiling, checked at the mint and at every use (§4.7.4). A token another principal minted acts only where that minter could (§4.7.5). A token may name the agent, the application, the client and the run it acts for (§4.7.2), and external issuers sign tokens through the issuers file (§4.7.1). A token that carries none of the new claims verifies as before, but the first two rules reach it too.
The four rules that refuse tokens and mints 0.13.x served each have a switch, read once at boot after the override files: CORTEX_TOKEN_CONFINEMENT_ENFORCE, CORTEX_MINT_LIFETIME_ENFORCE, CORTEX_MINT_REACH_ENFORCE (the mint's reach, §8.16.3) and CORTEX_MINTER_LINK_ENFORCE. on, blank or unset enforces, the default; off serves what the rule would refuse and counts it under the access report's check token_confinement, mint_lifetime, mint_reach or minter_link (GET /v1/admin/access/report, §8.30); any other value refuses the boot (exit 78 AUTH_CONFIG_INVALID). On a cluster data node they are [engine] variables, and GET /v1/admin/metrics auth.enforce and /node/v1/status auth_modes.enforce report each as on or off. §1.1 lists the switches of the release's other checks.
4.7.1 Issuers-file tokens
CORTEX_AUTH_ISSUERS_FILE names a TOML file of issuer entries; on a cluster data node, [auth] issuers_file in the node config (an [engine] that sets the variable refuses to start). Unset, the server verifies only its minter's and the commitment issuer's tokens. The file is read at boot, after the override files, and again by POST /v1/admin/auth/reload (trusted operator, node-local, §8.30), which swaps the whole set with no restart. A file that does not exist, does not parse or breaks a rule refuses the boot (exit 78 AUTH_CONFIG_INVALID, naming the entry and the rule); a reload that finds one keeps the running entries and answers 422 AUTH_CONFIG_INVALID. Every table refuses unknown keys.
version = 1
deployment_minters = ["service:website-minter"]
[[issuer]]
id = "okta"
iss = "https://acme.okta.com/oauth2/default"
format = "jwt"
algorithms = ["RS256"]
jwks_url = "https://acme.okta.com/oauth2/default/v1/keys"
max_lifetime_s = 3600
[issuer.subject]
mode = "prefix"
kind = "user"
namespace = "okta" # sub 00u1abcd maps to user:okta.00u1abcd
[issuer.tenants]
allowed = ["acme"]
[issuer.claims]
auth_time = true
| Key | Default | Rule |
|---|---|---|
version | required | 1 |
deployment_minters | [] | service: principals, at most 16, that mint as the operator with a deployment-audience token of this server's minter (§4.7.5) |
id | required | [a-z0-9][a-z0-9_-]{0,31}, unique; not minter, commitment or unknown, the names details.issuer gives the built-in issuers |
iss | required | the tokens' exact iss; unique, unlike the minter's and the commitment issuer's, never static-api-key, auth-disabled or dev_local-unsigned |
format | required | jwt or paseto |
algorithms | jwt: a non-empty subset of RS256 and ES256, matching the keys | |
keys, jwks_url | jwt: pinned PEM key files, a JWKS URL (https://, or http:// to a loopback host with [issuer.jwks] allow_http = true), or both, the pinned keys verifying beside the fetched set; paseto: keys only, each 32 raw bytes or their base64url. With several key files each key's kid is its file name without the extension. Paths are relative to the file | |
max_lifetime_s | 86,400 | a token whose exp - iat is above it is refused (lifetime_over_maximum) |
leeway_s | 60 | clock skew for iat and nbf, at most 300 |
jti_claim | jti | the claim read as the token id, which becomes <id>:<value> |
disabled | false | true refuses every token of the entry (issuer_disabled) |
revoked_kids | [] | at most 32 kids refused whatever the key set holds (kid_revoked) |
subject.claim | sub | the claim the principal is mapped from |
subject.mode | prefix | prefix: <kind>:<namespace>.<value> (kind and namespace required; a value holding @ is refused, personal_data_in_id); hash: <kind>:<namespace>.<32 hex digits>, an HMAC-SHA-256 of the value under hash_key_file (at least 32 bytes, never rotated); actor: the value is a principal id; directory: the principal of the tenant's directory entry that holds the account {directory_system, value} (directory_system defaults to the entry's iss; §8.27) |
subject.kinds, subject.services | actor and directory: the kinds the entry may map (required; never system), and the service: principals it may map when kinds names service | |
subject.directory_system | the entry's iss | directory only: the sign-in system whose accounts map the subject, 1 to 128 bytes, a directory account's system bound (a longer iss needs a shorter system named here); the file's directory entries name at most 16 distinct systems. A directory entry takes no subject.kind, subject.namespace or subject.hash_key_file, needs a server that advertises directory_v1, and on a cluster data node takes no tenants.aliases, since an ingress cannot route an alias to its tenant's directory. Each break is rule subjects |
tenants.allowed | required | tenant ids, or ["*"] alone: any tenant but default, dev and the tenant of CORTEX_V1_AUDIENCE |
tenants.deployment_audience | false | true: aud may be CORTEX_V1_AUDIENCE |
tenants.aliases | [] | {aud, tenant} pairs: an aud (an MCP resource URI, say) that maps to a tenant |
claims.act, .client, .run, .run_start, .taint, .auth_time | false | which principal-chain claims the entry's tokens may carry (§4.7.2); run_start needs run |
claims.app | {claim = "client_id", allowed = [...], map = {...}}: the claim read as the application, the service: ids allowed, and raw values mapped to them; a value outside allowed is the application unlisted; with allowed empty no app is asserted | |
claims.scopes_any_root | false | with tenants.deployment_audience: the entry's deployment-audience tokens may name any root in scopes |
[issuer.jwks] | refresh_s 300, min_refetch_s 30, timeout_ms 3,000, max_bytes 65,536, max_keys 32, stale_after_s 86,400, ca_file (PEM roots in place of the WebPKI ones), allow_http false |
A file holds at most 32 entries.
An entry's token is checked in this order: the entry whose iss it names (a disabled one refuses it); its format and, for a JWT, its header (a crit header refused, a typ other than JWT or at+jwt refused, alg in algorithms, kid not revoked; jku, jwk, x5u and x5c ignored); its signature, with the entry's keys only; its audience (a string, or an array exactly one element of which maps); its subject; its token id; exp and iat (both required) and nbf, within leeway_s, and exp - iat within max_lifetime_s; the revocation of <id>:<jti>; the claims the entry may assert; each claim's form. The mapped sub is the caller, and GET /v1/auth/whoami answers it.
- Audiences.
cortexdb:tenant:<t>with<t>allowed,CORTEX_V1_AUDIENCEwithdeployment_audience, or an alias'saud;<t>is the billing tenant. Anything else is401 WRONG_TENANT. scopes. Every entry lies in the token's tenant rootorg:<t>(a:*entry counts as lying in it), but a read entry (scope.read*) namingapp:<key>, the reference root of the token's own applicationservice:<key>; any other is401 CLAIM_NOT_PERMITTED,details.claim: "scopes",details.entry.minteris never an entry's: only this server's minter stamps it (401 CLAIM_NOT_PERMITTED,details.claim: "minter").- Read at every use. A read that holds its evidence while it runs (
/v1/recall,/v1/recall/stream,/v1/answer,/v1/compose) checks the token again at each use: the entry must still be the file's for the token'siss, under the sameid, enabled and still admitting the token's audience, and the token must be unexpired and unrevoked. A reload that disables the entry or drops the tenant, or a revocation, so ends a read in flight:403 POLICY_DENIEDbefore anything is delivered. - JWKS. Fetched in the background from boot, and refreshed every
min(refresh_s, max-age), at least every 60 s; serving does not wait, but an entry's first bearer waits on its first fetch when no set was kept. An unknownkidrefetches once, single-flight, at most once permin_refetch_s; a failed fetch keeps the cached set and backs off from 3 s to 60 s; a set older thanstale_after_sis dropped. The last good set is kept in<data_dir>/auth/jwks/<id>.jsonand loaded at boot. While no pinned or cached key verifies a token and no fetch succeeds, it is503 ISSUER_KEYS_UNAVAILABLE(retriable), withRetry-Afterthe whole seconds until the cache's next fetch (its backoff: 3 s doubling to 60 s; 3 s while no failure is remembered, before the first fetch), at least 1, also indetails.retry_after_seconds. To stop a leaked key at once, add itskidtorevoked_kids(or setdisabled) and reload. - No entry's token mints:
POST /v1/auth/tokenswith one is403 POLICY_DENIED,details.reason: "issuer_token_cannot_mint".
GET /v1/admin/metrics auth reports the file (issuers_file, auth_issuers_sha256, reloaded_at, deployment_minters, each entry's keys and fetches), and GET /metrics cortexdb_auth_*.
4.7.2 The principal chain's claims
Every claim is optional, at the payload's top level. A claim whose value is JSON null reads as absent.
| Claim | JSON | Valid when | details.reason of a refusal |
|---|---|---|---|
act | {"sub": "agent:<id>"} | exactly one member, an agent: principal other than sub | malformed, not_an_agent, same_as_sub; act_not_delegable (below) |
app | "service:<id>" | a service: principal; an entry's value mapped through claims.app, unlisted outside its list | malformed, not_a_service |
client | "person" or "agent" | one of the two; "person" never beside act or run | malformed, person_with_agent |
run | string | 1 to 128 characters of [A-Za-z0-9_.:-] | malformed |
run_start | integer, Unix seconds: when the run began | with run; at most iat plus the leeway, and at most 86,400 s before iat | run_start_without_run, after_iat, run_too_old, malformed |
taint | array of 1 to 8 tags of [a-z0-9_]{1,32}, such as ["external"] | as stated | malformed |
auth_time | integer, Unix seconds: the person's last sign-in | 0 <= auth_time <= iat plus the leeway | out_of_range, malformed |
minter | "operator" or a principal id | stamped by this server's minter only (§4.7.5) | malformed |
cdb_crit | array of at most 16 claim names | each one of the eight above, which this release understands | unknown_critical_claim (with details.critical), malformed |
A malformed claim is 401 INVALID_TOKEN_CLAIM with details.claim, details.reason and details.issuer. A claim the token's issuer may not assert is 401 CLAIM_NOT_PERMITTED, details.claim: this server's minter asserts every claim, but act, app, client, run, run_start, taint and a minter other than "operator" only in a token signed with the PASETO implicit assertion cortexdb:chain:v1 (footer {"cdb":"chain1"}), which only POST /v1/auth/tokens signs and which 0.13.x refuses; an issuers-file entry asserts what its [issuer.claims] allows and never minter; every other key asserts none; any issuer may set cdb_crit.
The chain's links. The person is sub when it is a user:, or when it is an agent: that is the self of an AI employee record of the tenant (the registry decides it); the agent is act.sub, else sub when it is an agent:; the application is app; the client is client, else "agent" when the token carries act, app or run or sub is not a user:, else "person". An agent chain token carries act or run, or carries app or client and resolves client to "agent": it is confined on every capability (§4.7.3). GET /v1/auth/whoami answers chain for a token that carries a claim other than minter (§8.16.2). app is the chain's application wherever a tenant admits applications: a tenant whose root sets apps_enforced refuses a chain whose application is not admitted at the scope, 403 APP_NOT_ADMITTED (§8.26). The link gates the data plane, never registry administration: change sets (staging, activation, and a dated activation at its date), the scope routes of §8.8 and the directory's Owner checks (§8.27) are decided by the roster alone, so an Owner administers its records whatever application its token names.
Writes. A write is non-human when sub is not a user:, the token carries act or run, or client resolves to "agent".
- A token with
actand norunwrites nothing:403 RUN_REQUIRED,details.scope, onPOST /v1/experience, each item of/v1/experience/bulkand/v1/experiences, each JSONL import line andPOST /v1/beliefs, after the route's own authorization. - A write whose token carries
act, and whose envelope leavesobserved_actorout, is stored with the agent asobserved_actorand the caller assubject;scope.write.on_behalf_ofis asked only for anobserved_actorthat is neither the caller nor the agent (§8.1). The stamp is not part of the write's identity: a resend under anotheractreplays the first write. - A chain token's non-human write carries the atoms and provenance of what its chain and run read, and is redirected to its writer's private space when it must be (
write_provenance_v1, §8.1). - An AI employee's shift is its own run. A token, whoever signed it, whose
actnames theselfof anemployeerecord at<tenant root>/agent:<id>or<tenant root>/employee:<id>that is notdelegableis401 INVALID_TOKEN_CLAIM,details: {"claim": "act", "reason": "act_not_delegable"}: an AI employee's token names the employee assub, with noact. A mint of such a token is422 INVALID_BODY,act_not_delegable. The agents of workers' and project roles' regions, which aredelegable, act for a person, and so does an agent that is no employee'sself.
4.7.3 Confinement
scopes entry | Names |
|---|---|
<capability-or-prefix>:<path>, <capability-or-prefix>:<path>/* | the subtree at <path>: the scope and every descendant |
<capability-or-prefix>:<path>! | that one scope, none below it (principal_chain_v1) |
<capability-or-prefix>:* | every scope, and the checks a route makes without a scope (audit.read, blob.upload, blob.read, lifecycle.subscribe, vocabulary.read, temporal.phrases.read, ...) (confinement_wildcard_v1). On a tenant-audience token (aud cortexdb:tenant:<t>): every scope in org:<t> only |
The capability part is an exact capability or a dotted prefix of one: scope.read names every scope.read.*, and scope names scope.read.*, scope.write.* and scope.create.*. An entry whose path does not parse confines its family to nowhere. After the deployment's and the tenant's policy, a token's capability is decided so:
caps: a capability the list leaves out is403 POLICY_DENIED,details.denied_by_tier: "actor".- An entry names the capability: it is held only where such an entry covers the scope, else
403 POLICY_DENIED,details.denied_by_tier: "actor"; when only a tenant-audience token's:*entry named it and the scope lies outside its root,details.link: "tenant". - No entry names it (total confinement, since 0.14.0):
403 POLICY_DENIED,details.link: "confinement", withdetails.capability. A check made without a scope is confined the same way, so such a family needs a:*entry. WithCORTEX_TOKEN_CONFINEMENT_ENFORCE=offthe capability stays unconfined and each use counts undertoken_confinement; an agent chain token stays confined whatever the switch. - An agent chain token without
scopesholds no capability:403 POLICY_DENIED,details.link: "confinement".
A token without scopes that is not an agent chain token keeps 0.13.x's rules, its rosters confining it. GET /v1/auth/whoami and GET /v1/policy/effective list only the capabilities an entry names while the switch is on. A :* entry is never evidence of a grant at a path: it registers no scope at a first write and skips no tenant-root fence. A token signed elsewhere with a :* entry, which 0.13.x read as confining its family to nowhere, holds that family from 0.14.0; a 0.13.x server reads a :* or ! entry as a path that does not parse.
4.7.4 Lifetime ceilings
Since 0.14.1 each ceiling is a setting, read once at boot after the override files (an [engine] variable on a
cluster data node): a whole number of seconds, or of minutes, hours or days with m, h or d (90d, 24h,
3600), at least 60. Unset or blank is the default; any other value, or one under 60 s, refuses the boot (exit 78
AUTH_CONFIG_INVALID).
| Minted token | Setting | Ceiling by default (exp - iat) | At the mint | At every use |
|---|---|---|---|---|
carries a chain field (act, app, client, run, run_start, taint) | CORTEX_MINT_MAX_LIFETIME_CHAIN | 86,400 s (24 hours) | 422 INVALID_BODY, details: {reason: "ttl_too_long", field: "ttl_seconds", lifetime_s, ceiling_s}, whatever the switch (lifetime_s and ceiling_s since 0.14.1) | its subject's ceiling below |
a user: subject (a person) | CORTEX_MINT_MAX_LIFETIME_PERSON | 7,776,000 s (90 days; 7 days in 0.14.0) | 422 INVALID_BODY, ttl_too_long, with details.field, details.lifetime_s and details.ceiling_s | 401 INVALID_TOKEN_CLAIM (below) |
an agent: subject | CORTEX_MINT_MAX_LIFETIME_AGENT | 604,800 s (7 days) | as above | as above |
a service: or system: subject | CORTEX_MINT_MAX_LIFETIME_SERVICE | 2,592,000 s (30 days) | as above | as above |
ttl_secondsdefaults to 3,600 and is clamped to at least 60. A mint is refused before anything is written, a hosted tenant's rebind included. Attl_secondswhose expiry is past what a timestamp holds is422 INVALID_BODY,ttl_out_of_range, whatever the switch.- At every use, a PASETO token whose
issisCORTEX_V1_MINTER_ISSUERand which the minter's own key verifies is refused when itsexp - iatis above the ceiling for itssub's kind, the one this boot runs with:401 INVALID_TOKEN_CLAIM,details: {claim: "exp", reason: "lifetime_over_ceiling", issuer: "minter", lifetime_s, ceiling_s}, after the clock checks and before the revocation. That reaches every token the minter ever signed, whenever it was minted: a token minted before 0.14.0 with a longer lifetime, or under a ceiling since lowered, stops authenticating; mint it again. A person's token of up to 90 days, which 0.14.0 refused, authenticates again under the default./v1/auth/signup's tokens live 7 days, or the person's ceiling when it is set lower. CORTEX_MINT_LIFETIME_ENFORCE=offmints and serves them, counting each undermint_lifetimeagainst the same ceilings; the chain ceiling of a chain mint and the out-of-range refusal stay.GET /v1/admin/metricsauth.lifetime_ceilingsreports the four ceilings this process runs with, in seconds ({"person", "agent", "service", "chain"}), and so does a cluster data node's/node/v1/statusauth_modes.lifetime_ceilings, whichcortexdb admin statuscompares across the data nodes (AUTH_MODE_DIVERGED): give every data node the same settings.- A hosted deployment whose website mints 90-day account tokens (
user:subjects) for its customers' SDKs mints within the person's default. One whose own minting token, such asservice:website-minter's, lives longer than 30 days setsCORTEX_MINT_MAX_LIFETIME_SERVICEto that lifetime (365d) before it turns the switch on, or re-mints that token within 30 days. - An issuers-file entry's tokens are bound by its
max_lifetime_sinstead (401 INVALID_TOKEN_CLAIM,lifetime_over_maximum, §4.7.1).
4.7.5 The minter link
- Every mint stamps
minter(mint_chain_v1):"operator"when the minting credential is the trusted operator or a deployment minter (a principal the issuers file lists indeployment_minters, minting with a deployment-audience token this server's minter signed), and on the tokens of/v1/auth/signupandmint_offline; otherwise the minting token'ssub. Aminter: "operator"token is signed as before, so 0.13.x still reads it. - The link. Every decision for a token whose
minteris a principal other than itssubalso needs that principal to pass at the same scope: each capability the decision checks, under the deployment's and the tenant's policy (with no token), and the role the decision needs on the scope's roster. A decision it fails is403 POLICY_DENIED,details.link: "minter",details.denied_by_tier: "scope". Only verified per-actor tokens take the link; a self-mint, aminter: "operator"token and a token minted before 0.14.0, which carries nominter, pass.CORTEX_MINTER_LINK_ENFORCE=offserves such a decision and counts it underminter_link. - A mint's chain fields (
act,app,client,run,run_start,taint; §8.16.3) are checked against the minting credential before anything is signed:actandrunfor another subject needauth.mint.on_behalf_ofat everyscopesentry (403 POLICY_DENIED,on_behalf_of_required);apptakes the application's own principal or an Owner of<tenant>/app:<id>(403,app_not_owned);client: "person"takes a self-mint, the trusted operator or a deployment minter (422,person_client_not_permitted); a token that will be an agent chain token names each of its capabilities inscopes(422,unconfined_family). A minting token'staintis copied in by every mint, whatever fields the request sends, itsrun_startinto a token of the samerun, andauth_timeonly into a token for the same subject; since 0.14.0 arunis 1 to 128 characters of[A-Za-z0-9_.:-]and atainttag 1 to 32 of[a-z0-9_], at most 8 tags with the minting token's (422 INVALID_BODY,malformed), so a minted token always verifies. The response echoes what was stamped aschain. - The mint's reach (
CORTEX_MINT_REACH_ENFORCE, checkmint_reach; §8.16.3). A minted token reaches no more than its minter: the mint names one tenant root, each of itscapsis one the minting credential holds at the mint's scope, itsscopesentries lie within the minting token's own, and a token another principal minted never mints. A deployment minter has no exemption: its token (service:website-minter's, say) holdsauth.mintand, at*, every family the tokens it mints carry, so a hosted deployment re-mints it with every family its account tokens carry when it upgrades.
4.7.6 Refusals
Every authenticated route can give these; §16 has each code.
| HTTP | Code | When | details |
|---|---|---|---|
| 400 | INVALID_HEADER | the operator key, an auth-disabled server or the unsigned development mode, with an X-Cortex-Actor that is not a principal id | part: "header", field: "X-Cortex-Actor", reason (the parse error) |
| 401 | MISSING_TOKEN | no Authorization: Bearer; or a bearer that is neither the operator key nor a PASETO v4 public or JWT token (a wrong operator key), with or without X-Cortex-Actor | none |
| 401 | ACTOR_MISMATCH | a token that verifies, sent without X-Cortex-Actor (but an issuers-file entry's in prefix, hash or directory mode, and /mcp; a token that does not verify answers its own refusal), or one whose sub differs from it | none |
| 401 | INVALID_TOKEN | a PASETO token no registered key verifies, one signed by a key other than its iss's included | none |
| 401 | INVALID_TOKEN_SIGNATURE | a bad signature, an iss no issuer is registered under, a JWT algorithm other than RS256 or ES256, a malformed token, a plain token's iat ahead | on an entry's token: issuer, and reason issuer_disabled, token_type, critical_header, algorithm, kid_revoked or unknown_kid |
| 401 | EXPIRED_TOKEN | exp has passed | issuer on an entry's or a chain token |
| 401 | REVOKED_TOKEN | the token's id is revoked (§4.5) | as above |
| 401 | WRONG_TENANT | an aud the token's issuer may not name, or one that names no tenant | as above |
| 401 | INVALID_TOKEN_CLAIM | a malformed chain claim (§4.7.2); an entry's token without exp, iat or jti (missing), with iat or nbf ahead (ahead, also on a chain token), or past its max_lifetime_s (lifetime_over_maximum); a minter token past its ceiling (lifetime_over_ceiling, §4.7.4); act_not_delegable | claim, reason, issuer, and lifetime_s and ceiling_s for a lifetime |
| 401 | CLAIM_NOT_PERMITTED | a chain claim the token's issuer may not assert; an entry's scopes entry outside its tenant root | claim, issuer; entry for scopes |
| 401 | SUBJECT_UNMAPPED | an entry's subject mapped to no principal (missing, not_a_principal, kind, service, foreign_namespace, personal_data_in_id, malformed, too_long; for a directory entry also not_in_directory, no entry of the tenant's directory holds the account, and directory_not_here, this node does not serve the tenant's root or keeps no directory); on every route and whatever issuer signed it, a principal whose entry in its tenant's directory is deactivated (deactivated), never the trusted operator | reason, and issuer for a mapping |
| 410 | TENANT_DELETED | the credential's tenant root, org:<billing tenant>, is being deleted or was (§8.6.10); never the trusted operator. SCIM answers it 401 (§8.28) | none |
| 503 | REVOCATION_UNAVAILABLE (retriable) | a cluster data node whose revocation lease lapsed (no metadata confirmation for 10 s, or just started), or a single node whose revocation journal failed (a refused write latches the list, and every token is denied: never 401 REVOKED_TOKEN) | issuer on an entry's or a chain token |
| 503 | ISSUER_KEYS_UNAVAILABLE (retriable, Retry-After) | an entry's JWKS cannot be fetched and no pinned or cached key verifies the token; Retry-After is the whole seconds until the cache's next fetch, at least 1 | issuer, retry_after_seconds |
| 503 | WAL_UNAVAILABLE (retriable) | the directory did not read: a directory subject's principal, or a principal's deactivation, is unknown | issuer for a mapping |
| 403 | POLICY_DENIED | caps or scopes leave the capability out (§4.7.3), the minter link fails (§4.7.5), the roster does not admit the caller, or the credential stopped being current during a read (§4.7.1) | capability, denied_by_tier, link (confinement, tenant, minter) |
| 403 | APP_NOT_ADMITTED | the chain's application is not admitted at the scope, in a tenant that sets apps_enforced (§8.26); the events listing and an export answer it as their own 403 POLICY_DENIED (§8.7.1, §8.12.1) | none |
| 403 | RUN_REQUIRED | a write by a token with act and no run (§4.7.2) | scope |
The operator key also meets the operator plane's codes, 403 BREAK_GLASS_REQUIRED, 400 INVALID_HEADER for a malformed, repeated or oversized X-Cortex-Break-Glass (details.field: "X-Cortex-Break-Glass") and 503 NOTICE_UNAVAILABLE (§8.15.3), and every credential meets the license gate's 402 LICENSE_EXPIRED and 402 LICENSE_REQUIRED, which answer before authentication on a build that enforces licenses.
5. Authorization Framework
5.1 The Four-Tier Stack
Deployment policy ← operator, at server boot
↓ narrows
Tenant policy ← tenant admin
↓ narrows
Scope policy ← scope owner
↓ narrows
Actor policy ← scope owner or self
A capability is allowed iff every tier allows it. A tier's silence on a capability defaults to its parent's value (inherit-up).
5.1.1 Monotonicity rule
No tier can grant a capability its parent denies. Token caps, when present, are further narrowed against the effective tier stack — they cannot expand. Since 0.14.0 a token's scopes confine every capability it holds, not only those an entry names (§4.7.3), and a token another principal minted holds a capability at a scope only where its minter does (§4.7.5).
5.1.2 Decision attribution
Every 403 POLICY_DENIED names the capability and the tier that denied it, in details:
{
"error_code": "POLICY_DENIED",
"message": "scope.read.local capability required on scope org:acme/team:eng",
"request_id": "req_01HX...",
"details": {
"capability": "scope.read.local",
"denied_by_tier": "actor",
"link": "confinement"
},
"retriable": false
}
denied_by_tier is deployment or tenant (the policy stack), actor (the token's own caps or scopes) or scope (the scope's roster, or the token's minter). Since 0.14.0 a refusal by a token's own rules names its link, details.link (§4.7): confinement (no scopes entry names the capability, or an agent chain token carries no scopes), tenant (a tenant-audience token's <capability>:* entry outside its root) or minter (the minter link). A refusal 0.13.x already gave carries no link and keeps its body.
5.2 Capability Catalog
Capabilities are dot-delimited and form a shallow hierarchy. Wildcards allowed in policy expressions (scope.read.*) but not in token caps.
| Capability | Gates |
|---|---|
scope.create.global | Registering a global:* scope |
scope.create.cross_tenant | Registering a scope path that crosses tenant boundaries |
scope.write | Writing to any scope (default-allow at deployment) |
scope.write.elevated | Writing to a scope above the actor's natural level (e.g., user writing to dept). "Natural level" = the deepest scope path where the actor is an explicit owner or writer member. |
scope.write.on_behalf_of | Setting observed_actor ≠ caller in the envelope (delegated writes, importer flows) |
scope.write.about_other | Setting subject ≠ observed_actor (admin corrections, coach-observes-player scenarios) |
scope.create.custom | Registering a scope whose type segment is not in the deployment's allowed_scope_types builtin set |
scope.create.source, scope.create.container, scope.create.set, scope.create.hold, scope.create.policy | Registering version 2's records of those types (since 0.14.0): a connector's source and its containers, sets, legal holds, policy records. A caller holding scope.create.custom still registers them, as before 0.14.0 named a capability for them. A set, hold or policy comes only through a change set (§8.22) |
scope.read.local | Reading exactly the named scope (default-allow) |
scope.read.holistic | Selecting holistic/lineage traversal. Public holistic recall admits self plus separately authorized ancestors and descendants (never siblings); layer-list holistic is self plus authorized ancestors only. |
scope.read.descend | Selecting explicit subtree traversal with view=descend |
scope.read.cross_tenant | Crossing tenant boundaries on read |
understanding.read | Reading concept nodes: GET /v1/understanding and /v1/concepts (at the scope, and at each other scope a walking view reads a concept from), /coverage, a concept by id, its /history and its /related (at the concept's scope), beside scope.read.local and a view's own capability |
understanding.read.cross_scope | Pulling concepts across sibling scopes |
understanding.synthesize | Forcing consolidation (admin/debug); also requires scoped write and LLM invocation authority |
forget.cascade.derived_only | Default forget mode |
forget.cascade.redact_events | Redact mode |
forget.gdpr | Erasure of events and everything derived from them (/v1/erasures, §8.6) |
forget.gdpr.cross_workspace | GDPR propagation into shared workspaces |
forget.by_key | A forget whose selector names only memory ids, idempotency keys and capture keys, under the default derived_only cascade: it reads nothing first, so a forget-only service token holds it alone (since 0.14.0, §8.5) |
import.from.mem0 | Run the Mem0 importer |
import.from.zep | Run the Zep importer |
import.from.letta | Run the Letta importer |
import.from.openai | Run the OpenAI memory importer |
import.from.jsonl | Run the generic JSONL importer |
export.format.mem0 | Export to Mem0 format |
export.format.zep | Export to Zep format |
export.format.jsonl | Export to JSONL |
lifecycle.subscribe | Open an SSE lifecycle stream |
llm.invoke | Trigger an LLM call (used by /v1/answer, manual synthesis, and optional narrative views) |
diagnostics.read | Include diagnostics: summary or diagnostics: full in recall/answer responses (otherwise diagnostics are stripped) |
audit.read | Query the audit log |
audit.read.cross_actor | Query audit log for actors other than self |
auth.revoke | Revoke tokens. A caller revokes the token it presents without it; another caller's token takes the trusted operator, whatever the capabilities (§4.5) |
auth.mint | Mint tokens with POST /v1/auth/tokens (§8.16.3) |
auth.mint.on_behalf_of | Mint act, run or run_start for a subject other than the minter's own, at every scopes entry of the mint (since 0.14.0, §4.7.5) |
temporal.phrases.read | List custom temporal phrases |
temporal.phrases.write | Register/delete custom temporal phrases |
vocabulary.read | List vocabularies |
vocabulary.write | Register/edit vocabularies |
policy.administer.deployment | Operator only |
policy.administer.tenant | Tenant admin |
policy.administer.scope | Scope owner |
derivation.administer.scope | Since 0.15.0 (derivation_policy_v1): a scope's derivation policy, as an Owner of the scope, without access administration: a derive record in a change set (§8.22.7), include=texts on GET /v1/derivation/policy and GET /v1/derivation/texts (§8.32). policy.administer.scope admits the same. Free-tier signup tokens carry it under their two subtrees, and cloud_shared_saas allows it; policy.administer.scope is never handed out for it. GET /v1/policy/effective and GET /v1/auth/whoami do not list it yet: the catalog they evaluate (cortex-auth/src/policy.rs::CAPABILITY_CATALOG) predates it, though every check of it is made |
policy.administer.actor | Scope owner or self |
blob.upload | Upload to /v1/blobs |
blob.read | Read blob contents |
admin.flush | Force WAL flush (operator) |
admin.compact | Trigger compaction (operator) |
admin.health | Read full health diagnostics |
The full enumeration with defaults per preset is in Appendix A.
5.3 Deployment Presets
Operators pick one preset at server boot via CORTEX_DEPLOYMENT_PRESET=<name> or a custom YAML. Since 0.14.0 the preset also gives the operator key's default mode, CORTEX_OPERATOR_DATA_READS (deny on cloud_shared_saas, allow on the other three, §8.15.3), and every preset lists version 2's record types under version_2_scope_types (container, set, hold, policy, attrs), which join allowed_scope_types on a node armed for shard apply format 8, as a node is from its first boot of 0.14.0.
5.3.1 on_prem_enterprise
preset: on_prem_enterprise
allow: ["*"]
deny: []
defaults:
actor.require_signed: true
scope.auto_register: true
forget.cascade.default: derived_only
audit.retention: "P1Y"
Everything is on. Customer is responsible for their own internal policy.
5.3.2 cloud_shared_saas
The hosted service's preset. Synced with crates/cortexdb/presets/cloud_shared_saas.yaml, the file
the server loads (comments dropped; the file wins if the two ever disagree):
preset: cloud_shared_saas
tier: deployment
allow:
- scope.create.org
- scope.create.user
- scope.create.agent
- scope.create.service
- scope.create.ws
- scope.create.project
- scope.create.dept
- scope.create.team
- scope.create.app
- scope.create.group
- scope.create.aud
- scope.create.source
- scope.create.container
- scope.create.set
- scope.create.hold
- scope.create.policy
- scope.write
- scope.write.elevated
- scope.write.on_behalf_of
- scope.write.about_other
- scope.read.local
- scope.read.holistic
- scope.read.descend
- understanding.read
- understanding.synthesize
- forget.cascade.derived_only
- forget.cascade.redact_events
- forget.gdpr
- forget.gdpr.cross_workspace
- forget.by_key
- "import.from.*"
- "export.format.*"
- lifecycle.subscribe
- llm.invoke
- diagnostics.read
- audit.read
- blob.upload
- blob.read
- policy.administer.tenant
- policy.administer.scope
- policy.administer.actor
- derivation.administer.scope
- auth.revoke
- auth.mint
- auth.mint.on_behalf_of
- vocabulary.read
- vocabulary.write
- temporal.phrases.read
- temporal.phrases.write
- admin.health
deny:
- scope.create.global
- scope.create.cross_tenant
- scope.create.custom
- scope.read.cross_tenant
- understanding.read.cross_scope
- audit.read.cross_actor
- policy.administer.deployment
- admin.flush
- admin.compact
defaults:
actor.require_signed: true
scope.auto_register: true
forget.cascade.default: derived_only # a forget without `cascade` keeps the memories (§8.5)
audit.retention: P2Y
audit.store_body_bytes: true
audit.pepper_rotation_period: P3M
audit.pepper_retention_buffer: P3M
rate_limit.write: "100/s"
rate_limit.read: "500/s"
rate_limit.importer: "1000/s"
rate_limit.monthly: 1000
allowed_scope_types: [org, dept, team, app, user, agent, service, ws, project, source, employee, chat, role, group, aud]
version_2_scope_types: [container, set, hold, policy, attrs]
issuers: []
Since 0.14.0 the import and export entries name the families' three-segment capabilities: a pattern's * stands for
one segment, and the import.* and export.* this preset listed until then matched no capability, so it allowed no
import and no export.
source is the connectors' segment type (<root>/source:<connector>). Since 0.14.0 registering a
source: leaf explicitly through POST /v1/scopes takes scope.create.source, which this preset
allows (a caller holding scope.create.custom still may); an employee:, chat: or role: leaf
takes scope.create.custom, which it denies (§3.4.1): AI employees and project roles are registered as
agent: scopes of tree kind employee. issuers is parsed and not read: external issuers are the
issuers file's (§4.7.1).
5.3.3 cloud_private
preset: cloud_private
# Single-tenant cloud — global is "their private public"
allow: ["*"]
deny:
- "scope.create.cross_tenant"
- "scope.read.cross_tenant"
defaults:
actor.require_signed: true
scope.auto_register: true
forget.cascade.default: derived_only
audit.retention: "P3Y"
5.3.4 dev_local
preset: dev_local
allow: ["*"]
deny: []
defaults:
actor.require_signed: false # ONLY for local dev
scope.auto_register: true
forget.cascade.default: derived_only
audit.retention: "P7D"
For make dev. The only preset where unsigned actors are allowed.
5.4 Policy Propagation
A policy mutation (PUT on any tier) takes effect immediately for new requests. In-flight requests complete under the policy snapshot they started with.
For SSE lifecycle streams:
- A policy change that affects an open stream takes effect at the next event boundary.
- The current event is delivered if already in progress.
- The stream is then either continued (if still allowed) or closed with
event: policy_revokedfollowed by HTTP close.
5.5 Policy Endpoints
Policy introspection is read-only in v1. The deployment preset and per-tenant
policy lists are set at boot from configuration, not over HTTP. Mutation
endpoints (PUT) and the per-scope / per-actor policy tiers are deferred to a
later phase and are not wired — see cortex-auth::policy for why this is not
an authorization gap (scope access is enforced via scope-registry membership and
token caps, not per-scope policy lists).
| Method | Path | Cap | Purpose |
|---|---|---|---|
| GET | /v1/policy/deployment | none (any authenticated caller) | The deployment policy in force (§5.5.2) |
| GET | /v1/policy/effective?actor=...&scope=... | none (any authenticated caller) | The effective capability set after stacking, for the request's own credential (§5.5.1) |
Both are operator-plane routes of class O (§8.15.3), served to the operator key in every mode. On a cluster the ingress routes each by the bearer's tenant while that root is assigned, else to any owner.
5.5.1 GET /v1/policy/effective
Capability: none: any authenticated caller.
Evaluates the server's capability catalog for the request's own credential: the deployment policy, the
policy of the caller's billing tenant, and the token's own caps and scopes at scope. The catalog is a
fixed list of 65 built-in names, every capability the server names: §5.2's and scope.create.<type> for each
built-in type. Since 0.14.0 that includes version 2's scope.create.source, .container, .set, .hold and
.policy, forget.by_key, auth.mint and auth.mint.on_behalf_of, so a client learns all it may do, minting
included; until 0.14.0 the list left those eight out. Since 0.15.0 it also lists derivation.administer.scope, so a
console can tell who may administer a scope's derivation policy. GET /v1/auth/whoami lists the same catalog with
no scope (§8.16.2).
| Query | Type | Notes |
|---|---|---|
scope | string | The scope to evaluate at. Absent: no scope. One that does not parse is 422 INVALID_SCOPE_GRAMMAR. |
actor | string | The actor the body reports, an actor id such as user:alice; default the caller. It changes nothing else: the per-actor tier is not evaluated, so the lists are the caller's own whatever actor it names. One that does not parse is 422 INVALID_BODY. |
- Token
capsleave out what they do not name (denied_by_tier: "actor"). - A token that carries
scopesholds a capability atscopeonly through an entry that names it there: a subtree entry at or abovescope, an exact entry (<capability>:<path>!) atscope, or a<capability>:*entry (on a hosted tenant's token, for scopes underorg:<tenant>only). With noscope, only:*entries hold. Since 0.14.0 a capability no entry names is denied too (total confinement, §4.7), unlessCORTEX_TOKEN_CONFINEMENT_ENFORCE=off. - An agent chain token (
actorrun, orapporclientresolving toagent) withoutscopesholds nothing. - Roster roles and the minter link are not consulted: a capability listed here can still be refused at a scope whose roster does not admit the caller. Listing is not a use, so the access report counts nothing for it.
Response: 200:
{
"actor": "user:alice",
"scope": "org:acme/dept:eng/user:alice",
"deployment_preset": "cloud_shared_saas",
"natural_level": null,
"allowed": [
"scope.write", "scope.read.local", "scope.read.holistic",
"understanding.read", "forget.cascade.derived_only", "lifecycle.subscribe", "..."
],
"denied": [
{"capability": "scope.create.global", "denied_by_tier": "deployment"},
{"capability": "scope.read.cross_tenant", "denied_by_tier": "deployment"}
],
"rate_limits": {"write": "100/s", "read": "500/s", "importer": "1000/s"}
}
scope is null without the parameter; natural_level is always null (not computed in this release);
allowed and denied keep the catalog's order; denied_by_tier is deployment, tenant or actor (the
token's caps or scopes); rate_limits are the deployment defaults' rate_limit.write, .read and
.importer, each null when unset.
Errors: 422 INVALID_BODY (actor), 422 INVALID_SCOPE_GRAMMAR (scope), each retriable: false.
5.5.2 GET /v1/policy/deployment
Capability: none: any authenticated caller.
The deployment preset this server loaded (CORTEX_DEPLOYMENT_PRESET, default dev_local, §5.3) as the
evaluator holds it: its allow and deny capability patterns and its defaults, under their dotted names,
each optional default null when unset. defaults.allowed_scope_types is the list in force: the preset's
own and, on a node armed for shard apply format 8, its version-2 types (container, set, hold, policy
and attrs in the presets), which are never served under a name of their own, so an unarmed node answers as
0.13.x did. Per-tenant policy lists are not served.
{
"preset": "dev_local",
"allow": ["*"],
"deny": [],
"defaults": {
"actor.require_signed": false,
"scope.auto_register": true,
"forget.cascade.default": "derived_only",
"audit.retention": "P7D",
"audit.store_body_bytes": true,
"audit.pepper_rotation_period": "P3M",
"audit.pepper_retention_buffer": "P3M",
"rate_limit.write": "10000/s",
"rate_limit.read": "50000/s",
"rate_limit.importer": "100000/s",
"rate_limit.monthly": null,
"allowed_scope_types": ["org", "dept", "team", "app", "user", "agent", "service", "ws", "project",
"global", "system", "debug", "temp", "source", "employee", "chat", "role", "group", "aud",
"container", "set", "hold", "policy", "attrs"]
}
}
forget.cascade.default is the preset's; POST /v1/forget does not read it (§8.5). The route has no errors
of its own.
Since 0.14.0, for a token that carries scopes, allowed lists only the capabilities a scopes entry names (while CORTEX_TOKEN_CONFINEMENT_ENFORCE is on), and an agent chain token without scopes lists none (§4.7.3). Since 0.14.0 every capability of the catalog is listed in allowed or denied, version 2's scope.create names, forget.by_key, auth.mint and auth.mint.on_behalf_of included; until then those eight were never listed.
6. HTTP Conventions
6.1 URLs and versioning
- Base path:
/v1 - One major version. Breaking changes increment to
/v2; the old major stays online for 90 days minimum once a successor exists. (Not relevant pre-launch.) - No minor version in the URL; additive changes ship freely.
6.2 Content types
- Request body:
application/json; charset=utf-8 - Standard response:
application/json; charset=utf-8 - Streaming responses:
text/event-stream; charset=utf-8 - Blob upload: raw file bytes to
/v1/blobswithContent-Type: <mime>(multipart bodies are rejected with 415;application/jsonis a valid file MIME — the body is stored verbatim as the file's bytes)
6.3 Idempotency
Every write endpoint accepts an idempotency_key field in the body, except
POST /v1/forget and POST /v1/forget/preview: their bodies are strict, so a
forget that carries idempotency_key is refused with a 422 (unknown field) and
deletes nothing. A forget needs no key, because deletes are idempotent and
re-sending the identical request is safe (§8.5). POST /v1/erasures does take
one (§8.6.3).
A duplicate (same key + same body) replays the original result: the single-write response carries replayed_from_idempotency: true and each bulk item carries the same flag in its results[] entry. (There is no X-Cortex-Replay response header — the signal is in the body.)
- Keys are scoped to
(requested scope, caller, endpoint bucket, idempotency_key).POST /v1/experience,/v1/experience/bulkand/v1/experiencesshare one bucket, so a retry that switches between them still replays;POST /v1/importwith/v1/import/jsonl, and each other import source, have their own. A capture redirected to its writer's private space keeps its claim under the scope it asked for. - Keys expire after 24 hours.
- Without a key, writes are not idempotent. The SDK supplies one by default.
- Status lookup:
GET /v1/experience/status?idempotency_key=<key>answers "did my write land?" without re-sending the body — the resume path after an ambiguous client timeout (see §8.18). - Failed writes keep their key: when a write is accepted but its indexing
then fails (
INDEXING_FAILED,retriable: false), its idempotency record is kept — re-sending the same key replays the failure. Do not re-send the data: the event is stored and excluded from recall, and an operator can bring it back under its own id withPOST /v1/admin/index-audit/reinclude({event_id, scope}; trusted operator, single node), which indexes it in place and, if it fails again, leaves it excluded and says so (502INDEXING_FAILED, or 503INDEXING_UNAVAILABLEwhile its embedding provider is down). A key that answersfound: falseon the status endpoint has no live receipt: re-sending it is safe if the write was sent within the last 24 hours (receipts last that long); for an older write, look it up before re-sending. The answer'sresendfield says which (§8.18). - Unicode canonicalization: both the key and the "same body" comparison
are Unicode-normalization-insensitive (NFC). A retry whose text round-tripped
through an NFC-normalizing system (Slack, macOS, many databases) and came
back canonically equivalent but byte-different still replays — it is not
an
IDEMPOTENCY_CONFLICT. Stored content is never rewritten; only the dedup identity is canonicalized.
6.4 Pagination
Cursor-based pagination on all list endpoints.
GET /v1/facts?scope=...&limit=50
→
{
"items": [...],
"next_cursor": "eyJpZCI6ImZhY3RfMDFIWC4uLiJ9",
"has_more": true
}
GET /v1/facts?scope=...&limit=50&cursor=eyJpZCI6ImZhY3RfMDFIWC4uLiJ9
- The bounds are each route's own (its section and the served OpenAPI give them): the layer lists default to
50 and clamp
limitto 1 to 1000; the access lookups default to 1,000; the rollups to 20, at most 100. - Cursors are opaque: send one back unchanged, to the route and with the query that issued it; one that does not
decode, or that another route or query issued, is refused with
INVALID_CURSOR. The change feed's (§8.7.23) is bound to its root and its consumer instead, never ends (next_cursoris always given), survives a scope move, and is refused withFEED_CURSOR_INVALIDand adetails.reason. - A cursor is a position, not a snapshot: each page is read and authorized as the data and the registry stand
when it is asked for. The access lookups (default
limit1,000) seal their cursors (AES-256-GCM, with a key derived fromCORTEX_API_KEY) to the caller and the request, and judge each later page at the registry's current revision (§8.20).
6.5 Rate limits
Every authenticated response carries X-RateLimit-Limit (the deployment preset's
rate_limit.read for GET and HEAD, rate_limit.write otherwise) and X-RateLimit-Reset (the
next second), plus X-RateLimit-Monthly-Limit and X-RateLimit-Monthly-Reset when the preset
sets rate_limit.monthly. These headers announce the preset's ceiling; the server does not
count requests against it and sends no X-RateLimit-Remaining.
Per-subtree limits (IR7). The operator may limit each tenant subtree with
CORTEX_SUBTREE_RATE_LIMITS=read=RATE[:BURST],write=RATE[:BURST] (requests per second, a
token bucket per subtree and class; BURST defaults to twice RATE; off when unset). A subtree is
the scope's first CORTEX_TENANT_DEPTH segments (default 1, the root; 2 gives each
tenant under a bucket root, org:b7/org:acme, its own bucket). Reads are /v1/recall,
/v1/recall/stream, /v1/answer and /v1/compose, one each, charged to the request's scope;
writes are /v1/experience (one) and /v1/experience/bulk (one per item, to each item's
subtree, all or none). A request is charged only after its authorization passed, so a caller
cannot spend a subtree it may not use. Over the limit the request answers
429 SUBTREE_RATE_LIMITED, retriable: true, with Retry-After (whole seconds) and
details: subtree, class, limit_per_second, burst; nothing was done. The buckets are
per process: on a cluster each data node limits the roots it serves.
Usage per tenant subtree (IR12). GET /v1/usage?scope= (scope read) also reports
storage (events, bytes, capped: the captured rows the source log holds under the scope
and their encoded bytes, read from the scope index, so the cost is the subtree's own rows; a row a
forget hid but did not erase still counts) and, for a scope that is a tenant subtree (its first
CORTEX_TENANT_DEPTH segments) or above one, activity: reads (recall, recall stream,
answer, compose), writes (memories; a bulk counts each item), write_bytes (their content's
JSON bytes), erasures, first_at and last_at (Unix seconds), all counted when the request
passed its authorization and its subtree rate limit. Above the tenant depth it is the sum over the
tenants under the scope (tenants, capped past 100,000). GET /v1/admin/usage/subtrees
(trusted operator; prefix, after, limit at most 10,000) pages every tenant's counters in
subtree order, next_after naming the next page. The counters are per node, survive a restart (only
the subtrees that changed are merged into their rows, every CORTEX_USAGE_LEDGER_FLUSH_SECONDS
and at shutdown; a crash loses at most one interval) and live in the v1_layers store under
usage_sub/, with no new column family. On a cluster each data node counts what it served.
Outcomes per tenant (0.12.8). The activity counters also count how each request charged to a
tenant ended (a request reaches its tenant at its plan check or its subtree rate limit, so the
memory routes: experience, bulk, recall, recall stream, answer and compose): errors_5xx
(status 500 and above), errors_4xx (other 4xx the tenant's request caused: 400, 404, 409, 413,
422, ...; never 401 or 403, which name a caller that wasn't the tenant's), refused_plan (402
PLAN_LIMIT_REACHED) and refused_rate (429 SUBTREE_RATE_LIMITED), each with a _month
twin for month (an outcome sets month even with plans off), plus last_error_at (Unix
seconds) and last_error_code (that response's error_code). A request refused before it named
a tenant (malformed JSON, no token) counts for none. Every outcome field is left out while 0, so
an older row reads back as zeros. GET /v1/admin/usage/subtrees?include_storage=1 adds each
subtree's storage_events, storage_bytes and storage_capped (the storage figure of
/v1/usage); it walks each subtree's rows (at most 1,000,000 each) on the DB lane, so such a page
holds at most 100 subtrees.
Hosted plans (0.12.6; answers and memories by size since 0.12.7). Off unless CORTEX_PLANS=1; an on-prem server never reads a plan,
refuses nothing for one and sends none of the headers below. On a hosted deployment each account
is a tenant subtree (org:acct_42 at the default depth) with a plan; an account without one is
free:
| Plan | Memories | Recalls a month | Answers a month | Tenants | Reads, writes per second (burst) |
|---|---|---|---|---|---|
free | 10,000 | 1,000 | 100 | 1 | 1 (20) |
starter | 100,000 | 25,000 | 2,500 | 5 | 5 (50) |
pro | 1,000,000 | 150,000 | 15,000 | 20 | 17 (100) |
enterprise | unlimited | unlimited | unlimited | unlimited | 83 (500) |
A tenant is a scope one level under the account (org:acct_42/user:acct_42,
org:acct_42/app:support); memories are the account's stored memories counted by size, each
up to 2,000 characters of its text (a memory's text, a blob's transcript, otherwise its
serialized content), so a 5,000-character memory counts 3 (from its captured rows, re-counted at
most every 10 minutes and after a forget, an erasure or an import, plus the writes accepted since);
recalls are /v1/recall and /v1/recall/stream (and a /v1/answer with skip_answer_llm, which
never reaches the model); answers are /v1/answer and /v1/compose, the requests that reach the
answer model. Each request counts once, in the UTC month, however many passes it makes (kept by the
IR12 counters: a crash forgets at most one flush interval); a request refused before its model
(no llm.invoke, no renderer) counts nothing. The plan's rates become the account's IR7 buckets. Past a limit the request answers
402 PLAN_LIMIT_REACHED, retriable: false, and nothing was done:
{"error_code": "PLAN_LIMIT_REACHED",
"message": "the free plan of org:acct_42 allows 10000 stored memories; 10000 used. Upgrade at https://cortexdb.ai/pricing",
"details": {"limit": "memories", "used": 10000, "max": 10000, "plan": "free",
"subtree": "org:acct_42", "upgrade_url": "https://cortexdb.ai/pricing"},
"retriable": false, "request_id": "req_…"}
limit is memories (/v1/experience; a bulk is refused whole when its items' units would pass
it; an import is refused once the account is at it, and one already running is not cut short),
recalls_month or answers_month (each with resets_at, the first instant of next month UTC) or
tenants (a write to a new tenant past the plan's count). Responses to an account's token carry its real
X-RateLimit-Monthly-Limit, X-RateLimit-Monthly-Remaining and X-RateLimit-Monthly-Reset for
recalls (none on an unlimited plan).
GET /v1/plan— the caller's own account: withoutscope, the account its token's first scope grant names; with?scope=, the account of a scope the caller can read. Answers the plan,overrides,limits(null= unlimited),usage(memories,recalls_this_month,answers_this_month,tenants),memory_unit_chars(2000),month,resets_atandupgrade_url.GET /v1/admin/plans/{subtree},PUT /v1/admin/plans/{subtree}— trusted operator only.PUTtakes{"plan": "free"|"starter"|"pro"|"enterprise", "overrides": {...}}, whereoverridesmay setmax_memories,max_recalls_month,max_answers_month,max_tenants(a number, ornullfor unlimited),read_per_second,read_burst,write_per_second,write_burst; an unknown plan or field is422 INVALID_BODY, a scope that is not a tenant subtree400 INVALID_SUBTREE. Both answer the account's report asGET /v1/plandoes.
Plans live in the v1_layers store beside the IR12 rows (plan_sub/<subtree>,
plan_ten/<subtree>/<segment>); a node re-reads an account's plan at least every 60 seconds, so a
hosted deployment is one node or sets each plan on every node. With plans off these routes answer
404 NOT_FOUND. CORTEX_PLAN_UPGRADE_URL sets upgrade_url (default
https://cortexdb.ai/pricing); CORTEX_DISABLE_ANON_SIGNUP=1 makes POST /v1/auth/signup answer
404 even with the minter on, so accounts come only from the website.
6.6 Errors
Standard envelope. All error codes are UPPER_SNAKE_CASE — there is one casing rule, applied everywhere. The redundant lower-snake error field used in older drafts is retired.
{
"error_code": "POLICY_DENIED",
"message": "Cannot create scope under global:* on this deployment.",
"request_id": "req_01HX...",
"details": {
"capability": "scope.create.global",
"denied_by_tier": "deployment"
},
"retriable": false,
"documentation": "https://docs.cortexdb.ai/errors/POLICY_DENIED"
}
Normative shape: error_envelope.schema.json in Appendix D. Fields:
| Field | Type | Required | Notes |
|---|---|---|---|
error_code | UPPER_SNAKE string | yes | Stable identifier; clients pattern-match on this |
message | string | yes | Human-readable; may be localized in the future |
request_id | string | yes | The request's correlation id (§6.7) |
details | object | no | Error-specific structured fields |
retriable | bool | yes | Whether the same request may succeed later |
documentation | URL | no | Link to error reference |
| HTTP | When |
|---|---|
| 400 | Validation error in request body. Since 0.14.0 also INVALID_QUERY for a ?consistency= that is not a flag (§6.11), INVALID_HEADER for a request header that does not parse (an X-Cortex-Actor that is not a principal id, §4.1, a malformed, repeated or oversized X-Cortex-Break-Glass on an operator-key request or a deployment minter's mint, in every mode, §8.15.3, a lifecycle stream's Last-Event-ID, §8.9, or a directory or SCIM User write's If-Match, §8.27, §8.28; details {part, field, reason}), and the AuthZEN routes' refusals, which answer 400 where the access API answers 422 (§8.21) |
| 401 | Auth failure: MISSING_TOKEN, INVALID_TOKEN, INVALID_TOKEN_SIGNATURE, EXPIRED_TOKEN, REVOKED_TOKEN, ACTOR_MISMATCH, WRONG_TENANT; since 0.14.0 INVALID_TOKEN_CLAIM, CLAIM_NOT_PERMITTED and SUBJECT_UNMAPPED (a deactivated directory entry on every route included) (§4.7.6), and FRESH_AUTH_REQUIRED with WWW-Authenticate on a publish of a norm (§8.29) |
| 402 | The license has ended (LICENSE_EXPIRED) or there never was one (LICENSE_REQUIRED), on a build that enforces licenses, before authentication; a hosted plan's limit (PLAN_LIMIT_REACHED, §6.5) |
| 403 | Policy denial (capability missing in effective set, or a roster that does not admit the caller): POLICY_DENIED with details.capability and details.denied_by_tier (§5.1.2); since 0.14.0 a token's own refusal names details.link (confinement, tenant or minter, §4.7). Also BREAK_GLASS_REQUIRED (the operator key under deny, §8.15.3), RUN_REQUIRED, APP_NOT_ADMITTED, ATOMS_REDIRECT_REFUSED and PUBLISH_PERSON_REQUIRED (§1.1) |
| 404 | Resource not found. A by-id read answers the same 404 for a record that does not exist, one outside the caller's tenant and one the delivery gate withholds, so no route confirms a record to a caller who may not read it; a request that names a scope the caller may not read answers 403. Since 0.14.0 a path no route of this server serves is NOT_FOUND, message: "no route of this server serves {method} {path}" (/mcp keeps its own while CORTEX_MCP is off) |
| 405 | METHOD_NOT_ALLOWED (since 0.14.0, on every route): a method the path does not serve; the Allow header names the methods it does, and retriable is false (before, a bare 405 with no body) |
| 408 | A wait ran out of its budget: WAIT_TIMEOUT (retriable: true, details.waited_ms, details.waiting_on), on a write's ?wait= barrier (§8.1, §8.2) and, since 0.14.0, on a consistency demand (waiting_on registry, indexer, declared or access_view, §6.11) |
| 409 | Conflict (idempotency-key reuse with different body; scope path collision on register; CANCELLED, a replay or wait on a write whose cancel committed). Since 0.14.0 also a change set's refusals (CHANGESET_NOT_STAGED, CHANGESET_STALE, CHANGESET_STAGING_FULL, CHANGESET_CONFLICT, CHANGESET_INCOMPLETE, PREVIEW_CHANGED, ACCESS_ASSERTION_FAILED, REGISTRY_NOT_REPLICATED, §8.22), a limit reached (ACCESS_LIMIT_REACHED, APP_LIMIT_REACHED, §8.20), PROVENANCE_ERASED, HOLD_IN_FORCE, ERASURE_NOT_CANCELLABLE (§8.6.5), RESTORE_NOT_PENDING, DIRECTORY_ACCOUNT_TAKEN, ACCESS_REPORT_OFF and ICE_FORK_UNSUPPORTED (§8.15.6) |
| 410 | Resource deleted (forget) — only when policy allows revealing existence; EVENT_EXPIRED (§8.7.1.1). Since 0.14.0 TENANT_DELETED: every request of a tenant whose deletion has begun, but the trusted operator's (§8.6.10); and ROLLUP_SUPERSEDED, a rollup that is not part of its topic's current build (§8.29.3) |
| 412 | DIRECTORY_VERSION_CHANGED (since 0.14.0): a conditional directory or SCIM write whose entry moved (§8.27) |
| 413 | Body exceeds the payload limit (PAYLOAD_TOO_LARGE, see §6.10) — split via /v1/experience/bulk or upload via /v1/blobs. WAL_TOO_LARGE: a vocabulary, temporal-phrase or retention-policy record, a change set's part, a notice acknowledgement's entry, a clustered owner's registry change or a declared belief, above the 4 MiB log command limit (retriable: false). CHANGESET_TOO_LARGE (since 0.14.0): a change set above 1,024 parts or 64 MiB (§8.22) |
| 415 | UNSUPPORTED_MEDIA_TYPE: the body needs Content-Type: application/json (below) |
| 422 | Semantic validation failure (e.g., invalid scope grammar, malformed timestamp). Since 0.14.0 also CONSISTENCY_TOKEN_INVALID (§6.11), INVALID_ACCESS_RECORD (§8.22), INVALID_MOUNTS (§8.26), CROSS_ROOT_PROVENANCE and PROVENANCE_UNKNOWN (§8.1), DIRECTORY_MALFORMED (§8.27) and PUBLISH_TOO_LARGE (§8.29), and on the usage and plan routes INVALID_SCOPE, INVALID_RANGE and SCOPE_REQUIRED, which were 400s (§8.15.4) |
| 429 | A subtree's rate limit (SUBTREE_RATE_LIMITED, Retry-After, §6.5), or every /v1/recall execution permit stayed busy past the queue timeout (RECALL_OVERLOADED, Retry-After: 1) |
| 500 | Server error: a route's own codes (§16), and INTERNAL_ERROR, a failure CortexDB does not classify, which a client retries as an outage under the same idempotency key (retriable: true; false with details.refusal, a proposer bug that reached apply). Since 0.14.0 every route answers INTERNAL_ERROR (INTERNAL is retired), retriable (0.13.x answered each with retriable: false) |
| 502 | Write accepted (WAL-durable) but indexing failed (INDEXING_FAILED, retriable: false) — the idempotency key replays this failure; do not re-send: the event is stored and excluded from recall, and an operator can re-include it with POST /v1/admin/index-audit/reinclude |
| 503 | Service degraded (e.g., embedding service unavailable; write WAL still succeeds but extraction queued). On any write: NOT_LEADER, WAL_UNAVAILABLE or WAL_OUTCOME_UNKNOWN — the replicated log refused or lost the proposal (retriable: true; after WAL_OUTCOME_UNKNOWN retry with the same idempotency key, which replays the original receipt if it committed); a shard apply refusal answers a 503 under its own code, retriable by its own flag (§16). DISK_FULL — the disk guard refused the write before submit because a disk is nearly full; nothing was written (retriable: true, Retry-After, §16). MEMORY_PRESSURE — the server's memory is nearly full, so a heavy request (a bulk write or an import (refused before its body is read), a recall whose subtree pass would engage or that asks for more than 16,000 tokens, a cohort read-all that would read the conversations again, or a recall past half the recall execution permits) was turned away before its heavy work began; nothing was written (retriable: true, Retry-After: 10, §16). Since 0.14.0: REVOCATION_UNAVAILABLE and ISSUER_KEYS_UNAVAILABLE (retriable, the latter with Retry-After, §4.7.6); TENANT_SETTINGS_UNAVAILABLE (retriable, §8.15.3); FORMAT_UPGRADE_PENDING, a write that needs a shard apply format the node's shard is not armed for, only on a node held below format 10 (retriable with Retry-After: 30 for details.reason: "members_behind", §1.1); NOTICE_UNAVAILABLE, a read that must tell someone first whose notice did not commit, so nothing was delivered; ACCESS_RESTORE_PENDING, a root restored from a backup, retriable: false (§8.24); SCOPE_MOVING on a change set, a source route, a directory or SCIM Users write, or a notice or restore acknowledgement, of a root moving between shards; ACCESS_VIEW_UNAVAILABLE (§8.20); and the erasure re-plans HOLD_CHANGED, ERASE_FORMAT_STALE, PROVENANCE_CLOSURE_CHANGED, ERASE_SCOPE_MOVED and DERIVED_CLOSURE_CHANGED (retriable, §16) |
Validation failures (422 INVALID_BODY) carry field-level metadata in
details: field_path (where in the payload serde stopped, e.g.
items[3].context.observed_at), reason (the parser's own message), and
schema (the /v1/schemas/... URL of the normative contract to validate
against).
Since 0.10.3 a request the server refuses before any route logic runs gets the
same envelope, with the status it always had (earlier releases answered these in
plain text): a JSON body that does not fit the route (an unknown field, a wrong
type, a missing field) is 422 INVALID_BODY; a body that is not JSON or could
not be read is 400 INVALID_BODY; a missing or non-JSON Content-Type is 415
UNSUPPORTED_MEDIA_TYPE; a query-string parameter that does not parse is 400
INVALID_QUERY; a path parameter that does not parse is 400
INVALID_PATH_PARAMS. details.part names the part (body, query or
path), details.reason is the parser's message (it names the field when the
parser knew it), message keeps the server's full sentence, and retriable is
false. /v1/answer and /v1/recall/stream also set details.field_path
when the error is below the top level of the body. Any other plain-text 400 or 422
the v1 router would have sent (for example the admin console's /assets and
/docs path errors) is 400 or 422 INVALID_REQUEST. Since 0.14.0 a path no route
serves is 404 NOT_FOUND and a method a path does not serve 405 METHOD_NOT_ALLOWED,
with an Allow header, in the same envelope (retriable: false).
Exceptions (0.10.3): /v1/answer ignores fields it does not know (200), and
/v1/recall reads its own body, so malformed JSON there is 422 INVALID_BODY
rather than 400, and a body with no Content-Type is accepted. Since 0.10.4
that 422 carries the same details.part, details.reason and
details.field_path as /v1/answer's.
6.7 Request IDs
Every v1 response carries X-Request-Id: the client's own X-Request-Id when the request sent
one, else a server-minted req_<uuidv7>. Every error envelope carries the same id in its
request_id: the envelopes the router builds before a route's handler runs (the rejections of
§6.6 and the 413 of an oversized body) since 0.10.3, and the errors a route's handler returns (a
handler's 422 INVALID_BODY, INVALID_CURSOR, a 408 WAIT_TIMEOUT, ...) since 0.10.4. Before
0.10.4 a handler's error minted an id of its own and returned it in X-Request-Id in place of the
client's. Since 0.14.0 the v1 request-id layer also puts the id into any JSON error body that lacks
one (the scope, import, forget, audit, re-derivation, synthesis, feature, settings, conflict, policy
and revoke routes' envelopes among them), so every error envelope carries it. Authentication-layer errors (401) also carry X-Cortex-Request-ID, the same id.
The X-Request-Id value is the request_id of the request's log line (target
cortex_api::request, CORTEX_REQUEST_LOG, docs/generated/env-vars.md §14) and, since 0.10.2,
of the audit rows the request writes: the authentication layer's row and the gdpr row of
POST /v1/forget (§8.10). Send your own id to join a client-side report to the server's line and
to its audit trail. Since 0.10.3 the line of a request that failed also carries the response's
error_code and retriable, so an operator reading the log sees why without the response body.
6.8 Headers we set
| Header | Meaning |
|---|---|
X-Request-Id | Request correlation (§6.7) |
X-Cortex-Request-ID | The same id, on the auth layer's errors and on many other error responses (§6.7) |
X-Cortex-Policy | deployment=<preset>; auth=ok, on every response to a request the auth layer admitted |
X-Cortex-Token-Expires-In, X-Cortex-Token-Expires-At | Seconds left on the request's credential, and its expiry (RFC 3339), on every authenticated response; within 72 hours of expiry a Warning: 199 header asks for a fresh token too |
X-RateLimit-Limit, X-RateLimit-Reset, X-RateLimit-Monthly-Limit, X-RateLimit-Monthly-Reset | The preset's announced ceilings, and a hosted plan's real monthly budget with X-RateLimit-Monthly-Remaining (§6.5) |
x-cortex-stability | stable, unless the route marks itself beta, experimental or internal (§2.4.4) |
Retry-After | On a retriable answer that names a wait (DISK_FULL, MEMORY_PRESSURE, SUBTREE_RATE_LIMITED, RECALL_OVERLOADED, §16); since 0.14.0 also FORMAT_UPGRADE_PENDING and NOTICE_UNAVAILABLE with details.reason: "members_behind" (30 s) and ACCESS_VIEW_UNAVAILABLE building and SUBTREE_BUSY (1 s), and ISSUER_KEYS_UNAVAILABLE (the whole seconds until the key cache's next fetch, §4.7.1). REVOCATION_UNAVAILABLE sets none |
Allow | Since 0.14.0, on a 405 METHOD_NOT_ALLOWED: the methods the path serves (§6.6) |
WWW-Authenticate | Since 0.14.0: /v1/publish's 401 FRESH_AUTH_REQUIRED (RFC 9470, error="insufficient_user_authentication", max_age="600"), and /mcp's 401s (RFC 9728 resource_metadata) |
ETag | Since 0.14.0, GET /v1/directory/{id}: the entry's version, for If-Match (§8.27) |
x-cortex-answer-cache | /v1/answer with the answer cache on: hit, miss or bypass (§8.4.1). Not exposed to cross-origin browser clients (CORS) |
There is no replay header (a replay says so in its body, §6.3) and no deprecation header. A consistency token is a body field, never a header (§6.11).
6.9 Headers we accept
| Header | Meaning |
|---|---|
Authorization | Bearer <credential>, required on every authenticated route: a token, or the operator key (§4.1) |
X-Cortex-Actor | Actor identity, which must match the token's sub; since 0.14.0 an issuers-file entry's token in prefix, hash or directory mode, and a call of /mcp, may leave it out; with the operator key, the actor it acts as (default user:local) (§4.1); a value that does not parse is 400 INVALID_HEADER |
X-Cortex-Break-Glass | Since 0.14.0, the operator key's stated reason for an action CORTEX_OPERATOR_DATA_READS=deny protects: reason=<incident, legal, support, security, migration, restore or other>; ticket=<1 to 64 characters of [A-Za-z0-9._:-]>, optionally ; note=<percent-encoded UTF-8, at most 256 bytes>, at most 512 bytes, sent once. Read only on operator-key requests and on a deployment minter's POST /v1/auth/tokens, ignored on every other credential; a malformed, repeated or oversized one is 400 INVALID_HEADER in every mode (details.field: "X-Cortex-Break-Glass", §8.15.3), and its audit row a deny (§14). Not in the CORS allow list, so a cross-origin page cannot send it |
X-Cortex-Subject-Token | Since 0.14.0, on the trusted operator's requests only: a person's or a worker's token, at most 8,192 bytes, once, for whose chain each decision the request makes is evaluated and counted too (subject_token_shadow_v1, check subject_shadow, §8.30); it never changes the response. A read that declares a purpose is shadowed for it: the subject's chain is decided with the request's purpose, so a path whose when is that purpose holds for the subject too |
X-Request-Id | The client's request id, which the response and every error envelope echo (§6.7) |
X-Cortex-Idempotency-Key | The keyed blob protocol's key: POST and DELETE /v1/blobs/idempotent, GET /v1/blobs/idempotent/status (§8.13.4). Every other write takes idempotency_key in its body (§6.3) |
If-Match | Since 0.14.0, a conditional directory or SCIM write (§8.27, §8.28); a value of no known form is 400 INVALID_HEADER |
Consistency tokens travel in bodies and query parameters, never in headers: consistency in a read's body, ?at_least= on a GET, ?consistency=1 on a write (§6.11).
6.10 Payload limits
| Limit | Default | Override |
|---|---|---|
| Request body (any v1 endpoint) | 32 MiB | CORTEX_MAX_BODY_BYTES |
| Flattened index text per experience | 1 MiB (1,048,576 bytes) | — |
| Stored record per experience (content, labels, references, source descriptor) | 4 MiB less 64 KiB, encoded | — |
idempotency_key | 64 bytes after Unicode NFC | — |
provenance per experience | 1,024 event ids | — |
context.refers_to per experience | 16 entries, 8 candidates each | — |
context.labels (only while CORTEX_LABEL_LIMITS=on, §3.5.3) | 4,096 labels of at most 262,144 bytes | CORTEX_LABELS_MAX_COUNT, CORTEX_LABEL_MAX_BYTES |
| Bulk items per request | 1,000 | — |
| Import rows or lines per request | 10,000 | — |
| Concurrent imports, per process | 32 | — |
| Export response, buffered | 256 MiB | — |
| Concurrent exports, per process | 4 | — |
| Connector fragment text | <1 MiB | lossless automatic fragmentation |
One experience whose flattened content exceeds 1 MiB, or whose whole stored
record exceeds 4 MiB less 64 KiB once encoded (the log's 4 MiB command limit
less a margin), is rejected with 422 INVALID_ENVELOPE; the server never
truncates it. In a bulk request the first refuses the whole batch before
anything is written, while an item over the record limit fails alone (207).
A complete HTTP request over the aggregate body limit is rejected earlier with
413 PAYLOAD_TOO_LARGE, details.max_body_bytes, and remediation pointers.
A bulk of more than 1,000 items is 422 INVALID_BODY; an import array of more
than 10,000 rows or lines is 422 INVALID_BODY, and a POST /v1/import data
string of more than 10,000 non-blank lines 413 IMPORT_TOO_MANY_ITEMS. A 33rd
concurrent import answers 429 IMPORT_SATURATED and a 5th concurrent export
429 EXPORT_SATURATED (both Retry-After: 1); an export past 256 MiB is
413 EXPORT_TOO_LARGE and returns nothing. Recommended chunking:
normalize captured data into message/turn-level items (one experience per
message, stable source IDs as idempotency keys) and batch them through
POST /v1/experience/bulk rather than posting whole conversation snapshots —
smaller items index faster, dedupe better, and retrieve more precisely. For
files, upload bytes via POST /v1/blobs and reference them as blob_ref
content.
For larger source objects, submit bounded experiences with a shared canonical
source identity and exact fragment locators. Within the per-experience limit,
?wait=captured (§8.1) returns at the durable accept point while indexing
proceeds in the background (a write that references a blob waits for the
indexer first).
6.11 Consistency tokens
Capability: consistency_tokens_v1 (since 0.14.0).
A consistency token is a lower bound on what a node has written or seen at one scope root. A response that carries one says "at least this much"; a later request at the same root that demands it waits until the node serving it has reached that point, then runs. It gives a client read-your-writes across a cluster's replicas and a failover, and lets it read through an access change it just made: a read that demands a change set's token is authorized after the change has reached its node.
A token is ct1. and unpadded base64url. It is opaque: send it back as a response returned it, and never parse or build one, since its encoding may change behind a new prefix. It is not signed and never authorizes anything: a server waits only for a token at or below what it has committed, so a forged one cannot hold a request. It is good only at the root it names, the first segment of the request's scope. A request that sends none of the fields below is answered byte for byte as before.
| Routes | Ask for a token | Demand one | The fields come back |
|---|---|---|---|
POST /v1/recall, /v1/recall/stream, /v1/answer, /v1/compose | "consistency": {} in the body | "consistency": {"at_least": "<token>"} | after the body's own fields; on /v1/recall/stream in its done frame; /v1/answer and /v1/compose with stream: true wait and carry none (their events have no place for one: send the request unstreamed for the token) |
POST /v1/access/check, /v1/access/explain, /v1/access/lookup/scopes, /v1/access/lookup/principals (§8.20) | as above | as above; the lookups also wait for the root's permission view | after the body's own fields |
GET /v1/events, /v1/events/{id}, /v1/episodes, /v1/facts, /v1/facts/{id}, /v1/facts/timeline, /v1/beliefs, /v1/beliefs/why, /v1/beliefs/history, /v1/understanding and /v1/concepts with their /{id}, /{id}/history, /{id}/related and /coverage, /v1/derivation/status, /v1/scopes, /v1/scopes/list, /v1/experience/status | any ?at_least= | ?at_least=<token> | after the JSON object's own fields |
POST /v1/experience, /v1/experience/bulk, /v1/experiences, POST /v1/publish; the legacy registry routes POST /v1/scopes, DELETE /v1/scopes, PUT /v1/scopes/members, PUT /v1/scopes/tree | ?consistency=1 | — | after a successful receipt's own fields |
POST /v1/access/changes/{id}/activate, PUT /v1/apps/{id}, POST /v1/admin/access/tenant-binding (a dry run included) | always, on a 200 (a dated change set's 202 carries none) | — | after the body's own fields |
POST /v1/corrections (§8.7.24) | always, on a 201 and a replay's 200 | — | after the body's own fields |
GET /v1/access/records (§8.24.1) | always, on every page | ?at_least=<token>, at ?root= | after the page's own fields |
GET /v1/access/watch's registry items each carry a consistency_token too, naming the change's registry revision (§8.23). Every other route ignores ?at_least= and ?consistency=, as it ignores any query parameter it does not know: POST /v1/scopes/prune, the import routes, POST /v1/beliefs, the forget and erasure routes among them. coverage: true alone returns no token. The AuthZEN routes refuse context.consistency_token (400 INVALID_BODY, §8.21).
POST /v1/experience?consistency=1
{"scope": "org:acme/team:eng", ...}
202
{"event_id": "evt_01JB...", "status": "captured", "wal_offset": 134892, ...,
"consistency_token": "ct1.eyJyIjoib3JnOmFjbWUiLCJpIjoi..."}
POST /v1/recall
{"scope": "org:acme/team:eng", "query": "when is the launch?",
"consistency": {"at_least": "ct1.eyJyIjoib3JnOmFjbWUiLCJpIjoi..."}}
200
{..., "consistency_token": "ct1.eyJyIjoib3JnOmFjbWUiLCJpIjoi...", "derived_through": 134880}
The response's fields, after its own and in this order, each present only when asked for or when its event occurred:
| Field | Type | Notes |
|---|---|---|
consistency_token | string | The token at the root of the request's scope. A read's, an activation's, an application record's and a rebind's cover what the serving node had indexed when it answered; a write's and a legacy registry route's cover the log up to its next offset when the request answered, the write included. A correction's (since 0.15.0) covers the log up to its next offset and the correction's own record too, which a read that demands it waits for the serving node to have applied (step 5 below); a read that demanded one covers that record on. Absent on a server with no shard |
consistency_reset | boolean | true when the request demanded a token of another incarnation or epoch of the root (a restore rotates the incarnation, a scope move changes the epoch), or one this node had nothing to compare with: the demand was ignored and the request ran without waiting. Absent otherwise |
derived_through | integer | The log offset (exclusive) enrichment had reached on the serving node: the indexed watermark at the start of its enrichment scanner's last pass that found nothing left to dispatch, so every capture below it was enriched or is not enriched at all. Absent until such a pass has run since the process started, on a node that runs no enrichment, and whenever CORTEX_ENRICHMENT_SCOPE_QUIET_MS is set |
access_restored_at | RFC 3339 | Beside consistency_reset only: the demanded token was issued before the restore of the root that started this node's current incarnation, and that restore's mark lists the root; when the restore was marked, by apply's clock, until the next restore, after the mark clears too (§8.24). A copy restored with --access-state unchanged writes no mark, so a token from before it is a reset alone |
A demand, in order:
- While
consistency_tokens_v1is not listed,consistencyis422 INVALID_BODYand the query parameters are ignored. - The root: the body's
scope(prefixon/v1/access/lookup/scopes); on a GET,?scope=, else?path=, else?root=, else the token's own root; a GET whose named scope does not parse runs without the demand, and the route refuses its own scope. - The token: one that does not decode (or whose text after
ct1.passes 4,096 characters), names another root, or names a registry revision, a log offset or a correction's record the node never committed is422 CONSISTENCY_TOKEN_INVALID,details.reasonmalformed,other_rootorahead_of_commit, at once. A server before 0.15.0 refuses a correction's token asmalformed. - A token of another incarnation or epoch is ignored: the request runs at once, and the response says
consistency_reset: true(withaccess_restored_atafter a restore). - The wait: until the node's registry has reached the token's revision (on a cluster, the shard's feed through the node's erase tail; on a plain node, the root's own registry revision) and its indexer has indexed every capture below the token's offset; for a correction's token, until the node has also applied the correction's record to what it serves (its declared tail, which a capture's offset does not cover, so after a failover a new leader waits for it too); the two lookups wait as well for the root's permission view to be built at that revision (not for a view over its cap, nor on the trusted operator's own scopes lookup, which reads no view). The budget is
CORTEX_CONSISTENCY_WAIT_MS(default 10,000 ms, at most 30,000; a value that does not parse is the default), and on a POST read no more than what is left of the route's own deadline. Past it:408 WAIT_TIMEOUT, retriable,details.waiting_on(registry,indexer,declaredoraccess_view) anddetails.waited_ms. - Only then is the request authorized and run, so a caller whose wait runs out gets the 408 rather than its 403.
?consistency= takes 1 or true (a token) and 0, false or nothing (none), in any case (TRUE, False); any other value is 400 INVALID_QUERY, details.field: "consistency", before the write runs. The token is at the root of the request's own scope, the one the route authorizes for the write: ?path= on PUT /v1/scopes/members, PUT /v1/scopes/tree and DELETE /v1/scopes, the body's path on POST /v1/scopes, its scope on POST /v1/experience, its target on POST /v1/publish (the token covers the copy), and on a bulk the root of the first item it stored (never of an item it refused). A ?scope= or ?path= naming a root the body does not write is refused before the write runs: 403 POLICY_DENIED, details.reason: "token_root_not_written", details.scope, and nothing is written. A token this node cannot issue leaves the committed receipt as it is, with no token, as the always-token routes do (a 503 in its place would have a client resending an unkeyed write store it twice). On /v1/recall and /v1/recall/stream, consistency must be an object: null or any other value is 422 INVALID_BODY, details.field_path: "consistency". Elsewhere null reads as absent, and an unknown member of consistency is 422 INVALID_BODY on every route.
Errors: 400 INVALID_QUERY (a ?consistency= that is not a flag); 403 POLICY_DENIED (token_root_not_written); 408 WAIT_TIMEOUT (retriable); 422 CONSISTENCY_TOKEN_INVALID (malformed, other_root, ahead_of_commit); 422 INVALID_BODY (consistency malformed, or its capability not listed); 503 WAL_UNAVAILABLE (retriable: the shard's state could not be read to check a demanded token, or to issue a read's; a write, a legacy registry route and the always-token routes then answer without one).
7. Layer Reference
7.1 Events
The append-only WAL. Source of truth.
Record shape (MemoryEventV1; served schema /v1/schemas/event):
{
"id": "evt_0196a1b2c3d47e8f9a0b1c2d3e4f5a6b",
"scope": "org:acme/dept:eng/user:alice",
"caller": "agent:support_bot_v3",
"observed_actor": "user:alice",
"subject": {"id": "user:alice", "type": "user"},
"scope_key": "acme",
"modality": "conversation",
"content": { /* exactly as submitted in the envelope */ },
"context": {
"observed_at": "2026-05-13T15:42:00Z",
"recorded_at": "2026-05-13T15:42:09Z",
"preceded_by": ["evt_..."],
"intent": "deal_close",
"labels": [...]
},
"derives": ["fact_01HX..."],
"wal_offset": 134892
}
| Field | Type | Notes |
|---|---|---|
id | evt_ + UUID v7 | Time-ordered |
wal_offset | uint64 | Position in the WAL; monotonic per node |
derives | array | Records derived from this event (back-pointer for "why" trail). On GET /v1/events (0.10.4): the ids of the live (not superseded) facts that cite this event in supports, each a fact the caller may read at the listing's view; absent when the event supports none (so a listing without facts is unchanged). Recall packs and GET /v1/events/{id} do not fill it. |
caller / observed_actor | actor id | Who wrote the capture, and the actor the envelope observed (when it names none: the agent the token names in act, else the caller) |
subject | object | {id, type}: whom or what the memory is about; type is user, agent, entity or concept |
scope_key | string | The writer's billing tenant at capture |
atoms / provenance | array | Shared memory, rows of shard apply format 9 and later only: the scopes the row's material came from ({scope, record?, created_at?}, design §9.3) and the events its writer's chain read or declared (DB-28); absent when empty |
Events carry no _partial. excluded_from_recall (a cancelled event) never reaches a reader: cancelled events are not listed and read by id as 404.
Lifecycle: Created by a capture (POST /v1/experience, the bulk and import routes). Never updated in place. Removed by an erasure (/v1/erasures), a forget that names it (selector.memory_ids), a scope-wide redact_events forget (which blanks it), or a retention rule: an erase rule deletes it; under keep_learned its raw data expires, what was learned from it stays, and GET /v1/events/{id}?scope= answers 410 EVENT_EXPIRED. A cancel hides it. With a segment store (CORTEX_ICE_URL) an old event may be sealed into a segment; it is then read by id with ?scope= (§8.7.1.1).
7.2 Episodes
A causal chain of events.
{
"id": "ep_01HX...",
"scope": "org:acme/dept:eng/user:alice",
"name": "Acme deal Q3 close",
"summary": "Multi-day negotiation culminating in 200-seat signature on May 13.",
"events": ["evt_01HX...", "evt_01HX...", "..."],
"started_at": "2026-05-08T...",
"ended_at": "2026-05-13T15:42:00Z",
"valid_from": "2026-05-08T...",
"valid_to": null,
"recorded_from": "2026-05-13T15:42:09Z",
"recorded_to": null,
"actors_involved": ["user:alice", "user:priya@acme"],
"centrality_score": 0.78,
"causal_chain": [
{"event": "evt_...", "role": "trigger"},
{"event": "evt_...", "role": "decision"},
{"event": "evt_...", "role": "outcome"}
],
"sealed": false
}
causal_chain entries are {event, role, summary?}, role one of trigger, follow_up, decision, complication, outcome, current_state. Episodes carry atoms (the union of their events' atoms, DB-23) when there are any, _partial only when it is true (with _progress, how far a partial record is, 0..1), and summary_embedding only for a read that sends include_vectors=true (§8.7.3). A declared episode (since 0.15.0, declared_episodes_v1) also carries "declared": true and, when its declaration named one, its write-back stamp derived_by ({name, version}, §3.5.3); a built episode carries neither.
Lifecycle: Built by POST /v1/episodes/build (§8.7.13) or, with CORTEX_V1_LAYERS_AUTO, by the auto-layer scheduler: a scope's events in observed-time order, split into sessions at gaps over 2 hours. A rebuild replaces the unsealed episodes. An episode is sealed (sealed: true) when a keep_learned retention rule detaches one of its events or the segment store seals one; a sealed episode is never rebuilt, and its events are never clustered into another. A declared episode (§8.7.26) is a caller's replicated record instead: every replica serves it, a scope move carries it, no rebuild or seal touches it, and it goes with its record: a DELETE /v1/episodes/{id}, an erasure of any event it names, or a whole-scope erasure over its scope.
7.3 Facts
Triple-shaped, optionally temporal.
{
"id": "fact_01HX...",
"scope": "org:acme/dept:eng/user:alice",
"subject": {"type": "entity", "id": "ent_acme_corp"},
"predicate": "moved_to_seat_count",
"object": {"type": "literal", "datatype": "string", "value": "200"},
"supports": ["evt_01HX..."],
"valid_from": "2026-05-13T15:42:00Z",
"valid_to": null,
"recorded_from": "2026-05-13T15:42:09Z",
"recorded_to": null,
"confidence": 0.94,
"extractor": "gpt-4o-mini",
"stance": "supported"
}
| Field | Type | Notes |
|---|---|---|
subject | typed reference | An entity reference: the stored subject as an ent_ id (ent_ + its slug when it is not one). A fact with no triple is served as subject ent_fact_subject_<id>, predicate states, object its text |
predicate | string | Free text; for an extracted fact, the built-in ontology's canonical. No stored vocabulary binds it (§7.3.1) |
object | typed value | A string literal: the stored object, or the fact's text when it has no triple |
confidence | float | 0..1; extractor-provided |
extractor | string | On GET /v1/facts and GET /v1/facts/{id} (0.10.4): the model the extraction call that produced the fact reported, e.g. gpt-4.1-2025-04-14. Absent on facts extracted before 0.10.4 and on facts no extraction call produced (a content.kind: "triple" capture's direct fact, a consolidation merge). Recall and answer packs do not carry it. |
superseded_by | fact_id | The fact that superseded this one; absent while it is current, and absent to a reader who may not read the superseder (DB-23). supersedes is never set on served facts |
atoms | array | The atoms the fact inherited from what it was derived from (DB-23); absent when none |
_partial, _progress | bool, float | _partial is true while the record is partial, absent otherwise; _progress (0..1) is how far it is |
summary_embedding | array | The fact's embedding, only for a read that sends include_vectors=true (§8.7.3) |
Lifecycle: Created at Update (extract stage). Superseded by a newer fact via the conflict resolver: the old fact gets superseded_by and its validity closes (valid_to); recorded_to stays null on served facts. It remains readable with as_of, include_superseded=true, GET /v1/facts/{id} and GET /v1/facts/timeline.
7.3.0 Original surfaces and the English gloss (fact_surface_v1, M6 D1; not in v0.9.13)
Capability fact_surface_v1: a KNOWN name that is not advertised yet on GET /v1/admin/version (M6 fix round 4). The response fields below ship on M6 builds (they are
additive and optional); the name is listed once D1's acceptance holds under the build plan's own
rules: the owner rules on the belief-key threshold, the kiraya fact-key check has run on the
Hinglish-memory cases, where D1's gloss rows exist (M6 fix round 4 ran it on the 4 cross-language
cases only, whose memories are English), and the
approved full-500 LongMemEval run is done or waived (plan §12). It is response-only: no request
field is gated on it. M6 changes the default extraction for every enrichment-on deployment,
English included (see "What changes for English" below).
Extraction reads the ORIGINAL text of the capture plus its C1 hints (language, scripts,
context.timezone, context.refers_to). Nothing is translated before extraction. The extractor
is instructed to keep a fact's surfaces (subject, object, sentence text) in the source language
and script; the guaranteed original span is the byte-exact quote, which CortexDB validates. The
text and object are not validated: an extraction can still write them in English (measured: one
Hinglish sentence fact of the 50-item experiment). English enters only as a derived gloss:
{
"id": "fact_01HX...",
"subject": {"type": "entity", "id": "ent_kabir"},
"predicate": "likes",
"object": {"type": "literal", "datatype": "string", "value": "garam chai"},
"language": "hi-Latn",
"polarity": "affirmative",
"quote": "Kabir ko garam chai pasand hai",
"gloss": {
"object_en": "hot tea",
"derived": true,
"model": "gpt-4.1-mini",
"prompt_version": "d1-surface-6"
}
}
| Field | Notes |
|---|---|
language | The capture's C1 tag. Absent for implicit English. |
polarity | affirmative or negated, from the extractor's field (D0a), checked against the gloss (below). |
quote | A byte-exact span of the source text that can state a claim: at least three letters, starting and ending on a word boundary. A quote the extractor gives that is not a span of the text (a paraphrase, a case or spacing change, text from the prompt's hint sections) or is a fragment (a cut word, a lone particle) is dropped, never stored. English facts get one too. |
date_basis | How the fact's stated date was obtained: verbatim (written in the text), refers_to (matches a caller context.refers_to entry), extractor (the extractor produced it: resolved a relative phrase or reformatted one; CortexDB did not verify it) or ambiguous. On triples it covers valid_from / valid_until; on sentence facts it covers the absolute dates the fact text states (YYYY-MM-DD, 25 September, 2026, September 25, 2026). Absent when the fact states no date. |
date_candidates | With date_basis: ambiguous: every reading of an ambiguous day (an untensed kal, one word for the day before and the day after). No date is stamped on the fact; neither reading is picked. A caller refers_to entry with ambiguous: true and candidates wins over the extractor's own readings, and it applies whenever its expr_original phrase occurs as a word of the claim's quote, even when the extractor wrote no date or a date of its own. |
gloss | Non-English facts only: text_en (a sentence fact) and/or object_en (a triple object), always derived: true, with the model and extraction prompt version. |
- Predicates are English snake_case whatever the source language (a non-ASCII predicate is still rejected, D0a).
- The gloss is a search key, never a source. It is indexed as one key-only row per fact
(fulltext and vector, doc_type
gloss_en) whose content is the fact's ORIGINAL body, so an English query that only the gloss matches ("hot tea") returns the Hinglish fact as written. The layer rankers matchlayers.factson it the same way. It is never rendered intocontext_block, never appears inprovenance.citationsorlayers.events, and is never the sole support of anything. - Dates. CortexDB has no date lexicon of its own. The extractor is told to take a date from the
caller's
refers_towhenever one covers the phrase; every other date is flagged bydate_basis. - Source negation check (M6 fix round 4b: no quote keyword changes a polarity). A negation word in a
claim's quote is a reason to ask the verifier re-check below, never a verdict on its own, in any
language. For a non-English capture, a Hindi negation word (
nahi,nahin,kabhi nahi,bilkul nahi,nai/nabefore a verb,matbefore a verb,नहीं,मत,न) counts only inside the clause of the quote that holds the claim: a clause ends at, ; : ? ! .or a danda and before aur / lekin / par / magar / ki / jo / kyunki / to (and their Devanagari forms), so "paani mat dijiye, dhoop wali jagah rakhiye" does not denyprefers | dhoop wali jagah. With a cue in its clause, a claim the extractor called affirmative is re-checked, unless the claim already states a negation or a negative-sense relation of its own (should_not_be_given,reports_problem | ... kaam nahi kar raha), which is left as extracted; a claim already negated agrees and is kept, unless it also states a negation or a negative-sense relation of its own (has_problem_with | phone ka Bluetoothmarked negated for "Bluetooth kaam nahi kar raha" may be a double negative): that claim goes to the gloss check below, so a gloss that disagrees sends it to the verifier (pre-merge fix MB-4). "ya nahi" (or not), "nahi to" (otherwise) and a negation after "ab" (possibly "no longer") are left to the extractor and the gloss check. The one change made without a call is a change of relation, not of polarity: an AFFIRMATIVEdislikeswhose own clause carries the denial ("X ko Y pasand nahi" extracted asdislikes | Y) is stored aslikes | Y, negated (polarity_check: quote_cue). A NEGATEDdislikes/avoids(the double negative "does not dislike"), in either language, is re-checked: when the verifier answers that the text asserts the dislike, the claim is stored as the relation the text denies, negated (English "doesn't like coffee" aslikes | coffee, "doesn't eat non-veg" aseats | non-veg, when the denied verb takes the object directly; a Hindidislikesaslikes), otherwise the antonym is stored affirmative; the text's own double negative ("doesn't dislike karela", "doesn't mind the rain") is never asked about. For any language, a triple whose object opens with "not" / "never" ("likes | not eating meat") is stored negated even if the extractor said affirmative (the D0a detector over the stored object). English quotes: a triple on a relation the built-in ontology knows (or whose compound head is one,plans_to_attend) that the extractor calls affirmative while the clause of its quote that holds the object may deny it is re-checked ("Vikram doesn't have a car" extracted asowns | caraffirmative). That needs a negation (not,n't,never,cannot,no longer) before the object's first word with no cognition, reporting, limit or comparison word between them, and the clause ends at, ; : ? ! .and before and / or / but / although / though / whereas / while / however / that / which / who / whom / whose / because / if / when. So none of these is even checked: "I didn't know Sam owns a Tesla", "Priya works at Google and doesn't plan to leave", "Priya has a dog that never barks", "I never thought I'd like sushi", "Can't believe Priya works at Google", "Didn't I tell you? Rohan owns a Tesla", "cannot exceed 10MB", "not later than Friday", and the idioms "can't live without", "never misses", "wouldn't miss", "can't wait", "can't help", "can't stop", "don't mind". Not checked either: a cessation, an affirmativedislikes/avoids(it already states the denial) and an unknown predicate, which may itself be the denial's positive rephrasing (will_miss | offsite).CORTEX_POLARITY_QUOTE_TRIGGER_EN=0turns the English quote check off. English sentence facts are read by the D0a detector over their own words, as before. (Round 3 stored English triples negated on the keyword and round 4 Hinglish ones; review found false denials in both.) A negation is stored once (deploy fix after the 0.10.0 drill): a triple markednegated, with no cessation, whose object states its own denial in words the detector does not read ("wants | no delivery on Sunday", an object opening with "no", "without", "none" or "nothing") gets one verifier re-check, whose verdict is stored (the text's own double negative, "I didn't say no to the offer", stays negated); an opener followed by a number or a capitalised word is part of an address or a name ("No. 45, 2nd Cross", "No Cost EMI", "Nothing Phone") and is not asked about, and without the verifier the extractor's polarity stands. An affirmative claim of that shape is never asked about by the English quote check. The double-negative re-check also covers a denial written as a cessation ("does not want SMS updates any more", stored once verified aswants | SMS updates, negated and ceased), a denial head the ontology does not map (rejects,refuses,declines,lacks), and a tolerance verb ("can't stand coffee" is a dislike, never folded intostands); a negated English claim whose object states an exclusion ("all purchases except gift card purchases") is re-checked too; a predicate that carries its own negation keeps it even when the extractor calls the fact affirmative (not_arrived | truekeys asarrived, so it is storednegated; "can't wait", "never misses" and "don't mind" are idioms and keep the extractor's verdict); and a predicate the ontology knows as a whole (cannot_stand, which isdislikes) denies nothing. - An ambiguous day is not an unresolved reference (M6 fix round 3). A triple whose object is
only the caller's ambiguous time phrase (
flight_time | kalfor arefers_toentry withambiguous: true) keepsdate_basis: ambiguousand both readings, and the extractor'sunresolvedflag on it is cleared: that flag keeps a triple out of beliefs and is meant for a referring expression whose value is unknown ("the book she recommended"). - Negation cross-check. When a glossed fact's polarity field disagrees with the negation cues of
its English gloss (
polarity_gloss_mismatch), and the source check above did not settle it, or the source check asks (polarity_quote_mismatch_en,polarity_source_cue_mismatch,polarity_antonym_denial), one verifier re-check (the enrichment model, a narrow "does the text affirm or deny this claim" prompt,max_tokens32) settles it; its verdict is stored (polarity_check: rechecked). The verifier reads the claim's sentence of the source, plus up to 160 bytes on each side when the source is longer than 600 bytes, never the whole capture. When no verdict comes back (the call fails, the per-job call budget is spent, no verifier, orCORTEX_POLARITY_RECHECK=0), a keyword-raised question keeps the extractor's polarity at full confidence (polarity_check: unchecked), while a gloss mismatch, two model outputs that disagree, keeps the extractor's polarity at confidence0.6(polarity_check: unresolved), so it cannot retire a confident fact. - Belief keys compare a fact's object by precedence: a typed value (a bare number or ISO
date), then equal resolver-supplied entity ids, then the versioned fold of the ORIGINAL object
(with the D0b exonym table), then the normalized English form (
object_en, or the original of an English fact). A Hinglish value and its English restatement ("transit mein" withobject_en"in transit", beside "in transit") are therefore one value: two Supports, no supersession, no contradiction. The English rung applies only when one side is an English fact (its object IS its English form): two different non-English originals are never one value on their glosses alone. Different resolver entity ids do not separate two objects on their own until the resolver has aliases and per-scope resolution (N1): today it can mint two ids for one surface in one scope. On any relation, a denial (or a cessation) of one value never supersedes a statement of another value, in either order, and two denials of different values never retire each other: only a cessation of the same claim ends it ("Meera doesn't eat non-veg" leaves "Meera eats fish" current;works_at | not Globexleavesworks_at | Acmecurrent). Two affirmative values of a single-valued relation (works_at | Acme, thenworks_at | Globex) are still an update. On a relation the built-in ontology knows as multi-valued (likes,owns,visited,plans_to,diet, ...), a different affirmative value never supersedes another either, and the topic makes one belief per value (M6 fix round 4b:has_pet | dogbesideowns | bikeare two beliefs, each with its own Supports; the first-stated value keeps the topic's belief id). A cross-languageduplicatesverdict from the consolidator between a glossed fact and a different value is dropped. A denial and another statement are one claim only when their words are equal or the larger adds nothing but a verb of the claim or a time qualifier ("never eats meat" against "eats meat"), so an exception ("likes coffee but not iced coffee", "works at Google, not Google Cloud") is two claims and no conflict. Predicate spellings the extractor alternates for one statement of ONE relation key as one predicate (flight_at=flight_time;follows_diet=diet;will_visit/will_go_to/going_to=plans_to); a flight's date or destination is not its time (flight_date,has_flightare their own predicates since M6 fix round 4), andarrives_atis not mapped (its object may be a time or a place). A belief's claim is picked in capture order, not in the order the enrichment results happened to be applied. Polarity compares the same way: a glossed fact's claim is its English gloss with the negation stripped, so the Hinglish denial "nahi kal" (gloss "not tomorrow") contradicts the English "tomorrow" instead of standing beside it as another value, and a denial whose object is only a polarity word ("no", the gloss of "nahi") is a bare denial of the predicate's claim. - Erasure. Erasing a source event removes the gloss row (content, reverse mapping, BM25
document, vector), the fact's gloss and quote fields (also on a fact that survives on another
support, whose earlier WAL rows carrying that gloss and quote are redacted too, so a restart
cannot bring them back), and any concept built on such a fact (its TITLE and SUMMARY are English). Deleting a
fact now also removes the fact's own BM25 document, content row and vector row, and the
question-key rows the auto-layer backfill wrote for it, which forget used to leave behind. M6
fix round 4b: the capture's extraction summary row is erased with it, and with
CORTEX_ENTITY_GRAPH=1so are the graph edges derived only from it and the entities (graph, resolver, entity vector) that only it named. Deleted rows' bytes can stay in RocksDB SST files until compaction.
What changes for English. The prompt is shared: every extraction now asks for a quote, and
facts carry polarity and, when dated, date_basis. An English capture never gets a gloss (one
the model returns anyway is dropped); it triggers the re-check only through the English quote
check and the double-negative check above (one short call per such triple; measured on 230
negation-bearing held-out English captures: 1 quote trigger and 2 double-negative re-checks, no
flip). A hint-free English capture sends the same user prompt as before; the system prompt grows
by the D1 section, and the output by about one quote per claim. Price the extra tokens with
CORTEX_MODEL_PRICES like any other enrichment spend. Also changed for English, as of M6 fix
round 4b:
- The extraction prompt's PREDICATE VOCABULARY is M5's list without
intends_to(nowplans_to).flight_timeanddietare key-only: they map synonyms but are never listed. - Stored predicates and fact kinds: an ontology synonym is stored as its canonical, so
intends_to/intends/aims_to/intent_toand the future forms (will_visit,will_go_to,is_going_to,going_to,will_travel(_to),will_attend,will_come(_to),is_coming_to,coming_to,will_join,plans_to_visit,plans_to_go(_to),plans_to_travel) becomeplans_towith fact kindPlan;flight_at/flight_is_atbecomeflight_time;follows_diet/diet_type/dietary_preference/has_dietbecomediet(multi-valued: vegetarian and gluten-free are two beliefs). A verified double negative is stored as the denied relation ("doesn't like coffee" aslikes | coffee, negated). - Beliefs: one per value of a multi-valued topic; belief keys follow
BELIEF_KEY_RULES_VERSION4, and the start-up sweep re-keys beliefs whose topic moved. - Conflicts: a later capture that states a new value of a single-valued relation from before the
observation of the old one ("I moved last week; I live in Denver now") corrects the old value
instead of opening a
temporal_overlapconflict.
7.3.1 Predicate vocabularies
Predicates are free text. An extracted fact's predicate is keyed as the built-in ontology's canonical
(intends_to is plans_to, §7.3.0), and the extraction prompt lists the built-in predicate vocabulary; nothing
else steers it. A tenant may store a controlled vocabulary of its own:
POST /v1/vocabularies
{
"name": "sales_v1",
"predicates": [
{"id": "deal_stage", "datatype": "string", "values": ["intro","poc","close","signed","lost"]},
{"id": "seat_count", "datatype": "integer"},
{"id": "contact_at", "datatype": "entity"}
]
}
Nothing in the extraction path reads a stored vocabulary. Earlier releases of this reference said that an
active vocabulary steers extraction, mapping free-text predicates to its terms; no release did, and since 0.15.0
the reference no longer says so. /v1/vocabularies (§8.14) is a stored list for clients: CortexDB
stores, lists and returns the records and reads them for nothing else, and a cluster data node refuses them
(503 TENANT_MAPS_UNSUPPORTED).
7.4 Beliefs
Probabilistic claims with explicit stance, calibration, and revision policy.
{
"id": "belief_01HX...",
"scope": "org:acme/dept:eng/user:alice",
"claim": {
"subject": {"type": "entity", "id": "ent_acme_corp"},
"predicate": "is_likely_to_renew",
"object": {"type": "literal", "datatype": "boolean", "value": true}
},
"stance": "supported",
"confidence": 0.62,
"confidence_interval": {"lower": 0.48, "upper": 0.74, "method": "beta_posterior", "level": 0.90},
"calibration": {
"model": "platt_v2",
"brier_score_30d": 0.18,
"samples": 47,
"last_calibrated_at": "2026-05-13T00:00:00Z"
},
"supports": [
{"type": "fact", "id": "fact_01HX...", "weight": 0.34, "polarity": "supports"},
{"type": "fact", "id": "fact_01HX...", "weight": 0.28, "polarity": "supports"},
{"type": "episode", "id": "ep_01HX...", "weight": 0.22, "polarity": "supports"}
],
"contradicts": [
{"belief_id": "belief_01HW...", "tension": 0.41, "resolution": "newer_wins"}
],
"revision_policy": {
"trigger": "new_supporting_evidence_or_contradiction",
"min_evidence_delta": 0.05,
"cooldown": "PT5M",
"max_revisions_per_hour": 12
},
"valid_from": "2026-05-13T15:42:09Z",
"valid_to": null,
"recorded_from": "2026-05-13T15:42:09Z",
"recorded_to": null,
"last_revised_at": "2026-05-13T15:42:09Z",
"revision_count": 3,
"supporting_evidence_redacted": false,
"supporting_evidence_redacted_fraction": 0.0,
"why_url": "/v1/beliefs/why?belief_id=belief_01HX..."
}
| Field | Type | Notes |
|---|---|---|
claim | object | Triple form: {subject, predicate, object} |
stance | enum | One of supported, contradicted, uncertain, deprecated. See §7.4.1 |
confidence | float | Point estimate, 0..1 |
confidence_interval | object | {lower, upper, method, level} — calibrated CI. Methods: beta_posterior, bootstrap, wilson |
calibration | object | Model + recent Brier / ECE score; updated by the calibration job |
supports | array | Weighted contributing records, each with explicit polarity (supports | against) and, when there are any, the atoms of what it cites (DB-23) |
contradicts | array | Other beliefs in tension, with tension score and proposed resolution |
revision_policy | object | Per-belief revision rules (overrides tenant defaults) |
last_revised_at | RFC3339 | |
revision_count | int | Total revisions since creation |
supporting_evidence_redacted | bool | True if any support was GDPR-redacted (see §11.3) |
supporting_evidence_redacted_fraction | float | 0..1; fraction of supports[] redacted |
why_url | string | Permalink to the explainability endpoint for this belief |
_partial | bool | True when belief is in revision or evidence-redacted-decayed state |
_partial_reason | enum | revision_in_progress, supporting_evidence_redacted, calibration_stale |
_progress | float | 0..1: how far a partial belief is |
summary_embedding | array | The belief's summary embedding, only for a read that sends include_vectors=true (§8.7.3) |
redirected_to | scope | Only on the 201 of POST /v1/beliefs: the private space a redirected declaration landed in (DB-28) |
7.4.1 Stance enum
| Stance | Meaning |
|---|---|
supported | Evidence supports the claim; confidence reflects this. |
contradicted | Evidence has overturned the claim; confidence reflects how strongly. The belief is kept (not deleted) for explainability. |
uncertain | Evidence is mixed or insufficient; confidence near 0.5. |
deprecated | The claim's predicate vocabulary or subject identity has changed; the record is retained for as_of queries but is not surfaced by default reads. |
7.4.2 How facts group into beliefs (M6 D0b; not in v0.9.13)
These rules apply to fact-derived beliefs, with enrichment on. None of it needs a capability. One
optional field was added in M6 fix round 4, claim_key (below); beliefs carry no language or
polarity field of their own.
-
One key. A belief's topic is
(subject, predicate)under one key function, used byPOST /v1/beliefs/build, the incremental builder, the fact store's topic index and the write-time conflict resolver alike. The subject and predicate go through a versioned fold (NFC, lowercase, whitespace collapsed; version 1, which on ASCII input is the old ASCII lowercase key). The predicate is the built-in ontology's canonical form, with a denial folded to the claim it denies:employed atgroups withworks_at,did_not_go_towithwent_to(visited), andintends_towithplans_to(they are now one canonical predicate). -
Deterministic ids. Every fact-derived belief id is derived from
(scope, topic). A full rebuild processes facts in fact-id order and returns the same beliefs, with the same ids, whatever order the store hands the facts back in, and the ids equal the incremental builder's. Before this,POST /v1/beliefs/buildminted new random ids on every call. On the first start of this build, a one-time sweep deletes fact-derived beliefs whose topic moved (their id is no longer the id of any current topic of their scope); the reconcile then rebuilds them under the new key. Beliefs declared throughPOST /v1/beliefs(no fact supports) are never swept. -
The same value twice is two Supports. Two facts on one topic whose objects are the same value (compared after the fold, trailing punctuation dropped, and a small place-exonym table: Dilli/Delhi, Bombay/Mumbai, Bangalore/Bengaluru, Calcutta/Kolkata, Madras/Chennai) are a restatement: the resolver supersedes neither, and both count
supports. A Hinglish and an English statement of one fact therefore give one belief with two Supports and no conflict. A different value, or the same value with a different stated end, is still an update and still supersedes. Astaleverdict from the consolidation LLM between two statements of the same value is dropped. -
Exonyms are one value. A single-valued predicate (
lives_in,works_at, ...) with "Dilli" and "Delhi" as its live values issupported, notcontradicted. -
Synonyms of a multi-valued relation coexist. Two facts that share a topic only because their predicates are synonyms of a known multi-valued relation ("likes tea", "enjoys hiking") are two values; neither supersedes the other. A synonym of a functional relation supersedes, as an update.
-
Disposition rollup. The per-person
disposition_profilebelief now needs two DISTINCT dispositions (predicate family plus value). Two facts stating one plan make no rollup. -
The claim is the latest supporting fact's own words; the key form is
claim_key(M6 fix round 4). A structured belief'sclaimis its latest supporting fact's own predicate and object, exactly as before M6 fix round 2 (rounds 2-3 rewrote it into the key form; review found English claims losing words incontext_block). The key form the belief groups and compares on is returned beside it asclaim_key:"claim_key": {"subject": "isha", "predicate": "plans_to", "value": "party", "polarity": "affirmative", "rules_version": 3}subject/predicate: the topic's key-folded subject and its predicate (the built-in ontology canonical with the belief-key aliases,prefers->likes,has_pet->owns,went_to->visited, or the relation a compound splits to);value: the claim's value in key form (below):yesfor an affirmative object that only restates the predicate (paid_rent | paid, or a Hinglish object whose gloss is "knows how to drive" underknows_how_to_drive), the split value of a compound (will_go_to_party | yeshas valueparty), the recorded day, the relation's own leading words and a leading article or possessive dropped ("go to the dentist" underplans_tohas valuedentist);polarity: of the fact the claim is taken from;rules_version: the key-rules version.
Absent on text-topic beliefs, rollups, hand-written beliefs and beliefs built before it. The D1 belief-key stability metric (
benchmarks/multilingual/d1_hinglish50.py --compare) reads it. -
Cross-language restatements stay two facts (M6 fix round 2). A consolidator
duplicatesverdict between a glossed (non-English) fact and an unglossed one that agree is not applied. Both facts stay live, and the belief lists both as Supports. Applying it would retire one capture's own fact, with its language tag and byte-exact quote. Such a verdict is logged withcode=consolidation_cross_language_kept. Same-language duplicates still merge. -
Glosses compare on content words (M6 fix round 2), cross-language only (fix round 4). When at least one side is a non-English fact compared through its gloss, the English rung of the object ladder treats two English forms as one value when they have the same content words. Articles, copulas, prepositions and
perare ignored, so a Hinglish "ek laal car" (gloss "a red car") matches the English "red car". Two English originals compare on their folded form only, so "to Delhi" / "from Delhi" and "his sister" / "her sister" stay two values. A content word on only one side always makes two values: "not tea" is not "tea", and "red car" is not "car". -
The compound split is in the topic key (M6 fix round 3). A compound predicate the ontology does not know as a whole, whose leading words name a relation it does know, stated with an object that carries no value of its own (
yes,no,true, a barenot, or words that only repeat the predicate), keys in that relation's topic:will_go_to_party | yesand a denialwill_come_to_meeting | nogroup withplans_to | partyandplans_to | meeting, and the rest of the predicate is the value the belief compares. The head is two or more words, or one word that is itself a canonical relation name (likes_tea | yes); a one-word synonym never splits (knows_how_to_driveis notfriend_of). Only the original object is read, never the gloss, so erasing a gloss never moves a topic. Caller-typed triples key the same way. On a split, the value is in the predicate and the object is only the claim's polarity: a bare negative object (no,false,none,not,never) is a denial of the split claim whatever verdict was stored (likes_spicy_food | nonever reads as an affirmativelikes | spicy food), and a split denial or cessation ends only its own value (works_at_infosys | no longerdoes not supersedeworks_at | Google;lives_in_delhi | not anymoredoes not retirelives_in | Mumbai, but does endlives_in | Delhi). A split assent then a canonical different value (lives_in_delhi | yes, thenlives_in | Mumbai) is an ordinary update (fix round 4). -
Values compare in their key form (M6 fix round 3). A belief compares its facts' values (which facts are its Supports, and whether a single-valued topic has two values) on the key form
claim_key.valuestates: leading words that name the fact's own relation dropped, and a leading article or possessive dropped ("her new job" is "new job"), and a trailing date dropped only when it names the same day the fact records for its claim (a D1 fact withdate_basis: its triple'svalid_from/valid_until, or a reading of the caller's ambiguous day; relative day words are read against the capture time). An object that was only that recorded day is an assent (on_leave | from 28 September, 2026withvalid_from2026-09-28 has valueyes). Fix round 4: a date-valued predicate keeps its date (birthday | 3 March,deadline | 30 September, 2026,due_date | 2026-10-05,flight_time | tomorrow), and so does a date that is not the recorded one, so two different deadlines are still two values and a single-valued topic stayscontradicted. The write-time resolver still compares objects as stored, so a rescheduled date is still an update. -
The orphan sweep re-runs when key rules change (M6 fix round 3). The one-time sweep of beliefs whose topic moved is keyed on the key-fold version and on a key-rules version (the ontology synonyms, the belief-key aliases and the compound split), so a build that changes how a predicate keys sweeps once more on first start.
Lifecycle: Built from facts by the incremental builder as facts change and by POST /v1/beliefs/build (§7.4.2), or declared by a caller (POST /v1/beliefs, §8.7.15). A rebuild that changes a belief's claim, stance, confidence or supports keeps the old version for GET /v1/beliefs/history (§8.7.16), its recorded_to closed, and bumps revision_count and last_revised_at. A newer declaration over the same subject and predicate closes the older one (valid_to, stance deprecated). Nothing deletes a belief for low confidence, and no route answers 410 for one: a belief that is gone, or that the caller may not read, is 404 NOT_FOUND by id and absent from listings. _partial appears only when true. Each support carries the atoms of what it cites (DB-23) when there are any, and a belief rebuilt for one reader carries rebuilt: true (§8.7.5).
7.4.3 How a fact or belief was made (include=derivation; derivation_provenance_v1, new in 0.15.0)
Every fact the enrichment plane writes from 0.15.0 on is stamped with how it was made: the prompt version of the extraction call, the models that answered it, and the gate version that judged it. The stamp is stored with the fact always and served only when a read asks for it, with include=derivation on GET /v1/facts, GET /v1/facts/{id}, GET /v1/facts/timeline, GET /v1/beliefs and GET /v1/beliefs/why. Each row then carries one derivation object after its own fields (a timeline entry carries its fact's; /v1/beliefs/why adds it to belief). Without the parameter no response changes by a byte, and no recall pack, answer context or other read ever carries it. include takes a comma-separated list whose only value is derivation; any other value is 400 INVALID_QUERY.
"derivation": {"verdict": "accepted", "rule": null, "policy_hash": "dp1:none",
"model": "claude-haiku-5-5", "entity_model": "gpt-4o-mini",
"prompt_version": "kx-default-batch:9c1e44a0", "gate_version": 1, "topic": null,
"derived_by": null, "pinned": false, "confirmed": false, "unsynced": false}
| Field | Type | Notes |
|---|---|---|
verdict | string or null | accepted for a fact the enrichment plane wrote (every candidate it stores passed the gate); declared for a caller's write-back (a typed triple or a declared belief written with derived_by); null for a row with no stamp: one written before 0.15.0, or a typed triple's direct fact written without derived_by |
rule | string or null | The gate rule that admitted the row (accept.default, accept.consent.<category>, review.approved.<decision id>, …), under a derivation policy only (§8.32); null for a row made under no policy |
policy_hash | string or null | The effective policy the row was made under (§8.32): dp1:none for a stamped row made under no policy; null for a row with no stamp |
model | string or null | The model the knowledge extraction call reported. For a row with no stamp, its extractor (§7.3) when it has one |
entity_model | string or null | The model the entity extraction call reported, or the knowledge model when the entities rode its call (CORTEX_UNIFIED_EXTRACTION) |
prompt_version | string or null | <template id>:<first 8 hex of blake3 over the exact system prompt sent>. The template id is kx-default, kx-dense or kx-doc, then -batch for a call that carried several events, then -unified or -compact as they apply. Any change to the prompt's bytes, the predicate vocabulary section included, changes it |
gate_version | integer or null | The gate version that judged the row; 1 is this release's. With no policy its only rule is the capture's own directives.extract; the policy hash covers the version too (§8.32) |
topic | string or null | The taxonomy topic the gate labelled the row with, under a policy that offers topics (§8.32.2); null otherwise |
derived_by | object or null | A write-back's {name, version} stamp, as it was written (derived_by_v1, §3.5.3): the fact of a typed triple written with derived_by, and a declared belief written with it, whose stamp is read from its record; null otherwise |
pinned, confirmed | bool | A correction in force pins or confirms the row's claim (corrections_v1, §8.7.24): pinned for a pin's claim and a replacement's new one, confirmed for a confirmation's. false below format 11 |
unsynced | bool | The row was made under a policy other than the one in effect at its scope now (its stamped hash against the scope's current effective hash, §8.32.1): a policy staged, changed or removed since, or a release that moved the taxonomy, detector or gate version. Always false where no policy ever applied. A write-back's fact (a typed triple written with derived_by, a correction's replacement, an importer's row) is stamped with no policy, so the policy never makes it unsynced: it is true when its stamp names another version than its name's latest committed write in the root, the rows ?derived_by= on GET /v1/derivation/status counts as unsynced (§8.7.12), which are their pipeline's to rewrite. A typed triple without derived_by is the caller's statement and is never unsynced |
A belief's object is computed when it is read, from its supporting facts this node holds (at most 64 of them): the latest one's, its pinned and confirmed included, with unsynced true when any of them is. A belief with no fact support (a declared belief, a rollup's) answers the object with every value null or false, unless its record carries a derived_by stamp: then verdict is declared, policy_hash dp1:none, derived_by the stamp, and unsynced is true when the stamp names another version than its name's latest committed write in the root. extractor (§7.3) is unchanged: it stays the knowledge model the 0.10.4 stamp recorded, and model repeats it.
On a cluster every replica stamps the same: the shard's leader puts the stamps in the learned record it replicates, and every replica's apply stamps each fact from the record. A leader puts the stamps in that record only on a shard armed above format 10, which every member must allow; below that it writes the record as before, without stamps, and no replica stamps the facts of that record. Where an event's derivation itself stands, recorded or not, is GET /v1/derivation/decisions (§8.7.22).
7.5 Understanding
Synthesized conceptual nodes. Beta tier in v1.
7.5.1 Identity, versioning, and staleness
| Property | Rule |
|---|---|
| Concept identity | A concept_id is stable across versions. The id is assigned at first synthesis and never changes; only version increments. |
| Concept versioning | Versions are immutable. A synthesis that changes the concept's name, stance, edges (target and relation) or supported_by keeps the prior version, with recorded_to set to when it was superseded, and bumps version; a re-worded summary updates the concept in place and keeps no version. Prior versions are read with GET /v1/understanding/{concept_id}/history (§8.7.17). previous_version is reserved for cross-id lineage and is absent on an ordinary bump; no route reads a concept as_of a time. |
| Coalescence | Reserved. canonical_id marks a concept merged into another, and clients follow it (no route does). The server sets it on no concept today. |
| Splitting | Reserved. derived_from names the concepts a split one came from. The server sets it on no concept today. |
| Relation vocabulary | Edges use a tenant-scoped, vocabulary-bound relation field. Default relations: is_a, part_of, specializes, generalizes, depends_on, causes, contradicts, co_occurs_with, related_to. A vocabulary's relations (§8.14) are stored for clients only: no synthesis reads them. |
| Synthesis inputs | Each concept records the layers it was synthesized from and the synthesizer (synthesis_inputs). A synthesis pass reads the scope's current events, facts and beliefs; it takes no as_of. |
| Staleness | Reserved. staleness_score (0..1) and staleness_reason describe input updates not yet reflected. The server writes staleness_score: 0 and no reason on every concept today, so GET /v1/understanding/coverage reports avg_staleness_score: 0 and no most_stale_concept. |
| Coverage score | Per concept: the fraction of in-scope inputs the synthesis consulted, as the synthesizer estimates it. GET /v1/understanding/coverage averages it over a scope's concepts. |
| Invalidation on forget | A forget or erasure whose cascade reaches the understanding layer deletes the concepts citing what it removes (§11). support_loss_fraction is written 0 and not updated, no concept's stance moves to deprecated on its own, and no route takes include_deprecated: listings return concepts of every stance. |
7.5.2 Shape
{
"id": "concept_01HX...",
"scope": "org:acme/dept:eng",
"name": "B2B SaaS Sales Cycle",
"version": 3,
"summary": "Multi-stage process typically involving prospecting, qualification, POC, negotiation, signature, onboarding.",
"synthesis_inputs": {
"layers": ["facts", "episodes", "beliefs"],
"filters": {"topic": "sales_process"},
"as_of": "2026-05-13T00:00:00Z",
"synthesizer": "claude-opus-4-6",
"synthesizer_version": "2026-05-08"
},
"supported_by": {
"events": ["evt_01HX...", "..."],
"facts": ["fact_01HX...", "..."],
"episodes": ["ep_01HX...", "..."],
"beliefs": ["belief_01HX...", "..."],
"external": [
{"source": "wikipedia", "id": "Sales_process", "url": "..."}
],
"atoms": [{"scope": "org:acme/dept:eng/user:alice", "record": "org:acme/dept:eng", "created_at": "2026-03-02T09:00:00Z"}]
},
"edges": [
{"to": "concept_01HX...", "relation": "specializes", "weight": 0.81, "vocabulary": "default"},
{"to": "concept_01HX...", "relation": "depends_on", "weight": 0.55, "vocabulary": "default"}
],
"valid_from": "2026-04-01T00:00:00Z",
"valid_to": null,
"recorded_from": "2026-05-13T15:42:09Z",
"recorded_to": null,
"last_synthesized_at": "2026-05-13T15:42:09Z",
"stance": "supported",
"confidence": 0.78,
"staleness_score": 0.0,
"support_loss_fraction": 0.0,
"coverage_score": 0.91,
"_partial": true,
"_partial_reason": "insufficient_supporting_facts",
"_progress": 0.3
}
| Field | Type | Notes |
|---|---|---|
id | concept_id | Stable across versions: concept_ followed by [A-Za-z0-9_-], at most 192 characters |
canonical_id | concept_id | Reserved (§7.5.1); absent when unset |
version | int | From 1; bumped on a semantic revision (§7.5.1) |
previous_version | concept_id | Reserved for cross-id lineage; absent on an ordinary bump |
derived_from | array | Reserved (§7.5.1); absent when empty |
summary_embedding | array | Absent unless the read sends include_vectors=true, and then present only on a stored concept that still carries its vector inline |
synthesis_inputs | object | Layers + filters + synthesizer used to produce this version |
supported_by | object | events, facts, episodes, beliefs, external and (since 0.14.0, DB-23) atoms: what the concept was made from, each absent when empty. A reader is served the concept only when its chain may read every atom's scope; a concept without atoms is checked by the atoms of its events (§8.7.7) |
edges | array | Relations to other concepts, vocabulary-bound; absent when empty |
stance | enum | supported, contradicted, uncertain, deprecated (same semantics as §7.4.1) |
staleness_score | float | 0..1; reserved, written 0 (§7.5.1) |
staleness_reason | string | Reserved; absent |
support_loss_fraction | float | 0..1; reserved, written 0 (§7.5.1) |
coverage_score | float | 0..1; fraction of in-scope inputs consulted during synthesis |
_partial | bool | Present (true) only on a partial concept: one the deterministic synthesizer made from fewer than 3 events; absent otherwise |
_partial_reason | enum | consolidation_in_progress, insufficient_supporting_facts, synthesis_disabled_by_policy, no_implementation_yet, stale_inputs_pending_resynthesis; the server writes insufficient_supporting_facts today |
_progress | float | 0..1, when meaningful (0.3 for insufficient_supporting_facts) |
valid_to and recorded_to are null while open; every other optional member is left out, never null.
Lifecycle: Created and updated by a synthesis pass: an explicit POST /v1/understanding/synthesize (§8.7.11), or the background concept reflection (§8.7.11, "Model + cost note"). Versioning is append-only: superseded versions are kept and read with the history route (§8.7.17). Staleness and support loss trigger nothing (both are written 0).
8. Endpoint Reference
8.1 POST /v1/experience — Write
Capability: scope.write on scope; scope.write.on_behalf_of when observed_actor is neither the caller nor the
agent its token names (act); scope.write.about_other when subject is neither the resolved observed_actor nor,
under act, the caller; and scope.write on directives.consolidate_into. A per-actor token also needs Writer on each
of those scopes' rosters and acts only inside its billing tenant; the trusted operator (the static CORTEX_API_KEY, or
an auth-disabled server) passes the rosters. The route never asks for scope.write.elevated.
Request: Experience envelope (see §3.5). The route reads the body as raw JSON, whatever its Content-Type: a body
that does not parse is 422 INVALID_BODY with details.field_path, details.reason and details.schema.
A first write auto-registers its scope, and a consolidate_into target, when the deployment's scope.auto_register and
allowed_scope_types allow it (§3.4.4). The write is one shard Capture proposal: an ack means it is committed and
applied, fsynced in the Raft log. A single write is never refused for memory pressure.
| Query parameter | Notes |
|---|---|
wait | When the route answers (below) |
consistency | consistency_tokens_v1 (§6.11): 1 or true adds consistency_token, which covers this write, and derived_through (once enrichment has finished a pass) after the receipt's own keys; 0, false or empty asks for none, in any case; anything else is 400 INVALID_QUERY. A token this node cannot issue leaves the receipt without one |
path, scope | Read only with consistency=1 (path first): a scope of the root the token names. It must be under the root of the body's scope, else 403 POLICY_DENIED, details.reason: "token_root_not_written", before the write runs and with nothing written; leave them out |
Response (async, default):
HTTP/1.1 202 Accepted
Content-Type: application/json
X-Cortex-Policy: deployment=on_prem_enterprise; auth=ok
X-Request-Id: req_01HX...
{
"event_id": "evt_01HX...",
"status": "captured",
"wal_offset": 134892,
"lifecycle_stream": "/v1/lifecycle/stream?event_id=evt_01HX...",
"replayed_from_idempotency": false
}
Response (sync via ?wait=indexed):
HTTP/1.1 200 OK
{
"event_id": "evt_01HX...",
"status": "indexed",
"wal_offset": 134892,
"stages_completed": ["captured", "extracted", "indexed"],
"replayed_from_idempotency": false
}
| Field | Type | Notes |
|---|---|---|
event_id | string | The stored event, or the one the key replayed |
status | string | captured on the 202 and for wait=captured; otherwise the stage waited for |
wal_offset | integer | The capture's offset in the shard log; a replay returns the original's |
lifecycle_stream | string | 202 only: /v1/lifecycle/stream?event_id=<event_id> |
stages_completed | array | 200 only: the stages this process has recorded for the event (captured, extracted, indexed, consolidated, compressed) |
replayed_from_idempotency | boolean | Always present: true when the key replayed an earlier write's receipt. There is no replay header |
warnings | array | capture_language_v1 notes, then (since 0.15.0) directive_not_enforced:<name> for each directive the write names that nothing reads (§3.5.3); absent when empty |
redirected_to | string | write_provenance_v1 (since 0.14.0): the home the row landed in when it was redirected (below); absent otherwise |
consistency_token, derived_through | string, integer | With consistency=1 only |
wait parameter values:
| Value | Returns when | Typical latency |
|---|---|---|
(omitted) or accepted | Durable accept (HTTP 202 once the capture is committed and applied); indexing continues asynchronously and an immediate recall can race it | ~10ms, flat in payload size |
captured | The same durable point, answered 200 {"status": "captured"}; indexing continues in the background (the fast path for large payloads; poll §8.18 or the lifecycle stream for progress) | ~10ms, flat in payload size |
indexed | The indexer has indexed every log offset up to this write (it indexes the log in order, whatever the scope) and the event reached indexed: BM25 and vectors in place, read-your-writes on /v1/recall | ~100–500ms |
consolidated | As indexed, then, with enrichment on (CORTEX_ENRICHMENT_DELAY_SECONDS), until deferred enrichment applied this event; a triple or an extract: [] event does not wait for it | provider-bound, typically ~0.5–6s |
settled | Never, in this release: the write is captured and indexed, then the route answers 503 SETTLEMENT_UNAVAILABLE (no storage coordinator reports artifact settlement; with artifact workers off, the default, retriable: false and details.artifact_workers_enabled: false). Use indexed | — |
indexed and consolidated share one wait budget of 30 s, for the indexer wait and the stage wait together; past it
the answer is 408 WAIT_TIMEOUT. A write whose content references a blob (a blob_ref, an inlined text blob, a
transcript) waits for the indexer, within the same budget, whatever wait says, so its blob stays leased until the
reference is published.
consolidatedblocks on an out-of-process LLM call. Unlikecapturedandindexed, whose cost is CPU and I/O inside the server, this stage waits on the deferred enrichment cursor (DISC-014) — so its latency is dominated by the configured enrichment provider's round-trip and is not a server-side budget you can tune. Acks of 5–6s are normal under ordinary provider variance (KAN-29 measured 1.2s / 5.1s / 5.9s on the same corpus, same build); the server's own ceiling is the 30s wait budget, after which the request answers 408 and the stage continues in the background. Do not set a fixed SLO on this value. If you need a bounded ack, usewait=indexed(read-your-writes on/v1/recall) and observe consolidation out-of-band via the lifecycle stream (§13) orGET /v1/experience/status(§8.18).
Any other value is rejected with 422 INVALID_BODY; the error message lists
the valid values. accepted is an alias for the omitted default.
The response body's status field is "captured" in all async-accept cases;
the distinction is the barrier the connection was held for.
Any ack (202, the wait 200, and each results[] item of /v1/experience/bulk) may carry
warnings[]: conflicting_hint_on_replay (capability capture_language_v1), and since 0.15.0, after it,
directive_not_enforced:<name> for each directive the write names that nothing reads (§3.5.3, "Directives
nothing reads"). The key is absent when there is nothing to report.
Idempotency. The idempotency_key is claimed for 24 hours per requested scope, caller and endpoint bucket;
POST /v1/experience, /v1/experience/bulk and /v1/experiences share one bucket (§6.3). A resend with the same write
identity (§3.5) replays the original receipt, with its event_id and wal_offset and replayed_from_idempotency: true;
under a wait it waits as the original did, at the original offset. A resend with another body is
409 IDEMPOTENCY_CONFLICT. Under a wait, the key of a write whose indexing failed replays the 502 and the key of a
cancelled write the 409 CANCELLED.
The principal chain (since 0.14.0). A token that names an agent (act) and no run writes nothing:
403 RUN_REQUIRED, details.scope. An envelope that leaves out observed_actor is stamped with the token's act
(§3.5.1).
Provenance and redirects (write_provenance_v1, since 0.14.0). provenance names up to 1,024 events of the
request's root the write was made from; every write carries them as its row's provenance, so an erasure of any of them
erases the write on every replica. A non-human write (its token's sub is not a user:, or it carries act or run,
or its client resolves to agent) also carries what its chain read on this node: the event ids its read record holds,
as provenance, and the homes and atoms of the rows it was delivered, as atoms. It is redirected to its writer's private
space (<tenant>/app:<id>/user:<p> for an application chain, an AI employee's own scope, else <tenant>/user:<p>) when
its read record is unknown, its token or run carries taint, its record overflowed and it declared nothing, it would
carry more than 16 atoms, or an atom lies in a private region; the receipt's redirected_to names that home, and a
retry with the same key replays it there. An atom that names the record governing the scope the write asks for, as it
governs it at write time (that scope itself, the record's path and created_at), is no atom of the write: a write back
into the very scope its run read neither is redirected for it nor carries it, since the row's own home bounds who
reads it. That scope read under a record that no longer governs it (deleted and registered again), an ancestor or a
descendant of it, and every other private scope (an application's private space, when the write asks for the person's
own region) stay atoms. A row a redirect moves carries no atom of the private space it lands in, and keeps the one of
the scope it asked for. A person's write, and the operator key's, carry only their declared
provenance and are never redirected; a token that carries none of act, app, client and run keeps the 0.13.x
rules until CORTEX_LEGACY_WRITE_CUTOFF passes. Refusals: 403 ATOMS_REDIRECT_REFUSED (details.reason:
confinement, the token may not write the private space; no_person, the chain names no person; too_many_atoms,
more than 64; no_private_space), 422 CROSS_ROOT_PROVENANCE (the read record or provenance names another root,
details: {scope, root}; a cited event is known to be of another root only where this node holds its live row, as a
plain node does for every root, so on a cluster an event of a root another shard holds is apply's PROVENANCE_UNKNOWN
instead), and, from apply, 409 PROVENANCE_ERASED (a cited event was erased or redacted: drop the
citation) and 422 PROVENANCE_UNKNOWN (a cited event is not one of the root's), both with details: {event_id, cited}
and nothing stored. A row carrying atoms or provenance needs a shard armed for apply format 9: below it, a write that
declares provenance, or carries atoms outside its writer's own private space, is 503 FORMAT_UPGRADE_PENDING; one
into the writer's own private space lands without them.
Known limit on a cluster (0.14.0). A run that read its application's reference root (app:<key>, §8.8) is
anchored on its tenant's shard alone, so its writes are not redirected merely for having read it; but where another
shard holds that reference root, the write's node does not know the root as a reference root, takes the run's read
record as unknown and redirects the write to its writer's private space (403 ATOMS_REDIRECT_REFUSED when the token's
confinement holds no private space). A plain node, which holds both roots, writes it where it was sent.
Blobs. A content.kind: "blob_ref" names a blob uploaded through POST /v1/blobs (§8.13); it must be live and the
caller's billing tenant's and actor's, else 404 BLOB_NOT_FOUND. A text-shaped blob is inlined as text, decoded
charset-safe (blob_text_decode_v1): a UTF-16 byte-order mark selects UTF-16, valid UTF-8 is used as is (a UTF-8
byte-order mark is kept), a declared UTF-16 charset= is applied first when the bytes do not read as UTF-8 text, and
otherwise the stored Content-Type's charset= decides; bytes none of those decode are
422 BLOB_TEXT_ENCODING_UNKNOWN, never U+FFFD text. A non-blank transcript is indexed as text instead (the label
source_blob:<blob_id> is added). A binary blob keeps its reference for the content processor; a cluster data node
refuses it (400 BLOB_UNSUPPORTED_CLUSTERED). The stored event lists the blob in source_blob_ids, so an erasure can
delete the blob with its last reference.
Operator plane (since 0.14.0). Under CORTEX_OPERATOR_DATA_READS=deny the operator key's write into a private
region or a shared org-tree scope, or one that registers its scope, is an in-band path: 403 BREAK_GLASS_REQUIRED
without the break-glass header (§8.15.3). With CORTEX_SUBTREE_RATE_LIMITS the scope's subtree is charged one write
(429 SUBTREE_RATE_LIMITED), and with CORTEX_PLANS=1 a write past the account's limits is 402 PLAN_LIMIT_REACHED.
Errors:
| HTTP | Code | When |
|---|---|---|
| 400 | BLOB_UNSUPPORTED_CLUSTERED | A binary blob_ref on a cluster data node, whose replicas would each index the blob as text (a text blob is inlined and accepted); retriable: false |
| 400 | INVALID_QUERY | consistency is not a flag (details.field: "consistency") |
| 401 | ACTOR_MISMATCH | Header doesn't match token sub |
| 402 | PLAN_LIMIT_REACHED | Hosted plans (CORTEX_PLANS=1): the write would take the account past its stored memories or tenants; nothing written; details: {limit, used, max, plan, subtree, upgrade_url} |
| 403 | POLICY_DENIED | A capability the policy denies (details.capability, details.denied_by_tier, and details.link for a 0.14.0 rule such as minter or confinement); a scope outside the token's billing tenant (details.scope, details.billing_id); a write into an application's reference root by anyone but its principal (details.reason: "reference_root"); with consistency=1, a path or scope under another root (details.reason: "token_root_not_written", details.scope). Since 0.14.0 an outcome of the final admission that is no decision about the caller (an outage, a state that moved) keeps the registry's own code (503 SCOPE_STORAGE_UNAVAILABLE, WAL_OUTCOME_UNKNOWN; 409 SCOPE_STATE_CHANGED, AUTHORIZATION_STATE_CHANGED, ACTIVITY_CHANGED), never 403 |
| 403 | NOT_A_MEMBER | The scope's roster gives the caller no Writer role |
| 403 | SCOPE_REGISTRATION_REQUIRED | An unregistered scope that may not be auto-registered |
| 403 | APP_NOT_ADMITTED | The chain's application is not admitted at the scope (DB-18; no details) |
| 403 | RUN_REQUIRED | A token with act and no run (since 0.14.0); details.scope |
| 403 | ATOMS_REDIRECT_REFUSED | The write must land in its writer's private space and may not (details.reason, above) |
| 403 | BREAK_GLASS_REQUIRED | The operator key under CORTEX_OPERATOR_DATA_READS=deny, writing into a private region or a shared org-tree scope or registering its scope, without X-Cortex-Break-Glass (class in_band, §8.15.3) |
| 404 | BLOB_NOT_FOUND | A blob_ref names no live blob of the caller's billing tenant and actor; nothing written |
| 408 | WAIT_TIMEOUT | ?wait=indexed or consolidated ran out of its one wait budget: about 30 s, shared by the wait for the indexer to reach the event and the wait for the stage after it (before 0.10.2 each got 30 s, so the 408 came at about 60 s). retriable: true. The event is captured and durable and processing continues. details: event_id, target_stage, status_url (poll it), waited_ms, and waiting_on: indexer (the indexer had not reached this event; it indexes the log in order, so it may be working through other writes first) or stage (indexed, but not yet at the requested stage). A resend replays (never duplicates) only when the request carried its own idempotency_key; without one a resend is a new write. A same-key replay the indexer has not reached answers the same 408 within the same budget. wait=settled answers it too when CORTEX_SETTLEMENT_TIMEOUT_MS (default 600000) runs out during its pass. |
| 409 | IDEMPOTENCY_CONFLICT | Same key, different body (another derived_by included); details.existing_event_id |
| 409 | CANCELLED | Under wait=indexed, consolidated or settled, or for a write that references a blob, a same-key replay included: the write's cancel committed. It is kept but never indexed or recalled, and its key stays claimed; details.event_id; retriable: false |
| 409 | PROVENANCE_ERASED | A cited event was erased or redacted before the write committed; nothing stored; details: {event_id, cited} |
| 409 | WRITER_NOT_ALLOWED | Since 0.15.0: a derivation policy's writer rule refuses a typed triple's predicate (§8.32, "Writer rules"); nothing stored; on a bulk, the item alone; details: {predicate, writers, requires} |
| 409 | DESTRUCTIVE_OPERATION_IN_PROGRESS | retriable: true, Retry-After: 5: the capture would register a new scope (or bind a tenant) inside a /v1/forget or /v1/erasures still running past the admission wait (CORTEX_DESTRUCTIVE_LEASE_WAIT_SECS, default 120 s, at most 3600); nothing written; details: {scopes, retry_after_seconds, admission_wait_seconds}; re-send the identical request |
| 409 | SCOPE_STATE_CHANGED | retriable: true, Retry-After: 1: that conflict had cleared as the error was rendered. (The scope registry's own SCOPE_STATE_CHANGED, AUTHORIZATION_STATE_CHANGED and ACTIVITY_CHANGED, when it could not decide the authorization, carry retriable: true since 0.14.0, and no Retry-After; re-send.) |
| 413 | PAYLOAD_TOO_LARGE | Body over the §6.10 limit |
| 422 | INVALID_BODY | Body validation failed; details.field_path, details.reason, details.schema populated. A body that is not JSON is a 422 here too, never a 400 or 415: the route reads the body itself, whatever its Content-Type. Also a wait value outside the five, and a multilingual or provenance field whose capability GET /v1/admin/version does not list (details.unsupported_fields, details.required_capabilities; 0.14.0 lists all of them) |
| 422 | INVALID_ENVELOPE | A validation failure: empty modality; an empty idempotency_key or one over 64 bytes; more than 1,024 provenance ids; an empty text or message text; content over 1,048,576 indexable bytes; an encoded record over 4 MiB less 64 KiB; an empty or over-256-character triple predicate; a ttl_for_belief_layer that is not an ISO-8601 duration; an empty subject.id; an invalid source (or one of another modality, or a single fragment whose fingerprint does not match the text); a malformed language, scripts or context.timezone; an invalid context.refers_to; or details.field: "directives.consolidate_into", a target the caller may not write |
| 422 | LABELS_TOO_MANY, LABEL_TOO_LONG, LABEL_EMPTY, LABEL_INVALID_CHARACTER | While CORTEX_LABEL_LIMITS=on: a context.labels limit (§3.5.3) |
| 422 | DERIVED_BY_INVALID | derived_by_v1: a derived_by out of grammar or shape or on anything but a typed triple, or a context.labels entry starting derived_by: (§3.5.3, "Write-back stamps"); details: {field, reason} |
| 422 | BLOB_TEXT_ENCODING_UNKNOWN | A blob_ref text blob is not UTF-8, has no BOM, and no usable charset= (§8.13.1); details.blob_id, details.content_type, details.reason, details.charset populated |
| 422 | INVALID_SCOPE_GRAMMAR | details.reason: "reserved_path": a first write at a marker or companion path, refused by default since 0.14.0 (with CORTEX_RESERVED_PATH_ENFORCE=off it is written and counted) |
| 422 | UNREGISTERED_SCOPE_TYPE | A first write whose scope has a segment type outside the deployment's allowed_scope_types |
| 422 | PROVENANCE_UNKNOWN | A cited event is not one of the root's; nothing stored; details: {event_id, cited} |
| 422 | CROSS_ROOT_PROVENANCE | The chain's read record or provenance names another root; details: {scope, root} |
| 429 | SUBTREE_RATE_LIMITED | CORTEX_SUBTREE_RATE_LIMITS: the scope's subtree spent its write budget, or the chain's application its requests_per_minute; retriable: true, Retry-After |
| 500 | INTERNAL_ERROR | An unexpected pipeline failure (the pipeline shut down during the wait, a minted event id already taken); retriable: true |
| 500 | SCOPE_STORAGE_MISCONFIGURED | The scope registry's storage cannot take the scope's registration, or its tenant binding, as it is configured (details.reason, §8.8); retriable: false: the operator must act (since 0.14.0; it was 503 SCOPE_STORAGE_UNAVAILABLE) |
| 502 | INDEXING_FAILED | Accepted (WAL-durable) but indexing failed; retriable: false — the record is kept, so the same idempotency key replays this failure; do not re-send: the event is stored and excluded from recall, and an operator can re-include it with POST /v1/admin/index-audit/reinclude. Only a write that waits for the indexer (wait=indexed and above, or a blob write) sees it. An event that a concurrent scope forget or erasure blanked while wait=indexed was waiting is not reported this way: it was erased on purpose, and re-sending it would restore it |
| 503 | NOT_LEADER, WAL_UNAVAILABLE, WAL_OUTCOME_UNKNOWN | The replicated log refused the write before submitting it (nothing written; NOT_LEADER never occurs on a serving single node, WAL_UNAVAILABLE means the log stopped on a storage error or is shutting down) or lost its outcome (WAL_OUTCOME_UNKNOWN: it may have committed; retry with the same idempotency key). All retriable: true |
| 503 | DISK_FULL | A disk of the shard is critical, so the write was refused before submit; nothing written; retriable: true, Retry-After: 30, details: {node, retry_after_seconds} |
| 503 | FORMAT_UPGRADE_PENDING | A write that must carry atoms or provenance outside its writer's own private space, on a shard below apply format 9; details: {reason, format, node, paths, count, scope}, reason one of members_behind, arming_disabled and reserved_path_in_use; retriable only for members_behind (Retry-After: 30); the other two wait for the operator |
| 503 | WAL_UNAVAILABLE | The cited events' records could not be read; retriable: true |
| 503 | MEMORY_INGESTION_UNAVAILABLE | This process is a worker-disabled prepared artifact replica; retriable: true (since 0.14.0); send writes to an artifact-worker process |
| 503 | BLOB_REGISTRY_UNAVAILABLE, BLOB_BYTES_UNAVAILABLE | The blob could not be verified or read; retriable: true |
| 503 | REPLAY_STAGE_UNVERIFIED | A same-key replay of a write this process did not make cannot prove a stage past indexed; retriable: false; use wait=indexed |
| 503 | SETTLEMENT_UNAVAILABLE, SETTLEMENT_SATURATED | wait=settled (above) |
| 503 | SCOPE_STORAGE_UNAVAILABLE, WAL_OUTCOME_UNKNOWN | The scope registry could not answer, or a registry change's outcome is unknown (it was SCOPE_MUTATION_UNKNOWN before 0.14.0); retriable: true (since 0.14.0; it said false). On a clustered owner, a registration the shard did not take answers the shard's own code and retriable instead (§8.8) |
On a cluster data node apply can also refuse the capture, writing nothing: 503 SCOPE_NOT_OWNED, STALE_EPOCH
or REGISTRY_STALE (retriable), or BIND_MISMATCH (not retriable). A cluster ingress answers its own codes (docs/generated/cluster.md),
routes the write by the roots of scope and directives.consolidate_into (422 CROSS_SHARD_REQUEST when they lie on
different shards), and resends a capture whose outcome it lost only when it carries an idempotency_key.
8.2 POST /v1/experience/bulk — Bulk Write
Capability: scope.write, and for each item what POST /v1/experience asks of its envelope (§8.1).
Request:
{
"items": [
{"scope": "org:acme/dept:eng/user:alice", "modality": "...", "content": {...}, "context": {...}, "idempotency_key": "..."},
...
],
"ordering": "strict_temporal" | "batch_throughput"
}
Each item is a full experience envelope carrying its own scope — there
is no batch-level scope/actor/directives (items in one batch may target
different scopes). experiences is accepted as an alias for items (send
one of the two). ordering is accepted but not read: items are processed in
submit order whatever it says. Any other top-level key is 422 INVALID_BODY.
As on §8.1, the body is read as raw JSON whatever its Content-Type.
Maximum 1000 items per call; an empty batch, or more than 1000 items, is
422 INVALID_BODY. Larger imports should use /v1/import/jsonl (up to
10,000 lines, §8.11.5).
While the server's memory is high (Linux; CORTEX_MEMORY_PRESSURE, by default one reading at 85% of its limit, cleared
after three at or below 75%), a bulk write is refused before its body is read: 503 MEMORY_PRESSURE, Retry-After: 10,
details: {kind: "bulk_write", memory_ratio, retry_after_seconds}; nothing is written.
The query parameters are §8.1's (wait, below; consistency, whose token names the root of the first item the
batch stored; a path or scope naming a root no item writes is 403 POLICY_DENIED, token_root_not_written).
Response (202 for wait omitted, accepted or captured; 200 with stage for indexed or consolidated; 207 on a
partial failure):
{
"batch_id": "batch_01HX...",
"accepted": 999,
"event_ids": ["evt_...", "..."],
"results": [
{"index": 0, "event_id": "evt_...", "replayed_from_idempotency": false},
{"index": 1, "event_id": "evt_...", "replayed_from_idempotency": true}
],
"lifecycle_stream": "/v1/lifecycle/stream?batch_id=batch_01HX..."
}
| Field | Type | Notes |
|---|---|---|
batch_id | string | batch_ and 32 hex digits, minted per request |
accepted | integer | Distinct events the batch stored or replayed |
event_ids | array | Those events, in first-occurrence order |
results | array | {index, event_id, replayed_from_idempotency, warnings?, redirected_to?} per written or replayed item, in item order |
lifecycle_stream | string | /v1/lifecycle/stream?batch_id=<batch_id>: the batch's rows at every stage, from the oldest row the log holds (§8.9.1) |
stage | string | 200 only: indexed or consolidated |
failures | array | 207 only: {index, error_code, error, details, retriable} per failed item (details is null when the code has none); an INDEXING_FAILED item carries event_id and remediation instead of details |
partial | boolean | true on a 207 only |
degraded | object | Present while the embedding provider is failing at runtime: {embedding_provider_unhealthy, consecutive_failures, last_error, note}; the items are stored and wait for their vectors |
consistency_token, derived_through | string, integer | With consistency=1 only (§6.11) |
accepted and event_ids count distinct persisted events: items
deduplicated by a shared idempotency_key (within the batch, or against a
prior write) store one event, repeat its event_id in the index-aligned
results array, and carry replayed_from_idempotency: true (v0.7.9
report F2). The keys are claimed as on §8.1, in the bucket the three capture
routes share; an item without a key is a new write on every resend.
Status contract (v0.7.9 report F1):
- Every envelope is validated before anything commits, then authorized. Any invalid item rejects the whole batch —
422 INVALID_ENVELOPEwith per-indexdetails.failures[]anddetails.accepted: []— and the first item the authorization refuses (a403, a422, a503 FORMAT_UPGRADE_PENDING, ...) refuses the batch with that item's answer. Hosted-plan limits and the subtree write budget are charged for every item at once, all or none. The one item-level exception is an item whose stored record exceeds the §6.10 limit: it is rejected on its own withINVALID_ENVELOPEwhile the other items are written. - The items are captured in request order, about 1 MiB of encoded items per shard proposal (a larger item goes alone), each proposal awaited before the next. After a chunk fails with a WAL error, its items and every later item report that error and were not written.
- A 4xx/5xx bulk response wrote nothing new, except:
503 WAL_OUTCOME_UNKNOWN(chunks before the failed one may have committed: retry the whole batch with the same keys, and committed items replay);408 WAIT_TIMEOUT(written, and processing continues); and502 INDEXING_FAILED,409 CANCELLEDand a503 BULK_WRITE_FAILEDholding such items, whose events are stored and excluded (their keys replay the answer). - Runtime faults on some items with others committed return
207 Multi-Statuswithpartial: true, the committedresults, and per-indexfailures[]— retry only the failed items. A 207 is answered before any stage barrier. Indexing failures keep their idempotency records (retriable: false): do not re-send those items, under their keys or new ones; an operator re-includes them (POST /v1/admin/index-audit/reinclude). - When every item fails at capture: one reason across the batch answers that reason's status (
502 INDEXING_FAILED, the WAL code's503, the registry's403,409 CANCELLED); different reasons, or mixedretriableflags, answer503 BULK_WRITE_FAILED(retriableonly when every failure is); and any other single reason (IDEMPOTENCY_CONFLICT,PROVENANCE_ERASED,PROVENANCE_UNKNOWN,BLOB_UNSUPPORTED_CLUSTERED, an oversized record) answers422 INVALID_ENVELOPEwith each item's own code indetails.failures. - Indexing failures: an item whose indexing fails terminally after capture is excluded from recall and keeps its key, so a same-key retry replays the failure instead of writing a duplicate. An embedding-provider outage is not such a failure: the item waits until the provider answers.
Items with content.kind: "triple" write their fact deterministically
(no LLM) on the direct-fact path, same as the single-write endpoint —
since v0.8.7 this holds for bulk too (previously bulk stored the triple
event but produced no fact unless an enrichment LLM was configured). On
single-event POST /v1/experience under the unified WAL (the default)
the fact is written by the indexer tail as it applies the event, so
?wait=indexed returns after the fact exists, and ?wait=accepted /
?wait=captured get it once the tail passes the event. Before this fix
single-write triples produced no fact under the unified WAL. A triple is
embedded once, with its event, after the write is acknowledged: while the
embedding provider is down the event and its fact wait to be indexed
(?wait=indexed answers 408 WAIT_TIMEOUT once its budget runs out), and
the fact is written with its vector when the provider answers. A triple the
provider rejects on its own is stored without a vector.
wait omitted or accepted on bulk waits for the indexer to index the batch, for at most
min(30 s + 1 s per newly stored item, 600 s), then answers 202 whether or not it finished (never 408); an item whose
indexing failed terminally within that wait is reported as a failure.
?wait=captured on bulk (v0.8.11) is the raw-first/derive-later fast
path: every item acks at its WAL-durable capture point (202) and indexing
(embedding, the indexes, triple facts) runs in the background. This is the
recommended mode for large backfills — previously bulk always awaited the
mirror, so a 25-row batch could block ~90s in embedding and clients hit their
own timeouts while the server kept working. A batch with an item that
references a blob waits for the indexer as accepted does. Poll
GET /v1/experience/status?idempotency_key=... per item (or the lifecycle
stream, per event) for indexing progress; a background indexing failure keeps
the item's idempotency key, so that item is not re-sent, under it or a new key: an operator
re-includes it with POST /v1/admin/index-audit/reinclude.
Per-item write status is also queryable by idempotency_key via
GET /v1/experience/status?idempotency_key=<key> (§8.18).
?wait=consolidated on bulk waits for each event as a single write does (0.15.0): with
enrichment on, until deferred enrichment applied the event (§8.1); a triple or an extract: []
event does not wait for it. Through 0.14.2 the bulk barrier checked its events without their scope,
so it never waited for enrichment and could answer 200 before enrichment had applied anything. With
enrichment on, a large batch now takes as long as its enrichment, and past the budget below it
answers 408 WAIT_TIMEOUT.
?wait=indexed / consolidated on bulk has one budget (0.10.2): min(30 s + 1 s per item, 600 s), and it covers the wait for the indexer to index the batch as well as the stage barrier
after it. (In 0.10.1 the batch's inline indexing had no limit and the barrier's budget started
only after it: a batch stuck behind a slow embedding provider waited, then answered 200 with its
ids. Builds of 0.11.0 before this merge gave the indexer wait and the barrier a budget each.) When
the budget runs out the answer is 408 WAIT_TIMEOUT, retriable: true, with details:
batch_id,target_stage,waited_ms;waiting_on:indexing(the batch is still being captured or indexed;itemsis the request's item count) orstage(indexed, but not every event reached the stage;acceptedis the distinct event count);event_ids(0.10.2): the batch's captured events, distinct and in item order, the same list a 200 returns. It is absent only when the budget ran out before every chunk of the batch was captured.
The writes continue in the background: poll GET /v1/experience/status?event_id=<id> for each id
(§8.18). A resend replays (never duplicates) only the items that carried their own
idempotency_key; an item without one is written again. Send an idempotency_key on every
item of a bulk that waits. ?wait=settled cannot succeed in this release: after the batch is
indexed, within CORTEX_SETTLEMENT_TIMEOUT_MS (default 600 s), the route answers 503 SETTLEMENT_UNAVAILABLE.
Errors: §8.1's, per item, with these differences:
| HTTP | Code | When |
|---|---|---|
| 207 | — | Partial: some items written, some failed (above) |
| 402 | PLAN_LIMIT_REACHED | The batch would take an account past its plan; all or none |
| 403 | §8.1's 403 codes | The first refused item refuses the batch, before anything is written |
| 409 | CANCELLED | Every item's write was cancelled (details.failures) |
| 409 | DESTRUCTIVE_OPERATION_IN_PROGRESS, SCOPE_STATE_CHANGED | As §8.1, for any item; nothing in the batch was written |
| 422 | INVALID_BODY | Also an empty batch, more than 1000 items, an unknown top-level key |
| 422 | INVALID_ENVELOPE | An invalid item (the batch is refused, details: {failures, accepted: []}; an item with a refused derived_by carries DERIVED_BY_INVALID and its details in its entry), or every item failed at capture for one reason (above) |
| 429 | SUBTREE_RATE_LIMITED | An item's subtree spent its write budget; all or none |
| 502 | INDEXING_FAILED | Every written item failed its indexing; details: {failures, accepted: []} |
| 503 | BULK_WRITE_FAILED | Every item failed, for different reasons; details: {failures, accepted: []}; retriable only when every failure is |
| 503 | DB_SATURATED, DB_UNAVAILABLE | The storage lane did not run a new scope's registration, so no item was captured; retriable: true (since 0.14.0; it was SCOPE_MUTATION_UNKNOWN) |
| 503 | MEMORY_PRESSURE | Memory is high (above); Retry-After: 10 |
| 503 | WAL codes | Every item failed on the log; after an earlier chunk committed the batch answers 207, the code on each failed item |
| 504 | DB_TIMEOUT | A new scope's registration ran past the storage lane's execution deadline and may still be running; no item was captured; retriable: false (since 0.14.0; it was 503 SCOPE_MUTATION_UNKNOWN) |
A bulk never answers 400 BLOB_UNSUPPORTED_CLUSTERED: a binary blob_ref item on a cluster data node fails on its own
(207, or 422 INVALID_ENVELOPE when every item fails so). A cluster ingress routes the batch by every item's root
(422 CROSS_SHARD_REQUEST across shards) and resends a capture whose outcome it lost only when every item carries an
idempotency_key.
8.2.1 POST /v1/experiences
An alias of POST /v1/experience/bulk, for callers that reach for the plural (audit FRI-2): the same handler, body,
query parameters, limits, answers and errors, the same refusal for memory pressure before the body is read, the same
operator-plane class and the same cluster routing. Its items' keys are claimed in the bucket /v1/experience and
/v1/experience/bulk share, so a batch sent to either replays on the other. Only the path differs (the request log and
the metrics name it).
8.3 POST /v1/recall — Read
Capability: scope.read.local on scope and, on a per-actor token, Reader on its roster (always); scope.read.holistic for view holistic (the default), structured or lineage; scope.read.descend for view=descend; diagnostics.read if diagnostics ≠ "none". Each extra scope and each mounted scope (§8.3.2) is authorized as a direct granular recall of it. The route reads stored rows: under CORTEX_OPERATOR_DATA_READS=deny the operator key needs the break-glass header (class stored_rows, or private_region when scope or an extra scope lies in a private region; §8.15.3).
Current credentials, traversal authority and represented scope memberships are
rechecked before returning evidence and while handing off the response body.
If access is withdrawn after response headers were sent, the body terminates with
an error. A 200 header alone is not a successful recall: consume and validate the
complete JSON response. The development native ownership path additionally retains
source use through body completion/drop; production v1 producer and Gateway
admission are tracked separately in IWORK_ACTIVE_MILESTONE.md.
holistic is the public recall default. It can return evidence from the
requested scope, authorized ancestors, and authorized descendants; it never
crosses into sibling subtrees. Descendant admission is filtered against the
scope registry and the caller's signed capability constraints at every exact
ACL boundary. Use granular (or its local alias, matched case-insensitively) for exact-scope
recall. At a shared org-tree scope (an org, team, group or compartment, §8.8.7) a request that names
no view reads granular, and one that names a view that walks the tree (holistic, structured,
lineage, descend) is 422 VIEW_NOT_ALLOWED_AT_SCOPE (0.13.0), raised after the read and roster
checks, so a caller who may not read the scope learns nothing of its kind.
Request:
{
"scope": "org:acme/dept:eng/user:alice",
"view": "holistic",
"query": "What did we decide about the Q3 launch?",
"include": ["beliefs", "facts", "episodes"],
"exclude_content": false,
"temporal": {
"as_of": null,
"valid_during": null,
"natural": "last 30 days",
"reference_date": null
},
"filters": {
"metadata": {
"observed_actor": ["user:alice", "agent:planner_v3"],
"labels": ["decision"]
}
},
"budgets": {
"max_tokens": 4000,
"per_layer_limits": {
"events": 0,
"episodes": 5,
"facts": 20,
"beliefs": 10,
"understanding": 3
}
},
"diagnostics": "summary"
}
Field reference:
| Field | Type | Notes |
|---|---|---|
include | array | Layers to fill: events, episodes, facts, beliefs, understanding, rollups (any other name is 422 INVALID_BODY). Empty or absent: every layer the view fills, rollups included where the scope homes rollups the caller is served (§9); a list without rollups leaves them out. |
exclude_content | bool | When true every layers.events[].content is null: ids and metadata only, for a caller that re-hydrates selectively (diagnostics.filters_applied lists exclude_content). |
temporal.reference_date | RFC3339 | Anchor for parsing temporal.natural phrases (e.g., "last week"). Defaults to request time. |
temporal.valid_during | [start, end] | Capture time: keeps events whose observed_at is in the range, and is pushed into retrieval as a filter. It is not the date a memory talks about; send that as temporal.refers_during. |
temporal.natural_mode | strict | lenient | Capability temporal_lenient_v1. strict (the default, and the behaviour without the field): an unparseable temporal.natural is 422 UNPARSEABLE_TEMPORAL. lenient: the phrase is ignored, no time filter is applied, and the pack carries warnings: ["temporal_natural_ignored: ..."]. |
temporal.timezone | IANA zone | Capability temporal_lenient_v1. The caller's zone, e.g. Asia/Kolkata; a non-IANA value is 422 INVALID_BODY (details.field = "temporal.timezone"). temporal.natural calendar phrases (today, yesterday, this week, ...) resolve on this zone's calendar instead of UTC's. Default zone of refers_during. |
temporal.refers_during | object | Capability refers_to_v1. {from, to, zone?}: the local interval the question refers to. Boost-only. See §12.2. |
filters | object | Exactly one field: metadata, a map of attribute → string or list of strings (list = match ANY, i.e. OR). Accepted attributes: observed_actor, caller, modality, labels, intent. labels matches the EXACT stored label string (the values you passed in context.labels at write time — note the asymmetry: you store labels top-level in context.labels but filter them under filters.metadata.labels). Boolean operators (AND/OR trees) and comparison objects (gte etc.) are NOT accepted; there is no confidence filter; unknown fields or attributes are rejected with 422. Multiple attributes are ANDed; multiple values within one attribute are ORed. |
budgets.max_tokens | int | Token budget for the whole pack (default 4000). It bounds context_block (about 3.5 bytes per token): no entry takes the block past it, whole events are never cut, and an event longer than the room it gets is served as an excerpt, the same one in the block and in layers.events (§9.5, budget_excerpt_v1). It is also a cross-layer token budget over the structured layers, spent by priority: layers named in include first (in include order), then facts > beliefs > episodes > understanding > events. Events are therefore evicted first unless include lists them, and within the events layer the events context_block does not render leave before any it renders; eviction is otherwise from each layer's tail, until the pack fits. diagnostics.knapsack_evictions reports how many items went. A generous budget evicts nothing. per_layer_limits are applied first as hard caps. Every event whose text is in context_block stays identifiable by id (§9.2). Set CORTEX_CROSS_LAYER_KNAPSACK=0 to restore the legacy behavior (budget bounds only context_block; derived layers item-capped, not token-counted). |
budgets.per_layer_limits | map | Item caps by layer name (events, episodes, facts, beliefs, understanding, rollups; rollups default 8, at most 32), applied before the token budget; events also caps an order: "recency" tail. A field of budgets other than max_tokens and per_layer_limits is 422 INVALID_BODY. While the server's memory is high a max_tokens over 16,000 is 503 MEMORY_PRESSURE (details.kind: "large_recall"). |
citation_mode | enum | none, inline_with_markers (default), block_at_end, structured_only. Accepted for compatibility; no recall path reads it in this release. |
diagnostics | enum | none (the default), summary (filters applied, phase timings, knapsack evictions and, when retrieval degraded, _partial and degraded_sources) or full (adds policy attribution and, with capability recall_diagnostics_v1, the per-item side-table below). Any level but none needs diagnostics.read (403 POLICY_DENIED, details.capability: "diagnostics.read"). |
query_variants | array | Capability query_variants_v1. Up to 4 alternative phrasings of query, each {text, language?, script?} (language BCP-47, script ISO 15924). Use it to send, for example, an English helper with a Hinglish question. More than 4 entries, empty or whitespace-only text, or text over 4096 bytes is 422 INVALID_BODY with details.field = "query_variants". A variant equal to query or to an earlier variant (compared trimmed, whitespace-collapsed and case-folded) is dropped without an error. Unknown keys inside a variant are a 422. See "Query variants" below. |
language | BCP-47 | Capability recall_language_v1. Language of query, e.g. hi-Latn; canonicalized; malformed is 422 INVALID_BODY with details.field = "language". Makes a grounding miss advisory for a non-English tag; fil, id, vi and und-* also turn off the English stoplist (hi / hi-Latn keep it in Release 1). See "Language hints" below. |
scripts | array | Capability recall_language_v1. ISO 15924 scripts of query, dominant first; at most 8; malformed is 422 INVALID_BODY with details.field = "scripts". |
extra_scopes | array | Capabilities extra_scopes_v1 and extra_scopes_40_v1. Up to 40 more scopes (8 on a server that does not list extra_scopes_40_v1) in the tenant subtree of scope (its root; with CORTEX_TENANT_DEPTH=2 its first two segments, so two tenants under one bucket root never share a read set), read in the same ranked pass (docs/EXTRA_SCOPES_DESIGN.md). Each is read exactly (its own events, no ancestors or descendants) and authorized exactly as a direct granular recall of it would be; one the caller cannot read refuses the request with that recall's 403. Each scope contributes its own vector and BM25 top-k, and the lists meet in one fusion and one rerank. Events keep their real scope in layers.events[].scope; context_block lines from an extra scope carry its last segment after the time bracket ([2026-06-15 08:30 UTC] [source:slack] ...). Repeats and scope itself are dropped; a scope outside that subtree, or more scopes than the bound, is 422 INVALID_EXTRA_SCOPES (details.max_items: 8 for a list of at most 8, else 40); not combinable with subtree, nor with newest_of_kinds. /v1/answer and /v1/compose take the same field for every recall they make; such answers are not cached. Each extra scope's derived layers (facts, beliefs, episodes, concepts) join too, read at the exact scope and ranked with scope's. See §8.3.2. |
newest_of_kinds | array | Capability memory_kinds_v1. context.intent values (memory kinds, for example handover) served as their newest event only: for each kind listed the pack holds the newest eligible event of that kind in the scope, first, whether or not the query matched it, and none of the older ones. Older events stay listable (GET /v1/events?intent=) and erasable. Blank and repeated entries are dropped; more than 16 is 422 INVALID_BODY (details.field = "newest_of_kinds"); not combinable with subtree, and, since it reads the home scope alone, not with extra_scopes or mounts either (422 INVALID_BODY, details.reason newest_of_kinds_with_extra_scopes or newest_of_kinds_with_mounts; a list that trims to nothing combines with both). When the scope cannot be read whole in one bounded listing, the newest of each kind among the recalled events is kept and warnings carries newest_of_kinds_partial. |
stream | bool | true is refused on /v1/recall (422 INVALID_BODY): POST the same body to /v1/recall/stream for the event stream (§10.1). |
idempotency_key | string | Accepted and ignored: recall keeps no idempotency, and a repeated request runs again. |
order | enum | relevance (default) or recency. recency replaces ranked retrieval for the events layer with a timeline tail: the scope's newest eligible events by observed_at, capped by budgets.per_layer_limits.events (else CORTEX_RECENCY_TAIL_EVENTS, default 100), rendered NEWEST-FIRST in the context block and events layer (v0.8.7; /v1/answer also tells the model about the ordering, so clients need no ordering instructions). Eligibility (scope/tenant, filters, temporal) is identical to ranked mode — only selection changes. Built for "recent/latest X" questions, where relevance ranking returns the most-repeated items and drops the newest ones. /v1/answer infers it for recency-shaped questions (kill-switches: CORTEX_RECENCY_INFERENCE=0 for inference, CORTEX_RECENCY_ORDER=0 for the mode itself). Views (0.10.3): an order: "recency" the caller sends is served as a tail in holistic, granular, lineage and raw (a raw tail fills the events layer only; that view has no context block). Two views keep ranked retrieval: descend, because the tail reads the request scope's own partition and a descend read's events live in its descendants' partitions, and structured, which has no events layer. From v0.9.0 to v0.10.2 the tail ran only in holistic: order: "recency" was silently served ranked in every other view, and on every /v1/answer over an exact scope with no child scopes (it recalls those granular). An order /v1/answer infers is narrower; see §8.4. A tail none of whose events names a capitalised name in query (the entity grounding gate would clear it, leaving an empty context) is not served: ranked retrieval runs instead (0.10.3). |
prefer_exhaustive | bool | The small-scope exhaustive probe (holistic only): true lets it serve the whole scope as the context when the scope fits under CORTEX_SMALL_SCOPE_EXHAUSTIVE_MAX_TOKENS (default 32,000); false always ranks; absent, the probe runs only for a request with metadata filters. CORTEX_SMALL_SCOPE_EXHAUSTIVE=0 turns the probe off. |
subtree | object | Flag-gated: one ranked pass across the authorized child scopes (§8.3.1). |
mounts | "default" | Capability recall_mounts_v1: the chain's application's mounts join the read set (§8.3.2). |
coverage | bool | Capability recall_coverage_v1: the pack reports what the read searched and what it left out (§8.3.2). |
beliefs | "stored" | "merged" | Capability beliefs_merged_v1: one merged history per topic across the read set (§8.3.2). |
consistency | object | Capability consistency_tokens_v1: {} or {"at_least": "<token>"} (§8.3.2, §6.11). |
purpose | string | Capability read_purpose_v1: the purpose the read declares, [a-z0-9_-]{1,64}; null is none, and a read without it is unchanged. The route declares it on the request's context before any check, and every roster check of the request reads it (the scope's, the extra scopes', the mounts', the ancestors', the descendant boundaries', the delivery gate's homes and atoms, the recall engine's row gate and the notice rules' tell_first), so a path whose when is {purpose: <id>} holds only for a read that names that id. The read's authorization snapshot records it, and a recheck under another purpose decides nothing; the answer cache's key, the snapshot digest and the delivery decisions' digest (which the cohort read cache binds) include it. /v1/recall/stream splits it off the body, as it does consistency. A value out of the grammar is 422 INVALID_BODY, details.field: "purpose". A read refused only because the one roster path that admits the caller needs a purpose the request does not declare (none, or another) is 403 POLICY_DENIED with details.reason: "purpose_required" and details.purpose, the purpose that path needs, and a message naming it (since 0.14.0; it answered "caller is not a member of scope ...", as a caller with no path at all still is). |
session | string | Capability derivation_use_rules_v1 (new in 0.15.0, experimental): the session the read is made in, an opaque id of 1 to 256 bytes with no control character (422 INVALID_BODY, details.field: "session", otherwise). Read only where a read-time use rule is in force (§8.32.5): there an event captured before the rule's window, or in another session than this one, is withheld from the pack, and so is every fact, belief, episode, concept and rollup derived only from withheld events; the pack says use_rule_withheld: <n> events from earlier sessions in warnings. A read without it counts every event as another session's. Accepted and ignored where no rule is in force: the pack is then byte for byte the one without it. In voice mode it is also the call's session (voice_sessions_v1, §8.3.3): a voice recall naming a session this node does not hold opens it again. |
server_timing | bool | Capability recall_profile_voice_v1. Voice mode (experimental). true: the 200 carries a Server-Timing header naming the request's stages in milliseconds with three decimals (microsecond resolution; diagnostics.time_ms keeps whole milliseconds): total (the route, from its start, a run lost to an authorization race included) and queue (the admission wait), then recall_total, exhaustive_scope_recall (when the small-scope probe or a recency tail served the pack), coordinator_recall, the coordinator's own coordinator.usage, coordinator.bm25_commit, coordinator.shadow_planner and coordinator.recency_listing, the pipeline's recall.<phase> stages in the order they ran (recall.embed_batch, recall.vector_search, recall.bm25_search, recall.retrieval_channels, recall.fusion and the others diagnostics.time_ms names), wal_hydrate_loop, wal_supplement_ms, derived_layers and pack_assembly, as in Server-Timing: total;dur=3.120, queue;dur=0.002, recall_total;dur=2.410, .... The stages and their times describe the server's work on the scope (which channels ran, whether a voice call's working set served the pack), so the header goes only to a caller holding diagnostics.read on the scope (what diagnostics: "summary" needs) and to the trusted operator; any other caller's 200 has none, unless the operator sets CORTEX_RECALL_SERVER_TIMING=all (default diagnostics), which the voice profile does not set. The pack is the same with or without it; a refusal carries no header. /v1/recall/stream accepts it and sends none. |
profile | "standard" | "voice" | Capability recall_profile_voice_v1. Voice mode (experimental). standard (the default) is the recall this table describes. voice is the short read path of a live voice turn: the pack is read granular (one that names any other view is 422 INVALID_BODY, details.field: "view"; local is granular), and the question-shape classifier, LLM query expansion, the cross-encoder rerank, the entity-graph stages and the BM25 commit at recall entry are skipped (a document written in the last 100 ms may not be found by BM25 yet; the background commit publishes it within that interval), except that a voice recall demanding a consistency token (consistency.at_least, §6.11) commits what the token covers first, so it reads those writes by BM25 too. A voice recall that names no include fills the events layer alone: facts, beliefs, episodes and understanding only when include names them. Each channel retrieves fewer candidates (CORTEX_RECALL_TOP_K_VOICE, default 16): the vector list is the first 16 events of the 32 nearest chunks, each event at its best chunk, and the BM25 list the best 16 chunks. The fused list keeps one of each set of identical texts and is not re-ordered by its texts (no lexical evidence ordering, no neighbouring turns of a session, no per-document cap), and its first events are the pack's candidates: twice per_layer_limits.events (8 when it names none), at least 16 and at most 64, which the delivery checks, the token knapsack and per_layer_limits then cut. A query with a recency cue ("last", "latest", "most recent") reads the 20 newest events homed at the scope itself (from at most 8 of its partitions; events of the scopes under it are not read) in capture order instead of listing the scope; an import back-dated by observed_at can make the two differ. The admission wait is CORTEX_RECALL_QUEUE_TIMEOUT_MS_VOICE (default 100 ms, never longer than CORTEX_RECALL_QUEUE_TIMEOUT_MS; then 429 RECALL_OVERLOADED), and the 200 carries the Server-Timing header for a caller who may see it (server_timing). The pack's schema is unchanged. In voice mode (voice_sessions_v1, §8.3.3) a voice recall whose scope has a ready working set on the serving node is served from it, in RAM, ranked by the same rules into the same number of candidates, with the same pack and the same delivery checks on every row; the Server-Timing header then ends src;desc="working_set" (src;desc="index" otherwise). |
alpha | number | Capability recall_profile_voice_v1. The fusion weight of the vector list against the BM25 list, from 0.0 to 1.0: a vector hit at rank r adds alpha / (60 + r) to an event's fused score and a BM25 hit (1 - alpha) / (60 + r); other lists keep weight 1. 1.0 is vector-only and runs no BM25 search; 0.0 is BM25-only and runs no vector search, so the query is not embedded. Absent: unweighted reciprocal-rank fusion, the recall this table describes. A value outside the range is 422 INVALID_BODY, details: {"field": "alpha", "minimum": 0.0, "maximum": 1.0}. |
Query variants (query_variants_v1). Every variant is embedded in the same embedding
call as query, so variants add no embedding round trip. Each variant then gets its own vector
list and its own BM25 list (a non-Latin variant skips the capitalised-entity BM25 expansion), and
those two are fused with RRF. The primary result (the question plus any sub-queries and HyDE
passages) is built exactly as it is without variants. A second stage then merges the primary list
with each variant list. That stage is fixed server-side and is not a request field:
interleave(the default): a rank-wise round-robin, primary first, with duplicates removed by id. Rank 0 of each variant list lands in the top1 + number of variantspositions.depth_cap: RRF (k = 60) over the top 10 of every list, followed by the rest of the primary list in its own order. A variant takes at most 10 positions.
Variant lists are never fed into the primary RRF at full depth. When they are, a hit that only
one variant finds scores below every item that both lists find at a middle rank, and it drops out
of the pack. Operators can select the mode with CORTEX_QUERY_VARIANTS_FUSION
(interleave, depth_cap, or deep_rrf, the negative control used in evaluation) and
CORTEX_QUERY_VARIANTS_DEPTH (N for depth_cap, default 10). Entity grounding counts a match
on any anchor from the query or from any variant, so one phrasing's capitalised word cannot clear
a pack that another phrasing filled. The cross-encoder rerank still scores against query. A
request whose query_variants is absent, [], or holds only duplicates of query returns the
same bytes as before Q1. /v1/recall/stream applies the same rules. /v1/answer does not take
query_variants.
Language hints (recall_language_v1). The BM25 query strips stopwords with a list chosen
from the hint:
en,hi,hi-Latn,hi-*, and every query without alanguagehint: the English list, byte for byte as before.fil,id,vi,und-*and every other language: nothing is stripped.- A
scriptshint withoutLatnstrips nothing.
A hi-Latn hint does not change the stoplist in Release 1. Two Hinglish lists were measured on
the text-embedding-3-small Hinglish pilot (45 queries) and both lost recall when hinted: the
plan's list (English plus hai, ka, kya, tha, ..., minus is, do, so, the, in, her) cost
Hinglish-over-Hinglish R@5 1.0 → 0.944, and the English list minus is, do, so, the, in, her
alone cost Latin queries over Devanagari memories R@5 0.456 → 0.433 and English queries over
Hinglish memories 0.933 → 0.911. Send "language": "hi-Latn" for what it does do (an
advisory, not empty, pack on an entity-grounding miss), not for a stoplist change. Query variants
resolve their own language/script the same way. Stoplists shape the query only; indexed
documents are unchanged and no index is rebuilt.
Advisory entity grounding. When the query names a capitalised entity that no retrieved memory contains, recall normally returns an empty events layer ("we have no record of Initrode"). The gate is instead advisory, keeping the pack and its derived layers, when the anchor cannot match by construction:
| Reason | When |
|---|---|
non_en_hint | the request's language is not English |
non_en_variant | a query variant's language is not English |
script_mismatch | a retrieved memory uses a script that the query, its variants and scripts do not ("Priya" asked over प्रिया) |
scope_census | the scope's subtree holds memories tagged non-English by C1 ("Mom" asked over Hinglish "mummy" memories) |
An advisory pack carries warnings: ["entity_grounding_advisory: query entities [...] not found in retrieved memories; pack kept (<reason>) - results may be about a different entity"], and
diagnostics.filters_applied (under summary/full) gains entity_grounding:advisory:<reason>.
An English question over an all-English scope is enforced exactly as before, and a pack without a
warning has no warnings key. The census is built from live captures and one lazy background scan
of the scope's WAL history, so the first recall after a restart may still be enforced before the
scan finishes.
Id-like words. The gate reads no id-like word as an entity, and reads the words after one as it
would without it: a word bracketed whole ([x], <x>, {x}), or one holding a digit, :, _ or
/ (run and event ids such as run:… and evt_…, scope paths, URLs, numbers, UUIDs and ULIDs).
So "<marker> What is on the launch checklist?" names no entity (sc.37 and earlier read the word
after the marker as one, and the pack came back empty). A capitalised name beside an id still
counts.
Question words and lead-ins. A question word, auxiliary or modal (what, which, who,
whom, whose, when, where, why, how, am, is, are, was, were, do, does,
did, has, have, had, can, could, will, would, shall, should, may, might,
must, also in a contraction such as What's or Isn't) is never an entity, wherever it stands.
A : ends a sentence, and so does a list marker (-, *, •, 1., 1)) that opens the query or
a line, so the capitalised word after either reads as a sentence's first word, as one after a full
stop does. "Quick question: What is on the launch checklist?" and "- What is on the launch checklist?" therefore name no entity; sc.37 and earlier read "What" as one and came back empty.
The same rules make a name right after a colon or a marker ("Owner: Priya"), and the name Will,
no entity. Variants are read the same way.
Diagnostics side-table (recall_diagnostics_v1, diagnostics=full only). diagnostics
gains four keys. None of them appears under none or summary:
| Key | Shape | Meaning |
|---|---|---|
items | array | One row per returned event, in layers.events order, then ranked-but-not-returned events (at most 200 rows in total). Each row has event_id (evt_…) and final_rank (its position in layers.events, null if it was not returned). Optional fields: fused_rank (position in the primary RRF), variant_fused_rank (position after the variant merge), channels (vector, bm25, fact, semantic_fact → {rank, score?}), variants[] ({index, vector_rank?, bm25_rank?, fused_rank?}), matched_via[] (primary, variant:N, graph, recency or outside_ranked_pool) and reorder (stage → {from, to} for each stage that moved the event: variant_fusion, graph_boost, graph_splice, recency_supplement, lexical_ordering, salience, session_balance, rerank). Chunk and derived-row hits are folded onto their source event. |
drops | array | {event_id, reason} for ranked events that were not returned. reason is one of time_range, dedupe, fact_cap, fact_validity, empty_content, grounding, temporal or metadata. floor (below the assembly relevance floor) and no_wal (no WAL row to hydrate) are reserved, not emitted yet: the schema accepts them, but no server hook records them today, so a drop of either kind is simply absent from drops. |
channel_lists | array | {channel, variant?, len} for each ranked list the ranks refer to. |
items_truncated | int | Rows left out by the 200-row cap. A returned event is never left out. |
All ranks are zero-based. A score compares only within its own list.
Response: the stratified pack (§9). Its pack_id lets /v1/answer and /v1/compose reuse
the pack for 60 seconds (use_pack_id). With consistency the pack's own fields are followed by
the consistency fields (§8.3.2). A request that sent view: "local" gets the header
Warning: 299 - "view=local is an alias for view=granular; the response echoes granular". The
event stream is POST /v1/recall/stream with the same body (§10.1).
Admission and retries. At most CORTEX_RECALL_MAX_CONCURRENT recalls run at once (default
1.5 times the cores, at least 8); one that waits longer than CORTEX_RECALL_QUEUE_TIMEOUT_MS
(default 2,000; 0 sheds at once) for a permit answers 429 RECALL_OVERLOADED with
Retry-After: 1, and nothing ran. A profile: "voice" recall, and a session start (§8.3.3),
waits at most CORTEX_RECALL_QUEUE_TIMEOUT_MS_VOICE (default 100, never longer than
CORTEX_RECALL_QUEUE_TIMEOUT_MS, so 0 sheds voice at once too) instead: a live turn sheds fast and
answers without memory rather than wait. The permits are one first-in, first-out queue: a voice
recall waits behind every recall already queued, standard ones included, and sheds at its own limit,
so under a queue a voice turn is the first to shed; a deployment that mixes live turns with heavy
recalls sizes CORTEX_RECALL_MAX_CONCURRENT for both. One evidence deadline bounds the request,
CORTEX_EVIDENCE_TIMEOUT_MS (default 120,000, clamped to 100 to 300,000). A run that loses a race
with an authorization change at the scope, at an ancestor or (for a view that reads descendants)
below it runs again from a fresh snapshot, at most three runs within the deadline; only the last
run's refusal reaches the client. While the server's memory is high (one reading at 85% of its
limit enters the state, three at or below 75% leave it; GET /v1/admin/metrics memory), recalls
run at half their usual concurrency (503 MEMORY_PRESSURE, details.kind: "busy_recall", refused
before the body is read), and a recall whose subtree pass would engage, or that asks for
budgets.max_tokens over 16,000, is refused after every other check (subtree_recall,
large_recall); each refusal carries Retry-After: 10, details.memory_ratio and
details.retry_after_seconds. Hosted plans count the request as one of the month's recalls
(402 PLAN_LIMIT_REACHED), and the subtree limiter as one read at scope, however many scopes it
reads (429 SUBTREE_RATE_LIMITED, §6.5).
Errors (/v1/recall; /v1/recall/stream answers the same codes except RECALL_OVERLOADED
and busy_recall, and reads its body as JSON: 415 UNSUPPORTED_MEDIA_TYPE, 400 INVALID_BODY for
a syntax error):
| Status | Code | When |
|---|---|---|
| 402 | PLAN_LIMIT_REACHED | hosted plans (CORTEX_PLANS): the month's recalls are used up (details.limit: "recalls_month") |
| 403 | POLICY_DENIED | the caller may not read scope, an extra scope or a mounted scope it named, lacks the view's traversal capability or diagnostics.read, or lost access before the pack was delivered |
| 403 | APP_NOT_ADMITTED | the chain's application is not admitted at scope or an extra scope (DB-18) |
| 403 | BREAK_GLASS_REQUIRED | the operator key under CORTEX_OPERATOR_DATA_READS=deny without the break-glass header (§8.15.3) |
| 408 | WAIT_TIMEOUT (retriable) | consistency.at_least was not reached in time (§8.3.2) |
| 409 | SUBTREE_RECALL_DISABLED | the body carries subtree while CORTEX_SUBTREE_RECALL is off |
| 422 | INVALID_BODY | a body that does not parse (details.part, details.reason, details.field_path), an unknown field, a pagination key (limit, offset, page, cursor, page_size), stream: true, a field whose capability is not listed (details.unsupported_fields, details.required_capabilities), a bad hint, variant, filter, newest_of_kinds or subtree value, coverage with subtree (details.field) |
| 422 | INVALID_EXTRA_SCOPES | see extra_scopes |
| 422 | INVALID_MOUNTS | see mounts (§8.3.2) |
| 422 | VIEW_NOT_ALLOWED_AT_SCOPE | a walking view at a shared org-tree scope (details.view, details.scope_kind, details.allowed_views) |
| 422 | UNPARSEABLE_TEMPORAL | temporal.natural does not parse under natural_mode: "strict" |
| 422 | CONSISTENCY_TOKEN_INVALID | consistency.at_least is not a token this deployment issued for this root (§8.3.2) |
| 429 | RECALL_OVERLOADED (retriable, Retry-After: 1) | no execution permit in time |
| 429 | SUBTREE_RATE_LIMITED (retriable, Retry-After) | the subtree's read budget (CORTEX_SUBTREE_RATE_LIMITS), or the application's requests_per_minute |
| 500 | INTERNAL_ERROR (retriable) | the engine failed |
| 503 | MEMORY_PRESSURE (retriable, Retry-After: 10) | above |
| 503 | AUTHORIZATION_STATE_CHANGED (retriable) | an authorization change reached the read after its runs were spent |
| 503 | EVIDENCE_UNAVAILABLE, EVIDENCE_ADMISSION_TIMEOUT, EVIDENCE_SATURATED (retriable) | the evidence lane failed, did not admit the read in time, or is full; since 0.14.0 EVIDENCE_UNAVAILABLE also when the registered temporal phrases temporal.natural is matched against did not read (§8.17) |
| 503 | SUBTREE_BUSY (retriable, Retry-After: 1) | the ranked subtree lane (§8.3.1) |
| 503 | NOTICE_UNAVAILABLE | the read must tell someone first and the notice did not commit (§8.3.2) |
| 503 | WAL_UNAVAILABLE (retriable) | the shard's state could not be read for a consistency token |
| 503 | SCOPE_STORAGE_UNAVAILABLE (retriable since 0.14.0) | the scope registry could not answer the authorization |
| 504 | EVIDENCE_TIMEOUT (retriable) | the read outlived its evidence deadline |
8.3.1 Ranked recall across customers (subtree; xscope, flag-gated, new in 0.10.4, experimental)
A recall at a parent scope (org:acme) reads the scopes under it (org:acme/user:*) in storage
order, not by relevance (the pack says so, §9). A request that carries subtree asks for one
relevance-ranked pass across every authorized child scope instead:
{
"scope": "org:acme",
"view": "descend",
"query": "financing and EMI questions",
"subtree": {"per_subject": 2, "max_subjects": 40, "tags": "alias"}
}
subtree field | Notes |
|---|---|
per_subject | Events per customer in the pack, 1-8 (default 2). |
max_subjects | Customers in the pack, 1-200 (default 40). |
tags | How each context line names its customer: alias (default, a stable pseudonymous C- alias), scope (the scope path relative to the request scope, user:u1) or none. |
Gate. The field needs CORTEX_SUBTREE_RECALL=request; otherwise the request answers
409 SUBTREE_RECALL_DISABLED, even for "subtree": null. The capability name
subtree_recall_v1 is known but not advertised in 0.10.4 (see "Detecting support" in §8.4.2).
The ranked pass then runs only when every engagement condition holds; when one fails, the response
is today's pack plus the warning subtree_recall_unavailable: <reason> and no subtree field,
never a partial ranked pack:
| Reason | Meaning |
|---|---|
view_not_subtree | view is neither holistic nor descend |
scope_read_descend_required | the caller lacks scope.read.descend on the scope |
subtree_recall_off | the flag is off (internal callers only; the route answers 409 first) |
no_authorized_descendants | no authorized descendant scope holds data (a leaf, or nothing readable) |
no_authorization_index | no route-computed descendant authorization (internal callers only) |
scope_partition_map_pending | the scope-partition map is still building after a restart |
unsupported | the coordinator or engine cannot run the pass (a native host, a legacy store) |
filter_scan_incomplete / filter_cohort_too_large | the request's metadata filters could not be resolved to an exact candidate set in time, or select more than 50,000 events |
query_required | the request has no query text to rank by |
subtree_too_large | the authorized subtree holds more than CORTEX_SUBTREE_EXACT_VECTOR_MAX vectors (default 1,000,000), counted before any scan; this build has no approximate strategy for larger subtrees |
What runs. One embedding batch (the query and up to four query_variants); a vector pass
scored exactly over every authorized child partition, best per_subject hits per partition (on
its own small worker pool, never the leaf search pool; it checks CORTEX_SUBTREE_DEADLINE_MS
inside its scan); one BM25 query restricted to the authorized scopes; reciprocal-rank fusion; then
the events are balanced per customer (customers in order of their best fused rank, round robin,
at most per_subject each). Metadata filters (filters) select an exact candidate set first and
only those events are scored. Every event is hydrated with the leaf recall's own checks plus the
per-event erasure markers. The storage-order walk, the exhaustive probe and the recency tail do
not run. At most CORTEX_SUBTREE_MAX_INFLIGHT passes run at once (default 2).
Response. The usual pack (§9) plus subtree:
"subtree": {
"mode": "ranked", "complete": false,
"subjects_authorized": 300, "subjects_with_candidates": 52,
"subjects_in_pack": 13, "events_in_pack": 26, "vector_strategy": "exact_scan",
"subjects": [{"alias": "C-4F2AQ7M", "scope": "org:acme/user:u1", "events": 2, "best_rank": 0}]
}
complete is always false: a ranked pack is a sample, never a complete list (count and list
questions belong to the exact lane, §8.4.3). vector_strategy is exact_scan or filter_first
(exact scores of the filtered candidates). Each context_block line names its customer after the
time bracket, [2026-06-15 08:30 UTC] [subject C-4F2AQ7M] text (the bracket is server-made; a
[subject …] written inside an event's own text is not one), and layers.events[].scope is the
real scope. A multi-chunk event lists the chunks the pass matched in matched_fragments (§9.4).
Errors. 503 SUBTREE_BUSY (retriable, Retry-After: 1 on /v1/recall, /v1/recall/stream before the stream
starts, and /v1/answer's cohort lanes, as on the cohort routes; /v1/compose engages no subtree pass): the in-flight cap was still
full at the deadline, or the pass outlived CORTEX_SUBTREE_DEADLINE_MS. 503 EVIDENCE_UNAVAILABLE
(retriable): a storage read of the pass failed; a partial ranked pack is never returned.
422 INVALID_BODY (details.field: subtree.per_subject or subtree.max_subjects): a value out
of range. subtree does not combine with extra_scopes (422 INVALID_EXTRA_SCOPES), with
newest_of_kinds or coverage (422 INVALID_BODY), or with mounts (422 INVALID_MOUNTS,
details.reason: "not_combinable"). While the server's memory is high a pass that would engage is
503 MEMORY_PRESSURE (details.kind: "subtree_recall", Retry-After: 10); a request the route
already refused (a view that is not holistic or descend, no scope.read.descend) serves
today's pack and is not refused.
8.3.2 Read sets, coverage and consistency tokens (extra_scopes, mounts, coverage, beliefs, consistency; 0.14.0)
Capability: extra_scopes_v1 and extra_scopes_40_v1, recall_mounts_v1,
recall_coverage_v1, beliefs_merged_v1, consistency_tokens_v1, each listed by this release's
GET /v1/admin/version. The fields need no capability beyond the read's own (§8.3).
A recall's read set is its scope (with the scopes its view walks), each entry of
extra_scopes, and, with mounts, the scopes its application's mounts reach. These five fields
widen the read set, report on it, and order it after an earlier response, on /v1/recall,
/v1/recall/stream, /v1/answer and /v1/compose alike (the two model routes apply them to
every recall pass they make). A field whose capability the server does not list is
422 INVALID_BODY (details.unsupported_fields); a request without them is answered byte for byte
as before.
POST /v1/recall
{
"scope": "org:initech/user:alice",
"query": "Where did we land on the vendor contract?",
"extra_scopes": ["org:initech/team:procurement", "org:initech/source:slack/container:c-legal"],
"mounts": "default",
"beliefs": "merged",
"coverage": true,
"consistency": {"at_least": "ct1.eyJyIjoib3JnOmluaXRlY2gi…"}
}
| Field | Type | Notes |
|---|---|---|
extra_scopes | array of scope paths | Up to 40 more scopes (8 on a server that does not list extra_scopes_40_v1) in the tenant subtree of scope, each read exactly and authorized as a direct granular recall of it: one the caller may not read refuses the request with that recall's 403, coverage or not. Repeats and scope are dropped first; a list of at most 8 is judged against 8, a longer one against 40 (422 INVALID_EXTRA_SCOPES, details.max_items the bound used). The scopes are searched in parallel, each with its own top-k; a read set of more than 9 scopes shares the depth 9 lists would have, at least 8 deep each, so 40 scopes hand fusion and rerank about the candidates 9 do. A lane that reads scope alone (the small-scope probe, an order: "recency" tail) reads none of them, and with coverage each is a gap bound. Not with subtree or cohort, nor beside newest_of_kinds (422 INVALID_BODY, details.reason: "newest_of_kinds_with_extra_scopes"). |
mounts | "default" | The chain's application's mounts join the read set: the token's app claim names the application, whose record (<tenant>/app:<id>) and its companion list the mounts. Each mount must be admitted for the application by an apps entry now, and lie outside every private region; one that is not is dropped and named in warnings as mount_not_admitted: <path> (on /v1/answer and /v1/compose in their own warnings field; on /v1/recall/stream in a warnings frame). A scope mount is read exactly. A prefix mount reads the containers under it the chain may read, most recently registered first: the non-private ones, and the private ones whose roster names the chain's person, directly or through a set the person belongs to, never through a grant, a head or the application alone. Each is authorized as a direct granular read: a scope mount the chain may not read is dropped (gap not_authorized, no warning), a container it may not read is left out and not reported, and a registry that cannot answer fails the request. Mounted scopes fill extra_scopes up to its bound of 40 (8), the explicit ones first; with coverage each one left out past the bound that the chain may read is listed as authorized with a gap bound, or private_unexpanded for a private container (without coverage nothing past the bound is evaluated). 422 INVALID_MOUNTS (details.field: "mounts"): details.reason no_app (the chain carries no app), app_unknown (the app has no record in the tenant) or not_combinable (with subtree, cohort, or an order: "recency" the request sends; an order /v1/answer infers is not one). On the recall routes not_combinable is checked with the other validations and the other two once the scope and the extra scopes are authorized; on the model routes all three after authorization. Beside newest_of_kinds: 422 INVALID_BODY, details.reason: "newest_of_kinds_with_mounts". Every run resolves the mounts again, and no answer over mounts is cached. |
coverage | bool | The response carries coverage: what the read searched, what of its read set the caller may read, and each difference with its reason (below). It observes only: the pack is the one the request without it gets. /v1/answer and /v1/compose report the union of their recall passes (a certified reducer's answer runs none and carries none); /v1/recall/stream sends a coverage frame. With subtree or cohort: 422 INVALID_BODY, details.field: "coverage". An answer that asks for it is never served from, nor stored in, the answer cache. |
beliefs | "stored" | "merged" | stored (the default) serves the stored beliefs, one per scope and topic. merged, when extra_scopes is not empty, rebuilds for this reader the beliefs of the pack's topics (at most 64, in rank order) from the facts of every scope of the read set the reader may read (at most 256 a topic, the newest), replaying the resolver's supersession across the scopes in the order the facts were learned, so a decision made in one scope, reversed in a second and revised in a third reads as one history. A rebuilt belief takes the rank of its topic's best-ranked stored belief and replaces the others; it carries rebuilt: true, an id over the sorted ids of the stored beliefs it merges, the scope of the fact its claim comes from, a revision_count of the superseded facts of its history and a why_url (/v1/beliefs/why?belief_id=…&scope=…&merges=…&scopes=…) that re-runs the rebuild for a caller who may read every scope it names. A topic whose facts lie in one scope is served as stored; what the bounds leave unmerged is the gap rebuild_cut; a rebuild that cannot read its facts serves the stored beliefs and names derived_beliefs_merged in diagnostics.degraded_sources. Over one scope, and with subtree or cohort, merged serves the stored beliefs. A rebuilt belief passes the filters a stored one does. An answer that asks for merged is never cached. |
consistency | object | {} asks for a consistency token on the response; {"at_least": "<token>"} also waits, before the read is authorized and run, until this node's registry has reached the token's revision and its indexer has indexed below its offset (§6.11). The wait is bounded by CORTEX_CONSISTENCY_WAIT_MS (default 10,000, at most 30,000) and by the request's own deadline: past it, 408 WAIT_TIMEOUT (retriable; details.waiting_on registry, indexer or declared, details.waited_ms), and nothing was read. A token that does not decode, names another root, or names a revision or offset this server never committed is 422 CONSISTENCY_TOKEN_INVALID at once (details.reason malformed, other_root or ahead_of_commit). A token of another incarnation or epoch (after a restore or a move) is ignored, and the response says consistency_reset: true. A field other than at_least is 422 INVALID_BODY. |
Consistency fields. A response to a request that sent consistency ends, after its own
fields, with these (on /v1/recall/stream in the done frame, after pack_id; a streamed answer
or composition waits for at_least and carries none):
{
"pack_id": "pack_01JB…",
"...": "the pack's own fields",
"consistency_token": "ct1.eyJyIjoib3JnOmluaXRlY2giLCJpIjoi…",
"derived_through": 48213
}
consistency_token is opaque (ct1. and unpadded base64url): a later read with
consistency.at_least of it sees at least what this response saw; it is a lower bound, never an
authorization. consistency_reset: true says the demanded token was of another incarnation or
epoch and was ignored, and access_restored_at beside it, when the token predates a restore of
the root that serves again, says when the restore was marked. derived_through is the log offset
LLM-derived layers had reached on the serving node when its enrichment last finished a pass
(absent before one, and where enrichment does not run). 503 WAL_UNAVAILABLE (retriable) says the
shard's state could not be read to check or issue a token.
Coverage.
"coverage": {
"searched": {"scopes": ["org:initech/user:alice", "org:initech/team:procurement",
"org:initech/source:slack/container:c-legal"],
"scopes_total": 3, "partitions": 3, "truncated": false},
"authorized": {"scopes": ["org:initech/user:alice", "org:initech/team:procurement",
"org:initech/source:slack/container:c-legal"],
"scopes_total": 3, "truncated": false},
"gaps": [
{"scope": "org:initech/source:jira", "reason": "mount_not_admitted"},
{"scope": "org:initech/source:slack", "reason": "watermark"}
],
"watermarks": [{"source": "org:initech/source:slack", "at": "2026-11-01T06:00:00Z"}]
}
searched lists the scopes and counts the vector partitions the read searched; authorized
lists the read set's scopes the caller may read; gaps[] names each difference once per scope and
reason. The home scope stands for every scope its view reads: a gap in its ancestors or
descendants names the home (segment_unreachable names the root). Each list holds at most 1,000
scopes with its total and truncated; past 1,000 gaps, gaps holds the first 1,000 and
gaps_truncated: true and gaps_total say so. An answer that read in several passes merges their reports before
the cap: scopes_total and gaps_total count every scope and gap of every pass, and a list cut in any pass stays
truncated. watermarks[] lists, once per source, the last
completed sync of each source a scope of the read set belongs to (PUT /v1/access/watermarks;
absent until a source reports one).
| Gap reason | When |
|---|---|
bound | a bound left the scope out: an extra scope a lane that reads scope alone skipped (the small-scope probe, an order: "recency" tail), or a mounted scope past the read set's bound that the caller may read (listed as authorized) |
private_unexpanded | a private container a prefix mount reached through the person's own membership, left out past the bound (listed as authorized) |
not_authorized | a scope mount the caller may not read, dropped |
mount_not_admitted | a mount no apps entry admits for the application now (also a warnings note) |
segment_unreachable | old data in a segment the read could not read in time (named by the root; the pack also warns segments_unreachable) |
rebuild_cut | a beliefs: "merged" rebuild's bounds (64 topics, 256 facts a topic) left this scope's beliefs unmerged |
watermark | a source of the read set whose watermark (its last completed sync) is older than CORTEX_SOURCE_WATERMARK_MAX_AGE_S (86,400 when unset or unreadable; clamped to 60 seconds to 30 days, so no value turns it off), named by the source |
container_cap | a source whose last sync left containers out at its containers_per_source (left_out counts them) |
deadline | an expansion's scan outlived its deadline (CORTEX_READ_SET_EXPANSION_DEADLINE_MS) and nothing it read was used; no request fills an expansion in this release, so it does not occur yet |
Notices (access_notices_v1). A read that must tell someone commits the notice before it
delivers anything, or answers 503 NOTICE_UNAVAILABLE and delivers nothing. Every production
router decides these by its grant rules (DB-17): a Detail read, at Reader, of a person's work
compartment (a version-2 chain compartment, the person's aud:work) by a reader admitted there
only through a grant naming it tells the compartment's person. The scope and each extra scope are
told before the read runs; a row whose home or atom is such a compartment is told before the
response is released, and a stream withholds a row whose notice is not committed yet. Repeats
within the hour are one notice. The operator key's break-glass read of a private region tells the
region's people (§8.15.3). details.reason: moving (the root is sealed for a move; retry after
it), limit (the root holds 250,000 notices; retry once older ones are dropped),
arming_disabled (the operator's format ceiling holds the shard below format 8; not retriable
until it is raised), reserved_path_in_use (a record at a reserved path holds the shard below
format 8; not retriable until the operator migrates its events out and deletes it; since 0.14.0,
it was reported as members_behind), members_behind (a member is not armed yet;
Retry-After: 30) or refused (the proposal failed; details.refusal names its code; retry).
Errors: 403 (an extra or mounted scope's own POLICY_DENIED or APP_NOT_ADMITTED),
408 WAIT_TIMEOUT (retriable), 422 INVALID_BODY (a field whose capability is not listed;
coverage with subtree or cohort; newest_of_kinds beside extra_scopes or mounts; a
malformed consistency), 422 INVALID_EXTRA_SCOPES, 422 INVALID_MOUNTS,
422 CONSISTENCY_TOKEN_INVALID, 503 NOTICE_UNAVAILABLE (retriable but arming_disabled and reserved_path_in_use),
503 WAL_UNAVAILABLE (retriable), 503 SCOPE_STORAGE_UNAVAILABLE (a mount's registry check).
8.3.3 Voice call sessions (/v1/sessions; voice_sessions_v1, experimental)
A voice call keeps its caller's memories in RAM for the call: the call's working set. Flag-gated:
the routes below answer 409 VOICE_SESSIONS_DISABLED (details.flag: "CORTEX_PROFILE") unless the
server runs in voice mode (CORTEX_PROFILE=voice), and voice_sessions_v1 is listed on
GET /v1/admin/version only then. Sessions and working sets live on the node that serves the scope,
in memory only: nothing is persisted or replicated, so a restart or, on a cluster, a leader change
loses them. The next voice recall naming the session opens it again there (the status and end routes
answer 404 SESSION_NOT_FOUND, retriable, meanwhile), and its recalls are served by the index until
its working set has loaded again. On a cluster the ingress routes all three by the scope's root to
that shard's leader.
A session is its principal's. It is keyed by its scope, its id and the principal chain that
started it (the token's issuer and subject, the agent acting for it and its application; the trusted
operator is one principal). Another caller naming the same id at the same scope holds a session of
its own, and GET /v1/sessions/{session} and POST …/end answer 404 SESSION_NOT_FOUND to anyone
but its principal, so no caller can see, extend, shorten, take over or end another's call (an Owner of
the scope and the trusted operator may end every principal's session of an id). A voice recall naming
a session opens it again as its own caller's: such a session ends after 120 s without a recall
(CORTEX_SESSION_IDLE_TIMEOUT_S when that is shorter), unless a start names it.
The working set. The visible events homed at exactly the scope (what a granular read reads),
read from the stored events rather than the index, each with its chunks in an in-memory BM25 (the
index's tokenizer, BM25 over the set's own statistics) and its chunk vectors in an exact int8 scan
rescored against binary16 rows (a sign-bit scan or a graph is selectable with
CORTEX_SESSION_VECTOR_SEARCH; a set above CORTEX_SESSION_EXACT_MAX_VECTORS, 200,000, uses the
graph, built in parallel shards). A vector comes from the chunk index; a row the index has not reached yet is embedded by the
server's embedder when it is fast (one turn's call, up to 8 inputs, within
CORTEX_SESSION_INLINE_EMBED_MS, 5 ms), and is otherwise found by BM25 and recency until its
vector arrives. A POST /v1/recall with profile: "voice" of the scope is served from the set
when it is ready, and its Server-Timing header (for a caller who may see it, server_timing
in §8.3) ends src;desc="working_set" with the set's own stages (working_set.embed,
working_set.refresh, working_set.vector_search, working_set.bm25_search,
working_set.fusion, working_set.hydrate); the pack is the recall's pack, built from the set's
ranked events by the same assembly, and every row passes the request's delivery checks (atoms,
labels, notices, the read-time use rule) as on the index path. The set ranks by the index path's
rules (§8.3: the same depths, fusion, alpha, ties broken by id, identical texts kept once, the same
number of candidates), and a long event that does not fit the budget is cut to the chunks its lists
matched, which matched_fragments names, as on the index path. So the two paths differ only where
their data does: the set's BM25 scores with the set's own term statistics, where the index's are
the whole index's (CORTEX_SESSION_LEXICAL=index asks the index instead), and its vector list is an
exact int8 scan rescored against the binary16 rows where the index's scans the scope's 2-bit codes
(TQ2, the default) and rescores them against the same rows. A recency cue reads the newest events
by their observed_at from the set and by capture from the index, which differ only for a
back-dated import. A voice recall with filters, a
temporal field, extra_scopes, mounts, coverage, query_variants, an order,
prefer_exhaustive, newest_of_kinds, subtree or diagnostics: "full" takes the index path.
A voice recall demanding a consistency token (consistency.at_least) reads every write the token
covers, from the set or the index.
Freshness. The set has no timer: before every read it checks, without a lock, that nothing it
depends on moved (the read-visibility revision every removal moves, the forgotten-event markers, the
newest stored write, the server's cache clears and, on a cluster, the root's placement), and repairs
itself in place when something did: a forget, an erasure, a redaction, a cancel, a retention sweep and
a seal to the segment store re-read the events they name; a change over the whole scope (a scope
forget, an early-answered erasure's fence, a re-derivation) rescans it while the index serves; new
writes are read in by their position. A removal still running withholds the events it names (the
whole set, for one over the scope). A recall that starts after a removal answered never serves the
removed row. A row naming an event the set does not hold visible (a preceded_by link or a
supports: label, which an erasure scrubs from the rows that cite what it erased) is read from the
stored events when it is served, never from the set's copy. A read catches up at most 1,024 new
stored rows itself; past that it is served by the index while the rest are read in the background. A
write acknowledged with wait=captured joins the set of its scope at once (for a
request of up to 16 events), so the same call's next recall finds it; larger batches arrive by the
next read. An event moved into the scope from another home is found by the index until the set is
rebuilt.
Memory. Every working set together stays under CORTEX_SESSION_MAX_BYTES (default a tenth of
the memory limit, at most 8 GiB), a set still loading included: a set that does not fit is not loaded
(working_set.state: "refused"), and the least recently used set goes first when one must. A call's
set holds at most a quarter of that budget (a pinned scope's, all of it), counted as it loads: one
past its share stops loading and its scope is served by the index (too_large), as is a scope whose
load reads more than CORTEX_SESSION_MAX_EVENTS (20,000) stored events, its own and those of every
scope under it. Event text is held up to CORTEX_SESSION_TEXT_MAX_BYTES (2 MiB) per set; an older
hit is read from the stored events. While memory is high no set loads or rescans, and the
memory-pressure monitor cancels the loads running and sheds the least recently used sets (§8.15).
The scopes in CORTEX_VOICE_PINNED_SCOPES (a comma list, for an agent's shared knowledge
base) are loaded at boot, one at a time in the order listed, on a lane of their own (a call's set
never waits behind one), each on up to half the node's cores, at most 8 (readiness waits for their
first load, checks.voice on
GET /v1/admin/ready, for at most CORTEX_VOICE_READY_WAIT_SECS, 60 s after the start; past it
the node is ready and degraded while they still load, and their recalls take the index path),
held up to CORTEX_VOICE_PINNED_MAX_EVENTS (1,000,000) events and never
evicted. A set with no session goes after CORTEX_SESSION_IDLE_TIMEOUT_S (900 s).
GET /v1/admin/metrics reports it under sessions (WorkingSetStatus), GET /metrics as
cortexdb_sessions, cortexdb_working_set*.
Limits. A node holds CORTEX_SESSION_MAX_SESSIONS sessions (10,000), a tenant (the scope's
first CORTEX_TENANT_DEPTH segments) CORTEX_SESSION_MAX_PER_TENANT of them (a quarter of the
node's) and a principal chain CORTEX_SESSION_MAX_PER_PRINCIPAL (a tenth; the trusted operator is
not counted). A start past any of them is still answered, 200 with its brief: working_set.state
is refused, warnings names session_not_held: <the limit>, no session is held, and the call's
recalls take the index path, as does a voice recall naming a session it cannot open. A start holds a
recall permit only while its brief recalls run (it waits for one as a voice recall waits), never
while it waits for the working set, and while memory is high it is admitted as a recall is, at half
the permits (503 MEMORY_PRESSURE, retriable, past them).
POST /v1/sessions
Capability: as for a granular POST /v1/recall of scope (scope.read.local, Reader on its
roster on a per-actor token). The route reads stored rows: under CORTEX_OPERATOR_DATA_READS=deny
the operator key needs the break-glass header (§8.15.3).
{
"scope": "ws:acme/caller:9f2c1e",
"session": "call_01JF8M2Q7R",
"profile": "voice",
"brief": { "max_tokens": 400, "query": "billing question", "include": ["events", "facts", "beliefs", "episodes"] },
"deadline_ms": 300,
"idle_timeout_s": 900
}
| Field | Type | Meaning |
|---|---|---|
scope | string | The caller's scope. |
session | string | The call's id, 1 to 256 bytes with no control character: the session its voice recalls name and its turns carry (a session:<id> label). |
profile | "voice" | Optional; the only profile. |
brief.max_tokens | integer | The brief's budget, 1 to 4,000 (default 400). |
brief.query | string | The reason for the call: its top memories join the brief. |
brief.include | string[] | events, facts, beliefs, episodes (default all four); facts, beliefs and episodes only where enrichment derives them. |
deadline_ms | integer | 1 to 10,000 (default 300): past it the start answers with what it has, brief.partial: true. |
idle_timeout_s | integer | 30 to 14,400 (default CORTEX_SESSION_IDLE_TIMEOUT_S, 900): the session ends after this long without a recall or a start naming it. |
It authorizes the scope as a recall does, opens the session (its working set starts loading in the
background) and reads the brief: the scope's newest events and, with brief.query, a ranked voice
recall, both through the recall route's own checks, so every row the brief holds is one the caller may
be served. The brief makes no model call. Answer 201 (200 for a start repeated with the same scope,
session and principal, which keeps the session and reads the brief again, or for one this node does
not hold, Limits above):
{
"session": "call_01JF8M2Q7R",
"scope": "ws:acme/caller:9f2c1e",
"started_at": "2026-11-12T15:05:00Z",
"expires_at": "2026-11-12T15:20:00Z",
"last_used_at": "2026-11-12T15:05:00Z",
"working_set": { "state": "ready", "pinned": false },
"brief": {
"no_prior_history": false,
"prior_sessions": 47,
"last_session": "call_01JE…",
"last_session_at": "2026-11-10T14:02:11Z",
"context_block": "[2026-11-10 14:02 UTC] [user] …",
"items": [
{ "id": "evt_…", "kind": "event", "text": "…", "observed_at": "…", "session": "call_01JE…", "role": "user", "source": "ranked" }
],
"current_values": [],
"partial": false
},
"warnings": ["current_values_need_enrichment: …"]
}
working_setis the set'sstateandpinned. Itsevents,bytes,loaded_at,load_msanderrordescribe the whole set before any reader's checks, so only the trusted operator is served them (GET /v1/admin/metricssessionshas the node's totals).context_blockholds the current values first, then each item as a recall renders an event ([time] [role] text), withinbrief.max_tokens; an item cut to fit is markedtruncated: true. Items found for the query come first (source: "ranked"), then the newest events ("recent").current_valueslists current facts and beliefs only where enrichment derives them at the scope; otherwise it is empty andwarningsnamescurrent_values_need_enrichmentonce.prior_sessions(distinct earlier sessions),last_session,last_session_atandno_prior_history(no visible event outside this call's session) are counted over the rows the caller may be served: from the working set when it is ready withindeadline_ms, otherwise from the newest events alone, withpartial: trueandprior_sessions_partialinwarnings. Counting a row commits no access notice: only the rows the brief serves are reads.warningsalso carriesworking_set_not_loading: <reason>when the set does not load (memory_pressure,budget_full,queue_full,too_large,failed; the call's recalls then take the index path),session_not_held: <the limit>when this node holds no session for the start, and the brief recalls' own warnings (use_rule_withheld: …).
Errors: 403 POLICY_DENIED, APP_NOT_ADMITTED, BREAK_GLASS_REQUIRED;
409 VOICE_SESSIONS_DISABLED; 422 INVALID_BODY (details.field); 429 RECALL_OVERLOADED
(retriable); 503 MEMORY_PRESSURE, AUTHORIZATION_STATE_CHANGED, EVIDENCE_UNAVAILABLE,
EVIDENCE_SATURATED (retriable). A brief recall that runs past deadline_ms is no error: the brief
is partial; neither is a start past the session limits (Limits above).
GET /v1/sessions/{session}?scope=
The caller's own session and its working set's state (its counts for the trusted operator), never a
row; for a caller who may read the scope. 200 with the start's fields but the brief and the
warnings; 404 SESSION_NOT_FOUND (retriable; details.scope, details.session), also for a session
another principal started; 409 VOICE_SESSIONS_DISABLED; 422 INVALID_QUERY (scope missing or not
a scope).
POST /v1/sessions/{session}/end?scope=
Drops the caller's own session's handle; its working set goes when no other session holds it (a
pinned scope's stays). For a caller who may read the scope (403 POLICY_DENIED otherwise). An Owner
of the scope or the trusted operator holding no session of that id ends every principal's session of
it; anyone else is answered 404 SESSION_NOT_FOUND, as for a session that does not exist. An
optional body {"post_call": {"enrich": true}} is accepted: where enrichment is on the call's events
are enriched in the background whether or not the end asks. 204; 404 SESSION_NOT_FOUND;
409 VOICE_SESSIONS_DISABLED; 422 INVALID_QUERY, INVALID_BODY.
8.4 POST /v1/answer — Recall + LLM
Capability: scope.read.local on scope and, on a per-actor token, Reader on its roster; the traversal capability of the view the request names and of the view the answer recalls with (with no view the answer recalls holistic at a scope with authorized descendants, which needs scope.read.holistic; 403 POLICY_DENIED "scope.read.holistic required for view=holistic"); llm.invoke unless skip_answer_llm; scope.read.descend for a cohort answer (§8.4.2). Each extra scope and each mounted scope is authorized as a direct granular read (§8.3.2). There is no diagnostics field: the answer's recall runs at summary when the caller holds diagnostics.read (its phase timings then reach diagnostics.time_ms), else at none. The route reads stored rows: under CORTEX_OPERATOR_DATA_READS=deny the operator key needs the break-glass header (§8.15.3).
/v1/answer shares the recall provenance contract: the same pack_id, provenance, and citations blocks appear in the response. It is recall composed with an LLM call, not a separate opaque endpoint.
Availability. A deployment with no answer LLM configured (no CORTEX_ANSWER_API_KEY and no provider fallback key — see docs/generated/env-vars.md §5) answers 503 ANSWER_UNAVAILABLE, retriable: false, on /v1/answer and /v1/compose. The refusal is deployment-wide and scope-independent, and it is raised after authorization, so a caller that may not read the requested scope still gets 403 POLICY_DENIED and learns nothing about the deployment's LLM wiring. Two escapes: skip_answer_llm: true still returns 200 with the context block and diagnostics.answer_model == "not-invoked" (no LLM is involved on that path), and CORTEX_ANSWER_STUB=1 opts a deterministic context-echo renderer back in for CI and local development — never for production, because its 200 is indistinguishable from a real answer to a client. GET /v1/admin/ready reports the live state under checks.answer (configured, stub, model).
{
"scope": "org:acme/dept:eng/user:alice",
"view": "holistic",
"question": "Did Acme renew?",
"answer_model": "claude-opus-4-6",
"answer_max_tokens": 1500,
"include": ["beliefs", "facts", "episodes"],
"temporal": {"as_of": null, "natural": "last 30 days"},
"filters": {},
"budgets": {"max_tokens": 4000, "per_layer_limits": {"facts": 20, "beliefs": 10}},
"cite_sources": true,
"include_context": false,
"use_pack_id": null,
"skip_answer_llm": false,
"stream": false
}
| Field | Type | Notes |
|---|---|---|
answer_model | string | LLM identifier (provider-routed) |
answer_max_tokens | int | Output ceiling |
use_pack_id | string | null | Skip recall and use a previously generated pack (within 60s TTL). Recall-related fields are ignored; the requested scope must still match the pack. Reuse in answer and compose revalidates the original credential, the pack's traversal permission, and current read capability/membership for its layer scopes and visible traversal scopes, and re-admits every layers.code region under the code evidence lane's per-repository rule (a caller who may not read one of its repositories cannot reuse the pack). Lost authorization returns 403 POLICY_DENIED; an unknown, expired or different-scope pack returns 404 NOT_FOUND. |
skip_answer_llm | bool | Build and return the final quota-packed context_block plus route/certification diagnostics without invoking answer-stage LLM planning, rendering, verification, or retries. answer is empty unless a certified deterministic reducer succeeds. Intended for bring-your-own answer models and cost-free read-plane evaluation. Cannot be combined with stream; the context is returned even when include_context is false. |
order | enum | relevance (default) | recency — forwarded to the recall (§8.3). An explicit value always wins, except that an answer recalled descend stays ranked. When absent, recency-shaped questions ("recent…", "latest…", "currently…", "next best step…") infer recency. Inferred recency since 0.10.3: when the answer recalls holistic (view: "holistic", the SDK and CLI default, or no view on a scope with child scopes) it serves the tail as before. When it recalls granular (no view, or granular, raw or structured, on an exact scope with no child scopes) or lineage, it serves the tail only on a typed event stream, a scope where more than half of the newest events carry context.intent (page views, orders, status changes). On any other scope (conversations, documents) the answer stays ranked, as in v0.10.2. When a tail is served, evidence older than the newest N events (budgets.per_layer_limits.events, else CORTEX_RECENCY_TAIL_EVENTS, default 100) is not in the context, apart from the event-kind additions below. To opt out, send order: "relevance" on the request, or set CORTEX_RECENCY_INFERENCE=0 for the whole server. Hindi and Hinglish cue words (0.10.4, opt-in): with CORTEX_RECENCY_CUES_MULTILINGUAL=1 the inference also reads हाल ही में, हालिया, नवीनतम, ताज़ा, सबसे नया, आखिरी, aakhri, haal hi mein and last in a question detected as Hinglish (not before a time unit, not "in the end" (last mein), not before a date or price noun (aakhri tareekh, last price)), and their set and past-tense shapes for the tail. Off by default: a non-English question then infers exactly what it did in 0.10.3, and English inference is the same either way. The answer context is capped at budgets.max_tokens (default 4,000, at most 8,000); a timeline tail longer than that keeps its newest-first order and loses its OLDEST events (0.10.3; before, the cap re-ranked the tail by evidence type, could drop its newest event and still told the model the context was newest-first). See "Event kinds" below. |
budgets | object | Forwarded to the recall (§8.3). per_layer_limits.events caps the evidence set — and the order=recency tail size (event-kind coverage, below, may add one event per uncovered kind beyond it). (v0.8.6: this documented field was previously dropped on deserialization.) |
include | array | Layer whitelist forwarded to the recall — binds the answer's derived-layer backfills too, so include: ["events"] + a modality filter is airtight. (v0.8.6: previously dropped on deserialization; backfills previously bypassed it.) |
question | string | Required. The question; also the retrieval query. |
question_date | string | The question's own time (YYYY/MM/DD or RFC 3339, for example the date of a chat). With no temporal window in the request, a time phrase in the question ("last Saturday", "two months ago") resolves against it into the recall's capture window, which the answer drops again when that window holds no relevant evidence. Without it the answer cache also matches on the UTC day. |
answer_instructions | string | A style and format addendum after the deployment's CORTEX_ANSWER_DEFAULT_INSTRUCTIONS; the grounding rules stay in force and retrieval reads question alone. More than 4,000 characters is 422 INVALID_BODY. |
cite_sources | bool | Grounded citations: the context's events carry [S#] markers, the model is told to cite them, and citations are the markers it cited (support_strength 1.0). Default false. |
include_context | bool | Return context_block, the context the model read. Default false. |
conversation_id | string | The conversation for conversation-local context such as recent working memory; without it that context is skipped (the server never guesses a conversation). |
view | enum | As on /v1/recall (default granular; local is its alias); see the capability line for the view the answer recalls with. With cohort: holistic, descend or none. |
temporal, filters, newest_of_kinds | As on /v1/recall, for every recall pass (newest_of_kinds and filters do not combine with cohort). | |
extra_scopes, mounts, coverage, beliefs, consistency | §8.3.2, for every recall pass; coverage is the union of the passes. None of them combines with cohort but beliefs and consistency. | |
purpose | string | read_purpose_v1: as on /v1/recall (§8.3), for the whole request. |
session | string | derivation_use_rules_v1: as on /v1/recall (§8.3), for every recall pass and every secondary read of the answer; where a rule is in force the artifact plane reads nothing, a cohort lane reads no subject the rule governs, and a use_pack_id pack holding a row the rule withholds from this read is 404 NOT_FOUND (§8.32.5). |
cohort | object | Flag-gated: a question across the customers under a parent scope (§8.4.2). |
The route reads only the fields above: any other field (query_variants, language, scripts,
diagnostics, citation_mode, exclude_content, subtree among them) is ignored.
Event kinds (0.10.3). On a scope whose events carry context.intent (an event stream: page
views, orders, cancellations), /v1/answer reads the scope's kind census: the newest eligible
event of each distinct intent, under the same scope, view, filters and time window as the recall
(at most 32 kinds; a scope with more distinct intents gets none). A newest-K tail and a relevance
top-K are both dominated by the most frequent kind, so a rare one (a cancellation 700 events behind
a burst of page views) used to be invisible to both:
- Over an
order=recencytail, the context keeps the newest events that fit the budget and then, after the line[note] Older history: ..., the newest event of each kind those events do not include. Every one of them is older than every event above the note, so the context stays newest-first. - Over a ranked context, when the question names a kind (a word of the intent: "order" names
shop.order.cancel, unless every kind of the scope carries that word), the newest event of each named kind is added, so "the order signal" reaches the current one.
Events without an intent have no kind, so a scope without intents is unchanged. Set
CORTEX_ANSWER_KIND_COVERAGE=0 to turn it off.
The census costs one more bounded read of the scope's own events on the database lane (at most 8
pages of 1,024 events, the same listing the timeline tail uses), paid by each answer whose context
carries kinds and is a tail or names a kind; a scope whose events do not fit that read gets no
census. It is skipped for use_pack_id, for an answer that auto-descended into child scopes and on
native reads. Its entries stay within budgets.max_tokens: over a tail they take the place of the
oldest events.
Premise guard. When an answer asserts something but also says the memories do not mention (or
hold no record of) what the question presupposes, the answer is replaced by the abstention "The
information provided is not enough." Two refinements (0.10.3): a note that the request scope's own
identifier does not appear in the memory text (for example "no record of the user id <id>" over
scope .../user:<id>) does not trigger it, because every recalled memory belongs to the scope; and
when the answer opens with a plain absence report about the asked thing ("The memories contain no
record of the user viewing a Model X widget, but ..."), that first clause is kept after the
abstention ("The information provided is not enough. The memories contain no record of the user
viewing a Model X widget."). The clause ends at the first comma, dash, semicolon or sentence end, and
a leading "No" and everything after the clause are dropped, so the result is still an abstention
and never a negative answer ("No, there is no record of who you went with, you went alone" keeps
"There is no record of who you went with" only). Because an abstention may now carry that report,
recognise one by its leading "The information provided is not enough." and never by equality with
that text. A question that names the scope's own identifier also gets a prompt note that the
memories are that subject's history.
Response:
{
"pack_id": "pack_01HX...",
"answer": "Acme upgraded to 200 seats on May 13. They did not renew their previous contract; they signed a new one. [1][2]",
"citations": [
{"marker": "[1]", "layer": "fact", "id": "fact_01HX...", "support_strength": 0.91},
{"marker": "[2]", "layer": "event", "id": "evt_01HX...", "support_strength": 0.87}
],
"provenance": {
"trail": [...],
"citations": {...}
},
"diagnostics": {
"recall_ms": 412,
"llm_ms": 814,
"total_ms": 1240,
"answer_model": "claude-opus-4-6",
"answer_llm_skipped_by_request": false,
"tokens_input": 1284,
"tokens_output": 218
},
"as_of": "2026-05-13T15:42:09Z"
}
provenance has the pack's shape (§9). citations[].layer is event, fact, belief,
rollup or artifact (the artifact a certified reducer answered from). as_of is
temporal.as_of (else as_of_valid, else as_of_recorded), else the end of
temporal.valid_during, else the request time. diagnostics.answer_model is the model that
answered (not-invoked under skip_answer_llm, certified-reducer for a certified reducer's
answer); tokens_input and tokens_output are absent when the provider reported none. With
include_context (or skip_answer_llm) the body carries context_block; with coverage,
coverage; with mounts, warnings (mount_not_admitted: <path>), and, last,
use_rule_withheld: <n> events from earlier sessions when a read-time use rule withheld something
from the answer's reads (§8.32.5); warnings is absent when empty; with
consistency, the consistency fields at its end (§8.3.2).
Two optional diagnostics explain an abstention; both are omitted when empty:
premise_unsupported_terms(array of strings) — question words with no literal support in the answer context. They drive the answer prompt's evidence-check note and the premise gate that keeps an abstention instead of retrying. The match is literal, so a word the memories paraphrase can appear here; general nouns such as "issue" or "problem" are never listed, because they label the event the other question words identify.extractive_retry_outcome(string) — what the default-on extractive retry did after a first answer that abstained:answered(the retry replaced the abstention),still_abstained, orpremise_ungrounded(the premise gate kept the abstention without retrying). Absent when the first answer did not abstain. An answer that gives a value or answers part of the question, then notes that the memories contain no such information about the rest, is not an abstention. The check reads the opening sentence: an answer that OPENS with that note and answers another part afterwards is still treated as an abstention, so it may cost one extractive retry.
A stream: true answer served token by token from a streaming-capable provider skips the retry pipeline and reports neither field.
degraded_sources (array of strings; server builds after v0.9.13; omitted when empty) names what the answer ran without, as stable codes only, never error text (the error stays in the server log). From the recall pack: coordinator_recall, wal_supplement, derived_<lane> (for example derived_facts), artifact_search, index_divergence, scope_partition_map (the answer started while the server was still building its scope-partition map after startup, so descendant scopes and cold-tier vectors were not read; it clears once that build lands, seconds to minutes after a restart over a large store). From the answer stage: derived_backfill (the derived-layer backfill failed), facet_plan_unavailable, facet_recall_failed, ms_executor_fallback (the multi-session executor failed and the standard answer path answered from the same pack; since 0.14.2 an extraction that completes and finds nothing is not a failure and reports nothing), segments_unreachable (the pack's warning of the same name: some segments of old data were not searched because the segment store did not answer in time or the request's read budget ran out, so old memories they hold may be missing from the context), and on a cohort answer cohort_narration_unverified (the narration stated a number the number check did not verify, or an unknown alias; deterministic, not worth retrying as is), cohort_narration_failed and subtree_recall_unavailable (§8.4.2). Any other source is reported as unknown. The answer is still returned; read a non-empty list as "this answer saw less evidence than a healthy run would": every code names a transient failure worth retrying except index_divergence, cohort_narration_unverified and a subtree_recall_unavailable whose cohort block names subtree_too_large. The legacy parent-pack note (parent_pack_unranked_sample, §8.4.2) is a pack warning, not a degraded source. /v1/compose reports the same field; /v1/recall keeps its own diagnostics.degraded_sources (§9).
Streaming. stream: true answers text/event-stream (§10.2): tokens, then citations,
provenance, diagnostics and done (pack_id, as_of). A streamed answer carries no
coverage, warnings or consistency token, and does not combine with skip_answer_llm or
cohort (422 INVALID_BODY).
Order and retries. The body is read first (unknown fields ignored), then the consistency,
temporal and cohort gates, the consistency wait and the notice of the read scopes (§8.3.2);
then, for each run, the option checks, authorization, the read-set fields, llm.invoke, the
model's availability (503 ANSWER_UNAVAILABLE), metering (hosted plans count an answer, or a
recall for skip_answer_llm, once per request; the subtree limiter one read at scope) and the
authorization snapshot. A run that loses an authorization race runs once more: at most two runs,
since a run may already have called the model. On a cluster the ingress routes the answer by the
root of scope to the shard's leader.
Errors (/v1/answer; /v1/compose, §8.4.4, answers the same without the cohort codes):
| Status | Code | When |
|---|---|---|
| 402 | PLAN_LIMIT_REACHED | hosted plans: the month's answers (or, for skip_answer_llm, recalls) are used up |
| 403 | POLICY_DENIED | as on /v1/recall, and llm.invoke, the traversal capability of the view the answer chose, scope.read.descend for cohort, or a reused pack the caller may not read |
| 403 | APP_NOT_ADMITTED, BREAK_GLASS_REQUIRED | as on /v1/recall |
| 404 | NOT_FOUND | use_pack_id names no live pack of this scope |
| 404 | COHORT_ALIAS_NOT_FOUND | §8.4.2 |
| 408 | WAIT_TIMEOUT (retriable) | §8.3.2 |
| 409 | COHORT_DISABLED, SUBTREE_RECALL_DISABLED | §8.4.2 |
| 413 | COHORT_SUBTREE_TOO_LARGE | §8.4.2 |
| 422 | INVALID_BODY | a body that does not fit; skip_answer_llm with stream; answer_instructions over 4,000 characters; a malformed use_pack_id; a bad filter or temporal hint; a read-set field (§8.3.2); a cohort option (§8.4.2) |
| 422 | INVALID_EXTRA_SCOPES, INVALID_MOUNTS, VIEW_NOT_ALLOWED_AT_SCOPE, UNPARSEABLE_TEMPORAL, CONSISTENCY_TOKEN_INVALID | as on /v1/recall |
| 422 | COHORT_NO_DESCENDANTS | §8.4.2 |
| 429 | SUBTREE_RATE_LIMITED (retriable, Retry-After) | as on /v1/recall |
| 500 | INTERNAL_ERROR (retriable) | the answer failed inside the server |
| 501 | COHORT_UNSUPPORTED | cohort on a native answer host, which serves no cohort answer: send the cohort question to a server that serves the scope's root (§8.4.2) |
| 502 | ANSWER_PROVIDER_ERROR, ANSWER_PROVIDER_INCOMPLETE (retriable) | the provider failed, or answered blank twice (the second time to a repair prompt) |
| 503 | ANSWER_UNAVAILABLE | no answer model is configured (after authorization) |
| 503 | ANSWER_PROVIDER_ADMISSION_TIMEOUT, ANSWER_PROVIDER_SATURATED, ANSWER_PROVIDER_UNAVAILABLE (retriable) | the provider lane did not admit the call in time, is full, or is closed |
| 503 | EVIDENCE_UNAVAILABLE, EVIDENCE_ADMISSION_TIMEOUT, EVIDENCE_SATURATED, AUTHORIZATION_STATE_CHANGED, NOTICE_UNAVAILABLE, WAL_UNAVAILABLE, SCOPE_STORAGE_UNAVAILABLE | as on /v1/recall |
| 503 | COHORT_WARMING, COHORT_REQUIRES_UNIFIED_WAL, COHORT_STATE_CHANGED, COHORT_UNAVAILABLE, SUBTREE_BUSY, MEMORY_PRESSURE | §8.4.2 |
| 504 | ANSWER_PROVIDER_TIMEOUT, EVIDENCE_TIMEOUT (retriable) | the model call or the read outlived the deadline |
On a native memory host 503 NATIVE_ANSWER_UNAVAILABLE says the host's answer composition is
unavailable.
8.4.1 Answer cache (opt-in)
With CORTEX_ANSWER_CACHE=1, a repeated question returns the stored response instead of running recall and the answer model again. A stored answer is reused only for the same caller and token claims, the same scope, the same view, and the same answer-shaping fields: question (with its whitespace collapsed), question_date, temporal, filters, order, budgets, include, answer_model, answer_max_tokens, answer_instructions, cite_sources, include_context and conversation_id. Other body fields are not part of the match, so a field the server ignores cannot create a separate entry. A request without question_date also matches on the UTC day, so a question about "today" or "yesterday" is never answered from the day before.
A stored answer is served only while it is current:
- A write accepted at the scope, below it, or at an ancestor the answer could read invalidates it, including one accepted up to 5 seconds before the answer started (a write is timestamped slightly before it reaches the log). So does any forget, erasure, cancel or redact anywhere, and any ACL change that matters to reads at the scope: at it, at an ancestor, or below it (the scope registry's authorization revision for the scope is part of the match). A new scope's first write elsewhere in the root leaves it current. A non-dry-run scope migration, a bitemporal conflict resolution, and turning a live feature on or off clear the whole cache.
- A response is stored only if indexing had caught up with every captured write when the answer started, and nothing it depends on moved while it ran. An answer that ran without some of its evidence (any
diagnostics.degraded_sourcesentry exceptindex_divergence) is not stored, so a transient failure is not replayed; that includes an answer started while the scope-partition map was still building (scope_partition_map). Responses over 1 MiB are not stored. - It expires after
CORTEX_ANSWER_CACHE_TTL_SECS(default 300, at most 540). Enrichment results and derived-layer rebuilds move no counter the cache reads; the TTL bounds how long an answer can predate them.
Cache-Control: no-cache answers now and replaces the stored answer; no-store neither reads nor writes the cache. These requests bypass it entirely: stream: true, skip_answer_llm: true, use_pack_id, cohort (§8.4.2), evaluation facet-plan overrides, a request that sends extra_scopes, mounts, newest_of_kinds, coverage or beliefs: "merged" (§8.3.2), a request whose chain's reads are recorded (a non-human chain on a verified token, DB-28), a native host, and an answer whose scope table could not be read. An answer whose pack holds rollups (§9) is not stored, and a stored answer whose rows need a notice the request has not told (§8.3.2) is not served. A store is only kept while the indexer's watermark proves the index current; an engine without the indexer tail (never the serving binary, which exits 78 on the retired legacy WAL, CORTEX_UNIFIED_WAL=0) never stores anything, and the server logs a warning at startup.
While the cache is on, every successful /v1/answer response carries the header x-cortex-answer-cache: hit, miss (answered now) or bypass. It is absent when the cache is off and on error responses. A hit is the original response with diagnostics.answer_cache: {"hit": true, "age_ms": N}, and diagnostics.tokens_input and tokens_output set to 0 because no model ran for it; pack_id, as_of and the timings describe the original computation, and the pack itself may have expired (a later use_pack_id then returns 404). Hits, misses, stores, skipped stores and clears are under answer_cache on GET /v1/admin/metrics. The cache is in memory only: a restart empties it, and nothing in it is written to disk or replicated.
On a cluster (cortexdb node) each data node keeps its own cache, set in the node's [engine] table (a data node reads no inherited CORTEX_* variable), and its counters are on that node's /v1/admin/metrics, not the ingress's. Only a shard's leader answers /v1/answer, after its erasure feed and its indexer caught up (the edge fence), so a new leader starts cold. An answer a node cached stays safe across leader changes and scope moves: every replica's erase tail invalidates it for every erasure, cancel and eviction it applies, a registry change it applies moves the authorization revision the match binds when the change matters to the scope, every replica's indexer invalidates it for every row it indexes in the scope (another leader's writes and a move's imported rows included), and the match includes the root's placement on the node (its scope-table epoch and whether it is active there), so an answer cached before the root moved away and back is never served. The ingress passes the client's Cache-Control to the data node, and the node's x-cortex-answer-cache back.
8.4.2 Questions across customers (cohort; xscope, flag-gated, new in 0.10.4, experimental)
A question asked at a parent scope (org:acme) about the customers under it (org:acme/user:*)
is answered by the cohort lanes when the request carries cohort. Without the field the answer
path is unchanged, whatever the flags say. The field is gated by CORTEX_COHORT=on (otherwise
409 COHORT_DISABLED, even for "cohort": null); its capability name cohort_query_v1 is known
but not advertised in 0.10.4. The ranked and synthesis lanes also need
CORTEX_SUBTREE_RECALL=request. The lanes are experimental: the exact lane is exact over typed
facets, but questions that need conversations read are answered from a coverage-stated sample, and
how well a business term maps to a facet depends on the operator glossary (below).
Detecting support. Do not rely on capabilities[] for these names in 0.10.4. A server before
0.10.4 ignores an unknown cohort field on /v1/answer and answers from its storage-order parent
sample: treat a 2xx answer without a cohort field as "this server has no cohort lanes" and
never show its narration as a cohort answer. To probe without spending a model call, send
POST /v1/cohort/query: 404 means a server without the cohort routes, 409 COHORT_DISABLED
means the flag is off, anything else means the lane is served.
{
"scope": "org:acme",
"question": "Which customers cancelled an order last week?",
"cohort": {
"naming": "alias",
"anchor": "data_end",
"max_listed": 50
}
}
cohort field | Notes |
|---|---|
naming | alias (default): stable pseudonymous aliases (C- + 7 Crockford base32 characters, keyed per root by <data_dir>/cohort_alias.key). alias_ephemeral: per-request aliases that link nothing across requests. scope: the model still sees per-request aliases; after the model call the server substitutes each customer's scope path relative to the request scope (user:u1) in the answer text, and drops the aliases from the block and the citations. The caller always receives real scopes in cohort.result.subjects[].scope and in citations. |
anchor | now, data_end (the newest authorized observed_at under the scope) or an RFC 3339 instant. Relative windows (last week) resolve against it, and it is always stated in cohort.coverage. |
plan | An explicit CohortPlan (see docs/schemas/openapi.json); it always wins over the planner. A plan with lane: "ranked" needs CORTEX_SUBTREE_RECALL=request (409 SUBTREE_RECALL_DISABLED). |
lanes | ["exact"], ["ranked"] or both (default: every lane the flags enable). A question that needs an excluded lane gets status: unsupported. |
max_listed | Customers listed in the model context and in cohort.result.subjects, 1-200 (default 50). |
focus | A follow-up about one customer, by the alias a previous answer returned. See "Focus" below. |
subject_level | child (default): a customer is the scope one level below the request scope. leaf: the event's exact scope. |
read | How a question that needs conversations read is read: all reads every conversation of the cohort (lane: read_all, below), sample reads a ranked sample of excerpts (lane: ranked / sample). Absent: all while CORTEX_COHORT_SYNTH_MAX_CALLS is above 0 (the default, 32), else sample. all falls back to the sample, with a note in cohort.notes, when read-all is off on the server, no answer model is configured, or the request sets skip_answer_llm (which makes no model call). |
Gates. The request needs view holistic, descend or none (422 INVALID_BODY,
details.field: "view"), the scope.read.descend capability on the scope (403), and cannot
combine cohort with stream or filters (422; say the condition in cohort.plan), nor with
extra_scopes (422 INVALID_EXTRA_SCOPES), newest_of_kinds or coverage (422 INVALID_BODY)
or mounts (422 INVALID_MOUNTS, not_combinable). At a shared org-tree scope (§8.8.7) a cohort
answer is 422 VIEW_NOT_ALLOWED_AT_SCOPE whatever view it sends (details.view: "descend"), after
the read and roster checks. cohort itself is validated before anything runs: an invalid plan, a
max_listed outside 1 to 200, a repeated lane, a plan whose lane lanes leaves out, or focus
beside plan is 422 INVALID_BODY naming the field. Every count, list and breakdown covers only
the customers the caller may read, decided per customer scope, and nothing reports how many were
left out. The authorization snapshot is re-checked before the response
(503 AUTHORIZATION_STATE_CHANGED).
Routing. The question goes through a planner (an explicit cohort.plan skips it):
| Question | Lane | What the model sees |
|---|---|---|
| A typed lookup, count, top-N, funnel, segment, sequence or "latest": which customers cancelled an order, top 5 products by customers, the order funnel, viewed both X and Y, confirmed but never had a conversation, cancelled then later confirmed | Exact (Lane E): computed over the typed facets (intent, labels, modality) of every authorized customer | ## Cohort result (complete over N authorized customers; window W; anchor A), the plan, the mapping notes, up to max_listed alias rows with counts and first/last dates (or the groups, funnel steps or share), and the coverage line. No event text. |
| What customers said: which customers discussed refunds in a chat | Read all (below): every conversation of the exact cohort the question names is read, and the matching customers are the union of the conversations that show it. With read: "sample" (or read-all off): Ranked (Lane R), filtered first to that cohort | Read all: the computed block (the matching customers with one [k] marker each and their matching-conversation counts) and the line "read X of Y conversations in the cohort". Ranked: [k] [time UTC] [subject C-…] text excerpts ([k] is the answer's k-th citation marker, which the narration cites per theme), up to two per customer, and the line "excerpts from K of M customers in the cohort; ranked sample, NOT a complete list" |
| Themes across conversations: what do customers ask about financing, common concerns on calls, among customers who cancelled, what reasons come up | Read all (below): every conversation read, themes computed. With read: "sample" (or read-all off): Synthesis (Lane R over conversations, one excerpt per customer) | Read all: the computed block (the themes, most customers first, each with its customer and conversation counts, two [k] C-… example markers and the readers' labels; the matching customers) and the coverage line. Sample: as above, with "read excerpts of X of Y conversations" |
An alias in the question, or cohort.focus | Focus | The customer's own memory on the single-customer answer path |
| Anything the planner cannot map | none | Nothing: no model call. cohort.status: "unsupported" with a reason (unknown_term, needs_text_attribute, needs_conversation_reading, other) and a pointer to GET /v1/cohort/vocabulary |
The planner (CORTEX_COHORT_PLANNER=rules, the default) matches the question against the
authorized vocabulary: intents (an intent matches when every word of its last dotted segment is
in the question, cancelled = cancel, and a short segment may be an initialism, test drive =
td), label values (case-insensitive), label family names (for "top" and "split by"), and
modalities. It reads time windows (between 2026-03-16 and 2026-03-22 as inclusive UTC days,
in June 2026, in W26, and relative phrases such as last week or past 30 days, which resolve
against the anchor), clauses, negation (never, not, no, without) and sequence cues (then,
later). Two values of one family joined by "and" are separate per-customer conditions; joined
by "or" they are an any-of. A word that matches nothing makes the question unknown_term, except
generic words (viewed, car, page), a name or channel word right before a matched facet word
(WhatsApp chat, phone call), a word that names a label family (automatic transmission), the
scope's own name (Acme under org:acme), and a proper noun matched by nothing (Tesla), which
is probed as a label value and so selects no customer: the answer is "0 of N", complete. A
lowercase word that could narrow the cohort is never dropped: "a red Quill" is unknown_term, not
every Quill. When a condition pairs intents with labels of a family no event of those intents
carries ("ordered a paperback" where orders carry a listing id but no format), the planner reads
those labels through the identifier family both kinds of event carry (a via semi-join on
listing), from the vocabulary's co-occurrence (label_families[].co_families and .intents), and
says so in cohort.notes. An event share whose base names nothing ("what share of views were
hardcover") is over the events that record the subset's family (every event with a format label),
not every event under the scope; a customer share keeps every customer as its base.
CORTEX_COHORT_PLANNER=llm adds one JSON-plan call that sees only the question, the vocabulary
summary and the rules planner's candidates (never scopes, event ids or event text); a plan whose
terms are not in the vocabulary is unknown_term, and an unusable reply keeps the rules plan.
CORTEX_COHORT_PLANNER=auto is the recommended setting when users ask in more than one language:
the rules run first, and the JSON-plan call is made only when they cannot plan the question
(unsupported, unknown_term above all) or the question is not English by the capture detector
(Latin-script Hinglish hi-Latn, Devanagari und-Deva, any other non-Latin script, a mixed-script
question). An English question the rules can plan gets exactly the rules plan and answer, with no
model call. cohort.notes says why the model planned (planner auto: the question reads as hi-Latn ... or planner auto: the rules could not plan the question (unknown_term) ...).
Spanish and other Latin-script languages are not detected; they reach the model through an
unsupported rules outcome. The rules read the vocabulary, operator words and glossary in English
(Devanagari words are matched whole, so a Devanagari glossary phrase works), so under rules a
Hinglish, Hindi or Spanish question is refused unknown_term. skip_answer_llm makes no planner
call in any mode.
Two rules apply to a plan the JSON-plan call returns, and only to it (0.10.5; the rules planner's
plans and a caller's cohort.plan are run exactly as they are). A window.natural phrase that
means no window at all (all time, ever, overall, kabhi bhi, ab tak, ...) is dropped and
the question is answered over all data, with the note planner window '<phrase>' ignored: the question is answered over all data. Any other phrase the executor cannot resolve (pichle mahine written as is, instead of last month) makes the plan unusable: the rules outcome stands,
with the note LLM planner unusable (its window '<phrase>' is not a time phrase the server can resolve) on a plan, so a question about last month is never answered over all data (a caller's
plan with such a phrase still answers 422 INVALID_BODY naming plan.window.natural). And the
operator glossary is binding on a plan that reads conversations (lane: "ranked", no chain): a
glossary phrase of the question whose facet the plan names nowhere (for example "phone call" left
out of a Hinglish question's plan, which would read every chat too) is added to the plan's
where, with a note ending (operator glossary, binding: added to the LLM plan, which had left it out), so the cohort is the one the rules build for the same words in English. A facet the plan
already names anywhere, also under none_of, is left as planned, and so is one the plan names in
other terms for the same channel (intent conversation.call for a glossary facet labels_all ctype:call) or whose every phrase the model kept in the plan's query (it read "call back" as the
topic, not as the channel). The reply may also carry reader_question, the question in English
for the read-all readers (see "Reading every conversation"); it is not part of the plan.
Business terms the vocabulary does not spell are mapped by an optional operator glossary,
<data_dir>/cohort_glossary.json (read on each cohort request; configuration, never customer
data). Each entry maps a phrase to a predicate; an empty predicate marks a phrase as known filler.
Longer phrases match first. A file that cannot be read is ignored and named in cohort.notes.
{
"version": 1,
"entries": [
{"phrase": "viewed", "facet": {"labels_all": ["etype:PAGE"]}},
{"phrase": "paid for an order", "facet": {"intent": ["shop.order.payment.done"]}, "note": "payment completed"},
{"phrase": "storefront", "facet": {}}
]
}
Response. The usual answer response plus cohort, the structured answer and the source of
truth for graders and UIs:
{
"pack_id": "pack_01J9Z…",
"answer": "3 of 120 authorized customers cancelled an order in the week of 2026-06-29 to 2026-07-05 (anchor: data end, 2026-07-08): C-4F2AQ7M, C-8X9QW2E and C-1KDZP0R.",
"citations": [
{"marker": "[1]", "layer": "event", "id": "evt_0190…", "support_strength": 1.0,
"scope": "org:acme/user:u1/session:s3", "subject": "C-4F2AQ7M"}
],
"cohort": {
"version": 1, "status": "complete", "lane": "exact",
"plan": {"op": "list", "where": {"intent": ["shop.order.cancel"]}, "window": {"natural": "last week"}},
"notes": ["cancelled order -> intent shop.order.cancel", "last week -> window \"last week\" (relative to the anchor)"],
"coverage": {"subjects_considered": 120, "events_considered": 9000,
"window": {"from": "2026-06-29T00:00:00Z", "to": "2026-07-05T23:59:59.999Z"},
"anchor": "data_end", "anchor_at": "2026-07-08T09:30:00Z", "root_events_ignored": 0},
"result": {"count": 3, "subjects": [{"alias": "C-4F2AQ7M", "scope": "org:acme/user:u1", "events": 2,
"first_at": "2026-06-30T09:00:00Z", "last_at": "2026-07-02T09:00:00Z",
"evidence": ["evt_0190…"], "evidence_scopes": ["org:acme/user:u1/session:s3"]}],
"truncated": {"listed": 3, "total": 3}},
"narration_unverified_numbers": []
}
}
statusiscomplete(exact over every authorized customer; onread_all, every conversation of the cohort was read),partial(a ranked or sampled read, or aread_allthat did not read every conversation;coverage.complete: false) orunsupported.laneisexact,ranked,sample(synthesis over excerpts),read_all(every conversation read),focusornone.- On the ranked lanes
coveragealso statessubjects_read/subjects_in_cohortand, for a synthesis,conversations_read/conversations_in_cohort, counted over the excerpts that actually fit the context. The cohort is counted exactly (Lane E) before the ranked pass, which scores only that cohort's events; an event the ranked pass returns outside it is dropped and noted. - Citations name the evidence: on the exact lane each listed customer's evidence event, on the
ranked lanes each excerpt's event, with
scope(the cited EVENT's own scope, which undersubject_level: childcan sit below its customer, such as a session) andsubject(the alias the model saw).result.subjects[].evidence_scopes[i]is the own scope ofevidence[i]. Every id reads back withGET /v1/events/{id}?scope=<that scope>(event_scope_filter_v1, an exact scope match). pack_idis always a valid pack id. A ranked answer carries its subtree pack's id. The exact lane, an unsupported block and a ranked-lane fallback recall no pack: their id is minted for the response, names no stored pack, anduse_pack_idwith it answers404like an expired pack.context_block(withinclude_contextorskip_answer_llm) is exactly what the model saw.
Narration and the number check. The model gets a cohort-specific system prompt (many
customers, aliases only, numbers only from the result block, coverage always stated, a theme needs
two customers) and never sees a scope or an event id. After the call, every number in the answer
(digits with , or . in any script's decimal digits, ४२ being 42, percentages, dates, times,
cardinal words such as "twelve", counts written 128.9k or 3 lakh) is checked against numbers
the server computed, in the role the answer uses it in. The sources are taken from the
structured block, never from rendered text:
| A narrated number used as | Verifies against |
|---|---|
| a count or total | result.count, the share's numerator and denominator, the coverage totals (customers and events considered, customers and conversations read and in the cohort), the listed and not-listed counts, the plan's own numbers (n, within_days, the funnel's step count) and the numbers in the server's notes |
| a group's value (top-N, funnel) | that group's value only: a number standing next to a group key in its clause must be that key's value (Quill (179) fails when Quill's value is 184 and Harbor's is 179) |
| a customer's count | that customer's count, only in a sentence that names the customer's alias |
| a share | the share, as a percentage; a rounding is accepted (31.5% or 31% for 31.47%) |
| a date or time | a date or time in the block (data span, window, anchor, first and last seen) or, on the ranked lanes, an excerpt's time bracket; date parts never verify a count (2026-03-04 does not verify "4 customers") |
a rank (#1, 5th, step 2) | 1 to the number of listed groups, customers, steps or n |
A number in the question counts only through the plan that used it (the 5 of "top 5", a window's
dates): a figure stated in the question itself ("why did the 400 customers who cancelled ...") is
not a source. On the ranked lanes the excerpts' text is never a source for any number. Any number
that fails is listed, as written, in cohort.narration_unverified_numbers, and the answer text is
replaced by the deterministic server summary (fail closed), with
diagnostics.degraded_sources: ["cohort_narration_unverified"]; so is a narration that names an
alias the context did not. On the ranked lanes (lane: "ranked", "sample" or "read_all",
where the narration summarises more than the server summary restates) the sentences stating those
numbers are removed instead, with the same list, degraded source and a note, as long as at least
half of the narration's sentences remain; otherwise it fails closed the same way. The check has
known limits: within one clause a key and a value are paired by position, so a narration that
names two keys and then two values without "respectively" ("Quill and Harbor had 179 and 184")
is paired in order; and a count that happens to equal another count of the block verifies. The
structured block, not the narration, is what to grade and display. A provider failure or an empty
narration falls back the same way (cohort_narration_failed). With CORTEX_ANSWER_STUB=1 the
answer is the server summary. skip_answer_llm: true returns cohort and context_block with no
model call at all (the rules planner only). Usage is recorded under the answer role against the
request scope.
On the ranked lanes the prompt adds the lane's rules: a ranked lookup must name and cite every
customer whose excerpt shows what the question asks about (and no other), a synthesis lists the
themes at least two customers raise, most widespread first, one line each with aliases and
markers. Their default output budget is 1,500 tokens (700 on the exact lane; answer_max_tokens
overrides both, at most 2,000). On a narrated ranked answer cohort.result.subjects stays the
customers whose excerpts were read (the block is never cut by model output), and each row's
cited flag says whether the narration cites that customer's excerpt; citations keep only the
cited excerpts, and a note gives how many of the customers read are cited. cited is the model's
reading of a ranked sample, never a complete list: a grader that wants "which customers said X"
from a ranked answer reads the cited: true rows and treats them as a sample. A narration that
cites no marker flags no row, and says so.
Reading every conversation (lane: read_all; design D4). A synthesis or a "which customers
said X" question reads EVERY conversation of its cohort instead of a ranked sample, while
CORTEX_COHORT_SYNTH_MAX_CALLS is above 0 (the default) and the request makes model calls:
- The cohort, exactly. Lane E counts the cohort's customers and conversations (the plan's
conditions and window, modality
conversation) and lists the conversation ids, newest first. Each conversation is read in full through the same fences as every lane (under the scope, a customer scope the caller may read, not excluded, redacted, tombstoned or marked erased), and a conversation longer thanCORTEX_COHORT_SYNTH_CONVERSATION_MAX_BYTESkeeps its first two thirds and its last third (cohort.read.conversations_truncated, and a note). - Map. The conversations are packed into batches (
CORTEX_COHORT_SYNTH_BATCH_TOKENSestimated tokens, at mostCORTEX_COHORT_SYNTH_BATCH_MAXconversations) and each batch is one call to the map model (CORTEX_COHORT_SYNTH_MAP_MODEL, default the answer model), at mostCORTEX_COHORT_SYNTH_PARALLELISMin flight (each also takes a permit of the shared provider lane). The batches fill whole waves of calls in flight, cut to about equal tokens (at least one batch per call in flight when there are that many conversations), and a "which customers said X" question reads in smaller batches (up to three waves), since its reply is one short line per conversation. The model sees a reader question, the plan's topic words and the conversation text, never a scope, an alias or an event id, and answers one line per conversation: whether it shows what the question asks and, for a themes question, one to three short labels. A conversation whose line is missing is never guessed: it is unread. One retry pass runs for failed calls and missing lines while time and calls remain. The reader question (0.10.5). The readers always get the question's meaning. A plain topical question, one that only asks who discussed, mentioned, talked or asked about a topic (themes: what customers raise or say about it), with no negation, noand/both, no other verb or qualifier, and two or more topics joined only byor, gets a reader question built from the plan's canonical topic, so the same plan reads the same way whatever language it was asked in: the plan'squerywords without English or Hinglish function words, question and customer words, the generic verbs of a lookup (discussed,ki baat ki) and the words of a channel the plan's own conditions already select (phone callwhen the plan selectsctype:call), in the planner's order, an acronym keeping its capitals ("Which customers discussed loan or EMI?", "What do customers raise about financing, loan or EMI?"). Every other question reaches the readers as asked: an English one in the asker's words; a Hindi or Hinglish one as the model planner's English translation (its plan reply'sreader_question, used only when it reads as English and keeps the question's negation andand), else in the asker's words. So "Which customers did not mention a refund?", "...both insurance and a loan?", "...asked to cancel their loan?" and "Why do customers cancel?" keep their meaning, and never share a cached read with the plain question about the same topic. A plan whose query leaves no topic word gives the readers the asker's question.cohort.read.topicis the canonical topic;cohort.read.reader_questionis the question the readers got when it is not the asker's own (canonical or translated); the plan echo (cohort.plan.query) carries the canonical topic. The ranked lane (read: "sample", or read-all off) searches with the plan's English query and, for a non-English question, also with the asker's own words as a query variant. - Fences again. A conversation forgotten or erased while it was read counts nowhere
(
cohort.read.conversations_dropped). - Reduce, by the server. The matching customers are the union of the customers of the
conversations that show it (
result.count,result.subjects, each with its matching conversations and up to three of them as evidence). For a themes question the labels are folded; when there are more than 12, one theme call (map model) groups them into themes, and the server applies that grouping (labels it left out count underOther; the rarest past 400 are not sent and count underOthertoo), keeps at most 12 named themes (past that, the ones with the fewest customers count underOther, with a note) and counts the distinct customers and conversations of each theme (result.groups, mirrored with each theme's example conversations and labels incohort.read.themes). If the theme call fails, the 12 most common labels are the themes as written, and a note says so. - Check, before any example is cited. For each of the six most common themes (at least 2
customers, not
Other), one check call on the answer model re-reads up to five candidate example conversations (distinct customers, the most focused first) and confirms which of them show the theme as an answer to the question. Only confirmed conversations are cited (and kept as the theme'sevidence); a theme with fewer than two confirmed examples from different customers is not listed in the narration context (its counts stay incohort.read.themes, and a note says how many were left out). A check call that fails or runs out of time keeps the map model's own picks for that theme, with a note. The check calls run in parallel (cohort.read.check_calls,cohort.read_all.checkindiagnostics.time_ms) and are priced at the answer model's rate. - One narration over that block (the answer model): the listed themes most customers first with their counts and example markers, or the matching customers with their markers, and the coverage. The number check verifies its numbers against the computed counts (a theme's count only next to that theme).
coverage states conversations_read of conversations_in_cohort and subjects_read of
subjects_in_cohort; status is complete only when every conversation of the cohort was read,
else partial with diagnostics.degraded_sources: ["cohort_synthesis_partial"] and a note naming
the cause (CORTEX_COHORT_SYNTH_MAX_CALLS, which reads the newest conversations first; map calls
that failed or outlived the deadline; conversations with no stored text). A read that read nothing
makes no narration call and answers with the server summary. cohort.read gives the map model,
the conversations in the cohort, read, unread, truncated, dropped and matching, the batches, the
calls by kind (map, theme, check, narration), the distinct labels, the themes, the tokens of every
call of the answer and their cost at the price book's rates (cost_usd, map and theme calls at the
map model's rate, check and narration calls at the answer model's), and the elapsed time. Every call is also recorded in the usage ledger under the
answer role with its own model name. Membership and themes are the map model's reading of each
conversation, counted by the server: the narration says "customers raised", never "all
customers".
Reusing a read (0.10.5, CORTEX_COHORT_READ_CACHE, on by default). Two runs of the same
question used to list a few different customers, because the map model reads each conversation
afresh. A complete read (every conversation read, none erased while it was read) is now kept in
the server's memory and served again, with no map, theme or check call, to a later answer with the
same identity: the same tenant (the caller token's audience), scope, subject level and naming
(with stable aliases, the same cohort_alias.key), the same plan
(cohort.read.plan_fingerprint) over the same conversations (cohort.read.cohort_fingerprint) at
the same data revision (the cohort projection's captured offset, visibility revision and
forgotten-marker generation, and the scope registry revision), the same reader question (the
canonical topic for a plain topical question, else the question the readers got), models, prompts
and read settings, and the same caller authorization. So an English question and its Hinglish
translation that plan the same plain read get the same customers and counts; a negated or
otherwise non-plain question is its own read. Before a result is reused, every conversation it was
computed from is checked again against the live forget and erasure fences; if one no longer
passes, the scope's results are dropped and the cohort is read again. /v1/forget and
/v1/erasures clear every kept result before they run and when they finish. A reused block says
so: cohort.read.reused: true, cohort.read.computed_at is the earlier read's time, a note
starting result reused:, and the batch, call, token, cost and elapsed_ms figures of
cohort.read are this answer's own (no map, theme or check call); the narration runs again, in
the asker's language. At most 16 results (32 MiB) are kept, least recently used out; nothing is
written to disk and a restart empties it. naming: "alias_ephemeral" answers are never kept.
CORTEX_COHORT_READ_CACHE=0 turns reuse off. Every cohort.read also carries computed_at,
plan_fingerprint, cohort_fingerprint (short digests, equal when two answers ran the same plan
over the same conversations), topic when the plan has a canonical topic, and reader_question
when the readers did not get the asker's own words.
Two answers with the same identity at the same time read the cohort once: the second waits for the
first's result (at most until 25 s before its own answer budget ends) and reuses it. If the first
stores nothing (a partial read, a result above 4 MiB, an answer cancelled late), the second reads
the cohort itself when at least 10 s of its read time is left, and otherwise answers from the
ranked sample with the note read: all waited for another answer ..., where it would have read
every conversation had it not waited. Ask again for a full read.
Time: one budget bounds the whole cohort answer, CORTEX_COHORT_ANSWER_BUDGET_MS from the
request's start (85 s by default, at most 95 s, so a proxy with a 100 s origin limit always gets the
answer). Every model and store call of the cohort branch finishes inside it: the LLM planner call
within 15 s; the map and theme calls by CORTEX_COHORT_SYNTH_DEADLINE_MS from the read's start (45 s
by default, at most 60 s; on a themes question the map stops 10 s before it, keeping time for the
theme call) and never later than 35 s before the budget ends; the check calls up to 15 s past the
read and never later than 25 s before the budget ends; the narration by the budget's end. A map
call still running at its cut-off is abandoned and its conversations are unread (an abandoned call
is still billed and recorded in the usage ledger); a narration that does not finish answers with the
server summary (cohort_narration_failed), never a 5xx. Measured answers take a fraction of the
budget. A faster map model keeps a cohort of hundreds of conversations inside it.
Timing and cost. A cohort answer says where its time went and what its model calls cost:
-
diagnostics.time_ms(milliseconds):cohort.plan(the planner; anllmplanner's call included),cohort.exec(the lane) andcohort.narrate(the narration call). On the ranked lanescohort.execsplits intocohort.exec.cohort_filter(Lane E's exact cohort: its counts and candidate events) andcohort.exec.ranked_recall(the one Lane R recall), followed by Lane R's own stage timessubtree.wait,subtree.candidates,subtree.search(withsubtree.search.select,.embed,.vector,.bm25,.resolve,.fuse),subtree.visible_subjects(dropping customers with no visible event) andsubtree.hydrate: times only, never the counts adiagnostics: "full"recall mixes into the same map. Aread_allanswer addscohort.read_all(the whole read, insidecohort.exec), split intocohort.read_all.fetch(CortexDB's reads: the cohort, the conversation texts and the fence re-check after the map),cohort.read_all.map(the map phase's wall time, retry pass included),cohort.read_all.themes(the theme call, when it ran),cohort.read_all.check(the check calls' wall time, when they ran), andcohort.read_all.map.call_p50/cohort.read_all.map.call_max(the median and the longest single map call, its wait for a provider-lane permit included).recall_msiscohort.exec;llm_msis the planner and narration call time only. -
diagnostics.cost_usd: the USD cost of every model call of the answer at the price book's rates, the ones the usage ledger records the same calls at (CORTEX_MODEL_PRICES, thenCORTEX_LLM_PROVIDERS, then the published table): the planner and the narration at the answer model's rate (read-all check calls included), read-all map and theme calls at the map model's.0when the answer made no model call (skip_answer_llm, an unsupported question); absent when a call ran on a model the price book has no rate for (declare one inCORTEX_MODEL_PRICES). Onread_allit equalscohort.read.cost_usd. An answer withoutcohortnever carries it. -
A
Server-Timingresponse header, in milliseconds with one decimal:Server-Timing: cortex;dur=53.4;desc="CortexDB", plan;dur=46.1, exec;dur=7.2, llm;dur=4401.0;desc="model", total;dur=4454.4totalis the server's own end to end time (diagnostics.total_ms),llmthe wall time spent waiting on model calls (the planner, the narration, and a read-all answer's map phase and theme call) andcortex=total-llm, CortexDB's own share;planandexecare the phase times and include any model call made inside them, so they do not add up tototal. A browser's network share is its round trip minustotal. A proxy in front of the server may add metrics of its own: read these by name. Only a cohort answer (not afocusfollow-up, which is a single-customer answer) and the two routes of §8.4.3 carry the header; every other response is unchanged.
To time CortexDB alone, send skip_answer_llm: true (no model call: llm is 0), or re-run the
plan an answer returned as cohort.plan with skip_answer_llm (no planner either: the server
time is the lane's own). benchmarks/latency/cohort_latency_bench.py measures p50 and p95 per
question type through POST /v1/cohort/query (plan and question) and /v1/answer, from these
fields.
Focus. cohort.focus: "C-4F2AQ7M" (or a question that names one alias) resolves the alias
over the customers the caller may read; an unknown alias and one the caller may not read both
answer 404 COHORT_ALIAS_NOT_FOUND. The question is then answered by the ordinary
single-customer answer path at that customer's scope (its own authorization, recall and prompt),
and the response carries cohort with lane: "focus" and the customer's profile.
When the ranked lane cannot run (the scope-partition map is still building after a restart,
the subtree holds more than CORTEX_SUBTREE_EXACT_VECTOR_MAX vectors, or the store does not
support it), a ranked or synthesis question answers status: unsupported with the reason
(subtree_recall_unavailable: <reason>, §8.3.1) and
degraded_sources: ["subtree_recall_unavailable"]; it is never narrated from the storage-order
sample.
Other errors. 409 COHORT_DISABLED (CORTEX_COHORT is off; even for "cohort": null),
409 SUBTREE_RECALL_DISABLED (an explicit ranked plan while CORTEX_SUBTREE_RECALL is off),
403 POLICY_DENIED (the caller lacks scope.read.descend),
404 COHORT_ALIAS_NOT_FOUND (focus), 413 COHORT_SUBTREE_TOO_LARGE (the scope holds more than
CORTEX_COHORT_MAX_EVENTS events, or its in-memory projection alone would exceed
CORTEX_COHORT_MAX_BYTES), 422 INVALID_BODY (view, filters, stream, an option out of range),
422 VIEW_NOT_ALLOWED_AT_SCOPE (a shared org-tree scope),
422 COHORT_NO_DESCENDANTS (no authorized customer scope under the scope holds data),
503 COHORT_WARMING with Retry-After: 2 (retriable; the in-memory projection is being built or
repaired past CORTEX_COHORT_WAIT_MS, or the build queue is full; stale data is never served),
503 COHORT_REQUIRES_UNIFIED_WAL (not retriable), 503 COHORT_STATE_CHANGED (retriable,
Retry-After: 1), 503 COHORT_UNAVAILABLE (retriable; a cohort read that failed), 501 COHORT_UNSUPPORTED
(not retriable: a native answer host, which serves no cohort answer; send the question to a server that serves the
scope's root), 503 SUBTREE_BUSY (retriable; the ranked lane's
in-flight cap or deadline), 503 MEMORY_PRESSURE (read: "all" while memory is high,
details.kind: "cohort_read_all", Retry-After: 10) and 503 AUTHORIZATION_STATE_CHANGED. The
ranked lane's recall and the model calls answer their own errors (503 EVIDENCE_*,
504 EVIDENCE_TIMEOUT, ANSWER_PROVIDER_*, §8.4). The answer cache never stores or serves a
cohort answer.
The legacy parent answer. A /v1/answer at a parent scope without cohort still reads the
scopes under it in storage order, not by relevance. When the recall engine marks such a pack
(warnings: ["parent_pack_unranked_sample: events from K of M authorized descendant scopes, ..."],
§9; CORTEX_PARENT_SAMPLE_WARNING, on by default in 0.10.4, 0/off turns it off), the answer
prompt gains one line: "The memories below come from K scopes under this one (customers, teams,
sessions or similar) and were selected in storage order, not by relevance: they are a sample, so
do not generalise them to every scope under this one". K counts the descendant scopes whose events
the context the model reads actually holds (the line states no number when none can be matched).
The note is informational: it is not a diagnostics.degraded_sources entry, it does not set
diagnostics.partial, and such answers stay cacheable. A leaf pack never carries that warning.
8.4.3 POST /v1/cohort/query and GET /v1/cohort/vocabulary (xscope, flag-gated, new in 0.10.4, experimental)
The exact lane's own routes: deterministic, no model call, the same CORTEX_COHORT flag
(409 COHORT_DISABLED while off) and the same gates as §8.4.2 (scope.read.descend on the scope,
a revision-stamped descendant authorization snapshot taken before and re-checked after execution).
Both answer over the customers the caller may read only, decided per exact event scope, and report
nothing about the ones left out.
POST /v1/cohort/query takes exactly one of plan and question:
{
"scope": "org:acme",
"plan": {"op": "top", "where": {"labels_all": ["etype:view"]}, "group_by": "label:model",
"metric": "subjects", "n": 5},
"anchor": "data_end",
"subject_level": "child",
"naming": "alias",
"limit": 100,
"evidence_per_subject": 1
}
| Field | Notes |
|---|---|
plan | A CohortPlan (grammar below). A plan with lane: "ranked" is refused (422, details.field: plan.lane): ranked plans are served by /v1/answer. |
question | Instead of a plan: the rules planner of §8.4.2 (never an LLM call, at most 4,096 bytes). Its mapping notes come first in notes, an alias in the question runs profile, and a question about what customers said answers 200 with status: "unsupported" (needs_conversation_reading: ask it on /v1/answer with cohort). |
anchor | now, data_end or an RFC 3339 instant; default data_end when the plan has a natural window, else now. |
subject_level | child (default: a customer is the scope one level below scope, its subtree included) or leaf (the event's exact scope). |
naming | alias (stable aliases), alias_ephemeral (per-request aliases) or scope (no aliases; real scopes only). Real scopes are always in result.subjects[].scope. |
limit | Customers per page of a list, 1-1000 (default 100). |
cursor | result.next_cursor of the previous page. It anchors on the last customer listed: the next page resumes after that customer even if rows moved, and answers 503 COHORT_STATE_CHANGED (restart the listing) when that customer is no longer listed with the same count. A cursor this server did not issue is 422 (details.field: cursor). |
evidence_per_subject | Event ids listed per customer, 0-3 (default 1), with their own scopes in evidence_scopes. |
The response body is a CohortBlock (the cohort object of §8.4.2, without
narration_unverified_numbers). Its as_of names the WAL offset, visibility revision and
forgotten-marker generation the answer was computed at.
Plan grammar (version 1). Every field is optional unless stated; full schema:
docs/schemas/openapi.json (CohortPlan).
| Field | Meaning |
|---|---|
where | A same-event predicate: intent (any of), intent_prefix (dot-segment prefix: shop.order matches shop.order.cancel), labels_all, labels_any (family:value, compared case-insensitively), modality, observed ({from, to}, inclusive), via (a semi-join: the event carries a family:v label that some event matching via.match also carries) |
all_of / none_of | Up to 4 predicates each: the customer also has (never has) an event matching each |
sequence | {first, then, within_days?}: the customer's earliest first event is strictly before its latest then event |
op | list (customers by matching events, paged), count, top (group_by: intent, modality, day, week or label:<family>; n 1-50; per_subject: "dominant" counts each customer once under its most frequent value; every group tied with the n-th is listed and ties_at_cutoff set), funnel (steps, 2-8; ordered: true makes each step follow the previous one), latest (n 1-200; per_subject: true for one per customer), share (numerator / denominator predicates), profile (subject: an alias or a scope) |
metric | subjects (default) or events |
window | {from, to} or {natural: "last week"}, resolved against the anchor and always stated in coverage |
chain | Up to 3 plans; a later step may name {stepN.key}, the first group key of step N's top (for example "the viewers of the most-viewed vehicle") |
A term that matches nothing is an empty, complete result ("0 of N"), never an error.
GET /v1/cohort/vocabulary?scope=org:acme&subject_level=child returns what the planner can
match, over authorized rows only: subjects, events, data_span, intents[] and
modalities[] (each {value, events, subjects}), and label_families[] (family,
distinct_values, events, subjects, the values themselves when a family has at most 500, and
co_families / intents: which other families and intents the events carrying that family also
carry, which the planner uses to infer a via join).
Both routes may answer 503 COHORT_WARMING with Retry-After: 2 while the scope's in-memory
projection is built (in the background; POST /v1/admin/cohort/warm starts it ahead of the first
question, and CORTEX_COHORT_WARM_ROOTS queues named scopes at boot) and
413 COHORT_SUBTREE_TOO_LARGE past CORTEX_COHORT_MAX_EVENTS or CORTEX_COHORT_MAX_BYTES.
A 200 of either route carries the Server-Timing header of §8.4.2 ("Timing and cost"): plan
is the rules planner's time for a question (0 for an explicit plan, and on the vocabulary
route), exec the lane's, llm is always 0, so cortex equals total. An error envelope
carries none.
Who may call. scope.read.local and scope.read.descend on scope, and Reader on its roster
on a per-actor token; both routes read stored rows, so under CORTEX_OPERATOR_DATA_READS=deny the
operator key needs the break-glass header (§8.15.3). An event that carries atoms (DB-23) is never
in a projection. A run that loses a race with an authorization change under the root (a new
customer's first write) runs again from a fresh snapshot, at most three runs. On a cluster the
ingress routes both by the root of the scope; the projections and cohort_alias.key are per node.
Errors (both routes): 409 COHORT_DISABLED (details.flag); 400 INVALID_QUERY for the
vocabulary's query (a scope that does not parse, a subject_level other than child or leaf,
a parameter not listed); 400, 415 or 422 INVALID_BODY for the query's body (unknown fields
are refused; details.field for an invalid plan or option, such as plan.lane, question,
limit, evidence_per_subject, cursor); 403 POLICY_DENIED, APP_NOT_ADMITTED,
BREAK_GLASS_REQUIRED; 413 COHORT_SUBTREE_TOO_LARGE; 422 VIEW_NOT_ALLOWED_AT_SCOPE (a shared
org-tree scope); 422 COHORT_NO_DESCENDANTS; 503 COHORT_WARMING (retriable, Retry-After: 2),
COHORT_REQUIRES_UNIFIED_WAL, COHORT_STATE_CHANGED (the query; retriable, Retry-After: 1),
COHORT_UNAVAILABLE (retriable), AUTHORIZATION_STATE_CHANGED (retriable), NOTICE_UNAVAILABLE
(a break-glass read of a private region, §8.15.3) and SCOPE_STORAGE_UNAVAILABLE.
POST /v1/admin/cohort/warm (trusted operator: the static key or an auth-disabled server;
403 POLICY_DENIED otherwise, checked before the flag) starts, or joins, the background build of a
root's projection and answers 202 with its state, without waiting:
POST /v1/admin/cohort/warm
{"scope": "org:acme", "subject_level": "child"}
202
{"root": "org:acme", "subject_level": "child", "state": "building", "rows": 0, "subjects": 0,
"bytes_estimate": 0}
state is building, ready (with as_of), repairing or failed; a build that refused the
root as too large reads failed, and a query then answers 413. Errors: 409 COHORT_DISABLED,
400, 415 or 422 INVALID_BODY (unknown fields refused), 503 COHORT_WARMING (retriable,
Retry-After: 2: the build queue, CORTEX_COHORT_CACHE_ROOTS builds, is full),
503 COHORT_REQUIRES_UNIFIED_WAL, 503 COHORT_UNAVAILABLE (retriable). On a cluster the ingress
routes it by the root, so it warms that root's leader.
GET /v1/admin/cohort/status (trusted operator; served whatever the flags say) answers this
node's cohort flags (cohort_enabled, subtree_recall, planner, parent_sample_warning), its
effective numeric knobs by environment name (config), its resident projections (resident[],
each as the warm route answers it) and the Lane E counters (builds, full_rebuilds_unscoped,
subject_repairs, catch_ups, refused_too_large, warming_refusals, builds_skipped,
budget_evictions). It is node-local: a cluster ingress answers 501 CLUSTER_ROUTE_UNSUPPORTED
(reach a node with cortexdb admin node call). Both admin routes are operator-plane routes,
served in every CORTEX_OPERATOR_DATA_READS mode.
8.4.4 POST /v1/compose — Write a document from memory
Capability: scope.read.local on scope and, on a per-actor token, Reader on its roster; the
view's traversal capability (scope.read.holistic for holistic and lineage,
scope.read.descend for descend); llm.invoke, always: compose has no context-only mode. Each
extra scope and mounted scope is authorized as a direct granular read (§8.3.2). Under
CORTEX_OPERATOR_DATA_READS=deny the operator key needs the break-glass header (§8.15.3).
The document counterpart to /v1/answer: one recall with brief as the query, then one
answer-model call that writes a markdown document from the context. Synthesis is permitted and
fabrication forbidden; where evidence is thin a section says so instead of the whole document
abstaining, and none of the answer route's question machinery runs (no supplemental passes,
abstain retry or premise guard). With no view, an empty holistic pack at a scope with authorized
descendants is recalled again with descend (never at a shared org-tree scope).
{
"scope": "org:acme/user:alice",
"brief": "Digest of my week, as a table of decisions and owners",
"time": "last 7 days",
"length": "standard",
"structure": ["Decisions", "Open questions"],
"citations": true
}
| Field | Type | Notes |
|---|---|---|
scope | string | Required. |
brief | string | Required, not blank: what to write; also the retrieval query. |
view | enum | holistic (default), lineage or descend. raw, structured and granular are 422 INVALID_BODY. At a shared org-tree scope (§8.8.7) the walking views are 422 VIEW_NOT_ALLOWED_AT_SCOPE and granular is taken, and is the default; a caller who may not read such a scope gets the 422 INVALID_BODY of granular, so the answer says nothing of the scope's kind. |
time | string | A natural-language window ("last 7 days"), resolved as temporal.natural under strict (422 UNPARSEABLE_TEMPORAL). |
depth | enum | standard (default: ranked retrieval with the size probe) or exhaustive (the whole scope when it fits). |
length | enum | The output budget: brief (600 tokens), standard (1,500, the default) or deep (4,000). |
max_tokens | int | Overrides length. Without it an exhaustive pack scales the budget to its context, up to 16,000. CORTEX_ANSWER_MAX_TOKENS may clamp either; a document cut at its budget ends with a note naming it. |
structure | array | A section outline the document follows exactly, in order. |
format | string | markdown only (422 INVALID_BODY otherwise). |
instructions | string | A style addendum after CORTEX_ANSWER_DEFAULT_INSTRUCTIONS; at most 4,000 characters. |
model | string | The model to write with, where the renderer routes by model. |
citations | bool | Grounded [S#] citations; default true. |
include_context | bool | Return context_block. |
filters | object | As on /v1/recall. |
use_pack_id | string | Write from a pack returned within 60 seconds; 404 NOT_FOUND for one that is not this scope's or no longer current, 422 INVALID_BODY for a malformed id. |
newest_of_kinds, extra_scopes, mounts, coverage, beliefs, consistency | As on /v1/recall (§8.3.2); mounts answers no_app and app_unknown only, and coverage reports the recall the document was written from. | |
purpose | string | read_purpose_v1: as on /v1/recall (§8.3). |
session | string | derivation_use_rules_v1: as on /v1/answer (§8.4), for this composition's recall passes. |
stream | bool | text/event-stream (§10.2) when the renderer streams, else JSON; a stream carries no coverage, warnings or consistency fields. |
Unknown fields are ignored.
Response:
{
"pack_id": "pack_01J...",
"document": "## Decisions\n\n| Decision | Owner |\n|---|---|\n| Ship the beta on June 2 [S1] | Alice |",
"citations": [{"marker": "[S1]", "layer": "event", "id": "evt_01J...", "support_strength": 1.0}],
"provenance": {"trail": [...], "citations": {...}},
"diagnostics": {"recall_ms": 380, "llm_ms": 5210, "total_ms": 5602, "answer_model": "claude-opus-4-6",
"answer_llm_skipped_by_request": false, "tokens_input": 3100, "tokens_output": 912},
"as_of": "2026-11-02T10:00:00Z"
}
plus context_block, coverage, warnings and the consistency fields as on /v1/answer. A
composition is never cached; hosted plans count it as one of the month's answers. A provider failure answers 502 ANSWER_PROVIDER_ERROR (retriable: true) and is not counted: a composition counts once its document is rendered.
Before 0.14.0 it answered 200 with the error text as the document. A run that loses
an authorization race runs once more (at most two runs).
Errors: as /v1/answer (§8.4) without the cohort codes: 402 PLAN_LIMIT_REACHED,
403 POLICY_DENIED (llm.invoke included), 404 NOT_FOUND, 408 WAIT_TIMEOUT, 422
(INVALID_BODY for a blank brief, an unknown length, depth or format, instructions over
4,000 characters and the views above; INVALID_EXTRA_SCOPES, INVALID_MOUNTS,
VIEW_NOT_ALLOWED_AT_SCOPE, UNPARSEABLE_TEMPORAL, CONSISTENCY_TOKEN_INVALID),
429 SUBTREE_RATE_LIMITED, 500 INTERNAL_ERROR (retriable), 502 ANSWER_PROVIDER_ERROR (retriable), 503 ANSWER_UNAVAILABLE (after
authorization; CORTEX_ANSWER_STUB=1 opts the stub renderer back in for CI and development), the
provider lane's and the evidence lane's 503s, 503 NOTICE_UNAVAILABLE, 503 WAL_UNAVAILABLE (a consistency token's state),
504 ANSWER_PROVIDER_TIMEOUT and 504 EVIDENCE_TIMEOUT.
8.5 POST /v1/forget — Selective Forget
Capability: forget.cascade.<mode> matching the requested cascade (forget.cascade.derived_only by
default), or, for a forget that reads nothing first ("By key", below), forget.by_key in its place, at every
authorization boundary of the request: scope and every registered (or deleted) scope under it, or, for a
selector of event ids that all resolve under scope, the scopes those events are stored in. A per-actor token
also needs the Owner role at each of them; the trusted operator (the static CORTEX_API_KEY, or an
auth-disabled server) skips the roster. A person's own application home that has no record
(<tenant>/app:<id>/user:<p>, p the caller, under a registered application record, where a redirected write of
theirs lands) is decided as their reads and writes there are: its person is its Owner, through the application link
the home will read once its first write registers it. So a forget there, its preview and an erasure are served as the
person's listing and recall there are: at a space CortexDB never made they answer 200 with nothing matched and
nothing deleted (with the "selector matched no records" warning where a selector named something), and register
nothing. Any other path with no record answers as before, another person's own home included. A forget is a write: under CORTEX_OPERATOR_DATA_READS=deny it needs
no break-glass header, whatever its selector (§8.15.3).
Note: Earlier drafts used
DELETE /v1/forgetwith a JSON body. We usePOSTinstead because (a) DELETE with bodies is unreliable across HTTP clients/proxies, (b)forgetis a job that may be long-running, and (c) it composes uniformly with the/v1/erasuresjob family for true erasure (§8.6).
{
"scope": "org:acme/dept:eng/user:alice",
"layers": ["beliefs", "facts"],
"selector": {
"about_subject": "user:alice",
"about_entity": "ent_acme_corp",
"predicate": "is_likely_to_renew",
"memory_ids": []
},
"cascade": "derived_only",
"confirm_all": false,
"audit_note": "User retracted speculation"
}
Warning: the default cascade keeps the memories. A forget that does not name a
cascaderunsderived_only, on every deployment. On the hosted service this is also the preset's setting (cloud_shared_saassetsforget.cascade.default: derived_only, as every shipped preset does).derived_onlyremoves derived data only: facts, beliefs, episodes and understanding. The captured memories (events) stay, and recall,/v1/answerandGET /v1/eventskeep returning them. A whole-scope forget ("confirm_all": true, no selector) under the default cascade therefore deletes no memory; its response says so inwarnings.To delete memories:
- Named memories: put their event ids in
selector.memory_ids, withlayersempty or namingevents. They are deleted under either cascade, the default included.- Every memory in a scope:
POST /v1/erasures(§8.6), the erasure with a preview, a status, a receipt and a proof. A forget with"cascade": "redact_events"and"confirm_all": trueblanks every event in the scope instead.Retry keys. Deleting a memory frees its
idempotency_key: after amemory_idsforget or an erasure, re-sending the deleted write with its old key stores it again. A scope-wideredact_eventsforget does not free them. Its blanked events keep their keys (a key lasts up to 24 hours from its write), and a re-send with an old key answers with the blanked event (replayed_from_idempotency: true) and stores nothing. Send new keys to write that content again.
The body is strict. Its fields are scope, layers, selector, cascade,
confirm_all, audit_note (reason is accepted as an alias) and
from_preview_id; any other key is refused with a 422 (unknown field) and
nothing is deleted. That includes idempotency_key, which /v1/experience and
/v1/erasures take but a forget does not: re-sending the identical forget is
safe without one. POST /v1/forget/preview takes the same body.
selector takes about_subject, about_entity, predicate and memory_ids,
and with forget_by_key_v1 the keys below. It has no time filter, and it is
strict: any other field (for example valid_during) answers
422 INVALID_BODY with details.reason: "unknown_selector_field" and
details.field naming it, and nothing is deleted. A dropped field would leave
the selector wider than asked, and an empty selector is the whole scope, which
needs confirm_all (below). layers names events, episodes, facts,
beliefs, understanding or code (the code plane's repositories); any other
name answers 422 INVALID_BODY, details.reason: "unknown_layer", since a
selective forget naming no derived layer cascades to all four. The preview
applies from_preview_id as the forget does: an id the forget would refuse
answers 422 UNKNOWN_PREVIEW_ID there too.
about_subject and about_entity together are both applied: a fact must match
each. Under redact_events every attribute field is a full-text query an event
must match (the events every set field selects), never the first field's hits
alone; memory_ids is an OR beside them. Two combinations are refused as not
applied, since the forget would answer 200 having done less than asked: under
redact_events, which keeps every derived record, a fact_ or ent_ id in
memory_ids (details.fields: ["selector.memory_ids", "cascade"]), and, when
layers leaves the events out, any selector field (the fields and layers).
Each is 422 INVALID_BODY, details.reason: "field_not_applied", details.field
the first and details.fields all of them, on the forget and its preview, and
nothing is read or erased.
By key (forget_by_key_v1, since 0.14.0). selector.idempotency_keys (at most 1,024
{"key", "caller"?}: the event each key's first write to the scope stored (a /v1/experience or
/v1/experience/bulk write, which share one bucket: an import's keys select nothing),
found through its idempotency claim wherever a redirect landed it; caller
defaults to the request's own, and a claim lasts 24 hours) and
selector.capture_keys (at most 64 labels: every event at exactly the scope
that carries one, such as a capture's cap:<capture>, cancelled and sealed events
included) name events by keys the client already holds, so the forget reads nothing
first. They combine with memory_ids, and the response counts only: requested
counts one more per idempotency key and per event only a capture key named. A key
whose claim expired or was freed names nothing. The route checks the scope itself
before it resolves any key, so a caller that may not forget there learns nothing of
what its keys name; an event a redirect landed outside scope is forgotten at its
home when the caller may forget there (Owner and the capability), and is passed over
otherwise, as an id stored elsewhere is. A forget whose selector names only event
ids, fact_<uuid> ids and keys, under the default derived_only cascade, is
admitted by the policy capability forget.by_key or by
forget.cascade.derived_only (forget.by_key admits no query selector, no entity id,
no empty selector and no other cascade), and it is not a query: under
CORTEX_OPERATOR_DATA_READS=deny it and its preview need no break-glass. A key list
past its bound, an empty key, or a caller that is no principal is
422 INVALID_BODY with details.field. A store the keys are resolved from that does not read (the claims, the
scope index, a sealed event's segment) fails the forget and its preview, 502 FORGET_BACKEND_FAILED (retriable), never
a count that skipped rows. The erasure routes take neither key (§8.6.3).
Legal holds (since 0.14.0). A hold record of the tenant keeps what it names
(§8.6, "Legal holds"). A forget neither deletes nor blanks a held event: it records
a pending held erasure of it under an id of the forget's own (fgt_..., not
returned), which the shard leader's runner erases once no hold keeps it. Every
derived record (a fact, a belief, an episode, a concept) that cites a held event,
directly or through a fact, an episode or a belief, stays too, wherever it is homed,
and so do the derived records homed in a held scope or a held person's region: a hold
freezes what the system knows about the held material, in every shape of forget (by
event ids with or without the events layer, by fact ids, by attributes, scope-wide).
A record whose sources are all unheld is deleted as before, and a fact one of whose
sources is erased and another held keeps the held one. deleted counts only what
went: it leaves the held out, events_under_legal_hold counts the events a
hold kept (each a pending held erasure) and derived_under_legal_hold (facts,
beliefs, episodes, understanding) the derived records it kept (since 0.14.0).
What a hold kept was matched: matched counts it beside what went, and a selector whose
every match a hold kept gets no "selector matched no records" warning. A hold placed or released while the forget runs
makes the engine plan its next entry again; past its attempts the forget answers
503 HOLD_CHANGED (retriable), keeping what already applied. POST /v1/forget/preview
counts in events_under_legal_hold the events the forget would delete or blank that a
hold keeps, and in derived_under_legal_hold the derived records it would delete that a
hold keeps, because one of their source events is held or their home is, by the same
read of the holds; neither is counted in any estimated_deleted field.
While a restore mark holds the root (since 0.14.0). A scope root restored from a
backup that lost its access state stays pending until its access sources acknowledge
it (or the operator does, POST /v1/admin/access/restore). Meanwhile only the
trusted operator's forget whose selector reads no stored rows (ids, keys, or an empty
selector), and its preview by ids or keys, are served; any other forget or preview
naming the root answers 503 ACCESS_RESTORE_PENDING, not retriable, with
details.root, pending_sources, restored_at, owner_acknowledges and
operator_override.
The license gate (since 0.14.0). A locked license passes POST /v1/forget and its
preview, as it passes every erasure route (§8.6) and POST /v1/export: deleting data is
always allowed.
Break-glass for a preview by query. Under CORTEX_OPERATOR_DATA_READS=deny (the
deployment's or the tenant's own), the operator key's POST /v1/forget/preview whose
selector names about_subject, about_entity or predicate, or holds in memory_ids an
id that names no event or fact (an ent_ id reads as about_entity), counts the stored rows
that match, so it is a read of stored rows (class stored_rows, or private_region
when the scope lies in a private region) and needs X-Cortex-Break-Glass:
403 BREAK_GLASS_REQUIRED without it, and for a private region a notice that commits
first or 503 NOTICE_UNAVAILABLE (§8.15.3). The forget itself, and a preview by event or fact ids
or by keys, need none.
Response:
{
"deleted": {
"events": 0,
"episodes": 0,
"facts": 2,
"beliefs": 1,
"understanding": 0
},
"audit_id": "audit_01HX...",
"purge": {...}
}
Cascade modes:
| Mode | Capability | Behavior |
|---|---|---|
derived_only (default) | forget.cascade.derived_only (or forget.by_key for a forget by ids and keys) | Deletes derived records from the named layers; events untouched, except the events a memory_ids selector (or a key) names, which it deletes (see the warning above) |
redact_events | forget.cascade.redact_events | With confirm_all and an empty selector: blanks every event of the scope recorded at or before the cutoff (payload, labels, intent, location and source removed; id, scope, actors, timestamps and wal_offset kept), tombstones the scope, and deletes the derived layers layers names. With memory_ids: deletes those events, as derived_only does. With about_subject, about_entity or predicate: deletes the events under the scope that every set field's full-text query selects (never the first field's hits alone; memory_ids is an OR beside them), and selects no derived record (§11.2) |
events_too is NOT a cascade value here — true erasure of events goes through /v1/erasures (§8.6).
confirm_all flag. When the selector is empty (or only layers is set), the server requires confirm_all: true to proceed — otherwise it 422s with EMPTY_SELECTOR_WITHOUT_CONFIRMATION. This is the foot-gun guard for "forget everything in this scope." A non-empty selector (keys included) with confirm_all: true is refused, 400 AMBIGUOUS_SELECTOR_CONFIRM_ALL, rather than widened into a scope-wide forget.
What a scope-wide forget selects (the selection pin). A confirmed
scope-wide forget, and a /v1/erasures execute (§8.6.3), fix their selection
once, when the request starts: the server reads the log head, then takes the
cutoff, its clock reading or, when later, the latest time recorded on an event
the log already holds (a shard that changed leader, or received a moved scope,
can hold events stamped ahead of this server's clock), before it reads any
event. So every event already in the log is recorded at or before the cutoff,
whichever server stamped it. Every step of the
request then selects against that pin: the storage engine's derived-layer
passes, the scope tombstone, which is committed to the log only once those
passes succeeded and carries the pinned cutoff, and the event redaction. An
event is selected when the server recorded it at or before the cutoff. The
comparison always uses the server's own context.recorded_at, never the
client-supplied observed_at.
- A capture the server stamps after the cutoff is kept, whenever it
reaches the log: in practice every capture sent after the forget started.
It stays readable through
GET /v1/events/{id},view: "raw"and default recall, and after a restart. Before the pin, such a capture could be erased even though its200had already been sent. - A capture sent after the forget returns is kept too, even when its
observed_atis earlier than the forget. Backdatingobserved_atnever selects an event. - A capture that the server stamped before the cutoff but that was still being written when the forget started is treated as part of the forgotten history when it reaches the log before the forget's tombstone: it is hidden and its payload is blanked. One that reaches the log only after the tombstone is stamped after the cutoff there, and kept.
- The cutoff is compared at microsecond resolution everywhere. The server moves it to the last nanosecond of its microsecond before any comparison, and every event that reaches the log after the tombstone is stamped at least a microsecond after it, so the event store, the tombstone and the storage engine all make the same decision for an event stamped in the same microsecond as the cutoff (such an event is selected). Previously a capture stamped a few hundred nanoseconds after the cutoff could stay readable while its searchable content was purged.
- A forget whose derived-layer pass fails answers the error before its tombstone is committed, so the scope is never hidden while the records the forget was meant to clear are still there; a retry takes a new pin.
deleted.events on a scope-wide redact_events forget counts each event
the request actually blanked, once. Events that are already blanked are
skipped: they are not rewritten and not counted, so forgetting an
already-forgotten scope reports events: 0 and costs almost no writes. (The
count used to include every previously blanked event again, and the storage
engine's document tally was added on top, so 300 events read as 600.)
POST /v1/forget/preview counts the same way: only events not yet blanked.
What a forget holds while it runs. A forget, a forget preview, and an erasure preview or execute (§8.6) check the scope plan once, then run without holding the scope registry. They hold a destructive lease on their footprint instead: the whole subtree of a scope-wide request, or each explicitly named target and its ancestors for a selective one. While the lease is held:
- Reads, captures into scopes that are already registered, and scope changes outside the footprint proceed normally. (They used to wait for the whole forget.) A capture into an existing scope under the forgotten subtree is admitted, and the selection pin above keeps it.
POST /v1/scopes,PUT /v1/scopes/membersandDELETE /v1/scopeson a scope inside the footprint, or on an ancestor that governs it, return409 SCOPE_STATE_CHANGED, retriable since 0.14.0 (0.13.x's envelope saidfalse): the conflict ends with the forget, so send the change again once the forget has returned.- A capture (
POST /v1/experience,/v1/experience/bulk) that would auto-register a new scope inside the footprint, or bind a tenant to a record there, waits until the forget finishes and is then admitted against the post-forget ACL. The wait is bounded byCORTEX_DESTRUCTIVE_LEASE_WAIT_SECS(default 120 s, clamp 1-3600; seedocs/generated/env-vars.md§14). If the forget is still running when it elapses, the capture fails with409 DESTRUCTIVE_OPERATION_IN_PROGRESS,retriable: true,Retry-After: 5, anddetails: {scopes, retry_after_seconds, admission_wait_seconds}. Nothing was written; re-send the identical request (the sameidempotency_keyis safe). Since DB-4 a whole-scope erasure costs about a millisecond per event (0.56 s measured for 510 events, 2.8 s for 2,531), so the default covers scopes far larger than a typical customer's; raise the knob for scopes of tens of thousands of events if your clients do not retry. (This used to be a403 POLICY_DENIED, which read as a permanent refusal.) If the conflict has already cleared by the time the error is rendered, the code is409 SCOPE_STATE_CHANGED, also retriable, withRetry-After: 1.
A scope registered while a forget is being authorized (0.10.2). A forget, a forget preview
and an erasure preview or execute (§8.6) plan their authorization once, then take the lease
against that plan's set of authorization boundaries in the footprint. A scope registered or
removed outside the footprint (for example a capture, from any tenant, that registers a
brand-new scope elsewhere) no longer affects the request. Before 0.10.2 any registration between
the plan and the lease made the request answer a spurious 403 POLICY_DENIED, with nothing
executed. When a boundary appears or vanishes inside the footprint, the request re-plans on
the current state (a caller the new boundary denies still gets 403) and tries again, up to 5
attempts. If the footprint moved on every attempt, the answer is 409 AUTHORIZATION_STATE_CHANGED, retriable: true, Retry-After: 1 and
details.retry_after_seconds: 1; nothing was changed, so re-send the identical request. Under a
sustained storm of new child scopes inside the footprint (measured at about 28 per second) the
retries do not converge while the storm lasts; v0.10.1 answered 403 there. The same code is
503 on /v1/recall and /v1/answer, where it means the authorization changed while evidence was
being assembled (§16).
A forget whose client disconnects still runs to completion and still writes its audit row. Retrying the identical request is safe.
Shutdown. On SIGTERM or SIGINT the server stops starting new forget and
erasure work: POST /v1/forget, POST /v1/erasures, POST /v1/erasures/person
and POST /v1/erasures/tenant (its dry run included) answer
503 SERVER_SHUTTING_DOWN (retriable: true, Retry-After: 5) and change
nothing; the previews are not refused. It then waits for the forgets and erasures already running,
including those whose client disconnected, to finish their deletion, audit row
and erasure-job state, and only then writes the final snapshot and exits. The
wait is bounded by CORTEX_SHUTDOWN_DESTRUCTIVE_WAIT_SECS (default 60 s,
0 skips it) and logged either way. Keep it below your supervisor's stop
timeout (systemd TimeoutStopSec, docker stop -t, which defaults to 10 s),
or the supervisor's SIGKILL ends the wait first. An operation cut off by the
bound may be missing its audit row or job state; erasure is idempotent, so
re-issue it after the restart.
A backend failure fails the request (502). A derived-layer store that
cannot answer — beliefs, episodes, concepts, or a registered erasure
participant such as the Code Intelligence Plane — returns
502 FORGET_BACKEND_FAILED (retriable: true) instead of a 200 whose
deleted counters report zero for the layer that failed. POST /v1/forget/preview
and POST /v1/erasures/preview behave the same way: a preview that could not
read a store reports the failure rather than a confident 0. Deletes are
idempotent and a preview mutates nothing, so the documented recovery is to
retry the identical request. (Audit C-05 / DISC-028: a right-to-be-forgotten
flow must never read as complete because the store that held the data was
unreachable.)
Forget by entity id. about_entity, about_subject and a
memory_ids entry that is an ent_... id all name the entity the way
GET /v1/facts and GET /v1/beliefs show it. Triple writes store the raw
subject ("Priya", "José"); the server maps the id back to those subjects,
inside the request scope and its descendants only, and under
cascade: "derived_only" deletes the facts about that subject plus the
beliefs and understanding they support. Three id shapes resolve:
| Id | Example | Matches |
|---|---|---|
| ASCII | ent_Priya | subjects whose id is exactly this, case-sensitive (ent_priya names nobody) |
| Hashed (non-ASCII name) | ent_u-0133576006acc0d5, ent_jose-0f66606aa13f1258 | every spelling of that one name (NFC/NFD, case, ZWNJ) |
| Legacy (before the multilingual ids) | ent_Jos_ | the one non-ASCII subject in scope with that old id, case-insensitive; if the old id names more than one subject in the scope, it matches nothing — retry with about_subject set to the exact surface |
A plain surface ("about_subject": "Priya") keeps matching byte for byte, and
ent_<uuid> keeps its old meaning in memory_ids (an event id). Only the
subject is matched, not the object. Under cascade: "redact_events" an entity
id deletes no events (one in memory_ids is refused, field_not_applied, above).
POST /v1/forget/preview dry-runs entity ids and attribute selectors with the
execute's own match; under redact_events a query's preview counts the events it
selects in estimated_deleted.events (before 0.14.0, none). It counts the facts the
execute would delete and the beliefs and understanding they support, so a
preview no longer reports 0 for a request whose execute deletes facts. An
entity id that repeats about_entity/about_subject is counted once. The
preview is a snapshot: a fact written between the preview and the execute is
counted by the execute only. fact_... ids in memory_ids are previewed (the
facts, and the beliefs and concepts they support; since 0.14.0, they used to preview
as nothing). estimated_deleted.events counts a named event sealed into a segment,
which the forget erases from it, as the forget counts it (since 0.14.0; before, the
preview left it out); one a hold keeps by its marker is counted in
events_under_legal_hold.
Ids outside the scope. A memory_ids id stored in another scope is
treated exactly like an id that does not exist, on both POST /v1/forget and
POST /v1/forget/preview: 200, every count 0, requested = the number of
ids, matched: 0, and (on the forget) the "selector matched no records"
warning. The response never says which case it was. Other ids in the same
list are still deleted. (This used to be a 502 FORGET_BACKEND_FAILED for a
foreign id and a 200 for a missing one.) The preview carries requested and
matched only for a selector of event ids (evt_... or raw UUIDs) or of keys
(forget_by_key_v1), the shapes it counts exactly.
{
"deleted": { "events": 0, "episodes": 0, "facts": 0, "beliefs": 0, "understanding": 0 },
"requested": 1,
"matched": 0,
"audit_id": "audit_01HX...",
"warnings": ["The selector matched no records in this scope — nothing was deleted. ..."]
}
purge: what this request removed. Every forget response carries purge
(capability erasure_blob_cascade_v1), the storage engine's physical counts for
this request, the shape /v1/erasures reports as summary.purge: events,
documents, edges, blobs, retained_shared_blobs, twins_redacted,
bitemporal_records_erased, wal_rows_redacted, artifacts_cascaded. Each
counter counts only a change this request made:
events: a named event whose raw WAL row this request redacted, or one of whose content rows or search documents it removed. An event an earlier request already erased is not counted.documents: the search documents of the named events (and query hits) this request deleted. The later chunks of a long event are removed too but not counted. WithCORTEX_ENTITY_GRAPH=1, a graph entity the request moved to tombstoned counts too; with the graph off (the default) nothing does.artifacts_cascaded: derived artifacts (procedures, concepts, knowledge syntheses) removed because what they were derived from was erased. Since 0.13.0 the cascade follows a derivation chain to its end (an artifact built from such artifacts goes too), andcascaded_artifact_idslists them (at most 10,000; absent when none).
So a repeat of a forget that already completed answers matched: 0 and every
purge counter 0. Before the pre-merge fix a repeat reported events: 1 and
documents: 1, and with the graph off every forget by id added one phantom
document per named id.
warnings. Each warning names the real reason something the caller may
have expected was not deleted:
| Request | Warning |
|---|---|
confirm_all with an empty selector, cascade: "derived_only", layers empty or naming events | "Raw events were not deleted because cascade="derived_only" ..." (use redact_events, or POST /v1/erasures) |
memory_ids naming events, layers not naming events | "layers did not name "events", so no raw event was deleted ..." (add events to layers, or POST /v1/erasures) |
| a non-empty selector that matched nothing (a record a legal hold kept is a match) | "The selector matched no records in this scope ..." |
cascade: "redact_events" without confirm_all, layers empty or naming events | "cascade="redact_events" is scope-wide and requires confirm_all=true; only the events named in selector.memory_ids were deleted." |
| code repositories bound under the scope were kept | the count, with the whole-scope remedy for a selector-free request; a request with a selector is told it never removes repositories |
A request with a selector is never told to use redact_events: that cascade is
scope-wide, and following the advice by dropping the selector turns a one-id
forget into a wipe of the scope. (The first row used to fire for every
memory_ids request that deleted no event, including a repeat of a completed
forget, and recommended redact_events there.)
Where a forget spends its time. A confirmed scope forget runs its derived
passes, commits its tombstone, then redacts the scope's rows through the log in
Erase entries of up to 4096 events, each one fsynced log append; the server's
erase tail then removes each entry's events from the views (content, search
index, vectors, derived rows) and publishes the search-index deletes. Its search
for the coordinator's raw rows reads only the scope's own rows, and a
memory_ids forget reads only the named rows and the retry candidates (rows an
earlier, failed erasure marked forgotten and did not redact), through the
erasure reference index (DB-4); the blob survival proof and the leader's
preceded_by / supports: scrub list likewise read only the rows that name
what is erased, and apply frees the erased events' idempotency keys by point
reads. A forget's cost therefore grows with what it erases, not with the store:
on 0.10.1 (single node) a forget by id took 0.04-0.37 s on a 1M-event store and
0.09-0.27 s on a 5M one, where the same release without the index took 10-13 s
and 64-67 s (docs/ERASURE_COVERAGE.md, "What an erasure reads"). Before the
pre-merge fix (DB-3) the single-node build wrote one synced row per event, twice
(the event and its storage-engine copy), committed the search index twice, and
deserialized every WAL row of every scope. On a data dir upgraded from an
earlier release the node-local half of the index is backfilled in the
background at the first start, and the replicated half is built by that start's
Derived split; until both are ready (erasure_index.wal.ready on
GET /v1/admin/metrics) a forget reads the whole log as before, except the
raw-WAL discovery, which reads Derived rows only and needs only the node-local
half, and CORTEX_ERASURE_INDEX=0 keeps it doing so.
To see the split on a running server, set
RUST_LOG=<your filter>,cortex_coordinator::erasure_timing=debug. Each forget
then logs one debug line for the HTTP route (authorization, lease and queue,
engine, audit row), one for the engine (derived layers, event redaction,
tombstone, storage-engine pass, tail sweep), and one for each storage-engine
pass it runs (full-text flush, content and raw-WAL discovery, artifact
closure, purges, index publish, raw-WAL redaction). /v1/erasures logs the
storage-engine line for each pass it runs.
Errors. POST /v1/forget and POST /v1/forget/preview: 400 AMBIGUOUS_SELECTOR_CONFIRM_ALL,
400 CASCADE_UNSUPPORTED_CLUSTERED (a cluster data node, a derived-record purge that keeps its source
events); 403 POLICY_DENIED, and on the preview 403 BREAK_GLASS_REQUIRED (above); 409 AUTHORIZATION_STATE_CHANGED (retriable, Retry-After: 1), 409 REDERIVE_IN_PROGRESS (retriable,
Retry-After: 30, details.job_id); 422 EMPTY_SELECTOR_WITHOUT_CONFIRMATION, 422 UNKNOWN_PREVIEW_ID
(also for a preview id older than 15 minutes), 422 INVALID_BODY (details.reason
unknown_selector_field or unknown_layer with details.field; field_not_applied with details.field and
details.fields; a key selector out of shape with details.field; any other field the body does not have); 502 FORGET_BACKEND_FAILED (retriable;
details.audit_id on the forget); 503 ACCESS_RESTORE_PENDING (not retriable), 503 NOTICE_UNAVAILABLE
(the preview's break-glass read of a private region), and on the forget 503 SERVER_SHUTTING_DOWN
(retriable, Retry-After: 5), 503 FORMAT_UPGRADE_PENDING (retriable only for details.reason: "members_behind", Retry-After: 30) and the shard's refusals as every proposing route answers them (§6.6): a 503 under the WAL's own
code (NOT_LEADER, WAL_UNAVAILABLE, WAL_OUTCOME_UNKNOWN) or the refusal's (one the engine's own re-plans did
not clear, such as HOLD_CHANGED or REGISTRY_STALE), retriable but for a final apply refusal, 413 WAL_TOO_LARGE
(not retriable), and apply's scope fence under its own code (SCOPE_NOT_OWNED, STALE_EPOCH, retriable), each
with details.audit_id when the attempt was recorded; the disk guard never refuses a forget, so no DISK_FULL.
None of the 400 and 422 codes is retriable.
8.6 /v1/erasures — GDPR Erasure
The erasure family: POST /v1/erasures/preview and POST /v1/erasures (a whole scope, named events, or,
since 0.14.0, an outside party's labelled events), POST /v1/erasures/person (§8.6.9) and
POST /v1/erasures/tenant (§8.6.10), each run as one job with a gdpr audit row, an erasure_complete
lifecycle row and a durable receipt, and the job's routes: status, cancel, proof and receipt. It replaces
the prior DELETE /v1/forget/gdpr endpoint. A forget by memory_ids deletes the events it names too (§8.5),
but leaves no receipt to prove it; an erasure deletes what it selects with everything derived from it, and
GET /v1/erasures/{erasure_id}/verify proves it store by store. There is no reference count (the heading's
name is historical): what a whole-scope erasure deletes and what it blanks in place is decided by where each
event is stored (§11.3).
Who may call them. POST /v1/erasures, its preview and the by-id job routes need forget.gdpr at every
authorization boundary of the request (the scope and every registered or deleted scope under it; for
selector.memory_ids, the scope and the scopes the named events are stored in; for a by-id route, the job's
footprint as recorded when it was created) and, for a per-actor token, the Owner role there (Reader for the
status and receipt reads; a person's own application home that has no record is decided as their reads there are,
§8.5); while membership is enforced (any credential but the trusted operator's) the
token's principal must be a user (user:), so a service or agent token gets 403 POLICY_DENIED, or 404 on
a by-id route. The proof (§8.6.7), an outside party's erasure, a person's erasure and a tenant's deletion are
the trusted operator's alone (the static CORTEX_API_KEY, or an auth-disabled server). The erasure routes are
operator-plane routes: CORTEX_OPERATOR_DATA_READS=deny asks no break-glass of them, except of a preview whose
selector is a query (§8.15.3), which the erasure preview then refuses anyway (422 UNSUPPORTED_SELECTOR). A locked license passes every route of
the family (since 0.14.0): deleting data is always allowed, as an export is.
Legal holds (since 0.14.0). A hold record of the tenant (<tenant>/hold:<id>) keeps the events of the
scopes it names and, within each named person's window (from inclusive, until exclusive, each open when
absent), the events that person captured, observed or is the subject of, or that lie in a scope one of whose
segments is the person. Every erasure applies the holds before its closure: a held event is neither deleted
nor redacted, the derived records citing it stay with it, and each held item (an event, a rollup or declared
record, a person's directory entry) is recorded as a pending held erasure under the job's id. The receipt lists
them (held_event_ids, held_rollups, held_declared), never among what was erased, so /verify re-reads
only what went. A whole-scope erasure's tombstone (and a tenant's deletion's) still hides a held event from
every read; under any other erasure it stays served. When a hold is released (a change to its record), the
shard leader's runner erases each item no hold keeps any more, as the job asked, and every node that stores the
job's receipt records the run in held_completed. A receipt records only the runs its own node applied: a root moved
to another shard after the job ran takes its pending held erasures along, and the target's leader runs them, but the
receipt on the source's nodes does not record that run. A hold placed or released while the erasure runs makes the
engine plan its next entry again; past its attempts the erasure answers 503 HOLD_CHANGED (retriable). The
erasure preview reads the tenant's holds as the execute does: events_under_legal_hold counts the events the
execute would take that a hold keeps, counted in neither events_to_delete nor events_to_redact and in no blob
or derived count.
While a restore mark holds the root (since 0.14.0). A scope root restored from a backup that lost its
access state stays pending until its access sources acknowledge it (or the operator does, POST /v1/admin/access/restore). Meanwhile POST /v1/erasures is served for the trusted operator's erasure by
memory_ids, of the whole scope or of a party, the preview for its preview by memory_ids, POST /v1/erasures/person, POST /v1/erasures/tenant (the dry run included) and a cancel (with or without ?scope=)
for the trusted operator, and the status, proof and receipt reads; everything else naming the root (any other
caller's erasure, preview, person's erasure, tenant deletion or cancel, a cancel once its caller is authorized on
the job) answers 503 ACCESS_RESTORE_PENDING, not
retriable, with details.root, pending_sources, restored_at, owner_acknowledges and operator_override.
8.6.1 POST /v1/erasures/preview — Dry-run
Capability: forget.gdpr and the Owner role, as for the execute (read-only preview is gated by the same cap as the destructive action, so callers can't enumerate without authorization). subject (party_erasure_v1) is the trusted operator's.
{
"scope": "org:acme/user:alice",
"confirm_all": true,
"audit_note": "DSR #1234 — preview"
}
The preview needs no confirmation, but its preview_id is bound to the
caller, the billing tenant, the scope, selector (memory_ids as a set) and
confirm_all it was issued for, and expires after 15 minutes. Send the same values
you will send to the execute: a whole-scope execute requires
confirm_all: true, so preview it with confirm_all: true too.
| Field | Type | Notes |
|---|---|---|
scope | string | The scope to erase, with every scope under it; with subject, the tenant root. Required. |
selector | object | memory_ids only (§8.6.3); empty or absent previews the whole scope. Strict. |
confirm_all | bool | Bound into the preview_id; not required by the preview. |
subject | object | {"email": "..."}, party_erasure_v1 (since 0.14.0): previews an outside party's erasure (§8.6.3), in place of selector and confirm_all. The trusted operator's. |
confirm | bool | Accepted beside subject; without it 422 INVALID_BODY, details.reason: "field_not_applied". |
audit_note | string | Accepted and not used. |
The body is the execute's without from_preview_id, idempotency_key and respond: those, like any other
field the body does not have, are 422 INVALID_BODY. A preview by memory_ids counts the named events found at
or under the scope and dry-runs their derived cascade; a whole-scope preview counts every event under the scope
(in_scope_events), the ones stored exactly at the scope as deleted and the ones below it as redacted, and the
derived layers' stores under the scope (each count capped at 100,000); a party preview counts the events whose
writers labelled them party:<address> under the tenant root, as the execute selects them. The preview takes
the destructive lease the execute takes (§8.5), on the request: it is not refused during shutdown and writes no
audit row. Under CORTEX_OPERATOR_DATA_READS=deny the operator key's preview whose selector names an attribute
field needs X-Cortex-Break-Glass before the route refuses the selector (§8.15.3). While a restore mark holds
the root, only the trusted operator's preview by memory_ids is served (§8.6).
Like a forget, the preview answers the retriable 409 AUTHORIZATION_STATE_CHANGED
(Retry-After: 1) when scopes were registered or removed inside its footprint on each of 5
attempts to authorize it (§8.5), and 409 REDERIVE_IN_PROGRESS while a re-derivation holds the
scope root.
Response:
{
"preview_id": "ervw_01HX...",
"scope": "org:acme/user:alice",
"estimated_affected": {
"events": 9420,
"episodes": 318,
"facts": 4120,
"beliefs": 318,
"understanding": 12
},
"refcount_breakdown": {
"in_scope_events": 12480,
"events_to_delete": 9420,
"events_to_redact": 3060,
"events_under_legal_hold": 0
},
"estimated_duration_ms": 25960
}
estimated_affected.events is the headline delete count; refcount_breakdown
carries the full in-scope tally (in_scope_events, the whole scope's even for a
preview by memory_ids) and the delete-vs-redact split; events_under_legal_hold
counts the events the execute would take that a hold keeps (§8.6, "Legal holds"),
counted in neither events_to_delete nor events_to_redact and in no blob or
derived count.
estimated_affected also carries blobs and retained_shared_blobs
(erasure_blob_cascade_v1), and the body code_repos_to_delete (whole scope),
each omitted when 0. estimated_duration_ms is a planning estimate for choosing a client
timeout, not a promise: since 0.10.4, 1 s plus 2 ms per in-scope event, about
twice the DB-4 measurements (a whole-scope execute took 0.56 s for 510 events
and 2.8 s for 2,531 on a 5M-event store). Before 0.10.4 it was 250 ms plus
80 ms per event, the pre-DB-4 cost (one synced rewrite per event), and
predicted 35 s for an execute that takes about one. The execute answers once
the job ended, unless it asks for the early answer (§8.6.3). There is no separate manifest endpoint or manifest_url in v1 — the plan
above IS the preview. Execute returns the job's manifest_url, which is
its status resource GET /v1/erasures/{erasure_id} (§8.6.4), not a distinct
manifest route.
Errors: 403 POLICY_DENIED, 403 BREAK_GLASS_REQUIRED; 409 AUTHORIZATION_STATE_CHANGED and 409 REDERIVE_IN_PROGRESS (both retriable); 422 INVALID_BODY (key_selector_not_supported,
unknown_selector_field, field_not_applied, a field the body does not have, a subject that does not
apply), 422 AMBIGUOUS_SELECTOR (subject beside a selector or confirm_all), 422 UNSUPPORTED_SELECTOR
(an attribute selector); 502 ERASURE_BACKEND_FAILED (retriable); 503 ACCESS_RESTORE_PENDING (not
retriable), 503 NOTICE_UNAVAILABLE.
8.6.3 POST /v1/erasures — Execute
Capability: forget.gdpr and the Owner role at every authorization boundary (§8.6, "Who may call them"); subject is the trusted operator's. No route checks forget.gdpr.cross_workspace: there is no cross-workspace propagation (§11.4).
{
"scope": "org:acme/user:alice",
"confirm_all": true,
"from_preview_id": "ervw_01HX...",
"audit_note": "DSR #1234 — Alice exercised right to erasure",
"idempotency_key": "erasure-dsr-1234"
}
| Field | Type | Notes |
|---|---|---|
scope | string | The scope to erase, with every scope under it; with subject, the tenant root (its first CORTEX_TENANT_DEPTH segments). Required. |
selector | object | memory_ids: event ids (evt_<32 hex>, or the event's UUID in any spelling). Empty or absent: the whole scope. Strict (below). |
confirm_all | bool | true authorizes the whole-scope erasure of an empty selector; refused beside memory_ids or subject. |
subject | object | {"email": "..."}, party_erasure_v1 (since 0.14.0): an outside party's erasure (below). The trusted operator's. |
confirm | bool | true, required with subject; refused without it. |
audit_note | string | Operator text kept on the receipt, trimmed and cut at 1,000 characters. |
from_preview_id | string | Optional; an ervw_ id (below). |
idempotency_key | string | Optional; replays the first job (below). |
respond | string | completed (the default) or accepted, erasure_early_answer_v1 (below). |
With no selector.memory_ids the execute erases the whole scope, and it
requires confirm_all: true or it answers 422 EMPTY_SELECTOR_WITHOUT_CONFIRMATION.
To erase specific events, send selector.memory_ids without confirm_all
(both together answer 422 AMBIGUOUS_SELECTOR). Attribute selectors
(about_subject, about_entity, predicate) answer 422 UNSUPPORTED_SELECTOR
here; they belong to /v1/forget. A named event found at or under the scope is
erased, as a live row, a sealed event or an expired marker; an id stored in another
scope, an unknown id, and a fact_ or ent_ id erase nothing, and the job's counts
do not say which.
An outside party (party_erasure_v1, since 0.14.0). {"scope": "<tenant root>", "subject": {"email": "..."}, "confirm": true} erases the events whose writers labelled
them party:<address> in context.labels (the address compared NFC and full lowercase),
in every scope of the tenant root, live, sealed and expired, as a selective erasure of the
root erases named events. Only labelled events are found, never one that names the address
in its text alone. subject takes the place of selector and confirm_all (either beside
it is 422 AMBIGUOUS_SELECTOR); an address that does not parse, a scope that is not the
tenant root, and a missing confirm: true are 422 INVALID_BODY; anyone but the trusted
operator gets 403 POLICY_DENIED. The receipt (kind: "party") names the address only by
its hash (party.subject_hash, the hex BLAKE3 of the root, 0x1F and the normalized
address), counts the events per scope (party.per_scope) and says coverage: "labelled_only". Once the node's party index is built (erasure_index.party on
GET /v1/admin/metrics; a change of CORTEX_TENANT_DEPTH builds it again) and the erasure
index's readers are on (CORTEX_ERASURE_INDEX not 0), the leader waits up to 30 s for its
indexer to reach the head it read and reads the index; while the index is not built, with the
readers off, or past the 30 s, it scans the root, which finds no expired event. The index finds
an expired event by its marker when the event expired on a shard armed for format 10 (one moved
in from another shard, or expired before this replica joined, included); one that expired below
format 10 is found only while this node's index held its row.
The selector takes no other field. The read-free forget's keys
(idempotency_keys, capture_keys, §8.5) are /v1/forget's: here, on the
preview, on /v1/erasures/person and on /v1/erasures/tenant, a body that
names either, in its selector or at its top level and whatever its value,
answers 422 INVALID_BODY with details.reason: "key_selector_not_supported"
and details.field naming it, and erases nothing. Dropping the keys would
leave the selector empty, which with confirm_all erases the whole scope. Any
other selector field answers 422 INVALID_BODY with
details.reason: "unknown_selector_field". confirm confirms an outside
party's erasure (subject) and nothing else: without subject it answers
422 INVALID_BODY, details.reason: "field_not_applied", here and on the
preview. A whole scope's erasure is confirmed by confirm_all.
from_preview_id is optional. When set, it must name an unexpired
POST /v1/erasures/preview this server issued to the same caller and tenant
for the same scope, selector and confirm_all, or the request answers
422 UNKNOWN_PREVIEW_ID. A forget preview's fpvw_ id never authorizes an
erasure. The server does not compare the scope's current contents with the
preview: events written since the preview are selected like any other, up to
the selection pin below. A preview grant lives 15 minutes.
idempotency_key. The key binds the request to its first job, per caller and scope,
for 24 hours, in this process's memory: the same key with the same selector, confirm_all
and address (audit_note, from_preview_id and respond are not compared) answers that
job's 202 with its status as it is now (running, completed or cancelled) and its
audit_id; a job that failed is started again under the same id. The same key with another
request is 409 IDEMPOTENCY_CONFLICT, and so is one whose job this process no longer holds
(retired early at the registry's 10,000-job capacity): a retired job is never permission to
erase again. A restart forgets the keys, so a retry after one starts a new job, which finds
what is left. The registry holds at most 10,000 keys of the last 24 hours and 10,000 running
jobs; past either, an execute answers 503 ERASURE_JOB_CAPACITY, retriable since 0.14.0, with
Retry-After: 30 and details.retry_after_seconds (it clears as jobs end and keys expire).
Response (202):
{
"erasure_id": "erasure_01HX...",
"status": "completed",
"manifest_url": "/v1/erasures/erasure_01HX...",
"lifecycle_stream": "/v1/lifecycle/stream?erasure_id=erasure_01HX...",
"audit_id": "audit_01HX...",
"receipt_url": "/v1/erasures/erasure_01HX.../receipt",
"verify_url": "/v1/erasures/erasure_01HX.../verify"
}
By default the execute runs to completion before it answers, so status is completed (a backend failure
answers 502 ERASURE_BACKEND_FAILED instead, and a shard that refuses the erasure answers as every proposing
route answers it, §6.6: a 503 under the WAL's own code, NOT_LEADER, WAL_UNAVAILABLE or WAL_OUTCOME_UNKNOWN,
or the refusal's, one its re-plans did not clear, such as HOLD_CHANGED or REGISTRY_STALE, retriable but for a
final apply refusal; 413 WAL_TOO_LARGE, not retriable; apply's scope fence under its own code, SCOPE_NOT_OWNED
or STALE_EPOCH, retriable; each with details.audit_id when the attempt was recorded (the disk guard never refuses
an erasure, so no DISK_FULL); 503 FORMAT_UPGRADE_PENDING, with its details, when an entry needs an apply format the shard is not armed for). A
job a cancel stopped answers its request 202 with status: "cancelled" (§8.6.5). A failed job keeps a failed
receipt. Since 0.10.4:
audit_idnames the gdpr audit row the execute wrote:capability: forget.gdpr, the targetscope,event_id= the erasure id,gdpr: true, the request'srequest_id(theX-Request-Idthe response echoes),decision: allowand status 202 (cancelledand 202 for a job a cancel stopped, §8.6.5;failedand the status answered, 502 or 503, for a failed execute). A replay of the sameidempotency_keyanswers the same job andaudit_id.audit_noteis kept on the job's receipt (§8.6.8), verbatim and cut at 1,000 characters: it is operator text, so put a ticket number in it, not personal data.lifecycle_streamdelivers this job'serasure_completerow (§8.6.6) and nothing else, also when opened after the 202 (it replays the row from the lifecycle log). Before 0.10.4 theerasure_idfilter was ignored and the stream carried every lifecycle event.receipt_urlandverify_urlare the job's receipt (§8.6.8) and its store-by-store proof (§8.6.7).
Early answer (respond, capability erasure_early_answer_v1). A whole-scope execute may
send "respond": "accepted" (the default is "completed", the behaviour above). It then
answers the 202 as soon as the erasure is authorized and holds its lease on the scope, with
status: "running" and no audit_id yet, and the erasure runs to completion in the
background. From that answer on, this node's read paths (recall, answer, compose, /v1/events,
the layer reads, the cohort lanes) no longer serve any event under the scope recorded before the
admission, exactly as the erasure's own tombstone will once it commits; a write sent after the
answer is served as usual. Poll manifest_url (running, then completed or failed) or
lifecycle_stream; the erasure_id is the receipt's id, and receipt_url and verify_url
answer for it once the job ended (409 ERASURE_RECEIPT_UNAVAILABLE while it runs), durably and
after a restart, like any other job. If the job fails, the scope is served again as the failure
left it, and the job's status and receipt say failed. The hiding is held in memory by this
node and lasts as long as the job: graceful shutdown waits for the job first, but a process
that dies mid-job loses both, and an execute re-sent with the same idempotency_key then
starts it again. On a cluster the hiding is on the data node that runs the erasure, the one
that serves the scope's root. A selector.memory_ids or subject execute with respond: "accepted"
answers 422 EARLY_ANSWER_WHOLE_SCOPE_ONLY: an erasure of named events answers when it
completes. A shutdown that begins before the early answer refuses it (503 SERVER_SHUTTING_DOWN)
and marks the job failed.
Selection. The execute uses the same selection pin as a scope-wide
forget (§8.5): it deletes or redacts only events the server recorded at or
before the execute's cutoff. A capture the server stamps after the cutoff
(one sent while the execute runs) is kept, and it is not counted in
deleted_events. (The
count used to include such captures: 301 reported for a 300-event scope.)
Running the execute again later erases those captures, like any other event
in the scope.
The pin also governs what the execute does beyond the event rows:
- Artifacts. The artifact closure covers every selected event, including
descendant events that an earlier
/v1/forgetalready blanked. Those are not redacted again and not counted inredacted_events, but an artifact compiled from them is deleted (or queued for re-evaluation)./v1/forgetdoes not guarantee artifact deletion;/v1/erasuresdoes. - Captures still being written at the pin (stamped before the cutoff,
appended after the execute read the log head) go through the artifact
closure and the storage-engine purge with the rest of the selection. They
are counted in
deleted_events/redacted_events. A capture that reaches the log only after the execute's tombstone is stamped after the cutoff there and kept. - Derived layers. Episodes, understanding (concepts) and beliefs under
the scope are deleted unless every source they cite traces to events
captured after the cutoff. Provenance is followed through facts (their
source events), episodes and belief-on-belief supports. A layer with no
source, an external or concept-typed source, or any source from before the
cutoff is deleted. So a layer built only from captures stamped after the
cutoff survives with those captures, and nothing built from erased history
does, whichever server's clock stamped that history.
deleted_episodes,deleted_conceptsanddemoted_beliefscount only what this step deleted.
The execute holds the same destructive lease as a forget (§8.5) and has the
same effect on concurrent scope changes and captures, including the retriable
409 DESTRUCTIVE_OPERATION_IN_PROGRESS for a new-scope capture that outlasts
the admission wait. It is authorized the same way too: a scope registered outside its footprint
does not affect it, and a footprint that moved on each of 5 attempts answers the retriable
409 AUTHORIZATION_STATE_CHANGED (Retry-After: 1), with the job marked failed and nothing
erased (§8.5). During shutdown a new execute is refused with
503 SERVER_SHUTTING_DOWN and a running one is waited for (§8.5, "Shutdown"). If the client
disconnects, the execute still runs to completion and records its outcome on
the job, so a retry with the same idempotency_key returns the job with
status: "completed". An execute whose scope plan check fails after the job
was created now marks the job failed instead of leaving it running.
Errors: 403 POLICY_DENIED; 409 AUTHORIZATION_STATE_CHANGED (retriable, Retry-After: 1), 409 REDERIVE_IN_PROGRESS (retriable, Retry-After: 30, details.job_id), 409 IDEMPOTENCY_CONFLICT (not
retriable); 422 INVALID_BODY (key_selector_not_supported, unknown_selector_field, field_not_applied,
a field the body does not have, a subject that does not apply), 422 AMBIGUOUS_SELECTOR, 422 UNSUPPORTED_SELECTOR, 422 EMPTY_SELECTOR_WITHOUT_CONFIRMATION, 422 UNKNOWN_PREVIEW_ID, 422 EARLY_ANSWER_WHOLE_SCOPE_ONLY; 502 ERASURE_BACKEND_FAILED (retriable, details.audit_id); 503 SERVER_SHUTTING_DOWN (retriable, Retry-After: 5), 503 ERASURE_JOB_CAPACITY (retriable, Retry-After: 30), 503 ACCESS_RESTORE_PENDING (not retriable), 503 FORMAT_UPGRADE_PENDING, and the shard's refusals as above
(details.audit_id when the attempt was recorded). The body-shape refusals and the subject checks come before
authorization; every other 4xx comes after it, so a caller that may not erase the scope gets 403 first.
8.6.4 GET /v1/erasures/{erasure_id} — Status
{
"erasure_id": "erasure_01HX...",
"status": "completed",
"phase": "audit",
"summary": {
"deleted_events": 9420,
"redacted_events": 3060,
"demoted_beliefs": 18,
"deleted_facts": 0, "deleted_episodes": 0, "deleted_concepts": 0,
"deleted_artifacts": 0, "artifacts_pending_reevaluation": 0,
"purge": {"events": 0, "documents": 0, "edges": 0, "blobs": 0, "twins_redacted": 0,
"bitemporal_records_erased": 0, "wal_rows_redacted": 0, "artifacts_cascaded": 0}
},
"log_residual_cleared_at": "2026-10-02T10:15:04.512Z",
"log_residual_pending": null,
"audit_id": "audit_01HX...",
"created_at": "2026-10-02T10:14:58.120Z",
"completed_at": "2026-10-02T10:14:59.031Z"
}
audit_id, created_at and completed_at are 0.10.4 additions (audit_id is absent on a job
that never reached the execute's audit step, a running one included; completed_at on a running
one).
status is running, completed, failed (a backend or WAL failure, or a refusal after the job
was created, such as its lease or shutdown, that failed it before its erasure began; error says which, a
refusal with its own code and message: refused before its erasure began: REDERIVE_IN_PROGRESS: …) or
cancelled (a cancel stopped it before its first erasure entry, §8.6.5: no event was erased; summary counts
what its passes deleted before it stopped, and is null while it stops); phase is
enumerate until the job completes, then audit (the job runs as one step: there are no other
phases). A running job lives only in this process's memory and gets its receipt when it ends, so a
restart mid-job loses it (404). Every kind of job is read here, a person's erasure (§8.6.9) and a
tenant's deletion (§8.6.10) included.
On completion the job's summary carries deleted_events and
redacted_events, which are the erasure's event counts. It also carries
purge, the storage engine's own physical counts (events, documents,
edges, blobs, twins_redacted, bitemporal_records_erased,
wal_rows_redacted, artifacts_cascaded). The erasure commits its events
to the log in Erase entries of up to 4096 events, and the server's erase
tail runs one storage-engine pass per entry, the artifact-source erasure of
those events included; purge is the sum of those passes, as this server
reported them.
Since M7 (erasure_blob_cascade_v1) purge.blobs counts the uploaded blobs the erasure deleted
(inline and transcript blobs included, whole-scope erasures included) and
purge.retained_shared_blobs the blobs kept because another event still references them. The
server reads the erased events' blob ids when it builds each Erase entry and carries them in it,
so every server that applies the entry deletes the same blobs. Each
server's storage-engine pass for an entry reads only its named events and the retry
candidates, and its blob survival proof only the rows that name a candidate blob, in both logs
(DB-4; until the erasure index is ready, §8.5, each reads the whole log as before). Named
events the log no longer holds are carried as the entry's sources, so every server deletes
the facts, beliefs, episodes and concepts that still cite them inside the scope (DB-1).
The status also carries log_residual_cleared_at: null until the erased bytes left every file
that held them on every current voter of the shard (a single node is its only voter), then that
time. Two things have to finish. The background pass flushes and compacts the erased keys out of
the RocksDB content store, the Derived log, the shard's source log (unified_wal/) and the
session-fragment store and merges the full-text segments still holding the deleted documents;
every erasure path records what it removed, fact, gloss and question-key rows included, and the
shard's apply reports the source-log rows it deleted or redacted. Then each replica's log
residual builds a shard snapshot, purges its Raft log through the erasure's entry and compacts
the log's store, drops every older snapshot, and checks the Stage 2 rollback checkpoint
(pre_stage2/); a replica that caught up from a snapshot first compacts its source log whole, and
is not clear until then. The
node that ran the erasure asks every other voter for its time, and the field is the latest of
them (docs/ERASURE_COVERAGE.md). The
pass is throttled (quiet window CORTEX_ERASURE_RESIDUAL_DEBOUNCE_MS, default 1000; passes at
least CORTEX_ERASURE_RESIDUAL_MIN_INTERVAL_MS apart, default 30000, and at least three times
the previous pass's duration apart, so it is busy at most a quarter of the time) and bounded per pass
(CORTEX_ERASURE_RESIDUAL_MAX_BYTES of estimated SST rewrite per store, default 512 MiB;
CORTEX_ERASURE_RESIDUAL_FULLTEXT_MAX_DOCS documents, default 1,000,000); carried work keeps the
field null until a later pass finishes it. A job that erased nothing waits for the residue of
every erasure the server applied before it, and gets its time at once when nothing is pending,
unless an over-budget segment holds residue it could reach (below).
Restarts: the recorded work is journaled on disk as it is recorded (<data_dir>/erasure_residual/,
ids and scopes only). A graceful stop (SIGTERM) runs passes until nothing is pending or
CORTEX_ERASURE_RESIDUAL_SHUTDOWN_SECS (default 20) passes; what is left, and whatever a crash
interrupted, is re-armed at the next boot, and every job created after the boot waits for it.
Since 0.10.4 every job that ends writes a durable receipt (§8.6.8), and GET /v1/erasures/{id},
/verify and /receipt answer from it after a restart; a pre-0.10.4 job, or one created before
the restart by an older binary, still answers 404. A restored job whose residual had not cleared
is given a fresh residual ticket on its first read, which waits for the work the boot re-armed
(the reported clear time is never earlier than the real one); once observed, the clear time is
recorded on the receipt and never changes. Re-submitting the erasure is safe and does not report
a clear time before the original's residue is gone, even though it finds nothing left to delete.
While the field is null on a completed job, log_residual_pending says why:
reason | Meaning |
|---|---|
pass_pending | The pass, or the log residual's cycle, has not finished the work this job recorded yet. |
fulltext_segment_over_budget | A full-text segment with more documents than the per-pass budget still holds documents erased, by this job or an earlier one, under a scope that overlaps this job's scope (the same scope, an ancestor or a descendant). The pass never merges such a segment; the field clears when Tantivy's own merging rewrites it (the pass looks again on every run and every CORTEX_ERASURE_RESIDUAL_PARKED_RECHECK_SECS, default 900); Tantivy's default merge policy never merges a segment above 10 million documents. A segment that is merely gone does not clear it: a merge Tantivy began before the delete carries the erased document into the segment it writes, marked deleted there, so the residue passes to every segment written since that carries deletes (one that fits the budget is rewritten by the pass, one that does not stays in this state) and clears only once none of them can still hold it. Also carries fulltext_documents (the erased documents those segments hold for the overlapping scopes), fulltext_segments, largest_segment_docs and budget_docs. A retry, or a wider erasure, of the same subject is held by it even when it deletes nothing new; a job in an unrelated scope is not. |
pre_stage2_retained | The Stage 2 upgrade's rollback checkpoint (pre_stage2/) holds, by event id, a row this job or an earlier one erased. It clears once the operator deletes pre_stage2/, which also gives up that downgrade path. Rows captured after the upgrade are never in it. |
replica_unreachable | A voter of the shard did not answer for its own residual. |
segment_rewrite_pending | The job took events out of the segment store (docs/ICE_TIER_PLAN.md, step 3), and a segment that held one has not been rewritten without it, or dropped, yet: until then its object, and the key in the shard's log that opens it, still exist. The archiver rewrites such a segment within a pass (30 s) while the store answers; the replacement's own log-residual cycle then takes the old key out of every voter's files, and the field is set after it. |
not_covered | No pass covers this job: CORTEX_ERASURE_RESIDUAL=0. The field never gets set. |
node, when present, names the voter of the shard the reason is about, when it is not the node
that answered.
What a set log_residual_cleared_at guarantees, on every voter of the shard: the passes covering
the job completed their flushes, compactions and merges over every key and document the job (or
any job before it) recorded, so no live file of content/, derived_wal/, unified_wal/ or
session_fragments/ and no live full-text segment holds them (a segment a Tantivy merge wrote
from one that held them included), no over-budget segment holds residue erased under an
overlapping scope, and the derived-layer store's .log is released; the Raft log holds no entry
at or before the job's, every shard snapshot kept was checkpointed after the compaction, and
pre_stage2/ is absent or holds none of the rows. The time never changes once reported and
is never earlier than the rewrite of a segment that held the job back. What it does not: the files a compaction or merge replaced are deleted
only once nothing still reads them, so a long scan already running when the pass finished (a blob
survival scan, the orphan-blob report, a deferred-enrichment scan) keeps its old files on disk
until it ends; the pass does not re-read the files to verify; a learner, a replica removed from
the shard and a scope move's source shard are not asked; and the other stores (derived-layer SST
versions, vector indexes, resolver, graph, layer snapshot files) are covered only as
docs/ERASURE_COVERAGE.md lists. GET /v1/admin/metrics reports the pass under
erasure_residual (pending keys, ranges and ids per store, parked segments with their erased
documents and the largest one, overflows, oldest pending age, the journal, last pass).
GET /v1/erasures/{erasure_id} and the cancel below are authorized against the job's own
footprint on every call. Since 0.10.2 a scope registered outside that footprint (any new-scope
capture) no longer turns a poll or a cancel into a spurious 404; a boundary that moved inside it
on each of 5 attempts answers the retriable 409 AUTHORIZATION_STATE_CHANGED (Retry-After: 1),
never a 404 for a job the caller may see. Authorization is forget.gdpr at every boundary of the
footprint and, for a per-actor token, the Reader role there (Owner for the cancel), with a user
principal while membership is enforced; a caller that fails it gets the same 404 as for an unknown
id. On a cluster send ?scope= (any scope under the job's root): the ingress routes a by-id route by
it, and answers 501 CLUSTER_ROUTE_UNSUPPORTED without it.
8.6.5 POST /v1/erasures/{erasure_id}/cancel
Access: forget.gdpr and, for a per-actor token, the Owner role at every boundary of the job's
footprint (a user principal while membership is enforced); the trusted operator skips the roster. No
request body.
Stops a running erasure job that has not yet proposed its first erasure entry, and answers 200 with the
job's status (§8.6.4): status: "cancelled". The job stops at its next check (between the pages of its walk and
between its leader-local passes) and proposes nothing more: no event is erased. What its passes had deleted before
it stopped (derived records, compiled artifacts, code repositories: rebuildable from the events) is not restored;
once it stopped its summary counts it (deleted_events: 0) and completed_at says when. It then writes a gdpr
audit row with decision: "cancelled" and a receipt with status: "cancelled" (§8.6.8), and no
erasure_complete row; an early answer's read fence lifts, so the scope is served again. Its own request (a
synchronous execute still waiting, or a replay of its idempotency key) answers 202 status: "cancelled". While
the job is stopping, /receipt answers 409 ERASURE_RECEIPT_UNAVAILABLE.
{
"erasure_id": "erasure_01HX...",
"status": "cancelled",
"phase": "enumerate",
"summary": null,
"log_residual_cleared_at": null,
"log_residual_pending": null,
"created_at": "2026-10-02T10:14:58.120Z",
"completed_at": "2026-10-02T10:14:58.412Z"
}
Once the job has proposed an erasure entry (it commits, or may have committed), a cancel answers
409 ERASURE_NOT_CANCELLABLE, not retriable, and the job runs to its end. So does the cancel of a job that has
ended, completed, failed or cancelled already: never a 404 for a job the caller may read. A tenant's deletion is
never cancellable: its root is marked deleting before the job exists. The 409's details are
{erasure_id, status, job}, job the status this section's 200 would carry.
Errors: 404 NOT_FOUND (unknown id, or a job the caller may not see); 409 ERASURE_NOT_CANCELLABLE;
409 AUTHORIZATION_STATE_CHANGED (retriable, Retry-After: 1); 503 ACCESS_RESTORE_PENDING (not retriable)
while a restore mark holds the job's root and the caller is not the trusted operator: the mark serves the trusted
operator's cancel, with or without ?scope=.
8.6.6 Lifecycle events emitted
event: erasure_complete
data: {"erasure_id": "...", "summary": {...}, "audit_id": "audit_01HX..."}
Since 0.10.4 every erasure job (a person's erasure and a tenant's deletion included) emits one
erasure_complete row when it completes, on the lifecycle log and stream, with the job's scope
(only a caller who may see that scope receives it); a failed or cancelled job emits none. There are no
erasure_progress rows, an early-answered job's included. ?erasure_id= restricts a stream
to one job's rows and, without a since_lifecycle_id, first replays the ones the log still holds
(the log keeps rows for its retention window). Detailed semantics in §11.3.
8.6.7 GET /v1/erasures/{erasure_id}/verify — Proof (0.10.4)
Access: trusted operator only (the static operator key, or an auth-disabled server; any other
caller gets 403 POLICY_DENIED), authorized on the job's own footprint like the status read.
Read-only; it runs off the request worker and reads every store once per call. The job and its
receipt are kept on the node that ran the erasure: on a cluster, send the proof (and the receipt
read) with ?scope= to the scope's shard, and expect 404 from a node that did not run it, for
example after the shard's leader changed. The idempotency check reads the shard's idempotency
claims of the deleted events, and the proof reads the stores of the node that answers it.
It re-reads every store for exactly what the job's receipt says it erased and answers one check per store:
{
"erasure_id": "erasure_01HX...",
"scope": "org:acme/user:alice",
"verified_at": "2026-10-02T10:16:00.004Z",
"checks": [
{"store": "captured_wal", "what": "captured (v1 log) rows of the erased events still stored with payload", "remaining": 0, "ok": true},
{"store": "idempotency", "what": "...", "remaining": 0, "ok": true},
{"store": "content", "what": "...", "remaining": 0, "ok": true},
{"store": "vectors", "what": "...", "remaining": 0, "ok": true},
{"store": "fulltext", "what": "...", "remaining": 0, "ok": true},
{"store": "wal_twins", "what": "...", "remaining": 0, "ok": true},
{"store": "chunk_fragments", "what": "...", "remaining": 0, "ok": true},
{"store": "session_fragments", "what": "...", "remaining": 0, "ok": true},
{"store": "derived_layers", "what": "...", "remaining": 0, "ok": true},
{"store": "derived_artifacts", "what": "...", "remaining": 0, "ok": true},
{"store": "erasure_markers", "what": "...", "remaining": 0, "ok": true},
{"store": "scope_tombstone", "what": "...", "remaining": 0, "ok": true},
{"store": "cohort_projection", "what": "...", "remaining": 0, "ok": true, "note": "roots checked: org:acme"},
{"store": "cohort_alias", "what": "...", "remaining": 0, "ok": true}
],
"residual": {"cleared_at": "2026-10-02T10:15:04.512Z", "pending": null},
"checks_ok": true,
"all_ok": true,
"events_checked": 12480,
"event_ids_sha256": "9f2c..."
}
remaining counts rows that should be gone and are not; a check that cannot run (a store read
failed, a cohort projection still warming) answers ok: false with a note, never a silent pass,
and so does a check that did not reach every row (the whole-scope captured_wal scan past
1,000,000 rows). receipt_ids appears only when the proof cannot pass: when the receipt's id lists
were cut at 250,000 ids of a kind (event_ids_truncated). entity_names appears when the erased
events had derived rows (they were enriched): since 0.14.0 (DB-23), when the resolver's provenance
index tracked every one of them, it counts the provenance rows still naming an erased event and
passes at zero, since each replica's erase tail removes every name and alias only they named; for
events enriched before that index it cannot pass while CORTEX_ENTITY_GRAPH is off (the names stay
in resolver/ and entity_vector/; the receipt's retained_by_design lists them too).
expired_markers appears for a whole scope and for
a selective erasure that named events a keep_learned retention had detached: the expired markers
still present for the receipt's expired_event_ids and, for a whole scope, for any event of the
scope captured at or before the cutoff. With the segment store on (docs/ICE_TIER_PLAN.md, step
3), an erasure under a root holding sealed events adds three: sealed_markers (erased events, and
for a whole scope any event captured at or before the cutoff, still sealed), segment_rewrites
(segments the receipt's sealed_segments names, the ones that held erased events, not yet
rewritten past the generation it recorded nor dropped: the archiver does it within a pass of 30 s,
so a proof run at once may wait for it) and segment_objects (those segments' old objects still in
the ice store; an object this server shares with the server it was copied from, and never deletes,
counts too and says so in the note).
derived_artifacts (the artifacts derived from an erased event, at any depth, that keep a content
row or their WAL row's text) is always checked; rollup_records and declared_records appear on a
shard armed for format 10: remaining counts a record the receipt lists as erased that the shard
still stores, a stored one that still cites an event the receipt lists as deleted, and, for a whole
scope, a stored one homed at or under the scope. Since 0.14.0 a legal hold's items are preserved, not
left: what a hold still keeps (held_event_ids, held_rollups and held_declared that no
held_completed entry took) is never counted as remaining, the check's note counts it, and the
events a run of the job's pending held erasures took since are checked like the job's own (the proof
re-reads the receipt this node stores, where its erase tail records those runs).
Since 0.15.0, on a shard armed for format 11, governed_records checks governed memory formation's records, every kind
(corrections, held candidates, review decisions, declared episodes, policy texts, subject settings, feed marks;
§8.7.23 to §8.7.28, §8.32), and declared_records keeps to declared beliefs: remaining counts one still stored that
the receipt lists as erased (declared, corrections), one that cites an erased event (an example, a held
candidate, a decision, an episode), a correction none of whose cited events is left, and for a
whole scope one scoped at or under it; the note names what remains by kind, and counts what a legal hold keeps.
Since 0.15.0 (format 11) the proof also lists the receipt's feed_consumers (§8.6.8): no check covers them, since copies outside CortexDB are their consumers' to delete.
checks_ok is every check passing (and at least one ran); all_ok adds that log_residual_cleared_at is set (the
erased bytes are compacted out of the files the residual pass covers, §8.6.4). scope_tombstone
and cohort_alias, the whole-scope captured_wal scan and the markers captured at or before the
cutoff are checked for a receipt of kind whole_scope and for a tenant's deletion (kind: tenant, which
erases its root whole); every other kind is checked over the receipt's id lists. With CORTEX_COHORT off cohort_projection reports 0
with a note (no projection exists). What each store check reads, and what it deliberately does not
(the vector index files' own residue, derived-layer SST versions, snapshots, backups):
docs/ERASURE_COVERAGE.md, "The proof". Errors: 409 ERASURE_NOT_COMPLETED for a running,
failed or cancelled job; 409 ERASURE_RECEIPT_UNAVAILABLE for a job a pre-0.10.4 binary ran (re-run the
identical erasure, which is idempotent, and verify that job); 404 as for the status read; 409 AUTHORIZATION_STATE_CHANGED (retriable, Retry-After: 1); 500 ERASURE_VERIFY_FAILED when the
verification did not complete. None but AUTHORIZATION_STATE_CHANGED is retriable.
8.6.8 GET /v1/erasures/{erasure_id}/receipt — Receipt (0.10.4)
Authorized like the status read. Serves the job's receipt and the SHA-256 of exactly the bytes
served as receipt:
{
"receipt": {
"version": 1,
"erasure_id": "erasure_01HX...",
"kind": "whole_scope",
"scope": "org:acme/user:alice",
"status": "completed",
"requested_by": "user:local",
"tenant": "default",
"audit_id": "audit_01HX...",
"request_id": "DSAR-1234-execute",
"audit_note": "DSR #1234",
"request_sha256": "5b1e...",
"idempotency_key_sha256": "c0a4...",
"created_at": "2026-10-02T10:14:58.120Z",
"completed_at": "2026-10-02T10:14:59.031Z",
"selection_cutoff": "2026-10-02T10:14:58.121999999Z",
"summary": {"deleted_events": 9420, "redacted_events": 3060, "...": "..."},
"deleted_event_ids": ["evt_...", "..."],
"redacted_event_ids": ["evt_...", "..."],
"event_ids_sha256": "9f2c...",
"event_ids_truncated": false,
"footprint": {"explicit_paths": ["org:acme/user:alice"], "descendant_prefix": "org:acme/user:alice", "created_revision": 7},
"residual": {"ticket": 41, "boot_id": "boot_01HX...", "feed": 1288, "cleared_at": "2026-10-02T10:15:04.512Z"},
"retained_by_design": ["this receipt: ...", "..."]
},
"sha256": "e3b0...",
"durable": true
}
The receipt holds identities, counts, timestamps and hashes, never content: no text, labels,
intent or other field of an erased event, and never the idempotency key itself (only its
SHA-256). kind is whole_scope (an empty selector), selective (memory_ids), party (an
outside party, party_erasure_v1, with party), person (§8.6.9, with person_erasure) or
tenant (§8.6.10, with tenant_deletion); status is completed, failed (a failed
job's receipt carries error and no ids) or cancelled (a cancelled job's receipt carries the counts of what
its passes deleted before it stopped, no event id, no residual). The event id lists are sorted and cut at 250,000 each
(event_ids_truncated); event_ids_sha256 is the SHA-256 over every id: the sorted deleted ids,
each followed by a newline, one more newline, then the sorted redacted ids, each followed by a
newline, and, only when the receipt lists expired_event_ids (events a keep_learned retention
had detached, whose markers and learned records the erasure removed, §8.15.1), one more newline
and the sorted expired ids, each followed by a newline. retained_by_design lists what the erasure keeps by design (this receipt, the audit
rows (deleted by age with the audit trail, audit.retention: the receipt is the lasting record), a whole-scope
tombstone, the no-resurrection markers, the redacted rows' identities and actors (the caller, the observed actor
and the subject ids), the
scope registry entry, the deleted idempotency claims' bytes until RocksDB compacts them, copies outside
the server), a line for the entity names enrichment extracted when the erasure could not remove them,
and since 0.14.0 a line for what a legal hold kept (§8.6). Each of the following is absent when empty, so
a receipt without it hashes as before: sealed_segments (the segments that held events the erasure took
out of the segment store, {root, segment, generation, object}), rollups and declared (the rollup and
declared records its entries erased, format 10), held_rollups, held_declared and held_event_ids
(what a legal hold kept, each a pending held erasure under the job, never among the erased lists), and
held_completed (since 0.14.0: each run of the job's pending held erasures once their holds were
released, as this node applied it, {at, deleted?, redacted?, rollups?, declared?, directory?}, ids
only, in the order applied), corrections (since 0.15.0, format 11, corrections_v1: the corrections the
erasure's entries erased because none of the events each cites was left, by id, §8.7.24; the other
governed records it erased are among declared), held_candidates (since 0.15.0, format 11, derivation_review_v1: the
candidates held for review, §8.7.27, that the erasure's entries erased with their events, by record id,
listed apart and among declared too; no legal hold's), and feed_consumers (since 0.15.0, format 11): every consumer of the change
feed (§8.7.23) whose mark had passed an event the erasure took, so it may hold a copy, ordered by consumer,
{consumer, principal, may_have_received, event_id_hashes, event_id_hashes_truncated?, note}:
principal is the reader of its last page, may_have_received how many of the erased events its mark
had passed, event_id_hashes those events as the feed's erasure items name them (at most 10,000, then
event_id_hashes_truncated: true), and note says that CortexDB cannot verify that a consumer deleted
its copies. The list may over-report and never under-reports. To recompute sha256, hash the receipt
object serialized as compact JSON in the order served (Python:
hashlib.sha256(json.dumps(r["receipt"], separators=(",", ":"), ensure_ascii=False).encode())).
residual.feed (0.11.0) is the job's last erasure-feed row, from which the shard log's part of
the residual is reported. The receipt changes when a later process first reads it before its
residual cleared (a fresh ticket and boot_id, and, on a receipt written before 0.11.0, the
erase floor as feed), once when the residual clear time is first recorded, and each time this
node records a run of the job's pending held erasures (held_completed); so does its hash.
durable: false means this server keeps no durable receipts (an embedded coordinator without a
storage engine): the job and its receipt are then lost at a restart. Errors: 409 ERASURE_RECEIPT_UNAVAILABLE while the job runs or, after a cancel, stops, or for a job a pre-0.10.4 binary
ran; 404 as for the status read.
8.6.9 POST /v1/erasures/person — Erase a person
Capability: person_erasure_v1 (shared memory phase 2). The trusted operator only (the static
CORTEX_API_KEY, or an auth-disabled server): the job spans every scope of the tenant that holds the
person's rows.
Erases what a person holds in a tenant as one erasure job with one receipt, in this order:
- their own region,
<root>/user:<id>and every scope under it; - their application homes:
<root>/<app>/user:<id>under every application record of the tenant (a record of kindapp, or one at a top-levelapp:path), and the capture home<root>/app:capture/user:<id>, whether or not a record exists there; - their own messages in the tenant's groups: every event whose
observed_actoris the person, in every scope of kindgroup; - last, their directory entry with its notices.
Each region and home is erased as a whole-scope erasure erases a scope (§8.6.3), then every row that
erasure left blanked in place, and every sealed row, by id, so no row of it is left; the group messages
are erased by id. An event outside the set whose subject is the person is not erased: the receipt
counts it per scope in review, for an operator or the tenant to decide.
POST /v1/erasures/person
{"scope": "org:acme", "person": "user:alice", "confirm": true, "reason": "DSR-1234"}
| Field | Type | Notes |
|---|---|---|
scope | string | The tenant root (its first CORTEX_TENANT_DEPTH segments, org:acme at the default depth 1). Required. |
person | string | A user: id. Required. |
confirm | bool | Must be true. |
reason | string | At most 256 bytes of UTF-8 without control characters, no personal data. Checked, then written nowhere. |
The body is strict: any other field (a selector included) is 422 INVALID_BODY, and idempotency_keys
or capture_keys in a selector or at its top level is 422 INVALID_BODY, details.reason: "key_selector_not_supported".
Response (202), once the job has ended:
{
"erasure_id": "erasure_01HX...",
"status": "completed",
"manifest_url": "/v1/erasures/erasure_01HX...",
"lifecycle_stream": "/v1/lifecycle/stream?erasure_id=erasure_01HX...",
"audit_id": "audit_01HX...",
"receipt_url": "/v1/erasures/erasure_01HX.../receipt",
"verify_url": "/v1/erasures/erasure_01HX.../verify"
}
GET /v1/erasures/{erasure_id}, /verify and /receipt serve the job as they serve any erasure's
(§8.6.4, §8.6.7, §8.6.8). The receipt has kind: "person" and person_erasure: parts (an object of
regions, app_homes and group_messages, each the events erased per scope), review (the events per
scope outside the set whose subject is the person), held and directory_erased. It holds ids and counts
only. The job's gdpr audit row names the endpoint POST /v1/erasures/person, and the body it hashes names
the person, so two persons' erasures in one tenant hash apart.
Legal holds. The job decides event by event, on the holds as they are when each part runs (§8.6,
"Legal holds"): an event is kept while a hold's scopes hold it, or while a hold names a person the event
belongs to (its caller, its observed actor, its subject, or a segment of its scope, so every event of the
person's own regions and homes) and that person's window covers its capture time. A region or home holding
no kept event is erased whole; one holding a kept event is erased by id, every event but the kept ones, so
no tombstone hides what a hold keeps. Each kept event, and each rollup or declared record a hold keeps, is
recorded as a pending held erasure under the job, listed in the receipt (held_event_ids, held_rollups,
held_declared) and erased by the shard leader once its holds are released (held_completed). A hold in
force that names the person keeps the directory entry and its notices, whatever its window: on a shard armed for
format 10 the entry is recorded as a pending held erasure under the job, which the shard leader erases with its notices
once no hold names the person (held_completed, directory: true); below format 10 it is kept unrecorded. parts counts
only the events erased; person_erasure.held lists, in path order, each scope of the set in which a hold
kept an event, then person when a hold keeps the directory entry; review leaves out the kept events.
No idempotency key. A try after a lost answer starts a new job, which erases what is left and
completes. Two requests for one person do not run side by side: while an erasure of the same person in the same
tenant root runs on this node, another answers 409 DESTRUCTIVE_OPERATION_IN_PROGRESS (retriable), with
details.erasure_id and details.manifest_url naming the running job (a cancelled one no longer runs). The
running job is cancellable by that id until it proposes its first erasure entry (§8.6.5).
Format 8. The directory erasure that closes the job is a format-8 entry, so a shard not armed for
format 8 answers 503 FORMAT_UPGRADE_PENDING before any part runs, a person with no directory entry
included, with the shard's details.reason (members_behind, retriable with Retry-After: 30;
arming_disabled; reserved_path_in_use), format, node, paths and count. A server that serves no
shard answers 503 NOT_AVAILABLE.
The job runs detached once admitted, under the destructive lease of the tenant root, and graceful shutdown
waits for it (§8.5, "Shutdown"). While a restore mark holds the tenant root, the root serves the trusted
operator's request, as it serves the trusted operator's erasures; the route answers anyone else 503 ACCESS_RESTORE_PENDING. On a cluster the ingress routes
it by the tenant root.
Errors: 403 POLICY_DENIED (not the trusted operator); 409 AUTHORIZATION_STATE_CHANGED (retriable,
Retry-After: 1), 409 REDERIVE_IN_PROGRESS (retriable, Retry-After: 30), both when the job's lease is
taken; 409 DESTRUCTIVE_OPERATION_IN_PROGRESS (retriable: an erasure of the same person runs, details.erasure_id,
details.manifest_url); 422 INVALID_BODY (scope not a tenant root, person not a user: id, confirm not true,
reason too long or holding a control character, a field the body does not have,
key_selector_not_supported); 502 ERASURE_BACKEND_FAILED (retriable: a part failed, and a retry erases
what is left; details.audit_id); 503 SERVER_SHUTTING_DOWN (retriable, Retry-After: 5), 503 NOT_AVAILABLE, 503 FORMAT_UPGRADE_PENDING, 503 ERASURE_JOB_CAPACITY (retriable, Retry-After: 30), 503 ACCESS_RESTORE_PENDING (not retriable; the trusted operator's request is served), and the shard's refusals as
POST /v1/erasures answers them (§8.6.3; HOLD_CHANGED and the other re-plans among them).
8.6.10 POST /v1/erasures/tenant — Delete a tenant
Capability: tenant_erasure_v1 (shared memory phase 2). The trusted operator only (the static
CORTEX_API_KEY, or an auth-disabled server).
Deletes a tenant, its memory, its directory and its registry, as one erasure job with one receipt. A dry run comes first and is the default.
POST /v1/erasures/tenant
{"scope": "org:acme", "dry_run": false, "confirm": true, "reason": "OPS-1142"}
| Field | Type | Notes |
|---|---|---|
scope | string | The tenant root. Required. |
dry_run | bool | Default true: count what the deletion would erase and change nothing. |
confirm | bool | true, required with dry_run: false. |
reason | string | At most 256 bytes of UTF-8 without control characters, no personal data. Checked, then written nowhere. |
The body is strict, as §8.6.9's.
The dry run (200).
{
"scope": "org:acme",
"dry_run": true,
"counts": {"records": 41, "tombstones": 3, "directory_entries": 12, "name_entries": 9, "texts": 4,
"notices": 20, "events": 10482, "staged_changesets": 0, "pending_erasures": 0,
"watermarks": 2},
"holds": []
}
counts is read from the registry and the shard's applied state; events is the root's Captured rows, a
floor past 10,000,000. holds is always empty on a 200: while any hold of the tenant is in force the route
answers 409 HOLD_IN_FORCE, dry run or not, with details.holds (the hold records' paths, at most 64) and
details.holds_in_force; release them first. The dry run proposes nothing and is served on a shard not
armed for format 8.
The job (202). With dry_run: false and confirm: true:
- Its first registry change marks the root
deleting(a bare record carries it where none is registered). From then on every replica answers every request of the tenant's credentials (org:<billing tenant>) but the trusted operator's410 TENANT_DELETED, andPOST /v1/auth/tokensmints nothing for it (422 INVALID_BODY,details.reason: "reserved_tenant"). This node then admits no write under the root and waits up to 60 s for the writes admitted before the mark; past that it answers503 TENANT_WRITES_IN_FLIGHT(retriable: the root stays marked, and a retry continues). - Under the root's destructive lease it erases the root's memory as a whole-scope erasure does (§8.6.3), then erases by id every row that erasure left blanked below the root, and every sealed row, so the source log keeps no row of the tenant; then the directory, every principal's entry with its notices and every name entry; then, where this binary builds their commands, the root's texts and its remaining notices.
- After the lease it tombstones every record at or under the root but its hold records, without
former_members, the root's keepingdeleting. - It answers
202with the body §8.6.9 shows,status: "completed".
The mark is a version-2 registry field, so a shard not armed for format 8 answers 503 FORMAT_UPGRADE_PENDING before the mark, with the shard's reasons (§8.6.9). The receipt (kind: "tenant") holds tenant_deletion {planned, directory_erased, records_tombstoned, directory_held?, retained?}, counts and hashes only, never a name, an email or a text; planned is the dry run's counts at
the job's start, and retained counts by kind what this binary could not erase. The job's gdpr audit row
names the endpoint POST /v1/erasures/tenant. Its proof (§8.6.7) takes the whole-scope checks.
A hold placed once the job started keeps what it names as any erasure job keeps it (§8.6, "Legal
holds"): its events, the rollup and declared records citing them, and the directory entries of the
principals it names stay, pending under the job (tenant_deletion.directory_held counts the entries), and
its record is not tombstoned (retained.holds counts the hold records), so what it keeps stays until it is
released (a change to its record): the shard leader's runner then erases it (held_completed), and a new run of the
deletion tombstones what is left.
No idempotency key. A retry after a lost answer, or after a failure, starts a new job, which continues
the deletion; the root stays marked deleting meanwhile. The whole request, the dry run included, runs
detached: during graceful shutdown it answers 503 SERVER_SHUTTING_DOWN. While a restore mark holds the
root, the root serves the trusted operator's request, the dry run included; the route answers anyone else 503 ACCESS_RESTORE_PENDING. The job's cancel answers 409 ERASURE_NOT_CANCELLABLE: the root is marked deleting
before the job exists (§8.6.5). On a cluster the ingress routes it by the tenant root.
Errors: 403 POLICY_DENIED (not the trusted operator); 409 HOLD_IN_FORCE (not retriable), 409 DESTRUCTIVE_OPERATION_IN_PROGRESS (retriable: another destructive operation holds the root, so the mark was
not written), 409 AUTHORIZATION_STATE_CHANGED and 409 REDERIVE_IN_PROGRESS (retriable, when the job's
lease is taken; the root stays marked); 422 INVALID_BODY (scope not a tenant root, reason too long or
holding a control character, confirm absent on a run, a field the body does not have,
key_selector_not_supported); 502 ERASURE_BACKEND_FAILED (retriable: the dry run's count failed, or a step
failed after the mark, which stays; details.audit_id once the job started); 503 TENANT_WRITES_IN_FLIGHT
(retriable), 503 FORMAT_UPGRADE_PENDING, 503 NOT_AVAILABLE (the server serves no shard), 503 SERVER_SHUTTING_DOWN (retriable, Retry-After: 5), 503 ERASURE_JOB_CAPACITY (retriable, Retry-After: 30;
the root stays marked, and a retry continues), 503 ACCESS_RESTORE_PENDING (not retriable; the trusted operator's
request is served), 503 SCOPE_STORAGE_UNAVAILABLE or WAL_OUTCOME_UNKNOWN (the registry could not write or
confirm the mark; retriable since 0.14.0, when they said false; on a clustered owner a mark the shard did not
take answers the shard's own code instead, as the registry routes answer it, §8.8), 500 SCOPE_STORAGE_MISCONFIGURED (not retriable, details.reason, §8.8), and the shard's
refusals as POST /v1/erasures answers them (§8.6.3).
8.7 Layer-Scoped Reads
8.7.1 GET /v1/events
Capability: scope.read.local + traversal as appropriate. Default view is local — see §18.2 item 14.
GET /v1/events
?scope=org:acme/dept:eng/user:alice
&view=local
&since=2026-04-01T00:00:00Z
&observed_actor=user:alice
&modality=conversation
&intent=handover,skill
&limit=50
&cursor=...
intent (capability memory_kinds_v1) is a comma-separated list of
context.intent values: only events whose intent is exactly one of them are
listed.
On these direct layer-list endpoints, pass view=holistic explicitly for the
requested scope plus authorized ancestors. Unlike public recall's holistic
view, layer-list holistic does not include descendants; use view=descend for
an authorized subtree read.
Response:
{
"items": [ /* Event records (see §7.1) */ ],
"next_cursor": "...",
"has_more": true
}
since (RFC 3339) keeps events recorded at or after it; observed_actor and modality match exactly; labels (comma-separated) keeps events carrying any of them. limit defaults to 50 (1 to 1,000); cursor is opaque (le1. and base64url), the next_cursor of the page before, bound to the query that issued it (scope, view, caller, filters), and any other value is 422 INVALID_CURSOR (since 0.14.0; it was a decimal offset). view is local (the default), granular, raw or structured (each reads the scope exactly; structured still needs scope.read.holistic), holistic or descend (scope.read.descend); any other value, lineage included, is 422 INVALID_BODY.
Since 0.14.0 the cursor reaches every event. The listing is newest first by capture time (context.recorded_at, then id) for granular, raw, structured and holistic, merged across the exact scopes the view reads; a descend listing reads the request scope and each authorized descendant scope holding events one at a time, in scope-path order, each newest first. With a segment store (CORTEX_ICE_URL) a scope's sealed events (the newest 5,000 the caller may read among the root's newest 100,000 markers) follow its live events; a store that does not answer leaves them out of that page. Cancelled and forgotten events are never listed, nor is a row whose scope the caller may not read or whose atoms its chain may not read (DB-28). The filters apply before the page is cut. A page examines at most 20,000 rows: one that runs out of them answers what it found with has_more: true. (Before 0.14.0 the listing read at most 5,000 events of each scope, the earliest, so a scope's later events were never listed.) Each event carries derives (§7.1). The body is sent with Cache-Control: no-store and checked again as it is sent: a read whose authorization lapsed in the meantime ends without a body.
Every refusal of the read rule, an application the tenant does not admit at the scope included (§8.26; never APP_NOT_ADMITTED), answers 403 POLICY_DENIED, message: "Current event read authority required", with no details, except a walking view at a shared org-tree scope (422 VIEW_NOT_ALLOWED_AT_SCOPE). A page whose JSON would exceed 16 MiB, or an event store whose read profile refuses the read, answers 503 EVENT_LIST_UNAVAILABLE (retriable: keep the cursor, or ask for a smaller limit), and so does a descend listing whose subtree cannot be enumerated now (the scope-partition map still building). A read that lost a race with an authorization change runs again, up to three runs in all, then answers 503 AUTHORIZATION_STATE_CHANGED (retriable). Storage-lane failures are 503 DB_SATURATED / DB_UNAVAILABLE (retriable since 0.14.0: nothing ran), 504 DB_TIMEOUT (not retriable) and 500 INTERNAL_ERROR (retriable). The layer reads §6.11 lists take ?at_least=; the claims, the conflicts and a synthesis status take none. Break-glass (§8.15.3): the layer reads and the two builds are class stored_rows.
The explicitly configured native source-use listing profile additionally uses bounded WAL pagination and withdrawal-aware response bodies. Its versioned opaque cursor, ordering, empty-page continuation and failure semantics are specified in the native event-page contract. This is unsealed development behavior requiring current host/owner admission; the legacy listing profile retains its existing pagination semantics.
8.7.1.1 GET /v1/events/{evt_id} — exact citation source
Requirements: FRI-11, DISC-024, CDB-G14. Capability:
scope.read.local, intersected with the token's scope constraints and current
Reader membership on the event's retained scope. The route checks read authority
before ID discovery and revalidates signed credential expiry/revocation and scope
membership after awaited storage work.
A successful response is the retained MemoryEventV1 JSON envelope (§7.1),
including the original scope, caller, observed actor, subject, modality, content,
and context timestamps. Text is not normalized or reconstructed. The production
unified WAL and standalone RocksDB WAL use their durable event-ID indexes, so
restarting or retaining more than 5,000 events does not change lookup semantics or
require a history scan. A repeated authorized read returns the same envelope
unless the event has subsequently been changed or suppressed by an authorized
lifecycle operation.
?scope=<scope> (capability event_scope_filter_v1, 0.10.2) confines the read to one
scope: the event is returned only when its own retained scope is exactly that scope. An event
stored in a sibling, an ancestor or a descendant of it is the same 404 NOT_FOUND as a missing
id, byte for byte, so the filter cannot be used to learn where an event lives. Exact match is the
same rule as the event listing's default view=local (§8.7.1). The value is parsed as given, with
no trimming: an empty, blank or malformed value (a leading space, a trailing /) is
422 INVALID_SCOPE_GRAMMAR, never a read without the filter. Send the parameter once: a repeated
scope makes the query string unparseable and is refused with 400 INVALID_QUERY (a plain-text
400 before 0.10.3), also never a read without the filter. The filter only narrows what the
credential may read. A server that does not list event_scope_filter_v1 ignores the parameter,
so gate on the capability, or compare the returned scope with the one you expect. This matters
most for operator-wide credentials: the static operator key (CORTEX_API_KEY) and an
auth-disabled server read every scope of every tenant by id. A token whose scopes hold an exact
entry (<path>!) reads that scope's events by id, as confinement reads the entry (since 0.14.0; such a
token got 404 before), and so do the lifecycle reads (§8.9).
Missing or malformed IDs, denied reads, excluded events, events outside ?scope=, events whose atoms
the caller's chain may not read (DB-28), and events covered by a scope-forget tombstone return 404,
error_code: "NOT_FOUND", and message: "event not found", with a fresh request correlation ID.
Authentication failures at ingress retain the common authentication error contract. An original
envelope unavailable from the durable WAL is also not found: legacy coordinator
projections cannot supply exact source evidence and are never synthesized here.
Clients with legacy-only data must use an explicitly qualified migration or
recapture path; they must not treat reconstructed metadata as the original source.
Two kinds of event are found only with ?scope= naming the event's own scope, and are the same
404 without it. A sealed event (a segment store, CORTEX_ICE_URL) is read from its segment:
503 SEGMENT_UNAVAILABLE (retriable) when the store does not answer within the request's read
budget. An event whose raw data a keep_learned retention rule removed answers 410 EVENT_EXPIRED
to a caller who may read its scope, details: {scope, recorded_at, expired_at}: what was learned from
it stays, and cites it. The response is sent with Cache-Control: no-store. On a cluster the ingress
routes a by-id read by ?scope= and answers 501 CLUSTER_ROUTE_UNSUPPORTED without it. Break-glass
(§8.15.3, "By-id reads"): class stored_rows, decided once the event is read, by its own scope's
tenant and class, whatever ?scope= names: a break-glass read of a private region's event is served
once the region's notice commits. Its 410 EVENT_EXPIRED and 503 SEGMENT_UNAVAILABLE answer the
operator key only under its row's mode (403 BREAK_GLASS_REQUIRED without the header under deny). Storage-lane failures are 503 DB_SATURATED / DB_UNAVAILABLE (retriable), 504 DB_TIMEOUT and 500 INTERNAL_ERROR (retriable).
8.7.2 GET /v1/episodes
GET /v1/episodes?scope=...&view=...&actor=...&overlapping=2026-04-01..2026-05-01&with_causal_chain=true&limit=50&cursor=...
Capability: scope.read.local and Reader on scope, plus the view's traversal capability, as GET /v1/facts.
Episodes at the scope (§7.2), from the episode store, newest first by started_at within each scope read (the scope's own first, then each ancestor's for holistic). view, limit (default 50, 1 to 1,000) and cursor are as on GET /v1/events.
overlapping=<start>..<end>keeps episodes whose[started_at, ended_at)overlaps the range from the start of the left date expression to the end of the right one (2024-03..2024-04covers both months;2024-03-01,march 2024and2019parse). An episode withoutended_atis ongoing. A range that does not parse, or is empty, is422 INVALID_RANGE, and so is a relative phrase (yesterday,last year).actorkeeps episodes whoseactors_involvedholds that actor id exactly.with_causal_chain=truegives every item acausal_chain: the builder's role-tagged entries ({event, role, summary?}), else one{"event_id": ...}per event in order; at most 50.
Since 0.14.0 the route reads every episode of each scope it covers (each exact scope of the view) before it applies its filters and then pages, so a filter never drops an older match (a scope past the store's scan bound of 100,000 rows answers 500 INTERNAL_ERROR); an episode whose atoms (else its events' atoms) the caller's chain may not read is then dropped from the page (DB-28), so a page can hold fewer than limit items. Episodes come back without summary_embedding unless the read sends include_vectors=true (§8.7.3). Response: {items, next_cursor?, has_more}. Errors: 400 INVALID_QUERY (view); 422 INVALID_SCOPE_GRAMMAR, INVALID_CURSOR, INVALID_RANGE, VIEW_NOT_ALLOWED_AT_SCOPE; 403 POLICY_DENIED, APP_NOT_ADMITTED (the chain's application is not admitted at the scope, §8.26); 503 AUTHORIZATION_STATE_CHANGED (retriable); the storage-lane failures of §8.7.1.
8.7.3 GET /v1/facts
Default view is local — pass view=holistic explicitly for the
requested scope plus authorized ancestors (still no descendant traversal on a
layer-list endpoint).
GET /v1/facts
?scope=...
&view=local
&subject=ent_acme_corp
&predicate=deal_stage
&as_of=2026-04-15T00:00:00Z
&min_confidence=0.6
&include_superseded=false
&include_vectors=false
&limit=50
Capability: scope.read.local and Reader on scope, plus scope.read.holistic for view=holistic or structured and scope.read.descend for view=descend.
as_of and include_superseded: a superseded fact is left out unless include_superseded=true or as_of is set; as_of implies it, since a past as_of asks for the facts that were true then. as_of keeps facts valid at that instant (valid_from ≤ as_of < valid_to) as the system knows them now (recorded_from ≤ now; a served fact never carries recorded_to).
subject and predicate match the fact's subject and predicate, so only a fact with a triple matches. predicate is the ontology canonical (plans_to), matched exactly. subject is the ent_ id a fact is served with (subject.id), or the stored subject surface: a fact matches when its served id, or its stored surface, equals it (since 0.14.0; before, only the stored surface, so ent_priya did not match a fact stored as Priya). min_confidence keeps confidence at or above it. Results are newest first by valid_from; limit defaults to 50 (1 to 1,000), and cursor is as on GET /v1/events.
Since 0.14.0 the route reads every fact of each scope it covers (each exact scope of the view) before it applies its filters and then pages, so a filter never drops an older match; a scope past the store's scan bound of 100,000 rows answers 500 INTERNAL_ERROR. A fact superseded by one the caller may not read is shown as current (no superseded_by, valid_to: null; DB-23), and a fact whose atoms (else its events' atoms) the caller's chain may not read is dropped from the page (DB-28), so a page can hold fewer than limit items. Responses carry X-Cortex-Stability: beta. Errors as GET /v1/episodes (§8.7.2), without INVALID_RANGE.
include (derivation_provenance_v1, new in 0.15.0; also on GET /v1/facts/{id}, GET /v1/facts/timeline, GET /v1/beliefs and GET /v1/beliefs/why): include=derivation adds each fact's derivation object after its own fields (§7.4.3), its stamp read back by id once the page is cut; without it the response is unchanged. Any other value is 400 INVALID_QUERY.
include_vectors (v0.8.11, also on GET /v1/facts/{id}, GET /v1/episodes, GET /v1/beliefs and GET /v1/understanding[/{id}]): embedding vectors (summary_embedding) are omitted by default — two operator reports flagged hundreds of floats per record making listings unreadable for inspection. Since 0.14.0 include_vectors=true returns each record's summary_embedding (a fact's embedding, a belief's or an episode's summary embedding), read back from the side store records are stored lean beside (binary16, within about 1e-3 of the vector embedded); a record that has none stays without. (Before, the listings did not read that store, and true added an embedding only to a record that still carried one inline.)
8.7.4 GET /v1/facts/timeline
GET /v1/facts/timeline?scope=...&subject=ent_acme_corp&predicate=deal_stage
Capability: as GET /v1/facts: scope.read.local and Reader on scope, plus the view's traversal capability.
scope names the scope whose supersession chain to read. It is required of signed callers — omitting it returns 400 INVALID_QUERY (since 0.14.0; it was 422 INVALID_BODY), message: "scope is required for signed callers" — because a per-actor token carries no scope for the scan to authorize. It stays optional for operator credentials (static API key, or an auth-disabled deployment), which then read org:<their billing tenant>. Naming a scope the caller may not read returns 403 POLICY_DENIED. view (default local) widens the read as on GET /v1/facts, and is authorized exactly as there: the view's traversal capability (scope.read.holistic, scope.read.descend), the roster, and 422 VIEW_NOT_ALLOWED_AT_SCOPE for a walk from a shared org-tree scope; 403 POLICY_DENIED otherwise (since 0.14.0; before, only the granular read rule was checked). as_of (RFC 3339, optional; since 0.14.0) is the valid-time lens of GET /v1/facts: only the facts whose bi-temporal window contains as_of under the recorded-now view (valid_from ≤ as_of < valid_to, recorded by now).
Returns the supersession chain for (subject, predicate):
{
"subject": {"id": "ent_acme_corp"},
"predicate": "deal_stage",
"timeline": [
{"fact_id": "fact_01HV...", "value": "poc", "valid_from": "...", "valid_to": "2026-04-10T..."},
{"fact_id": "fact_01HW...", "value": "close", "valid_from": "2026-04-10T...", "valid_to": "2026-05-13T..."},
{"fact_id": "fact_01HX...", "value": "signed", "valid_from": "2026-05-13T...", "valid_to": null}
]
}
subject.id is the subject's served ent_ id. The timeline holds every fact at the scopes read whose subject and predicate match the query's as GET /v1/facts matches them (the served ent_ id or the stored surface), superseded ones included, oldest first by valid_from; value is the fact's stored object, else its text, and valid_to is null for a fact superseded by one the caller may not read (DB-23). With include=derivation (derivation_provenance_v1) each entry also carries its fact's derivation (§7.4.3). A fact whose atoms the caller's chain may not read is left out (DB-28). The route reads at most 100,000 facts of each scope (a scope holding more answers 500 INTERNAL_ERROR). Responses carry X-Cortex-Stability: beta. Errors: 400 INVALID_QUERY (a bad view, or no scope from a signed caller); 422 INVALID_SCOPE_GRAMMAR, VIEW_NOT_ALLOWED_AT_SCOPE; 403 POLICY_DENIED, APP_NOT_ADMITTED; 503 AUTHORIZATION_STATE_CHANGED (retriable); the storage-lane failures of §8.7.1. A missing subject or predicate, or an as_of that is not a date-time, is 400 INVALID_QUERY.
8.7.5 GET /v1/beliefs
GET /v1/beliefs?scope=...&about=ent_acme_corp&min_confidence=0.6&as_of=...&limit=50
Capability: scope.read.local and Reader on scope, plus the view's traversal capability, as GET /v1/facts.
view, limit (default 50, 1 to 1,000) and cursor are as on GET /v1/events. about keeps beliefs whose claim subject is that value: an entity id (an ent_ id also matches a non-ASCII entity name through its current and its pre-D0a slug), a concept id, or a literal string. min_confidence keeps confidence at or above it. as_of keeps beliefs valid and recorded at that instant (valid_from ≤ as_of < valid_to and recorded_from ≤ as_of < recorded_to). include_vectors is as on GET /v1/facts. include=derivation (derivation_provenance_v1) adds each belief's derivation, computed from its supporting facts (§7.4.3).
Since 0.14.0 the route reads every belief of each scope it covers (the scope's own first, then each ancestor's for holistic) before it applies its filters and then pages, so a filter never drops an older match; a scope past the store's scan bound of 100,000 rows answers 500 INTERNAL_ERROR. Each page is then served to this reader (DB-23, DB-28): a belief whose home or declared record it may not read, or none of whose supports it may read, is withheld, and one only some of whose supports it may read is served rebuilt from the facts it may read (rebuilt: true, with a why_url that re-runs the rebuild, §8.7.6), so a page can hold fewer than limit items. The first page (no cursor) at a rollup home also carries rollups: the home's belief rollups the caller is served (rollups_v1), newest first, at most limit, and absent when there are none, so every other page is unchanged.
Response: {items, next_cursor?, has_more, rollups?}. Errors as GET /v1/facts.
8.7.6 GET /v1/beliefs/why
The "why do you think that?" endpoint. Unique to CortexDB.
GET /v1/beliefs/why?belief_id=belief_01HX...
Capability: scope.read.local and Reader on the belief's own scope.
Response:
{
"belief": { /* belief record (§7.4) */ },
"support_graph": {
"nodes": [
{"id": "belief_01HX...", "type": "belief", "summary": "\"is_likely_to_renew\" @ 0.62"},
{"id": "fact_01HX...", "type": "fact", "weight": 0.34, "summary": "Acme upgraded to 200 seats"},
{"id": "evt_01HX...", "type": "event", "summary": "Just got off a call with Priya at Acme..."},
{"id": "ep_01HX...", "type": "episode", "summary": "Acme deal Q3 close"}
],
"edges": [
{"from": "belief_01HX...", "to": "fact_01HX...", "relation": "supported_by"},
{"from": "fact_01HX...", "to": "evt_01HX...", "relation": "extracted_from"},
{"from": "evt_01HX...", "to": "ep_01HX...", "relation": "contained_by"}
]
},
"narrative": "I think Acme is likely to renew because on May 13 they upgraded to 200 seats (fact_01HX), and this followed a positive POC episode (ep_01HX) in April.",
"narrative_model": "claude-haiku-4-5"
}
The graph holds the belief (its predicate and confidence as the summary), each support (with its weight; supported_by, or contradicted_by for a support against the claim), each fact support's text and source events (extracted_from; an event's summary is its content cut to 160 bytes), and each episode of the fact's scope that holds such an event (contained_by), at most 100 nodes. A fact support or a source event the store no longer holds at that scope is type redacted, and a source event a keep_learned retention rule removed is type expired. narrative is the model's 2 to 4 sentences (the answer router, CORTEX_ANSWER_*, at most 300 tokens, usage role layer_explain) when a router is configured, the belief has supports and the caller holds llm.invoke at its scope; otherwise, or when the call fails, it is a fixed sentence and narrative_model is null.
Rebuilt beliefs (beliefs_merged_v1, DB-20). A belief served rebuilt (rebuilt: true) carries a why_url with scope, merges (the stored beliefs it merges) and scopes (the scopes whose facts it read). With merges the route re-runs that rebuild for its caller instead of reading a stored belief: merges names 1 to 256 belief ids and scopes at most 256 scopes (422 INVALID_BODY otherwise), and every merged belief's scope and every named scope is authorized as a by-id read. scope routes the call on a cluster.
?scope= confines the read (since 0.14.0): the belief's own scope must be that scope or lie under it (for a
rebuilt belief's why_url, the rebuilt belief's own scope; the merged beliefs and scopes are each authorized as
before), else the same 404 as an unknown id; a malformed value is 422 INVALID_SCOPE_GRAMMAR.
include=derivation (derivation_provenance_v1, new in 0.15.0): belief carries its derivation after its own
fields, computed from its supporting facts (§7.4.3); any other include value is 400 INVALID_QUERY.
Errors: 400 INVALID_QUERY (belief_id, merges or scopes malformed, or merges naming none or more than the bound, scopes more than the bound; since 0.14.0, it was 422 INVALID_BODY), 422 INVALID_SCOPE_GRAMMAR; 404 NOT_FOUND for an unknown belief, one the caller may not read (or a merged belief or named scope it may not read), a stored belief with a support the caller may not read (that reader is served it rebuilt, and the rebuilt belief's why_url names the rebuild), and a rebuild that does not produce belief_id; 503 AUTHORIZATION_STATE_CHANGED (retriable) for a read that lost a race with an authorization change on each of its three runs, each from a fresh snapshot, and 503 SCOPE_STORAGE_UNAVAILABLE for a scope registry that cannot answer; 503 DB_UNAVAILABLE when the graph could not be read in time; the storage-lane failures of §8.7.1 from the first lookup. Break-glass (§8.15.3, "By-id reads"): class stored_rows, decided by the belief's own scope once it is read, whatever ?scope= names. On a cluster the ingress routes it by ?scope= (501 CLUSTER_ROUTE_UNSUPPORTED without it).
8.7.7 GET /v1/understanding
Capability: scope.read.local and Reader on the scope; also scope.read.holistic for view=holistic or structured, scope.read.descend for view=descend; and understanding.read (since 0.14.0): a walking view leaves out, with no refusal, the concepts of a scope where the token may not read them. Default view is local.
GET /v1/understanding?scope=org:acme/dept:eng&view=local&limit=50&cursor=50
The concepts of a scope (§7.5), newest synthesis first (last_synthesized_at, then id). local, granular, raw and structured read the scope itself; holistic adds the concepts of the ancestors the caller may read (the scope's own first, then each ancestor's), never descendants; descend adds those of the descendants the caller may read. lineage is refused. At a shared org-tree scope a walking view answers 422 VIEW_NOT_ALLOWED_AT_SCOPE, and no walk enters a private region it did not start in (§8.8).
| Parameter | Type | Notes |
|---|---|---|
scope | string | Required. |
view | string | local (default), granular, holistic, descend, raw, structured; anything else is 400 INVALID_QUERY (since 0.14.0, on every layer read that takes view: the events, facts, beliefs and episodes listings and the facts timeline too). |
limit | int | Default 50, clamped to 1..1000. |
cursor | string | The previous page's next_cursor (an offset); anything else is 422 INVALID_CURSOR. |
include_vectors | bool | Default false: summary_embedding is absent. true serves each concept's vector, read from the side store where it is kept by the concept's id (binary16, so within about 1e-3 of what was embedded); a concept with no vector kept has none. |
at_least | string | A consistency token (consistency_tokens_v1, §6.11): the read first waits until this node has reached it at the scope's root; the response then carries the consistency fields after its own. |
Any other query parameter is refused, 400 INVALID_QUERY (details.part: "query", details.reason naming it), as
the rollup routes refuse theirs: topic and depth (the related walk's, §8.7.9) among them.
Response: {"items": [ /* Concept records (§7.5.2) */ ], "next_cursor": "100", "has_more": true}; next_cursor is absent on the last page.
Since 0.14.0 each concept passes the delivery gate (DB-28): it is served only when the reader's chain may read the scope of every atom in supported_by.atoms at Reader, each atom's record is still the one that governed it, and the concept's effective label is within the cap of the reader's best path to its home. A concept without atoms (made before DB-23) is checked by the atoms of the events in supported_by.events, one with neither at its home only. Withheld concepts are dropped before the page is cut: a page holds limit concepts unless it is the last, has_more is true exactly when the reader is served more (and next_cursor is present exactly then), and the cursor counts the concepts the reader is served. A read that loses a race with a registry change runs again from a fresh snapshot, up to three runs. Under CORTEX_OPERATOR_DATA_READS=deny the operator key needs the break-glass header (class stored_rows, or private_region, §8.15.3). GET /v1/concepts is the same handler (§8.7.18).
Errors: 400 INVALID_QUERY; 403 POLICY_DENIED (details.capability, details.denied_by_tier; details.capability: "understanding.read" for that capability, with details.link: "confinement" for an agent chain token or under total confinement), 403 APP_NOT_ADMITTED, 403 BREAK_GLASS_REQUIRED; 408 WAIT_TIMEOUT (retriable); 422 INVALID_SCOPE_GRAMMAR, INVALID_BODY, INVALID_CURSOR, VIEW_NOT_ALLOWED_AT_SCOPE, CONSISTENCY_TOKEN_INVALID; 500 INTERNAL_ERROR (retriable; a scope of more than 100,000 concept rows included); 503 AUTHORIZATION_STATE_CHANGED (retriable), NOTICE_UNAVAILABLE (retriable but for arming_disabled and reserved_path_in_use), DB_SATURATED and DB_UNAVAILABLE (both retriable), SCOPE_STORAGE_UNAVAILABLE, WAL_UNAVAILABLE (retriable); 504 DB_TIMEOUT.
8.7.8 GET /v1/understanding/{concept_id}
Capability: scope.read.local and Reader at the concept's own scope, and understanding.read at the concept's scope (since 0.14.0), whose refusal is the same 404 NOT_FOUND.
Returns full concept record (§7.5), summary_embedding removed unless ?include_vectors=true; true serves the vector as §8.7.7 does. concept_id is concept_ followed by [A-Za-z0-9_-], at most 192 characters; another form is 400 INVALID_PATH_PARAMS (since 0.14.0, here and on /related and /history). An unknown id, a refusal, a concept outside the named ?scope= and a concept the delivery gate withholds (§8.7.7) answer the same 404 NOT_FOUND (concept not found). What is no refusal is not hidden: a read whose authorization changed before delivery lost a race and runs again from a fresh snapshot, up to three runs, answering 503 AUTHORIZATION_STATE_CHANGED (retriable) only when every run lost it; a scope registry that cannot answer keeps its own error (503 SCOPE_STORAGE_UNAVAILABLE and the other codes §16 lists for it), the same for every id. canonical_id is not followed. ?at_least= waits at the token's own root.
The operator key's read under deny is decided once the concept is read, by its tenant's mode (403 BREAK_GLASS_REQUIRED without the header); a break-glass read of a concept in a private region commits the region's notice (cause break_glass) before the concept leaves, 503 NOTICE_UNAVAILABLE when it does not commit. ?scope= (optional) confines the read: a concept whose own scope is not that scope or under it is the same 404 NOT_FOUND (concept not found) as an unknown id, whoever asks and on every node, and the operator plane decides on the concept's own scope, never on the one named (naming a non-private ancestor of a private region's concept does not escape its class or its notice). A malformed ?scope= is 422 INVALID_SCOPE_GRAMMAR. A cluster ingress routes by it (501 CLUSTER_ROUTE_UNSUPPORTED without it).
Errors: 403 BREAK_GLASS_REQUIRED; 404 NOT_FOUND; 408 WAIT_TIMEOUT (retriable); 400 INVALID_PATH_PARAMS (a malformed concept id); 422 INVALID_SCOPE_GRAMMAR, CONSISTENCY_TOKEN_INVALID; 500 INTERNAL_ERROR (retriable); 503 AUTHORIZATION_STATE_CHANGED (retriable), NOTICE_UNAVAILABLE, SCOPE_STORAGE_UNAVAILABLE (retriable since 0.14.0), DB_SATURATED, DB_UNAVAILABLE, WAL_UNAVAILABLE (retriable); 504 DB_TIMEOUT.
8.7.9 GET /v1/understanding/{concept_id}/related
Capability: as §8.7.8.
GET /v1/understanding/{concept_id}/related?relation=specializes&depth=2
A breadth-first walk of the concept's outgoing edges (edges[].to), up to depth hops (1 to 3, default 1; another number is 400 INVALID_QUERY), at most 100 concepts, each visited once. relation keeps only edges whose label equals it exactly, both for inclusion and for further expansion. Only concepts in the root concept's own scope that the delivery gate admits by their own atoms are served; an edge whose target no longer resolves, lies in another scope or is withheld is skipped and not walked through.
Response:
{
"items": [
{"id": "concept_01HY...", "name": "Enterprise renewals", "summary": "...", "confidence": 0.71, "relation": "specializes", "depth": 1}
],
"has_more": false
}
The walk is not paged: has_more is always false, there is no next_cursor, and limit is not read. Refusals, an unknown id and a root concept the gate withholds are 404 NOT_FOUND; ?scope= confines the walk's root as §8.7.8 confines the read; the operator plane and the errors are §8.7.8's (500 INTERNAL_ERROR also when the root concept cannot be read).
8.7.10 GET /v1/understanding/coverage
Capability: scope.read.local and Reader on the scope, and understanding.read (since 0.14.0).
GET /v1/understanding/coverage?scope=org:acme/dept:eng
Response:
{
"scope": "org:acme/dept:eng",
"concept_count": 421,
"avg_confidence": 0.74,
"avg_coverage_score": 0.61,
"avg_staleness_score": 0.0,
"synthesis_lag": "P2D",
"_partial": false
}
Counts and averages over the concepts stored at exactly the scope (no ancestors or descendants; at most the 10,000 newest). synthesis_lag is the coarse ISO 8601 duration since the oldest last_synthesized_at: P<n>D, PT<n>H, PT<n>M or PT<n>S. most_stale_concept names the concept with the highest staleness_score above 0 and is absent otherwise (always, today: §7.5.1). A scope without concepts answers "_partial": true, "_partial_reason": "no_concepts_synthesized_yet", every number 0 and synthesis_lag: "P0D". The counts and averages are over the concepts the delivery gate admits for the reader (§8.7.7): a concept it withholds adds nothing and is never most_stale_concept. A scope whose concepts cannot be read (its scan of at most 100,000 rows exceeded included) is 500 INTERNAL_ERROR, never _partial. The route counts only (operator plane class D-write: the operator key is not refused under deny). ?at_least= is taken as on §8.7.7. GET /v1/concepts/coverage is the same handler.
Errors: 403 POLICY_DENIED (details.capability: "understanding.read" for that capability), APP_NOT_ADMITTED; 408 WAIT_TIMEOUT (retriable); 422 INVALID_SCOPE_GRAMMAR, CONSISTENCY_TOKEN_INVALID; 500 INTERNAL_ERROR (retriable); 503 AUTHORIZATION_STATE_CHANGED, DB_SATURATED, DB_UNAVAILABLE (retriable), SCOPE_STORAGE_UNAVAILABLE (retriable since 0.14.0), WAL_UNAVAILABLE (retriable); 504 DB_TIMEOUT.
8.7.11 POST /v1/understanding/synthesize
Capabilities: understanding.synthesize + scope.write + llm.invoke at the requested scope. The caller must also hold the scope's Writer role.
Async (audit FRI-10) — returns 202 immediately with a job id; the
synthesizer runs in the background.
GET /v1/understanding/synthesize/{job_id} requires scope.read.local and
Reader access at the job's scope. Unknown, expired, and unauthorized job IDs
all return the same 404; authorization is revalidated immediately before
the job state is released. Saturated POST admission returns retriable 503 SYNTHESIS_SATURATED without creating a job.
{
"scope": "org:acme/dept:eng",
"topics": ["sales_process"],
"force": false
}
| Field | Type | Notes |
|---|---|---|
scope | string | Required; a scope path (another value is 422 INVALID_BODY). The final Writer admission registers it first when the deployment auto-registers scopes. |
topics | array of string | Optional; at most 128 entries, each at most 1,024 bytes, 16,384 bytes in all (past a bound: 422 INVALID_BODY). Kept on the job and returned by its status; the pass does not read them. |
force | bool | Optional, default false. Kept on the job; the pass does not read it. |
Under its tenant's deny, the operator key's synthesis into a private region, into a shared org-tree scope (an org, a
team, a group, a compartment), or at a scope no record is registered at (which the admission would register) is an
in-band path (§8.15.3): 403 BREAK_GLASS_REQUIRED, details {mode, class: "in_band", route}, without
X-Cortex-Break-Glass, as a capture or a declared belief there is (since 0.14.0). Nothing is registered or queued.
The pass reads the scope's events (at most 2,000; an event whose directives.extract denies understanding is left out), facts and beliefs (at most 2,000 each) and stores the concepts it makes at the scope. The LLM is the deployment's general router, the one entity extraction uses: CORTEX_LLM_PROVIDERS when set, else CORTEX_LLM_URL with a key from CORTEX_ENTITY_API_KEY, OPENAI_API_KEY or LLM_API_KEY, model CORTEX_LLM_MODEL (default gpt-4o-mini). With none (no key, or CORTEX_LLM_DISABLE=1) the POST answers 503 SYNTHESIZER_UNCONFIGURED (not retriable), after authorization.
Response: 202 + lifecycle stream URL, with the header x-cortex-stability: beta.
{
"job_id": "job_019e...",
"status": "running",
"lifecycle_stream": "/v1/lifecycle/stream?job_id=job_019e..."
}
The stream carries synthesis_progress (stage digest_built, questions_extracted or concept_synthesized, with fraction_complete), then synthesis_complete (concepts_created) or synthesis_failed (error). At most the provider lane's parallelism plus its queue run or wait at once; a job the lane does not admit within 30 s fails. Jobs live in the accepting node's memory, at most 10,000, each kept 24 hours after it ends (§8.7.20); a restart forgets them.
Poll pattern:
job = client.synthesize(scope=SCOPE)
# Subscribe to the SSE stream, or poll GET /v1/understanding/synthesize/{job_id}
# until status is "completed" or "failed":
# GET {job['lifecycle_stream']}
# Then read derived concepts:
summary = client.understanding(scope=SCOPE)
Errors: 403 POLICY_DENIED (a capability denied, a scope outside the caller's billing tenant, or another decision of the final admission about the caller), 403 NOT_A_MEMBER (no Writer role), 403 SCOPE_REGISTRATION_REQUIRED, 403 APP_NOT_ADMITTED, 403 BREAK_GLASS_REQUIRED (above); 409 DESTRUCTIVE_OPERATION_IN_PROGRESS (retriable, Retry-After: 5, details.scopes, retry_after_seconds, admission_wait_seconds: the scope must be registered inside a forget or erasure still running after the admission wait); 422 INVALID_BODY, UNREGISTERED_SCOPE_TYPE; 500 INTERNAL_ERROR (retriable: a storage error in the final admission); 503 SYNTHESIZER_UNCONFIGURED, 503 SYNTHESIS_SATURATED (retriable; no job created), 503 AUTHORIZATION_STATE_CHANGED (retriable: the registry's state moved under the checks or the final admission on each of three runs, which the route makes from a fresh state), 503 SCOPE_STORAGE_UNAVAILABLE, 503 WAL_OUTCOME_UNKNOWN. A race or an outage in the final admission is no decision about the caller, so it is never 403. A refused run keeps no job. Synthesis is class D-write: under deny the operator key is refused only on the in-band paths above.
Model + cost note (audit POL-1): the synthesizer renders concepts
through the deployment's configured LLM router. The selected provider and
model are operator-controlled; synthesis is a metered cost driver. Background
concept reflection triggers per scope after ≥25 new writes or ≥1h
staleness (CORTEX_V1_LAYERS_CONCEPT_MIN_WRITES /
_MAX_AGE_SECS; the legacy CORTEX_V1_LAYERS_CONCEPT_EVERY tick-parity
override still throttles globally when set), so frequent synthesize()
calls on busy scopes can add up on usage-based plans. With enrichment
(CORTEX_ENRICHMENT_DELAY_SECONDS) unset, background reflection is gated
off entirely unless CORTEX_V1_LAYERS_AUTO=1 opts in. Manual
synthesize() calls require the capabilities above and bounded job admission.
8.7.12 GET /v1/derivation/status
Capability: scope.read.local and Reader on scope (a granular read; the trusted operator skips the roster).
Whether background derivation has caught up with what was written to a scope: connectors and cortexdb-sync --wait-derivation poll it after a bulk load. The counters are this process's own, empty at boot; on a cluster the node that serves the scope's root answers.
Two kinds of derivation run behind a write, and the route reports them apart. The top-level fields are the auto-layer scheduler's (episodes, beliefs and concepts built from what the store holds); caught_up says it owes the scope no build, and keeps that meaning, which cortexdb-sync --wait-derivation polls. Facts are not written with the event: the background enrichment derives them on its own schedule (§2, the derivation layer), and the extraction block (derivation_provenance_v1, new in 0.15.0) reports how far it got, with its own caught_up.
GET /v1/derivation/status?scope=org:acme/team:eng
GET /v1/derivation/status?scope=org:acme/team:eng&derived_by=acme-level,import:mem0
{
"scope": "org:acme/team:eng",
"caught_up": false,
"derivation": "auto",
"state": "settling",
"dirty": false,
"idle_seconds": 12,
"last_write_at": "2026-10-27T09:14:02Z",
"last_built_at": "2026-10-27T09:12:40Z",
"last_tick_at": "2026-10-27T09:13:58Z",
"built": {"episodes": 14, "beliefs": 52, "concepts": 3, "errors": 0},
"extraction": {"caught_up": false, "pending": 1820, "learned": 51022, "nothing_admitted": 912,
"held_only": 0, "failed": 3, "last_learned_at": "2026-10-27T09:13:40Z"}
}
| Field | Type | Notes |
|---|---|---|
derivation | enum | auto: the auto-layer scheduler (CORTEX_V1_LAYERS_AUTO, off by default) derives this scope; off: no scheduler runs; excluded: CORTEX_V1_LAYERS_AUTO_EXCLUDE_SCOPES (comma-separated prefixes) matches the scope, or the scheduler excluded it |
state | enum | off (derivation is not auto), no_writes (no write this process accepted), ingesting (writes queued for the next tick), settling (queue drained, last write under 60 s ago), building (settled, not rebuilt since the last write), caught_up (rebuilt after the last write) |
caught_up | bool | true in the states off, no_writes and caught_up. With derivation off or excluded nothing builds by itself: derived layers build only through POST /v1/episodes/build, /v1/beliefs/build and /v1/understanding/synthesize |
dirty | bool | Writes queued for the next tick; always false when derivation is not auto |
idle_seconds, last_write_at | int, RFC 3339 | Since the last write this process accepted; null when none |
last_built_at, last_tick_at | RFC 3339 | The scheduler's last build of this scope, and its last tick (global); null before one |
built | object | Episodes, beliefs and concepts the scheduler built for the scope since boot, and its build errors |
extraction | object | derivation_provenance_v1: present while the capability is served. The scope's events (exactly this scope) by the outcome this node recorded as it applied each enrichment result: learned (a candidate accepted), nothing_admitted (derived, nothing accepted), held_only (every admitted candidate held for review, §8.7.27) and failed (the last attempt came back degraded, retrying or dead-lettered), kept as counters as each outcome is recorded or removed, so the route never scans them (an erasure takes an event's outcome with its derived rows). pending is what the enrichment scanner has yet to derive: exact over the first 4,096 positions past its durable cursor, every position past them counted (an upper bound, never under). caught_up is true when nothing is pending and no retry of the scope's is queued, and always with enrichment off, outside CORTEX_ENRICHMENT_SCOPE_PREFIXES, at enrich: off and in a reference root. last_learned_at is the last time the scope recorded learned (null before one). Per event: GET /v1/derivation/decisions (§8.7.22) |
Write-back reports (derived_by_v1, new in 0.15.0). ?derived_by= names write-backs, comma-separated, at most 8,
each once: a pipeline's name (§3.5.3) or an importer's (import:mem0, import:zep, import:letta, import:openai).
The answer then carries derived_by, one report per name, in order:
"derived_by": [{"name": "acme-level", "latest": "1.1.0", "current": 992, "unsynced": 211, "complete": true}]
| Field | Type | Notes |
|---|---|---|
latest | string or null | The version on the name's most recently committed write in the scope's root: its newest stamped event in log order, or its newest stamped declared belief, whichever was recorded later; null when the name has no write there. Read from the root's rows, whichever the caller may read: a version string, never content |
current | int | Rows under the scope stamped at latest |
unsynced | int | Rows under the scope stamped at another version. The pipeline writes them again, and forgets the old ones |
complete | bool | false when a bound stopped the read (100,000 rows of the scope, 100,000 rows of the root back from the log's head, 100,000 declared records): the counts are then a lower bound, and latest may be an older version |
The rows are the live events under the scope that carry the name's stamp (typed triples and the importers' rows; a
cancelled or forgotten event is not live, and a sealed one, in the segment store, is not read) and the current declared
beliefs under it whose record carries the stamp (a belief a newer declaration closed is history). A name that neither
grammar holds, no name, or more than 8 is 400 INVALID_QUERY; a log or records that could not be read is
503 STORAGE_UNAVAILABLE (retriable). Without the parameter the answer has no derived_by.
The governance block (derivation_rederive_v1, new in 0.15.0; a shard armed for format 11). How much of the
subtree was made under the policy in force at each row's scope (current) and how much under another (unsynced,
what a reextract would bring in line, §8.32.7), with the work that governs it:
"governance": {"policy_hash": "dp1:4be1c0d29a7e3f5b6c8d0e1f2a3b4c5d",
"events": {"current": 48211, "unsynced": 3711, "unreachable_expired": 220,
"by_outcome": {"learned": 50110, "nothing_admitted": 1790, "failed": 22}},
"facts": {"current": 47002, "unsynced": 4020, "stale_restrictions": null},
"held_open": 14, "corrections": 37, "jobs_open": ["job_0196f3b0c1d27b3e9a4f5d6c7b8a9e01"],
"derived_by": [{"name": "acme-level", "latest": "1.1.0", "current": 992, "unsynced": 211,
"complete": true}],
"node_local": ["beliefs", "episodes", "concepts"], "complete": true}
| Field | Type | Notes |
|---|---|---|
policy_hash | string | The effective policy at scope (§8.32.1) |
events | object | The subtree's events by the policy their recorded outcome names: current when it is the one in force at the event's scope, unsynced otherwise; by_outcome, the subtree's recorded outcomes; unreachable_expired, events a keep_learned retention expired whose facts survive, which a regate reaches and a reextract cannot (it has no text to read) |
facts | object | The subtree's facts by their stamp's policy (derivation.p, §8.7.3), the same way. stale_restrictions is what the last regate dry run at this scope counted the policy in force would retire, null until one ran under it |
held_open, corrections | int | Open held candidates and corrections in force at or under the scope |
jobs_open | array | The open re-derivation jobs at the scope, above it or below it (§8.32.7). While one is a reextract, extraction.caught_up is false |
derived_by | array | The write-back report of each name stamped in the scope's root (at most 8), as ?derived_by= answers it |
node_local | array | The layers whose counts are this node's own: builder beliefs, episodes and concepts are built per node |
complete | bool | false when a bound cut a read (more than 4,096 scopes under the scope, 100,000 expired markers, or more than 8 write-back names): the counts are then a lower bound |
Errors: 422 INVALID_SCOPE_GRAMMAR; 403 POLICY_DENIED (or APP_NOT_ADMITTED) when the caller may not read the scope; 500 INTERNAL_ERROR (retriable; the outcome counters could not be read); 503 AUTHORIZATION_STATE_CHANGED (retriable), STORAGE_UNAVAILABLE (retriable: the governance block's reads); the storage-lane failures of §8.7.1. It serves counts, times and versions, never a row's content (a derived_by report counts stored rows), so the operator plane does not gate it. It takes ?at_least= (§6.11).
8.7.13 POST /v1/episodes/build
Capability: scope.write and Writer on scope (the trusted operator skips the roster). Experimental: responses carry X-Cortex-Stability: experimental.
Rebuilds a scope's episodes from its own events and returns them.
{"scope": "org:acme/team:eng/user:alice"}
The build reads every event of exactly this scope (a scope holding more than 200,000 answers 500 INTERNAL_ERROR; before 0.14.0 it read the earliest 5,000), and leaves out the events of sealed episodes (§7.2). It orders them by observed time, splits sessions at gaps over 2 hours (since 0.15.0, the scope's derivation policy can set the gap, group events by a label, or turn the builder off, which removes the scope's built episodes: §8.32, "Producers outside the enrichment job"), gives each episode the atoms of its events (DB-23; an episode past a row's atom bound is dropped) and embeds each summary (one embedding call per episode; a failure leaves that episode without one). It then replaces exactly its scope's own derived rows, the unsealed episodes of the scope (sealed ones stay), with the new ones; every descendant scope's episodes stay as they are, since a build reads only its scope's own events (since 0.14.0; before, a build of a parent dropped its descendants' episodes). Episodes are the serving node's own; a build proposes nothing to the shard. The build runs within the request's deadline (CORTEX_EVIDENCE_TIMEOUT_MS, default 120,000 ms), after the write check, and an authorization change at the scope between the check and the write refuses it.
Response: 200:
{"built": 2, "items": [ /* episode records (§7.2) */ ]}
items are the episodes stored, as this caller is served them: one whose atoms the caller's chain may not read is left out, and built counts items. summary_embedding is never returned here (GET /v1/episodes with include_vectors=true reads it back).
Errors: 422 INVALID_SCOPE_GRAMMAR; 403 POLICY_DENIED (no scope.write, a scope outside the caller's billing tenant or not registered on a durable registry, or no Writer role) or APP_NOT_ADMITTED; 409 AUTHORIZATION_STATE_CHANGED (retriable since 0.14.0: send it again); 500 INTERNAL_ERROR (retriable; the build failed); 503 PROVIDER_SATURATED / PROVIDER_UNAVAILABLE (retriable since 0.14.0) and 504 PROVIDER_TIMEOUT (not retriable); 503 SCOPE_STORAGE_UNAVAILABLE. The operator key under CORTEX_OPERATOR_DATA_READS=deny needs the break-glass header (class stored_rows, §8.15.3).
8.7.14 GET /v1/facts/{id}
Capability: scope.read.local and Reader on the fact's own scope.
One fact (§7.3) by id, superseded ones included: a closed validity window stays fetchable. id is fact_<uuid> or the bare UUID.
GET /v1/facts/fact_0196a1b2c3d47e8f9a0b1c2d3e4f5a6b?scope=org:acme/team:eng
| Parameter | Type | Notes |
|---|---|---|
scope | string | Optional (since 0.14.0). Confines the read to a fact whose own scope is this scope or lies under it; any other fact is 404, as an unknown id. Routes the read on a cluster. 422 INVALID_SCOPE_GRAMMAR when malformed |
include_vectors | bool | true returns the fact's summary_embedding (§8.7.3) |
include | string | derivation (derivation_provenance_v1, new in 0.15.0) adds the fact's derivation after its own fields (§7.4.3); any other value is 400 INVALID_QUERY |
Response: 200 with the fact record, extractor included (0.10.4).
The read is authorized against the fact's own scope (its scope path, else its tenant string). An unknown or malformed id, a fact the caller may not read, a fact under a scope-forget tombstone, and a fact whose atoms the caller's chain may not read (DB-28) all answer the same 404 NOT_FOUND (message: "fact not found"), so the route reveals nothing about a fact the caller may not see. What is no refusal is not hidden: a read that lost a race with an authorization change runs again from a fresh snapshot, up to three runs, answering 503 AUTHORIZATION_STATE_CHANGED (retriable) only when every run lost it, and a scope registry that cannot answer keeps its own error (503 SCOPE_STORAGE_UNAVAILABLE). A fact superseded by one the caller may not read is shown as current (no superseded_by, valid_to: null; DB-23).
Errors: 404 NOT_FOUND; 422 INVALID_SCOPE_GRAMMAR; 500 INTERNAL_ERROR (retriable; the fact store failed); 503 AUTHORIZATION_STATE_CHANGED (retriable), SCOPE_STORAGE_UNAVAILABLE (retriable since 0.14.0); the storage-lane failures of §8.7.1. On a cluster the ingress routes a by-id read by ?scope= (any scope of the fact's root) and answers 501 CLUSTER_ROUTE_UNSUPPORTED without it. Break-glass (§8.15.3, "By-id reads"): class stored_rows, decided by the fact's own scope once it is read, whatever ?scope= names: a break-glass read of a private region's fact is served once the region's notice commits. It takes ?at_least= (§6.11).
8.7.15 POST /v1/beliefs — Declare a belief
Capability: scope.write and Writer on scope (the trusted operator skips the roster); provenance needs write_provenance_v1. Experimental: responses carry X-Cortex-Stability: experimental.
Declares a caller-authored belief (DB-27, API contract §5.8.2). A declared belief is no derivation: no build makes it again, and builds preserve it (§7.4.2).
{
"scope": "org:acme/team:eng",
"statement": "The Q3 release ships on 14 November",
"confidence": 0.8,
"subject": "Q3 release",
"predicate": "ships_on",
"supports": ["evt_0196a1b2c3d47e8f9a0b1c2d3e4f5a6b", "fact_0196a1b2c3d47e8f9a0b1c2d3e4f5a6c"],
"valid_from": "2026-10-27T00:00:00Z",
"provenance": ["evt_0196a1b2c3d47e8f9a0b1c2d3e4f5a6d"]
}
| Field | Type | Notes |
|---|---|---|
scope | string | Required. Where the belief lives, unless the write rules redirect it (below) |
statement | string | Required, non-empty after trimming. The claim's object (a string literal), and its subject when subject is absent |
confidence | number | Required, 0 to 1; also each support's weight |
supports | array | Event (evt_…) and fact (fact_…) ids, duplicates dropped. Each must name an event or fact of exactly this scope (an event a keep_learned retention rule expired counts): another kind of id is 422 INVALID_BODY, one that names nothing here 422 UNKNOWN_SUPPORT |
subject | string | The claim's subject: an ent_… id as given, else ent_<slug> of the text, with the text kept as its name; blank is absent |
predicate | string | Default asserts; blank is absent |
valid_from | RFC 3339 | Default now |
provenance | array | write_provenance_v1: the events the belief was made from, at most 1,024 distinct evt_… ids of the scope's root, which its record cites beside its supports, so an erasure of any of them erases the belief on every replica. Needs a shard armed for format 10 |
idempotency_key | string | Optional, 1 to 256 bytes, not blank (since 0.14.0). The same caller (sub), billing tenant, requested scope and key name one belief (its id is derived from them), so a retry after an outcome it did not learn (503 WAL_OUTCOME_UNKNOWN, a lost connection) answers the belief the first attempt declared, 201, never a second one. The same key with another statement, confidence, supports, landing scope or derived_by is 409 IDEMPOTENCY_CONFLICT. Without a key every declaration is a new belief |
derived_by | object | derived_by_v1 (new in 0.15.0): the write-back stamp of the pipeline that declared it, {name, version}, in the envelope's grammar (§3.5.3; 422 DERIVED_BY_INVALID otherwise). It rides the belief's replicated record, so it needs a shard armed for format 10 (503 FORMAT_UPGRADE_PENDING below it): every replica stores it with the record, an older one's too, and no belief view carries it, so only include=derivation serves it (§7.4.3). null is no stamp |
Unknown fields are ignored.
Response: 201 with the belief (§7.4): a new belief_<uuid> id, stance supported, revision_count: 0, a why_url, and its supports with the atoms of what they cite (DB-23); summary_embedding is never returned here (a listing's include_vectors=true reads it back). A belief the write rules redirected carries redirected_to, the scope it landed in.
Declaring over the same claim. The declaration closes every earlier belief at the scope that is still open, has the same subject and predicate, and is valid from no later than the new one: its valid_to becomes the new valid_from, its stance deprecated, and its revision_count grows by one.
Where it lives (DB-27). On a shard armed for format 10 the belief is a replicated record: a PutDeclared entry citing its event supports, its facts' events and its provenance, with the atoms of what the writer's chain read (DB-28), applied by every replica, carried by a scope move, and erased with any event it cites. The route applies it on this node before it answers. Below format 10 the belief is the leader's alone, as before 0.14.0, and a declaration that carries provenance or atoms answers 503 FORMAT_UPGRADE_PENDING with details: {reason, format: 10, node, paths, count, scope}; only members_behind is retriable, with Retry-After: 30.
Write rules (§1.3, DB-28). A token with act and no run is refused 403 RUN_REQUIRED. A non-human write carries atoms and provenance from its chain's read record, as a capture does, and is redirected to its writer's private space when its record is unknown or tainted, it would carry more than 16 atoms, or an atom is a private region; a redirect the token may not write, a chain with no person, or more than 64 atoms is 403 ATOMS_REDIRECT_REFUSED (details.reason: confinement, no_person, no_private_space or too_many_atoms). A cited event of another root is 422 CROSS_ROOT_PROVENANCE where this node holds it (on a cluster, an event of a root another shard holds is 422 PROVENANCE_UNKNOWN). The operator key's declaration into a private region, at a shared org-tree scope or at an unregistered scope is an in-band path (§8.15.3). A derivation policy's writer rules (since 0.15.0, §8.32, "Writer rules") apply to the claim's predicate (asserts when absent) at the scope the belief lands in, as writer declared_belief: a refusal is 409 WRITER_NOT_ALLOWED and nothing is stored.
A retry after 503 WAL_OUTCOME_UNKNOWN that sends the first attempt's idempotency_key answers the belief it declared; one without a key may declare the belief twice, under two ids.
Errors: 422 INVALID_SCOPE_GRAMMAR; 422 INVALID_BODY (an empty statement, a confidence outside [0, 1], a support that is not an event or fact id, a provenance entry that is not an event id or more than 1,024 of them, or a declaration past a record's bounds: more than 1,024 cited events in all, or an encoding over 1,032,192 bytes; the provenance cases carry details.field: "provenance"); 422 UNKNOWN_SUPPORT; 422 CROSS_ROOT_PROVENANCE; 422 PROVENANCE_UNKNOWN (a cited event the shard does not hold under the root; details: {belief_id, cited}); 403 POLICY_DENIED, APP_NOT_ADMITTED, RUN_REQUIRED, ATOMS_REDIRECT_REFUSED, BREAK_GLASS_REQUIRED; 409 PROVENANCE_ERASED (a cited event was erased or redacted; details: {belief_id, cited}); 409 WRITER_NOT_ALLOWED (not retriable; details: {predicate, writers, requires}); 409 AUTHORIZATION_STATE_CHANGED (retriable since 0.14.0); 409 IDEMPOTENCY_CONFLICT; 413 WAL_TOO_LARGE (not retriable: the declaration encodes past the 4 MiB command limit); 500 INTERNAL_ERROR (retriable); 503 FORMAT_UPGRADE_PENDING (details.reason, format, node, paths, count, scope; retriable only for members_behind, Retry-After: 30); 503 STORAGE_UNAVAILABLE (retriable: a cited fact or an earlier belief could not be read, or the derivation policy whose writer rules admit the belief did not read; not retriable for details.reason: record_unreadable); 503 DISK_FULL (retriable, Retry-After: 30); 503 WAL_UNAVAILABLE, NOT_LEADER, WAL_OUTCOME_UNKNOWN (retriable) and the shard's other refusals of the proposal, each by its own flag (§16); 503 PROVIDER_SATURATED / PROVIDER_UNAVAILABLE (retriable) and 504 PROVIDER_TIMEOUT; 503 SCOPE_STORAGE_UNAVAILABLE.
8.7.16 GET /v1/beliefs/history
Capability: scope.read.local and Reader on the belief's own scope.
GET /v1/beliefs/history?belief_id=belief_0b9f2c...
Response:
{
"current": { /* belief record (§7.4) */ },
"versions": [ { /* the belief before its first revision */ }, { /* ... */ } ],
"revision_count": 2
}
versions are the earlier semantic versions the belief builder kept when a rebuild changed the belief's claim, stance, confidence or supports, each with recorded_to set to when it was replaced, oldest first; revision_count is how many are listed. A declared belief (§8.7.15) has none: a newer declaration closes it in place. As on the other belief reads, current is served as this reader may read it (rebuilt from the supports it may read when it may read only some; DB-23), and a version is listed only when the reader may read every one of its supports.
Errors: 400 INVALID_QUERY (belief_id missing or not a belief id; since 0.14.0, a malformed one was 422 INVALID_BODY); 404 NOT_FOUND (message: "belief not found") for an unknown belief, one the caller may not read or none of whose supports it may read; 503 AUTHORIZATION_STATE_CHANGED (retriable) for a read that lost a race with an authorization change on each of its three runs, and 503 SCOPE_STORAGE_UNAVAILABLE (retriable since 0.14.0); 500 INTERNAL_ERROR (retriable); the storage-lane failures of §8.7.1. Break-glass (§8.15.3, "By-id reads"): class stored_rows, decided by the belief's own scope once it is read, whatever ?scope= names. ?scope= (since 0.14.0) confines the read to a belief whose own scope is that scope or lies under it; any other belief is the same 404, and a malformed value 422 INVALID_SCOPE_GRAMMAR. On a cluster the ingress routes it by ?scope= (501 CLUSTER_ROUTE_UNSUPPORTED without it). It takes ?at_least= (§6.11).
8.7.17 GET /v1/understanding/{concept_id}/history
Capability: scope.read.local and Reader at the concept's own scope, and understanding.read at the concept's scope (since 0.14.0), whose refusal is the same 404 NOT_FOUND.
The concept now and the versions it superseded (§7.5.1).
{
"current": { /* Concept (§7.5.2), version 3 */ },
"versions": [
{ /* version 1, "recorded_to": "2026-05-02T10:00:00Z" */ },
{ /* version 2, "recorded_to": "2026-05-13T15:42:09Z" */ }
]
}
| Field | Type | Notes |
|---|---|---|
current | Concept | The concept as GET /v1/understanding/{concept_id} serves it, summary_embedding absent unless ?include_vectors=true, which serves it as §8.7.8 does |
versions | array of Concept | The retained earlier versions of the same id in the same scope, oldest first (by version), each with recorded_to set to when it was superseded; no version carries a vector (only the current one is kept) |
A version is kept when a synthesis changes the concept's name, stance, edges (target and relation) or supported_by; a re-worded summary updates the concept in place. Each version passes the delivery gate by its own atoms or is left out; a current concept the gate withholds is 404. The history is not paged. Refusals and unknown ids are the same 404 NOT_FOUND as §8.7.8, whose operator-plane rules, ?scope= and ?at_least= apply here too.
Errors: 403 BREAK_GLASS_REQUIRED; 404 NOT_FOUND; 408 WAIT_TIMEOUT (retriable); 400 INVALID_PATH_PARAMS (a malformed concept id); 422 INVALID_SCOPE_GRAMMAR, CONSISTENCY_TOKEN_INVALID; 500 INTERNAL_ERROR (retriable); 503 AUTHORIZATION_STATE_CHANGED (retriable), SCOPE_STORAGE_UNAVAILABLE (retriable since 0.14.0), STORAGE_UNWIRED (a server built without storage), NOTICE_UNAVAILABLE, DB_SATURATED, DB_UNAVAILABLE, WAL_UNAVAILABLE (retriable); 504 DB_TIMEOUT.
8.7.18 /v1/concepts — aliases of /v1/understanding
/v1/concepts is the user-facing name of the Understanding layer. Five routes are registered on the same handlers as their /v1/understanding counterparts: the same parameters (so GET /v1/concepts refuses topic, depth and every other parameter it does not read, 400 INVALID_QUERY), authorization, delivery gate, operator-plane class, cluster routing, responses and errors. Nothing differs.
| Alias | Same handler as |
|---|---|
GET /v1/concepts | GET /v1/understanding (§8.7.7) |
GET /v1/concepts/{concept_id} | GET /v1/understanding/{concept_id} (§8.7.8) |
GET /v1/concepts/{concept_id}/related | GET /v1/understanding/{concept_id}/related (§8.7.9) |
GET /v1/concepts/{concept_id}/history | GET /v1/understanding/{concept_id}/history (§8.7.17) |
GET /v1/concepts/coverage | GET /v1/understanding/coverage (§8.7.10) |
Synthesis has no alias: it is POST /v1/understanding/synthesize (§8.7.11) and GET /v1/understanding/synthesize/{job_id} (§8.7.20) only.
8.7.19 GET /v1/claims and GET /v1/claims/history
Capability: scope.read.local and Reader on the named scope. Both need the bi-temporal engine (§12.5): CORTEX_BITEMPORAL_MODE shadow (the default) or enforce; off answers 503 BITEMPORAL_DISABLED.
GET /v1/claims is the two-axis record query over every claim (scope, subject, predicate) at the scope and the descendants the caller may read: only the scope's own at a shared org-tree scope, and never a private region the named scope is not in, whoever reads.
GET /v1/claims?scope=org:acme&subject=acme corp&predicate=headquartered_in&valid_as_of=2023-06-01&known_as_of=2024-01-01
| Parameter | Type | Notes |
|---|---|---|
scope | string | Required. |
subject | string | Only claims of this subject, compared after the engine's text normalization. |
predicate | string | Only claims of this predicate, mapped to its canonical name through the engine's predicate ontology. |
valid_as_of | date expression | World-time point (point mode); default now. |
known_as_of | date expression | Record-time point (point mode); default now. |
valid_during | start..end | World-time range: switches to range mode. |
recorded_during | start..end | Record-time range: switches to range mode. |
limit | int | Default 100, clamped to 1..1000. |
Point mode returns the records valid at valid_as_of that were current knowledge at known_as_of ("what was true at X, as known at Y"); a past known_as_of returns what was then believed, records since retracted or erased included (an erased one with object: null, redacted: true). Range mode, when either range is given, ignores the points and returns the records whose valid interval overlaps valid_during and whose record-time interval overlaps recorded_during. A date expression is an ISO date or RFC 3339 date-time, a year-month (2024-03), a written month (March 2024) or a bare year, read as the start of its period; a range runs from the start of start's period to the end of end's (2023..2024 is all of 2023 and 2024) and must not be empty. A relative phrase (today, yesterday, this year, last year, last month, last week, last summer, 2 years ago) is refused, since nothing anchors it here: 422 INVALID_DATE for a point, 422 INVALID_RANGE for a range (since 0.14.0; before, it was resolved against 1970-01-01). Records come claim by claim, in (scope, subject, predicate) order, cut at limit; there is no cursor.
Response:
{
"records": [
{
"id": "0192f1c2-7d1e-7a40-9b1c-4f7d2e8a1b33",
"subject": "acme corp",
"predicate": "headquartered_in",
"object": "Berlin",
"redacted": false,
"valid_from": "2021-03-01T00:00:00Z",
"valid_from_basis": "stated",
"valid_to": null,
"valid_to_basis": "observed",
"recorded_from": "2024-05-02T09:14:07Z",
"recorded_to": null,
"status": "active",
"supersedes": null,
"source_authority": "extraction",
"extractor": "gpt-4o-mini",
"confidence": 0.82
}
]
}
| Field | Type | Notes |
|---|---|---|
object | string | null | The value as text (an entity id, text, a quantity with its unit, a date, true/false); null when erased |
valid_from, valid_to | timestamp | null | RFC 3339, whole seconds, UTC; null for an unbounded start or an open end |
valid_from_basis, valid_to_basis | enum | stated (render "on/since observed (render "by |
recorded_from, recorded_to | timestamp | When the record became and stopped being current knowledge; recorded_to null while current |
status | enum | active, record_superseded, retracted, erased |
supersedes | uuid | null | The record this one corrected |
source_authority | enum | low_trust_connector, extraction, high_trust_connector, operator |
GET /v1/claims/history?scope=&subject=&predicate= (all three required) is the change log of one claim, exactly at the scope: history, every record of the claim oldest record time first (every valid interval and every record-time correction), and conflicts, every conflict of the claim in the scope whatever its status (§8.7.21), oldest detection first; claim echoes the key looked up (scope, normalized subject, canonical predicate). It is not paged. Its conflicts are the claim's conflicts the reader is served a record of, each with only those records (§8.7.21).
Since 0.14.0 every record either route returns passes the delivery gate by the atoms of the event it derives from (at its home only when that event carries none), and enters the chain's read record. Neither route takes ?at_least=. Under deny the operator key needs the break-glass header (class stored_rows, or private_region, §8.15.3).
Errors: 400 INVALID_QUERY (a required parameter missing); 403 POLICY_DENIED (details {capability: "scope.read.local", denied_by_tier: "scope"}; also a registry change between the access plan and the read), 403 BREAK_GLASS_REQUIRED; 422 INVALID_SCOPE_GRAMMAR, INVALID_DATE and INVALID_RANGE (claims; checked after authorization and the engine check); 503 BITEMPORAL_DISABLED, NOTICE_UNAVAILABLE, SCOPE_STORAGE_UNAVAILABLE. These routes' error bodies carry no request_id (the X-Request-Id header does).
8.7.20 GET /v1/understanding/synthesize/{job_id}
Capability: scope.read.local and Reader at the job's scope.
{
"job_id": "job_019e...",
"status": "completed",
"concepts_created": 4,
"topics": ["sales_process"]
}
| Field | Type | Notes |
|---|---|---|
job_id | string | As the 202 of §8.7.11 returned it |
status | enum | running (queued or running), completed, failed |
concepts_created | int | Set when the job completes; 0 before and on failure |
topics | array of string | As submitted |
error | string | Why the job failed, at most 4 KiB; absent unless failed |
Jobs are held in the memory of the node that accepted them, at most 10,000, each kept 24 hours after it ends (the oldest ended jobs make room first); a restart forgets them. An unknown or expired id, a job of a scope the caller may not read and a read whose authorization changed answer the same 404 NOT_FOUND (synthesize job not found). The route takes no ?at_least= (it does not read one). Under deny the operator key needs the break-glass header, decided once the job is read by its scope and its tenant's own mode (class stored_rows, or private_region, whose read commits the region's notice first). ?scope= confines the read: a job whose scope is not that scope or under it is the same 404 NOT_FOUND; a malformed one is 422 INVALID_SCOPE_GRAMMAR. On a cluster, name ?scope= (the ingress routes by it).
Errors: 403 BREAK_GLASS_REQUIRED; 404 NOT_FOUND; 422 INVALID_SCOPE_GRAMMAR; 503 NOTICE_UNAVAILABLE (a break-glass read of a private region's job whose notice did not commit).
8.7.21 /v1/conflicts
Capability: scope.read.local and Reader for the reads, scope.write and Writer for a resolution, each on the conflict's scope (the queue: the named scope). The bi-temporal engine must be on (§8.7.19).
GET /v1/conflicts?scope=&status=&limit=&cursor= is the conflict queue: value disagreements, temporal overlaps, corrections and low-confidence auto-resolutions between claims of one (subject, predicate), and the polarity conflicts the belief builder opens (a live claim beside a live denial of it). It is subtree-inclusive, oldest detection first: a descendant's conflicts are listed only when the caller may read the descendant's scope, a private region the named scope is not in is never entered (the operator key included), and at a shared org-tree scope only the scope's own conflicts are read. status=all lists every status; any other value, or none, lists open conflicts. limit defaults to 50, clamped to 1..500; cursor is the previous page's next_cursor.
{
"conflicts": [
{
"id": "0192f1c3-1b2a-7c55-8e0f-2a9d4c6b7e10",
"scope": "org:acme/user:alice",
"subject": "alice",
"predicate": "lives_in",
"kind": "value_disagreement",
"status": "open",
"records": [ /* claim records (§8.7.19) */ ],
"detected_at": "2026-10-20T08:12:44Z",
"resolved_at": null,
"resolved_by": null,
"resolution": null
}
],
"total": 1,
"next_cursor": null
}
| Field | Type | Notes |
|---|---|---|
kind | enum | value_disagreement, temporal_overlap, correction, low_confidence |
status | string | open, auto_resolved, manually_resolved, dismissed or merged:<survivor uuid> |
records | array | The member records the delivery gate admits (§8.7.19). A conflict the gate admits none of the records of is not there for the reader: the queue neither lists it nor counts it in total, and GET /v1/conflicts/{id} and POST /v1/conflicts/{id}/resolve answer the same 404 NOT_FOUND as an unknown id (the resolution before any notice is told or anything changes) |
resolved_by | string | null | auto:<strategy> for the engine's own resolutions; for a resolution through this API, the resolving principal (user:alice; for the operator key, its X-Cortex-Actor). A conflict resolved before 0.14.0 keeps operator:<billing tenant id> |
resolution | object | null | The resolution applied, as the request that makes it reads (since 0.14.0): {"action": "pick", "winner", "reason"}, {"action": "split", "boundary", "earlier", "later"} (boundary an RFC 3339 instant: the start of the period the request named), {"action": "new_information", "record"} or {"action": "dismiss", "reason"}; the engine's own resolutions read the same way. null while the resolution names a record the reader is not served (a pick's winner, a split's earlier or later, the new_information record): it is withheld with that record |
confidence | number | Absent for a full-confidence conflict; 0.5 for a probable spelling variant (§12.5) |
total | int | Every conflict the caller is served at this status |
next_cursor | int | null | null on the last page |
GET /v1/conflicts/{id} returns one conflict. An unknown id, a refusal and a conflict whose scope changed are the same 404 NOT_FOUND (conflict <id> not found); a scope registry that cannot answer keeps its own error, and with the engine off every id is 503 BITEMPORAL_DISABLED. ?scope= (optional) confines the read: a conflict whose scope is not that scope or under it is the same 404 NOT_FOUND (conflict <id> not found) as an unknown id, whoever asks. Under deny the operator key's read is decided once the conflict is read, by the conflict's own scope and its tenant's mode, as §8.7.8 describes.
POST /v1/conflicts/{id}/resolve resolves an open conflict. The body is one of:
{"action": "pick", "winner": "0192f1c2-7d1e-7a40-9b1c-4f7d2e8a1b33", "reason": "confirmed with the customer"}
{"action": "split", "boundary": "2024-03", "earlier": "0192f1c2-7d1e-7a40-9b1c-4f7d2e8a1b33", "later": "0192f1c4-0a6e-7f12-b3d4-9c8e7f6a5b21"}
{"action": "new_information", "record": "0192f1c9-5e4d-7b3a-a2c1-0f9e8d7c6b5a"}
{"action": "dismiss", "reason": "two offices"}
| Action | Effect |
|---|---|
pick | winner (a member) stays. Every other current, unredacted member whose value differs and whose valid interval overlaps the winner's is closed at the winner's valid start when it began earlier (a narrowed successor supersedes it in record time), else retracted. reason defaults to "". |
split | Both were true, on either side of boundary, an absolute date expression (§8.7.19) read as the start of its period (a relative phrase is 422 INVALID_BOUNDARY): earlier's valid interval is closed there and later is moved to start there, each only while current. |
new_information | As pick, with record as the winner: a record of the conflict's own scope, a member or not. A record of any other scope, another tenant's included, is refused exactly as an id that names no record (409 RESOLVE_FAILED, record <id> is not a member of the conflict). |
dismiss | Not a real conflict: the members' value hashes are recorded for the claim, so the same values never reopen it. reason defaults to "". |
The resolution is applied and appended to the engine's log in one step: a log write that fails leaves the conflict as it was and answers 503 WAL_UNAVAILABLE (retriable), and a resolution the engine refuses part way applies nothing either. It is audited (action conflict_resolve), resolved_by names the resolving principal, and the node's answer cache is cleared.
Below format 11 the resolution is local to the node that ran it: it changes the bitemporal store and that node's log only, so recall, /v1/facts and /v1/beliefs never see it, and a failover undoes it. On a shard armed for format 11 (corrections_v1, new in 0.15.0, §8.7.24) the resolution is also proposed as corrections, which every replica applies to its facts, beliefs and recall: pick and new_information pin the winner's claim and reject each loser with effect close (a loser that was once true stays in /v1/facts/timeline; "loser": "wrong" beside a pick deletes the losers' facts instead), split confirms the earlier claim until boundary and the later from it, and dismiss confirms both values. Each correction has origin: conflict and is keyed by the conflict and its record, so a retried resolution finds the ones it made; the response gains correction_ids. A record whose fact this node does not hold makes no correction. A correction that did not commit after the engine resolved answers 503 WAL_OUTCOME_UNKNOWN (retriable: the retry finds what was made). The bitemporal store's own resolution stays the node's. Response: 200 with the conflict after resolution (its records through the delivery gate), or {"resolved": true} when it no longer exists. A refusal is the same 404 as an unknown id. Under deny the operator key needs the break-glass header, decided once the conflict is read by the conflict's own scope and its tenant's own mode (class stored_rows, or private_region); a break-glass resolution of a private region's conflict commits the region's notice before it resolves anything (503 NOTICE_UNAVAILABLE when the notice does not commit, and the conflict is unchanged). ?scope= confines the resolution as it does the read.
None of the three routes takes ?at_least=; since 0.14.0 their error bodies carry request_id, as the X-Request-Id header does.
Errors: 400 INVALID_PATH_PARAMS (an id that is not a UUID); 403 POLICY_DENIED (the queue: details {capability: "scope.read.local", denied_by_tier: "scope"}), 403 BREAK_GLASS_REQUIRED; 404 NOT_FOUND; 409 RESOLVE_FAILED (the conflict is not open, a pick winner or a split record is not a member, the new_information record is not a record of the conflict's scope, or the boundary leaves a record no valid interval); 422 INVALID_SCOPE_GRAMMAR (the queue, or a malformed ?scope=), INVALID_BOUNDARY (split, after authorization), INVALID_BODY (a body of no form); 503 BITEMPORAL_DISABLED, STORAGE_UNWIRED (resolve, a server built without storage), NOTICE_UNAVAILABLE, SCOPE_STORAGE_UNAVAILABLE, WAL_UNAVAILABLE (retriable; the resolution's log write failed). None is retriable but WAL_UNAVAILABLE, NOTICE_UNAVAILABLE (except arming_disabled and reserved_path_in_use) and, since 0.14.0, SCOPE_STORAGE_UNAVAILABLE.
8.7.22 GET /v1/derivation/decisions (derivation_provenance_v1, new in 0.15.0)
Capability: scope.read.local and Reader on the event's own scope (the trusted operator, the static CORTEX_API_KEY or an auth-disabled server, skips the roster). Experimental: responses carry X-Cortex-Stability: experimental.
What became of one event's derivation: whether the background enrichment learned something from it, nothing, or has not got to it yet, and why.
GET /v1/derivation/decisions?scope=org:acme/user:alice&event_id=evt_0196f2a0c1d27b3e9a4f5d6c7b8a9e01
{"event_id": "evt_0196f2a0c1d27b3e9a4f5d6c7b8a9e01", "outcome": "nothing_admitted",
"policy_hash": "dp1:none", "prompt_version": "kx-default-batch:9c1e44a0",
"models": {"knowledge": "claude-haiku-5-5", "entity": "gpt-4o-mini"},
"accepted": 0, "held": 0, "rejected": {}, "at": "2026-11-07T10:05:00Z", "computed": false}
| Parameter | Notes |
|---|---|
scope | Required. A scope at or above the event's own; the event's own scope must lie at or under it, else the same 404 as an unknown event. Its root routes the request on a cluster and finds a sealed or expired event's marker |
event_id | Required. evt_<uuid>; anything else is 400 INVALID_QUERY |
The route takes nothing else (another parameter, at_least included, is 400 INVALID_QUERY).
Every node records an outcome as it applies an enrichment result (a single node's drain; each data node's learner, from the shard's learned record and at the record's clock, so every replica records the same), and the response is that record, computed: false:
outcome | Meaning |
|---|---|
learned | At least one candidate was accepted; accepted counts them |
nothing_admitted | The event was derived and nothing was accepted, or nothing was produced. A terminal learned state: the enrichment backfill, distill (§8.15.1) and the re-derivation's queue (POST /v1/admin/derived/rederive) do not ask the model about such an event again on their own, so facts a derived_only forget removed do not come back through them. A re-derivation that purges the event's derived rows takes its outcome with them and records its own |
held_only | Candidates were held for review (§8.7.27) and none was accepted. A terminal learned state, as nothing_admitted is: an approval later makes its fact |
failed | The attempt's result came back degraded (a provider or processor failed); retrying is true while a retry is queued, false once it is dead-lettered |
With no outcome recorded, the outcome is computed at read, computed: true (at: null, the policy in effect now): pending while the enrichment scanner has not passed the event, or a re-derivation queued it, and while the node applies a result of the event (from its first fact written to its outcome recorded, a re-extraction's replacement included: never a terminal outcome nothing recorded); skipped, with reason, when enrichment does not take it now: enrich_off (enrichment off for the process, outside its scope allowlist, or off by the scope's effective enrich), reference_root, extract_none (its directives.extract names no stage the model runs), typed_triple (stored as the caller's own fact, never derived) or no_content; failed from the retry sets; and, for an event derived before 0.15.0 recorded outcomes, learned when a fact cites it (whatever enrichment would do with the event now; never for a typed triple), else nothing_admitted; and skipped, reason budget, while a job a derivation policy's spent daily budget deferred waits for the next UTC midnight (§8.32), after which it is pending again. The reasons mode_off (the effective policy's or the subject's mode: off), not_explicit (mode: explicit, and the event is not marked), detector (detectors.source_action: skip met a detector hit) and source_rule (a sources rule refuses the event) are a derivation policy's (§8.32). A rejected candidate is never described: rejected counts them by rule id, never their text.
An event's outcome goes with its derived rows at erasure and at eviction (a move records it again at the target as the target's learner applies the root's learned records). A forget of the derived rows alone, a keep_learned detach and a seal keep it, so a sealed or expired event keeps its recorded outcome.
A reader of the event only: an event the caller may not read, one whose atoms its chain may not read, a cancelled event, one under a scope-forget tombstone, one whose own scope is not ?scope= or under it, and one this node does not hold all answer the same 404 NOT_FOUND (message: "event not found"). Errors: 400 INVALID_QUERY; 404 NOT_FOUND; 422 INVALID_SCOPE_GRAMMAR; 500 INTERNAL_ERROR (retriable; the outcome journal or the event log failed); 503 FORMAT_UPGRADE_PENDING on a shard armed below format 10 (only members_behind is retriable); 503 AUTHORIZATION_STATE_CHANGED (retriable), SCOPE_STORAGE_UNAVAILABLE (retriable); the storage-lane failures of §8.7.1. Break-glass (§8.15.3, "By-id reads"): class stored_rows, decided by the event's own scope once it is found. On a cluster the ingress routes the request by ?scope='s root to its leader (422 SCOPE_REQUIRED without one).
8.7.23 GET /v1/derivation/feed (derivation_feed_v1, new in 0.15.0)
Capability: scope.read.local and Reader on the scope (the trusted operator, the static CORTEX_API_KEY or an auth-disabled server, skips the roster); descend=true also needs scope.read.descend, as GET /v1/events?view=descend does (422 VIEW_NOT_ALLOWED_AT_SCOPE at a shared org-tree scope). Experimental: responses carry X-Cortex-Stability: experimental.
The change feed: what a worker outside CortexDB reads to derive from a scope's events (a profile field, a summary, a label) and write the results back, each write naming the events it read in provenance (§3.5), so that erasing an event erases what was made from it. The worker runs on the customer's compute; CortexDB runs none of its code.
GET /v1/derivation/feed?scope=org:acme/app:tutor&consumer=acme-level&limit=500&descend=true
{"items": [{"type": "erased", "event_id_hashes": ["284c5e5cb197e678093a790ca6ccf3d7ec1822b71b811b3d42672d49e4fca18e"],
"scope": "org:acme/app:tutor/user:k2", "erasure_id": null, "tombstone": null},
{"type": "erased", "event_id_hashes": ["0f5fb639d267e11697244d93e51beec1a53f181b5381617b0a2ec192a4f8f470"],
"scope": "org:acme", "erasure_id": null, "tombstone": null},
{"type": "event", "event": {"id": "evt_0196f2a0c1d27b3e9a4f5d6c7b8a9e03",
"scope": "org:acme/app:tutor/user:k9", "content": {"kind": "text", "text": "…"},
"context": {"labels": ["source:assessment"]}, "…": "…"}}],
"next_cursor": "eyJ2IjoxLCJyb290Ijoib3JnOmFjbWUiLCJlcG9jaCI6MCwiZmQiOjB9", "has_more": false,
"consumer_recorded": true}
| Parameter | Notes |
|---|---|
scope | Required. The feed's scope; its root routes the request on a cluster |
descend | true: the scope and every authorized scope under it; false (the default): the scope alone |
cursor | The previous page's next_cursor, as it was given. Absent: the feed starts at the root's beginning, or at since |
since | RFC 3339 (write a UTC offset as Z, or percent-encode +). Without a cursor only (400 INVALID_QUERY beside one): the feed starts at the first event whose id was minted at or after it |
limit | 1 to 1,000 items (default 500); anything else is 400 INVALID_QUERY. A page holds more only to keep one erasure's items together |
consumer | The worker's name, [a-z0-9][a-z0-9._-]{0,63} (else 400 INVALID_QUERY). A cursor is bound to the consumer it was issued to: send the same one with it |
The route takes nothing else (another parameter is 400 INVALID_QUERY).
Items. A page holds two streams, each in its own log order: the erasures that touch the scope, then its events.
type | Fields | A worker should |
|---|---|---|
event | event: the captured event exactly as GET /v1/events serves it to this reader (§8.7.1: the same checks, the delivery gate's, derives) | Derive and write back |
erased | event_id_hashes (below); scope, the scope the erasure removed them under (the erasure's, or a cascade group's), or, where this reader may not know it, the nearest scope above both it and the feed's; erasure_id, null in this release; tombstone, the scope a whole-scope erasure tombstoned, else null | Delete its copies and what it derived from them. CortexDB already erased the write-backs citing them |
expired | event_id_hashes: detached by a keep_learned retention rule (§8.15.1); the raw text is gone | Delete raw copies; keeping what it derived is allowed |
redacted | event_id_hashes: redacted in place | Delete raw copies |
rehomed | event_id, from, to: an event moved within the root (POST /v1/access/rehome); to is null when it moved where this feed does not serve it to this reader | Update its scope bookkeeping; with to: null, treat the event as gone from this feed |
gap | reason: re_anchored, the cursor re-anchored after a scope move; or sealed, with event_ids, events the segment store sealed (§8.15.6) before the cursor may have reached them | Expect items again; or read each named event with GET /v1/events/{id}?scope= |
Ordering and delivery. Events come in the order the shard applied them, erasures in the order they were committed. A page's erasures are read before its events, so an erasure committed after a page's events were read comes in a later page, never before the event it erases. Delivery is at least once: an item may come again (a retried cursor, a re-anchored one), and none is missed. Make writes idempotent, for example with an idempotency key made of the worker's name and version, the event id and the item's index. An event a rehome moved into the feed's view after the cursor had passed its position is served as an event item where the rehome's item would be. A cancelled event (POST /v1/lifecycle/memory-event/{id}/cancel) is no longer served, and its cancel is no item.
What an erasure item names. An erased, expired or redacted item names its events only by hash, in event_id_hashes, one per event; it never carries event_ids, whoever reads it. A hash is the lowercase hex of BLAKE3 over the bytes cortexdb/feed/erased-id/v1 followed by the event id's 16 UUID bytes in order (evt_0196f2a0c1d27b3e9a4f5d6c7b8a9e02 hashes to 284c5e5cb197e678093a790ca6ccf3d7ec1822b71b811b3d42672d49e4fca18e). Hash the ids you hold and delete those that match. An erased event's row is gone, and CortexDB keeps neither its scope nor what the delivery gate would decide of it, so no id is named; the hash of an id you were never served tells neither that the event existed nor when. Every erasure of the feed's root reaches the feed, one beside the feed's scope too. An erased item's scope is the erasure's when the feed serves that scope to this reader or it lies above the feed's scope (a prefix of ?scope=), else the nearest scope above both, a prefix of ?scope= too: it never names a path you may not read and did not send, not a sibling's nor a private region's (§8.8.7). A whole-scope erasure's tombstone is named where it reaches what the feed serves. The ids of rehomed items and of a sealed gap are each checked at their own scope, as the event would be, and by the delivery gate. A notice may over-report; it never under-reports.
The cursor is opaque base64url: clients must not parse it. next_cursor is always given (the feed never ends); has_more says whether the log held more than the page reached. A cursor is bound to its root and its consumer, and is refused with 422 FEED_CURSOR_INVALID and details.reason: malformed (it does not decode), version (a version this server does not read), root (another root's cursor) or consumer (issued for another consumer, or for a consumer when the request names none, or the reverse). A fresh cursor's erasures start where the feed's stand when its first page is read: an erasure before then removed what no page can serve.
Surviving a scope move. A move (cortexdb admin scope move) gives the root's rows new positions on the new shard and keeps their ids and their order. A page whose cursor names an older placement of the root re-anchors and starts with a gap item (re_anchored): its events start after the cursor's last delivered event, or, that event erased since, an hour before that event id's time, and its erasures at the move's import, whose summary of the root's erasures it delivers again. Some items come again; none is missed.
Sealed events. With the segment store on, the archiver seals old events out of the log (§8.15.6), and the feed reads the log: an event sealed before the cursor reached it is not an event item, but its seal's gap item (sealed) names it, and GET /v1/events/{id}?scope= serves it from its segment.
Consumers. On a shard armed for format 11 a request that names a consumer records the consumer's mark of the root before its page is served, and answers consumer_recorded: true. The mark is one replicated record per root and consumer: who read last (principal), the scope its reads cover (widened to the nearest scope above both when the consumer reads another scope of the root), and how far its pages may have reached, which the leader moves at most 10,000 positions past the page it serves. A page inside that headroom writes nothing, and a mark no page wrote for a day is written again, since a mark no page has read for 90 days is purged. A scope move carries the marks. An erasure's receipt and GET /v1/erasures/{id}/verify then name in feed_consumers every consumer whose mark had passed an event the erasure took, with how many and those events' hashes, as this feed's erasure items name them (§8.6.8): the list may over-report (a mark of an earlier placement of the root passes every event of its scope), and never under-reports. A page is refused with 503 EVENT_LIST_UNAVAILABLE (retriable: send the same cursor) when its consumer's mark did not commit, or when an erasure committed after the page was read took one of its events. At format 10 nothing is recorded: consumer_recorded is false, and no receipt names a consumer. GET /v1/derivation/feed/consumers (§8.7.28) lists the consumers whose marks reach a scope.
Format and the license. The route needs apply format 10 (503 FORMAT_UPGRADE_PENDING on a shard armed below it); consumer marks need 11. The feed is served after the license lapses, as POST /v1/export is (§8.12.1).
Errors: 400 INVALID_QUERY; 403 POLICY_DENIED (every refusal of the read rule, and a page whose events the caller may no longer read when it is sent); 422 INVALID_SCOPE_GRAMMAR, FEED_CURSOR_INVALID, VIEW_NOT_ALLOWED_AT_SCOPE; 500 INTERNAL_ERROR (retriable; the source log failed); 503 FORMAT_UPGRADE_PENDING (only members_behind is retriable), AUTHORIZATION_STATE_CHANGED (retriable), EVENT_LIST_UNAVAILABLE (retriable: keep the cursor), SCOPE_STORAGE_UNAVAILABLE (retriable); the storage-lane failures of §8.7.1. Break-glass (§8.15.3): class stored_rows, as GET /v1/events. On a cluster the ingress routes the request by ?scope='s root to its leader, which confirms its leadership before it reads (422 SCOPE_REQUIRED without one).
8.7.24 Corrections (corrections_v1, new in 0.15.0)
Capability: POST: Writer at the scope with scope.write. GET: scope.read.local and Reader on the scope. DELETE: the correction's author, an Owner of its scope, or the trusted operator. Every route needs a shard armed for format 11 (503 FORMAT_UPGRADE_PENDING below it, with the shard's reason; only members_behind is retriable). Experimental: responses carry X-Cortex-Stability: experimental.
A correction rejects, replaces, pins or confirms a claim: the subject, the canonical predicate, the value and the polarity, keyed as the fact store keys them. It never names a fact id, because re-derivation mints new ones; a request may name a fact, which the server resolves to its claim. The correction is a replicated record (kind correction), which every replica applies, a move carries, and erasure, receipts and /verify reach.
POST /v1/corrections
{"scope": "org:acme/app:companion/user:bob", "idempotency_key": "bob-fix-17",
"action": "reject", "target": {"fact_id": "fact_0196a1b2c3d47e8f9a0b1c2d3e4f5a6b"},
"bind": "claim", "reason": "I never lived in Boston"}
POST /v1/corrections
{"scope": "org:acme/app:companion/user:bob", "idempotency_key": "bob-fix-18",
"action": "replace",
"target": {"claim": {"subject": "user", "predicate": "lives_in", "object": "Boston"}},
"value": {"object": "Denver", "valid_from": "2026-03-01"}}
201
{"correction_id": "cor_0196f3b0c1d27b3e9a4f5d6c7b8a9e02", "action": "replace",
"scope": "org:acme/app:companion/user:bob",
"claim": {"subject": "user", "predicate": "lives_in", "object": "Boston"},
"replacement": {"event_id": "evt_0196f3b0c1d27b3e9a4f5d6c7b8a9e03",
"fact_id": "fact_0196f3b0c1d27b3e9a4f5d6c7b8a9e04",
"claim": {"subject": "user", "predicate": "lives_in", "object": "Denver"}},
"effects": {"facts_deleted": 0, "facts_closed": 1, "pinned": true, "suppressed_sources": 1},
"state": "applied", "record_kept": true, "consistency_token": "ct1.eyJyIjoib3JnOmFjbWUifQ"}
The rejection of a typed triple's claim, whose only source is that triple's capture (below):
201
{"correction_id": "cor_0196f3b0c1d27b3e9a4f5d6c7b8a9e05", "action": "reject",
"scope": "org:acme/app:companion/user:bob",
"claim": {"subject": "Bob", "predicate": "plan", "object": "gold"},
"effects": {"facts_deleted": 0, "facts_closed": 0, "pinned": false, "suppressed_sources": 0,
"triple_events_erased": 1, "events_erased": 1,
"erasure_id": "erasure_0196f3b0c1d27b3e9a4f5d6c7b8a9e06"},
"state": "applied", "record_kept": false, "consistency_token": "ct1.eyJyIjoib3JnOmFjbWUifQ"}
record_kept says whether the shard keeps the correction's record: GET /v1/corrections/{id} reads it, and
DELETE undoes it, only while it is true. Both answers carry a consistency_token (§6.11) covering the log up
to its next offset, the correction (and its replacement or erasure) included, and the correction's record. The node
answers once it has applied the correction itself, so a read it serves next sees it; a read that demands the token
(at_least) waits until the node serving it has applied the correction too (its declared tail, §6.11), a new leader
after a failover included (408 WAIT_TIMEOUT, details.waiting_on: "declared", past the wait).
| Field | Notes |
|---|---|
scope | Required. The scope the correction governs: it covers the facts at that scope and below it |
idempotency_key | Optional, 1 to 256 bytes. The correction's id derives from the scope's root, the caller and this key, so a retry finds its first attempt (200, replayed: true), and the same key with another body is 409 IDEMPOTENCY_CONFLICT. Without one every request makes a new correction |
action | Required: reject, replace, pin or confirm |
target | Required: exactly one of fact_id (fact_<uuid>, a fact at or under the scope) and claim ({subject, predicate, object, negated?}; an empty predicate names a sentence fact) |
bind | A reject's binding, claim when absent; any other action takes claim only (422 INVALID_BODY) |
value | Required for replace and refused otherwise: {object, valid_from?}, valid_from an absolute date |
valid | A confirm's window {from?, to?}, bounded on at least one side |
reason | Optional, at most 512 bytes. Personal data: erased with the record |
subject_principal | Optional: the principal the claim is about (user:bob). A person's erasure erases the corrections about them (§8.6) |
| Action | What every replica does |
|---|---|
reject | Deletes the facts its binding covers through the erasure path, with their search rows, vectors, gloss rows, concepts, builder beliefs, tenant-profile copies and bitemporal records, and leaves a suppression: no re-enrichment, re-derivation or replay of a covered event stores a matching candidate again. claim covers the events the correction cites and every event captured at or before it, so a later event may state the claim again and is learned (new evidence); subject_predicate covers every value of the subject and predicate, past and future; subject everything about the subject. A typed triple is a customer statement no suppression stops: a reject of one erases its event by id, with a receipt, before the correction is recorded (below) |
replace | Captures the new value as a typed triple of the caller, labelled correction:<id> and stamped derived_by: cortexdb:correction@1 (§3.5.3), then closes the old claim's facts (each superseded by the new fact, at its validity start, kept in /v1/facts/timeline), pins the new claim and suppresses the old one. A fact of the old claim learned later (a re-enrichment, a replica or move target learning the event afterwards) is stored and closed the same way, so every replica keeps the same history |
pin | No extracted fact supersedes a fact of the claim: a contradicting extracted value stays live beside it, and each such contest opens a value conflict in /v1/conflicts (§8.7.21) whose id derives from the two facts, the same on every replica. A typed triple, and a replacement, still supersede it, as explicit statements |
confirm | Raises the claim's authority: a belief whose claim is the confirmed value reads supported, not contradicted (as does one whose claim is a pinned value). It blocks nothing |
Rejecting a typed triple. A typed triple's fact rests on a captured customer statement, which the indexer would state again from its row, so no suppression stops it. A reject whose binding covers such facts first erases their events by id, as an erasure job of its own run as POST /v1/erasures runs a selective one (§8.6): its gdpr audit row (endpoint POST /v1/corrections, capability scope.write: the correction's own authorization, a Writer of the events' scopes, not forget.gdpr), its receipt and its erasure_complete lifecycle row. effects.events_erased counts the events it deleted (a legal hold keeps the others, as a pending held erasure; triple_events_erased is the same count under the name it had first) and effects.erasure_id names the job: GET /v1/erasures/{id}, /receipt and /verify answer for it. The correction is recorded after: when that erasure took every event it would cite (a claim stated only by typed triples, under the default claim binding), the shard keeps no record (a correction is erased with the last event it cites, §8.6), and the answer says record_kept: false with suppressed_sources: 0. GET /v1/corrections/{id} then answers 404, there is nothing to undo, and the trail is the correction's audit row (action: "correction") with the erasure's gdpr row and receipt. A refusal of the correction after that erasure names it, details.erasure_id: the statements are erased whatever the correction's outcome. An erasure that fails answers its own refusal (502 ERASURE_BACKEND_FAILED, or the shard's 503 code, with its audit_id) and records no correction. The same request sent again plans what is left: after a record-less rejection its claim names no live fact (422 CORRECTION_TARGET_UNKNOWN, or 404 NOT_FOUND for a fact_id).
Every change re-resolves the topics it touches in arrival order under the pins in force, rebuilds their belief topics at once, and moves the read-visibility fence, so no cached pack or answer serves the old state. Errors: 403 POLICY_DENIED; 404 NOT_FOUND (a fact_id the caller may not read or that does not exist under the scope); 409 CORRECTION_CONFLICT (an open correction of the same claim and action, or a pin and a reject of one claim; details.existing), IDEMPOTENCY_CONFLICT, PROVENANCE_ERASED (an event it cites was erased while it ran), WRITER_NOT_ALLOWED (a replace of a predicate whose derivation policy's writers leave out correction, or whose requires the replacement does not meet: §8.32, "Writer rules"; nothing is written; details: {predicate, writers, requires}); 422 INVALID_BODY (details.field), CORRECTION_TARGET_UNKNOWN (no live fact in the scope states the claim, for reject, pin and confirm: a replace of an unknown claim is a plain declared write; always details.claim, the claim as stated or as the named fact states it), INVALID_SCOPE_GRAMMAR; 503 FORMAT_UPGRADE_PENDING, WAL_OUTCOME_UNKNOWN (a replace whose capture committed and whose correction did not: retry with the same key, details.correction_id), and the storage-lane failures of §8.7.1.
Erasure. A correction's sources are the source events of the facts it changed, sorted and unique, at most 1,024; it cites them all of. When its suppression later meets a candidate of an event it does not cite (an event captured before it, learned after it), the shard's leader adds that event, so sources can grow. Erasing one of several leaves it (without it the wrong fact would come back from the others); erasing the last erases it in the same batch, and the erasure's receipt lists it. A scope tombstone at or above its scope, a person's erasure of its subject_principal, its undo and the tenant's deletion erase it too. A subject_predicate or subject binding cites no events: it is erased only with its scope, by undo, or with the tenant.
A new correction writes an audit row (action: "correction", event_id its id, gdpr: true, the peppered hash of the answer, never its words; §14), and its undo another (action: "correction_undo"); a retry that finds its first attempt writes none.
The license. A rejection is a deletion: a person's request to stop remembering never depends on the license. On a build that enforces licenses, a reject of any binding (subject_predicate and subject included) is served after the license and its grace period have ended, as POST /v1/forget and POST /v1/erasures are. The license gate reads no body, so it lets every POST /v1/corrections through, and the route answers every other action (replace, pin, confirm) with the gate's own 402 LICENSE_EXPIRED (LICENSE_REQUIRED when there never was a license), after authentication and before anything else is checked. An undo (DELETE /v1/corrections/{id}), which brings back what a rejection deleted, and the reads (GET /v1/corrections, /v1/corrections/{id}, GET /v1/memory/about) answer the gate's 402 until a license is installed.
GET /v1/corrections?scope=&action=&origin=&subject=&predicate=&cursor=&limit= lists the corrections governing exactly scope, in id order (limit 1 to 200, default 50; cursor the previous page's last correction_id), and GET /v1/corrections/{id}?scope= reads one, with the facts it changed as they were (snapshot, no embeddings). A correction holds its claim, so it is served to a reader of its scope whose chain may read the events it cites; any other answers the same 404 as an unknown id.
{"items": [{"correction_id": "cor_0196f3b0c1d27b3e9a4f5d6c7b8a9e01", "action": "reject", "bind": "claim",
"scope": "org:acme/app:companion/user:bob",
"claim": {"subject": "user", "predicate": "lives_in", "object": "Boston"},
"origin": "user", "by": "user:bob", "at": "2026-11-07T10:02:11Z",
"reason": "I never lived in Boston", "sources": 3, "sources_remaining": 3, "state": "active"}],
"next_cursor": null, "has_more": false}
DELETE /v1/corrections/{id}?scope= undoes a correction. A replace's triple event is erased first; then every replica reverses what the correction did (what it deleted comes back under its own id, unless another correction covers it or its events are gone; what it closed reopens; its pin goes; its topics are re-resolved), and the record is erased, which starts the log residual's cycle. Another caller is answered 404, as for a correction that does not exist.
A candidate the gate dropped under the correction before it was learned (at extraction, or when the extraction finished after the correction was made) is in no learned record, so the reversal cannot bring it back. The undo re-extracts each event the correction cites whose recorded outcome names its suppression (suppression.<correction id> among rejected in GET /v1/derivation/decisions) instead: asynchronously, through the extraction scanner, under the daily extraction budget (a spent budget defers it to the next UTC midnight, as any extraction), with no approval and no cap of its own. effects.events_reextracting counts the events queued, and the outcome journal shows each result once it lands; the result replaces what the event's earlier extraction derived. A subject_predicate or subject binding cites no events: its undo finds them by reading the outcomes recorded under its scope instead, for up to 10 seconds in the request (reextract_scan: "complete"), the rest in the background ("running": the counts are what the request found, and the server log line CORRECTION_UNDO_REEXTRACT has each later pass's). One undo queues at most 20,000 events; effects.events_not_queued counts the rest, which a reextract job (§8.32.7) restores.
{"correction_id": "cor_0196f3b0c1d27b3e9a4f5d6c7b8a9e02", "state": "undone",
"effects": {"facts_restored": 1, "unpinned": true, "replacement_event_erased": true,
"events_reextracting": 0, "events_not_queued": 0, "reextract_scan": "complete"}}
What a correction can and cannot do, stated plainly: a replace closes only extracted facts of the old claim (effects.facts_closed), never a typed triple's, which no correction rewrites: where a typed triple stated the old value, the replacement's own triple supersedes it as any later triple of a single-valued predicate does, so a valid_from before the old statement's time leaves the old value current, and on a multi-valued predicate both stay current (reject the old statement instead, which erases its event); it matches a sentence fact by its text fold, so a paraphrase of a rejected sentence can come back (bind subject_predicate, or replace the value with a triple, instead); an undo on a replica that never applied the correction (a fresh replica, a move target) restores nothing there; and an event captured before the correction, not yet extracted and never cited by it, can bring the claim back once every cited event is erased.
8.7.25 GET /v1/memory/about (corrections_v1, new in 0.15.0)
Capability: scope.read.local and Reader on the scope, designed for the end user's own token. Needs a shard armed for format 10; include=corrections lists corrections from format 11. Experimental.
What is known about the scope's subject: its current facts and its beliefs at exactly the scope, each with its sources. An item any of whose sources the reader may not read is left out and not counted, so the route doubles as the per-subject export for access and portability requests. A read-time use rule (§8.32.5) never applies here: the subject's own access to what is known about it stays whole, as it does on the event, fact and belief listings.
GET /v1/memory/about?scope=org:acme/app:companion/user:bob&include=corrections&limit=100
200
{"items": [{"kind": "fact", "id": "fact_0196f3b0c1d27b3e9a4f5d6c7b8a9e04", "statement": "user | lives_in | Denver",
"valid_from": "2026-03-01T00:00:00Z",
"sources": [{"event_id": "evt_0196f3b0c1d27b3e9a4f5d6c7b8a9e03", "snippet": "user lives_in Denver",
"observed_at": "2026-03-01T00:00:00Z"}],
"pinned": true}],
"corrections": [{"correction_id": "cor_0196f3b0c1d27b3e9a4f5d6c7b8a9e02", "action": "replace",
"claim": {"subject": "user", "predicate": "lives_in", "object": "Boston"}, "at": "2026-11-07T10:02:11Z"}],
"counts": {"facts": 1, "beliefs": 0}, "next_cursor": null}
include takes corrections and held (derivation_review_v1: the scope's open candidates held for review, §8.7.27, as items of kind: "held" with their id and held_id (both hld_…, what §8.7.27's decisions name them by), statement, rule, lapse_at and source, and counts.held; from format 11); any other value is 400 INVALID_QUERY. limit is 1 to 500 (default 100); cursor is the previous page's last item id. Errors: 400 INVALID_QUERY; 403 POLICY_DENIED; 422 INVALID_SCOPE_GRAMMAR; 503 FORMAT_UPGRADE_PENDING below format 10; the storage-lane failures of §8.7.1.
8.7.26 POST /v1/episodes and DELETE /v1/episodes/{id} (declared_episodes_v1, new in 0.15.0)
Capability: scope.write and Writer on the scope's roster (the trusted operator, the static CORTEX_API_KEY or an auth-disabled server, skips the roster), as POST /v1/beliefs. Experimental: responses carry X-Cortex-Stability: experimental.
An episode a worker defines over events it read (a call, a session, a case), stored as a replicated record that every replica serves beside the built episodes (§7.2) with "declared": true, which a scope move carries, and which no rebuild or seal touches. It is erased with any event it names, on every replica.
POST /v1/episodes
{"scope": "org:acme/team:support", "name": "Checkout outage call", "summary": "The checkout service failed for an hour.",
"events": ["evt_0196f2a0c1d27b3e9a4f5d6c7b8a9e02", "evt_0196f2a0c1d27b3e9a4f5d6c7b8a9e03"],
"started_at": "2026-11-08T09:00:00Z", "ended_at": "2026-11-08T10:00:00Z",
"derived_by": {"name": "acme-sessionizer", "version": "2.1.0"}, "idempotency_key": "outage-0196"}
201 {"id": "ep_0196f2a1…", "scope": "org:acme/team:support", "name": "Checkout outage call", "…": "…",
"declared": true, "derived_by": {"name": "acme-sessionizer", "version": "2.1.0"}}
DELETE /v1/episodes/ep_0196f2a1…?scope=org:acme/team:support
200 {"deleted": true}
| Field | Notes |
|---|---|
scope | Required. The episode's scope; its root routes the request on a cluster |
events | Required. 1 to 1,024 event ids, none twice, in the episode's order. Each must be in the scope's root and readable by the caller where it lies (its scope by the read rule, its atoms by the delivery gate, not cancelled): one that is not, or that the server does not hold, is 422 PROVENANCE_UNKNOWN; one erased or redacted is 409 PROVENANCE_ERASED |
name | At most 256 bytes, not blank |
summary | At most 4 KiB, not blank. Embedded once, by the node that takes the request; every replica keeps that embedding |
started_at, ended_at | RFC 3339; default to the first and the last of the events' times (an event's context.observed_at, else the time its id was minted at). ended_at before started_at is 422 INVALID_BODY |
actors_involved | At most 64 actor ids |
derived_by | The write-back stamp (§3.5.3, derived_by_v1), a field of the record, served on every read of the episode |
idempotency_key | 1 to 256 bytes. The same caller, billing tenant, requested scope and key name one episode: a retry answers the first attempt's episode (201), and the same key with another name, summary, events, times, actors or stamp is 409 IDEMPOTENCY_CONFLICT. Without a key every declaration is a new episode |
The body takes nothing else (422 INVALID_BODY). The episode's id is ep_ and its record's UUID. The principal chain's write rules apply: a non-human write is planned as a capture is, with its events as its declared provenance (its atoms, and a redirect to its writer's private space, whose scope the answer names in redirected_to). summary_embedding is never returned here (GET /v1/episodes with include_vectors=true reads it).
DELETE /v1/episodes/{id}?scope= erases the declared episode at ?scope= (an erasure of its record: every replica drops its view, and the log residual's cycle takes its bytes) and answers {"deleted": true}. A built episode is the builder's, and answers 404 NOT_FOUND, as does a declared episode at another scope, or none.
The license. The erasure is served after the license and its grace period have ended, as POST /v1/erasures is (since 0.15.0): deleting data never depends on the license. POST /v1/episodes answers the gate's 402 until a license is installed.
Format. Both routes need apply format 11: below it they answer 503 FORMAT_UPGRADE_PENDING with details {reason, format: 11, node, paths, count, scope} (only members_behind is retriable).
Errors (POST): 403 POLICY_DENIED, RUN_REQUIRED, ATOMS_REDIRECT_REFUSED, BREAK_GLASS_REQUIRED (class D-write); 409 PROVENANCE_ERASED, IDEMPOTENCY_CONFLICT, AUTHORIZATION_STATE_CHANGED (retriable); 422 INVALID_SCOPE_GRAMMAR, INVALID_BODY (details.field), PROVENANCE_UNKNOWN, CROSS_ROOT_PROVENANCE, DERIVED_BY_INVALID; 503 FORMAT_UPGRADE_PENDING, DISK_FULL (a declared episode adds data), WAL_OUTCOME_UNKNOWN (retry with the same idempotency_key), STORAGE_UNAVAILABLE, and the provider-lane failures. DELETE: 403 POLICY_DENIED; 404 NOT_FOUND; 409 AUTHORIZATION_STATE_CHANGED; 422 INVALID_SCOPE_GRAMMAR; 503 FORMAT_UPGRADE_PENDING, WAL_OUTCOME_UNKNOWN (a retry finds it gone, 404, or erases it), STORAGE_UNAVAILABLE, and the storage-lane failures. On a cluster the ingress routes POST by the body's scope root and DELETE by ?scope='s root, to the root's leader (422 SCOPE_REQUIRED without one).
8.7.27 Review before commit (derivation_review_v1, new in 0.15.0)
Capability: a reviewer of the scope: a Writer of the scope, or a principal (or a member of a set of the tenant) that the scope's effective derivation policy names in review.reviewers (§8.32), with Reader on the scope. Reading the queue needs scope.read.local; deciding needs scope.write. Both routes need a shard armed for format 11 (503 FORMAT_UPGRADE_PENDING below it, with the shard's reason; only members_behind is retriable). Experimental: responses carry X-Cortex-Stability: experimental.
A derivation policy can hold a candidate for review instead of storing it (review.hold by topic or predicate, mode: review, a writer rule's refusal with refused_writers, a confidence below confidence_below). A held candidate is a replicated record (kind held) in no store and no index: no recall, answer, fact or belief read sees it until a reviewer approves it. Each new one is announced on the lifecycle stream as derivation_held (§13), with its ids, its rule and its topic, never its words.
GET /v1/review?scope=org:acme/clinic:north&state=open&topic=health&limit=20
200
{"items": [{"held_id": "hld_0196f2a1c3d47e8f9a0b1c2d3e4f5a6b", "event_id": "evt_0196f2a0c1d27b3e9a4f5d6c7b8a9e02",
"scope": "org:acme/clinic:north",
"candidate": {"kind": "triple", "subject": "patient", "predicate": "has_condition", "object": "asthma",
"quote": "my asthma flared up", "topic": "health", "confidence": 1},
"rule": "review.topic.health", "policy_hash": "dp1:4be1c0d2e3f405162738495a6b7c8d9e",
"held_at": "2026-11-07T10:05:00Z", "lapse_at": "2026-12-07T10:05:00Z",
"source": {"snippet": "…my asthma flared up again last night…", "observed_at": "2026-11-07T10:04:51Z"}}],
"open": 14, "next_cursor": "1762509900000000:hld_0196f2a1c3d47e8f9a0b1c2d3e4f5a6b", "has_more": true}
GET /v1/review?scope= lists the open candidates held at exactly scope, oldest first; descend=true adds those of the descendants the caller may read with scope.read.descend. Filters: state (open, the default and the only state listed), topic (the candidate's topic label), rule (an exact rule id), cursor (the previous page's next_cursor) and limit (1 to 200, default 50). An item is served to a reader whose chain may read its event, as a derived row is; any other is left out and not counted. open counts every item the filters select, past the page. source is the event's snippet around the candidate's quote (about 100 characters each side) and its observation time, or null when the event is no longer here to quote (sealed or expired since). Errors: 400 INVALID_QUERY; 403 POLICY_DENIED; 422 INVALID_SCOPE_GRAMMAR; 503 FORMAT_UPGRADE_PENDING, AUTHORIZATION_STATE_CHANGED (retriable); the storage-lane failures of §8.7.1.
POST /v1/review/decisions
{"scope": "org:acme/clinic:north",
"decisions": [{"held_id": "hld_0196f2a1c3d47e8f9a0b1c2d3e4f5a6b", "decision": "approve", "reason": "confirmed with patient"},
{"held_id": "hld_0197a2b3c4d5e6f708192a3b4c5d6e7f", "decision": "reject", "bind": "subject_predicate"}]}
200
{"results": [{"held_id": "hld_0196f2a1c3d47e8f9a0b1c2d3e4f5a6b", "decision": "approved",
"decision_id": "dec_0196f3b0c1d27b3e9a4f5d6c7b8a9e05", "fact_id": "fact_0196f3b0c1d27b3e9a4f5d6c7b8a9e06"},
{"held_id": "hld_0197a2b3c4d5e6f708192a3b4c5d6e7f", "decision": "rejected",
"decision_id": "dec_0196f3b0c1d27b3e9a4f5d6c7b8a9e07", "correction_id": "cor_0196f3b0c1d27b3e9a4f5d6c7b8a9e08"}]}
A request carries 1 to 100 decisions, and each is independent: one refusal never stops the others, and each result answers its own. Each decision is one replicated entry:
| Decision | What happens |
|---|---|
approve | The decision is written and the candidate becomes a fact: on a cluster the shard's leader proposes one learned record of its event that carries only that candidate, which every replica applies; on a single node the same apply runs locally. The fact's id derives from the decision, so fact_id names it before every replica holds it, and it is stamped review.approved.<decision id> under include=derivation (§7.4.3). It is recallable from then on, and beliefs build from it. Approval works from the held record, not from the raw text, so it still works after the event was sealed (§8.15.6) or expired under keep_learned (§8.15.1). When the fact cannot be made at once (the embedder or the shard failed after the decision committed) the result says pending: true, and the leader's review sweep finishes it |
reject | The held candidate is erased, the decision written, and a correction (§8.7.24; action: reject, effect: delete, origin: review, listed by GET /v1/corrections?origin=review) keeps its claim suppressed: no re-enrichment, re-derivation or replay stores it again. bind is claim (the default: this claim, from this event and every event captured at or before the decision; the correction cites the event) or subject_predicate (every value of the subject and predicate, past and future; it cites none) |
A candidate nobody decides lapses review.lapse_days after it was held (1 to 90, default 30): the leader's review sweep, hourly, erases it and writes a decision lapsed by system:lapse, and it leaves the queue. A later re-extraction of an approved candidate's event that states its claim again accepts it under review.approved.<decision id> rather than holding it twice; a re-extraction of a rejected one is suppressed.
| Field | Notes |
|---|---|
scope | Required. The scope the reviewer decides at; every held record must lie at or under it, and one under it needs scope.read.descend there |
decisions[].held_id | Required: hld_ and 32 hex digits |
decisions[].decision | Required: approve or reject |
decisions[].bind | A rejection's binding, claim or subject_predicate; an approval takes none, and subject is refused (422 INVALID_BODY, details.field) |
decisions[].reason | Optional, at most 512 bytes. Personal data: erased with the decision |
A refused decision's result carries error_code, message, retriable and, for REVIEW_ITEM_DECIDED, details.decision_id: NOT_FOUND (no held candidate of that id the caller may see at or under the scope, a malformed id included), REVIEW_ITEM_DECIDED (decided before: approved, rejected, lapsed or regated), PROVENANCE_ERASED (its event was erased while the decision ran), or a storage lane's code (WAL_OUTCOME_UNKNOWN, WAL_UNAVAILABLE, NOT_LEADER, DISK_FULL, STORAGE_UNAVAILABLE: retriable; a retry answers REVIEW_ITEM_DECIDED when the first attempt committed). Every decision a reviewer makes writes an audit row (action: "review_decision", gdpr: true, the peppered hash of its result, never its words; §14).
Erasure. A held candidate and a decision each cite their event, so erasing the event erases both, on every replica, and GET /v1/erasures/{id}/verify's governed_records check counts any left; a rejection's correction is erased by the rules of §8.7.24. Errors (POST): 403 POLICY_DENIED, BREAK_GLASS_REQUIRED (class D-write); 409 AUTHORIZATION_STATE_CHANGED; 422 INVALID_BODY, INVALID_SCOPE_GRAMMAR; 503 FORMAT_UPGRADE_PENDING, STORAGE_UNWIRED, and the storage- and provider-lane failures. On a cluster the ingress routes GET by ?scope='s root and POST by the body scope's root, to the root's leader (422 SCOPE_REQUIRED without one).
8.7.28 GET /v1/derivation/feed/consumers (derivation_feed_v1, new in 0.15.0)
Capability: an Owner at the scope with derivation.administer.scope (or policy.administer.scope), or the trusted operator. Operator-plane class O (§8.15.3): the answer holds names, principals, scopes, positions and times, never a stored row. Experimental: responses carry X-Cortex-Stability: experimental.
The consumers of the change feed (§8.7.23) whose reads reach a scope, as their marks record them: who may hold a copy of the scope's events outside CortexDB, which is what an erasure's receipt names in feed_consumers (§8.6.8). The console's Derivation › Consumers tab reads it.
GET /v1/derivation/feed/consumers?scope=org:acme/app:tutor&limit=100
{"scope": "org:acme/app:tutor", "consumer_recorded": true, "format_armed": 11,
"consumers": [{"consumer": "acme-level", "principal": "service:acme-worker",
"scope": "org:acme/app:tutor", "descend": true,
"delivered_through": {"event_id": "evt_0196f2a0c1d27b3e9a4f5d6c7b8a9e03", "at": "2026-11-08T09:12:00Z"},
"mark": {"epoch": 0, "events_pos": 10412, "feed_pos": 10007}, "epoch_current": true,
"last_read_at": "2026-11-08T09:12:00Z", "idle": false, "purges_at": "2027-02-06T09:12:00Z"}],
"next_cursor": null}
| Parameter | Notes |
|---|---|
scope | Required. The scope whose consumers are listed: every mark of its root whose scope lies at or under it, or above it with descend (a consumer whose reads cover it). At the root, every consumer of the root |
limit | 1 to 1,000 consumers (default 100); anything else is 400 INVALID_QUERY |
cursor | The previous page's next_cursor: the consumer name it ended with. Consumers are listed by name |
The route takes nothing else (another parameter is 400 INVALID_QUERY).
| Field | Notes |
|---|---|
consumer, principal | The consumer's name, and the reader of its last recorded page |
scope, descend | The scope its reads cover (with descend, its subtree), widened to the nearest scope above both when it read another scope of the root |
delivered_through | The last event a recorded page delivered, and when that page was served; null before a page delivered one |
mark | How far its pages may have reached on one placement of the root (epoch, events_pos, feed_pos), up to 10,000 positions past what was delivered. An erasure's receipt names the consumer for every erased event at or below it |
epoch_current | false after a scope move, until the consumer's next page re-anchors the mark; a receipt then names the consumer for every erased event its scope covers |
last_read_at | The mark's last write. A page inside the mark's headroom is recorded at most once a day, so this is within a day of the consumer's last read |
idle | No read recorded for 7 days |
purges_at | When the leader's sweep purges the mark unless a page is read before: 90 days after its record was last written. A receipt names no consumer whose mark was purged |
The list has no count of the erasure notices since a consumer's last read. The server keeps no consumer's delivered position: the mark runs ahead of delivery, and a page inside its headroom is recorded at most once a day, so such a count would be neither exact nor cheap.
Format. Marks exist from format 11. Below it the route answers an empty consumers list, consumer_recorded: false and the shard's format_armed, as the feed itself answers consumer_recorded: false there.
Errors: 400 INVALID_QUERY; 403 POLICY_DENIED; 422 INVALID_SCOPE_GRAMMAR; 500 INTERNAL_ERROR (retriable); 503 STORAGE_UNAVAILABLE (retriable: the marks or the root's placement did not read). On a cluster the ingress routes the request by ?scope='s root to its leader, which confirms its leadership before it reads (422 SCOPE_REQUIRED without one); a scope move carries the marks with the root.
8.8 Scopes
The registry routes of this section read and write version 1's record fields: POST, GET and
DELETE /v1/scopes, GET /v1/scopes/list, PUT /v1/scopes/members and PUT /v1/scopes/tree. A call on a
record that holds version-2 fields keeps every one it does not name (IDENTITY_AND_API_CONTRACT.md §5.8.5).
They are operator-plane routes of class O (§8.15.3): their reads are served to the operator key in every
mode, and the writes each route names below are in-band paths under deny. On a cluster the ingress routes
each by its path's root (?path=, or the body's path for a registration) to that root's leader, but
GET /v1/scopes/list, which a cluster ingress does not route (501 CLUSTER_ROUTE_UNSUPPORTED). Since 0.14.0 a
change the shard did not take there answers the shard's own code and retriable, on every registry route:
503 SCOPE_MOVING (details.roots, details.refusal), REGISTRY_STALE, NOT_LEADER,
WAL_UNAVAILABLE and WAL_OUTCOME_UNKNOWN, all retriable; 409 REGISTRY_NOT_REPLICATED (a shard bound before RF3
T10); 413 WAL_TOO_LARGE; 503 FORMAT_UPGRADE_PENDING with what holds the shard; and any other apply refusal
503 with its own code and retriable (BIND_MISMATCH and REGISTRY_ENTRIES_MALFORMED are not retriable).
503 SCOPE_STORAGE_UNAVAILABLE is then a registry the node cannot read,
and 503 WAL_OUTCOME_UNKNOWN a change whose outcome is unknown (it may have committed: read the record before writing it again; it was SCOPE_MUTATION_UNKNOWN before 0.14.0), both retriable since 0.14.0, as
are 409 SCOPE_STATE_CHANGED, AUTHORIZATION_STATE_CHANGED and ACTIVITY_CHANGED on these routes (the state moved
under the request). (0.13.x answered a change the shard refused SCOPE_STORAGE_UNAVAILABLE, or
SCOPE_MUTATION_UNKNOWN for an unknown outcome, and every registry refusal with retriable: false.)
A brand-new registration by a token another principal minted also runs the minter link since 0.14.0: the minter must
hold the registration's capabilities and be an Owner of the record that governs the path, none where no record governs it (403 POLICY_DENIED,
details.link: "minter"; with CORTEX_MINTER_LINK_ENFORCE=off it is counted instead).
Consistency tokens (consistency_tokens_v1, §6.11). ?consistency=1 (or true, in any case) on POST /v1/scopes,
PUT /v1/scopes/members and PUT /v1/scopes/tree adds a consistency_token at the end of the success body,
at the path's root, covering the change; 0, false or no value asks for none, and any other value is
400 INVALID_QUERY. On POST /v1/scopes a ?path= or ?scope= under another root than the body's path is
403 POLICY_DENIED, details.reason: "token_root_not_written", before the write runs. DELETE /v1/scopes checks the parameter too, but its 204 has no body and carries no
token. ?at_least=<token> on GET /v1/scopes (at ?path='s root) and on GET /v1/scopes/list (at the
token's own root) first waits, before the read is authorized, until this node has reached the token, within
CORTEX_CONSISTENCY_WAIT_MS (default 10,000 ms, at most 30,000): past it 408 WAIT_TIMEOUT
(details.waiting_on registry, indexer or declared, details.waited_ms, retriable). A token that does not decode,
names another root or names what this server never committed is 422 CONSISTENCY_TOKEN_INVALID
(details.reason malformed, other_root or ahead_of_commit); one of another incarnation or epoch is
ignored and the response says consistency_reset: true (with access_restored_at for a token issued before
a restore of the root). The 200 then carries consistency_token (and consistency_reset,
derived_through) after its own fields. A demanded token whose state does not read is 503 WAL_UNAVAILABLE (retriable); a
token this node cannot issue after a change committed leaves the success body as it is, with no token.
Error bodies. retriable is each code's own (0.14.0; before, every registry refusal said false):
true for 409 SCOPE_STATE_CHANGED, AUTHORIZATION_STATE_CHANGED and ACTIVITY_CHANGED (the state moved
under the request: send it again), for 503 WAL_OUTCOME_UNKNOWN and SCOPE_STORAGE_UNAVAILABLE (the
registry did not answer), and the shard's codes by their own flag (above); false for a decision about the
caller or a body the caller must change. Storage the registry cannot write as it is configured is 500 SCOPE_STORAGE_MISCONFIGURED, not retriable, with what the operator must fix in details.reason:
invalid_persistence (the stored state is invalid or incompatible), at_capacity, unsupported_platform or
durable_guard_required (since 0.14.0; each was 503 SCOPE_STORAGE_UNAVAILABLE).
8.8.1 POST /v1/scopes — Register
Capabilities: policy.administer.scope and scope.create.<leaf_type> for the path being created. scope.create.global is additionally required below a global:* root, scope.create.custom when the path contains a deployment-defined custom type (an org tree's group: and aud: segments take scope.create.group and scope.create.aud instead, since 0.13.0), and scope.create.cross_tenant for a foreign org:* root. A standalone ws:* root uses scope.create.ws; it does not require scope.create.cross_tenant because ownership is established by the new scope's ACL.
Each is checked at the path. A leaf of a type the server does not name takes scope.create.custom;
version 2's source and container leaves take scope.create.source and scope.create.container, or
scope.create.custom as before version 2 named them, and a system: leaf scope.create.system. The trusted
operator owns every root, so it never needs scope.create.cross_tenant, but the deployment policy applies to
it as to any credential (cloud_shared_saas denies scope.create.custom, .global and .cross_tenant).
Since 0.14.0 a token that carries scopes needs each capability named by an entry (total confinement, §4.7).
A refusal is 403 POLICY_DENIED, its message naming the capability and the tier that denied it. Every
segment's type must be in defaults.allowed_scope_types (§5.5.2), the leaf never a record-only type (set,
hold, policy, attrs), and on an armed node no segment of a reserved type (attrs, orgtree, holds,
access, self); else 422 UNREGISTERED_SCOPE_TYPE.
{
"path": "ws:acme-q3-launch",
"members": [
{"actor": "user:alice", "role": "owner"},
{"actor": "agent:planner_v3", "role": "writer"},
{"actor": "agent:summarizer", "role": "reader"}
],
"policies": {
"consolidation": "merge_compatible_beliefs",
"conflict_resolution": "latest_wins_within_confidence_band",
"inherit_from": [],
"audit": "full",
"children": {"auto_register": true}
}
}
In v0.9.10, policies.inherit_from is accepted and persisted as reserved
metadata, but recall does not consult it. It does not widen traversal or grant
access. Use a hierarchical scope path or issue separate authorized recalls
until server-side inheritance is implemented.
Response: 201 Created with the canonical scope record. The response
includes a server-derived billing_tenant (taken from the authenticated token
audience); clients do not choose this value:
{
"path": "ws:acme-q3-launch",
"billing_tenant": "acme",
"members": [{"actor": "user:alice", "role": "owner"}],
"policies": {"children": {"auto_register": true}},
"auto_provisioned": false,
"created_at": "2026-09-04T12:00:00Z"
}
Scope paths remain globally unique registry keys. Every verified lookup,
write admission, export/read ACL check, member edit, and deletion validates
the persisted billing tenant in addition to actor membership. Thus the same
actor spelling in another token audience cannot claim or operate on an
existing standalone ws:* path.
If policies.children.auto_register is omitted, it defaults to true. Set it to false explicitly to require registration for new descendants; the nearest registered ancestor governs an otherwise-unregistered child.
For reads, the governing ACL is the exact registered scope when one exists, otherwise the nearest registered ancestor. An exact child registration overrides its ancestor's ACL. A path retains scratchpad-tier read behavior only when neither it nor any ancestor is registered.
The roster. members takes version 1's entries only, {actor, role} with role owner, writer
or reader; a set entry or the summary role is 422 INVALID_BODY. The caller is added as Owner when the
list does not name it, so members: [] registers the caller alone; a list that names the caller at a lower
role and names no Owner is 422 OWNERLESS_ROSTER. Since 0.14.0 a principal listed twice is refused by
default, 422 INVALID_BODY with details {field: "members", reason: "duplicate_member", actor}; with
CORTEX_DUPLICATE_MEMBER_ENFORCE=off it is stored and counted (check duplicate_member,
GET /v1/admin/access/report). Since 0.14.0 owner (before, dropped silently) adds that principal as an Owner entry,
and one members already names at Owner is kept as it is; an owner that is no principal id is 422 INVALID_BODY
(details {field: "owner", reason: "malformed"}), and so is one members names at another role
(reason: "owner_role_conflict").
An existing path. A path that holds an explicit registration is 409 SCOPE_REGISTRATION_EXISTS. One that
holds an auto-provisioned record (written by a first write, its writer as sole Owner) is converted into an
explicit registration: its roster and tree are replaced by the request's, and its created_at and version-2
fields are kept. A verified token converts it only as its Owner, and registers a new record only as an Owner
of the nearest registered ancestor that governs it; a new record whose nearest boundary is a deleted ancestor
is refused until that ancestor is registered again, and a deleted path is registered again only by an Owner of
its former roster (each 403 POLICY_DENIED, since 0.14.0 with details.reason not_a_member,
insufficient_role, registration_required, billing_tenant_mismatch or billing_tenant_unbound, and no other
tenant's id). The trusted operator is not roster-checked. With
CORTEX_OPERATOR_INHERIT_TENANT=on the trusted operator's record takes the binding of the record that governs
it (§8.15.3).
Org trees and reserved paths. tree sets the record's org-tree attributes (§8.8.7); naming a parent
takes Owner of that parent too. Since 0.14.0, by default, tree.display_name is refused
(422 INVALID_SCOPE_TREE, §8.8.7), and so is a marker path (<tenant>/orgtree:changes,
<tenant>/holds:changes, <tenant>/access:changes, <tenant>/self:<id>), 422 INVALID_SCOPE_GRAMMAR with
details {reason: "reserved_path", path}; CORTEX_RESERVED_PATH_ENFORCE=off registers and counts it (check
reserved_path). A marker path reaches that check only on an unarmed node whose allowed_scope_types lists
its type; elsewhere its type is 422 UNREGISTERED_SCOPE_TYPE first, as a companion path's attrs leaf always
is.
During a forget or erasure. Registering, editing the members or the tree of, or
deleting a scope inside the footprint of a forget or erasure that is still
running, or an ancestor that governs that footprint, returns
409 SCOPE_STATE_CHANGED, retriable: send it again once the forget or
erasure has finished. Scopes elsewhere are not affected
(§8.5, "What a forget holds while it runs").
Limits and assertions. In an org-tree tenant a registration past the deployment's brain_scopes setting
(CORTEX_LIMIT_BRAIN_SCOPES, default 520,000) is 409 ACCESS_LIMIT_REACHED,
details {limit, value, used, setting, scope}; on an armed registry a widening change that breaks one of the
tenant's assertion cases is 409 ACCESS_ASSERTION_FAILED, details.failed.
The operator plane. Every registration by the operator key is an in-band path (§8.15.3): under the
tenant's effective mode deny it needs X-Cortex-Break-Glass (403 BREAK_GLASS_REQUIRED).
An application's reference root (app_records_v1, DB-18). {"path": "app:<key>", "reference": true, "kinds": [...]} registers application <key>'s reference root, or converts the record there into one. It
is the trusted operator's alone (403 POLICY_DENIED, details.reason: "reference_root") and follows its own
rule: none of the checks above applies. Its shape is fixed: members left out or exactly
[{"actor": "service:<key>", "role": "owner"}], no policies, no tree, no record under it, and kinds at
most 32 of 1 to 64 bytes; any other is 422 INVALID_ACCESS_RECORD, details {path, reason: "reference_root"}. It needs a node armed for apply format 8: else 503 FORMAT_UPGRADE_PENDING, as PUT /v1/apps/{id}
answers it (§8.26.1), with details.reason alone: members_behind (retriable, Retry-After: 30), or arming_disabled
for any other reason (reserved_path_in_use included), not retriable.
Errors: 403 POLICY_DENIED (also details.reason: "token_root_not_written" for a ?consistency=1 call whose
?path= or ?scope= names a root its body does not write, §8.8), BREAK_GLASS_REQUIRED; 409 SCOPE_REGISTRATION_EXISTS, SCOPE_STATE_CHANGED, ACCESS_LIMIT_REACHED, ACCESS_ASSERTION_FAILED; 422 UNREGISTERED_SCOPE_TYPE, OWNERLESS_ROSTER, INVALID_BODY (a path that does not parse, a roster entry or a tree
field the route does not take, duplicate_member, an owner that is malformed or an owner_role_conflict), INVALID_SCOPE_GRAMMAR, INVALID_SCOPE_TREE, INVALID_ACCESS_RECORD;
500 SCOPE_STORAGE_MISCONFIGURED (not retriable, details.reason, §8.8); 503 SCOPE_STORAGE_UNAVAILABLE, WAL_OUTCOME_UNKNOWN, FORMAT_UPGRADE_PENDING; on a clustered owner the
shard's own codes (§8.8); and the consistency token's (§8.8). retriable is each code's own (§8.8).
8.8.2 GET /v1/scopes — Lookup by path
Routing note: scope paths contain
/, so we cannot put them in URL path segments without ambiguity. Scope lookup, member edit, and delete all use the query parameter?path=...form. SDKs canonicalize and percent-encode the value.
GET /v1/scopes?path=org:acme%2Fdept:eng%2Fuser:alice
Returns the record registered at the path, as stored, including billing_tenant and auto_provisioned;
version-2 fields appear only on records that have them. No capability is checked: a verified token needs
Reader or above on the record's roster, and the trusted operator reads every record but an application's
reference root, which only a chain of that application, or its principal, reads. A record owned by another
billing tenant is not readable even when its member roster contains the same actor ID, and an unregistered
path under another tenant's org: root is refused the same way: 403 POLICY_DENIED, "not a member of this
scope". A path no record is at is 404 NOT_FOUND (a first write registers one where auto-registration is
allowed).
names=true (directory_v1): each member that is a principal with a directory entry in the record's tenant
gains display_name, for a caller of that tenant or the trusted operator; without it the body is the record,
byte for byte. ?at_least= waits for a consistency token first (§8.8).
Errors: 400 INVALID_QUERY (no path, or names other than true or false), 403 POLICY_DENIED,
404 NOT_FOUND, 422 INVALID_SCOPE_GRAMMAR, 500 INTERNAL_ERROR (retriable: with names=true, the record did
not serialize); with at_least, 408 WAIT_TIMEOUT (retriable),
422 CONSISTENCY_TOKEN_INVALID, 503 WAL_UNAVAILABLE (retriable).
8.8.3 PUT /v1/scopes/members?path=...
Capability: policy.administer.scope at the path, and Owner of the record (a verified token; the
trusted operator is not roster-checked).
Replaces the roster with the full list submitted, version 1's entries {actor, role} (owner, writer,
reader). Each principal named gets the role named, keeping its stored version-2 until, when and
reason_ref; every stored set entry is kept; a principal left out is removed. The roster must keep an Owner:
an empty list, or one with no owner, is 422 OWNERLESS_ROSTER. The record becomes an explicit registration
(auto_provisioned: false) bound to the caller's billing tenant, and the response is the record as stored.
PUT /v1/scopes/members?path=ws:acme-q3-launch
{
"members": [
{"actor": "user:alice", "role": "owner"},
{"actor": "agent:planner_v3", "role": "writer"},
{"actor": "agent:summarizer", "role": "reader"}
]
}
Since 0.14.0 a principal listed twice is refused by default, as at registration (§8.8.1). An application's
reference root takes no roster edit (422 INVALID_ACCESS_RECORD, details.reason: "reference_root"). The
operator key's edit that adds a service: principal, or adds anyone to a record in a private region, is an
in-band path (§8.15.3). ?consistency=1 returns a token (§8.8). Since 0.14.1 a roster that would make a version-2
record a version-1 one, which 0.13.0's rule would then decide, is refused and writes nothing (the hard rail): one that
leaves out the record's one entry with an until, when or reason_ref, or names its one summary reader at
reader, is 422 INVALID_SCOPE_TREE, details {path, reason: "version_downgrade", dropped}, as a change set's put
is INVALID_ACCESS_RECORD (§8.22.1). This route has no convert; a change set that says it does that.
Errors: 400 INVALID_QUERY; 403 POLICY_DENIED, BREAK_GLASS_REQUIRED; 404 NOT_FOUND;
409 SCOPE_STATE_CHANGED (§8.8.1), ACCESS_ASSERTION_FAILED; 422 INVALID_SCOPE_GRAMMAR,
OWNERLESS_ROSTER, INVALID_BODY (duplicate_member, or an entry that is not {actor, role}),
INVALID_ACCESS_RECORD, INVALID_SCOPE_TREE (version_downgrade); 500 SCOPE_STORAGE_MISCONFIGURED (not retriable, details.reason, §8.8); 503 SCOPE_STORAGE_UNAVAILABLE, WAL_OUTCOME_UNKNOWN; on a clustered owner, the
shard's own codes (§8.8).
8.8.4 DELETE /v1/scopes?path=...
Capability: policy.administer.scope at the path, and Owner of the record (a verified token; the
trusted operator is not roster-checked). An application's reference root is deleted by the trusted operator
only (403 POLICY_DENIED, details.reason: "reference_root").
Deletes only the scope's policy/registration. It never deletes records:
?records=keep(default) — Only deletes the policy/registration; records remain accessible to other allowed scopes.- Any other
recordsvalue, includingrecords=forget, returns422 UNSUPPORTED_RECORDS_ACTION. To remove data, runPOST /v1/forget(redaction) orPOST /v1/erasures(GDPR hard delete) first, wait for it to complete, and then delete the registration.
The registration leaves a tombstone holding its billing tenant and former roster, so a later write cannot
re-create its ACL from the log, and the path is registered again only by an Owner of that roster (§8.8.1). A
record other scopes name as parent in their org tree is 409 SCOPE_PARENT_IN_USE until they move or go
(§8.8.7). Deleting a tenant root's companion (<tenant>/attrs:unit) while it enforces application admission
and the tenant holds an application record is 422 INVALID_ACCESS_RECORD, details.reason: "apps_exist".
The operator key's delete of a record in a private region is an in-band path (§8.15.3). ?consistency=1
returns no token: the 204 has no body.
Response: 204 No Content. Errors: 400 INVALID_QUERY; 403 POLICY_DENIED, BREAK_GLASS_REQUIRED;
404 NOT_FOUND (no record at the path); 409 SCOPE_PARENT_IN_USE, SCOPE_STATE_CHANGED (§8.8.1),
ACCESS_ASSERTION_FAILED; 422 INVALID_SCOPE_GRAMMAR, UNSUPPORTED_RECORDS_ACTION (checked after the
authorization), INVALID_ACCESS_RECORD; 500 SCOPE_STORAGE_MISCONFIGURED (not retriable, details.reason, §8.8); 503 SCOPE_STORAGE_UNAVAILABLE, WAL_OUTCOME_UNKNOWN; on a clustered
owner, the shard's own codes (§8.8).
8.8.5 GET /v1/scopes/list — List
GET /v1/scopes/list?prefix=org:acme&auto_provisioned=false&limit=50
Capability: none: any authenticated caller. The trusted operator sees every record; a verified token
sees only the records bound to its billing tenant that admit it at Reader or above (since 0.14.0 a version-1
record's entries are asked at Reader too, CORTEX_ROLE_BLIND_MEMBERSHIP_ENFORCE, on by default; Reader is
version 1's lowest role, so no answer changes).
| Query | Type | Notes |
|---|---|---|
prefix | string | A scope path: the record at it and every record under it (org:acme matches org:acme/team:x, never org:acmex). A trailing / does not parse: 422 INVALID_SCOPE_GRAMMAR. Absent: every record. |
auto_provisioned | boolean | Keep only the records whose flag equals it. |
limit | integer | Default 50, clamped to 1..1000. |
cursor | string | Since 0.14.0: the previous page's next_cursor, unchanged. |
Response: 200 {"items": [<scope record>, ...], "has_more": bool, "next_cursor"?: string}, in the order of the
records' paths as strings, limit of them a page. The cursor is sealed as the access lookups' are (§6.4): it binds this
route, the caller and every query field but cursor and limit, which may change between pages; a cursor of another
request is 422 INVALID_CURSOR (details.field: "cursor"). A cluster ingress does not route it
(501 CLUSTER_ROUTE_UNSUPPORTED): it lists one node's registry. Errors: 400 INVALID_QUERY (a limit or an
auto_provisioned that does not parse); 422 INVALID_SCOPE_GRAMMAR; with at_least (§8.8),
408 WAIT_TIMEOUT, 422 CONSISTENCY_TOKEN_INVALID, 503 WAL_UNAVAILABLE.
8.8.6 POST /v1/scopes/prune — Cleanup
Capability: policy.administer.tenant
Deletes the registrations of auto-provisioned scopes of the caller's billing tenant whose last write is older than older_than (an ISO-8601 day duration P<days>D, 1 to 365000 days, default P90D; anything else is 422 INVALID_DURATION). With membership enforced only registrations whose roster names the caller an Owner are considered. dry_run defaults to false: send true to list the candidates without deleting. Only the registration goes; the scope's stored events stay. Each delete is guarded by the scope's write-activity revision, so a write that lands between the scan and the delete keeps the registration.
{
"older_than": "P90D",
"dry_run": true
}
Each request examines at most 256 eligible auto-provisioned registrations. The response reports examined and truncated; repeat the operation when truncated is true. total is the number of prune candidates among the registrations actually examined, not a hidden global denominator. Activity that cannot be verified completely is reported in failures and is never pruned.
Response:
{
"candidates": [
{"path": "org:acme/.../user:bob/temp:debug",
"created_at": "2025-11-02T...",
"last_write": "2026-02-01T...",
"records": {"events": 4},
"auto_provisioned": true}
],
"total": 73,
"examined": 256,
"truncated": true,
"dry_run": true,
"deleted": 0,
"failures": [{"code": "SCOPE_SCAN_LIMIT", "remaining": 12}]
}
failures[] lists the registrations kept and why: SCOPE_SCAN_LIMIT (remaining were not examined), ACTIVITY_UNKNOWN (no activity record, or the scan failed: reason), ACTIVITY_SCAN_LIMIT (the activity scan, at most 250,000 log entries, was not complete), REGISTRATION_CHANGED, ACTIVITY_CHANGED (a write landed before the delete) and DELETE_FAILED. Errors: 403 POLICY_DENIED (no policy.administer.tenant, checked without a scope), 422 INVALID_DURATION, 503 PRUNE_UNAVAILABLE (retriable). A cluster ingress does not route it (501 CLUSTER_ROUTE_UNSUPPORTED).
8.8.7 Org trees (tree; new in 0.13.0)
An org tree is a tenant whose root scope is registered with "tree": {"kind": "org"}
(docs/ORG_BRAIN_DESIGN.md). Every scope outside one has no tree, and nothing about it changes.
GET /v1/admin/version names the feature org_tree_v1: everything in this section, as 0.13.0 shipped it. Gate on
the name, not on a version.
The attributes. A scope record carries them under tree, set at registration
(POST /v1/scopes with "tree": {...}) or replaced with PUT /v1/scopes/tree:
| Field | Meaning |
|---|---|
kind | org (the tenant root: its first CORTEX_TENANT_DEPTH segments, no parent), team (a named team; a department is a team high in the tree), person, employee, group (a project, committee, meeting set or 1:1 pair), compartment (aud:pub, aud:lead, aud:roll, aud:work). |
display_name | The name people know it by: 1 to 200 characters, no control characters. Since 0.14.0 a write that sets it is refused by default, 422 INVALID_SCOPE_TREE with details.reason person_display_name on a person or employee record and display_name on any other: a name belongs in the directory (PUT /v1/directory/{id}, directory_v1), since the shard's feed keeps every record for ever. CORTEX_PERSON_DISPLAY_NAME_ENFORCE=off and CORTEX_DISPLAY_NAME_IN_RECORD_ENFORCE=off store it and count it instead (the access report's checks of the same names). A name a record already holds stays readable, and a write that sets none is never refused for it. |
parent | The registered org, team or group it sits under, in the same tenant. Required for every kind but org. The chain must reach the org without a loop, in at most 64 steps. Units are flat siblings under the org root, so a reorg changes parent and moves no rows. |
private | true: read only by name; never through an ancestor or a descendant; never an input to a synthesis homed outside it. false: explicitly not private below a private ancestor (a person's aud:work). Absent: as the nearest registered ancestor that says, else not private. |
POST /v1/scopes
{"path": "org:acme", "tree": {"kind": "org"}}
POST /v1/scopes
{"path": "org:acme/team:emea", "members": [...],
"tree": {"kind": "team", "parent": "org:acme"}}
PUT /v1/scopes/tree?path=... replaces the whole tree (a field left out is cleared; {}
takes the scope out of its org tree). Capability policy.administer.scope and Owner of the scope,
as for its members. Naming a parent the record did not have also takes Owner of that parent,
on both routes: a parent the caller does not own and one that does not exist get the same
403 POLICY_DENIED. display_name and private need a kind (outside org trees a record has no
tree), and a field the body does not know is refused (422 INVALID_BODY), since a field left out
is cleared. The body names version 1's attributes only: kind is one of the six above
(any other, a version-2 kind included, is 422 INVALID_SCOPE_TREE, "unknown kind"), and the record's
version-2 attributes (audience, self, delegable, label) are kept as stored. A kind that replaces a version-2
kind, the record's one version-2 field, would make it a version-1 record: since 0.14.1 that is refused,
422 INVALID_SCOPE_TREE, details {path, reason: "version_downgrade", dropped} (a change set that says convert
does it). The record becomes an
explicit registration (auto_provisioned: false). An application's reference root takes no tree edit
(422 INVALID_ACCESS_RECORD, details.reason: "reference_root"). The operator key's edit that clears
private, or that changes the parent of, or sets private: false on, a record in a private region, is an
in-band path (§8.15.3). ?consistency=1 returns a token (§8.8). On a cluster the change also names its
tenant's marker <tenant>/orgtree:changes, so two tree changes of one tenant conflict at the log and the
later is computed again. Errors: 422 INVALID_SCOPE_TREE (details.reason names the rule broken; for a
display_name, person_display_name or display_name, with details.field: "tree.display_name"),
409 SCOPE_PARENT_IN_USE (other scopes name it as parent and the change, or a DELETE, would
orphan them), 409 SCOPE_STATE_CHANGED (§8.8.1), 409 ACCESS_ASSERTION_FAILED, 404 NOT_FOUND (no record
at the path), 422 SCOPE_TREE_UNSUPPORTED (the native host's journal profile, which serves no registry route:
a plain node or a cluster never answers it), 500 SCOPE_STORAGE_MISCONFIGURED (not retriable, details.reason, §8.8), 503 SCOPE_STORAGE_UNAVAILABLE; on a clustered owner, the shard's own
codes (§8.8).
What an org tree changes.
- The nearest kind decides. A path's kind is that of the nearest registered record above it (or at it) that has one. So a scope registered without a kind inside an org tree (one auto-provisioned before the tree was registered, say) answers as the unit or person above it: shared under the org or a unit, the person's own under a person.
- No walk from a shared scope. At an
org,team,grouporcompartmentscope, the views that walk the tree (holistic,structured,lineage,descend) answer422 VIEW_NOT_ALLOWED_AT_SCOPE,retriable: false, withdetails {field: "view", view, scope_kind, allowed_views: ["granular", "raw"]}. The check runs after the read and roster checks, so a non-member still gets403 POLICY_DENIED. A recall, stream, answer or composition (/v1/compose, which takesgranularthere) that names no view readsgranularthere. Name the scopes to read (extra_scopes) instead of walking. A person's or employee's own scope keeps today's default. The same holds where a read walks without aview:GET /v1/eventsandGET /v1/facts/timelineanswer the 422 for a walking view;- a
/v1/answerwithcohortanswers it whatever view it sends (details.view: "descend"), and ause_pack_idnaming a walking pack at a scope that has become shared answers404; GET /v1/claims,GET /v1/conflictsand the lifecycle routes with?scope=read the scope itself only;POST /v1/exportof a shared scope is not refused: since 0.14.0 it reads granular, the scope's own rows, and never walks into the scopes under it (export each scope by name, or take a cold backup); 0.13.0 refused it,422 VIEW_NOT_ALLOWED_AT_SCOPE, when a scope was registered under it. A read that raced a change to the scope's kind answers503 AUTHORIZATION_STATE_CHANGED(retriable), and the retry gets the rule's answer.
- Private stays private. No walk enters a private region it did not start in, whatever the
roster says, a trusted operator's key included: a
descendfrom an ancestor and aholisticfrom a scope under it both skip it, as do event pages, claims, conflicts and lifecycle reads (a page that holds a scope made private since it was built is withdrawn). An export whose subtree holds a private scope it did not start in answers403 POLICY_DENIED("export it by name"): an export is whole or refused. - No auto-registration. Nothing registers itself under a shared org-tree scope: a first
write to an unregistered path there answers
403 SCOPE_REGISTRATION_REQUIRED. Register every scope of the tree first. Under a person's own scope, auto-registration works as before. - No implicit synthesis. CortexDB's own synthesis never homes a blend of two scopes at a
shared org-tree scope, and never homes a private scope's material outside its private region;
consolidation and procedure mining group one scope at a time there. Each refusal is counted (
synthesis_org_tree_skips_total,synthesis_private_skips_totalinGET /v1/admin/layers/stats;cortexdb_synthesis_*_skips_totalinGET /metrics).
On a cluster, a registry entry that carries tree is proposed under apply format 7. A replica on a
binary of format 6 or older stops at it (SHARD_FORMAT_UNSUPPORTED) instead of dropping the
attributes, so upgrade every replica before registering an org tree.
8.9 Lifecycle
Capability: lifecycle.subscribe for the four reads (§8.9.1 to §8.9.4); the cancel (§8.9.5)
takes scope.write instead. A token without lifecycle.subscribe is refused 403 POLICY_DENIED
(details.capability, details.denied_by_tier) before any row is read; a token confined to paths
is admitted when one of its lifecycle.subscribe paths passes the policy, and is then checked row
by row. The capability is part of the default self-serve tier, so signup tokens carry it.
The log. Lifecycle rows are kept in memory by the process that serves the request: the last
hour of rows, at most 100,000 rows and 64 MiB, oldest dropped first. A restart empties it. On a
cluster each node keeps its own: an ingress routes these routes by ?scope= to the owner of the
scope's root, and answers 501 CLUSTER_ROUTE_UNSUPPORTED to a request without it.
Visibility. A lifecycle row is delivered to a caller only if the caller may see the thing it reports, evaluated per event rather than per request:
| Row | Who sees it |
|---|---|
carries a scope (capture, extraction, indexing, consolidation, forget, …) | a Reader of that scope holding lifecycle.subscribe there; an unregistered scope counts only under the caller's own tenant root (org:<tenant>/…), never under a foreign root |
carries no scope but belongs to an import job (import_progress, import_complete, import_error) | the actor that submitted the job (POST /v1/import/*), in the job's billing tenant and holding lifecycle.subscribe with no path confinement, and nobody else |
carries no scope and belongs to no job | operator credentials only (static API key, or an auth-disabled deployment) |
Operator credentials see every row (they skip the roster checks, not the capability policy),
except that with ?scope= inside an org tree (§8.8.7) no caller sees a private scope's rows unless
the scope it names lies in that private region, and at a shared org-tree scope the routes cover the
scope itself only. A row that names a memory event (captured, extracted, indexed,
consolidated) is delivered only while that event's atoms admit the caller (DB-28). Since 0.14.0 a row whose home or
atom the caller reads only under a notice (a Detail read under a grant naming a person's aud:work, §8.23) is told
first: the catch-up listing and the by-id reads commit the notice before the response leaves, or answer
503 NOTICE_UNAVAILABLE and deliver nothing, and the stream, which tells nothing first, withholds the frame. The filter
applies identically to the SSE stream (live frames and replay), to the catch-up listing, and to the
two by-id reads — where an invisible row is reported as 404 NOT_FOUND with the same body a
nonexistent id produces, so the routes never confirm that another tenant's event exists.
Operator plane. The four reads are class D-rows (§8.15.3): under
CORTEX_OPERATOR_DATA_READS=deny the operator key needs X-Cortex-Break-Glass
(403 BREAK_GLASS_REQUIRED without it). A by-id read is decided once its row is read, by the
row's own scope, whatever ?scope= names (§8.15.3, "By-id reads"): a break-glass read of a private
region's row is served once the region's notice commits. ?scope= confines a by-id read: a row whose
own scope is not that scope or under it answers the same 404 (a lifecycle row without a scope lies
under none, so it is 404 with ?scope=).
Errors of every read: 400 INVALID_QUERY (a malformed event_id or since_lifecycle_id), 400 INVALID_PATH_PARAMS (a malformed {lce_id} or {evt_id}) and 400 INVALID_HEADER (a Last-Event-ID that is not
UTF-8 or not an lce_ id), each with details {part, field, reason} (part query, path or header, field the
parameter or the header, reason the parser's message); 403 POLICY_DENIED; 422 INVALID_SCOPE_GRAMMAR (a malformed
?scope=); 503 NOTICE_UNAVAILABLE from the catch-up listing and the by-id reads (a notice the read must tell first
did not commit, above; retriable but for details.reason arming_disabled and reserved_path_in_use). No other is retriable.
8.9.1 GET /v1/lifecycle/stream — SSE
Capability: lifecycle.subscribe
GET /v1/lifecycle/stream?scope=org:acme/user:alice&since_lifecycle_id=lce_01HX...
Accept: text/event-stream
| Parameter | Type | Notes |
|---|---|---|
scope | scope path | Rows whose scope is this scope or lies under it; a row without a scope never matches. A filter, never an authority: another tenant's scope yields an empty stream, not a 403 |
event_id | evt_ id | Only the rows that name this memory event (captured, extracted, indexed, consolidated) |
events | string | Comma-separated event names (§13); a name no row carries matches nothing |
since_lifecycle_id | lce_ id | Replay the retained rows after this one, then go live. A lifecycle event ID (lce_...), not a memory event ID (evt_...) |
Last-Event-ID | header | The SSE resume header, read only when since_lifecycle_id is absent; EventSource sends it on reconnect. One that is not UTF-8 or not an lce_ id is 400 INVALID_HEADER |
job_id | string | Only the synthesis_* rows of this POST /v1/understanding/synthesize job |
import_id | string | Only the import_* rows of this import job (the lifecycle_stream URL the import routes return) |
erasure_id | string | Only the erasure_* rows of this erasure job (0.10.4) |
batch_id | string | One bulk write's rows: those of the events its captured rows name (data.batch_id, set on every row a POST /v1/experience/bulk captures), at every stage (captured, extracted, indexed, consolidated; a compressed row names no event). An event leaves the filter when the log evicts its captured row. An idempotent replay inside the batch captures nothing, so its event's rows are not the batch's |
export_id | string | One export job's export_progress and export_complete rows. The server emits none today (POST /v1/export answers its data in its response), so such a stream delivers nothing |
Without a resume cursor, a stream filtered by erasure_id, batch_id or export_id starts at the oldest row the log
holds, so the link a response returns delivers the job's rows written before it was opened; any other stream starts at
the head. No other parameter is read.
Each row is one frame: id is its lifecycle_id, event its event name, data the row (§13):
id: lce_01HX...
event: captured
data: {"lifecycle_id":"lce_01HX...","ts":"2026-05-13T15:42:09.018Z","scope":"org:acme/user:alice","event":"captured","data":{"event_id":"evt_01HX...","wal_offset":1042,"actor":"user:alice","modality":"text"}}
A comment line every 30 s keeps an idle connection open. See §10.
Resume. With since_lifecycle_id, or else Last-Event-ID, the stream replays the retained
rows after that row that match the filters, then goes live (410 RESUME_CURSOR_UNAVAILABLE, below, is not
retriable).
The stream reads the server's lifecycle log in order from its cursor: after the anchor of a resume
(?since_lifecycle_id=, else Last-Event-ID), at the oldest row the log holds for an erasure_id, batch_id or
export_id stream, else at the log's head. It delivers each row once, whether the row was appended before the stream
opened or after, and a subscriber that falls behind is caught up from the log for as long as the log holds its rows
(one hour, at most 100,000 rows and 64 MiB). When the log no longer holds the row at the cursor, because it evicted rows
the subscriber had not read, the stream sends one lagging frame and ends. The frame has no SSE id, so the client's
Last-Event-ID stays the last row it was delivered; its data.resume_from is that row (else the anchor the stream
resumed from, else null). Those rows are gone, so a resume from it answers 410 RESUME_CURSOR_UNAVAILABLE: start
again from a catch-up page (§8.9.4). An anchor the log does not hold (unknown, pruned, or evicted) answers 410 at once
and is never replayed from the start. A resume is not bounded by a window: the 10,000-row, 16 MiB and 100,000-row
replay bounds apply to the catch-up page's since_lifecycle_id, not to the stream. A stream that starts at the oldest
row (a job's, without a cursor) replays what the log held when it opened and promised nothing older: a row from before
its opening that a full log evicts before the stream reads it is skipped, while a row appended after it opened and
evicted before it was read ends it with lagging like any gap.
The subscriber's credential is re-checked for every delivered frame and, on an idle stream, every CORTEX_LIFECYCLE_AUTHORITY_RECHECK_SECS seconds (default 30, floor 1). When it stops verifying mid-stream — the token is revoked, expires, or loses the capability — the server emits one final frame and closes the connection:
event: policy_revoked
data: {"lifecycle_id":"lce_01HX...","ts":"2026-05-13T15:42:09Z","event":"policy_revoked","data":{"reason":"credential no longer current"}}
so a client can tell an authorization lapse from a dropped connection and stop reconnecting (§10.4). The subsequent request on that credential fails at ingress with 401 (REVOKED_TOKEN / EXPIRED_TOKEN).
Errors (JSON, before the stream opens): those of §8.9, 403 BREAK_GLASS_REQUIRED,
410 RESUME_CURSOR_UNAVAILABLE.
8.9.2 GET /v1/lifecycle/event/{lce_id} — Poll one lifecycle event
Capability: lifecycle.subscribe
Returns one retained lifecycle row (§13), the same JSON a stream frame's data carries:
{
"lifecycle_id": "lce_01HX...",
"ts": "2026-05-13T15:42:09.418Z",
"scope": "org:acme/user:alice",
"event": "extracted",
"data": {"event_id": "evt_01HX...", "derived": {"facts": ["fact_01HX..."], "beliefs": ["belief_01HX..."]}}
}
Errors: those of §8.9; 404 NOT_FOUND (no retained row has that id, or the caller may not see
it: the same body either way); 403 BREAK_GLASS_REQUIRED and 503 NOTICE_UNAVAILABLE (§8.9,
operator plane).
8.9.3 GET /v1/lifecycle/memory-event/{evt_id} — Aggregated view
Capability: lifecycle.subscribe
Aggregates the rows the log still holds for one memory event:
{
"event_id": "evt_01HX...",
"stages_completed": ["captured", "extracted", "indexed"],
"lifecycle_event_ids": ["lce_01HX...", "lce_01HX...", "lce_01HX..."],
"derived": {"facts": ["fact_01HX..."], "beliefs": ["belief_01HX..."]}
}
| Field | Type | Notes |
|---|---|---|
event_id | string | The memory event |
stages_completed | array | Which of captured, extracted, indexed and consolidated have a row, in the order they arrived |
lifecycle_event_ids | array | The rows aggregated, oldest first |
derived | object | The ids its extracted rows report: facts, entities, beliefs, each absent when empty |
The view reads only the in-memory log: a memory event older than the retention window, or written
before the last restart, answers 404 NOT_FOUND, as does one with any row the caller may not see.
Errors: those of §8.9.2.
8.9.4 GET /v1/lifecycle — Catch-up paginated
Capability: lifecycle.subscribe
GET /v1/lifecycle?scope=org:acme/user:alice&limit=100&offset=0
GET /v1/lifecycle?scope=org:acme/user:alice&since_lifecycle_id=lce_01HX...&limit=100
For clients that can't hold SSE connections. Returns retained rows oldest first, in arrival order.
| Parameter | Type | Notes |
|---|---|---|
scope | scope path | As on the stream (§8.9.1) |
event_id | evt_ id | As on the stream |
batch_id, export_id | string | As on the stream (§8.9.1) |
since_lifecycle_id | lce_ id | The rows after this one; offset is then ignored |
limit | int | Default 50, clamped to 1–1000 |
offset | int | Default 0; counts the rows this caller may see that match the filters |
The stream's events, job_id, import_id and erasure_id are not read here.
{
"items": [
{"lifecycle_id": "lce_01HX...", "ts": "2026-05-13T15:42:09.018Z", "scope": "org:acme/user:alice",
"event": "captured", "data": {"event_id": "evt_01HX...", "wal_offset": 1042}}
],
"next_offset": 100,
"has_more": true
}
Without since_lifecycle_id, offset and next_offset count only the rows this caller may see
that match the filters: rows it may not see are skipped and not counted, so a page holds limit
rows unless it is the last, next_offset is offset plus the rows returned, and the offsets say
nothing about another tenant's volume. With since_lifecycle_id the page holds up to limit rows
after that row, next_offset is 0 and has_more says whether more follow: page on with the last
item's lifecycle_id. Page until has_more is false. An anchor the log no longer holds, more
than 10,000 matching rows or 16 MiB after it, or a page over 16 MiB answers
410 RESUME_CURSOR_UNAVAILABLE: start again from offset=0. scope here is a filter, not a
scope the caller claims — pointing it at another tenant's scope returns 200 with items: []
rather than a 403, exactly as a scope with no rows does, so the listing never confirms that
another tenant's scope exists. The same holds for ?scope= on the stream.
Errors: those of §8.9, 403 BREAK_GLASS_REQUIRED, 410 RESUME_CURSOR_UNAVAILABLE.
8.9.5 POST /v1/lifecycle/memory-event/{evt_id}/cancel
Capability: scope.write at the event's home scope plus Writer membership on it; for another
actor's event, Owner membership through a registered record at or above the scope plus
policy.administer.scope there. lifecycle.subscribe is not needed. The event is read from the
WAL, which outlives the lifecycle buffer, so its scope and its writer (caller) are known after
the hour and after a restart. A caller who fails a membership check gets 404 NOT_FOUND — the
same body an unknown evt_id produces — rather than a 403 that would confirm the event exists;
a missing capability is 403 POLICY_DENIED. The authorization is held until the exclusion
commits: a registry change in between also answers 404.
Cancels queued lifecycle stages (extracted, indexed, consolidated, compressed) for a memory event that has already been captured. The WAL capture itself is not reversible — the event remains retained in the WAL but is suppressed from public citation lookup via GET /v1/events/{evt_id} — but the event is flagged excluded_from_recall: true and will not appear in /v1/recall, /v1/answer, or layer-scoped list endpoints. The cancel emits a forgotten row (§13): layer: "events", count: 0, cascade: "cancelled".
Use cases: client submitted by accident; client realized post-submit that the content shouldn't be derived from; client wants to retry with corrected content.
Request (optional body):
{
"audit_note": "Caller cancelled (incorrect content); will resubmit"
}
A cancel writes its own audit row in the trail's chain, beside the auth layer's row of the request (both carry the
request's request_id): endpoint POST /v1/lifecycle/memory-event/{evt_id}/cancel, capability: "scope.write",
decision: "allow", decided_by_tier: "handler", scope the event's home scope, event_id the event. It holds the
audit_note as the peppered digest of the canonical JSON {"audit_note": <note>} ({} without one), never as text:
POST /v1/audit/verify {audit_id, body: {"audit_note": <note>}} answers match: true for the note sent. audit_id is
absent only when the server keeps no audit trail; such a server answers a cancel that sends audit_note 422 INVALID_BODY, details: {field: "audit_note", reason: "no_audit_trail"}, before it reads or changes anything.
Response:
{
"event_id": "evt_01HX...",
"stages_cancelled": ["extracted", "indexed", "consolidated", "compressed"],
"stages_already_completed": ["captured"],
"excluded_from_recall": true,
"audit_id": "audit_01HX..."
}
stages_already_completed lists the stages this process recorded as done for the event (none
after a restart), and stages_cancelled the rest of extracted, indexed, consolidated and
compressed. A cancel also takes what was derived from the event: its facts, and the
beliefs, episodes and concepts built on them, leave every replica's views (on one node at once, on a cluster when each
replica's erase tail applies the cancel), so no recall, answer or layer listing serves them, and a rebuild of the layers
brings none back (since 0.14.0). A failure removing them answers 503 WAL_UNAVAILABLE (retriable: the cancel committed,
and its resend removes them). excluded_from_recall is always true in a 200: when the
shard finds no row to exclude, the route answers 404.
Errors: 400 INVALID_PATH_PARAMS (not an evt_ id; details {part: "path", field, reason}); 403 POLICY_DENIED;
404 NOT_FOUND; 422 INVALID_BODY (an audit_note on a server that keeps no audit trail, details: {field: "audit_note", reason: "no_audit_trail"}); 500 INTERNAL_ERROR (retriable; the cancel did not complete); 503 NOT_LEADER, WAL_UNAVAILABLE, WAL_OUTCOME_UNKNOWN
and, on a cluster data node, an apply refusal such as REGISTRY_STALE (all retriable). A cluster
ingress routes it by ?scope= (the root of the event's scope), and answers
501 CLUSTER_ROUTE_UNSUPPORTED without it.
8.10 Audit
Capability: audit.read on every audit route (the trusted operator — the static
CORTEX_API_KEY or an auth-disabled server — needs none); 403 POLICY_DENIED without it.
audit.read.cross_actor widens what a caller reads:
- Rows of the caller's own billing tenant only; the trusted operator reads every tenant's.
- Without
audit.read.cross_actor, only the rows its own actor wrote. With it, the rows of every actor in its co-membership boundary: itself and the actors the rosters of its tenant's registered records name where it holds at least Reader (the trusted operator is unbounded). client_ipis removed from rows served to a caller withoutaudit.read.cross_actor.
The trail is per node (§14), and a cluster ingress routes none of these routes
(501 CLUSTER_ROUTE_UNSUPPORTED; reach a node with cortexdb admin node call). Their error bodies
carry error_code, message, retriable (never retriable) and, since 0.14.0, request_id.
8.10.1 GET /v1/audit
Capability: audit.read. audit.read.cross_actor additionally required to query for actors other than self.
GET /v1/audit
?actor=agent:planner_v3
&capability=scope.write
&decision=allow
&limit=100
| Parameter | Notes |
|---|---|
actor | Only this actor's rows. Another actor needs audit.read.cross_actor and must be inside the caller's co-membership boundary; either miss is 403 POLICY_DENIED, never a silent page of the caller's own rows |
capability | Exact match on the row's capability (empty on the authentication layer's rows, §14) |
decision | Exact match on the row's decision (§14 lists the values). deny finds the rows of refused requests (403s, since 0.14.0 the authentication layer's own among them: BREAK_GLASS_REQUIRED, an import's or export's POLICY_DENIED, and the operator plane's 400 INVALID_HEADER for a malformed X-Cortex-Break-Glass): at most 60 per principal a minute, plus one row with denial.suppressed |
limit | Default 100, clamped to 1–1000 |
No other parameter is read: ?scope= and ?since= are ignored.
Response: {"items": [ …rows (§14)… ]}.
Returns audit log rows (§14), newest first since 0.10.4 (limit, default 100, keeps the newest
rows; before 0.10.4 the list was oldest first and the limit kept the OLDEST rows, so a busy server
never showed a recent one). /v1/audit/chain keeps chain order. Since 0.10.4 POST /v1/erasures
writes its own gdpr: true row too (§8.6.3). Each row's request_id is the request's
X-Request-Id (§6.7):
since 0.10.2 the authentication layer's row and the gdpr: true row a POST /v1/forget writes
carry the id the response echoed and the request log line (cortex_api::request) shows, so an
erasure's audit rows can be joined to its log line and to a client-side report. (Before 0.10.2
the gdpr row always, and the authentication layer's row on a successful request, carried a fresh
id that appeared nowhere else.)
Errors: 403 POLICY_DENIED.
8.10.2 GET /v1/audit/{id}
Capability: audit.read
Single row by ID (§14). A row outside what the caller reads (§8.10) answers the same
404 NOT_FOUND as a missing id, so the route never confirms another actor's or tenant's row.
8.10.3 POST /v1/audit/verify
Capability: audit.read
Tamper-evidence check for one row. Submit the original request body; the server hashes it (with the server's pepper) and confirms whether it matches the row's body_hash.
The server hashes request bodies as the raw bytes received on the wire — no re-serialization. body accepts two forms:
- a string — hashed exactly as given; pass the byte-for-byte original request body;
- any other JSON value (object, array, number, boolean, null) — serialized to canonical JSON (object keys sorted by byte order, no insignificant whitespace) and those bytes hashed. This matches whenever the original sender emitted compact sorted-key JSON (the form the first-party SDKs and
serde_jsonproduce). For bodies originally sent with other whitespace or key order, use the raw string form.
{
"audit_id": "audit_01HX...",
"body": "{ ... raw JSON of the original request ... }"
}
or
{
"audit_id": "audit_01HX...",
"body": { "scope": "org:acme", "content": "..." }
}
Response:
{
"match": true,
"hashed_at": "2026-05-13T15:42:09Z",
"algorithm": "sha256",
"tenant_pepper_version": 2
}
Some rows carry a marker instead of a digest in body_hash because the middleware declined to buffer the body: unhashed:multipart (multipart uploads), unhashed:oversize (body over 8 MiB), unhashed:streaming (unbounded/chunked body), unhashed:unread (a body the authentication layer answered before it read it, or one that did not read to its end; since 0.14.0). Verify always reports match: false for those rows.
match is false, and hashed_at null, when the body does not match; tenant_pepper_version
is the row's. A row written before a restart verifies, under the pepper the data dir keeps (§14); a row an older
binary wrote (tenant_pepper_version: 1) answers match: false. The chain hashes (§8.10.4) are unpeppered and
unaffected.
The row is read as GET /v1/audit/{id} reads it: the caller's own row, or, with audit.read.cross_actor, a row of an
actor inside the caller's co-membership boundary in its billing tenant (the trusted operator is unbounded). Any other
row answers 404 NOT_FOUND, exactly as an id that does not exist.
8.10.4 GET /v1/audit/chain
Capability: audit.read
Hash-chain head for tamper-evident continuity checks. Every appended audit row is linked into a chain:
row_hash = sha256( prev_hash || canonical_json(row without prev_hash/row_hash) )
prev_hash = previous row's row_hash (absent on the first hashed row)
canonical_json is compact JSON with object keys sorted by byte order. Chain hashes are unpeppered (the row stores digests of the request body and headers, never their content), so anyone holding the audit JSONL can re-verify independently.
Response:
{
"head_hash": "sha256:9f2c...",
"length": 1204,
"legacy_rows": 0,
"algorithm": "sha256-chain-v1"
}
legacy_rows counts rows persisted before chain support; the chain starts at the first hashed row. Optional ?actor=<actor_id> narrows length/head_hash to one actor's rows as a continuity anchor (requires audit.read.cross_actor for actors other than self); the chain linkage itself is always global and append-ordered. An actor outside the caller's co-membership boundary is 403 POLICY_DENIED too.
A caller other than the trusted operator gets figures for its own billing tenant's rows: length
counts them and head_hash is the last one's row_hash in the global chain, an anchor rather than
an independently linked sub-chain; the trusted operator gets the global chain. head_hash is
null when no matching row is hashed.
8.10.5 POST /v1/audit/chain/verify
Capability: the trusted operator only; every other caller, audit.read or not, gets
403 POLICY_DENIED: the chain is one global, cross-tenant sequence, and a tenant's subset cannot
prove continuity.
Walks the whole chain, recomputing every row hash. Empty request body (a body sent is ignored).
Response:
{
"valid": true,
"length": 1204,
"legacy_rows": 0,
"head_hash": "sha256:9f2c...",
"algorithm": "sha256-chain-v1"
}
When invalid, first_broken_index (0-based index into the full row list) identifies the first row that fails verification — a tampered, deleted, reordered, or spliced-in row breaks linkage at or after that position. A row is broken when it lacks row_hash after hashed rows began (legacy rows are tolerated only as a
prefix), its prev_hash does not name the previous hashed row's row_hash, its recomputed hash
differs, or its line does not parse. head_hash is absent when no row is hashed.
Once a retention sweep (§14) has deleted the trail's first rows, the walk starts where the sweep left the chain, and the response names it:
"anchor": {"starts_after": "sha256:4b1e...", "pruned_rows": 5120, "pruned_before": "2025-10-27T00:00:00Z"}
starts_after is the row_hash of the last row deleted (null when that was a legacy row),
pruned_rows the rows every sweep deleted, pruned_before the last sweep's cutoff.
8.11 Import
Six routes write other systems' memories, one row at a time. Every import route requires scope.write and the source's
capability (import.from.jsonl, import.from.mem0, import.from.zep, import.from.letta or import.from.openai) on
every scope a row lands in, and Writer there for a per-actor token; a token whose capability narrowing (caps) lacks
either is refused 403 POLICY_DENIED before its body is read.
Before a job exists the request is checked whole: while memory is high (Linux; CORTEX_MEMORY_PRESSURE) it is refused
503 MEMORY_PRESSURE (Retry-After: 10, details.kind: "import") before its body is read; a worker-disabled prepared
replica refuses it 503 MEMORY_INGESTION_UNAVAILABLE (retriable); with 32 imports already running in the process it is
429 IMPORT_SATURATED (Retry-After: 1). Then the body is parsed (application/json; unknown keys are ignored; an array
of more than 10,000 rows or lines is 422 INVALID_BODY), every row's effective scope is authorized, and every target is
admitted (auto-registered) at once: a refused row refuses the request and nothing is written. Hosted plans
(CORTEX_PLANS=1) refuse an import once the account is at its memories limit (402 PLAN_LIMIT_REACHED); one already
running is not cut short. Imports are not charged to CORTEX_SUBTREE_RATE_LIMITS.
The job then runs inside the request. Rows are written one at a time, each its own shard Capture, without waiting for
the indexer, and each is planned again just before it is written (DB-28, since 0.14.0: a non-human chain's rows carry
the atoms and provenance of what it read, and may be redirected to its writer's private space, §8.1). A row that fails
— invalid, over a label limit, refused by its plan, a full disk, a lost log outcome, a reused key — is recorded on the
job, and the others continue. The 202 comes when every row has been tried, so its counts are final; if the request
ends first (its client goes away), the job stops there with status cancelled and the rows already written stay. A
fully failed import is a 202 too: read failed and first_error.
{
"import_id": "imp_01HX...",
"status": "completed",
"estimated_items": 3,
"accepted": 2,
"failed": 1,
"first_error": "line 2: envelope validation: content.message text is empty",
"status_url": "/v1/import/imp_01HX...",
"lifecycle_stream": "/v1/lifecycle/stream?import_id=imp_01HX..."
}
| Field | Type | Notes |
|---|---|---|
import_id | string | imp_ and 32 hex digits |
status | string | completed (running only when the job's record was already dropped) |
estimated_items | integer | Rows or lines the request carried (a data string's non-blank lines) |
accepted | integer | Rows written, idempotent replays included |
failed | integer | Rows that failed, exact |
first_error | string | line <n>: <error> of the first recorded failure, n the row's 0-based position; absent when none failed |
warnings | array | Omitted when empty. Once each, in the order the rows first named them: directive_not_enforced:<name> for a directive nothing reads that a written row names (§3.5.3), and derived_by_dropped:<name> for a stamp that an exported line carried and /v1/import/jsonl did not keep (§8.11.5) |
status_url, lifecycle_stream | string | The job's status (§8.11.6) and its import_progress, import_error and import_complete events |
Errors the import routes answer themselves carry error_code, message, retriable and, since 0.14.0,
request_id, without details. A cluster ingress does not route them
(501 CLUSTER_ROUTE_UNSUPPORTED).
The source importers' rows (new in 0.15.0). The Mem0, Zep, Letta and OpenAI routes share these rules:
- Keys. A row's
idempotency_keycomes from the source. A row with anidis keyedimport:<provider>:<id>(an id too long for the key's 64 bytes isimport:<provider>:id:<first 32 hex of its blake3>). A row without one is keyedimport:<provider>:<first 32 hex of blake3 over its user_id, its time and its text>, each part length-prefixed. The time is the row's own time field (created_at, Zep'svalid_at, OpenAI'screated), empty when absent. So a resent export replays every row within a key's 24 hours, andacceptedcounts the replays. A row changed under its id is another write: it fails alone withIDEMPOTENCY_CONFLICT. A Zep edge's end counts as a change (§15.2), so an edge resent with aninvalid_atit did not have fails too, rather than replaying the open edge. Before 0.15.0 every row took a fresh key, and a resent import wrote its rows again. mode.raw, the default and the behaviour before 0.15.0, writes each row as a message that the scope derives again under its own rules.keepwrites it withdirectives.extract: []and the labelimported_memory. A memory the source system already extracted is then served as an event and never extracted again.keep_triplesis the Zep importer's alone (§15.2); the other three refuse it with422 INVALID_BODY. The mode is part of each row's write identity: the same export resent in another mode within 24 hours fails every row withIDEMPOTENCY_CONFLICT.- Labels. Every row carries
imported, then its source's own labels (§15), then the importer's stampderived_by:import:<provider>@1(§3.5.3, "Write-back stamps"). No client can write that namespace, andGET /v1/derivation/status?derived_by=import:<provider>reports it like any write-back's (§8.7.12).
8.11.1 POST /v1/import/mem0
Source capability: import.from.mem0
{
"scope_template": "org:acme/user:{user_id}",
"mode": "keep",
"rows": [
{"id": "mem-1", "memory": "Prefers window seats", "user_id": "alice", "created_at": "2026-05-13T15:42:00Z",
"categories": ["travel"], "metadata": {"source": "web"}}
]
}
| Field | Type | Notes |
|---|---|---|
scope_template | string | Required. {user_id} is replaced per row by the row's user_id (unknown when it has none); nothing else is substituted. Its first segment must be a fixed scope root (422 INVALID_BODY otherwise). A row whose resolved scope does not parse fails alone (scope: ...). |
rows | array | Required, at most 10,000: {memory, id?, user_id?, agent_id?, run_id?, created_at?, categories?, metadata?} (§15.1) |
mode | string | raw (default) or keep (above); keep_triples is 422 INVALID_BODY |
Every resolved scope is authorized before the job (the fixed root, when no row resolves), as POST /v1/experience
authorizes an envelope: the source capability besides, RUN_REQUIRED for a chain that names an agent but no run, and
the operator plane's in-band class (BREAK_GLASS_REQUIRED for the operator key under CORTEX_OPERATOR_DATA_READS=deny
without the header); the first refused scope refuses the request. Each row becomes a message
envelope (§15.1) keyed from its source (above), so a resent export replays.
8.11.2 POST /v1/import/zep
Source capability: import.from.zep
The Mem0 shape: scope_template (with {user_id}), up to 10,000 rows of {id? (alias uuid), fact?, content?, valid_at?, user_id?, fact_name?, source_node_name?, target_node_name?, invalid_at?} and mode: raw, keep or
keep_triples. The text is content, else fact; a row with neither fails as an empty message. Under keep_triples an
edge, a row with fact_name and both endpoint names, becomes a typed triple with its validity (§15.2).
8.11.3 POST /v1/import/letta
Source capability: import.from.letta
{"scope": "org:acme/agent:planner", "rows": [{"text": "...", "kind": "archival", "created_at": "2026-05-13T15:42:00Z"}]}
scope (required; a malformed path is 422 INVALID_BODY) is where every row is written; it is authorized before the
job and admitted only when there are rows (with RUN_REQUIRED and BREAK_GLASS_REQUIRED as for Mem0). Up to 10,000 rows of {id?, text?, kind?, created_at?}; kind
becomes the label letta_kind:<kind>, and a row without text fails as an empty message (§15.3). mode is raw or
keep.
8.11.4 POST /v1/import/openai
Source capability: import.from.openai
For ChatGPT memory exports: {"scope": "...", "rows": [{"id": "...", "text": "...", "created": "..."}], "mode": "raw"},
scope as for Letta, up to 10,000 rows, text required, id optional (§15.4). mode is raw or keep.
8.11.5 POST /v1/import/jsonl and POST /v1/import
Source capability: import.from.jsonl
{
"scope_template": "org:acme/user:alice",
"lines": ["{\"scope\":\"org:acme/user:alice\",\"modality\":\"conversation\",\"content\":{\"kind\":\"text\",\"text\":\"...\"},\"idempotency_key\":\"line-1\"}"]
}
POST /v1/import/jsonl takes scope_template and lines (both required; at most 10,000 lines). POST /v1/import, the
inverse of POST /v1/export, writes the same lines through the same importer (its job's source is jsonl): scope or
scope_template (the latter wins when both are sent) and lines or data, a raw JSONL string such as an export's
data pasted verbatim (blank lines are skipped; lines wins when both are sent; more than 10,000 non-blank lines is
413 IMPORT_TOO_MANY_ITEMS), with format defaulting to jsonl (any other value is 422 INVALID_BODY). Missing either
pair is 422 INVALID_BODY.
Each line is a canonical experience envelope (§3.5) or a line of /v1/export output, which is converted back (§15.5); a
line that is neither fails as a row, with the parse error. When scope_template is itself a scope path every line is
written there; otherwise each line keeps its own scope. Its first segment must be a fixed scope root either way
(422 INVALID_BODY). A line's idempotency_key deduplicates in the bucket the two routes share, compared on the line's
exact bytes: a resent line whose bytes differ under the same key fails as a reused key; a line without a key gets a
fresh one, and an exported line gets reimport-<event id>. Lines may declare provenance (write_provenance_v1); an exported line's provenance is resolved as §15.5 says
before the line is authorized. A line's atoms are never read: the server stamps every imported row's atoms (the source
importers' rows too) from the importing principal's chain, so a re-import is the importer's own statement and cannot
forge another chain; only a file-level restore (scripts/cold_backup.py restore) keeps the original atoms. The
line's own observed_actor and subject are kept: a token's act is not stamped on import lines.
A canonical line takes derived_by on a typed triple as POST /v1/experience does (derived_by_v1, §3.5.3): a line
whose stamp, or whose own derived_by: label, is refused fails alone, its job error leading with DERIVED_BY_INVALID: .
An exported line keeps the stamp its event carries as a label only as the field could have set it, since a line is
its client's own statement: one stamp, the first in the client grammar, on a typed triple. Every other label that reads
as a stamp is dropped, and the job warns derived_by_dropped:<name> once for each name: a stamp in the importers'
namespace (derived_by:import:<provider>@<version>, which only an importer writes), one out of grammar (its name cut
to 64 bytes), a second stamp, and one on anything but a typed triple. A derived_by: label that reads as no stamp
(no @) is kept, since nothing reads it as one.
Before the job each parseable line is authorized as POST /v1/experience authorizes an envelope: import.from.jsonl
besides, scope.write.on_behalf_of and scope.write.about_other for its identities (a re-imported export of another
actor's events needs them), its consolidation target, RUN_REQUIRED, the operator plane's in-band class
(BREAK_GLASS_REQUIRED), hosted plans and its write plan (403 ATOMS_REDIRECT_REFUSED, 422 CROSS_ROOT_PROVENANCE,
503 FORMAT_UPGRADE_PENDING); the first refused line refuses the request.
8.11.6 GET /v1/import/{import_id}
Status of a job a POST /v1/import* request ran (the route's path parameter is {id}). A per-actor token sees only the
jobs its own billing tenant and actor made; any other id answers 404 NOT_FOUND exactly as an unknown one does. The
trusted operator reads any job by id. No capability is asked. Job records live in the serving process's memory: kept
24 hours after the job finishes (at most 10,000 finished jobs), never across a restart.
{
"import_id": "imp_01HX...",
"source": "jsonl",
"status": "completed",
"processed": 5240,
"total": 5241,
"failed": 1,
"errors": [
{"line": 1208, "error": "envelope validation: modality is empty"}
],
"error_details_truncated": false
}
| Field | Notes |
|---|---|
source | jsonl, mem0, zep, letta or openai |
status | running, completed, or cancelled (the request that ran the job ended first) |
processed | Rows written, idempotent replays included |
failed | Exact, past the detail cap too |
errors | At most 100 entries and 64 KiB of text; line is the row's 0-based position. A label limit leads with its code (LABEL_TOO_LONG: envelope validation: ...), a refused write plan reads <CODE>: <message> |
error_details_truncated | true when a row's detail was left out or shortened |
8.11.7 POST /v1/import/{import_id}/cancel
Not served: no route is registered at this path, and a request to it answers 404. An import runs inside its request and
finishes before its 202; a request that ends first stops its job, which then reads status: "cancelled".
8.12 Export
8.12.1 POST /v1/export
Capability: export.format.jsonl and scope.read.descend on scope; scope.read.local and Reader on scope and
on every scope registered under it; scope.read.cross_tenant when scope lies outside the caller's billing tenant (an
org: root other than its own, or a root no read ACL binds to it; the trusted operator is exempt). A token whose
capability narrowing lacks export.format.jsonl, scope.read.local or scope.read.descend is refused before its body
is read.
Returns every stored event of the scope's subtree as JSONL, in the one response.
{"scope": "org:acme/user:alice", "format": "jsonl"}
| Field | Type | Notes |
|---|---|---|
scope | string | Required: the subtree's scope path (a malformed one is 422 INVALID_BODY) |
format | string | jsonl, the default; any other value is 422 INVALID_BODY |
Any other key is refused, 422 INVALID_BODY with details.field naming it (include, layers, as_of,
destination, ...): an export never answers something other than what it was asked for. There are no layers, as_of
or destination, and no other format: mem0, zep and letta are 422 INVALID_BODY like any format other than
jsonl.
Response: 200, its members in this order:
{
"export_id": "exp_01HX...",
"format": "jsonl",
"data": "{\"id\":\"evt_...\",\"scope\":\"org:acme/user:alice\",...}\n",
"bytes": 4823648
}
data holds one line per stored event as the log holds it, each newline-terminated: id, scope, caller,
observed_actor, subject ({id, type}), scope_key (the billing tenant), modality, source, content (the
envelope's tagged block), context (observed_at, recorded_at, source_recorded_at, location, preceded_by,
intent, labels, timezone, refers_to), derives, wal_offset, language, scripts,
language_source, source_blob_ids, extract, atoms and provenance, each key left out when it is empty. bytes
counts data's UTF-8 bytes. Live rows come first, in log order up to the log head the export began at, then the
scope's sealed events, read from their segments. A cancelled or excluded row (excluded_from_recall) is left out,
live or sealed, as every public read leaves it out; a redacted row is exported as it is stored.
POST /v1/import (or /v1/import/jsonl) takes the lines back (§8.11.5, §15.5).
An export is whole or refused: a row whose scope the caller may not read (a region made private since included) refuses
it 403 POLICY_DENIED, and so does an authorization that changed while it ran; nothing is returned then. The one
exception is DB-28's delivery gate (since 0.14.0): a row whose atoms the caller's chain may not read is left out without
an error. What an export delivers enters the chain's read record, so a non-human chain's later writes carry it as atoms
and provenance (§8.1). Org trees: at a shared scope (an org, a team, a group, a compartment) the export reads
granular since 0.14.0, as a read naming no view does (§8.8.7; 0.13.0 refused it, 422 VIEW_NOT_ALLOWED_AT_SCOPE,
when a scope was registered under it): it exports the scope's own rows and never walks into the scopes
under it, members' private regions included; export those by name. Elsewhere a private scope under the export's scope
that the export did not start in refuses it 403 POLICY_DENIED.
Bounds: at most 4 exports run at once in a process (429 EXPORT_SATURATED, Retry-After: 1); the buffered response is
at most 256 MiB (413 EXPORT_TOO_LARGE, nothing returned: narrow the scope); the export's database work runs within
CORTEX_EVIDENCE_TIMEOUT_MS (default 120 s).
An export reads stored rows (operator-plane class stored_rows, private_region in a private region): under
CORTEX_OPERATOR_DATA_READS=deny the operator key needs the break-glass header (403 BREAK_GLASS_REQUIRED), and a
private region's notice commits first (503 NOTICE_UNAVAILABLE, §8.15.3). An export is served while the license has
lapsed: it is exempt from the license gate. A cluster ingress does not route it (501 CLUSTER_ROUTE_UNSUPPORTED). Errors
the route answers itself carry no details, but for INVALID_BODY naming a field; since 0.14.0 they carry
request_id.
Errors:
| HTTP | Code | When |
|---|---|---|
| 403 | POLICY_DENIED | A capability, a role (an application the tenant does not admit at a scope included, §8.26: never APP_NOT_ADMITTED), a private scope, or an authorization that changed (above); retriable: false |
| 403 | BREAK_GLASS_REQUIRED | The operator key under deny, without the header |
| 413 | EXPORT_TOO_LARGE | Over 256 MiB |
| 422 | INVALID_BODY | format other than jsonl; a malformed scope; a field the route does not honour (details.field) |
| 429 | EXPORT_SATURATED | 4 exports already run; retriable: true |
| 500 | EXPORT_SERIALIZATION_FAILED | An event could not be serialized; no partial export |
| 503 | DB_UNAVAILABLE, DB_SATURATED | The log or a sealed segment could not be read, or the database lane did not run the work; retriable (since 0.14.0) |
| 503 | NOTICE_UNAVAILABLE | A break-glass read of a private region whose notice did not commit (§8.15.3) |
| 504 | DB_TIMEOUT | The database work ran past CORTEX_EVIDENCE_TIMEOUT_MS; not retriable (since 0.14.0; it was a 503 DB_UNAVAILABLE) |
8.12.2 GET /v1/export/{export_id}
Not served: no route is registered at this path, and a request to it answers 404. An export is answered whole in its
own response, and its export_id names nothing that can be fetched later.
8.13 Blobs
For multimodal content.
8.13.1 POST /v1/blobs — Upload
Capability: blob.upload
The request body is the raw file bytes; Content-Type declares the file's MIME type (e.g. application/pdf). Do not wrap in multipart/form-data — it is rejected with 415 UNSUPPORTED_MEDIA_TYPE. application/json remains a valid MIME for a raw JSON file. The normal v1 request-body ceiling applies (32 MiB by default).
curl -X POST https://api-v1.cortexdb.ai/v1/blobs \
-H "Authorization: Bearer $CORTEX_TOKEN" \
-H "X-Cortex-Actor: $CORTEX_ACTOR" \
-H "Content-Type: application/pdf" \
--data-binary @report.pdf
Response:
{
"blob_id": "blob_01HX...",
"size_bytes": 4823648,
"content_type": "image/png",
"sha256": "..."
}
Reference in an experience envelope via content: {"kind":"blob_ref","blob_id":"blob_01HX..."}.
blob.upload is checked without a scope, so a scopes-confined token needs a blob:* or blob.upload:* entry (§4.7). The bytes go to the blob store, outside the shard, so the upload asks the disk guard itself.
Errors: 403 POLICY_DENIED (no blob.upload); 413 PAYLOAD_TOO_LARGE (over CORTEX_MAX_BODY_BYTES); 415 UNSUPPORTED_MEDIA_TYPE (a multipart body); 503 DISK_FULL (retriable, Retry-After: 30); 503 BLOB_OPERATION_CAPACITY (retriable: all eight detached blob operation slots are busy); 503 BLOB_REGISTRY_ERROR, BLOB_STORE_ERROR and BLOB_OPERATION_FAILED (all retriable). A cluster ingress routes no blob route (501 CLUSTER_ROUTE_UNSUPPORTED).
Text blobs are decoded charset-safely (capability blob_text_decode_v1). When a blob_ref names a text-shaped blob (text/*, application/json, application/xml, …), POST /v1/experience and /v1/experience/bulk inline its text in this order:
- Byte-order mark. A UTF-16LE (
FF FE) or UTF-16BE (FE FF) BOM selects that encoding and is stripped. A UTF-8 BOM selects UTF-8 and is kept as a leading U+FEFF, so the stored text (and the write's idempotency identity) of an existing UTF-8-with-BOM blob does not change. UTF-32 is refused. - Strict UTF-8. Valid UTF-8 is stored byte-for-byte, exactly as before. (A declared
charset=utf-16,utf-16leorutf-16beis applied before this step: BOM-less UTF-16 of ASCII or Devanagari text is also valid UTF-8 and would otherwise be stored NUL-interleaved.) - Declared charset. Otherwise the
charset=parameter of the blob'sContent-Type(matched case-insensitively, quotes allowed, WHATWG encoding labels such aswindows-1252,windows-1256,shift_jis,utf-16le) decodes the bytes, with malformed sequences fatal.
Erasure reaches the blob (capability erasure_blob_cascade_v1, M7; not in v0.9.13). An event whose text came from a blob — a text-shaped blob inlined as above, or a blob sent with a client transcript — carries the server-set source_blob_ids: ["blob_..."] (returned by /v1/events; never accepted from a client, never write identity). Erasing the event with /v1/forget or /v1/erasures deletes the blob once no surviving event links or references it; the response counts it in purge.blobs, and a blob kept for another event in purge.retained_shared_blobs. Transcript events written before M7 name the blob only through their source_blob: label; the operator repair POST /v1/admin/index-audit/source-blob-links links them. Store-by-store coverage: docs/ERASURE_COVERAGE.md.
Bytes none of these can decode faithfully are refused with 422 BLOB_TEXT_ENCODING_UNKNOWN (retriable: false) — they are never stored as U+FFFD replacement text. details carries blob_id, content_type, charset (the declared or BOM-selected encoding, or null) and reason: undeclared_non_utf8 (not UTF-8, no BOM, no charset=), unknown_charset (the label is not a known encoding — ISCII has none), unsupported_charset (a label mapped to the WHATWG replacement encoding), malformed_for_charset (invalid in the declared charset, including charset=utf-8 over non-UTF-8 bytes), malformed_after_bom, or utf32_unsupported. In a bulk request the first such item fails the whole batch, as BLOB_NOT_FOUND does. Fix it by re-uploading with Content-Type: <mime>; charset=<encoding>, or as UTF-8. The upload itself (POST /v1/blobs) is unchanged and never decodes; binary blobs (PDF, images, audio, …) are not affected.
8.13.2 GET /v1/blobs/{blob_id}
Capability: blob.read (checked without a scope)
Returns the raw bytes of a live blob. Content-Type reflects the original. A managed blob is bound at upload to the uploading principal, its billing tenant and actor together: only that principal reads it, and anyone else, the operator key included, gets the 404 an unknown id gets. A blob still being prepared, being deleted or retired, and one whose bytes the store cannot return, answer 404 too. Under CORTEX_OPERATOR_DATA_READS=deny an operator-key read needs X-Cortex-Break-Glass (§8.15.3).
Errors: 403 POLICY_DENIED, 404 NOT_FOUND, 503 BLOB_REGISTRY_ERROR (retriable).
8.13.3 DELETE /v1/blobs/{blob_id}
Capability: blob.upload — authorized by tenant-bound ownership: only the tenant/actor that uploaded the blob may delete it, exactly as for GET. A blob owned by someone else answers 404 (the same answer a read gets — it never confirms the id exists). Legacy metadata with no authoritative tenant binding is available only in trusted-operator mode.
Deletes the stored bytes and retires the record (a tombstone keeps only its lifecycle identity, so a second DELETE answers 404). Unchanged by erasure_blob_cascade_v1: a blob a live event still references is deleted too (no 409). Since M7 a forget of the referencing events already deletes an unshared blob, so a DELETE that follows answers 404, which connectors treat as success.
{ "blob_id": "blob_01HX...", "bytes_deleted": true }
bytes_deleted: false means the metadata was dropped but the backing store already had no object; the end state is the same.
Use this when the source file is deleted upstream. Since erasure_blob_cascade_v1, forgetting or erasing the experiences that reference an uploaded blob also deletes the object once no surviving event links or references it, so the second call below is needed only for a blob another live event still references, or one no experience ever used; after the cascade it answers 404 (already gone). The SDKs' delete_blob(..., missing_ok=True) / deleteBlob(id, { missingOk: true }) treat that 404 as success. The full right-to-be-forgotten sequence over uploaded files is still:
# 1. redact the experience that referenced the file
curl -X POST $CORTEX_URL/v1/forget -H "Authorization: Bearer $CORTEX_TOKEN" \
-H "X-Cortex-Actor: $CORTEX_ACTOR" -H 'Content-Type: application/json' \
-d '{"scope":"user:alice","selector":{"memory_ids":["evt_01HX..."]},"cascade":"redact_events"}'
# 2. purge the bytes
curl -X DELETE $CORTEX_URL/v1/blobs/blob_01HX... \
-H "Authorization: Bearer $CORTEX_TOKEN" -H "X-Cortex-Actor: $CORTEX_ACTOR"
Deleting an unknown or already-deleted id returns 404; the call is safe to retry.
Errors: 403 POLICY_DENIED (no blob.upload, checked without a scope), 404 NOT_FOUND, 503 BLOB_OPERATION_CAPACITY, BLOB_STORE_ERROR (the bytes could not be deleted), BLOB_REGISTRY_ERROR and BLOB_OPERATION_FAILED (all retriable).
8.13.4 Keyed blob protocol — durable connector uploads
Connectors that persist an attachment/source ledger should use the separate keyed surface. The separate path is deliberate: during a heterogeneous rollout an older node returns 404/405 before storing the body, whereas the legacy upload path would ignore an unfamiliar header.
The required X-Cortex-Idempotency-Key is an opaque, case-sensitive token of
1–64 visible ASCII bytes with no whitespace. Persist one fresh random token
for each source incarnation before uploading. Its namespace includes the
authenticated billing tenant, actor, and keyed-blob endpoint family. Reusing
the token for a later incarnation is an error; allocate a fresh token.
Before sending any bytes, probe capability and current state:
GET /v1/blobs/idempotent/status
X-Cortex-Idempotency-Key: 2Rj7xWc-opaque-incarnation-token
Even an unknown token returns 200 with the exact capability marker:
{"protocol":"keyed-blob-v1","found":false,"blob_id":null,"status":"unknown"}
Fail closed without uploading if the request fails or protocol is absent or
different. Then upload at most 32 MiB of raw bytes to
POST /v1/blobs/idempotent with the same header. This keyed-route ceiling is
fixed even if the operator raises the general API body limit. A successful
create or exact replay returns 200 and the same authoritative blob_id:
{
"protocol": "keyed-blob-v1",
"blob_id": "blob_0123456789abcdef0123456789abcdef",
"size_bytes": 12,
"content_type": "text/plain; charset=utf-8",
"sha256": "0000000000000000000000000000000000000000000000000000000000000000"
}
Replay equality covers the exact body bytes and canonical Content-Type. The
server trims optional whitespace, lowercases type/subtype and parameter names,
sorts parameters, lowercases only the charset value, and decodes then
minimally requotes quoted values. Other parameter-value casing is preserved.
Duplicate parameters, malformed/control-bearing MIME, and a missing,
duplicate, or invalid key return 422. Multipart returns 415. Reusing a token
with different bytes or normalized MIME returns 409; a retired token returns
410 and can never recreate bytes.
The status probe reports prepared, live, deleting, or retired for a
known token. The first three include size_bytes, canonical content_type,
and lowercase 64-hex sha256; a retired response intentionally omits those
customer/object fields and retains only the opaque blob_id and lifecycle
state.
If an upload response was lost and the local ledger has no blob_id, delete
by token without resending source bytes:
DELETE /v1/blobs/idempotent
X-Cortex-Idempotency-Key: 2Rj7xWc-opaque-incarnation-token
A found token returns 200, including on repeated deletion:
{
"protocol": "keyed-blob-v1",
"blob_id": "blob_0123456789abcdef0123456789abcdef",
"status": "retired",
"bytes_deleted": false
}
Unknown tokens return 404.
The keyed routes check blob.upload (upload and delete) or blob.read (status), without a scope, before anything else. Every keyed error is the error envelope plus "protocol": "keyed-blob-v1": 422 INVALID_IDEMPOTENCY_KEY, 422 INVALID_CONTENT_TYPE, 415 UNSUPPORTED_MEDIA_TYPE, 409 IDEMPOTENCY_CONFLICT, 410 IDEMPOTENCY_KEY_RETIRED, 413 PAYLOAD_TOO_LARGE (over 32 MiB), 503 BLOB_IDEMPOTENCY_UNAVAILABLE (not retriable: a cluster data node), and the retriable 503 DISK_FULL (upload), BLOB_OPERATION_CAPACITY, BLOB_REGISTRY_ERROR, BLOB_STORE_ERROR and BLOB_OPERATION_FAILED (resend with the same key).
The keyed surface is single-node only: a cluster
ingress (cortexdb node, docs/generated/cluster.md) answers every blob route
501 CLUSTER_ROUTE_UNSUPPORTED, because this release has no replicated blob
registry and no designated-ingress opt-in. Legacy
POST /v1/blobs remains available and continues to allocate a fresh ID even
when the new header is present.
After admission, upload and deletion work owns a bounded server operation
slot and continues if the HTTP client disconnects; the server does not abort
an in-flight object-store request on a handler timeout. A process crash leaves
a durable prepared or deleting work item. Startup drains deletions before
publishing the API and reconciles exact prepared objects; a bounded background
pass catches a remote PUT that completed after the process exited.
The local-filesystem backend has no write that can continue after its process
has exited. A remote object-store provider, however, can theoretically finish
a request after the client process has died. The registry will adopt that
exact object while the token remains prepared, but the generic
object_store API cannot transactionally fence a provider-side late PUT
against a token DELETE issued after restart. Deployments requiring a formal
privacy proof for that extreme cloud failure window must additionally use
provider-side object versioning/lifecycle or an audited single-writer storage
gateway; this release does not claim such a distributed storage transaction.
8.14 Vocabularies
Vocabularies and temporal phrases (§8.17) are rows of the replicated event log:
every create, update and delete is a log proposal. A record that encodes above
the 4 MiB log command limit is 413 WAL_TOO_LARGE (retriable: false), a
proposal the log refused or lost is 503 NOT_LEADER / WAL_UNAVAILABLE /
WAL_OUTCOME_UNKNOWN (retriable: true; re-read after
WAL_OUTCOME_UNKNOWN, the write may have landed), and a read that fails on
storage is 500 TENANT_MAP_STORAGE.
A put is refused while a disk is critical (503 DISK_FULL, retriable, Retry-After: 30); a delete never is. Both capabilities are checked without a scope, so a scopes-confined token needs a vocabulary:* entry (or vocabulary.read:* / vocabulary.write:*; §4.7); without the capability every route is 403 POLICY_DENIED. A cluster ingress routes none of these routes (501 CLUSTER_ROUTE_UNSUPPORTED), and a clustered shard refuses the records at apply (503 TENANT_MAPS_UNSUPPORTED, not retriable).
Namespace. With membership enforced (signed tokens on a server that enforces rosters) a record belongs to the verified caller's billing tenant and actor, which the server stamps as billing_id and owner whatever the body says. The operator key and an auth-disabled server use the shared unbound namespace, which never sees a tenant's records. A name held in another namespace is invisible: a read, patch or delete of it is 404 NOT_FOUND, exactly as for an absent name.
The record (Vocabulary) denies unknown fields at every level (422 INVALID_BODY): name (required), description, scope (a scope path the record is declared for; only the ?scope= filter reads it), terms (id, alias term; label, category, definition, aliases, active (default true), valid_from, valid_to, replaced_by), predicates (id, datatype required; name, definition, aliases, values) and relations (id, description). A name over 256 characters is 422 INVALID_BODY (on PUT, the path's name, which replaces the body's). Nothing else is validated.
8.14.1 POST /v1/vocabularies
Capability: vocabulary.write
Stores the record, replacing one of the same name in the caller's namespace, and answers 201 with the stored record echoed verbatim. The record is a stored list for clients: nothing in the extraction path reads it (§7.3.1).
8.14.2 GET /v1/vocabularies/{name}
Capability: vocabulary.read
200 with the record. GET /v1/vocabularies lists the caller's records, {"items": [...]} sorted by name, narrowed by ?scope= to the records whose scope equals it exactly.
8.14.3 PUT /v1/vocabularies/{name}
Capability: vocabulary.write
Creates or replaces the record whole and answers 200 with it. The path's name overwrites the body's, but the body must still carry a name field.
8.14.4 PATCH /v1/vocabularies/{name}
Capability: vocabulary.write
A shallow merge into the stored record: description and scope replace when present; each entry of terms, predicates and relations replaces the stored entry with the same id or is appended. Nothing is removed (deprecate a term with active: false), and a patch never moves a record between namespaces. Unknown fields are 422; 404 when the record is not in the caller's namespace; 200 with the merged record.
8.14.5 DELETE /v1/vocabularies/{name}
Capability: vocabulary.write
204, or 404 NOT_FOUND when the caller's namespace holds no record of that name.
8.15 Admin (existing surface, retained)
Readiness is not application success. GET /v1/admin/ready answers 200 once
the process and its storage answer: before the embedding provider has ever
worked, and before any write was indexed. Since 0.12.2 its body says which
stages are proven, in setup, and says at top level when embeddings fail:
{
"ready": true,
"provider_failing": false,
"setup": {
"installed": true,
"licensed": "active",
"provider": "untested",
"application": "untested",
"summary": "installed; the embedding provider is not proven yet (write once, or ask GET /v1/admin/ready?deep=1)"
},
"checks": { "…": "…" }
}
provider is ok (a real call succeeded and the last one did), failing
(the last call failed: writes are not indexed, recall is degraded), untested
or mock. application is ok once a write was indexed and a recall
answered 200 since start. ?deep=1 makes one real embedding call (at most
15 s) first, so provider is ok or failing and setup.provider_probe
gives the outcome; it is billable on a hosted provider, so leave it off for a
load balancer.
The HTTP status keeps its meaning (storage), so a health check built on it is
unaffected: ready is false, and the status 503 with the same body, only when
checks.data_dir_writable fails (the data dir refused a probe file), when
checks.storage fails (the storage probe could not run within
CORTEX_EVIDENCE_TIMEOUT_MS, default 120 s), on a native memory host while
native_memory is withdrawn, when checks.local_embedding fails (a transformer's pool with no
live worker), or, under the voice profile (CORTEX_PROFILE=voice, docs/VOICE_MODE.md), while
checks.voice fails: its warm-up, for at most CORTEX_VOICE_READY_WAIT_SECS (60) after the
process started. degraded is true, with ready unchanged, when the corpus is pinned to mock
embeddings, when the last embedding call failed, while the disk guard refuses writes, or while voice
mode's warm-up runs past that wait (checks.voice.state: "warming"). No credential is taken and the license gate
never refuses the route; GET /v1/ready is the same handler. A cluster ingress
answers it itself: {"ready", "role": "ingress", "checks": {"catalog": {"ok", "revision", "incarnation"}}}, ready once it holds the cluster catalog.
| Check | Present | ok is false when | Other fields |
|---|---|---|---|
data_dir_writable | always | the probe file cannot be written (no data dir registered counts as ok) | detail |
storage | always | the storage probe did not run in time | detail (wal_events=…, vectors=…) |
enrichment | always | boot reported no mode (enrichment off reads ok) | enabled, mode, detail |
content_processors | always | none is configured, or none was reported | configured, detail |
answer | always | boot reported nothing | configured, stub, model, detail |
commitments | always | boot reported nothing | mounted, reason, posture, expired, detail |
embeddings | always | pinned to mock embeddings, or the last call failed | mock, unproven, ok_count, fail_count, last_success_ms, last_failure_ms, last_error, detail |
disk | when a disk guard runs | the disk is critical (new writes answer 503 DISK_FULL) | level, used_percent, refusing_writes, detail |
local_embedding | where the in-process embedder (CORTEX_EMBEDDING_PROVIDER=local) loaded a model | a transformer's query or write pool has no live worker, so every embedding fails until the server restarts (a model that does not load refuses the start, exit 78; this one was verified, loaded and run on its warm-up texts before the server bound) | model, kind (static or transformer), precision, dims, pin (the vector space: local:<model id>@<source revision>:<dims>:<precision>), build (model_sha256, tokenizer_sha256, library_sha256, runtime, arch, cpu: what the data dir's canary holds to the pin), runtime, source_repo, source_revision, licence, models_dir, not_shipped (what differs from the files this release ships; empty when they are its own), load_ms, warm_up_runs, warm_up_ms, query_workers, write_workers, workers_basis, table_bytes, resident_bytes (the memory the load added), physical_cores, health (a transformer's live workers, null for a static model), detail |
voice | under the voice profile | for at most CORTEX_VOICE_READY_WAIT_SECS (60; 0 never waits) after the process started (state: "starting"), while the scope-partition map is still building (a log past 250,000 entries builds it on a thread after boot, a smaller one before the server binds; until then descendant listings and cold-tier vector scans come back empty) or a pinned scope's first load (CORTEX_VOICE_PINNED_SCOPES, §8.3.3) is still running. Past the wait it is ok and the probe answers 200 with degraded: true (state: "warming") until the warm-up lands (state: "ready"), so the image's healthcheck and the one-click updater never read a long build as an unhealthy node. A pinned scope whose load ended without a working set (too large, failed, refused while memory was high) has finished: its recalls take the index path, and pinned gives its state | state (starting, warming or ready), wait_s, waited_s (seconds since the start), profile (voice), scope_partition_map (building or built), pinned_scopes (none, loading or loaded: every first load has finished), pinned (each pinned scope's scope, state, events, bytes), detail |
Only data_dir_writable, storage and local_embedding, and under the voice profile voice,
decide ready; the rest report. local_embedding and voice (voice mode) are absent where they do not apply, so
every other deployment's body keeps its key set.
| Endpoint | Capability | Purpose |
|---|---|---|
GET /v1/admin/health (alias GET /v1/health) | (open) | Liveness only: {"status": "healthy", "version"}, 200 while the process is up; it proves neither storage nor providers |
GET /v1/admin/ready (alias GET /v1/ready) | (open) | Readiness probe; setup names what is proven (above) |
GET /v1/admin/metrics | trusted operator + diagnostics.read | Process-global JSON metrics. A cluster ingress serves its own to the operator key alone (Authorization: Bearer <static key>): 401 MISSING_TOKEN without a bearer, 403 POLICY_DENIED for any other credential or on an ingress whose config names no key. An ingress-only node may carry [auth] with api_key_file alone (minter_key_dir and issuers_file are refused there); without it its metrics are served to no one (boot warns INGRESS_METRICS_UNKEYED) |
GET /v1/admin/layers/stats | trusted operator + diagnostics.read | Process-global layer counts, health, queues, and provider state |
POST /v1/admin/compaction/dedup | trusted operator + admin.compact | Trigger process-global dedup compaction |
POST /v1/admin/persist | trusted operator + admin.flush | Persist process-global snapshots |
POST /v1/admin/index-audit | trusted operator + (diagnostics.read for report / admin.compact for repair) | Audit the search indexes (BM25, and with vectors the chunk vectors) against the event log, and with repair rebuild what is missing (§8.15.5.3) |
POST /v1/admin/index-audit/reinclude | trusted operator | Bring a 502 INDEXING_FAILED event back into recall under its own id ({"event_id": "evt_...", "scope": "..."}): lifts the indexer's exclusion and indexes it in place; one that fails again stays excluded (502 INDEXING_FAILED, or 503 INDEXING_UNAVAILABLE while its embedding provider is down). 404 outside scope; 409 EVENT_NOT_EXCLUDED, EVENT_CANCELLED (a writer's cancel is never undone) or REINCLUDE_UNSUPPORTED (a cluster data node; the ingress does not route it) |
POST /v1/admin/vector-hygiene | trusted operator + (diagnostics.read for report / admin.compact for repair) | Audit/remove process-global orphan vectors |
POST /v1/admin/reembed | trusted operator (+ admin.compact to start) | The online re-embed: the plan of moving every vector index to another embedding model (the default dry run: rows, estimate, blockers), or the start of a job that builds them beside the live ones while they serve, for the restart that configures the target to swap in (§8.15.8) |
GET /v1/admin/reembed | trusted operator | The current or last re-embed job: state, progress, rate, pauses, the swap's checks (§8.15.8) |
POST /v1/admin/reembed/cancel, POST /v1/admin/reembed/cleanup | trusted operator + admin.compact | Cancel a building or ready job, its copies deleted; delete the old index a swap kept (§8.15.8) |
GET /v1/admin/ice/status | trusted operator + diagnostics.read | The segment store (docs/ICE_TIER_PLAN.md, step 3): its settings, what the log's segment manifests hold, the caches and reads, the owner record, the archiver's passes and the data disk's outlook (hours_to_critical at the last hour's growth); 409 ICE_OFF while CORTEX_ICE_URL is unset |
POST /v1/admin/ice/seal | trusted operator + admin.compact | Seal old events into segments now, whatever the disk ({"root": "org:acme", "max_segments": n}, both optional; the archiver does it on its own while the disk is above CORTEX_ICE_TARGET_PERCENT); the hot window, the indexer's floor and enrichment still apply |
POST /v1/admin/ice/owner | trusted operator + admin.compact | Settle an owner conflict ({"action": "adopt"} when the server that owned the ice location is gone for good, {"action": "fork"} to keep both running, this one writing under its own prefix): a server that finds another owner deletes nothing there until then |
GET /v1/admin/compile-dead-letter | trusted operator + diagnostics.read | Process-global parked compile sessions and failure reasons |
POST /v1/admin/scopes/migrate, GET /v1/admin/scopes/migrate/{id} | trusted operator + admin.compact | Run/poll process-global scope migration jobs |
GET /v1/admin/retention | trusted operator + diagnostics.read | Retention config, every durable per-scope rule, sweep cursor + fingerprint, last tick, totals, unified-log census |
GET /v1/admin/retention/policies?scope= | trusted operator + diagnostics.read | Read the rule stored for exactly one scope, plus its inherited effective_days and effective_mode |
PUT /v1/admin/retention/policies | trusted operator + admin.compact | Store/replace one scope's retention rule, its mode keep_learned (the default for a new rule) or erase (resets the sweep cursor) |
DELETE /v1/admin/retention/policies?scope= | trusted operator + admin.compact | Remove one scope's retention rule (resets the sweep cursor) |
POST /v1/admin/retention/sweep | trusted operator + (diagnostics.read for the default dry run / admin.compact to apply) | Run one retention tick: report, or erase expired captured events |
GET /v1/admin/wal?verify=true | trusted operator + diagnostics.read | Unified-WAL census, optionally with the bounded row-level self-check (bounded at 1M rows / 512 MiB — see §8.15.1) |
POST /v1/admin/wal/compact | trusted operator + (diagnostics.read for the default dry run / admin.compact to apply) | Reclaim already-dead unified-WAL rows (redaction tombstones, orphaned Derived twins) |
GET /v1/admin/events/{id}/chunks | trusted operator + diagnostics.read | The chunks one event was indexed as (plan A1-M): chunk ids (chunk 0 reuses the event's UUID), each chunk's index text (section header included, exactly what BM25 and the vector were built from), text_bytes / text_chars, vector (the chunk has a vector row), chunker_version, and fragment: stored (M8 byte offsets, with byte_range, locator, text_source, language, scripts, blob_id), implicit (a single-chunk event: byte_range is the whole stored text) or none (written before M8). Confined to the caller's billing tenant and to an event whose own scope the caller may read; an unknown, foreign, erased or cancelled id is the same 404 |
POST /v1/admin/derived/rederive | trusted operator + admin.compact | Plan (default dry run) or run a re-derivation job over flagged events: revert flagged supersessions (and those the job re-decides), purge and re-enrich their derived rows, reconsolidate, rebuild the affected belief topics (§8.15.2) |
GET /v1/admin/derived/rederive/{job_id} | trusted operator + diagnostics.read | Read a re-derivation job record (§8.15.2) |
POST /v1/admin/cohort/warm | trusted operator; CORTEX_COHORT on (else 409) | Body {"scope": "org:acme", "subject_level": "child"}: start (or join) the background build of that scope's in-memory cohort projection and return its state at once (202, never waits). A build requested while the build queue is full answers 503 COHORT_WARMING. CORTEX_COHORT_WARM_ROOTS does the same for named scopes at boot. §8.4.3 |
GET /v1/admin/cohort/status | trusted operator | Served whatever the flags say: cohort_enabled, subtree_recall, planner, parent_sample_warning, the effective numeric knobs (config, by environment name), the resident projections (resident[]: root, subject level, state building / ready / repairing / failed, rows, subjects, as_of, bytes_estimate) and the counters (builds, full_rebuilds_unscoped, subject_repairs, catch_ups, refused_too_large, warming_refusals, builds_skipped, budget_evictions) |
POST /v1/admin/derived/resolver/unmerge | trusted operator + admin.compact | Report (default dry run) or split names the entity resolver merged, such as Priya into Riya (§8.15.2) |
GET /v1/admin/version | (open) | Build info, plus capabilities[]: the sorted API-shape names this binary accepts, evaluated per request. In 0.14.0 these are the 48 names access_changesets_v1, access_check_v1, access_limits_v1, access_lookup_v1, access_notices_v1, access_report_v1, access_watch_v1, app_records_v1, authzen_v1, beliefs_merged_v1, blob_text_decode_v1, budget_excerpt_v1, capture_language_v1, confinement_wildcard_v1, consistency_tokens_v1, directory_v1, enrich_backfill_v1, erasure_blob_cascade_v1, erasure_early_answer_v1, event_scope_filter_v1, extra_scopes_40_v1, extra_scopes_v1, forget_by_key_v1, matched_fragments_v1, mcp_http_v1, memory_kinds_v1, mint_chain_v1, operator_break_glass_v1, org_tree_v1, party_erasure_v1, person_erasure_v1, principal_chain_v1, publish_v1, query_variants_v1, read_purpose_v1, recall_coverage_v1, recall_diagnostics_v1, recall_language_v1, recall_mounts_v1, refers_to_v1, rollups_v1, scim_v1, source_containers_v1, subject_token_shadow_v1, temporal_lenient_v1, tenant_access_settings_v1, tenant_erasure_v1 and write_provenance_v1; 0.15.0 adds derivation_provenance_v1 (include=derivation on the fact and belief reads, §7.4.3; GET /v1/derivation/decisions, §8.7.22; the extraction block of GET /v1/derivation/status, §8.7.12; a format-10 name, whose decisions route answers 503 FORMAT_UPGRADE_PENDING on a shard armed below 10), derivation_feed_v1 (the change feed, GET /v1/derivation/feed, §8.7.23; its route answers 503 FORMAT_UPGRADE_PENDING on a shard armed below 10, and from format 11 records a request's consumer mark, which an erasure's receipt names in feed_consumers, and which GET /v1/derivation/feed/consumers lists, §8.7.28), derived_by_v1 (the write-back stamp on typed triples and declared beliefs, §3.5.3, §8.7.15; its report on GET /v1/derivation/status, §8.7.12; the importers' own stamp, §15), corrections_v1 (/v1/corrections* and GET /v1/memory/about, §8.7.24 and §8.7.25; conflict resolution as corrections, §8.7.21; a format-11 name, whose correction routes answer 503 FORMAT_UPGRADE_PENDING on a shard armed below 11), derivation_policy_v1 (derivation policies: derive records in change sets, §8.22.7; GET /v1/derivation/policy, templates, taxonomy, subject settings and policy texts, §8.32; the policy test, POST /v1/derivation/policy/test, §8.32.6, from format 10; a format-11 name, whose settings, texts and change-set records answer 503 FORMAT_UPGRADE_PENDING on a shard armed below 11, where the policy read answers the empty policy with format_armed), declared_episodes_v1 (POST /v1/episodes and DELETE /v1/episodes/{id}, §8.7.26; a format-11 name, whose routes answer 503 FORMAT_UPGRADE_PENDING on a shard armed below 11), derivation_use_rules_v1 (the read-time use rule: session on /v1/recall, /v1/recall/stream, /v1/answer and /v1/compose, and on the /mcp recall tool, §8.32.5; a format-11 name: below 11 no derive record can hold a rule, and session is accepted and ignored), derivation_review_v1 (review before commit: GET /v1/review and POST /v1/review/decisions, §8.7.27, the lifecycle event derivation_held, §13, and include=held on GET /v1/memory/about; a format-11 name, whose routes answer 503 FORMAT_UPGRADE_PENDING on a shard armed below 11) and derivation_rederive_v1 (re-derivation: POST /v1/derivation/rederive, its job's GET and cancel, §8.32.7; GET /v1/derivation/report, §8.32.8; the governance block of GET /v1/derivation/status, §8.7.12; an undo's re-extraction of what the gate dropped under a correction, §8.7.24; a format-11 name, whose routes answer 503 FORMAT_UPGRADE_PENDING on a shard armed below 11); voice mode adds recall_profile_voice_v1 (profile, alpha and server_timing on /v1/recall and /v1/recall/stream, §8.3: the short read path of a live voice turn, the fusion weight and the Server-Timing header; listed on every deployment, voice mode or not, and on a cluster ingress once every data node lists it); M6's fact_surface_v1 is known but not advertised yet (§7.3.0), and so are 0.10.4's cohort_query_v1 (§8.4.2, §8.4.3) and subtree_recall_v1 (§8.3.1): their fields and routes are served while their flags are on, but a client must detect them as §8.4.2 "Detecting support" says, not from this list. Two names depend on an operator switch: budget_excerpt_v1 is withheld while CORTEX_RECALL_BUDGET_EXCERPTS is 0, off or false (since 0.10.2; the server then renders contexts as 0.10.0 did), and the flag-gated mcp_http_v1 (0.14.0, §8.31) while CORTEX_MCP is off; a cluster ingress never lists mcp_http_v1. Every other name is listed whatever the switches say. A native memory host leaves capabilities out. Clients gate new fields on this list, never on version |
GET /v1/admin/layers/stats health section (extended in v0.8.14 — the
layer-observability asks from the vault-migration report; every field: §8.15.5.1):
llm_roles separates the LLM roles (enrichment_extraction, artifact_compilation,
which shares its router, recall_expansion_and_synthesis, answers, verifier) with
per-role configured/model, and entity_extraction, which is the enrichment
pipeline's LLM extraction: with enrichment off it is configured: false and the entity
graph receives no new entities; layer_sources gives every layer its derivation source and current
gate (events: raw, episodes: raw_derived_no_llm,
facts: llm_extracted_plus_deterministic_triples with status
deterministic_triples_only when no enrichment model is set — which is why
a text-only backfill adds no facts, beliefs: derived_from_facts_no_llm,
concepts: llm_synthesized with the spend gate); and
enrichment_backlog_stalled (+ note) flags the deferred-scanner backlog
that can never drain because CORTEX_ENRICHMENT_MODEL is unset.
Since 0.10.4 llm_roles.enrichment_extraction.model (and
artifact_compilation.model, which shares the router) is the model the
running enrichment router was built with at startup, not whatever
CORTEX_ENRICHMENT_MODEL says now: the Settings page writes the new value
before the restart that loads it. When the two differ the role also carries
pending_restart, the configured model a restart would load (null when it
was cleared). With CORTEX_ENRICHMENT_SCOPE_PREFIXES set the role carries
scope_prefixes (the scope subtrees enrichment may touch) and
scope_events_skipped (captures the allowlist kept out of enrichment since
start); without it neither key is present.
GET /v1/admin/layers/stats belief_reconcile (0.10.1; not in v0.9.13): the incremental belief
rebuild still queued, for deployments with CORTEX_V1_LAYERS_INCREMENTAL.
seeded_topics is what the startup reconcile queued (null until the
scheduler has seeded it), dirty_scopes / dirty_topics what is still
queued, tick_in_progress whether a tick is building right now,
max_topics_per_scope_per_tick the pacing cap (2,000) and done whether the
seeded reconcile has finished: seeded, nothing queued, no tick building. A
tick drains at most 2,000 topics per scope and embeds one rebuilt belief per
call, so on a scope with more topics than that the reconcile takes several
ticks, and global.ticks_total >= 1 does not mean it is finished; done
does. It turns false again while new fact writes queue topics. Without
incremental layers incremental is false and done is always false.
Three cases where done is not the signal: the seeding (and the D0b sweep)
runs in the auto-layer scheduler, so with CORTEX_V1_LAYERS_AUTO off
nothing is seeded, seeded_topics stays null and done never turns
true (rebuild with POST /v1/beliefs/build per scope); the reconcile
seeds every scope that has facts but the tick skips scopes matching
CORTEX_V1_LAYERS_AUTO_EXCLUDE_SCOPES, so their topics stay queued and
done never turns true (wait for dirty_topics to stop falling, and
build the excluded scopes by hand: the sweep removed their keyless
beliefs); and a tick drains a scope's topics before building them, so a
build that fails drops them and done still turns true. The last shows
only as a growing by_scope.<scope>.belief_errors_total. On a cluster data
node only the shard's leader builds layers: a follower seeds its reconcile but
never drains it, so read done on the leader (a cluster ingress answers this
route 501 CLUSTER_ROUTE_UNSUPPORTED). Built beliefs and built episodes are
the node's that built them and are not replicated: after a leader failover the
new leader serves none until a build runs there, POST /v1/beliefs/build or
POST /v1/episodes/build per scope or, under CORTEX_V1_LAYERS_AUTO, the
auto-layer scheduler's rebuild on the new leader (a known limitation of 0.14.0;
a declared belief on a shard armed for format 10 is replicated, §8.7.15; a
root moved to another shard is rebuilt on its target).
POST /v1/admin/scopes/migrate (v0.8.13) — the scope migration/merge
workflow: applications that change their memory model (e.g. per-source
scopes user:x/source:chatgpt folding into one root user:x) get a
first-class copy/move instead of hand-rolled re-sync scripts. Body:
{ "from": "user:x/source:chatgpt", "to": "user:x",
"mode": "copy", // or "move"
"dry_run": false,
"batch_size": 100,
"confirm_erase_source": false }
Returns 202 {job_id, status: "running", status_url}; poll GET /v1/admin/scopes/migrate/{job_id}
(job records are process-local and lost at restart, like erasure jobs).
Since 0.14.0 a migration copies the events of from's whole subtree to the same relative paths under to
(user:x/source:chatgpt/conv:1 into user:x lands at user:x/conv:1), through the write pipeline: each copy is a
capture of the log (bulk Capture, as an import writes), so /v1/export, retention, every erasure and a rebuild of
the views reach it on every replica. A copy keeps its source's content, observed actor and subject, writer
(caller) and billing tenant, observed_at, the source's recorded_at as context.source_recorded_at, labels,
intent, location, timezone, refers_to, extract directive, a typed language hint, linked blobs
(source_blob_ids) and lineage (atoms, provenance); a preceded_by naming an event the run copied names its
copy. Its id and recorded_at are its own capture's. Copied: the live rows and the sealed ones a reader is served;
a redacted, an excluded (cancelled or failed to index) or a tombstoned row is counted in report.skipped, never
copied. Each copy's idempotency key is a digest of its target scope and its source event (migrate-<48 hex>,
endpoint family /v1/admin/scopes/migrate), so a run again replays what an earlier one copied
(report.already_copied) and never duplicates. mode: "move" (with confirm_erase_source: true) first fences
writes under from on the node that runs it (a write there is refused until the move ends) and waits out the writes
in flight, copies, reads the source again and erases it only when every event copied and the source is the one it
copied: through a whole-scope erasure job run as POST /v1/erasures runs one, with its gdpr audit row and its
durable receipt (erasure.erasure_id, erasure.receipt_url, erasure.verify_url), the source's rows and
idempotency claims gone with it. A move erases the source's whole subtree, its expired markers, its sealed events
and what was learned from them, as any scope erasure does.
Each batch of copies is captured within the writer admission an import's batch takes, for the copies' writer and
authorized by the operator (no role at the target is asked of the writer): a scope type the deployment allows, no
marker, companion, record-only or tombstoned path, nothing registered under a shared org-tree scope or below a
record that admits no new children, and a fence over the target (a tenant's deletion, a move of it) refuses the
batch. A new target scope is registered as a first write registers it: the copies' writer its Owner, bound to their
billing tenant, or under CORTEX_OPERATOR_INHERIT_TENANT=on to the governing record's. A refused batch fails its
copies (report.failed, the refusal in report.errors), and a move then erases nothing.
Requires trusted-operator access plus admin.compact; a migration whose source or target is in a private region or
holds one below it, or whose target is a shared org-tree scope, is an in-band path (§8.15.3). On a cluster the
ingress routes the start by the roots of from and to (422 CROSS_SHARD_REQUEST when they lie on different
shards) and the job read by ?scope=. Every field and error: §8.15.5.8.
POST /v1/admin/index-audit body: {"repair": bool, "scope": "user:...", "vectors": bool},
all optional. The endpoint is restricted to trusted operators because its
report and repair state are process-global. repair=false (default) reports events whose search-index
entries are missing; repair=true re-indexes them — since v0.8.7 this
includes rebuilding missing content-store rows from the WAL event content
(previously such events were unrepairable: "content row missing; cannot
repair from stored state"). scope restricts the audit and the repair to
one scope subtree (exact or descendant); before v0.8.7 it was accepted and
silently ignored (repair always ran globally). Caveat: if a failed bulk
batch was already re-sent under fresh events (pre-v0.8.7 behavior),
repairing its stranded originals re-indexes duplicate content — erase those
scopes first.
vectors (default false, since v0.8.21) widens the membership test to the
VECTOR index. The default check is BM25-only on purpose: a cold-tier demotion
removes the in-memory graph node while the vector stays intact and searchable,
so treating "not in the graph" as missing would flag healthy consolidated data.
With vectors: true the audit asks whether a stored row exists in either
tier, which separates "demoted" from "truly gone" — the state an embedding
outage leaves behind, since the fulltext document is written whether or not
embedding succeeded. Such events stay keyword-findable but are invisible to
semantic recall, and nothing else reports them. The counts are separate:
missing_vectors / missing_vectors_total / vectors_repaired alongside the
fulltext missing / missing_total / repaired, so existing consumers read
unchanged. With repair: true the lost vectors are re-embedded from stored
content — so fix a broken embedding key BEFORE repairing, or every chunk lands
in vector_repair_skipped instead.
GET /v1/admin/layers/stats is restricted to trusted operators because its
scheduler, enrichment, provider-health, vector, artifact, and bi-temporal
counters are process-global; diagnostics.read is also required.
8.15.1 Retention and the unified WAL
Retention runs on the event log, which since 0.11.0 is the replicated shard
log (a legacy dual-WAL data dir no longer starts: exit 78
LEGACY_WAL_RETIRED, migrate it offline with cortexdb migrate-unified-wal).
Retention rules are rows of that log too. A store that carries the
native-host profile answers 503 RETENTION_NATIVE_PROFILE_REQUIRED: its rows
belong to an independently admitted host. A rule write whose log proposal was
refused or lost answers 503 NOT_LEADER, WAL_UNAVAILABLE or
WAL_OUTCOME_UNKNOWN (retriable; on a cluster data node also the shard's own
refusals, each by its own flag, such as SCOPE_NOT_OWNED or STALE_EPOCH while the root moves, both retriable); a
rule that encodes above the 4 MiB log command limit is 413 WAL_TOO_LARGE.
An applying tick on the shard's leader answers none of them: a scope whose expiry proposal is
refused or lost is one line of the report's errors, the tick reports
stopped: "backend_error", and the cursor stays at that scope's first row,
so the next tick drives it again.
On a cluster the ingress sends GET, PUT and DELETE /v1/admin/retention/policies to the leader of the shard that holds the
scope's root (by the body's scope for PUT, by ?scope= otherwise); each
shard stores the rules of its own roots. GET /v1/admin/retention,
POST /v1/admin/retention/sweep, GET /v1/admin/wal and
POST /v1/admin/wal/compact are per node: the ingress answers them 501 CLUSTER_ROUTE_UNSUPPORTED, and the operator reaches a data node with
cortexdb admin node call. A data node's scheduled sweep runs on its
shard's leader.
A rule's mode says what an expired event loses. Under erase, the
meaning every rule had before modes existed, an applied sweep runs the same
erasure plane POST /v1/forget runs — the event, its chunks, its BM25
documents, its vectors, its graph tombstones, its derived
facts/beliefs/episodes/concepts and its blobs (when the pass removes their last
reference) all go, and the event's row is deleted from the event log through
the log's Erase command. Under keep_learned only the raw data goes: the
event's row, its coordinator copy, chunks, text, vectors, full-text documents,
session fragments and blobs, as for an erasure; what was learned from it
(facts, beliefs, concepts, episodes, compiled artifacts and their vectors)
stays, and keeps citing the event, which reads as expired. An expired
marker (scope, capture time, source: labels, expiry time) takes the row's
place in the event log, so the event's id is never reused and a later erasure
still finds what was learned from it (docs/ICE_TIER_PLAN.md, step 2).
Neither mode can be undone. Two consequences follow directly:
dry_rundefaults to true on both mutating routes. A report costs onlydiagnostics.read; applying needsadmin.compact.- TTLs count from the server-stamped
context.recorded_atof the captured envelope, never from a caller-suppliedobserved_at.
Rules are stored per scope path and inherited by shortest TTL: the
candidates are the scope and every ancestor of it, and the smallest finite
value among them wins, so a tighter rule anywhere on the path always shortens
and never lengthens. Modes inherit the same way: every rule on the path with a
finite TTL for the event votes, and erase wins over keep_learned, so
an event under both expires at the shortest TTL and loses everything. A rule
written through PUT /v1/admin/retention/policies without a mode is stored
as keep_learned; a rule stored before modes existed, and the deployment
default, mean erase unless CORTEX_RETENTION_DEFAULT_MODE=keep_learned. A
keep_learned rule is a one-way upgrade: its log entries are apply format 6,
which a 0.11.0 binary refuses. A cluster data node takes the mode as a single
node does: its shard's leader learns once and replicates what it learned
(ice step 4.1), so a detach keeps the same facts on every replica. A rule with no default_retention_days and no
per_source_days is an explicit keep: it overrides the deployment default
(CORTEX_RETENTION_DEFAULT_DAYS) for its subtree. With no rule anywhere on
the path, the deployment default applies; with no deployment default either,
nothing expires. per_source_days keys are source:<system> labels (at most
128 bytes, no whitespace) and are finite days only — a per-source override
cannot mean "keep". Days run from 1 to 36,500; any other value, or a malformed
key, is 422 INVALID_RETENTION_POLICY.
Expired rows left alone are reported rather than silently skipped: rows under
an active legal hold of the governance store (held.legal_hold), rows at
or above the indexer watermark (held.unindexed) — an un-indexed ack is
not yet held by the store, so it is never a retention candidate — and, on a
cluster data node, rows of a root the shard does not serve right now because
it is moving in or out (held.inactive, not counted in expired; the cursor
stays at the first of them). A row under a legal hold is decided again on the
next rescan or rule change. Since 0.14.0 the registry's legal hold records
(DB-26) bind retention too: an expiry in either mode leaves the events a hold
keeps (its scopes, or a person it names whose window covers the capture
time), and what was derived from them, in place, and records no pending held
erasure. They count in expired and in held.legal_hold, as a governance
hold's do. Their TTL class's cursor passes them (one cursor per TTL, below),
and the class keeps the first of them as its held floor (the Derived log's
retention:ttl:<days>:held consumer offset, which GET /v1/admin/wal lists
once a hold has kept a row of the class). The first tick after a change to the
record of a hold that kept rows (and the first tick of a restarted process)
starts that class's pass again at its held floor, rescan: true, and decides
each row by the holds as they are then:
what nothing keeps any more expires by the rules, with no rescan or rule
change asked. A hold's window ending releases nothing; only a change to its
record does. A hold the erasure's own fenced read finds placed since the scan
keeps its rows the same way, counted in held.legal_hold. On a shard armed
for format 9 an erase expiry also deletes the agent writes made from the
events it erases (their provenance), wherever they are homed.
Distill before expiry. With enrichment on (CORTEX_ENRICHMENT_DELAY_SECONDS)
a keep_learned rule does not drop an event nothing was learned from yet: the
sweep queues it for enrichment, through the re-derivation queue, and holds it
(held.distilling, the cursor stays at the first held row) until its
enrichment ends, learned from or dead-lettered, then detaches it. The queue is
bounded per UTC day by an estimated spend (CORTEX_RETENTION_DISTILL_BUDGET_USD,
default 5, at the price book's rate for the enrichment model, about 2,500 input
and 450 output tokens an event) and by a count
(CORTEX_RETENTION_DISTILL_MAX_EVENTS, default 5,000, the only cap for an
unpriced model), both kept in the Derived log's consumer offsets so a restart
does not reopen the day. An event held for
CORTEX_RETENTION_DISTILL_MAX_HOLD_DAYS (default 7), counted from the tick that
first held it in this process, is detached unlearned. distill in the report
counts what was queued, what is waiting, what went unlearned and today's
estimated spend_today_usd. CORTEX_RETENTION_DISTILL=off detaches at once.
With enrichment off nothing is learned from new events, so for them a
keep_learned rule acts as erase (only what earlier enrichment learned
stays); the rule's PUT answer says so in warnings
(keep_learned_without_enrichment). A detach waits while a re-derivation job
holds the event's root (held.rederive), and a job asked to start meanwhile is
refused (409 REDERIVE_IN_PROGRESS, details.job_id: "retention_sweep").
What reads and erasures make of an expired event. Recall keeps the facts,
beliefs, episodes and concepts citing it; an answer whose pack holds no events
cites its facts (layer: "fact", markers [F1]...) and beliefs ("belief",
[B1]...); GET /v1/beliefs/why shows the source as kind: "expired";
GET /v1/events/{id}?scope= answers 410 EVENT_EXPIRED (with details.scope,
recorded_at, expired_at) to a caller who may read the event's scope, and
the same 404 as for an unknown id otherwise (an event sealed into a segment,
step 3, is served from its segment instead, or 503 SEGMENT_UNAVAILABLE,
retriable, while the store does not answer); the re-derivation plan skips it
with reason: "expired". An entity the question names that only learned
records mention still grounds the pack. POST /v1/erasures erases what was
learned from an expired event by its id, or by its scope, and removes its
marker (removed_expired in the job's result), lists it in the receipt's
expired_event_ids and checks it in the proof (expired_markers). A recall
with filters keeps a learned record only through a source that matches
them: an expired source matches a filter of labels alone, through the
source: labels its marker keeps ({"labels": "source:slack"} still finds
what was learned from expired Slack events), and never a filter on another
key or another label.
A sweep is single-flight: a second tick is refused with 409 RETENTION_SWEEP_RUNNING rather than queued. It is also cursor-driven and
bounded, so a tick that hits max_events or the time budget reports where it
stopped and the next one resumes there; changing any rule (or the deployment
default) changes the policy fingerprint and forces a full rescan. A tick that
outlives the request's blocking-lane deadline answers 202 {"running": true, "poll": "/v1/admin/retention"} and finishes in the background — its report
lands in last on the status route. A sweep request with no body or {} is a
dry run over the whole log. A body must be JSON sent as such: one without a
JSON Content-Type is refused 415 UNSUPPORTED_MEDIA_TYPE (before 0.14.0 it
was ignored, so {"dry_run": false} without the header ran as a dry run).
The policy writes (PUT, DELETE) answer the same 202 when they outlive
the deadline (CORTEX_EVIDENCE_TIMEOUT_MS, default 120000 ms); the work still
runs to its end. The policy read (GET) waits for its read once admitted, so
it always answers with effective_days and effective_mode; the deadline
bounds only its admission (503 DB_UNAVAILABLE when the lane cannot admit
it).
One cursor per TTL (since 0.14.0). The sweep keeps one cursor per distinct TTL
its rules can give a row (its TTL classes: the deployment default, each rule's
default and each per-source value), in the Derived log's consumer offsets as
retention:ttl:<days>. A class's pass reads only the rows captured at least its
TTL ago and decides only those whose effective TTL is its own, so no row is passed
before its own rule could expire it (with 30 days at org:acme/team:ops and 365 at
org:acme/team:legal, a legal row expires at 365 days, never passed over by the
30-day cursor), and a tick reads only the rows that aged past each class's TTL
since the last one. The passes run shortest TTL first under the tick's one event
budget and one deadline; a pass the budget leaves out keeps its cursor for the next
tick. cursor (GET /v1/admin/retention), cursor_before and cursor_after (a
sweep's report) and the retention row are the least of the classes' cursors;
stopped is the last pass's reason, or the budget that ended the tick;
kept_forever counts a row once, when the shortest class's pass reaches it. A rule
change (the fingerprint), a rescan and a policy write's cursor_reset start every
class again from zero; a change to a hold's record restarts only that class's pass,
at its own held floor (above). A store swept before 0.14.0 by the one cursor resumes
it for its shortest class, and every longer class reads the log once from the
start, so a row the old cursor passed is decided at the first tick after the
upgrade.
An applying sweep runs only where the scheduled one does: on the replica that
leads the shard, once the term's first pass found its views caught up (the
erase tail at the erasure feed, the indexer past the term's captured head).
Elsewhere it is refused before it reads anything: 503 NOT_LEADER
(retriable; the message names the leader the replica knows of), the shard's
own answer to a proposal off the leader, or 503 SHARD_CATCHING_UP
(retriable) while the leader's views catch up. Before 0.14.0 a cluster
follower's sweep answered 200 backend_error, each scope group's erase
refused into errors[]. A dry run runs on any replica.
H=http://127.0.0.1:3141
AUTH="Authorization: Bearer $CORTEX_API_KEY"
JSON='Content-Type: application/json' # without it a body is refused: 415 UNSUPPORTED_MEDIA_TYPE
# What would expire, and where the scan would stop
curl -sX POST $H/v1/admin/retention/sweep -H "$AUTH" -H "$JSON" -d '{}'
# Apply it (needs admin.compact)
curl -sX POST $H/v1/admin/retention/sweep -H "$AUTH" -H "$JSON" -d '{"dry_run":false}'
# One subtree, one-off age override (never persisted; requires scope);
# "mode":"keep_learned" keeps what was learned (default erase)
curl -sX POST $H/v1/admin/retention/sweep -H "$AUTH" -H "$JSON" \
-d '{"dry_run":false,"scope":"org:acme/user:x","older_than_secs":86400}'
# A rule that keeps what was learned after a year (no mode = keep_learned)
curl -sX PUT $H/v1/admin/retention/policies -H "$AUTH" -H "$JSON" \
-d '{"scope":"org:acme","default_retention_days":365}'
POST /v1/admin/wal/compact is the separate, physical half: it removes rows
of the node-local Derived log (derived_wal/) that are already logically
dead — redaction tombstones and Derived twins whose Captured source is
retired. The event log itself is written only by the shard's apply and is not
compacted here. It never removes a live row, never touches derived-artifact
history, and preserves every invariant the strict native opener validates.
below_offset defaults to the Derived log's head;
compaction selects the reclamation mode (none, touched_ranges the
default, full for a whole-column-family pass). A compaction request with no
body or {} is a dry run with these defaults. A body must be JSON sent as
such: one without a JSON Content-Type is refused 415 UNSUPPORTED_MEDIA_TYPE (before 0.14.0 it was ignored, so {"dry_run": false}
without the header ran as a dry run). An applied sweep that erased
or detached anything runs it at once unless
CORTEX_RETENTION_COMPACT_AFTER_SWEEP=0, and a background tick runs it once a
day (CORTEX_WAL_COMPACT_INTERVAL_SECS, default 86400; 0 turns it off, any
other value is at least 60). CORTEX_SCHEDULER_DISABLE stops that tick and
the scheduled sweep; both routes still work.
GET /v1/admin/wal?verify=true runs the strict native opener's row
validator against the live log. That validator is bounded — 1 000 000 rows
and 512 MiB across all column families — and a production-sized log is past
that bound, so the answer has three states, not two: verify.ok: true (every
counted invariant holds), verify.ok: false with reason (an invariant is
violated), and verify.ok: null with skipped (the log is past the bound and
nothing was checked). The last one is a refusal to answer, never a health
verdict — treating it as corruption is how a healthy store gets restored from
a cold backup.
Restore semantics: the cursor and the policy fingerprint live in the Derived
log's consumer offsets (derived_wal/), so they travel with a cold backup. Restoring an archive
taken before an expiry resurrects those rows together with a cursor below
them, and the next applied sweep re-expires them under the current rules. A
policy created after the backup is gone with the restore — re-create it, and
the fingerprint mismatch forces the rescan that re-applies it.
GET /v1/admin/metrics (JSON, gated on trusted-operator access plus diagnostics.read) reports, beyond
the request/error/rate-limit counters: version, per-route endpoints[]
(call count, errors, p50/p95/p99/max latency ms), errors_by_code[]
(structured error responses grouped by error_code),
writes.indexing_failures_total (accepted-but-unindexed writes),
enrichment_multilingual (the multilingual guard counters since process
start: non_en_script_events_enriched, non_en_script_events_skipped under
CORTEX_ENRICHMENT_SKIP_NON_EN=1, and
triples_rejected.{predicate_empty,predicate_non_ascii}),
recall_empty_content_drops (0.10.2: recall candidates dropped since process start because their
content row was gone, never served, by reason: absent_during_erasure, an erasure removed the row
while the recall ran or shortly before, expected and logged at debug; absent_orphan, no row and
no erasure behind it, an orphan index document, logged at warn; foreign_tenant, the row belongs
to another tenant, logged at warn; always present),
storage.data_dir_bytes_approx (on-disk footprint, cached ~60s), and access_view (DB-21's
permission views: keeps, whether this node keeps views at all, which it does while it leads its
roots, always on a single node, and while CORTEX_ACCESS_VIEW_MAX_BYTES is not 0; leader, its
leader gate's answer; bytes, the views kept, maps and caches, against max_bytes and the cap one
root's view has, root_max_bytes; roots_kept, roots_building and roots_over_cap; and
evictions, views dropped since process start to stay within max_bytes; in memory, AccessViewMetrics
in the openapi). retention (lifetime tick/scan/expire/erase/detach/held/error counters) is
present when a retention sweeper runs in the process, and unified_wal (the same census
GET /v1/admin/wal serves) whenever the process runs the unified log and the census read
finished; each is omitted, never zeroed, otherwise — wal stays
the v1 ack-surface depth the readiness probe reports and is unrelated. The object also
carries indexer (the unified indexer's tail: watermark, captured_head, lag,
applied_above_floor, inflight, barriers, and held or vectors_waiting when set),
answer_cache (when the cache is on), erasure_residual and erasure_index (the
erasure passes and reference indexes; since 0.14.0 erasure_index.party, the party index's state:
scheme, depth, complete, until, after, rows, §8.6.3), vector_indexes[]
(name, quantization, hot_count, cold_count, memory_bytes), vectors (the vector
replication counters), storage.breakdown[] (the data directory's children, largest first),
artifact_plane_enabled and artifact (null while the plane is off), process.rss_bytes
(Linux), disk (the disk guard), memory (memory pressure, the resident vector cap and the
RocksDB budget), ice (the segment store, as GET /v1/admin/ice/status serves it), code
({"enabled": false} while the code plane is off), since 0.14.0, auth (the
enforcement switches, the deployment minters and the issuers; since 0.14.1 also
lifetime_ceilings, §4.7.4) and, since 0.15.0, shard_format (the binary's apply format, the
format ceiling, the shard's armed format and what holds it below the binary's, pending; omitted with
no shard; §8.15.7) and derivation (DerivationMetrics in the
openapi; this process's figures since it started, none per scope: verdicts[], the gate's candidates
by verdict and rule family, with the accepted, held and rejected totals; held_open, the
held candidates open on this node's shard, every root, read at most every 30 seconds, null before a
shard is attached; lapses; corrections, those this node applied by action and the ones it undid,
reject, replace, pin, confirm and undo; jobs, the derivation jobs by state, planned,
approved, running, paused, completed, cancelled, failed; and spend, spent_usd,
calls, unpriced_calls and deferrals, §8.32). The data-directory walk, the
census and the artifact gauges share one database-lane admission: when it fails the route still
answers 200 without them. A cluster data node adds edge (its read gate, erase-floor wait,
ReadIndex failures, reconciler and edge.shard counters, docs/generated/cluster.md); a cluster
ingress answers its own object, with only role, responses, resends, reroutes,
leader_redirects and replica_rotations, and asks for no credential. The
/metrics Prometheus endpoint exposes the same counters as
cortexdb_* series including cortexdb_indexing_failures_total,
cortexdb_errors_by_code_total{code=...}, since 0.15.0 the derivation series
cortexdb_derivation_verdicts_total{verdict, family}, cortexdb_derivation_held_open (while it
reads), cortexdb_derivation_spend_usd_total and cortexdb_derivation_jobs{state}, none with a
scope label, the same multilingual guard
counters as cortexdb_enrichment_non_en_script_events_enriched_total,
cortexdb_enrichment_non_en_script_events_skipped_total and
cortexdb_enrichment_triples_rejected_total{code="predicate_empty"|"predicate_non_ascii"}
(always rendered), the permission views as cortexdb_access_view_keeps,
cortexdb_access_view_leader, cortexdb_access_view_bytes, cortexdb_access_view_max_bytes,
cortexdb_access_view_root_max_bytes,
cortexdb_access_view_roots{state="kept"|"building"|"over_cap"} and
cortexdb_access_view_evictions_total (always rendered), plus
cortex_retention_expired_total, cortex_retention_erased_total,
cortex_retention_cursor and cortex_wal_live_rows (absent, rather than
zero, when retention is not wired or the value has never been observed). The
Prometheus endpoint is unauthenticated, so it reports only O(1) values: the
retired-marker census lives on the authenticated GET /v1/admin/wal, never
here.
8.15.2 Derived-row re-derivation (RD1)
Item RD1 of the multilingual build plan (§13.2); not in v0.9.13. Derived rows written
before the M1 fixes (D0a) keep their damage: a negated fact superseded by its affirmative, or the
other way round; "Priya called" merged into "Riya called"; two different Devanagari names on one
ent_______ id. The raw events are intact, so the repair re-derives exactly the flagged events.
The operator procedure, per deployment, is docs/DERIVED_REDERIVE_RUNBOOK.md.
On a shard armed for format 11 (since 0.15.0) a re-enrichment goes through the extraction scanner, so the derivation
policy's gate and every correction in force apply to it; an event whose recorded outcome counts as learned
(nothing_admitted included) counts as enriched; the purge deletes derived rows only, never a correction, held
candidate or review decision (replicated records); a job's revert keeps every supersession a correction made (a
replace closing the old claim's fact; the plan lists it with basis: "correction" and a warning); an event a spent
derivation budget deferred is queued (its reason says until when), so the job waits for it; and a job fences the
read caches of its scope, so no pack or answer built before it or while it runs cites a purged fact after it.
There, prefer a reextract (§8.32.7), which re-extracts what was made under another policy with an estimate and a
cap, on every topology.
POST /v1/admin/derived/rederive body:
{ "scope": "org:acme", // required: the job is confined to this subtree
"event_ids": ["evt_..."], // and/or
"fact_ids": ["fact_..."], // their supporting events are re-derived; and/or
"edges": [{"fact": "fact_...", "superseded_by": "fact_..."}], // exact edges to revert; and/or
"audit": { ... }, // a scripts/derived_corruption_audit.py report
"billing_tenant": "acme", // default: the caller's billing id
"actions": ["revert_supersessions", "purge_derived", "reenrich",
"reconsolidate", "rebuild_beliefs"], // default: all five
"max_events": 200, // eligible events per job, at most 2000
"dry_run": true, // default
"job_id": "rdj_...", // name or resume a job
"continue_from": "rdj_...", // instead of targets: what that job's cut left
"cold_backup_ack": false, // required with purge_derived on an apply
"enrichment_wait_secs": 600 } // at most 3600
From an audit report the route takes, inside scope: the facts and supporting events of every
lost or introduced negation (either polarity superseding the other), every subject_differs or
script_differs merge, every belief polarity mismatch and every fact whose negation is stored
twice or dropped (negation_doubled, negation_dropped, audit tool version 2), and the beliefs and facts behind every lossy or
colliding ent_ id. A colliding legacy id (one lossy id such as ent_______ naming
several non-Latin subjects) reaches the facts of every subject it names in the scope subtree: this
is an operator repair, so the ambiguity guard that makes /v1/forget refuse such an id does not
apply. The plan lists each one in ambiguous_entity_ids ({"ent_______": {"subjects": [...], "facts": n}}) and adds a warning naming the subjects. The exact edges of negation_lost rows and of the two merge kinds
are flagged edges; edges in the body adds more. The informational other_names_differ
merges are not targets.
billing_tenant names the billing tenant whose captures the job may touch; an event captured for
any other tenant is skipped (foreign_tenant). The static operator key bills as default, while a
pilot's captures written with PASETO tokens bill to the pilot's tenant, so a job over those names
it here. The plan lists the tenants of the skipped events (foreign_tenants).
Which supersession edges are reverted. Only two kinds: a flagged edge that still holds, and an
edge whose superseder is purged and re-derived by this job (the new rows decide it again). An edge
whose superseded fact is itself purged goes with that fact, and every other edge is kept, in
particular one whose two ends are both left alone (skipped, over max_events, a typed triple,
another tenant's). Naming a fact, or reaching it through an entity id or a belief, chooses
events; it never reverts the edges that fact sits on. A revert gives the fact back the end
date it had before the supersession (its t_valid_to, read from the fact's last unsuperseded
FactExtracted row); an open-ended fact reopens open-ended. The job's revert step reads those
dates (one pass over the WAL that decodes only fact rows) and records them on the job's
edges[].restore_valid_to; the plan reads no WAL, so a dry run is bounded by the targeted events,
not by the size of the log.
The max_events cut. Events one fact cites together (a merged keeper cites both people's
events) are one group, taken or left whole: the cut never strips a fact of some of its eligible
sources and not the others. A job takes the oldest groups whose eligible events fit in
max_events; the first group that does not fit and every later one are over_max_events, left
for a later job. continue_from: "<job_id>" names a completed job of the same caller, scope and
billing tenant, and takes exactly those events as the new job's targets (no other target may be
named beside it); re-posting the original request under a new job_id would select the same
events again. A job is continued once: the continuation records itself on the job it continues
(continued_by) before it stores its own record, that job's status then reports
remaining_events: 0, and a second continue_from of it under another job_id, applied or dry,
answers 409 JOB_ALREADY_CONTINUED with details.continued_by (it would re-derive, and pay for,
the same events again). Re-posting the continuation's own job_id still resumes it. A plan whose
oldest group alone exceeds max_events takes nothing and says so in warnings.
Dry run (the default) answers 200 with plan:
- each event with its eligibility (
reason:not_found_or_erased,expired(akeep_learnedretention removed its raw data: what was learned from it stays, and no text is left to learn it again from),foreign_tenant,held(since 0.14.0: a legal hold record of the scope's tenant keeps it, by its home, its people or its capture time, or the holds could not be read; its purge would delete what the hold keeps),not_enrichable,over_max_events,enrichment_scope_not_allowed,enrich_off(since 0.14.0: its scope's effectiveenrichisoff),segment_unreadable: the event is sealed into a segment, step 3 ofdocs/ICE_TIER_PLAN.md, and the segment store did not answer; plan again once it does), counted inskipped_by_reasonand, forforeign_tenant, per capturing tenant inforeign_tenants; a sealed event is otherwise re-derived like a live one, its text read from its segment; supersession_edges: every edge that touches a target or re-derived fact, and every flagged edge, with both texts,revertand itsbasis(flagged:<finding>,superseder_rederived,superseded_rederived,not_rederived,revert_not_requested);edges_to_revertcounts the reverted ones;- what the purge deletes:
derived_totals,doomed_beliefsanddoomed_concepts(each with its id, scope,kindand what matched it),rederived_facts(fully supported by the eligible events) andstripped_facts(they keep another support and only lose the events); kept_declared_beliefs: caller-declared beliefs (POST /v1/beliefs: a random id, no claim key) that cite a purged fact. They are kept, their support to that fact dangling; only the belief builder's own beliefs (a topic's deterministic id, or a value belief whose claim key names the topic) are purged and rebuilt. The purge gives each kept one anEventsupport for the purged fact's source events (the fact support's weight and polarity), so a later/v1/forgetor/v1/erasuresof those events still deletes it: the erasure's fact leg cannot reach it any more, since the re-derived fact has a new id;concept_scopes: the scopes whose purged concepts the operator re-synthesises afterwards;- the entity ledgers and belief scopes involved, and
rebuild_fact_ids; cost_estimate, priced from the price book (CORTEX_MODEL_PRICES, then the provider fleet, then published rates;usd: nullwhen a model has no rate), for the actions requested only;warnings, among them the reason an apply would be refused.
Nothing changes.
Apply (dry_run: false) answers 202 with the job record and Location: /v1/admin/derived/rederive/{job_id}, and runs detached, in this order:
- Revert the edges the plan marked
revert. The step first reads the reverted facts' end dates from the WAL (the job log records the rows read and the time). AFactSupersessionRevertedWAL event is appended, then the fact reopens with its own end date back (and loses the consolidator'sduplicate_ofmarker). Replay applies reverts together with supersessions in time order, so the state survives a restart. - Purge with an RD1-specific match: the facts the eligible events fully support (a fact that
keeps another support only loses the events), the belief builder's beliefs citing a purged
fact, the concepts citing a purged fact or belief, and the entity-graph rows the events
produced (
CORTEX_ENTITY_GRAPH=1). Episodes (built from the raw events), caller-declared beliefs (even one citing a purged fact), concepts that cite only raw events or episodes, and the tenant profile are kept. Since 0.14.0 the purge also leaves out an event a legal hold placed since the plan keeps (the queue step then skips itheld) and the derived rows homed in a held scope or a held person's region. The fact-store snapshot is rewritten at once (serialized with the periodic saver and/v1/admin/persist, which write the same file). The purge redacts the facts'FactExtractedWAL rows, so it cannot be undone without a cold backup: an apply that includespurge_derivedneedscold_backup_ack: true. - Re-enrich by writing enrichment retry records and waking the deferred scanner, which re-extracts the events with this build's extraction and guards. There is no second enrichment path; a failure follows the retry and dead-letter rules of any enrichment.
- Reconsolidate: reset the consolidation marks of the entity ledgers involved and, when an LLM router is wired, consolidate them now (otherwise they stay due for the scheduler).
- Rebuild beliefs for the affected topics only: the topics of the re-derived facts, of the reopened and stripped ones, of the surviving supports of purged beliefs and of the ledgers the reconsolidation changed, through the incremental builder's per-topic path, with the LLM refinement when a router is wired. No other belief is touched (an LLM-refined belief on another topic, a declared belief, a belief in a child scope), whatever the deployment's layer mode.
The job does not re-synthesise the concepts the purge removed; its log and concept_scopes name
the scopes, and the runbook re-synthesises them with POST /v1/understanding/synthesize.
An apply that asks for a re-derivation (purge_derived or reenrich) while no targeted event is
eligible is refused before any change with 422 NO_ELIGIBLE_EVENTS (details: skipped_by_reason,
foreign_tenants, edges_to_revert); it would only revert edges. A revert-only job
("actions": ["revert_supersessions"]) is not refused.
Enrichment scope allowlist (0.10.4). With CORTEX_ENRICHMENT_SCOPE_PREFIXES set, the dry run
reports it as capabilities.enrichment_scope_prefixes, and a job whose actions include
reenrich may only target events under it. A planned event outside it is skipped with reason
enrichment_scope_not_allowed (its own scope named), and the request, dry run or apply, answers
422 ENRICHMENT_SCOPE_NOT_ALLOWED before any change or job record, with details:
reason, allowed_scope_prefixes, events_outside (the count), events_enrich_off and events
(the first 20, each {event_id, scope, reason}). A scope holding nothing the allowlist admits is refused the same way before
it is planned (events_outside: 0). A job without reenrich (revert or purge only) is not
confined. The queue step re-checks each event, so a resumed job never queues one outside it.
Unset, nothing here changes. Since 0.14.0 a scope whose effective enrich is off (its
companion record, resolved through inherit up the tree) keeps its events out the same way, as a
cause of its own: they are skipped enrich_off, and a job that re-enriches them answers the same
422 with details.reason: "enrich_off", events_enrich_off (the count) and a message naming the
scope's enrich. The allowlist's refusals say details.reason: "allowlist" (events_outside
counts only its events); both causes at once, allowlist_and_enrich_off. Each listed event
carries its own reason. The allowlist is checked first: an event it keeps out is never also
counted as enrich_off. A scope inside an
application's reference root (DB-18), where nothing derives, is refused before it is planned,
whatever the actions: 422 ENRICHMENT_SCOPE_NOT_ALLOWED with details: {"scope": ..., "reason": "reference_root"}. plan.cost_estimate.enrichment_model is the model the running
enrichment router was built with (the re-enrichment runs on it), and
enrichment_model_pending_restart names a different CORTEX_ENRICHMENT_MODEL saved since
startup, which a restart would load.
reenrich requires purge_derived (re-enriching mints new fact ids, so the old rows would stay
live beside the new ones). The job record (ids and counts only) is written after every phase, in
the v1_layers store's default column family under the key prefix rd1/job/: RD1 adds no column
family, so a store stays openable by v0.9.13 until an apply writes a FactSupersessionReverted
row (see the runbook's rollback floor). When a run's enrichment_wait_secs runs out the job is
left awaiting_enrichment; re-posting the same request with the same job_id resumes any
interrupted or waiting job from its last completed phase (a job id reused for other targets,
actions or billing tenant is 409 JOB_MISMATCH), and a completed job answers 200 {"already_completed": true, "job": …} without doing anything. A new job over the same events
does the work again.
Safety: an event that is erased, forgotten or under a forget tombstone is never re-enriched (it is
re-checked when it is queued, so an erasure that lands mid-job wins); events captured for another
billing tenant are skipped (foreign_tenant). A job refuses to start (409 DESTRUCTIVE_OPERATION_IN_PROGRESS, retriable) while a forget or erasure holds a destructive lease
under the scope root, and while it runs, /v1/forget, /v1/erasures and their previews on that
root answer 409 REDERIVE_IN_PROGRESS (retriable, Retry-After: 30). One job runs per scope root.
A dry run, a start or resume, an already-completed answer, and a refusal for the enrichment scope
or for no eligible event each write a DERIVED_REDERIVE:<decision> row to the audit log
(dry_run, started, resumed, already_completed, scope_not_allowed, nothing_eligible;
its id is the response's audit_id); the detached run writes one more when it ends (completed,
awaiting_enrichment, failed), and the unmerge writes unmerge_dry_run or unmerge. Every
other refusal writes none. Each phase logs
code=DERIVED_REDERIVE. With enrichment off (CORTEX_ENRICHMENT_DELAY_SECONDS unset) the route
answers 409 ENRICHMENT_OFF (details.enrichment_mode).
GET /v1/admin/derived/rederive/{job_id} answers {"job": …, "running": bool, "remaining_events": n}: phase, per-event state (pending, skipped, queued, enriched, dead_lettered), the
target billing_tenant, requested_by (the billing id of the operator credential that created
it), continued_from, continued_by (the job that continued it), the reverted edges with the
end date each got back, concept_scopes, counts and a bounded log; remaining_events counts the
events its max_events cut left that a continuation can still take (continue the job while it is
above 0; it is 0 once a job has continued it). A job another caller created reads as 404 JOB_NOT_FOUND.
A continue_from naming an unknown or foreign job is 404 JOB_NOT_FOUND; one that is not
completed is 409 JOB_NOT_COMPLETED (resume it first); one another job already continued is 409 JOB_ALREADY_CONTINUED (resume that job); another scope or billing tenant, or other targets beside
it, is 422 INVALID_BODY; a job that left nothing is 422 NO_TARGETS. An apply
whose planning outlives the request deadline (CORTEX_EVIDENCE_TIMEOUT_MS, default 120000 ms)
answers 503 DB_UNAVAILABLE (retriable) with its job_id in details: the plan finishes on its
lane, holding the scope root, and stores the job; re-post the same body with that job_id to
resume it. Every other lane failure of these routes answers as every storage lane does (since 0.14.0): 503 DB_SATURATED or DB_UNAVAILABLE (retriable: the lane did not run the work), or 504 DB_TIMEOUT (not retriable: a read
or dry run outlived the deadline). An apply writes derived rows outside the
shard's admission, so it asks the disk guard first: while this node's disk reads critical it
answers 503 DISK_FULL (retriable, Retry-After: 30, details.node) before anything changes.
A failed dry-run plan is 500 REDERIVE_PLAN_FAILED; a failed job lookup, plan or record write
of an apply, or of the status route, is 500 REDERIVE_FAILED; a failed unmerge 500 UNMERGE_FAILED; a coordinator that does not answer re-derivation 503 REDERIVE_UNSUPPORTED. A
cluster ingress answers the three routes of this section 501 CLUSTER_ROUTE_UNSUPPORTED.
POST /v1/admin/derived/resolver/unmerge body:
{ "scope": "org:acme",
"names": ["Riya", {"name": "Amita", "entity_type": "person"}],
"audit": { ... }, // optional: adds the names of its subject_differs merges
"dry_run": true, // default
"max_events": 200 }
It acts on both resolvers. Since shared memory's DB-23, enrichment registers a name in the
scope-keyed resolver, under its audience (the event's home with its atoms), and a name resolves
only among its audience's names; the legacy process-wide resolver holds the names an older binary
registered. For each name the unmerge reports one entry per audience of the scope-keyed resolver
where the name resolves, the scope's own and that of each event under scope that mentions the
name, as resolver: "scoped" with audience: {home, atoms}; and one entry for the legacy
resolver, resolver: "legacy", when it knows the name. A name neither knows gets one entry with
action: "none" and no resolver. Each entry gives the entity the name resolves to now, the match
(ExactName, Alias, FuzzyName), whether that is a merge, the planned action (split,
restore or none) and the events under scope that mention the name. Applying splits each
merged entry where it is. A scoped split removes the alias the other entity held (its key, its
provenance rows, its place in the record) and registers the name as its own entity in that
audience, named by that audience's mentioning events, so their erasure takes it. A legacy split
works as before: a merged-away entity with that canonical name is restored, otherwise a new entity
is registered and an alias the other entity held is removed; the legacy resolver is process-wide,
so a legacy split applies to every scope. From then on the name resolves to itself at the exact
stage, so the edit-distance stage, which within an audience still runs, cannot pull it back. It
never merges anything. Graph edges and derived rows already attached to the other entity move
only when the mentioning events are re-derived; run the unmerge first, then the re-derivation.
Each names entry is trimmed and may not be empty; entity_type is person (the default),
company, service, database, product, project, team, incident, deployment,
document, tool, environment, concept, procedure or community, in any case, and the
names an audit adds are people. An empty name, an unknown type or max_events outside 1 to
2000 is 422 INVALID_BODY; no name at all is 422 NO_TARGETS. The unmerge returns entity names
and the events that mention them, so it is a content-returning admin route for the operator
plane (§8.15.3): under CORTEX_OPERATOR_DATA_READS=deny, the deployment's or the tenant's own,
the operator key needs X-Cortex-Break-Glass (403 BREAK_GLASS_REQUIRED, details.class
admin_content, or private_region when scope lies in a private region), and a break-glass
read of a private region commits its notice to the region's people first (503 NOTICE_UNAVAILABLE with details.reason when it does not commit; nothing is returned).
8.15.3 The operator plane and a tenant's own mode (DB-16)
Capabilities operator_break_glass_v1 and tenant_access_settings_v1 (shared memory phase 1,
docs/shared_memory/IDENTITY_AND_API_CONTRACT.md §3, §5.6.5).
CORTEX_OPERATOR_DATA_READS is what the operator key (CORTEX_API_KEY) may read: allow (0.13.x's behaviour),
audit or deny, read once at boot (any other value, and audit or deny with auth disabled, refuse the boot with
exit 78 AUTH_CONFIG_INVALID). Unset, it is the deployment preset's (CORTEX_DEPLOYMENT_PRESET) since 0.14.0: deny
on cloud_shared_saas, allow on the single-tenant presets (dev_local, the zero-config default, on_prem_enterprise
and cloud_private) and wherever auth is disabled. A tenant's own mode, set with the route below, overrides it in that tenant. The
mode governs only requests the operator key authenticates, and a deployment minter's mints; no other token is affected.
| Operator-key action | allow | audit | deny |
|---|---|---|---|
| An operator-plane route (health, console, tokens, the registry's reads, the access API and AuthZEN (§8.20, §8.21), erasure, admin routes without content, audit, configuration) | served | served | served |
A read of stored rows (/v1/recall, /v1/answer, /v1/export, /v1/events, the layer reads, …), and a forget or erasure preview whose selector is a query (about_subject, about_entity, predicate, or an ent_ id in memory_ids) | served | served, counted | header |
A content-returning admin route (/v1/admin/events/{id}/chunks, /v1/admin/compile-dead-letter, /v1/admin/derived/resolver/unmerge, /internal/ui/logs) | served | served, counted | header |
A read whose scope, or one of its extra_scopes, lies in a private region | served | served, counted | header; with it, the read first commits a notice to the region's people (its self, else its members), else 503 NOTICE_UNAVAILABLE and nothing is delivered |
An in-band path: a mint of a token that carries a data capability, can mint, carries policy.administer.scope or a scope.create.* name, or is for an Owner of a private region of the tenant; a registration by the key (an auto-provisioning first write, and a tenant rebind that registers its root, included); a PUT /v1/apps/{id} that registers the application's record or names a service: principal its stored roster does not hold (the default roster names service:<id>); a roster edit that adds a service: principal or adds anyone to a private region; a tree edit that clears private or moves a private region's record; deleting a private region's record; a write into a private region or a shared org-tree scope (not the key naming an application's principal service:<key> writing in its reference root app:<key>, whose kind app is shared but which holds no tenant's data, §8.26: it needs no header); a migration out of or into a private region, or into a shared org-tree scope; lowering a tenant's mode from deny; a deployment minter's mint of a token that carries a data capability | served | served, counted | header |
| Other writes, imports, migrations, forgets, erasures | served | served | served |
"Counted" is report check operator_access on GET /v1/admin/access/report, by class (stored_rows,
admin_content, private_region, in_band), with a decision line (mode=report) for each; GET /metrics carries
cortexdb_operator_access_total{route, class, mode, outcome}. "Header" is 403 BREAK_GLASS_REQUIRED, details
{mode, class, route}, unless the request carries a well-formed break-glass header:
X-Cortex-Break-Glass: reason=support; ticket=SUP-1142; note=customer%20asked%20for%20an%20export
reason is one of incident, legal, support, security, migration, restore, other; ticket is 1 to 64
characters of [A-Za-z0-9._:-]; note is optional, percent-encoded UTF-8 of at most 256 bytes. Exactly one header, at
most 512 bytes; any other form is 400 INVALID_HEADER in every mode, details {part: "header", field: "X-Cortex-Break-Glass", reason}, reason what is wrong with it (sent more than once, longer than 512 bytes,
not ASCII, a field not key=value, a key other than reason, ticket and note, a key twice, a reason or ticket
outside its grammar, a note not percent-encoded UTF-8 or over 256 bytes). It is read only on operator-key requests and on
a deployment minter's POST /v1/auth/tokens, ignored on every other credential. A well-formed header writes the audit
row's break_glass {reason, ticket} (never the note) and one decision line, mode=break_glass, with the note and, for a
mint, the minted token's id; cortexdb_break_glass_total{route, reason} counts them. Both refusals, 403
BREAK_GLASS_REQUIRED and 400 INVALID_HEADER, write the request's audit row as deny, each with its
denial.reason (the 403's class; break_glass_invalid for the 400, which names no scope), within the operator key's bound (denial.check operator_access, §14). The header is self-asserted:
CortexDB checks its form, not its truth. A cross-origin browser page cannot send it (it is not in the
CORS allow list). The bundled console, served from the same origin, sends it only after a request of
its own answers 403 BREAK_GLASS_REQUIRED: it asks the operator for the reason, the ticket and the
note, and sends that one request again with them (since 0.14.0).
Change sets (since 0.14.0). The operator key's activation of a change set (POST /v1/access/changes/{id}/activate,
§8.22.4, a dated change set's approval included) is an in-band path when a record it writes would be one through the
legacy registry routes, judged from the change's effects against the registry: a record it registers where none is (a
tombstone's path included); a service: principal it names on a roster, in a set, as a companion's head, delegate,
grantee or members set, or as a self, where the record did not name it; a principal or a set it adds to a record in a
private region (before or after the change), or a principal who reads a scope in a private region at a higher role
after it than before (through a set it writes that the region's roster reaches, a longer until, a dropped when, a
raised role); or another change that widens who may read a private region (a record in one deleted, its private
cleared or set false, its parent, self or kind changed, a wider audience, a lower label, delegable, or an
admission, head, delegate or grant added, or a grant naming a scope in one). Its preview names those records
(in_band, in_band_parts, §8.22.3). Under deny such an activation without the header is 403
BREAK_GLASS_REQUIRED (details {mode, class: "in_band", route: "/v1/access/changes/{id}/activate"}) and activates
nothing; with it, each private region the change widens is told first, as a break-glass read of it is (cause
break_glass, the header's reason; told: the region record's self, else its principal members), and the change
activates once that notice commits, else 503 NOTICE_UNAVAILABLE and nothing is activated. Under audit it is served
and counted (in_band), and tells no one. Staging, the preview, the status and a discard need no header: they change no
access. A dated change set's approval is where the header is needed; the leader's sweep activates it at its date with
no request to decide. Another credential's change set is decided by its own authorization alone.
By-id reads (since 0.14.0). A by-id read (GET /v1/events/{id}, GET /v1/facts/{id}, GET /v1/beliefs/why,
GET /v1/beliefs/history, GET /v1/lifecycle/event/{id}, GET /v1/lifecycle/memory-event/{id}, GET /v1/derivation/decisions (0.15.0, by its event), and GET /v1/admin/events/{id}/chunks, whose row outside a
private region counts as admin_content) is decided once its row
is read, by the row's own scope's tenant and class, whatever ?scope= it names: under deny it is refused then,
before anything is delivered, and with the header a row in a private region makes the region's notice due, which
commits before the response leaves, so the read is served once it commits, or answered 503 NOTICE_UNAVAILABLE
with the notice's own details.reason. So a tenant stricter than the deployment is never read by id at the
deployment's mode. ?scope= (which routes the read on a cluster) never decides the operator plane, but it confines
the read: a row whose own scope is not the named scope or under it (a row without a scope lies under none) answers
the route's own 404, the answer for an id that names no row, for every caller, on every node, a cluster's data
node included. GET /v1/events/{id} keeps its exact match (event_scope_filter_v1). A malformed or empty ?scope=
is 422 INVALID_SCOPE_GRAMMAR. A memory-event view decides each scope its rows hold, each under the named scope.
The break-glass line of such a read names its first row's scope and tenant, and no scope when it answered 404.
Before 0.14.0 the gate decided on the named scope, which the routes never read, and a break-glass by-id read without
?scope= of a private region's row answered 503 NOTICE_UNAVAILABLE, details.reason: "scope_unnamed".
GET /v1/admin/access/tenant-settings?scope=<tenant root> and PUT the same (trusted operator only; scope is exactly a
tenant root, its first CORTEX_TENANT_DEPTH segments): the tenant's own operator mode and its readiness override, stored
together, one record per tenant. On a cluster the ingress routes both by the scope's root.
PUT /v1/admin/access/tenant-settings?scope=org:acme
{"operator_data_reads": "audit", "readiness_override": {"ticket": "OPS-1142"}}
200
{"scope": "org:acme",
"operator_data_reads": {"mode": "audit", "source": "tenant"},
"deployment_mode": "deny",
"readiness_override": {"ticket": "OPS-1142", "at": "2026-11-02T10:00:00Z"},
"updated_at": "2026-11-02T10:00:00Z"}
A field left out is kept, null clears it. operator_data_reads is exactly allow, audit or deny (lower case);
readiness_override is {"ticket": "..."}, 1 to 64 characters of [A-Za-z0-9._:-], the operator's case reference and no
personal data, recorded at the time of the request (recording the ticket the tenant already holds keeps its at). Nothing
reads the override: it is stored and reported only. A body that changes nothing writes nothing, audits nothing and answers
the settings as they stand. source is tenant for the tenant's own mode and deployment for
CORTEX_OPERATOR_DATA_READS (or its preset's default); deployment_mode is that deployment mode (allow, audit or
deny) whatever the tenant sets, so a client learns it without reading a tenant that sets none (since 0.14.0); readiness_override and updated_at are absent while the tenant
holds no record, and every time is whole seconds. A change that lowers the tenant's effective mode from deny (setting
allow or audit, or clearing the tenant's own deny under a deployment mode below it) is an in-band path and needs the
break-glass header; raising it, and recording or clearing the override, need none. A plain node stores the settings in
<data_dir>/auth/tenant_access.json ({"version": 1, "tenants": {...}}), written whole and synced before the answer
(0.13.x ignores the file; one that does not read, or of another version, refuses the boot with exit 78
AUTH_CONFIG_INVALID); a cluster in the metadata group (PutTenantAccess; its first use makes the metadata group
one-way), after which the route waits up to 5 s for its own owner's catalog to show the change, so the answer and the next
request read the same record. Every change writes the request's audit row and, unless CORTEX_DECISION_LOG=off, one
decision line, never rate limited (check=operator_access reason=tenant_settings, with old_mode, new_mode and the
ticket). The access report carries the same object as tenant_settings (§8.30.1). Errors: 400 INVALID_QUERY (no
scope, or not a tenant root), 403 POLICY_DENIED (not the trusted
operator), 403 BREAK_GLASS_REQUIRED (a lowering from deny without the header, details.class: "in_band"), 422
INVALID_BODY (a body that is not a JSON object, a field other than the two, a bad mode or ticket; on a cluster, a
command the metadata group refused, details.reason such as TENANT_ACCESS_INVALID), 503 TENANT_SETTINGS_UNAVAILABLE (retriable:
not durably stored; on a plain node the file did not sync, on a cluster the metadata group did not commit it). None
of the others is retriable (§16).
8.15.4 Usage and plans
GET /v1/usage reports one scope; the trusted operator (the static CORTEX_API_KEY, or an auth-disabled server) reads
the durable usage ledger, every tenant's counters and the hosted plans. The IR12 counters and the hosted plans are
described in §6.5; this section is the routes. Every counter is per node: on a cluster each data node reports what it
served, and only GET /v1/usage is routed by an ingress (by its scope's root).
GET /v1/usage?scope= — Capability: scope.read.local and Reader on the roster, at the scope and at every
scope below it that has its own registry record (the counts cover the subtree).
200
{"scope": "org:acme", "events_stored": 1840, "events_capped": false, "episodes": 52, "facts": 310,
"entities": 44, "recalls_lifetime": 920, "recalls_this_month": 75, "source": "live",
"storage": {"events": 1840, "bytes": 2310455, "capped": false},
"activity": {"tenants": 1, "capped": false, "reads": 995, "writes": 1840, "write_bytes": 1904410,
"erasures": 2, "first_at": 1790000000, "last_at": 1793000000}}
| Field | Type | Notes |
|---|---|---|
events_stored, events_capped | int, bool | Distinct events under the scope, counted up to 1,000,001 (events_capped then true) |
episodes, facts, entities | int | Episodes (at most 10,001), facts (at most 100,001) and their distinct subjects |
recalls_lifetime, recalls_this_month | int | Recalls of the scope |
source | string | Always live |
storage | object | {events, bytes, capped}: the captured rows the source log's scope index holds under the scope and their encoded bytes, capped past 10,000,000 rows; a row a forget hid but did not erase still counts. Absent without the index, or when the walk does not finish on the DB lane |
activity | object | At a tenant subtree or above one (§6.5): the IR12 counters, with tenants and capped (the sum stops past 100,000 tenants); at a tenant subtree also by_app, the same counters by the application the requests' chains carried (at most 256). Absent for a scope inside a tenant |
Errors: 403 POLICY_DENIED; 422 INVALID_SCOPE (a 400 before 0.14.0); 503 NOT_CONFIGURED (no storage
coordinator, retriable: false); 503 AUTHORIZATION_STATE_CHANGED (retriable): a registry change at the scope,
above it or under it while the count ran is counted again from a fresh snapshot, up to 3 runs, and only a change on
every run is answered (before 0.14.0 a change mid-count was a 403 POLICY_DENIED); the DB lane's 503 DB_SATURATED
and DB_UNAVAILABLE (retriable) and 504 DB_TIMEOUT.
GET /v1/admin/usage — Capability: trusted operator only (the ledger spans every tenant on the node).
The durable usage ledger at <data_dir>/usage/ledger.json: exact tokens and the dollars derived from them per (UTC
day, role, tenant, model), so a range sum answers month to date or since any day, and the figures survive a restart
(durable: false when CORTEX_USAGE_LEDGER=0 keeps the ledger in memory).
| Parameter | Type | Notes |
|---|---|---|
from, to | string | Inclusive days, YYYY-MM-DD (else 400 INVALID_DAY); from after to is 422 INVALID_RANGE |
period | string | all (the default, also empty), mtd or month_to_date, read only when from and to are both absent; else 400 INVALID_PERIOD |
role | string | embedding, entity_extraction, enrichment, enrichment_qa, layer_build, fact_maintenance, consolidation, recall, answer, verifier, layer_explain, reranker or rollup (else 400 INVALID_ROLE, which lists them) |
tenant | string | One tenant, matched exactly |
format | string | csv for one row per bucket (text/csv, Content-Disposition: attachment; filename="cortex-usage.csv"; parse its header by name); any other value answers JSON |
The JSON carries durable, range (from, to, and observed_from, the earliest day with any record: a range before
it means no record, not zero spend), total, by_role, by_role_model (exact tokens beside each model, so dollars can
be re-priced), by_tenant, by_day, enrichment_coverage, enrichment_coverage_by_tenant, enrichment_backlog (live
gauges), instrumentation (complete, uninstrumented_roles, conditional_gaps for lanes behind an off-by-default
flag that record nothing, and by_role with each role's coverage, full, partial or none), cost_basis ({tokens: "measured", cost_usd: "ledger_priced", recompute_from: "by_role_model", note}, note
stating the ledger's pricing: CORTEX_MODEL_PRICES, else a CORTEX_LLM_PROVIDERS entry's cost_in/cost_out, else
the build's published rate, with what stays unpriced: unpriced models, cache hits, unsplit tokens) and
enrichment_backfill. A counter row has calls, failed_calls, cached_calls, tokens_input, tokens_output,
tokens_unsplit, incomplete_calls, tokens_total, cost_usd, unpriced_calls, latency_ms_total and
latency_ms_mean. The ledger prices cost_usd itself from each bucket's model and exact tokens (CORTEX_MODEL_PRICES
first); a model it cannot price adds no dollars and counts in unpriced_calls. The role rollup is the rollup driver's
synthesis (§8.29.1), recorded on the shard leader that made each call. On a cluster data node the ledger is that node's
own spend (a shard's leader embeds and learns each row once, so a follower records none of that); cortexdb admin usage sums the data nodes.
enrichment_backfill (enrich_backfill_v1, since 0.14.0) is the backfill that a committed change turning a scope's
effective enrich from off to on starts on this node, or null where the process runs none (the scheduler off):
"enrichment_backfill": {"budget_usd_per_day": 5.0, "setting": "CORTEX_ENRICHMENT_BACKFILL_BUDGET_USD",
"day": "2026-10-27", "process_enrichment": "on",
"tenants": [{"tenant": "org:acme", "spent_today_usd": 1.25, "remaining_today_usd": 3.75,
"scopes": ["org:acme/team:eng"], "all_on_scopes": false,
"started_at": "2026-10-27T08:00:00Z", "queued": 410, "walking": true,
"waiting": null, "done_at": null, "next_scopes": []}]}
Each tenant's walk queues the scope's older captures that the scanner skipped while it was off and nothing learned
from, never a new write, within the tenant's daily budget (CORTEX_ENRICHMENT_BACKFILL_BUDGET_USD, default 5 US dollars
per UTC day; 0 queues nothing; any value but zero or more dollars refuses the boot, exit 78
ENRICHMENT_BACKFILL_CONFIG; a data node takes it in [engine]). Each capture is priced at the price book's rate for
the enrichment model (about 2,500
input and 450 output tokens) and noted in the ledger's day spend, so a restart does not reopen the day. all_on_scopes
means more scopes turned on than a job names, so the walk is for every capture of the tenant whose effective enrich is
on; next_scopes are those turned on while it walked, walked next from the start. waiting is budget (today's is
spent) or unpriced_model (the enrichment model has no price, so nothing is queued); with process_enrichment: "off"
(CORTEX_ENRICHMENT_DELAY_SECONDS unset) nothing is walked. Only the shard's leader walks; every node records the
turn-ons it applies. The day's spend is this node's, so a new leader may spend a tenant's day again; a turn-on applied
inside a snapshot install or while the node was down, a scope already on before 0.14.0, and a re-parenting that moves
a scope under an on companion start no walk.
Errors: 400 INVALID_DAY, INVALID_ROLE, INVALID_PERIOD; 403 POLICY_DENIED; 422 INVALID_RANGE (a 400
before 0.14.0); 503 NOT_CONFIGURED (no ledger in this process).
GET /v1/admin/usage/subtrees — Capability: trusted operator only (it lists every tenant).
Every tenant subtree's IR12 counters on this node, in subtree order, as {tenant_depth, items, next_after}: each item
the counters of GET /v1/usage's activity with its subtree and, when its requests' chains carried an application,
by_app.
| Parameter | Type | Notes |
|---|---|---|
prefix | string | Only subtrees starting with it (org:b7/) |
after | string | Exclusive: the previous page's next_after |
limit | int | Default 1,000, clamped to 1 to 10,000 (to 100 with include_storage), never refused |
include_storage | string | 1 or true (any other value adds nothing): each item's storage_events, storage_bytes and storage_capped, from a walk of its rows (at most 1,000,000) on the DB lane, absent when the walk does not finish |
next_after is the page's last subtree whenever the page is full, null otherwise, so a full last page is followed
by an empty one. Errors: 403 POLICY_DENIED; 503 DB_UNAVAILABLE (retriable).
Plans. With hosted plans on (CORTEX_PLANS is 1, true, TRUE or yes; §6.5), GET /v1/plan reports the
caller's own account, and GET and PUT /v1/admin/plans/{subtree} (trusted operator only) read and set one; with
plans off all three answer 404 NOT_FOUND before any other check. No cluster ingress routes them: each node keeps its
own plan rows in its v1_layers store and re-reads a plan at least every 60 s, so on several nodes a plan is set on
each.
PUT /v1/admin/plans/org:acct_42
{"plan": "starter", "overrides": {"max_tenants": 10, "write_burst": 80}}
200
{"subtree": "org:acct_42", "plan": "starter", "overrides": {"max_tenants": 10, "write_burst": 80.0},
"updated_at": 1793000000,
"limits": {"max_memories": 100000, "max_recalls_month": 25000, "max_answers_month": 2500, "max_tenants": 10,
"read_per_second": 5.0, "read_burst": 50.0, "write_per_second": 5.0, "write_burst": 80.0},
"usage": {"memories": 18210, "recalls_this_month": 4120, "answers_this_month": 230, "tenants": 3},
"memory_unit_chars": 2000, "month": "2026-10", "resets_at": "2026-11-01T00:00:00+00:00",
"upgrade_url": "https://cortexdb.ai/pricing"}
| Field | Type | Notes |
|---|---|---|
plan | string | free, starter, pro or enterprise (required) |
overrides | object | Any of max_memories, max_recalls_month, max_answers_month and max_tenants (a whole number, or null for unlimited), read_per_second and write_per_second (above 0), read_burst and write_burst (at least 1); a field left out keeps the plan's value. No other field |
The report (PlanReport) has the plan's limits with its overrides ({} when none; a null limit is unlimited),
updated_at (Unix seconds of the last change, null for an account with no row, which is free), usage,
memory_unit_chars, month and resets_at (the first instant of next month, UTC) and upgrade_url
(CORTEX_PLAN_UPGRADE_URL, default https://cortexdb.ai/pricing). {subtree} names a tenant subtree exactly; at
CORTEX_TENANT_DEPTH 2 or more its / is sent as %2F. GET /v1/plan without scope reports the account of the
token's first scope grant; with ?scope=, the account of that scope, which the caller must read (scope.read.local
and Reader at the scope and at every scope below it that has its own registry record); since 0.14.0 that
authorization is checked again after the count, as GET /v1/usage checks it, with the same reruns and 503 AUTHORIZATION_STATE_CHANGED.
Errors: 400 INVALID_SUBTREE (not a tenant subtree); 403 POLICY_DENIED; 404 NOT_FOUND (plans off); 422 INVALID_SCOPE, 422 SCOPE_REQUIRED (GET /v1/plan with no scope and no scope grant on the token; both 400s before
0.14.0), 422 INVALID_BODY (an unknown plan or field, or an invalid override); 503 DB_UNAVAILABLE (the row was not
stored, or the report's DB lane did not run it) and 503 DB_SATURATED, both retriable; 503 AUTHORIZATION_STATE_CHANGED (GET /v1/plan?scope=, retriable); 504 DB_TIMEOUT (the report's
lane ran past its deadline).
8.15.5 Maintenance and repair routes
The operator's audit and repair routes. Every one answers the trusted operator only: the static
CORTEX_API_KEY, or any caller of an auth-disabled server. Any other credential is 403 POLICY_DENIED, whatever it holds. Most also check a capability at no scope (diagnostics.read to
report, admin.compact or admin.flush to change something), so a token's scopes confinement never
reaches them. Each acts on this node's own stores and, unless the route says otherwise, on every
tenant's data. A cluster ingress routes none of them but GET /v1/admin/events/{id}/chunks and the scope
migration routes (§8.15.5.8), and answers the others 501 CLUSTER_ROUTE_UNSUPPORTED; reach a data node with cortexdb admin node call.
| Route | Needs, beyond the trusted operator | What it does |
|---|---|---|
GET /v1/admin/layers/stats | diagnostics.read | Layer counts, layer health, enrichment and provider state (§8.15.5.1) |
POST /v1/admin/compaction/dedup | admin.compact | Delete duplicate abstraction artifacts (§8.15.5.2) |
POST /v1/admin/index-audit | diagnostics.read; admin.compact with repair | Audit the search indexes against the event log, and repair them (§8.15.5.3) |
POST /v1/admin/index-audit/source-blob-links | diagnostics.read; admin.compact to apply | Link transcript events to the blobs their labels name (§8.15.5.4) |
GET /v1/admin/index-audit/orphan-blobs | diagnostics.read | Live blobs no event references (§8.15.5.4) |
POST /v1/admin/index-audit/reinclude | nothing more | Bring back an event excluded after it failed to index (§8.15.5.5) |
GET /v1/admin/events/{id}/chunks | diagnostics.read | The chunks one event was indexed as (§8.15.5.6) |
POST /v1/admin/persist | admin.flush | Save the snapshots a graceful shutdown saves (§8.15.5.7) |
POST /v1/admin/vector-hygiene | diagnostics.read; admin.compact with repair | Find and delete orphan chunk vectors (§8.15.5.7) |
POST /v1/admin/scopes/migrate, GET /v1/admin/scopes/migrate/{id} | admin.compact | Copy or move one scope's events, as a job (§8.15.5.8) |
GET /v1/admin/compile-dead-letter | diagnostics.read | Parked artifact-compile sessions (§8.15.5.9) |
How long they run. The synchronous routes work on the database lane. Since 0.14.0 the six long
operations (the dedup, the index audit and its repair, vector hygiene, persist, the source-blob links and
the re-inclusion) run to completion once the lane admits them, and their answer is their outcome:
CORTEX_EVIDENCE_TIMEOUT_MS (default 120 s, from 100 ms to 300 s) bounds their admission only, so a
full-log audit of a large store answers when it ends. The other synchronous routes wait at most
CORTEX_EVIDENCE_TIMEOUT_MS; a run still going then answers 504 DB_TIMEOUT (not retriable). A lane
that did not admit the work answers 503 DB_SATURATED (its queue is full) or 503 DB_UNAVAILABLE,
both retriable since nothing started, and 503 NOT_AVAILABLE a server with no storage engine wired. (Before 0.14.0 each lane failure was a 503 DB_UNAVAILABLE, or VECTOR_HYGIENE_FAILED on the hygiene route, not retriable.)
The bodies of POST /v1/admin/index-audit, /v1/admin/vector-hygiene and /v1/admin/index-audit/source-blob-links
are optional: no bytes at all are the route's defaults, with or without a Content-Type. Any bytes must be JSON
declared as such: since 0.14.0 a body without a JSON Content-Type is 415 UNSUPPORTED_MEDIA_TYPE (not retriable),
never ignored, one that does not parse 400 INVALID_BODY, and one that is not the request 422 INVALID_BODY (each of
the three requests is strict, an unknown field included).
8.15.5.1 GET /v1/admin/layers/stats
Capability: trusted operator + diagnostics.read.
Experimental (the response carries x-cortex-stability: experimental) and process-global. global
and by_scope are the auto-layer scheduler's counters: ticks, scopes seen and excluded, and per scope
the episodes, beliefs and concepts built, the errors, last_built_at and last_excluded_at, for every
scope it built, failed to build or excluded, of every tenant. belief_reconcile is the incremental belief rebuild
(§8.15). bitemporal (mode, records, open_conflicts, stats, top_unmapped_predicates) is
present only with the bi-temporal engine. health:
| Field | Type | Notes |
|---|---|---|
llm_roles, layer_sources, concepts_gated_by, enrichment_backlog_stalled, enrichment_backlog_note | object, string, boolean | How each layer is produced and what gates it (§8.15) |
enrichment_configured, llm_configured, scheduler_enabled | boolean | What the binary wired at boot |
enrichment_mode | string | off, inline or deferred:<N>s |
enrichment_status | string | off; failing (an event got no derived output); degraded (fallbacks fired, or the enrichment or embedding provider is unhealthy); healthy |
raw_indexing_healthy | boolean | No accepted write has failed to index since start |
enrichment_failures_total, enrichment_degrades | integer, object | Terminal failures, and survivable fallbacks by cause |
enrichment_jobs_queued_total, enrichment_jobs_completed_total, enrichment_jobs_pending | integer | Progress since start, from which a client derives throughput and an ETA |
enrichment_deferred_backlog | integer or null | Events the deferred scanner counts; null without deferred mode |
enrichment_llm_usage, enrichment_llm_usage_durable | object, boolean | Enrichment LLM usage by family (entity, knowledge, qa), read from the durable usage ledger when one is installed |
enrichment_coverage, consolidation_backlog | object, integer | Extraction coverage since start, and the entities due a consolidation pass |
enrichment_retry_set_size, enrichment_dead_letter_size | integer or null | Events awaiting an enrichment retry, and parked ones |
provider_health | object or null | Per role (embedding, llm, enrichment, answer, verifier): healthy, consecutive_failures, totals, the rolling window and the last error; a role turns unhealthy after CORTEX_PROVIDER_UNHEALTHY_THRESHOLD (5) failures in a row and recovers on the next success |
synthesis_cross_tenant_skips_total, synthesis_org_tree_skips_total, synthesis_private_skips_total | integer | Syntheses refused at the tenant, org-tree and private-region boundaries |
artifact_bundles_committed, artifact_compile_failures, artifact_sessions_pending | integer or null | Null while the artifact plane is off |
vectors_active, vectors_tombstoned, vectors_evicted_total, vectors_cold | integer | The chunk vector index |
by_scope | object | Per scope: has_writes, and for facts, episodes, beliefs and concepts the records (counted up to 100,000) and, for an empty layer, a blocked_reason: no_writes_yet, enrichment_unconfigured, enrichment_failing, scheduler_disabled, llm_unconfigured or concepts_gated_enrichment_unset |
health.by_scope covers the scopes the scheduler has seen and those the registry holds for the
caller's billing tenant. The storage reads share one database-lane admission: when it fails the route
still answers 200, with health.by_scope empty and the engine's fields 0 or null. Errors: 403 POLICY_DENIED.
8.15.5.2 POST /v1/admin/compaction/dedup
Capability: trusted operator + admin.compact.
A repair for stores the compaction loop bloated before it kept a dedup registry. It reads every procedure, knowledge and concept artifact of the content store, groups them by tenant, scope and text, keeps the oldest of each group, deletes the others from the content store and the full-text and vector indexes, and records the kept ones so the loop cannot add them again. Captured events and the event log are never touched. Idempotent and safe on a live server; it takes no body.
{"status": "ok", "kept": 412, "removed_total": 3071,
"removed_procedures": 120, "removed_knowledge": 2903, "removed_concepts": 48}
{"status": "unsupported"} alone means the engine keeps no abstraction store. Errors: 403 POLICY_DENIED, 500 DEDUP_FAILED and 503 NOT_AVAILABLE, none retriable; 503 DB_SATURATED and
DB_UNAVAILABLE (retriable).
8.15.5.3 POST /v1/admin/index-audit
Capability: trusted operator + diagnostics.read for a report, admin.compact for a repair.
What it checks, and why vectors is opt-in, is in §8.15. The body is optional: without a
Content-Type header the defaults apply, and unknown fields are ignored.
| Field | Type | Notes |
|---|---|---|
repair | boolean | Default false. Re-index what the audit finds from stored state: missing BM25 documents (restoring a missing content row from the event's stored content), and with vectors the lost chunk vectors. Appends nothing to the event log |
scope | string | Audit and repair only the events whose tenant or scope is this string or lies under it. Not parsed as a scope path |
vectors | boolean | Default false. Also ask whether each chunk's vector exists in either tier |
{"scanned": 18233, "missing": [], "missing_total": 0, "repaired": 0, "repair_failed": 0,
"vector_repair_skipped": 0, "missing_vectors": ["0193c2b8-5d1e-7a40-9f1e-2c7d9a0b4e11"],
"missing_vectors_total": 1, "vectors_repaired": 0, "repaired_from_wal": 0, "errors": [],
"vector_families": [{"family": "chunk", "directory": "vector", "open": true, "dimensions": 1536,
"vectors": 40311, "shortfall": 0, "empty_but_expected": false, "row_audited": true,
"repairable_by_audit": true, "refill": "..."}],
"vector_families_incomplete": false, "clean": false}
missing and missing_vectors are bare event UUIDs in log order, the first 1,000; the totals count
all of them. vector_families reports the four families (chunk, entity, derived, summary) on
every call: vectors, a countable expected_at_least where one exists, shortfall, and
empty_but_expected, the one fault the audit claims for a family it cannot check per row; only
chunk is checked per row, and only chunk is repaired here (refill says how to refill the
others). vector_rebuild_pending appears while a vector rebuild record exists (indexes dropped for an
embedding change): its outstanding families, satisfied, and cleared once a {"repair": true, "vectors": true} call found every family refilled and deleted the record. embedding_repin appears
while an embedding provider repin has had no rebuild; the audit never repairs it. clean is the
verdict: true only for a call with vectors: true that found nothing outstanding and hit no error, so
a call without vectors is never clean. A repair that put a vector back clears the /v1/answer
cache. Errors: 403 POLICY_DENIED, 500 INDEX_AUDIT_FAILED, 503 NOT_AVAILABLE, 503 DB_SATURATED and DB_UNAVAILABLE (retriable).
8.15.5.4 Blob links: POST /v1/admin/index-audit/source-blob-links and GET /v1/admin/index-audit/orphan-blobs
Capability: trusted operator + diagnostics.read (a dry run, and the report) or admin.compact
(an apply).
Without a scope both are confined to the caller's billing tenant, which for the operator key is
default, as for an auth-disabled server: they reach the events and blobs written with the operator key
or with auth disabled. With one they reach any tenant: the links repair walks every event under scope,
whichever tenant wrote it (each label still linked only to a live blob of the event's own tenant and
caller), and the orphan report lists the blobs of scope's tenant (the bound tenant of the nearest
registered record at or above it, else its org:<id> root's id).
The links repair: transcript events written before erasure_blob_cascade_v1 name their blob only
through a source_blob:<blob_id> label, which erasure does not trust (a label is client-writable), so
the blob survives the event's erasure. The repair walks the tenant's captured events (or one scope
subtree) and links a label only when it names a live blob of the event's own tenant and caller; it
reports the rest as unverifiable and leaves them. The body is optional, {"scope": "org:acme/team:a", "dry_run": true}; dry_run defaults to true. An apply proposes the links to the event log
(LinkSourceBlobs), which every replica applies.
{"applied": false, "events_scanned": 5120, "events_with_label": 88, "events_already_linked": 12,
"events_linked": 74, "links_added": 74, "unverifiable_total": 2,
"unverifiable": [{"event_id": "evt_...", "blob_id": "blob_...",
"reason": "not a live blob of this event's tenant and caller"}]}
unverifiable lists the first 100. Errors: 403 POLICY_DENIED, 409 UNIFIED_WAL_REQUIRED (never on
a serving server), 422 INVALID_SCOPE, 500 SOURCE_BLOB_LINKS_FAILED, 503 NOT_AVAILABLE (not retriable), 503 DB_SATURATED and DB_UNAVAILABLE (retriable), and 503 NOT_LEADER, WAL_UNAVAILABLE or WAL_OUTCOME_UNKNOWN for an
apply's refused or lost proposal (retriable).
The orphan report lists the tenant's live blobs that no surviving event links (source_blob_ids) or
references (a processor-path blob reference, or a sealed segment's event): blobs inlined before 0.10.1,
and uploads never used. It deletes nothing; deleting is the operator's decision (DELETE /v1/blobs/{id}). Query: limit, the orphans listed (default 100, at most 1,000; the totals always count
every blob), and scope (above; 422 INVALID_SCOPE when it does not parse). Any other query parameter
is 400 INVALID_QUERY.
{"live_blobs": 230, "referenced_blobs": 221, "orphans_total": 9, "truncated": false,
"orphans": [{"blob_id": "blob_...", "content_type": "text/plain", "size_bytes": 5120,
"sha256": "...", "uploaded_by": "user:local", "label_only_events": ["evt_..."]}]}
A blob with label_only_events (at most 10) is named by surviving events through a label the repair
has not linked: run the repair first, it is not safe to delete. Records imported from the legacy
sidecar carry no tenant and are never listed. Errors: 400 INVALID_QUERY, 403 POLICY_DENIED, 422 INVALID_SCOPE, 500 ORPHAN_BLOB_REPORT_FAILED, 503 NOT_AVAILABLE, 503 DB_SATURATED and DB_UNAVAILABLE (retriable), 504 DB_TIMEOUT.
8.15.5.5 POST /v1/admin/index-audit/reinclude
Capability: trusted operator (no capability).
A write answered 502 INDEXING_FAILED is stored but excluded from recall, and nothing else brings it
back. This proposes the un-exclusion, then indexes the event in place under its own id, as the
indexer's recovery does; an attempt that does not index puts the exclusion back.
POST /v1/admin/index-audit/reinclude
{"event_id": "evt_0193c2b85d1e7a409f1e2c7d9a0b4e11", "scope": "org:acme/user:alice"}
200
{"event_id": "evt_0193c2b85d1e7a409f1e2c7d9a0b4e11", "scope": "org:acme/user:alice",
"reincluded": true, "indexed": true}
scope is the event's scope or one above it. Single node only. Errors: 404 NOT_FOUND (no captured
event with that id under scope), 409 EVENT_NOT_EXCLUDED, 409 EVENT_CANCELLED (a writer's cancel is
never undone), 409 REINCLUDE_UNSUPPORTED (a cluster data node; the ingress does not route it), 422 INVALID_EVENT_ID, 422 INVALID_SCOPE, 500 REINCLUDE_FAILED, 502 INDEXING_FAILED (it failed again
and stays excluded), 503 INDEXING_UNAVAILABLE (its embedding provider is down; retriable), 503 WAL_UNAVAILABLE or WAL_OUTCOME_UNKNOWN (retriable), 503 NOT_AVAILABLE, 503 DB_SATURATED and DB_UNAVAILABLE
(retriable).
8.15.5.6 GET /v1/admin/events/{id}/chunks
Capability: trusted operator + diagnostics.read; a content-returning admin route (class
admin_content, §8.15.3).
The chunks one event was indexed as; the table in §8.15 lists each chunk's fields. The event itself
carries event_id, scope, content_kind (null when the envelope names none), stored_text_bytes
(null unless a text or message event), language, scripts, source_blob_ids, chunker_version,
chunk_count and chunks[]. ?scope= (since 0.14.0) names where the event lies: its own scope must lie at or under it, else the
same 404, and within it the trusted operator reaches every tenant's events; without it the route reads
the caller's billing tenant's events only (default for the operator key, §8.15.5.4). The event's own
scope must be one the caller may read: an unknown, foreign, erased, forgotten or cancelled id, an event
excluded from recall and one sealed into the segment store are the same 404 NOT_FOUND. Under
CORTEX_OPERATOR_DATA_READS=deny the operator key needs the break-glass header, decided once the event is
read, by its own scope (class admin_content, or private_region for a row in a private region; §8.15.3,
"By-id reads"). A cluster requires
scope: the ingress routes the request to the leader of its root and the data node's edge fences it
there; without it a cluster answers 501 CLUSTER_ROUTE_UNSUPPORTED. A scope that does not parse is
422 INVALID_SCOPE_GRAMMAR, and an unknown query field 400 INVALID_QUERY. Errors: 400 INVALID_QUERY, 403 POLICY_DENIED, 403 BREAK_GLASS_REQUIRED, 404 NOT_FOUND, 422 INVALID_SCOPE_GRAMMAR, 500 CHUNK_INSPECTION_FAILED, 501 CLUSTER_ROUTE_UNSUPPORTED,
503 NOT_AVAILABLE, 503 DB_SATURATED and DB_UNAVAILABLE (retriable), 504 DB_TIMEOUT.
8.15.5.7 POST /v1/admin/persist and POST /v1/admin/vector-hygiene
Capability: trusted operator + admin.flush (persist); diagnostics.read for a hygiene report,
admin.compact for a hygiene repair.
POST /v1/admin/persist runs the snapshot save a graceful shutdown runs (the vector indexes that saw
writes, the fact store, the bi-temporal store, the layer snapshot and the resolver's fuzzy-match
sidecar) and answers {"persisted": true, "elapsed_ms": 812, "saved": ["vector", "fact_store"], "skipped": ["bitemporal"]}: saved the stores it wrote, skipped those with nothing to write since their last save (the
stores are vector, entity_vector, derived_vector, summary_vector, fact_store, bitemporal,
layer_snapshot and entity_fuzzy, the optional ones only where they run). A harness that cannot signal the server
(Windows) calls it before killing the process, so the next boot replays nothing the periodic saver
(CORTEX_SNAPSHOT_INTERVAL_SECS, default 300 s) had not saved. A store whose save
fails answers 500 PERSIST_FAILED (not retriable), details: {persisted: false, elapsed_ms, saved, skipped, failed: [{store, error}]} (since 0.14.0; before, persisted was always true and a failed save only logged). It
takes no body. Errors: 403 POLICY_DENIED, 500 PERSIST_FAILED, 503 NOT_AVAILABLE, 503 DB_SATURATED and
DB_UNAVAILABLE (retriable).
POST /v1/admin/vector-hygiene walks every row of the chunk vector index and counts as an orphan a
row nothing claims: no content row, no event of that id in the log, no fact. Recall can never resolve
one. The body is optional and strict, {repair} (default false); {"repair": true} deletes the orphans.
Every call walks the whole index, since an orphan row names no scope: scope or vectors is 422 INVALID_BODY, details: {reason: "field_not_applied", field} (since 0.14.0; they were accepted and ignored),
and any other field the body parser's refusal.
{"status": "ok", "scanned": 2604113, "orphaned": 3, "deleted": 0, "repair": false,
"elapsed_ms": 48211, "examples": ["0193c2b8-5d1e-7a40-9f1e-2c7d9a0b4e11"]}
examples lists the first 50; {"status": "unsupported"} alone means the engine has no rows to walk.
Errors: 403 POLICY_DENIED, 422 INVALID_BODY, 500 VECTOR_HYGIENE_FAILED (the row scan failed), 503 NOT_AVAILABLE, 503 DB_SATURATED and DB_UNAVAILABLE (retriable: the database lane did not admit the walk, and
nothing started).
8.15.5.8 POST /v1/admin/scopes/migrate and GET /v1/admin/scopes/migrate/{id}
Capability: trusted operator + admin.compact.
What a copy and a move do is in §8.15. Body (strict: an unknown field is refused):
| Field | Type | Notes |
|---|---|---|
from | string | Required. The scope whose subtree's events are copied |
to | string | Required. The scope the copies are written under, at the same relative paths; not at or under from |
mode | string | copy (default) or move, any case |
dry_run | boolean | Default false. Count and write nothing: copied stays 0, and source_events less already_copied is what a run would copy |
batch_size | integer | 1 to 500, default 100: events per page and per bulk capture |
confirm_erase_source | boolean | Required true for a move that is not a dry run |
The start answers 202 {"job_id": "job_<32 hex>", "status": "running", "status_url": "/v1/admin/scopes/migrate/job_<32 hex>"}. The job:
{"job_id": "job_0193c2b85d1e7a409f1e2c7d9a0b4e11", "from": "user:x/source:chatgpt", "to": "user:x",
"mode": "move", "dry_run": false, "status": "done",
"started_at": "2026-10-27T10:00:00Z", "finished_at": "2026-10-27T10:00:41Z",
"report": {"dry_run": false, "source_events": 1200, "sealed_events": 0, "copied": 1180, "already_copied": 20,
"failed": 0, "skipped": {"redacted": 0, "excluded": 0, "forgotten": 0}, "errors": []},
"erasure": {"erasure_id": "erasure_01HX...", "status_url": "/v1/erasures/erasure_01HX...",
"receipt_url": "/v1/erasures/erasure_01HX.../receipt", "verify_url": "/v1/erasures/erasure_01HX.../verify"},
"source_erased": true}
status is running, done or failed; finished_at is absent while it runs, and report before the first
pass ends: {dry_run, source_events, sealed_events, copied, already_copied, failed, skipped: {redacted, excluded, forgotten}, errors[]} (at most 20 error samples). A move's job carries erasure ({erasure_id, status_url, receipt_url, verify_url}) and source_erased; a failed job carries error. A copy whose rows failed ends failed
with its report, and a re-run copies the rest. The report's skipped_existing of 0.13.x is already_copied, and
its triple_facts_rewritten is gone: a copy's typed triple writes its fact through the indexer tail, as every
capture does. A run that is not a dry run clears the whole /v1/answer cache. Job records live in this node's
memory: a restart forgets them (404 NOT_FOUND); a move's erasure keeps its receipt. Errors of the start: 403 POLICY_DENIED (not the trusted operator, or no admin.compact), 403 BREAK_GLASS_REQUIRED (class in_band, a
migration out of or into a private region, or into a shared org-tree scope, under deny), 422 INVALID_SCOPE
(details.field: from or to does not parse), 422 INVALID_BODY (details.field: to with details.reason: "target_inside_source" for a to at or under from; mode; confirm_erase_source), 422 CROSS_SHARD_REQUEST (a
data node, details.field and details.root: a root this shard does not hold), 503 SERVER_SHUTTING_DOWN
(retriable). The job route answers 403 POLICY_DENIED and 404 NOT_FOUND.
8.15.5.9 GET /v1/admin/compile-dead-letter
Capability: trusted operator + diagnostics.read; a content-returning admin route (class
admin_content, §8.15.3).
Every artifact-compile session the compiler parked after its retry cap, of every tenant, in one unpaginated list:
{"parked_sessions": 1,
"sessions": [{"tenant_root": "org:acme", "session_id": "s-17", "reason": "extraction failed: ...",
"attempts_at_park": 3, "restart_retries": 1, "from_backfill": false,
"parked_at_micros": 1761638400000000}]}
tenant_root is the scope root of the session's scope; restart_retries counts boot re-queues
(CORTEX_ARTIFACT_COMPILE_RESTART_RETRY_MAX, default 1); parked_at_micros is microseconds since the
Unix epoch. The list is empty while the artifact plane is off (CORTEX_ARTIFACT_DUAL_WRITE). reason
is extraction failure text, so under CORTEX_OPERATOR_DATA_READS=deny the operator key needs the
break-glass header. Errors: 403 POLICY_DENIED, 403 BREAK_GLASS_REQUIRED.
8.15.6 The segment store routes (/v1/admin/ice/*)
The segment store (docs/ICE_TIER_PLAN.md, step 3; off unless CORTEX_ICE_URL is set) seals old
events, by scope root, into encrypted segment objects. Three operator routes read and steer it. All
three answer the trusted operator only (the static CORTEX_API_KEY, or any caller of an auth-disabled
server), each with a capability checked at no scope, and 409 ICE_OFF while the store is off. Each
waits for the database lane by CORTEX_EVIDENCE_TIMEOUT_MS (else 503 DB_UNAVAILABLE, or 503 DB_SATURATED for a full queue, both retriable) and,
once admitted, runs to its end, so the answer says what it did. A cluster ingress routes none of them
(501 CLUSTER_ROUTE_UNSUPPORTED); a data node, which runs the store too since ice step 4.2, answers
for itself through cortexdb admin node call.
GET /v1/admin/ice/status (diagnostics.read): the settings (url, target_percent, hot_days,
segment_mb, the per-request read budgets), the caches (cache), the read counters (reads), what the
log's manifests hold (segments), the owner record (owner) and the archiver (archiver: passes,
the last pass and seal, the totals since boot, the data disk's outlook with hours_to_critical,
leading and foreign_key_segments). GET /v1/admin/metrics carries the same object as ice. On a
cluster data node owner.state is follower on a replica that does not lead its shard, and
archiver.leading says whether this replica seals.
POST /v1/admin/ice/seal (admin.compact): seal now, whatever the disk; the archiver does it on
its own while the data disk is above CORTEX_ICE_TARGET_PERCENT.
{"root": "org:acme", "max_segments": 4}
| Field | Type | Notes |
|---|---|---|
root | string | Optional. A scope root (org:acme), compared trimmed; every root's oldest rows when absent |
max_segments | integer | Default 4, from 1 to 64 |
The body is required ({} for the defaults) and takes no other field. Every other rule of the
archiver holds: only events the indexer applied, outside the hot window (CORTEX_ICE_HOT_DAYS), that
enrichment has learned from, under a root no re-derivation holds. The answer is the pass report
(sealed_segments, sealed_events, uploaded_bytes, ...; all 0 when nothing was eligible); a 200
whose error is set sealed some segments before a later one failed. On a cluster only the shard's
leader seals. Errors: 403 POLICY_DENIED, 409 ICE_OFF, 422 INVALID_REQUEST (root is not a scope
root, or max_segments is outside 1 to 64), 503 ICE_FAILED (retriable: nothing was sealed, because
the store did not take the upload or this replica does not lead its shard; the events stay live),
503 DB_UNAVAILABLE (retriable).
POST /v1/admin/ice/owner (admin.compact): the operator's decision on an owner conflict. A
server that finds another owner of its ice location (a copy of its data dir, or a restored backup of a
server that kept running) deletes nothing there until told. {"action": "adopt"}: the other server is
gone for good, so this one takes the location over. {"action": "fork"}: both keep running; this one
writes under its own prefix (forks/<instance>/), rewrites the segments it shares into it over time,
and never deletes the shared objects. The answer is the owner state after the decision. On a cluster
data node the record is the shard's, which every replica shares, and fork is refused, 409 ICE_FORK_UNSUPPORTED (not retriable). Errors: 403 POLICY_DENIED, 409 ICE_OFF, 409 ICE_FORK_UNSUPPORTED,
422 INVALID_REQUEST (action is neither), 503 ICE_FAILED (retriable: the store did not take the record), 503 DB_UNAVAILABLE (retriable).
8.15.7 The shard's apply format (shard_format) and its ceiling (0.15.0)
Governed memory formation needs shard apply format 11. Arming is one-way: take a cold backup first
(scripts/cold_backup.py). A data directory arms the newest format its binary builds at its first boot of a
release, unless the operator holds its format ceiling lower (CORTEX_FORMAT_CEILING on a single node,
[engine] format_ceiling on a cluster data node: unset or latest is the binary's format, a number caps it,
7 or less arms nothing). Once armed, only the backup taken before goes back.
GET /v1/admin/metrics reports the state as shard_format (ShardFormatStatus in the openapi; one point read
of the shard's state, omitted with no shard), and so does a cluster data node's /node/v1/status:
"shard_format": {"binary": 11, "ceiling": 10, "armed": 10,
"pending": {"format": 11, "reason": "arming_disabled", "node": 1}}
binary is the binary's apply format; ceiling this node's effective ceiling, as it read it at boot; armed
the format the shard is armed for (its applied max_format, 0 when it never armed); pending why the shard is
not armed at binary, null once it is. pending.reason is a 503 FORMAT_UPGRADE_PENDING's (§16):
members_behind (a member's binary is below the format, did not answer the leader's probe, or holds another
tenant depth; the leader arms by itself once the member answers), arming_disabled (a member's ceiling holds
it: only the operator's raise clears it) or reserved_path_in_use (a registry record at a marker path, or at a
companion path a record that is not a companion of kind attrs, with paths and count; a real companion never
holds a shard since 0.15.1). pending.node names the member that holds the shard: on the shard's leader, the one its
last arming pass found; this node itself when its own ceiling holds it; null on a follower whose own binary
and ceiling allow the format (its leader's status names the member). While a snapshot installs,
/node/v1/status answers {"error": "SNAPSHOT_INSTALLING"} in its place.
The ceiling on a single node, from the console. The Settings page shows shard_format and the ceiling as a
curated, one-way setting: GET /internal/ui/settings lists it as the connection shard_format (one_way: true, its field ceiling with the options "" (the newest format, the default), 10 and 11), with what a
save asks (confirm: ["data_dir", "cold_backup"]) and the data directory's path as this server sees it
(data_dir). PUT /internal/ui/settings/shard_format writes it to <data_dir>/settings_overrides.json, which the
next boot applies over the server's environment, like every setting (restart_required: true):
PUT /internal/ui/settings/shard_format
{"values": {"ceiling": "11"},
"confirm": {"data_dir": "/var/lib/cortexdb", "cold_backup": true}}
200
{"connection": "shard_format", "saved": true, "restart_required": true, "kept": [], "arms": 11}
A value that lets the next boot arm the shard for a format above the one it is armed for (8 or more) is saved
only when confirm.data_dir names the data directory (the same path, a trailing separator ignored, or the
same directory once both resolve) and confirm.cold_backup is true: else 422 ONE_WAY_CONFIRMATION_REQUIRED, details.missing naming what is missing, and nothing is saved. arms is the
format the next boot arms the shard for, null for a save that arms nothing (a hold at the armed format needs no
confirmation). A value below the format the shard is armed for holds nothing back and is refused, 409 FORMAT_ARMED_ONE_WAY. These routes are internal (trusted operator; the save needs admin.compact) and not in the
openapi. A cluster data node reads no override file and answers 403 on /internal/ui/*: its ceiling is the
[engine] key, raised on every member with a rolling restart.
8.15.8 The online re-embed (/v1/admin/reembed, 0.16.0)
Moves a data directory to another embedding model (a local model, another remote model, another width) while it
serves. A background job builds every vector index the server keeps again, under the TARGET model, in
<data_dir>/reembed/<job_id>/ beside the live ones, which go on serving recall unchanged; once its copy is complete
(ready) the job keeps it current with every write, forget, erasure and retention change. The next restart whose
configured provider resolves to the target swaps the copies in before storage opens (directory renames, then the
pin), checks them and serves: recall never drops to BM25 alone. Nothing changes before that restart, and a restart
on the current provider resumes the job. The operator procedure is docs/EMBEDDING_MIGRATION_RUNBOOK.md, whose
offline drop and refill stays the path for a cluster.
Who. Every route answers the trusted operator only (the static CORTEX_API_KEY, or any caller of an
auth-disabled server); a start, a cancel and a cleanup also need admin.compact, as index-audit repair does. A
single node only: a cluster data node answers 409 REEMBED_UNSUPPORTED_ON_CLUSTER on every route, and an ingress
routes none of them (501 CLUSTER_ROUTE_UNSUPPORTED).
What the job carries. Every vector the server embeds itself, embedded again from the input its live writer
embedded (the same text, as a document or as a query as that writer did), under the same id and partition, into a
store of the same kind that the same opener opens. A tenant-sharded pool (CORTEX_VECTOR_TENANT_SHARDS) is copied as a
pool of the same shard count, shard n of the copy holding the rows of live shard n:
| Family | Live store | Rows |
|---|---|---|
chunks | vector/, or the tenant pool vector_shards/ | Event chunks, each from the body its content row holds (so a chunk keeps its id whatever the chunker does now), and the enrichment rows that share the index: facts, triples, summaries, synthetic questions, gloss rows, question keys, multimodal derived text, abstraction events |
derived | derived_vectors/ (CORTEX_DERIVED_EMBEDDINGS) | Facts and beliefs |
entities | entity_vector/ | Entity names, each from the entity's registered name |
summaries | summary_vectors/, or summary_vector_shards/ | Rollup summaries |
layer_vectors | v1_layers/, family layer_vectors | The fp16 fact, belief, episode and concept embeddings |
Not carried: the code plane's index (its own provider, CORTEX_CODE_EMBEDDING_*), the artifact semantic projection
(keyed by the model, it fills itself again after a model change), the shape classifier's cache (keyed by the pin), and
the vectors inside declared records in the source log, which nothing rewrites.
POST /v1/admin/reembed: the plan (dry_run, the default) or the start.
{"to": {"provider": "local", "model": "potion-multilingual-128M"}, "dry_run": true, "retain_old_index": false}
| Field | Type | Notes |
|---|---|---|
to.provider | string | Required: a CORTEX_EMBEDDING_PROVIDER name (local, openai, ...) |
to.model | string | A CORTEX_EMBEDDING_MODEL name, or for local a CORTEX_LOCAL_EMBEDDING_MODEL one (default for local: potion-multilingual-128M, the voice profile's model, on any server; restart_with then names it) |
to.dims | integer | As CORTEX_EMBEDDING_DIMS; a local model only at its own width |
dry_run | bool | Default true |
retain_old_index | bool | Default false. true keeps the old indexes after the swap, in reembed/<job_id>/old/, until POST /v1/admin/reembed/cleanup |
The target resolves exactly as a boot resolves the configured provider (the same function, with to laid over the
server's environment), so a remote target's key and URL come from the server's environment or settings, never from
the request. Any other field, in the body or in to, is 422 INVALID_BODY; an empty to.provider is 422 INVALID_REQUEST.
The plan answers 200, with blockers or without:
{
"dry_run": true,
"current_pin": "openai:text-embedding-3-small:1536",
"target_pin": "local:potion-multilingual-128M@73908c3438cf:256:int8",
"dimension_change": true,
"families": {"chunks": {"rows": 515720}, "derived": {"rows": 0}, "entities": {"rows": 0},
"summaries": {"rows": 0}, "layer_vectors": {"rows": 0}},
"estimate": {"embedding_inputs": 515720, "input_tokens": 61000000, "cost_usd": 0.0,
"seconds": 180, "disk_bytes": 412000000, "memory_bytes": 160000000},
"serving_during_job": "current_index",
"finish": "When the job is ready, restart with the target provider configured; that restart swaps the index.",
"restart_with": {"CORTEX_EMBEDDING_PROVIDER": "local", "CORTEX_LOCAL_EMBEDDING_MODEL": "potion-multilingual-128M"},
"blockers": []
}
families names every family (one whose live store is not open, such as derived with derived embeddings off,
counts 0 rows and gets no copy). target_pin is null when the target does not resolve. In estimate,
embedding_inputs is every row; input_tokens the rows times the mean length of a sample of chunk rows, at about
four bytes a token; cost_usd the whole job at the price book's input rate (null for a remote model the price
book has no rate for, 0 for a local one); seconds from the rows-a-second rates measured at real scale (about
1,000 a thread for a static local model, 110 for a transformer, 500 for a remote target); disk_bytes what the copies
take beside the live indexes, and memory_bytes their graphs plus the RocksDB write buffers their stores fill (within
the process's RocksDB budget). restart_with is the configuration the swapping
restart sets, the model always named. The dry run makes every check the start makes before it loads the target: a
remote provider's key, and a local model's manifest, the digests of its files and, for a transformer, its ONNX
Runtime library, which must not be writable by the server's user. So a plan with no blocker is not refused for its
target at the start, except when the load itself fails (a library that is no ONNX Runtime). Each blocker is {code, message}, and a start refuses on any:
| Code | Why |
|---|---|
REEMBED_UNSUPPORTED_ON_CLUSTER | A cluster data node |
SEGMENTS_PRESENT | The segment store is configured (CORTEX_ICE_URL set), sealed segments or not: a segment holds the current model's codes and vectors, which recall scans and the job cannot rewrite, and the archiver seals more while a job runs |
JOB_ACTIVE | A job is building, ready or swapping: one at a time |
OLD_INDEX_RETAINED | A swapped job kept its old index, which a new job would delete unasked: clean it up first |
TARGET_UNAVAILABLE | The target does not resolve, or the start's load would refuse it; the message says why (model files missing or not the ones its manifest names, an ONNX Runtime library the server's user may write, a precision this CPU refuses, a missing key, a refused provider) |
TARGET_MOCK | The mock embedder, whose vectors are hashes of the text |
TARGET_IS_CURRENT | The data dir is embedded as the target already |
SCOPE_MIGRATION_ACTIVE | A /v1/admin/scopes/migrate job is running (one that starts while a job runs reaches the copies) |
DISK_INSUFFICIENT | estimate.disk_bytes is more than the disk holds before the disk guard's warn mark |
A start (dry_run: false) answers 202 with the job record as GET serves it, beside the plan's estimate and
families; with any blocker it answers 409, error_code the first blocker's code and details.blockers all of
them.
GET /v1/admin/reembed: {"job": {...}}, the current or last job, or {"job": null}.
{"job": {
"id": "rmb_01936f2b-7c1e-7d40-9a51-3f0e8c2d4b6a", "state": "building",
"current_pin": "openai:text-embedding-3-small:1536",
"target_pin": "local:potion-multilingual-128M@73908c3438cf:256:int8",
"to": {"provider": "local", "model": "potion-multilingual-128M"},
"retain_old_index": false,
"started_at": "2026-11-14T10:00:00Z", "updated_at": "2026-11-14T10:01:00Z", "finished_at": null,
"progress": {"chunks": {"done": 120000, "total": 515720, "unresolved": 0},
"derived": {"done": 0, "total": 0, "unresolved": 0}, "entities": {"done": 0, "total": 0, "unresolved": 0},
"summaries": {"done": 0, "total": 0, "unresolved": 0}, "layer_vectors": {"done": 0, "total": 0, "unresolved": 0}},
"rate_per_s": 2900.5, "eta_s": 136, "paused": null, "error": null,
"restart_with": {"CORTEX_EMBEDDING_PROVIDER": "local", "CORTEX_LOCAL_EMBEDDING_MODEL": "potion-multilingual-128M"},
"old_index_retained": false,
"current_dims": 1536, "target_dims": 256, "families": ["chunks", "entities", "layer_vectors"],
"exact": false, "verify": null
}}
| Field | Notes |
|---|---|
state | building (the walk runs), ready (the copies are complete and kept current: restart with restart_with to swap), swapping (with phase), swapped, failed (error: {code, message}; its copies are deleted), cancelled |
phase | Only while swapping: renaming, pin_written, layers, verified, repairing. Every phase but repairing runs before the swapping boot serves, so it shows only in a crash's record; repairing shows while the server serves (below) |
progress | Per family: the rows walked (done) of the rows the live store holds (total), and unresolved, rows whose input was not found (they get no vector in the copy, and the swap's repair embeds them from stored content) |
rate_per_s | Embedding inputs a second over the last minute (null until the job has embedded for a second); eta_s follows from it |
paused | null, or {reason, since}: memory_pressure (the memory monitor reads high), disk (the disk guard reads warn or critical) or provider_backoff (a remote target failed; the job retries) |
families | The families the job copies |
exact | The copies equalled the live indexes at the last graceful stop |
verify | The swapping boot's checks: rows, missing (vector-index rows the old index held and the new one does not: one row per chunk, and every other row the family's index holds, such as a fact's; the unresolved rows, and after a stop that was not graceful the rows indexed after the job's last catch-up, which the repair embeds. The repair counts events, each with all its chunks, so its REEMBED_REPAIRED events_repaired is not this number), dropped (rows of the new index the old did not hold, deleted), sampled, sample_failures (a sampled row's stored vector finds neither the row nor a row of the same vector), ok. When ok is false the old index is kept, whatever retain_old_index said |
After a swap the record stays, with finished_at set, until the next job starts; old_index_retained says whether a
cleanup is pending.
POST /v1/admin/reembed/cancel: cancels a building or ready job, its copies deleted before the answer: 200 {"job": {...}}. Any other state is 409 REEMBED_NOT_CANCELLABLE.
POST /v1/admin/reembed/cleanup: after a swap that kept the old index, deletes it: 200 {"job": {...}}, with
old_index_retained: false. Otherwise 409 REEMBED_NOTHING_TO_CLEAN.
While a job runs. Recall reads the live indexes only. Each live index carries an observer: a write's rows are
marked, and the job embeds them again with the target, one bounded step at a time on its own worker; a delete (a
forget, an erasure, retention, a move's eviction) leaves the copy in the same call as the live index. A cancelled
write stays out of recall as before. The job embeds on CORTEX_REEMBED_THREADS threads (default a quarter of the
cores, at least 1; a local target never uses the voice query pool), pauses while memory is high or the disk guard
reads warn or critical, and records a remote target's calls, batched, in the usage ledger under the role reembed
(GET /v1/admin/usage?role=reembed). A graceful stop halts the indexer, processes every pending mark within
CORTEX_REEMBED_SHUTDOWN_SECS (default 20), saves the copies and records exact; the console's restart (POST /internal/ui/restart) is a graceful stop too, which then exits 75 for the supervisor to relaunch the server. An erasure's proof (GET /v1/erasures/{id}/verify) checks the copy (reembed_side_vectors), and a swapped job's kept old index
(reembed_old_index, never ok: nothing proves the erased rows left it).
The restart. Before storage opens, the boot reads <data_dir>/reembed/job.json:
| Job | Configured provider | The boot |
|---|---|---|
ready | The target | Swaps: the copies are renamed into place and the live indexes into reembed/<job_id>/old/, and the pin is written (REEMBED_SWAPPING, REEMBED_PIN_MOVED); once storage opens, the layer_vectors rows are rewritten, the checks run (REEMBED_VERIFIED) and the old indexes are deleted unless kept. A job that was not exact (it crashed rather than stopped) is then swapping in phase repairing while the server serves: the rows indexed after its last catch-up are embedded with the target (REEMBED_REPAIR, REEMBED_REPAIRED), then it is swapped |
building or ready | The current one | Resumes (REEMBED_RESUMED). A ready job that stopped gracefully stays ready; otherwise the walk runs again from the start, keeping the chunk rows its copy holds |
building | The target | Exits 78 REEMBED_NOT_READY, naming the job, its state and progress and both ways out: restart on the current provider and let it finish, or cancel it |
swapping | The target | Finishes the swap from its phase |
swapping, the pin not moved | The current one | Undoes the renames: the job is ready again (REEMBED_SWAP_ROLLED_BACK) |
swapping, the pin moved | The current one | Exits 78 REEMBED_SWAP_INCOMPLETE: restart with the target |
failed or cancelled | Any | Deletes whatever copies are left |
A record that does not parse, or a swap whose files are not what its record says, exits 78 REEMBED_SWAP_FAILED. A
job built from a pin the dir no longer holds is failed (REEMBED_STALE). The swap waits for a restart by design:
nothing replaces a live index under a running server.
Settings. A console save that would move the pin (PUT /internal/ui/settings/{id}, 409 EMBEDDING_PIN_MISMATCH)
is accepted when a ready job targets exactly the identity it configures: the 200 then carries "reembed": {"job_id", "swap_on_restart": true}, and the restart it asks for is the swap. Every other such 409 carries
details.reembed: {"available": bool}, with job_id, state and target_pin when a job stands in the way.
Backups, restores and older binaries. scripts/cold_backup.py leaves reembed/ out of a backup and refuses one
while a swap is under way. cortexdb restore-check drops a restored dir's job (reembed_dropped), and refuses a dir
copied mid-swap (RESTORE_CHECK_REEMBED_SWAPPING). A 0.15.x binary ignores reembed/ and refuses a dir swapped to a
local: model, a provider it does not know: go back with the backup taken before the swap, or with another job to
the old model on 0.16.0.
Observability. GET /v1/admin/metrics carries reembed (ReembedMetrics in the openapi: the job, and
dirty_pending, embedded, side_deletes, side_delete_failures, late_writes; null with no job). GET /metrics carries cortexdb_reembed_state{state}, cortexdb_reembed_rows_done{family},
cortexdb_reembed_rows_total{family}, cortexdb_reembed_rows_unresolved{family},
cortexdb_reembed_rate_per_second, cortexdb_reembed_paused, cortexdb_reembed_dirty_pending,
cortexdb_reembed_embedded_total, cortexdb_reembed_side_deletes_total,
cortexdb_reembed_side_delete_failures_total and cortexdb_reembed_old_index_retained.
Errors: 403 POLICY_DENIED; 409 with a blocker's code, REEMBED_NOT_CANCELLABLE or REEMBED_NOTHING_TO_CLEAN;
422 INVALID_BODY, INVALID_REQUEST; 500 REEMBED_FAILED (a store failed); 503 REEMBED_UNAVAILABLE (this server's
engine runs no jobs), 503 NOT_AVAILABLE (no storage engine is wired, as on the other admin routes; not retriable),
503 DB_SATURATED and DB_UNAVAILABLE (retriable: the database lane did not admit the work, and nothing ran).
8.16 Auth
8.16.1 POST /v1/auth/revoke
Capability: the trusted operator (the static key or an auth-disabled server), or, for self-revocation, the token holder. auth.revoke alone does not let a token revoke another token: it is evaluated in the caller's own tenant, and the revocation list is deployment-wide. On a native memory or commitment host, whose verifier accepts tokens of its one caller only, a token of that caller holding auth.revoke revokes any of its tokens: such a host has no static key, and no other principal's token is in its revocation list.
Adds a token's jti to the revocation list. The token becomes invalid for all subsequent calls until exp passes.
{
"jti": "01HX...",
"exp": 1793000000,
"reason": "rotated"
}
| Field | Type | Notes |
|---|---|---|
jti | string | The token's id as the verifier names it (required): the bare jti of a token this server minted; with CORTEX_REVOCATIONS_V2 on (the default since 0.14.0) <namespace>:<jti> for an issuer given a namespace (commitment:<jti>, whose bare jti also still counts); an issuers-file entry's token by <entry id>:<jti> either way. The caller's own token is matched by that id or by its bare jti, and recorded under the id. |
exp | integer | The revoked token's expiry, epoch seconds above 0 (400 INVALID_REQUEST otherwise, with the switch on). With the switch on the revocation is dropped 60 s after it; one revoked without exp is kept. A caller revoking its own token stores that token's own exp, whatever this says. Ignored while the switch is off, which keeps every revocation as 0.13.x does. |
reason | string | Accepted and not stored. |
Response: 204 No Content.
Runtime returns 204 only after durable journal synchronization and cache publication. All JTI strings accepted by signed-token verification remain revocable; the writer and cache use a domain-separated SHA-256 digest of the exact UTF-8 identity, without normalization or a new token-admission restriction. Existing HTTP/header limits remain unchanged. Unavailable or full persistence returns redacted 503. The journal (<data_dir>/token-revocation-v1) retains at most 1M digest tombstones / 512 MiB. With CORTEX_REVOCATIONS_V2 on it drops, at boot and hourly, each revocation whose token's exp passed more than 60 s ago, rewriting itself in a form an older binary still opens; with it off nothing is pruned. Startup refuses damaged or missing previously initialized history. The journal must accompany backups and compatible binary rollback; restoring older history requires an independent revocation floor (ADR-MEM-026). On a cluster data node the revocation is the metadata group's: 204 only once the
group committed it (its leader drops it after exp the same way), and a commit that failed is
503 REVOCATION_UNAVAILABLE, retriable. The ingress routes the request by the bearer's tenant while that root
is assigned, else to any owner.
Errors: 400 INVALID_REQUEST (exp at or below 0 with the switch on); 403 POLICY_DENIED (another token's
id, by a credential other than the trusted operator; details.reason: "revoke_requires_operator" since
0.14.0, when the envelope carried no details);
503 REVOCATION_UNAVAILABLE (retriable on both paths since 0.14.0; nothing is reported revoked: on a plain node the
journal did not sync or is full, on a cluster the metadata group did not commit it).
8.16.2 GET /v1/auth/whoami
Capability: (open to authenticated callers)
Returns the effective identity and capability set for the current token. Useful for clients and SDKs to introspect their environment.
{
"caller": "agent:planner_v3",
"tenant_id": "acme",
"deployment_preset": "cloud_shared_saas",
"token": {"jti": "01HX...", "iss": "...", "exp": 1715836800},
"effective_capabilities": ["scope.write", "scope.read.holistic", "lifecycle.subscribe", "..."]
}
caller is the token's sub, tenant_id its billing tenant (the id in aud, cortexdb:tenant:<id>), and
deployment_preset the preset this server loaded. The trusted operator's synthetic credentials answer
token.iss static-api-key (tenant default) or, with auth disabled, auth-disabled (tenant default,
deployment_preset: "auth_disabled"), and an unsigned dev_local actor dev_local-unsigned (tenant dev).
effective_capabilities is the capability catalog of GET /v1/policy/effective (§5.5.1) evaluated with no
scope; since 0.14.0 that is every capability the server names, auth.mint, auth.mint.on_behalf_of and
forget.by_key included (0.13.x never listed them). For a token that carries scopes it lists
only the families a <capability>:* entry names: a subtree or exact entry holds only at a scope, and since
0.14.0 a family no entry names holds nowhere (§4.7). Use GET /v1/policy/effective?scope= for the set at a
scope. Roster roles are not consulted.
chain (principal_chain_v1) is added only for a token that carries a principal-chain claim other than
minter (act, app, client, run, run_start, taint, auth_time): each claim it carries (act as
the agent's id), client as it resolves (agent for a token with act, app or run, or whose sub is
not a user:, unless it says person), and issuer, the issuer entry that verified it (minter,
commitment, an issuers-file entry's id, or unknown):
"chain": {"act": "agent:planner", "client": "agent", "run": "run-7", "run_start": 1792996400,
"minter": "user:alice", "issuer": "minter"}
A token of an issuers-file entry in prefix, hash or directory mode may call it without
X-Cortex-Actor and learns its mapped caller here. On a cluster the ingress routes it by the bearer's
tenant while that root is assigned, else to any owner. It has no errors of its own.
8.16.3 POST /v1/auth/tokens — Mint tokens (narrowed and scope-confined)
Capability: auth.mint — 🔒 not in free-tier tokens (audit FRI-3).
Free-tier signups can't mint child tokens; you'll get 403 POLICY_DENIED
with "caller lacks auth.mint capability". This is by design — auth.mint
is granted to operator/tenant-admin tokens on Starter+, or to any token on
self-hosted on_prem_enterprise deployments.
Self-hosted (free): flip the deployment preset to on_prem_enterprise
and you get auth.mint deployment-wide.
Cloud: upgrade to Starter+ to get auth.mint on your tenant scope, or
contact sales for an operator token if you're building multi-tenant
infrastructure.
| Field | Type | Notes |
|---|---|---|
subject | string | Actor the token is for, e.g. agent:planner_v3 (required); one that is not an actor id is 422 INVALID_BODY |
scope | string | Where the caller's auth.mint is evaluated; omit for a deployment-wide check. It does not confine the minted token. One that is not a scope path is 422 INVALID_SCOPE_GRAMMAR. A token that carries scopes must name auth.mint by an entry covering it (auth.mint:* for a mint without scope). |
ttl_seconds | int | Default 3600, clamped to at least 60. Above the subject's lifetime ceiling (by default 90 days for a person, 7 for an agent, 30 for a service or a system: subject; each a setting, §4.7.4) the mint is 422 INVALID_BODY, details.reason: "ttl_too_long", with details.lifetime_s and details.ceiling_s, before anything is written (the default since 0.14.0); with CORTEX_MINT_LIFETIME_ENFORCE=off the token is minted as asked and the mint counted by the access report (mint_lifetime). A value whose expiry is past what a timestamp holds is 422 INVALID_BODY, details.reason: "ttl_out_of_range" (it used to sign a token that had already expired). A mint that carries a chain field (act, app, client, run, run_start, taint) lives at most the chain ceiling, whatever the switch (86,400 s by default, CORTEX_MINT_MAX_LIFETIME_CHAIN): above it, 422 INVALID_BODY, ttl_too_long, with details.lifetime_s and details.ceiling_s since 0.14.1. |
caps | array | Capability narrowing (alias: capabilities). Empty inherits the deployment + tenant defaults; a token never exceeds what policy allows. Each is a capability literal, else 422 INVALID_BODY with details {field: "caps", entry, reason}: reason wildcard_not_allowed for a pattern such as scope.*, invalid for any other entry that does not parse (since 0.14.0; it answered mint failed: ... with no details). Since 0.14.0 both lie within the minting credential's own ("The mint's reach", below); until then neither was checked against it. |
scopes | array | Scope confinement, one <capability>:<scope-path>[/*] entry per constraint (with or without /*, the path and everything under it). The capability part is an exact capability or a prefix of one (scope.read covers every scope.read.*), and names a capability the server checks or one the deployment policy names; any other entry, or one whose path does not parse, is 422 INVALID_BODY naming it. A capability named by any entry is usable only under the listed subtrees. A capability no entry names is refused, 403 POLICY_DENIED with details.link: "confinement" and details.capability (the default since 0.14.0), so name every family a token uses; with CORTEX_TOKEN_CONFINEMENT_ENFORCE=off it stays unconfined and the access report counts each use of one (check token_confinement). <capability-or-prefix>:* (capability confinement_wildcard_v1) names a family at every scope and for the checks a route makes without one (audit.read, blob.upload, blob.read, lifecycle.subscribe, vocabulary.read, temporal.phrases.read), where a subtree entry fails closed on them; it is as open as an unnamed family and no evidence of a grant at any one path. On a hosted tenant's token (one whose aud is a billing tenant's own, cortexdb:tenant:<tenant>), :* names every scope in org:<tenant> and the checks made without a scope, never another root; only a token of the deployment's own audience reaches every root with it. A 0.13.x server refuses it at mint and reads it in a token as confining its family to nowhere. <capability-or-prefix>:<scope-path>! (principal_chain_v1) names that one scope and none below it, in a minted token as in one another issuer signs; a 0.13.x server refuses it at mint and denies its family. |
tenant | string | Hosted, with CORTEX_V1_TENANT_AUDIENCES=1 only (0.12.6): the billing tenant the token belongs to, e.g. acct_45. Its aud becomes cortexdb:tenant:acct_45, so every scope record it creates is bound to acct_45 and it reaches org:acct_45/... records, never another tenant's. Requires a deployment-wide mint (no scope) by a credential of the deployment's own audience; every scopes entry must lie in org:<tenant> or be a <capability>:* entry, and at least one must lie in org:<tenant>. Records under org:<tenant> that earlier deployment-audience tokens bound to the deployment's own tenant move to <tenant> on this mint, so the account keeps its data. default, dev and the deployment audience's own tenant are reserved (422 INVALID_BODY, details.reason: "reserved_tenant"). |
act | string | mint_chain_v1: the agent acting for the subject, agent:<id>, stamped as {"sub": act}. Only for a self-mint, or with auth.mint.on_behalf_of at every scopes entry (scopes not empty), else 403 POLICY_DENIED, on_behalf_of_required. Never subject itself (same_as_sub), and never an AI employee of the tenant, the self of an employee record that is not delegable (422 INVALID_BODY, act_not_delegable; a worker's or project role's agent, whose region is delegable, acts for a person). |
app | string | mint_chain_v1: the application, service:<id>; only by the application's own principal or an Owner of <tenant>/app:<id>, else 403 POLICY_DENIED, app_not_owned. |
client | string | mint_chain_v1: agent, or person for a self-mint, the trusted operator or a deployment minter only, never beside act or run (422 INVALID_BODY). |
run | string | mint_chain_v1: the run's id, 1 to 128 bytes, under act's rule. Since 0.14.0 a run outside 1 to 128 characters of [A-Za-z0-9_.:-] is 422 INVALID_BODY, malformed, so a minted token always verifies (it used to mint a token every request refuses, 401 INVALID_TOKEN_CLAIM). |
run_start | int | mint_chain_v1: Unix seconds, at most now and at most 86,400 s before it; needs run. Absent with run, the mint time is stamped; a minting token of the same run has its run_start copied, and another is 422 INVALID_BODY, run_start_mismatch. |
taint | array | mint_chain_v1: tags, each 1 to 32 characters of [a-z0-9_], at most 8 with the minting token's own, which every mint copies in, whether or not the request sends taint; since 0.14.0 any other is 422 INVALID_BODY, malformed, and an empty list is no taint, so a minted token always verifies (it used to mint a token every request refuses). |
An agent chain token (act or run, or app or client resolving to agent) is confined on every
capability it grants: caps is not empty and a scopes entry names each (422 INVALID_BODY,
unconfined_family). The response adds chain (MintChainEcho) when the request sent one of the six: what
the mint stamped, minter included.
A token for team B's agent that can read and write only under
org:dev/team:b, and receive recall/answer diagnostics only there (a
confined capability is denied wherever a check names no scope, so this token
cannot use process-global diagnostics.read routes):
{
"subject": "agent:entb",
"scope": "org:dev/team:b",
"ttl_seconds": 3600,
"caps": ["scope.read.local", "scope.read.holistic", "scope.write", "diagnostics.read"],
"scopes": [
"scope.read:org:dev/team:b/*",
"scope.write:org:dev/team:b/*",
"diagnostics.read:org:dev/team:b/*"
]
}
Here scope only says the caller must hold auth.mint on org:dev/team:b;
the confinement comes from scopes. Without scopes the same request mints
a token whose capabilities apply in every scope its roster role admits.
The mint's reach (0.14.0, API contract §1.7). A minted token reaches no more than its minter, each refusal with its details.reason and a decision line (CORTEX_MINT_REACH_ENFORCE=off mints them as 0.13.x did and counts each under check mint_reach, §1.1):
- a mint names its tenant root with
scope,tenantorscopes, which all lie in that one root (a:*entry names none, and ascope.readentry for the reference rootapp:<key>of the minted token'sapp,service:<key>, is set aside): else422 INVALID_BODY,scopes_span_roots; a mint that names no root is the operator key's alone, and only for aservice:orsystem:subject: else403 POLICY_DENIED,deployment_mint_requires_operator. So the operator key namesscope(ortenant, orscopes) whenever it mints a person's or an agent's token,scope: "org:<tenant>"for a person of that tenant, and a mint whosescopesspan two roots (a signup user'sorg:u_Xanduser:u_Xsubtrees) is minted as one token per root; - every
capsentry is one the minting credential holds at the mint's scope (itsscope, else the root it names), and a credential that carriescapsorscopesnames them (an emptycapsinherits the deployment's, more than a narrowed or confined credential holds): else403 POLICY_DENIED,caps_exceed_minter, withdetails.capabilityfor a named one; - a minting token that carries
scopesmints no entry past its own: every mintedscopesentry lies within one of the minter's, by family (an entry forscope.readis not within one forscope.read.local) and by reach (a subtree at or under the minter's subtree, an exact scope within such a subtree or the same exact entry, anything within a:*entry), at the mint's scope and anywhere else; and its mint carriesscopes, unless the minter holds each minted capability everywhere (a:*entry). Else403 POLICY_DENIED,details {reason: "scopes_exceed_minter", link: "minter", entry, capability}naming the entry (orfield: "scopes"andcapabilityfor a mint withoutscopes). A family no entry of the minter names is within its reach only whileCORTEX_TOKEN_CONFINEMENT_ENFORCE=off, and never for an agent chain token; - a token that another principal minted (its
minteris not"operator") never mints:403 POLICY_DENIED,minted_token_cannot_mint; - a minting token's
taintis always copied in, whatever fields the request sends; arunis 1 to 128 characters of[A-Za-z0-9_.:-]and atainttag 1 to 32 of[a-z0-9_], at most 8 tags with the minting token's (else422 INVALID_BODY,malformed), so a minted token always verifies.
The trusted operator holds what the deployment allows. A deployment minter is not the trusted operator here and has no exemption: its token, such as service:website-minter's, holds auth.mint and, at *, every family the tokens it mints carry, and names the minted token's caps when it carries caps or scopes; a hosted deployment re-mints its website token with every family its account tokens carry when it upgrades to 0.14.0.
The minter (DB-16). Every minted token carries minter: "operator" when the minting
credential is the operator key (CORTEX_API_KEY) or a deployment minter (a principal the issuers
file names in deployment_minters, minting with this server's own deployment-audience token), and
otherwise the minting token's sub. A token whose minter is "operator" is signed as before, so
a 0.13.x server still reads it; one whose minter is another principal is signed with the chain
assertion (cortexdb:chain:v1, footer {"cdb":"chain1"}), which a 0.13.x server refuses. Every
decision for a token whose minter is a principal other than its sub also needs that principal
to pass the person rule at the same scope: each capability under the deployment's and the tenant's
policy, and the role on the scope's roster (the minter link). A decision the link fails is refused,
403 POLICY_DENIED, details.link: "minter" (the default since 0.14.0); with
CORTEX_MINTER_LINK_ENFORCE=off it is served and counted by the access report (check
minter_link, link minter, reason minter_not_permitted). A self-mint, a
token the operator minted, and a token minted before this release pass. auth_time is copied from
the minting token only into a token for the same subject. /v1/auth/signup's tokens and
mint_offline's carry minter: "operator"; MINT_OFFLINE_MINTER=none mints without it, for a
key that is not this server's minter, such as a native memory host's transport key, which may
not carry minter (only the server's own minter may).
Response: 200 with {token, jti, expires_at}: token a PASETO v4 public token (with the chain footer
when the chain assertion signs it), jti jti_<uuid7>, expires_at RFC 3339; and chain, as above. Every
refusal comes before anything is signed:
403 POLICY_DENIEDwhen the caller lacksauth.mint(atscope, else deployment-wide); for a token of an issuers-file entry (details.reason: "issuer_token_cannot_mint") and for a verified token whoseaudis not the deployment's own (a billing tenant's own audience); foron_behalf_of_requiredandapp_not_owned; since 0.14.0 for a mint past its minter's reach (caps_exceed_minter,scopes_exceed_minter,deployment_mint_requires_operator,minted_token_cannot_mint; and422 INVALID_BODY,scopes_span_roots).403 BREAK_GLASS_REQUIREDfor an in-band mint underdeny(§8.15.3), and400 INVALID_HEADER(details.field: "X-Cortex-Break-Glass") for a deployment minter's malformed, repeated or oversized header; each writes the request's audit row asdeny(§14).422 INVALID_BODYfor a badsubject, acapsentry that is no capability (details {field: "caps", entry, reason},reasonwildcard_not_allowedorinvalid), or ascopesentry the policy evaluator could not enforce (no:, a capability part that names no known capability or prefix — for example a bare scope path such asorg:acme/user:alice— or an unparseable scope path), with the offending entry named in the message; forttl_out_of_rangeandttl_too_long; forreserved_tenant(also a tenant whose deletion has begun, named bytenant, the caller's billing tenant,scopeor ascopesentry) and thetenantrefusals below; and for the chain refusals,details {reason, field}:not_an_agent,same_as_sub,act_not_delegable,not_a_service,malformed,person_with_agent,person_client_not_permitted,run_start_without_run,run_start_mismatch,out_of_range,unconfined_family.422 INVALID_SCOPE_GRAMMARwhenscopeis not a scope path.503 NOT_CONFIGUREDwhen the deployment has no minter wired: it is on by default only underdev_localwith noCORTEX_API_KEY,CORTEX_V1_MINTER_ENABLE=1turns it on elsewhere, and a native memory host never mints.
On a cluster the ingress routes a mint whose scope, tenant and scopes entries name exactly one assigned
root to that root's leader, gated as a write (held while the root moves); any other mint goes to any owner.
Per-tenant audiences (hosted, 0.12.6). One server, one billing tenant per
account: with CORTEX_V1_TENANT_AUDIENCES=1 (it needs the minter) the
verifier accepts aud = cortexdb:tenant:<id> for any valid org id <id>, but
only on tokens whose iss is this server's minter AND whose signature
verifies under the minter's own key; every other issuer keeps the single
CORTEX_V1_AUDIENCE. The website mints each account's token with its minting
service credential: a deployment-audience token of a principal the issuers file lists in deployment_minters
(§4.7.1), so the account tokens carry minter: "operator" and pass the minter link (§4.7.5). Since 0.14.0 a
minted token reaches no more than its minter ("The mint's reach", above), with no exemption, so the minting token
holds auth.mint and every family its account tokens carry, each at * in scopes (a deployment-audience token's
* reaches every root, so one token serves every account) and as the capabilities the deployment allows in caps;
and each account mint names those capabilities in caps (a caps entry is a literal, never a prefix): an empty
caps from that token is 403 POLICY_DENIED, caps_exceed_minter. A hosted deployment re-mints its website token
so when it upgrades. The minting token's own mint, as tests/smoke/hosted_plans_smoke.py runs it on
cloud_shared_saas:
{
"subject": "service:website-minter",
"ttl_seconds": 7200,
"caps": ["auth.mint", "<every capability of the account token's caps>"],
"scopes": ["auth.mint:*", "scope:*", "understanding:*", "llm.invoke:*", "forget:*", "import:*", "export:*",
"policy:*", "diagnostics.read:*", "audit.read:*", "blob:*", "lifecycle.subscribe:*", "vocabulary:*",
"temporal.phrases:*", "auth.revoke:*"]
}
The account token's scopes name every family it uses: those a route checks at a scope under the tenant's
root (a prefix such as scope names scope.read.*, scope.write.* and
scope.create.*), and those checked without a scope with <capability>:*.
A family no entry names is refused since 0.14.0 (403 POLICY_DENIED, details.link: "confinement"), and only counted by the access report (token_confinement) under
CORTEX_TOKEN_CONFINEMENT_ENFORCE=off:
{
"subject": "user:acct_45",
"tenant": "acct_45",
"ttl_seconds": 604800,
"caps": [
"scope.create.org", "scope.create.user", "scope.create.agent", "scope.create.service", "scope.create.ws",
"scope.create.project", "scope.create.dept", "scope.create.team", "scope.create.app", "scope.create.group",
"scope.create.aud", "scope.create.source", "scope.create.container", "scope.create.set", "scope.create.hold",
"scope.create.policy", "scope.write", "scope.write.elevated", "scope.write.on_behalf_of",
"scope.write.about_other", "scope.read.local", "scope.read.holistic", "scope.read.descend",
"understanding.read", "understanding.synthesize", "llm.invoke",
"forget.cascade.derived_only", "forget.cascade.redact_events", "forget.gdpr", "forget.gdpr.cross_workspace",
"forget.by_key", "import.from.mem0", "import.from.zep", "import.from.letta", "import.from.openai",
"import.from.jsonl", "export.format.mem0", "export.format.zep", "export.format.jsonl",
"policy.administer.tenant", "policy.administer.scope", "policy.administer.actor",
"diagnostics.read", "audit.read", "blob.upload", "blob.read", "lifecycle.subscribe",
"vocabulary.read", "vocabulary.write", "temporal.phrases.read", "temporal.phrases.write", "auth.revoke"
],
"scopes": [
"scope:org:acct_45/*",
"understanding:org:acct_45/*",
"llm.invoke:org:acct_45/*",
"forget:org:acct_45/*",
"import:org:acct_45/*",
"export:org:acct_45/*",
"policy:org:acct_45/*",
"diagnostics.read:org:acct_45/*",
"audit.read:*",
"blob:*",
"lifecycle.subscribe:*",
"vocabulary:*",
"temporal.phrases:*",
"auth.revoke:*"
]
}
A tenant's own token never mints (403 POLICY_DENIED, so it cannot mint
itself out of its tenant). tenant with the mode off, with scope, without
scopes, with only <capability>:* entries, with a scopes entry outside
org:<tenant> or with a value that is not an org id is 422 INVALID_BODY; a
failure to move the tenant's records is 503 REGISTRY_UNAVAILABLE
(retriable).
Self-serve signup. POST /v1/auth/signup (§8.16.4) mints a 7-day token (within a person's
lifetime ceiling, §4.7.4; the ceiling itself when it is set below 7 days) for a new user:u_<id> with the 19 free-tier
capabilities (since 0.15.0 derivation.administer.scope among them, so a person sets their own derivation policy),
and its scopes name every one of them: the thirteen a route
checks at a scope under the user's two subtrees (<capability>:org:u_<id>/user:u_<id>/*
and <capability>:user:u_<id>/*), and the six checked without a scope
(audit.read, blob.upload, blob.read, lifecycle.subscribe,
vocabulary.read, temporal.phrases.read) with <capability>:*. A signup token an older release signed
confines only scope.write and the three scope.read.* families: since 0.14.0 total confinement refuses
its other fourteen (403 POLICY_DENIED, §4.7) unless CORTEX_TOKEN_CONFINEMENT_ENFORCE=off, and it carries no
derivation.administer.scope at all, so a client
signs up again for a token that names them.
8.16.4 POST /v1/auth/signup — Self-serve signup
Capability: none: the route takes no credential at all.
Mints a fresh actor user:u_<uuid7>, its home scope org:u_<uuid7>/user:u_<uuid7> and a 7-day free-tier
token for it (the person's ceiling, when that is set shorter) (§8.16.3, "Self-serve signup"). The body is optional and its fields (display_name, email,
source) are read and ignored: an empty body, or one that is not JSON, is the same request, so a bare
curl -X POST succeeds. The token's aud is the deployment's own (CORTEX_V1_AUDIENCE, default
cortexdb:tenant:dev), so its billing tenant is the deployment's; it carries minter: "operator" and never
auth.mint. Nothing is registered: the home scope is auto-provisioned by its first write.
Response: 200:
{
"token": "v4.public.eyJ...",
"jti": "jti_0199f3c2b7a77d1e9c4b8a6f5e3d2c1b",
"expires_at": "2026-11-03T10:00:00+00:00",
"user_id": "user:u_0199f3c2b7a77d1e9c4b8a6f5e3d2c1a",
"scope": "org:u_0199f3c2b7a77d1e9c4b8a6f5e3d2c1a/user:u_0199f3c2b7a77d1e9c4b8a6f5e3d2c1a",
"tier": "free"
}
Errors: 404 NOT_FOUND with CORTEX_DISABLE_ANON_SIGNUP=1 (hosted accounts come from the website, even with
the minter on); 503 NOT_CONFIGURED when the deployment has no minter (§8.16.3); 500 INTERNAL_ERROR (retriable)
when the token could not be signed. A cluster ingress does not route it (501 CLUSTER_ROUTE_UNSUPPORTED).
8.16.5 The 0.14.0 token rules at these routes
The release's token rules (§4.7), as POST /v1/auth/tokens and a token's later use meet them. Each
CORTEX_<CHECK>_ENFORCE switch enforces when unset, blank or on, and off counts instead (check of the same
name, GET /v1/admin/access/report). Each is read once at boot (an [engine] variable on a cluster data
node), and any other value refuses the boot (exit 78, AUTH_CONFIG_INVALID).
| Rule | At the mint | At each use of the token |
|---|---|---|
Total confinement (CORTEX_TOKEN_CONFINEMENT_ENFORCE) | scopes entries are validated in every form the evaluator reads: <cap>:<path>[/*], <cap>:<path>!, <cap>:* | A token that carries scopes holds only the capabilities an entry names; any other is 403 POLICY_DENIED (details.link: "confinement" where the route's refusal carries details). A family a route checks without a scope needs a :* entry. An agent chain token is confined whatever the switch, and holds nothing without scopes. whoami and GET /v1/policy/effective list accordingly. |
Lifetime ceiling (CORTEX_MINT_LIFETIME_ENFORCE; the ceilings CORTEX_MINT_MAX_LIFETIME_*, §4.7.4) | Above the subject's ceiling, by default 90 days for a user: subject, 7 days for an agent: one, 30 days for a service: or system: one: 422 INVALID_BODY, ttl_too_long. Above the chain ceiling (1 day by default) for a mint with a chain field, whatever the switch | A token this server's minter signed whose exp - iat is above its subject's ceiling as this server runs it, whenever it was minted: 401 INVALID_TOKEN_CLAIM, details.reason: "lifetime_over_ceiling" |
The minter link (CORTEX_MINTER_LINK_ENFORCE) | Every mint stamps minter | A decision of the scope seam for a token another principal minted also needs that principal to pass the person rule at the scope: 403 POLICY_DENIED, details.link: "minter" (the registry routes answer it with their own message, without details) |
The mint's reach (CORTEX_MINT_REACH_ENFORCE) | A minted token reaches no more than its minter (§8.16.3): 403 POLICY_DENIED, caps_exceed_minter, scopes_exceed_minter (details.link: "minter"), deployment_mint_requires_operator or minted_token_cannot_mint, and 422 INVALID_BODY, scopes_span_roots; with the switch off minted and counted (check mint_reach). A deployment minter has no exemption | No rule at use |
A delegable act (no switch) | An act naming an AI employee of the tenant: 422 INVALID_BODY, act_not_delegable | A token whose act names one, whatever issuer signed it: 401 INVALID_TOKEN_CLAIM, details {claim: "act", reason: "act_not_delegable"}, on every request |
| Issuers-file tokens (no switch) | Never mint: 403 POLICY_DENIED, issuer_token_cannot_mint | Authenticate on every route; a read that checks its credential again at each use (recall, answer, compose) checks the entry again (enabled, audience, expiry, revocation) |
Revocation (CORTEX_REVOCATIONS_V2, on unless off) | No mint rule | Ids are namespaced by issuer, and a revocation is dropped 60 s after the revoked token's exp (§8.16.1) |
8.17 Temporal Phrases
Stored like vocabularies, with the same namespace and the same 403 / 413 / 503 / 500 answers (§8.14). Registered phrases are read by temporal.natural: on POST /v1/recall, POST /v1/recall/stream and POST /v1/answer (and /v1/compose's time), a natural equal to the pattern of a phrase in the caller's own namespace (case and runs of whitespace aside) that applies at the request's scope reads the window that phrase's resolves_to.valid_during names, before the built-in grammar (§12.4), whatever reference_date or timezone say; it fills valid_during only when the request left it empty, as the grammar does. A phrase applies at the scope its optional scope names and under it; without one, everywhere in its namespace; the most specific applies first, then by name. A store that does not read fails the read 503 EVIDENCE_UNAVAILABLE (retriable). A cluster data node refuses the records (503 TENANT_MAPS_UNSUPPORTED), so nothing applies there. A put or a delete clears the answer cache (CORTEX_ANSWER_CACHE).
Namespace. Phrases registered under signed auth belong to the actor that registered them, exactly as vocabularies do (§8.14): GET lists only the caller's own phrases, and DELETE of a phrase owned by someone else returns 404 NOT_FOUND. Two tenants may therefore hold the same phrase name with different resolutions. Two deliberate exceptions: phrases written before this rule shipped carry no owner and stay visible to everyone until they are rewritten, and operator credentials (static API key, or an auth-disabled deployment) share that same unowned namespace — an operator does not inherit a tenant's private phrases.
8.17.1 POST /v1/temporal/phrases
Capability: temporal.phrases.write (tenant admin)
Register a custom temporal phrase in the caller's namespace. name, pattern and resolves_to are required, scope is optional, and unknown fields are ignored. pattern must hold words and resolves_to must be exactly {"valid_during": [from, to]}, each bound an RFC 3339 instant or a YYYY-MM-DD date (a date-only to includes its day), from before to, as temporal.valid_during takes them (422 INVALID_BODY otherwise); scope must be a scope path (422 INVALID_SCOPE). A record stored before 0.14.0 with another resolves_to is still listed, and no parser reads it. A phrase of the same name in the namespace is replaced. The response echoes the stored record, with owner and billing_id stamped by the server where membership is enforced.
{
"name": "fiscal_q3",
"pattern": "fiscal Q3",
"resolves_to": {"valid_during": ["2026-07-01", "2026-10-01"]},
"scope": "org:acme/team:finance"
}
Response: 201 Created.
8.17.2 GET /v1/temporal/phrases
Capability: temporal.phrases.read (any authenticated reader)
Only phrases bound to the caller's billing tenant are returned.
{
"items": [
{"name": "fiscal_q3", "pattern": "fiscal Q3", "resolves_to": {...}}
]
}
8.17.3 DELETE /v1/temporal/phrases/{name}
Capability: temporal.phrases.write
204, or 404 NOT_FOUND when the caller's namespace holds no phrase of that name (another namespace's phrase of the same name answers the same and is untouched).
8.18 GET /v1/experience/status — Write Status
Capability: scope.write and, for a per-actor token, Writer at the event's own scope; only the caller that made the
write sees it (keys are scoped per caller, so one caller can never probe another's keys), the trusted operator
included.
Answers "did my write land, and how far has it progressed?" — the resume path after a client-side timeout, and the poll
target for async-accept writes. (The native memory host serves POST /v1/experience/status at this path instead.)
GET /v1/experience/status?idempotency_key=<key>[&scope=<scope>] # by key (24h window)
GET /v1/experience/status?event_id=evt_01HX... # by event id
| Parameter | Notes |
|---|---|
idempotency_key | The write's key, as sent (canonicalized to NFC); it wins over event_id. One of the two is required (422 INVALID_BODY) |
event_id | An id a receipt returned; a malformed one is 422 INVALID_BODY |
scope | The scope the write was sent to, or the scope it landed in: a write a run redirected to its writer's private space (DB-28) is found by either. With idempotency_key it is matched against every namespace of the caller's key (the namespace the write was keyed under, and its row's scope); for an event_id, the event's own scope or the scope its claim was keyed under must equal it. A malformed path is 400 INVALID_QUERY |
at_least | consistency_tokens_v1 (§6.11): the read first waits for the token, at the root scope names (else the token's own), within CORTEX_CONSISTENCY_WAIT_MS; the answer then carries consistency_token (at the indexer's watermark), consistency_reset and derived_through |
A key lookup reads the claims of the bucket POST /v1/experience, /v1/experience/bulk and /v1/experiences share; an
import's keys live in their own buckets and are not found here.
{
"found": true,
"event_id": "evt_01HX...",
"status": "indexed",
"stages_completed": ["captured", "extracted", "indexed"],
"resend": "no",
"note": "stored and queryable"
}
status is the furthest stage: captured; indexed (this process recorded it, or the indexer's durable watermark
passed the event); consolidated or compressed (recorded by this process); failed (the indexer excluded the event
after a terminal indexing failure: failure_reason is set, and the key replays this failure; do not re-send the write,
under this key or a new one: an operator re-includes it with POST /v1/admin/index-audit/reinclude); or cancelled (the write's cancel committed: it is kept but never indexed or recalled, and its key stays
claimed). Lookup by event_id reads the stored write, so it answers the same before and after a restart; a sealed write
is read from its segment. A read error on the write's records answers 503 WAL_UNAVAILABLE (retriable) and a segment
that does not read now 503 SEGMENT_UNAVAILABLE (retriable), never found: false.
resend says when re-sending the write is safe (since 0.12.2):
resend | When | What to do |
|---|---|---|
no | found, a failed write included | Never re-send: the write is stored. A failed one is excluded from recall and is never re-sent, at any age, under its key (which replays the failure) or a new one; an operator re-includes it (POST /v1/admin/index-audit/reinclude). Since 0.14.0 new_key, which 0.13.x answered for a failed write, is never answered |
if_sent_within_24h | found: false by idempotency_key | No receipt for this key. Receipts last 24 h: a write sent within them was not stored, and re-sending is safe. For an older write the receipt has expired; look the write up (recall, or GET /v1/events/{id}) before re-sending, or it is stored twice. |
check_first | found: false by event_id | No stored write under this id for this caller: erased, forgotten or not visible. An id the server returned is never "not yet stored"; do not re-send on this answer. |
A missing write and one the caller may not see answer the same. A write redirected to its writer's private space
(write_provenance_v1, §8.1) is found by key or by event id, with no scope or with a scope naming either the scope
it was sent to, where its claim lies, or its home, where its row lies (by event id, the first while its claim lasts).
Errors: 400 INVALID_QUERY (a malformed scope; not retriable), 408 WAIT_TIMEOUT (at_least not reached within the wait; details.waiting_on registry, indexer or declared,
details.waited_ms; retriable), 422 INVALID_BODY, 422 CONSISTENCY_TOKEN_INVALID (details.reason malformed,
other_root or ahead_of_commit), 503 WAL_UNAVAILABLE (also when the shard's
state could not be read for at_least) and 503 SEGMENT_UNAVAILABLE, both retriable. A cluster ingress routes the probe by ?scope=
(501 CLUSTER_ROUTE_UNSUPPORTED without it).
8.19 GET /v1/schemas — Machine-Readable Contracts
Unauthenticated (like /v1/admin/health). Lists and serves the normative
JSON Schemas for every request/response shape, embedded in the binary at
build time so the running server and its published contract cannot drift.
Like /v1/openapi.json, the schema routes pass the license gate (since 0.14.0): a
locked license passes them. A
cluster ingress routes them to an owner (by the bearer's tenant root when it
names one, else to any owner).
GET /v1/schemas → {"schemas": [{"name": "...", "url": "/v1/schemas/..."}], "note": "..."}
GET /v1/schemas/experience_envelope → the JSON Schema (application/schema+json)
GET /v1/schemas/error_envelope → the error envelope contract
The 32 names served: answer_response, audit_row, belief, capability_set, common, commitment_authority_v1, commitment_command_v1, commitment_decision_v1, commitment_evidence_v1, commitment_read_authority_v1, commitment_read_v1, commitment_receipt_v1, concept, episode, erasure_job, erasure_preview, error_envelope, event, experience_envelope, fact, lifecycle_event, policy, scope, source_erasure_command_v1, source_erasure_http_error_v1, source_erasure_progress_v1, source_erasure_progress_v2, source_erasure_status_v1, stratified_pack, temporal_block, token_claims, vocabulary. note reads "normative request/response
contracts; where prose docs disagree with a schema, the schema wins". Since 0.14.0
audit_row (§14) and lifecycle_event (§13) validate the rows the server sends (they were stricter before).
Use these for client-side preflight validation before runtime. A 422 INVALID_BODY from the body
parser of the experience write routes names the envelope schema in details.schema
(/v1/schemas/experience_envelope), beside details.field_path and details.reason; other 422s
carry no details.schema.
8.19.1 GET /v1/schemas/{name}
Capability: none (no credential).
Answers the named schema file byte for byte, Content-Type: application/schema+json. name is a
name the listing gives, with or without the .schema.json suffix
(/v1/schemas/experience_envelope.schema.json is the same file). A schema's relative $refs
(common.schema.json#/$defs/…) resolve against its $id
(https://schemas.cortexdb.ai/v1/<name>.schema.json); this server serves that file as
/v1/schemas/common.
Errors: 404 NOT_FOUND (no schema of that name; the message points at /v1/schemas), not
retriable.
8.19.2 GET /v1/openapi.json
Capability: none (no credential); exempt from the license gate.
Serves the OpenAPI 3.1 document of the HTTP surface, embedded in the binary at build time, byte for
byte, Content-Type: application/json; GET /openapi.json serves the same document. It maps the
routes, their parameters, bodies and errors, and references the schemas it does not inline as
/v1/schemas/<name> (§8.19). A native memory host serves the same document, though it mounts only
a few of its routes; a cluster ingress serves its own copy.
8.20 The access API (/v1/access/*)
New in 0.14.0 (shared memory; docs/shared_memory/IDENTITY_AND_API_CONTRACT.md §5.3). The access API answers
questions about access and reads or writes no memory: whether a principal chain may read, write or administer a scope,
or read one memory, and why; which scopes a chain may read under a prefix, and who may read a scope; the limits a root
enforces; and a scope's effective enrich. One route writes: POST /v1/access/texts/erase erases the free text a
registry record names (§8.20.7).
| Route | Capability | Callers |
|---|---|---|
POST /v1/access/check (§8.20.1) | access_check_v1 | any caller, for its own chain; for another chain (chain), an Owner of scope or the trusted operator |
POST /v1/access/explain (§8.20.2) | access_check_v1 | as check |
GET /v1/access/limits?scope=<root> (§8.20.3) | access_limits_v1 | a principal of the root's tenant, a Reader of any other root, or the trusted operator |
POST /v1/access/lookup/scopes (§8.20.4) | access_lookup_v1 | as check |
POST /v1/access/lookup/principals (§8.20.5) | access_lookup_v1 | an Owner of scope (in a private region, also one of its direct members) or the trusted operator |
GET /v1/access/enrich?scope=<path> (§8.20.6) | enrich_backfill_v1 | a Reader of scope, or the trusted operator |
POST /v1/access/texts/erase (§8.20.7) | none | an Owner of the record or of the tenant root, or the trusted operator |
GET /v1/admin/version lists the capabilities; gate on them, not on a version. The trusted operator is the static
CORTEX_API_KEY or an auth-disabled server. Every route of this section is operator plane (class O, §8.15.3): the
operator key never needs X-Cortex-Break-Glass on them. JSON bodies refuse unknown fields with 422 INVALID_BODY.
The decisions run on the database blocking lane within CORTEX_EVIDENCE_TIMEOUT_MS (default 120,000 ms): a full queue
(CORTEX_DB_BLOCKING_MAX_WAITERS) answers 503 DB_SATURATED and a lane that cannot take the work 503 DB_UNAVAILABLE,
both retriable; work past the deadline answers 504 DB_TIMEOUT. A registry that cannot decide answers as the registry
routes answer it (503 SCOPE_STORAGE_UNAVAILABLE, WAL_OUTCOME_UNKNOWN). A root a restore holds pending (its access
sources have not acknowledged it yet) answers 503 ACCESS_RESTORE_PENDING, not retriable, on every route of this
section. On a cluster the ingress routes each request by its scope's root (the body's scope, ?scope= on a GET) to
the root's leader, which answers after its ReadIndex and erase-floor wait; the POST routes but texts/erase are reads for the ingress,
so a lost answer is 504 SHARD_TIMEOUT, never a resend, and a request whose scope is missing or does not parse is
422 SCOPE_REQUIRED there. A decision is not a use: the access report counts none of them.
The chain. check, explain and the scopes lookup decide the caller's own chain, its confinement included, unless
the body names another in chain (PrincipalChain):
| Field | Type | Notes |
|---|---|---|
sub | string | Required. The principal: user, agent, service or system, a colon, and 1 to 128 characters of [A-Za-z0-9_.@-]. |
act | string | The agent acting for sub, agent:<id>, never sub itself (a token carries it as {"sub": ...}). |
app | string | The chain's application, service:<id>, which the application link reads. |
client | string | person or agent; person never beside act or run. |
run | string | 1 to 128 characters of [A-Za-z0-9_.:-]. |
auth_time | integer | Unix seconds, at least 0: the person's sign-in time, which fresh_auth conditions read when the chain's client is a person. |
caps | array | Capability names that narrow the chain; absent, the deployment's and the tenant's policy. |
scopes | array | Confinement entries, read as a token's scopes are (§8.16.3): an entry that does not parse confines its family to nowhere. |
An agent chain (one with act or run, client: "agent", or app without client: "person") is confined on every
capability, as its token would be: a capability no scopes entry names is denied (link confinement, reason
confined), so without scopes it holds none. Any other chain without caps and scopes is unconfined. The chain is
evaluated as a verified token of this deployment would be (membership enforced, never as the trusted operator), in the
billing tenant of scope's root: the id of an org: root, else the binding of the record at the root, else of the
record that governs scope, else the caller's own. The minter link is never evaluated for it. A field that does not
validate is 422 INVALID_BODY, with details.field (chain.sub, chain.act, ...) and details.reason (invalid, or
person_with_agent, or act_not_delegable for an act that names an AI employee of the tenant it is evaluated in,
the self of an employee record that is not delegable, refused as POST /v1/auth/tokens refuses it and carried by no
verified token, on check, explain and the scopes lookup, once the caller may ask about another chain, so only an
Owner of scope or the trusted operator learns whether an agent is an employee). At an application's reference root
a chain's app is read as its token's would be: a chain of the application reads the root at Reader, and a chain of
another application, or of none, is refused by app, reason app_not_admitted, as recall refuses those chains'
tokens.
Links, reasons and paths. A decision (ScopeDecision: {scope, allowed, denied_by?, links}) decides the links of
the chain rule in order and stops at the first that fails. links maps each link it decided to
{allowed, via?, reason?, bound_tenant?, capability?}, in the order below; an allowed decision holds capability,
confinement, tenant, person and private_region.
| Link | What it decides | Reasons on a denial |
|---|---|---|
capability | the deployment's and the tenant's policy for the role's capability: scope.read.local (reader, summary), scope.write (writer), policy.administer.scope (owner) | capability_denied, with capability |
confinement | the chain's caps and scopes | confined, with capability |
tenant | the tenant-root fence (a verified token reaches no org: root of another tenant that the registry does not govern) and the governing record's billing binding | outside_tenant, billing_tenant_mismatch (with bound_tenant), billing_tenant_unbound |
person | the roster: the record's entries and, on a version-2 record, every audience rule (sets, self, participants, subtree, leads, rollup, chain, heads, delegates, unit, source and application grants, the agent's own region); for writer, write admission and the write rules too | not_a_member, insufficient_role, not_registered, registration_required, scope_type_not_allowed, run_required; record_changed for an atom (§8.20.1); not_authorized (below) |
app | the application link, where the root's companion sets apps_enforced, and an application's reference root | app_not_admitted, reference_root |
minter | the minter link (§4.7.5): a token another principal minted acts only where its minter may, at the role decided; decided last, once tenant and person passed | minter_denied, with capability |
private_region | reported allowed, with no via, on every allowed decision: the registry decides who reads a private region | |
condition | a path the person link would take but for a fresh_auth or purpose condition the request does not satisfy | condition_failed |
label | a path whose max_label is below the home's label | label_cap |
summary_limit | a Summary path at a labelled home | summary_limit |
On a condition, label or summary_limit denial, person passes with the stopped path's via. A minter-link refusal
(CORTEX_MINTER_LINK_ENFORCE) reports tenant and person allowed with their paths and minter denied, its one via
step the minter (since 0.14.0; it was reported by capability, reason capability_denied). view is a value of the
enum this release does not report: every role is decided at the granular view.
via is the deciding path, step by step (AuthPathStep: {kind, record?, field?, index?, who?, role?}):
kind | What the step names |
|---|---|
capability | the policy tier, field deployment.allow or tenant.allow; on a denial deployment.deny, tenant.deny, tenant.allow or deployment.allow |
confinement | record: "token", field caps or scopes, index the entry that admitted; on a denial, the field that refused |
tenant | the governing record and field: "billing_tenant"; or record: "token" with field aud (the caller's own org: root) or scopes (an explicit scope.write grant, with index) |
entry | a roster entry: record, field: "members", index, who, role |
set | a set's entry, expanding the set the step before named: record the set, field: "set.entries", index, who |
self, employee | a region's self; the employee record that makes an agent: principal a person (field: "tree.self") |
head, delegate, grant | an entry of a companion's heads, delegates or grants, with index and who (role for a grant) |
rule | a record's tree.audience, tree.kind, tree.parent, members_set (who the unit's members set), tree.private, tree.delegable, or policies.children.auto_register (a first write below the record registers the scope) |
token | record: "token", field: "act": a writer's chain with act and no run |
minter | record: "token", field: "minter", who the token's minter |
unregistered | no record governs the path, so every role passes |
operator | the trusted operator, whose rosters are not read |
The person link's steps are the best path's: the highest role, then the highest label it reads, then the latest end.
The uniform denial. Where the caller's own chain holds no role at a scope (it does not pass the roster there at
Summary, the lowest role; its token's minter is no part of that, so a minter-link refusal keeps its reason), a denial by any link that reads the registry answers one body: allowed: false,
denied_by: "person", links: {"person": {"allowed": false, "reason": "not_authorized"}}, with no via and no names.
So the API never tells such a caller whether a path is registered, private, labelled or shared. A capability or
confinement denial depends only on the caller's own token and keeps its reason. An Owner of the scope and the trusted
operator get every distinct reason, for any chain.
Names. check, explain and the lookups join the directory (directory_v1): a principal's display_name for a
caller who reads names in the scope's tenant (a principal of the tenant, or the trusted operator), and a scope's or a
set's name entry, inside a private region only for a caller who may read it. A principal or scope without an entry is
shown by its id alone.
Consistency tokens. check, explain and both lookups take consistency (consistency_tokens_v1, §6.11): {}
asks for a token; {"at_least": "<token>"} also waits, before the request is authorized, until this node has reached
the token at the request's root, within CORTEX_CONSISTENCY_WAIT_MS (default 10,000, at most 30,000) and the route's
deadline. Past it the answer is 408 WAIT_TIMEOUT (retriable), details.waiting_on registry, indexer or declared, or
access_view on a lookup, and details.waited_ms. A token that does not decode, names another root, or names what this
server never committed is 422 CONSISTENCY_TOKEN_INVALID (details.reason malformed, other_root or
ahead_of_commit); one of another incarnation or epoch is ignored, and the answer says consistency_reset: true, with
access_restored_at when the token predates a restore of the root. A request that sent consistency gets
consistency_token, and derived_through once this node's enrichment has finished a pass, after the body's own fields.
check and explain never wait for the permission view; a lookup's at_least does. The two GET routes read no
?at_least=, and the AuthZEN routes take no token (§8.21).
8.20.1 POST /v1/access/check
Capability: access_check_v1.
Can this chain read, write or administer this scope, or read this memory? Each role is decided by the seam the routes
that act at that role call, so check answers what those routes would do:
role | Decided as | Checks, in order |
|---|---|---|
reader (default) | a read of the scope by name (/v1/recall, a by-id read) | scope.read.local, the tenant-root fence, Reader on the roster |
summary | the same read at Summary | scope.read.local, the fence, Summary on the roster |
writer | a capture (POST /v1/experience) | scope.write, the fence, Writer on the roster, write admission (a first write's registration rules), then the write rules: a chain with act and no run is denied by person, reason run_required |
owner | administration (PUT /v1/scopes/members, PUT /v1/scopes/tree, DELETE /v1/scopes) | policy.administer.scope, the fence, Owner on the roster |
A record that holds no memories (a set, a hold, a policy, a companion record) passes owner only. A chain with no
person (a service:, a connector, an agent that is no employee's self) reads only through the record's own entries,
sets expanded: nothing inherited, never inside a private region.
POST /v1/access/check
{"scope": "org:acme/team:eng", "role": "reader", "consistency": {}}
| Field | Type | Notes |
|---|---|---|
scope | string | Required. The scope decided, or the memory's home; the routing key. Not a scope path: 422 INVALID_SCOPE_GRAMMAR. |
role | string | summary, reader, writer or owner; default reader. |
memory | object | {id, kind?}: decide this memory, homed exactly at scope. kind is event, fact, belief, episode, concept or understanding; without it the id's prefix names it (evt_, fact_, belief_, ep_, concept_). |
chain | object | Another chain (§8.20), for an Owner of scope (membership enforced, no capability asked) or the trusted operator; anyone else gets 403 POLICY_DENIED, one fixed body. Absent: the caller's own chain. |
consistency | object | §8.20, §6.11. |
purpose | string | read_purpose_v1: the purpose the request declares, [a-z0-9_-]{1,64}; null is none. It decides the chain for that purpose: the caller's own chain through a context that declares it, a hypothetical chain through its facts, so a path whose when is {purpose: <id>} holds only for that id. The Owner check a caller passes to ask about another chain reads none. A value out of the grammar is 422 INVALID_BODY, details.field: "purpose". |
Response 200:
{
"allowed": true,
"scope": "org:acme/team:eng",
"role": "reader",
"delivered_role": "reader",
"label_cap": "restricted",
"links": {
"capability": {"allowed": true, "via": [{"kind": "capability", "field": "deployment.allow"}]},
"confinement": {"allowed": true, "via": [{"kind": "confinement", "record": "token", "field": "caps", "index": 0},
{"kind": "confinement", "record": "token", "field": "scopes", "index": 0}]},
"tenant": {"allowed": true, "via": [{"kind": "tenant", "record": "org:acme/team:eng", "field": "billing_tenant"}]},
"person": {"allowed": true, "via": [{"kind": "entry", "record": "org:acme/team:eng", "field": "members", "index": 0,
"who": "org:acme/set:eng", "role": "reader"},
{"kind": "set", "record": "org:acme/set:eng", "field": "set.entries", "index": 3,
"who": "user:p_7f3a"}]},
"private_region": {"allowed": true}
},
"until": null,
"unconfined_capabilities": [],
"names": {"user:p_7f3a": "Priya N."},
"consistency_token": "ct1.Zm9vYmFyYmF6"
}
| Field | Notes |
|---|---|
allowed | The decision; for a memory at reader, the delivery gate's (below). |
scope, role | As decided. |
delivered_role | When allowed: the role the deciding path delivers, an entry's or a rule's or a grant's (Reader at most); owner for the trusted operator and for a path no record governs. |
label_cap | When allowed: the highest label the deciding path reads: restricted for a path with no max_label, its lowest max_label, none for a Summary path. |
denied_by | On a denial: the first link that failed. |
links | Each link decided, in the chain rule's order (§8.20). |
until | The earliest end on the deciding path, or on a condition, label or summary_limit denial on the stopped path, RFC 3339; null when none ends and on every other denial. |
conditions | Each when on that path, {kind, holds}, kind fresh_auth, purpose or max_label; absent when it has none. |
unconfined_capabilities | The capability families the chain holds at the scope that no scopes entry names, sorted; empty for an agent chain. |
names | §8.20. |
| consistency fields | When the request sent consistency (§8.20). |
A memory. memory must be homed exactly at scope. An id that is unknown, hidden (an event excluded from recall,
or under a forget's tombstone), homed elsewhere, or homed where the caller's own chain may not read answers
404 NOT_FOUND, the same body in every case. An event is read from the log (a sealed one through its marker at
scope's root); a fact, belief, concept or understanding through the coordinator; an episode among the episodes listed
at scope (at most 100,000). At reader the decision is the delivery gate's for that row (DB-23): its home; then every
atom the memory carries, each current (its record still the one that governed its scope when the row was written) and
readable by the chain at Reader; then its effective label, the most restrictive of the home's and the atoms' labels,
within the home path's label_cap. A derived memory's atoms are its stamped ones, else its events'. A belief passes
while one of its supports does. A memory its home admits and an atom or the label withholds answers allowed: false,
denied_by the atom's link (person) or label, with no delivered_role or label_cap. An atom whose record is gone
or another one is denied by person, reason record_changed. At summary, writer and owner the decision is the
home's.
Races. A decision whose authorization revision moved under it is made again, up to three runs in all, then
answered 503 AUTHORIZATION_STATE_CHANGED (retriable, no Retry-After).
Errors: 403 POLICY_DENIED (another chain, from a caller who is no Owner of scope and not the trusted operator);
404 NOT_FOUND (memory, above); 408 WAIT_TIMEOUT (retriable); 422 INVALID_BODY (an unknown field, a field of
the wrong type, no scope, a chain field that does not validate, a purpose out of its grammar), 422 INVALID_SCOPE_GRAMMAR,
422 CONSISTENCY_TOKEN_INVALID; 503 AUTHORIZATION_STATE_CHANGED, DB_SATURATED, DB_UNAVAILABLE and
WAL_UNAVAILABLE (the shard's state could not be read for a consistency token), all retriable;
503 ACCESS_RESTORE_PENDING (not retriable); the registry's outage codes; 504 DB_TIMEOUT; 500 INTERNAL_ERROR
(retriable).
8.20.2 POST /v1/access/explain
Capability: access_check_v1.
Why may this chain read this scope or memory, or why not? The request, callers, routing, consistency and rules are
check's (§8.20.1). The answer gives the home's whole ScopeDecision, and, for a memory at reader, one decision per
atom and a derived memory's supports.
POST /v1/access/explain
{"scope": "org:acme/team:eng", "memory": {"id": "belief_0193b7c2e4a17d3c9f2b8e6a5d4c3b21"}}
200
{
"allowed": true,
"role": "reader",
"home": {"scope": "org:acme/team:eng", "allowed": true, "links": {...}},
"atoms": [
{"scope": "org:acme/team:eng", "allowed": true, "links": {...}},
{"scope": null, "redacted": true, "reason": "atom_not_readable", "allowed": false, "denied_by": "person", "links": {}}
],
"derived": {"kind": "belief", "rebuilt": true,
"supports": [{"id": "fact_0193b7c1d2e37a4b8c9d0e1f2a3b4c5d",
"atoms": [{"scope": "org:acme/team:eng", "allowed": true, "links": {...}}]}]},
"label": {"effective": "none", "cap": "restricted", "allowed": true}
}
| Field | Notes |
|---|---|
allowed | The decision; for a memory at reader, the delivery gate's. |
role | As decided. |
home | The chain's ScopeDecision at scope, every link with its path; the uniform denial (§8.20) for the caller's own chain where it holds no role there. |
atoms | For a memory at reader: one AtomDecision per distinct atom scope it carries (a belief's over every support), in the order first decided: the chain's ScopeDecision at that scope. Empty for a scope alone, at every other role, and for a memory without atoms. |
derived | For a derived memory: kind (fact, belief, episode, concept; concept for an understanding too), supports (only those the chain may see, each {id, atoms}: a belief's supports; a fact's and an episode's events; a concept's events, facts, episodes and beliefs that still exist), rebuilt (a belief the chain is served rebuilt from the supports it may see) and hidden_supports (how many it may not see; the trusted operator only). A home the chain may not read lists no supports. |
label | {effective, cap, allowed}: the effective label (the home's and the atoms', the most restrictive; for a belief, over the supports the chain may see), the deciding path's cap, and whether the first is within the second; none, none and the decision where another link refused. |
names, consistency fields | As on check. |
An atom's decision names its scope only to a caller who may read that scope (the request's own credential) and to the
trusted operator. To any other caller (the caller's own chain at an atom it may not read, or an Owner asking about
another chain) it is redacted: scope: null, redacted: true, reason: "atom_not_readable", the chain's allowed and
denied_by there, and links: {}. So explain never names a scope the caller may not see, such as a private channel
a memory was derived from. A belief is allowed while one of its supports is; every other derived memory is joint
evidence, decided by its own atoms, its supports only explaining it.
Errors: as check (§8.20.1).
8.20.3 GET /v1/access/limits
Capability: access_limits_v1.
The limits this binary enforces at a root, with this deployment's values, so that a client sizes its work to them and never hard-codes one.
GET /v1/access/limits?scope=org:acme
200
{"limits": [
{"name": "brain_scopes", "kind": "setting", "value": 520000, "default": 520000, "unit": "records", "past": "ACCESS_LIMIT_REACHED"},
{"name": "sources", "kind": "setting", "value": 16, "default": 16, "unit": "sources", "past": "ACCESS_LIMIT_REACHED"},
{"name": "containers_per_source", "kind": "setting", "value": 50000, "default": 50000, "unit": "records", "past": "not_ingested"},
...
{"name": "command_bytes", "kind": "structural", "value": 4194304, "default": 4194304, "unit": "bytes", "past": "WAL_TOO_LARGE"}
]}
Each item is {name, kind, value, default, unit, past}: name, which a refusal's details.limit carries; kind,
setting (this deployment's) or structural (a constant of the code); value, what this deployment enforces (a
setting's value on the root's leader, a structural limit's constant, equal to default); default, the design's
number; unit, what value counts, per org unless the name says otherwise; and past, the code a write past it is
refused with. The list, in order:
name | kind | default | unit | past |
|---|---|---|---|---|
brain_scopes | setting | 520,000 | records | ACCESS_LIMIT_REACHED |
sources | setting | 16 (a value above 16 counts as 16) | sources | ACCESS_LIMIT_REACHED |
containers_per_source | setting | 50,000 | records, per source | not_ingested: a connector leaves the containers past it out and counts them on the source's watermark and in coverage.gaps; a change set that would pass it is 409 ACCESS_LIMIT_REACHED |
sets | setting | 50,000 | records | ACCESS_LIMIT_REACHED |
apps | setting | 8 | records (application records) | APP_LIMIT_REACHED |
policies | setting | 64 | records | ACCESS_LIMIT_REACHED |
scope_path_segments | structural | 32 | segments | INVALID_SCOPE_GRAMMAR |
scope_path_bytes | structural | 4,096 | bytes | INVALID_SCOPE_GRAMMAR |
segment_type_chars | structural | 32 | characters | INVALID_SCOPE_GRAMMAR |
segment_id_chars | structural | 128 | characters | INVALID_SCOPE_GRAMMAR |
org_tree_depth | structural | 64 | links | INVALID_SCOPE_TREE (a change-set route answers INVALID_ACCESS_RECORD) |
command_bytes | structural | 4,194,304 | bytes | WAL_TOO_LARGE |
A setting is limits.<name> in a data node's [engine] table and CORTEX_LIMIT_<NAME> on a plain node
(CORTEX_LIMIT_BRAIN_SCOPES, ...); a value that is not a whole number of at least 1 is the default. It is enforced on
the proposer, per org tree, at a change set's activation, on a legacy registry route and at a first write's
auto-provisioning: 409 ACCESS_LIMIT_REACHED (APP_LIMIT_REACHED for apps) with details.limit, details.value,
details.used (what the scope held before the write), details.setting (the variable) and details.scope (the org, or
for containers_per_source the source), so a client's room is value - used. The structural limits
changeset_parts, changeset_bytes, set_entries, set_nesting and set_closure are enforced and not listed yet.
Callers: any principal of the root's tenant (a verified credential whose billing tenant is the root's org, with a role
at the root or none: limits are settings, not memory, so the root companion's access sources read them too); a caller
holding at least Reader at any other root (a ws: or custom root, another tenant's org: root); or the trusted
operator. Anyone else gets 403 POLICY_DENIED, one fixed body. Not paginated. On a cluster the ingress routes it by
the root to its leader, whose values are the ones it enforces.
Errors: 400 INVALID_QUERY (scope missing, not a scope path, or more than one segment; details.field: "scope");
403 POLICY_DENIED; 503 ACCESS_RESTORE_PENDING, DB_SATURATED, DB_UNAVAILABLE, the registry's outage codes;
504 DB_TIMEOUT.
8.20.4 POST /v1/access/lookup/scopes
Capability: access_lookup_v1.
Which registered scopes, at a prefix and under it, may this chain read at this role?
POST /v1/access/lookup/scopes
{"scope": "org:acme", "role": "reader", "kinds": ["team", "compartment"], "limit": 2}
200
{"items": [
{"scope": "org:acme/team:eng", "kind": "team", "role": "writer", "private": false, "display_name": "Engineering"},
{"scope": "org:acme/team:eng/aud:pub", "kind": "compartment", "role": "reader", "private": false}],
"next_cursor": "lc1.8Rk2vYw0b3Jn",
"has_more": true,
"revision_changed": false}
| Field | Type | Notes |
|---|---|---|
scope | string | Required. The prefix: the record at it and every record under it are the candidates; the routing key. |
role | string | Default reader. |
chain | object | Another chain (§8.20), for an Owner of scope (membership enforced) or the trusted operator, else 403 POLICY_DENIED; absent, the caller's own. |
kinds | array | Only records whose own tree.kind is one of these (org, team, person, employee, group, compartment, source, container, app, set, hold, policy, attrs); a record without a kind is then left out, and an empty list keeps none. Another name is 422 INVALID_BODY. |
include_private | boolean | Default false. Also list the scopes in private regions the chain may read; honoured only for the caller's own chain, so another chain's lookup names no private scope. |
limit | integer | 1 to 1000, default 1000; outside it 422 INVALID_BODY. |
cursor | string | next_cursor of an earlier page of the same request. |
consistency | object | §8.20. |
Each item holds scope; kind and label, the record's own tree.kind and label when it states them; role, the
role the deciding path delivers (check's delivered_role, at least the one asked); private, whether the record lies
in a private region; until, the deciding path's earliest end; and display_name (§8.20, names).
What is listed. The registered records at the prefix and under it, in path order (the order of the paths as
strings), each decided as check decides the chain there (another chain in the tenant check evaluates it in at that
record), so a scope is listed exactly where check allows it. A path no record registers reads through its governing
record and is not listed. The candidates come from the root's permission view, which the root's leader keeps: every
record some rule can reach the chain's principal at, a superset of what check allows. The trusted operator's own
lookup, whose roster is not read, takes every record and reads no view.
Pages. A page holds at most limit items and 1 MiB encoded, and evaluates at most 50,000 candidates, records that
kinds or the private filter leave out included; a page that stops at a bound says has_more: true with what it found,
possibly nothing, and next_cursor. The cursor is opaque and sealed: a page that stops at its bound of evaluated
records stops at a record its caller may not read, and the cursor never names it. It binds the request (the caller, the
scope, the role, the chain, kinds and the include_private honoured; not limit, which a later page may change), so a
cursor of another request, or one that does not open, is 422 INVALID_CURSOR (details.field: "cursor"). It is
sealed under a key derived from CORTEX_API_KEY, so it opens on every node of a deployment and after a restart; a
server with no static key opens only the cursors its own process issued. Later pages are evaluated at the current
revision: revision_changed: true says an authorization change at the prefix, at an ancestor or under it was made
since the first page (a change to a set or a companion elsewhere does not set it), or that another process issued the
cursor; restart for one consistent listing.
The permission view. While the root's view is being built (a node's first lookup of a root of more than 4,096
records, the first after a failover, after a registry change too large to follow record by record), and on a node that
does not lead the root, a lookup answers 503 ACCESS_VIEW_UNAVAILABLE, details.reason: "building", retriable with
Retry-After: 1. A root whose view would pass CORTEX_ACCESS_VIEW_ROOT_MAX_BYTES (default 1 GiB) or the node's
CORTEX_ACCESS_VIEW_MAX_BYTES (default 2 GiB; 0 keeps no view) answers reason: "over_cap", not retriable. A page
whose view goes while it reads ends there, with has_more: true. A request with consistency.at_least waits for the
view instead, within its budget (408 WAIT_TIMEOUT, details.waiting_on: "access_view", past it). The checks run in
this order: the body (422), the consistency demand (422, 408), the caller (403), the cursor (422), the view
(503).
Errors: 403 POLICY_DENIED; 408 WAIT_TIMEOUT (retriable); 422 INVALID_BODY, INVALID_SCOPE_GRAMMAR,
INVALID_CURSOR, CONSISTENCY_TOKEN_INVALID; 503 ACCESS_VIEW_UNAVAILABLE, ACCESS_RESTORE_PENDING, DB_SATURATED,
DB_UNAVAILABLE, WAL_UNAVAILABLE (retriable); 504 DB_TIMEOUT.
8.20.5 POST /v1/access/lookup/principals
Capability: access_lookup_v1.
Who may read this scope at this role, inherited readers included?
POST /v1/access/lookup/principals
{"scope": "org:acme/team:eng", "expand_sets": false}
200
{"items": [
{"set": "org:acme/set:eng", "display_name": "Engineering", "role": "reader",
"via": [{"kind": "entry", "record": "org:acme/team:eng", "field": "members", "index": 0,
"who": "org:acme/set:eng", "role": "reader"}]},
{"principal": "user:o_11c2", "display_name": "Omar K.", "role": "owner",
"via": [{"kind": "entry", "record": "org:acme/team:eng", "field": "members", "index": 1,
"who": "user:o_11c2", "role": "owner"}]}],
"has_more": false,
"revision_changed": false}
| Field | Type | Notes |
|---|---|---|
scope | string | Required. The scope whose readers are listed; the routing key. |
role | string | Default reader. |
expand_sets | boolean | Default true: every item is a principal with its best path. false: a principal reached through a set is listed as that set. |
limit | integer | 1 to 1000, default 1000. |
cursor | string | As on the scopes lookup (§8.20.4). |
consistency | object | §8.20. |
Each item is {principal | set, display_name?, role, via, until?, conditions?}: role is the role the deciding path
delivers (check's delivered_role for that principal; for a set, the highest among its members on the page), via
the deciding path (check's links.person.via; for a set, the path up to the entry, head, grant or members set that
names it), until and conditions that path's (for a set, only where every member through it on the page agrees), and
display_name a principal's directory name, or a set's name entry. The page carries has_more, next_cursor while
it has more, revision_changed, and truncated (present, true, on a page that ends where the candidate walk stopped
at its bound: follow next_cursor).
Callers. An Owner of scope (of its governing record, for a path with no record) or the trusted operator. A scope
in a private region has its readers listed only to that region's direct members (its self, or a principal its own
entries name, sets expanded, each entry's until and when holding) and the trusted operator. Anyone else gets
403 POLICY_DENIED, one body for every refusal. Then a scope no record is at answers 404 NOT_FOUND, so only a caller
who passed learns whether a path is registered.
The candidates are every principal a rule of the record can reach: its entries, its self and its chain person;
outside private regions the heads, delegates and grants of its unit and of the units above it, its source's and its
application's grants, the members of its unit and of the units under it, and the heads up its participants' home
chains. Each is decided as the hypothetical chain {sub} by check's gate, so a principal is listed exactly where
check allows that chain; a reader only an acting agent makes one (tree.delegable) is not listed. The walk reads at
most 4,000,000 entries and records a phase. A page that lists the last candidate of a phase whose walk stopped at that
bound says truncated: true, with has_more: true and a next_cursor that goes on with the next phase (a walk of
twice the bound, listing the readers it reached past the first, then three times, and so on), so following the
cursors lists every reader once, in id order within each phase. truncated is absent otherwise. The decisions read the root's permission view, so every principals lookup, the trusted operator's included,
answers 503 ACCESS_VIEW_UNAVAILABLE while it is being built, after the caller's checks and before the 404.
Pages are in principal id order within a phase, at most limit items, 1 MiB and 50,000 candidates evaluated each; without
expand_sets a set may be listed again on a later page. The cursor is sealed as on the scopes lookup and binds the
caller, the scope, the role and expand_sets; it is opened after the 404. consistency.at_least waits for the token and
then the view before the caller is checked.
Errors: 403 POLICY_DENIED; 404 NOT_FOUND; 408 WAIT_TIMEOUT (retriable); 422 INVALID_BODY,
INVALID_SCOPE_GRAMMAR, INVALID_CURSOR, CONSISTENCY_TOKEN_INVALID; 503 ACCESS_VIEW_UNAVAILABLE,
ACCESS_RESTORE_PENDING, DB_SATURATED, DB_UNAVAILABLE, WAL_UNAVAILABLE; 504 DB_TIMEOUT.
8.20.6 GET /v1/access/enrich
Capability: enrich_backfill_v1.
A scope's effective enrich (design §6.10, owner decision A5), what decides it, whether this process enriches at all,
and its tenant's enrichment backfill.
GET /v1/access/enrich?scope=org:acme/team:emea
200
{"scope": "org:acme/team:emea",
"enrich": null,
"effective": "on",
"decided_at": "org:acme/team:sales",
"process_enrichment": "on",
"enrichment_scope_allowed": true,
"enriched": true,
"backfill": {"tenant": "org:acme", "spent_today_usd": 0.0172, "remaining_today_usd": 4.9828,
"scopes": ["org:acme/team:sales"], "all_on_scopes": false,
"started_at": "2026-10-26T09:00:00Z", "queued": 10, "walking": true,
"waiting": null, "done_at": null, "next_scopes": []}}
| Field | Notes |
|---|---|
scope | The scope asked about. |
enrich | What the scope's own companion (<scope>/attrs:unit) says: on, off or inherit; null when it has none that says. |
effective | The nearest companion at or above the scope that says on or off, along each record's tree.parent, else the path's parent; null when none says, and the process decides. |
decided_at | The scope whose companion decided effective; null when none says. |
process_enrichment | off when this process enriches nothing (CORTEX_ENRICHMENT_DELAY_SECONDS unset): enrich then has no effect. |
enrichment_scope_allowed | false when CORTEX_ENRICHMENT_SCOPE_PREFIXES is set and the scope lies outside it: not enriched whatever its companion says. |
enriched | Whether a new capture at the scope is enriched now: process_enrichment on, the scope allowed, and effective not off. |
backfill | The scope's tenant's backfill on this node, null when it has none: tenant (the tenant root, its first CORTEX_TENANT_DEPTH segments); today's (UTC) spent_today_usd and remaining_today_usd against CORTEX_ENRICHMENT_BACKFILL_BUDGET_USD (default 5 US dollars a tenant a day); scopes, the scopes turned on it walks for (all_on_scopes when more turned on than a job names); started_at; queued; walking; waiting (budget: today's budget is spent; unpriced_model: the enrichment model has no price, so nothing is queued); done_at; and next_scopes, turned on while it walked and walked next. |
A committed change that turns a scope's effective enrich from off to on starts a walk of its older captures,
which the deferred scanner skipped while it was off, within the tenant's daily budget; GET /v1/admin/usage reports
every tenant's (enrichment_backfill). Callers: the trusted operator, or a caller holding at least Reader at the scope
(the tenant-root fence and the roster, no capability asked): enrich is a setting of the tree, not memory. Not
paginated. On a cluster the ingress routes it by the scope's root to its leader, whose backfill it reports.
Errors: 400 INVALID_QUERY (scope missing or not a scope path); 403 POLICY_DENIED; 503 ACCESS_RESTORE_PENDING,
DB_SATURATED, DB_UNAVAILABLE, the registry's outage codes; 504 DB_TIMEOUT.
8.20.7 POST /v1/access/texts/erase
Capability: none gates it.
Erases the free text a registry record names: its roster entries', grants', heads' and delegates' reasons, a hold's
matter and a policy case's notes. Free text holds no personal data by rule; this route is how one that does
leaves every replica.
POST /v1/access/texts/erase
{"scope": "org:acme", "path": "org:acme/team:eng"}
200
{"scope": "org:acme", "path": "org:acme/team:eng", "erased": 2}
| Field | Type | Notes |
|---|---|---|
scope | string | Required. The tenant root, its first CORTEX_TENANT_DEPTH segments; the routing key. |
path | string | Required. The record whose texts are erased, at or under scope. |
The leader proposes EraseTexts for every text the record names that its root's text range holds, one entry per
4,096 references, and the record keeps its references. Each entry's feed row starts the log residual's cycle, so the
text leaves the Raft log, the snapshots and the files of every voter, and the ice erasure journal replays it after a
restore. A response answers each erased text as {"erased": true} in its place; no response joins a record's texts
but a change set's reason, so that is where it shows. erased is the number of texts this call erased: a repeat
proposes nothing and answers erased: 0. A tombstone's texts are not reached (no record at path: 404); they go
with the daily sweep once nothing names them, or with the tenant.
Two erasures need no call: a tenant's deletion erases every text of its root (§8.6.10), and the leader's daily sweep, a day after boot and daily after, over every root, erases each text no record, tombstone or change-set header names a day after it was stored, with no feed row (it keeps every text a change-set header names, open or closed).
Callers: an Owner of the record, an Owner of the tenant root (who may rewrite any record of it, as change sets admit),
or the trusted operator; anyone else gets 403 POLICY_DENIED, audited, whether or not a record is there. On a cluster
the ingress routes it by scope to the root's leader; it is a write for the ingress, not a read.
Errors: 403 POLICY_DENIED; 404 NOT_FOUND (no record is registered at path); 422 INVALID_BODY with
details.field body, scope (details.reason invalid or scope_not_root) or path (invalid or
outside_root); 503 SCOPE_MOVING (details.roots, details.refusal: the root is moving and nothing was erased),
FORMAT_UPGRADE_PENDING (retriable for members_behind), NOT_LEADER, WAL_UNAVAILABLE and WAL_OUTCOME_UNKNOWN,
retriable; each other apply refusal, 503 with its own code and flag; 413 WAL_TOO_LARGE for an entry over 4 MiB
(not retriable); 503 ACCESS_RESTORE_PENDING (not retriable).
8.21 AuthZEN 1.0 (/access/v1/*)
Capability: authzen_v1 (new in 0.14.0).
The OpenID Foundation's Authorization API 1.0 over the access API, for a third-party policy enforcement point:
| Route | Maps onto |
|---|---|
POST /access/v1/evaluation (§8.21.1) | POST /v1/access/check (§8.20.1) |
POST /access/v1/search/resource (§8.21.2) | POST /v1/access/lookup/scopes (§8.20.4) |
GET /.well-known/authzen-configuration (§8.21.3) | the policy decision point's metadata, public |
The subject is always another chain (§8.20): sub is <type>:<id>, type one of user, agent, service and
system, and properties may carry the chain's act, app, client, run, auth_time, caps and scopes. So the
callers of check's other chain apply: an Owner of the resource's scope (membership enforced) or the trusted operator,
else 403 POLICY_DENIED; and a denial names the link that failed, never the uniform denial. action.name is the role:
summary, read (reader), write (writer) or own (owner); action.properties, if sent, must be empty.
A request that does not parse, misses a member, names a member this server does not map, or whose Content-Type is not
application/json (or a +json type) is 400 INVALID_BODY, with details.part and details.field, where check
would answer 415 or 422; so a chain whose scopes a client misspelled is never evaluated unconfined. Every 422 of
the route an AuthZEN route maps onto is a 400 here, with the same code and envelope (INVALID_SCOPE_GRAMMAR,
INVALID_CURSOR, a subject field that does not validate, its details.field subject.id or
subject.properties.<name>); a subject whose act names an AI employee is 400 INVALID_BODY,
details.field: "subject.properties.act", details.reason: "act_not_delegable". context.consistency_token is not mapped: 400 INVALID_BODY,
details.field: "context.consistency_token" (send consistency on check or the lookups); the AuthZEN answers carry no
consistency fields and no names. A client's X-Request-ID is echoed. On a cluster the ingress routes both POST routes
by resource.properties.scope when it is present, else by resource.id for a resource of type scope, as reads; a body
it cannot route is a 400 there too (SCOPE_REQUIRED, INVALID_BODY).
8.21.1 POST /access/v1/evaluation
POST /access/v1/evaluation
{"subject": {"type": "user", "id": "p_7f3a", "properties": {"client": "person"}},
"action": {"name": "read"},
"resource": {"type": "scope", "id": "org:acme/team:eng"}}
200
{"decision": false, "context": {"denied_by": "person"}}
| Member | Notes |
|---|---|
subject | Required. {type, id, properties?}: the chain (above). |
action | Required. {name, properties?}. |
resource | Required. {"type": "scope", "id": <path>}, or {"type": "memory", "id": <memory id>, "properties": {"scope": <its home>}}. A scope resource's properties.scope, if sent, must be its id, since the request is routed by one and decided at the other. |
context | {purpose?, consistency_token?}: purpose is check's (read_purpose_v1, §8.20.1), 400 INVALID_BODY with details.field: "context.purpose" for a value out of its grammar; consistency_token is refused (above). |
The answer is 200 with {"decision": true}, or {"decision": false, "context": {"denied_by": <link>}} on a denial. A
memory check answers 404 for (unknown, homed elsewhere, or homed where the caller may not read) is
{"decision": false} with no context, which confirms no more than the 404: AuthZEN has no not-found. For a memory
resource the decision is check's: at read the delivery gate's, its home, every atom the memory carries and its
label within the home path's cap (§8.20.1, "A memory"), with context.denied_by the link that withheld it (person
for an atom, label); at summary, write and own, its home's.
Errors: 400 INVALID_BODY, INVALID_SCOPE_GRAMMAR; 403 POLICY_DENIED; 503 AUTHORIZATION_STATE_CHANGED
(retriable), ACCESS_RESTORE_PENDING, DB_SATURATED, DB_UNAVAILABLE, the registry's outage codes; 504 DB_TIMEOUT.
8.21.2 POST /access/v1/search/resource
POST /access/v1/search/resource
{"subject": {"type": "user", "id": "p_7f3a"},
"action": {"name": "read"},
"resource": {"type": "scope", "properties": {"scope": "org:acme/team:eng"}},
"page": {"limit": 100}}
200
{"results": [{"type": "scope", "id": "org:acme/team:eng"},
{"type": "scope", "id": "org:acme/team:eng/aud:pub"}],
"page": {"next_token": ""}}
The scopes at and under resource.properties.scope that check allows the subject at the role, in path order, as the
scopes lookup lists them for another chain: no private scope is listed. resource.type is scope (another type is
400), and an id is ignored (AuthZEN §8.5.1). page.limit asks at most 1000 results (default 1000; 0 is 400; more
asks 1000, and the PDP may return fewer). page.next_token is always present and empty on the last page. A later page
repeats the first request, its limit included, with page.token; a token sent with another request is
400 INVALID_CURSOR, details.field: "page.token", and an absent or empty token asks the first page. page.properties, if sent, must be empty;
context takes no purpose (a search has none) and no consistency_token (400 each). The search reads the root's
permission view without waiting for it: while the view is being built, 503 ACCESS_VIEW_UNAVAILABLE,
details.reason: "building", retriable with Retry-After: 1.
Errors: 400 INVALID_BODY, INVALID_SCOPE_GRAMMAR, INVALID_CURSOR; 403 POLICY_DENIED (no Owner of the prefix, not
the trusted operator); 503 ACCESS_VIEW_UNAVAILABLE, ACCESS_RESTORE_PENDING, DB_SATURATED, DB_UNAVAILABLE;
504 DB_TIMEOUT.
8.21.3 GET /.well-known/authzen-configuration
The policy decision point's metadata (AuthZEN §9). Public: the route reads no credential.
GET /.well-known/authzen-configuration
200
{"policy_decision_point": "https://memory.example.com",
"access_evaluation_endpoint": "https://memory.example.com/access/v1/evaluation",
"search_resource_endpoint": "https://memory.example.com/access/v1/search/resource"}
policy_decision_point is CORTEX_AUTHZEN_PDP, read at each request, when it is an absolute http or https URL with
a host and no query or fragment (a trailing / dropped, a path kept); otherwise the request's origin: the scheme of
X-Forwarded-Proto's first value (https or http; http when it names neither) and the Host header when it is a
host and an optional port, else http://localhost. The two endpoints are the only ones this server serves: no batch
evaluation, subject search or action search is named. The answer carries Cache-Control: no-store, since it may name
the request's own host. On a cluster the ingress serves it itself. A node whose license gate has locked answers it
402 (LICENSE_EXPIRED, LICENSE_REQUIRED), as it answers a data request; a cluster ingress, which installs no license
guard, never does.
8.22 Change sets (/v1/access/changes)
Capability: access_changesets_v1 (since 0.14.0; shared memory phase 2, DB-4). The name also covers
GET /v1/access/records and POST /v1/access/restore/ack, described with the restore routes.
A change set rewrites a version-2 registry's records as one change. It is staged in parts, which are not visible,
previewed with a structural hash that an approval binds, and activated with every part at once, now or on a date. The
legacy registry routes (§8.8) make one-part changes with no preview. Change sets are shard apply format 8 entries: a
shard not armed for format 8 answers 503 FORMAT_UPGRADE_PENDING. On a cluster the ingress routes each request by its
root (the body's scope on a POST, ?scope= on GET and DELETE) to the root's leader.
Ids. id is the caller's idempotency id, 1 to 64 bytes of [A-Za-z0-9._:-], unique per root and caller. scope
is the change set's tenant root (one segment at the default CORTEX_TENANT_DEPTH of 1); every path it writes lies
under it. The {id} routes resolve id in the caller's namespace; with ?proposer=<principal id> they reach another
caller's change set, for an Owner of the registered root or the trusted operator only (403 POLICY_DENIED otherwise,
422 INVALID_QUERY for a value that is not a principal id). The replicated id, which watch names (§8.23.1), is
derived, never minted: the first 16 bytes of blake3("cortexdb/changeset/v1" ‖ root ‖ 0x1F ‖ the proposer's sub ‖ 0x1F ‖ id) as a UUID of version 8 with the RFC 9562 variant. So a retry after a lost answer finds its first attempt on any
leader, and two callers' ids never collide. Do not reuse an id: 7 days after a change set closes its header is purged,
and the same id then stages a new change set.
Who may call. For every record a change set writes, the caller is an Owner of it, with policy.administer.scope
at its path. For a new scope record that means scope.create.<type> at its path and Owner of the parent it names, or
without a parent, Owner of its nearest registered ancestor; for a set, hold, policy or companion record, an Owner of
that record, or of the scope a companion governs. An Owner of the tenant root covers everything in it, private records
included. A new tenant root needs owns_scope_root for the caller's billing tenant with scope.create.<type>, or the
trusted operator, so a change set never registers a root outside the caller's own tenant. The trusted operator may
always call. The same check runs again at activation, against the registry as it is then.
Since 0.14.0 (the A02 review) the decision is the credential's as well as the roster's, and every refusal is
403 POLICY_DENIED with details.link and details.reason and writes its decision line. The tenant: a change
set is its caller's own tenant's: a credential of another billing tenant is refused (link: "tenant"), and a
tenant root no record registers is registered only by a principal of that tenant or the trusted operator
(reason: "outside_tenant"). The credential: staging, and activation again for the approver, need
policy.administer.scope at each record the change writes and, for a new record, scope.create.<type> of its
leaf (a companion attrs: record is checked at the record it describes), under the token's own caps and
scopes (link: "capability" or "confinement", with details.capability and details.scope); preview and
discard need policy.administer.scope at the root. A token that carries scopes names these families where it
writes: a compiler's token (CortexOS's) carries policy.administer.scope and scope.create.<type> entries for the
subtrees its change sets write, or it is refused with link: "confinement". The roster, as the table says.
The trusted operator holds every capability the deployment allows and skips the roster.
| Route | Caller |
|---|---|
POST /v1/access/changes, POST …/{id}/parts | The trusted operator (the static CORTEX_API_KEY, or any caller of an auth-disabled server). Otherwise the rule above for every record the change writes: policy.administer.scope and Owner at its path (an Owner of the registered tenant root covers every record in it); for a new scope record scope.create.<type> and Owner of the parent it names (of its nearest registered ancestor without one); for a new tenant root owns_scope_root with scope.create.<type>. …/parts checks the records against the change set's proposer |
POST …/{id}/preview, GET and DELETE /v1/access/changes/{id} | The proposer, in its own namespace; another caller's change set with ?proposer= (an Owner of the registered root, or the trusted operator) |
POST …/{id}/activate | The caller is the approver: the staging rule again, against the registry as it is, for every record the change set writes; another caller's change set with ?proposer= as above |
Lifecycle.
staged ──activate: undated, or its date passed──▶ activated
staged ──activate: date ahead──▶ scheduled ──at the date, the checks pass──▶ activated
scheduled ──activate again: date ahead──▶ scheduled (the new approval replaces the old)
scheduled ──activate: date passed──▶ activated
scheduled ──at the date, a check fails──▶ staged (refusal recorded; watch: activation_refused)
staged | scheduled ──DELETE, or 7 days past its date (dated) or its staging (undated)──▶ discarded
activated | discarded ──7 days after closing──▶ purged (404 NOT_FOUND)
The root's leader sweeps every 60 seconds. It activates a dated change set on its date with the approval its header
holds (any leader's, after a failover), checking again as an activation does, the approver's authority included, or
proposes its refusal; it discards an open change set 7 days after its date or its staging, and purges a closed header 7
days after it closed. A refusal at the date (PREVIEW_CHANGED, ACCESS_ASSERTION_FAILED, ACCESS_LIMIT_REACHED,
APP_LIMIT_REACHED, CHANGESET_STALE with its paths, POLICY_DENIED once the approver has lost its authority,
INVALID_ACCESS_RECORD for a put that would make a version-2 record version 1 (since 0.14.1), or
CHANGESET_INCOMPLETE) clears the approval, leaves the change set staged, sets its status's refusal and is listed by
watch as activation_refused: the stager approves again, or stages a new change set. A shard that cannot take the
entry at the date (no leader there, a full disk) is tried again at the next sweep. Activation and discard delete the
parts and close the header.
Staleness. Each staged part records the state of every path it writes: its registry sequence on a cluster, a
content stamp of the record or tombstone on a plain node. Activation refuses a change set any of whose paths moved
since: 409 CHANGESET_STALE, so a change set never undoes a later change (a SCIM or connector removal, a legacy route,
another change set). A path's state never moves back, so such a change set can never activate: discard it, read the
records again, and stage a new one under a new id.
Read paths. What a change set's checks read beyond the paths it writes (the sets its rules reach, the tenant's
policy records) rides its parts, at most 256 a part, and its activation, 256 more. A part staged with records: []
holds read paths only, which the leader fills. When a request's new parts cannot carry the read paths, nothing is
staged; when an activation's checks read more than its parts and its own 256 name, it is refused. Both answer 409
CHANGESET_STALE with details.reason: "read_set" and details.read_paths (the number read): send the request again
with more parts of records: [], or, at activation, stage the change set again under a new id with them after its last
part.
Restores, moves, full disks. While a restore mark holds the root pending, these routes serve only resync change
sets, to the access sources the mark lists for the root (an Owner of the root when it lists none) and the trusted
operator; any other request, the trusted operator's ordinary change set and the status or preview of one staged before
the restore included, answers 503 ACCESS_RESTORE_PENDING, not retriable, with details.pending_sources; to such a
caller an {id} route answers it for an id that names no change set too (a caller the mark serves gets 404), so the
gate names no change set to anyone it does not serve. A mark that does not read is 503 WAL_UNAVAILABLE (retriable).
The scheduler's sweep is not gated: a dated change set approved before the restore still activates at its date. On a
cluster, an entry
that apply's scope fence refuses, because the root is moving between shards or its assignment changed under the
proposal, writes nothing and answers 503 SCOPE_MOVING (retriable; details.roots, details.refusal
SCOPE_NOT_OWNED or STALE_EPOCH). While a disk is critical only a narrowing change set stages and activates (503
DISK_FULL, Retry-After: 30); a dated approval and a discard are always admitted.
Free text. A roster entry's, a grant's or a delegate's reason, a hold's matter, a policy case's note, and the
change set's own reason are stored in the root's text range under a random reference the route draws; the stored
record or header holds the reference, never the text. Each is at most 256 bytes, and holds no personal data. A record
may name a *_ref the range holds already; one it does not hold refuses the staging with 500 INTERNAL_ERROR,
details.refusal: "REGISTRY_ENTRIES_MALFORMED".
ChangeSetStatus, what every route here but the preview answers:
| Field | Type | Notes |
|---|---|---|
id | string | The client id |
scope | string | The tenant root |
state | string | staged, scheduled (a dated change set's approval is recorded for its date), activated or discarded |
parts, parts_total | integer | Parts staged, and parts the change set has |
bytes | integer | Bytes of the staged parts' records |
staged_at | RFC 3339 | When its first part applied |
activate_at | RFC 3339 | A dated change set's date; absent when undated |
approved_preview_hash, approved_by | string | The approval a schedule recorded; absent until a dated change set is approved, and cleared by a refusal at its date. An undated activation records none |
activated_at, discarded_at, closed_at | RFC 3339 | How and when it closed |
discard_after | RFC 3339 | Open: when the sweep discards it, 7 days after its date or its staging. Closed: when its header is purged, 7 days after it closed |
refusal | object | The last refusal at its date, {code, at, paths?, moved?}, with paths (the first 256 in path order) and moved for CHANGESET_STALE. A later approval clears it; an activation or a discard keeps it |
revision | integer | On an activation's own 200: the root's authorization revision after it |
proposer | string | The staging caller's sub, whose namespace id is in |
narrowing | boolean | |
resync | object | {last}, on a resync change set |
reason | string | The change set's reason, read back from the root's text range |
consistency_token, derived_through | On an activation's 200 only (§8.22.4, §6.11) | |
warnings | array | On a staging's 200 only (since 0.15.0): each companion put whose stored enrich the staging kept, {reason: "enrich_kept", path, kept} (§8.22.1); absent when there is none |
8.22.1 POST /v1/access/changes — Stage a change set
Capability: access_changesets_v1. Callers: §8.22, "Who may call".
Stages parts of a change set in the caller's own namespace.
{
"scope": "org:acme",
"id": "reorg-2026-11",
"parts": [
{"part": 0, "records": [
{"path": "org:acme/team:eng", "op": "put", "record": {
"members": [
{"actor": "user:compiler", "role": "owner"},
{"actor": "user:alice", "role": "summary", "reason": "reads the weekly rollup"}
],
"policies": {},
"auto_provisioned": false,
"created_at": "2026-11-01T00:00:00Z",
"tree": {"kind": "team", "parent": "org:acme"}
}},
{"path": "org:acme/team:old", "op": "delete"}
]}
],
"parts_total": 2,
"activate_at": "2026-11-15T09:00:00Z",
"reason": "November reorg"
}
| Field | Type | Notes |
|---|---|---|
scope | string | Required. The tenant root. Not a scope path: 422 INVALID_SCOPE_GRAMMAR; deeper than the tenant root: 422 INVALID_BODY, details.reason: "scope_not_root"; a tenant root of more than one segment (CORTEX_TENANT_DEPTH above 1): 422 INVALID_BODY, details.reason: "tenant_depth_unsupported" (since 0.14.0; staging used to refuse each of its records) |
id | string | Required. 1 to 64 bytes of [A-Za-z0-9._:-] (else details.reason: "id") |
parts | array | Required, at least one {part, records}. Each part at most once a request, from 0 and below parts_total (else "part") |
parts[].records | array | {path, op, record?}: op put with its record, or delete without one (else "op"); [] makes a part of read paths only |
parts_total | integer | 1 to 1,024 (else "parts_total"). Default: the number of parts in the request, so a retry that leaves it out sends as many parts as its first attempt did |
activate_at | RFC 3339 | A dated activation, at most 90 days after staging (else "activate_at_too_far"). A date already past when the first part is staged is dropped: the change set is undated |
reason | string | At most 256 bytes of UTF-8 (else "reason") |
resync | {last: boolean} | The change set re-sends part of a restored root's access state, and is served while the restore mark holds the root. A source's resync may span several change sets; activating the one with last: true acknowledges the restore for its proposer alone, when the mark lists the proposer as an access source of the root |
narrowing | boolean | Default false. The change set only removes access: a request whose records widen access is 422 INVALID_BODY, "not_narrowing", through anyone's role or through a written record's own fields, with details.path, the first record (in part order) whose change widens access, and, when a person's role is what widens, details.principal and details.scope: the record whose own rules widen access, or the first with which, the request's records applied in part order, a role the change gives first shows (a record whose own rules widen is named without a role). A change to a field that admits or grants (a record's apps or reference; a companion's heads, delegates, grants, members_set, apps, access_sources or apps_enforced) widens unless it provably shrinks: every principal the field names after it, every entry counted, is one it named before through entries with no until and no when, on an entry that ends no earlier and asks no more (a grant: the same scope, a role no higher). A unit's members are its companion's members_set, else its own entries. It counts against its proposer's narrowing quota only |
convert | boolean | Default false. A conversion of version-1 records to version 2, names moved into name entries first; a request whose records change access is 422 INVALID_ACCESS_RECORD, "conversion_changes_access", details.path the root. Since 0.14.1 it is also what lets a put that states no version-2 field replace a stored version-2 record, making it a version-1 one, under the same rule: without it the put is refused, "version_downgrade" (below) |
A record's path is a scope path under the root, written at most once in the change set across all its requests
(422 INVALID_BODY, "path_twice"). record is the stored record, in the JSON GET /v1/scopes?path= returns: members,
policies, auto_provisioned and created_at are required, path defaults to the op's and must equal it, and the
record is written as sent, but for created_at, auto_provisioned and billing_tenant: the leader sets them,
replacing a value sent for them. And since 0.15.0 a companion's enrich is kept unless the put names
it: a put of <scope>/attrs:unit whose attrs does not name enrich (absent or null, or no attrs at all) is
staged with the stored companion's value, and only an explicit "enrich": "inherit" clears it. A whole-record
put from a writer that does not know enrich used to drop it without a word. The staging answer's warnings names
each put that kept an on or off, {"reason": "enrich_kept", "path", "kept"}, the first 256 (a kept
inherit decides nothing and is not named), and is omitted when there is none; only a staging answers it, never a
status read. The rule runs at staging, so the staged record is the one every replica applies, and a part sent again
keeps what its first attempt staged. A change set that writes policy records writes nothing else ("assertions_alone"). The
record rules answer 422 INVALID_ACCESS_RECORD with details.path and details.reason, before anything is staged:
record (it does not decode, or a text field is not a string of at most 256 bytes), path, outside_root,
reserved_path (a marker path), display_name (a name belongs in the directory), roster_too_large and
set_too_large (more than 256 entries), listed_twice, principal_is_address (a new principal id holding @),
when_purpose (a roster entry's, a set entry's or a unit grant's when: {purpose} id outside a read's purpose
grammar, [a-z0-9_-]{1,64}), and the container rules container_parent, container_kind, container_writer,
container_reader, container_apps, dm_not_private. Since 0.14.1, version_downgrade (the hard rail): a put that
states no version-2 field over a stored version-2 record, which 0.13.0's rule would then decide (the first entry naming
a principal, whatever the check), in a change set that does not say convert. It is refused before anything is
evaluated, a narrowing change set's included, and details.dropped lists the stored record's version-2 fields, every
one of which the put leaves out (tree.self, tree.audience, members[].until, members[].role for a summary
entry, apps, ...): state them in the put, or say convert.
- Idempotent by id. The same parts again answer 200 with the current status, and a request naming a part not yet
staged stages it. Other records under a staged part's number, or another
parts_total,activate_at,reason,resync,narrowingorconvertunder a staged id, answer 409CHANGESET_CONFLICT. An id whose change set was activated or discarded answers 409CHANGESET_NOT_STAGED, with its status indetails.status, until the header is purged. A part sent again keeps what its first attempt staged that the leader derived: a delete's tombstone, the markers and the read paths. - One part at a time. A request's parts are proposed in request order; an error after the first leaves the earlier parts staged, and the same request sent again stages the rest.
- Bounds. Each part's entry encodes within 4 MiB (413
WAL_TOO_LARGE,details.part); a change set holds at most 1,024 parts and 64 MiB of staged records (413CHANGESET_TOO_LARGE); per root at most 4,096 staged parts and 256 MiB across its open change sets that are not narrowing, per proposer 1,024 parts and 64 MiB of them, and per proposer 1,024 parts and 64 MiB of narrowing change sets, a quota of their own, so no stager holds back a revocation (409CHANGESET_STAGING_FULL,details.limitroot,proposerorproposer_narrowing). The body is at mostCORTEX_MAX_BODY_BYTES(32 MiB). - The deployment's limits (§8.22.4) are checked at activation, when every part is known, never at staging.
Response: 200 with ChangeSetStatus, state staged, and no consistency token; 202 while its check's
evaluation runs long (below).
Evaluations that run long (since 0.14.1). A request whose evaluation (a narrowing or a conversion staging's check, a preview, an activation's checks) runs past CORTEX_CHANGESET_EVAL_WAIT_MS (default 20,000 ms; 0 or off waits for it, as 0.14.0 did) answers 202 with Retry-After: 2, and the evaluation runs on. Sending the same request again joins it, or, once it ended, is answered by it for 60 s (and a preview's for as long as the root holds still), so a client with a 30 s timeout polls its way to the answer. A staging's or an activation's 202 has no body; the request it answers goes on in the background once its evaluation ends, so the request sent again answers the change set's status. An evaluation no request waits on stops 60 s after the last one left. A dated change set's activation by the sweep, and SCIM, wait as before.
{"id": "reorg-2026-11", "scope": "org:acme", "state": "staged", "parts": 1, "parts_total": 2, "bytes": 412,
"staged_at": "2026-11-02T10:00:00Z", "activate_at": "2026-11-15T09:00:00Z",
"discard_after": "2026-11-22T09:00:00Z", "proposer": "user:compiler", "narrowing": false,
"reason": "November reorg"}
Errors (§16): 403 POLICY_DENIED; 409 CHANGESET_CONFLICT, CHANGESET_NOT_STAGED, CHANGESET_STAGING_FULL,
CHANGESET_STALE (read_set), REGISTRY_NOT_REPLICATED (a cluster shard whose registry is node-local); 413
WAL_TOO_LARGE, CHANGESET_TOO_LARGE; 422 INVALID_BODY, INVALID_ACCESS_RECORD, INVALID_SCOPE_GRAMMAR; 500
INTERNAL_ERROR (details.refusal); 503 ACCESS_RESTORE_PENDING (not retriable), SCOPE_STORAGE_UNAVAILABLE (retriable since 0.14.0; it said false),
DISK_FULL, SCOPE_MOVING, REGISTRY_STALE (the registry kept moving over three attempts), NOT_LEADER,
WAL_UNAVAILABLE, WAL_OUTCOME_UNKNOWN (retriable: send the same request again), FORMAT_UPGRADE_PENDING (retriable,
Retry-After: 30, only with details.reason: "members_behind"). Every 409, 413 and 422 here is not retriable.
8.22.2 POST /v1/access/changes/{id}/parts — Stage more parts
Capability: access_changesets_v1. Query: proposer (optional).
Body {scope, parts}. Stages more parts of a staged change set under the fields its header holds (parts_total,
activate_at, reason, resync, narrowing, convert), with §8.22.1's rules, bounds and errors. A part number
already staged with the same records changes nothing; with other records it is 409 CHANGESET_CONFLICT. The records are
checked against the roles of the change set's proposer, and always pass for the trusted operator. An unknown id is 404
NOT_FOUND (an id that is not 1 to 64 bytes of [A-Za-z0-9._:-], 422 INVALID_BODY, details.reason: "id"); a change
set that was activated or discarded answers 409 CHANGESET_NOT_STAGED. Response: 200 with ChangeSetStatus.
8.22.3 POST /v1/access/changes/{id}/preview — Preview the access diff
Capability: access_changesets_v1. Query: proposer (optional).
The access diff of a staged or scheduled change set against the registry now, computed from the units and sets the
change touches (the records it writes, the sets their rosters name, nested, and the records whose rosters name a set it
writes), never the whole org. The page is computed when it is asked for, answered at once once its evaluation
ended, and kept for the activation while the root holds still. While the evaluation runs past the bound it answers
202 with Retry-After: 2 and {"state": "previewing"}, as §8.22.1 says ("Evaluations that run long"). It proposes
nothing.
{"scope": "org:acme", "people": true, "limit": 100}
| Field | Type | Notes |
|---|---|---|
scope | string | Required. The change set's tenant root |
people | boolean | Default false: list each unit's people with their gains and losses |
limit | integer | Units a page holds at most, 1 to 1000, default 100 (else 422 INVALID_BODY, details.reason: "limit") |
cursor | string | A previous page's next_cursor (else 422 INVALID_CURSOR) |
Response: 200 with ChangeSetPreview:
{"id": "reorg-2026-11",
"preview_hash": "sha256:4f0c…",
"computed_at": "2026-11-02T10:05:00Z", "revision": 412, "widens": true, "narrows": true,
"summary": {"records_written": 2, "units": 1, "people_gaining": 1, "people_losing": 2, "rollups_hidden": 0},
"units": [{"unit": "org:acme", "records": ["org:acme/team:eng", "org:acme/team:old"],
"changes": [{"path": "org:acme/team:old", "before": {"kind": "team", "parent": "org:acme", "…": "…"},
"after": {"tombstone": true, "deleting": false}}],
"people": [{"principal": "user:alice",
"gains": [{"scope": "org:acme/team:eng", "before": null, "after": "summary"}],
"losses": []}]}],
"rollups_hidden": [],
"assertions": {"evaluated": 3, "failed": []},
"stale_paths": [],
"in_band": false, "in_band_parts": [],
"names": {"user:alice": "Alice Kim"},
"next_cursor": null, "has_more": false}
preview_hashcovers the structural effect only: the records written and, for each, its structure before and after and that of the records it sits under (kind, parent,private, audience,self,delegable, label, admissions, the set rules of a roster, a set's nested sets, a companion's heads, delegates, grants and settings, a hold's scopes and people, a policy's cases, an application's body). Principals on rosters and in sets, and text references, are not hashed, so roster churn inside the touched units leaves it equal. It is a deterministic function of the registry and the change set, so every leader computes the same.- A unit is the nearest record of kind
orgorteamat or above a record the change writes or reaches, else the tenant root.units[].recordslists the written records under it,units[].changestheir structural changes (beforeandafterare structures in the hash's form,{tombstone: true, deleting}for a tombstone, or null), and withpeople: true,units[].peopleeach principal whose role at a record of the unit changes, with each scope's role before and after (nullwhere no path admits them). People are listed, never hashed. widensandnarrows: some principal gains or loses a role, or a structural change widens (a lower label, an audience changed, a region made delegable or no longer private, or a field that admits or grants changed in any way but a provable shrink: a record'sappsorreference, a companion'sheads,delegates,grants,members_set,apps,access_sourcesorapps_enforced; seenarrowing, §8.22.1) or narrows. The people are evaluated at every record whose access the change can move, not only those whose rosters name a set it writes: a record reading a changed unit's heads or members (a team, asubtree,rollup,leadsorchaincompartment), a container whose source changed, aparticipantsgroup whose members' homes or units changed, a record under a region whose roster changed; and at each, every principal who may hold a path there (as the lookups list them), so a member a companion'smembers_setadds is listed gaining.assertions.failedlists every policy case that fails after the change, one that already failed before included; only a case that held before blocks a widening change (§8.22.4).caseis the case's index in its policy, as a string.rollups_hidden(rollups_v1): the rollups the change would hide, by home then id, the first 256, each{rollup, home, readers};summary.rollups_hiddencounts them all. Neither is hashed.stale_paths: the first 256 paths the change set writes whose state moved since staging; activation would answerCHANGESET_STALE.in_bandandin_band_parts(since 0.14.0): whether the caller's activation is an in-band path of the operator plane (§8.15.3, "Change sets"), which only the operator key's can be, and the records that make it so, the first 256, each{part, path, reason, scope?}: the part that writes the record, its path,reasonone ofregisters,service_principal,private_region_readerorprivate_region_widened, and for the last twoscope, the scope in a private region whose readers it widens (the record itself, a private record whose roster reaches a set the change writes, or a grant's scope). Underdenythe key's activation of such a change set needsX-Cortex-Break-Glassand tells each such region's people first. Any other caller getsfalseand[]. Neither is hashed: both are judged against the registry each time.names(directory_v1): the directorydisplay_nameof each person the page lists, for a caller who reads names in the tenant, joined after the preview is computed, so the hash never covers a name;{}withoutpeople.warnings(since 0.15.0): each companion put that keeps a storedenrichofonoroff,{"reason": "enrich_kept", "path", "kept"}, judged against the registry now, the first 256, on every page; absent when there is none. A put that leftenrichout is among them (§8.22.1), and so is one that names the stored value. Not hashed.- Pages hold at most
limitunits and 1 MiB. A unit that does not fit continues on the next page, repeated with the rest of its records, changes and people: itsrecords_cursoris set while its records or changes continue, itspeople_cursorwhile its people do, each the page'snext_cursor. A page always serves its first item, however large.next_cursorisnullon the last page, and each page is computed against the registry as it is when it is asked for.
Errors (§16): 403 POLICY_DENIED (?proposer=); 404 NOT_FOUND; 409 CHANGESET_NOT_STAGED (activated or discarded);
422 INVALID_BODY, INVALID_CURSOR, INVALID_SCOPE_GRAMMAR, INVALID_QUERY; 500 INTERNAL_ERROR; 503
ACCESS_RESTORE_PENDING (not retriable), WAL_UNAVAILABLE (retriable).
8.22.4 POST /v1/access/changes/{id}/activate — Approve and activate
Capability: access_changesets_v1. Query: proposer (optional).
{"scope": "org:acme", "preview_hash": "sha256:4f0c…"}
preview_hash is the hash the approver approved, sha256: and 64 hex digits (else 422 INVALID_BODY,
details.reason: "preview_hash"). The leader checks, against the current registry, in order:
- every part up to
parts_totalis staged, else 409CHANGESET_INCOMPLETEwithdetails.missing_parts; - the caller, the approver, has the staging authority for every record the change set writes, else 403
POLICY_DENIED; and, since 0.14.1, no put makes a version-2 record a version-1 one unless the change set saysconvert, else 422INVALID_ACCESS_RECORD,details.reason: "version_downgrade", withdetails.pathanddetails.dropped(a change set staged before 0.14.1, or over a record converted since its staging read it); - the structural hash equals
preview_hash, else 409PREVIEW_CHANGEDwithdetails.preview_hash, the current one; - the tenant's assertions, as they stood before the change, against the state after it: a change that widens access
and breaks a case that held before is refused, 409
ACCESS_ASSERTION_FAILED,details.failed[]of{policy, case, widening}(casethe case's index as a string, as the preview gives it). A change that does not widen activates with the cases it breaks, whichwatchlists asassertion_brokenitems; - the deployment's limits (
GET /v1/access/limits), against the state after it, what it deletes netting off what it adds: 409ACCESS_LIMIT_REACHED, orAPP_LIMIT_REACHEDfor application records, withdetails.limit,details.value(the deployment's value),details.used(the count before the change),details.setting(the environment variable, for exampleCORTEX_LIMIT_SETS) anddetails.scope(the org, or the source forcontainers_per_source); - every path it writes is in the state its part recorded, else 409
CHANGESET_STALEwithdetails.paths(the first 256 that moved, in path order) anddetails.moved(their number): it can never activate (§8.22, "Staleness"); - what the checks read beyond what the parts name fits the activation's own 256 read paths, else 409
CHANGESET_STALE,details.reason: "read_set", withdetails.read_paths.
Undated, or its date passed: every part becomes visible at once: 200, ChangeSetStatus, state activated, with
revision. A scheduled change set activated after its date under another preview_hash first records the new
approval. On a cluster the activation is one ActivateChangeSet entry, one feed row a part, which every replica's tail
applies under one registry write lock; on a plain node the registry commits the parts as one journal line, then the
entry that closes the header is proposed, and one that fails is proposed again by the sweep.
Checks that run long: 202 with Retry-After: 2 and no body, as §8.22.1 says ("Evaluations that run long"): the
activation goes on in the background once its checks end, and sent again it answers its status.
Dated, with the date ahead: the approval (approved_preview_hash, approved_by) is recorded for the date, 202,
state scheduled; activating again records a new approval in place of the old. At the date the sweep activates it or
records a refusal (§8.22, "Lifecycle").
The 200 ends with consistency_token, a token at the request's root covering the change (the body's scope; a
?scope= query parameter takes precedence), and derived_through once this node's enrichment has finished a pass, so a
following read whose consistency.at_least is that token sees the change on any replica (§6.11). A 202, a refusal and
a GET carry none; a token this node cannot issue leaves the 200 as it is, since the change has committed.
An activated change set answers 200 with its status, so an activation after a lost answer (WAL_OUTCOME_UNKNOWN) is
retried by calling it again; a discarded one answers 409 CHANGESET_NOT_STAGED. A resync change set with last: true
acknowledges the root's restore for its proposer when the mark lists the proposer as an access source of the root.
The operator key (since 0.14.0; §8.15.3, "Change sets"). Under the tenant's effective mode deny or audit, the
key's activation, and its approval of a dated change set, is first judged as the checks above judge it (an incomplete,
changed, blocked, limited or stale change set is refused with its own code before anything else), and then decided on
the records that make it an in-band path, which the preview names (in_band_parts, §8.22.3). Under deny one that
has any answers 403 BREAK_GLASS_REQUIRED without X-Cortex-Break-Glass and activates nothing; with it, each private
region it widens is told first (a notice of cause break_glass, the header's reason, to the region record's self,
else its principal members), and it activates only once those notices commit (503 NOTICE_UNAVAILABLE, nothing
activated, otherwise). Should the registry change between that decision and the activation so that the change set
reaches what was not decided, the activation is refused 503 REGISTRY_STALE (retriable) and writes nothing; the retry is
decided again. Under audit it is served and counted. The request's audit row records the header (break_glass), or
the refusal (denial.check: "operator_access", denial.reason: "in_band").
Errors (§16): 403 POLICY_DENIED, BREAK_GLASS_REQUIRED (the operator key, above); 404 NOT_FOUND; 409
PREVIEW_CHANGED, ACCESS_ASSERTION_FAILED,
ACCESS_LIMIT_REACHED, APP_LIMIT_REACHED, CHANGESET_STALE, CHANGESET_INCOMPLETE, CHANGESET_NOT_STAGED,
CHANGESET_CONFLICT (another approval was recorded while this one was checked), REGISTRY_NOT_REPLICATED, none
retriable; 422 INVALID_BODY, INVALID_SCOPE_GRAMMAR, INVALID_QUERY, INVALID_ACCESS_RECORD (version_downgrade,
since 0.14.1); 500 INTERNAL_ERROR; 503
ACCESS_RESTORE_PENDING (not retriable), SCOPE_STORAGE_UNAVAILABLE (retriable since 0.14.0, when it said false: a
cluster's registry could not catch up, before or after the activation committed; call it again to read the outcome), DISK_FULL, SCOPE_MOVING,
REGISTRY_STALE, NOT_LEADER, WAL_UNAVAILABLE, WAL_OUTCOME_UNKNOWN (retriable), FORMAT_UPGRADE_PENDING
(retriable only with members_behind), NOTICE_UNAVAILABLE (the operator key's break-glass activation whose notice did
not commit, with the notice's details.reason; nothing was activated).
8.22.5 GET /v1/access/changes/{id}?scope=<root> — A change set's status
Capability: access_changesets_v1. Query: scope (required), proposer (optional).
ChangeSetStatus, from the open header while staged or scheduled and from the closed header once activated or
discarded, until the header is purged 7 days after it closed; then 404 NOT_FOUND. The proposer reads its own change
sets with no other role checked. It proposes nothing and reads no ?at_least=.
Errors (§16): 403 POLICY_DENIED (?proposer=); 404 NOT_FOUND; 422 INVALID_SCOPE_GRAMMAR, INVALID_BODY
(scope_not_root or tenant_depth_unsupported, here for the query parameter), INVALID_QUERY; 500 INTERNAL_ERROR; 503 ACCESS_RESTORE_PENDING
(not retriable), WAL_UNAVAILABLE (retriable).
8.22.6 DELETE /v1/access/changes/{id}?scope=<root> — Discard
Capability: access_changesets_v1. Query: scope (required), proposer (optional).
Discards a staged or scheduled change set and answers its status, state discarded: its parts are deleted, its header
closes, and watch lists a discarded item. Repeating it answers the same and never removes a closed header. An
activated change set answers 409 CHANGESET_NOT_STAGED; its undo is a reverse change set. On a plain node, a change set
whose activation committed to the registry but whose log entry has not closed its header is closed as activated
instead, and the answer says activated.
Errors (§16): 403 POLICY_DENIED; 404 NOT_FOUND; 409 CHANGESET_NOT_STAGED; 422 as §8.22.5; 500 INTERNAL_ERROR;
503 ACCESS_RESTORE_PENDING (not retriable), SCOPE_MOVING, NOT_LEADER, WAL_UNAVAILABLE, WAL_OUTCOME_UNKNOWN
(retriable), DISK_FULL (only for the plain node's close as activated).
8.22.7 Derivation policies in change sets (derivation_policy_v1, new in 0.15.0)
Capability: access_changesets_v1, plus derivation_policy_v1 for derive records. Experimental. An Owner of the
governed scope or of the tenant root, whose credential holds derivation.administer.scope or policy.administer.scope
at the governed scope (the trusted operator always). Format 11.
A derivation policy is a registry record of kind derive at <scope>/attrs:derive, whose body derive holds the typed
rules for the scope's subtree (modes, stages,
topics, detectors, sources, grounding, predicates, review, episodes, a model and a budget). It is staged, previewed and
activated through the change-set routes above, and read back through GET /v1/derivation/policy (§8.32.1). A derive
record holds no roster and no policies, so its record may leave out members and policies:
POST /v1/access/changes
{"id": "derive-companion-v1", "scope": "org:acme", "reason": "Consumer defaults for the companion app",
"parts": [{"part": 0, "records": [
{"path": "org:acme/app:companion/attrs:derive", "op": "put",
"record": {"tree": {"kind": "derive"},
"derive": {"v": 1, "from_template": "consumer@1", "mode": "automatic",
"topics": {"deny": ["payment_data", "government_ids", "secrets"],
"deny_unless_consent": ["gdpr_art9"], "on_unknown": "accept"},
"detectors": {"deny": ["payment_card", "iban", "government_id", "secret"],
"action": "drop", "source_action": "redact"},
"on_unlisted_predicate": "contest",
"instructions": [{"text": "Keep what helps the user plan meals and trips."}],
"examples": [
{"input": "I'm vegetarian and I hate early flights.",
"memories": ["User is vegetarian", "User dislikes early flights"], "synthetic": true},
{"input": "lol ok whatever", "memories": [], "synthetic": true}]}}}]}]}
Inline texts. An object in instructions, in examples or in a custom topic's description is a new policy text,
written as its own record (its content may hold personal data, so it never enters the registry; §8.32.4): the staging
validates it, gives it an id (ptx_ and 32 hex digits) and stages the record naming the id. An existing text is named by
its id. An instruction is {"text", "language"?} (up to 4 KiB, 8 per policy, 8 KiB in total), a description
{"text", "language"?} (up to 1 KiB, 4 KiB in total), an example {"input", "memories", "synthetic"?, "sources"?, "language"?} (an input up to 4 KiB holding none of the prompt's section markers, 0 to 16 memories of up to 512 bytes,
memories: [] for a negative example; 32 per policy, 12 KiB in total). An example says it is synthetic (the author's
statement that it holds no personal data) or cites, in sources, the 1 to 64 events of the root it was copied from,
each readable by the author: erasing any of them erases the example (§11). A part sent again keeps the ids its first
attempt staged for the same texts, so it answers its status. A change set discarded leaves its texts named by nothing;
the leader erases them 30 days later (§8.32.4).
Rules. A change set that writes a derive record writes nothing else, in any of its parts (422
INVALID_ACCESS_RECORD, details.reason: derive_with_access_records); a resync never names one
(derive_is_not_access_state: a derive record is no access state). A record at <scope>/attrs:derive is of kind
derive with a body (derive_kind) and nothing else (derive_record_shape), and a record of kind derive, or with a
body, lies at such a path (derive_path). The body is strict: an unknown key, a value of the wrong form, an id that is
no taxonomy category or group, detector, custom topic or live text of the root, a text of another role, a count or a
size past its bound are 422 DERIVATION_POLICY_INVALID with details.path (the record), details.field (the field in
the body, topics.deny[2]) and details.reason (unknown_id, limit, too_large, text_role, bad_value). A
model or entity_model the operator's CORTEX_DERIVATION_MODELS does not list (unset: the model the process's enrichment runs, none without one; a policy that names
no model runs on the process's own) is 422 DERIVATION_MODEL_NOT_ALLOWED (details.model, details.allowed). A text refused is 422
DERIVATION_TEXT_INVALID (details.reason: source_required, source_unknown, too_large, too_many, delimiter;
details.index, the text's place among the request's inline texts; details.field). A rule looser than a restriction an
ancestor sets (an allow naming what an ancestor denies, a looser mode, a higher budget), over the scope's path
ancestors and its org-chart chain alike, or than an ancestor's subject settings, is 422 DERIVATION_POLICY_WIDENS
(details.rule, details.value, details.ancestor). Below format 11 every derive record, a deletion's included, is
503 FORMAT_UPGRADE_PENDING before anything is written (details.reason: members_behind, retriable with
Retry-After: 30; arming_disabled or reserved_path_in_use, not retriable). While a restore mark holds the root, no
derive record is staged (503 ACCESS_RESTORE_PENDING). A staged derivation change set holds a scope move, as any
staged change set does. A derivation change set staged with narrowing: true is refused 422 INVALID_BODY
(details.reason: not_narrowing, details.path) unless every record only tightens (its restrictions at least as strict
as the record it replaces, its steering unchanged; a deletion never does); such a change set is admitted at a critical
disk, another is not.
The preview (§8.22.3) of a derivation change set carries a derivation section on every page; an access change
set's has no derivation key:
"derivation": {
"records": [{"path": "org:acme/app:companion/attrs:derive", "before": null,
"after_hash": "dp1:5c27a1e0b94d3f8a6e2d1c0b9a8f7e6d"}],
"effective": [{"scope": "org:acme/app:companion", "before": "dp1:none", "after": "dp1:4be1c0d29a7e3f5b6c8d0e1f2a3b4c5d",
"changes": [{"rule": "topics.deny", "added": ["credentials", "financial_account", "government_id",
"payment_card"]},
{"rule": "on_unlisted_predicate", "from": null, "to": "contest"}]}],
"narrowing": false,
"texts": [{"id": "ptx_0196f2a1c3d47e8f9a0b1c2d3e4f5a6c", "role": "instruction", "bytes": 46, "synthetic": null,
"sources": 0}],
"warnings": []}
records gives each record written with the hash of its own rules before (null where the registry holds none) and
after (null for a deletion); effective each governed scope's effective policy hash before and after, with the rules
that move (added and removed for a list, from and to for a value); narrowing whether every record only
tightens; texts the texts the records name (missing: true for one no longer there); warnings a text_missing for
each such text. The approval binds the section beside the structural hash: the preview_hash combines the change set's
structural hash (which covers each derive body) with the records, the effective hashes and narrowing, so an
ancestor's policy activated, a subject setting of a governed scope changed, or a named text erased since the preview is
409 PREVIEW_CHANGED at activation, which also checks each record again against the registry then. No derive record
enters an access change set's hash: an access change set's approval never moves with a policy. Since
derivation_rederive_v1, POST .../preview adds unsynced_impact to the section, outside what the approval binds
(the counts move with every write): scopes, the governed scopes whose effective policy moves, and events and
facts, those under them made under a recorded policy, which read unsynced once it activates (§8.7.12), for a
regate or a reextract (§8.32.7); regate_retirements_estimate, reextract_estimate_usd and estimate_basis are
null: a re-derivation's dry run counts and prices them.
8.23 Watch and notices
Capability: access_watch_v1 for GET /v1/access/watch, access_notices_v1 for the notice routes (since 0.14.0;
shared memory phase 2, DB-19).
watch lists a root's access changes from a position: its registry changes, its change sets' lifecycle, its notices and
its restore. A notice tells a person about a read of their data, or a change to their sign-in. A read that must tell
someone first commits its notice before it delivers anything, or delivers nothing (503 NOTICE_UNAVAILABLE, §16).
cause | Written when | Told | Field |
|---|---|---|---|
grant | a Detail read (at Reader) of a person's work compartment (a chain compartment, their aud:work) admitted only through a grant naming it, on a route that returns rows | the person (the self of the parent person scope) | companion, the companion record holding the grant |
break_glass | the operator key's break-glass read of a private region under CORTEX_OPERATOR_DATA_READS=deny (§8.15.3) | the region's people: its self, else its members | reason, the break-glass reason |
identity_account | a directory write changes the accounts an issuer maps a principal's sign-in through | that principal | system, the identity system, never the account; scope is the tenant |
The people told are fixed when the notice is made (a set is expanded then), at most 256 a notice: a read that tells more
writes one notice per 256. A read of the same key (scope, people told, reader and its run, cause) within the hour
after a notice's latest read tells no one again: the leader proposes nothing. Reads that reach apply together (two
leaders', or concurrent ones) merge into one notice, counted in repeats, the latest in last_at. A root stores at most
250,000 notices that are not identity_account; a read whose notice would pass the bound is refused,
NOTICE_UNAVAILABLE, details.reason: "limit". A notice is dropped when it is acknowledged, or 30 days after it was
stored, acknowledged or not. A principal's directory erasure takes the notices that tell only them. A move rebuilds a
root's notices on its target under new seqs, and the target's positions reset.
8.23.1 GET /v1/access/watch — Access changes and notices
Capability: access_watch_v1. Callers: an Owner of the root (on its roster; no capability is evaluated) or the
trusted operator.
GET /v1/access/watch?scope=org:acme&after=wp1.eyJ…&limit=500&wait_ms=10000
| Field | Type | Notes |
|---|---|---|
scope | string | Required. A root (one segment) |
after | string | A position from an earlier page, wp1. then unpadded base64url: opaque, and not a consistency token. Absent: the page starts at the current position and carries no history |
limit | integer | Items a page holds at most, 1 to 1000, default 500 |
wait_ms | integer | 0 to 30,000, default 0: hold a page that would be empty, re-reading every 100 ms, until an item arrives or the wait ends. A page with an item, a reset or has_more answers at once |
Response: 200 with WatchPage, {items, position, has_more, reset, names}:
{"items": [
{"type": "registry", "revision": 412, "changeset": "1f3a52c0-77d4-8a1e-9b2f-0c4d5e6f7a8b",
"paths": ["org:acme/team:eng", "org:acme/team:old"], "part": 0, "parts": 1, "consistency_token": "ct1.eyJ…"},
{"type": "changeset", "changeset": "1f3a52c0-77d4-8a1e-9b2f-0c4d5e6f7a8b", "proposer": "user:compiler",
"state": "activated"},
{"type": "notice", "at": "2026-11-15T09:04:11Z", "seq": 17, "scope": "org:acme/user:dev/aud:work",
"told": ["user:dev"], "reader": {"sub": "user:finn"}, "cause": "grant",
"companion": "org:acme/team:eng/attrs:unit"}],
"position": "wp1.eyJ…", "has_more": false, "reset": false,
"names": {"user:dev": "Dev Rao", "user:finn": "Finn Ola"}}
type | Fields |
|---|---|
registry | revision (the feed sequence on a cluster, the root's registry revision on a plain node), changeset (the replicated id of the change set whose activation it is; null for a legacy route's change or a first write's provision), paths (at most 1,000), part, parts, and consistency_token, which a read demands to see at least this change (§6.11). A change that wrote more than 1,000 paths is several items of one revision, part 0 to parts - 1. A cluster lists each part of an activation as its own revision, a plain node an activation as one. The tenant's orgtree:changes marker is never listed |
changeset | changeset (its replicated id, §8.22), proposer, state (staged, scheduled, activated, discarded, activation_refused), and for activation_refused its code, with paths (the first 256 that moved) and moved for CHANGESET_STALE. discarded includes the sweep's discard after 7 days |
assertion_broken | changeset, policy, case (from 0): a case an activation broke without being blocked, one item per case, right after that activation's changeset item |
notice | at, seq, scope, told, reader {sub, act?, app?, run?}, cause with its companion, reason or system, and repeats and last_at once a read merged into it |
restore | at, restored_from (the incarnation the copy was taken from), restore_state (pending or cleared), pending_sources (the access sources still to acknowledge, in the mark's order): the root's restore mark, each acknowledgement that counted for the root (a listed source's first, the operator's for the root or for every root, an Owner's for a root whose mark lists no source) and the clearing, which is the last: each once, at apply's time and in apply's order, before the page's other items, nothing after the clearing; every replica lists the same items |
at is on a notice, a restore, and a plain node's registry and changeset items; a cluster's feed row holds no time,
and an assertion_broken item has none.
- Where changes come from. On a shard that replicates its registry they are the replicated feed's: each feed row of
the root that carries a registry part or a first write's provision is a
registrychange, itsrevisionthe row's feed sequence, so every replica serves the same items from the same position; a page reads at most 10,000 feed rows, the root's or not, then answershas_morewith a position past them. On a plain node they are its registry's, each change appended to a node-local log kept 7 days, and its change-set events come from the change sets' headers, listed among the log's changes by time. A header keeps each kind's last event, so a plain node's reader that starts after an approval was cleared does not list it. - Positions and resets. A position is valid 7 days from when it was issued; every page issues a new one. A position
older than that, or of another incarnation or epoch (a restore, a move), answers
reset: true: the page first lists the root's restore as it stands (while the mark holds the root, or within 7 days of its clearing), then the root's stored notices the caller may see, oldest first,limitat a time withhas_moreand a position that continues the listing, whose later pages sayreset: false; then the watch continues from the position the reset began at. Changes made before the reset are not listed: read the registry again (GET /v1/access/records). - Privacy. An item about a private scope goes only to the region's direct members and the trusted operator, one
about a deleted scope only to the trusted operator and the members its tombstone keeps, and a notice only to the
trusted operator and the principals its
toldnames;assertion_brokenandrestoreitems go to every caller. Privacy is judged by the registry as the page is served (on a cluster, brought to the feed's head first). Items a caller may not see are left out, not redacted, and the position still advances past them: an Owner of the root who is not a direct member of a private region misses its items, and a consumer that needs every item reads with the operator key. - Bounds. A page holds at most
limititems and 1 MiB encoded, and ends before the feed row or event whose items would pass either; a row's items are never split, so the first row of a page is listed whole. names(directory_v1): thedisplay_nameof each principal the page names (a notice'stoldand reader, a change set's proposer, a restore's pending sources) that has a directory entry, for a caller who reads names in the tenant, within the page's 1 MiB;{}when none is joined.- Served while a restore mark holds the root. On a cluster the ingress routes it by
?scope=to the root's leader.
Errors (§16): 400 INVALID_QUERY (details.field: scope not a root, after not a position, limit or wait_ms out
of range); 403 POLICY_DENIED; 503 WAL_UNAVAILABLE (retriable: the shard's state could not be read).
8.23.2 GET /v1/access/notices?scope=<root>&mine=true — A principal's own notices
Capability: access_notices_v1. Callers: a verified token whose billing tenant is the root's (the root is
org:<billing tenant>), for its own notices; the trusted operator's mine=true lists the notices that tell the actor it
names (X-Cortex-Actor), and it reads every notice through watch.
| Field | Type | Notes |
|---|---|---|
scope | string | Required. A root (one segment) |
mine | boolean | Required, exactly true: the only listing in this version |
limit | integer | 1 to 1000, default 100 |
cursor | string | The previous page's next_cursor: n1. and the last seq it listed |
Response: 200 with NoticePage, {items, next_cursor?, has_more, names}: the root's stored notices whose told
names the caller, oldest first. Each item is the notice item of watch without type and told (NoticeItem);
names joins each notice's reader. Pages hold at most limit items and 1 MiB; next_cursor is present while
has_more.
{"items": [{"at": "2026-11-15T09:04:11Z", "seq": 17, "scope": "org:acme/user:dev/aud:work",
"reader": {"sub": "user:finn"}, "cause": "grant", "companion": "org:acme/team:eng/attrs:unit",
"repeats": 2, "last_at": "2026-11-15T09:31:40Z"}],
"has_more": false, "names": {"user:finn": "Finn Ola"}}
Errors (§16): 400 INVALID_QUERY (scope not a root, mine absent or not true, limit out of range); 403
POLICY_DENIED; 422 INVALID_CURSOR; 503 WAL_UNAVAILABLE (retriable: the shard's state could not be read), ACCESS_RESTORE_PENDING
(not retriable: the route is not served while a restore mark holds the root).
8.23.3 POST /v1/access/notices/ack — Acknowledge notices
Capability: access_notices_v1. Callers: the trusted operator, for any notice; a verified token whose billing tenant
is the root's, for the notices whose told names it.
{"scope": "org:acme", "seqs": [17], "through": "wp1.eyJ…"}
| Field | Type | Notes |
|---|---|---|
scope | string | Required. The root (one segment) |
seqs | array | At most 4,096 notice seqs. A seq of a notice that does not tell the caller refuses the whole request, 403 POLICY_DENIED, dropping nothing; one of a notice already gone counts nothing |
through | string | A watch position: every notice at or before it that the caller may acknowledge, up to the position's notice sequence, or, inside a reset's listing, up to the last notice listed (every notice for the trusted operator) |
A request needs a non-empty seqs, a through, or both. The leader drops the notices named (DropNotices, at most 4,096 an entry). A
notice is one record however many principals it tells: acknowledging it drops it for all of them. A through of another
incarnation or epoch acknowledges nothing, the seqs included, and answers {"acknowledged": 0, "reset": true}; the
caller's next watch page is a reset, which lists the unacknowledged notices again. Repeating an acknowledgement changes
nothing. The body is read as JSON whatever its Content-Type.
Response: 200 {"acknowledged": <the notices dropped>}, with reset: true only for a through of another
incarnation or epoch.
Errors (§16), a proposal's failure answered as on every access route: 403 POLICY_DENIED; 413 WAL_TOO_LARGE (not
retriable); 422 INVALID_BODY (a body that does not parse or names an unknown field, scope not a root, more than
4,096 seqs, neither seqs nor through, through not a position); 503 DISK_FULL (Retry-After: 30, details.node,
details.retry_after_seconds), SCOPE_MOVING (details.roots, details.refusal), NOT_LEADER, WAL_UNAVAILABLE,
WAL_OUTCOME_UNKNOWN (retriable: an acknowledgement of more than 4,096 notices proposes several entries, the ones before
a failure stay dropped, and sending it again is safe), FORMAT_UPGRADE_PENDING (details.reason; retriable with
Retry-After: 30 only for members_behind), ACCESS_RESTORE_PENDING (not retriable).
8.24 Restores (/v1/access/records, /v1/access/restore/ack, /v1/admin/access/restore)
Capability access_changesets_v1 (shared memory phase 2, DB-26; docs/shared_memory/IDENTITY_AND_API_CONTRACT.md
§5.3.8, §5.3.9, §5.6.2).
A cold-backup copy whose access state may be older than its sources' is prepared with
cortexdb restore-check --access-state lost, the default for a copy that shows format-8 state
(scripts/cold_backup.py restore passes --access-state; --access-state unchanged serves a copy the operator knows
lost nothing as it was). It puts a restore mark on the copy's shard: every root the copy held is pending until
each access source the mark lists for it has acknowledged, for itself, that it re-sent the root's access state, or until
the trusted operator acknowledges the root for all of them. The mark lists, per root, the access sources the root's
companion listed in the copy (<root>/attrs:unit, access_sources, at most 16 principals: typically the compiler, each
connector that owns a source, the SCIM client and a mirror); a root whose companion listed none has its Owners as its one
source, and any one of them acknowledges it. A root the copy did not hold, or one first written or moved in after the
mark, is never pending. Each acknowledgement is an AckRestore through the shard log, so every replica holds it and a
failover keeps it; none is refused at a critical disk. A pending root cannot move (MOVE_RESTORE_PENDING).
While a root is pending, the node that serves it (a plain node's router, a data owner's edge) serves only what repairs it:
| Served on a pending root | To whom |
|---|---|
GET /v1/access/records, POST /v1/access/restore/ack, POST /v1/admin/access/restore | as each route below says |
GET /v1/access/watch, the directory routes, /scim/v2/* (its Group writes refuse themselves, with Retry-After: 30, which the provider retries, §8.28) | as outside a restore |
The change-set routes (/v1/access/changes*) | resync change sets only |
POST /v1/access/rehome, PUT and GET /v1/access/watermarks, POST /v1/access/accounts/resolve (§8.25) | the root's access sources, its Owners and the trusted operator |
POST /v1/forget, /v1/forget/preview, /v1/erasures, /v1/erasures/preview by ids or keys; GET /v1/erasures/{id}, /verify, /receipt | the trusted operator's deletion replay, counts only (a preview by query stays refused) |
POST /v1/erasures/person, POST /v1/erasures/tenant (the dry run included), POST /v1/erasures/{id}/cancel (with or without ?scope=) | the trusted operator; anyone else 503 ACCESS_RESTORE_PENDING (a cancel once its caller is authorized on the job) |
GET /v1/auth/whoami, POST /v1/auth/revoke, GET /v1/policy/effective, GET /v1/policy/deployment, GET /v1/schemas, GET /v1/schemas/{name} | as outside a restore: they hold none of the root's state |
Every other read and write that names the root answers:
503
{"error_code": "ACCESS_RESTORE_PENDING", "retriable": false,
"message": "scope root org:acme was restored from a backup and serves again once its access sources have re-sent its access state and acknowledged (or the trusted operator acknowledges it): hold the request and send it again then",
"details": {"root": "org:acme", "pending_sources": ["service:scim-okta"],
"restored_at": "2026-11-02T09:58:00Z", "owner_acknowledges": false,
"operator_override": "POST /v1/admin/access/restore"},
"request_id": "req_0197f0c1"}
It carries no Retry-After: a client holds the request and sends it again once a restore item of
GET /v1/access/watch says cleared, or a probe answers 200. owner_acknowledges is true for a root whose mark lists
no source. On a plain node a by-id request that names no ?scope= is refused while any root of the mark is pending; a
mark that does not read answers 503 WAL_UNAVAILABLE, retriable. Once the root serves again, a read whose
consistency.at_least was issued before the restore answers consistency_reset: true with access_restored_at (§6.11).
The repair. Each access source replays the deletions made since the backup (the trusted operator's forgets by id or
key, and erasures); on a plain node, re-sends the revocations made since; re-sends the directory; lists the root's
records (§8.24.1; a connector its own subtree, with prefix), compares them with its own state, and stages the
differences as resync change sets, the last with resync: {"last": true}, which acknowledges for it. Between them it
resolves its accounts, rehomes what changed and reports its watermark (§8.25). A source that found nothing to change
acknowledges with §8.24.2.
8.24.1 GET /v1/access/records?root=<tenant root>
Capability: an explicit Owner of the root's record (the role by any path the registry admits, a set included), one of
the root's access sources, or the trusted operator (the static key or an auth-disabled server). An operator-plane route:
CORTEX_OPERATOR_DATA_READS=deny asks no break-glass header for it (§8.15.3).
Every registry record and tombstone of a tenant root, in path order: what an access source diffs against its own state
after a restore, and the roster check that GET /v1/scopes/list cannot serve past 1,000 records. Served while the root's
restore mark holds; on a cluster the ingress routes it by root.
| Parameter | Type | Notes |
|---|---|---|
root | string | Required. A tenant root (its first CORTEX_TENANT_DEPTH segments); a deeper scope is 400 INVALID_QUERY |
after | string | The previous page's next_after; absent for the first page |
limit | int | 1 to 1000, default 500; outside it 422 INVALID_QUERY |
prefix | string | Only the records and tombstones at or under this scope, so a connector lists its own source's subtree. A scope at or under root, whatever its depth; any other is 400 INVALID_QUERY |
at_least | string | A consistency token (§6.11): checked and waited for at root before the caller is authorized; past the wait 408 WAIT_TIMEOUT, a token that does not decode, names another root or was never committed 422 CONSISTENCY_TOKEN_INVALID |
The route takes no other parameter (400 INVALID_QUERY). Every page, demanded or not, ends with consistency_token
(and derived_through, and consistency_reset with access_restored_at for a demanded token of another incarnation or
from before a restore) after its own fields.
GET /v1/access/records?root=org:acme&prefix=org:acme/source:slack&limit=2
200
{"items": [
{"path": "org:acme/source:slack", "seq": 17, "stamp": "5f0c9a1be2d34c7f8a90b1c2d3e4f501",
"kind": "source", "private": false, "tombstone": false,
"record": {"path": "org:acme/source:slack", "billing_tenant": "acme",
"members": [{"actor": "service:slack-acme", "role": "owner"}], ...}},
{"path": "org:acme/source:slack/container:G01", "seq": 31, "stamp": "a1b2c3d4e5f60718293a4b5c6d7e8f90",
"kind": "container", "private": true, "tombstone": false, "withheld": true}],
"next_after": "MTIfb3JnOmFjbWUvc291cmNlOnNsYWNrL2NvbnRhaW5lcjpHMDE",
"has_more": true, "revision": 12, "revision_changed": false,
"consistency_token": "ct1.eyJyIjoib3JnOmFjbWUiLCJpIjoi..."}
| Field | Type | Notes |
|---|---|---|
items[].path | string | The record's or tombstone's path |
items[].seq | int | Its sequence in the registry index (reg/) on a cluster data node, 0 where the index holds none; absent on a plain node |
items[].stamp | string | The content stamp: the first 16 bytes of the BLAKE3 hash of the stored JSON, 32 lowercase hex characters; what a change set's staleness check compares |
items[].kind | string | The record's tree.kind; absent for a record without one and for a tombstone |
items[].private | bool | The record's tree.private; false for a tombstone |
items[].tombstone | bool | The item is a tombstone |
items[].record | object | The stored record; for a tombstone, the stored tombstone ({billing_tenant?, former_members?, deleted_at, deleting?}); absent when withheld |
items[].withheld | bool | Present, true, only on a private record whose content this caller may not read: only the trusted operator and the principals the record's roster names directly read it, so another access source gets it withheld too |
next_after | string | Present only with has_more: the next page's after, opaque |
has_more | bool | More items follow: past limit, or past the page's 1 MiB (a page holds one item at least) |
revision | int | The root's authorization revision on this node now |
revision_changed | bool | revision is not the first page's: the registry moved since the listing began, so a diff runs again from the start, or compares stamps. Since 0.15.0 also true when a derivation policy's record (kind derive, §8.22.7) was edited since the first page, which moves no authorization revision: the cursor carries a digest of the root's derivation policies (a cursor an older binary issued compares the revision only) |
consistency_token | string | On every page: a token at root naming this node's indexed watermark, as a read's does (§6.11); derived_through follows it once this node's enrichment has finished a pass |
Errors: 400 INVALID_QUERY (no root, not a tenant root, a prefix not under it, a limit that is not an integer, an
unknown parameter); 403 POLICY_DENIED; 408 WAIT_TIMEOUT (retriable); 422 INVALID_QUERY (limit outside 1 to
1000); 422 INVALID_CURSOR (after is not a cursor this route issued); 422 CONSISTENCY_TOKEN_INVALID; 503 WAL_UNAVAILABLE (retriable: the shard's state could not be read for a token). None but WAIT_TIMEOUT and
WAL_UNAVAILABLE is retriable.
8.24.2 POST /v1/access/restore/ack
Capability: an access source the mark lists for the root, for itself; for a root the mark lists with no source, an
Owner of the root's record. Anyone else gets 403 POLICY_DENIED, details.reason: "not_an_access_source". The trusted
operator is decided here as any caller, by its actor; it acknowledges a root through §8.24.3.
POST /v1/access/restore/ack
{"scope": "org:acme"}
200
{"scope": "org:acme", "source": "service:slack-acme",
"acknowledged_at": "2026-11-02T10:05:00Z",
"pending_sources": ["service:scim-okta"], "cleared": false}
| Field | Type | Notes |
|---|---|---|
scope | string | Required: the root, or a scope under it (its first segment names the root). No other field is accepted |
The response names the root (scope), the caller (source), when the shard stored the caller's acknowledgement (acknowledged_at, apply's clock; a repeat answers the first's), the sources the
mark still waits on, in its order (pending_sources: empty for a root that lists none, and once the root has cleared),
and whether the root serves again (cleared). One source's acknowledgement never clears another's. Activating the
source's last resync change set (resync: {"last": true}) acknowledges for it the same way, so this route is for a
source that found nothing to change. Repeating it answers the same, its first acknowledgement's time included: nothing is
proposed for a caller whose acknowledgement the shard holds under the mark, pending or cleared. Two known limits: two
first acknowledgements of one source sent at the same moment can still store the later's time, and a source that
acknowledged here and then activates its last resync change set while the root is pending stores that activation's
time. The route answers once the acknowledgement has applied on this
node; on a cluster the ingress routes it by the root of scope, to its leader.
Errors: 403 POLICY_DENIED (above); 409 RESTORE_NOT_PENDING (no restore mark lists the root: the shard holds none, or
the root was first written, or moved in, after it); 422 INVALID_BODY (scope missing or not a scope path, another
field); 503 WAL_UNAVAILABLE (the mark, or the stored acknowledgement, did not read; retriable); the proposal's 503 NOT_LEADER, WAL_UNAVAILABLE,
WAL_OUTCOME_UNKNOWN and, on a cluster data node, SCOPE_MOVING while the root moves (details.roots,
details.refusal) (all retriable; after WAL_OUTCOME_UNKNOWN send it again), any other apply refusal under its own code
and flag, and 503 FORMAT_UPGRADE_PENDING (details.reason, format, node, paths, count; retriable with
Retry-After: 30 only for members_behind); 500 INTERNAL_ERROR for a shard response the route does not expect.
8.24.3 POST /v1/admin/access/restore
Capability: the trusted operator only (the static key or an auth-disabled server).
The operator's override: it acknowledges a root for every access source at once, for a source that cannot re-send its
access state (a SCIM client whose provider re-pushes on its own schedule) or a root whose Owners do not acknowledge. With
?scope= it acknowledges that root (the scope's first segment), even one that has cleared already; without it, every
root of the shard's mark, which a plain node holding many hosted roots needs, and the response's scope is null. A
cluster ingress refuses a request without scope (422 SCOPE_REQUIRED), so on a cluster the operator sends it to each
shard's leader:
cortexdb admin node call --id <leader> --bypass-fence --body ack.json POST /v1/admin/access/restore
POST /v1/admin/access/restore?scope=org:acme
{"acknowledge": true, "reason": "OPS-1142: the SCIM provider re-pushes nightly"}
200
{"scope": "org:acme", "restored_from": "0192f3aa-0000-7000-8000-000000000001",
"acknowledged_at": "2026-11-02T10:06:00Z", "pending_sources": []}
| Field | Type | Notes |
|---|---|---|
acknowledge | bool | Required, true |
reason | string | Required, 1 to 256 bytes, not blank. It goes to the decision audit only (a line with code ACCESS_RESTORE_ACKNOWLEDGED under the tracing target cortex_api::decision), never into replicated state |
restored_from is the incarnation the copy was restored from (the mark's predecessor, else the restored shard's own
incarnation); acknowledged_at is when this node answered; pending_sources is empty, since the operator's
acknowledgement clears the root for every source. The route answers once the acknowledgement has applied on this node.
Errors: 400 INVALID_QUERY (a parameter other than scope); 403 POLICY_DENIED (not the trusted operator); 409 RESTORE_NOT_PENDING (no mark lists the root; without scope, the shard holds none); 422 INVALID_BODY (acknowledge
not true, reason blank or longer than 256 bytes, a missing or unknown field); 422 INVALID_SCOPE_GRAMMAR (scope is
not a scope path); 503 WAL_UNAVAILABLE (the mark did not read, with scope or without; retriable), and the other
503 and 500 as in §8.24.2.
8.25 Source containers (/v1/access/rehome, /v1/access/watermarks, /v1/access/accounts/resolve)
Capability source_containers_v1 (shared memory phase 3b, DB-22; docs/SHARED_MEMORY_ARCHITECTURE.md §8,
docs/shared_memory/IDENTITY_AND_API_CONTRACT.md §5.3.12 to §5.3.14).
A source's connector writes each permission unit of its source into a container,
<tenant>/source:<system>/container:<key>, and each direct or group conversation into a private group,
<tenant>/group:dm-<key>, through the change-set routes; it syncs through the three routes below besides. The two writes
are shard apply format 9 (RehomeEvents, PutWatermark): the capability says the binary can arm a shard, never that it
has, and until the shard is armed they answer 503 FORMAT_UPGRADE_PENDING. Neither write is refused at a critical disk.
On a cluster the ingress routes each route by its scope's root.
During a restore (§8.24) the restore gate serves all three on a pending root, since a connector's resync needs them
before it acknowledges; they then admit only the root's access sources, its Owners and the trusted operator, and anyone
else answers 503 ACCESS_RESTORE_PENDING (not retriable). A mark that does not read is 503 WAL_UNAVAILABLE
(retriable). Each route answers 503 NOT_AVAILABLE (not retriable) on a server that serves no shard.
8.25.1 POST /v1/access/rehome
Capability: the Owner role and policy.administer.scope at scope and at every moved event's home now, or the
trusted operator. The caller is authorized at scope before any named id is read, and at every live event's home once
the ids are, so a caller who is no Owner of scope gets the one 403 POLICY_DENIED whatever the ids name, and only a
caller authorized for the whole request is told that an id lies under another root (event_outside_root).
An item's sharing changed: its live events move to scope, another scope of the same root, without erasing anything.
Their ids, idempotency claims and provenance stay, and so do the derived rows homed with them, which move with them when
every source they cite moved (facts, summaries and other provenance-derived documents; the episodes, beliefs and concepts
all of whose evidence moved); a derived row with a source elsewhere stays at its old home.
POST /v1/access/rehome
{"scope": "org:acme/source:slack/container:C024BE91L",
"event_ids": ["evt_0192f0c1-7a2b-7c3d-8e4f-5a6b7c8d9e0f", "evt_0192f0c1-7a2b-7c3d-8e4f-5a6b7c8d9e10"]}
200
{"moved": 1, "unchanged": 0,
"skipped": [{"event_id": "evt_0192f0c1-7a2b-7c3d-8e4f-5a6b7c8d9e10", "reason": "sealed"}]}
| Field | Type | Notes |
|---|---|---|
scope | string | Required: the events' new home, under their root |
event_ids | array | Required: 1 to 1,024 distinct event ids, each of an event under the root of scope. No other field is accepted |
moved counts the events moved, unchanged those already at scope, and skipped, in event id order, names each event
not moved: sealed (its row lives in a segment), expired (a keep_learned retention detached it) and too_large (its
row and chunk vectors alone pass the 64 MiB one entry moves), which the connector erases and captures again at the new
home within one sync interval; absent for an id with no live row here
(erased, redacted or never captured). The route proposes RehomeEvents in entries of at most 1,024 events and 64 MiB of
what apply counts, each row's stored bytes and its chunk vectors (on a cluster data node each chunk's text and binary16
vector, several times the row's own); a row that alone passes 64 MiB is not proposed and is named in skipped,
too_large; an entry apply still refuses for its size (vectors written meanwhile) is proposed again as two halves. On a clustered owner each entry carries the
registry floor and the auth paths its authorization read, so a registry change in between answers 503 REGISTRY_STALE.
A request whose ids name no live row proposes nothing, and an id the shard found gone since the route read it is read
again and named in skipped. The route answers once this node's erase tail has moved the events' views, so a read that
follows finds them at their new home.
Errors: 422 INVALID_BODY (details.field scope or event_ids; details.max_items for the count; details.reason
repeated for an id named twice, event_outside_root for an event under another root, to a caller authorized at scope and at every moved event's
home); 403 POLICY_DENIED; 503 FORMAT_UPGRADE_PENDING (details.reason members_behind, retriable with Retry-After: 30, or arming_disabled and
reserved_path_in_use, not retriable; details.format, details.node); 503 REGISTRY_STALE, SCOPE_MOVING (the root's fence on a cluster data node, as during a move: details.roots,
details.refusal, never SCOPE_NOT_OWNED or STALE_EPOCH themselves), REHOME_TAIL_PENDING (the shard moved the
events and this node's views have not moved yet: a retry answers them unchanged once they have), NOT_LEADER,
WAL_UNAVAILABLE and WAL_OUTCOME_UNKNOWN, all retriable; a registry outage during the authorization answers as for
registry writes (503 SCOPE_STORAGE_UNAVAILABLE); 503 ACCESS_RESTORE_PENDING, WAL_UNAVAILABLE and NOT_AVAILABLE
(above); 500 INTERNAL_ERROR (the log did not read for the plan, retriable; or an apply refusal the route does not expect,
named in details.refusal, not retriable).
8.25.2 PUT and GET /v1/access/watermarks
Capability: PUT: the Owner role and policy.administer.scope at the source record's path, or the trusted operator.
GET: at least Reader at scope (the tenant-root fence and the roster; no capability), or the trusted operator.
A source's watermark is its last completed sync ("mirrored through"), with the count of containers the sync left out at
its containers_per_source limit (GET /v1/access/limits). A connector puts one after each completed sync whose value
changed, never after a failed one.
PUT /v1/access/watermarks
{"scope": "org:acme/source:slack", "at": "2026-10-25T12:00:00Z", "left_out": 12}
200
{"changed": true,
"watermark": {"source": "org:acme/source:slack", "at": "2026-10-25T12:00:00Z",
"left_out": 12, "stored_at": "2026-10-25T12:00:01Z"}}
| Field | Type | Notes |
|---|---|---|
scope | string | Required: a source record's path, <tenant>/source:<system> (its last segment a source: one), else 422 INVALID_BODY, details.reason: "not_a_source" |
at | string | Required: the completed sync's time, RFC 3339 |
through | string | A mirror's own revision, at most 256 bytes; a connector leaves it out |
left_out | int | The containers this sync left out at containers_per_source; 0 or absent when it left none out (0 is stored as absent) |
PutWatermark stores the earlier of at and the shard's clock, so a skewed clock cannot freeze a watermark ahead of its
source, and a stored time at or after that time stores nothing (changed: false). watermark is what the shard holds for
the source after the put (on changed: false, the one already stored): source, at, through and left_out when
set, and stored_at, the shard's clock when it was stored. No feed row and no registry record is written.
GET /v1/access/watermarks?scope=<scope> answers {"watermarks": [...]}, each as watermark above: every watermark of
the root when scope is the root (its first segment), else those of the sources at or under scope and of the source
scope lies under, in the order of their stored keys (a hash of each source's path), not by path. It is read on this
node.
A read whose read set holds a source or a scope under it (one of its containers) reports the source's watermark in its
coverage.watermarks (recall_coverage_v1), a nonzero left_out as the gap container_cap, and a watermark older than
CORTEX_SOURCE_WATERMARK_MAX_AGE_S (86,400 s when unset; honoured from 60 s to 30 days) as the gap watermark.
Errors: PUT: 422 INVALID_BODY (not_a_source; through longer than 256 bytes, details.field: "through"; a missing
scope or at, an unknown field); 403 POLICY_DENIED; the 503 codes of §8.25.1 but REGISTRY_STALE and
REHOME_TAIL_PENDING (a stored watermark that does not read back is WAL_UNAVAILABLE); 500 INTERNAL_ERROR for an apply
refusal the route does not expect (details.refusal). GET: 400 INVALID_QUERY (scope missing or not a scope path,
details.field: "scope"); 403 POLICY_DENIED; 503 ACCESS_RESTORE_PENDING, WAL_UNAVAILABLE (the mark),
NOT_AVAILABLE; 500 INTERNAL_ERROR (the watermarks did not read; retriable).
8.25.3 POST /v1/access/accounts/resolve
Capability: one of the root's access sources (its companion's access_sources), an Owner of the root's record, or
the trusted operator: an account is personal data, which a non-Owner never reads.
Fail-closed identity: each account resolves to the principal whose directory entry (directory_v1) in the tenant root
lists it under the same system, matched exactly, or to null, which grants nothing: the connector gives such an account
no roster or set entry, and counts it.
POST /v1/access/accounts/resolve
{"scope": "org:acme",
"accounts": [{"system": "slack:T024BE7LD", "account": "U012AB3CD"},
{"system": "slack:T024BE7LD", "account": "U0999ZZZZ"}]}
200
{"accounts": [{"system": "slack:T024BE7LD", "account": "U012AB3CD", "id": "user:p_7f3a"},
{"system": "slack:T024BE7LD", "account": "U0999ZZZZ", "id": null}],
"unmapped": 1}
| Field | Type | Notes |
|---|---|---|
scope | string | Required: the tenant root whose directory resolves them |
accounts | array | Required: 1 to 1,000 {system, account}, system 1 to 128 bytes (slack:<team id>, microsoft:<tenant id>, discord, google:<domain>, atlassian, notion), account 1 to 256 bytes. No other field is accepted |
The answer keeps the order sent, and unmapped counts the nulls. It is read on this node.
Errors: 422 INVALID_BODY (scope not a tenant root; accounts empty or over 1,000, details.max_items; a system or
account outside its bounds; an unknown field); 403 POLICY_DENIED; 503 ACCESS_RESTORE_PENDING, WAL_UNAVAILABLE (the
mark), NOT_AVAILABLE; 500 INTERNAL_ERROR (the directory did not read; retriable).
8.26 Applications (/v1/apps/{id})
Capability: app_records_v1 (shared memory phase 2, DB-18). PUT: an Owner of the tenant root holding
policy.administer.scope there, or the trusted operator (the static key or an auth-disabled server). GET: the same,
and the application's own principal.
An application record registers one application in one tenant. It is two registry records, written together as one
change at shard apply format 8: the record <root>/app:<id> (kind app, parent the tenant root: its roster, by
default the application's own principal service:<id> as Owner; its home template; the memory kinds it writes) and
its companion <root>/app:<id>/attrs:unit (its mounts and its limits). The record admits nothing: an apps entry,
which a change set writes, admits an application at a scope, every mount must already be admitted when the record is
written, and every read checks the mounts again (mounts: "default", capability recall_mounts_v1). A tenant holds at
most CORTEX_LIMIT_APPS application records (limits.apps in a data node's [engine]; default 8), the setting apps
on GET /v1/access/limits. Both routes are operator plane (class O, §8.15.3): the operator key is served in every
CORTEX_OPERATOR_DATA_READS mode, except that under the tenant's effective mode deny its PUT that registers the
record, or that names a service: principal the stored roster does not hold (the default roster names
service:<id>), is an in-band path and needs X-Cortex-Break-Glass (403 BREAK_GLASS_REQUIRED without it). While the tenant's root is pending a restore they answer 503 ACCESS_RESTORE_PENDING. On a
cluster the ingress routes both by the root.
8.26.1 PUT /v1/apps/{id}?scope=<tenant root>
{id} is the application id, ^[a-z0-9][a-z0-9_-]{0,63}$; scope is the tenant root, its first
CORTEX_TENANT_DEPTH segments exactly.
PUT /v1/apps/support?scope=org:acme
{
"kinds": ["note", "decision"],
"mounts": [{"prefix": "org:acme/source:slack"}],
"limits": {"requests_per_minute": 600, "tokens_per_day": 2000000}
}
| Field | Type | Notes |
|---|---|---|
members | array | Roster entries, each {"actor": <principal>} or {"set": <path>} with role (and until, reason_ref, when as a version-2 roster entry carries them): 1 to 256, each principal or set once, no principal whose id holds @, and a principal at owner. Left out: [{"actor": "service:<id>", "role": "owner"}]. |
home | string | <root>/app:<id>/user:{person}, the only template. Stored whether sent or not. |
kinds | array | The memory kinds the application writes: at most 32 as sent, each 1 to 64 bytes with no control character. A repeat is dropped. |
mounts | array | {"scope": <path>} (that scope) or {"prefix": <path>} (the non-private containers under it): at most 40 once repeats are dropped, each in the tenant, outside every private region, and admitted for the application now. |
limits | object | {requests_per_minute?, tokens_per_day?}. requests_per_minute limits the application's chains in the tenant, one request a call, 429 SUBTREE_RATE_LIMITED with details.app past it; tokens_per_day is stored and served. |
display_name | string | Refused, 422 INVALID_BODY with details.field: "display_name" and details.name_entry, the entry's id <root>/app:<id>, whatever its value: an application's name is the name entry of its record's path in the directory (§8.27.1), never the record. |
The PUT replaces both records. kinds, mounts and limits left out are cleared, and members left out is the
default roster; the record's apps admissions, its policies and created_at, and the companion's other fields are
kept. The body refuses unknown fields, and the route answers every body that does not parse, malformed JSON and a
missing JSON Content-Type included, with 422 INVALID_BODY, details.field: "body".
Response: 200, the record and its companion as stored, each mount's admission evaluated now, then the
consistency fields (§6.11):
{
"id": "support",
"path": "org:acme/app:support",
"members": [{"actor": "service:support", "role": "owner"}],
"home": "org:acme/app:support/user:{person}",
"kinds": ["note", "decision"],
"mounts": [{"prefix": "org:acme/source:slack", "admitted": true}],
"limits": {"requests_per_minute": 600, "tokens_per_day": 2000000},
"consistency_token": "ct1.AZLzqgAAcACAAAAAAAAAAQMpBwAAAAAAKQ"
}
Since 0.14.0 a 200 carries consistency_token with no ?consistency= flag (capability consistency_tokens_v1):
a read that demands it with consistency.at_least sees at least this record. The token is at the tenant root, after
the record's own fields, and names this node's indexed watermark; derived_through joins it once this node's
enrichment has finished a pass. A node that cannot read its shard's state to issue a token answers the 200 without
them; the record is written all the same.
To name the application, write the name entry of its path:
PUT /v1/directory/org:acme%2Fapp:support?scope=org:acme
{"display_name": "Support desk"}
Errors:
| Status | Code | When |
|---|---|---|
| 400 | INVALID_QUERY | scope is missing, does not parse or is not a tenant root (details.field: "scope") |
| 403 | POLICY_DENIED | No policy.administer.scope at the root, not an Owner of the registered root by its roster, or a credential of another billing tenant |
| 403 | BREAK_GLASS_REQUIRED | The operator key under the tenant's effective mode deny, registering the record or naming a service: principal the stored roster does not hold, without X-Cortex-Break-Glass (details.mode: "deny", details.class: "in_band", details.route: "/v1/apps/{id}") |
| 409 | APP_LIMIT_REACHED | A new record past the tenant's apps setting: details.limit: "apps", details.value, details.used, details.setting: "CORTEX_LIMIT_APPS", details.scope |
| 409 | ACCESS_ASSERTION_FAILED | The change widens access past one of the tenant's assertions (details.failed) |
| 409 | SCOPE_STATE_CHANGED | A running forget or erasure held the record's path and did not release it in time |
| 409 | REGISTRY_NOT_REPLICATED | A clustered owner whose shard was bound before RF3 T10, which takes no version-2 entry |
| 413 | WAL_TOO_LARGE | On a clustered owner, a change that encodes above 4 MiB |
| 422 | INVALID_BODY | The body does not parse (details.field: "body"), or it sends display_name (details.field: "display_name", details.name_entry) |
| 422 | INVALID_MOUNTS | details.mount, details.reason: not_admitted, private, foreign or too_many |
| 422 | INVALID_ACCESS_RECORD | details.path, details.reason: app_id, home, kinds, members, duplicate_member, principal_is_address, owner_required, when_purpose (a when: {purpose} id outside [a-z0-9_-]{1,64}), or kind (a record of another kind holds the path) |
| 500 | SCOPE_STORAGE_MISCONFIGURED | The registry's storage cannot take the change as it is configured (details.reason, §8.8); not retriable (since 0.14.0; it was 503 SCOPE_STORAGE_UNAVAILABLE) |
| 503 | FORMAT_UPGRADE_PENDING | The shard is not armed for apply format 8; details.reason alone: members_behind, retriable with Retry-After: 30, or arming_disabled for any other reason (reserved_path_in_use included), not retriable |
| 503 | SCOPE_MOVING, REGISTRY_STALE, NOT_LEADER, WAL_UNAVAILABLE, WAL_OUTCOME_UNKNOWN | On a clustered owner, a change the shard did not take, with the shard's own code, all retriable: SCOPE_MOVING (details.roots, details.refusal SCOPE_NOT_OWNED or STALE_EPOCH; nothing was written), REGISTRY_STALE (the registry kept changing under every attempt), and the log's own; after WAL_OUTCOME_UNKNOWN the proposal may have committed, so read the record before writing it again |
| 503 | SCOPE_STORAGE_UNAVAILABLE | The registry's storage did not answer; nothing was committed |
| 503 | ACCESS_RESTORE_PENDING | The tenant's root is pending a restore (details.root, details.pending_sources, details.restored_at); no Retry-After |
Only FORMAT_UPGRADE_PENDING for members_behind, a clustered owner's shard codes (SCOPE_MOVING,
REGISTRY_STALE, NOT_LEADER, WAL_UNAVAILABLE, WAL_OUTCOME_UNKNOWN) and, since 0.14.0, SCOPE_STATE_CHANGED and
SCOPE_STORAGE_UNAVAILABLE set retriable: true; a change whose outcome is unknown answers WAL_OUTCOME_UNKNOWN on a
single node too (it was SCOPE_MUTATION_UNKNOWN before 0.14.0): read the record before writing it again. A clustered owner's other
apply refusals answer 503 with their own code and flag (BIND_MISMATCH and REGISTRY_ENTRIES_MALFORMED:
retriable: false).
8.26.2 GET /v1/apps/{id}?scope=<tenant root>
The record as PUT answers it, without consistency fields (?at_least= is ignored). admitted is false for a
mount that no apps entry admits the application at now, or that lies in a private region; a read with
mounts: "default" leaves such a mount out. Callers: the trusted operator; an Owner of the tenant root holding
policy.administer.scope there; and the application's own principal service:<id> in the tenant its credential
names. Errors: 400 INVALID_QUERY, 403 POLICY_DENIED, 404 NOT_FOUND (no application record has this id in this
tenant), 503 ACCESS_RESTORE_PENDING.
8.27 The directory (/v1/directory)
Capability: directory_v1 (shared memory phase 2, DB-29). Callers: any principal of the tenant, a token whose
billing tenant is the tenant's, and the trusted operator; who writes what is below.
The directory holds each tenant's principals, with their names, emails and source accounts, and the names of its
scopes and sets. A tenant is a tenant root, its first CORTEX_TENANT_DEPTH segments, sent as ?scope=. The directory
lives in the tenant root's shard, every change a shard proposal of apply format 8, so its writes answer
503 FORMAT_UPGRADE_PENDING on a shard not armed for it. It holds no memory content: every directory route is operator
plane (§8.15.3) and is served while the tenant's root is pending a restore. On a cluster the ingress routes every
directory route by the root and forwards If-Match.
A name belongs here, never in a scope record, which the shard's feed keeps for ever: since 0.14.0 a record's
tree.display_name is refused (§8.8.7), and an application's name is the name entry of its record's path (§8.26.1).
A connector names its containers and a compiler its teams through name entries.
| Entry | {id} | Fields |
|---|---|---|
| A principal's entry | the principal: user:, agent: or service: | display_name, emails, accounts ([{system, account}]), title, status (active or deactivated), attributes |
| A name entry | the path of a scope or a set of the tenant, its / sent as %2F (an unescaped / is another route) | display_name alone |
An {id} that reads as a principal names the principal.
Who reads what.
| Field | Read by |
|---|---|
id, display_name, title, status, version | any principal of the tenant, and the trusted operator |
emails, accounts, attributes | Owners of the tenant root, the trusted operator, and the principal itself |
| a private scope's name entry (one in a private region of the org tree) | the principals who may read that scope, and the trusted operator |
A field the caller may not read is left out, not nulled. A private scope's name entry answers anyone else 404, the
same body as an absent entry or a caller outside the tenant, and a search never shows it. "Owner of the tenant root" is
the registry's roster check. While no record registers the tenant's root, no principal of the tenant is an Owner of
it for the directory: emails, accounts and attributes of another principal's entry, an email match in a search,
and every write and erasure are the trusted operator's alone; principals read the basic fields, and a principal still
reads its own private fields. Register the tenant's root first.
Deactivation. An entry of the tenant root org:<billing tenant> with status: "deactivated" stops the principal
at its next request on every replica of the root's shard: every credential it presents, whichever issuer signed it,
answers 401 SUBJECT_UNMAPPED, details.reason: "deactivated", on every route, until the entry is active again.
Its memberships are kept, so reactivating gives the access back. The trusted operator is never refused. An issuer in
directory mode maps its tokens' subjects through the accounts of its directory_system, and a deactivated entry does
not sign in.
Versions. Each entry carries version, 1 after its first put; a missing entry is at version 0. GET and PUT
answer ETag: "<version>". If-Match takes "3", 3 or W/"3", and if_version in the body takes the integer; a
different stored version is 412 DIRECTORY_VERSION_CHANGED with details.version, the version now.
If-Match: "0" creates the entry only where none exists.
8.27.1 PUT /v1/directory/{id}?scope=<tenant root>
Writes the whole entry: a field left out is cleared, and status left out is active, so a put without it
reactivates a deactivated entry.
PUT /v1/directory/user:dev?scope=org:acme
If-Match: "1"
{
"display_name": "Dev Patel",
"emails": ["Dev@Acme.Example"],
"accounts": [{"system": "slack:T024BE7LD", "account": "U0DEV"}],
"title": "Engineer",
"attributes": {"cost_center": "4410"}
}
| Field | Type | Notes |
|---|---|---|
display_name | string | Required: 1 to 200 characters, not blank, no control character. |
emails | array | Normalized to NFC and full lowercase before the proposal, repeats dropped, at most 8; each an address of at most 254 bytes. |
accounts | array | {system, account}, 1 to 128 and 1 to 256 bytes: at most 32, each once, each naming one principal of the tenant. |
title | string | At most 200 characters, no control character. |
status | string | active (the default) or deactivated. |
attributes | object | The application's own: at most 32 keys and 4 KiB encoded. |
if_version | integer | The version last read; equal to If-Match when both are sent. |
A name entry takes display_name alone, with if_version.
Who writes. Every writer but the trusted operator is a principal of the tenant; any other is 403 POLICY_DENIED,
whatever its roles. Then:
- A principal's entry is written by an Owner of the tenant root or the trusted operator. A principal may change its own
display_nameand nothing else, on an entry that exists (403 POLICY_DENIED,details.reason: "own_display_name_only"). - A name entry is also written by an Owner of the record registered at its path. A path that no record registers is named by an Owner of the tenant root or the trusted operator alone.
- An account whose
systemis thedirectory_systemof an issuer indirectorymode whose tokens may bill the tenant (a disabled entry's included; read from the issuers file at each put, so a reload counts at once; none whereCORTEX_TENANT_DEPTHis above 1) authenticates: only the trusted operator writes one here, and a SCIM client through SCIM only when the system is its own,scim:<client>(§8.28); anyone else gets403 POLICY_DENIED,details.reason: "identity_account". A change to one on an existing entry, or the re-creation within 90 days of an entry erased with one, writes a notice to the principal; a first provisioning tells no one.
A change to accounts writes an audit row that names the entry's id, never an account. A principal id that holds @
is refused (422 DIRECTORY_MALFORMED, details.reason: "principal_is_address"). At a critical disk a put that adds
data answers 503 DISK_FULL; one that only removes accounts or emails, or deactivates, is admitted, conditional on the
version it was compared with. Every put drops the principal's cached sign-in mappings on every replica.
Response: 200, the entry as the caller may read it, with its new version and ETag:
{
"id": "user:dev",
"display_name": "Dev Patel",
"title": "Engineer",
"status": "active",
"emails": ["dev@acme.example"],
"accounts": [{"system": "slack:T024BE7LD", "account": "U0DEV"}],
"attributes": {"cost_center": "4410"},
"version": 2
}
Errors:
| Status | Code | When |
|---|---|---|
| 400 | INVALID_HEADER | An If-Match of no known form, * included; details {part: "header", field: "If-Match", reason} |
| 400 | INVALID_REQUEST | {id} is neither a principal nor a scope path; If-Match and if_version that differ |
| 400 | INVALID_QUERY | scope does not parse or is not a tenant root |
| 403 | POLICY_DENIED | Above; details.reason own_display_name_only or identity_account where they apply |
| 409 | DIRECTORY_ACCOUNT_TAKEN | An account names another principal of the tenant (details.system, details.account): remove it from the other entry first |
| 412 | DIRECTORY_VERSION_CHANGED | details.version |
| 422 | DIRECTORY_MALFORMED | details.reason: principal_is_address, display_name, title, emails, accounts, attributes, path_outside_tenant, or, for a name entry with another field, "a name entry holds display_name alone" |
| 422 | INVALID_BODY | An unknown field, no display_name, or a status other than active and deactivated |
| 500 | INTERNAL_ERROR | The shard refused the put for a reason the route checks first (details.refusal), or the directory's storage failed (retriable) |
| 503 | DISK_FULL | A put that adds data at a critical disk; retriable, Retry-After: 30 |
| 503 | FORMAT_UPGRADE_PENDING | The shard is not armed for apply format 8 (details.reason, details.format, details.node); retriable, with Retry-After: 30, only for members_behind |
| 503 | NOT_LEADER, WAL_UNAVAILABLE, WAL_OUTCOME_UNKNOWN | Retriable |
| 503 | SCOPE_MOVING | The tenant's root is moving between shards, or its assignment changed (details.roots, details.refusal: SCOPE_NOT_OWNED or STALE_EPOCH); nothing was written; retriable |
| 503 | NOT_AVAILABLE | This server serves no shard and keeps no directory |
8.27.2 GET /v1/directory/{id}?scope=<tenant root>
The entry as the caller may read it, with ETag: "<version>". A name entry answers {id, display_name, version}. For
a principal's entry status is always present, and emails and accounts are present (an empty array included) for
the callers who read them. No entry, a caller outside the tenant, or a private scope's name entry the caller may not
read: 404 NOT_FOUND, one body for all three. Errors: 400 INVALID_QUERY, 400 INVALID_REQUEST, 404 NOT_FOUND,
500 INTERNAL_ERROR, 503 NOT_AVAILABLE.
8.27.3 DELETE /v1/directory/{id}?scope=<tenant root>
Erases the entry. Callers: an Owner of the tenant root, or the trusted operator. The entry, its account and email keys
and, for a principal, its notices go in one batch, and its feed row starts the log residual's cycle, so the name
leaves the Raft log and the snapshots of every voter; a restore replays it. Responses then show the bare id where they
joined the name. A principal's erasure leaves a 90-day marker, a hash of the id, so that an entry re-created with a
sign-in account tells the person. It erases no memory: a person's erasure is POST /v1/erasures/person (§8.6), which
ends with this erasure. Never refused for disk space.
A principal's entry is not erased while a hold of the tenant names the principal, whatever its window: 409 HOLD_IN_FORCE (not retriable), with details.holds (the hold records, sorted) and details.holds_in_force, and the
entry stays. Otherwise its erasure is fenced by the holds it read, so a hold placed while it runs still keeps the
entry. Holds do not affect a name entry's erasure. A person's erasure keeps its own rule: the entry is kept and its
pending held erasure recorded (§8.6.9).
{"id": "user:dev", "existed": true, "erased_at": "2026-10-27T10:00:00Z"}
erased_at is a principal's, by the shard's clock. A repeat answers existed: false, and so does an {id} that names
a path outside the tenant. Errors: 400 INVALID_QUERY, 400 INVALID_REQUEST, 403 POLICY_DENIED,
409 HOLD_IN_FORCE, 500 INTERNAL_ERROR, and the 503s of PUT but DISK_FULL.
8.27.4 GET /v1/directory?scope=<tenant root>&q=<prefix>&limit=&cursor=
The entries whose display_name, or one of whose emails, starts with q (1 to 200 characters), compared
case-folded (NFC, lowercase). Emails are matched only for Owners of the tenant root and the trusted operator (a
principal's own emails are not matched for it), so the search reveals no address; a private scope's name entry is
matched only for a caller who may read the scope. Each entry carries the fields the caller may read.
GET /v1/directory?scope=org:acme&q=dev&limit=2
200
{
"items": [
{"id": "user:dev", "display_name": "Dev Patel", "title": "Engineer", "status": "active", "version": 2},
{"id": "user:devika", "display_name": "Devika Rao", "status": "active", "version": 1}
],
"next_cursor": "303a757365723a646576696b61",
"has_more": true
}
Principals' entries come first, in id order, then name entries, in path order. limit is 1 to 1,000, default 1,000,
and a page holds at most 1 MiB of encoded entries, the first always, whatever the limit. next_cursor, present while
has_more, is opaque and resumes after the last entry sent. Each node serves the search from an
index of its own, in memory: built from the entries the first time a tenant is searched there, refreshed from each
entry's feed row, at most 256 tenants a node (the least recently searched evicted), never persisted, logged or
replicated. Callers: any principal of the tenant, and the trusted operator. Errors: 400 INVALID_QUERY (scope,
q, limit), 403 POLICY_DENIED (not a principal of the tenant), 422 INVALID_CURSOR, 500 INTERNAL_ERROR,
503 NOT_AVAILABLE.
8.28 SCIM 2.0 (/scim/v2/*)
Capability: scim_v1 (shared memory phase 3b, DB-30). Caller: the tenant's SCIM client only.
An identity provider such as Okta or Microsoft Entra ID provisions a tenant's people and groups through SCIM 2.0
(RFC 7643, RFC 7644). Users are directory entries (§8.27); Groups are registry sets, whose membership changes the
server batches into change sets. Every response body is application/scim+json; a request body is read as JSON
whatever its Content-Type. Every write is a shard proposal of apply format 8.
The caller. A bearer whose sub is service:scim-<client> (<client> 1 to 64 bytes), with a tenant audience
(cortexdb:tenant:<t>), sent alone: no X-Cortex-Actor, the token's sub is the caller. The client must be an Owner
of the tenant root org:<t> by the registry's roster, and while no record registers the root it is refused,
403 POLICY_DENIED (the registry would make every principal of the tenant its Owner): register the root first. No capability is checked. The operator key and any other
principal are 403 POLICY_DENIED; a bearer whose tenant root is bound to another billing tenant is
401 WRONG_TENANT. The operator mints the client's token for at most the service ceiling, 30 days by default (§4.7.4), or an issuers-file entry
allowed for the tenant signs it. The tenant root is org:<t>: a deployment whose CORTEX_TENANT_DEPTH is above 1 answers every SCIM route
501 SCIM_UNSUPPORTED, not retriable, before the caller check. On a cluster
the ingress routes SCIM by the bearer's tenant, read from its audience without verifying the token, to the root's
leader (to any owner while the root is not assigned), and forwards If-Match.
What maps onto what.
| SCIM | CortexDB |
|---|---|
User id | the directory entry's principal id; user:<UUIDv7 hex> when this server creates the entry |
externalId | the account {system: "scim:<client>", account: <externalId>} |
userName | the account {system: "scim:<client>:username", account: <userName>} |
displayName, else name.formatted, else the given and family names | display_name |
name, the emails' type | kept in attributes.scim, for the provider to read back |
emails[].value | emails: at most 8, normalized, the primary first |
title | title |
active | status: active or deactivated |
Group id | set:scim-<UUIDv7 hex>, the leaf of the set <tenant>/set:scim-<hex>; the whole path, its / as %2F, is accepted too |
Group displayName | the set's name entry in the directory, never the set record |
Group members[].value | the set's entries; past 256 members, child sets <group>-<n> of at most 256 each, which the client never sees |
An entry that holds an account of one of the client's two systems is that client's User, whatever wrote it; any other
entry is 404 to the client. A provider links to existing people only on externalId: a POST /Users whose
externalId an entry already holds writes to that entry and answers 201 with its id. A client whose people already
have principal ids writes their scim:<client> accounts first (PUT /v1/directory/{id}, as the trusted operator),
then points the provider at CortexDB. A userName never links: one that another entry holds is 409 uniqueness.
What is supported.
GET,POST,PUT,PATCHandDELETEon/Usersand/Groups, andGETon/ServiceProviderConfig,/ResourceTypes,/ResourceTypes/{id},/Schemasand/Schemas/{id}. No/Bulk,/Meor.search, no sorting, no password change.- Filters: one
eqcomparison of a string, attribute names and operators in any case, with or without the schema URN. Users filter onuserName,externalId,id,displayName(without case) andemails(emails.value); Groups ondisplayName(without case),idandexternalId, which matches none, since a Group'sexternalIdis not kept. Anything else is400 invalidFilter. - Paging:
startIndex(1-based; below 1 is 1) andcount(default 100, at most 1,000;0answerstotalResultsalone), and a page holds at most 1 MiB past its first resource;itemsPerPagesays how many it holds. Users list in id order, Groups in path order.attributesandexcludedAttributesproject the top-level attributes (id,schemasandmetaalways kept). Query parameter names compare without case;sortByandsortOrderare ignored. - PATCH:
add,replaceandremove, in any case, applied in order. On a User a path isattr,attr.sub,attr[filter]orattr[filter].sub, and an operation without a path carries a value object; a value filter is comparisons (eq,ne,co,sw,ew,pr) joined byandor byor; a filter that matches no element makes the element it names (Entra'semails[type eq "work"].value);"True"and"False"read as booleans; an attribute this server keeps no field for (the enterprise extension, phone numbers) is accepted and dropped;idis read-only (400 mutability). On a Group,membersare added, removed (by value, or by amembers[value eq "…"]filter; a removal without a value removes every member) or replaced, anddisplayNamereplaced. - Versions: a User carries
ETag: W/"<version>", its entry's version, andmeta.version;PUT,PATCHandDELETEtakeIf-Match(W/"3","3",3, or*for any; any other form is400 invalidValue,detailstartingINVALID_HEADER:). WithoutIf-Match, a User write that another writer overtook is made again on the new version, up to three times. Groups carry no ETag.
Users. A create, replace or patch replaces the entry's display_name, emails, title, status and the
client's two accounts, and keeps every other account and attribute the entry holds; every other User attribute
(phone numbers, addresses, the enterprise extension, a password) is dropped. A displayName, title or name part
above 200 characters, more than 8 emails, or a userName or externalId above 256 bytes is 400 invalidValue. A
create answers 201 with ETag and Location; a replace or a patch 200 with the User and its ETag; a delete
204. active: false writes the entry deactivated and keeps the person in their SCIM groups: from the next request
every credential of the person answers 401 SUBJECT_UNMAPPED (§8.27, Deactivation); active: true gives the access
back through the same groups, which the provider need not send again. A DELETE takes the User out of every SCIM
group of the tenant, whichever client's, in one narrowing change set, then erases the entry (§8.27.3).
Groups. A Group's set has the client's principal as its one Owner. Its changes become change sets the server
stages and activates under the client's proposer system:scim-<client>, removals and additions apart: each change
waits for the next batch of its kind, the changes that arrive within 200 ms of the batch's first (at most 256 parts and
16 MiB, never two that write one Group), and a request's removals activate before its additions. An addition that
widens access past one of the tenant's assertions is refused at once, 409 ACCESS_ASSERTION_FAILED; a request is
answered when its own part activates, or with its own part's refusal, never another request's. A member is a principal
with a directory entry in the tenant (400 invalidValue otherwise), and a nested Group is refused. A Group's sets hold
at most 250,000 entries, members and child sets together. A create answers 201 with Location; a replace 200,
where members left out removes every member; a patch and a delete 204. A change-set refusal SCIM has no message
of its own for (REGISTRY_NOT_REPLICATED, PREVIEW_CHANGED, CHANGESET_NOT_STAGED, CHANGESET_INCOMPLETE,
NOT_FOUND) answers the code /v1/access/changes answers it with (§8.22), in SCIM's body; CHANGESET_STAGING_FULL, a
full staging queue, is 503 with Retry-After instead of the 409 every other route answers, since SCIM has no status
for a full queue and a provider retries a 503.
During a restore. While the tenant's root is pending a restore, Users, Group reads and the metadata routes are
served; a Group write answers 503 ACCESS_RESTORE_PENDING with Retry-After: 30 before its body is read, the
envelope's root, pending_sources and restored_at in detail, and stages nothing. Its provider retries it on its
own (every other route answers the code not retriable, §16). A SCIM client cannot diff and re-send its sets, so the
operator acknowledges the restore for it (§8.24), then asks the provider for a full push.
POST /scim/v2/Users
Authorization: Bearer <the SCIM client's token>
Content-Type: application/scim+json
{
"schemas": ["urn:ietf:params:scim:schemas:core:2.0:User"],
"userName": "dev.patel@acme.example",
"externalId": "00u1devokta",
"name": {"givenName": "Dev", "familyName": "Patel"},
"displayName": "Dev Patel",
"emails": [{"value": "dev.patel@acme.example", "type": "work", "primary": true}],
"active": true
}
201
ETag: W/"1"
Location: /scim/v2/Users/user:0192f3aa7c3b7d2e8f1a2b3c4d5e6f70
{
"schemas": ["urn:ietf:params:scim:schemas:core:2.0:User"],
"id": "user:0192f3aa7c3b7d2e8f1a2b3c4d5e6f70",
"externalId": "00u1devokta",
"userName": "dev.patel@acme.example",
"name": {"givenName": "Dev", "familyName": "Patel", "formatted": "Dev Patel"},
"displayName": "Dev Patel",
"emails": [{"value": "dev.patel@acme.example", "primary": true, "type": "work"}],
"active": true,
"meta": {"resourceType": "User", "version": "W/\"1\"",
"location": "/scim/v2/Users/user:0192f3aa7c3b7d2e8f1a2b3c4d5e6f70"}
}
Okta's deactivation, a replace without a path:
PATCH /scim/v2/Users/user:0192f3aa7c3b7d2e8f1a2b3c4d5e6f70
{"schemas": ["urn:ietf:params:scim:api:messages:2.0:PatchOp"],
"Operations": [{"op": "replace", "value": {"active": false}}]}
200, the User with "active": false and ETag: W/"2"
A Group, and Entra's removal of a member by value:
POST /scim/v2/Groups
{"schemas": ["urn:ietf:params:scim:schemas:core:2.0:Group"],
"displayName": "Engineering",
"members": [{"value": "user:0192f3aa7c3b7d2e8f1a2b3c4d5e6f70"}]}
201
Location: /scim/v2/Groups/set:scim-0192f3b07d4e7a1b9c2d3e4f5a6b7c8d
{"schemas": ["urn:ietf:params:scim:schemas:core:2.0:Group"],
"id": "set:scim-0192f3b07d4e7a1b9c2d3e4f5a6b7c8d",
"displayName": "Engineering",
"members": [{"value": "user:0192f3aa7c3b7d2e8f1a2b3c4d5e6f70",
"$ref": "/scim/v2/Users/user:0192f3aa7c3b7d2e8f1a2b3c4d5e6f70", "type": "User"}],
"meta": {"resourceType": "Group", "created": "2026-10-27T10:00:00Z",
"location": "/scim/v2/Groups/set:scim-0192f3b07d4e7a1b9c2d3e4f5a6b7c8d"}}
PATCH /scim/v2/Groups/set:scim-0192f3b07d4e7a1b9c2d3e4f5a6b7c8d
{"schemas": ["urn:ietf:params:scim:api:messages:2.0:PatchOp"],
"Operations": [{"op": "Remove", "path": "members",
"value": [{"value": "user:0192f3aa7c3b7d2e8f1a2b3c4d5e6f70"}]}]}
204
A lookup before a create, as Okta sends it:
GET /scim/v2/Users?filter=userName%20eq%20%22dev.patel%40acme.example%22&startIndex=1&count=100
200
{"schemas": ["urn:ietf:params:scim:api:messages:2.0:ListResponse"],
"totalResults": 1, "startIndex": 1, "itemsPerPage": 1,
"Resources": [<the User, as the create above answered it>]}
Errors. SCIM's own body (RFC 7644 §3.12), detail starting with the CortexDB code:
{"schemas": ["urn:ietf:params:scim:api:messages:2.0:Error"],
"status": "409", "scimType": "uniqueness",
"detail": "DIRECTORY_ACCOUNT_TAKEN: another principal of the tenant holds this userName"}
SCIM answers follow RFC 7644's and the API contract's SCIM conventions, while the codes inside SCIM bodies are the
server's own. Every error the SCIM routes answer, the auth layer's included, takes this body; the CortexDB envelope's details and
retriable are not carried, so ACCESS_LIMIT_REACHED's detail names the limit, its value, what is used and the
setting that raises it. The codes in detail are the server's own, but the status is RFC 7644's, which identity
providers act on: three codes are answered here with another status than on every other route (§16):
CHANGESET_STAGING_FULL (409 elsewhere), ACCESS_RESTORE_PENDING (retried after Retry-After: 30, not retriable
elsewhere) and TENANT_DELETED (410 elsewhere).
| CortexDB code | Status | scimType |
|---|---|---|
DIRECTORY_ACCOUNT_TAKEN | 409 | uniqueness |
DIRECTORY_VERSION_CHANGED | 412 | |
DIRECTORY_MALFORMED, INVALID_BODY, INVALID_ACCESS_RECORD, INVALID_REQUEST, INVALID_QUERY, INVALID_HEADER | 400 | invalidValue |
INVALID_FILTER | 400 | invalidFilter |
MUTABILITY | 400 | mutability |
POLICY_DENIED | 403 | |
NOT_FOUND | 404 | |
ACCESS_ASSERTION_FAILED, ACCESS_LIMIT_REACHED, CHANGESET_STALE, CHANGESET_CONFLICT | 409 | |
CHANGESET_TOO_LARGE, WAL_TOO_LARGE | 413 | |
CHANGESET_STAGING_FULL | 503, with Retry-After | |
ACCESS_RESTORE_PENDING (a Group write during a restore) | 503, with Retry-After: 30 | |
every other 503 (SCOPE_MOVING, REGISTRY_STALE, DISK_FULL, FORMAT_UPGRADE_PENDING, NOT_LEADER, WAL_UNAVAILABLE, WAL_OUTCOME_UNKNOWN, NOT_AVAILABLE, REVOCATION_UNAVAILABLE) | 503; every retriable one with Retry-After (30 unless the refusal set one): FORMAT_UPGRADE_PENDING only for a retriable reason (members_behind, 30), never arming_disabled or reserved_path_in_use, and NOT_AVAILABLE never | |
WRONG_TENANT, SUBJECT_UNMAPPED, MISSING_TOKEN and every other credential refusal | 401 | |
TENANT_DELETED | 401: a deleted tenant's credentials no longer work | |
SCIM_UNSUPPORTED | 501 | |
| any other 422 | 400 | invalidValue |
| any other client error (a 409 this table does not name, …) | its own status | |
| any other code | 500 |
A refusal made before the request reaches the SCIM routes keeps the CortexDB envelope (§6.6): the license gate's 402,
413 PAYLOAD_TOO_LARGE for a body above CORTEX_MAX_BODY_BYTES, a path parameter that does not decode
(400 INVALID_PATH_PARAMS), and a cluster ingress's or a data owner's edge refusals.
Discovery. GET /scim/v2/ServiceProviderConfig says patch, filter (maxResults 1,000) and etag supported,
and bulk, sort and changePassword not; its one authentication scheme is oauthbearertoken. GET /scim/v2/ResourceTypes lists User and Group, and GET /scim/v2/Schemas the two core schemas with the attributes this
server keeps, each as a ListResponse. GET /scim/v2/ResourceTypes/{id} and GET /scim/v2/Schemas/{id} serve each resource type
and schema at the meta.location its list names (User and Group; the core schemas' URNs; the id compares without
case), 404 NOT_FOUND for another id. All five take the SCIM client's bearer, as every SCIM route does, and a cluster
ingress routes them by the bearer's tenant.
8.29 Rollups and publish
Capabilities rollups_v1 and publish_v1 (shared memory phase 4, DB-7 and DB-8,
docs/shared_memory/IDENTITY_AND_API_CONTRACT.md §5.13 and §5.14). Since 0.14.0.
8.29.1 Rollup homes, kinds and who is served
A rollup is a record the shard leader's rollup driver builds for a unit of an org tree (§8.8.7) and homes in the
unit's aud:roll compartment. A unit is a non-private org or team record of the root, and it has rollups only when
<unit>/aud:roll is registered as a compartment with the rollup rule: nothing infers a home from a name. Every
replica holds the same records (PutRollup, shard apply format 10) and serves them the same way; on a shard below
format 10 nothing is built and the routes below answer empty.
A unit's inputs are its own scope (a team's; an org's never), then its children in path order: a child team through
its aud:roll when that is registered, else itself, and a member's aud:work read at Summary. A private scope or one
in a private region, a labelled scope read at Summary, an aud:lead compartment, a group, the unit's aud:pub and the
unit's own homes are never inputs, and a row whose atoms the home does not dominate is skipped and counted. Past 32
inputs the children roll up in runs of 32 into intermediate nodes homed at the unregistered internal paths
<unit>/aud:roll-<n> (n from 1); there is one node level, so a unit of more than 31 × 32 children builds nothing.
kind | topic | What it holds |
|---|---|---|
totals | totals:<YYYY-MM> | The month's rows (by recorded_at, UTC): events, counts per context.intent and per label family (the part of a label before its first :, never its value), and per typed-triple predicate with an integer or number object its count, sum and latest value. Always summary_safe |
belief | synthesis | A position the inputs take; positions keeps each input's when they disagree |
concept, learning | synthesis | A statement (text, at most 4,000 characters) and the rows it drew on (citations) |
level is team (a team with no team child), department (a team with one), org, or node (an intermediate
node). A home's synthesis items are rebuilt as one topic, each item a part of its build; a totals month too large for one
record is stored in parts, which a reader merges. Every read serves each topic's newest complete build.
Building. Reading a home opens its unit on this node for 7 days: an opened unit is rebuilt on its level's cadence,
CORTEX_ROLLUP_CADENCE (default team:300,department:3600,org:86400,node:3600, seconds), only the topics whose inputs
changed; a unit nobody opened is built at the next pass after its first read, which serves what is stored then.
Synthesis runs only where the background LLM stages run (CORTEX_CONSOLIDATION_ENABLED, or
CORTEX_ENRICHMENT_DELAY_SECONDS set with no CORTEX_ENRICHMENT_SCOPE_PREFIXES), within the level's daily budget,
CORTEX_ROLLUP_BUDGET_USD (default team:0.25,department:0.50,org:1.00,node:0.25); totals need no model. Each call is
recorded in the usage ledger under the role rollup (§8.15.4). A value of either variable that does not parse refuses
the boot (exit 78 ROLLUP_CONFIG). An erasure of any event a rollup used removes the rollup, and every rollup that
cites it, on every replica.
Who is served. A rollup is served to the request's chain when all of these hold:
- The chain reads the home at Summary or above:
scope.read.localthere, and Summary or Reader on its roster (the unit's heads and the heads above, its grantees, the record's own entries). For an intermediate node the home read is its unit'saud:roll. Call that role R. - At Summary the record is
summary_safe, and of its citations only those of kindrollupare served. - Dominance: the chain reads every input at the lower of R and the input's
read_at, through a path whose conditions are no stricter than the home's (afresh_authof at most as many minutes, the samepurpose, amax_labelno lower) and whose end is no earlier; it reads every atom of every row the rollup used at R; no input is private now; and every rollup it cites passes the same check. Each of those reads goes through a path whose label cap reads the scope's current label, so a relabel hides a rollup at the next read.
Otherwise the rollup is hidden from that chain, and from it alone: absent from lists and totals, 404 by id, with no
flag or count that says so. The decision is cached per chain, rollup and registry revision, and is not reused within
60 s of the earliest until its paths relied on; one whose paths carry a fresh_auth condition is never cached. The
trusted operator (the static CORTEX_API_KEY, or an auth-disabled server) reads at Reader. Under
CORTEX_OPERATOR_DATA_READS=deny the operator key's reads of the three routes below are break-glass class
stored_rows, or private_region for a home in a private region, whose notice commits first (§8.15.3).
GET /v1/rollups, /v1/rollups/totals and /v1/rollups/{id} take ?scope= naming the home and refuse any query
parameter they do not list (400 INVALID_QUERY); none takes ?at_least=. A cluster ingress routes each by the scope's
root. Errors they share: 400 INVALID_QUERY; 403 POLICY_DENIED (the caller does not read the home at Summary or
above), 403 BREAK_GLASS_REQUIRED; 422 INVALID_SCOPE_GRAMMAR (details.field: "scope"), 422 INVALID_QUERY with
details.reason: "not_a_rollup_home" (and details.scope) for a scope that is not a rollup home; 503 NOTICE_UNAVAILABLE. Only NOTICE_UNAVAILABLE is retriable, and not for details.reason arming_disabled or reserved_path_in_use.
8.29.2 GET /v1/rollups — A home's rollups
Capability: scope.read.local and Summary or above at the home (§8.29.1).
GET /v1/rollups?scope=org:acme/team:sales/aud:roll&kind=totals&limit=1
200
{"items": [{"id": "0192f3a0-...", "home": "org:acme/team:sales/aud:roll", "unit": "org:acme/team:sales",
"level": "department", "kind": "totals", "topic": "totals:2026-10", "summary_safe": true,
"built_at": "2026-10-25T10:00:00Z",
"window": {"from": "2026-10-01T08:12:00Z", "through": "2026-10-24T17:40:00Z"},
"inputs": [{"scope": "org:acme/team:apac/aud:roll", "read_at": "reader"},
{"scope": "org:acme/team:sales", "read_at": "reader"}],
"totals": {"events": 120,
"intents": [{"key": "decision", "count": 12, "latest_at": "2026-10-24T17:40:00Z"}],
"label_families": [{"key": "deal", "count": 40, "latest_at": "2026-10-23T11:02:00Z"}],
"measures": [{"predicate": "deal_amount_usd", "count": 7, "sum": 1250000,
"latest": {"value": 400000, "at": "2026-10-23T11:02:00Z"}}],
"inputs": [{"scope": "org:acme/team:apac/aud:roll", "events": 100},
{"scope": "org:acme/team:sales", "events": 20}]}}],
"next_cursor": "1", "has_more": true}
| Parameter | Type | Notes |
|---|---|---|
scope | string | The rollup home (required) |
kind | string | totals, belief, concept or learning; anything else is 422 INVALID_QUERY (details.field: "kind") |
topic | string | A topic prefix: totals:2026-10, totals:, synthesis |
limit | int | 1 to 100, default 20; 0 or more than 100 is 422 INVALID_QUERY (details.field: "limit"), not clamped |
cursor | string | The previous page's next_cursor; a value that does not parse is 422 INVALID_CURSOR |
Each item is a Rollup:
| Field | Type | Notes |
|---|---|---|
id | string | A UUIDv7 the leader's driver minted |
home, unit | string | The home, and the unit it rolls up (the home's tree.parent) |
level, kind, topic | string | §8.29.1 |
part, parts | int | Only when the build is stored in more than one record; part counts from 0 |
summary_safe | bool | Totals always; a synthesis item when it holds no quote of its sources and no name, and no letter of a caseless script |
built_at | string | When the shard stored it (apply's clock) |
window | object | {from, through}: the earliest and latest recorded_at of the rows it used; absent when it used none |
inputs | array | {scope, read_at}: reader, or summary for a chain compartment such as a member's aud:work |
totals | object | Kind totals: each list sorted by key, keys of at most 64 bytes, at most 256 entries, the rest counted in other |
text | string | Synthesis kinds: the statement |
positions | array | Kind belief: {text, inputs} for each position its inputs take |
citations | array | Synthesis kinds: {kind, id, scope}, kind one of event, fact, belief, rollup; at Summary only rollup |
Items are ordered by built_at (newest first), then topic, part and id. An intermediate node's rollups are never
listed. next_cursor is present while has_more; a cursor is a position in the list as it is served at each read, so
a rebuild between two pages can repeat or skip an item. Errors: §8.29.1's and 422 INVALID_CURSOR.
8.29.3 GET /v1/rollups/{id} — One rollup
Capability: scope.read.local and Summary or above at the home; for an intermediate node, at its unit's aud:roll.
GET /v1/rollups/{id}?scope=<home> answers the Rollup homed exactly at scope, as §8.29.1 serves it. scope may be
an intermediate node's internal path <unit>/aud:roll-<n>: such a rollup is listed nowhere and is answered only when
its unit's rollup's dominance passes for the caller, so a client reaches it through a rollup citation. An id that is not
a UUID, an absent rollup, one homed anywhere but scope, one hidden from the caller, and a node that keeps no rollups all
answer the same 404 NOT_FOUND. Reading opens the home.
Since 0.14.0 a superseded build is never served: a rollup the caller is served that is not part of its topic's
current build (an earlier build kept only because a stored rollup still cites it, or a part of a build that lost
another) answers 410 ROLLUP_SUPERSEDED, not retriable, with details: {home, topic, current, current_parts?}:
current the id of the current build's first part, null when the topic has no current build or the caller is not
served all of it, and current_parts every part's id, in part order, for a build of several parts, so a citation can
be followed. A record the caller is not served stays 404. Errors: §8.29.1's, 404 NOT_FOUND and 410 ROLLUP_SUPERSEDED.
8.29.4 GET /v1/rollups/totals — A home's typed totals
Capability: scope.read.local and Summary or above at the home.
What a Summary reader's dashboard reads: the home's typed totals, merged over the totals builds the caller is served
whose month lies in [from, to]. A build any part of which is hidden from the caller adds nothing.
GET /v1/rollups/totals?scope=org:acme/team:sales/aud:roll&from=2026-09&to=2026-10
200
{"home": "org:acme/team:sales/aud:roll", "unit": "org:acme/team:sales", "level": "department",
"totals": {"events": 230,
"intents": [{"key": "decision", "count": 21, "latest_at": "2026-10-24T17:40:00Z"}],
"inputs": [{"scope": "org:acme/team:apac/aud:roll", "events": 190},
{"scope": "org:acme/team:sales", "events": 40}]},
"months": ["2026-09", "2026-10"], "built_at": "2026-10-25T10:00:00Z"}
| Parameter | Type | Notes |
|---|---|---|
scope | string | The rollup home (required) |
from, to | string | Inclusive months, YYYY-MM (UTC), both optional; anything else is 422 INVALID_QUERY (details.field). A from after to merges nothing |
Counts and sums add and latest values take the later; after the merge each list is held to 256 keys, the rest counted
in other. months lists the months merged, ascending; built_at is the newest merged record's, absent when no month
merged. A home with nothing the caller is served in the range answers zero totals and months: [], with level the
home's level in its root's plan (team when the plan does not place it). Errors: §8.29.1's.
8.29.5 GET /v1/admin/rollups/status — The rollup driver
Capability: trusted operator only (the static CORTEX_API_KEY, or an auth-disabled server).
GET /v1/admin/rollups/status?scope=<any scope of the root> reports this node's rollup driver for that root
(RollupStatus). It is node-local, and a cluster ingress does not route it.
200
{"root": "org:acme", "leading": true, "term": 7, "passes": 412, "last_error": null,
"view": {"floor": 9310, "records": 64, "newer": 0, "corrupt": 0},
"homes": [{"home": "org:acme/team:apac/aud:roll", "unit": "org:acme/team:apac", "level": "team",
"cadence_s": 300, "opened": true, "last_build": "2026-10-25T09:55:00Z",
"built_topics": 1, "unchanged_topics": 3, "records": {"belief": 2, "totals": 4},
"skipped": {"atoms_not_dominated": 3}, "spend_today_usd": 0.04, "budget_usd": 0.25,
"last_error": null}]}
| Field | Type | Notes |
|---|---|---|
leading, term | bool, int | This node leads the root's shard with its creates gate open, and the term its driver builds in (null while it does not lead) |
passes, last_error | int, string | Passes run since boot on a shard armed for format 10, and the last pass's error |
view | object | This node's rollup tail over every root: the last order seq read (floor), the records held, and the records skipped since boot as a later payload version (newer, logged ROLLUP_PAYLOAD_NEWER) or undecodable (corrupt) |
homes | array | Every home the root's current plan names (each registered aud:roll with the rollup rule, and each intermediate node), every home after the homes it reads |
opened | bool | Read on this node within 7 days, by this process: a restart opens nothing until a read |
last_build | string | This driver's last build of the home, else its newest stored record's |
built_topics, unchanged_topics | int | Topics the last build proposed, and those whose fingerprint held |
records | object | The current builds' records by kind; settled-call records are not counted |
skipped | object | What the last build left out, by reason: inputs (private, labelled, leads, group, published, other, home_rule, bound), rows (atoms_not_dominated, labelled) and synthesis (bound, budget, model_failed, no_items) |
spend_today_usd, budget_usd | number | The home's synthesis spend today (UTC), the highest of this process's, the ledger's day total and its stored records', against the level's CORTEX_ROLLUP_BUDGET_USD |
A node that keeps rollups but no driver answers {root, leading: false, view, homes: []}, and one that keeps none
{root, leading: false, homes: []}. Errors: 400 INVALID_QUERY, 403 POLICY_DENIED (not the trusted operator),
422 INVALID_SCOPE_GRAMMAR.
8.29.6 POST /v1/publish — Publish a copy into a wider home
Capability: a person's chain, with scope.write and Writer at target by the record's own entries.
The one way to widen a memory's audience: a person writes a copy of a memory it is served, an event or a rollup, into
target, as an original memory there. The copy carries no atoms, whatever the original's, and names the original as
its provenance, so an erasure of the original, or of any event a rollup's copy names, erases the copy on every replica,
and a copy of that copy with it; erasing a copy leaves the original. Agents draft; people publish.
POST /v1/publish
{"target": "org:acme/team:sales/aud:pub",
"source": {"scope": "org:acme/app:notes/user:p_priya", "event_id": "0192f3b1-..."},
"content": {"kind": "text", "text": "Start security reviews at stage 2."},
"context": {"intent": "procedure", "labels": ["topic:security"]},
"idempotency_key": "pub-7f3a"}
202
{"event_id": "0192f3c4-...", "status": "captured", "wal_offset": 5121,
"lifecycle_stream": "/v1/lifecycle/stream?event_id=0192f3c4-...", "replayed_from_idempotency": false,
"published_from": {"scope": "org:acme/app:notes/user:p_priya", "event_id": "0192f3b1-..."}}
| Field | Type | Notes |
|---|---|---|
target | string | Where the copy lands, in the original's root (required) |
source | object | {scope, event_id} an event at exactly scope, or {scope, rollup_id} a rollup homed at scope; exactly one of the two ids (required) |
content | object | An envelope content replacing the original's; absent or null keeps it. A rollup's content is its context-block line, as text |
context | object | intent and labels, each replacing the original's when present; labels: [] drops them, and an intent cannot be removed. observed_at is always the original's (a rollup's, its built_at) |
idempotency_key | string | 1 to 64 bytes. Absent: publish: and the unpadded base64url SHA-256 of the original, target and the copy's content (51 characters) |
?wait=accepted|captured|indexed is the capture's barrier; any other value is 422 INVALID_BODY. ?consistency=1
(consistency_tokens_v1, §6.11) adds consistency_token after the answer's own fields: a token at target's root that
covers the copy. The route takes no other query parameter (400 INVALID_QUERY). The body is unknown-field
strict (422 INVALID_BODY, including a source naming neither or both ids, details.field: "source").
Who. A person's chain only: a verified token whose sub is a user: principal, with no act or run, and whose
client resolves to person. An app is allowed: a person publishes through the tenant's application, whose
client asserts client: "person". Where the tenant enforces applications, the application must be admitted at the
original (else 404 NOT_FOUND, as for an original the caller is not served) and at target (else 403 APP_NOT_ADMITTED), as on every read and write (§8.26), and a chain without an application publishes only an original
in the person's own regions, and only into them. An agent's act, a run, a service subject, or a token with app
and no client (which resolves to an agent chain, §4.7.2) is 403 PUBLISH_PERSON_REQUIRED, and so are the static
key and an auth-disabled server. The write is POST /v1/experience's on the built envelope: its authorization (scope.write
and Writer at target by the record's own entries, else 403 NOT_A_MEMBER or 403 POLICY_DENIED), hosted plans (402 PLAN_LIMIT_REACHED), the subtree rate limit (429 SUBTREE_RATE_LIMITED), idempotency and answers. A copy carries
provenance, so the shard needs format 9 (503 FORMAT_UPGRADE_PENDING).
The original. An event is read as GET /v1/events/{id}?scope= serves it: its scope exactly, read by the caller,
its atoms admitted by the delivery gate, not forgotten and not excluded; a sealed event from its segment (503 SEGMENT_UNAVAILABLE, retriable, when the store does not answer). A rollup must be served to the caller (§8.29.1) and part of its topic's current build, else
410 ROLLUP_SUPERSEDED (as §8.29.3 answers it, and nothing is written); its
copy's provenance is the events it and every rollup it cites used, deduplicated, at most 1,024 (else 422 PUBLISH_TOO_LARGE, details {events, max_events}, events the count at which the walk stopped), and a rollup whose
events are all erased is 409 PROVENANCE_ERASED. The original must lie in target's root (422 CROSS_ROOT_PROVENANCE, details {scope, root}). Anything else, an id that does not parse included, is the same 404 NOT_FOUND.
Norms. A copy whose intent (the body's context.intent, else the original's) is rule, regulation, vision,
goal, procedure or definition needs the token's auth_time within the last 600 s, and no more than 60 s ahead:
else 401 FRESH_AUTH_REQUIRED, details.max_age_s: 600, with WWW-Authenticate: Bearer error="insufficient_user_authentication", max_age="600" (RFC 9470), and nothing is written.
Idempotency. The default key covers the original, the target and the content, not the context: the same publish
twice is one copy (replayed_from_idempotency: true), and the same content with another context is the same key with
another body, 409 IDEMPOTENCY_CONFLICT; send an idempotency_key to publish it again.
The answer is the capture's, 202 with its CapturedResponse or, once a wait target is reached, 200 with the wait
body (stages_completed), plus published_from: {scope, event_id} or {scope, rollup_id}, and with ?consistency=1 consistency_token (and
derived_through, §6.11). A cluster ingress routes
the publish by the root of target and source.scope; the owner reads the original from its own rows or rollup view.
Errors: 400 INVALID_QUERY; 401 FRESH_AUTH_REQUIRED; 402 PLAN_LIMIT_REACHED; 403 PUBLISH_PERSON_REQUIRED,
NOT_A_MEMBER, POLICY_DENIED (with ?consistency=1 also token_root_not_written, §6.11), APP_NOT_ADMITTED (the
chain's app is not admitted at target, in a tenant that enforces applications); 404 NOT_FOUND; 408 WAIT_TIMEOUT (wait=indexed, retriable); 409 PROVENANCE_ERASED (also from the capture's apply for an erased or redacted cited event, details {event_id, cited}),
IDEMPOTENCY_CONFLICT; 410 ROLLUP_SUPERSEDED; 422 INVALID_BODY, INVALID_SCOPE_GRAMMAR (details.field target or source.scope),
CROSS_ROOT_PROVENANCE, PUBLISH_TOO_LARGE, and the capture's INVALID_ENVELOPE and PROVENANCE_UNKNOWN; 429 SUBTREE_RATE_LIMITED (retriable, Retry-After); 500 INTERNAL_ERROR (retriable); 503 FORMAT_UPGRADE_PENDING (retriable only for
details.reason: "members_behind", Retry-After: 30), SEGMENT_UNAVAILABLE, WAL_UNAVAILABLE (a rollup's record did
not read) and DB_UNAVAILABLE (the read lane), all three retriable, and the capture route's 503s (§16).
8.30 Access administration
The trusted operator's routes over the shared-memory access layer, besides the restore override (§8.24.3) and a tenant's
own operator mode and readiness override (GET and PUT /v1/admin/access/tenant-settings, §8.15.3). Each is the trusted
operator's only (the static key or an auth-disabled server), and each is an operator-plane route:
CORTEX_OPERATOR_DATA_READS=deny asks no break-glass header for any of them (§8.15.3).
8.30.1 GET /v1/admin/access/report?scope=<tenant root>
Capability: the trusted operator with diagnostics.read. Capability name access_report_v1 (shared memory phase 0,
docs/shared_memory/IDENTITY_AND_API_CONTRACT.md §4.4, §5.6.1).
A fix that refuses callers it used to serve ships with a report check, which counts per tenant whom it would refuse, and
usually a switch, CORTEX_<CHECK>_ENFORCE. Since 0.14.0 every switch enforces by default (on, blank or unset), so a
check with a switch counts a would-deny only while its switch is off; any other value refuses the boot (exit 78
AUTH_CONFIG_INVALID). Each switch is read once at boot (GET /v1/admin/metrics auth.enforce lists them). The
facility refuses nothing itself and counts only what the rules in force allow: a decision they deny, a request a fix
refused and a request answered 401, 403 or 404 count nothing, so no caller makes an entry for a root of its choosing.
The counters are node-local and in memory: they restart with the process and with a change of the term in which this
node leads its shard (counting_since). A node keeps at most 65,536 tenants and CORTEX_ACCESS_REPORT_MAX_MB MiB of
counters (default 64), estimated per tenant, the least recently counted evicted first, so a client keeps the running
totals. CORTEX_ACCESS_REPORT=off (or 0, false) records nothing, and the route then answers 409 ACCESS_REPORT_OFF; the capability stays listed. A request counts under the tenant of the first scope a counted decision
named (its first CORTEX_TENANT_DEPTH segments; a shallower scope is a tenant of its own), else under its token's
billing tenant root (org:<billing id>, exact only at CORTEX_TENANT_DEPTH=1); a mint counts under the tenant it mints
for. On a cluster the ingress routes the report to the root's leader, which made the root's decisions; a mint whose
targets name one root is counted by that root's leader, any other mint by the owner that served it.
The checks, each listed with zeros when nothing was counted, in this order:
| Check | Counts | Switch |
|---|---|---|
subject_shadow | Each trusted-operator request that carried X-Cortex-Subject-Token (subject_token_shadow_v1), its decisions evaluated for the subject's chain: match, would_deny (each failing decision's link and reason), invalid_token, operator_plane, not_evaluated (nothing decided, past the 2 ms budget, or a subject token whose directory mapping this node cannot read, directory_not_here), shadow_dropped. It refuses nothing | none |
mint_lifetime | A mint above its subject's lifetime ceiling (by default 90 days for a user, 7 for an agent, 30 for a service or system; CORTEX_MINT_MAX_LIFETIME_*, §4.7.4), reason ttl_too_long; a presented token this server's minter signed whose exp - iat is above it, lifetime_over_ceiling | CORTEX_MINT_LIFETIME_ENFORCE |
token_confinement | A capability no scopes entry names, used by a token that carries scopes: link confinement, reason capability_not_named, by capability; a route's probe whose refusal would only degrade the request, reason would_degrade, which is no would-deny | CORTEX_TOKEN_CONFINEMENT_ENFORCE |
mint_reach | Each mint (since 0.14.0): a match, or the rule of the mint's reach it breaks (§8.16.3), by its reason (caps_exceed_minter, link capability; scopes_exceed_minter, link minter; scopes_span_roots and deployment_mint_requires_operator, link tenant; minted_token_cannot_mint); only a node with the switch off mints one, so with it on the check counts matches alone | CORTEX_MINT_REACH_ENFORCE |
role_blind_membership | An entry one of the three any-entry sites (GET /v1/scopes/list, the audit boundary, the commitment transport's read side) admits that a Reader check would refuse: none until a role below Reader exists | CORTEX_ROLE_BLIND_MEMBERSHIP_ENFORCE |
duplicate_member | A POST /v1/scopes or PUT /v1/scopes/members roster that lists a principal twice, link person; and, when the report is read, the records whose roster does (classes.records) | CORTEX_DUPLICATE_MEMBER_ENFORCE (refuses with 422 INVALID_BODY) |
reserved_path | A registration or first write at a marker path (<tenant>/{orgtree,holds,access}:changes, <tenant>/self:*) or a companion path (<scope>/attrs:unit); and, when read, the records and tombstones at reserved paths (classes.records_marker ... tombstones_reserved_type; a version-2 companion, kind attrs, is not counted; 0.15.0 and 0.15.1 counted it in records_companion) | CORTEX_RESERVED_PATH_ENFORCE (422 INVALID_SCOPE_GRAMMAR) |
legacy_machine_written | When read, the root's Captured rows by class, from their caller, observed actor, credential tenant and source alone (machine_caller, machine_observed, machine_written, unverified_actor, relayed, sourced; sealed and expired rows unclassified), within 100,000 rows and markers and 2 s: a cut answers partial and a cursor, which the next read passes as after | none |
minter_link | A decision for a token another credential minted whose minter would not pass the person rule at the decision's scope, link minter, reason minter_not_permitted | CORTEX_MINTER_LINK_ENFORCE |
operator_access | Under CORTEX_OPERATOR_DATA_READS=audit (the deployment's or the tenant's own), each operator-key action deny would refuse, by class (stored_rows, admin_content, private_region, in_band, §8.15.3) | the operator mode |
person_display_name, display_name_in_record | A POST /v1/scopes or PUT /v1/scopes/tree that sets tree.display_name on a person or employee record, and on any other; and, when read, the records that hold one (classes.records) | CORTEX_PERSON_DISPLAY_NAME_ENFORCE, CORTEX_DISPLAY_NAME_IN_RECORD_ENFORCE (422 INVALID_SCOPE_TREE) |
audit_retention | When read, the tenant's audit rows past the retention's cutoff (rows_past_retention) and those this node's daily sweep deleted since its start (rows_deleted), where CORTEX_DEPLOYMENT_PRESET names a preset or CORTEX_AUDIT_RETENTION sets one (zeros otherwise); a tenant root org:<id> counts the rows of billing tenant <id>, the id an audit row names, and a root of another type counts none | CORTEX_AUDIT_RETENTION_ENFORCE (the sweep deletes them) |
legacy_write | A non-human write from a token carrying none of act, app, client and run, before CORTEX_LEGACY_WRITE_CUTOFF, reason legacy_write | none |
delivery_gate | A row the delivery gate's home check would withhold, served because its switch is off, link person, reason home_not_readable, one per row | CORTEX_DELIVERY_GATE_ENFORCE |
explicit_grant_reach and commitment_reach join the same route in later releases. Each would-deny also
writes a decision line under the tracing target cortex_api::decision (CORTEX_DECISION_LOG=off|report|denials|all,
default denials, which a value that does not parse also reads as, with a warning; rate limited per tenant, route,
check, link and scope; a mint's line never), naming this node, its
shard and its term, and GET /metrics carries cortexdb_access_report_requests_total{check, route, outcome} and
cortexdb_access_report_would_deny_total{check, route, link} without a tenant label.
GET /v1/admin/access/report?scope=org:acme
200
{"scope": "org:acme", "node": 1, "shard": 0, "counting_since": "2026-11-02T10:00:00Z",
"checks": [
{"check": "subject_shadow", "requests": 0,
"outcomes": {"match": 0, "would_deny": 0, "invalid_token": 0, "operator_plane": 0,
"not_evaluated": 0, "shadow_dropped": 0}, "routes": []},
{"check": "mint_lifetime", "requests": 120, "outcomes": {"match": 119, "would_deny": 1},
"routes": [{"method": "POST", "route": "/v1/auth/tokens", "requests": 3, "would_deny": 1,
"links": {}, "reasons": {"ttl_too_long": 1}, "capabilities": {},
"last_would_deny": {"at": "2026-11-02T11:00:00Z", "request_id": "req_0197f0c1",
"reason": "ttl_too_long", "scope": "org:acme/user:alice"}}]}],
"tenant_settings": {"scope": "org:acme", "operator_data_reads": {"mode": "deny", "source": "deployment"}}}
(The example shows two of the fourteen checks.)
| Field | Type | Notes |
|---|---|---|
scope | string | The tenant root the counts are for (a deeper ?scope= reports its tenant) |
node, shard | int | This node and the shard it holds: 1 and 0 on a plain node |
counting_since | string | Every count was made since: the later of the facility's start, the last change of the term this node leads in, and the last eviction of a tenant |
checks[] | array | {check, requests, outcomes, routes, classes?, partial?, cursor?}: outcomes holds match and would_deny (and subject_shadow's four more), zeros included; classes the counts by class, absent for a check that has none; partial and cursor only on a cut legacy_machine_written read |
checks[].routes[] | array | Per matched route template and method: requests, would_deny, links, reasons, capabilities and last_would_deny ({at, request_id, link?, reason, scope, capability?}, or null); past 256 routes a check counts the rest under (other) |
tenant_settings | object | tenant_access_settings_v1: the tenant's operator mode and readiness override, as GET /v1/admin/access/tenant-settings answers them (§8.15.3) |
| Parameter | Type | Notes |
|---|---|---|
scope | string | Required: the tenant root |
after | string | legacy_machine_written's cursor from an earlier read: the count resumes after it, so a client adds the reads up |
Errors: 400 INVALID_QUERY (no scope); 403 POLICY_DENIED (not the trusted operator, or no diagnostics.read,
details.capability); 409 ACCESS_REPORT_OFF (after the authorization checks, details.variable: "CORTEX_ACCESS_REPORT"); 422 INVALID_SCOPE_GRAMMAR (scope not a scope path); 422 INVALID_CURSOR (after is not a
cursor this report answered, details.field: "after"); 503 WAL_UNAVAILABLE (the root's rows did not read for
legacy_machine_written; retriable); 500 INTERNAL_ERROR (the read-time count did
not finish; retriable).
8.30.2 POST /v1/admin/access/tenant-binding?scope=<root>
Capability: the trusted operator only. Capability name principal_chain_v1 (DB-16,
docs/shared_memory/IDENTITY_AND_API_CONTRACT.md §5.6.3, §8 D6).
Under the root (the first segment of ?scope=; a deeper scope names its root), the records and tombstones bound to the
billing tenant from (for example default, the static key's) are bound to the tenant the root names: org:<id> binds
<id>. A record or tombstone moves when its binding is from, whatever its path implies; one with no binding stays. A
root with no record is registered, bound to that tenant, with the caller's X-Cortex-Actor as its only Owner and no tree,
so later registrations have a record to inherit from. A run that registers the root is an in-band path, as the key's registration through POST /v1/scopes is: under
CORTEX_OPERATOR_DATA_READS=deny (or the tenant's deny) it needs X-Cortex-Break-Glass, else 403 BREAK_GLASS_REQUIRED (details {mode, class: "in_band", route}); under audit it is counted. A dry run, and a run at
a root that has its record, register nothing and need none. Every 200, a dry run's included, says how the operator
plane decides the run in operator_plane (since 0.14.1), so a dry run tells the caller what its run will need.
POST /v1/admin/access/tenant-binding?scope=org:acme
{"from": "default", "dry_run": false}
200
{"scope": "org:acme", "from": "default", "to": "acme", "records": 42, "tombstones": 3,
"remaining": 0, "root_registered": false, "dry_run": false,
"operator_plane": {"registers_root": false, "in_band": false, "mode": "deny", "break_glass_required": false},
"consistency_token": "ct1.eyJyIjoib3JnOmFjbWUiLCJpIjoiMDE5MmYzYWEtMDAwMC03MDAwLTgwMDAtMDAwMDAwMDAwMDAxIiwiZSI6MywidiI6NDEsIm8iOjEyMDd9"}
| Field | Type | Notes |
|---|---|---|
from | string | Required: the billing tenant to move from; not blank, and not the root's own tenant |
dry_run | bool | Default true: nothing changes, and the answer says what would move (remaining their sum, root_registered: false). No other field is accepted |
root_registered says whether this call registered the root: false on a dry run, which registers nothing.
operator_plane (since 0.14.1) says how the operator plane decides the run, this call's own or, on a dry run, the run it
stands for, judged as that run judges it and deciding nothing:
| Field | Type | Notes |
|---|---|---|
registers_root | bool | The root has no record, so the run registers it |
in_band | bool | The run registers the root and is the operator key's: an in-band path, as the key's POST /v1/scopes is |
mode | string | The tenant's effective operator mode, allow, audit or deny (its own, else the deployment's) |
break_glass_required | bool | in_band under deny: the run needs X-Cortex-Break-Glass, else 403 BREAK_GLASS_REQUIRED; under audit it is counted and served |
The move runs in batches whose entries encode within 4 MiB less 64 KiB (one entry at least), each durable on its own: one
PutScopeEntries on a cluster owner, one journal line on a plain node. A crash or a refusal between two leaves the rest
bound to from, remaining counts what is still bound to it once the call is done, and running the route again is safe.
Every 200, a dry run's included, ends with consistency_token (§6.11): a token at the root of ?scope=, issued once the
batches are done, at this node's registry revision and indexed watermark, so a read with consistency.at_least of it sees
at least the binding; derived_through follows it once this node's enrichment has finished a pass. A token this node
cannot issue leaves the answer without one, since the change has committed. With CORTEX_OPERATOR_INHERIT_TENANT=on
(default off; an [engine] variable on a cluster) the trusted operator's later registrations and first writes take the
binding of the record that governs them, so a rebind holds. On a cluster the ingress routes the route by the root.
Errors: 400 INVALID_QUERY (no scope, or not a scope path); 403 POLICY_DENIED (not the trusted operator), 403 BREAK_GLASS_REQUIRED (above); 422 INVALID_BODY (not {from, dry_run?}, the root is not an org: root, from blank or the root's own tenant); and as for
registry writes, each safe to run again: 409 SCOPE_STATE_CHANGED (retriable since 0.14.0), 409 ACCESS_LIMIT_REACHED
(not retriable: registering the root would pass a limit), 503 SCOPE_STORAGE_UNAVAILABLE (a batch was not stored) and 503 WAL_OUTCOME_UNKNOWN (an unknown outcome; it was SCOPE_MUTATION_UNKNOWN), both retriable since
0.14.0 (0.13.x said retriable: false for each), and on a clustered owner a batch the shard did not take answers
the shard's own code and retriable instead, as the registry routes answer it (§8.8); 500 SCOPE_STORAGE_MISCONFIGURED (not retriable, details.reason, §8.8);
500 INTERNAL_ERROR (the binding did not finish).
8.30.3 POST /v1/admin/auth/reload
Capability: the trusted operator only; node-local. Capability name principal_chain_v1 (DB-16,
docs/shared_memory/IDENTITY_AND_API_CONTRACT.md §5.6.4).
Re-reads the issuers file this node verifies external tokens with (CORTEX_AUTH_ISSUERS_FILE on a plain node, [auth] issuers_file on a data node), checks it by every rule, and only then swaps the whole set of entries at once: an entry
added verifies from the swap; one removed, disabled, or whose kid is in revoked_kids stops verifying at once; a
tenant or an application added to an entry is accepted at once. An entry whose jwks_url is unchanged keeps its cached
and persisted key sets. A request in flight finishes under the set it started with, and a file that breaks a rule leaves
the running set as it was. The body is empty, blank or {}.
POST /v1/admin/auth/reload
200
{"reloaded_at": "2026-11-02T10:00:00.123456789+00:00", "entries": 2, "changed": ["okta"],
"auth_issuers_sha256": "9f2c4e0a7b3d5e1f8a6c2b4d0e9f7a5c3b1d8e6f4a2c0b9d7e5f3a1c8b6d4e2f"}
| Field | Type | Notes |
|---|---|---|
reloaded_at | string | When this reload swapped the set |
entries | int | The entries the file holds now |
changed | array | The ids of the entries added, removed or changed by this reload, sorted |
auth_issuers_sha256 | string | SHA-256 of the parsed file in canonical JSON, key material and deployment_minters included: what /node/v1/status reports and cortexdb admin status compares |
Nothing in the file is replicated: on a cluster the ingress does not route this route (501 CLUSTER_ROUTE_UNSUPPORTED),
and the operator calls it on each data node with cortexdb admin node call --id <node> POST /v1/admin/auth/reload;
cortexdb admin status prints AUTH_ISSUERS_DIVERGED until every data node has reloaded the same file. GET /v1/admin/metrics auth shows the running set, and GET /metrics counts each reload in
cortexdb_auth_reloads_total{outcome} (ok or refused).
Errors: 403 POLICY_DENIED (not the trusted operator); 422 AUTH_CONFIG_INVALID (the file breaks a rule:
details.entry, the entry's id or null for a rule of the whole file, and details.rule name it; the running entries
are kept); 422 INVALID_BODY (a body other than empty, blank or {}); 503 NOT_CONFIGURED (this node has no issuers
file; not retriable); 500 INTERNAL_ERROR (the reload did not finish).
8.31 The HTTP MCP server (/mcp)
Capability: mcp_http_v1, listed since 0.14.0 and flag-gated by CORTEX_MCP (off by
default): while it is off the name is withheld from GET /v1/admin/version and every route below
answers 404 NOT_FOUND. Each tool call then needs what its REST route needs.
The Model Context Protocol over streamable HTTP, protocol versions 2026-07-28, 2025-11-25,
2025-06-18 and 2025-03-26: stateless, JSON responses only (no event stream), one JSON-RPC 2.0
message per POST. An OAuth 2.1 resource server: every call is authenticated alone by its own
bearer, which must be a principal's signed token (one the deployment minted, or one an
issuers-file entry maps, such as an enterprise IdP's access token, the entry's alias mapping the
resource's aud to a tenant). The static operator key and an unsigned actor are refused
401 INVALID_TOKEN (on an auth-disabled server every call runs as its local actor).
X-Cortex-Actor may be left out: the caller is the token's sub. No Mcp-Session-Id is issued,
and one sent is ignored: no session carries an identity. A voice call's session (call_brief, and
session on a voice recall) is CortexDB's call session (§8.3.3), named by the call's id: it is no
MCP session, and no MCP session names one. The bearer is never passed on: each tool
call is the REST request the same credential would make, run in process, so the same checks decide
it and every refusal reaches the decision-audit stream (an inner request's id is this request's
X-Request-Id followed by .1, .2, …). Every response carries Cache-Control: no-store. A
cluster ingress routes none of these routes (501 CLUSTER_ROUTE_UNSUPPORTED).
| Setting | Default | Meaning |
|---|---|---|
CORTEX_MCP | off | on serves the routes |
CORTEX_MCP_PROFILE | read | read serves recall, decision_history, explain, memory_why, memory_about and call_brief; write adds remember, forget and correct |
CORTEX_MCP_SCOPES | org:{tenant}/{principal}/* | The scope allowlist, the caller's own region by default ({principal} is the caller's principal id, {tenant} its billing tenant); it only narrows, and the scope's own checks still decide. A scope path holds no ., so a principal an issuers-file entry maps in prefix or hash mode (user:<namespace>.<value>) has no own region, and the default names no scope for it: each of its tool calls answers SCOPE_NOT_ALLOWLISTED. Map such callers in directory mode to principal ids that hold no . (SCIM's user:<hex> ids are such), or list the scopes they act in |
CORTEX_MCP_RESOURCE | this request's origin and /mcp | The resource URI the metadata and the 401 challenge name; set it behind a proxy that rewrites Host |
CORTEX_MCP_AUTHORIZATION_SERVERS | every issuers-file iss that is an http(s) URL | The metadata's authorization_servers |
CORTEX_MCP_ALLOWED_ORIGINS | none | Browser origins admitted (* admits any) |
A setting that does not parse refuses CORTEX_MCP=on at boot (exit 78 MCP_CONFIG_INVALID), and so does CORTEX_MCP=on
in a cluster data node's [engine]: the server runs on a plain node, since an ingress cannot route a call whose scope
is inside its params.
Origins. A request with an Origin header is refused 403 ORIGIN_NOT_ALLOWED
(details.origin) unless CORTEX_MCP_ALLOWED_ORIGINS lists that origin or it is the origin of
CORTEX_MCP_RESOURCE — never admitted by the request's own Host, which a DNS-rebinding page
controls. A client that sends no Origin, as every non-browser client does, is not asked. /mcp keeps the server's
CORS policy, which allows no MCP header (MCP-Protocol-Version among them), so a browser-based MCP client is not
supported yet.
8.31.1 POST /mcp
{"jsonrpc": "2.0", "id": 7, "method": "tools/call",
"params": {"name": "recall", "arguments": {"query": "what did we decide about the database?", "when": "last week"}}}
| Method | Result |
|---|---|
initialize | protocolVersion (the client's when served, else 2026-07-28), capabilities: {"tools": {"listChanged": false}}, serverInfo: {"name": "cortexdb", "version"}, instructions |
ping | {} |
tools/list | The profile's tools only, each with inputSchema and annotations (readOnlyHint, destructiveHint, idempotentHint, openWorldHint: false), plus ttlMs: 60000 and cacheScope: "private" |
tools/call | {"content": [{"type": "text", "text"}], "structuredContent", "isError", "cacheScope": "private"} |
A notification (no id) or a client's response (no method) is answered 202 with no body. A
tool's own failure, a REST route's refusal or this server's, is a result with isError: true and
the route's error envelope in structuredContent; the text is cut at 256 KiB and marked
[truncated].
| Tool | Profile | Runs | Arguments |
|---|---|---|---|
recall | read | POST /v1/recall | query (required); since and until (RFC 3339 capture-time bounds) or when (a phrase such as last week, read leniently); max_tokens (100–16000); profile (standard, the default, or voice: recall_profile_voice_v1, the short read path of a live voice turn, §8.3; sent with no view, since a voice recall reads granular, and with max_tokens 400 unless the call names one); session (the conversation session, which a read-time use rule reads, §8.32.5; in voice mode also the call's session, whose working set answers a voice recall, §8.3.3); scope |
decision_history | read | the scope's beliefs, then GET /v1/beliefs/history for each | about (every word must appear in the belief's claim: subject, relation or value), or belief_id (a belief homed inside the allowlist); limit (1–10, default 5); scope. Newest revision first |
explain | read | POST /v1/access/explain | memory_id; role (summary, reader, writer, owner; default reader); scope. Changes nothing |
memory_why | read | derivation_provenance_v1 (new in 0.15.0): for a fact, GET /v1/facts/{id}?include=derivation, then GET /v1/derivation/decisions for its first five source memories; for a belief, GET /v1/beliefs/why?include=derivation; for a memory, GET /v1/derivation/decisions | memory_id (required: a fact_, belief_ or evt_ id); scope. Every read names scope as its ?scope=, and a fact or belief must be homed inside the allowlist (SCOPE_NOT_ALLOWLISTED otherwise). Where the allowlist holds a scope but not what lies under it, a decision is read only for a memory found exactly at that scope (GET /v1/events/{id}?scope= first). Answers how the row was made (the derivation object, §7.4.3) and what became of each memory's derivation (§8.7.22), in words and as the routes' JSON; a source memory whose decision is refused is named with its error, and the tool still answers. Below format 10 a memory's decision is the route's 503 FORMAT_UPGRADE_PENDING. Changes nothing |
memory_about | read | corrections_v1 (new in 0.15.0): GET /v1/memory/about (§8.7.25) | include_corrections (sends include=corrections); limit (1–100, default 50); cursor (the previous answer's next_cursor); scope. Answers what is known about the scope's subject: the current facts and beliefs homed exactly at scope that the caller may read, each with the memories it rests on (id, observation time and snippet), and with include_corrections the scope's corrections, in words and as the route's JSON (with scope). Below format 10 it is the route's 503 FORMAT_UPGRADE_PENDING; below format 11 the route lists no corrections, and the text says so. Changes nothing |
call_brief | read | voice_sessions_v1 (voice mode): POST /v1/sessions (§8.3.3) with profile: "voice" | session (required: the call's id, which the route checks: 1 to 256 bytes with no control character); query (the reason for the call: sent as brief.query); max_tokens (1–4000: brief.max_tokens); idle_timeout_s (30–14400); scope. Opens the caller's session of the call and answers its brief in words (whether it was started or was open already, the working set's state, the earlier calls, the brief's context_block, the warnings, and that each voice recall of the call names the session) and as the route's JSON. It writes no memory, so the read profile serves it, but it opens a session the server holds in RAM: annotated readOnlyHint: false, idempotentHint: true (the same start again reads the brief of the same session). Outside voice mode it is the route's 409 VOICE_SESSIONS_DISABLED, whose text says that a voice recall works without a session |
remember | write | POST /v1/experience | text (required); scope |
forget | write | POST /v1/forget, or POST /v1/forget/preview with preview: true | memory_ids (required, 1–100); note (kept as the forget's audit_note); preview; from_preview_id (a preview's id, not with preview); scope. Answers the receipt: the counts deleted per layer and the audit row id |
correct | write | corrections_v1 (new in 0.15.0): POST /v1/corrections (§8.7.24) | action (required: reject, replace, pin or confirm); target (required: {fact_id} or {claim: {subject, predicate, object, negated}}); bind (reject only: claim, subject_predicate or subject); value (replace only: {object, valid_from}); reason; idempotency_key; scope. Each is sent as the route's field of that name, and a field the route refuses is its 422 INVALID_BODY (details.field). Annotated destructiveHint: true: a reject deletes facts, and erases the memory of a typed triple it names. Answers the correction's id, its effects in words and as the route's JSON, and how to undo it: undo in structuredContent is {method: "DELETE", path: "/v1/corrections/{id}?scope=…"}, a route this server has no tool for. When a reject erased typed triples' memories, the tool reads the correction again (GET /v1/corrections/{id}): one that cited only those memories was erased with them, and is answered kept: false and undo: null, with nothing left to undo. A retry with the same idempotency_key answers the first attempt (replayed: true). Below format 11 it is the route's 503 FORMAT_UPGRADE_PENDING |
Every tool acts at scope, which must lie inside the allowlist; a tool that names none uses the
allowlist's first entry. A scope outside it, or a write tool under the read profile, is refused
inside the result (isError: true; SCOPE_NOT_ALLOWLISTED, READ_ONLY_PROFILE), each with a
decision line (reasons scope_not_allowlisted and read_only_profile). A correction governs the
facts at its scope and below it, so correct acts only at a scope whose whole subtree the
allowlist holds (an entry ending in /* at or above it), and is refused SCOPE_NOT_ALLOWLISTED,
with its line, at a scope the allowlist names alone. The destructive tools, forget and correct,
refuse an argument they do not apply with JSON-RPC error -32602 naming it, never dropping it
silently: forget deletes by memory id only, so capture_keys and idempotency_keys (§8.5,
forget_by_key_v1) are among them.
Errors: 400 with a JSON-RPC error body (id: null), not the error envelope: -32700 (not
JSON), -32600 (a batch or any message that is not one JSON object, or an MCP-Protocol-Version
header this server does not speak). JSON-RPC errors inside a 200: -32601 (a method not
served), -32602 (invalid params: no tool named, arguments not an object, a malformed argument, an
argument a destructive tool does not apply). 401 MISSING_TOKEN, INVALID_TOKEN (also the
operator key or an unsigned actor), EXPIRED_TOKEN, REVOKED_TOKEN, INVALID_TOKEN_SIGNATURE,
WRONG_TENANT, each with WWW-Authenticate: Bearer resource_metadata="<the metadata URL>", plus
error="invalid_token" when a credential was presented. 403 ORIGIN_NOT_ALLOWED. 404 NOT_FOUND
(CORTEX_MCP off). None is retriable.
8.31.2 GET /mcp and DELETE /mcp
This server opens no event stream and keeps no sessions: after the same origin check and
authentication as POST, both answer 405 METHOD_NOT_ALLOWED with Allow: POST.
8.31.3 GET /.well-known/oauth-protected-resource and GET /.well-known/oauth-protected-resource/mcp
Capability: none (no credential).
The RFC 9728 protected-resource metadata of /mcp: the second URL is the one RFC 9728 forms for
the resource /mcp, which a 401 from /mcp names; the first is for a client that probes the
host's root. Cache-Control: no-store, since without CORTEX_MCP_RESOURCE the document names
the request's own host.
{
"resource": "https://memory.example.com/mcp",
"authorization_servers": ["https://auth.example.com"],
"bearer_methods_supported": ["header"],
"resource_name": "CortexDB"
}
authorization_servers is absent when there is none. Errors: 404 NOT_FOUND (CORTEX_MCP off).
8.32 Derivation policies (/v1/derivation/policy, /policy/test, /templates, /taxonomy, /settings, /texts)
Capability: derivation_policy_v1 (new in 0.15.0, experimental: every response carries
X-Cortex-Stability: experimental). The policy read, the templates and the taxonomy are served at format 10 too; the
settings and texts routes answer 503 FORMAT_UPGRADE_PENDING on a shard armed below format 11. A derivation policy is
staged through change sets (§8.22.7).
Resolution. A scope's effective policy is read from the derive records along two walks and from subject settings, under the process ceiling:
- Restrictions accumulate over the derive records of the scope, its path ancestors and its org-chart chain (each
record's
tree.parent, else the path's parent): deny lists are unioned, allow lists intersected, the strictest value of a strictness order wins, budgets and lapse days take the minimum, a sealed compartment is sticky. A floor an org-chart parent skips still binds: a person's scope whose parent is a team cannot escape an application's deny. - Steering is nearest-wins along the org-chart chain the scope's
enrichwalks: instructions, examples, models, output language, episodes,on_unlisted_predicate, reviewers, each predicate's cardinality, conflict rule and synonyms, each custom topic by id. A field the nearest record leaves unset passes the question up. - Subject settings (§8.32.3) of the scope and its path ancestors add their restrictions; their consents lift a
deny_unless_consentcategory for the scope that holds them and its subtree, never a plain deny. - The ceiling: with enrichment off for the process, a scope outside
CORTEX_ENRICHMENT_SCOPE_PREFIXES, an effectiveenrich: offor a reference root, nothing derives whatever a policy says (derives: false). - No record anywhere is the empty policy,
dp1:none: today's behaviour exactly.
The policy hash is dp1: and 32 hex digits of a blake3 hash over the effective rules in canonical JSON, the ids of
the policy texts they name that exist, and the taxonomy, detector registry and gate versions: a text erased with its
source, or a release that changes a version, changes it. Reviewers, budgets and lapse days are effective rules but are
not hashed, and neither is the ceiling. Each fact the enrichment plane derives is stamped with the hash of the policy it
was derived under (include=derivation, §7.4.3).
Models and budgets. A policy's model and entity_model name a model the
operator lists in CORTEX_DERIVATION_MODELS (§8.22.7). The process builds one router per listed name at boot: with the
provider fleet (CORTEX_LLM_PROVIDERS), the provider of that name, else of that model, called alone; without it, that
model at the enrichment endpoint (CORTEX_ENRICHMENT_URL, else CORTEX_LLM_URL, else OpenAI's) with the enrichment
lane's key. The process's own extraction models keep their own routers. A listed name it cannot route is logged at boot
(DERIVATION_MODEL_UNROUTABLE), and a job under a policy that names it never runs on another model. A policy's
budget_usd_per_day holds ongoing extraction under it:
- every model call a job makes is priced from the price book (
CORTEX_MODEL_PRICES, then the provider fleet's rates, then the published ones; entity calls included) and added to the UTC day's spend of every budget-setting scope on the job's path, its org-chart chain included; - once one of them has spent its budget, the jobs under it wait for the next UTC midnight and then run as retries;
meanwhile an event's decision (§8.7.22) is
skipped, reasonbudget; - a call the price book cannot price spends the budget's whole day, because no dollar budget can hold a model with no
rate: declare the rate in
CORTEX_MODEL_PRICES(the boot lint names a listed model with none,DERIVATION_MODEL_UNPRICED); - the spend is a replicated counter per budget-setting scope and UTC day, which the shard's leader writes at most once a minute while it changes, so a leader change overspends by at most a minute of spend. Counters are purged after 7 days and do not move with a scope: the target starts its own.
Policy tests (§8.32.6) and reextract dry runs draw on their own budget, CORTEX_DERIVATION_BUDGET_USD per tenant per UTC day
(default 5; kept by the node that serves them, noted in the usage ledger so a restart does not reopen the day), and a
reextract job's approved cap may not exceed CORTEX_DERIVATION_BUDGET_MAX_USD (default 500). A value of either that is
not 0 to 1,000,000 US dollars refuses the boot (exit 78 DERIVATION_BUDGET_CONFIG). A data node takes all three settings
from its [engine] table.
Writer rules. A predicate's writers name who may set it: extraction (the
enrichment plane), triple (a typed triple a caller writes), declared_belief, correction (a correction's
replacement), review (an approved review decision), derived_by:<name> (a write stamped derived_by with that
name), app:service:<id> (a write by that service principal) or source:<label value> (a write, or an event it cites
as provenance, labelled source:<value>). Along a scope's path the lists intersect. A predicate's requires adds a
condition every write must meet, and the conditions along the path add up: {"label": "source:assessment"} is met
when the write itself, or an event it cites as provenance, carries the label. So "level": {"writers": ["triple"], "requires": {"label": "source:assessment"}} lets only a typed triple that is, or cites, an assessment set level.
The predicate is matched as the policy names it: through its built-in canonical and the policy's synonyms.
- Declared writes are checked before anything is proposed, at the scope the write lands in: typed triples on
POST /v1/experience, each bulk item,/v1/import/jsonllines and importer rows,POST /v1/beliefs(the claim's predicate) and a correction's replacement. A refusal is409 WRITER_NOT_ALLOWED(not retriable;details: {predicate, writers, requires},writersnull when any writer may), and nothing is stored; in a bulk only that item fails. A policy that does not read refuses the write with503 STORAGE_UNAVAILABLErather than admit it. - Extraction is judged by the gate as the enrichment plane learns: a candidate whose predicate's writers leave out
extraction(and everysource:label its event carries), or whose event does not meetrequires, is rejected under rulewriter.<predicate>, or held for review withreview.hold.refused_writers. - An event a write cites counts by what this node holds of it: a live event's labels, a sealed or expired event's
source:labels. Below format 11 no derive record exists, so no writer rule applies.
Producers outside the enrichment job. The background passes that derive
without an enrichment job read the same policy. Each still applies its own ceiling (the allowlist, enrich: off,
reference roots) and its own switch, and under no policy each does exactly what it did before.
- Input. An event feeds a producer only when the policy at its own scope lets its stage read it: the stage in
the policy's
stagesand the event'sdirectives.extract(factsfor the fact sweeper;understandingfor memory consolidation, knowledge synthesis, concept abstraction, concept reflection and rollup synthesis;episodesfor the episode builder), themode(and the subject's), and thesourcesrules. An event whose recorded outcome shows a denied topic or a candidate held for review is no input to a summary, a concept, a knowledge row, a concept reflection or a rollup synthesis (read under a policy, from the gate's record of the event: a data node's learned record, a single node's outcome journal). A fact a correction suppresses is no input to the fact consolidator or to concept reflection, and concept reflection purges the stored concepts that cite one. The fact consolidator never sees a pinned fact, and never supersedes or marks as duplicate a pinned fact or a fact whose predicate a writer rule governs. - Output. A swept triple and each fact the consolidator makes pass the gate's steps 1 to 11 as candidates of
the event they were learned from; one the gate holds becomes a held record of that event, for review (§7.6), and
when those records do not commit nothing of what was judged is stored and the pass tries again. Summaries, knowledge rows, concepts, rollup
items and episode summaries pass the policy's detectors: redacted with
redact_value, otherwise dropped (an episode keeps its events and loses its summary). - Joint derivations (one output from several scopes) take the union of every input scope's restrictions and
never blend a
compartment: sealedsubtree with its siblings: memory consolidation groups a sealed subtree's memories apart, knowledge synthesis and concept abstraction skip such a group, and a rollup leaves out the rows outside its home's compartments. - Belief refinement may not move a pinned or confirmed value's belief off
supported. - Episodes (
episodes, §7.2):builder: offbuilds no episode at the scope and removes the ones the builder made there (declared episodes are records, not builder output, and stay);session_gapreplaces the two-hour gap;group_by_label: "<key>"never puts events whose<key>:labels hold different values in one episode. - A policy that does not read derives nothing from its scope and changes nothing a producer made there; the pass tries again on its next run.
8.32.1 GET /v1/derivation/policy?scope=<path>[&include=texts]
Capability: derivation_policy_v1. A Reader at the scope (scope.read.local), or the trusted operator;
include=texts needs an Owner with derivation.administer.scope or policy.administer.scope (for the operator key it
is a class admin_content read, §8.15.3). Format 10 or more.
GET /v1/derivation/policy?scope=org:acme/app:companion/user:bob
200
{"scope": "org:acme/app:companion/user:bob", "policy_hash": "dp1:7a01ee39c4d2b18f05e6a9d3c7b14e20", "format_armed": 11,
"derives": true,
"ceiling": {"process_enrichment": "on", "enrichment_scope_allowed": true, "enrich": "on", "reference_root": false,
"derives": true},
"mode": {"value": "explicit", "set_at": [{"scope": "org:acme/app:companion/user:bob", "via": "settings"}]},
"restrictions": [
{"rule": "topics.deny", "value": ["credentials", "financial_account", "government_id", "payment_card"],
"set_at": [{"scope": "org:acme/app:companion", "via": "path"}]},
{"rule": "topics.deny_unless_consent", "value": ["health", "religion_belief"],
"set_at": [{"scope": "org:acme/app:companion", "via": "path"}], "consented": ["health"]},
{"rule": "settings.deny_predicates", "value": ["diet"],
"set_at": [{"scope": "org:acme/app:companion/user:bob", "via": "settings"}]}],
"steering": {"instructions": {"value": ["ptx_0196f2a1c3d47e8f9a0b1c2d3e4f5a6c"], "set_at": "org:acme/app:companion",
"via": "path", "texts": [{"id": "ptx_0196f2a1c3d47e8f9a0b1c2d3e4f5a6c", "bytes": 46}],
"count": 1},
"model": {"value": null, "effective": "claude-haiku-5-5"},
"entity_model": {"value": null, "effective": null},
"on_unlisted_predicate": {"value": "contest", "set_at": "org:acme/app:companion", "via": "path"}},
"custom_topics": [], "predicates": [],
"ineffective": [{"scope": "org:acme/app:companion/user:bob", "via": "path", "rule": "topics.allow",
"value": ["health"], "overridden_by": "org:acme/app:companion", "reason": "denied"}],
"versions": {"taxonomy": 1, "detectors": 1, "gate": 1}}
Each restriction names every record that takes part in it (set_at, via: path, tree or settings), each
steering field the one scope that set it, model and entity_model the model that runs when no policy names one, a
text the policy names that is gone missing: true. ineffective lists the values set on the path that have no effect
here, and why (denied, not_allowed, looser, shadowed, off_chain, consent_without_rule,
consent_over_deny). format_armed is the shard's armed apply format: below 11 no policy can exist yet, and the route
answers the empty policy. The route reads the registry and the shard's records now, never a cache, so a change's own
answer and a read after it agree. include=texts adds texts, each named text present with its content (id, role,
text or input and memories, synthetic, sources, language, by, at, bytes).
Errors: 400 INVALID_QUERY (scope missing, an include other than texts); 403 POLICY_DENIED; 422 INVALID_SCOPE_GRAMMAR; 503 STORAGE_UNAVAILABLE (the records did not read, retriable; or one of a later version this
binary cannot read, details.reason: record_unreadable, not retriable). On a cluster the ingress routes it by
?scope='s root.
8.32.2 GET /v1/derivation/templates and GET /v1/derivation/taxonomy
Capability: derivation_policy_v1. Any authenticated caller: static data compiled into the binary. Format 10 or
more. A cluster ingress serves its own binary's copy.
GET /v1/derivation/templates answers {"templates": [{"name", "version", "id", "summary", "body"}]}: consumer@1
(protective defaults for consumer and companion apps), minimal@1 (remember only what the user asks), enterprise@1
(work memory over chat, tickets and documents), and minor@1 and health_app@1, which the read-time use rule follows
with. Applying a template copies its body into a derive record (from_template is informational), so a binary upgrade
never changes a stored policy. GET /v1/derivation/taxonomy answers the taxonomy (version 1): its categories
(health, sex_life_orientation, gender_identity, religion_belief, political_opinion, union_membership,
racial_ethnic_origin, genetic, biometric, neural, precise_geolocation, government_id,
financial_account, payment_card, credentials, criminal_record, immigration_status,
communications_content, minor_status, personal_matters), the groups that name them (gdpr_art9, cpra_spi,
wa_consumer_health, ny_art48_personal, government_ids, payment_data, secrets), and the detector registry
(detectors: its version, packs and detectors, each with its precision class and locales). Topic labels are a
model's judgments; a detector's verdict is exact.
8.32.3 PUT, GET, DELETE /v1/derivation/settings
Capability: derivation_policy_v1. PUT and DELETE: a Writer at the scope with scope.write. GET: a Reader with
scope.read.local. Format 11.
A subject's own settings for one scope, which an application or its end user writes with no change set and no preview: they hold restrictions and consents only, so they take effect at once.
PUT /v1/derivation/settings
{"scope": "org:acme/app:companion/user:bob", "mode": "explicit", "deny_predicates": ["diet"],
"consents": {"health": {"purpose": "health coaching"}}}
200
{"scope": "org:acme/app:companion/user:bob",
"settings": {"v": 1, "mode": "explicit", "deny_predicates": ["diet"],
"consents": {"health": {"purpose": "health coaching", "at": "2026-11-07T10:00:00Z", "until": null}},
"by": "service:companion-app", "at": "2026-11-07T10:00:00Z"},
"policy_hash": "dp1:7a01ee39c4d2b18f05e6a9d3c7b14e20", "revision": 3, "consistency_token": "ct1.…"}
| Field | Effect |
|---|---|
mode | off, explicit, review, automatic: only stricter than the effective policy's (and than an ancestor's settings); a looser one is 422 DERIVATION_POLICY_WIDENS |
deny_topics, deny_predicates | Taxonomy categories or groups or custom topics, and canonical predicates, denied for the subject (at most 64 each) |
consents | By topic: {"purpose", "until"?} (a purpose up to 256 bytes, at most 32 consents). Lifts a deny_unless_consent topic while until has not passed; never a plain deny. A consent the previous record held with the same purpose and end keeps the time it was given |
limit_spi | Denies every cpra_spi category for the subject |
objection | The subject's mode becomes explicit |
attributes | age_assured_adult, age_assured_at, minor: inputs of the read-time use rule, which the application asserts |
PUT replaces the whole record: a field it omits is removed, so a client reads it, changes it and writes it back. The
record is a replicated record of the root (at most 4 KiB), one per scope; revision is its place in the shard's
declared order, the same on every replica and higher with every put, and consistency_token covers the write. A put is
admitted at a critical disk. GET /v1/derivation/settings?scope= answers {"scope", "settings", "revision"}, or 404 NOT_FOUND. DELETE /v1/derivation/settings?scope= erases the record and answers {"erased": true|false, "policy_hash"}: an erasure (the record is personal data), whose feed row starts the log residual's cycle on every voter
(§11). The erasure is served after the license and its grace period have ended, as POST /v1/erasures is (since
0.15.0); PUT and GET answer the gate's 402 until a license is installed.
A put that gives, changes or withdraws a consent, and the erasure of a record that held one, writes an audit row of its
own (§14): action: "derivation_consent", gdpr: true, event_id the settings record's id, capability: "scope.write"
and, as request.body_hash, the peppered hash of the canonical JSON {"scope", "before", "after"} of the scope's
consents before and after the write, never the consents themselves. A put that leaves the consents as they were (a
consent the previous record held with the same purpose and end keeps its time) writes none.
Errors: 422 DERIVATION_POLICY_WIDENS, DERIVATION_POLICY_INVALID (details.field, details.reason), INVALID_BODY
(an unknown field), INVALID_SCOPE_GRAMMAR; 403 POLICY_DENIED; 404 NOT_FOUND (GET); 503 FORMAT_UPGRADE_PENDING,
STORAGE_UNAVAILABLE, and the shard's own (NOT_LEADER, WAL_UNAVAILABLE, WAL_OUTCOME_UNKNOWN, SCOPE_MOVING). On a
cluster the ingress routes PUT by the body's scope and GET and DELETE by ?scope=.
8.32.4 GET /v1/derivation/texts and POST /v1/derivation/texts/erase
Capability: derivation_policy_v1. GET: an Owner with derivation.administer.scope or policy.administer.scope
(class admin_content for the operator key). Erase: an Owner of the scope, or the trusted operator. Format 11.
Policy texts (instructions, examples and custom topics' descriptions) are immutable replicated records, created inline by a change set (§8.22.7): an edit is a new text with a new id, and a derive record names it, so a policy's hash moves with any edit without hashing a word of text.
GET /v1/derivation/texts?scope=org:acme
200
{"items": [{"id": "ptx_0196f2a1c3d47e8f9a0b1c2d3e4f5a6d", "role": "example", "scope": "org:acme/app:companion",
"synthetic": false, "sources": ["evt_0196f2a0c1d27b3e9a4f5d6c7b8a9e01"], "bytes": 212,
"named_by": ["org:acme/app:companion/attrs:derive"], "at": "2026-11-07T10:00:00Z", "by": "user:alice"}],
"next_cursor": null}
POST /v1/derivation/texts/erase
{"scope": "org:acme", "ids": ["ptx_0196f2a1c3d47e8f9a0b1c2d3e4f5a6d"], "reason": "example copied from a real conversation"}
200
{"erased": 1, "policies_affected": ["org:acme/app:companion/attrs:derive"],
"new_policy_hashes": ["dp1:4be1c0d29a7e3f5b6c8d0e1f2a3b4c5d"],
"receipt_id": "ptxe_0196f2a1c3d47e8f9a0b1c2d3e4f5a70", "audit_id": "audit_0196f2a1c3d47e8f9a0b1c2d3e4f5a71"}
GET lists the texts created at or under the scope, in id order (limit 1 to 1,000, default 100; cursor a page's
next_cursor), without their content (§8.32.1's include=texts serves it). The erase route erases the texts it names
that were created at or under the scope (an id it does not hold is not erased, so a repeat erases 0): an erasure,
whose feed row starts the log residual's cycle on every voter, served after the license and its grace period have
ended, as POST /v1/erasures is (since 0.15.0; GET waits for a license). The derive records that named them keep
the ids; resolution skips a missing text and new_policy_hashes gives each affected policy's scope's hash after it. A
text also goes:
- with any event an example cites (the erasure of the event, a person's erasure included, erases the example in the same batch, on every replica);
- with a tombstone of the scope it was created at, and with its tenant;
- with the leader's daily sweep, once no active derivation policy and no open change set has named it for 30 days (a rollback within the window can name it again; a node that leads without having seen a text unnamed starts its clock then, so a failover only delays a sweep).
An erasure that erased a text writes an audit row (§14: action: "derivation_text_erase", gdpr: true, event_id its
receipt's id, capability: "derivation.administer.scope") and a receipt on the node that ran it, as a
/v1/erasures job's is (receipt_id): the texts and the scopes they were created at, the policies affected and their
new hashes, who and when, and the audit row's id. Like every receipt it holds ids, counts and hashes, never content. The
reason (at most 512 bytes) is free text that can name a person, so it is kept nowhere: not in the receipt, the audit
row, a log line or the answer. The row's request.body_hash is the reason's peppered hash (the node's audit pepper over
its UTF-8 bytes; over no bytes without a reason), and the receipt's reason_sha256 is the same hash (absent without a
reason, or on a node that keeps no audit trail). The caller confirms which reason it gave by hashing it again: POST /v1/audit/verify with the row's id and the reason as a raw string answers match: true. A whole-scope erasure
(/v1/erasures, a confirmed whole-scope forget, a tenant's deletion) of the receipt's scope or of a scope a text was
created at erases the receipt, on the node that runs the erasure. receipt_id is absent when the node keeps no
receipts, audit_id when it keeps no audit trail, and both when nothing was erased.
Errors: 400 INVALID_QUERY (limit, cursor); 403 POLICY_DENIED; 422 INVALID_BODY (ids empty or above 1,024,
an id that is no ptx_ id, a reason above 512 bytes), INVALID_SCOPE_GRAMMAR; 503 FORMAT_UPGRADE_PENDING,
STORAGE_UNAVAILABLE, and the shard's own. On a cluster the ingress routes GET by ?scope= and the erasure by the
body's scope.
8.32.5 Read-time use rules (derivation_use_rules_v1, new in 0.15.0)
Capability: derivation_use_rules_v1. Experimental. A format-11 name: the rule lives in a derive record, which a
shard armed below 11 cannot hold, so there session is accepted and nothing is withheld.
A derive record's use field (§8.22.7) holds read-time use rules (their first phase). They
limit the use of memory, never its storage: New York's General Business Law Article 48 forbids using information a
user gave more than twelve hours earlier, or in an earlier session, unless the operator has established that the user
is not a minor. The minor@1 template carries the rule ny_unassured_window; no other template does, and a policy may
carry its own:
"use": {"rules": [{"id": "ny_unassured_window", "unless": "age_assured_adult",
"withhold": {"captured_before": "12h", "other_sessions": true}, "content": "all"}]}
- Where a rule is in force. Use rules are restrictions: every rule a derive record on a scope's path or org-tree
chain carries applies there and below (§8.32.1). A rule with
unless: "age_assured_adult"is not in force for a subject whose settings (§8.32.3, the scope's or a path ancestor's) assertattributes.age_assured_adult: trueand none denies it; a subject asserted to be aminoris never exempt. The application asserts the attribute; CortexDB verifies no age and stores no age-assurance evidence. Setting or clearing it takes effect at the next read. - What is withheld. Where a rule is in force at an event's scope, the event is withheld from a read when it was
captured before
now − captured_before(its id's UUIDv7 time;nowis the request's clock) or, withother_sessions, in another session than the read'ssession. An event's session is itssource.fragments[].locator.session_id(§3.5.3), else itssession:<id>label; one with neither, or naming more than one, is a session of its own. A read withoutsessioncounts every event as another session's. A fact, belief, episode, concept or rollup is withheld when every event it stands for is (a belief by its event supports and its fact supports' events, a concept by its events and its facts' events); one that stands for no event is judged as a capture of its own at its recorded time, in no session. - Where.
POST /v1/recalland/v1/recall/stream(every source of candidates: ranked retrieval, the small-scope probe, theorder: "recency"tail, which takes the newest events the rule lets through,newest_of_kinds, the supplements, the evidence boost and the lineage injection, and the derived layers and rollups),POST /v1/answer(every recall pass, the event-kind coverage, and the fact, belief, episode and concept reads its prompt sections draw on; the artifact plane, meaning its routes, the certified reducer, summaries, occurrences, working memory and conflict notes, reads nothing where a rule is in force at the scope),POST /v1/compose, the/mcprecalltool, and the cohort lanes (/v1/answerwithcohort,/v1/cohort/queryand/v1/cohort/vocabulary), which read no data-bearing scope a rule governs for the read, since a cohort spans subjects whose sessions are never the read's (503 COHORT_WARMINGwhile the scope-partition map that names those scopes is still building after a boot). - Where not. The subject's own access reads are never filtered:
GET /v1/events,/v1/facts,/v1/beliefs,/v1/episodes,GET /v1/memory/about(§8.7.25) and the export. Access and deletion rights stay whole. - Reuse and caches. A pack reused through
use_pack_idis404 NOT_FOUNDwhen the rule withholds any of its rows from the reusing read. A stored answer (§8.4.1) is served only to a read of the same session under the same rules in force, and never under a rule with acaptured_beforewindow; setting or clearingage_assured_adultchanges the state an entry binds. - What a read says. A pack, an answer and a composition the rule withheld anything from carry
use_rule_withheld: <n> events from earlier sessionslast inwarnings(n distinct events, withheld directly or through every row derived from them). It is not a degraded source and does not setpartial.
POST /v1/recall
{"scope": "org:acme/app:companion/user:bob", "query": "how is my asthma", "session": "chat-2026-11-08-a"}
200
{"pack_id": "pack_…", "layers": {"events": [ … this session's events … ]}, "context_block": "…",
"warnings": ["use_rule_withheld: 14 events from earlier sessions"]}
The rule judges nothing with a model, verifies no age and deletes nothing: retention and erasure do that. Phase two
(content: "personal", withholding only rows labelled with a personal topic) is not built; this binary refuses the
value in a derive record (422 DERIVATION_POLICY_INVALID).
8.32.6 POST /v1/derivation/policy/test
Capability: derivation_policy_v1. Experimental. An Owner of the scope with derivation.administer.scope (or
policy.administer.scope) and llm.invoke, who reads every sample event (class data_rows for the operator key).
Format 10 or more. On a cluster the root's leader runs it, as a read: a lost answer is never re-sent, which would call
the model again.
It runs extraction and the gate over a sample of events under a draft policy and answers what each candidate's verdict would be. It writes nothing: no fact, held record, outcome, learned record or spend counter, and no model response is cached.
POST /v1/derivation/policy/test
{"scope": "org:acme/app:companion",
"policy": {"v": 1, "topics": {"deny": ["gdpr_art9"]}, "on_unlisted_predicate": "contest"},
"sample": {"recent": 50},
"compare_with_active": true, "max_cost_usd": 1.00}
200
{"policy_hash": "dp1:9a14c0d29a7e3f5b6c8d0e1f2a3b4c5d", "active_policy_hash": "dp1:none",
"events": [{"event_id": "evt_0196…", "outcome": "learned",
"candidates": [
{"kind": "triple", "subject": "user", "predicate": "diet", "object": "vegetarian",
"quote": "I'm vegetarian", "topic": "food", "verdict": "accepted", "rule": "accept.default",
"active": "accepted", "active_rule": "accept.default"},
{"kind": "triple", "subject": "user", "predicate": "has_condition", "object": "asthma",
"topic": "health", "verdict": "rejected", "rule": "topic.deny.health",
"active": "accepted", "active_rule": "accept.default"}]}],
"summary": {"events": 50, "accepted": 61, "held": 0,
"rejected": {"topic.deny.health": 4, "detector.payment_card": 1}, "unlabelled": 3},
"diff": {"added": 0, "removed": 5, "changed_conflict_rule": 2},
"cost": {"calls": 12, "input_tokens": 51200, "output_tokens": 6100, "usd": 0.31, "unpriced_calls": 0,
"model": "claude-haiku-5-5"}}
- The draft.
policyis a derive body (v1 when absent), validated as a change set would stage it at<scope>/attrs:derive(DERIVATION_POLICY_INVALID,DERIVATION_POLICY_WIDENS,DERIVATION_MODEL_NOT_ALLOWED,DERIVATION_TEXT_INVALID, §8.22.7), and takes the place of the scope's own derive record only: the ancestors' restrictions still apply, so a draft cannot test a looser policy than the scope may have. Instead,changeset: {"id", "scope"}names the caller's own staged change set (its client id and root): the registry as it would leave it. Name exactly one. - The sample.
sample.recent(1 to 200) takes the newest captured events at or under the scope that the caller reads (a bounded newest-first scan of the log);sample.event_ids(at most 200) names them, and an event this node does not hold, or one the caller may not read, answers404 NOT_FOUNDwithdetails.event_id. Each sample event passes the delivery gate by its atoms and enters the chain's read record (§8.7.1). - The run. Each event's job is built as the scanner builds it, G-0 under the draft (an event the draft derives
nothing from is
skipped,reasonits outcome, such asskipped.mode_off), and run as the enrichment plane runs it, with the models the draft names. Each candidate is then judged alone for its verdict and its rule (accepted,heldorrejected), under the draft and, withcompare_with_active, under the policy in force (active,active_rule, with the active policy's hash and adiff: candidates accepted by only one of them, and those both accept under another conflict rule). An event'soutcomeand thesummary's counts are the full run's.unlabelledcounts the candidates with no topic label the draft offered (0 when it has no topic rule). - Rejected candidates are shown with their text. The answer is transient, to a caller who may read the sample events anyway; nothing of it is stored or logged.
- Cost.
max_cost_usd(default 1) caps the run. With a priced model the estimate is refused before any call when it is above the cap; the cap is reserved of the tenant's daily budget of tests and dry runs (CORTEX_DERIVATION_BUDGET_USD, §8.32), which keeps what the calls spent; and the run stops once its calls spent it: the events left arenot_run,reason: "max_cost_usd". A model the price book cannot price is refused, as no cap can hold it (a call that answers unpriced stops the run:reason: "unpriced_model").
Errors: 403 POLICY_DENIED; 404 NOT_FOUND (an event of sample.event_ids); 409 ENRICHMENT_OFF (the process has
enrichment off, or runs no extraction model); 422 ENRICHMENT_SCOPE_NOT_ALLOWED (a reference root, or outside
CORTEX_ENRICHMENT_SCOPE_PREFIXES), POLICY_TEST_TOO_LARGE (more than 200 events: details.events, max_events; an
estimate above the cap: details.events, estimate_usd, max_cost_usd; an unpriced model: details.reason: "unpriced_model", model; a tenant's day that cannot hold the cap: details.reason: "daily_budget", budget_usd,
spent_usd, remaining_usd), DERIVATION_POLICY_INVALID and the change sets' other validation codes,
INVALID_REQUEST (both or neither of policy and changeset, of recent and event_ids, or a max_cost_usd that is
not a positive number), INVALID_SCOPE_GRAMMAR; 503 PROVIDER_UNAVAILABLE, PROVIDER_SATURATED (the model provider
failed, retriable, details.event_id), FORMAT_UPGRADE_PENDING (below format 10), STORAGE_UNAVAILABLE.
8.32.7 Re-derivation jobs: POST /v1/derivation/rederive, GET and POST …/{job_id}/cancel
Capability: derivation_rederive_v1 (new in 0.15.0). Experimental. Format 11 (503 FORMAT_UPGRADE_PENDING below
it). A policy applies to what is derived from then on; a re-derivation brings what was derived before in line with the
policy in force. Two modes:
regatetightens the past for free. It re-applies the policies in force to the stored facts and the open held candidates of the subtree, from stored data (the fact's stamped topic, its text and quote, its claim, its event's role, actor, labels and directive), and calls no model. Each fact the policy now rejects is retired by a correction (§8.7.24) of originregatethat names its rule and the policy hash: a suppression, so no replica's later replay of the old learned record makes the fact again. Each open held candidate the policy now denies is deleted with a review decisionregated. A fact made before policies existed has no topic label: under topic rulestopics.on_unknowndecides it, and the dry run counts it asunlabelled. When the change only tightens, the completed job restamps the rows it judged and kept on every replica, so they read as current; a fact learned after the job planned, which it never judged, staysunsyncedfor the nextregate. A change that loosens or steers leaves the rowsunsynced, for areextract.reextractloosens the past, priced first. It runs the model again over the events made under another policy (select: {"unsynced": true}, the default) or over up to 20,000 named events (select.event_ids). An erased event, a scope atenrich: off, a reference root and an event under a legal hold are left out and counted; a sealed event is read from its segment. Each event's clean result replaces what the event derived before (on a data node every replica's learner evicts the old records' rows and applies the new; a correction in force still suppresses what it covers, and an approved review decision still admits its claim).
Who. A regate is an Owner's of the scope with derivation.administer.scope, or the trusted operator's. A
reextract also needs llm.invoke, and the operator's switch CORTEX_DERIVATION_REEXTRACT must let the caller:
tenant (the default) lets the Owner, operator only the trusted operator, off nobody (403 REEXTRACT_NOT_ALLOWED, details.switch). A value of the switch other than these three refuses the boot (exit 78
DERIVATION_REEXTRACT_CONFIG); a data node takes it from its [engine] table. A job is read and cancelled by its
creator, an Owner of its scope with derivation.administer.scope, or the trusted operator; anyone else is answered
404, as for a job that does not exist.
The dry run (dry_run, default true) changes nothing a reader sees.
POST /v1/derivation/rederive
{"scope": "org:acme/app:companion", "mode": "regate"}
200
{"mode": "regate", "scope": "org:acme/app:companion", "target_policy_hash": "dp1:4be1c0d29a7e3f5b6c8d0e1f2a3b4c5d",
"selected": {"facts": 51022},
"retire": {"facts": 212, "corrections": 37, "by_rule": {"topic.deny.health": 205, "detector.payment_card": 7}},
"held": {"regated": 3, "by_rule": {"topic.deny.health": 3}},
"would_hold": {}, "unlabelled": 1108, "unreadable": 0, "restamp": true, "model_calls": 0}
A regate dry run also keeps its retirement count as the status route's governance.facts.stale_restrictions
(§8.7.12). A reextract dry run selects the events, extracts a stratified sample of them (sample_size, default 50, at
most 200) under the policies in force, writing nothing, diffs the sample by claim key against what each event's facts
state now, and prices the whole: the mean cost of a sample event times the events selected, with a 90% interval.
POST /v1/derivation/rederive
{"scope": "org:acme/app:companion", "mode": "reextract", "select": {"unsynced": true},
"dry_run": true, "sample_size": 50, "max_events": 20000}
200
{"mode": "reextract", "scope": "org:acme/app:companion", "target_policy_hash": "dp1:4be1c0d29a7e3f5b6c8d0e1f2a3b4c5d",
"selected": {"events": 18211, "skipped": {"expired_unreachable": 220, "held_legal": 8}, "over_max": 0},
"sample": {"events": 50, "diff": {"added": 41, "removed": 12, "unchanged": 118},
"items": [{"event_id": "evt_0196…", "scope": "org:acme/app:companion/user:bob", "outcome": "learned",
"added": 1, "removed": 0, "unchanged": 3, "sealed": false}], "truncated": null},
"estimate": {"usd": 41.20, "interval_90": [33.10, 49.80], "calls_per_event": 1.7,
"tokens_per_event": {"input": 3120, "output": 470}, "price_book": "pb1:0a1b2c3d",
"sealed_reads": 3100, "unpriced_calls": 0},
"cost": {"usd": 0.11, "calls": 85, "models": ["claude-haiku-5-5"]},
"estimate_id": "est_0196f3b0c1d27b3e9a4f5d6c7b8a9e01", "expires_at": "2026-11-09T10:30:00Z"}
The sample's calls draw on the tenant's daily budget of tests and dry runs (CORTEX_DERIVATION_BUDGET_USD, §8.32; the
usage ledger records them as the policy tests' are), and a sample the budget or the 240-second deadline cut short says
so (truncated). The answer holds counts and ids only. estimate_id binds the selection, the target policy, the
sample, the models and the price book for 24 hours; it is kept on the leader that ran the dry run.
The apply (dry_run: false) starts a job: 202 with Location: /v1/derivation/rederive/{job_id}?scope=<scope>
and {"job": {…}}. A reextract apply names its dry run's estimate_id and a cap_usd, the most the job may spend
(at most CORTEX_DERIVATION_BUDGET_MAX_USD, default 500: 422 INVALID_BODY, details.max_usd, above it). job_id is
the apply's idempotency key: the same key from the same caller on the same root answers the job it made, 200.
POST /v1/derivation/rederive
{"scope": "org:acme/app:companion", "mode": "reextract", "dry_run": false,
"estimate_id": "est_0196f3b0c1d27b3e9a4f5d6c7b8a9e01", "cap_usd": 50.00, "job_id": "companion-reextract-1"}
202 Location: /v1/derivation/rederive/job_0196…?scope=org:acme/app:companion
{"job": {"id": "job_0196…", "mode": "reextract", "scope": "org:acme/app:companion", "state": "approved", …}}
The job is a replicated record of the shard (kind job), so every replica holds it and a new leader goes on with it:
its driver adopts the job (leader), counts the reservations a page in flight held as spent, and runs the rest. One job
runs on a root at a time (409 DERIVATION_JOB_ACTIVE, details.job_id), and a scope move of the root waits for it
(cortexdb admin scope move refuses with MOVE_DERIVATION_JOB_ACTIVE). Forgets and erasures are not held: an event
erased while its page runs is left, counts.skipped.erased. A job is not created while the disk is critical
(503 DISK_FULL), and a running one pauses then (pause_reason).
- A
regateproposes its retirements and regated decisions in pages of at most 256 parts, each with the job's progress, then completes, naming itsrestampwhen the change only tightened. - A
reextractruns in pages of at most 256 events. Before a page is dispatched its cost is reserved against the cap (the dry run's upper estimate per event times its events); a page that does not fit ends the jobcompletedwithstop: "cap_reached", so the cap is never passed. Each page's events are re-extracted through the extraction scanner (retry causereextract:<job id>, which re-learns an event the scanner would skip as learned) and its calls are counted against the job's cap, not the daily budget. A page whose results do not land within 10 minutes pauses the job (waiting_on_extraction) until they do. If the policy in force at the job's scope changes, the job fails (error.code: "TARGET_POLICY_CHANGED"): run the dry run again.
GET /v1/derivation/rederive/{job_id}?scope= answers {"job": {…}}: mode, scope, select, target_policy_hash,
state (planned, approved, running, paused, completed, cancelled, failed), approval (by, at,
estimate_id, estimate_usd, cap_usd, per_event_usd, max_events), cursor, budget (reserved_usd,
spent_usd, reservations, calls, tokens_in, tokens_out), counts (selected, done, retired,
corrections, held_regated, reextracted, failed, pages, skipped), restamp, leader, cancel_requested,
pause_reason, stop, error, key, created_by, created_at, updated_at, closed_at. ?scope= names the
job's scope or one above or below it. POST /v1/derivation/rederive/{job_id}/cancel?scope= answers 202: the page in
flight ends, then the job closes cancelled (a closed job is answered as it stands). A closed job's record is purged
30 days after it closed. An approval is audited (action: "derivation_job").
Errors: 403 POLICY_DENIED, REEXTRACT_NOT_ALLOWED; 404 NOT_FOUND (a job's GET or cancel); 409 ENRICHMENT_OFF
(a reextract on a process with enrichment off), REDERIVE_ESTIMATE_REQUIRED (an apply whose estimate_id names no
live estimate of the same scope and selection on this leader), REDERIVE_ESTIMATE_STALE (the selection changed since
the dry run: details.selected_then, selected_now), REDERIVE_BUDGET_EXHAUSTED (the cap is below the first page's
reservation, details.cap_usd, spent_usd, next_page_usd; the dry run's model is unpriced, details.reason: "unpriced_model"; or the tenant's daily budget of dry runs is spent, details.reason: "tenant_budget_spent",
budget_usd, spent_usd), DERIVATION_JOB_ACTIVE; 422 INVALID_BODY (details.field: select,
select.event_ids, sample_size, max_events, estimate_id, cap_usd, job_id), ENRICHMENT_SCOPE_NOT_ALLOWED,
INVALID_SCOPE_GRAMMAR; 503 FORMAT_UPGRADE_PENDING, DISK_FULL, STORAGE_UNAVAILABLE and the shard's write codes
(retriable). On a cluster the root's leader runs it; the POST is a read for resending, so a lost answer is never
re-sent (send the apply again with the same job_id). The console's Derivation › Jobs tab runs both modes, a dry
run first and then the apply of the same selection, and follows the job it started.
8.32.8 GET /v1/derivation/report
Capability: derivation_rederive_v1 (new in 0.15.0). Experimental. An Owner of the scope with
derivation.administer.scope, or the trusted operator (operator plane class A). Format 11.
What was derived under a subtree over a period, for a regulator or a risk assessment: counts and ids, never content.
?from= and ?to= take a day (2026-11-01) or an RFC 3339 time (to exclusive; default all of it, up to now), and
format=csv answers text/csv, one section,key,value row per count.
GET /v1/derivation/report?scope=org:acme/app:companion&from=2026-10-01&to=2026-11-01
200
{"scope": "org:acme/app:companion", "from": "2026-10-01T00:00:00Z", "to": "2026-11-01T00:00:00Z",
"policy_hash": "dp1:4be1c0d29a7e3f5b6c8d0e1f2a3b4c5d",
"activations": [{"changeset": "cs_0196…", "proposer": "user:ana", "approved_by": "user:raj",
"at": "2026-10-12T08:00:00Z", "paths": ["org:acme/attrs:derive"]}],
"verdicts": {"events": 51022, "accepted": 50110, "held": 14, "rejected": {"topic.deny.health": 205},
"by_category": {"health": 205}, "by_outcome": {"learned": 50110, "nothing_admitted": 912}},
"review": {"approved": 9, "rejected": 4, "regated": 3},
"corrections": {"by_action": {"reject": 37}, "by_origin": {"user": 30, "regate": 7}},
"jobs": [{"id": "job_0196…", "mode": "regate", "scope": "org:acme/app:companion", "state": "completed",
"retired": 212, "held_regated": 3, "reextracted": 0, "spent_usd": 0,
"created_at": "2026-10-20T09:00:00Z", "closed_at": "2026-10-20T09:01:12Z"}],
"erasures": {"count": 2, "corrections_erased": 2, "declared_erased": 0, "window": "retained_feed"},
"feed_consumers": [{"consumer": "warehouse", "principal": "service:etl", "scope": "org:acme/app:companion",
"updated_at": "2026-10-31T23:59:00Z"}]}
activations are the derivation change sets activated in the period (a change set's header is kept 7 days after it
closes, so older ones are in the audit trail); verdicts are this node's recorded outcomes (on a cluster, the root's
leader's), with the rejections by rule and by taxonomy category or detector; review, corrections and jobs are
those made in the period; erasures counts the erasures of the retained erasure feed that took corrections or declared
records under the scope (a feed row keeps no time: window: "retained_feed"). Errors: 400 INVALID_QUERY (from, to or format out of their
grammar, or to before from: details.field); 403 POLICY_DENIED; 422 INVALID_SCOPE_GRAMMAR; 503 FORMAT_UPGRADE_PENDING, STORAGE_UNAVAILABLE.
8.31 The HTTP MCP server (/mcp)
Capability: mcp_http_v1, listed since 0.14.0 and flag-gated by CORTEX_MCP (off by
default): while it is off the name is withheld from GET /v1/admin/version and every route below
answers 404 NOT_FOUND. Each tool call then needs what its REST route needs.
The Model Context Protocol over streamable HTTP, protocol versions 2026-07-28, 2025-11-25,
2025-06-18 and 2025-03-26: stateless, JSON responses only (no event stream), one JSON-RPC 2.0
message per POST. An OAuth 2.1 resource server: every call is authenticated alone by its own
bearer, which must be a principal's signed token (one the deployment minted, or one an
issuers-file entry maps, such as an enterprise IdP's access token, the entry's alias mapping the
resource's aud to a tenant). The static operator key and an unsigned actor are refused
401 INVALID_TOKEN (on an auth-disabled server every call runs as its local actor).
X-Cortex-Actor may be left out: the caller is the token's sub. No Mcp-Session-Id is issued,
and one sent is ignored: no session carries an identity. A voice call's session (call_brief, and
session on a voice recall) is CortexDB's call session (§8.3.3), named by the call's id: it is no
MCP session, and no MCP session names one. The bearer is never passed on: each tool
call is the REST request the same credential would make, run in process, so the same checks decide
it and every refusal reaches the decision-audit stream (an inner request's id is this request's
X-Request-Id followed by .1, .2, …). Every response carries Cache-Control: no-store. A
cluster ingress routes none of these routes (501 CLUSTER_ROUTE_UNSUPPORTED).
| Setting | Default | Meaning |
|---|---|---|
CORTEX_MCP | off | on serves the routes |
CORTEX_MCP_PROFILE | read | read serves recall, decision_history, explain, memory_why, memory_about and call_brief; write adds remember, forget and correct |
CORTEX_MCP_SCOPES | org:{tenant}/{principal}/* | The scope allowlist, the caller's own region by default ({principal} is the caller's principal id, {tenant} its billing tenant); it only narrows, and the scope's own checks still decide. A scope path holds no ., so a principal an issuers-file entry maps in prefix or hash mode (user:<namespace>.<value>) has no own region, and the default names no scope for it: each of its tool calls answers SCOPE_NOT_ALLOWLISTED. Map such callers in directory mode to principal ids that hold no . (SCIM's user:<hex> ids are such), or list the scopes they act in |
CORTEX_MCP_RESOURCE | this request's origin and /mcp | The resource URI the metadata and the 401 challenge name; set it behind a proxy that rewrites Host |
CORTEX_MCP_AUTHORIZATION_SERVERS | every issuers-file iss that is an http(s) URL | The metadata's authorization_servers |
CORTEX_MCP_ALLOWED_ORIGINS | none | Browser origins admitted (* admits any) |
A setting that does not parse refuses CORTEX_MCP=on at boot (exit 78 MCP_CONFIG_INVALID), and so does CORTEX_MCP=on
in a cluster data node's [engine]: the server runs on a plain node, since an ingress cannot route a call whose scope
is inside its params.
Origins. A request with an Origin header is refused 403 ORIGIN_NOT_ALLOWED
(details.origin) unless CORTEX_MCP_ALLOWED_ORIGINS lists that origin or it is the origin of
CORTEX_MCP_RESOURCE — never admitted by the request's own Host, which a DNS-rebinding page
controls. A client that sends no Origin, as every non-browser client does, is not asked. /mcp keeps the server's
CORS policy, which allows no MCP header (MCP-Protocol-Version among them), so a browser-based MCP client is not
supported yet.
8.31.1 POST /mcp
{"jsonrpc": "2.0", "id": 7, "method": "tools/call",
"params": {"name": "recall", "arguments": {"query": "what did we decide about the database?", "when": "last week"}}}
| Method | Result |
|---|---|
initialize | protocolVersion (the client's when served, else 2026-07-28), capabilities: {"tools": {"listChanged": false}}, serverInfo: {"name": "cortexdb", "version"}, instructions |
ping | {} |
tools/list | The profile's tools only, each with inputSchema and annotations (readOnlyHint, destructiveHint, idempotentHint, openWorldHint: false), plus ttlMs: 60000 and cacheScope: "private" |
tools/call | {"content": [{"type": "text", "text"}], "structuredContent", "isError", "cacheScope": "private"} |
A notification (no id) or a client's response (no method) is answered 202 with no body. A
tool's own failure, a REST route's refusal or this server's, is a result with isError: true and
the route's error envelope in structuredContent; the text is cut at 256 KiB and marked
[truncated].
| Tool | Profile | Runs | Arguments |
|---|---|---|---|
recall | read | POST /v1/recall | query (required); since and until (RFC 3339 capture-time bounds) or when (a phrase such as last week, read leniently); max_tokens (100–16000); profile (standard, the default, or voice: recall_profile_voice_v1, the short read path of a live voice turn, §8.3; sent with no view, since a voice recall reads granular, and with max_tokens 400 unless the call names one); session (the conversation session, which a read-time use rule reads, §8.32.5; in voice mode also the call's session, whose working set answers a voice recall, §8.3.3); scope |
decision_history | read | the scope's beliefs, then GET /v1/beliefs/history for each | about (every word must appear in the belief's claim: subject, relation or value), or belief_id (a belief homed inside the allowlist); limit (1–10, default 5); scope. Newest revision first |
explain | read | POST /v1/access/explain | memory_id; role (summary, reader, writer, owner; default reader); scope. Changes nothing |
memory_why | read | derivation_provenance_v1 (new in 0.15.0): for a fact, GET /v1/facts/{id}?include=derivation, then GET /v1/derivation/decisions for its first five source memories; for a belief, GET /v1/beliefs/why?include=derivation; for a memory, GET /v1/derivation/decisions | memory_id (required: a fact_, belief_ or evt_ id); scope. Every read names scope as its ?scope=, and a fact or belief must be homed inside the allowlist (SCOPE_NOT_ALLOWLISTED otherwise). Where the allowlist holds a scope but not what lies under it, a decision is read only for a memory found exactly at that scope (GET /v1/events/{id}?scope= first). Answers how the row was made (the derivation object, §7.4.3) and what became of each memory's derivation (§8.7.22), in words and as the routes' JSON; a source memory whose decision is refused is named with its error, and the tool still answers. Below format 10 a memory's decision is the route's 503 FORMAT_UPGRADE_PENDING. Changes nothing |
memory_about | read | corrections_v1 (new in 0.15.0): GET /v1/memory/about (§8.7.25) | include_corrections (sends include=corrections); limit (1–100, default 50); cursor (the previous answer's next_cursor); scope. Answers what is known about the scope's subject: the current facts and beliefs homed exactly at scope that the caller may read, each with the memories it rests on (id, observation time and snippet), and with include_corrections the scope's corrections, in words and as the route's JSON (with scope). Below format 10 it is the route's 503 FORMAT_UPGRADE_PENDING; below format 11 the route lists no corrections, and the text says so. Changes nothing |
call_brief | read | voice_sessions_v1 (voice mode): POST /v1/sessions (§8.3.3) with profile: "voice" | session (required: the call's id, which the route checks: 1 to 256 bytes with no control character); query (the reason for the call: sent as brief.query); max_tokens (1–4000: brief.max_tokens); idle_timeout_s (30–14400); scope. Opens the caller's session of the call and answers its brief in words (whether it was started or was open already, the working set's state, the earlier calls, the brief's context_block, the warnings, and that each voice recall of the call names the session) and as the route's JSON. It writes no memory, so the read profile serves it, but it opens a session the server holds in RAM: annotated readOnlyHint: false, idempotentHint: true (the same start again reads the brief of the same session). Outside voice mode it is the route's 409 VOICE_SESSIONS_DISABLED, whose text says that a voice recall works without a session |
remember | write | POST /v1/experience | text (required); scope |
forget | write | POST /v1/forget, or POST /v1/forget/preview with preview: true | memory_ids (required, 1–100); note (kept as the forget's audit_note); preview; from_preview_id (a preview's id, not with preview); scope. Answers the receipt: the counts deleted per layer and the audit row id |
correct | write | corrections_v1 (new in 0.15.0): POST /v1/corrections (§8.7.24) | action (required: reject, replace, pin or confirm); target (required: {fact_id} or {claim: {subject, predicate, object, negated}}); bind (reject only: claim, subject_predicate or subject); value (replace only: {object, valid_from}); reason; idempotency_key; scope. Each is sent as the route's field of that name, and a field the route refuses is its 422 INVALID_BODY (details.field). Annotated destructiveHint: true: a reject deletes facts, and erases the memory of a typed triple it names. Answers the correction's id, its effects in words and as the route's JSON, and how to undo it: undo in structuredContent is {method: "DELETE", path: "/v1/corrections/{id}?scope=…"}, a route this server has no tool for. When a reject erased typed triples' memories, the tool reads the correction again (GET /v1/corrections/{id}): one that cited only those memories was erased with them, and is answered kept: false and undo: null, with nothing left to undo. A retry with the same idempotency_key answers the first attempt (replayed: true). Below format 11 it is the route's 503 FORMAT_UPGRADE_PENDING |
Every tool acts at scope, which must lie inside the allowlist; a tool that names none uses the
allowlist's first entry. A scope outside it, or a write tool under the read profile, is refused
inside the result (isError: true; SCOPE_NOT_ALLOWLISTED, READ_ONLY_PROFILE), each with a
decision line (reasons scope_not_allowlisted and read_only_profile). A correction governs the
facts at its scope and below it, so correct acts only at a scope whose whole subtree the
allowlist holds (an entry ending in /* at or above it), and is refused SCOPE_NOT_ALLOWLISTED,
with its line, at a scope the allowlist names alone. The destructive tools, forget and correct,
refuse an argument they do not apply with JSON-RPC error -32602 naming it, never dropping it
silently: forget deletes by memory id only, so capture_keys and idempotency_keys (§8.5,
forget_by_key_v1) are among them.
Errors: 400 with a JSON-RPC error body (id: null), not the error envelope: -32700 (not
JSON), -32600 (a batch or any message that is not one JSON object, or an MCP-Protocol-Version
header this server does not speak). JSON-RPC errors inside a 200: -32601 (a method not
served), -32602 (invalid params: no tool named, arguments not an object, a malformed argument, an
argument a destructive tool does not apply). 401 MISSING_TOKEN, INVALID_TOKEN (also the
operator key or an unsigned actor), EXPIRED_TOKEN, REVOKED_TOKEN, INVALID_TOKEN_SIGNATURE,
WRONG_TENANT, each with WWW-Authenticate: Bearer resource_metadata="<the metadata URL>", plus
error="invalid_token" when a credential was presented. 403 ORIGIN_NOT_ALLOWED. 404 NOT_FOUND
(CORTEX_MCP off). None is retriable.
8.31.2 GET /mcp and DELETE /mcp
This server opens no event stream and keeps no sessions: after the same origin check and
authentication as POST, both answer 405 METHOD_NOT_ALLOWED with Allow: POST.
8.31.3 GET /.well-known/oauth-protected-resource and GET /.well-known/oauth-protected-resource/mcp
Capability: none (no credential).
The RFC 9728 protected-resource metadata of /mcp: the second URL is the one RFC 9728 forms for
the resource /mcp, which a 401 from /mcp names; the first is for a client that probes the
host's root. Cache-Control: no-store, since without CORTEX_MCP_RESOURCE the document names
the request's own host.
{
"resource": "https://memory.example.com/mcp",
"authorization_servers": ["https://auth.example.com"],
"bearer_methods_supported": ["header"],
"resource_name": "CortexDB"
}
authorization_servers is absent when there is none. Errors: 404 NOT_FOUND (CORTEX_MCP off).
9. The Stratified Pack
The output of POST /v1/recall (POST /v1/recall/stream sends the same parts as frames, §10.1).
Schema: StratifiedPack in docs/schemas/openapi.json.
{
"pack_id": "pack_01HX...",
"scope": "org:acme/dept:eng/user:alice",
"view": "holistic",
"context_block": "## What I know\n- Acme moved to 200 seats on May 13, 2026 and signed. ...",
"layers": {
"beliefs": [
{"id": "belief_01HX...", "scope": "org:acme/dept:eng/user:alice", "claim": {...}, "stance": "...", "confidence": 0.62, "supports": [...]}
],
"facts": [
{"id": "fact_01HX...", "scope": "org:acme/dept:eng/user:alice", "triple": {...}, "confidence": 0.91, "supports": [...]}
],
"episodes": [
{"id": "ep_01HX...", "name": "Acme deal Q3 close", "summary": "..."}
],
"events": [
{"id": "evt_01HX...", "scope": "org:acme/dept:eng/user:alice", "content": {...}}
]
},
"provenance": {
"trail": [
{"phase": "coordinator_recall", "elapsed_ms": 88},
{"phase": "wal_hydrate", "elapsed_ms": 4},
{"phase": "derived_layers", "elapsed_ms": 22},
{"phase": "context_contributors", "elapsed_ms": 0,
"context_contributors": [{"event_id": "evt_01HX...", "rank": 0}]}
],
"citations": {
"belief_01HX...": [...],
"fact_01HX...": [...]
}
},
"diagnostics": {
"filters_applied": ["temporal.natural"],
"time_ms": {"recall_total": 412, "coordinator_recall": 88, "wal_hydrate": 4, "derived_layers": 22},
"knapsack_evictions": 0
}
}
pack_id, scope, view (the view read; local echoes as granular), context_block (always
present, empty for raw and structured), layers, provenance and diagnostics are always
there; diagnostics is {"time_ms": {}} under the default diagnostics: "none". Each layer is
absent when empty; layers.code holds cited source regions when the code plane serves them, and
layers.rollups the rollups the scope homes (rollups_v1). A pack names no request: the request
id is the X-Request-Id header.
warnings (absent when empty, so a default pack is byte-identical to one built before the
field existed) holds non-fatal notes on how the pack was assembled, in this order:
temporal_natural_ignored: ...: atemporal.naturalphrase thatnatural_mode: lenientignored (§8.3).mount_not_admitted: <path>: a mount the route dropped because noappsentry admits the application there now (§8.3.2; only on a request that sentmounts).subtree_recall_unavailable: <reason>: a request that sentsubtreewhose ranked pass could not run; the pack is today's pack (reasons in §8.3.1).entity_grounding_advisory: ...: the advisory grounding note (§8.3).parent_pack_unranked_sample: events from K of M authorized descendant scopes, selected in storage order, not by relevance(orevents from K authorized descendant scopes, ...when M is not known): a pack at a parent scope whose child events were read in storage order (never at a leaf, never on a rankedsubtreepack). K counts the descendant scopes the final pack holds, after the events limit, the render budget and the knapsack. Informational: it is not adiagnostics.degraded_sourcesentry and does not setdiagnostics.partial.CORTEX_PARENT_SAMPLE_WARNING=0turns it off. New and on by default in 0.10.4.segments_unreachable: N segment(s) of old data were not searched (the store did not answer, or the request's read budget was spent): with the segment store on (CORTEX_ICE_URL), old events live in segments in the object store, and a recall searches the segments of its scope's root within a budget (CORTEX_ICE_READ_DEADLINE_MS, 1,500 ms,_READ_MAX_MB,_READ_MAX_REQUESTS); a segment it could not read in time is skipped, so old memories it holds may be missing from the pack. Such a pack is never cached, and/v1/answernames it indiagnostics.degraded_sources(segments_unreachable), which keeps the answer out of the answer cache. A ranked subtree pass does not search segments yet and sayssubtree_segments_not_searchedindiagnostics.degraded_sourceswhen the root has any.GET /v1/admin/metricsice.reads.budget_skipsandfetch_errorscount the skips. Withcoveragethe root is also a gapsegment_unreachable(§8.3.2).newest_of_kinds_partial: ...: the scope's newest event of each kind (newest_of_kinds) could not be read whole in one bounded listing, so the newest among the recalled events is served.use_rule_withheld: <n> events from earlier sessions(derivation_use_rules_v1, new in 0.15.0): a read-time use rule withheld n distinct events from this read, directly or through every row derived only from them (§8.32.5). Informational: it is not adiagnostics.degraded_sourcesentry and does not setdiagnostics.partial, since the pack is complete for the read's session.
subtree (only on a pack built by the ranked subtree lane, §8.3.1): mode (ranked),
complete (always false), subjects_authorized, subjects_with_candidates,
subjects_in_pack, events_in_pack, vector_strategy (exact_scan or filter_first) and
subjects[] (alias, scope, events, best_rank). Absent on every other pack.
coverage (only when the request sent coverage: true, §8.3.2): what the read searched, what
of its read set the caller may read, and each gap with its reason.
knowledge_subgraph (view: "structured" only): a JSON-LD graph of the pack's facts
(@context, @graph nodes with @id, @type and label, and edges with subject,
predicate, object, confidence). Absent when the pack holds no facts.
With consistency (§8.3.2) the pack's fields are followed by consistency_token and the other
consistency fields that apply.
9.1 Views
view | What gets filled |
|---|---|
raw | layers.events of the exact scope. context_block is empty. Useful for debugging and replay. |
granular (alias local) | The layers of the exact scope; context_block is the stitched evidence of its events. |
holistic (default) | All layers from the requested scope plus authorized ancestors and descendants (never siblings). On /v1/recall the context_block is the structured rendering (What I know / Timeline / Evidence) built from the pack's layers; a ranked subtree pack keeps its tagged evidence block. |
descend | The scope and its authorized descendants (scope.read.descend). |
lineage | The scope plus the ancestor-scoped derived records its subtree contributed to; never an ancestor's raw events. |
structured | The scope and its authorized ancestors (not its descendants), with an empty context_block and a knowledge_subgraph (JSON-LD) of the pack's facts. |
holistic, lineage and structured need scope.read.holistic. At a shared org-tree scope only
granular and raw read (§8.3). There is no narrative view: an unknown view is
422 INVALID_BODY.
9.2 Ranking and limits
budgets.per_layer_limits caps each layer's array (applied first), and budgets.max_tokens is a cross-layer token budget over the whole pack. Layers named in include are funded first, in include order, then facts > beliefs > episodes > understanding > events; the lowest-priority items are evicted from the tail until the pack fits (in the events layer, the events context_block does not render leave before any it renders), with the count in diagnostics.knapsack_evictions. So unless include lists events, event records are the first to go: their text is already in context_block. context_block is bounded to the same budget: no entry takes it past max_tokens, whole events are never cut, and an event longer than the room it gets is served as an excerpt (§9.5). An exhaustive (whole-scope) pack supersedes the budget by design, and a trailing ## Code section of cited code (only when the code plane serves one) has its own budget share on top.
Every event whose text is in context_block is identifiable by id in the same response. It is in layers.events, or, when the cross-layer knapsack evicted it from the layer (derived layers are funded before events by default), the context_contributors provenance entry names it with evicted_from_layers: true (§9.5). The block's events are therefore not always a subset of layers.events: cite, audit and check forget or erasure against the union of the two.
Degraded/partial retrieval is reported via diagnostics._partial and diagnostics.degraded_sources, both present only under diagnostics summary or full (each source as <code>: <detail>; /v1/answer reports the codes alone to every caller). After a restart over a large store the server builds its scope-partition map in the background; until it lands, recalls read no descendant scopes and no cold-tier vectors, and each carries a degraded_sources entry starting scope_partition_map: (in diagnostics, so a /v1/recall caller sees it when it may read diagnostics; /v1/answer reports the scope_partition_map code to every caller).
9.3 Citation map
provenance.citations is a directed acyclic graph from derived records back to events. Walking it gives the "why" trail for any item in the pack. The same data is reachable via /v1/beliefs/why for beliefs specifically. It never names a chunk: the span of a long event that matched is matched_fragments (§9.4).
9.4 Matched fragments (matched_fragments_v1, M8; not in v0.9.13)
The write path splits an event longer than one chunk (about 500 bytes) into overlapping chunks
and indexes each chunk on its own. Since M8 each chunk of such an event records where its text
lies in the event's stored text, and a layers.events item of a multi-chunk event carries
matched_fragments: the chunks a retrieval channel (vector or BM25, primary query or query
variant) returned for this recall, at most 8, best first.
Order is the signal. The list is every chunk of the event that a channel returned anywhere in its candidate list (the vector channel reads about 80 chunks per query, and a later chunk of an already-admitted document counts), sorted by the best position either channel gave it; it is not cut at a relevance threshold. So the first entry is the chunk the channels ranked highest, and later entries can be any chunk the channels returned: for a document of six or seven chunks the list often names every chunk. Cite the first entry; treat the rest as fallbacks, not as further evidence. Measured on the plan's four section 2.7 documents (Hindi, Tamil, Hinglish, English) in a 516-event scope with text-embedding-3-small: 23 of 24 queries returned the document with the field; the first entry held the queried fact in 16 of the 24, some entry in 21 (misses: one fact split across two chunks by chunker v1, one document found only through a chunk without the fact, one document not returned).
On a ranked subtree pack (/v1/recall with subtree, §8.3.1) a multi-chunk event's
matched_fragments lists the chunks the subtree pass's channels returned for it, in the same
order, so a reader can show the part of a long conversation that matched rather than its start;
the cohort answer's excerpts open at the first one.
"matched_fragments": [
{
"chunk_id": "0194c2b8-6f2a-7c41-9d3e-5b8a1f0c2d44",
"text_source": "event_text",
"byte_range": {"start": 1996, "end": 2494},
"locator": {"kind": "document", "section_path": ["Employee Advance Policy 2027", "Eligibility and limits"]},
"language": "hi",
"matched_via": "bm25"
}
]
| Field | Meaning |
|---|---|
chunk_id | The chunk's id (a UUID). The first chunk of an event reuses the event's UUID. |
text_source | event_text: the caller's own text (a text or message envelope, or a client transcript sent with a blob). converted_text: a text-shaped blob the server decoded (§ blobs, blob_text_decode_v1) and stored as the event's text. derived_text: server-processor extraction (not produced yet; plan A1-3). |
byte_range | A half-open range of UTF-8 bytes of the event's stored content.text (the text GET /v1/events/{id} returns, and the item's own content.text unless the item carries a _partial view). content.text[byte_range] is the chunk text without its contextual prefix: the [section: …] header line the index copy carries and, on a message's first chunk, the [role] marker. |
locator | {kind: "document", section_path: [title, heading]}: the Markdown headings in force where the chunk starts. Absent when no heading precedes the chunk. Chunker v1 takes them at the chunk's start, which can lie in the overlap before the next heading, so a chunk mostly about the next section can still name the previous one (a known v1 behaviour; the chunker-v2 fix is plan A1-2b). |
language | The event's C1 language tag; absent for implicit English. |
matched_via | vector or bm25: the channel where the chunk ranked higher (vector on a tie). folded and gloss_en are reserved for later releases. |
The key is absent (the item keeps its bytes) on single-chunk items, on events written before M8
(their chunks have no recorded offsets until they are rewritten), on JSON, triple and
blob-placeholder content (no stored text a caller could re-slice), and on events no vector or
BM25 list returned (a recency, graph or WAL-supplement item). A fact that the v1 chunker split
across two chunks (plan §2.7: a Tamil honorific திரு. is taken as a sentence end) lies across two
adjacent fragments, never inside one.
Slice by bytes, not string indices: the SDKs' fragment_text(text, fragment) (Python,
cortexdb.v1.fragments) and fragmentText(text, fragment) (TypeScript) do it and refuse a range
that splits a character.
The composed context_block reports which fragments it served: the provenance trail entry
{"phase": "context_fragments", "context_fragments": [{"event_id", "chunk_ids": [...]}]} lists,
for each multi-chunk event the block renders, the chunks whose byte ranges the rendered windows
cover. It is present only when such an event was served. For a budget excerpt (§9.5) the row is
computed from the excerpt's exact _excerpt_ranges.
9.5 Budget excerpts and the context receipt (budget_excerpt_v1, 0.10.1)
context_block on a ranked pack is built from whole events in rank order while they fit the
max_tokens budget. An event that does not fit where it ranks is skipped and packing continues
with the smaller ones behind it (CORTEX_CONTEXT_RENDER_SKIP_OVERSIZED=0 ends the whole-event
pass at it instead);
under the default CORTEX_CONTEXT_STRIP_ECHO=paired, an assistant turn written in the
In reply to user: convention loses its echo of a user turn the block also renders. Since 0.10.1
no entry, the first one included, takes the block past the budget, and an event that did not fit is
then served as an excerpt in the room still free, at its rank position (it needs at least 512
bytes of room unless it is the block's only entry):
- its best-matching chunks: the chunks the vector and BM25 channels returned for it (the
matched_fragmentsorder, best first), taken while the result fits, then served in document order (when not even the best one fits, its head is); - without fragment rows (events written before M8), its head, cut at a char boundary;
- verbatim slices of the stored text joined by
\n[…]\n, led by[…]\nwhen text before the first slice is left out and closed by\n[…]when text after the last one is. Echo stripping does not apply inside an excerpt.
The excerpt is the same text in context_block (after the event's time prefix and [role]
marker) and in the event's layers.events item, whose content keeps its kind and role and
becomes a partial view:
"content": {
"kind": "message",
"role": "assistant",
"text": "[…]\nSection 3: …\n[…]\nSection 40: …\n[…]",
"_partial": true,
"_partial_reason": "budget_excerpt",
"_original_bytes": 32768,
"_excerpt_ranges": [{"start": 775, "end": 1015}, {"start": 9692, "end": 9932}]
}
_original_bytes is the stored text's byte length and _excerpt_ranges the half-open byte ranges
of the stored text the excerpt carries, in document order. GET /v1/events/{id} returns the whole
stored event; matched_fragments byte ranges keep indexing the stored text. A pack in which every
event fits whole is unchanged byte for byte. The holistic /v1/recall rendering (the
# Memory context wrapper) cuts its first evidence entry to the room its synthesized sections
leave, closed by \n[…], and reports the coverage as partial. CORTEX_RECALL_BUDGET_EXCERPTS=0
restores the pre-0.10.1 render (the first entry admitted whole, no excerpts). Since 0.10.2 a server
with that switch off does not list budget_excerpt_v1 in GET /v1/admin/version (the only
capability a switch withdraws) and logs the startup lint RECALL_BUDGET_EXCERPTS_DISABLED, so a
client that gates on the name knows when excerpts are off. On a cluster the ingress answers
GET /v1/admin/version from its own environment (it has no [engine]): set the switch in every
data node's [engine] and in the ingress's environment, or the ingress keeps listing the name.
/v1/answer builds its context from several recall passes at different budgets, so one pass can
serve an event as an excerpt while another serves it whole. The answer context treats the two as
one event: the whole text is kept once, in the excerpt's place when the excerpt came first, and the
excerpt is dropped. Excerpts from the composer and from CORTEX_CONTEXT_ASSISTANT_EXCERPTS, which
carry the same […] mark, are not budget excerpts and merge as before.
The context receipt. The provenance trail entry
{"phase": "context_contributors", "context_contributors": [{"event_id", "rank"}, ...]} (content
free) names, since 0.10.1, the events context_block renders, after the ranked candidates the
context was assembled from and any recovered user turn (recovered_user_turn: true). rank is the
event's position in the events layer before the knapsack when no earlier row gave one. Rows for
events that are still in layers.events stop at 128; the layer names the rest. A rendered event
the cross-layer knapsack evicted from layers.events carries evicted_from_layers: true and always
gets its row: those rows are outside the 128-row cap, one per evicted event, so an exhaustive or
order: "recency" block with a small explicit max_tokens can carry hundreds of them. An exhaustive
pack renders its events layer in order, so there only such evicted events get rows.
10. Streaming
10.1 Recall streaming (POST /v1/recall/stream)
POST /v1/recall/stream takes the /v1/recall body (§8.3) and answers text/event-stream with
the pack in parts; /v1/recall itself refuses stream: true (422 INVALID_BODY). The stream
takes no recall execution permit (no 429 RECALL_OVERLOADED, no busy_recall), reads its body as
JSON (415 UNSUPPORTED_MEDIA_TYPE for another content type, 400 INVALID_BODY for a syntax
error), ignores a ?stream= query parameter, and otherwise prepares, authorizes and meters the read
as /v1/recall does; an error before the stream opens is an ordinary JSON envelope.
event: plan
data: {"view": "holistic", "scope": "org:acme/dept:eng/user:alice"}
event: layer
data: {"layer": "beliefs", "items": [...]}
event: layer
data: {"layer": "facts", "items": [...]}
event: layer
data: {"layer": "episodes", "items": []}
event: layer
data: {"layer": "events", "items": [...]}
event: layer
data: {"layer": "understanding", "items": []}
event: context_block
data: {"text": "Acme is a B2B SaaS in late-stage..."}
event: provenance
data: {"trail": [...], "citations": {...}}
event: diagnostics
data: {"time_ms": {}}
event: done
data: {"pack_id": "pack_01HX...", "consistency_token": "ct1...."}
- The five
layerframes always come, in this order, even with emptyitems; a sixth,rollups, follows them only when the pack holds rollups. context_blockis sent only when the block is not empty (never forraworstructured).- After
diagnostics:coverage(thecoverageobject, §8.3.2) only for a request that sentcoverage: true, thenwarnings(a JSON array ofmount_not_admitted: <path>notes, and theuse_rule_withheldnote of §8.32.5) only when the request'smountsdropped one or a read-time use rule withheld something; no other warning reaches the stream. donecarriespack_idand, for a request that sentconsistency, the consistency fields (§8.3.2).- A comment line keeps the connection alive every 30 seconds.
- Every frame is fenced against the caller's current access. A stream whose authorization changed
ends with
event: error,data: {"error_code": "AUTHORIZATION_STATE_CHANGED", "retriable": true}; any other withdrawal ends the transport without a frame. A stream is complete only oncedonearrived.
10.2 Answer and compose streaming
POST /v1/answer with stream: true, and POST /v1/compose with stream: true on a renderer that
streams (otherwise compose answers JSON), answer text/event-stream:
event: token
data: {"text": "Acme"}
event: token
data: {"text": " upgraded"}
event: token
data: {"text": " to 200"}
...
event: citations
data: [{"marker": "[1]", "layer": "fact", "id": "fact_01HX...", "support_strength": 0.91}, ...]
event: provenance
data: {"trail": [...], "citations": {...}}
event: diagnostics
data: {"recall_ms": 412, "llm_ms": 814, "total_ms": 1240, "answer_model": "claude-opus-4-6"}
event: done
data: {"pack_id": "pack_01HX...", "as_of": "2026-05-13T15:42:09Z"}
- With a provider that streams, the tokens arrive as the model writes them, and
diagnosticsholds the timings, the model, the token counts the provider reported and any artifact or focus route. A multi-session question, a question the server checks before it is shown (one that asks how many, how much, how often, a number of, or an amount) and a renderer that does not stream are answered first and sent as word-sizedtokenframes, with the answer's wholediagnostics. - An
event: errorframe ends the stream:{"error": "<message>"}when the provider fails mid-stream,{"error_code": "AUTHORIZATION_STATE_CHANGED", "retriable": true}when the caller's access changed. - A streamed answer carries no
coverage,warnings,context_block,cohortor consistency token, and does not combine withskip_answer_llmorcohort(422 INVALID_BODY). A request that sentconsistency.at_leaststill waits for it before the stream starts. While the answer cache is on, a streamed answer's response carriesx-cortex-answer-cache: bypass.
10.3 Lifecycle streaming
Used for /v1/lifecycle/stream. Full event catalog in §13.
10.4 Reconnection and resume
Clients pass Last-Event-ID: lce_01HX... (standard SSE) or ?since_lifecycle_id=lce_01HX... on reconnect. The ID is a lifecycle event ID (lce_ prefix), not a memory event ID.
Server-side: every recall job's events are cached for 60s under the request's idempotency_key. Reconnect-with-resume replays from the next unsent event.
Lifecycle subscriptions support ?since_lifecycle_id=lce_01HX... for resume — server keeps a 1-hour replay buffer anchored from lifecycle-event arrival (§18.2 item 10). The window is "any lifecycle event whose server-side arrival timestamp is within the last hour is available for resume." Subscriber lifecycle (connect/disconnect timing) is irrelevant. Buffer is per-server-node; in cluster mode, replay across node failover may be incomplete for events that were in-flight during the failover.
10.5 Backpressure
We rely on HTTP/2 flow control. No application-level token bucket on streaming responses; we don't buffer events beyond the OS socket buffer.
A lifecycle stream that falls behind is caught up from the server's lifecycle log, however far behind, while the log holds its rows (one hour, 100,000 rows, 64 MiB). Once the log has evicted rows the stream had not delivered, it sends one event: lagging frame (data.resume_from, the last row delivered) and closes; the client restarts from GET /v1/lifecycle, because a resume from that cursor answers 410.
11. Forget Semantics
11.1 Cascade modes
| Mode | Endpoint | Capability | What happens |
|---|---|---|---|
derived_only (the default) | POST /v1/forget | forget.cascade.derived_only | Wipes named derived layers; events untouched, so the memories stay readable (§8.5). Rederivable from WAL replay. A memory_ids selector still deletes the events it names. |
redact_events | POST /v1/forget | forget.cascade.redact_events | With confirm_all: blanks every event of the scope (payload, labels, intent, location and source removed; id, wal_offset, scope, actors and timestamps kept), tombstones the scope and deletes the derived layers layers names. With a selector: deletes the events it names, or that a full-text query of its attribute finds (§11.2). Permanent. |
| GDPR | POST /v1/erasures (§8.6), POST /v1/erasures/person, POST /v1/erasures/tenant | forget.gdpr (a person's erasure and a tenant's deletion: the trusted operator) | True erasure of what it selects, with everything derived from it, a receipt and a proof (§11.3). |
11.2 Selector semantics
The selector block on /v1/forget is conjunctive:
{
"about_entity": "ent_acme_corp",
"predicate": "is_likely_to_renew",
"memory_ids": []
}
about_subject (or about_entity) and predicate are conjunctive: under derived_only a fact matches when its subject matches and, when predicate is set, its predicate matches too, and the beliefs and understanding it supports go with it. about_subject and about_entity name the same thing, the facts' subject; since 0.14.0, when both are set, both are applied: a fact must match each. Under redact_events the attribute fields are full-text queries over the events, and an event at or under the scope is deleted only when every set field's query selects it (before 0.14.0, the first set field's hits alone). Empty selector matches every record in the named layers within scope, and the request must then carry confirm_all: true (§8.5).
These four keys, and since 0.14.0 the keys idempotency_keys and capture_keys (forget_by_key_v1,
§8.5), are the whole selector. There is no time filter
(valid_during, recorded_during and created_during are not selector
fields). Since 0.14.0 the selector is strict: a field it does not know is refused, 422 INVALID_BODY
with details.reason: "unknown_selector_field" and details.field, and nothing is deleted (it used to
be ignored, which left the selector wider than asked). A combination its cascade and layers would not apply is
refused too (field_not_applied, §8.5). The erasure routes take memory_ids only (§8.6.3).
memory_ids is an "OR" with the other filters — if present, those IDs are deleted regardless of other filters (within the scope).
11.3 GDPR erasure
Triggered by POST /v1/erasures (§8.6), and by a person's erasure and a tenant's deletion (§8.6.9,
§8.6.10), which erase their parts the same way. There is no reference count and no walk of the scope's
owners: what is deleted and what is blanked is decided by where each event is stored, and every step
selects against one pin.
Selection. A whole-scope erasure takes its pin before its first read (the log head, then the cutoff,
§8.5) and selects every Captured row whose scope is the erasure scope or under it, recorded at or before
the cutoff (the rows in flight at the pin included), with the scope's sealed events and expired markers. A
selective erasure selects the events selector.memory_ids names that are stored at or under the scope
(live rows, sealed events, expired markers), and the derived records still citing a named event the log no
longer holds. An outside party's erasure selects the events labelled party:<address> under the tenant
root. Legal holds come first: a held event leaves the selection, and what cites it stays (§8.6).
Delete or redact.
- A whole-scope erasure deletes every selected event stored exactly at the erasure scope and redacts every
selected event stored in a scope below it: the row keeps its
id,scope, actors, timestamps andwal_offset; its payload becomes{"redacted": true}, its source, zone, referred times, labels, intent, location, atoms and provenance go, and it is never recalled again. The scope's tombstone, at the cutoff, then hides every row recorded at or before it from every read path. A tenant's deletion and a person's erasure follow the whole-scope erasure of each region with an erasure by id of what it left blanked, so nothing of it stays. - A selective erasure, and an outside party's, deletes every selected event and writes no tombstone.
- Deleting an event frees its idempotency claim and retires its id (a redacted event keeps both), drops the
preceded_byandsupports:<id>references surviving events hold to it, and removes its content, search, vector and fragment rows on every replica.
Derived records and artifacts. Facts that only erased events support go with them. A whole-scope
erasure deletes the episodes, concepts and beliefs under the scope unless every source they cite traces to
captures after the cutoff; a selective one deletes those its events support. No belief is demoted:
demoted_beliefs counts the beliefs deleted, and supporting_evidence_redacted stays false. Compiled
artifacts whose every source was erased are deleted, multi-source ones queued for re-evaluation, and since
0.13.0 the artifacts derived from those, to the chain's end. Blobs no surviving event references are
deleted (purge.blobs), shared ones kept (purge.retained_shared_blobs). A whole-scope erasure also
removes the code-plane repositories bound under the scope.
Audit and receipt. Each job writes one gdpr audit row (capability: forget.gdpr, the scope,
event_id = the erasure id, decision allow, failed or cancelled; ids and hashes, never the body), one
erasure_complete lifecycle row with the job's summary when it completes, and a durable receipt (§8.6.8)
with the ids, counts and hashes. The audit row is subject to the audit trail's retention like every row
(audit.retention, CORTEX_AUDIT_RETENTION, enforced by default since 0.14.0); the receipt is kept: it is the
lasting record, and an audit row can name the person.
11.4 Cross-workspace propagation
Not built. No route checks forget.gdpr.cross_workspace (a policy may still grant it), and no erasure
scans other workspaces for references to the erased events: an erasure reaches the scopes at and under its
own scope, and, for an outside party or a person, the scopes of the tenant §8.6.3 and §8.6.9 name. A
surviving event elsewhere that referenced an erased one loses that reference (preceded_by,
supports:<id>), and nothing else of it changes.
11.5 What forget does NOT do
- Does not affect audit log entries (audit is the immutable history of policy decisions, not memory content).
- Does not delete tokens (revoke separately via
/v1/auth/revoke). - Does not propagate to imported source systems (you must delete from Mem0/Zep/etc separately).
- Does not reach backups, checkpoints or the other stores listed as out of scope in
docs/ERASURE_COVERAGE.md. - Does not erase what a legal hold keeps until the hold is released (§8.6); the shard leader then erases it as the request asked.
12. Temporal Model
12.1 Time axes
Two independent axes, four endpoints per axis:
valid_from ─────────────────── valid_to
event time
recorded_from ─────────────── recorded_to
ingest time
| Field | Meaning |
|---|---|
valid_from | First moment the claim is true in the world |
valid_to | First moment it ceases to be true; null = open |
recorded_from | First moment CortexDB learned the claim |
recorded_to | First moment CortexDB superseded its own record; null = current |
Events have observed_at and recorded_at as singletons.
12.2 Temporal query primitive
The temporal block on any layer read or recall:
{
"temporal": {
"as_of": "2026-04-15T00:00:00Z",
"valid_during": ["2026-03-01", "2026-04-01"],
"recorded_during": null,
"natural": "last 30 days"
}
}
Semantics:
as_ofpins both axes.recorded_*≤as_of, andvalid_from≤as_of<valid_to. This answers "what did we believe at point T?"valid_duringfilters records whose[valid_from, valid_to)overlaps the range.recorded_*is pinned tonowunlessrecorded_duringis also set.recorded_duringfilters by ingest-time range only.naturalis parsed server-side and reduced tovalid_during. Supported phrases:"last N {days|weeks|months|years}","yesterday","this week","between X and Y","since X". Locale-aware. Anchored torequest_timeunlessreference_dateis also set. The grammar is English: never send Hinglish ("kal wala") here. Withnatural_mode: "lenient"(temporal_lenient_v1) an unparseable phrase becomes atemporal_natural_ignoredpack warning instead of a 422; withtimezoneset, calendar phrases use that zone's calendar. Since 0.14.0 a phrase the caller registered (§8.17) that applies at the request's scope is read before this grammar, as the window it names, whateverreference_dateortimezonesay.- On events,
valid_duringis capture time. For recall's events layer it filters onobserved_atand is pushed into retrieval as the index time range, so a memory captured on the 24th about the 25th is dropped byvalid_during: ["2026-09-25", "2026-09-25"]. Measured on the multilingual pilot, sending referenced dates this way cost temporal R@5 1.00 → 0.40. Send referenced dates asrefers_during. refers_during(refers_to_v1, T1a) is the time the question refers to:{from, to, zone?}, inclusive local dates (YYYY-MM-DD) or date-times (YYYY-MM-DDTHH:MM[:SS], no offset), inzone, elsetemporal.timezone. It is boost-only: applied once, after every candidate source has resolved the event candidates and before assembly, it moves every candidate event it matches ahead of the others (a stable partition: retrieval order is kept inside each group). It never adds or removes an event, so it cannot fetch a memory outside the candidate set (filter mode,mode: "filter", is T1b and is still an unknown field). An event matches on itscontext.refers_toentries, including every candidate of an ambiguous entry; an event withoutrefers_tomatches on its capture time. With two date bounds the comparison is on calendar dates, each event's in its own zone (refers_to[].zone, else itscontext.timezone, else the window's zone, else UTC): an IST memory and an Asia/Bangkok memory captured just after their local midnight on the 24th both match{"from": "2026-09-24", "to": "2026-09-24"}, although both are the 23rd in UTC. A bound with a time switches to an instant overlap and needs a zone. A bad bound,from > to, a time bound without a zone or a bad zone is422 INVALID_BODY(details.field = "temporal.refers_during"). The provenance trail gets{"phase": "refers_during_boost", "candidates": N, "matched": M, "mode": "boost"}, anddiagnostics.filters_appliedliststemporal.refers_during:boost./v1/recall/streamand/v1/answeraccept and validate the same fields.- Context prefix.
context_blockentries lead with[YYYY-MM-DD HH:MM UTC]. A non-English-tagged event (storedlanguagenoten) that has a capturecontext.timezonegets its local wall time as well:[2026-09-23 20:30 UTC] [2026/09/24 (Thu) 02:00 Asia/Kolkata] ..., so a capture at 02:00 IST reads as the 24th. English events, tagged or implicit, keep exactly the UTC prefix.
12.3 As-of semantics
as_of defaults:
| Field | Default |
|---|---|
as_of | null (= now) |
Implicit recorded_to pin | now |
Implicit valid_from pin | as_of (or now) |
?include_superseded=true on layer reads disables the recorded_to=null filter, returning all historical versions.
12.4 Natural-language parsing
A small deterministic parser handles common phrases. An unparseable temporal.natural is 422 UNPARSEABLE_TEMPORAL under natural_mode: "strict" (the default), and is dropped with a temporal_natural_ignored warning under "lenient". A phrase the caller registered (§8.17) that applies at the request's scope is read first, as the window it names:
POST /v1/temporal/phrases
{
"name": "fiscal_q3",
"pattern": "fiscal Q3",
"resolves_to": {"valid_during": ["2026-07-01", "2026-10-01"]}
}
12.5 The bi-temporal record store (implemented)
The axes above are populated and enforced by the bi-temporal engine
(BITEMPORAL_CONFLICT_DESIGN.md; crates/cortex-bitemporal). Rollout is
mode-gated: CORTEX_BITEMPORAL_MODE = off | shadow (default) | enforce.
In shadow mode the engine runs on every triple-derived fact, persists
BITEMPORAL WAL events, detects conflicts, and exports coverage metrics —
without changing legacy Fact fields. In enforce mode stated dates ground
t_valid_from/t_valid_to (real world-time, not ingest time).
The record-level query surface:
GET /v1/claims?scope=&subject=&predicate=&valid_as_of=&known_as_of=— the two-axis point query ("what was true at X, as known at Y").valid_during=start..end/recorded_during=start..endswitch to interval-overlap mode.GET /v1/claims/history?scope=&subject=&predicate=— the full change-log of one claim: every valid interval, every record-time correction, plus its conflicts.GET /v1/conflicts?scope=&status=open|all/GET /v1/conflicts/{id}/POST /v1/conflicts/{id}/resolve(pick|split|new_information|dismiss) — the conflict queue and manual resolution (§5.4 of the design). Every resolution is an audited, append-only WAL event. A resolution is in the store only once its log holds it. Values compare after normalization and, on server builds after v0.9.13 (M6 D0b), through the place-exonym table as well, so "Dilli" beside "Delhi" is a restatement and opens novalue_disagreement. A conflict row may carryconfidence(0..1): avalue_disagreementwhose values are within edit distance 2 of each other and match no exonym ("Gurgaon" / "Gurgaun") stays open atconfidence: 0.5, a probable spelling variant. The field is absent for a full-confidence conflict, so existing rows serialize exactly as before.GET /v1/beliefs/history?belief_id=andGET /v1/concepts/{id}/history— semantic-delta version history (§5.3): superseded versions carryrecorded_toclosed.
Every finite validity boundary carries a basis: stated (the source
asserted the world date — render "on/since observed (we
bounded it by when we learned it — render "by
13. Lifecycle Events Catalog
Every row has lifecycle_id (lce_…, also the SSE frame's id), ts, scope (absent on
import rows and on deployment-wide rows), event (the name below, also the SSE frame's event)
and data, the event-specific payload. Rows are delivered on /v1/lifecycle/stream and returned
by the other lifecycle reads (§8.9). A payload field marked ? is absent when unset (an array,
when empty).
| Event name | Fires when | Payload |
|---|---|---|
captured | WAL append succeeds | {event_id, actor, modality, wal_offset, batch_id?}; batch_id only on a bulk write's rows |
extracted | Async extract stage done | {event_id, derived: {facts?, entities?, beliefs?}} (ids) |
indexed | BM25 + HNSW insert done | {event_id, layers_indexed} |
consolidated | Belief / understanding revised | {event_id, beliefs_updated, conflicts_resolved, superseded_facts?} |
compressed | Episode sealed / understanding versioned | {episode_id?, understanding_ids?} |
forgotten | Records deleted, or an event cancelled | {layer, count, by_actor?, cascade?}; a cancel (§8.9.5) writes {"layer": "events", "count": 0, "cascade": "cancelled"} |
policy_revoked | The subscription is no longer allowed | {reason} (stream closes after; never in the log) |
lagging | The log evicted rows the stream had not delivered; the stream closes after it, and the frame carries no SSE id | {resume_from}: the last lce_ id delivered, else the resume anchor, else null |
import_progress | Import job tick | {import_id, fraction_complete, processed, total} |
import_complete | Import job done | {import_id, summary} |
import_error | Import row failed | {import_id, line, error} (line is null when the error is not one line's) |
erasure_progress | GDPR job tick | {erasure_id, phase, fraction_complete, deleted_events, redacted_events} |
erasure_complete | GDPR job done | {erasure_id, summary, audit_id} |
synthesis_progress | Synthesize job tick (POST /v1/understanding/synthesize) | {job_id, stage, questions_total?, concepts_done?, fraction_complete}; stage is digest_built, questions_extracted or concept_synthesized |
synthesis_complete | Synthesize job done | {job_id, concepts_created} |
synthesis_failed | Synthesize job failed | {job_id, error} |
derivation_held | Since 0.15.0 (derivation_review_v1): a derivation policy held a candidate for review (§8.7.27); sent by the shard's leader as the held record commits | {held_id, event_id, rule, topic?, lapse_at}, never the candidate's words |
Defined in the wire type but not emitted by this release: policy_changed ({tier, capability_diff?}), export_progress ({export_id, fraction_complete}) and export_complete
({export_id, url?, size_bytes}).
Filtering: ?events=captured,consolidated to subscribe to a subset; ?job_id=, ?import_id=,
?erasure_id=, ?batch_id= and ?export_id= select one job's rows (§8.9.1). The published JSON Schema
(GET /v1/schemas/lifecycle_event) validates the rows served.
14. Audit Log Schema
The authentication layer writes one row per authenticated request, once the response is built,
whatever its status and whoever answers it: a route, or, since 0.14.0, the authentication layer itself before the
route runs (the operator plane's gate, a pre-body hook, a body that does not read to its end; Denials below). Rows
start once the caller is known: a 401, a deactivated principal's request, a directory outage's 503 and a 410
TENANT_DELETED write none. Routes write rows of their own:
POST /v1/forget and POST /v1/erasures (gdpr: true), the directory and SCIM writes, RD1 re-derivations, a
lifecycle cancel (§8.9.5), and since 0.15.0 a subject's consent change (action: "derivation_consent", §8.32.3), a
policy texts erasure (action: "derivation_text_erase", §8.32.4), a correction (action: "correction", §8.7.24) and
a correction's undo (action: "correction_undo"), a review decision (action: "review_decision", §8.7.27) and a
re-derivation job's approval (action: "derivation_job", §8.32.7), all gdpr: true. Rows are read with
GET /v1/audit (§8.10). Schema:
{
"id": "audit_0192f0c4b7a87c31a2d5e0e5b8f1a9c3",
"ts": "2026-05-13T15:42:09.018Z",
"actor": "agent:planner_v3",
"token_jti": "...",
"tenant_id": "acme",
"endpoint": "POST /v1/experience",
"capability": "",
"decision": "allow",
"decided_by_tier": "deployment",
"request": {
"method": "POST",
"path": "/v1/experience",
"body_hash": "sha256:abc...",
"headers_hash": "sha256:def...",
"body_bytes": 4823,
"tenant_pepper_version": 2
},
"response_status": 202,
"client_ip": "1.2.3.4",
"request_id": "req_01HX...",
"elapsed_ms": 12,
"gdpr": false,
"prev_hash": "sha256:7a41...",
"row_hash": "sha256:9f2c..."
}
| Field | Type | Notes |
|---|---|---|
id | string | audit_ and 32 hex digits |
ts | string | RFC 3339 |
actor | string | The caller |
token_jti | string | Absent when the credential carries no jti |
tenant_id | string | The billing tenant |
scope | string | Absent on the authentication layer's rows; a route's row names its scope |
endpoint | string | METHOD path |
capability | string | "" on the authentication layer's allow rows; on a deny row the capability the refusal decided ("" when none); a route's row names the capability it exercised (admin.compact on re-derivation rows, scope.write on a cancel's) |
decision | string | allow or deny on the authentication layer's rows (deny for a refused request, below); allow or failed on a forget's, an erasure's and a scheduler's rows (cancelled on an erasure's that a cancel stopped, §8.6.5); allowed on a directory or SCIM accounts change; DERIVED_REDERIVE:<step> on a re-derivation's |
decided_by_tier | string | deployment on an allow row; deployment, tenant, token, scope, request or handler on a deny row (below); handler on a route's own row; scheduler on a scheduler's |
request | object | method, path, body_hash (sha256:<hex>, or unhashed:multipart, unhashed:oversize, unhashed:streaming or unhashed:unread), headers_hash (empty on a scheduler row), body_bytes (absent for a body the layer did not buffer), tenant_pepper_version (2 under the kept pepper, below) |
response_status | int | The status answered |
event_id | string | An event, an erasure or a directory entry's id; absent on the authentication layer's rows |
client_ip | string | Removed from rows served to a caller without audit.read.cross_actor |
request_id | string | The request's X-Request-Id (§8.10.1); a client's is sanitised to [A-Za-z0-9._:-], at most 128 characters |
elapsed_ms | int | |
gdpr | bool | Always present |
chain | object | The token's chain {act, app, client, run, run_start, taint, auth_time, minter, issuer}, each link present and the issuer entry's id, when it carries a claim other than minter (DB-16); auth_time counts, so a token whose only claim beyond minter is auth_time writes it |
break_glass | object | {reason, ticket} of an operator-key request's X-Cortex-Break-Glass, never its note |
subject | object | The subject-token shadow's verified subject {sub, jti, issuer, outcome}; for a subject token that did not verify, {outcome, code}: outcome invalid_token, or not_evaluated with code: "SUBJECT_UNMAPPED" for a directory mapping this node cannot read (directory_not_here). outcome is deferred for a request whose decisions are evaluated after its response |
denial | object | On a deny row: {link?, reason, path?, check?, role?, suppressed?}, the fields of the request's enforced decision line, ids and closed vocabularies only: link (capability, confinement, tenant, person, view, app), reason, the deciding path (<record>#<field>), the report check whose switch refused, the role asked for, and suppressed (below). With no check noted (CORTEX_DECISION_LOG=off or report leave no context to note one in, unless the refusal travels with the response), reason is the error code in lower case and path is absent |
action | string | Since 0.15.0, on a route's row that records an action: derivation_consent (a subject's consents given, changed or withdrawn; event_id the settings record's id), derivation_text_erase (policy texts erased; event_id the erasure's receipt id), correction (a correction made) or correction_undo (one undone), each with event_id the correction's id, review_decision (a held candidate decided; event_id the decision's id) and derivation_job (a re-derivation job approved; event_id the job's id). The row holds the peppered hash of what it records, never its words. Absent on every other row, which keeps its bytes and its chain hash. GET /v1/audit?action= selects them |
prev_hash, row_hash | string | The hash chain (§8.10.4); absent on legacy rows, prev_hash also on the first hashed row |
A row has no user_agent.
Denials. The row of a request that ends in a 403 writes decision: "deny", capability the capability the
refusal decided ("" when none), scope the scope it decided at, and decided_by_tier from its path's record:
deployment, tenant, token, scope (a registered record, an unregistered path, the registry), request
(request#, pack#, read#, use#, mcp#), or handler (no path). Every other row keeps allow, deployment and
capability: "", and no denial. A 401 writes no row: a credential that does not verify names no principal; nor does a deactivated
principal's request, a directory outage's 503 or a 410 TENANT_DELETED (rows start once the caller is known). A by-id
read's 404 that masks a denial writes allow and no denial: the caller reads its own rows (audit.read), and a
deny there would confirm what the 404 hides. A principal (billing tenant and actor) writes at most 60 denial rows per
60 s, from its first in the window; past that each denial is counted, and once the window has ended its last denial is
written, carrying denial.suppressed, the number of the window's denials that wrote no row of their own; it is written
before the next row anyone appends (the principal's next denial included), so a flood leaves 60 rows and one count a
minute. The bound holds 65,536 principals' open windows; past it the oldest closes early, with its count. It is
node-local and in memory: a restart forgets an open window's count. The operator key's principal is its billing tenant
and its X-Cortex-Actor.
Since 0.14.0 what the authentication layer answers itself once the caller is authenticated, before a route runs,
writes its row by the same rules: the operator plane's gate (403 BREAK_GLASS_REQUIRED under deny, 400
INVALID_HEADER for a malformed, repeated or oversized X-Cortex-Break-Glass, 503 NOTICE_UNAVAILABLE, §8.15.3), a pre-body hook (an import's or export's 403
POLICY_DENIED for a token whose caps narrow the route's capabilities away, 503 MEMORY_PRESSURE, 503
MEMORY_INGESTION_UNAVAILABLE, 429 IMPORT_SATURATED) and a body that does not read to its end (400
INVALID_BODY). A 403, and the gate's 400 INVALID_HEADER, write deny and a denial within the principal's
bound; any other status writes allow,
deployment and capability: "", as a route's own 400 or 503 does: a pre-body hook's 503 or 429 and an unread body's
400 are not authorization decisions. The gate's 403 names what its decision line
names: check: "operator_access", reason the class (stored_rows, admin_content, private_region,
in_band), path: "request#x-cortex-break-glass", at the scope the gate decided, so decided_by_tier is
request; so does a route that makes that decision itself (an in-band write or mint, a by-id read decided by its
row). Its 400 names check: "operator_access", reason: "break_glass_invalid" and path: "request#x-cortex-break-glass" (decided_by_tier request) at no scope, because the gate reads the header before
it reads what the request names; so does a deployment minter's mint that sends a malformed header. An import's or export's narrowing by the token's caps names link: "confinement", reason: "confined"
and path: "token#caps", the missing capability in capability. The gate's refusal hashes the body as a route's
row does; a body the layer answered before reading it (a pre-body hook refuses before the body is read) or one that
did not read to its end is unhashed:unread.
Hashes:
body_hash = sha256(raw body bytes || pepper), the body exactly as received; a body the layer does not buffer carries a marker instead:unhashed:multipart,unhashed:oversize(over 8 MiB),unhashed:streaming, and (since 0.14.0)unhashed:unreadfor a body the layer answered before it read it, or one that did not read to its end.headers_hash = sha256over the request's header names in sorted order, each followed by:, its value and a newline; the values ofauthorization,x-cortex-subject-tokenandx-cortex-break-glassare left out (their names are hashed). It is unpeppered.
Pepper. The pepper the trail hashes bodies with is kept in a file, so POST /v1/audit/verify (§8.10.3) matches a
row after a restart: <data_dir>/audit_pepper.json, or the file CORTEX_AUDIT_PEPPER_FILE names, created at the first
start, whole (a staged file linked into place), mode 0600, and never replaced; {"version": 2, "pepper": "<64 hex digits>"}. Rows hashed with it record request.tenant_pepper_version: 2. Version 1 is the pepper each start of an
older binary drew and kept nowhere: a row it hashed verifies under no kept pepper, and its version says so. A pepper
file that does not read refuses the boot, exit 78 AUDIT_PEPPER_INVALID; it is never replaced by a new pepper. One
pepper serves the node, every tenant, and nothing rotates it. On a cluster data node the variable is set in the node
config's [engine]; each node keeps its own pepper beside its own trail. The file holds no content, only the key the
body hashes are peppered with. A cold backup of the data dir carries it; a trail kept outside the data dir
(CORTEX_V1_AUDIT_PATH) is restored with its pepper, and a CORTEX_AUDIT_PEPPER_FILE outside the data dir with that
file. The chain (§8.10.4) is unpeppered and unaffected.
Storage. The trail is a JSON Lines file at CORTEX_V1_AUDIT_PATH; without it the rows live
in memory and a restart loses them. Each node keeps its own. Since 0.14.0 the file is the store: a start reads only
its last row, for the chain's head, and cuts off a torn last line (a write the process did not finish), and every read
streams the file (GET /v1/audit newest first, only as far as its page), so no row is held in memory. A line that does
not parse is skipped by every read and is the first broken row POST /v1/audit/chain/verify reports; a last complete
line that does not parse refuses the file at start, and the server then keeps its trail in memory, with an error in its
log. Not indexed in HNSW; not part of the
recall pipeline.
Retention. audit.retention of the deployment preset (CORTEX_DEPLOYMENT_PRESET; P7D on
dev_local, P1Y to P3Y on the others) or CORTEX_AUDIT_RETENTION (an ISO 8601 period, or
off); with neither set, no row is deleted. A daily sweep, the first five minutes after start,
deletes the rows written before the cutoff, gdpr: true rows included, and keeps the chain
verifiable from where it now starts (§8.10.5 anchor); CORTEX_AUDIT_RETENTION_ENFORCE=off only
counts them. A period that does not parse refuses the boot (exit 78 AUTH_CONFIG_INVALID).
The published JSON Schema (GET /v1/schemas/audit_row) validates the rows served.
15. Importer Mappings
What each import route (§8.11) writes. Every row of the four source routes becomes one envelope with
modality: "imported", a message content of role user (or, for a Zep edge under keep_triples, a typed triple), a
canonical source (source_id import:<provider>:<content fingerprint>, content kind text/plain, one fragment
record), and an idempotency_key from its source: import:<provider>:<id>, else a hash of its user, time and text
(§8.11). A resent export therefore replays. The labels are imported, then imported_memory under mode: keep or
keep_triples (with directives.extract: []), then the source's own labels below, then the importer's stamp
derived_by:import:<provider>@1. The caller is the row's observed_actor and subject. A source field the tables do
not list is ignored.
15.1 Mem0
| Mem0 field | CortexDB target | Notes |
|---|---|---|
memory | content.text | Required; empty fails the row |
id | idempotency_key import:mem0:<id> | Optional (0.15.0) |
user_id | {user_id} in scope_template | unknown when absent |
created_at | context.observed_at | Now when absent |
categories | Labels category:<name> | 0.15.0. Each string, trimmed, once, in order, at most 16, each within the label limits; any other entry is skipped |
metadata | Labels meta:<key>=<value> | 0.15.0. Each scalar entry, by key: a string its text, a number or boolean its JSON. Each label must be within the label limits' size and characters, and the row within their count; null, arrays and objects are skipped |
agent_id, run_id | — | Accepted, not read |
15.2 Zep
| Zep field | CortexDB target | Notes |
|---|---|---|
content | content.text | |
fact | content.text when content is absent | A row with neither fails as an empty message |
id (alias uuid) | idempotency_key import:zep:<id> | Optional (0.15.0) |
valid_at | context.observed_at | Now when absent |
user_id | {user_id} in scope_template | unknown when absent |
fact_name | The triple's predicate, in snake case | keep_triples only (0.15.0): WORKS_AT, worksAt and works at are all works_at |
source_node_name, target_node_name | The triple's subject and object, as entities (ent_<slug> with the name) | keep_triples only |
invalid_at | The end of the fact's validity | keep_triples only: the row's one context.refers_to interval runs from valid_at to invalid_at in UTC, and the fact made from the triple is valid until then (through that second) |
Under keep_triples a row is an edge when it has fact_name and both endpoint names. It becomes a typed triple whose
fact the indexer writes with no model call (§7.3): valid from valid_at, the triple's context.observed_at, and, with
invalid_at, until then. Only a row this importer stamped takes its validity from refers_to: a caller's own triple
with a refers_to keeps an open validity, as before. Any other row is written as keep writes it.
15.3 Letta
| Letta field | CortexDB target | Notes |
|---|---|---|
text | content.text | A row without it fails as an empty message |
id | idempotency_key import:letta:<id> | Optional (0.15.0) |
created_at | context.observed_at | Now when absent |
kind | Label letta_kind:<kind> | 0.15.0; it was not read before |
Every row is written at the request's scope.
15.4 OpenAI memory export
| OpenAI field | CortexDB target | Notes |
|---|---|---|
text | content.text | Required |
id | idempotency_key import:openai:<id> | Optional (0.15.0) |
created | context.observed_at | Now when absent |
Every row is written at the request's scope.
15.5 Generic JSONL
Each line is a canonical experience envelope (§3.5), written as POST /v1/experience would write it, or a line of
/v1/export output (§8.12.1), which is converted back into one:
{"scope":"org:acme/user:alice", "modality":"conversation", "content":{"kind":"text","text":"..."}, "context":{"observed_at":"2026-05-13T15:42:00Z"}, "idempotency_key":"line-1"}
{"id":"evt_...", "scope":"org:acme/user:alice", "caller":"user:alice", "observed_actor":"user:alice", "subject":{"id":"user:alice","type":"user"}, "scope_key":"acme", "modality":"conversation", "content":{"kind":"text","text":"..."}, "context":{"observed_at":"2026-05-13T15:42:00Z","recorded_at":"2026-05-13T15:42:01Z"}, "wal_offset":17}
| Exported field | Envelope target |
|---|---|
scope, modality, source, content | The same (a content that is not a tagged block is kept as json) |
observed_actor, subject | The same: another actor needs scope.write.on_behalf_of, another subject scope.write.about_other |
context | The same, recorded_at becoming source_recorded_at unless one is set |
extract | directives.extract (a stage this build does not know is dropped) |
language, scripts | Kept when they were a typed hint (language_source: "hint"); otherwise detected again |
id | idempotency_key: "reimport-<id>", so importing one export twice replays |
context.labels | The same, but a stamp is kept only as the derived_by field could have set it: one stamp in the client grammar, on a typed triple. Any other (an importer's derived_by:import:<provider>@<version>, one out of grammar, a second one, one on another content kind) is dropped and the job warns derived_by_dropped:<name> (§8.11.5) |
provenance | Kept where the importing log can stand by it: an id of an event the importing root holds (live, sealed, expired or retired) is kept; an id of another root's event is dropped; an id the log does not hold is replaced by the event this caller re-imported it as (reimport-<id>), else kept as it is |
caller, scope_key, wal_offset, derives, atoms, source_blob_ids, excluded_from_recall | Not carried over: the re-imported event is a new, live event of the importing caller. Atoms are stamped by the server from the writing principal's chain, so a re-imported line is the importer's own statement and carries the importer's atoms, never the file's: carrying a file's atoms would let an importer forge a chain. Only a file-level restore (scripts/cold_backup.py restore) keeps the original atoms |
16. Error Catalog
The table below is the complete set of error codes this release answers, generated from the code on
2026-10-27: every error_code a plain server, a cluster data node or a cluster ingress puts in the
error envelope (§6.6: error_code, message, request_id, retriable, and details when the code
has any), with the HTTP status it is answered with. Rows are sorted by HTTP status, then code; a code
answered with more than one status has a row for each. SCIM's routes answer RFC 7644's statuses, which identity
providers act on, so three codes have another status there (CHANGESET_STAGING_FULL, ACCESS_RESTORE_PENDING,
TENANT_DELETED): their rows say so, and §16.1 has SCIM's whole map. Retriable is the envelope's own
retriable flag: yes means the same request can succeed later unchanged (after Retry-After when
the response carries it), no that it cannot without a change by the caller or the operator. Where
the flag depends on the route or the reason, the cell says how. Every envelope carries request_id, the
request's id, which the response's X-Request-Id header carries too (§6.7).
Clients must treat a code they do not know by its HTTP status and the envelope's retriable, never by
the absence of a match: a minor release may add codes, and a route may answer a code of another route
family (the shard's own refusals, for example, pass through the generic write paths unchanged).
| HTTP | Code | Meaning | Retriable |
|---|---|---|---|
| 400 | AMBIGUOUS_SELECTOR_CONFIRM_ALL | /v1/forget: a selector that names events together with confirm_all: true; the forget is refused instead of widening "delete these ids" into a scope wipe | no |
| 400 | BAD_REQUEST | PUT /internal/ui/settings/{id}: a value the setting does not take | no |
| 400 | BLOB_UNSUPPORTED_CLUSTERED | A capture carrying a blob_ref on a cluster data node, whose replicas would each index the blob as text | no |
| 400 | CASCADE_UNSUPPORTED_CLUSTERED | A POST /v1/forget or /v1/forget/preview on a cluster data node whose derived-record purge would keep its source events: cascade: derived_only with anything but event ids and the events layer included, or a confirm_all wipe whose layers leave out events under either cascade. That purge is node-local, so a cluster data node refuses it | no |
| 400 | GRAPH_QUERY_REFUSED | POST /v1/code/graph/query and /export: a walk asked for no bounded plan (no route sends one); a postings read that failed is 503 QUERY_ERROR | no |
| 400 | INVALID_BODY | The body is not JSON, could not be read, or is not UTF-8 (§6.6; details.part: body, details.reason); an AuthZEN request AuthZEN calls bad; a cluster ingress's body that is not JSON or a routing key of the wrong type | no |
| 400 | INVALID_DAY | GET /v1/admin/usage: from or to is not a YYYY-MM-DD day | no |
| 400 | INVALID_DIRECTORY | POST /v1/code/inventory (kind: files): the path is refused by the file inventory (its message says why) | no |
| 400 | INVALID_FILTER | SCIM: a filter the server does not parse or support (SCIM scimType: invalidFilter). SCIM routes answer RFC 7644's error body: the CortexDB code leads its detail ("INVALID_FILTER: …") | no |
| 400 | INVALID_GRAPH_QUERY | POST /v1/code/graph/query and /export: roots must hold 1 to 16 exact indexed names, or the query is out of shape | no |
| 400 | INVALID_HASH | /v1/code/pins: manifest_hash is not 64 hex characters | no |
| 400 | INVALID_HEADER | A request header that does not parse (since 0.14.0): an X-Cortex-Actor that is no principal id, on the operator key, an auth-disabled server or the unsigned development mode (it was a 401 INVALID_BODY); an X-Cortex-Break-Glass on an operator-key request or a deployment minter's mint that is sent more than once, is longer than 512 bytes, is not ASCII or does not parse, in every mode (§8.15.3; the request's audit row is a deny, §14); a lifecycle stream's Last-Event-ID that is not UTF-8 or not an lce_ id; an If-Match of no known form on PUT /v1/directory/{id} and on a SCIM User's PUT, PATCH or DELETE (SCIM's invalidValue, detail starting INVALID_HEADER: ). details {part: "header", field, reason}: the header as the route documents it (X-Cortex-Actor, X-Cortex-Break-Glass, Last-Event-ID, If-Match), and what is wrong with it. The keyed blob routes' Idempotency-Key (422 INVALID_IDEMPOTENCY_KEY) and the memory planes' proof headers keep their own codes | no |
| 400 | INVALID_PATHS | POST /v1/code/certify: paths out of shape | no |
| 400 | INVALID_PATH_PARAMS | A path parameter does not parse; details.part: path, details.reason (§6.6, 0.10.3), and on the lifecycle routes details.field (a malformed {lce_id} or {evt_id}, since 0.14.0) | no |
| 400 | INVALID_PERIOD | GET /v1/admin/usage: period is not all or mtd | no |
| 400 | INVALID_QUERY | A query-string parameter has the wrong type, or a required one is missing; details.part: query, details.reason (§6.6, 0.10.3). Handlers answer the same code for a query value they refuse, the lifecycle routes for a malformed event_id or since_lifecycle_id with details.field (since 0.14.0) | no |
| 400 | INVALID_REPO_NAME | A repository name outside [A-Za-z0-9_-], 1 to 115 characters | no |
| 400 | INVALID_REQUEST | Any other plain-text 400 the v1 router produced before a handler ran (§6.6, 0.10.3); a directory {id} that is neither a principal nor a scope path, an If-Match that disagrees with if_version (one out of form is INVALID_HEADER); a POST /v1/auth/revoke with an invalid exp or identity | no |
| 400 | INVALID_ROLE | GET /v1/admin/usage: role names no ledger role | no |
| 400 | INVALID_SUBTREE | /v1/admin/plans/{subtree}: {subtree} is not a tenant subtree exactly (its first CORTEX_TENANT_DEPTH segments) | no |
| 400 | INVALID_SYMBOL | POST /v1/code/certify: symbol is not a canonical SCIP identity | no |
| 400 | INVALID_SYMBOL_PREFIX | GET /v1/code/symbol/search: prefix is empty or longer than 256 bytes | no |
| 400 | MUTABILITY | SCIM: a PATCH or PUT changes an attribute SCIM marks read-only (scimType: mutability) | no |
| 400 | ROUTE_HEADER_INVALID | Cluster data owner: a malformed x-cortex-route header (<root>=<epoch>,…) on a data owner | no |
| 400 | TRAVERSAL_REFUSED | GET /v1/code/calls: a walk asked for no bounded plan (no route sends one); a postings read that failed is 503 QUERY_ERROR | no |
| 400 | UNSUPPORTED_QUESTION | POST /v1/code/certify: an unsupported certified question | no |
| 401 | ACTOR_MISMATCH | X-Cortex-Actor differs from the token's sub, or is missing for a token that verifies and needs it (an issuers-file entry in prefix, hash or directory mode and an MCP call may leave it out); a token that does not verify answers its own refusal, with or without the header | no |
| 401 | CLAIM_NOT_PERMITTED | The token carries a principal-chain claim its issuer is not bound to assert | no |
| 401 | EXPIRED_TOKEN | The token's exp has passed; a token of an issuers-file entry or with chain claims carries details.issuer | no |
| 401 | FRESH_AUTH_REQUIRED | POST /v1/publish of a norm (intent rule, regulation, vision, goal, procedure or definition) without a sign-in within the last 10 minutes (auth_time); details.max_age_s: 600, with RFC 9470's WWW-Authenticate: Bearer error="insufficient_user_authentication", max_age="600" (since 0.14.0) | no |
| 401 | INVALID_TOKEN | The verifier failed opaquely (most often a key mismatch on an expired token): the token cannot be verified; /mcp answers it for the operator key or an unsigned actor, which are not MCP credentials | no |
| 401 | INVALID_TOKEN_CLAIM | A principal-chain claim (act, app, client, run, run_start, taint, auth_time, minter, cdb_crit) is malformed, client: "person" names an agent or a run, iat is ahead of the clock, a minter token's lifetime is over its ceiling (unless CORTEX_MINT_LIFETIME_ENFORCE=off), or act names an AI employee of the tenant (reason: act_not_delegable, since 0.14.0) | no |
| 401 | INVALID_TOKEN_SIGNATURE | The token's signature does not verify, it is not yet valid, its issuer is not allowed, its JWT algorithm is not supported, or a required claim is missing or of the wrong shape; an issuers-file entry's token carries details.issuer and details.reason (unknown_kid among them) | no |
| 401 | MISSING_TOKEN | No Authorization: Bearer header on a route that needs a credential, or a bearer whose format the verifier does not recognize (a mistyped operator key among them), with or without X-Cortex-Actor | no |
| 401 | REVOKED_TOKEN | The token's jti is on the revocation list | no |
| 401 | SUBJECT_UNMAPPED | The token's subject maps to no principal (an issuers-file entry's subject mapping, contract §2.7), or the principal's directory entry is deactivated (reason: deactivated); details.reason is one of missing, too_long, malformed, kind, service, not_a_principal, not_in_directory, foreign_namespace, personal_data_in_id, directory_not_here, deactivated | no |
| 401 | WRONG_TENANT | The token's aud names another deployment, or carries no cortexdb:tenant: prefix; SCIM: the bearer names no tenant whose root this server holds | no |
| 402 | LICENSE_EXPIRED | A licensed build (CORTEX_LICENSE_ENFORCE=1 at compile time) whose license ended and whose grace period ran out answers every data request this; health, version, ready, the console, /internal/ui/*, every GET /v1/admin/*, /metrics, /v1/auth/whoami, POST /v1/export, the published contract (/v1/openapi.json, /openapi.json, GET /v1/schemas, /v1/schemas/{name}) and, since 0.14.0, deleting data (POST /v1/forget and its preview, POST /v1/erasures and its preview, /v1/erasures/person, /v1/erasures/tenant, /v1/erasures/{id}/cancel, and GET /v1/erasures/{id}, /verify and /receipt) still pass; since 0.15.0 so do the change feed (GET /v1/derivation/feed, an export), governed memory formation's deletions (DELETE /v1/derivation/settings, POST /v1/derivation/texts/erase and DELETE /v1/episodes/{id}, §8.32.3, §8.32.4, §8.7.26) and a correction's rejection (POST /v1/corrections with action: "reject", §8.7.24): the gate lets every POST /v1/corrections through, and the route answers this code to its other actions. details.company, plan, license_id, last_day, contact, portal, data: "safe and unchanged" | no |
| 402 | LICENSE_REQUIRED | As LICENSE_EXPIRED, for a licensed build that has held no valid license for 14 days; details.portal, details.data | no |
| 402 | PLAN_LIMIT_REACHED | Hosted plans (CORTEX_PLANS=1): the subtree's plan allows no more stored memories, recalls or answers this month, or tenants; details.limit (memories, recalls_month, answers_month, tenants), used, max, plan, subtree, upgrade_url, resets_at for a monthly limit | no |
| 403 | APP_NOT_ADMITTED | The token's application (app, or none for a chain that carries none) is not admitted at the scope by the tenant's application records (DB-18). GET /v1/events and POST /v1/export answer such a refusal as their own 403 POLICY_DENIED (§8.7.1, §8.12.1); the other layer reads name this code | no |
| 403 | ATOMS_REDIRECT_REFUSED | An agent's or an application's write that must land in its writer's private space cannot: the token's confinement does not admit the private space (reason: confinement), the chain names no person (no_person), the private space is not a scope path (no_private_space), or the row would carry more than 64 atoms (too_many_atoms); details.scope, details.reason. Nothing was written (write_provenance_v1, since 0.14.0) | no |
| 403 | BREAK_GLASS_REQUIRED | Under CORTEX_OPERATOR_DATA_READS=deny, the deployment's or the tenant's own, an operator-key action of a refused class without X-Cortex-Break-Glass: a read of stored rows (stored_rows), a content-returning admin route (admin_content), a private region's read (private_region) or an in-band action (in_band: a registry write, a change set's activation that a legacy registry route would make one (§8.15.3), a write into a private region or a shared org-tree scope, a deployment minter's mint of a data capability); details {mode, class, route} | no |
| 403 | COMMITMENT_DENIED | A /v1/memory/commitments/* credential did not carry decision authority: the transport bearer, the purpose-bound proof, the admitted service caller, or scope membership. Which one is deliberately not disclosed | no |
| 403 | NOT_A_MEMBER | The write-admission surfaces (POST /v1/experience, /bulk, /v1/import, /v1/synthesize) keep this code for a registered scope's role failure (not a member, or below Writer). Every other route reports a roster refusal as POLICY_DENIED with details.denied_by_tier: "scope"; both SDKs map the two into one policy-denied exception family | no |
| 403 | ORIGIN_NOT_ALLOWED | /mcp from a browser origin CORTEX_MCP_ALLOWED_ORIGINS does not list; details.origin | no |
| 403 | POLICY_DENIED | Effective capability missing, or the caller is not on the roster of the scope it named. details.capability names the capability that was required; details.denied_by_tier is deployment, tenant, scope or actor (actor when the caller's own token is confined away from that scope, scope when the scope's roster refused it); since 0.14.0 a refusal of the principal-chain rules names details.link (minter, confinement, tenant), a mint past its minter's reach details.reason (caps_exceed_minter, scopes_exceed_minter with details.entry or details.field, deployment_mint_requires_operator, minted_token_cannot_mint; §8.16.3), a read refused only for want of the purpose its roster path names purpose_required with details.purpose (§8.3), revoking another token without the trusted operator revoke_requires_operator, and a refused registration its reason (not_a_member, insufficient_role, registration_required, billing_tenant_mismatch, billing_tenant_unbound), naming no other tenant's id. A trusted-operator route called with another credential, and an application's reference root written by anyone but its principal (details.reason: reference_root), answer it too | no |
| 403 | PUBLISH_PERSON_REQUIRED | POST /v1/publish: only a person publishes; the chain is an agent's, a run's, a service's, an application's own (app without client: "person") or the operator key's (since 0.14.0) | no |
| 403 | REEXTRACT_NOT_ALLOWED | POST /v1/derivation/rederive with mode: reextract while CORTEX_DERIVATION_REEXTRACT is off, or operator and the caller is not the trusted operator; details.switch (§8.32.7) | no |
| 403 | RUN_REQUIRED | A token that names an agent (act) and no run writes nothing: mint it with run (contract §1.3); details.scope | no |
| 403 | SCOPE_REGISTRATION_REQUIRED | The scope must be registered before it can be written (a durable registry under a deployment that does not auto-register); the scope routes add details.scope | no |
| 404 | BLOB_NOT_FOUND | No blob of this id the caller may read, or a capture's blob_ref names none | no |
| 404 | COHORT_ALIAS_NOT_FOUND | /v1/answer with cohort: the focus alias (or the alias in the question) names no customer the caller may read under the scope; unknown and unauthorized answer the same (§8.4.2) | no |
| 404 | CONNECTION_NOT_FOUND | PUT /internal/ui/settings/{id}: no connection of this id | no |
| 404 | FEATURE_NOT_FOUND | PUT /internal/ui/features/{id}: no feature of this id | no |
| 404 | JOB_NOT_FOUND | No re-derivation job of this id for the caller's tenant (continue_from, job_id, or the status route) | no |
| 404 | NOT_FOUND | Resource absent — or present but outside the caller's tenant. A record the caller may not read is reported byte-identically to one that does not exist, so no by-id route confirms existence across a tenant boundary. Also POST /v1/auth/signup while anonymous signup is off, a path no route of this server serves (message: "no route of this server serves {method} {path}", since 0.14.0; /mcp keeps its own message while CORTEX_MCP is off), and a cluster ingress's unknown path | no |
| 404 | REPO_NOT_FOUND | No repository of this name the caller may read (a scope the caller may not read answers the same) | no |
| 404 | SESSION_NOT_FOUND | voice_sessions_v1: GET /v1/sessions/{session} or POST …/end of a session this node does not hold at the scope for the caller (it ended, expired, was lost to a restart or a leader change, or another principal started it); details.scope, details.session (§8.3.3) | yes |
| 405 | METHOD_NOT_ALLOWED | A method the path does not serve, on every route: the Allow header names the methods it does (since 0.14.0; before, a bare 405 with no body), among them GET /mcp (the server offers no event stream) and DELETE /mcp (no sessions); a cluster ingress answers it for a method a known path does not take | no |
| 408 | REQUEST_TIMEOUT | Cluster ingress: the body did not arrive within body_timeout_s | no |
| 408 | WAIT_TIMEOUT | A wait ran out of its budget; the request's work continues. A ?wait= barrier on POST /v1/experience or /v1/experience/bulk (about 30 s for a single write; min(30 s + 1 s per item, 600 s) for a bulk, the indexer wait included): the write is captured; details.waited_ms and details.waiting_on (indexer, stage, indexing) say how long and on what, plus status_url (single) or event_ids (bulk); a resend replays only items that carried their own idempotency_key (§8.1, §8.2). A demanded consistency token not reached within the route's budget: details.waiting_on is registry, indexer, declared or access_view (§6.11) | yes |
| 409 | ACCESS_ASSERTION_FAILED | The change widens access past the tenant's access assertions; details.failed[] lists {policy, case, widening}. Change the change set, or the assertion in a change set of its own. The legacy registry routes answer it for a widening call too | no |
| 409 | ACCESS_LIMIT_REACHED | The write would take the org past a limit this deployment enforces (brain_scopes, sources, containers_per_source, sets, policies; A28): remove records first, or ask the operator; details.limit, value, used, setting, scope | no |
| 409 | ACCESS_REPORT_OFF | GET /v1/admin/access/report on a node whose access report records nothing (CORTEX_ACCESS_REPORT=off); details.variable | no |
| 409 | ACTIVITY_CHANGED | A scope prune or deletion raced a write: the scope's write activity changed (or no authoritative revision exists to compare against) while the operation was pending; re-snapshot and decide again | yes (since 0.14.0 on every route; until then only the code plane said yes) |
| 409 | APP_LIMIT_REACHED | The tenant holds as many application records as CORTEX_LIMIT_APPS allows; details.limit: apps, value, used, setting, scope | no |
| 409 | AUTHORIZATION_STATE_CHANGED | POST /v1/forget, /v1/forget/preview, /v1/erasures, /v1/erasures/preview, the tenant and person erasures, GET /v1/erasures/{id} and its cancel: scopes were registered or removed inside the request's authorization footprint on each of 5 attempts to authorize it (0.10.2; a scope registered outside the footprint never causes it). Nothing was changed; Retry-After: 1, details.retry_after_seconds (§8.5). The scope, layer-build and code-plane routes answer it for a registry mutation whose authorization revision moved | yes (after Retry-After: 1 on the forget and erasure routes); since 0.14.0 on every route (until then only the forget and erasure routes and the code plane said yes) |
| 409 | CANCELLED | A replay of, or a wait=indexed/consolidated on, a write whose cancel committed: it is kept but never indexed or recalled, and its key replays this answer; details.event_id (a bulk whose every item was cancelled: details.failures, details.accepted) (§8.1) | no |
| 409 | CHANGESET_CONFLICT | A change set of this id already holds other parts or other header fields, or a change-set command disagrees with its header or part; nothing was staged | no |
| 409 | CHANGESET_INCOMPLETE | A schedule or an activation before every part is staged; details.missing_parts | no |
| 409 | CHANGESET_NOT_STAGED | The change set was activated or discarded: no command applies to a closed change set; details.status is the closed change set's status | no |
| 409 | CHANGESET_STAGING_FULL | Staging would pass the root's staging budget, the proposer's quota or its narrowing quota; details.limit is root, proposer or proposer_narrowing. Discard or activate staged change sets first. SCIM's Group writes answer it 503 with Retry-After instead, which a provider retries (§8.28) | no |
| 409 | CHANGESET_STALE | Records the change set writes changed after it was staged (details.paths, the first 256 that moved, and details.moved, their number): discard it and stage a new one; or the activation's checks read records no part names (details.reason: read_set, details.read_paths): stage it again with parts of the read paths | no |
| 409 | CODE_INDEX_REFRESHING | The repository's index is refreshing, or the query's generation is no longer the published one; details.freshness, published_generation, query_generation | yes |
| 409 | COHORT_DISABLED | A cohort route, or a /v1/answer body carrying cohort (even null), while CORTEX_COHORT is off; details.flag (and field, capability for a gated request field) (§8.4.2) | no |
| 409 | COMMITMENT_CONFLICT | A command identity was reused with different bytes, or expected named a revision the commitment has already advanced past. Re-read /v1/memory/commitments/current and re-issue | no |
| 409 | CORRECTION_CONFLICT | POST /v1/corrections (corrections_v1, 0.15.0): an open correction of the same claim and action, or a pin and a reject of one claim; details.existing names it (§8.7.24) | no |
| 409 | DERIVATION_JOB_ACTIVE | POST /v1/derivation/rederive: another re-derivation job is open on the scope's root; wait for it or cancel it; details.job_id (§8.32.7) | no |
| 409 | DESTRUCTIVE_OPERATION_IN_PROGRESS | The request would act inside the footprint of a forget or erasure that is still running: a write that would register a new scope there, once that operation outlasted CORTEX_DESTRUCTIVE_LEASE_WAIT_SECS (Retry-After: 5; details.scopes, retry_after_seconds, admission_wait_seconds; §8.5); a tenant deletion while another destructive operation holds the root; a re-derivation of a root a forget or erasure is running under (Retry-After: 30, details.scope_root); a person's erasure while one of the same person in the same tenant root runs on this node (details.erasure_id, details.manifest_url, §8.6.9). Nothing was written | yes (after Retry-After) |
| 409 | DIRECTORY_ACCOUNT_TAKEN | The account the entry names is held by another principal's entry; details.system, details.account | no |
| 409 | DISK_INSUFFICIENT | a blocker of POST /v1/admin/reembed, which a start refuses on (§8.15.8): the job's copies need more disk than the disk holds before the disk guard's warn mark | no |
| 409 | ENRICHMENT_OFF | POST /v1/admin/derived/rederive on a deployment with enrichment off (CORTEX_ENRICHMENT_DELAY_SECONDS unset); details.enrichment_mode (§8.15.2). A reextract of POST /v1/derivation/rederive (§8.32.7) and a policy test (§8.32.6) on a process with enrichment off | no |
| 409 | ERASURE_NOT_CANCELLABLE | POST /v1/erasures/{id}/cancel: the job proposed an erasure entry and runs to its end, or changed state before it ran (a tenant's deletion marks its root first), or has ended (completed, failed, cancelled already); details {erasure_id, status, job}, job the status GET /v1/erasures/{id} serves (since 0.14.0, §8.6.5). Poll the job: nothing is left to cancel | no |
| 409 | ERASURE_NOT_COMPLETED | GET /v1/erasures/{id}/verify on a running, failed or cancelled job (0.10.4, §8.6.7) | no |
| 409 | ERASURE_RECEIPT_UNAVAILABLE | GET /v1/erasures/{id}/verify or /receipt on a job with no receipt: still running, cancelled and still stopping, or run by a pre-0.10.4 binary (re-run the identical erasure and use that job) (0.10.4, §8.6.7-8) | no |
| 409 | EVENT_CANCELLED | POST /v1/admin/index-audit/reinclude: the event's write was cancelled, or it was excluded again while it was re-included | no |
| 409 | EVENT_NOT_EXCLUDED | POST /v1/admin/index-audit/reinclude: the event is not excluded from recall | no |
| 409 | FORMAT_ARMED_ONE_WAY | PUT /internal/ui/settings/shard_format (0.15.0): a format ceiling below the format the shard is armed for, which would hold nothing back, since arming is one-way; details.armed, details.ceiling (§8.15.7) | no |
| 409 | HOLD_IN_FORCE | POST /v1/erasures/tenant: holds of the tenant are in force; release them, then delete the tenant. DELETE /v1/directory/{id}: a hold of the tenant names the principal, whatever its window, and the entry stays (§8.27.3). details.holds, details.holds_in_force | no |
| 409 | ICE_FORK_UNSUPPORTED | POST /v1/admin/ice/owner with {"action": "fork"} on a cluster data node, whose replicas share the shard's owner record (since 0.14.0) | no |
| 409 | ICE_OFF | /v1/admin/ice/*: the segment store is off (CORTEX_ICE_URL unset) | no |
| 409 | IDEMPOTENCY_CONFLICT | The idempotency key was reused with a different body: a write (details.existing_event_id; a bulk item carries it in details.failures[]), an erasure bound to another erasure request, a keyed blob upload bound to other bytes, a declared belief's key sent with another statement, confidence, supports or landing scope (POST /v1/beliefs, since 0.14.0) | no |
| 409 | JOB_ACTIVE | a blocker of POST /v1/admin/reembed, which a start refuses on (§8.15.8): a re-embed job is building, ready or swapping; one at a time | no |
| 409 | JOB_ALREADY_CONTINUED | continue_from names a job another job already continued (it took the remaining events): resume that job, or continue from it once it completes; details.job_id, details.continued_by | no |
| 409 | JOB_MISMATCH | A re-derivation job_id was reused for other targets, actions or billing tenant (§8.15.2); details.job | no |
| 409 | JOB_NOT_COMPLETED | A re-derivation continue_from named a job that has not completed; resume that job first; details.job_id (§8.15.2) | no |
| 409 | NO_SNAPSHOT | The repository has no published snapshot yet | no |
| 409 | OLD_INDEX_RETAINED | a blocker of POST /v1/admin/reembed, which a start refuses on (§8.15.8): a swapped job kept its old index (retain_old_index), which a new job would delete unasked; POST /v1/admin/reembed/cleanup first | no |
| 409 | PREVIEW_CHANGED | The activation's preview_hash is not the change set's structural effect now (it was previewed, then the state moved); details.preview_hash is the current one | no |
| 409 | PROVENANCE_ERASED | A write's, a declared belief's or a publish's provenance cites an event that was erased or redacted (a publish: every event its rollup was built from): drop the citation; details.event_id or belief_id, details.cited (since 0.14.0) | no |
| 409 | REDERIVE_BUDGET_EXHAUSTED | POST /v1/derivation/rederive: a reextract apply whose cap_usd is below its first page's reservation (details.cap_usd, spent_usd, next_page_usd) or whose dry run's model is unpriced (details.reason: "unpriced_model"), or a dry run when the tenant's daily budget of tests and dry runs is spent (details.reason: "tenant_budget_spent", budget_usd, spent_usd) (§8.32.7) | no |
| 409 | REDERIVE_ESTIMATE_REQUIRED | POST /v1/derivation/rederive: a reextract apply with no live estimate of the same scope and selection on this leader (none named, expired after 24 hours, or made on another node); run the dry run again (§8.32.7) | no |
| 409 | REDERIVE_ESTIMATE_STALE | POST /v1/derivation/rederive: the reextract selection changed since the dry run; details.selected_then, selected_now; run the dry run again (§8.32.7) | no |
| 409 | REDERIVE_IN_PROGRESS | A forget, an erasure, one of their previews, or a second re-derivation named a scope root on which a derived-row re-derivation job is running (§8.15.2), or a re-derivation named a root a keep_learned retention is detaching events under (details.job_id: "retention_sweep", §8.15.1). Nothing was changed; details.job_id, retry_after_seconds (30) on the forget routes, scope_root on the re-derivation route | yes (after Retry-After: 30) |
| 409 | REEMBED_NOTHING_TO_CLEAN | POST /v1/admin/reembed/cleanup with no old index a swap kept (§8.15.8) | no |
| 409 | REEMBED_NOT_CANCELLABLE | POST /v1/admin/reembed/cancel with no job, or one that is not building or ready (§8.15.8) | no |
| 409 | REEMBED_UNSUPPORTED_ON_CLUSTER | /v1/admin/reembed* on a cluster data node, which runs no re-embed job (also a dry run's blocker, §8.15.8) | no |
| 409 | REGISTRY_NOT_REPLICATED | A change-set or registry command on a cluster shard bound before RF3 T10, whose scope registry is node-local | no |
| 409 | REINCLUDE_UNSUPPORTED | POST /v1/admin/index-audit/reinclude on a cluster data node (the re-include is node-local) | no |
| 409 | REPO_EXISTS | POST /v1/code/repos: a repository of this name is already registered for the tenant (or registered but not restored at startup: details.reason; remove it first) | no |
| 409 | REPO_SCOPE_IN_USE | POST /v1/code/repos: another repository of the tenant, registered by an earlier build, already binds the scope | no |
| 409 | RESOLVE_FAILED | POST /v1/conflicts/{id}/resolve: the bitemporal engine refused the resolution (its message says why) | no |
| 409 | RESTORE_NOT_PENDING | The root carries no restore mark: there is nothing to acknowledge | no |
| 409 | RETENTION_SWEEP_RUNNING | POST /v1/admin/retention/sweep while a sweep is already running (single flight) | yes |
| 409 | RETENTION_UNSUPPORTED_BACKEND | /v1/admin/retention* and /v1/admin/wal* on a backend without the unified WAL (D1 routes are unified-WAL only) | no |
| 409 | REVIEW_ITEM_DECIDED | POST /v1/review/decisions (derivation_review_v1, 0.15.0), in one decision's result: the held candidate was decided before (approved, rejected, lapsed or regated); details.decision_id names the decision (§8.7.27) | no |
| 409 | SCOPE_MIGRATION_ACTIVE | a blocker of POST /v1/admin/reembed, which a start refuses on (§8.15.8): a /v1/admin/scopes/migrate job is running | no |
| 409 | SCOPE_PARENT_IN_USE | The scope is the parent of other scopes in its org tree: move or delete them first (0.13.0) | no |
| 409 | SCOPE_REGISTRATION_EXISTS | POST /v1/scopes: the path is already registered; POST /v1/code/repos: the registration of its parent scope lost a race | no from the scope routes; yes on the code plane |
| 409 | SCOPE_STATE_CHANGED | The scope state moved under a scope mutation (the plan changed while it was pending), or a write's admission collided with a registry change no forget or erasure holds (details.scopes, retry_after_seconds, admission_wait_seconds, Retry-After: 1) (§8.5) | yes (after Retry-After: 1 at a write's admission); since 0.14.0 on every route (until then only a write's admission and the code plane said yes) |
| 409 | SEGMENTS_PRESENT | a blocker of POST /v1/admin/reembed, which a start refuses on (§8.15.8): the segment store is configured (CORTEX_ICE_URL set): segments hold the current model's vectors, which the job cannot rewrite | no |
| 409 | SUBTREE_RECALL_DISABLED | A /v1/recall body carrying subtree, or an explicit ranked cohort plan, while CORTEX_SUBTREE_RECALL is off; details.flag (and field, capability) | no |
| 409 | TARGET_IS_CURRENT | a blocker of POST /v1/admin/reembed, which a start refuses on (§8.15.8): the data dir is embedded as the target already | no |
| 409 | TARGET_MOCK | a blocker of POST /v1/admin/reembed, which a start refuses on (§8.15.8): the mock embedder is no target | no |
| 409 | TARGET_UNAVAILABLE | a blocker of POST /v1/admin/reembed, which a start refuses on (§8.15.8): the target does not resolve or build (model files missing, a precision this CPU refuses, a missing key, a refused provider; the message says which) | no |
| 409 | UNIFIED_WAL_REQUIRED | POST /v1/admin/index-audit/source-blob-links needs the unified WAL | no |
| 409 | UPDATE_IN_PROGRESS | POST /internal/ui/update while an update is running | no |
| 409 | VOICE_SESSIONS_DISABLED | A /v1/sessions route while the server is not in voice mode (CORTEX_PROFILE=voice); details.flag, details.capability (§8.3.3) | no |
| 409 | WAL_COMPACTION_RUNNING | POST /v1/admin/wal/compact while a compaction is already running | yes |
| 409 | WRITER_NOT_ALLOWED | derivation_policy_v1 (0.15.0): a derivation policy's writer rule refuses this write of its predicate: a typed triple on POST /v1/experience, a bulk item (in its details.failures[] entry, the item alone), a /v1/import/jsonl or importer row (its job error leads with the code), a declared belief (POST /v1/beliefs) or a correction's replacement, whose kind the predicate's writers leave out, or that neither carries nor cites as provenance an event carrying the label its requires names; nothing was stored; details: {predicate, writers, requires} (§8.32) | no |
| 410 | EVENT_EXPIRED | GET /v1/events/{id}?scope=: a keep_learned retention rule removed the event's raw data; what was learned from it is kept (§8.15.1). details.scope, recorded_at, expired_at. Only for a caller who may read the event's scope; anyone else gets the 404 | no |
| 410 | IDEMPOTENCY_KEY_RETIRED | POST /v1/blobs/idempotent: the idempotency key named a blob that was deleted; the key is retired and cannot store a new one | no |
| 410 | RESUME_CURSOR_UNAVAILABLE | GET /v1/lifecycle/stream and GET /v1/lifecycle: the Last-Event-ID or resume cursor names a row the log no longer holds (unknown, pruned or evicted; a lagging frame's resume_from included), or the catch-up page's replay passes its bounds; restart from a fresh catch-up page | no |
| 410 | ROLLUP_SUPERSEDED | GET /v1/rollups/{id} and POST /v1/publish by rollup_id: the rollup is not part of its topic's current build (since 0.14.0, §8.29.3); details: {home, topic, current, current_parts?}, current the current build's first part or null. A publish writes nothing | no |
| 410 | TENANT_DELETED | The tenant's deletion has begun (POST /v1/erasures/tenant): every request of the tenant but the trusted operator's is refused, whatever token it holds. SCIM answers it 401, with the other credential refusals (§8.28) | no |
| 412 | DIRECTORY_VERSION_CHANGED | If-Match or if_version names another version than the stored entry's; details.version is the stored one | no |
| 413 | CHANGESET_TOO_LARGE | A change set holds at most 1,024 parts and 64 MiB | no |
| 413 | COHORT_SUBTREE_TOO_LARGE | A cohort request at a scope holding more than CORTEX_COHORT_MAX_EVENTS events, or whose in-memory projection alone would exceed CORTEX_COHORT_MAX_BYTES | no |
| 413 | EXPORT_TOO_LARGE | The export exceeds the buffered v1 limit; narrow the requested scope | no |
| 413 | IMPORT_TOO_MANY_ITEMS | An import holds more than 10,000 items; split it into smaller requests | no |
| 413 | PAYLOAD_TOO_LARGE | The request body exceeds the router's limit (CORTEX_MAX_BODY_BYTES, default 32 MiB); details.max_body_bytes, details.bulk_endpoint, details.blob_endpoint. A cluster ingress answers it for a body over 32 MiB; the /v1/memory/commitments/* routes for a body over their 32,768 bytes, with details.max_body_bytes: 32768 and no bulk or blob hints | no |
| 413 | WAL_TOO_LARGE | A record above the 4 MiB log command limit, refused before submit: a vocabulary, temporal-phrase or retention-policy record, a change-set part (details.part), a notice acknowledgement's entry, a clustered owner's registry change (§8.8, §8.26), or a declared belief (POST /v1/beliefs); nothing was stored | no |
| 415 | UNSUPPORTED_MEDIA_TYPE | The body needs Content-Type: application/json (the header is missing or names another type), or the route refuses the media type it was given (POST /v1/blobs and POST /v1/blobs/idempotent take raw bytes, not multipart) (§6.6); since 0.14.0 also a POST /v1/admin/retention/sweep or POST /v1/admin/wal/compact body sent without a JSON Content-Type, which they ignored before (§8.15.1) | no |
| 422 | AMBIGUOUS_SELECTOR | An erasure whose selector.memory_ids come with confirm_all: true (confirm_all takes an empty selector), or a party erasure (subject) beside a selector or confirm_all | no |
| 422 | AUTH_CONFIG_INVALID | POST /v1/admin/auth/reload: the issuers file does not validate; details.entry, details.rule. The running issuers are kept | no |
| 422 | BLOB_TEXT_ENCODING_UNKNOWN | A text blob_ref's bytes decode under none of its BOM, strict UTF-8 or its declared charset (A1-1a: undecodable bytes are refused, never stored as U+FFFD); details.blob_id, content_type, reason | no |
| 422 | BUNDLE_REJECTED | POST /v1/code/import-index: the index bundle does not decode or verify, or its main manifest names a block neither the bundle nor the store holds; nothing was written | no |
| 422 | COHORT_NO_DESCENDANTS | A cohort request at a scope with no authorized customer scope holding data under it (the same answer whether the scope has no children or the caller may read none) | no |
| 422 | COLD_BACKUP_ACK_REQUIRED | A re-derivation apply with purge_derived did not set cold_backup_ack: true (§8.15.2) | no |
| 422 | CONSISTENCY_TOKEN_INVALID | The request's consistency token (consistency.at_least, ?at_least=) is not one this deployment issued for this scope's root: details.reason is malformed, other_root or ahead_of_commit (since 0.14.0, consistency_tokens_v1, §6.11) | no |
| 422 | CORRECTION_TARGET_UNKNOWN | POST /v1/corrections (corrections_v1, 0.15.0): no live fact in the scope states the claim, for reject, pin and confirm, or the claim keys no fact, or the named fact states no claim another fact can; always details.claim, the claim as the request stated it or as the named fact states it (null for a fact gone meanwhile) (§8.7.24) | no |
| 422 | CROSS_ROOT_PROVENANCE | The write's chain read, or its declared provenance names, an event under another scope root than the write's (X2); a cited event is known to be of another root only where this node holds its live row, as a plain node does for every root, so on a cluster an event of a root another shard holds is PROVENANCE_UNKNOWN; details.scope, details.root | no |
| 422 | CROSS_SHARD_REQUEST | Cluster ingress: the request names scope roots on different shards; it is not split: send one request per shard. A data node's POST /v1/admin/scopes/migrate naming a root its shard does not hold (details.field, details.root) | no |
| 422 | DERIVATION_MODEL_NOT_ALLOWED | derivation_policy_v1: a derivation policy's model or entity_model is not in the operator's CORTEX_DERIVATION_MODELS (unset: the model the process's enrichment runs, none without one; a policy that names no model runs on the process's own); details.model, details.allowed (§8.22.7) | no |
| 422 | DERIVATION_POLICY_INVALID | derivation_policy_v1: a derive body or a subject settings record is invalid; details.path (the record), details.field (topics.deny[2]), details.reason (unknown_id, limit, too_large, text_role, bad_value) (§8.22.7, §8.32.3) | no |
| 422 | DERIVATION_POLICY_WIDENS | derivation_policy_v1: a derive record or a subject settings record would widen a restriction an ancestor's policy or settings sets; details.rule, details.value, details.ancestor (§8.22.7, §8.32.3) | no |
| 422 | DERIVATION_TEXT_INVALID | derivation_policy_v1: an inline policy text is invalid; details.reason (source_required, source_unknown, too_large, too_many, delimiter), details.index (its place among the request's inline texts), details.field (§8.22.7) | no |
| 422 | DERIVED_BY_INVALID | derived_by_v1 (0.15.0): a write-back stamp refused on a capture route, a /v1/import/jsonl line (its job error leads with the code) or POST /v1/beliefs: out of grammar (name_grammar, reserved_namespace, version_invalid), of shape (shape), on anything but a typed triple (not_a_triple), or a context.labels entry starting derived_by:, which only the field sets (reserved_label); details: {field, reason} (§3.5.3) | no |
| 422 | DIRECTORY_MALFORMED | A directory entry out of its shape; details.reason | no |
| 422 | DOWNGRADE_REFUSED | POST /internal/ui/update to an older version than the running one | no |
| 422 | EARLY_ANSWER_WHOLE_SCOPE_ONLY | respond: "accepted" on an erasure that names memory_ids or a party: an early answer is only for a whole-scope erasure (confirm_all: true) | no |
| 422 | EMPTY_SELECTOR_WITHOUT_CONFIRMATION | A forget or an erasure with an empty selector and no confirm_all: true: the whole scope would be removed, so the request must say so | no |
| 422 | ENRICHMENT_SCOPE_NOT_ALLOWED | A re-derivation that re-enriches events the enrichment scope allowlist (CORTEX_ENRICHMENT_SCOPE_PREFIXES) or a scope's effective enrich: off keeps out, or a scope inside an application's reference root; nothing was changed; details.reason (allowlist, enrich_off, allowlist_and_enrich_off, reference_root), scope, allowed_scope_prefixes, events_outside, events_enrich_off, events | no |
| 422 | FEED_CURSOR_INVALID | GET /v1/derivation/feed: a cursor the feed did not issue; details.reason malformed (it does not decode), version (a version this server does not read), root (another root's cursor) or consumer (issued for another consumer, or for a consumer when the request names none, or the reverse) (since 0.15.0) | no |
| 422 | INVALID_ACCESS_RECORD | An access record is out of its contract: a change set's record, an application record (PUT /v1/apps/{id}), a registry write, or an edit of an application's reference root, whose shape is fixed (reason: reference_root); a when: {purpose} id outside a read's purpose grammar on a roster entry, a set entry or a unit grant is reason: when_purpose; a change set's put that would make a version-2 record a version-1 one, without convert, is reason: version_downgrade with details.dropped (since 0.14.1); details.path, details.reason | no |
| 422 | INVALID_AUDIT | A re-derivation or unmerge audit report that does not parse or names another scope | no |
| 422 | INVALID_BODY | The body does not fit the route's contract: an unknown field, a wrong type, a missing field, or a value the route refuses; a field that needs a capability this server does not advertise names it (details.unsupported_fields, details.required_capabilities). details.field_path, details.field and details.reason where known (§6.6) | no |
| 422 | INVALID_BOUNDARY | POST /v1/conflicts/{id}/resolve: the boundary date does not parse as an absolute date (2024-03, March 2024); a relative phrase is refused too (since 0.14.0) | no |
| 422 | INVALID_COMMITMENT | A commitment command or read was not canonical, or failed the closed-field contract pinned by docs/schemas/fixtures/commitment/ | no |
| 422 | INVALID_CONTENT_TYPE | POST /v1/blobs/idempotent: the Content-Type header is missing, repeated or not a media type | no |
| 422 | INVALID_CURSOR | A page cursor the route did not issue, or issued for another request, or that no longer decodes | no |
| 422 | INVALID_DATE | GET /v1/claims: valid_as_of or known_as_of does not parse as a date, or is a relative phrase nothing anchors (yesterday, last year; since 0.14.0) | no |
| 422 | INVALID_DURATION | POST /v1/scopes/prune: older_than is not a whole number of days as P<n>D (default P90D) | no |
| 422 | INVALID_ENVELOPE | An experience envelope failed validation (a capture item encoding above 4 MiB less 64 KiB included); a consolidation target the caller may not write is refused under it with details.field: directives.consolidate_into. A bulk whose every item was refused answers it with details.failures[] and details.accepted | no |
| 422 | INVALID_EVENT_ID | POST /v1/admin/index-audit/reinclude: event_id does not parse | no |
| 422 | INVALID_EXTRA_SCOPES | extra_scopes (extra_scopes_v1) past its cap, or naming a scope outside the request scope's root; details.field: extra_scopes, details.max_items | no |
| 422 | INVALID_IDEMPOTENCY_KEY | /v1/blobs/idempotent: the Idempotency-Key header is missing, repeated, empty, too long or not visible ASCII | no |
| 422 | INVALID_MOUNTS | A read's mounts cannot apply (details.field: mounts, details.reason: no_app, app_unknown, not_combinable), or an application record's mount is invalid (details.mount, details.reason) | no |
| 422 | INVALID_RANGE | A time range whose bounds do not parse or are reversed, or (since 0.14.0) are a relative phrase nothing anchors (GET /v1/episodes, GET /v1/claims); GET /v1/admin/usage whose from is after to (a 400 before 0.14.0) | no |
| 422 | INVALID_REQUEST | Any other plain-text 422 the router produced (§6.6); an operator route's body the route refuses (/v1/admin/ice/seal, /ice/owner, the retention routes, /v1/admin/wal/compact) | no |
| 422 | INVALID_RETENTION_POLICY | PUT /v1/admin/retention/policies: the policy does not validate | no |
| 422 | INVALID_SCOPE | A usage, plan, maintenance, re-derivation, unmerge, code-plane or (since 0.14.0) temporal-phrase scope that does not parse (GET /v1/usage, GET /v1/plan and /v1/admin/plans/{subtree} answered a 400 before 0.14.0) | no |
| 422 | INVALID_SCOPE_GRAMMAR | A scope path is malformed (details.field, details.reason where the route names them), or names a path the registry reserves (reason: reserved_path) | no |
| 422 | INVALID_SCOPE_TREE | Org-tree attributes out of their rules (0.13.0): details.reason names the rule, details.field the field (tree.display_name is refused under CORTEX_DISPLAY_NAME_IN_RECORD_ENFORCE: put the name in the directory); since 0.14.1 also a legacy registry write that would make a version-2 record a version-1 one, reason: version_downgrade, with details.path and details.dropped | no |
| 422 | LABELS_TOO_MANY | A new write's context.labels holds more labels than CORTEX_LABELS_MAX_COUNT (default 4096); details.count, details.limit (0.10.5, only while label limits are enforced, CORTEX_LABEL_LIMITS=on; §3.5 "Label limits") | no |
| 422 | LABEL_EMPTY | A label is empty or only whitespace; details.index (0.10.5, while enforced) | no |
| 422 | LABEL_INVALID_CHARACTER | A label holds an ASCII control character other than tab, line feed and carriage return; details.index, details.code_point (U+001F), details.byte_offset (0.10.5, while enforced) | no |
| 422 | LABEL_TOO_LONG | A label is longer than CORTEX_LABEL_MAX_BYTES UTF-8 bytes (default 262,144); details.index, details.bytes, details.limit (0.10.5, while enforced) | no |
| 422 | LCOV_EMPTY | POST /v1/code/import/coverage: no covered file records parsed from the lcov payload | no |
| 422 | LICENSE_INVALID | POST /internal/ui/license: the pasted token is not a valid CortexDB license | no |
| 422 | NO_ELIGIBLE_EVENTS | A re-derivation apply asked for purge_derived or reenrich but no targeted event is eligible (erased, another billing tenant's, not enrichable); nothing was changed; details.billing_tenant, skipped_by_reason, foreign_tenants. Name the right billing_tenant, or post actions: ["revert_supersessions"] (§8.15.2) | no |
| 422 | NO_TARGETS | A re-derivation or unmerge that names nothing to work on (no event or fact ids, no audit findings in the scope), or a continue_from whose job left no events | no |
| 422 | ONE_WAY_CONFIRMATION_REQUIRED | PUT /internal/ui/settings/shard_format (0.15.0): a format ceiling that lets the next boot arm the shard for a format it is not armed for, one way, sent without confirm.data_dir naming the data directory or without confirm.cold_backup: true; details.missing (data_dir, cold_backup), details.armed, details.arms; nothing is saved (§8.15.7) | no |
| 422 | OWNERLESS_ROSTER | The scope's roster is empty, or a change would leave it without an Owner | no |
| 422 | POLICY_TEST_TOO_LARGE | POST /v1/derivation/policy/test (derivation_policy_v1, 0.15.0): more than 200 sample events (details.events, max_events), an estimate above the request's max_cost_usd (details.events, estimate_usd, max_cost_usd), a model the price book cannot price (details.reason: "unpriced_model", model), or a tenant's day of tests and dry runs that cannot hold the cap (details.reason: "daily_budget", budget_usd, spent_usd, remaining_usd); nothing is run (§8.32.6) | no |
| 422 | PROVENANCE_UNKNOWN | A write's or a declared belief's provenance cites an event the shard does not hold under the write's root (on a cluster also an event of a root another shard holds, which a plain node answers CROSS_ROOT_PROVENANCE); details.event_id or belief_id, details.cited (since 0.14.0) | no |
| 422 | PUBLISH_TOO_LARGE | POST /v1/publish of a rollup built from more events than a copy's provenance holds (1,024); details.events, details.max_events | no |
| 422 | REGISTRATION_FAILED | POST /v1/code/repos: the repository could not be opened or scanned (a scan limit names details.limit and details.max) | no |
| 422 | REPO_PATH_NOT_ALLOWED | POST /v1/code/repos: the path policy refused the repository's path; details.reason | no |
| 422 | SCIP_REJECTED | POST /v1/code/import/scip: the SCIP import refused the index (its message says why) | no |
| 422 | SCOPE_REQUIRED | GET /v1/plan without ?scope= from a credential that carries no scope grant (a 400 before 0.14.0); POST /v1/code/repos names no scope under the tenant (details.tenant); a cluster ingress answers it for a routable request that names no valid scope | no |
| 422 | SCOPE_TREE_UNSUPPORTED | Org-tree attributes on a registry profile that does not store them (0.13.0) | no |
| 422 | SYNTHESIS_LIMIT_EXCEEDED | Not answered over HTTP: POST /v1/understanding/synthesize reads topics with these bounds (the number of topics, one topic's bytes, their total bytes), so a body past them is 422 INVALID_BODY (§8.7.11); the code is the coordinator's own check for a caller that builds a request in process | no |
| 422 | UNKNOWN_PREVIEW_ID | from_preview_id is unknown, expired, or does not match this caller, tenant, scope, layers, selector, cascade and confirmation: preview this exact operation first, or omit the field | no |
| 422 | UNKNOWN_SUPPORT | POST /v1/beliefs: a declared belief's supports names an event or fact that does not exist under the scope | no |
| 422 | UNPARSEABLE_TEMPORAL | temporal.natural is not understood (the default natural_mode: strict; lenient returns 200 with a temporal_natural_ignored warning instead) | no |
| 422 | UNREGISTERED_SCOPE_TYPE | Implicit or explicit scope creation used a type outside allowed_scope_types | no |
| 422 | UNSUPPORTED_RECORDS_ACTION | DELETE /v1/scopes?records= with anything but keep: the route removes only the registration; delete data with POST /v1/forget or POST /v1/erasures first | no |
| 422 | UNSUPPORTED_SELECTOR | /v1/erasures and its preview take no attribute selectors (about_subject, about_entity, predicate): name the events with selector.memory_ids, or use /v1/forget for attribute-scoped redaction | no |
| 422 | VIEW_NOT_ALLOWED_AT_SCOPE | A view that walks the scope tree (holistic, structured, lineage, descend) at a shared org-tree scope (kind org, team, group or compartment): name the scopes to read and use view: granular (0.13.0); details.field: view, details.view, details.scope_kind, details.allowed_views (["granular", "raw"]) | no |
| 422 | WORKSPACE_REPO_LIMIT | POST /v1/code/workspace/context with more than 16 repositories; details.requested | no |
| 429 | EXPORT_SATURATED | Every export slot is busy; retry after an active export completes | yes (after Retry-After: 1) |
| 429 | IMPORT_SATURATED | Every import slot is busy; retry after an active import completes | yes (after Retry-After: 1) |
| 429 | RECALL_OVERLOADED | /v1/recall found every execution permit (CORTEX_RECALL_MAX_CONCURRENT) busy past CORTEX_RECALL_QUEUE_TIMEOUT_MS (default 2000; 0 sheds at once), or past CORTEX_RECALL_QUEUE_TIMEOUT_MS_VOICE (default 100, never longer than the other) for a profile: "voice" recall or a session start (§8.3.3); nothing ran | yes (after Retry-After: 1) |
| 429 | SUBTREE_RATE_LIMITED | A tenant subtree's request rate (CORTEX_SUBTREE_RATE_LIMITS, read=RATE[:BURST],write=RATE[:BURST], writes counted per item) or an application's limits.requests_per_minute is reached; charged after authorization on /v1/recall, /v1/recall/stream, /v1/answer, /v1/compose, /v1/experience and /bulk. details.subtree, class, and limit_per_second and burst, or for an application app, limit: requests_per_minute, value | yes (after Retry-After) |
| 500 | AUTH_CONTEXT_MISSING | Internal: a route's body admission ran without the authenticated context | no |
| 500 | CHUNK_INSPECTION_FAILED | GET /v1/admin/events/{id}/chunks failed to read the event's chunks | no |
| 500 | DEDUP_FAILED | POST /v1/admin/compaction/dedup failed | no |
| 500 | ERASURE_VERIFY_FAILED | GET /v1/erasures/{id}/verify: re-reading the stores for the receipt failed | no |
| 500 | EXPORT_FAILED | GET /v1/code/export-index failed | no |
| 500 | EXPORT_SERIALIZATION_FAILED | An event could not be serialized; no partial export was returned | no |
| 500 | GC_FAILED | POST /v1/code/gc failed | no |
| 500 | IMPORT_ADMISSION_MISSING | Internal: an import handler ran without its admission (memory pressure, plan or slot) | no |
| 500 | INDEX_AUDIT_FAILED | POST /v1/admin/index-audit failed | no |
| 500 | INTERNAL_ERROR | A failure CortexDB does not classify, on any route: an engine invariant, a panicked task, a pack or copy that could not be rendered, a write-path failure after capture, a storage failure in the access plane, the directory, the erasure jobs, the tenant binding or a cluster owner's handler; an MCP tool result carries it in structuredContent. Retry it as an outage, under the same idempotency key. A shard refusal the proposer's own checks should have prevented answers it with details.refusal naming the refusal (CHANGESET_INVALID, TEXT_MALFORMED, REHOME_MALFORMED, …). Since 0.14.0 it is the one such code: INTERNAL is retired (§16.4) | yes (since 0.14.0); no with details.refusal and for a cluster data owner's failed handler (its edge answers it not retriable) |
| 500 | MATRIX_UNAVAILABLE | GET /v1/code/matrix: the support matrix could not be built | no |
| 500 | ORPHAN_BLOB_REPORT_FAILED | GET /v1/admin/index-audit/orphan-blobs failed | no |
| 500 | PERSIST_FAILED | POST /v1/admin/persist: a store's snapshot save failed (since 0.14.0; details: {persisted: false, elapsed_ms, saved, skipped, failed: [{store, error}]}); PUT /internal/ui/features/{id} or PUT /internal/ui/settings/{id}: the write to disk failed | no |
| 500 | PIN_FAILED | POST /v1/code/pins failed | no |
| 500 | REDERIVE_FAILED | A re-derivation job failed to start or its record could not be read | no |
| 500 | REDERIVE_PLAN_FAILED | The re-derivation's plan failed | no |
| 500 | REEMBED_FAILED | /v1/admin/reembed*: a store failed while the route read or wrote the job (§8.15.8) | no |
| 500 | REGISTRATION_PANICKED | POST /v1/code/repos: the registration task panicked | no |
| 500 | REINCLUDE_FAILED | POST /v1/admin/index-audit/reinclude failed on storage | no |
| 500 | REPO_PURGE_FAILED | DELETE /v1/code/repos/{name}: the repository's stores could not be deleted; details.path, details.registry | no |
| 500 | REPO_PURGE_PANICKED | DELETE /v1/code/repos/{name}: the purge task panicked | no |
| 500 | REPO_REGISTRY_WRITE_FAILED | DELETE /v1/code/repos/{name}: the repository registry write failed | no |
| 500 | RETENTION_BACKEND | The retention sweeper, the policy store or the WAL engine failed | no |
| 500 | SCOPE_STORAGE_MISCONFIGURED | Since 0.14.0 (each was 503 SCOPE_STORAGE_UNAVAILABLE): the scope registry's storage cannot take a change as it is configured: the scope routes (§8.8), PUT /v1/apps/{id}, a capture's or import's scope registration, the tenant rebind, the tenant erasure's mark and a code repository's parent. details.reason invalid_persistence (the stored state is invalid or incompatible), at_capacity, unsupported_platform or durable_guard_required. The operator must act | no |
| 500 | SOURCE_BLOB_LINKS_FAILED | POST /v1/admin/index-audit/source-blob-links failed | no |
| 500 | STORE_ERROR | A code repository store could not be written (a read is 503 QUERY_ERROR) | no; yes on import/scip and import-index, which publish nothing when it happens |
| 500 | TENANT_MAP_STORAGE | A vocabulary or temporal-phrase read failed on storage | no |
| 500 | UNMERGE_FAILED | POST /v1/admin/derived/resolver/unmerge failed in the resolver | no |
| 500 | UNPIN_FAILED | DELETE /v1/code/pins failed | no |
| 500 | VECTOR_HYGIENE_FAILED | POST /v1/admin/vector-hygiene failed; a lane that did not run it answers the lane's code (DB_SATURATED, DB_UNAVAILABLE, DB_TIMEOUT; since 0.14.0, where it answered this as a 503) | no |
| 501 | CLUSTER_ROUTE_UNSUPPORTED | The route is not served through a cluster ingress (a by-id route without ?scope=, a cross-shard or node-local route) | no |
| 501 | COHORT_NOT_IMPLEMENTED | A build without the cohort lane module (never a release build); details.component, details.owner | no |
| 501 | COHORT_UNSUPPORTED | /v1/answer with cohort on a native answer host, which serves no cohort answer: send the cohort question to a server that serves the scope's root | no |
| 501 | SCIM_UNSUPPORTED | SCIM: every /scim/v2/* route, before the caller check, on a deployment whose CORTEX_TENANT_DEPTH is above 1, since SCIM is served only where a tenant's root is org:<t> (§8.28). In SCIM's error body, the code leading its detail | no |
| 502 | ANSWER_PROVIDER_ERROR | The answer model failed: its call panicked or kept failing after one retry, or the renderer returned a provider error | yes |
| 502 | ANSWER_PROVIDER_INCOMPLETE | The answer model returned an incomplete answer after one retry | yes |
| 502 | ERASURE_BACKEND_FAILED | The erasure engine failed after admission; details.audit_id names the gdpr audit row | yes |
| 502 | FORGET_BACKEND_FAILED | The forget engine failed after admission (a storage error mid-run); details.audit_id names the gdpr audit row it was recorded under | yes |
| 502 | INDEXING_FAILED | The write is stored but its storage-engine indexing failed: it is excluded from recall; do not re-send (the key is kept and replays this failure); an operator re-includes it with POST /v1/admin/index-audit/reinclude, which answers this when the event fails to index again. details.event_id, details.remediation; a bulk: details.failures[], details.accepted (§8.1) | no |
| 502 | UPDATER_AUTH_FAILED | The updater sidecar refused the server's token | no |
| 502 | UPDATER_ERROR | The updater sidecar answered an error | no |
| 502 | UPDATER_UNREACHABLE | The updater sidecar could not be reached | no |
| 503 | ACCESS_RESTORE_PENDING | The request names a scope root restored from a backup that lost its access state, and the root's access sources have not all re-sent it: until each acknowledges (or the trusted operator does), only the repairing routes are served (the registry listing, the acknowledgements, watch, the directory and SCIM Users, the operator's deletion replay by ids, resync change sets, rehome, watermarks and account resolution). details.root, pending_sources, restored_at, owner_acknowledges, operator_override. Hold the request and send it again once the mark clears (since 0.14.0; a cluster data owner's edge answers it too). A SCIM Group write answers it with Retry-After: 30, which its provider retries (§8.28) | no; a SCIM Group write is retried |
| 503 | ACCESS_VIEW_UNAVAILABLE | The root's permission view, which the lookups are served from, is being built (details.reason: building), or would pass its cap (over_cap; CORTEX_ACCESS_VIEW_ROOT_MAX_BYTES, CORTEX_ACCESS_VIEW_MAX_BYTES), when its lookups are not served | yes for building (after Retry-After: 1); no for over_cap |
| 503 | ANSWER_PROVIDER_ADMISSION_TIMEOUT | The answer model's blocking lane did not admit the call before its admission deadline | yes |
| 503 | ANSWER_PROVIDER_SATURATED | The answer model's blocking lane is saturated | yes |
| 503 | ANSWER_PROVIDER_UNAVAILABLE | The answer model's blocking lane is closed, or the call was cancelled | yes |
| 503 | ANSWER_UNAVAILABLE | /v1/answer or /v1/compose on a deployment with no answer LLM configured (§8.4); send skip_answer_llm: true for a context-only response | no |
| 503 | AUTHORIZATION_STATE_CHANGED | On the read routes (/v1/recall, /v1/recall/stream before its stream starts, /v1/answer, /v1/compose, /v1/cohort/query, the layer GETs) and /v1/access/check, /v1/access/explain, /access/v1/evaluation, GET /v1/usage and GET /v1/plan?scope= (since 0.14.0): an authorization change that matters to the read (at its scope, at an ancestor, or below it when the view reads descendants) landed while it ran, on every run. The server runs such a read again from a fresh authorization snapshot, up to 3 runs (2 for an answer or a composition, whose rerun calls the answer model again), so a client sees it only while those changes keep landing faster than the read completes. After a stream has started, the same code arrives as an SSE error event | yes |
| 503 | BIND_MISMATCH | Shard apply refused the command and wrote nothing: a BindShard other than the stored binding: the shard holds another cluster binding. A route that passes WAL codes through answers it as a 503 | no |
| 503 | BITEMPORAL_DISABLED | GET /v1/claims and /v1/claims/history on a deployment whose bitemporal engine is off | no |
| 503 | BLOB_BYTES_UNAVAILABLE | A text blob_ref's bytes could not be read from the blob store | yes |
| 503 | BLOB_IDEMPOTENCY_UNAVAILABLE | /v1/blobs/idempotent on a process that is not the blob registry's single writer | no |
| 503 | BLOB_OPERATION_CAPACITY | Blob operation capacity is temporarily exhausted (detached uploads and deletes in flight); nothing was stored | yes |
| 503 | BLOB_OPERATION_FAILED | /v1/blobs and /v1/blobs/idempotent (keyed-blob-v1): the operation's task failed (on /v1/blobs a 500 before 0.14.0) | yes |
| 503 | BLOB_REGISTRY_ERROR | /v1/blobs and /v1/blobs/idempotent: the blob registry failed (on /v1/blobs a 500 before 0.14.0) | yes |
| 503 | BLOB_REGISTRY_UNAVAILABLE | The blob registry could not verify a blob_ref (its lane failed or the lookup failed closed); nothing was written | yes |
| 503 | BLOB_STORE_ERROR | /v1/blobs and /v1/blobs/idempotent: the blob store did not take or return the bytes, or DELETE /v1/blobs/{id} could not delete them (on /v1/blobs a 500 before 0.14.0, and STORAGE_ERROR for the deletion) | yes |
| 503 | BULK_WRITE_FAILED | Bulk items failed for different reasons (more than one failure category, or retriable and non-retriable failures together): follow each details.failures[] entry's error_code, retriable and remediation instead of retrying the whole request; details.accepted lists the committed events | yes only when every item's failure is |
| 503 | CAPTURE_MALFORMED / EXCLUDE_MALFORMED / ERASE_MALFORMED / NOTICE_MALFORMED / RESTORE_MALFORMED / DECLARED_MALFORMED / GOVERNED_MALFORMED / LEARNED_MALFORMED / REGISTRY_ENTRIES_MALFORMED | Shard apply refused a command out of its shape (a capture, a cancel, an erasure, a notice, a restore mark, a declared record, a governed record or a re-extraction's learned records (0.15.0, format 11), registry entries), writing nothing: a proposer bug, which the routes' own checks prevent. A route that passes WAL codes through answers it as itself | no |
| 503 | CODE_PLANE_DISABLED | A /v1/code/* route on a deployment whose Code memory feature bundle is off (CORTEX_CODE_PLANE) | no |
| 503 | COHORT_REQUIRES_UNIFIED_WAL | A cohort request on a server running the legacy WAL (CORTEX_UNIFIED_WAL=0); never from this release, which refuses to start on the legacy WAL | no |
| 503 | COHORT_STATE_CHANGED | Visibility or erasure state moved while the cohort answer was computed | yes (after Retry-After: 1) |
| 503 | COHORT_UNAVAILABLE | A cohort storage read failed (never a partial answer); a native answer host answers 501 COHORT_UNSUPPORTED | yes |
| 503 | COHORT_WARMING | The cohort projection of the scope is being built or repaired and outlasted CORTEX_COHORT_WAIT_MS; stale data is never served. Since 0.15.0 also a cohort read under a read-time use rule while the scope-partition map that names the governed scopes is still building after a boot (§8.32.5) | yes (after Retry-After) |
| 503 | COMMITMENT_ACCEPTANCE_UNKNOWN | A submission entered the log but the acceptance outcome was not observed (since 0.14.0 also a receipt that did not read after acceptance, or a write the store refused). Recover by retrying the same command identity with a fresh proof, or by reading /v1/memory/commitments/status; a new identity would risk a second commitment | yes |
| 503 | COMMITMENT_UNAVAILABLE | The commitment plane is not mounted on this deployment, or its storage is unavailable. GET /v1/admin/ready → checks.commitments.reason says which | yes |
| 503 | DB_SATURATED | A storage lane is saturated (its queue is full); nothing ran: the layer reads and builds, POST /v1/export, the usage and plan routes, the /v1/admin/* maintenance, ice and retention routes, the re-derivation and unmerge routes, the access routes, and POST /v1/experience/bulk for a new scope's registration (since 0.14.0 the usage, plan, maintenance and re-derivation routes answer it where they answered DB_UNAVAILABLE, and the bulk write where it answered SCOPE_MUTATION_UNKNOWN) | yes |
| 503 | DB_UNAVAILABLE | A storage lane could not run the work (its admission deadline passed, it is closed), or a store did not answer; nothing ran (since 0.14.0 retriable on every route; 0.13.x answered false on the layer, export, re-derivation and operator routes) | yes |
| 503 | DISK_FULL | The disk guard refused a write before it was submitted: a disk is critical (by default 95% used or under 4 GiB available, CORTEX_DISK_*), this node's or, on a cluster, another voter's of the shard; details.node, details.retry_after_seconds. Nothing was written. Answered by every write that adds data (/v1/experience, /bulk, /v1/import, vocabulary and temporal-phrase puts, /v1/blobs, an applied re-derivation, and since 0.14.0 change sets, directory entries, declared beliefs and the other access writes); forgets, erasures, retention and cancels are never refused for disk space. GET /v1/admin/ready → checks.disk and GET /v1/admin/metrics → disk say why | yes (after Retry-After: 30) |
| 503 | ERASURE_JOB_CAPACITY | POST /v1/erasures, /v1/erasures/person, /v1/erasures/tenant: the erasure job registry is at capacity; nothing was started (a tenant's deletion keeps its root marked, and a retry continues); details.retry_after_seconds (since 0.14.0; before, not retriable) | yes (after Retry-After: 30) |
| 503 | EVENT_LIST_UNAVAILABLE | GET /v1/events: the event page could not be read now (a page whose JSON would pass 16 MiB, a read profile that refuses the read, or a descend listing whose subtree cannot be enumerated yet, the scope-partition map still building); since 0.15.0 also GET /v1/derivation/feed, a page whose consumer mark did not commit or whose events an erasure committed after the read took (§8.7.23); retain the original cursor and retry | yes |
| 503 | EVIDENCE_ADMISSION_TIMEOUT | The evidence compiler's admission deadline passed before the read could start (CORTEX_EVIDENCE_TIMEOUT_MS, default 120,000, clamped to 100..300,000) | yes |
| 503 | EVIDENCE_SATURATED | Every evidence-compile slot is busy (CORTEX_EVIDENCE_BLOCKING_PARALLELISM, CORTEX_EVIDENCE_BLOCKING_MAX_WAITERS); nothing ran | yes |
| 503 | EVIDENCE_UNAVAILABLE | The evidence compiler could not run the read: its admission is closed, the task was cancelled, or the engine reported itself unavailable; since 0.14.0 also a recall, answer or compose whose temporal.natural is matched against the registered temporal phrases when their store did not read (§8.17) | yes |
| 503 | FORMAT_NOT_ARMED | Shard apply refused the command and wrote nothing: an entry of format 8 or later above the shard's armed format; the proposer refuses such an entry before submit (FORMAT_UPGRADE_PENDING), so a client meets this only when a replica disarmed in between. A route that passes WAL codes through answers it as a retriable 503 | yes |
| 503 | FORMAT_UPGRADE_PENDING | The shard is not armed for the replicated-state format the request needs (format 8 for change sets, notices, the directory and restore entries, 9 for lineage and rehome, 10 for rollups and declared records, and since 0.15.0 the decisions route and the change feed; 11 for derive records, subject settings, policy texts, corrections, held candidates and review decisions, declared episodes and feed consumer marks), and nothing was written. details.reason: members_behind (a member runs an older binary; the leader arms by itself once it answers), arming_disabled (the operator's ceiling holds the shard below it) or reserved_path_in_use; plus format, node, paths, count and route members (scope, audit_id) (since 0.14.0) | yes for members_behind (after Retry-After: 30); no for arming_disabled and reserved_path_in_use |
| 503 | HOLD_CHANGED / PROVENANCE_CLOSURE_CHANGED / ERASE_SCOPE_MOVED / DERIVED_CLOSURE_CHANGED / ERASE_FORMAT_STALE | Shard apply refused an erasure whose plan moved: the tenant's holds changed, an event citing what it erases committed, a rehome moved a named event out of the scope, a rollup or declared record citing it committed, or the erasure must name derived records. The forget engine re-plans and proposes again; a client sees one only when re-planning keeps failing | yes |
| 503 | ICE_FAILED | POST /v1/admin/ice/seal: nothing was sealed (the store did not take the upload; the events stay live); POST /v1/admin/ice/owner: the store did not take the owner record | yes |
| 503 | IMPORT_NOT_DONE / IMPORT_NOT_OPEN / IMPORT_TARGET_NOT_EMPTY / IMPORT_OUT_OF_ORDER / IMPORT_CONFLICT / IMPORT_COUNT_MISMATCH / EVICT_NOT_DRAINED | Cluster data node: shard apply refused a scope move's command and wrote nothing: an activation before its import finished, an import chunk with no import open, onto a root the target still holds, out of order, with ids already live, retired or claimed there, or with counts other than its chunks carried; a released root's final cleanup while its rows remain. The mover and the cleanup driver propose these, never a client | yes for IMPORT_NOT_DONE and EVICT_NOT_DRAINED; no for the others |
| 503 | INDEXING_UNAVAILABLE | POST /v1/admin/index-audit/reinclude: the event cannot be indexed now (its embedder or index is unavailable) and stays excluded | yes |
| 503 | ISSUER_KEYS_UNAVAILABLE | The token's issuer's keys (JWKS) cannot be fetched and no cached key verifies the token; Retry-After is the whole seconds until the key cache's next fetch (its backoff, 3 s doubling to 60 s), at least 1, also in details.retry_after_seconds | yes (after Retry-After) |
| 503 | LICENSE_UNAVAILABLE | /internal/ui/license*: this process manages no license (an unlicensed build, an ingress) | no |
| 503 | MEMORY_INGESTION_UNAVAILABLE | Memory ingestion is disabled on this artifact-worker-disabled prepared replica; send writes to an artifact-worker process; details.artifact_workers_enabled, details.remediation (an import answers it without details) | yes |
| 503 | MEMORY_PRESSURE | The server's memory is nearly full (by default one reading at 85% of its limit; it clears after three readings in a row at or below 75%, CORTEX_MEMORY_PRESSURE_*), so a heavy request was turned away before its heavy work began: a bulk write or an import (refused before its body is read), a recall whose subtree pass would engage or that asks for more than 16,000 tokens, a cohort read-all that would read the conversations again, or a recall past half the recall execution permits; details.kind (bulk_write, import, subtree_recall, large_recall, cohort_read_all, busy_recall), details.memory_ratio, details.retry_after_seconds. Nothing was written. Single writes, ordinary recalls, answers, forgets and erasures are always admitted; a request that cannot succeed gets its own 403, 409 or 422 first; a cohort answer reuses a stored read, and one without read: "all" reads the ranked sample instead, with a note. GET /v1/admin/metrics → memory says why | yes (after Retry-After: 10) |
| 503 | METADATA_UNAVAILABLE | Cluster ingress: the ingress holds no catalog from the metadata group yet | yes |
| 503 | NATIVE_ANSWER_UNAVAILABLE | /v1/answer on a native answer host whose answer composition is unavailable | no |
| 503 | NOTICE_UNAVAILABLE | A read that must tell someone first did not commit its notice, and delivered nothing: the operator key's break-glass read of a private region under CORTEX_OPERATOR_DATA_READS=deny (which tells the region's person, cause break_glass), on every route that returns stored rows, and a Detail read, at Reader, of a person's work compartment (a version-2 chain compartment, the person's aud:work) by a reader admitted there only through a grant naming it, on every route that returns rows (cause grant: every production router attaches these rules, DB-17). A change to a sign-in account writes its notice in the directory write's own entry, so it never answers this. details.reason: moving, limit, arming_disabled, reserved_path_in_use (since 0.14.0; it was reported as members_behind), members_behind (Retry-After: 30), or refused (with details.refusal). A by-id read's notice is its row's region's, committed once the row is read (since 0.14.0; scope_unnamed, which refused a by-id read without ?scope=, is gone) | yes, but for arming_disabled and reserved_path_in_use |
| 503 | NOT_AVAILABLE | The route needs a component this server does not have: a replicated shard, a directory, a storage coordinator, a unified WAL or a retention sweeper | no |
| 503 | NOT_CONFIGURED | The route's service is not configured on this deployment: the usage ledger, the feature or settings store, the issuers file (/v1/admin/auth/reload), the minter (/v1/auth/tokens, /v1/auth/signup) | no |
| 503 | NOT_LEADER | The write reached a node that does not lead its shard and was refused before submit; never on a serving single node. A cluster ingress answers it when the shard's replicas kept naming a leader that did not serve within resend_window_s (details.shard_id); a data owner's edge when it knows no leader or a write's leader lease lapsed. Since 0.14.0 also an applying POST /v1/admin/retention/sweep on a replica that does not lead its shard, refused before it reads anything (the message names the leader the replica knows of; §8.15.1) | yes |
| 503 | PROVIDER_SATURATED | The provider lane is saturated; nothing ran | yes |
| 503 | PROVIDER_UNAVAILABLE | The provider lane is closed or the work was cancelled; nothing ran | yes |
| 503 | PRUNE_UNAVAILABLE | POST /v1/scopes/prune: the prune's storage lane is unavailable | yes |
| 503 | QUERY_ERROR | A code repository store could not be read (a postings read during a walk included) | yes |
| 503 | READ_UNCONFIRMED | Cluster data owner: a quorum did not confirm, twice, that the data owner still leads the shard for a read | yes |
| 503 | REDERIVE_UNSUPPORTED | The coordinator cannot run a re-derivation (its capability probe failed) | no |
| 503 | REEMBED_UNAVAILABLE | /v1/admin/reembed*: this server has no re-embed job surface (§8.15.8) | no |
| 503 | REGISTRY_STALE | A registry change, a write, a cancel or an erasure was checked against a registry that a later registry row for the same scopes changed: nothing was written; re-read and retry (the owner admits a write once more and retries it once first) | yes |
| 503 | REGISTRY_UNAVAILABLE | POST /v1/auth/tokens: the tenant's scope records could not be moved to its own billing tenant before the mint | yes |
| 503 | REHOME_TAIL_PENDING | POST /v1/access/rehome committed and moved items, but this node's erase tail has not applied the rehome yet, so the views would still serve the old homes: retry | yes |
| 503 | REPLAY_STAGE_UNVERIFIED | An idempotent replay asked to wait for a stage later than indexed that a restarted process cannot prove from durable state; retrying the unchanged barrier will not succeed: use wait=indexed. details.event_id, details.target_stage, details.remediation | no |
| 503 | REPO_PURGE_BUSY | DELETE /v1/code/repos/{name}: the repository is de-registered but readers still hold its stores; retry to free them; details.retry_after_ms, details.registry: removed | yes |
| 503 | REQUEST_ABANDONED | A change set's evaluation stopped: every caller waiting on it went away (since 0.14.1). The change-set routes (POST /v1/access/changes, …/parts, …/preview, …/activate) and a SCIM Group write's checks answer it once the request's client has gone, and so has every other caller waiting on that evaluation (§8.22.1, "Evaluations that run long"). Nothing was staged or activated. Only a request whose client has gone meets it, so no client reads it | yes |
| 503 | RETENTION_NATIVE_PROFILE_REQUIRED | A retention or WAL operation that needs the native memory profile on a server without it | no |
| 503 | REVOCATION_UNAVAILABLE | The revocation list cannot answer: a cluster data owner whose revocation lease lapsed (it clears on renewal), or a single node whose revocation journal failed (a refused write latches the list; since 0.14.0, where it answered 401 REVOKED_TOKEN), denies every token on any authenticated route, failing closed; and a POST /v1/auth/revoke the metadata group or the local journal did not take | yes |
| 503 | SCOPE_CATCHING_UP | A data owner's edge fence: a root the request names has no local row, or one below the epoch the ingress expected (details.root); the ingress re-routes it | yes |
| 503 | SCOPE_MOVING | Cluster data node (since 0.14.0): apply's scope fence refused an entry of a change set, a registry route's change (§8.8, §8.26), a text erasure (§8.20.7), a source route (/v1/access/rehome, PUT /v1/access/watermarks), a directory or SCIM write (Users, and Groups through their change sets), or a notice or restore acknowledgement, so nothing was written; the root is moving between shards, or its assignment changed under the proposal (details.roots, details.refusal: SCOPE_NOT_OWNED or STALE_EPOCH). A cluster ingress answers it when the root is moving and resend_window_s ran out (details.roots). Send the request again | yes |
| 503 | SCOPE_NOT_OWNED | Cluster data node: apply's scope fence refused the write: a root it touches is not active on this shard (between an assignment and its apply, or while it moves); nothing was written. The capture routes, the tenant-map puts and the forgets and erasures answer it as itself, which an ingress resends to the root's new owner; the change sets, the registry routes, the text erasure, the source routes, the directory and SCIM Users, and the notice and restore acknowledgements answer SCOPE_MOVING | yes |
| 503 | SCOPE_STORAGE_UNAVAILABLE | The scope registry could not answer or accept the operation (its storage did not answer, a write failed, a reconciliation failed; since 0.14.0 storage the operator must fix is 500 SCOPE_STORAGE_MISCONFIGURED, which was this code until then). Since 0.14.0 a clustered owner's registry change the shard did not take answers the shard's own code and retriable instead (§8.8) | yes (since 0.14.0 on every route; until then only the code plane said yes) |
| 503 | SCOPE_UNROUTED | Cluster ingress: the scope root is assigned to no shard; details.root | no |
| 503 | SEGMENT_UNAVAILABLE | The event is sealed into a segment (docs/ICE_TIER_PLAN.md, step 3) and the store did not return it in time: GET /v1/events/{id}?scope=, GET /v1/experience/status, POST /v1/publish; told only to a caller who may read the event | yes |
| 503 | SERVER_SHUTTING_DOWN | POST /v1/forget or POST /v1/erasures (and the tenant and person erasures), or POST /v1/admin/scopes/migrate, after graceful shutdown began; nothing was changed (§8.5, "Shutdown") | yes (after Retry-After: 5) |
| 503 | SETTLEMENT_SATURATED | ?wait=settled: the settlement pass's blocking lane is saturated | yes |
| 503 | SETTLEMENT_UNAVAILABLE | ?wait=settled, which cannot succeed on this release: no coordinator reports settlement, so the route runs a synchronous compile and projection pass and answers this (details.artifact_workers_enabled, remediation, settlement) | no when the profile does not support settlement or artifact workers are off; yes otherwise |
| 503 | SHARD_APPLY_UNBUILT | The shard's apply stopped on an entry whose command this binary does not build (an entry a newer binary wrote): the replica stops instead of diverging; upgrade the node | yes |
| 503 | SHARD_CATCHING_UP | Cluster data owner: an admitted request waited for the node's views past its bound: every request for the erase tail to apply every committed erasure and registry change (2 s), and, once per leader term, a read, forget or erasure for the indexer to pass every write an earlier term acknowledged (5 s); the ingress resends it. Since 0.14.0 also an applying POST /v1/admin/retention/sweep on the leader before the term's first pass found its views caught up (§8.15.1) | yes |
| 503 | SHARD_UNAVAILABLE | Cluster ingress: no replica of the shard could be reached, each tried in turn and the first once more (at RF=1, one retry), and nothing was sent; details.shard_id, details.node_id | yes |
| 503 | STALE_EPOCH | Cluster data node: apply's scope fence refused the write: it was stamped with another ownership epoch than the applied one; nothing was written. The routes that answer SCOPE_MOVING for SCOPE_NOT_OWNED answer it for this too | yes |
| 503 | STORAGE_UNAVAILABLE | POST /v1/beliefs: the declaration's plan could not read what it cites | yes |
| 503 | STORAGE_UNWIRED | The route needs a storage coordinator and this server has none wired (a layer build, a declared belief, a history read, a conflict resolution) | no |
| 503 | SUBTREE_BUSY | The ranked subtree pass (subtree on /v1/recall, a ranked cohort lane) found its in-flight cap (CORTEX_SUBTREE_MAX_INFLIGHT) reached and its deadline passed; Retry-After: 1 on /v1/recall, /v1/recall/stream (its refusal before the stream starts), /v1/answer (its cohort lanes) and the cohort routes | yes (after Retry-After: 1) |
| 503 | SYNTHESIS_SATURATED | The synthesis queue or its job registry is at capacity; retry later | yes |
| 503 | SYNTHESIZER_UNCONFIGURED | POST /v1/understanding/synthesize on a server without a coordinator and an LLM router | no |
| 503 | TENANT_MAPS_UNSUPPORTED | Shard apply refused the command and wrote nothing: vocabulary and temporal-phrase maps on a clustered shard: they are tenant-keyed, not scoped. A route that passes WAL codes through answers it as a 503 | no |
| 503 | TENANT_SETTINGS_UNAVAILABLE | PUT /v1/admin/access/tenant-settings: the tenant-access store did not take the record (a plain node's write did not reach the disk, or a cluster's proposal did not commit) | yes |
| 503 | TENANT_WRITES_IN_FLIGHT | POST /v1/erasures/tenant: writes of the tenant admitted before its deletion mark are still in flight; the tenant stays marked, and a retry continues its deletion | yes |
| 503 | UPDATER_NOT_CONFIGURED | POST /internal/ui/update without the updater sidecar (CORTEX_UPDATER_URL and CORTEX_UPDATER_TOKEN) | no |
| 503 | WAL_OUTCOME_UNKNOWN | The write was submitted and may have committed (including when it has not committed within 10 s): retry with the same idempotency key, which replays the original receipt if it did. Since 0.14.0 also a scope-registry change whose outcome is unknown, on every route that runs one (a single node's included): read the record before writing it again (it was SCOPE_MUTATION_UNKNOWN) | yes |
| 503 | WAL_UNAVAILABLE | Cannot accept writes: the replicated log stopped on a storage error (the process then exits 74, WAL_FATAL) or is shutting down; also a read of the shard's state that failed (a write-status probe, a restore mark, a lineage record, the directory during authentication, a cluster owner's stopped shard, a consistency token's state (§6.11), /v1/access/watch and /v1/access/notices); a conflict resolution whose log write failed, the conflict unchanged (POST /v1/conflicts/{id}/resolve, since 0.14.0) | yes |
| 503 | WRITE_PIPELINE_UNAVAILABLE | A bulk item's write pipeline was shutting down; answered only inside details.failures[] of a bulk | yes |
| 504 | ANSWER_PROVIDER_TIMEOUT | The answer model's call ran past its execution deadline | yes |
| 504 | DB_TIMEOUT | A storage lane ran past its execution deadline, and its work may still be running: the layer reads and builds, POST /v1/export, the usage and plan routes, the /v1/admin/* maintenance routes but the six long operations (which run to completion once admitted, §8.15.5), the re-derivation and unmerge routes, /v1/access/check, /explain, /v1/access/enrich, a bulk write's registration of a new scope (since 0.14.0 on the bulk write, which answered 503 SCOPE_MUTATION_UNKNOWN, and on the export, usage, plan, maintenance and re-derivation routes, which answered 503 DB_UNAVAILABLE) | no |
| 504 | EVIDENCE_TIMEOUT | The evidence compile ran past its execution deadline (CORTEX_EVIDENCE_TIMEOUT_MS) | yes |
| 504 | PROVIDER_TIMEOUT | A layer build's or a coverage read's provider (embedding or LLM) lane ran past its deadline | no |
| 504 | SHARD_OUTCOME_UNKNOWN | Cluster ingress: a mutation was sent to the shard and not answered and may have applied (details.outcome_unknown: true, shard_id, node_id); a capture whose every envelope has an idempotency_key is resent for resend_window_s first, so retry it with the same keys | yes |
| 504 | SHARD_TIMEOUT | Cluster ingress: a read was sent to the shard and not answered; it is never resent; details.shard_id, details.node_id | yes |
16.1 Codes outside the envelope
- SCIM (
/scim/v2/*, §8.28): every error is rewritten into RFC 7644's error body (schemas,status,detail,scimType), and the CortexDB code leadsdetail("DIRECTORY_ACCOUNT_TAKEN: …"). SCIM's status follows the code, not the table above: the request codes (INVALID_BODY,INVALID_ACCESS_RECORD,DIRECTORY_MALFORMED,INVALID_REQUEST,INVALID_QUERY,INVALID_PATH_PARAMS,INVALID_HEADER,UNSUPPORTED_MEDIA_TYPE) are 400 withscimType: invalidValue,INVALID_FILTER400invalidFilter,MUTABILITY400mutability,DIRECTORY_ACCOUNT_TAKEN409uniqueness,DIRECTORY_VERSION_CHANGED412,CHANGESET_STALE,CHANGESET_CONFLICT,ACCESS_ASSERTION_FAILEDandACCESS_LIMIT_REACHED409, the size codes 413,CHANGESET_STAGING_FULL503 withRetry-After,ACCESS_RESTORE_PENDING503 withRetry-After: 30,TENANT_DELETED401 with every other credential refusal,SCIM_UNSUPPORTED501, any other 503 or 429 keeps its status, a 429 and every retriable 503 withRetry-After(30 unless the refusal set one; none forFORMAT_UPGRADE_PENDINGwitharming_disabledorreserved_path_in_use, orNOT_AVAILABLE), any other 422 is 400invalidValue, any other client error keeps its status, and anything else is a 500. - MCP (
POST /mcp): a tool's failure is a JSON-RPC result withisError: true, its text"<status>: <code>: <message>"and the REST envelope instructuredContent. Two codes are the MCP server's own:READ_ONLY_PROFILE: a writing tool under the read-only MCP profile (CORTEX_MCP_PROFILE=writeserves it).SCOPE_NOT_ALLOWLISTED: the tool's scope is outside the server's MCP scope allowlist, or the allowlist names no scope for the caller.
- Streams: after
/v1/recall/streamhas started, an authorization change ends it with an SSEerrorevent{"error_code": "AUTHORIZATION_STATE_CHANGED", "retriable": true}; a renderer failure is anerrorevent{"error": "<message>"}. - Bulk items: a
207or a failed bulk names each item's code indetails.failures[].error_code(the codes above, andWRITE_PIPELINE_UNAVAILABLE, retriable, for an item the pipeline refused while shutting down). - Bodies:
details.refusalcarries a shard refusal's code insideINTERNAL_ERRORandNOTICE_UNAVAILABLE(NOTICES_UNAVAILABLEwhen the router has no notice service); a dated change set's refused activation records its code in the change set and inwatchitems (PREVIEW_CHANGED,ACCESS_ASSERTION_FAILED,ACCESS_LIMIT_REACHED,APP_LIMIT_REACHED,CHANGESET_STALE,INVALID_ACCESS_RECORD);POST /v1/scopes/prunenames each skipped candidate's reason in its200(SCOPE_SCAN_LIMIT,ACTIVITY_UNKNOWN,ACTIVITY_SCAN_LIMIT,REGISTRATION_CHANGED,ACTIVITY_CHANGED,DELETE_FAILED);GET /v1/access/limitsnames, per limit, the code a write past it answers.
16.2 Native memory host planes
A server started with --native-memory-host-dir serves the native capture and source-erasure planes,
which answer {"code": "…", "schema_version": 1} (NativeCaptureHttpErrorV1,
SourceErasureHttpErrorV1), not the envelope:
| HTTP | Code | Meaning |
|---|---|---|
| 400 | native_capture_invalid_request | The native capture request is not canonical |
| 400 | source_erasure_invalid_request | The source-erasure request is not canonical |
| 403 | native_capture_authority_denied | The caller holds no native capture authority |
| 403 | source_erasure_authority_denied | The caller holds no source-erasure authority |
| 403 | source_erasure_write_authority_required | The command needs write authority over the source |
| 409 | native_capture_original_conflict | The capture's identity names another original |
| 409 | source_erasure_not_accepted | The command was not accepted (batch, epoch, candidate, target or command conflict) |
| 409 | source_erasure_not_refused | A refusal read names a command that was not refused |
| 503 | native_capture_outcome_unknown | The capture entered the log and its outcome was not observed |
| 503 | native_capture_unavailable | Native capture is unavailable |
| 503 | source_erasure_outcome_unknown | The command entered the plane and its outcome was not observed |
| 503 | source_erasure_unavailable | The source-erasure plane is unavailable |
16.3 Cluster internals
The codes cluster nodes answer one another on the internal mTLS listener (a data owner's 421s, the mover's
export and blob refusals, the metadata group's command refusals) never reach a client of an ingress. They are
listed in docs/generated/cluster.md, "Codes between cluster nodes"; the codes an
ingress itself answers are in the table above and in ClusterErrorCode of the served OpenAPI.
16.4 Codes no route answers
MISSING_REQUIRED_FIELD, INVALID_TIMESTAMP, RESOURCE_DELETED, DERIVED_LAYER_UNAVAILABLE and
RATE_LIMITED are not answered by this release (a missing field is a 422 INVALID_BODY, a malformed
time is 422 INVALID_BODY or UNPARSEABLE_TEMPORAL, rate limits answer SUBTREE_RATE_LIMITED,
RECALL_OVERLOADED, IMPORT_SATURATED or EXPORT_SATURATED). NON_HUMAN_WRITE_UNSUPPORTED is
retired in 0.14.0: an agent's or an application's write carries its atoms and provenance instead
(write_provenance_v1), and is redirected to its writer's private space when it must be
(redirected_to; 403 ATOMS_REDIRECT_REFUSED when it cannot be). SUBTREE_RECALL_NOT_IMPLEMENTED
is defined and never returned. INTERNAL, STORAGE_ERROR and the lower-case unsupported_media_type are retired in
0.14.0: every route answers 500 INTERNAL_ERROR, 503 BLOB_STORE_ERROR (a blob's bytes that could not be deleted) and
415 UNSUPPORTED_MEDIA_TYPE instead; a client keeps handling them only for an older server. SCOPE_MUTATION_UNKNOWN is
retired in 0.14.0 too: a registry change whose outcome is unknown answers 503 WAL_OUTCOME_UNKNOWN (retriable).
17. Compatibility Matrix
Framing. Peer systems are not flat. Mem0 has conversation/session/user/org scopes with filter/rerank operators; Zep ships bi-temporal facts on graph edges plus context blocks plus semantic/full-text/graph retrieval; Letta has tiered memory tools and shared blocks; Cognee has 14 search strategies. CortexDB's differentiation is not "they're simple, we're rich." It is event-sourced provenance, all-layer first-class access, policy with attribution, lifecycle observability, and verifiable erasure — the rows below reflect that re-framing. We also benchmark our ergonomics against Supermemory's "raw content in +
customId+ tags" simple-SDK happy path: CortexDB keeps the rich contract, but the SDK MUST offer a one-liner experience for the happy path.
| Capability | CortexDB | Mem0 | Zep | Letta | Cognee | Supermemory |
|---|---|---|---|---|---|---|
| Memory layers separately addressable as API resources | ✅ 5 | ⚠️ 1 (filterable) | ✅ 2 (facts, episodes) | ⚠️ 3 (block tiers) | ⚠️ 2 (graph, vector) | ⚠️ 1 (chunks/memories) |
| Bi-temporal across ALL layers (valid_+recorded_) | ✅ | ❌ | ⚠️ facts/edges only | ❌ | ⚠️ via Graphiti episodes | ❌ |
as_of point-in-time recall on any layer | ✅ | ⚠️ via filters | ⚠️ facts only | ❌ | ⚠️ episode-anchored | ❌ |
| Hierarchical scope with inheritance | ✅ | ⚠️ org/project/user/agent/run (no inherit) | ⚠️ user/group/thread (flat) | ⚠️ project-only | ⚠️ datasets + node_set tags | ⚠️ container tags |
| Workspace = scope (unified primitive) | ✅ | ❌ scoping is intersection-only | ⚠️ groups separate | ⚠️ shared blocks separate | ⚠️ dataset is shared | ❌ |
| Per-tier authorization with capability attribution | ✅ four-tier | ❌ API-key flat | ❌ API-key flat | ❌ API-key flat | ❌ | ❌ |
| Signed-token identity (caller / observed_actor / subject split) | ✅ | ❌ | ❌ | ❌ | ⚠️ user param | ❌ |
| Async-first writes with lifecycle visibility | ✅ + SSE | ✅ async; ❌ no lifecycle | ❌ | ❌ | ✅; ❌ no lifecycle | ✅ queued |
| SSE / push lifecycle stream (capture→consolidate observability) | ✅ | ❌ | ❌ | ⚠️ agent step stream | ❌ | ❌ |
| Hard delete (no soft delete in user-visible API) | ✅ | ⚠️ delete by id | ⚠️ delete by id | ⚠️ block edit | ⚠️ dataset delete | ⚠️ |
| Verifiable erasure (a durable receipt every store is re-checked against) | ✅ | ❌ | ❌ | ❌ | ❌ | ❌ |
| Erasure preview + manifest before destructive run | ✅ | ❌ | ❌ | ❌ | ❌ | ❌ |
| Streaming recall (granular per-layer) | ✅ | ❌ | ❌ | ❌ | ❌ | ❌ |
| Streaming recall (narrative token stream) | ✅ | ❌ | ❌ | ⚠️ agent reply | ❌ | ❌ |
| Provenance + citation trail returned in every recall | ✅ | ❌ | ⚠️ episodes/edges only | ❌ | ⚠️ graph trace | ❌ |
| "Why do you think that?" endpoint (explainability primitive) | ✅ | ❌ | ❌ | ❌ | ❌ | ❌ |
| Layer-aware forget (forget just beliefs / just facts) | ✅ | ❌ | ❌ | ❌ | ❌ | ❌ |
| Bulk importer from peer systems | ✅ Mem0/Zep/Letta/OpenAI/JSONL | n/a | ❌ | ❌ | ❌ | ❌ |
| Bulk export to peer systems | ✅ | ⚠️ memory export | ❌ | ⚠️ Agent File (.af) | ❌ | ❌ |
| Custom predicate / relation vocabularies | ✅ | ⚠️ custom categories | ✅ Pydantic ontology (10/10/10) | ❌ | ✅ Pydantic graph_model | ❌ |
| Multimodal blob attachment | ✅ | ⚠️ partial | ❌ | ❌ | ⚠️ partial | ✅ files/URLs |
| Auto-registered scopes with prune tooling | ✅ | n/a | n/a | n/a | n/a | n/a |
| Audit log with tamper-evident peppered hashes | ✅ | ❌ | ❌ | ❌ | ❌ | ❌ |
| Simple-SDK happy-path one-liner (raw text in, ID out) | ✅ via client.experience(text=...) | ✅ | ✅ | ⚠️ verbose | ⚠️ verbose | ✅ very ergonomic |
(⚠️ = partial / different shape; ❌ = absent; ✅ = present)
Reading the matrix. The right way to look at CortexDB vs the field is not "do they have it" but "is it observable, addressable, and explainable through the API." Mem0 has reranking — but you cannot ask why a result ranked where it did. Zep has bi-temporal facts — but only on facts. Letta has shared memory — but no policy. Our bar: every claim has a trail, every trail has an endpoint, every endpoint has a stability tier.
Compatibility between CortexDB releases is each release's own (its notes' upgrade section), not this matrix's: 0.14.0's first boot arms a data directory for shard apply format 10 and 0.15.0's for format 11, each one way, so the way back is the backup taken before the upgrade (§1.1, §1.2). CORTEX_FORMAT_CEILING=10 holds a 0.15.0 node at format 10, where the routes that write a format-11 record answer 503 FORMAT_UPGRADE_PENDING; §8.15.7 reads the state and sets the ceiling from the console.
18. Deferred Decisions & Open Ambiguities
18.1 Deferred (intentionally out of v1)
- Federation / multi-region replication API. Cluster mode (
cortexdb node,docs/generated/cluster.md) replicates shards within one deployment behind the same/v1API; the API contract for cross-region writes is deferred until we have a paying customer that needs it. - Differential privacy on recall. Mentioned by enterprise prospects; not standard enough to commit a shape.
- Vector store BYO. Letting customers point at their own pgvector / Pinecone. Out of v1 scope.
- Memory editing tool surface for agents. Letta's tool-callable memory editing is interesting but conflicts with our "events are immutable" stance. Could ship as a higher-level shim that maps tool calls to
experience+forget; deferred. - Webhook (push) lifecycle in addition to SSE. SSE covers most use cases; webhooks add infra (retries, signing). Deferred until requested. For workers that derive from a scope's events, the change feed (§8.7.23) is the pull alternative.
- GraphQL surface. REST + SDK feels sufficient; GraphQL adds maintenance burden. Deferred.
- Customer code inside CortexDB (since 0.15.0's governed memory formation): hosted derivation workers on CortexDB Cloud, and leader-only Wasm for pure, high-volume derivations. Customer logic stays out of the engine: a derivation policy is typed data (§8.32), and an outside worker reads the change feed and writes back with provenance and
derived_by(§3.5.3, §8.7.23). Both wait for a customer whose own workers prove the demand.
18.2 Resolved Ambiguities (formerly "Open before Implementation")
All 22 items from the prior round of disambiguation have been resolved on 2026-05-14. Each item below states the canonical resolution that the schemas and prose sections of this document have been updated to reflect. These are normative — if the schemas or prose disagree, the schemas win; if both disagree with this section, this section is authoritative for design intent.
The Stable surface gating list at the bottom of the prior version is cleared. Phase 1 of §19 is unblocked.
-
as_of×include_supersededinteraction (Stable: §8.7.3 facts). Resolved: both filters apply independently and conjunctively.as_ofclips both axes (recorded_*≤as_of,valid_from≤as_of<valid_to).include_supersededtoggles whether therecorded_to=nullconstraint is enforced — when true, superseded versions whoserecorded_to ≤ as_ofare returned alongside the current versions. Conformance: schemafact.schema.jsondeclares both query params; an integration test pair exists in §12 examples. -
Orphan
derives[]back-pointers after GDPR redaction (Experimental: §11.3). Resolved: option (c). When a derived record is deleted by GDPR and its source event is redacted-but-kept, the event'sderives[]entries pointing at the deleted record are replaced withredacted:<original_id>(e.g.,redacted:fact_01HX...). This preserves the audit signal that something was derived without leaking what. Conformance:event.schema.jsonderivesentries match pattern^(evt_|ep_|fact_|belief_|concept_|redacted:[a-z]+_)[A-Za-z0-9_-]+$. -
Lifecycle event ordering within a single
event_id(Stable: §8.9, §13). Resolved: strict ordering within one memory event. The stages for any singleevt_<id>are emitted in fixed order:captured→extracted→indexed→consolidated→ (optionally)compressed. No cross-event ordering guarantee. Conformance: SSE delivery has a per-event sequence number; an SSE conformance test validates monotonicity within event_id. -
view=descendwith partial read access (Stable: §8.3 recall). Resolved: option (b) — opaque placeholders with count-only stats. When an authorized caller descends into a tree containing child scopes the caller cannot read, the response'sscopes_traversedincludes{scope, denied: true, item_count: N, denied_reason}entries. Counts reveal existence without leaking content;denied_reasoncites the policy tier. Conformance:stratified_pack.schema.jsonscopes_traversed[]item is a discriminated union over{scope, items}and{scope, denied, item_count, denied_reason}. -
"Natural level" for
scope.write.elevated(Stable: §5.2). Resolved: the deepest scope path in which the caller appears as an explicitownerorwritermember. Writes to any scope at or below this depth do not requirescope.write.elevated; writes to ancestor scopes do. For unregistered scopes (no membership), the caller's natural level isnulland any write requires the capability. Conformance:capability_set.schema.jsonincludesnatural_level: scope-path | null. -
Bulk import rate-limit attribution (Beta: §8.11). Not built: this release has no importer bucket and no
rate_limit.importeroverride. An import is bounded by its own concurrency (429 IMPORT_SATURATED,Retry-After: 1) and, like any write, by the subtree rate limits (§6.5). -
Cancellation of in-flight async writes (Stable: §8.1). Resolved: ship
POST /v1/lifecycle/memory-event/{evt_id}/cancel. Drops queued stages (extract, index, consolidate, compress). The WAL capture itself cannot be reversed (it has already happened). The cancellation marks the event asexcluded_from_recall: true; it remains retained in the WAL but is suppressed fromGET /v1/events/{evt_id},/v1/recall, and/v1/answer. Endpoint added to §8.9; see §8.9.5 below. -
_partial: trueoutside Understanding (Beta: §7.4 Belief). Resolved: the_partial/_partial_reason/_progresstriple is promoted to every derived layer (Episode, Fact, Belief, Understanding). A stored event never carries these fields; a/v1/recallevents item can carry_partial/_partial_reasoninside itscontentas a recall-time view (compact_semantic_source_view,source_provenance_extractive_view, orbudget_excerpt, §9.5). Each layer's enum of_partial_reasonvalues is its own (e.g., Belief usesrevision_in_progress,supporting_evidence_redacted,calibration_stale; Understanding usesconsolidation_in_progress,insufficient_supporting_facts, etc.). Conformance: each layer schema declares the fields and its specific reason enum. -
idempotency_keycollision scope (Stable: §6.3). Resolved: scope is(scope, caller, endpoint_family, key), wherescopeis the full scope path the write targets (org:acct_46/team:eng/user:alice). Keys are therefore independent across tenants even when the tenants share one caller identity (a single deployment API key writing into manyorg:scopes): cross-tenant reuse of a key is a plain miss, never a409 IDEMPOTENCY_CONFLICT, and a conflict body can only ever carry anexisting_event_idfrom the requester's own tenant (v0.7.8 bug_12). Since v0.8.20 the namespace is the whole path rather than just its tenant root, so two sibling scopes under one tenant are also independent: writing the same item into…/project:aand…/project:bstores both, where it previously 409'd the second (report C4). Records written by an earlier binary still replay a genuine retry for the remainder of their 24h TTL, but never produce a conflict. Endpoint family buckets by logical write resource, not raw path:/v1/experienceand/v1/experience/bulkshare ONE family (v0.7.9 report F3 — they are two transports for the same write, so a retry that switches single↔bulk, or a proxy that coalesces single writes into a batch, replays instead of double-storing);/v1/import/mem0and/v1/import/zepremain separate (the same external id from two sources is two writes, not a retry);/v1/erasuresand/v1/erasures/previeware separate.GET /v1/experience/status?idempotency_key=accepts an optionalscope=for an exact probe — it must be the SAME scope the write named, since that is the namespace the record lives under; without it, all of the calling actor's own namespaces are searched (never another caller's). -
SSE replay buffer window (Stable: §10.4). Resolved: anchored from lifecycle-event arrival at the server. The 1-hour window means "any lifecycle event whose server-side arrival timestamp is within the last hour is available for resume via
?since_lifecycle_id=." Subscriber lifecycle (when they connected, when they disconnected) is irrelevant. Buffer is per-server-node; in cluster mode, replay across node failover may be incomplete for events that were in-flight during the failover. -
Tenant pepper rotation (Stable: §14). Resolved: peppers rotate quarterly. Old peppers are retained for
audit.retention+ 1 quarter — i.e., for as long as any audit row hashed under that pepper might still be present (plus a one-quarter safety margin for verification). Whenaudit.retention = P2Y, peppers persist for ~2.25 years. Conformance:policy.schema.jsondeployment-levelaudit.pepper_rotation_period(defaultP3M) andaudit.pepper_retention_buffer(defaultP3M). As built (0.14.0): one kept pepper per node, which nothing rotates (§14). -
directives.consolidate_intocross-scope write (Stable: §3.5, §8.1). Resolved: dual capability required —scope.writeon both the write scope and the consolidation target. No implicit elevation. If the caller lacksscope.writeon the consolidation target, the envelope is rejected at validation time (422INVALID_ENVELOPE,details.field = "directives.consolidate_into"). -
Empty-selector forget (Stable: §8.5). Resolved:
POST /v1/forgetwith emptyselector(all filter fields null/empty ANDmemory_ids: []) requiresconfirm_all: true. Without it, 422EMPTY_SELECTOR_WITHOUT_CONFIRMATION. Schema validation rule:selectoris "empty" iffselector.about_subject,selector.about_entityandselector.predicateare absent ornullandselector.memory_idsis absent or[]. The selector has no temporal fields (§11.2). -
Default
viewon layer reads (Stable: §8.7). Resolved: default islocalfor allGET /v1/events|episodes|facts|beliefs|understanding. Principle of least surprise: a caller passing a scope gets exactly that scope. To aggregate up the tree, they must passview=holisticexplicitly. The/v1/recallendpoint is the only one whose default isholistic(rationale: recall is intent-aware; layer reads are not). -
Audit row
body_bytes(Stable: §14). Resolved: add tenant-level settingaudit.store_body_bytes(boolean), defaulting totrue. Whenfalse, the audit row omits the field. Preset defaults:on_prem_enterprise = true,cloud_shared_saas = true(overridable per tenant),cloud_private = true,dev_local = true. Conformance:audit_row.schema.jsonmakesbody_bytesoptional. -
Belief deletion threshold behavior (Beta: §7.4). Resolved: confirmed as documented. When
confidence < tenant.confidence_floor(default 0.3), the belief record is deleted (not soft-deleted, no tombstone). Direct ID lookup atGET /v1/beliefs/{id}returns410 RESOURCE_DELETED. List endpoints (GET /v1/beliefs?...) silently omit deleted beliefs. Theaudit_idof the deletion is recorded in the audit log. -
view=rawand temporal filters (Stable: §8.3, §9). Resolved: forview=raw(events-only response),recorded_duringandas_ofapply (torecorded_aton events);valid_duringis ignored with no error (events have no validity interval, so the filter is a no-op). Avalid_duringfilter present in aview=rawrequest causesX-Cortex-Warning: valid_during_ignored_for_view_rawto be set on the response. -
Multimodal embedding strategy (Stable: §3.5). Resolved: v1 ships text-only embeddings. Image and other binary blobs are indexed by metadata (content-type, size, perceptual hash) and reachable via blob_id, but not embedded into the semantic vector space. Multimodal embedding is a v1.x add-on; the API contract is forward-compatible (envelope
content.media[]is already structured to accept additional indexing hints). -
Capability
scope.create.*granularity (Stable: §5.2). Resolved: the enumeratedscope.create.<type>set is closed at the deployment policy tier. The standard on-prem/private builtin set is{org, dept, team, app, user, agent, service, ws, project, global, system}; preset policy can narrow it (cloud_shared_saasexcludesglobalandsystem), whiledev_localadditionally permits its debug-only types. Every shipped preset also registers the non-builtin typesource, which the connectors write into; asource:leaf registered explicitly throughPOST /v1/scopesstill requiresscope.create.custom, socloud_shared_saasadmits it on first write but not by hand-registration. Operators may extend the set via the deployment YAML'sallowed_scope_typeswhere the preset permits custom creation. Any scope type not in the active allowed set is rejected at scope registration time with422 UNREGISTERED_SCOPE_TYPE. A single capabilityscope.create.customadditionally controls whether non-builtin types may be registered at all. -
use_pack_idlifetime in/v1/answer(Stable: §8.4). Resolved: 60 seconds from pack creation, no extension on reuse. Consistency over caching efficiency. After 60s the pack ID is invalid; the caller must re-run recall. -
pack_idand stateless recall (Stable: §8.3, §8.4). Resolved: ephemeral, 60s server-side TTL, not a stable client handle. Clients that need durable references should extract and store the constituentevt_/fact_/belief_/...IDs fromprovenance.citationsimmediately after receiving the pack. -
Error envelope casing consistency (Stable: §6.6, §16). Resolved 2026-05-14: unified on
error_code(UPPER_SNAKE) as the single error identifier field; lower-snakeerrorfield retired. See §6.6. Normative source:error_envelope.schema.json.
Resolution discipline going forward. Any future contract change that is non-additive against a Stable endpoint requires:
- An entry in this section documenting the prior behavior, the new behavior, and the rationale.
- A schema update in
docs/schemas/. - An updated example in the affected endpoint section.
- A regression test under
tests/api_contract/. - A bump of
X-Cortex-Stabilitytostable-revisingfor one minor release before the change becomes default.
19. Implementation Order
Updated 2026-05-14 to match the grounded gap analysis (
docs/GAP_ANALYSIS.md). The earlier numbered plan was theoretical; this version is informed by what actually exists in the codebase. Each phase is shippable in isolation; phases 1-3 are prerequisite (they reshape the contract). Estimated cumulative time: 10-14 weeks at full focus; the agent's gap-analysis estimate of 19 weeks is the conservative upper bound.
Phase 1 — Foundation (Weeks 1-2)
Goal: every request authenticates, identifies three actors, names a scope, and gets a policy decision with attribution.
- PASETO v4 public + JWT (RS256, ES256 only) token verifier
- Scope path parser + canonical form + grammar enforcement (ABNF in Appendix B)
- Auto-registration on first write
- Three-identity extraction (caller from token; observed_actor and subject from envelope)
- Four-tier policy evaluator skeleton (deployment + tenant tiers wired up; scope and actor tiers stubbed for phase 7)
X-Cortex-Policyheader on every admitted response (deployment=<preset>; auth=ok, §6.8)- Deployment-preset loader (reads
crates/cortexdb/presets/*.yaml) - Capability catalog enum + intersection logic
GET /v1/policy/effective,GET /v1/policy/deploymentGET /v1/auth/whoami,POST /v1/auth/revoke
Phase 2 — Core Memory Layers (Weeks 3-4)
Goal: every layer has its full record shape in storage, even if the layer's full pipeline isn't running yet.
- Facts: triple storage
(subject, predicate, object), bi-temporal (valid_from/to,recorded_from/to), supersession chain, confidence + extractor identifier - Beliefs: stance enum,
confidence_interval,calibration, weighted supports with polarity,revision_policy,_partialreasons - Understanding: concept nodes, versioning, edges,
derived_from/canonical_idfor split/merge, staleness + coverage scores (synthesizer stub returns_partial: truewith_partial_reason: no_implementation_yet) - Lifecycle event types (5 stages: Capture, Extract, Index, Reconcile, Compress) defined in
cortex-types _partialtriple promoted to every derived layer (per §18.2 item 8)
Phase 3 — Async Write Pipeline (Week 5)
Goal: write path returns 202 on capture, derives asynchronously, exposes wait modes.
POST /v1/experienceaccepts the new envelope shape (three identities, scope path, observed_at, directives, idempotency_key)- WAL append becomes the synchronous part; everything else queues to background workers
wait=captured|indexed|consolidated|settledmodesPOST /v1/experience/bulk(single + bulk paths share the worker pool)- Idempotency deduplication (key scope:
(scope, caller, endpoint_family, idempotency_key)— the full scope path, §18.2 item 9) directives.consolidate_intocross-scope write validation (dual capability check, §18.2 item 12)
Phase 4 — Stratified Recall (Week 6)
Goal: recall returns a stratified pack, not a flat context string.
POST /v1/recallreturns{pack_id, context_block, layers, provenance, diagnostics}- View modes:
raw,granular,holistic,structured(narrative deferred to phase 13) - Per-layer budgets +
exclude_content+citation_mode temporalblock parser includingas_of,valid_during,recorded_during,natural- Provenance trail (every phase, every elapsed_ms, every filter applied)
provenance.citationsmap (derived-record → events trail)pack_id60s TTL cache for/v1/answer use_pack_idreuse
Phase 5 — Lifecycle + SSE (Week 7)
Goal: the async pipeline is observable in real time.
- Lifecycle event log (new RocksDB column family or dedicated event store)
lce_ID namespaceGET /v1/lifecycle/stream(SSE) withsince_lifecycle_idresume, 1h server-side buffer (§18.2 item 10)GET /v1/lifecycle/event/{lce_id},GET /v1/lifecycle/memory-event/{evt_id}, paginated catch-upPOST /v1/lifecycle/memory-event/{evt_id}/cancel(drops queued stages, §8.9.5)- Emit lifecycle events at every pipeline stage hand-off
Phase 6 — Layer Reads (Week 8)
Goal: every layer has its own GET endpoint.
GET /v1/events(withderives[], labels filtering, defaultview=local)GET /v1/episodes(withcausal_chaintagging)GET /v1/facts,GET /v1/facts/timeline(withas_of×include_supersededsemantics, §18.2 item 1)GET /v1/beliefs,GET /v1/beliefs/why(with the full support graph + narrative)GET /v1/understanding,/{id},/{id}/related,/coverage(all returning_partial: trueuntil phase 11)
Phase 7 — Scopes + ACL (Week 9)
Goal: scope registration, member ACLs, holistic reads with denied placeholders.
POST /v1/scopes,GET /v1/scopes?path=...,PUT /v1/scopes/members?path=...,DELETE /v1/scopes?path=...- Scope tier of the policy stack wired up (members, roles, inheritance)
- View-aware read traversal (public recall
view=holisticincludes self plus authorized ancestors and descendants without siblings; layer-listholisticis self plus authorized ancestors;view=descendwalks an authorized subtree, §18.2 item 4) 403 NOT_A_MEMBERdenials with tier attribution- Auto-provisioned vs explicitly-registered tracking
Phase 8 — Forget + Erasures (Weeks 10-11)
Goal: hard delete works in proportional and erasure modes.
POST /v1/forgetwithderived_only+redact_eventscascades- Selector grammar (
about_subject,about_entity,predicate,memory_ids,valid_during,recorded_during) confirm_allflag for empty-selector forget (§18.2 item 13)POST /v1/erasures/preview(refcount breakdown + delete/redact split returned inline)POST /v1/erasures(executes),GET /v1/erasures/{id},POST /v1/erasures/{id}/cancel- Erasure pipeline (§11.3): select the events, delete or redact them and what was derived from them, delete a blob no surviving event references, write the receipt
- Belief demotion logic when supporting evidence is fully redacted
- Orphan
derives[]replacement withredacted:<id>markers (§18.2 item 2)
Phase 9 — Audit + Compliance (Week 12)
Goal: every policy decision is tamper-evidently logged.
- Audit log writer (RocksDB CF + Tantivy mirror)
- Per-tenant pepper rotation (P3M default, retention buffer P3M, §18.2 item 11)
- Body + headers hash (
sha256(body || pepper)) audit.store_body_bytestenant setting (§18.2 item 15)GET /v1/audit,GET /v1/audit/{audit_id},POST /v1/audit/verifyaudit.read.cross_actorcapability enforcement
Phase 10 — Imports + Exports (Weeks 13-14)
Goal: customers can move data in and out.
POST /v1/import/jsonlfirst (smallest; generic envelope ingest)POST /v1/import/mem0(mapping per §15.1)POST /v1/import/zep(preserves bi-temporal per §15.2)POST /v1/import/letta(Agent File.afper §15.3)POST /v1/import/openai(ChatGPT export per §15.4)- Order modes (
strict_temporalvsbatch_throughput) - Per-tenant importer rate-limit bucket (§18.2 item 6; not built)
POST /v1/exportfor each format, async destination routing (URL or inline)- Bidirectional round-trip tests
Phase 11 — Understanding Synthesizer (Weeks 15-16)
Goal: drop _partial: true on the Understanding layer.
- Real concept synthesis pipeline (consolidation stage)
- Coalescence, splitting, version chaining
- Coverage + staleness scoring jobs
POST /v1/understanding/synthesize(admin-triggered re-synthesis)GET /v1/understanding/coverage- Vocabularies for relation labels (
vocabulary.read/writecapabilities)
Phase 12 — Vocabularies + Temporal Phrases + Blobs (Week 17)
POST/GET/PUT /v1/vocabularies/...POST/GET/DELETE /v1/temporal/phrases/...POST /v1/blobs,GET /v1/blobs/{blob_id}(raw-byte upload, text-only embedding for v1)POST /v1/scopes/prunecleanup automation
Phase 13 — Streaming + Narrative (Weeks 18-19)
Goal: streaming surfaces for the experimental tier.
- Streaming recall (
POST /v1/recall stream=true) — granular per-layer SSE - Streaming answer (
POST /v1/answer stream=true) — token-by-token - Narrative view (
view=narrative) use_pack_idanswer reuse (60s TTL)
Risk gates between phases
| After phase | Required to proceed |
|---|---|
| 1 | All four presets load without error; cortex-auth-ref mints a token that the binary accepts |
| 2 | Schemas validate the new record shapes against docs/schemas/*.json |
| 3 | LongMemEval-S and LoCoMo benchmarks pass through the new write/recall API at the regression bar (§19.1) |
| 4 | Recall regression bar holds |
| 8 | Erasure preview/execute pair validated against the manifest schema; legal sign-off on redaction semantics |
| 11 | Understanding endpoint can return _partial: false for at least one real concept |
19.1 Benchmark Regression Bar
Concrete thresholds for any PR that touches the read or write pipeline (and therefore could regress retrieval quality).
LongMemEval-S (full 500 questions):
- Floor: 94.0% (≥470/500 correct)
- Published baseline: 95.4% (477/500) under LongMemEval's own evaluator: CortexDB 0.14.2, blind, Claude Opus 5.5 answering with Cohere reranking (2026-11-05;
benchmarks/longmemeval/RESULTS_HISTORY.md) - Bench command:
benchmarks/longmemeval/run_server.py(blind by default).reproduce.shandrun_fast.pyrun without the server: they measure the prompts and the answer model, not CortexDB - Gate: not a CI job. A full run costs about $50 and takes 2-3 hours, so it runs by hand at release checkpoints.
LoCoMo (categories 1-4, judge score):
- Floor: 91.5%
- Baseline: 92.8% (1,429/1,540): CortexDB 0.14.2, Claude Opus 5.5 answering, scored by a gpt-4.1 binary judge with the Memori/Mem0 prompt (2026-11-05)
- Bench command:
python benchmarks/locomo/run_locomo.pythenllm_judge_memori.py - Gate: as for LongMemEval-S.
Recovery PRs. A PR may merge below the floor if and only if it is explicitly tagged regression-fix and the previous (last-green) commit is identified. The next non-fix PR must restore the bar.
Latency budgets (informational, not gating for v1):
- Recall p50 ≤ 3500ms (last measured at ~2882ms, May 2026)
- Answer p50 ≤ 8500ms end-to-end (5.6 s in the 0.14.2 LongMemEval-S run, with Claude Opus 5.5)
- Capture (sync portion of
/v1/experience) p50 ≤ 50ms
These are tracked in docs/LATENCY_BASELINE.md; deviations beyond 20% trigger a perf-review checkbox on the PR.
Cost budget:
- Per-question LongMemEval-S cost ≤ $0.10 (0.14.2: about $0.095 a question at 95.4%, from the server's usage ledger; this is a hard cap)
- Recovery PRs may temporarily exceed; restore within two PRs.
What is NOT in the bar. Code-correctness tests, API contract tests, and unit tests live separately and are not part of this gate — they are independent merge requirements. The regression bar is specifically about retrieval and answer quality.
20. Appendices
Appendix A: Capability Reference (Full)
Defaults per preset. Y = allowed, N = denied, ~ = configurable per tenant default.
| Capability | on_prem | cloud_shared | cloud_private | dev_local |
|---|---|---|---|---|
scope.create.global | Y | N | Y | Y |
scope.create.cross_tenant | Y | N | N | Y |
scope.create.org | Y | Y | Y | Y |
scope.create.user | Y | Y | Y | Y |
scope.create.agent | Y | Y | Y | Y |
scope.create.ws | Y | Y | Y | Y |
scope.create.service | Y | Y | Y | Y |
scope.create.project | Y | Y | Y | Y |
scope.create.dept | Y | Y | Y | Y |
scope.create.team | Y | Y | Y | Y |
scope.create.app | Y | Y | Y | Y |
scope.create.group | Y | Y | Y | Y |
scope.create.aud | Y | Y | Y | Y |
scope.create.source | Y | Y | Y | Y |
scope.create.container | Y | Y | Y | Y |
scope.create.set | Y | Y | Y | Y |
scope.create.hold | Y | Y | Y | Y |
scope.create.policy | Y | Y | Y | Y |
scope.write | Y | Y | Y | Y |
scope.write.elevated | Y | ~ | Y | Y |
scope.write.on_behalf_of | Y | ~ | Y | Y |
scope.write.about_other | Y | ~ | Y | Y |
scope.create.custom | Y | N | Y | Y |
scope.read.local | Y | Y | Y | Y |
scope.read.holistic | Y | Y | Y | Y |
scope.read.descend | Y | ~ | Y | Y |
scope.read.cross_tenant | Y | N | N | Y |
understanding.read | Y | Y | Y | Y |
understanding.read.cross_scope | Y | N | Y | Y |
understanding.synthesize | Y | Y | Y | Y |
forget.cascade.derived_only | Y | Y | Y | Y |
forget.cascade.redact_events | Y | Y | Y | Y |
forget.gdpr | Y | Y | Y | Y |
forget.gdpr.cross_workspace | Y | Y | Y | Y |
forget.by_key | Y | Y | Y | Y |
import.from.mem0 | Y | Y | Y | Y |
import.from.zep | Y | Y | Y | Y |
import.from.letta | Y | Y | Y | Y |
import.from.openai | Y | Y | Y | Y |
import.from.jsonl | Y | Y | Y | Y |
export.format.mem0 | Y | Y | Y | Y |
export.format.zep | Y | Y | Y | Y |
export.format.jsonl | Y | Y | Y | Y |
lifecycle.subscribe | Y | Y | Y | Y |
llm.invoke | Y | Y | Y | Y |
diagnostics.read | Y | ~ | Y | Y |
audit.read | Y | Y | Y | Y |
audit.read.cross_actor | Y | N | Y | Y |
auth.revoke | Y | Y | Y | Y |
auth.mint | Y | Y | Y | Y |
auth.mint.on_behalf_of | Y | Y | Y | Y |
temporal.phrases.read | Y | Y | Y | Y |
temporal.phrases.write | Y | Y | Y | Y |
vocabulary.read | Y | Y | Y | Y |
vocabulary.write | Y | Y | Y | Y |
policy.administer.deployment | Y(op) | Y(op) | Y(op) | Y |
policy.administer.tenant | Y | Y | Y | Y |
policy.administer.scope | Y | Y | Y | Y |
derivation.administer.scope | Y | Y | Y | Y |
policy.administer.actor | Y | Y | Y | Y |
blob.upload | Y | Y | Y | Y |
blob.read | Y | Y | Y | Y |
admin.flush | Y(op) | Y(op) | Y(op) | Y |
admin.compact | Y(op) | Y(op) | Y(op) | Y |
admin.health | Y | Y | Y | Y |
Y(op) = operator-only (deployment-tier admin).
Since 0.14.0 the catalog also holds forget.by_key (a forget whose selector names only ids and keys, under the derived_only cascade, §8.5), auth.mint and auth.mint.on_behalf_of (minting, §8.16.3; on_behalf_of lets a minter name an act other than itself), and the scope.create.<type> names of the org-tree and shared-memory record types (service, project, dept, team, app, group, aud, source, container, set, hold, policy; matched by exact name, §8.22). Every preset grants them: cloud_shared_saas lists each, the others allow *. A capability a token's scopes names is confined to those entries, and since 0.14.0 one it does not name is refused (§4.7). Since 0.15.0 it also holds derivation.administer.scope (derivation_policy_v1: a scope's derivation policy, as an Owner of the scope, without access administration, §5.2, §8.22.7, §8.32), which every preset grants the same way (crates/cortexdb/presets/cloud_shared_saas.yaml lists it) and free-tier signup tokens carry (§8.16.4).
Appendix B: Scope Path Grammar (ABNF)
scope = segment *( "/" segment )
segment = type ":" id
type = ALPHA *( lowercase / DIGIT / "_" )
id = 1*( ALPHA / DIGIT / "_" / "-" )
ALPHA = %x61-7A ; a-z
lowercase = %x61-7A
DIGIT = %x30-39
Constraints:
- 1 ≤ segments ≤ 32
- 1 ≤ total length ≤ 4096
type≤ 32 chars;id≤ 128 chars
Appendix C: Sample Token (PASETO v4 public)
Decoded payload:
{
"iss": "https://auth.acme.com/cortexdb",
"sub": "agent:planner_v3",
"aud": "cortexdb:tenant:acme",
"exp": 1715836800,
"iat": 1715750400,
"jti": "01HX...",
"deployment": "cloud_shared_saas",
"caps": [
"scope.write",
"scope.read.local",
"scope.read.holistic",
"lifecycle.subscribe"
],
"scopes": [
"scope.write:org:acme/dept:eng/*",
"scope.read.holistic:org:acme/*"
]
}
Appendix D: JSON Schemas (Normative)
Status: normative. The schemas in docs/schemas/ define the contract. Where this prose spec disagrees with a schema, the schema wins. SDK code generators, request validation middleware, and server-side validators all run against these files. Spec text is explanatory; schemas are authoritative.
Schemas (JSON Schema draft 2020-12):
| File | Defines |
|---|---|
experience_envelope.schema.json | The POST /v1/experience request body |
event.schema.json | Event records (§7.1) |
episode.schema.json | Episode records (§7.2) |
fact.schema.json | Fact records (§7.3) |
belief.schema.json | Belief records (§7.4) including stance, confidence_interval, calibration, revision_policy |
concept.schema.json | Understanding concept records (§7.5) including identity/versioning/staleness fields |
scope.schema.json | Scope registration + policy block |
policy.schema.json | Deployment / tenant / scope / actor policy documents |
audit_row.schema.json | Audit log row (§14) |
stratified_pack.schema.json | The POST /v1/recall response |
answer_response.schema.json | The POST /v1/answer response (subset of pack + LLM block) |
lifecycle_event.schema.json | Each SSE event payload, discriminated by event name |
erasure_preview.schema.json | Preview / manifest response shape |
erasure_job.schema.json | Erasure execution / status / cancel responses |
token_claims.schema.json | Required and optional JWT/PASETO claims |
temporal_block.schema.json | The temporal block shared by recall / answer / layer reads |
capability_set.schema.json | Effective capability response from GET /v1/policy/effective |
Change discipline. A schema change accompanies every breaking change in this doc, in the same PR. CI fails if the schemas don't validate the examples in this spec.
Appendix E: SDK shape (illustrative, Python)
client = CortexClient(
base_url="https://api-v1.cortexdb.ai",
token_provider=OktaTokenProvider(...),
)
# Write
res = client.experience(
scope="org:acme/dept:eng/user:alice",
modality="conversation",
content={"kind": "message", "role": "user", "text": "..."},
context={"happened_at": "...", "recorded_at": "..."},
wait="indexed",
)
print(res.event_id, res.stages_completed)
# Recall (stratified pack)
pack = client.recall(
scope="org:acme/dept:eng/user:alice",
view="holistic",
query="What did we decide about Q3?",
layers=["beliefs", "facts", "episodes"],
temporal={"natural": "last 30 days"},
)
print(pack.context_block)
for b in pack.layers.beliefs:
print(b.claim, b.confidence)
# Why
why = client.beliefs.why(belief_id="belief_01HX...")
print(why.narrative)
# Streaming recall
async for chunk in client.recall_stream(
scope="...", view="narrative", query="...",
):
print(chunk.text, end="", flush=True)
# Forget
client.forget(
scope="org:acme/user:alice",
layers=["beliefs"],
selector={"about_entity": "ent_acme_corp"},
cascade="derived_only",
)
# GDPR
job = client.forget_gdpr(scope="org:acme/user:alice", audit_note="DSR #1234")
async for ev in client.lifecycle(erasure_id=job.erasure_id):
print(ev)
Sign-off
This spec is the contract we will implement against. Each phase in §19 ships an internally consistent slice; the spec evolves only through explicit revision PRs that update this file and the schemas in Appendix D in lockstep.
Open items (acknowledged):
- The Understanding layer remains partial in v1; the API surface is honest about it via
_partial. - Federation, BYO vector store, GraphQL, and webhook lifecycle are deferred (§18).
- All deployment-policy presets ship YAML examples in
crates/cortexdb/presets/(TBD by phase 1).
Code memory (/v1/code/*)
The Code Intelligence Plane indexes registered source repositories into a
typed, versioned code graph. Every fact carries a precision tier and a
resolution status, and a name that several identities carry answers with all
of them. Every answer and export spells a tier in lower case (compiler,
syntax, manifest, ...; since 0.14.0, where the structured graph answers
spelled Compiler). docs/CODE_PLANE.md is the guide: the tiers and
statuses, the code.context envelope, certificates, registration safety,
removal and erasure, and every CORTEX_CODE_* setting. The served OpenAPI
(schemas/openapi.json, GET /v1/openapi.json)
gives every field, bound and error status of the routes below.
| Method | Path | What it does | Capability |
|---|---|---|---|
POST | /v1/code/repos | Register a checkout under a parent scope and index it synchronously (201) | admin.compact on the parent |
GET | /v1/code/repos | The repositories the caller may read | diagnostics.read (per row) |
GET | /v1/code/repos/{name} | One repository's bound scope, snapshot, generation, freshness, manifest and counters | diagnostics.read |
DELETE | /v1/code/repos/{name} | De-register the repository and purge its bytes | admin.compact |
GET | /v1/code/symbol/resolve | Every identity carrying an exact name | diagnostics.read |
GET | /v1/code/symbol/search | Indexed names by prefix | diagnostics.read |
POST | /v1/code/inventory | One page of stats, definitions, unreferenced_definitions, routes, architecture or files | diagnostics.read |
GET | /v1/code/calls | Callees (default) or callers (direction=in) of a name | diagnostics.read |
GET | /v1/code/impact | Reverse calls closure of a name (default), or with direction=out what the name depends on (the forward closure), with the weakest tier per reached node; the response names its direction (in or out) | diagnostics.read |
POST | /v1/code/graph/query | Bounded multi-predicate traversal | diagnostics.read |
POST | /v1/code/graph/export | The same handler: output renders the slice as a download (nine formats) | diagnostics.read |
POST | /v1/code/context | The code.context evidence envelope for one repository | diagnostics.read |
POST | /v1/code/workspace/context | One budgeted envelope across up to 16 repositories | diagnostics.read |
GET | /v1/code/coverage/status | Counters and compiler-tier coverage of the pinned head | diagnostics.read |
GET | /v1/code/history/for-symbol | History events of a name, merged across its lineage | diagnostics.read |
GET | /v1/code/tests/for-change | Tests that exercise a name, each row static or observed | diagnostics.read |
POST | /v1/code/certify | Certified list-implementations or count-call-sites over compiler-tier evidence | diagnostics.read |
POST | /v1/code/import/scip | Import a .scip index (the body is the bytes) | admin.compact |
POST | /v1/code/import/coverage | Record an lcov report, replacing the previous one | admin.compact |
POST | /v1/code/gc | One two-phase GC cycle of the repository's content store | admin.compact |
POST | /v1/code/pins | Pin a manifest against GC | admin.compact |
DELETE | /v1/code/pins | Remove a pin | admin.compact |
GET | /v1/code/matrix | The earned language capability matrix | diagnostics.read (tenant-wide) |
GET | /v1/code/export-index | The repository's index as a hash-verified .cxcode bundle | admin.compact |
POST | /v1/code/import-index | Import such a bundle (the body is the bytes); its main head becomes the live index (below) | admin.compact |
A verified bundle's refs/heads/main becomes the live index: under the refresh lock its graph is built into a new
generation from the bundle's blocks, every other head is published, the main head last, and the runtime switches to it,
so graph/*, calls, impact, certify and coverage/status read one index. A bundle that fails verification, or
whose main manifest names a block neither the bundle nor the store holds, is 422 BUNDLE_REJECTED and nothing is
written; a store that fails to take a verified bundle is 500 STORE_ERROR (retriable: true), with no head moved.
Lexical and semantic search (context, workspace/context, recall's code lane) keep serving the checkout's files until
a refresh reads them again: a bundle carries facts, not file contents.
When the routes serve
The routes are always mounted. The plane is built at startup only when
CORTEX_CODE_PLANE is 1, true, on or yes (exactly those spellings);
otherwise nothing is constructed and every route answers 503 CODE_PLANE_DISABLED (retriable: false), except three checks that run
first: an invalid prefix on symbol/search (400), an empty or
oversized roots or predicates on graph/query and graph/export
(400), and a caller without diagnostics.read on matrix (403). The
console's "Code memory" feature sets CORTEX_CODE_PLANE=1 together with the
watcher (CORTEX_CODE_WATCH), the recall lane (CORTEX_CODE_BUNDLE) and
CORTEX_CODE_SHAPES=active, and takes effect on restart. With the plane on
and CORTEX_CODE_BUNDLE off, /v1/code/* serves and /v1/recall is
unchanged. The stores live under <data_dir>/code/, one directory per
tenant and repository, and registrations are journaled, so they survive a
restart. A cluster ingress does not route /v1/code/*: 501 CLUSTER_ROUTE_UNSUPPORTED.
Who may call
Repositories are tenant-scoped: a name resolves only inside the caller's
billing tenant. Registration binds each repository to
<parent>/repo:<name>-<12 hex>, and every route that names a repository
authorizes against that bound scope:
| Need | Routes | Capability on the bound scope | Seat, for a verified per-actor caller |
|---|---|---|---|
| Read | GET /v1/code/repos/{name}, symbol/*, calls, impact, coverage/status, history/for-symbol, tests/for-change, inventory, graph/*, context, workspace/context, certify | diagnostics.read | Reader |
| Mutate | DELETE /v1/code/repos/{name}, import/scip, import/coverage, gc, pins, export-index, import-index | admin.compact | Owner |
- The capability is evaluated on the bound scope, so a token's
scopesconfinement applies. - For a verified per-actor credential the bound scope must be governed by a scope roster; a repository no roster governs is not served to it. Static-key and auth-disabled operator identities skip rosters.
- Every denial (an unknown name, another tenant's repository, a missing
capability, a confined token, no seat, an ungoverned scope) answers the
same
404 REPO_NOT_FOUND, and listings leave the row out: existence never leaks. A roster that cannot answer is503 SCOPE_STORAGE_UNAVAILABLE(retriable: true), never a denial or a shorter list. GET /v1/code/reposlists exactly the repositories that pass the read gate, andworkspace/contextwithoutreposreads the same set.- Registration decides on the parent scope instead, with ordinary
403s (POLICY_DENIED,SCOPE_REGISTRATION_REQUIRED):admin.compactand an Owner seat there,scope.writeto provision an ungoverned parent, and a root scope is never claimed (CODE_PLANE.md, "HTTP API"). GET /v1/code/matrixnames no repository: it needsdiagnostics.readtenant-wide and answers403 POLICY_DENIEDwithout it.- Operator plane (§8.15.3): the read routes,
export-indexincluded, are D-rows routes, so underCORTEX_OPERATOR_DATA_READS=denythe operator key needsX-Cortex-Break-Glassthere (403 BREAK_GLASS_REQUIRED). Registration, removal, the imports, GC and pins are D-write.
Freshness and bounds
Answers come from one published generation of the index. While a change is
being indexed, or after a refresh failed, structural queries answer 409 CODE_INDEX_REFRESHING (retriable: true, details.freshness,
details.published_generation), and so does a query whose generation moved
while it ran (details.query_generation): retry. Repository status and the
listing keep serving and report freshness. certify, coverage/status
and import/scip read the pinned manifest (refs/heads/main) and answer
409 NO_SNAPSHOT until one is published.
Every list and walk is bounded; a value outside a clamp is applied at the
clamp, not refused, and a cut walk sets truncated.
| Route | Bounds |
|---|---|
symbol/resolve, symbol/search | limit 1–500 (default 50); prefix 1–256 bytes after trimming |
inventory | limit 1–1,000 (default 200) |
calls | depth default 1, no maximum; 1,000 nodes and 2,000 edges per identity; the first 4 identities are walked: the response's identities lists every one, identities_cut counts those not walked, and truncated is true when any was cut |
impact | depth 1–6 (default 3); 1,000 nodes and 5,000 rows per identity; the first 4 identities are walked: the response's identities lists every one, identities_cut counts those not walked, and truncated is true when any was cut |
graph/query, graph/export | 1–16 roots and 1–16 predicates; depth 1–6 (1), max_nodes 1–5,000 (250), max_edges 1–10,000 (500); 16 identities per name and 64 roots: identities_cut and roots_cut (each root's resolution carries its own identities_cut) count what was left out and set truncated; 1,024 definitions per file root |
context | token_budget default 2,000, not clamped; at most 8 files, 32 KiB each |
workspace/context | at most 16 repositories; token_budget 100–32,000 (default 2,000) |
history/for-symbol | limit 1–200 (default 50), offset cursor; reads the name's first identity: identities lists every one, identities_cut counts the others and sets truncated |
tests/for-change | limit 1–500 (default 50) bounds the rows (static rows by distance first, then observed ones); truncated and a note say what was left out past it |
certify | at most 64 paths |
import/scip, import-index | the body up to CORTEX_MAX_BODY_BYTES (default 32 MiB; 413 PAYLOAD_TOO_LARGE) |
Errors
Every error is the standard envelope (§16). The codes this plane adds:
| Code | Status | Retriable | When |
|---|---|---|---|
CODE_PLANE_DISABLED | 503 | no | The plane is off |
REPO_NOT_FOUND | 404 | no | Unknown, another tenant's, or not authorized for this caller |
CODE_INDEX_REFRESHING | 409 | yes | No complete current generation, or it moved during the request |
NO_SNAPSHOT | 409 | no | No pinned head yet |
REPO_PURGE_BUSY | 503 | yes | De-registered, but readers still hold the stores; a retry frees the bytes |
INVALID_REPO_NAME, INVALID_SYMBOL_PREFIX, INVALID_DIRECTORY, INVALID_GRAPH_QUERY, INVALID_SYMBOL, UNSUPPORTED_QUESTION, INVALID_PATHS, INVALID_HASH | 400 | no | A request field outside its rules |
TRAVERSAL_REFUSED (calls), GRAPH_QUERY_REFUSED (graph/*) | 400 | no | A walk asked for no bounded plan (no route sends one); a postings read that failed is 503 QUERY_ERROR |
REPO_EXISTS, REPO_SCOPE_IN_USE | 409 | no | Registration of a name or a binding already in use |
REPO_PATH_NOT_ALLOWED, REGISTRATION_FAILED, WORKSPACE_REPO_LIMIT, SCIP_REJECTED, LCOV_EMPTY, BUNDLE_REJECTED | 422 | no | The path, the workspace or the uploaded payload is refused |
QUERY_ERROR | 503 | yes | A repository store could not be read |
STORE_ERROR | 500 | no (yes on import/scip and import-index, which publish nothing when it happens) | A repository store could not be written |
REGISTRATION_PANICKED, REPO_REGISTRY_WRITE_FAILED, REPO_PURGE_FAILED, REPO_PURGE_PANICKED, GC_FAILED, PIN_FAILED, UNPIN_FAILED, MATRIX_UNAVAILABLE, EXPORT_FAILED | 500 | no | The named operation failed |
Registration also answers the scope registry's codes for the parent it
provisions (UNREGISTERED_SCOPE_TYPE, ACCESS_LIMIT_REACHED, ...). A lost
race (409 SCOPE_STATE_CHANGED, SCOPE_REGISTRATION_EXISTS,
AUTHORIZATION_STATE_CHANGED, ACTIVITY_CHANGED) and a registry outage
(503 SCOPE_STORAGE_UNAVAILABLE), and an unknown outcome (503 WAL_OUTCOME_UNKNOWN, which was SCOPE_MUTATION_UNKNOWN before 0.14.0), answer retriable: true, as
the repository gates do; for the parent's provisioning since 0.14.0 (it said false), but SCOPE_REGISTRATION_EXISTS,
which keeps retriable: false there. The other codes keep retriable: false; since 0.14.0 a parent the registry's
storage cannot provision as it is configured is 500 SCOPE_STORAGE_MISCONFIGURED (not retriable, details.reason, §8.8). The OpenAPI
lists them per route.
Native commitments (/v1/memory/commitments/*)
Exact-source commitment decisions (ADR-MEM-024). A commitment is an owner's
decision about a source they already captured — a proposal over an exact byte
range of that source, an explicit confirmation, or a correction that supersedes
a prior revision. The plane is its own authority: a generic scope.write
bearer cannot submit one, and no X-Cortex-Actor header confers decision
authority.
| Route | Body | Purpose |
|---|---|---|
POST /v1/memory/commitments/commands | CommitmentCommandV1, at most 32768 canonical bytes | Propose, confirm or correct. 200 applied, 202 durably accepted with the projection still pending; both carry CommitmentReceiptV1 (at most 4096 bytes) |
POST /v1/memory/commitments/status | CommitmentReadV1 with operation: "status", at most 8192 bytes | Acceptance metadata for one command identity (CommitmentReceiptV1) |
POST /v1/memory/commitments/current | CommitmentReadV1 with operation: "current", at most 8192 bytes | The currently projected decision for an owner (CommitmentDecisionV1, at most 65536 bytes) |
POST /v1/memory/commitments/evidence | CommitmentReadV1 with operation: "evidence", at most 8192 bytes | A typed UTF-8 quote out of one exact decision revision, carrying original-source lineage only (CommitmentEvidenceV1, at most 32768 bytes) |
Every call carries two independent credentials: the ordinary transport bearer
(Authorization) and a purpose-bound proof minted by the admitted
commitment issuer (nativeMemoryDecisionProof). A read proof can never submit.
Exact request and response shapes are in
schemas/openapi.json; the canonical fixtures are
under docs/schemas/fixtures/commitment/.
Callers, limits and errors
A request is served only when all of these hold. They are checked before the storage work, again inside and after it, and once more while a read's body is handed off (a lapse then ends the stream with an error instead of the body):
- Transport. Exactly one
Authorization: Bearerheader, the token at most 16384 bytes, that verifies to the claims the auth middleware read: subject the profile's admitted Memory service caller (aservice:actor), issuer its transport issuer, audience its admitted audience. The staticCORTEX_API_KEY, an auth-disabled server and unsigned mode never qualify. - Proof. Exactly one
X-Cortex-Memory-Decision-Proofheader, non-empty and at most 8192 bytes, that verifies against the exact canonical body within the request's deadline: the submit profile's oncommands, the read profile's on the three reads. Once the profile is withdrawn (below), no proof verifies. - Scope.
scope.write(commands) orscope.read.local(reads) at the body'sscope, which must be registered, with the caller on its roster at Writer or above (commands) or Reader or above (reads; a Summary entry reads nothing, and any entry of a version-1 record reads).
A body over 32768 bytes is refused before the handler (413); a read over 8192
bytes, a noncanonical body, or a read whose operation is not its route's is
422. Every request runs under a 30 s deadline, and every response carries
Cache-Control: no-store. Errors are the standard envelope (§16), with the
message native commitment request unavailable and no details:
| Status | error_code | Retriable | When |
|---|---|---|---|
| 401 | auth middleware codes (§4) | — | The bearer does not authenticate |
| 403 | COMMITMENT_DENIED | no | A check above fails (on commands, before the submit enters acceptance), including after the profile was withdrawn |
| 404 | NOT_FOUND | no | The exact source, predecessor, command association, owner commitment or revision is not available; nothing about the source is disclosed |
| 409 | COMMITMENT_CONFLICT | no | commands: the command identity was reused with a changed command, or the expected revision is stale. current: the revision advanced during the read; retry with a fresh proof |
| 413 | PAYLOAD_TOO_LARGE | no | Body over 32768 bytes. The envelope's message names this bound, details.max_body_bytes: 32768, with no bulk or blob hints (since 0.14.0; before, both named the server-wide CORTEX_MAX_BODY_BYTES) |
| 422 | INVALID_COMMITMENT | no | Invalid or noncanonical body, a read over 8192 bytes, an operation that does not match the route, an evidence range that bisects UTF-8 |
| 503 | COMMITMENT_UNAVAILABLE | yes | No plane is mounted; admission, the blocking lane, storage, projection or the deadline is unavailable (on commands, before the submit enters acceptance); the plane serves no current or evidence reads |
| 503 | COMMITMENT_ACCEPTANCE_UNKNOWN | yes | commands only: the submit entered acceptance and its outcome cannot be shown (the deadline, a check failing afterwards, a receipt that did not read or encode, a write the store refused; since 0.14.0 the last two answer this, not COMMITMENT_UNAVAILABLE or 404 NOT_FOUND). Retry with the original command identity and a fresh proof |
When the routes serve
The routes are always mounted and always advertised. Whether they answer is a deployment decision an operator makes explicitly.
| Deployment | Result |
|---|---|
No CORTEX_MEMORY_COMMITMENT_PROFILE | Every route answers 503 COMMITMENT_UNAVAILABLE, and GET /v1/admin/ready → checks.commitments.reason says why: profile_unconfigured normally, and index_absent / index_building when the log already holds history and configuring a profile would therefore NOT be enough on its own (a never-appended log has its index built by the first boot that configures a profile, so it reports the profile instead). Nothing is fatal: a deployment that does not want commitments is an ordinary deployment |
Profile configured, declared digest matches, unified WAL on, commitment index ready, posture signed | The plane mounts and the four routes serve |
Native memory host (cortexdb --native-memory-host-dir=<DIR>) | The host always mounts the four routes with its own plane; checks.commitments reports mounted: true |
| Profile configured and anything else wrong | Boot refuses. One FATAL: commitment plane: <CODE>: <what to do> line, then exit 78 (EX_CONFIG). The server never starts half-serving |
Boot-refusal codes: COMMITMENT_PROFILE_REFUSED (unreadable, non-canonical,
expired, wrong digest or wrong audience),
COMMITMENT_INDEX_NOT_READY (run the migrator below),
COMMITMENT_VERSION_UNSUPPORTED (the index was written by a newer binary),
COMMITMENT_ARTIFACT_STORE_UNAVAILABLE, COMMITMENT_POSTURE_UNSUPPORTED.
checks.commitments.posture is signed exactly when CORTEX_API_KEY is
configured; a keyless boot reports auth_disabled and refuses to mount a
configured profile. Identity facts — the profile digest, the admitted service
caller, the transport issuer — are deliberately not on the unauthenticated
readiness route; they are on the boot INFO line.
An admitted profile carries a not_after. A watchdog withdraws the authority
the moment it passes: the routes stay wired, every proof is refused with 403 COMMITMENT_DENIED, and readiness reports expired: true with mounted still
true. Rotation is a new profile file, a new declared digest and a restart —
there is no hot reload.
Configuration
| Variable | Meaning |
|---|---|
CORTEX_MEMORY_COMMITMENT_PROFILE | Path to the canonical NativeCommitmentHostProfileV1 file. Unset means the plane is off |
CORTEX_MEMORY_COMMITMENT_PROFILE_DIGEST | The digest the operator declares for that exact file. Required whenever the profile is set; a mismatch is boot-fatal. Set on its own, with no profile, it logs one WARN and the deployment stays unconfigured |
CORTEX_MEMORY_COMMITMENT_FRESH_INIT | 0 disables the commitment-index initialisation a fresh log gets at the first boot that configures a profile. Default on |
Minting a profile and signing proofs is offline operator work; the runbook is in
PRODUCTION_CONFIG.md.
Upgrading a data directory that already holds history
A store this or a later binary creates has its commitment index built at the first boot that configures a profile. A directory that already holds history does not — and neither does one that was first booted without a profile, since a store that never served commitments is deliberately left eligible for retention and dead-row compaction, which the commitment index marker disables. Either way the boot is fatal rather than silently degraded. Stop the server and run:
# 0 = applied, 1 = not applied; writes nothing
cortexdb migrate commitment-index --data-dir /var/lib/cortexdb --check
cortexdb migrate commitment-index --data-dir /var/lib/cortexdb
The migrator is offline by design: a running server holds the RocksDB lock, and
the migrator refuses rather than racing it. Exit codes are 0 done or already
applied, 1 --check found it unapplied, 2 usage, 3 cannot open the data
directory, 4 the migration itself failed, 5 refused because the log carries
a commitment erasure profile.
The decision record is ADR-MEM-024.
Native memory host (/v1/memory/source-erasure/*, /v1/experience/status, /v1/experience/resume)
cortexdb --native-memory-host-dir=<DIR> serves a prepared cell as the native
memory host. Its route graph is its own: native capture on POST /v1/experience
(the default router's shape of that path is §8.1), the commitment routes of the
previous section, native recall, answer and event reads, the six source-erasure
routes and the two capture-recovery routes below, plus an operational subset
(health, readiness, version, the OpenAPI document and schemas,
GET /v1/admin/native-memory, whoami, token minting and revocation, the
effective and deployment policy). Nothing else from the default router is
mounted. The default single-node server mounts none of the routes in this
section except GET /v1/experience/status (§8.18), which the host in turn does
not serve; a cluster ingress does not route GET /v1/admin/native-memory.
Field detail is in the served schemas (GET /v1/openapi.json, components
NativeCapture* and SourceErasure*; the generated ones are also served at
GET /v1/schemas/<name>). Every body is closed canonical UTF-8 JSON, every
request runs under a 30 s deadline, and every response carries
Cache-Control: no-store.
| Route | Body | Proof headers and capabilities | Success |
|---|---|---|---|
POST /v1/experience/status | NativeCaptureOriginalV1, at most 4096 bytes | No proof; scope.read | 200 NativeCaptureStatusV1 |
POST /v1/experience/resume | NativeCaptureOriginalV1, at most 4096 bytes | No proof; scope.read, scope.write, scope.write.on_behalf_of | 200 NativeCaptureStatusV1 |
POST /v1/memory/source-erasure/commands | SourceErasureCommandV1, at most 32768 bytes | Recovery and new-acceptance write | 200 SourceErasureStatusV1 |
POST /v1/memory/source-erasure/status | SourceErasureCommandV1 | Recovery; a write proof is refused | 200 SourceErasureStatusV1 |
POST /v1/memory/source-erasure/refusals | SourceErasureCommandV1 | Recovery and terminal-refusal write | 200 SourceErasureStatusV1 |
POST /v1/memory/source-erasure/discovery | SourceErasureDiscoveryQueryV1, at most 32768 bytes | Discovery; recovery and write proofs are refused | 200 SourceErasureDiscoveryResponseV1 |
POST /v1/memory/source-erasure/discovered-commands | SourceErasureDiscoveredCommandV1, at most 32768 bytes | Recovery, new-acceptance write and discovery | 200 SourceErasureStatusV1 |
POST /v1/memory/source-erasure/progress | SourceErasureCommandV1 | Recovery; a write proof is refused | 200 SourceErasureProgressV1 or SourceErasureProgressV2 |
GET /v1/admin/native-memory | None | No credential at all | 200 NativeMemoryStatusResponse |
Capture recovery and resume
POST /v1/experience/status reads the registration of one exact original
capture and returns it with the original:
{"schema_version": 1, "original": {...}, "registration": {...}}, where
registration is null when none exists, which is uncertainty, not proof of
absence. It never registers, resumes or indexes. POST /v1/experience/resume
does the same lookup and, when a registration exists, runs that capture's
compiler job on the provider lane before it returns the registration as it then
stands; it never registers a capture (POST /v1/experience on the host does).
Both answer at most 16384 bytes.
Headers are checked before authentication: exactly one Authorization and one
X-Cortex-Actor header, each non-empty and at most 16391 bytes, all headers
together at most 40960 bytes, and no query string. A missing token is therefore
400 here, not 401. The bearer must then pass the auth middleware (its own
401 envelope, §4) as a signed service: caller equal to the original's
caller; the static key and unsigned identities are refused with 403. The
capabilities are checked at the original's scope before and after the storage
work and again while the body is handed off; a lapse then ends the response
stream with an error instead of the body.
| Status | code | When |
|---|---|---|
| 400 | native_capture_invalid_request | A header rule above, a query string, or a noncanonical original or one over 4096 bytes |
| 401 | Auth middleware codes, standard envelope (§16) | The bearer fails verification, or X-Cortex-Actor differs from the token subject (ACTOR_MISMATCH) |
| 403 | native_capture_authority_denied | An unsigned, static-key or non-service identity, a caller other than the original's, a missing capability, or host, worker or capture authority that is not current |
| 503 | native_capture_unavailable | Deadline, cancellation, admission or storage unavailable, or authority lapsing after the read; for resume, only before the worker starts |
| 503 | native_capture_outcome_unknown | resume only: the worker started and its outcome cannot be shown. Retry with the same original |
409 native_capture_original_conflict belongs to registration
(POST /v1/experience on the host); neither route here returns it.
Source erasure
These routes have no auth middleware. The host's erasure transport owner
verifies the bearer itself: one Authorization: Bearer header whose token is at
most 16384 bytes, issued to the admitted privacy workload. X-Cortex-Actor,
scope capabilities and roster entries confer nothing, and a bad or missing
token is 400 or 403, never 401. Each proof is a separately signed token
over the exact canonical body, sent in one header of at most 8192 bytes; all
request headers together are at most 40960 bytes.
| Header | Purpose | Routes |
|---|---|---|
X-Cortex-Memory-Erasure-Recovery-Proof | Recovery: discloses status and progress metadata, cannot accept or refuse | Every route but discovery |
X-Cortex-Memory-Erasure-Write-Proof | New acceptance (commands, discovered-commands) or terminal refusal (refusals), from a key distinct from the recovery and transport keys | commands, refusals, discovered-commands; refused with 400 on status, progress and discovery |
X-Cortex-Memory-Erasure-Discovery-Proof | Discovery, bound to the query's observation_id and digest | discovery, discovered-commands |
Every mutation route first reads the exact command's status under the recovery
proof. A command already observed (accepted or refused) returns that status and
writes nothing; the write proof is verified only while the command is
unobserved. commands accepts only before the command's accept_before_ms,
and only while no batch, epoch, candidate, target or command conflict exists.
refusals closes the pending candidate with reason expired_unaccepted or
predecessor_conflict; a refusal is a durable record, not proof that no
acceptance happened elsewhere. After a mutation the status is read again, and a
command still unobserved answers 503 source_erasure_outcome_unknown.
Recover every ambiguous outcome with status and the same command; an error
never authorizes a replacement candidate. status may answer unobserved,
which is uncertainty, not proof of non-acceptance.
discovery inventories the WAL, materialized and (on the indexed plane) index
participants of an exact erasure selection. The query's schema_version must
be the served plane's: 1 for the two-inventory plane, 2 for the explicit
indexed plane. expected: null discovers; an expected digest set re-observes
and is refused (403) on any difference. The response is metadata only, at most
16 MiB + 4096 bytes (a larger one is refused with 403), and its body is
withdrawn if the observation is no longer current while it is read.
discovered-commands accepts a reviewed preview: it re-observes the inventory
under the embedded query and its discovery proof, has the preview-acceptance
owner bind that inventory to the command, then accepts it as commands would,
and discloses only the post-acceptance status.
progress returns the status plus, once the command is accepted, the cleanup
phase (cleanup, null until then) and, on the indexed plane, one
index_cleanup entry per target (pending, running, or live_rows_removed
with a receipt_digest). Its schema_version is the plane's: 1 (at most 9216
bytes) or 2 (at most 40960 bytes). A phase is an observation, not a
certificate, and live-row removal is not storage reclamation.
Errors are {"code": "<code>", "schema_version": 1} (SourceErasureHttpErrorV1)
and carry no retriable field:
| Status | code | When |
|---|---|---|
| 400 | source_erasure_invalid_request | A header or body rule above, a proof header on a route that refuses it, or (progress) a target that is not an evt_ id |
| 403 | source_erasure_authority_denied | Transport, proof, purpose, epoch or owner authority denied, including a check that lapses before the response when nothing was written; for discovery also a schema_version other than the plane's, a changed expected set and an oversized response |
| 403 | source_erasure_write_authority_required | commands, refusals, discovered-commands: the command is unobserved and no write proof was sent |
| 409 | source_erasure_not_accepted | commands, discovered-commands: accept_before_ms has passed, or the batch, epoch, candidate, target or command check refused the command |
| 409 | source_erasure_not_refused | refusals: the candidate could not be closed |
| 503 | source_erasure_unavailable | Admission, the deadline or storage unavailable before any mutation; on status, as on progress, a status that cannot be matched to the command or encoded (since 0.14.0) |
| 503 | source_erasure_outcome_unknown | A mutation was entered and its outcome cannot be shown (a storage error, the deadline, a lapsed authority, a status still unobserved); on discovered-commands also any discovery refusal at acceptance time and a lapse while the body is handed off |
Host status (GET /v1/admin/native-memory)
Auth-free like /v1/admin/health: an orchestrator probing a withdrawn host has
no usable token. Always 200; a host that has withdrawn reports
host_current: false. The body is produced per request and carries counters
and phase only, never a profile id, generation, storage set or account identity:
| Field | Type | Notes |
|---|---|---|
host_current | boolean | The retained host still passes its currency check |
workers | string | running, stopping, stopped or failed |
admission_withdrawn | boolean | The admission watch observed a withdrawal; the host is draining |
erasure_writes_frozen | boolean | Write-purpose erasure proofs are refused until a restart; recovery reads stay available |
accounts | integer | Prepared accounts the registry declared at boot |
captures_applied | integer | Capture jobs applied since boot |
erasure_steps | integer | Source-erasure steps completed since boot |
history_steps | integer | Commitment history steps completed since boot |