Skip to content

The fastest, cheapest, most efficient open-source agent harness. Run more than 500 agents on a $10 VPS.

docs: add storage schema documentation

Steven Enamakelc4338b556512
diff --git a/docs/storage-schema.md b/docs/storage-schema.md
new file mode 100644
index 0000000000..9457be1258
--- /dev/null
+++ b/docs/storage-schema.md
@@ -0,0 +1,307 @@
+# Storage schema
+
+<!-- Generated by `pnpm docs:generate` (scripts/ci/check-storage-schema.mjs) from the
+composed registry (`crates/openhuman-core/src/storage/schema.rs`). Do not edit by hand. -->
+
+Every crate that stores records declares them in `storage_schema()`; the host composes
+the declarations into one registry, prepares the backend from it and migrates every
+scope at boot. Names are `<owner>.<entity>`; the scope class says where a record lives
+(`tenant`: `local` or `u:<id>`, `agent`: `<tenant>/agent:<id>`, `module`:
+`<tenant>/module:<id>`, `cluster`: the shared registry scope).
+
+## box
+
+| Kind | Name | Version | Scope | Indexed fields |
+| --- | --- | --- | --- | --- |
+| collection | `box.boxes` | 2 | module | |
+| collection | `box.jail_index` | 2 | module | |
+
+Migration steps:
+
+- `rename_boxes`: `box.boxes` v1 to v2 from `tinybox_boxes`
+- `rename_jail_index`: `box.jail_index` v1 to v2 from `tinybox_jail_index`
+
+## channels
+
+| Kind | Name | Version | Scope | Indexed fields |
+| --- | --- | --- | --- | --- |
+| collection | `channels.delivery_failed` | 2 | module | |
+| collection | `channels.delivery_pending` | 2 | module | |
+| collection | `channels.delivery_results` | 2 | module | |
+| collection | `channels.remote_bindings` | 2 | module | |
+| collection | `channels.remote_busy` | 2 | module | |
+| collection | `channels.remote_meta` | 2 | module | |
+| collection | `channels.whatsapp_device` | 2 | module | |
+| collection | `channels.whatsapp_identity` | 2 | module | |
+| collection | `channels.whatsapp_lid_mapping` | 2 | module | |
+| collection | `channels.whatsapp_prekey` | 2 | module | |
+| collection | `channels.whatsapp_sender_key` | 2 | module | |
+| collection | `channels.whatsapp_session` | 2 | module | |
+| collection | `channels.whatsapp_signed_prekey` | 2 | module | |
+| collection | `channels.whatsapp_sync_key` | 2 | module | |
+
+Migration steps:
+
+- `delivery-pending-v2`: `channels.delivery_pending` v1 to v2 from `channels_delivery_pending`
+- `delivery-failed-v2`: `channels.delivery_failed` v1 to v2 from `channels_delivery_failed`
+- `delivery-results-v2`: `channels.delivery_results` v1 to v2 from `channels_delivery_results`
+- `remote-bindings-v2`: `channels.remote_bindings` v1 to v2 from `channel_remote_bindings`
+- `remote-busy-v2`: `channels.remote_busy` v1 to v2 from `channel_remote_busy`
+- `remote-meta-v2`: `channels.remote_meta` v1 to v2 from `channel_remote_meta`
+- `whatsapp-device-v2`: `channels.whatsapp_device` v1 to v2 from `whatsapp_device`
+- `whatsapp-identity-v2`: `channels.whatsapp_identity` v1 to v2 from `whatsapp_identity`
+- `whatsapp-session-v2`: `channels.whatsapp_session` v1 to v2 from `whatsapp_session`
+- `whatsapp-prekey-v2`: `channels.whatsapp_prekey` v1 to v2 from `whatsapp_prekey`
+- `whatsapp-signed-prekey-v2`: `channels.whatsapp_signed_prekey` v1 to v2 from `whatsapp_signed_prekey`
+- `whatsapp-sender-key-v2`: `channels.whatsapp_sender_key` v1 to v2 from `whatsapp_sender_key`
+- `whatsapp-sync-key-v2`: `channels.whatsapp_sync_key` v1 to v2 from `whatsapp_sync_key`
+- `whatsapp-lid-mapping-v2`: `channels.whatsapp_lid_mapping` v1 to v2 from `whatsapp_lid_mapping`
+
+## connectors
+
+| Kind | Name | Version | Scope | Indexed fields |
+| --- | --- | --- | --- | --- |
+| stream | `connectors.triggers` | | module | |
+| collection | `connectors.user_scopes` | 2 | module | |
+
+Migration steps:
+
+- `user_scopes_unwrap_value`: `connectors.user_scopes` v1 to v2 from `composio-user-scopes`
+- `triggers_rename`: `connectors.triggers` v1 to v2 from `triggers/`
+
+## conversations
+
+| Kind | Name | Version | Scope | Indexed fields |
+| --- | --- | --- | --- | --- |
+| collection | `conversations.appends` | 2 | tenant | |
+| stream | `conversations.messages` | | tenant | |
+| collection | `conversations.threads` | 2 | tenant | |
+
+Migration steps:
+
+- `threads_v2`: `conversations.threads` v1 to v2 from `conversation_threads_v1`
+- `appends_v2`: `conversations.appends` v1 to v2 from `conversation_appends_v1`
+- `messages_v2`: `conversations.messages` v1 to v2 from `conversation_messages_v1:`
+
+## cron
+
+| Kind | Name | Version | Scope | Indexed fields |
+| --- | --- | --- | --- | --- |
+| collection | `cron.admission` | 2 | tenant | |
+| collection | `cron.jobs` | 2 | tenant | `next_run_ms`, `enabled`, `next_run_ms`, `name`, `job_type`, `command` |
+| collection | `cron.runs` | 2 | tenant | `job_id`, `started_ms`, `seq` |
+
+Migration steps:
+
+- `jobs_v2`: `cron.jobs` v1 to v2 from `cron_jobs`
+- `runs_v2`: `cron.runs` v1 to v2 from `cron_runs`
+- `admission_v2`: `cron.admission` v1 to v2 from `cron_counters`
+
+## flows
+
+| Kind | Name | Version | Scope | Indexed fields |
+| --- | --- | --- | --- | --- |
+| collection | `flows.definitions` | 2 | tenant | `enabled`, `created_ms` |
+| collection | `flows.drafts` | 2 | tenant | `updated_ms` |
+| collection | `flows.revisions` | 2 | tenant | `flow_id`, `created_ms` |
+| collection | `flows.runs` | 2 | tenant | `flow_id`, `started_ms`, `status`, `started_ms`, `started_ms` |
+| collection | `flows.suggestions` | 2 | tenant | `status`, `created_ms` |
+
+Migration steps:
+
+- `definitions_v2`: `flows.definitions` v1 to v2 from `flows_definitions`
+- `revisions_v2`: `flows.revisions` v1 to v2 from `flows_revisions`
+- `runs_v2`: `flows.runs` v1 to v2 from `flows_runs`
+- `suggestions_v2`: `flows.suggestions` v1 to v2 from `flows_suggestions`
+- `drafts_v2`: `flows.drafts` v1 to v2 from `flows_drafts`
+
+## graph
+
+| Kind | Name | Version | Scope | Indexed fields |
+| --- | --- | --- | --- | --- |
+| collection | `graph.checkpoints` | 4 | agent | `ns`, `thread`, `seq`, `ns`, `thread`, `checkpoint_id`, `ns`, `thread`, `subgraph`, `seq` |
+| collection | `graph.threads` | 4 | agent | `ns` |
+| collection | `graph.writes` | 4 | agent | `ns`, `thread` |
+
+Migration steps:
+
+- `checkpoints_graph_v2`: `graph.checkpoints` v1 to v2 from `graph_checkpoints`
+- `checkpoints_delegation_v2`: `graph.checkpoints` v2 to v3 from `delegation_graph_checkpoints`
+- `checkpoints_flows_v2`: `graph.checkpoints` v3 to v4 from `flows_graph_checkpoints`
+- `threads_graph_v2`: `graph.threads` v1 to v2 from `graph_threads`
+- `threads_delegation_v2`: `graph.threads` v2 to v3 from `delegation_graph_threads`
+- `threads_flows_v2`: `graph.threads` v3 to v4 from `flows_graph_threads`
+- `writes_graph_v2`: `graph.writes` v1 to v2 from `graph_writes`
+- `writes_delegation_v2`: `graph.writes` v2 to v3 from `delegation_graph_writes`
+- `writes_flows_v2`: `graph.writes` v3 to v4 from `flows_graph_writes`
+
+## harness
+
+| Kind | Name | Version | Scope | Indexed fields |
+| --- | --- | --- | --- | --- |
+| collection | `harness.attachment_stash` | 2 | agent | `touched_ms` |
+| collection | `harness.embedding_cache` | 2 | agent | `sig` |
+| stream | `harness.journal` | | agent | |
+| collection | `harness.run_status` | 2 | agent | `root_run_id`, `thread_id`, `active` |
+| blobs | `harness/attachments/` | | agent | |
+| blobs | `harness/generated_media/` | | agent | |
+| blobs | `harness/outputs/` | | agent | |
+| blobs | `harness/tool_results/` | | agent | |
+| blobs | `harness/workspace/` | | agent | |
+
+Migration steps:
+
+- `run_status_v2`: `harness.run_status` v1 to v2 from `harness_run_status`
+- `embedding_cache_v2`: `harness.embedding_cache` v1 to v2 from `harness_embedding_cache`
+- `attachment_stash_v2`: `harness.attachment_stash` v1 to v2 from `attachment_stash_index`
+- `run_journal_v2`: `harness.journal` v1 to v2 from `16:session_journal/`
+- `attachment_blobs_v2`: `harness/attachments/` v1 to v2 from `attachments/`
+- `tool_result_blobs_v2`: `harness/tool_results/` v1 to v2 from `tool-results/`
+- `output_blobs_v2`: `harness/outputs/` v1 to v2 from `outputs/`
+- `workspace_blobs_v2`: `harness/workspace/` v1 to v2 from `workspace/`
+- `generated_media_blobs_v2`: `harness/generated_media/` v1 to v2 from `generated-media/`
+
+## history
+
+| Kind | Name | Version | Scope | Indexed fields |
+| --- | --- | --- | --- | --- |
+| collection | `history.messages` | 2 | agent | `session_id`, `id` |
+| collection | `history.search` | 2 | agent | `session_id` |
+| collection | `history.sessions` | 2 | agent | `status`, `started_ms`, `parent_session_id`, `started_ms`, `agent_definition_id`, `thread_id`, `source_channel`, `started_ms` |
+| collection | `history.tool_calls` | 2 | agent | `session_id`, `id`, `tool_name`, `created_ms` |
+
+Migration steps:
+
+- `sessions_v2`: `history.sessions` v1 to v2 from `session_history_sessions`
+- `messages_v2`: `history.messages` v1 to v2 from `session_history_messages`
+- `tool_calls_v2`: `history.tool_calls` v1 to v2 from `session_history_tool_calls`
+- `search_v2`: `history.search` v1 to v2 from `session_history_fts`
+
+## juice
+
+| Kind | Name | Version | Scope | Indexed fields |
+| --- | --- | --- | --- | --- |
+| blobs | `juice/ccr/` | | module | |
+
+Migration steps:
+
+- `ccr_prefix_v2`: `juice/ccr/` v1 to v2 from `tinyjuice_ccr/`
+
+## ledger
+
+| Kind | Name | Version | Scope | Indexed fields |
+| --- | --- | --- | --- | --- |
+| collection | `ledger.agent_runs` | 2 | agent | `status`, `kind`, `parent_run_id`, `parent_thread_id`, `updated_ms`, `worker_thread_id` |
+| collection | `ledger.entries` | 2 | agent | `session_id`, `ordinal`, `session_id`, `parent_id` |
+| collection | `ledger.entry_heads` | 2 | agent | |
+| collection | `ledger.entry_indexes` | 2 | agent | `session_id` |
+| collection | `ledger.entry_labels` | 2 | agent | `session_id` |
+| collection | `ledger.event_heads` | 2 | agent | |
+| collection | `ledger.event_outbox` | 2 | agent | `run_id`, `sequence` |
+| stream | `ledger.events` | | agent | |
+| collection | `ledger.members` | 2 | agent | `team_id`, `team_id`, `name`, `created_ms` |
+| collection | `ledger.tasks` | 2 | agent | `team_id`, `status`, `claimed_by_member_id`, `team_id`, `order_index`, `created_ms` |
+| collection | `ledger.teams` | 2 | agent | `parent_thread_id`, `status`, `updated_ms` |
+| collection | `ledger.telemetry` | 2 | agent | `updated_ms` |
+| collection | `ledger.tool_effects` | 2 | agent | `run_id`, `status`, `started_ms` |
+| collection | `ledger.workflow_runs` | 2 | agent | `definition_id`, `status`, `parent_thread_id`, `updated_ms` |
+
+Migration steps:
+
+- `workflow_runs_v2`: `ledger.workflow_runs` v1 to v2 from `run_ledger_workflow_runs`
+- `telemetry_v2`: `ledger.telemetry` v1 to v2 from `run_ledger_telemetry`
+- `agent_runs_v2`: `ledger.agent_runs` v1 to v2 from `run_ledger_agent_runs`
+- `teams_v2`: `ledger.teams` v1 to v2 from `run_ledger_teams`
+- `members_v2`: `ledger.members` v1 to v2 from `run_ledger_members`
+- `tasks_v2`: `ledger.tasks` v1 to v2 from `run_ledger_tasks`
+- `event_outbox_v2`: `ledger.event_outbox` v1 to v2 from `run_ledger_event_outbox`
+- `event_heads_v2`: `ledger.event_heads` v1 to v2 from `run_ledger_event_heads`
+- `tool_effects_v2`: `ledger.tool_effects` v1 to v2 from `run_ledger_tool_effects`
+- `entry_heads_v2`: `ledger.entry_heads` v1 to v2 from `run_ledger_entry_heads`
+- `entries_v2`: `ledger.entries` v1 to v2 from `run_ledger_entries`
+- `entry_labels_v2`: `ledger.entry_labels` v1 to v2 from `run_ledger_entry_labels`
+- `entry_indexes_v2`: `ledger.entry_indexes` v1 to v2 from `run_ledger_entry_indexes`
+- `run_events_v2`: `ledger.events` v1 to v2 from `run_events:`
+
+## mcp
+
+| Kind | Name | Version | Scope | Indexed fields |
+| --- | --- | --- | --- | --- |
+| stream | `mcp.audit` | | module | |
+| collection | `mcp.registry_cache` | 2 | module | `cache_key` |
+| collection | `mcp.registry_index` | 2 | module | `source` |
+| collection | `mcp.registry_index_state` | 2 | module | |
+| collection | `mcp.server_names` | 2 | module | |
+| collection | `mcp.servers` | 2 | module | `qualified_name`, `installed_ms` |
+| collection | `mcp.tool_cache` | 2 | module | |
+
+Migration steps:
+
+- `servers_v2`: `mcp.servers` v1 to v2 from `mcp_servers`
+- `server_names_v2`: `mcp.server_names` v1 to v2 from `mcp_server_names`
+- `registry_cache_v2`: `mcp.registry_cache` v1 to v2 from `mcp_registry_cache`
+- `tool_cache_v2`: `mcp.tool_cache` v1 to v2 from `mcp_tool_cache`
+- `registry_index_v2`: `mcp.registry_index` v1 to v2 from `mcp_registry_index`
+- `registry_index_state_v2`: `mcp.registry_index_state` v1 to v2 from `mcp_registry_index_state`
+- `audit_v2`: `mcp.audit` v1 to v2 from `mcp_audit`
+
+## memes
+
+| Kind | Name | Version | Scope | Indexed fields |
+| --- | --- | --- | --- | --- |
+| collection | `memes.state` | 2 | tenant | |
+
+Migration steps:
+
+- `state_v2`: `memes.state` v1 to v2 from `tinymemes_documents`
+
+## session
+
+| Kind | Name | Version | Scope | Indexed fields |
+| --- | --- | --- | --- | --- |
+| collection | `session.transcript_entries` | 2 | agent | `stem`, `seq`, `stem`, `written` |
+| collection | `session.transcripts` | 2 | agent | `thread_id`, `_created_ms`, `agent_name`, `_created_ms`, `agent_id`, `_created_ms` |
+| collection | `session.turn_states` | 2 | agent | `thread_id` |
+
+Migration steps:
+
+- `transcript_entries_v2`: `session.transcript_entries` v1 to v2 from `session_transcript_entries`
+- `transcripts_v2`: `session.transcripts` v1 to v2 from `session_transcripts`
+- `turn_states_v2`: `session.turn_states` v1 to v2 from `session_turn_states`
+
+## skills
+
+| Kind | Name | Version | Scope | Indexed fields |
+| --- | --- | --- | --- | --- |
+| collection | `skills.catalogs` | 2 | tenant | |
+| blobs | `skills/bundles` | | tenant | |
+
+Migration steps:
+
+- `catalogs_v2`: `skills.catalogs` v1 to v2 from `tinyskills_catalogs`
+
+## tasks
+
+| Kind | Name | Version | Scope | Indexed fields |
+| --- | --- | --- | --- | --- |
+| collection | `tasks.completions` | 2 | agent | `parent_key`, `state` |
+| collection | `tasks.history` | 2 | agent | `task_id`, `rev` |
+| collection | `tasks.records` | 2 | agent | `status`, `root_run_id`, `parent_run_id`, `thread_id`, `node_id`, `kind_label` |
+
+Migration steps:
+
+- `records_v2`: `tasks.records` v1 to v2 from `orchestration_tasks`
+- `history_v2`: `tasks.history` v1 to v2 from `orchestration_task_history`
+- `completions_v2`: `tasks.completions` v1 to v2 from `orchestration_completions`
+
+## wallet
+
+| Kind | Name | Version | Scope | Indexed fields |
+| --- | --- | --- | --- | --- |
+| collection | `wallet.budgets` | 2 | module | |
+| stream | `wallet.payments` | | module | |
+
+Migration steps:
+
+- `budgets_v2`: `wallet.budgets` v1 to v2 from `x402_budget`
+- `payments_v2`: `wallet.payments` v1 to v2 from `x402.payments`