Database entities cheat sheet
Look up the SQL table and column names stored by OpenClaw Control Plane (OCC).
The tables below are in the occ PostgreSQL schema; use occ."user" when
querying the user table.
The database schema defines
columns and constraints. The
repository-credentials migration
adds the repository binding and session-attempt storage below. The
Drizzle migration-history table,
drizzle.__drizzle_migrations, is excluded. See migration history
for supported database states and platform repositories
for how OCC reads and writes its data.
Platform resources
installation
Stores the single OCC Installation record.
idnamecreated_at
namespaces
Tracks platform Namespaces, their lifecycle status, and any existing Kubernetes namespace they use.
idnameexisting_namespacestatuscreated_atdeleted_at
agents
Stores Agent drafts, their desired runtime state, and the selected version reference.
idnamespace_idnameconfiguration_idbackend_idexecution_modegateway_managed_modepluginsplugin_driver(registered ID and implementation that admitted the saved selections)plugin_approversrepository_bindingsrepository_access(default and explicit per-repository overrides)service_principal_idharness_authharness_auth_secret_idharness_auth_service_account_idharness_auth_credential_source_idcredential_sources(every bound credential source)active_revision_iddesired_runtime_statesandbox_policy_editingstatuscreated_at
sandbox_policies
Stores one Agent-owned desired network policy with versioned application evidence. See per-Agent policies.
idnamespace_idagent_idversiondocument(additions, pending/latest application, last confirmed live version)
agent_revisions
Stores numbered, immutable snapshots of Agent settings accepted for deployment.
admitted_spec includes the explicit v2
execution admission decision.
idnamespace_idagent_idrevision_numberbackend_idgateway_managed_modefirst_deployment_digest: nullable SHA-256 intent digest, permitted only on revision 1; binds the Installation, actor, Namespace, Agent, key, reviewed Configuration tuple, and normalized Harness overrides. Private receipt recovery metadata, separate fromadmitted_specand public revision responses.admitted_spec(includes requestedharness.overridesand resolvedharness.configuration)admitted_at
workspace_setups
Holds private initial workspace input for one exact Namespace and Agent. Activation
completion clears files; setup identity and completion metadata remain until
Agent deletion. See the workspace setup flow.
idnamespace_idagent_iddefaults_idfilescompleted
configurations
Stores each Agent Configuration’s current generation and Secret bindings; the Driver stores values.
idnamespace_idkindgenerationsecret_bindingscreated_at
presets
Stores reusable Agent launch templates and variable definitions within one Namespace.
idnamespace_idnametemplatecreated_at
secrets
Stores Secret metadata and backend references; Secret values are kept by the selected Driver.
idnamespace_idnamedriver_idbackend_namespace_namebackend_namebackend_keybackend_uidcreated_at
connection_templates
Stores the scope and current version of each OAuth connection template.
idnamespace_iddisplay_namecurrent_versioncreated_at
oauth_connection_template_versions
Pins the approved OAuth configuration and the HTTPS destinations that can receive the credential. A discovered version also retains the MCP metadata observed when the administrator saved it.
template_id,version,oauth_client_id,modeissuer,authorization_url,token_url,revocation_urlscopes,authorization_parameters,observed_metadatadestinations(exact host, port, and path for each approved HTTPS destination)created_at
oauth_clients
Identifies an independently managed OAuth client and its approved credential destinations. OCC uses the registration ID to locate a confidential client’s private value on the owning Secret Driver. A cleanup deadline keeps an unpublished or deleted client hidden until private cleanup completes.
id,namespace_id,display_name,issuer,client_idtoken_url,revocation_url,token_endpoint_auth_methodsecret_driver_id,cleanup_after,created_at
saved_connections
Records the Namespace, consenting principal, approved template version and revocation status of a saved account.
namespace_idcredential_source_idowner_principal_idoauth_client_id,client_id,issuer,token_urlrecipient,mcp_server_url,resourcerequested_scopes,granted_scopesconnection_template_idconnection_template_versioncreated_atrevocation_requested_byrevoked_at
connection_sessions
Stores the private, single-use OAuth attempt for the initiating principal and browser session.
state_hashnamespace_idcredential_source_idpkce_verifierselected_scopesissuer_requiredsession_idredirect_uriactor_idconnection_template_idconnection_template_versioncreated_atexpires_at
connection_token_custody
Tracks the Token Service secret reference, the published access token version and the next refresh time.
namespace_idcredential_source_idsecret_refscheduled_versionnext_refresh_at
credential_sources
Records the owner of each source. A Credential Gateway or Credential Proxy source identifies its admitting Driver. The Token Service owns saved account sources.
idnamespace_idnametypeconfigegress(optional admitted source and versioned resolver references)owner_capability(credential_gateway,credential_proxy, ortoken_servicefor a saved account)driver_id(Gateway and Proxy sources)statecreated_at
egress_installations
Binds authenticated supervisor/Sandbox identity and an immutable loaded-enforcement instance/configuration fingerprint to the exact admitted revision plan. See protected inference.
sender_id,sandbox_idnamespace_id,agent_id,revision_idinstallation
credential_deliveries
Tracks delivery custody for the exact Namespace, Agent and revision. See the repository flow.
revision_id,live_revision_id,binding_id,namespace_id,agent_id,targetfence,operation_fence,settlement,worker_instance,adopted_at,updated_atdesired,observed,write_pending,blocked,retained_policy_hashmaterial_version,preparation_attempt_idtarget_material_version,target_preparation_attempt_id
credential_delivery_reductions
Retains material-delivery and execution-policy reduction requests for static and repository bindings. An unobserved request cannot be sent again. See the policy reduction flow.
revision_id,binding_id,fence,recipient,material_version,retained_policy_hashrequest_id,expected_version,observed_generationpolicy_request,policy_observed,delivery_binding_id
prepared_github_families
Owns prepared token issuance and renewal for an explicitly admitted source.
source_id,source,issuer,admissionenabled,next_check_at,worker_claim
prepared_github_attempts
Retains issuance and disposal custody, including unknown outcomes. Authenticated
expiry is distinct from confirmed revocation. A refusal with no token is not_issued.
An unknown outcome settles after GitHub's maximum token lifetime from started_at.
id,source_id,admission,state,custody,started_atmaterial_version,provider_expires_at,usable_until,sealed
prepared_repository_git_uses
Append-only records of possible disclosure, bound to the exact attempt and material version.
exchange_id,admission_id,attempt_id,material_versionoperation,recipient_fence,request_digest_sha256send_start_by,authorization_reply_by(exactly one deadline)
prepared_repository_draft_pulls
Retains the single draft-creation allowance for a grant, independently of later PR updates.
grant_id,operation_id,receipt_id,admission_id,attempt_id,material_versionrequest_digest_sha256,scope,admitted_at,send_start_by,authorization_reply_bysettled_at,outcome,projection
protected_repository_git_recipients
Records where the selected Driver observed the protected Git recipient and which token version it installed.
If the installation result is unknown, state stays installing. The sender must still get permission for each Git request.
revision_id,installation(the exact installation OCC recorded for this Agent revision)fence(advances before each attempt to install a token),state(observed,installing, orinstalled)attempt_id,material_version(identify the prepared token without storing its value here)
egress_send_receipts
Retains exact sender attempts and safe observations independently of final delivery proof. See protected inference.
sender_id,sender_generation,instance_id,use_id,attempt_idbinding(selected material evidence and original deadline)authorized_dispatch(accepted execution, installation and custody, digests and send-start bound)outcome,observation,settled,feedback
egress_rejected_material
Fences a provider-rejected version independently of later authoritative rereads.
namespace_id,secret_driver_idmaterial_id,material_version
agent_credential_sources
Mirrors each Agent draft's credential_sources through a trigger, so the database refuses to delete a source an Agent still binds.
namespace_idagent_idcredential_source_id
credential_source_secrets
Links each credential source secret field to the Namespace Secret that supplied it.
namespace_idcredential_source_idfieldsecret_id
credential_withdrawals
Records one credential source withdrawn from one Agent revision, until the gateway confirms revocation.
namespace_idagent_idrevision_idcredential_source_idstaterequested_byrequested_atcompleted_atlast_reasonlast_attempt_at
service_accounts
Stores Namespace service accounts and any credential Secret references.
idnamespace_idnamecredential
service_account_driver_bindings
Links managed accounts to a Backend, Driver, upstream account, workspace, and any issued credential.
service_account_idnamespace_idbackend_iddriver_idexternal_account_idexternal_credential_idworkspace_id
repository_session_attempts
Retains repository-session identity and cleanup context after AgentRevision deletion.
namespace_idagent_idrevision_idlive_revision_idcleanup_contextrepository_refadmission_idduration_secondsdeadline_wall_msbroker_protocol(0/1: historical native; 2: protected; 3: prepared native)phasesession_idcreated_atupdated_at
repository_broker_receipts
Retains nonsecret admission fences and broker-confirmed terminal evidence for an exact attempt.
admission_idstategenerationsession_iddeadline_wall_msrevokedexpired
Identity and access
iam_identities
Stores human Principals and service identities, including those owned by an Agent.
idnamespace_idagent_idkindissuersubject
iam_groups
Defines native IAM groups at Installation or Namespace scope, including the
configured Groups
(group_config_ IDs), which OCC can delete.
idnamespace_idname
iam_group_memberships
Links human Principals to their native IAM groups. Rows cannot be updated; memberships of a configured Group can be deleted.
namespace_idgroup_idprincipal_id
iam_roles
Defines native IAM roles as sets of actions and resource kinds. Only
configured Roles
(role_config_ IDs) can change; a check constraint keeps them at Installation
scope without installation permissions.
idnamespace_idnamepermissions
iam_access_bindings
Grants a native IAM role to an identity or group, optionally for a specific resource. OCC also writes configured Group bindings and the Owner bindings of creators here.
idnamespace_ididentity_subject_idgroup_subject_idrole_idresource_kindresource_id
iam_restrictions
Defines native IAM rules that deny actions on a resource kind or specific resource, overriding grants.
idnamespace_idactionresource_kindresource_ideffect
Audit and controller
audit_events
Keeps an append-only record of bootstrap, changes to resources, and authorization denials. When Control Plane audit is enabled, it also records covered API requests, worker activity, and disclosures of Agent audit records. See the audit guide.
idoccurred_atkindactor_idactionnamespace_idresource_kindresource_idoutcomedetails
controller_work
Queues and tracks controller work for Namespace and Agent lifecycle changes, Agent provisioning, and version deployments.
work_kindidempotency_keynamespace_idagent_idrevision_idactor_idnamespace_targetagent_targetstateavailable_atattempt_countclaim_tokenaudit_attempt_idlease_expires_atcompleted_atreason_coderesult_datacreated_atupdated_at
agent_provisioning_work
Records one Agent provisioning request and its progress. Each row belongs to a
controller_work row with work_kind = 'provisioning'. See the
Agent provisioning flow.
work_idnamespace_idagent_idconfiguration_idactor_idrequest_idrequest_fingerprintstatuscompleted_phaserevision_idplanprogresscreated_atupdated_at
Browser authentication and service API keys
user
Stores the profiles of people provisioned to sign in.
idnameemailemail_verifiedimagecreated_atupdated_at
session
Stores expiring browser sessions for signed-in users.
idexpires_attokencreated_atupdated_atip_addressuser_agentuser_id
account
Links a user to their sign-in method. Password methods store a password hash; identity-only external methods reject password and provider-token storage. See External sign-in.
idaccount_idprovider_iduser_idaccess_tokenrefresh_tokenid_tokenaccess_token_expires_atrefresh_token_expires_atscopepasswordauthentication_versionidentity_onlycreated_atupdated_at
human_authentication_accounts
Binds each enrolled human user to its existing Installation Principal and current account version. Disabled accounts cannot issue or use profile-bound sessions.
user_idinstallation_idprincipal_idversiondisabledchanged_at
human_authentication_sessions
Binds an ordinary browser session to its admitted account and method versions.
session_iduser_idmethod_idversionmethod_version
human_authentication_results
Holds outstanding external sign-in results by Installation and attempt. Deleting the bound session removes its result. The application role can insert, read, and delete rows.
installation_idattempt_idsession_idprovider_idexpires_at
human_authentication_recovery
Retains the fixed existing password recovery administrator for an Installation.
installation_iduser_idprincipal_idmethod_id
human_authentication_attempts
Stores one-use external-login attempts with browser binding and a maximum five-minute lifetime. Stores the PKCE verifier, but no authorization code or provider token. Consumed attempts are deleted before exchange.
state_hashbrowser_hashinstallation_idprovider_idcallback_urlcode_verifiercreated_atexpires_at
native_browser_intents
Short-lived, browser-bound native Agent launches. Consumed atomically; deleted with the parent session or revision.
id,installation_id,parent_session_id,principal_idnamespace_id,agent_id,revision_id,originchallenge_hash,exchange_hashcreated_at,expires_at
native_browser_handles
Hashed Agent access handles dependent on a live parent human session.
handle_hash,installation_id,parent_session_id,principal_idnamespace_id,agent_id,revision_id,origincreated_at,expires_at
verification
Stores expiring verification records managed by Better Auth.
ididentifiervalueexpires_atcreated_atupdated_at
apikey
Stores hashed service API keys and their settings for IAM service identities.
idconfig_idnamestartreference_idprefixkeyrefill_intervalrefill_amountlast_refill_atenabledrate_limit_enabledrate_limit_time_windowrate_limit_maxrequest_countremaininglast_requestexpires_atcreated_atupdated_atpermissionsmetadata
