Formation

Turn completed conversations into durable memory off the realtime path.

Submit structured turns after a call, chat, or workflow. ContextDB removes PII before the provider, proposes quote-backed ADD, UPDATE, DELETE, or NOOP candidates, applies blocking gates, and either returns them for review or commits them to the correct user partition.

structured turns → 202 job → propose | commit

Formation availability

Asynchronous memory formation

ContextDB Formation Hosted Alpha

Short answer: Formation is asynchronous memory creation. The agent finishes its realtime turn. A durable job decides what deserves to become memory afterward.

propose · commit · submit and poll Review service status

Off the realtime path

Do not make a voice agent wait while a transcript becomes memory.

A direct remember call is right when your application already knows the exact fact. Formation is for raw interaction turns that still need extraction, provenance, confidence, evidence, and a decision about whether memory should be added, corrected, retracted, or left unchanged.

  1. 01 / Submit

    Write one durable job

    A required stable idempotency key binds the structured text turns, mode, project, and user partition.

    POST /v1/formation/jobs → 202 queued
  2. 02 / Claim

    Lease the PostgreSQL row

    One dedicated same-VM process claims due work and records an inspectable attempt.

    queued | retry_wait → running
  3. 03 / Prepare

    Scope and process context

    Cloud reads at most 50 current factual memories from the exact partition, then PII-processes turns and context before provider execution.

    scope → PII gate → bounded context
  4. 04 / Plan

    Return explicit candidates

    The provider proposes ADD, UPDATE, DELETE, or NOOP. Every mutating candidate must survive the extractive quote and operation gates below.

    provider → validate → accepted | rejected
  5. 05 / Resolve

    Propose or commit

    Propose keeps candidate state encrypted at rest and returns candidate details for review without changing memory. Commit applies the frozen accepted stage under a stable commit identity.

    review candidates | write memory
  6. 06 / Poll

    Reach a closed ending

    The host polls the job ID until succeeded or failed and can inspect the terminal reason without resending turns.

    GET /v1/formation/jobs/{job_id}

The API object

Submit once. Poll without resending the transcript.

Every submission requires an idempotency key. Repeating the same request resolves to the same job. Changing the payload under that key fails closed.

The poll response shows provider attempts, elapsed time, accepted and rejected counts, operation counts, terminal reason, candidate evidence, lineage IDs, and consistency tokens when commit mode succeeds.

# enqueue
POST /v1/formation/jobs
Idempotency-Key: call-456-formation-v1
{
  "user_id": "customer-123",
  "mode": "propose",
  "turns": [
    {"speaker": "user",
     "content": "I prefer Saturday mornings."}
  ]
}
→ 202 {"job_id":"frm_…","status":"queued"}

# poll
GET /v1/formation/jobs/frm_…
→ succeeded · completed · candidate accepted

Two modes

Review first or commit automatically.

Mode / propose turns → encrypted candidate review

Inspect operation, target, candidate content, source, confidence, evidence quote, turn indexes, action relevance, NOOP reason, and rejection reason without changing memory.

Mode / commit validated stage → idempotent memory write

Accepted candidates enter the scoped memory state machine with stable commit identity. The result carries operation counts, current and prior memory IDs, deleted IDs, and a read-your-writes consistency token.

Operation-aware Formation

A completed conversation can change memory instead of only adding more.

The provider sees bounded current factual memory from the same project and user partition. It can propose ADD for a new fact, UPDATE for a correction, DELETE for an explicit retraction, or NOOP for a duplicate. ContextDB derives candidate identity and applies deterministic gates before any commit.

Blocking gates applied before propose output or commit
Candidate Required evidence Accepted result Fail-closed result
ADD Self-contained content, source fields, cited turn indexes, and an exact PII-processed quote from a valid turn. A server-derived candidate key identifies one new memory. A missing or non-extractive quote rejects the candidate.
UPDATE An exact supporting quote plus a current target ID or stable entity and attribute slot in the same partition. The successor records current and prior memory IDs. A missing or foreign target never becomes a blind ADD.
DELETE A current target or slot and an exact user-stated quote with explicit forget, remove, or retract language. The result lists deleted IDs. No retraction quote means no DELETE.
NOOP A bounded snake_case reason and a verified scoped reference. The audit records why nothing changed. No memory row is written and the memory version stays unchanged.

Read the full Memory Evolution guide.

See the result in Console: open Memories.

Durability and safety

A queue is useful only when every job has an inspectable ending.

One dedicated single-instance Formation process executes beside the gateway on the same app VM. The process is separate. The PostgreSQL job, lease, attempt, encrypted stage/result, and commit state stay durable.

Encrypted state project + job + payload kind

Request, staged candidate, and result payloads use project and job-bound authenticated encryption. Raw turns and candidates do not enter plaintext control columns.

Worker recovery worker_lost → retry_wait | failed

Jobs carry leases, deadlines, provider-attempt limits, and worker limits. Expired leases produce named worker-loss attempts instead of a permanent running state.

Commit recovery frozen stage + stable commit identity

A staged candidate has one commit identity. If a worker exits after the memory write, the next lease owner recovers that memory instead of writing another copy.

Use cases

Formation begins where the live interaction ends.

  • Voice call completion

    Extract stable caller preferences after the phone conversation without adding turn latency.

    completed call → structured turns
  • Support conversation review

    Propose durable account context for operator review before it reaches future agents.

    conversation → propose → review
  • Workflow event batches

    Turn structured human and agent events into sourced memories with a named failure state.

    events → durable job → terminal state
  • Agent-platform memory

    Offer post-session memory creation while keeping the platform's realtime runtime independent.

    session end → formation

Formation can mark a memory as action-relevant, but it does not authorize the action. ContextDB advises. The customer host enforces. The host applies the result at the action boundary.

Verified on August 24, 2026

What has actually been proved.

PostgreSQL tests claim · lease · terminal · recovery

Real PostgreSQL tests cover claim, lease, synthetic terminal, encrypted result, retry budget, and partial commit recovery.

Ownership test gateway → separate runtime → gateway poll

A bounded split-ownership CI test disables embedded execution, enqueues through the gateway, commits through a separately assembled runtime in the same test process, and polls through the gateway.

Production proof 2026-08-24

The August 24 bounded production proof passed propose, identical replay, commit, recall, lineage, consistency, Memory CI, and plaintext control-state scans.

Provider operations UPDATE · NOOP · DELETE

Gemini 2.5 Flash independently selected and committed UPDATE, NOOP, and DELETE against live project-scoped context.

Process restart worker_lost → completed

A later same-VM proof killed the dedicated Formation process, observed a new PID, advanced only the synthetic lease expiry, and reached worker_lost → completed without duplicate memory or commit identities.

Cleanup mutable proof rows → 0

Cleanup returned zero proof projects, keys, jobs, attempts, commits, suites, credentials, or memory rows.

This is functional and same-VM process-restart evidence, not a broad quality benchmark, COGS result, sustained-load test, high-availability, multi-VM failover, customer-data backup/restore, worker-fleet, or availability SLO evidence. It does not establish exactly-once provider calls or natural wall-clock lease timing.

Formation FAQ

Formation questions, answered directly.

Should I use Formation instead of remember?

Use remember when your host knows the exact fact. Use Formation when structured turns still need extraction and validation.

Does the realtime agent wait?

No. Submission returns a job ID immediately. The host polls after the interaction while a separate single-instance Formation process runs on the same app VM.

Can I upload audio?

No. The Hosted Alpha contract accepts structured text turns only.

Can I cancel or list jobs?

No. Cancellation, job listing, retention cleanup, and scheduling are not part of the current contract.

Can Formation correct or delete existing memory?

Yes, in Hosted Alpha. Version-2 jobs can propose and commit UPDATE, DELETE, and NOOP as well as ADD. UPDATE and DELETE require a current target or slot, and DELETE also requires an explicit retraction.

Is commit exactly once?

The implementation uses idempotent enqueue, staged candidates, stable commit identity, and recovery tests. ContextDB does not claim exactly-once infrastructure or an availability SLO.

Create memory after the conversation, not during it.

Start with propose mode, inspect one candidate, then decide whether commit fits your workflow.