> ## Documentation Index
> Fetch the complete documentation index at: https://docs.reilabs.org/llms.txt
> Use this file to discover all available pages before exploring further.

# Build continuity across calls

> Preserve useful evidence and constraints so later Adapt-1 calls can reason with them.

export const ContinuityStrip = () => {
  const stages = [["01", "Record", "A useful constraint enters", "Evidence, a decision, or an operating constraint becomes part of the current state.", "border-sky-200 bg-sky-50 dark:border-sky-900 dark:bg-sky-950"], ["02", "Apply", "Later reasoning can use it", "A new query begins from the structure already formed rather than from an empty interaction.", "border-amber-200 bg-amber-50 dark:border-amber-900 dark:bg-amber-950"], ["03", "Revise", "Correction changes what follows", "New evidence can weaken, replace, or remove an earlier constraint.", "border-emerald-200 bg-emerald-50 dark:border-emerald-900 dark:bg-emerald-950"]];
  return <figure className="not-prose my-8 overflow-hidden rounded-2xl border border-stone-200 bg-white shadow-sm dark:border-zinc-800 dark:bg-zinc-950" aria-labelledby="continuity-caption">
<div className="flex items-center justify-between gap-3 border-b border-stone-200 px-5 py-4 dark:border-zinc-800">
<div><div className="text-xs font-semibold uppercase tracking-widest text-stone-500 dark:text-zinc-400">Persistent, revisable state</div><div className="mt-1 text-sm font-semibold text-stone-900 dark:text-zinc-100">Continuity changes later reasoning</div></div>
<span className="rounded-full border border-stone-200 px-3 py-1 font-mono text-xs text-stone-500 dark:border-zinc-700 dark:text-zinc-400">call n · call n+1</span>
</div>
<div className="grid gap-3 p-4 md:grid-cols-3">
{stages.map(stage => <section key={stage[0]} className={`rounded-xl border p-4 ${stage[4]}`}>
<div className="flex items-center justify-between"><span className="font-mono text-xs text-stone-400 dark:text-zinc-500">{stage[0]}</span><span className="rounded-full bg-white px-2 py-1 text-xs text-stone-600 dark:bg-zinc-900 dark:text-zinc-300">{stage[1]}</span></div>
<div className="mt-5 text-sm font-semibold text-stone-900 dark:text-zinc-100">{stage[2]}</div>
<div className="mt-2 text-xs leading-5 text-stone-600 dark:text-zinc-400">{stage[3]}</div>
</section>)}
</div>
<figcaption id="continuity-caption" className="border-t border-stone-200 px-5 py-3 text-xs text-stone-500 dark:border-zinc-800 dark:text-zinc-500">The behavior to test is whether later reasoning changes appropriately—not whether a record merely exists.</figcaption>
</figure>;
};

## Outcome

Your application records useful evidence, decisions, constraints, or interactions and makes them available to later reasoning calls.

<ContinuityStrip />

## Workflow

```text theme={null}
record -> query -> inspect -> correct or remove -> query again
```

Use the `/api/v1/memory/*` namespace for this loop. The namespace is a stable API contract; it is not a description of the whole architecture. State is one input to Core's continuing reasoning and adaptation.

## Gateways

| Need                           | Route                                                                                 | Primary result                                                                                         |
| ------------------------------ | ------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------ |
| Record an interaction          | `POST /api/v1/memory/store`                                                           | Stored record identity/status                                                                          |
| Retrieve ranked support        | `POST /api/v1/memory/search`                                                          | Ranked supporting evidence                                                                             |
| Query with reasoning           | `POST /api/v1/memory/query`                                                           | `memory_context`, `confidence_score`, optional `reasoning`                                             |
| Inspect expanded reasoning     | `POST /api/v1/memory/explain`                                                         | Evidence, concepts, connections, and the contract-defined `conflicts` and `resolution` response fields |
| Inspect current state          | `POST /api/v1/memory/state`                                                           | Current session state                                                                                  |
| List, delete, or clear records | `POST /api/v1/memory/list`, `POST /api/v1/memory/delete`, `POST /api/v1/memory/clear` | State-control response                                                                                 |

## Memory lifecycle

The remaining public memory operations belong to this same continuity loop; they are not separate API products.

| Need                                      | UAT endpoint                                                              | Contract                                                                                  |
| ----------------------------------------- | ------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------- |
| Correct one record while retaining its ID | `POST https://rei-neuroadapt-api.reilabs.org/api/v1/memory/correct`       | Supply the returned `memory_id` plus the replacement content.                             |
| Store 1–50 records                        | `POST https://rei-neuroadapt-api.reilabs.org/api/v1/memory/batch_store`   | Synchronous, input-ordered, and non-transactional.                                        |
| Use the compatibility alias               | `POST https://rei-neuroadapt-api.reilabs.org/api/v1/batch_store`          | Alias for the canonical batch-store route.                                                |
| Read a capacity summary                   | `POST https://rei-neuroadapt-api.reilabs.org/api/v1/memory/state/summary` | Use `/memory/state` with `summary_only: true` when full diagnostics are otherwise needed. |
| Preview or apply pruning                  | `POST https://rei-neuroadapt-api.reilabs.org/api/v1/memory/prune`         | Start with `dry_run: true`; unique memories are protected by default.                     |

A batch can partially succeed: items completed before a later failure remain stored. Inspect the per-item results before retrying. Do not issue a dependent query until the batch request returns successfully.

```bash theme={null}
curl -fsS -X POST https://rei-neuroadapt-api.reilabs.org/api/v1/memory/correct \
  -H "Authorization: Bearer <api-key>" \
  -H "Content-Type: application/json" \
  -d '{
    "session_id": "<session-id>",
    "memory_id": "<memory-id>",
    "user_message": "Corrected observation text.",
    "ai_message": "",
    "context": {"source": "operator-correction"}
  }'
```

Memory query, search, and explain default to `update_memory_state: true`; when enabled, these operations can change how evidence is organized and what remains influential in later reasoning. Set `update_memory_state: false` for a read-only comparison or reproducible evaluation.

Use `max_records`, optional `max_bytes`, and `include_unique` deliberately when pruning. Review a dry-run candidate set before repeating the call with `dry_run: false`.

## Validation

Record one constraint, query for the decision it affects, then verify that the returned context or reasoning uses that constraint. Correct or remove the record and query again. The meaningful behavior is not storage alone; it is whether later reasoning changes appropriately.

## Boundaries

* Use Domains when the application benefits from explicit entities, relations, hypotheses, rules, or domain-shaped evidence.
* Use the interval policy when the documented interval and scalar contract matches the required result.

The [Quickstart](/docs/neuroadapt/quickstart) contains the complete first-call example.
