The fastest, cheapest, most efficient open-source agent harness. Run more than 500 agents on a $10 VPS.
Rust agent-orchestrationai-agentsai-assistantdesktopllmlocal-firstmcppersonal-aiprivacyrustsecond-braintauri
docs(storage-schema): document collections as owner specs
Steven Enamakelb0cff89aea0b
diff --git a/crates/openhuman-cli/Cargo.toml b/crates/openhuman-cli/Cargo.tomlindex 9e2499ccf4..70d9a4a689 100644--- a/crates/openhuman-cli/Cargo.toml+++ b/crates/openhuman-cli/Cargo.toml@@ -171,6 +171,13 @@ path = "../../tests/storage_delegation_e2e.rs"name = "components_e2e"path = "../../tests/components_e2e.rs"+[[test]]+# Boots a signed-in profile through the desktop host's storage migration and+# reads its historical records through their owning domains.+name = "storage_legacy_profile_boot_e2e"+path = "../../tests/storage_legacy_profile_boot_e2e.rs"+required-features = ["storage-sqlite", "modules", "flows"]+[[test]]name = "embedded_server_shutdown_e2e"path = "../../tests/embedded_server_shutdown_e2e.rs"diff --git a/docs/storage-schema.md b/docs/storage-schema.mdindex 759df9d04a..06cb4a4f98 100644--- a/docs/storage-schema.md+++ b/docs/storage-schema.md@@ -1,409 +1,256 @@# 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. -->+host-composed owner `CollectionSpec` values (`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).+Record owners declare collections with `CollectionSpec`; the host composes and prepares+those declarations at boot. Each section lists the specs by the owner namespace in the+collection name, including indexes, expiry fields, and full-text search fields.+Record shapes and migrations stay with their owners.## agents-| Kind | Name | Version | Scope | Indexed fields |-| --- | --- | --- | --- | --- |-| collection | `agents.registry` | 2 | tenant | |--Migration steps:--- `registry_v2`: `agents.registry` v1 to v2 from `storage_agents`+| Collection | Indexes | Expiry field | Search fields |+| --- | --- | --- | --- |+| `agents.registry` | | | |## approvals-| Kind | Name | Version | Scope | Indexed fields |-| --- | --- | --- | --- | --- |-| collection | `approvals.flow_trust` | 2 | tenant | `flow_id`, `tool_name` |-| collection | `approvals.requests` | 2 | tenant | `pending`, `created_ms`, `pending`, `decided_ms`, `session_id`, `pending` |--Migration steps:--- `requests_v2`: `approvals.requests` v1 to v2 from `approvals`-- `flow_trust_v2`: `approvals.flow_trust` v1 to v2 from `approval_flow_trust`+| Collection | Indexes | Expiry field | Search fields |+| --- | --- | --- | --- |+| `approvals.flow_trust` | `by_flow` (`flow_id`, `tool_name`) | | |+| `approvals.requests` | `by_decided` (`pending`, `decided_ms`)<br>`by_pending` (`pending`, `created_ms`)<br>`by_session` (`session_id`, `pending`) | | |## artifacts-| Kind | Name | Version | Scope | Indexed fields |-| --- | --- | --- | --- | --- |-| collection | `artifacts.args` | 2 | tenant | |-| collection | `artifacts.records` | 2 | tenant | `thread_id`, `created_ms` |-| collection | `artifacts.versions` | 2 | tenant | |--Migration steps:--- `records_v2`: `artifacts.records` v1 to v2 from `artifacts`-- `args_v2`: `artifacts.args` v1 to v2 from `artifact_args`-- `versions_v2`: `artifacts.versions` v1 to v2 from `artifact_versions`+| Collection | Indexes | Expiry field | Search fields |+| --- | --- | --- | --- |+| `artifacts.args` | | | |+| `artifacts.records` | `by_thread` (`thread_id`, `created_ms`) | | |+| `artifacts.versions` | | | |## 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`+| Collection | Indexes | Expiry field | Search fields |+| --- | --- | --- | --- |+| `box.boxes` | | | |+| `box.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`+| Collection | Indexes | Expiry field | Search fields |+| --- | --- | --- | --- |+| `channels.delivery_failed` | | | |+| `channels.delivery_pending` | | | |+| `channels.delivery_results` | | | |+| `channels.migrations` | | | |+| `channels.remote_bindings` | | | |+| `channels.remote_busy` | | | |+| `channels.remote_meta` | | | |+| `channels.whatsapp_device` | | | |+| `channels.whatsapp_identity` | | | |+| `channels.whatsapp_lid_mapping` | | | |+| `channels.whatsapp_prekey` | | | |+| `channels.whatsapp_sender_key` | | | |+| `channels.whatsapp_session` | | | |+| `channels.whatsapp_signed_prekey` | | | |+| `channels.whatsapp_sync_key` | | | |## config-| Kind | Name | Version | Scope | Indexed fields |-| --- | --- | --- | --- | --- |-| collection | `config.documents` | 2 | tenant | |--Migration steps:--- `documents_v2`: `config.documents` v1 to v2 from `config`+| Collection | Indexes | Expiry field | Search fields |+| --- | --- | --- | --- |+| `config.documents` | | | |## 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/`+| Collection | Indexes | Expiry field | Search fields |+| --- | --- | --- | --- |+| `connectors.migrations` | | | |+| `connectors.user_scopes` | | | |## 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:`+| Collection | Indexes | Expiry field | Search fields |+| --- | --- | --- | --- |+| `conversations.appends` | | | |+| `conversations.threads` | | | |## cost-| Kind | Name | Version | Scope | Indexed fields |-| --- | --- | --- | --- | --- |-| collection | `cost.records` | 2 | tenant | `ts_ms` |--Migration steps:--- `records_v2`: `cost.records` v1 to v2 from `cost_records`+| Collection | Indexes | Expiry field | Search fields |+| --- | --- | --- | --- |+| `cost.records` | `by_time` (`ts_ms`) | | |## devices-| Kind | Name | Version | Scope | Indexed fields |-| --- | --- | --- | --- | --- |-| collection | `devices.paired` | 2 | tenant | `revoked`, `created_ms` |--Migration steps:--- `paired_v2`: `devices.paired` v1 to v2 from `paired_devices`+| Collection | Indexes | Expiry field | Search fields |+| --- | --- | --- | --- |+| `devices.paired` | `by_active` (`revoked`, `created_ms`) | | |## 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`+| Collection | Indexes | Expiry field | Search fields |+| --- | --- | --- | --- |+| `graph.checkpoints` | `by_thread_id` (`ns`, `thread`, `checkpoint_id`)<br>`by_thread_seq` (`ns`, `thread`, `seq`)<br>`by_thread_subgraph` (`ns`, `thread`, `subgraph`, `seq`) | | |+| `graph.threads` | `by_ns` (`ns`) | | |+| `graph.writes` | `by_thread` (`ns`, `thread`) | | |## 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/`+| Collection | Indexes | Expiry field | Search fields |+| --- | --- | --- | --- |+| `harness.attachment_stash` | `touched` (`touched_ms`) | | |+| `harness.embedding_cache` | `by_signature` (`sig`) | | |+| `harness.run_status` | `by_active` (`active`)<br>`by_root` (`root_run_id`)<br>`by_thread` (`thread_id`) | | |## 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`+| Collection | Indexes | Expiry field | Search fields |+| --- | --- | --- | --- |+| `history.messages` | `session_id` (`session_id`, `id`) | | |+| `history.search` | `session` (`session_id`) | | `agent_name`, `content`, `tool_name` |+| `history.sessions` | `agent` (`agent_definition_id`)<br>`channel` (`source_channel`)<br>`parent` (`parent_session_id`, `started_ms`)<br>`started` (`started_ms`)<br>`status_started` (`status`, `started_ms`)<br>`thread` (`thread_id`) | | |+| `history.tool_calls` | `created` (`created_ms`)<br>`session_id` (`session_id`, `id`)<br>`tool` (`tool_name`) | | |## juice-| Kind | Name | Version | Scope | Indexed fields |-| --- | --- | --- | --- | --- |-| collection | `juice.savings` | 1 | module | |-| blobs | `juice/ccr/` | | module | |--Migration steps:--- `ccr_prefix_v2`: `juice/ccr/` v1 to v2 from `tinyjuice_ccr/`+| Collection | Indexes | Expiry field | Search fields |+| --- | --- | --- | --- |+| `juice.savings` | | | |## 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.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`-- `run_events_v2`: `ledger.events` v1 to v2 from `run_events:`+| Collection | Indexes | Expiry field | Search fields |+| --- | --- | --- | --- |+| `ledger.agent_runs` | `kind` (`kind`)<br>`parent` (`parent_run_id`)<br>`status` (`status`)<br>`thread` (`parent_thread_id`)<br>`updated` (`updated_ms`)<br>`worker` (`worker_thread_id`) | | |+| `ledger.event_heads` | | | |+| `ledger.event_outbox` | `run_sequence` (`run_id`, `sequence`) unique | | |+| `ledger.members` | `created` (`created_ms`)<br>`team_name` (`team_id`, `name`) unique<br>`team` (`team_id`) | | |+| `ledger.tasks` | `claimed` (`claimed_by_member_id`)<br>`order` (`team_id`, `order_index`, `created_ms`)<br>`status` (`status`)<br>`team` (`team_id`) | | |+| `ledger.teams` | `status` (`status`)<br>`thread` (`parent_thread_id`)<br>`updated` (`updated_ms`) | | |+| `ledger.telemetry` | `updated` (`updated_ms`) | | |+| `ledger.tool_effects` | `run` (`run_id`)<br>`started` (`started_ms`)<br>`status` (`status`) | | |+| `ledger.workflow_runs` | `definition` (`definition_id`)<br>`status` (`status`)<br>`thread` (`parent_thread_id`)<br>`updated` (`updated_ms`) | | |++## legacy (unqualified names)++| Collection | Indexes | Expiry field | Search fields |+| --- | --- | --- | --- |+| `remix_markers` | | | |+| `tinymemes_documents` | | | |## 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`+| Collection | Indexes | Expiry field | Search fields |+| --- | --- | --- | --- |+| `mcp.registry_cache` | `cache_key` (`cache_key`) | | |+| `mcp.registry_index` | `source` (`source`) | | |+| `mcp.registry_index_state` | | | |+| `mcp.server_names` | | | |+| `mcp.servers` | `installed_ms` (`installed_ms`)<br>`qualified_name` (`qualified_name`) | | |+| `mcp.tool_cache` | | | |## memes-| Kind | Name | Version | Scope | Indexed fields |-| --- | --- | --- | --- | --- |-| collection | `memes.state` | 2 | tenant | |--Migration steps:--- `state_v2`: `memes.state` v1 to v2 from `tinymemes_documents`+| Collection | Indexes | Expiry field | Search fields |+| --- | --- | --- | --- |+| `memes.remix_markers` | | | |+| `memes.state` | | | |## notifications-| Kind | Name | Version | Scope | Indexed fields |-| --- | --- | --- | --- | --- |-| collection | `notifications.core` | 2 | tenant | `workspace`, `read`, `timestamp_ms` |-| collection | `notifications.dedup` | 2 | tenant | |-| collection | `notifications.integration` | 2 | tenant | `provider`, `received_ms`, `status` |-| collection | `notifications.settings` | 2 | tenant | |+| Collection | Indexes | Expiry field | Search fields |+| --- | --- | --- | --- |+| `notifications.core` | `by_read` (`workspace`, `read`, `timestamp_ms`) | | |+| `notifications.dedup` | | | |+| `notifications.integration` | `by_provider` (`provider`, `received_ms`)<br>`by_status` (`status`) | | |+| `notifications.settings` | | | |-Migration steps:+## openhuman-- `integration_v2`: `notifications.integration` v1 to v2 from `integration_notifications`-- `dedup_v2`: `notifications.dedup` v1 to v2 from `notification_dedup`-- `settings_v2`: `notifications.settings` v1 to v2 from `notification_settings`-- `core_v2`: `notifications.core` v1 to v2 from `core_notifications`+| Collection | Indexes | Expiry field | Search fields |+| --- | --- | --- | --- |+| `openhuman.journal_backfill` | | | |## profiles-| Kind | Name | Version | Scope | Indexed fields |-| --- | --- | --- | --- | --- |-| collection | `profiles.registry` | 2 | cluster | |--Migration steps:--- `registry_v2`: `profiles.registry` v1 to v2 from `profiles`+| Collection | Indexes | Expiry field | Search fields |+| --- | --- | --- | --- |+| `profiles.registry` | | | |## 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`+| Collection | Indexes | Expiry field | Search fields |+| --- | --- | --- | --- |+| `session.transcript_entries` | `by_stem_written` (`stem`, `written`)<br>`by_stem` (`stem`, `seq`) | | |+| `session.transcripts` | `by_agent_id` (`agent_id`, `created_ms`)<br>`by_agent_name` (`agent_name`, `created_ms`)<br>`by_thread` (`thread_id`, `created_ms`) | | |+| `session.turn_states` | `by_thread` (`thread_id`) | | |## 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`+| Collection | Indexes | Expiry field | Search fields |+| --- | --- | --- | --- |+| `skills.bundles` | | | |+| `skills.catalogs` | | | |+| `skills.migrations` | | | |## subagents-| Kind | Name | Version | Scope | Indexed fields |-| --- | --- | --- | --- | --- |-| collection | `subagents.sessions` | 2 | agent | |--Migration steps:--- `sessions_v2`: `subagents.sessions` v1 to v2 from `subagent_sessions`+| Collection | Indexes | Expiry field | Search fields |+| --- | --- | --- | --- |+| `subagents.sessions` | | | |## task_sources-| Kind | Name | Version | Scope | Indexed fields |-| --- | --- | --- | --- | --- |-| collection | `task_sources.ingested` | 2 | tenant | `source_id`, `ingested_ms` |-| collection | `task_sources.sources` | 2 | tenant | `created_ms` |--Migration steps:--- `sources_v2`: `task_sources.sources` v1 to v2 from `task_sources`-- `ingested_v2`: `task_sources.ingested` v1 to v2 from `ingested_tasks`+| Collection | Indexes | Expiry field | Search fields |+| --- | --- | --- | --- |+| `task_sources.ingested` | `by_source` (`source_id`, `ingested_ms`) | | |+| `task_sources.sources` | `by_created` (`created_ms`) | | |## 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`+| Collection | Indexes | Expiry field | Search fields |+| --- | --- | --- | --- |+| `tasks.completions` | `by_parent` (`parent_key`)<br>`by_state` (`state`) | | |+| `tasks.history` | `task_rev` (`task_id`, `rev`) unique | | |+| `tasks.records` | `kind` (`kind_label`)<br>`node` (`node_id`)<br>`parent` (`parent_run_id`)<br>`root` (`root_run_id`)<br>`status` (`status`)<br>`thread` (`thread_id`) | | |## teq-| Kind | Name | Version | Scope | Indexed fields |-| --- | --- | --- | --- | --- |-| collection | `teq.ambient` | 1 | module | |-| collection | `teq.buckets` | 1 | module | |-| collection | `teq.cadence` | 1 | module | |-| collection | `teq.coalesce` | 1 | module | `due_ms`, `thread_group` |-| collection | `teq.conversations` | 1 | module | |-| collection | `teq.digest` | 1 | module | |-| collection | `teq.habituation` | 1 | module | |-| collection | `teq.outcomes` | 1 | module | `disposition`, `expires_ms` |-| collection | `teq.redriven` | 1 | module | |-| collection | `teq.staged` | 1 | module | `due_ms`, `cadence_key` |-| collection | `teq.threads` | 1 | module | |-| collection | `teq.tombstones` | 1 | module | `expires_ms` |+| Collection | Indexes | Expiry field | Search fields |+| --- | --- | --- | --- |+| `teq.ambient` | | | |+| `teq.buckets` | | | |+| `teq.cadence` | | | |+| `teq.coalesce` | `by_due` (`due_ms`)<br>`by_thread` (`thread_group`) | | |+| `teq.conversations` | | | |+| `teq.digest` | | | |+| `teq.habituation` | | | |+| `teq.outcomes` | `by_disposition` (`disposition`)<br>`by_expiry` (`expires_ms`) | | |+| `teq.redriven` | | | |+| `teq.staged` | `by_cadence` (`cadence_key`)<br>`by_due` (`due_ms`) | | |+| `teq.threads` | | | |+| `teq.tombstones` | `by_expiry` (`expires_ms`) | | |## threads-| Kind | Name | Version | Scope | Indexed fields |-| --- | --- | --- | --- | --- |-| collection | `threads.transcript_keys` | 2 | tenant | |+| Collection | Indexes | Expiry field | Search fields |+| --- | --- | --- | --- |+| `threads.transcript_keys` | | | |-Migration steps:+## tsd-- `transcript_keys_v2`: `threads.transcript_keys` v1 to v2 from `threads_transcript_keys`+| Collection | Indexes | Expiry field | Search fields |+| --- | --- | --- | --- |+| `tsd.counters` | | | |+| `tsd.kv` | `kv_by_key` (`owner`, `ns`, `key`) | | |+| `tsd.leases` | | | |+| `tsd.migrations` | | | |## 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`+| Collection | Indexes | Expiry field | Search fields |+| --- | --- | --- | --- |+| `wallet.budgets` | | | |+| `wallet.migrations` | | | |