Skip to content

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

docs(skills): add runtime schema documentation and module-level docs

Steven Enamakeld06283f5ae28
diff --git a/crates/openhuman-core/src/agent/registry/README.md b/crates/openhuman-core/src/agent/registry/README.md
index 47ac01be6b..f42a86c41d 100644
--- a/crates/openhuman-core/src/agent/registry/README.md
+++ b/crates/openhuman-core/src/agent/registry/README.md
@@ -3,66 +3,88 @@
User-facing agent registry. Owns the `agent_registry` RPC namespace: the
merged list of shipped default agents and user-authored custom agents, their
enable/disable state, and their tool visibility policy. This is a config
-layer over the harness — the actual tool-calling loop and prompt/runtime
-implementation live in [`agent/harness`](../harness/).
+layer over the harness — the tool-calling loop and prompt/runtime
+implementation live in [`agent/harness`](../harness/), and the definitions
+the harness runs come from [`agents/`](agents/) below.
## Files
- [`types.rs`](types.rs) — wire types: `AgentRegistryConfig` (the persisted
- `entries: Vec<AgentRegistryEntry>`), `AgentRegistryEntry` (id, name,
- description, `source: AgentRegistrySource` — `Default` vs `Custom` —
- enabled, model, optional system prompt, `tool_allowlist`/`tool_denylist`,
- `subagents: AgentSubagentPolicy` allowlist, tags, free-form metadata),
- `AgentRegistryPatch` (partial update), `AgentRegistrySource`.
- `AgentRegistryEntry::validate` enforces id/name/description and
- ASCII-safe id charset for both the entry and its subagent allowlist.
+ `entries: Vec<AgentRegistryEntry>`, stored at `Config.agent_registry`),
+ `AgentRegistryEntry` (id, name, description, `source: AgentRegistrySource`
+ — `Default` vs `Custom` — enabled, model, optional system prompt,
+ `tool_allowlist`/`tool_denylist`, `subagents: AgentSubagentPolicy`
+ allowlist, tags, free-form metadata), `AgentRegistryPatch` (partial
+ update), `AgentToolInfo` (tool-picker row). `AgentSubagentPolicy` also
+ deserializes from a legacy bare list of ids. `AgentRegistryEntry::validate`
+ enforces non-blank id/name/description and an ASCII `[A-Za-z0-9_-]` id
+ charset for both the entry and its subagent allowlist.
- [`defaults.rs`](defaults.rs) — `default_agents()` loads the built-ins from
- [`agents::load_builtins`](agents/mod.rs) and maps each `AgentDefinition` to
- a registry entry. `definition_from_registry_entry` is the inverse: it
- synthesizes an `AgentDefinition` from a *custom* entry (one with no shipped
- harness definition) so a custom agent runs through the same
- `Agent::from_config_for_agent` factory path as a built-in, with a real tool
- belt instead of a persona-only completion. Every harness-only field
+ [`agents::load_builtins`](agents/loader.rs) and maps each `AgentDefinition`
+ to a `Default`-sourced registry entry (tier becomes the single tag,
+ `ToolScope::Wildcard` renders as `["*"]`). `definition_from_registry_entry`
+ is the inverse: it synthesizes an `AgentDefinition` from a *custom* entry
+ (one with no shipped harness definition) so a custom agent runs through the
+ same `Agent::from_config_for_agent` factory path as a built-in, with a real
+ tool belt instead of a persona-only completion. Every harness-only field
(`omit_*`, temperature, iteration policy, sandbox mode, tier) takes the
harness's own safe worker default; see the function's doc comment for the
exact mapping and why an empty `tool_allowlist` must stay `Named(vec![])`
rather than collapsing to `Wildcard`.
- [`ops.rs`](ops.rs) — config-backed CRUD: `list_agents`, `get_agent`,
- `upsert_custom_agent`, `update_agent`, `set_agent_enabled`, `remove_agent`,
+ `upsert_custom_agent` (rejects ids that collide with a default),
+ `update_agent` (copies the default into config on first edit; refuses to
+ disable `orchestrator`), `set_agent_enabled`, `remove_agent`,
`merge_entries` (defaults overlaid with persisted config entries,
- default-first), `find_custom_in_config`. Reads/writes through
+ default-first), `available_tools`, `find_custom_in_config` (synchronous,
+ matches only *enabled* `Custom` entries — used by the agent factory on a
+ harness-registry miss). Reads/writes through
`config::rpc::load_config_with_timeout` and `Config::save`. Tool listing
- (`available_tools`) is sourced from the `tools_agent` built-in — its tool
- scope is the full catalog, unlike the orchestrator's curated subset.
+ (`available_tools`) builds the `tools_agent` built-in and reads its
+ `tool_specs()` — its tool scope is the full catalog, unlike the
+ orchestrator's curated subset.
- [`schemas.rs`](schemas.rs) — `ControllerSchema`/`RegisteredController`
definitions for namespace `agent_registry`: `list`, `get`,
`available_tools`, `create_custom`, `upsert_custom`, `update`,
- `set_enabled`, `remove`.
+ `set_enabled`, `remove`. Registered through
+ `all_agent_registry_registered_controllers` in `core/all.rs`.
- [`rpc.rs`](rpc.rs) — request/response payload types and the `*_rpc` handler
functions schemas.rs wires up, delegating into `ops.rs`.
- [`tools.rs`](tools.rs) — backwards-compatible re-export of
- `agent::orchestration::tools::*` (tool synthesis now lives there).
-- [`agents/`](agents/) — the built-in agent archetypes themselves.
+ `agent::orchestration::tools::*`; nothing in the tree imports it any more.
+- [`agents/`](agents/) — the built-in agent archetypes and their loader.
## `agents/`
Each built-in agent owns a subfolder with an `agent.toml` (id, `when_to_use`,
-model, tool allowlist, sandbox, iteration cap, `omit_*` flags — parsed
-directly into `AgentDefinition`), a `prompt.rs` exposing
-`pub fn build(&PromptContext) -> anyhow::Result<String>` wired into
-`PromptSource::Dynamic`, and optionally a `graph.rs` for a bespoke
-`AgentGraph` runner (agents without one use `AgentGraph::Default`). See the
-per-archetype contract documented on [`agents/mod.rs`](agents/mod.rs).
+model, tool scope, sandbox mode, iteration cap, tier, `omit_*` flags —
+parsed directly into `AgentDefinition`), a `prompt.md` holding the static
+archetype body, and a `prompt.rs` that `include_str!`s that body and exposes
+`pub fn build(&PromptContext) -> anyhow::Result<String>`, appending runtime
+sections (tools, user files, workspace) to it. `researcher` additionally
+owns a `graph.rs` for a bespoke `AgentGraph`; every other archetype uses
+`AgentGraph::Default`. The per-archetype contract is documented on
+[`agents/mod.rs`](agents/mod.rs).
-[`agents/loader.rs`](agents/loader.rs) owns `load_builtins` (walks the
-`BUILTINS` slice, parses each `agent.toml`, replaces `system_prompt` with the
-built-in's static `prompt.md` inline text, stamps
-`DefinitionSource::Builtin`) and `validate_tier_hierarchy` (worker-tier
-agents may not list subagents; a higher-tier agent may not delegate up the
-hierarchy; unknown subagent ids are tolerated here — they're a separate
-integrity concern). Workspace-level overrides
-(`$OPENHUMAN_WORKSPACE/agents/*.toml`) are merged in separately by
-`agent::harness::definition_loader`, replacing built-ins on id collision.
+[`agents/loader.rs`](agents/loader.rs) owns the `BUILTINS` slice and
+`load_builtins`, which parses each `agent.toml`, installs
+`PromptSource::Dynamic(prompt_fn)` and the optional graph, stamps
+`DefinitionSource::Builtin`, checks that the folder id matches the TOML id,
+and then runs `validate_tier_hierarchy`: a `worker` may not list any agent-id
+subagent, and `chat -> chat` / `reasoning -> reasoning` delegation is
+rejected (the pair rule is `validate_tier_transition` in the harness; unknown
+subagent ids are tolerated here as a separate integrity concern).
+`BUILTINS` is also the registration point for archetypes that live with
+other domains: `agent_memory` (`memory/agent/agent/`), `skill_setup` and
+`skill_executor` (`skills/{catalog,runtime}/agent/`, feature `skills`), and
+`workflow_builder` and `flow_discovery` (`flows/agents/`, feature `flows`).
+Workspace-level overrides (`<workspace_dir>/agents/*.toml`, with a
+`~/.openhuman/agents/` fallback) are loaded separately by
+`agent::harness::definition_loader` and replace built-ins on id collision;
+`AgentDefinitionRegistry::load` re-runs `validate_tier_hierarchy` after that
+merge.
+
+The 29 archetypes in this directory:
| Archetype | Role |
| --- | --- |
@@ -79,9 +101,9 @@ integrity concern). Workspace-level overrides
| `mcp_agent` (feature `mcp`) | Calls tools on an already-connected MCP server |
| `mcp_setup` | Walks the user through installing/connecting a new MCP server |
| `morning_briefing` | Proactive scheduled daily summary (tasks, calendar, email, skills) |
-| `orchestrator` | Default user-facing agent; direct-first, delegates only when it materially helps |
-| `planner` | Read-only architect: breaks a task into a DAG of subtasks with acceptance criteria |
-| `presentation_agent` | Builds decks from evidence; owns grounding/citations/image verification |
+| `orchestrator` | Default user-facing `chat`-tier agent; direct-first, delegates only when it materially helps |
+| `planner` | Read-only `reasoning`-tier architect: breaks a task into a DAG of subtasks with acceptance criteria |
+| `presentation_agent` (feature `documents`) | Builds decks from evidence; owns grounding/citations/image verification |
| `profile_memory_agent` | Profile, persona, preferences, people-graph specialist |
| `researcher` | Web/docs crawler that compresses findings to dense markdown; has a custom `graph.rs` |
| `scheduler_agent` | Reminders, recurring jobs, cron — time/cron tools only, no live calendar reads |
@@ -90,29 +112,42 @@ integrity concern). Workspace-level overrides
| `summarizer` | Runtime-dispatched only: compresses oversized tool results for the orchestrator |
| `task_manager_agent` | Task-board/task-source specialist: cards, feeds, artifacts, status |
| `tool_maker` | Narrow self-healer: writes a polyfill when a host command is missing |
-| `tools_agent` | Generalist heavy execution (shell/HTTP/web/files) that never touches a repo or git |
+| `tools_agent` | Generalist heavy execution (shell/HTTP/web/files) that never touches a repo or git; wildcard tool scope |
| `trigger_reactor` | One or two tool calls in direct reaction to an external trigger, no planning |
| `trigger_triage` | Classifies an external trigger into drop/acknowledge/react/escalate; never acts |
| `video_agent` | Video generation/animation specialist |
| `vision_agent` | Read-only image understanding: describe, OCR, locate UI elements |
-`flow_memory_agent` and `mcp_agent` are compiled out entirely when their
-gating feature (`flows`, `mcp`) is disabled; the orchestrator's `agent.toml`
-subagent list still names `mcp_agent` unconditionally (TOML can't be
-`cfg`'d), and both the tool-synthesis path and `validate_tier_hierarchy`
-tolerate that dangling id rather than failing boot.
+`flow_memory_agent` and `mcp_agent` are `#[cfg]`-gated out of both the
+module list and `BUILTINS` when `flows`/`mcp` is disabled;
+`presentation_agent` stays compiled but `builtin_enabled` drops it from
+`load_builtins` without `documents`, in lockstep with its
+`generate_presentation` tool. The orchestrator's `agent.toml` subagent list
+still names `mcp_agent` unconditionally (TOML can't be `cfg`'d); both the
+orchestrator tool synthesis in `tools/orchestrator_tools.rs` and
+`validate_tier_hierarchy` skip that dangling id rather than failing boot.
## Called by
-- `agent/harness/definition_loader.rs` — merges built-ins with workspace TOML
- overrides into the running `AgentDefinitionRegistry`.
-- `agent/library/` — shared agent-authored content referenced by archetypes.
-- `tools/orchestrator_tools.rs` — synthesizes one named delegation tool per
- id in the orchestrator's `subagents` allowlist, pulling each tool's
- description live from the target's `when_to_use` so it never drifts from
- a hardcoded table.
+- `core/all.rs` — registers the `agent_registry` controllers under
+ `DomainGroup::Agent`.
+- `config/schema/` — `Config.agent_registry: AgentRegistryConfig` is the
+ persisted store every `ops.rs` function reads and writes.
+- `agent/harness/builtin_definitions.rs` — `load_builtins()` seeds the
+ process-global `AgentDefinitionRegistry`; `agent/harness/definition_part_02.rs`
+ calls `validate_tier_hierarchy` again after workspace overrides merge.
+- `agent/harness/session/builder/factory.rs` —
+ `Agent::from_config_for_agent` falls back to `find_custom_in_config` +
+ `definition_from_registry_entry` when an id is not in the harness registry.
+- `agent/schemas.rs` — `agent.graph_topologies` and `agent.registry_snapshot`
+ enumerate `load_builtins()`.
+- `flows/` (`ops_part_02.rs`, `ops_part_03.rs`, `builder_tools_part_04.rs`,
+ `tinyflows/caps/agent.rs`) — resolve a flow `agent` node's `agent_ref`
+ through `list_agents`/`get_agent`/`find_custom_in_config`, honouring the
+ enabled flag.
## Tests
-`defaults_tests.rs`, `ops_tests.rs`, `schemas_tests.rs`, `types_tests.rs`,
-and under `agents/`: `loader_tests.rs` (+ `loader_tests_part_0N_tests.rs`).
+`defaults_tests.rs`, `ops_tests.rs`, `schemas_tests.rs`, `types_tests.rs`;
+under `agents/`: `loader_tests.rs` (+ `loader_tests_part_0N_tests.rs`) and a
+`prompt_tests.rs` beside almost every archetype's `prompt.rs`.
diff --git a/crates/openhuman-core/src/skills/runtime/mod.rs b/crates/openhuman-core/src/skills/runtime/mod.rs
index baaf44b1dc..a6cae48b68 100644
--- a/crates/openhuman-core/src/skills/runtime/mod.rs
+++ b/crates/openhuman-core/src/skills/runtime/mod.rs
@@ -1,14 +1,14 @@
//! Skill runtime: execution, cancellation, and run-log polling for installed
//! SKILL.md workflows.
//!
-//! `workflows` owns discovery and installed skill metadata. `skill_registry`
-//! owns remote catalogs and install sources. This module owns actually running
+//! `crate::skills` owns discovery and installed skill metadata.
+//! `crate::skills::catalog` owns remote catalogs and install sources. This module owns actually running
//! a skill, regardless of whether the skill's instructions call Python, Node,
//! shell tools, or another OpenHuman agent tool.
//!
//! ## Compile-time gate (`skills` feature)
//!
-//! `pub mod skill_runtime;` is ALWAYS compiled — it is a facade. The real
+//! `pub mod runtime;` is ALWAYS compiled — it is a facade. The real
//! implementation is gated behind the default-ON `skills` Cargo feature (the
//! same gate as `openhuman::skills` and `openhuman::skills::catalog` — the
//! three domains ship as one unit). When the feature is off, [`stub`] takes
diff --git a/crates/openhuman-core/src/skills/runtime/schemas.rs b/crates/openhuman-core/src/skills/runtime/schemas.rs
index 814426b414..433043d82a 100644
--- a/crates/openhuman-core/src/skills/runtime/schemas.rs
+++ b/crates/openhuman-core/src/skills/runtime/schemas.rs
@@ -1,8 +1,9 @@
//! Controller schemas and handlers for `openhuman.skill_runtime_*`.
//!
//! This namespace is the CLI/RPC-friendly execution surface for installed
-//! skills. The older `workflows_*` run/log/cancel controllers are kept for
-//! compatibility, but new scripts should call `skill_runtime_*` directly.
+//! skills. The `skills_run` / `skills_cancel` / `skills_recent_runs` /
+//! `skills_read_run_log` controllers in `skills/schemas/` wrap the same run
+//! machinery; new scripts should call `skill_runtime_*` directly.
use serde::Deserialize;
use serde_json::{Map, Value};