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

# Versioned state

> Understand revisions, active settings, and which records retain history.

PostgreSQL is the canonical store for an agent's persona, memory, execution
history, and configuration. Markdown and model prompts are views of that state,
not a second source of truth.

## What is versioned

| State | Current implementation |
| - | - |
| Persona | Append-only `agent_persona_revisions`, with one active revision per agent. Reverting activates an earlier revision. |
| Memory | A current entry plus immutable revisions for create, amend, and forget operations. Revision evidence retains authors, source audiences, and derivation. |
| Prompt context | Saved assembled prompts referenced by the model calls that used them. |
| Tool configuration | Agent-owned enablement and configuration records, with runtime validation before use. |
| Agent profile | The `runtime_agents` row plus persona revisions; there is no separate `agent_profiles` table. |

These records are not one universal version history. Some configuration rows are
updated in place; memory and persona have their own revision contracts. A prompt
snapshot records an invocation's context, not a restorable snapshot of the whole
deployment.

## Memory changes

`remember` creates an entry. `amend` creates a new revision of an existing entry.
`forget` retires the entry while retaining its operation history. The current
entry and its revision commit together.

Subject, source, and visibility are separate structured references. An amendment
preserves prior source restrictions and adds any new evidence; changing prose
cannot strip private provenance. Sharing grants are revision-specific, so changed
text needs new permission to reach an audience outside its source permissions.

Both automatic context and `recall` use current, live, authorized revisions.
Optional semantic indexes attach to immutable revisions and never override
canonical state. See [memory retrieval](https://docs.formation.texturehq.com/runtime/memory-retrieval.md) and
[memory privacy](https://docs.formation.texturehq.com/runtime/memory-privacy.md).

## Execution state

A run's model calls, tool observations, and outcomes are durable audit records.
[Checkpoints](https://docs.formation.texturehq.com/runtime/turn-checkpoints.md) additionally save the execution frontier
needed to recover after a worker exits. [Continuation](https://docs.formation.texturehq.com/runtime/task-continuation.md)
saves task context for another authorized stretch of work.

Recovery reconstructs current system policy and permissions. It does not turn old
prompt instructions into new authority, reset spent budgets, or assume that an
unconfirmed external operation failed.

Implementation: [`db/queries/versioned_state.sql` (repository)](https://github.com/TextureHQ/formation/blob/main/db/queries/versioned_state.sql),
[`internal/memory` (repository)](https://github.com/TextureHQ/formation/tree/main/internal/memory), and
[`internal/run` (repository)](https://github.com/TextureHQ/formation/tree/main/internal/run).


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.