Persistence
Current identities and retention
A Project is a repository and can own several managed workspaces/containers. workspaceId identifies storage and runtime, while session identity and native provider conversation identity remain separate. The operator wizard defaults to a compatible existing container; a separate worktree/container is available. Cross-repository reuse is restricted to the same owner and compatible policies. Different server users always have separate containers, sidecars, account stores and homes.
Sharing a subscription creates private authorization-only recipient profiles and one quota pool; it never shares the original transcript tree. Revocation blocks new starts and delays private auth cleanup until active providers have exited. Session history and retained provider resources are distinct: destroying a sandbox is not deleting controller history. Container choice, shared accounts (source access required), compute lifetimes.
Controller restart or client disconnect detaches transport without stopping provider processes. A controller handover requires reviewed authority transfer; a copied database must not become a second active authority. Server implementation.
Session Settings persists global/tracked/local provider defaults separately from each session's immutable launch snapshot. Selecting a session in the settings tree only chooses the exact restart target. Launch Profiles persists optional new-session recipes by repository and owner; deleting a recipe retains its sessions and containers. Neither saving defaults nor editing a recipe changes a running provider. Session configuration.
Context tool selection is durable private template/Project/container configuration, separate from observed installed versions. Verified host caches and immutable container tool directories allow reuse without rebuilding every workspace. DEVCTRL.AGENTS.MD is regenerated environment guidance, not the canonical store for grants or credentials; startup copies may be stale and live reread notifications preserve provider processes. Context tools, runtime instructions.
Project/repository and physical workspace identities are distinct. A repository may have multiple containers; a same-owner shared container retains session repository identity and independent checkout paths. Reusing it never transfers another container's secret grants. Container selection.
Optional server-user mode persists immutable ownership, hashed/revocable login tokens, aggregate resource reservations and controller authority epochs in the existing controller database. User container/account/Exchange storage is separate; a stopped container can retain disk accounting, and a controller restart does not release reservations without fresh host evidence. MCP templates, bindings and rate receipts are durable and owner-scoped. Folder results retain traffic counters and metadata, not read payloads. Server mode, MCP policies, folders.
Withdrawn policy approvals retain history as withdrawn/cancelled. Their queued
approval command and Agent Document binding are retired; written rules are removed
through a separate durable host command. Cancellation receipts suppress late
success results, and runtime markers stop an old retry from restoring access.
Rule cleanup is reported as pending/removed/failed separately from delivery.
Permission lifecycle.
Project sync telemetry (/v1/sync-progress) is not persisted in SQLite/audit or included in full state. The controller keeps only the latest bounded client report, marks it stale after 15 seconds and removes it after 60 seconds. Progress returns with the next report. This is not a durable transfer journal or a replacement for Unison archives; file contents are never accepted on this channel.
Relational tables include services, service_endpoints, environment_profiles, environment_bindings, client_file_sources, managed_files, file_grants and file_deployments. JSON entity snapshots preserve Store compatibility; unique/FK constraints enforce relationships.
A FileGrant write updates its JSON entity, relational row and audit in one SQL savepoint. The in-memory Map changes only after commit, so a destination conflict cannot leave an effective grant after a failed API request or restart.
Relay traffic counters update in memory per frame and are saved in one transaction each second. Connection changes and graceful controller shutdown also flush counters. A crash can lose the last unflushed telemetry; these counters are not a billing ledger. Metrics cleanup uses captured_at and deletes at most 1,000 expired rows per pass. Full batches continue on the next heartbeat; otherwise the next check waits at least one minute.
Managed-file state contains source metadata, SHA-256, size, desired assignment and deployed hash/state. Contents are not written to SQLite or encoded into JSON/base64. Active delivery uses bounded PassThrough until host acknowledgement. Remote copies live in /var/lib/devctl/workspaces/<id>/files/ and /var/lib/devctl/services/<id>/config/; Service runtime state is separate under /var/lib/devctl/services/<id>/state/.
SQLite stores hosts, clients, Projects, internal runtimes, sessions, account metadata, resources, grants, forwards, usage observations, bundles/Agent Packs, commands, events and 30-day metrics. The versioned entity mechanism also stores Skills/documents, MCP server definitions, global/Project/session bindings, credential-profile metadata and immutable session snapshots. MCP profiles store only secretRef; values remain in secret_values.
Local/Git Skill sources are registered on the operator machine in .devctl/skill-sources.json; source checkouts live under .devctl/skill-repositories/. Sync imports versioned contents, not live file synchronization, and does not alter running session snapshots. New Project containers expose a separate host-managed skills root at /run/devctl/skills. The native S3 gateway's .devctl/s3-read-gateway.json stays on its source machine with mode 0600; AWS credentials remain in the local credential chain, not controller SQLite. Session bearer tokens are delivered separately and excluded from generated agent documents.
Pending MCP mutations store session/Project/tool identity, arguments hash, redacted effects, status and expiry. Full arguments, prompts and MCP payloads are not retained in persistence/audit. An applied one-shot approval becomes consumed.
secret_values stores ciphertext, a unique 12-byte nonce, GCM authentication tag and key version. The CSPRNG-generated master key lives outside SQLite/repository at /var/lib/devctl/secrets/master-key-v1 with mode 0600. SecretKeyProvider permits future versions/KMS and re-encryption.
Durable execution-host state stays under /var/lib/devctl: projects, disk-backed workspace/Service temp directories, session/tmux homes, accounts, proxies and secrets. Project /tmp mounts /var/lib/devctl/workspaces/<id>/tmp; Service /tmp mounts /var/lib/devctl/services/<id>/tmp, both mode 01777. /dev/shm is forbidden by default; an explicit setting permits only bounded ephemeral space. Opaque account stores are separate from controller backups.
Host-agent stores sibling-workload ownership in /var/lib/devctl/managed-workloads.json and separate data under /var/lib/devctl/sibling-data/<workspace-id>/<resource-id>. Sessions write shutdown/<session-id>.json to Project Exchange. This synchronized control metadata does not replace the host registry. Cleanup follows when and explicit deleteDataPaths; /data results remain by default. See session shutdown.
Ordinary /exit or confirmed detached-process termination processes authorized manifest entries and retains the persistent workspace container. Claude conversation switches and managed restarts do not consume exit-only resources. Explicit workspace/Project deletion removes owner-matched runtime, DinD and egress containers after cleanup; unfinished siblings defer it. Bind data, volumes, images, account stores and durable Project configuration remain unless a separate authorized storage/source deletion applies. No global prune is implied.
An operator can also review that same manifest while the session is running.
ready-only cleanup removes only explicitly completed, owner-checked task
resources and retains both the original manifest and native session history.
Cached allocated disk observations are optional telemetry, not a canonical
resource inventory or proof that an untracked artifact is absent. See
disk sizes and live cleanup.
Usage snapshots are stored by account/time. Unavailable official observations use source/confidence=unknown; precise per-session attribution is never invented.
Project Exchange lives under /var/lib/devctl/project-interchange/<project>; account Exchange under /var/lib/devctl/agent-interchange. Neither is the managed Files directory. Unison archives/locks under /var/lib/devctl/unison survive host-agent restarts. A crash-left lock can block several Projects. The runbook (source access required) explains ownership checks and reversible lock recovery; archives must be preserved.
Exchange is for intentionally transferred inputs/results. Extraction, temporary files, working copies, dependencies and caches belong in checkouts, disk-backed /tmp or declared data volumes. `packages/config/interchange.ignore` excludes node_modules, .pnpm-store, .git and .DS_Store at any depth on both Unison replicas and in host permission normalization. Its format is one literal basename per line with # comments, no globs/negation. Updating it requires rebuilding/restarting client-agent and host-agent; it never deletes existing ignored files.
Client-agent additionally applies repository-root .gitignore and nested Exchange .gitignore files, including ! exceptions. Ignoring the enclosing agent-interchange/ does not disable the whole transfer. Both replicas must permit a path. Metadata/rules are checked every 15 seconds without reading file contents; changes trigger one exact-allowlist Unison batch. New files wait for the next check, and an active transfer completes before rules change. Rule-read failure or more than 50,000 scan entries pauses the batch. These rules do not broaden the permission manager's literal ignore file. Repository ignore changes require no session restart.
The permission manager watches only account/Project Exchange roots. It uses at most 512 nonrecursive directory watchers per root, a 1,024-path queue and one sequential worker processing up to 128 entries per batch with a 50 ms pause. A streaming sweep without a per-file index covers remaining entries, repeating 30 seconds after completion or sooner after lost events. Unwatched files are not excluded, but permission repair can wait for the sweep when watcher limits are reached. SQLite caching would not remove OS watcher growth. File sizes/contents are not read for this purpose.
Registering a managed environment source as a Secret creates a separate encrypted copy in secret_values; source-file updates do not rotate it automatically. FileGrant/hash state does not prove provider Unix permissions. ResourceGrant persistence does not restart an independently launched native SSH tunnel: a deployed file can remain readable while a route through an offline source machine is unavailable.
Controller audit journal
The events table retains stable event IDs and action metadata across restarts.
Events pages, JSONL export and the authenticated live WebSocket all read the same
journal. New records persist the owner and the authenticated request actor; older
records without trustworthy ownership remain visible only to the operator.
Collectors resume using the last durably stored ID. This journal excludes raw
provider transcripts and secret payloads and does not claim immutable compliance
logging. Audit events and collection.