Data and storage
Understand how LegionCode stores product records, lifecycle events, credentials, and review artifacts.
LegionCode stores enough state to authenticate users, connect repositories, run tasks, and reconstruct conversation and review history. Browser storage may cache preferences, but it is not the source of truth for product or runtime state.
Source of truth
The runtime writes turn, tool, approval, artifact, and terminal lifecycle events through one append path. The same durable history supports replay after a refresh and live continuation while work is active.
Transcripts, workflow activity, sidebar status, usage, and review state are projections over canonical records. A projection can present or group state; it does not change the underlying lifecycle.
Product data
Server-side data includes:
- user identity and session records;
- connected repositories and selected branches;
- workspace, task, turn, and run-attempt identities;
- transcripts and lifecycle events;
- permission decisions and tool-call records;
- finalized artifacts and Git action metadata;
- provider credential records and connection status.
If a turn fails or is interrupted, its durable history should remain available for review and troubleshooting.
Secrets
Secrets are stored separately from metadata returned to clients. API responses expose connection status and safe identifiers, not credential values.
Do not include provider credentials, cookies, private repository contents, or environment values in logs or bug reports.
Migrations
Database migrations live in the repository and must be applied before deploying code that depends on a new schema.
The supported Cloudflare production procedure is the scheduled-only migration worker documented in Deployment. It has no HTTP handler or public route. Keep the main Brain Worker in DATABASE_MIGRATIONS_MODE=manual; do not enable automatic migrations on live request handlers.