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(core): update agent orchestration and artifacts documentation
Steven Enamakel15d97e6671fd
diff --git a/crates/openhuman-core/src/agent/artifacts/README.md b/crates/openhuman-core/src/agent/artifacts/README.mdindex fc06108455..4c7a7b0d58 100644--- a/crates/openhuman-core/src/agent/artifacts/README.md+++ b/crates/openhuman-core/src/agent/artifacts/README.md@@ -46,7 +46,15 @@ All in the `ai` namespace:## Agent tools-None. This module owns no `tools.rs`.+`tools.rs` exposes three LLM-callable wrappers over `ops.rs`, re-exported crate-wide through `crate::tools::mod`'s `pub use crate::agent::artifacts::tools::*`:++| Tool | Permission | Behavior |+| --- | --- | --- |+| `artifact_list` | default (read-only) | Lists artifacts newest-first via `ops::ai_list_artifacts`; supports `offset`/`limit`. |+| `artifact_get` | default (read-only) | Fetches one artifact's metadata + `absolute_path` via `ops::ai_get_artifact`. |+| `artifact_delete` | `Dangerous` | Irreversibly deletes an artifact directory via `ops::ai_delete_artifact`. Ships **default-OFF**; must be opted in through the tool toggle map (`TOOL_ID_TO_RUST_NAMES` in `crate::tools::user_filter`). |++Each tool is a thin shim: it validates/reads its args, calls the matching `ops` function, and serializes the returned `RpcOutcome.value` as the tool result. `artifact_list` deliberately lists the full workspace (no per-chat filtering) so agent orchestration sees everything it has produced; the per-chat filter is an RPC-only concern.## Events@@ -68,7 +76,7 @@ None. No `bus.rs`; the module publishes/subscribes to no `DomainEvent`s.## Used by-- `crates/openhuman-core/src/core/all.rs` — registers `all_artifacts_registered_controllers()` (line ~141) and `all_artifacts_controller_schemas()` (line ~307) into the global controller/schema registries. No other in-crate consumer of `save_artifact_meta` was found, so artifact creation is not yet wired from a producer domain.+- `crates/openhuman-core/src/core/all.rs` — registered in the global controller registry via `all_artifacts_registered_controllers()`. `all_artifacts_controller_schemas()` is exported alongside for domain-local schema-coverage tests; the crate-wide `/schema` list (`core::all::all_controller_schemas`) is derived from registered controllers, not called separately per domain. No other in-crate consumer of `save_artifact_meta` was found, so artifact creation is not yet wired from a producer domain.## Notes / gotchasdiff --git a/crates/openhuman-core/src/agent/orchestration/README.md b/crates/openhuman-core/src/agent/orchestration/README.mdindex 291a413e5e..737edad849 100644--- a/crates/openhuman-core/src/agent/orchestration/README.md+++ b/crates/openhuman-core/src/agent/orchestration/README.md@@ -1,48 +1,164 @@# Agent Orchestration-`agent_orchestration` is the high-level control plane for agent-to-agent work.-It owns parent/child lineage, lifecycle state, wait/close/follow-up semantics,-and UI/diagnostic events. The lower-level `agent::harness` remains the execution-engine for prompt construction, policy-filtered tools, model selection, and-sub-agent loops.+`agent::orchestration` is the control plane for coordinating multiple agent+workers from one parent session: agent teams, background command-center views,+declarative multi-phase workflows, git-worktree isolation for parallel coding+workers, and the tool surface LLMs call to spawn/steer/wait-on sub-agents. The+lower-level `agent::harness` remains the execution engine — prompt+construction, policy-filtered tools, model selection, and the sub-agent run+loop itself.-## Current Inventory+Execution fans out on TinyAgents **graphs**: `workflow_runs` schedules phase+DAGs on a graph engine, `agent_teams` routes members through a+conditional-routing graph, `delegation` wires the durable+plan→execute⇄review→finalize graph, and parallel fanout goes through+`tinyagents_graph::parallel::map_reduce`. What stays in this module is the+product layer: durable SQL/JSON run ledgers, validation, cancellation+semantics, compatibility events, and JSON-RPC/tool response formatting.-- `agent_orchestration::tools::spawn_subagent` runs one typed sub-agent and returns a collapsed result.-- `agent_orchestration::tools::spawn_parallel_agents` fans out independent typed sub-agent runs.-- `agent_orchestration::tools::spawn_worker_thread` creates a persisted worker-thread transcript, but the current `spawn_subagent` tool rejects `dedicated_thread` until the worker UI is ready.-- `agent::harness::subagent_runner` is the canonical execution path for typed child agents.-- `agent::progress::AgentProgress::Subagent*` and `DomainEvent::Subagent*` already provide lifecycle and child tool-call telemetry.+## Responsibilities-## Control Surface+- Register, wait on, and cancel child agent runs (`ops.rs`,+ `AgentOrchestrationSession`) as thin wrappers over TinyAgents'+ `DetachedTaskRegistry`.+- Durable multi-agent models with their own run-ledger tables: agent teams+ (`agent_teams/`), declarative phase-graph workflows (`workflow_runs/`), and+ the plan→execute⇄review→finalize graph (`delegation.rs`).+- A read-only command-center view over background agent runs plus stop/retry/+ continue/follow-up control verbs (`command_center/`).+- Git-worktree isolation so parallel coding workers never clobber the same+ checkout (`worktree.rs`, `worktree_schemas.rs`).+- Cancellation of detached (`spawn_async_subagent`) background sub-agents from+ the frontend "Cancel" affordance (`subagent_control.rs`).+- Mirroring detached sub-agent lifecycle into a TinyAgents task store, batching+ finished background results back into chat, and settling run-ledger rows+ from the global bus regardless of the parent turn's lifecycle+ (`running_subagents*.rs`, `background_completions.rs`,+ `background_delivery.rs`, `run_ledger_finalize.rs`).+- A shared root `ParentExecutionContext` builder for surfaces that spawn real+ sub-agents from a background task with no enclosing agent turn on the stack+ (`parent_context/builder.rs`).-The intended canonical operations mirror Codex-style multi-agent controls:+## Key files-- `spawn_agent`: register a child in the TinyAgents `DetachedTaskRegistry` and run it through `agent::harness::run_subagent`.-- `wait_agents`: wait for one or more children to reach a terminal state, optionally with a timeout. A terminal child is pruned from the registry by the wait that observed it.-- `abort_all`: publish `cancelled` on every live child and hard-abort its task.+- `mod.rs` — module wiring and re-exports.+- `ops.rs` / `types.rs` — `AgentOrchestrationSession`, `OrchestrationError`,+ `AgentSnapshot`, `OrchestrationTaskStatus`, `SpawnAgentRequest`/`Response`,+ `WaitAgentOptions`/`Response`.+- `agent_teams/` — durable lead/worker team coordination (issue #3374):+ atomic task claiming, dependency validation, quality-gated completion, and+ live teammate execution via `start_member`.+- `command_center/` — read-only grouped view of background agent runs+ (`ops.rs`) plus stop/retry/continue/follow-up transitions (`control.rs`).+- `workflow_runs/` — declarative `WorkflowDefinition` phase graphs (issue+ #3375), the builtin "parallel research with cross-checking" workflow,+ structural/agent validation, and the live execution engine (`engine.rs`).+- `delegation.rs` — the durable plan→execute⇄review→finalize graph.+- `subagent_control.rs` — manual cancel/steer of detached background+ sub-agents; the manual counterpart to the automatic thread-close+ cancellation in `crate::threads`.+- `worktree.rs` / `worktree_schemas.rs` — `OpenHumanWorktreeIsolation` adapter+ over TinyAgents' host-agnostic git-worktree plumbing, plus the+ list/status/diff/remove RPC surface.+- `subagent_sessions/` — durable subagent session records+ (`DurableSubagentSessionSummary`, `SubagentSessionStore`) used for+ reuse/dedup decisions across turns.+- `parent_context/builder.rs` — `build_root_parent` / `with_root_parent`, the+ single blessed entry point for constructing a root `ParentExecutionContext`+ outside an agent turn.+- `running_subagents.rs` (+ `_part_01.rs`, `_part_02.rs`) — detached sub-agent+ registry mirror; `background_completions.rs` / `background_delivery.rs` —+ queue and idle-gated, debounced, batched delivery of finished background+ runs back into chat; `run_ledger_finalize.rs` — global-bus subscriber that+ settles ledger rows for runs that outlive their spawning turn.+- `tools.rs` — declares the LLM-callable tool files under `tools/` (see+ [Agent tools](#agent-tools)).-The in-memory `list_agents` / `message_agent` / `close_agent` / `follow_up` /-`resume_agent` / `events` mirror was removed — the durable equivalents live in-`command_center::control`.+## Public surface-## State Model+- `AgentOrchestrationSession`, `OrchestrationError` — `ops.rs`.+- `AgentSnapshot`, `OrchestrationTaskStatus`, `SpawnAgentRequest`/`Response`,+ `WaitAgentOptions`/`Response` — `types.rs`.+- `OpenHumanWorktreeIsolation`, `BaseRef`, `WorktreeError`, `WorktreeStatus` —+ `worktree.rs`.+- Controller schema/registration pairs re-exported from `mod.rs`:+ `all_agent_team_*`, `all_command_center_*`, `all_workflow_run_*`,+ `all_worktree_*`, `all_subagent_control_*`.-Each child has a stable `orchestration_id`, an `agent_id`, optional-`parent_agent_id`, status, prompt, result summary, error, timestamps, and-metadata. Status is TinyAgents' `OrchestrationTaskStatus`; the terminal values-are `completed`, `failed`, `cancelled`, `timed_out`, and `abandoned`.+## RPC-## Policy Inheritance+Five controller pairs are registered in `crate::core::all`:-Policy inheritance is delegated to `agent::harness::run_subagent`, which already-derives child tools, model routing, sandbox context, spawn depth, and progress-from the parent `ParentExecutionContext`. The orchestration layer should only-add lineage and lifecycle semantics; it must not widen tool visibility beyond-what the harness exposes to the child.+| Namespace | Source |+| --- | --- |+| `agent_team` | `agent_teams::{all_agent_team_controller_schemas, all_agent_team_registered_controllers}` |+| `agent_work` | `command_center::{all_command_center_controller_schemas, all_command_center_registered_controllers}` |+| `workflow_run` | `workflow_runs::{all_workflow_run_controller_schemas, all_workflow_run_registered_controllers}` |+| `worktree` | `worktree_schemas::{all_controller_schemas, all_registered_controllers}` |+| `subagent` | `subagent_control::{all_controller_schemas, all_registered_controllers}` |++## Agent tools++`tools.rs` declares the `tools/` directory files (via `#[path]`) and+re-exports them through `crate::tools` (`tools/mod.rs`:+`pub use crate::agent::orchestration::tools::*`): `agent_prepare_context`,+`archetype_delegation`, `awaiting_user`, `close_subagent`,+`collapsed_delegation`, `continue_subagent`, `delegate_graph`, `dispatch`,+`list_subagents`, `skill_delegation`, `spawn_async_subagent`,+`spawn_parallel_agents`, `spawn_subagent`, `spawn_worker_thread`,+`steer_subagent`, `wait`, `wait_subagent`, `worker_thread`. Execution itself+routes through `agent::harness::run_subagent`.## Persistence-The first implementation is process-local. The state shape is serializable so a-later PR can persist orchestration sessions across app restart, cron resumes, and-thread continuation without changing callers.+Durable state lives in `tinyagents_session::run_ledger` — the `agent_runs`,+`agent_teams`/`agent_team_members`/`agent_team_tasks`, and `workflow_runs`+tables, plus the shared run-event log for messages — backed by+`{workspace}/session_db/sessions.db` (see `agent/session_db/mod.rs`). Every+spawn path (`spawn_subagent`, `spawn_async_subagent`,+`spawn_parallel_agents`, `continue_subagent`, `dispatch`) writes a `running`+row; `run_ledger_finalize.rs` settles it from the global event bus so+detached runs that outlive their spawning turn are not left `running`+forever.++## Policy inheritance++Policy inheritance is delegated to `agent::harness::run_subagent`, which+derives child tools, model routing, sandbox context, spawn depth, and+progress from the parent `ParentExecutionContext`. This module only adds+lineage and lifecycle semantics; it must not widen tool visibility beyond+what the harness exposes to the child.++## Dependencies++- `agent::harness` — `run_subagent`, `fork_context::ParentExecutionContext`,+ `definition::{AgentDefinition, AgentDefinitionRegistry}`.+- `agent::tinyagents::orchestration` — `DetachedTaskRegistry`,+ `OrchestrationTaskStatus`, `TaskId`.+- `tinyagents_session::run_ledger` — durable storage for teams, workflow runs,+ and agent run rows.+- `tinyagents_graph` — the graph engine used for workflow phase scheduling,+ agent-team routing, and parallel map/reduce fanout.+- `core::bus::BUS` — `DomainEvent::AgentOrchestration*` /+ `Subagent*` publication and subscription.+- `web_chat::progress_bridge` — the per-turn progress-channel counterpart to+ `run_ledger_finalize.rs`'s global-bus settlement.++## Used by++- `agent::tools` re-exports every tool in `tools/` for the LLM tool-calling+ loop.+- `threads` — the automatic thread-close cancellation counterpart to+ `subagent_control.rs`'s manual cancel.+- `crate::core::all` — registers the five controller pairs above.++## Notes++- Namespace `agent_team` is distinct from the existing `team` domain (backend+ org/team membership); `workflow_run` is distinct from the `workflows`+ domain (SKILL.md/WORKFLOW.md bundle discovery).+- `wait_agents` prunes an entry once it observes a terminal status — every+ in-tree caller spawns and waits exactly once.+- `worktree.rs` only ever operates on the user's project repo rooted at the+ agent's `action_dir`, never on OpenHuman's own source tree; `remove`+ refuses a dirty worktree unless `force = true`.diff --git a/gitbooks/developing/building-rust-core.md b/gitbooks/developing/building-rust-core.mdindex 1312392650..26a8ca95f6 100644--- a/gitbooks/developing/building-rust-core.md+++ b/gitbooks/developing/building-rust-core.md@@ -169,28 +169,10 @@ sudo pacman -S --needed base-devel cmake pkgconf clang openssl \Why these matter:- `build-essential` / `base-devel`, `cmake`, `pkg-config` / `pkgconf`: native builds used by transitive Rust dependencies.-- `clang`, `libclang-dev`: bindgen / C and C++ compilation paths used by native crates.+- `clang`, `libclang-dev`: bindgen (used by native crates such as `cpal`'s ALSA bindings) and C/C++ compilation paths.- `libssl-dev` / `openssl`: OpenSSL headers needed by some networking dependencies.-- `libasound2-dev` / `alsa-lib`, `libxi-dev` / `libxi`, `libxtst-dev` / `libxtst`, `libxdo-dev` / `xdotool`, `libudev-dev` (included in Arch `systemd-libs`), `libevdev`: required by audio/input/device crates pulled into the core build.--### `whisper-rs` + `clang` note--`whisper-rs-sys` can fail under `clang` with:--```text-fatal error: 'array' file not found-```--This is why the docs call out `libstdc++-14-dev`: `clang` may pick GCC 14 C++ headers on Ubuntu runners.--If your distro layout still leaves `libstdc++.so` unresolved for the build, use the same workaround documented in [`AGENTS.md`](../../AGENTS.md):--```bash-# Ubuntu/Debian — adjust the GCC version as needed-sudo ln -sf /usr/lib/gcc/x86_64-linux-gnu/13/libstdc++.so /usr/lib/x86_64-linux-gnu/libstdc++.so-```--Arch Linux typically does not need this workaround because `gcc-libs` places `libstdc++.so` on the default library search path.+- `libasound2-dev` / `alsa-lib`, `libxi-dev` / `libxi`, `libxtst-dev` / `libxtst`, `libxdo-dev` / `xdotool`, `libudev-dev` (included in Arch `systemd-libs`), `libevdev`: required by audio/input/device crates (`cpal`, `enigo`/X11 input handling) pulled into the core build.+- `libstdc++-14-dev`: `clang`-driven builds may pick GCC 14 C++ headers on Ubuntu runners; this keeps `libstdc++.so` resolvable for those native crates.### Linux desktop/Tauri package set@@ -231,16 +213,15 @@ Install:Recommended commands after the Microsoft toolchain is installed:```powershell-rustup toolchain install 1.93.0 --component rustfmt --component clippy+rustup toolchain install 1.96.1 --component rustfmt --component clippyrustup target add x86_64-pc-windows-msvccargo build --manifest-path Cargo.toml --bin openhuman-core```-Windows note:--- The repo patches `whisper-rs-sys` to force the static MSVC CRT and avoid the `LNK2038` / `LNK1169` mismatch called out in [`Cargo.toml`](../../Cargo.toml). Use the MSVC toolchain, not MinGW.+Use the MSVC toolchain, not MinGW, to match CI and release builds.## 7. Related paths-- [Getting Set Up](getting-set-up.md): full desktop contributor setup with `pnpm`, Tauri, submodules, and sidecar staging.+- [Getting Set Up](getting-set-up.md): full desktop contributor setup with `pnpm`, Tauri, and submodules. The core runs in-process inside the desktop shell (see [Tauri Shell](architecture/tauri-shell.md)); there is no sidecar staging step.- [OpenHuman Architecture](architecture/README.md): where the core fits into the desktop app and RPC flow.+- [Deep Architecture Reference](architecture.md): the full crate map and repository layout.