Skip to content

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

docs: add README files for several crates and modules

Steven Enamakel765a9404a109
diff --git a/crates/openhuman-core/src/agent/harness/README.md b/crates/openhuman-core/src/agent/harness/README.md
index 5dacbdf461..8e41455872 100644
--- a/crates/openhuman-core/src/agent/harness/README.md
+++ b/crates/openhuman-core/src/agent/harness/README.md
@@ -35,27 +35,24 @@ used here (not defined here) by `agent_graph.rs` and `fork_context.rs`.
- Offload oversized worker artifacts to the filesystem, and persist oversized
tool results as action-workspace artifacts (`artifact_offload/`,
`tool_result_artifacts/`).
-- Queue mid-turn messages into steer/followup/collect lanes without aborting
- the in-flight turn (`run_queue/`).
+- Run the channel/CLI turn graph (`graph.rs`) and let a built-in agent select
+ a bespoke sub-agent turn graph (`agent_graph.rs`).
## Key sub-modules
| Module | Role |
| --- | --- |
-| `session/` | `Agent`/`AgentBuilder`/`TurnOverrides` (`types.rs`), the fluent builder + `Agent::from_config` factory (`builder/`), the turn lifecycle (`turn/`: `context.rs`, `core*.rs`, `graph.rs`, `recall_lanes.rs`, `session_io*.rs`, `tools.rs`), host-side transcript persistence + legacy migration (`session_io/`, `migration.rs`, `turn_checkpoint.rs`). Durable transcript codecs and discovery live in `tinyagents_session::transcript`. |
-| `../subagent_host/` | Direct OpenHuman planner/executor/persistence adapters for `tinyagents-orchestration::subagent`: model resolution, tool filtering, sandbox/action-root narrowing, checkpoint/handback and transcript mirroring. |
| `definition*.rs`, `builtin_definitions.rs`, `definition_loader.rs` | `AgentDefinition`/`AgentDefinitionRegistry`/`SandboxMode`/`ToolScope`/`PromptSource`/`ModelSpec`; loads built-ins from `crate::agent::registry::agents` and user TOML from the workspace/home `agents/` directory. |
-| `fork_context.rs`, `sandbox_context.rs`, `spawn_depth_context.rs`, `task_recency_context.rs` | Transitional task-locals for legacy callers. Live TinyAgents tool dispatch receives `OpenHumanRunContext` directly for parent, attachments, dispatch, and usage. |
+| `fork_context.rs`, `sandbox_context.rs`, `spawn_depth_context.rs`, `task_recency_context.rs` | Task-locals that let a spawned tool see its parent's runtime context: parent handle, sandbox mode, spawn depth, and task-recency window. `fork_context.rs` also carries the `RunQueue` handle (from `tinyagents_harness::run_queue`) down to a forked turn. |
| `graph.rs` | `run_channel_turn_via_graph` (`pub(crate)`) — the channel/CLI turn graph, thin over `run_turn_via_tinyagents_shared`; called by the `agent.run_turn` native-bus handler in `agent/bus.rs`. |
-| `agent_graph.rs` | `AgentGraph` (`Default`/`Custom`), `AgentTurnRequest`, `AgentTurnResult`, `AgentTurnUsage` — per-agent sub-agent turn-graph selection consumed by `subagent_host`. Every built-in agent currently selects `Default`. |
-| `archivist/` | `ArchivistHook` (`types.rs`, `PostTurnHook` impl in `hook_impl.rs`) — post-turn episodic insert, segment boundary detection + lifecycle, LLM recap with heuristic fallback, lesson extraction from tool failures, and raw-prose ingestion into the memory tree when `config.learning.chat_to_tree_enabled` (`boundary.rs`, `lifecycle.rs`, `recap.rs`, `resummarise.rs`, `store.rs`, `tree_ingest.rs`, `events_heuristic.rs`). |
+| `agent_graph.rs` | `AgentGraph` (`Default`/`Custom`), `AgentTurnRequest`, `AgentTurnResult`, `AgentTurnUsage` — per-agent sub-agent turn-graph selection consumed by `../subagent_host/`. Every built-in agent currently selects `Default`. |
+| `archivist/` | `ArchivistHook` (`types.rs`, `PostTurnHook` impl in `hook_impl.rs`) — post-turn episodic insert, segment boundary detection and lifecycle, LLM recap with heuristic fallback, lesson extraction from tool failures, and raw-prose ingestion into the memory tree when `config.learning.chat_to_tree_enabled` (`boundary.rs`, `lifecycle.rs`, `recap.rs`, `resummarise.rs`, `store.rs`, `tree_ingest.rs`, `events_heuristic.rs`). |
| `artifact_offload/` | The `outputs/` / `workspace/` convention under `action_dir`: prompt half (`contract.rs`) and host policy half (`policy.rs`); mechanics (thresholds, path resolution, pointer rendering, the writer) live in `tinyagents_harness::artifacts` and are re-exported here. |
-| `run_queue/` | `RunQueue` and `QueuedMessage` — steer/followup/collect lanes wrapping `tinyagents_harness::run_queue`; `QueueStatus` is re-exported from the crate. |
| `tool_result_artifacts/` | Persists oversized individual and aggregate tool outputs under `action_dir/artifacts/tool-results/`, replacing them with a bounded `[tool_result_preview]` envelope pointing at the full, redacted file. |
-| `memory_context.rs`, `memory_context_safety.rs`, `memory_protocol.rs` | Working-memory and `[Cross-chat context]` lines surfaced into the prompt (capped by `WORKING_MEMORY_LIMIT`); trust-tier wrapping of recalled entries that came from connectors (`wrap_untrusted_for_agent`); and the read-index → dedupe → write → update-index enforcement state machine for memory-mutating tools (issue #4116). |
-| `instructions.rs`, `parse.rs`, `required_output.rs` | Text-mode `<tool_call>` protocol section (`build_tool_instructions*`), `parse_tool_calls_with_pformat`, and required structured-output validation/repair. |
-| `credentials.rs` | `scrub_credentials` — regex scrubbing of credential-shaped text (key/value secrets, AWS access-key IDs, `sk-…` keys). Applied to every tool result by the middleware in `agent/tinyagents/`. |
-| `tinyagents/host/run_context.rs` | Explicit turn-scoped dispatch refusal and `LastTurnUsage`/`SubagentUsageEntry` accounting shared by synchronous descendants. Detached work resets these turn-only handles. |
+| `memory_context.rs`, `memory_context_safety.rs`, `memory_protocol.rs` | Working-memory and `[Cross-chat context]` lines surfaced into the prompt (capped by `WORKING_MEMORY_LIMIT`); trust-tier wrapping of recalled entries that came from connectors (`wrap_untrusted_for_agent`); and the read-index, dedupe, write, update-index enforcement state machine for memory-mutating tools (issue #4116). |
+| `required_output.rs` | Pure validate/repair/synthesize primitives (issue #4117) that guarantee a required structured-output block (for example a `thoughts` JSON block) on every accepted turn. The orchestration that calls these lives on the session in `../session_host/turn/`. |
+| `parse_wire_tests.rs` | Test-only fixtures for OpenHuman's own wire vocabulary (`inference::provider::ToolCall`, native-history JSON, OpenAI function-calling payloads). The actual `<tool_call>` parsing (tags, fenced blocks, bare JSON, `<invoke>` XML, GLM grammar, p-format) moved to the vendored `tinytools_agent` crate; nothing about recovering a tool call from model text stayed here. |
+| `credentials.rs` | `scrub_credentials` — regex scrubbing of credential-shaped text (key/value secrets, AWS access-key IDs, `sk-...` keys). Applied to every tool result by `CredentialScrubMiddleware` in `agent/tinyagents/middleware/credential_scrub.rs`, installed as the innermost tool wrap so nothing downstream sees the raw secret. |
## Public surface
diff --git a/crates/openhuman-embed/src/agent/README.md b/crates/openhuman-embed/src/agent/README.md
index 082feef842..1e2301776e 100644
--- a/crates/openhuman-embed/src/agent/README.md
+++ b/crates/openhuman-embed/src/agent/README.md
@@ -6,28 +6,28 @@ for how agents fit into the two-step library API.
## Contents
-- `mod.rs` — `Agent`, the cheap-to-clone handle a host holds: `run()` /
+- `mod.rs`: `Agent`, the cheap-to-clone handle a host holds: `run()` /
`turn()` to talk to it, `action_dir()` / `workspace_dir()` / `home_dir()` /
`skills_dir()` / `transcripts_dir()` for its paths, `provider()` /
`access()` / `config()` for inspection. `AgentInner` is the shared state
behind every clone, and `AgentError` covers the ways building or driving an
agent can fail (duplicate id, invalid id, widening the runtime's surface, a
workspace I/O failure).
-- `spec.rs` — `AgentSpec`, the pure-data description a host builds before an
+- `spec.rs`: `AgentSpec`, the pure-data description a host builds before an
agent exists: id, `AgentDefinitionSpec`, provider, access, tool groups,
domains, MCP servers (`mcp` feature), a skills directory (`skills`
feature), `action_dir`, trusted paths, an escape-hatch config closure, and
an optional per-turn tool factory (`tools()`). `Runtime::agent` applies
these, in order, onto a clone of the runtime's base config.
-- `definition.rs` — `AgentDefinitionSpec`, `ToolScopeSpec` and
+- `definition.rs`: `AgentDefinitionSpec`, `ToolScopeSpec` and
`SandboxModeSpec`: a thin re-spelling of the core's `AgentDefinition` so
the library surface does not track that struct field by field. The default
is the built-in orchestrator's definition under the agent's own id, with
every registered tool visible.
-- `layout.rs` — `AgentLayout`: where one agent's files live under the
+- `layout.rs`: `AgentLayout`: where one agent's files live under the
runtime's workspace (`agents/<id>/` for its home and skills,
`session_raw/` for transcripts, plus its resolved `action_dir`).
-- `build.rs` — `instantiate`, the function that turns an `AgentSpec` plus a
+- `build.rs`: `instantiate`, the function that turns an `AgentSpec` plus a
`Runtime` into the assembled `AgentInner` (lays out directories, copies
skills, builds the `Config`, derives the `CoreContext`).
@@ -49,7 +49,7 @@ belt bound to something shorter-lived than the agent can vary per turn).
## Where to look next
-- [`../runtime/README.md`](../runtime/README.md) — what instantiates an
+- [`../runtime/README.md`](../runtime/README.md): what instantiates an
agent and what stays runtime-wide instead of per-agent.
-- [`../harness/README.md`](../harness/README.md) — the one-runtime,
+- [`../harness/README.md`](../harness/README.md): the one-runtime,
one-agent shorthand.
diff --git a/crates/openhuman-embed/src/harness/README.md b/crates/openhuman-embed/src/harness/README.md
index 20f0faf10f..b48dd8d9f3 100644
--- a/crates/openhuman-embed/src/harness/README.md
+++ b/crates/openhuman-embed/src/harness/README.md
@@ -9,25 +9,25 @@ host needs more than one agent.
## Contents
-- `mod.rs` — `Harness` itself (`run()`, `turn()`, `runtime()`, `agent()`,
+- `mod.rs`: `Harness` itself (`run()`, `turn()`, `runtime()`, `agent()`,
`core()`, `workspace_dir()`, `action_dir()`) and `HarnessCore`, a
deliberately narrow facade over non-turn domains (config, auth) that
exposes neither the raw runtime nor the orchestrator agent, so nothing can
start a turn that skips the harness's provider route and access tier.
-- `builder.rs` — `HarnessBuilder`: provider, workspace, access, `backend_url`
+- `builder.rs`: `HarnessBuilder`: provider, workspace, access, `backend_url`
(for non-inference backend calls when the embedding product has its own
backend), and `session` (installing a backend identity when required).
-- `access.rs` — `Access`: the tier a turn runs under (`readonly`, `full`,
+- `access.rs`: `Access`: the tier a turn runs under (`readonly`, `full`,
`trust`).
-- `provider.rs` — `Provider`: which model answers and where the request
+- `provider.rs`: `Provider`: which model answers and where the request
goes, including `Provider::openai_compatible` for a caller-supplied
endpoint and `Provider::inherit` to run exactly as the installed app does.
-- `workspace.rs` — `Workspace`: `Ephemeral`, `dir(path)`, or `Inherit` (the
+- `workspace.rs`: `Workspace`: `Ephemeral`, `dir(path)`, or `Inherit` (the
operator's real `~/.openhuman` workspace and session).
-- `mcp.rs` (`mcp` feature) — `HttpHeader`, `McpAuthConfig`, `McpServer`.
-- `skills.rs` (`skills` feature) — skill bundle discovery and copying for a
+- `mcp.rs` (`mcp` feature): `HttpHeader`, `McpAuthConfig`, `McpServer`.
+- `skills.rs` (`skills` feature): skill bundle discovery and copying for a
harness-owned agent.
-- `error.rs` — `HarnessError`.
+- `error.rs`: `HarnessError`.
## Running on your own endpoint
@@ -56,5 +56,5 @@ runs exactly as the installed app does, session included.
## Where to look next
- [`../runtime/README.md`](../runtime/README.md) and
- [`../agent/README.md`](../agent/README.md) — the two types `Harness`
+ [`../agent/README.md`](../agent/README.md): the two types `Harness`
wraps.
diff --git a/crates/openhuman-embed/src/runtime/README.md b/crates/openhuman-embed/src/runtime/README.md
index 34e5b3f2f6..89fd92db13 100644
--- a/crates/openhuman-embed/src/runtime/README.md
+++ b/crates/openhuman-embed/src/runtime/README.md
@@ -8,15 +8,15 @@ for what running many agents on one runtime costs in memory.
## Contents
-- `mod.rs` — `Runtime` itself: `agent()` to instantiate an `Agent` from an
+- `mod.rs`: `Runtime` itself: `agent()` to instantiate an `Agent` from an
`AgentSpec`, `agent_ids()`, `core()` for non-turn access (config, auth),
`root_dir()` / `workspace_dir()`, and the process-scoped `CoreGuard` that
tears the embedded core down (and, for an ephemeral workspace, deletes it)
once the last `Runtime` or `Agent` handle referencing it drops.
-- `builder.rs` — `RuntimeBuilder`: workspace choice, feature/service/domain
+- `builder.rs`: `RuntimeBuilder`: workspace choice, feature/service/domain
selection, provider and access defaults, and `api_key()` for managed
TinyHumans inference.
-- `api_key.rs` — `ApiKey`, the newtype the builder stores the TinyHumans key
+- `api_key.rs`: `ApiKey`, the newtype the builder stores the TinyHumans key
as before it reaches the credential store.
## What is runtime-wide versus per-agent
@@ -52,8 +52,8 @@ overflow.
## Where to look next
-- [`../agent/README.md`](../agent/README.md) — what `Runtime::agent` builds.
-- [`../harness/README.md`](../harness/README.md) — the one-agent shorthand
+- [`../agent/README.md`](../agent/README.md): what `Runtime::agent` builds.
+- [`../harness/README.md`](../harness/README.md): the one-agent shorthand
built on top of a `Runtime` and an `Agent`.
- `openhuman-tinyhumans`'s `RuntimeBuilder` extension
(`crates/openhuman-tinyhumans/src/lib.rs`) boots a runtime already connected
diff --git a/crates/openhuman-tinyhumans/src/hosted/README.md b/crates/openhuman-tinyhumans/src/hosted/README.md
index c7cb49ca39..f4c6cb48a4 100644
--- a/crates/openhuman-tinyhumans/src/hosted/README.md
+++ b/crates/openhuman-tinyhumans/src/hosted/README.md
@@ -8,13 +8,13 @@ connection has no use for them.
## Contents
-- [`billing/`](billing/README.md) — plans, Stripe/Coinbase purchase and
+- [`billing/`](billing/README.md): plans, Stripe/Coinbase purchase and
top-up flows, credit balance and transactions, auto-recharge and saved
cards, coupon redemption.
-- [`team/`](team/README.md) — team CRUD, membership, role changes, invites,
+- [`team/`](team/README.md): team CRUD, membership, role changes, invites,
usage, active-team switching.
-- [`referral/`](referral/README.md) — referral codes and reward claims.
-- [`announcements/`](announcements/README.md) — the latest active product
+- [`referral/`](referral/README.md): referral codes and reward claims.
+- [`announcements/`](announcements/README.md): the latest active product
announcement, surfaced on harness init.
Each domain follows the same shape: an `ops.rs` of async handlers that
@@ -38,7 +38,7 @@ point; it never grows a `billing` or `team` branch of its own.
## Where to look next
- Each subdirectory's own README for its RPC surface and wire names.
-- [`../transport/README.md`](../transport/README.md) — the
+- [`../transport/README.md`](../transport/README.md): the
`BackendTransport` these domains ultimately call through.
-- `AGENTS.md`, "Backend API" — why hosted-only proxy domains belong here and
+- `AGENTS.md`, "Backend API": why hosted-only proxy domains belong here and
not in the core.
diff --git a/crates/openhuman-tinyhumans/src/jev/README.md b/crates/openhuman-tinyhumans/src/jev/README.md
index da11796ce4..34157f3b51 100644
--- a/crates/openhuman-tinyhumans/src/jev/README.md
+++ b/crates/openhuman-tinyhumans/src/jev/README.md
@@ -7,11 +7,11 @@ retrieval.
## Contents
-- `mod.rs` — `install_jev_ranker()`, the one entry point. It builds a
+- `mod.rs`: `install_jev_ranker()`, the one entry point. It builds a
`TinyHumansJevRanker` and registers it as the process-wide `tool_search`
ranker through `openhuman_core::agent::tinyagents::discovery`. Idempotent:
calling it again replaces the previous ranker in place.
-- `ranker.rs` — `TinyHumansJevRanker`, the `ToolRanker` implementation. It
+- `ranker.rs`: `TinyHumansJevRanker`, the `ToolRanker` implementation. It
resolves the current backend credential and base URL on every search
(not once at install time, since a desktop process signs in and out while
it runs), embeds the tool catalogue through the process's own embedding
@@ -19,7 +19,7 @@ retrieval.
Choice evaluation to pick from it. The built Jev client is cached by
credential and base URL fingerprint so a stable session does not rebuild
an HTTP client on every search.
-- `evaluator.rs` — `TinyJevEvaluator`, the `tinytools_jev::JevEvaluator` that
+- `evaluator.rs`: `TinyJevEvaluator`, the `tinytools_jev::JevEvaluator` that
reaches Jev through the backend's `/agent-integrations/openrouter/systemone`
proxy with the same credential every other backend call uses.
@@ -37,11 +37,11 @@ never makes a decision over a shortlist it distrusts.
## Where to look next
-- `vendor/tinyagents/vendor/tinytools/crates/tinytools-jev/` — the generic
+- `vendor/tinyagents/vendor/tinytools/crates/tinytools-jev/`: the generic
`JevRanker` / `JevEvaluator` / `JevStrategy` types this module configures.
-- `crates/openhuman-core/src/config/schema/agent.rs` — `ToolSearchConfig`,
+- `crates/openhuman-core/src/config/schema/agent.rs`: `ToolSearchConfig`,
where a config chooses `ranker = "jev"` (the default), `"bm25"`,
`"auto"`, or `"compare"`.
-- `cargo run -p openhuman-cli --bin tool-search-bench` — the ranker
+- `cargo run -p openhuman-cli --bin tool-search-bench`: the ranker
comparison harness; see
[`../../../openhuman-cli/src/bin/README.md`](../../../openhuman-cli/src/bin/README.md).
diff --git a/crates/openhuman-tinyhumans/src/session/README.md b/crates/openhuman-tinyhumans/src/session/README.md
index fcff774b2e..9c61f9b5a6 100644
--- a/crates/openhuman-tinyhumans/src/session/README.md
+++ b/crates/openhuman-tinyhumans/src/session/README.md
@@ -11,26 +11,26 @@ crate; see `AGENTS.md`'s "Backend API" section for the boundary it keeps.
## Contents
-- `client.rs` — `SessionClient`: the actual backend calls, login-token
+- `client.rs`: `SessionClient`: the actual backend calls, login-token
exchange and `GET /auth/me`, plus `ClientHeaders`. Carries the store-time
timeout, retry and transient-failure policy. Errors are
`SessionClientError` / `FetchMeError`.
-- `cache.rs` — `CurrentUserCache` / `CachedUser`: the last `/auth/me` answer,
+- `cache.rs`: `CurrentUserCache` / `CachedUser`: the last `/auth/me` answer,
served fresh or stale-while-revalidate, with bounded backoff while the
backend is unreachable.
-- `link.rs` — `CoreLink` / `CoreAuthState`: how a resolved credential is
+- `link.rs`: `CoreLink` / `CoreAuthState`: how a resolved credential is
pushed into whichever core the host owns, through `auth.set_credential` /
`auth.clear_credential` / `auth.get_state`. This is the only door into a
core from this module.
-- `manager.rs` — `SessionManager`, the host-facing orchestration over the
+- `manager.rs`: `SessionManager`, the host-facing orchestration over the
three pieces above: login, store, logout, current user, state, and change
events (`SessionEvent`, `SessionState`, `SessionError`).
-- `credential.rs` — `Credential` / `CredentialKind` and the JWT helpers
+- `credential.rs`: `Credential` / `CredentialKind` and the JWT helpers
(`decode_jwt_exp`, `jwt_is_live`, `user_id_from_jwt_claims`,
`user_id_from_profile_payload`).
-- `identity.rs` — process-global identity state read by synchronous Sentry
+- `identity.rs`: process-global identity state read by synchronous Sentry
hooks that cannot await a cache lookup.
-- `test_support.rs` — fixtures shared by this module's own tests.
+- `test_support.rs`: fixtures shared by this module's own tests.
## What this module must not do
@@ -44,7 +44,7 @@ host owns the login; the core only takes the resulting credential.
- `AGENTS.md`, "Tool, harness, and runtime boundaries" and "Backend API" —
why login ownership sits here and not in the core.
- [`gitbooks/developing/tinyhumans-api-key.md`](../../../../gitbooks/developing/tinyhumans-api-key.md)
- — the API-key alternative to a session login for library and headless
+ : the API-key alternative to a session login for library and headless
hosts, which does not go through this module.
-- [`../transport/README.md`](../transport/README.md) — the transport a
+- [`../transport/README.md`](../transport/README.md): the transport a
resolved credential ultimately authenticates.
diff --git a/crates/openhuman-tinyhumans/src/transport/README.md b/crates/openhuman-tinyhumans/src/transport/README.md
index aec5e7895b..1bbc27f8a9 100644
--- a/crates/openhuman-tinyhumans/src/transport/README.md
+++ b/crates/openhuman-tinyhumans/src/transport/README.md
@@ -7,7 +7,7 @@ header shapes the backend expects.
## Contents
-- `mod.rs` — `SdkBackendTransport`. It holds one `reqwest::Client` per
+- `mod.rs`: `SdkBackendTransport`. It holds one `reqwest::Client` per
`TransportProfile` (`Api`, `Integrations`), each built from the core's
`api::headers::build_backend_client` so TLS, timeouts and the attribution
headers (`x-core-version`, `x-tauri-version`, `x-sdk-name`) match exactly
@@ -16,7 +16,7 @@ header shapes the backend expects.
(`BackendCredential::Session` as a bearer token, `BackendCredential::ApiKey`
as `x-api-key`), and forward to the SDK's `raw()` client. `name()` returns
`"tinyhumans-sdk"`.
-- `error.rs` — `map_sdk_error`, translating `tinyhumans_sdk::Error` into the
+- `error.rs`: `map_sdk_error`, translating `tinyhumans_sdk::Error` into the
core's `BackendTransportError` variants.
## Installing it
@@ -41,9 +41,9 @@ route implementation of its own.
## Where to look next
-- `AGENTS.md`, "Backend API" — the full port/adapter boundary and the header
+- `AGENTS.md`, "Backend API": the full port/adapter boundary and the header
rules every authenticated request must follow.
-- [`../session/README.md`](../session/README.md) — where the credential this
+- [`../session/README.md`](../session/README.md): where the credential this
transport attaches comes from.
-- [`../hosted/README.md`](../hosted/README.md) — the RPC proxy domains built
+- [`../hosted/README.md`](../hosted/README.md): the RPC proxy domains built
on top of this transport.