Skip to content

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

docs(openhuman-core): add relative links to module READMEs

Steven Enamakeld06a178b6e3e
diff --git a/crates/openhuman-core/README.md b/crates/openhuman-core/README.md
index 4026b28be6..25965ec110 100644
--- a/crates/openhuman-core/README.md
+++ b/crates/openhuman-core/README.md
@@ -60,7 +60,7 @@ OpenHuman's policy.
Arrows point at what a crate depends on. Two seams let the upper crates plug
into the core without the core naming them:
-- The backend transport port (`backend/transport/`: `BackendTransport`,
+- The backend transport port ([`backend/transport/`](./src/backend/transport/): `BackendTransport`,
`BackendRequest`, `BackendTransportError`). `openhuman-tinyhumans`
implements it with the TinyHumans SDK and installs it once per process
(`openhuman_tinyhumans::install`, `RuntimeBuilder`, or
@@ -96,7 +96,7 @@ Every domain operation follows one contract, defined in `core/`:
```
Each domain exposes `all_<domain>_registered_controllers()` from its
-`schemas.rs`. `core/all.rs` collects them in `build_registered_controllers`
+`schemas.rs`. [`core/all.rs`](./src/core/all.rs) collects them in `build_registered_controllers`
(public) and `build_internal_only_controllers` (callable by the shell, hidden
from agent tool listings), tagging each with one `DomainGroup`. RPC method
names are `openhuman.<namespace>_<function>`, and namespace strings are wire
@@ -105,42 +105,42 @@ server dumps the live registry.
### The event bus
-`core/bus.rs` owns the process-wide `BUS` (a `tinybus` bus over
-`DomainEvent`, defined in `core/events.rs`). Domains publish with
+[`core/bus.rs`](./src/core/bus.rs) owns the process-wide `BUS` (a `tinybus` bus over
+`DomainEvent`, defined in [`core/events.rs`](./src/core/events.rs)). Domains publish with
`BUS.publish` and subscribe with an `EventHandler` in their own `bus.rs`,
named `<domain>::<purpose>`. Subscribers are registered at startup in
-`core/runtime/subscribers.rs`. `BUS.native()` carries typed in-process
+[`core/runtime/subscribers.rs`](./src/core/runtime/subscribers.rs). `BUS.native()` carries typed in-process
request and response calls whose values cannot be serialized. Adding an event
means adding the variant, extending `domain()`, registering the subscriber,
and bumping `EVENTS_VERSION`.
### Runtime composition
-`CoreBuilder` (`core/runtime/builder.rs`) builds a `CoreRuntime`. Three knobs
+`CoreBuilder` ([`core/runtime/builder.rs`](./src/core/runtime/builder.rs)) builds a `CoreRuntime`. Three knobs
narrow what runs, and they can only narrow:
| Knob | Selects | Presets |
| --- | --- | --- |
| `ServiceSet` | Background services and transports: HTTP RPC, Socket.IO, cron, channels, login-gated services, update checker, memory queue, MCP boot, integration sync | `desktop`, `headless_api`, `embedded`, `none` |
| `DomainSet` | Which `DomainGroup` families are live: controllers, tools, stores, subscribers | `full`, `harness`, `embedded`, `kernel`, `none` |
-| `ToolGroups` | Tool visibility for agents | (see `tools/toolpacks`) |
+| `ToolGroups` | Tool visibility for agents | (see [`tools/toolpacks`](./src/tools/toolpacks/)) |
`CoreRuntime::invoke` dispatches through the same `invoke_method` the RPC
server uses. `CoreContext::derive_with` gives an embedded agent its own
context, clamped to what the parent registered. Boot order (config,
migrations, cost ledger, socket manager, subscribers, services) is in
-`core/runtime/bootstrap.rs` and `services.rs`; see
+[`core/runtime/bootstrap.rs`](./src/core/runtime/bootstrap.rs) and `services.rs`; see
[`src/core/runtime/README.md`](src/core/runtime/README.md).
`run_core_from_args` (`lib.rs`) is the CLI entry point used by
-`crates/openhuman-cli/src/main.rs` and the desktop binary's `core` and `mcp`
+[`crates/openhuman-cli/src/main.rs`](../openhuman-cli/src/main.rs) and the desktop binary's `core` and `mcp`
subcommands. It loads dotenv, applies the startup restart delay, initializes
the keyring master key, and dispatches to `core::cli`. A host that serves RPC
calls `openhuman_rpc::server::install_cli_server()` first.
## Layout
-`src/core/` is infrastructure, not a domain. Everything else under `src/` is
+[`src/core/`](./src/core/) is infrastructure, not a domain. Everything else under `src/` is
one domain family, with the module shape described in `AGENTS.md` ("Rust
domain structure": `mod.rs`, `types.rs`, `store.rs`, `ops.rs`, `schemas.rs`,
`tools.rs`, `bus.rs`). A `*` marks a module whose `pub mod` in `lib.rs` is
@@ -152,7 +152,7 @@ feature-gated by the feature of the same name.
| --- | --- |
| [`src/core/`](src/core/README.md) | Controller contract (`Outcome`, `ControllerSchema`, `StructuredRpcError`, `params`), registry (`all.rs`), in-process dispatch (`invoke.rs`, `dispatch.rs`), `BUS` and `DomainEvent`, CLI, logging and observability, runtime composition (`runtime/`). |
| [`src/backend/`](src/backend/README.md) | The backend port and `BackendClient` (authenticated JSON, error classification). Holds no URL, header policy, or product identity; it asks the installed transport. |
-| [`src/config/`](src/config/README.md) | Config schema (`config/schema/`), load and save, settings RPC. |
+| [`src/config/`](src/config/README.md) | Config schema ([`config/schema/`](./src/config/schema/)), load and save, settings RPC. |
| [`src/util/`](src/util/README.md) | Self-contained helpers. Always compiled. |
| [`src/test_support/`](src/test_support/README.md)* | Wipe-and-reset hooks for E2E specs (feature `e2e-test-support`). |
@@ -172,7 +172,7 @@ feature-gated by the feature of the same name.
| Path | What it does |
| --- | --- |
-| [`src/tools/`](src/tools/README.md) | Assembles each session's tool list (`tools/ops.rs`), cross-cutting built-in tools, and tool policy. Domain tools live with their domain and are re-exported here. |
+| [`src/tools/`](src/tools/README.md) | Assembles each session's tool list ([`tools/ops.rs`](./src/tools/ops.rs)), cross-cutting built-in tools, and tool policy. Domain tools live with their domain and are re-exported here. |
| [`src/security/`](src/security/README.md) | The trust boundary: autonomy policy, approvals, credentials and secrets, redaction, egress and local-only mode, listener guard. |
| [`src/sandbox/`](src/sandbox/README.md) | Sandbox backends for tool isolation (platform jail, Docker via `tinybox`). |
| [`src/runtime/`](src/runtime/README.md) | Client side of code execution: `node_exec`, `npm_exec`, `python_exec`, `shell`, worker pools over the `tinyruntime` module. |
@@ -203,11 +203,11 @@ feature-gated by the feature of the same name.
## Feature gates
-`[features] default` in `Cargo.toml` is the contributor set: what a bare
+`[features] default` in [`Cargo.toml`](./Cargo.toml) is the contributor set: what a bare
`cargo check`, `cargo test`, or rust-analyzer builds. It is deliberately
smaller than the product set in `scripts/ci/product-features.txt`, which the
-desktop app forwards from `crates/openhuman-app/Cargo.toml` (it disables
-default features). `scripts/ci/check-feature-forwarding.mjs` checks that
+desktop app forwards from [`crates/openhuman-app/Cargo.toml`](../openhuman-app/Cargo.toml) (it disables
+default features). [`scripts/ci/check-feature-forwarding.mjs`](../../scripts/ci/check-feature-forwarding.mjs) checks that
forwarding, and the library chain (`openhuman-embed`, then
`openhuman-tinyhumans`, then `openhuman-cli`).
@@ -238,7 +238,7 @@ Gates come in two shapes. A leaf gate removes the module (`hosting`, `media`,
of its contents inside its own `mod.rs` (`channels`, `mcp`, `skills`,
`voice`, `web3`, `runtime-node`). Several facades also swap in a `stub.rs`
with matching signatures so always-on callers need no `#[cfg]` (`web3` and
-its `wallet` and `x402` members, `skills`, `voice`, `runtime/node`). Stub
+its `wallet` and `x402` members, `skills`, `voice`, [`runtime/node`](./src/runtime/node/)). Stub
drift is only caught by `cargo check --no-default-features`. Every compile-time gate
composes with the matching runtime `DomainSet` flag. The kernel floor profile
is `--no-default-features --features flows`. Read the policy comments above
@@ -247,15 +247,15 @@ enabled and disabled builds.
## Boundaries
-- No binaries. `crates/openhuman-cli` declares `openhuman-core`,
+- No binaries. [`crates/openhuman-cli`](../openhuman-cli/) declares `openhuman-core`,
`test-mcp-stub`, `openhuman-fleet`, `rss-bench`, `library-profile`, and the
tool benches, plus every root `tests/*.rs` and `examples/*.rs` target. See
[`../openhuman-cli/src/bin/README.md`](../openhuman-cli/src/bin/README.md).
- No JSON-RPC server, no HTTP client for RPC, no session store:
- `crates/openhuman-rpc`.
-- No backend URLs, SDK, login, or `/auth/*` calls: `crates/openhuman-tinyhumans`.
+ [`crates/openhuman-rpc`](../openhuman-rpc/).
+- No backend URLs, SDK, login, or `/auth/*` calls: [`crates/openhuman-tinyhumans`](../openhuman-tinyhumans/).
The core only accepts a credential through `auth.set_credential`.
-- No windows or native shell integration: `crates/openhuman-app`.
+- No windows or native shell integration: [`crates/openhuman-app`](../openhuman-app/).
- Agent loop, tool-call parsing, sessions and transcripts, the `Tool` trait,
provider wire formats, memory engines, channel backends, wallet signing,
search providers, and hosting providers belong to their `vendor/tiny*`
@@ -282,7 +282,7 @@ with explicit `[[test]]` and `[[example]]` entries, except
`required-features` and are skipped, not failed, under the contributor set;
run them with the product features. A suite that boots the core in-process
and reaches the mock backend must call `tinyhumans_boot::boot()` from
-`tests/support/tinyhumans_boot.rs` first.
+[`tests/support/tinyhumans_boot.rs`](../../tests/support/tinyhumans_boot.rs) first.
Further reading:
[`gitbooks/developing/architecture.md`](../../gitbooks/developing/architecture.md),
diff --git a/crates/openhuman-core/src/agent/README.md b/crates/openhuman-core/src/agent/README.md
index d2e1b38f4c..07e1b36e28 100644
--- a/crates/openhuman-core/src/agent/README.md
+++ b/crates/openhuman-core/src/agent/README.md
@@ -53,11 +53,11 @@ is adapters that hand TinyAgents the things only OpenHuman knows.
There are two ways into a turn. The stateful one is `OpenHumanSessionHost`
(re-exported from `crate::agent`), which owns one conversation, resumes it
from its transcript, and is what web chat, cron, flows, MCP and voice use.
-The stateless one is the `agent.run_turn` native bus handler in `bus.rs`:
+The stateless one is the `agent.run_turn` native bus handler in [`bus.rs`](./bus.rs):
the caller passes the whole history, the tool registry and a
`TurnModelSource` as owned Rust values in an `AgentTurnRequest` and gets an
`AgentTurnResponse` back. Channel runtimes
-(`channels/runtime/dispatch/processor/turn.rs`) and the triage evaluator use
+([`channels/runtime/dispatch/processor/turn.rs`](../channels/runtime/dispatch/processor/turn.rs)) and the triage evaluator use
the bus path because they keep their own history.
### A chat turn, end to end
@@ -99,19 +99,19 @@ In order:
`AgentDefinition` for the agent id, picks its model and provider role,
assembles the tool registry, and wires the `ContextManager`,
`ToolPolicy`, run queue and progress sender. Web chat caches one host per
- thread (`web_chat/session.rs`); cron builds one per job.
-2. The caller scopes an `AgentTurnOrigin` (`turn_origin.rs`) and calls
+ thread ([`web_chat/session.rs`](../web_chat/session.rs)); cron builds one per job.
+2. The caller scopes an `AgentTurnOrigin` ([`turn_origin.rs`](./turn_origin.rs)) and calls
`run_single_with_origin`. The origin (`WebChat`, `ExternalChannel`,
`TrustedAutomation`, `Cli`, `DirectChat`, `Unknown`) is what the approval
gate reads to decide trust. `run_single_with_origin` runs the
prompt-injection guard from `security::prompt_injection`, publishes
`DomainEvent::AgentTurnStarted`, and calls `turn_with_origin`.
3. `turn_with_origin` stages any attachments, builds the explicit per-turn
- carrier `OpenHumanRunContext` (`tinyagents/host/run_context.rs`), and
+ carrier `OpenHumanRunContext` ([`tinyagents/host/run_context.rs`](./tinyagents/host/run_context.rs)), and
resumes the conversation if it is bound to a `SessionRef` with
`ResumeMode::Session`. On resume it adopts the recorded tool list so
Composio actions the thread used before are rebuilt as deferred executors
- (`session_host/recorded_tools.rs`).
+ ([`session_host/recorded_tools.rs`](./session_host/recorded_tools.rs)).
4. TinyAgents' `Session::turn` runs the lifecycle. Its `before_turn` hook
(`OpenHumanSessionHooks`) prepares the request: system prompt (frozen
for a resumed thread), per-turn memory pack, integration, MCP and skill
@@ -123,7 +123,7 @@ In order:
`ChatModel` set from `TurnModelSource`, resolves the context window, and
calls `run_chat_turn_graph`, which calls
`run_root_turn_via_hosted_agent`.
-6. `assemble_turn_harness` (`tinyagents/harness_assembly.rs`) registers the
+6. `assemble_turn_harness` ([`tinyagents/harness_assembly.rs`](./tinyagents/harness_assembly.rs)) registers the
models, the tools (through `CanonicalSharedToolAdapter`) and the
middleware stack: approval and security gating, tool policy, cost
budget, tool-output capping and summarization, credential scrubbing,
@@ -132,17 +132,17 @@ In order:
runs: model call, parse tool calls, run them through middleware, append
results, repeat until the model answers or a cap is hit.
7. Every harness `AgentEvent` goes through `OpenhumanEventBridge`
- (`tinyagents/observability/event_bridge.rs`), which turns it into an
- `AgentProgress` value (`progress.rs`) on the session's `on_progress`
+ ([`tinyagents/observability/event_bridge.rs`](./tinyagents/observability/event_bridge.rs)), which turns it into an
+ `AgentProgress` value ([`progress.rs`](./progress.rs)) on the session's `on_progress`
channel and feeds usage to `platform::cost`. Web chat forwards that
- stream to the socket in `web_chat/progress_bridge.rs`. A `TurnJournal`
- (`tinyagents/journal.rs`) writes the same events to a durable JSONL
+ stream to the socket in [`web_chat/progress_bridge.rs`](../web_chat/progress_bridge.rs). A `TurnJournal`
+ ([`tinyagents/journal.rs`](./tinyagents/journal.rs)) writes the same events to a durable JSONL
store that the replay RPCs read.
8. If the loop paused at its model-call cap without a conclusion, the driver
runs a tools-disabled grounded close
- (`session_host/driver/grounded_close.rs`).
+ ([`session_host/driver/grounded_close.rs`](./session_host/driver/grounded_close.rs)).
9. The runtime commits the turn. `OpenHumanTranscriptCodec`
- (`session_host/codec.rs`) converts between durable `TranscriptMessage`
+ ([`session_host/codec.rs`](./session_host/codec.rs)) converts between durable `TranscriptMessage`
rows and model `Message`s. After the durable commit, the host publishes
`ConversationTurnCommitted` for memory ingest, optionally dual-writes
the legacy session format (`session_import::live`), and accounts usage
@@ -152,7 +152,7 @@ In order:
The bus path is shorter. `bus.rs` scopes the origin, sandbox mode and file
state agent id, then calls `harness::run_channel_turn_via_graph`
-(`harness/graph.rs`), which calls `run_turn_via_tinyagents_shared`. There is
+([`harness/graph.rs`](./harness/graph.rs)), which calls `run_turn_via_tinyagents_shared`. There is
no TinyAgents `Session`: the caller owns the history vector, and
`ask_user_clarification` is an early-exit tool whose question becomes the
reply.
@@ -178,7 +178,7 @@ its `AgentStores`. See [session_host/README.md](session_host/README.md).
### Sub-agents and orchestration
A parent agent delegates by calling a tool. `spawn_subagent`
-(`orchestration/tools/spawn_subagent.rs`) and its siblings
+([`orchestration/tools/spawn_subagent.rs`](./orchestration/tools/spawn_subagent.rs)) and its siblings
(`spawn_async_subagent`, `spawn_parallel_agents`, `continue_subagent`,
`steer_subagent`, `wait_subagent`, `close_subagent`, `delegate`) look up the
target `AgentDefinition` and call `subagent_host::run_subagent_with_parent`.
@@ -209,7 +209,7 @@ cheaper model. Its progress shows up on the parent's channel as
other `Subagent*` variants. Spawn depth is capped by
`harness::MAX_SPAWN_DEPTH`. Detached runs are tracked through TinyAgents'
`DetachedTaskRegistry` and can be steered through the shared
-`SteeringRegistry` (`tinyagents/host/steering.rs`).
+`SteeringRegistry` ([`tinyagents/host/steering.rs`](./tinyagents/host/steering.rs)).
`orchestration/` is the larger control plane on top of that: agent teams,
the command center, declarative workflow runs, git worktrees for parallel
@@ -219,13 +219,13 @@ coding workers, and background completion delivery. See
### Agent definitions, registry and prompts
-An `AgentDefinition` (`harness/definition/`) is an archetype: id, tier,
+An `AgentDefinition` ([`harness/definition/`](./harness/definition/)) is an archetype: id, tier,
prompt source, model spec, `ToolScope`, `SandboxMode`, iteration policy and
allowed sub-agents. Built-ins live in `registry/agents/<id>/` as an
`agent.toml` plus `prompt.md` (orchestrator, planner, critic, summarizer,
trigger_triage, trigger_reactor, vision_agent and others). Custom
definitions are TOML files under `<workspace>/agents/*.toml`, with
-`~/.openhuman/agents/*.toml` as a fallback (`harness/definition_loader.rs`).
+`~/.openhuman/agents/*.toml` as a fallback ([`harness/definition_loader.rs`](./harness/definition_loader.rs)).
`AgentDefinitionRegistry` holds the merged set; `agent.reload_definitions`
rebuilds it.
@@ -266,19 +266,19 @@ Turn execution:
| `harness/` | Agent definitions and loader, parent/fork context task-locals, sandbox and spawn-depth context, oversized tool-result artifacts, the channel/CLI turn graph ([README](harness/README.md)) |
| `bus.rs` | The `agent.run_turn` native request handler (`AgentTurnRequest` to `AgentTurnResponse`) |
| `progress.rs` | `AgentProgress`, the event enum every turn streams to its observer |
-| `progress_sink.rs` | Task-local progress sink for in-process embedders driving an RPC that returns only text |
-| `progress_tracing.rs`, `progress_tracing/` | OpenTelemetry/Langfuse-style spans built from the progress stream ([README](progress_tracing/README.md)) |
+| [`progress_sink.rs`](./progress_sink.rs) | Task-local progress sink for in-process embedders driving an RPC that returns only text |
+| [`progress_tracing.rs`](./progress_tracing.rs), `progress_tracing/` | OpenTelemetry/Langfuse-style spans built from the progress stream ([README](progress_tracing/README.md)) |
| `turn_origin.rs` | `AgentTurnOrigin` task-local, the trust and routing label the approval gate reads |
-| `turn_workspace.rs` | Task-local per-turn filesystem root an embedder binds one turn to |
-| `stop_hooks.rs` | `StopHook` mid-turn halts and the scoped `with_tool_call_limit` budget |
-| `tool_policy.rs` | `ToolPolicy`, the pre-execution allow/deny hook installed through the builder |
-| `hooks.rs` | `PostTurnHook` background hooks, including ones registered by embedders |
-| `queued_turn.rs` | `QueuedTurn`, the payload for a message sent while a turn is running |
-| `error.rs` | `AgentError`, typed retryable and permanent loop errors |
-| `cost.rs` | Per-turn token and cost accounting (`TurnCost`) |
-| `message_convert.rs`, `messages.rs` | Conversions between `TranscriptMessage` rows and TinyAgents `Message`s; the `history_wire` adapter for host-owned files |
-| `attachments/`, `multimodal.rs` | Durable user uploads and provider-side attachment resolution; legacy marker compatibility ([README](attachments/README.md)) |
-| `host_runtime.rs`, `platform_shell.rs` | Native and Docker shell `RuntimeAdapter`s and the shared `cmd.exe` vs `sh` selection |
+| [`turn_workspace.rs`](./turn_workspace.rs) | Task-local per-turn filesystem root an embedder binds one turn to |
+| [`stop_hooks.rs`](./stop_hooks.rs) | `StopHook` mid-turn halts and the scoped `with_tool_call_limit` budget |
+| [`tool_policy.rs`](./tool_policy.rs) | `ToolPolicy`, the pre-execution allow/deny hook installed through the builder |
+| [`hooks.rs`](./hooks.rs) | `PostTurnHook` background hooks, including ones registered by embedders |
+| [`queued_turn.rs`](./queued_turn.rs) | `QueuedTurn`, the payload for a message sent while a turn is running |
+| [`error.rs`](./error.rs) | `AgentError`, typed retryable and permanent loop errors |
+| [`cost.rs`](./cost.rs) | Per-turn token and cost accounting (`TurnCost`) |
+| [`message_convert.rs`](./message_convert.rs), [`messages.rs`](./messages.rs) | Conversions between `TranscriptMessage` rows and TinyAgents `Message`s; the `history_wire` adapter for host-owned files |
+| `attachments/`, [`multimodal.rs`](./multimodal.rs) | Durable user uploads and provider-side attachment resolution; legacy marker compatibility ([README](attachments/README.md)) |
+| [`host_runtime.rs`](./host_runtime.rs), [`platform_shell.rs`](./platform_shell.rs) | Native and Docker shell `RuntimeAdapter`s and the shared `cmd.exe` vs `sh` selection |
| `session_store/` | Process-wide `SessionStoreProvider` slot for hosts with their own database |
Delegation and coordination:
@@ -291,16 +291,16 @@ Delegation and coordination:
| `goals/` | Host adapters around `tinyagents_graph::goals` and the `goal_*` tools ([README](goals/README.md)) |
| `todos/` | Session-scoped todo list over the TinyAgents todo store ([README](todos/README.md)) |
| `plan_review/` | `request_plan_review` gate that parks a web-chat turn until the user decides |
-| `tools.rs`, `tools/` | Loop control tools: `delegate`, `plan_exit`, `todo`, `run_workflow`/`await_workflow` (with `skills`) ([README](tools/README.md)) |
+| [`tools.rs`](./tools.rs), `tools/` | Loop control tools: `delegate`, `plan_exit`, `todo`, `run_workflow`/`await_workflow` (with `skills`) ([README](tools/README.md)) |
Definitions, prompts and context:
| Path | What it does |
| --- | --- |
-| `registry/` | `agent_registry` RPC; built-in archetypes under `registry/agents/` ([README](registry/README.md)) |
+| `registry/` | `agent_registry` RPC; built-in archetypes under [`registry/agents/`](./registry/agents/) ([README](registry/README.md)) |
| `prompts/` | Bundled identity files, `SystemPromptBuilder`, prompt sections ([README](prompts/README.md)) |
| `context/` | `ContextManager` per session and the channel prompt builder ([README](context/README.md)) |
-| `context_breakdown.rs` | `agent.context_breakdown`: system/tools/history split of prompt size for the UI |
+| [`context_breakdown.rs`](./context_breakdown.rs) | `agent.context_breakdown`: system/tools/history split of prompt size for the UI |
| `debug/` | Dumps the exact system prompt and prompt-size report for an agent |
| `library/` | Display-safe projection of definitions (`AgentDefinitionDisplay`) |
@@ -312,23 +312,23 @@ Persistence, setup and RPC:
| `session_db/` | `run_ledger` RPC over `tinyagents_session::run_ledger` |
| `session_import/` | One-time import of legacy session files and the optional live dual-write ([README](session_import/README.md)) |
| `harness_init/` | First-run provisioning (Python, spaCy, Kompress, Node) ([README](harness_init/README.md)) |
-| `schemas.rs` | The `agent` namespace controllers |
+| [`schemas.rs`](./schemas.rs) | The `agent` namespace controllers |
## Key types and entry points
-- `OpenHumanSessionHost` (`session_host/types.rs`): one conversation.
+- `OpenHumanSessionHost` ([`session_host/types.rs`](./session_host/types.rs)): one conversation.
Construct with `from_config`, `from_config_for_agent` or
- `from_config_with_definition` (`session_host/builder/factory.rs`), or the
+ `from_config_with_definition` ([`session_host/builder/factory.rs`](./session_host/builder/factory.rs)), or the
`SessionHostBuilder` fluent API. Drive with `run_single` or
- `run_single_with_origin` (`session_host/runtime/run_loop.rs`).
+ `run_single_with_origin` ([`session_host/runtime/run_loop.rs`](./session_host/runtime/run_loop.rs)).
`TurnOverrides` adjusts the next turn only.
- `AgentTurnRequest` / `AgentTurnResponse` and `AGENT_RUN_TURN_METHOD`
(`bus.rs`): the stateless turn over `BUS.native()`.
`register_agent_handlers` installs it at startup.
-- `TurnModelSource` (`tinyagents/turn_models.rs`): builds a turn's primary,
+- `TurnModelSource` ([`tinyagents/turn_models.rs`](./tinyagents/turn_models.rs)): builds a turn's primary,
tier-routed and summarizer `ChatModel`s from `(role, config)`.
- `run_turn_via_tinyagents_shared` and `run_root_turn_via_hosted_agent`
- (`tinyagents/turn_runner.rs`): the only places a harness is invoked.
+ ([`tinyagents/turn_runner.rs`](./tinyagents/turn_runner.rs)): the only places a harness is invoked.
- `OpenHumanRunContext` (`tinyagents/host/run_context.rs`): the explicit
per-turn carrier (origin, progress, thread, workspace, cancellation, stop
hooks) passed into TinyAgents and down to recursive tools.
@@ -336,40 +336,40 @@ Persistence, setup and RPC:
deltas, cost updates and the `Subagent*` family.
- `AgentDefinition`, `AgentDefinitionRegistry`, `ToolScope`, `SandboxMode`
(`harness/definition/`): what an agent is.
-- `ParentExecutionContext` (`harness/fork_context.rs`): task-local parent
+- `ParentExecutionContext` ([`harness/fork_context.rs`](./harness/fork_context.rs)): task-local parent
state a sub-agent reads; `orchestration::parent_context::build_root_parent`
builds one for runs with no parent turn.
- `run_subagent`, `run_subagent_with_parent`, `SubagentRunOptions`
- (`subagent_host/lifecycle.rs`, `subagent_host/types.rs`).
+ ([`subagent_host/lifecycle.rs`](./subagent_host/lifecycle.rs), [`subagent_host/types.rs`](./subagent_host/types.rs)).
- `run_triage`, `apply_decision`, `TriggerEnvelope` (`triage/`).
-- `SystemPromptBuilder` (`prompts/builder.rs`).
+- `SystemPromptBuilder` ([`prompts/builder.rs`](./prompts/builder.rs)).
- `AgentTurnOrigin` and `with_origin` (`turn_origin.rs`).
## RPC surface
-All controllers register under `DomainGroup::Agent` in `core/all.rs`.
+All controllers register under `DomainGroup::Agent` in [`core/all.rs`](../core/all.rs).
| Namespace | Owner | Methods |
| --- | --- | --- |
| `agent` | `schemas.rs` | `chat`, `chat_simple`, `server_status`, `list_definitions`, `get_definition`, `reload_definitions`, `triage_evaluate`, `graph_topologies`, `registry_snapshot`, `context_breakdown` |
-| `agent` | `tinyagents/replay/` | `runs_active`, `run_status`, `run_events` (read-only journal replay) |
-| `agent` | `tinyagents/run_mode.rs` | `set_run_mode`, `get_run_mode` |
+| `agent` | [`tinyagents/replay/`](./tinyagents/replay/) | `runs_active`, `run_status`, `run_events` (read-only journal replay) |
+| `agent` | [`tinyagents/run_mode.rs`](./tinyagents/run_mode.rs) | `set_run_mode`, `get_run_mode` |
| `agent_registry` | `registry/` | `list`, `available_tools`, `get`, `upsert_custom`, `create_custom`, `update`, `set_enabled`, `remove` |
| `harness_init` | `harness_init/` | `status`, `run` |
| `plan_review` | `plan_review/` | `decide` |
| `ai` | `artifacts/` | `list_artifacts`, `get_artifact`, `delete_artifact`, `regenerate` |
| `run_ledger` | `session_db/` | `list`, `get`, `events` |
| `session_import` | `session_import/` | `run` |
-| `agent_work` | `orchestration/command_center` | `list`, `control` |
-| `workflow_run` | `orchestration/workflow_runs` | `list_definitions`, `list`, `get`, `start`, `stop`, `resume` |
-| `agent_team` | `orchestration/agent_teams` | `create`, `list`, `get`, `assign_task`, `claim_task`, `message_member`, `list_messages`, `complete_task`, `shutdown_member`, `close`, `start_member` |
-| `worktree` | `orchestration/worktree_schemas.rs` | `list`, `status`, `diff`, `remove` |
-| `subagent` | `orchestration/subagent_control.rs` | `cancel`, `steer` for running sub-agents |
+| `agent_work` | [`orchestration/command_center`](./orchestration/command_center/) | `list`, `control` |
+| `workflow_run` | [`orchestration/workflow_runs`](./orchestration/workflow_runs/) | `list_definitions`, `list`, `get`, `start`, `stop`, `resume` |
+| `agent_team` | [`orchestration/agent_teams`](./orchestration/agent_teams/) | `create`, `list`, `get`, `assign_task`, `claim_task`, `message_member`, `list_messages`, `complete_task`, `shutdown_member`, `close`, `start_member` |
+| `worktree` | [`orchestration/worktree_schemas.rs`](./orchestration/worktree_schemas.rs) | `list`, `status`, `diff`, `remove` |
+| `subagent` | [`orchestration/subagent_control.rs`](./orchestration/subagent_control.rs) | `cancel`, `steer` for running sub-agents |
`agent.chat` and `agent.chat_simple` load config and call
`inference::host_runtime::rpc::agent_chat` / `agent_chat_simple`, which
build an `OpenHumanSessionHost`. `chat_simple` is a bare provider call with
-no tools. The JSON-RPC server itself is in `crates/openhuman-rpc`.
+no tools. The JSON-RPC server itself is in [`crates/openhuman-rpc`](../../../openhuman-rpc/).
## Boundaries
@@ -379,10 +379,10 @@ What lives elsewhere:
resume, compaction generations, run queues, steering, the run ledger, the
sub-agent lifecycle, goals and todos stores, and generic middleware (context
compression, microcompact, final-call wrap-up, arg recovery) belong to
- `vendor/tinyagents` (`tinyagents-runtime`, `-session`, `-harness`,
+ [`vendor/tinyagents`](../../../../vendor/tinyagents/) (`tinyagents-runtime`, `-session`, `-harness`,
`-graph`, `-orchestration`). A bug there is fixed upstream, not worked
around here.
-- The `Tool` trait and tool types are in `vendor/tinyagents/vendor/tinytools`.
+- The `Tool` trait and tool types are in [`vendor/tinyagents/vendor/tinytools`](../../../../vendor/tinyagents/vendor/tinytools/).
`ChatModel`, providers and message types are in `tinyinference`.
- Tool implementations are in `crate::tools` and the owning domains. This
folder only owns the loop-control tools in `tools/` and the orchestration
@@ -410,8 +410,8 @@ What lives elsewhere:
- A resumed thread's prompt and tools are frozen. Testing a prompt change
needs a new thread.
- `agent.run_turn` must be registered before channels dispatch.
- `register_agent_handlers` runs from `channels/runtime/startup/start_channels.rs`
- and `core/runtime/subscribers.rs`; tests that replace the handler restore
+ `register_agent_handlers` runs from [`channels/runtime/startup/start_channels.rs`](../channels/runtime/startup/start_channels.rs)
+ and [`core/runtime/subscribers.rs`](../core/runtime/subscribers.rs); tests that replace the handler restore
it through the guard in `bus.rs`.
- `stop_hooks::with_tool_call_limit(Some(n), turn)` narrows the TinyAgents
invocation budget for one awaited turn, including parallel calls. Zero
@@ -424,12 +424,12 @@ What lives elsewhere:
## Tests
Unit tests sit beside their modules as `*_tests.rs` (for example
-`agent_tests.rs`, `bus_tests.rs`, `schemas_tests.rs` with
+[`agent_tests.rs`](./agent_tests.rs), [`bus_tests.rs`](./bus_tests.rs), [`schemas_tests.rs`](./schemas_tests.rs) with
`controller_schema_inventory_is_stable`, and the suites under
`session_host/`, `tinyagents/`, `subagent_host/`, `triage/`). Run them with
`cargo test -p openhuman agent::` or `pnpm debug rust agent::`.
-Integration coverage is in `tests/agent_harness_e2e.rs`
+Integration coverage is in [`tests/agent_harness_e2e.rs`](../../../../tests/agent_harness_e2e.rs)
(`cargo test -p openhuman-cli --test agent_harness_e2e`) and in
`tests/in_process/agent_*.rs`, aggregated into the `in_process_all` target.
diff --git a/crates/openhuman-core/src/agent/artifacts/README.md b/crates/openhuman-core/src/agent/artifacts/README.md
index af6e6c1b80..00d0d24610 100644
--- a/crates/openhuman-core/src/agent/artifacts/README.md
+++ b/crates/openhuman-core/src/agent/artifacts/README.md
@@ -5,7 +5,7 @@ documents, images, video). Metadata lives in the hidden, per-account
`<workspace_dir>/artifacts/`; the files themselves are written to a visible
files folder, `~/OpenHuman/projects/Files` by default
(`config::default_files_dir`, #5505). Producer tools
-(`tools/impl/presentation`, `tools/impl/document`, `media::generation`) call
+([`tools/impl/presentation`](../../tools/impl/presentation/), [`tools/impl/document`](../../tools/impl/document/), `media::generation`) call
this module to reserve an artifact and its file, write their bytes, and flip the record to
`Ready` or `Failed`; the module publishes the matching bus events, persists
`meta.json` / `args.json`, and exposes `ai.*` RPC controllers plus three
@@ -16,14 +16,14 @@ renders artifact content itself.
| File | Role |
| --- | --- |
-| `mod.rs` | `mod` decls and re-exports: `ArtifactKind` / `ArtifactMeta` / `ArtifactStatus`, the producer API (`create_artifact`, `finalize_artifact`, `fail_artifact`, `read_artifact_bytes`), and `all_artifacts_controller_schemas` / `all_artifacts_registered_controllers`. |
-| `types.rs` | `ArtifactKind` (presentation/document/image/other), `ArtifactStatus` (pending/ready/failed), `ArtifactMeta`. Enums serialize lowercase; `parse` is case-insensitive and never errors (unknown kind → `Other`, unknown status → `Pending`). `ArtifactMeta.error` and `.thread_id` are optional, `skip_serializing_if` none. |
-| `files.rs` | Where the bytes live: `reserve_file` (claims `<stem>.<ext>`, then `<stem> (2).<ext>`, with `create_new` in the shared files folder), `resolve_file` + the escape guard, `resolve_ready_file` (`pub`: the one id → existing-file lookup for readers and the desktop Download command), `remove_empty_placeholder`, the "file missing" error. |
-| `migrate.rs` | `migrate_legacy_artifacts`: the idempotent, crash-safe boot move of pre-#5505 files into the files folder (copy to `.<id>.partial` → claim a name and rename → atomic meta write → delete legacy bytes). Run per account from `config::ensure_agent_dirs`. |
-| `store.rs` | All filesystem I/O over `tokio::fs`: `artifacts_root`, `create_artifact`, `finalize_artifact`, `fail_artifact`, `read_artifact_bytes` (`pub`); `save_artifact_meta`, `save_artifact_args`, `read_artifact_args`, `list_artifacts`, `get_artifact`, `delete_artifact` (`pub(crate)`); `validate_artifact_id` / `assert_within_root` sandboxing; the `REGENERATE_TARGET_ID` task-local; `sanitize_filename_stem`. |
-| `ops.rs` | RPC business logic returning `Outcome<Value>`: `ai_list_artifacts`, `ai_get_artifact`, `ai_delete_artifact`, `ai_regenerate`. `DEFAULT_LIMIT = 50`, `MAX_LIMIT = 200`. The regenerate path that re-runs `PresentationTool` is `#[cfg(feature = "documents")]`; without the feature `ai_regenerate` returns an error. |
-| `schemas.rs` | `ControllerSchema`s and `handle_*` fns for the four `ai.*` controllers; param helpers `read_required`, `read_optional_u64`, `read_optional_string` (whitespace-only → absent), `type_name`. |
-| `tools.rs` | `ArtifactListTool`, `ArtifactGetTool`, `ArtifactDeleteTool`: shims over `ops` that unwrap the `Outcome` and return `outcome.value` as the `ToolResult` string. |
+| [`mod.rs`](./mod.rs) | `mod` decls and re-exports: `ArtifactKind` / `ArtifactMeta` / `ArtifactStatus`, the producer API (`create_artifact`, `finalize_artifact`, `fail_artifact`, `read_artifact_bytes`), and `all_artifacts_controller_schemas` / `all_artifacts_registered_controllers`. |
+| [`types.rs`](./types.rs) | `ArtifactKind` (presentation/document/image/other), `ArtifactStatus` (pending/ready/failed), `ArtifactMeta`. Enums serialize lowercase; `parse` is case-insensitive and never errors (unknown kind → `Other`, unknown status → `Pending`). `ArtifactMeta.error` and `.thread_id` are optional, `skip_serializing_if` none. |
+| [`files.rs`](./files.rs) | Where the bytes live: `reserve_file` (claims `<stem>.<ext>`, then `<stem> (2).<ext>`, with `create_new` in the shared files folder), `resolve_file` + the escape guard, `resolve_ready_file` (`pub`: the one id → existing-file lookup for readers and the desktop Download command), `remove_empty_placeholder`, the "file missing" error. |
+| [`migrate.rs`](./migrate.rs) | `migrate_legacy_artifacts`: the idempotent, crash-safe boot move of pre-#5505 files into the files folder (copy to `.<id>.partial` → claim a name and rename → atomic meta write → delete legacy bytes). Run per account from `config::ensure_agent_dirs`. |
+| [`store.rs`](./store.rs) | All filesystem I/O over `tokio::fs`: `artifacts_root`, `create_artifact`, `finalize_artifact`, `fail_artifact`, `read_artifact_bytes` (`pub`); `save_artifact_meta`, `save_artifact_args`, `read_artifact_args`, `list_artifacts`, `get_artifact`, `delete_artifact` (`pub(crate)`); `validate_artifact_id` / `assert_within_root` sandboxing; the `REGENERATE_TARGET_ID` task-local; `sanitize_filename_stem`. |
+| [`ops.rs`](./ops.rs) | RPC business logic returning `Outcome<Value>`: `ai_list_artifacts`, `ai_get_artifact`, `ai_delete_artifact`, `ai_regenerate`. `DEFAULT_LIMIT = 50`, `MAX_LIMIT = 200`. The regenerate path that re-runs `PresentationTool` is `#[cfg(feature = "documents")]`; without the feature `ai_regenerate` returns an error. |
+| [`schemas.rs`](./schemas.rs) | `ControllerSchema`s and `handle_*` fns for the four `ai.*` controllers; param helpers `read_required`, `read_optional_u64`, `read_optional_string` (whitespace-only → absent), `type_name`. |
+| [`tools.rs`](./tools.rs) | `ArtifactListTool`, `ArtifactGetTool`, `ArtifactDeleteTool`: shims over `ops` that unwrap the `Outcome` and return `outcome.value` as the `ToolResult` string. |
| `*_tests.rs` | Sibling test files for each of the above (`#[path]`). |
## Public surface
@@ -39,9 +39,9 @@ renders artifact content itself.
## RPC / controllers
-Namespace `ai`. Registered in `core/all.rs` under `DomainGroup::Agent` via
+Namespace `ai`. Registered in [`core/all.rs`](../../core/all.rs) under `DomainGroup::Agent` via
`all_artifacts_registered_controllers()`; `all_artifacts_controller_schemas()`
-is used by `schemas_tests.rs` to check every function has a schema and a
+is used by [`schemas_tests.rs`](./schemas_tests.rs) to check every function has a schema and a
handler. Handlers load config through `config::rpc::load_config_with_timeout()`
and trim string params.
@@ -62,14 +62,14 @@ When `thread_id` is given to `list_artifacts`, legacy records with no
## Agent tools
-Constructed in `tools/ops.rs` (unconditionally) and re-exported through
-`tools/mod.rs` (`pub use crate::agent::artifacts::tools::*`).
+Constructed in [`tools/ops.rs`](../../tools/ops.rs) (unconditionally) and re-exported through
+[`tools/mod.rs`](../../tools/mod.rs) (`pub use crate::agent::artifacts::tools::*`).
| Tool | Permission | Behavior |
| --- | --- | --- |
| `artifact_list` | default | `ops::ai_list_artifacts(.., thread_id = None)`: always the whole workspace; the per-thread filter is RPC-only. `offset` / `limit` args. Concurrency-safe. |
| `artifact_get` | default | `ops::ai_get_artifact`; `artifact_id` required. Concurrency-safe. |
-| `artifact_delete` | `Dangerous` | `ops::ai_delete_artifact`. Default-OFF: listed as its own `ToolFamily` (`id: "artifact_delete"`, `default_enabled: false`) in `TOOL_FAMILIES` in `tools/user_filter.rs`; `artifact_list` / `artifact_get` are deliberately not in that map so they cannot be toggled off. |
+| `artifact_delete` | `Dangerous` | `ops::ai_delete_artifact`. Default-OFF: listed as its own `ToolFamily` (`id: "artifact_delete"`, `default_enabled: false`) in `TOOL_FAMILIES` in [`tools/user_filter.rs`](../../tools/user_filter.rs); `artifact_list` / `artifact_get` are deliberately not in that map so they cannot be toggled off. |
There is no regenerate tool; regeneration is RPC-only.
@@ -85,7 +85,7 @@ subscribes to nothing):
All three carry `thread_id` / `client_id` read from the
`security::approval::APPROVAL_CHAT_CONTEXT` task-local; outside a chat turn
(CLI, cron, sub-agents) both are `None` and the
-`web_chat::artifact_surface` subscriber (`web_chat/event_bus.rs`) drops the
+`web_chat::artifact_surface` subscriber ([`web_chat/event_bus.rs`](../../web_chat/event_bus.rs)) drops the
event.
## Persistence
@@ -119,13 +119,13 @@ event.
## Used by
-- `tools/impl/presentation/mod.rs` and `tools/impl/document/mod.rs`
+- [`tools/impl/presentation/mod.rs`](../../tools/impl/presentation/mod.rs) and [`tools/impl/document/mod.rs`](../../tools/impl/document/mod.rs)
(`documents` feature; in `scripts/ci/product-features.txt`, not in Cargo
- defaults), and `media/generation/artifact_tool.rs`: the producers.
+ defaults), and [`media/generation/artifact_tool.rs`](../../media/generation/artifact_tool.rs): the producers.
Presentation also uses `read_artifact_bytes` for its image pipeline.
-- `config/ops/agent.rs` (`ensure_agent_dirs`): creates the files folder and
+- [`config/ops/agent.rs`](../../config/ops/agent.rs) (`ensure_agent_dirs`): creates the files folder and
runs the migration at boot.
-- `crates/openhuman-app/src/artifact_commands.rs`: the desktop Download
+- [`crates/openhuman-app/src/artifact_commands.rs`](../../../../openhuman-app/src/artifact_commands.rs): the desktop Download
command resolves an artifact id through `resolve_ready_file`.
- `web_chat/event_bus.rs`: bridges the three events to web-channel
`artifact_*` events.
diff --git a/crates/openhuman-core/src/agent/context/README.md b/crates/openhuman-core/src/agent/context/README.md
index 7d96e42992..e2d2d7ee2c 100644
--- a/crates/openhuman-core/src/agent/context/README.md
+++ b/crates/openhuman-core/src/agent/context/README.md
@@ -2,25 +2,25 @@
Global context management for agent sessions: system-prompt assembly, per-session context bookkeeping (utilisation stats, budget configuration), and the shared microcompact constants. Agents hold one `ContextManager` per session. This is a **pure logic / state-tracking domain**: no RPC controllers, no agent tools, no event-bus subscribers, no persisted store.
-> **Status (#4249): live history reduction/summarization moved out of this directory.** The in-turn compaction that used to live here (`ContextManager::reduce_before_call`, the `Summarizer` trait, `ProviderSummarizer`, `SegmentRecapSummarizer`, `microcompact.rs`, `pipeline.rs`, `guard.rs`) is gone: see [History](#history-4249). Folding an over-budget transcript into a summary now runs as the vendored `tinyagents_harness::middleware::ContextCompressionMiddleware` (with the seam-owned `ImageAwareMessageTrimMiddleware` as the deterministic backstop) inside `run_turn_via_tinyagents_shared` (`agent/tinyagents/turn_runner.rs`), backed by `agent/tinyagents/summarize.rs::ModelSummarizer`. Tool-result body clearing runs in `tinyagents_harness::middleware::MicrocompactMiddleware`. `stats.rs` keeps the data model behind `ContextManager::stats()`.
+> **Status (#4249): live history reduction/summarization moved out of this directory.** The in-turn compaction that used to live here (`ContextManager::reduce_before_call`, the `Summarizer` trait, `ProviderSummarizer`, `SegmentRecapSummarizer`, `microcompact.rs`, `pipeline.rs`, `guard.rs`) is gone: see [History](#history-4249). Folding an over-budget transcript into a summary now runs as the vendored `tinyagents_harness::middleware::ContextCompressionMiddleware` (with the seam-owned `ImageAwareMessageTrimMiddleware` as the deterministic backstop) inside `run_turn_via_tinyagents_shared` ([`agent/tinyagents/turn_runner.rs`](../tinyagents/turn_runner.rs)), backed by `agent/tinyagents/summarize.rs::ModelSummarizer`. Tool-result body clearing runs in `tinyagents_harness::middleware::MicrocompactMiddleware`. [`stats.rs`](./stats.rs) keeps the data model behind `ContextManager::stats()`.
## Responsibilities
-- Maintain prompt-adjacent session state; system-prompt assembly lives in `agent::prompts`, while `channels_prompt.rs` provides the channel-specific builder.
+- Maintain prompt-adjacent session state; system-prompt assembly lives in `agent::prompts`, while [`channels_prompt.rs`](./channels_prompt.rs) provides the channel-specific builder.
- Track context-window utilisation per session (`ContextStatsState`).
-- Expose the configured per-tool-result byte budget and the compaction/microcompact/autocompact toggles the tinyagents turn reads; enforcement lives in `agent/tinyagents` (`ToolOutputMiddleware`, `MicrocompactMiddleware`, `ContextCompressionMiddleware`) and in `agent/harness/tool_result_artifacts`.
+- Expose the configured per-tool-result byte budget and the compaction/microcompact/autocompact toggles the tinyagents turn reads; enforcement lives in [`agent/tinyagents`](../tinyagents/) (`ToolOutputMiddleware`, `MicrocompactMiddleware`, `ContextCompressionMiddleware`) and in [`agent/harness/tool_result_artifacts`](../harness/tool_result_artifacts/).
- Expose the microcompact placeholder/keep-recent constants consumed by the microcompact middleware.
## Key files
| File | Role |
| --- | --- |
-| `crates/openhuman-core/src/agent/context/mod.rs` | Module docstring, `pub mod` decls, `pub use` re-exports, and the three shared constants (`DEFAULT_TOOL_RESULT_BUDGET_BYTES`, `CLEARED_PLACEHOLDER`, `DEFAULT_KEEP_RECENT_TOOL_RESULTS`). No other logic. |
-| `crates/openhuman-core/src/agent/context/manager.rs` | `ContextManager`: per-session handle agents hold. Owns the default prompt builder, `ContextStatsState`, and the `ContextConfig`-derived knobs. Surfaces `build_system_prompt` / `build_system_prompt_tiered`, `stats()`, the getters the tinyagents turn reads (`tool_result_budget_bytes`, `compaction_enabled`, `autocompact_enabled`, `microcompact_keep_recent`, `autocompact_enabled`, `compaction()` (trigger override and strategy), `prefer_markdown_tool_output`), and the session-memory trigger/mark methods. |
+| [`crates/openhuman-core/src/agent/context/mod.rs`](./mod.rs) | Module docstring, `pub mod` decls, `pub use` re-exports, and the three shared constants (`DEFAULT_TOOL_RESULT_BUDGET_BYTES`, `CLEARED_PLACEHOLDER`, `DEFAULT_KEEP_RECENT_TOOL_RESULTS`). No other logic. |
+| [`crates/openhuman-core/src/agent/context/manager.rs`](./manager.rs) | `ContextManager`: per-session handle agents hold. Owns the default prompt builder, `ContextStatsState`, and the `ContextConfig`-derived knobs. Surfaces `build_system_prompt` / `build_system_prompt_tiered`, `stats()`, the getters the tinyagents turn reads (`tool_result_budget_bytes`, `compaction_enabled`, `autocompact_enabled`, `microcompact_keep_recent`, `autocompact_enabled`, `compaction()` (trigger override and strategy), `prefer_markdown_tool_output`), and the session-memory trigger/mark methods. |
| `crates/openhuman-core/src/agent/context/stats.rs` | `ContextStatsState`: last provider usage, context-window utilisation, and the shared `SessionMemoryHandle` (`Arc<Mutex<SessionMemoryState>>`). Pure state; issues no LLM calls and does not mutate history. |
| `crates/openhuman-core/src/agent/context/session_memory.rs` | `SessionMemoryState` / `SessionMemoryConfig`: threshold-gated `should_extract` decision (token growth, tool calls, and turns must all cross) and extraction bookkeeping. Holds `ARCHIVIST_EXTRACTION_PROMPT`. State-tracking only; does not spawn the archivist. |
| `crates/openhuman-core/src/agent/context/channels_prompt.rs` | Bespoke free functions `build_system_prompt(...)` / `build_system_prompt_with_identity(...)` (plus `PromptIdentityOverride`, `ProjectContextPlacement`, `render_project_context`) for channel runtimes (Discord/Slack/Telegram/…). Byte-stable for prefix-cache hits; injects workspace bootstrap files (`SOUL.md`, `IDENTITY.md`, optional `PROFILE.md`/`MEMORY.md`, with profile overrides for `SOUL.md`/`MEMORY.md`), tools, safety, skills, runtime, and channel-capabilities sections. |
-| `crates/openhuman-core/src/agent/context/manager_tests.rs`, `channels_prompt_tests.rs`, `session_memory_tests.rs` | Sibling test files wired via `#[cfg(test)] #[path = "..."] mod tests;` from their source file (the layout check rejects inline test modules). |
+| [`crates/openhuman-core/src/agent/context/manager_tests.rs`](./manager_tests.rs), [`channels_prompt_tests.rs`](./channels_prompt_tests.rs), `session_memory_tests.rs` | Sibling test files wired via `#[cfg(test)] #[path = "..."] mod tests;` from their source file (the layout check rejects inline test modules). |
## History (#4249)
@@ -65,23 +65,23 @@ No `store.rs`. State is per-session and in-memory:
## Dependencies
-- `crate::config`: `ContextConfig` (`config/schema/context.rs`): `enabled`, `microcompact_enabled` / `microcompact_keep_recent`, `autocompact_enabled`, `compaction_trigger_tokens` (absolute summarization trigger for benchmarks; env `OPENHUMAN_COMPACTION_TRIGGER_TOKENS`), `compaction_strategy` (env `OPENHUMAN_COMPACTION_STRATEGY`), `compaction_enabled`, `tool_result_budget_bytes`, `prefer_markdown_tool_output`, `summarizer_model`, and the embedded `session_memory: SessionMemoryConfig`.
+- `crate::config`: `ContextConfig` ([`config/schema/context.rs`](../../config/schema/context.rs)): `enabled`, `microcompact_enabled` / `microcompact_keep_recent`, `autocompact_enabled`, `compaction_trigger_tokens` (absolute summarization trigger for benchmarks; env `OPENHUMAN_COMPACTION_TRIGGER_TOKENS`), `compaction_strategy` (env `OPENHUMAN_COMPACTION_STRATEGY`), `compaction_enabled`, `tool_result_budget_bytes`, `prefer_markdown_tool_output`, `summarizer_model`, and the embedded `session_memory: SessionMemoryConfig`.
- `crate::inference::provider::UsageInfo`: fed into `record_usage`.
- `crate::agent::prompts`: owns prompt rendering; `channels_prompt.rs` uses `inject_inline_content`.
- `crate::skills::Workflow`: `channels_prompt.rs` renders the available-skills section from a `&[Workflow]`.
## Used by
-- `agent::harness`: the primary consumer: `session/builder/builder_build.rs` constructs the `ContextManager`; `session/turn/core/harness_turn.rs` reads the budget/compaction getters into the tinyagents turn config; `session/turn/session_io/{transcript_persist,background_tasks}.rs` read `stats()`; `fork_context.rs` and `../subagent_host/` consume prompt types.
+- `agent::harness`: the primary consumer: `session/builder/builder_build.rs` constructs the `ContextManager`; `session/turn/core/harness_turn.rs` reads the budget/compaction getters into the tinyagents turn config; `session/turn/session_io/{transcript_persist,background_tasks}.rs` read `stats()`; `fork_context.rs` and [`../subagent_host/`](../subagent_host/) consume prompt types.
- `agent::tinyagents`: `harness_assembly.rs` reads `CLEARED_PLACEHOLDER` when configuring `MicrocompactMiddleware`; `payload_summarizer.rs` and `host/context_composer.rs` build `PromptContext`s through `agent::prompts`.
- **`agent::registry::agents/*/prompt.rs`**, `flows/agents/*/prompt.rs`, `skills/*/agent/*/prompt.rs`: archetype prompt modules pull prompt sections/builder through `agent::prompts`.
-- `channels`: `channels/system_prompt.rs` (`ChannelSystemPrompt`, used by `channels/runtime/startup/start_channels.rs`) calls `channels_prompt::build_system_prompt_with_identity`; `channels/mod.rs` re-exports `build_system_prompt`; the `channels/tests/*` prompt/identity tests call it directly.
+- `channels`: [`channels/system_prompt.rs`](../../channels/system_prompt.rs) (`ChannelSystemPrompt`, used by [`channels/runtime/startup/start_channels.rs`](../../channels/runtime/startup/start_channels.rs)) calls `channels_prompt::build_system_prompt_with_identity`; [`channels/mod.rs`](../../channels/mod.rs) re-exports `build_system_prompt`; the `channels/tests/*` prompt/identity tests call it directly.
- `agent::triage`, `agent::debug`, `agent::orchestration::tools` (spawn_subagent and friends), `tools::orchestrator_tools`, `integrations::composio`: consume prompt types (`PromptContext`, `PromptSection`, `ToolCallFormat`, `ConnectedIntegration`, …) via `agent::prompts`.
## Notes / gotchas
- **The context stats state issues no LLM calls and does not mutate history.** Live reduction is owned by the tinyagents middleware stack.
-- **Tool-result budgeting is not a context pipeline stage.** The tinyagents path applies per-result budgets in `ToolOutputMiddleware` (`agent/tinyagents/middleware/tool_output.rs`), and artifact-preview fallback truncation lives in `agent/harness/tool_result_artifacts`.
+- **Tool-result budgeting is not a context pipeline stage.** The tinyagents path applies per-result budgets in `ToolOutputMiddleware` ([`agent/tinyagents/middleware/tool_output.rs`](../tinyagents/middleware/tool_output.rs)), and artifact-preview fallback truncation lives in `agent/harness/tool_result_artifacts`.
- **`autocompact_enabled()` is `config.enabled && config.autocompact_enabled`**, and `microcompact_keep_recent()` is `0` when `microcompact_enabled` is off: the manager folds the config gates so the turn reads one value per knob.
- Prompt rendering does not belong in this module; add it to `agent::prompts`.
- **`channels_prompt::build_system_prompt` deliberately bypasses `SystemPromptBuilder`** to keep production channel prompt bytes stable for prefix-cache hits; it is a standalone free function despite living under `context/`.
diff --git a/crates/openhuman-core/src/agent/harness/README.md b/crates/openhuman-core/src/agent/harness/README.md
index 2744fed393..55cd2b343a 100644
--- a/crates/openhuman-core/src/agent/harness/README.md
+++ b/crates/openhuman-core/src/agent/harness/README.md
@@ -7,14 +7,14 @@ layers on top: sub-agent definitions, parent/child context plumbing, post-turn
memory/archival hooks, and oversized-tool-result handling.
`Agent`, its per-turn lifecycle, and transcript persistence live in
-`../session_host/`, not here; this module supplies the definition/prompt data
-that session host and `../subagent_host/` build turns from.
+[`../session_host/`](../session_host/), not here; this module supplies the definition/prompt data
+that session host and [`../subagent_host/`](../subagent_host/) build turns from.
Cancellation is the tinyagents steering channel (`SteeringCommand` in
`crate::agent::tinyagents`); there is no in-house interrupt fence or
cancellation token owned here. The message queue that lets a caller steer or
follow up on an in-flight turn is `tinyagents_harness::run_queue::RunQueue`,
-used here (not defined here) by `agent_graph.rs` and `fork_context.rs`.
+used here (not defined here) by [`agent_graph.rs`](./agent_graph.rs) and [`fork_context.rs`](./fork_context.rs).
## Responsibilities
@@ -25,9 +25,9 @@ used here (not defined here) by `agent_graph.rs` and `fork_context.rs`.
traits directly. This module does not export a compatibility runner of its
own.
- Carry the task-local plumbing that lets a spawned tool see its parent's
- runtime context (`fork_context.rs`, `sandbox_context.rs`,
- `spawn_depth_context.rs`, `task_recency_context.rs`, `OpenHumanRunContext`).
-- Run the channel/CLI turn graph (`graph.rs`) and let a built-in agent select
+ runtime context (`fork_context.rs`, [`sandbox_context.rs`](./sandbox_context.rs),
+ [`spawn_depth_context.rs`](./spawn_depth_context.rs), [`task_recency_context.rs`](./task_recency_context.rs), `OpenHumanRunContext`).
+- Run the channel/CLI turn graph ([`graph.rs`](./graph.rs)) and let a built-in agent select
a bespoke sub-agent turn graph (`agent_graph.rs`).
- Offload oversized worker artifacts to the filesystem, and persist oversized
tool results as action-workspace artifacts (`artifact_offload/`,
@@ -37,15 +37,15 @@ used here (not defined here) by `agent_graph.rs` and `fork_context.rs`.
| Module | Role |
| --- | --- |
-| `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. |
+| `definition*.rs`, [`builtin_definitions.rs`](./builtin_definitions.rs), [`definition_loader.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` | 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`. |
+| `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`](../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`. |
| `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. |
| `tool_result_artifacts/` | Wiring only: `new_tool_result_store` hands `tinyagents_harness::artifacts::tool_results` OpenHuman's redactor (`SanitizingRedactor`), `file_read`/`use_skill` names and `FileReadTool::MAX_FILE_SIZE_BYTES`. The store, `[tool_result_preview]` envelope, budgets and paged reads live in the crate. |
-| `memory_context_safety.rs` | Trust-tier wrapping of recalled entries that came from connectors (`wrap_untrusted_for_agent`). The read-index, dedupe, write, update-index enforcement state machine for memory-mutating tools (issue #4116) now lives in `tinyagents_harness::middleware` (`MemoryProtocolTracker`). |
-| `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/`. |
-| `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. |
+| [`memory_context_safety.rs`](./memory_context_safety.rs) | Trust-tier wrapping of recalled entries that came from connectors (`wrap_untrusted_for_agent`). The read-index, dedupe, write, update-index enforcement state machine for memory-mutating tools (issue #4116) now lives in `tinyagents_harness::middleware` (`MemoryProtocolTracker`). |
+| `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/`](../session_host/turn/). |
+| `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`](../tinyagents/middleware/credential_scrub.rs), installed as the innermost tool wrap so nothing downstream sees the raw secret. |
## Public surface
@@ -68,11 +68,11 @@ Adjacent public surface that lives in sibling modules, not here:
`OpenHumanSessionHost`/`SessionHostBuilder`/`TurnOverrides` and the `Agent`
turn lifecycle are in `../session_host/`; `run_subagent`,
`SubagentRunOptions`, `SubagentRunError` are in `../subagent_host/`;
-`LastTurnUsage`/`SubagentUsageEntry` are in `../tinyagents/host/run_context.rs`.
+`LastTurnUsage`/`SubagentUsageEntry` are in [`../tinyagents/host/run_context.rs`](../tinyagents/host/run_context.rs).
## Dependencies
-- `tinyagents_harness` (vendored via `vendor/tinyagents/`): the tool loop
+- `tinyagents_harness` (vendored via [`vendor/tinyagents/`](../../../../../vendor/tinyagents/)): the tool loop
itself (`run_turn_via_tinyagents_shared`), the `run_queue` and `artifacts`
primitives this module wraps, and the `InMemoryStore` used as the
tool-result artifact index.
@@ -96,7 +96,7 @@ turn lifecycle are in `../session_host/`; `run_subagent`,
definitions, prompt data, and task-local context this module supplies.
- `agent/bus.rs` serves the `agent.run_turn` native request through
`run_channel_turn_via_graph`; channels reach the harness through that bus.
-- `channels/runtime/dispatch/routing.rs` consults
+- [`channels/runtime/dispatch/routing.rs`](../../channels/runtime/dispatch/routing.rs) consults
`AgentDefinitionRegistry`/`ToolScope`.
- `agent/tinyagents/middleware/credential_scrub.rs` calls
`harness::credentials::scrub_credentials` on every tool result.
@@ -108,14 +108,14 @@ turn lifecycle are in `../session_host/`; `run_subagent`,
## Tests
- Unit: `harness_tool_call_parsing_edge_case_tests.rs`, plus `*_tests.rs` files
- beside each sub-module (`tool_result_artifacts/mod_tests.rs`,
- `artifact_offload/artifact_offload_tests.rs`).
-- Integration: `tests/in_process/agent_harness_public.rs`, `tests/agent_harness_e2e.rs`.
+ beside each sub-module ([`tool_result_artifacts/mod_tests.rs`](./tool_result_artifacts/mod_tests.rs),
+ [`artifact_offload/artifact_offload_tests.rs`](./artifact_offload/artifact_offload_tests.rs)).
+- Integration: [`tests/in_process/agent_harness_public.rs`](../../../../../tests/in_process/agent_harness_public.rs), [`tests/agent_harness_e2e.rs`](../../../../../tests/agent_harness_e2e.rs).
## Notes / gotchas
-- `agent_graph.rs`, `artifact_offload/mod.rs`, and
- `../subagent_host/ops/runner.rs` cite `docs/specs/plan-agents.md` as the
+- `agent_graph.rs`, [`artifact_offload/mod.rs`](./artifact_offload/mod.rs), and
+ [`../subagent_host/ops/runner.rs`](../subagent_host/ops/runner.rs) cite `docs/specs/plan-agents.md` as the
plan for moving durable state, the sub-agent graph, and offload mechanics
onto TinyAgents primitives. That file is not checked into this repo, so the
plan itself is not documented here, only the citations to it.
diff --git a/crates/openhuman-core/src/agent/harness_init/README.md b/crates/openhuman-core/src/agent/harness_init/README.md
index 4526d2c113..fdb9e1dd9d 100644
--- a/crates/openhuman-core/src/agent/harness_init/README.md
+++ b/crates/openhuman-core/src/agent/harness_init/README.md
@@ -6,7 +6,7 @@ Node) used to run lazily on first use with no user-visible feedback. This
domain runs them eagerly at core startup without blocking the ready signal,
tracks per-step progress in an in-memory snapshot, and exposes it over
`openhuman.harness_init_status` / `openhuman.harness_init_run` for the
-frontend's initialization screen (`app/src/services/harnessInitService.ts`).
+frontend's initialization screen ([`app/src/services/harnessInitService.ts`](../../../../../app/src/services/harnessInitService.ts)).
Steps delegate to existing idempotent provisioning code: `runtime::python`
(`PythonBootstrap`), `runtime::node` (`NodeBootstrap`), and
@@ -15,8 +15,8 @@ This module only orchestrates and reports; it does not reimplement downloads.
## Files
-- `mod.rs`: module doc and re-exports.
-- `registry.rs`: the ordered `HarnessInitStep` list from `all_steps()`:
+- [`mod.rs`](./mod.rs): module doc and re-exports.
+- [`registry.rs`](./registry.rs): the ordered `HarnessInitStep` list from `all_steps()`:
`python_runtime`, `spacy`, `kompress`, `runtime_python_server`, and
`node_runtime` (only when the `runtime-node` feature is compiled in). Each
step is a durable, network-free `is_done` probe plus a `run` closure, and a
@@ -24,21 +24,21 @@ This module only orchestrates and reports; it does not reimplement downloads.
justify the blocking first-run overlay) or is routine startup that must run
silently (relaunching an already-installed local server). All steps are
`required: false`; a failure degrades to a fallback.
-- `ops.rs`: `run_harness_init` / `run_harness_init_with(config, force)`:
+- [`ops.rs`](./ops.rs): `run_harness_init` / `run_harness_init_with(config, force)`:
walks the registry, marks steps `Done` instantly when already satisfied,
otherwise runs them. `provisioning_required` decides up front whether any
*provisioning* step still needs work, so an already-provisioned host never
flashes the overlay on a warm restart (GH-5047). Also hosts the RPC handlers
`handle_status` / `handle_run` (`force` re-runs satisfied steps).
-- `store.rs`: process-lifetime `HarnessInitSnapshot` behind a mutex.
+- [`store.rs`](./store.rs): process-lifetime `HarnessInitSnapshot` behind a mutex.
`set_overall` and `update_step` mutate it; `update_step` publishes
`DomainEvent::HarnessInitProgress` and `publish_completed` publishes
- `DomainEvent::HarnessInitCompleted` (both in `core/events.rs`).
-- `types.rs`: `HarnessInitSnapshot`, `StepStatus`, `OverallState`,
+ `DomainEvent::HarnessInitCompleted` (both in [`core/events.rs`](../../core/events.rs)).
+- [`types.rs`](./types.rs): `HarnessInitSnapshot`, `StepStatus`, `OverallState`,
`StepState` (serialized `snake_case`).
-- `bus.rs`: placeholder; progress is published directly from `store`, so
+- [`bus.rs`](./bus.rs): placeholder; progress is published directly from `store`, so
there is no subscriber today.
-- `schemas.rs`: `harness_init` namespace controller schemas (`status`,
+- [`schemas.rs`](./schemas.rs): `harness_init` namespace controller schemas (`status`,
`run`).
- `*_tests.rs`: focused behavior tests beside each file.
@@ -46,10 +46,10 @@ This module only orchestrates and reports; it does not reimplement downloads.
- `core::runtime::services::start_boot_once_jobs` spawns `run_harness_init`
(fire-and-forget) when `ServiceSet.harness_init` is true. It is called from
- `start_core_runtime_services` in `core/runtime/bootstrap.rs`, deliberately outside
+ `start_core_runtime_services` in [`core/runtime/bootstrap.rs`](../../core/runtime/bootstrap.rs), deliberately outside
`bootstrap_core_runtime`, so a build-only embedder never starts it.
-- `ServiceSet` (`core/runtime/builder.rs`) turns it on in the `desktop()` and
+- `ServiceSet` ([`core/runtime/builder.rs`](../../core/runtime/builder.rs)) turns it on in the `desktop()` and
`embedded()` presets and off in `headless_api()` and `none()`.
- Controllers are registered under `DomainGroup::Agent` via
`agent::harness_init::all_harness_init_registered_controllers` in
- `core/all.rs`.
+ [`core/all.rs`](../../core/all.rs).
diff --git a/crates/openhuman-core/src/agent/orchestration/README.md b/crates/openhuman-core/src/agent/orchestration/README.md
index 11dd3248c4..50015d73d2 100644
--- a/crates/openhuman-core/src/agent/orchestration/README.md
+++ b/crates/openhuman-core/src/agent/orchestration/README.md
@@ -18,7 +18,7 @@ RPC/tool formatting, and OpenHuman's worktree policy.
## Responsibilities
-- Register, wait on, and cancel child agent runs (`ops.rs`,
+- Register, wait on, and cancel child agent runs ([`ops.rs`](./ops.rs),
`AgentOrchestrationSession`) as thin wrappers over TinyAgents'
`DetachedTaskRegistry`.
- Host adapters for durable teams and workflows: RPC schemas, root-parent
@@ -31,22 +31,22 @@ RPC/tool formatting, and OpenHuman's worktree policy.
- OpenHuman's `OpenHumanWorktreeIsolation` adapter and RPC surface; generic
worktree operations are used directly from `tinyagents_harness::workspace`.
- User-driven cancel/steer of detached (`spawn_async_subagent`) background
- sub-agents from the frontend background-tasks drawer (`subagent_control.rs`).
+ sub-agents from the frontend background-tasks drawer ([`subagent_control.rs`](./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`). The delivery turn runs
+ (`running_subagents*.rs`, [`background_completions.rs`](./background_completions.rs),
+ [`background_delivery.rs`](./background_delivery.rs), [`run_ledger_finalize.rs`](./run_ledger_finalize.rs)). The delivery turn runs
on the originating thread's cached chat session via
`web_chat::run_system_turn_on_thread`, never on a throwaway host.
- 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`).
+ ([`parent_context/builder.rs`](./parent_context/builder.rs)).
## Key files
-- `mod.rs`: module wiring and re-exports.
-- `ops.rs` / `types.rs`: `AgentOrchestrationSession`, `OrchestrationError`,
+- [`mod.rs`](./mod.rs): module wiring and re-exports.
+- `ops.rs` / [`types.rs`](./types.rs): `AgentOrchestrationSession`, `OrchestrationError`,
`AgentSnapshot`, `OrchestrationTaskStatus`, `SpawnAgentRequest`/`Response`,
`WaitAgentOptions`/`Response`.
- `agent_teams/`: OpenHuman's live member-worker adapter for the generic
@@ -58,18 +58,18 @@ RPC/tool formatting, and OpenHuman's worktree policy.
- `workflow_runs/`: OpenHuman's live workflow execution and RPC adapters;
workflow definitions, durable state, validation, graphs, and neutral engine
mechanics are imported directly from `tinyagents_orchestration::workflow`.
-- `delegation.rs`: production worker for TinyAgents' durable
+- [`delegation.rs`](./delegation.rs): production worker for TinyAgents' durable
plan→execute⇄review→finalize graph; every stage runs through `run_subagent`.
- `spawn_parallel_agents` uses `tinyagents_graph::parallel::map_reduce` with
OpenHuman-owned request validation, worktree policy, dispatch, workers, and
result formatting. The former parallel coordinator/request graph modules
were removed; there is no OpenHuman forwarding layer around the graph API.
-- `subagent_events.rs`: the single owner that constructs and publishes
+- [`subagent_events.rs`](./subagent_events.rs): the single owner that constructs and publishes
`DomainEvent::Subagent{Spawned,Completed,Failed,AwaitingUser}`.
- `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` and the
+- [`worktree.rs`](./worktree.rs) / [`worktree_schemas.rs`](./worktree_schemas.rs): `OpenHumanWorktreeIsolation` and the
list/status/diff/remove RPC surface. They call
`tinyagents_harness::workspace` directly rather than maintaining aliases.
- `subagent_sessions/`: durable subagent session records
@@ -78,7 +78,7 @@ RPC/tool formatting, and OpenHuman's worktree policy.
- `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` + `running_subagents/` (`registry.rs`, `roster.rs`,
+- [`running_subagents.rs`](./running_subagents.rs) + `running_subagents/` (`registry.rs`, `roster.rs`,
`resolve.rs`, `cancel.rs`, `steering.rs`, `wait.rs`, `task_ledger.rs`): the
detached sub-agent host glue (registry instance and metadata, store path,
steering, boot reconcile). The status type, wait, ledger helpers, roster and
@@ -89,12 +89,12 @@ RPC/tool formatting, and OpenHuman's worktree policy.
of finished background runs back into chat; `run_ledger_finalize.rs` is the
global-bus subscriber that settles ledger rows for runs that outlive their
spawning turn.
-- `fleet_tools.rs`: decides which fleet-control tools (`wait_subagent`,
+- [`fleet_tools.rs`](./fleet_tools.rs): decides which fleet-control tools (`wait_subagent`,
`steer_subagent`, `wait_loop`, `close_subagent`) a given parent agent's
definition actually exposes, so the delegation prompts and the
`[active_subagents]` roster text never name a tool the model cannot call
(#5701).
-- `tools.rs`: declares the LLM-callable tool files under `tools/` (see
+- [`tools.rs`](./tools.rs): declares the LLM-callable tool files under `tools/` (see
[Agent tools](#agent-tools)).
## Public surface
@@ -124,7 +124,7 @@ Five controller pairs are registered in `crate::core::all`:
## Agent tools
`tools.rs` declares the `tools/` directory files (via `#[path]`) and
-re-exports them through `crate::tools` (`tools/mod.rs`:
+re-exports them through `crate::tools` ([`tools/mod.rs`](../../tools/mod.rs):
`pub use crate::agent::orchestration::tools::*`). LLM-callable tools, by wire
name:
@@ -137,7 +137,7 @@ name:
and `CollapsedDelegationTool` (`delegate_to`).
There is no integrations delegate: connected Composio actions are
`Deferred` tools on the orchestrator's own belt, found through
- `tool_search` and called directly (`tools/orchestrator_tools.rs`).
+ `tool_search` and called directly ([`tools/orchestrator_tools.rs`](../../tools/orchestrator_tools.rs)).
`dispatch.rs` (the shared spawn path every tool above
calls), `awaiting_user.rs` (the awaiting-user envelope), and
@@ -158,7 +158,7 @@ races it against the inherited cancellation token. Execution itself routes throu
- `tinyagents_session::run_ledger`: the `agent_runs`,
`agent_teams`/`agent_team_members`/`agent_team_tasks`, and `workflow_runs`
tables plus the shared `run_events` log, backed by
- `{workspace}/session_db/sessions.db` (see `agent/session_db/mod.rs`). Every
+ `{workspace}/session_db/sessions.db` (see [`agent/session_db/mod.rs`](../session_db/mod.rs)). Every
spawn path (`spawn_subagent`, `spawn_async_subagent`,
`spawn_parallel_agents`, `continue_subagent`, `dispatch`) writes a `running`
`agent_runs` row; `run_ledger_finalize.rs` settles it from the global event
diff --git a/crates/openhuman-core/src/agent/progress_tracing/README.md b/crates/openhuman-core/src/agent/progress_tracing/README.md
index 6bf7e26f32..243f5714c4 100644
--- a/crates/openhuman-core/src/agent/progress_tracing/README.md
+++ b/crates/openhuman-core/src/agent/progress_tracing/README.md
@@ -4,7 +4,7 @@ Turns the agent's real-time [`AgentProgress`](../progress.rs) event stream into
OpenTelemetry/Langfuse-style trace spans (`agent.turn` -> `agent.iteration` ->
`tool.*`/`subagent.*`), correlated by session id, for offline inspection and
debugging long multi-agent runs (issue #3886). The module doc on
-`agent/progress_tracing.rs` has the full span-tree shape and the
+[`agent/progress_tracing.rs`](../progress_tracing.rs) has the full span-tree shape and the
content-capture privacy gate (`observability.agent_tracing.capture_content`,
default on; enforced once, in `SpanCollector`, so no exporter can leak
content).
@@ -17,14 +17,14 @@ content).
The data model (`TraceContext`, `RunType`, `SpanKind`/`SpanStatus`), content
caps, `spans_to_ndjson`, the pure OTLP conversion and Langfuse batch
chunking live upstream in
- `tinyagents_harness::observability::trace_export`. `export.rs` has the local file/log
+ `tinyagents_harness::observability::trace_export`. [`export.rs`](./export.rs) has the local file/log
exporter `export_spans`, and the two run-completion entry points
`export_run_trace` / `export_run_trace_from_journal`. Each entry point runs
two independent, best-effort paths: a Langfuse push when
`observability.share_usage_data` is on (the default), and local NDJSON
export to `export_path` or the app log when
`observability.agent_tracing.enabled` is on (opt-in).
-- `otlp.rs`: the remote agent-turn exporter (the span-to-OTLP conversion is
+- [`otlp.rs`](./otlp.rs): the remote agent-turn exporter (the span-to-OTLP conversion is
upstream; this file resolves the backend URL and credential and posts). It turns completed live spans
into OTLP/HTTP JSON, preserves the root turn's input/output, maps
TinyInference messages into role-labeled conversations, puts usage only on
@@ -33,9 +33,9 @@ content).
`/telemetry/langfuse/otel/v1/traces` proxy; the backend supplies project
keys and authoritative user attribution. Export is on by default through
`observability.share_usage_data`; local NDJSON export remains optional.
-- `langfuse.rs` + `langfuse/` retain the legacy batch projection for
+- [`langfuse.rs`](./langfuse.rs) + `langfuse/` retain the legacy batch projection for
compatibility tests and the flow-run exporter. Agent turns use `otlp.rs`.
-- `journal_projection.rs`: `spans_from_observations` rebuilds spans from the
+- [`journal_projection.rs`](./journal_projection.rs): `spans_from_observations` rebuilds spans from the
durable `AgentObservation` journal instead of the live stream, by folding
journalled events through the same `SpanCollector`, so a UI/supervisor can
attach after a run. Its match is exhaustive over
@@ -43,19 +43,19 @@ content).
parity gaps (estimated vs. charged cost, no subagent prompt/output content).
Tests live in this directory as `*_tests.rs` files, e.g.
-`progress_tracing_tests.rs`, `progress_tracing_span_tree_tests.rs`,
-`progress_tracing_attribution_tests.rs`, `progress_tracing_content_gate_tests.rs`,
-`langfuse_tests.rs`, `langfuse_batch_tests.rs`, `langfuse_trace_fields_tests.rs`,
-`journal_projection_tests.rs`, `journal_projection_cost_rollup_tests.rs`.
+[`progress_tracing_tests.rs`](./progress_tracing_tests.rs), [`progress_tracing_span_tree_tests.rs`](./progress_tracing_span_tree_tests.rs),
+[`progress_tracing_attribution_tests.rs`](./progress_tracing_attribution_tests.rs), [`progress_tracing_content_gate_tests.rs`](./progress_tracing_content_gate_tests.rs),
+[`langfuse_tests.rs`](./langfuse_tests.rs), [`langfuse_batch_tests.rs`](./langfuse_batch_tests.rs), [`langfuse_trace_fields_tests.rs`](./langfuse_trace_fields_tests.rs),
+[`journal_projection_tests.rs`](./journal_projection_tests.rs), [`journal_projection_cost_rollup_tests.rs`](./journal_projection_cost_rollup_tests.rs).
## Called by
-- `web_chat/progress_bridge.rs`: the only caller. Builds a `SpanCollector`
+- [`web_chat/progress_bridge.rs`](../../web_chat/progress_bridge.rs): the only caller. Builds a `SpanCollector`
per run, feeds it `AgentProgress`, shadow-compares the live spans against
`spans_from_observations` over the run journal, then calls
`export_run_trace_from_journal` (journal available) or `export_run_trace`.
-`flows/tinyflows/langfuse_export.rs` is the separate flow-run exporter and
+[`flows/tinyflows/langfuse_export.rs`](../../flows/tinyflows/langfuse_export.rs) is the separate flow-run exporter and
currently still uses the legacy batch proxy.
## Related docs
diff --git a/crates/openhuman-core/src/agent/prompts/README.md b/crates/openhuman-core/src/agent/prompts/README.md
index aab2bcf5a4..66714c5e14 100644
--- a/crates/openhuman-core/src/agent/prompts/README.md
+++ b/crates/openhuman-core/src/agent/prompts/README.md
@@ -11,8 +11,8 @@ domains use to compose their own prompts.
`PromptTool`, `ToolCallFormat`, `UserIdentity`, `ConnectedIntegration`,
`SubagentRenderOptions`. Pure data, no rendering logic. Also holds the
`pub(crate)` cap `BOOTSTRAP_MAX_CHARS` (20K, for
- `SOUL.md`/`IDENTITY.md`/`ROLE.md` and each `AGENTS.md` layer).
-- `render_connected_identities` (`connected_identities.rs`): best-effort,
+ [`SOUL.md`](./SOUL.md)/[`IDENTITY.md`](./IDENTITY.md)/[`ROLE.md`](./ROLE.md) and each `AGENTS.md` layer).
+- `render_connected_identities` ([`connected_identities.rs`](./connected_identities.rs)): best-effort,
sync render of the `## Connected Identities` block. It reads through the
bound memory driver via `block_in_place` and returns empty when there is no
multi-thread runtime or the config/driver read fails.
@@ -27,7 +27,7 @@ domains use to compose their own prompts.
`DateTimeSection`, `RuntimeSection`, `AgentsInstructionsSection`,
`PersonalityRosterSection`, `ArchetypePromptSection`,
`DynamicPromptSection`, `GroundingSection`).
-- Named re-exports from `render_helpers` (`render_helpers.rs` plus the
+- Named re-exports from `render_helpers` ([`render_helpers.rs`](./render_helpers.rs) plus the
`render_helpers/` submodules `section_renderers.rs`, `subagent.rs`,
`workspace_files.rs`): free `render_*` functions (thin wrappers over the
section structs), the workspace-file helpers
@@ -40,10 +40,10 @@ domains use to compose their own prompts.
## Bundled assets
-`IDENTITY.md`, `ROLE.md`, `SOUL.md`, `STYLE.md` are the bundled copies of the
+`IDENTITY.md`, `ROLE.md`, `SOUL.md`, [`STYLE.md`](./STYLE.md) are the bundled copies of the
master agent's identity, role brief, personality, and writing style. They are
-embedded with `include_str!` in `render_helpers/workspace_files.rs`
-(`default_workspace_file_content`) and, for `STYLE.md`, again in `builder.rs`
+embedded with `include_str!` in [`render_helpers/workspace_files.rs`](./render_helpers/workspace_files.rs)
+(`default_workspace_file_content`) and, for `STYLE.md`, again in [`builder.rs`](./builder.rs)
as `GLOBAL_STYLE_SUFFIX`. There are two uses:
- Seed and refresh: `sync_workspace_file(workspace_dir, filename)` writes the
@@ -60,8 +60,8 @@ as `GLOBAL_STYLE_SUFFIX`. There are two uses:
- Compile-time fallback: `GLOBAL_STYLE_SUFFIX` is used when the workspace
`STYLE.md` cannot be read.
-`USER.md` is different: nothing in this module reads it. It is exposed as the
-`openhuman://prompts/user` MCP resource by `mcp/server/resources.rs`
+[`USER.md`](./USER.md) is different: nothing in this module reads it. It is exposed as the
+`openhuman://prompts/user` MCP resource by [`mcp/server/resources.rs`](../../mcp/server/resources.rs)
(`include_str!("../../agent/prompts/USER.md")`).
The user's memory is not part of the system prompt: memory v2 injects the
@@ -82,8 +82,8 @@ module for this API.
Other domains contribute prompt content without living in this directory:
-- `tools/agent_policy/prompt.rs`: `render_tool_policy_boundary` is not a
- section. `agent/session_host/turn/context.rs` string-appends its
+- [`tools/agent_policy/prompt.rs`](../../tools/agent_policy/prompt.rs): `render_tool_policy_boundary` is not a
+ section. [`agent/session_host/turn/context.rs`](../session_host/turn/context.rs) string-appends its
`## Tool Policy Boundary` block after the builder output so the
session-scoped bytes land at the tail of the prompt.
@@ -91,7 +91,7 @@ Built-in archetype system prompts (orchestrator, planner, image_agent,
and so on) live in `agent/registry/agents/<name>/prompt.rs` and
`flows/agents/{flow_discovery,workflow_builder}/prompt.rs`, not here. Each is a
`PromptSource::Dynamic` function that hand-assembles its body via the
-`render_*` helpers; `agent/session_host/builder/factory.rs` wraps it with
+`render_*` helpers; [`agent/session_host/builder/factory.rs`](../session_host/builder/factory.rs) wraps it with
`SystemPromptBuilder::from_dynamic`.
## Builder entry points
@@ -149,6 +149,6 @@ user message via `current_datetime_line`).
the tool-policy boundary.
- `agent/session_host/builder/factory.rs`: picks the entry point per
`PromptSource`.
-- `agent/debug/`: `dump_agent_prompt` / `dump_all_agent_prompts` (`mod.rs`)
+- [`agent/debug/`](../debug/): `dump_agent_prompt` / `dump_all_agent_prompts` ([`mod.rs`](./mod.rs))
build the same `PromptContext` to render each agent's prompt,
`dump_writer.rs` writes it to disk, `prompt_size.rs` measures it.
diff --git a/crates/openhuman-core/src/agent/registry/README.md b/crates/openhuman-core/src/agent/registry/README.md
index 503151421c..76da924dd4 100644
--- a/crates/openhuman-core/src/agent/registry/README.md
+++ b/crates/openhuman-core/src/agent/registry/README.md
@@ -49,9 +49,9 @@ the harness runs come from [`agents/`](agents/) below.
definitions for namespace `agent_registry`: `list`, `get`,
`available_tools`, `create_custom`, `upsert_custom`, `update`,
`set_enabled`, `remove`. Registered through
- `all_agent_registry_registered_controllers` in `core/all.rs`.
+ `all_agent_registry_registered_controllers` in [`core/all.rs`](../../core/all.rs).
- [`rpc.rs`](rpc.rs): request/response payload types and the `*_rpc` handler
- functions that `schemas.rs` wires up, delegating into `ops.rs`.
+ functions that [`schemas.rs`](./schemas.rs) wires up, delegating into [`ops.rs`](./ops.rs).
- [`tools.rs`](tools.rs): backwards-compatible re-export of
`agent::orchestration::tools::*`; nothing in the tree imports it any more.
- [`agents/`](agents/): the built-in agent archetypes and their loader.
@@ -78,8 +78,8 @@ 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: `skill_setup`
-(`skills/catalog/agent/`, feature `skills`), and
-`workflow_builder` and `flow_discovery` (`flows/agents/`, feature `flows`).
+([`skills/catalog/agent/`](../../skills/catalog/agent/), feature `skills`), and
+`workflow_builder` and `flow_discovery` ([`flows/agents/`](../../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;
@@ -108,7 +108,7 @@ The orchestrator's chat delegates (its `[subagents]` allowlist) are
`image_agent`, `video_agent`, `presentation_agent`, `skill_setup`,
`workflow_builder` and `flow_discovery`. `planner` and `critic` stay
registered only for the `parallel_research_cross_check` workflow-run template
-(`agent/orchestration/workflow_runs/ops.rs`: decompose = `planner`, research
+([`agent/orchestration/workflow_runs/ops.rs`](../orchestration/workflow_runs/ops.rs): decompose = `planner`, research
= `planner` x2, cross_check = `critic`, synthesize = `summarizer`); the
orchestrator does not list them. Everything else is runtime-only.
@@ -136,15 +136,15 @@ ranking works.
- `core/all.rs`: registers the `agent_registry` controllers under
`DomainGroup::Agent`.
-- `config/schema/`: `Config.agent_registry: AgentRegistryConfig` is the
+- [`config/schema/`](../../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/registry.rs`
+- [`agent/harness/builtin_definitions.rs`](../harness/builtin_definitions.rs): `load_builtins()` seeds the
+ process-global `AgentDefinitionRegistry`; [`agent/harness/definition/registry.rs`](../harness/definition/registry.rs)
calls `validate_tier_hierarchy` again after workspace overrides merge.
-- `agent/session_host/builder/factory.rs`:
+- [`agent/session_host/builder/factory.rs`](../session_host/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`
+- [`agent/schemas.rs`](../schemas.rs): `agent.graph_topologies` and `agent.registry_snapshot`
enumerate `load_builtins()`.
- `flows/` (`ops/inference_readiness.rs`, `ops/builder_gates.rs`,
`builder_tools/kind_reads.rs`, `tinyflows/caps/agent.rs`): resolve a flow
@@ -152,7 +152,7 @@ ranking works.
## Tests
-`defaults_tests.rs`, `ops_tests.rs`, `schemas_tests.rs`, `types_tests.rs`;
+[`defaults_tests.rs`](./defaults_tests.rs), [`ops_tests.rs`](./ops_tests.rs), [`schemas_tests.rs`](./schemas_tests.rs), [`types_tests.rs`](./types_tests.rs);
under `agents/`: `loader_tests.rs` (+ `loader_tests_orchestrator_tier_tests.rs`,
`loader_tests_builtin_registration_tests.rs`, `loader_tests_specialist_agents_tests.rs`)
and a `prompt_tests.rs` beside almost every archetype's `prompt.rs`.
diff --git a/crates/openhuman-core/src/agent/session_host/README.md b/crates/openhuman-core/src/agent/session_host/README.md
index 055a1d9275..f73539d1f9 100644
--- a/crates/openhuman-core/src/agent/session_host/README.md
+++ b/crates/openhuman-core/src/agent/session_host/README.md
@@ -13,21 +13,21 @@ run after each turn commits.
| File | Role |
| --- | --- |
-| `types.rs` | `OpenHumanSessionHost` and `SessionHostBuilder` struct definitions, no logic |
+| [`types.rs`](./types.rs) | `OpenHumanSessionHost` and `SessionHostBuilder` struct definitions, no logic |
| `builder/` | `SessionHostBuilder` fluent API and the `from_config` factory |
-| `factory.rs` | `OpenHumanSessionFactory` |
-| `runtime_session.rs` | Runtime session composition and the public `turn()` |
+| [`factory.rs`](./factory.rs) | `OpenHumanSessionFactory` |
+| [`runtime_session.rs`](./runtime_session.rs) | Runtime session composition and the public `turn()` |
| `runtime/` | Public accessors, `run_single` |
-| `session_api.rs` | Start, read back, and list the generations of a durable session |
-| `driver.rs` | The OpenHuman `SessionDriver` that runs the model and tools |
-| `hooks.rs` | Product prepare, commit, and terminal hooks |
-| `codec.rs` | `OpenHumanTranscriptCodec`, the product transcript dialect |
-| `policy.rs` | Prompt and turn policy applied before dispatch |
-| `prefix_snapshot.rs` | Cache-prefix bookkeeping across resumes |
-| `recorded_tools.rs` | Rebuilds recorded Composio actions as deferred executors on resume |
-| `prelude_integrations.rs` | Fetches connected integrations on the first turn of a session instance |
-| `announcement_notes.rs`, `artifact_wiring.rs` | Smaller product wiring pulled out of the builder |
-| `turn/`, `turn_checkpoint.rs` | Per-turn state and checkpointing |
+| [`session_api.rs`](./session_api.rs) | Start, read back, and list the generations of a durable session |
+| [`driver.rs`](./driver.rs) | The OpenHuman `SessionDriver` that runs the model and tools |
+| [`hooks.rs`](./hooks.rs) | Product prepare, commit, and terminal hooks |
+| [`codec.rs`](./codec.rs) | `OpenHumanTranscriptCodec`, the product transcript dialect |
+| [`policy.rs`](./policy.rs) | Prompt and turn policy applied before dispatch |
+| [`prefix_snapshot.rs`](./prefix_snapshot.rs) | Cache-prefix bookkeeping across resumes |
+| [`recorded_tools.rs`](./recorded_tools.rs) | Rebuilds recorded Composio actions as deferred executors on resume |
+| [`prelude_integrations.rs`](./prelude_integrations.rs) | Fetches connected integrations on the first turn of a session instance |
+| [`announcement_notes.rs`](./announcement_notes.rs), [`artifact_wiring.rs`](./artifact_wiring.rs) | Smaller product wiring pulled out of the builder |
+| `turn/`, [`turn_checkpoint.rs`](./turn_checkpoint.rs) | Per-turn state and checkpointing |
Import `OpenHumanSessionHost` and `SessionHostBuilder` from `crate::agent`,
which re-exports them from here. The child files are an implementation
@@ -60,5 +60,5 @@ long conversation's generations without reading the whole chain.
builds from OpenHuman state, and for the harness call site itself.
- `crate::agent::subagent_host` for the same kind of adapter work, but over a
child agent run instead of the top-level session.
-- `vendor/tinyagents` for the session, resume, and transcript mechanics this
+- [`vendor/tinyagents`](../../../../../vendor/tinyagents/) for the session, resume, and transcript mechanics this
module wraps rather than reimplements.
diff --git a/crates/openhuman-core/src/agent/session_import/README.md b/crates/openhuman-core/src/agent/session_import/README.md
index 9fe7418c13..3dd91e7d94 100644
--- a/crates/openhuman-core/src/agent/session_import/README.md
+++ b/crates/openhuman-core/src/agent/session_import/README.md
@@ -8,13 +8,13 @@ destination layout and idempotency).
What stays in OpenHuman:
-- `schemas.rs`: the explicit `session_import.run` controller
+- [`schemas.rs`](./schemas.rs): the explicit `session_import.run` controller
(`openhuman-core session_import run`, JSON-RPC
`openhuman.session_import_run`). Never run from a boot hook.
-- `live.rs`: whether the dual-write and shadow read run
+- [`live.rs`](./live.rs): whether the dual-write and shadow read run
(`AgentConfig::session_dual_write` / `session_shadow_reads`, the
`OPENHUMAN_SESSION_DUAL_WRITE` / `OPENHUMAN_SESSION_SHADOW_READS` kill
switches) and the session KV store registered on `RunContext.stores`.
-- `projector.rs`: `journal_message_from_transcript`, the
+- [`projector.rs`](./projector.rs): `journal_message_from_transcript`, the
`JournalProjector` handed to the upstream importer so journal records carry
the host's reconstructed sidecar metadata.
diff --git a/crates/openhuman-core/src/agent/subagent_host/README.md b/crates/openhuman-core/src/agent/subagent_host/README.md
index 623d170431..93ab61818c 100644
--- a/crates/openhuman-core/src/agent/subagent_host/README.md
+++ b/crates/openhuman-core/src/agent/subagent_host/README.md
@@ -19,11 +19,11 @@ terminal persistence; this crate does not duplicate that state machine.
| File | Role |
| --- | --- |
-| `types.rs` | `SubagentRunOptions`, `SubagentRunOutcome`, `SubagentRunError`, `SubagentMode`, `SubagentCheckpointData`, `SubagentUsage` |
+| [`types.rs`](./types.rs) | `SubagentRunOptions`, `SubagentRunOutcome`, `SubagentRunError`, `SubagentMode`, `SubagentCheckpointData`, `SubagentUsage` |
| `ops/` | `run_subagent`, the typed and fork execution modes, and the TinyAgents graph route |
-| `lifecycle.rs` | `run_subagent`, `run_subagent_with_parent`, `continue_subagent`, checkpoint load/save, `OpenHumanSubagentHost` |
-| `tool_prep.rs` | Tool filtering, prompt loading, and the prompt protocol block |
-| `autonomous.rs` | Iteration-cap policy for autonomous (non-interactive) sub-agent runs |
+| [`lifecycle.rs`](./lifecycle.rs) | `run_subagent`, `run_subagent_with_parent`, `continue_subagent`, checkpoint load/save, `OpenHumanSubagentHost` |
+| [`tool_prep.rs`](./tool_prep.rs) | Tool filtering, prompt loading, and the prompt protocol block |
+| [`autonomous.rs`](./autonomous.rs) | Iteration-cap policy for autonomous (non-interactive) sub-agent runs |
`SubagentRunOptions::run_context` carries the child's `OpenHumanRunContext`
explicitly; recursive execution passes this value rather than snapshotting
@@ -38,6 +38,6 @@ survive that boundary on its own.
user-facing tools that call into this runner.
- `crate::agent::session_host` for the parent turn that sets up the
`ParentExecutionContext` a sub-agent reads.
-- `vendor/tinyagents` (`tinyagents-orchestration::subagent`,
+- [`vendor/tinyagents`](../../../../../vendor/tinyagents/) (`tinyagents-orchestration::subagent`,
`tinyagents-graph`) for the lifecycle and delegation-graph mechanics this
module adapts rather than reimplements.
diff --git a/crates/openhuman-core/src/agent/tinyagents/README.md b/crates/openhuman-core/src/agent/tinyagents/README.md
index 34cf520eb3..9e59f48697 100644
--- a/crates/openhuman-core/src/agent/tinyagents/README.md
+++ b/crates/openhuman-core/src/agent/tinyagents/README.md
@@ -4,13 +4,13 @@ The adapter seam between OpenHuman and the vendored [`tinyagents`](../../../../.
## Responsibilities
-- Assemble a per-turn harness (`assemble_turn_harness` in `harness_assembly.rs`): register the turn's `ChatModel`s, every shared tool, and the full middleware stack, then drive it via `AgentHarness::invoke_stream_in_context` (`turn_runner.rs`).
-- Convert between OpenHuman and crate types: tiered `ChatModel` bundles from `(role, config)` (`turn_models.rs`, `model.rs`), direct TinyTools/TinyInference tool declarations at their consumers, and `TranscriptMessage`/`TranscriptEntry` to and from the crate's `Message` via `crate::agent::message_convert`.
+- Assemble a per-turn harness (`assemble_turn_harness` in [`harness_assembly.rs`](./harness_assembly.rs)): register the turn's `ChatModel`s, every shared tool, and the full middleware stack, then drive it via `AgentHarness::invoke_stream_in_context` ([`turn_runner.rs`](./turn_runner.rs)).
+- Convert between OpenHuman and crate types: tiered `ChatModel` bundles from `(role, config)` ([`turn_models.rs`](./turn_models.rs), [`model.rs`](./model.rs)), direct TinyTools/TinyInference tool declarations at their consumers, and `TranscriptMessage`/`TranscriptEntry` to and from the crate's `Message` via `crate::agent::message_convert`.
- Enforce cross-cutting policy as harness middleware: approval/security gating, tool policy and CLI/RPC-only denial, cost budgets, context compaction/summarization, credential scrubbing, malformed-argument recovery, and the repeated-tool-failure circuit breaker (`middleware*.rs`).
-- Route workloads to model tiers and record the resolved provider/model for audit (`routes.rs`, canonical TinyInference response metadata).
+- Route workloads to model tiers and record the resolved provider/model for audit ([`routes.rs`](./routes.rs), canonical TinyInference response metadata).
- Let TinyAgents stop repetitive visible model streams in its agent loop; the OpenHuman session driver turns `GenerationStalled` into a bounded partial containing completed tool evidence.
-- Make turns durable and replayable: a JSONL event journal plus status store (`journal.rs`), a startup sweep for orphaned runs (`reaper.rs`), and a read-only RPC surface over both (`replay/`).
-- Provide graph-layer helpers for multi-stage sub-agent orchestration (`orchestration.rs`, `delegation.rs`) and expose graph structure for debugging (`topology.rs`).
+- Make turns durable and replayable: a JSONL event journal plus status store ([`journal.rs`](./journal.rs)), a startup sweep for orphaned runs ([`reaper.rs`](./reaper.rs)), and a read-only RPC surface over both (`replay/`).
+- Provide graph-layer helpers for multi-stage sub-agent orchestration (`orchestration.rs`, `delegation.rs`) and expose graph structure for debugging ([`topology.rs`](./topology.rs)).
- Pick which tools a turn even considers: `discovery/` holds the process-wide tool-search ranker slot (see [Tool search](#tool-search) below).
- Host adapters (`host/`) for the crate's ten host-capability traits. Not yet wired into the live turn path; see [Host adapters](#host-adapters) below.
@@ -18,38 +18,38 @@ The adapter seam between OpenHuman and the vendored [`tinyagents`](../../../../.
| File / group | Role |
| --- | --- |
-| `mod.rs` | Module root: declares submodules and re-exports (`TurnContextMiddleware`, `TranscriptSnapshotSink`, `SubagentScope`, `ToolPolicyEnforcement`, `TinyagentsTurnOutcome`, `TurnModelSource`/`TurnModels`, `run_turn_via_tinyagents_shared`). |
-| `turn_policy.rs` | `ToolPolicyEnforcement`, run-policy construction, and wall-clock-ceiling helpers (`agent_turn_wall_clock_ms` and friends). |
+| [`mod.rs`](./mod.rs) | Module root: declares submodules and re-exports (`TurnContextMiddleware`, `TranscriptSnapshotSink`, `SubagentScope`, `ToolPolicyEnforcement`, `TinyagentsTurnOutcome`, `TurnModelSource`/`TurnModels`, `run_turn_via_tinyagents_shared`). |
+| [`turn_policy.rs`](./turn_policy.rs) | `ToolPolicyEnforcement`, run-policy construction, and wall-clock-ceiling helpers (`agent_turn_wall_clock_ms` and friends). |
| `turn_runner.rs` | `run_turn_via_tinyagents_shared`, the single entry point every production caller uses, plus the `#[cfg(test)]`-only `run_turn_via_tinyagents`. |
| `turn_models.rs` | `TurnModels` (primary + tier routes + summarizer) and `TurnModelSource`, whose `build`/`build_summarizer` construct crate-native models from `(role, config)` via `build_turn_models_crate`. |
| `harness_assembly.rs` | `assemble_turn_harness`, which registers models, tools, and middleware in order. |
-| `harness_tool_registration.rs` | Tool + agent capability-registry projection consumed by `assemble_turn_harness`. |
-| `turn_outcome.rs` | `TinyagentsTurnOutcome`, `HaltSummarySlot`, `ToolOutcomeSink`, and `record_unobserved_turn_usage`, the cost-tracker fallback for turns with no `on_progress` observer. |
-| `turn_run_error.rs` | Maps a failed harness run onto the typed OpenHuman error `run_turn_via_tinyagents_shared` returns. |
-| `turn_run_finalize.rs` | Turns a completed harness run into a `TinyagentsTurnOutcome` on the success path (journal completion, compaction diagnostics, the terminal `TurnCompleted` event). |
+| [`harness_tool_registration.rs`](./harness_tool_registration.rs) | Tool + agent capability-registry projection consumed by `assemble_turn_harness`. |
+| [`turn_outcome.rs`](./turn_outcome.rs) | `TinyagentsTurnOutcome`, `HaltSummarySlot`, `ToolOutcomeSink`, and `record_unobserved_turn_usage`, the cost-tracker fallback for turns with no `on_progress` observer. |
+| [`turn_run_error.rs`](./turn_run_error.rs) | Maps a failed harness run onto the typed OpenHuman error `run_turn_via_tinyagents_shared` returns. |
+| [`turn_run_finalize.rs`](./turn_run_finalize.rs) | Turns a completed harness run into a `TinyagentsTurnOutcome` on the success path (journal completion, compaction diagnostics, the terminal `TurnCompleted` event). |
| `discovery/` | `install_tool_ranker` / `installed_tool_ranker`: the process-wide slot for the host's `ToolRanker` (a decision model such as Jev, installed by `openhuman-tinyhumans`; the core itself installs none), and `discovery_policy`, which turns the installed ranker plus `agent.tool_search` config into the `ToolDiscoveryPolicy` every turn harness runs with. A ranker that fails at search time falls back to BM25 in the harness. |
| `host/` | OpenHuman's implementations of the crate's ten host-capability traits: `agent_memory`, `budget_gate`, `context_composer`, `definition_registry`, `experience_store`, `learning_sink`, `model_resolver`, `progress_sink`, `security_gate`, `tool_outcome_classifier`. Each file adapts one trait onto the OpenHuman domain that implements it. |
| `replay/` | Read-only agent-run replay/status RPC (`mod.rs`, `ops.rs`, `schemas.rs`): three `agent`-namespace controllers; `ops.rs` is a workspace adapter over `tinyagents_harness::observability::replay`. |
| `journal.rs` | `TurnJournal` and `attach_turn_journal`: a crate `StoreEventJournal` over a JSONL append store plus a `HarnessStatusStore` writer (`FileStatusStore`, `mint_run_id` and the env-secret redaction seed are upstream in `tinyagents_harness::observability`) under `{workspace}/tinyagents_store`. Attached alongside the live `observability` bridge as an independent `EventSink` subscriber, wrapped in `RedactingSink`; best-effort and non-fatal. |
| `reaper.rs` | `reap_orphaned_runs`: workspace adapter over the upstream sweep (`tinyagents_harness::observability::reap_orphaned_runs`) that marks non-terminal runs `Cancelled` in the durable status store. The only writer over the status seam that `replay/` reads. |
-| `middleware.rs` + `middleware/` | The named OpenHuman middleware stack. `turn_context.rs`: `TurnContextMiddleware` (bundles config and installs the enabled hooks), `TranscriptSnapshotMiddleware`/`TranscriptSnapshotSink`. `tool_output.rs`: `ToolOutputMiddleware` (per-result byte cap and optional payload summarizer). `approval.rs`: `ApprovalSecurityMiddleware`. `cli_rpc_only.rs`: `CliRpcOnlyMiddleware`. `tool_policy.rs`: the `ToolPolicyMiddleware` struct and impl (records blocks into `crate::tools::registry::denials`). `tool_outcome_capture.rs`: `ToolOutcomeCaptureMiddleware`. `embedder_hooks.rs`: `EmbedderToolHooksMiddleware`. `memory_protocol.rs`: the OpenHuman tool vocabulary (`memory_protocol_spec()`) for the upstream `MemoryProtocolMiddleware`. `cost_budget.rs`: `CostBudgetMiddleware`. `repeated_failure.rs`: `RepeatedToolFailureMiddleware` (class-specific recovery budgets before the next model call; equivalent failures share a stable resource scope even when arguments differ). `loop_guards.rs`: `TerminalInferenceFailure`. `credential_scrub.rs`: the browser confirmation-token exemption and `credential_scrub_middleware()`, which wires the harness `CredentialScrubMiddleware`. The generic context-ladder and loop-guard middleware live in `tinyagents-harness` (`middleware::library`) and are installed by `harness_context_ladder.rs` / `harness_assembly.rs`: `ImageAwareMessageTrimMiddleware`, `FinalCallWrapUpMiddleware` (host passes the `file_write`/`apply_patch` deliverable tools and `CLEARED_PLACEHOLDER`), `ArtifactIndexTocMiddleware` (issue #6014), `RepeatProgressMiddleware`/`RepeatEvictionObserver` (host passes the `wait_subagent` exemption), and `ArgRecoveryMiddleware`. |
-| `middleware/research_budget.rs` | Withdraws the web tools from a top-level turn after eight successful search or fetch calls (forcing an answer only when no other tool remains), and notes once when consecutive web calls fail. |
+| [`middleware.rs`](./middleware.rs) + `middleware/` | The named OpenHuman middleware stack. `turn_context.rs`: `TurnContextMiddleware` (bundles config and installs the enabled hooks), `TranscriptSnapshotMiddleware`/`TranscriptSnapshotSink`. `tool_output.rs`: `ToolOutputMiddleware` (per-result byte cap and optional payload summarizer). `approval.rs`: `ApprovalSecurityMiddleware`. `cli_rpc_only.rs`: `CliRpcOnlyMiddleware`. `tool_policy.rs`: the `ToolPolicyMiddleware` struct and impl (records blocks into `crate::tools::registry::denials`). `tool_outcome_capture.rs`: `ToolOutcomeCaptureMiddleware`. `embedder_hooks.rs`: `EmbedderToolHooksMiddleware`. `memory_protocol.rs`: the OpenHuman tool vocabulary (`memory_protocol_spec()`) for the upstream `MemoryProtocolMiddleware`. `cost_budget.rs`: `CostBudgetMiddleware`. `repeated_failure.rs`: `RepeatedToolFailureMiddleware` (class-specific recovery budgets before the next model call; equivalent failures share a stable resource scope even when arguments differ). `loop_guards.rs`: `TerminalInferenceFailure`. `credential_scrub.rs`: the browser confirmation-token exemption and `credential_scrub_middleware()`, which wires the harness `CredentialScrubMiddleware`. The generic context-ladder and loop-guard middleware live in `tinyagents-harness` (`middleware::library`) and are installed by [`harness_context_ladder.rs`](./harness_context_ladder.rs) / `harness_assembly.rs`: `ImageAwareMessageTrimMiddleware`, `FinalCallWrapUpMiddleware` (host passes the `file_write`/`apply_patch` deliverable tools and `CLEARED_PLACEHOLDER`), `ArtifactIndexTocMiddleware` (issue #6014), `RepeatProgressMiddleware`/`RepeatEvictionObserver` (host passes the `wait_subagent` exemption), and `ArgRecoveryMiddleware`. |
+| [`middleware/research_budget.rs`](./middleware/research_budget.rs) | Withdraws the web tools from a top-level turn after eight successful search or fetch calls (forcing an answer only when no other tool remains), and notes once when consecutive web calls fail. |
| `model.rs` | Helpers and wrappers over native crate `ChatModel` values: message/response translation, usage merging, stream-delta forwarding, `MaxTokensModel`, `ProfileOverrideModel`. |
-| `tools.rs` | `CanonicalSharedToolAdapter`: resolves an OpenHuman shared tool registry and forwards the canonical `tinytools::Tool` contract; `EarlyExitHook` pauses successful `ask_user_clarification`-style calls. |
+| [`tools.rs`](./tools.rs) | `CanonicalSharedToolAdapter`: resolves an OpenHuman shared tool registry and forwards the canonical `tinytools::Tool` contract; `EarlyExitHook` pauses successful `ask_user_clarification`-style calls. |
| `routes.rs` | `WORKLOAD_ROUTE_TIERS` (the tier inventory projected into the model registry), `RequiredCapabilitiesMiddleware`, `FallbackObserverMiddleware`, `UsageCarryMiddleware`, and the per-model fallback policy. |
| `topology.rs` | `all_graph_topologies`: behaviour-free `GraphTopology` exports of every custom OpenHuman graph for debug/inspection. |
-| `observability.rs` + `observability/` | `event_bridge.rs`: `OpenhumanEventBridge`, translating crate `AgentEvent`s into `AgentProgress` and feeding per-call usage into `crate::platform::cost`. `event_projection.rs`: its `EventListener` impl. `cap_pauser.rs`: `CapPauser` and `SubagentScope`. `graph_tracing.rs`: `GraphTracingSink`. |
-| `host/steering.rs` | OpenHuman's steering allowlist and the shared `SteeringRegistry` for detached sub-agents. Task primitives are imported directly from `tinyagents_graph::orchestration`. |
-| `host/delegation.rs` | Explicit tracing-bound execution helpers over `tinyagents_graph::delegation`'s plan, execute, review, finalize graph. |
-| `payload_summarizer.rs` | `PayloadSummarizer` trait, `SummarizeOutcome`/`UnavailableReason`, and the default `SubagentPayloadSummarizer` that compresses oversized tool results through the `summarizer` sub-agent instead of hard-truncating them. |
-| `policy_denial.rs` | `maybe_enrich_policy_block`: rewrites `[policy-blocked]` tool results into structured what/why/workaround messages that tell the model to relay the denial rather than fabricate output. Called from `ToolOutcomeCaptureMiddleware`. |
-| `host/run_context.rs` + typed tool dispatch | `OpenHumanRunContext` owns one root `CancellationToken`; child contexts share it and recursive tools receive it from their typed parent `RunContext`. |
-| `steering_forwarder.rs` | Host adapter over `tinyagents_harness::run_queue::SteeringForwarderGuard` (forwards `RunQueue` steer/collect messages into the harness `SteeringHandle`; abort-on-drop so drop-based cancellation always deregisters it, issue #4456): `QueuedMessage for QueuedTurn`, the `RunQueue*` domain-event sink and the steering-registry cleanup hook. |
-| `stop_hooks.rs` | `StopHookMiddleware`: evaluates OpenHuman `StopHook`s after each model call and pauses the run via steering on the first `Stop` decision. |
+| [`observability.rs`](./observability.rs) + `observability/` | `event_bridge.rs`: `OpenhumanEventBridge`, translating crate `AgentEvent`s into `AgentProgress` and feeding per-call usage into `crate::platform::cost`. `event_projection.rs`: its `EventListener` impl. `cap_pauser.rs`: `CapPauser` and `SubagentScope`. `graph_tracing.rs`: `GraphTracingSink`. |
+| [`host/steering.rs`](./host/steering.rs) | OpenHuman's steering allowlist and the shared `SteeringRegistry` for detached sub-agents. Task primitives are imported directly from `tinyagents_graph::orchestration`. |
+| [`host/delegation.rs`](./host/delegation.rs) | Explicit tracing-bound execution helpers over `tinyagents_graph::delegation`'s plan, execute, review, finalize graph. |
+| [`payload_summarizer.rs`](./payload_summarizer.rs) | `PayloadSummarizer` trait, `SummarizeOutcome`/`UnavailableReason`, and the default `SubagentPayloadSummarizer` that compresses oversized tool results through the `summarizer` sub-agent instead of hard-truncating them. |
+| [`policy_denial.rs`](./policy_denial.rs) | `maybe_enrich_policy_block`: rewrites `[policy-blocked]` tool results into structured what/why/workaround messages that tell the model to relay the denial rather than fabricate output. Called from `ToolOutcomeCaptureMiddleware`. |
+| [`host/run_context.rs`](./host/run_context.rs) + typed tool dispatch | `OpenHumanRunContext` owns one root `CancellationToken`; child contexts share it and recursive tools receive it from their typed parent `RunContext`. |
+| [`steering_forwarder.rs`](./steering_forwarder.rs) | Host adapter over `tinyagents_harness::run_queue::SteeringForwarderGuard` (forwards `RunQueue` steer/collect messages into the harness `SteeringHandle`; abort-on-drop so drop-based cancellation always deregisters it, issue #4456): `QueuedMessage for QueuedTurn`, the `RunQueue*` domain-event sink and the steering-registry cleanup hook. |
+| [`stop_hooks.rs`](./stop_hooks.rs) | `StopHookMiddleware`: evaluates OpenHuman `StopHook`s after each model call and pauses the run via steering on the first `Stop` decision. |
| `summarize.rs` | `ModelSummarizer` / `FaultTolerantCachingSummarizer` plus a context-window-aware `SummarizationPolicy` driving the crate's `ContextCompressionMiddleware`. |
-| `embeddings.rs` | `ProviderEmbeddingModel`: adapts `crate::inference::embedding_host::EmbeddingProvider` onto the crate's `EmbeddingModel` trait. |
-| `todos.rs` | `todos_store` / `scratch_todos_store` (the crate `Store` behind per-thread agent todos, `tinyagents_graph::todos`). |
-| `config.rs` | Maps OpenHuman's `Config` (including model pins) onto `tinyagents_harness::config` structs. |
+| [`embeddings.rs`](./embeddings.rs) | `ProviderEmbeddingModel`: adapts `crate::inference::embedding_host::EmbeddingProvider` onto the crate's `EmbeddingModel` trait. |
+| [`todos.rs`](./todos.rs) | `todos_store` / `scratch_todos_store` (the crate `Store` behind per-thread agent todos, `tinyagents_graph::todos`). |
+| [`config.rs`](./config.rs) | Maps OpenHuman's `Config` (including model pins) onto `tinyagents_harness::config` structs. |
| `*_tests.rs` | Sibling test suites for each file/part group above. |
## Tool search
@@ -81,7 +81,7 @@ Within the crate the entry point is `run_turn_via_tinyagents_shared` (`pub(crate
## RPC (`replay/`)
-Namespace `agent`, three read-only controllers registered in `core/all.rs` through `all_agent_replay_registered_controllers`, all over the durable stores in `journal.rs`:
+Namespace `agent`, three read-only controllers registered in [`core/all.rs`](../../core/all.rs) through `all_agent_replay_registered_controllers`, all over the durable stores in `journal.rs`:
| Method | Purpose |
| --- | --- |
@@ -93,24 +93,24 @@ Responses project the crate's own `AgentObservation` and `HarnessRunStatus` serd
## Dependencies
-- The vendored crates under `vendor/tinyagents/`: `tinyagents-harness`, `tinyagents-graph`, `tinyagents-registry`, plus `tinyinference` and `tinytools` from `vendor/tinyagents/vendor/`, all declared as path dependencies in `crates/openhuman-core/Cargo.toml`. Per AGENTS.md, use this vendored copy; a second path to the same crates creates incompatible Rust types.
+- The vendored crates under [`vendor/tinyagents/`](../../../../../vendor/tinyagents/): `tinyagents-harness`, `tinyagents-graph`, `tinyagents-registry`, plus `tinyinference` and `tinytools` from [`vendor/tinyagents/vendor/`](../../../../../vendor/tinyagents/vendor/), all declared as path dependencies in [`crates/openhuman-core/Cargo.toml`](../../../Cargo.toml). Per AGENTS.md, use this vendored copy; a second path to the same crates creates incompatible Rust types.
- `crate::agent::message_convert` for `TranscriptMessage` to/from crate `Message` conversion.
- `crate::agent::harness::{run_queue, tool_result_artifacts}` and `crate::agent::{messages, progress, stop_hooks, cost, hooks, subagent_host}`: the OpenHuman-side turn plumbing this seam plugs into.
- `crate::tools`: the canonical `tinytools::Tool` trait resolved by `CanonicalSharedToolAdapter`, and `tools::registry::denials` for recording policy blocks.
-- `crate::platform::cost`: the global cost tracker fed by `observability/event_bridge.rs` and `turn_outcome.rs`.
+- `crate::platform::cost`: the global cost tracker fed by [`observability/event_bridge.rs`](./observability/event_bridge.rs) and `turn_outcome.rs`.
- `crate::config` and `crate::inference`: tier constants, `Config`, providers, and embedding providers.
## Used by
-- `agent/session_host/turn/graph.rs`: the chat-turn route into `run_turn_via_tinyagents_shared`.
-- `agent/harness/graph.rs`: the channel/CLI bus turn route.
-- `agent/subagent_host/`: the sub-agent spawn route. It and the session route both build their context-window summarizer through `TurnModelSource::build_summarizer`.
-- `agent/session_host/builder/setters.rs`, `agent/subagent_host/ops/{provider,runner}.rs`, `channels/`: construct `TurnModelSource`.
-- `agent/bus.rs`: reads `TinyagentsTurnOutcome::resolved_route` after a turn.
-- `core/all.rs` (replay controllers) and `core/runtime/builder.rs` (`reaper::reap_orphaned_runs`).
-- `agent/todos/`: `todos::*` stores.
+- [`agent/session_host/turn/graph.rs`](../session_host/turn/graph.rs): the chat-turn route into `run_turn_via_tinyagents_shared`.
+- [`agent/harness/graph.rs`](../harness/graph.rs): the channel/CLI bus turn route.
+- [`agent/subagent_host/`](../subagent_host/): the sub-agent spawn route. It and the session route both build their context-window summarizer through `TurnModelSource::build_summarizer`.
+- [`agent/session_host/builder/setters.rs`](../session_host/builder/setters.rs), `agent/subagent_host/ops/{provider,runner}.rs`, `channels/`: construct `TurnModelSource`.
+- [`agent/bus.rs`](../bus.rs): reads `TinyagentsTurnOutcome::resolved_route` after a turn.
+- `core/all.rs` (replay controllers) and [`core/runtime/builder.rs`](../../core/runtime/builder.rs) (`reaper::reap_orphaned_runs`).
+- [`agent/todos/`](../todos/): `todos::*` stores.
- `flows/tinyflows/caps/{llm,prompt}.rs`: the message-conversion re-exports and `model::usage_info_from_response`.
-- `tools/README.md` names `CanonicalSharedToolAdapter` and `ToolPolicyMiddleware` as the primary tinyagents-side tool consumers.
+- [`tools/README.md`](../../tools/README.md) names `CanonicalSharedToolAdapter` and `ToolPolicyMiddleware` as the primary tinyagents-side tool consumers.
## Host adapters
diff --git a/crates/openhuman-core/src/agent/todos/README.md b/crates/openhuman-core/src/agent/todos/README.md
index 7d5260d569..525380ce2d 100644
--- a/crates/openhuman-core/src/agent/todos/README.md
+++ b/crates/openhuman-core/src/agent/todos/README.md
@@ -4,9 +4,9 @@ TinyAgents owns todo types, persistence, normalization, status transitions,
and markdown rendering (`tinyagents_graph::todos`). This directory contains
only OpenHuman agent-runtime adapters:
-- `ops.rs`: maps OpenHuman execution scopes (agent session, scratch) onto the
+- [`ops.rs`](./ops.rs): maps OpenHuman execution scopes (agent session, scratch) onto the
one in-process TinyAgents store.
-- `types.rs`: re-exports the TinyAgents types.
+- [`types.rs`](./types.rs): re-exports the TinyAgents types.
The model-facing `todo` tool lives in `crate::agent::tools::todo`. The list
reaches the frontend through the `todo` tool call in the turn's progress
diff --git a/crates/openhuman-core/src/agent/tools/README.md b/crates/openhuman-core/src/agent/tools/README.md
index fee1397047..6113309e32 100644
--- a/crates/openhuman-core/src/agent/tools/README.md
+++ b/crates/openhuman-core/src/agent/tools/README.md
@@ -2,7 +2,7 @@
Tools that act on the agent loop itself, its todo list, or the user's stored
preferences, rather than on files, memory, or the network. `crate::tools`
-re-exports everything here (`tools/mod.rs` re-exports `crate::agent::tools`),
+re-exports everything here ([`tools/mod.rs`](../../tools/mod.rs) re-exports `crate::agent::tools`),
and `tools::ops` registers them into the tool catalog; nothing outside this
crate should construct them directly.
@@ -11,12 +11,12 @@ crate should construct them directly.
| Tool | File | Wire name (if different) |
| --- | --- | --- |
| `AskClarificationTool` | `tinyagents_harness::tools` | `ask_user_clarification` |
-| `DelegateTool` | `delegate.rs` | `delegate` |
-| `PlanExitTool` | `plan_exit.rs` | `plan_exit` |
+| `DelegateTool` | [`delegate.rs`](./delegate.rs) | `delegate` |
+| `PlanExitTool` | [`plan_exit.rs`](./plan_exit.rs) | `plan_exit` |
| `RememberPreferenceTool` | `remember_preference.rs` | `remember_preference` |
| `SavePreferenceTool` | `save_preference.rs` | `save_preference` |
-| `RunWorkflowTool`, `AwaitWorkflowTool` | `run_workflow.rs` | `run_workflow`, `await_workflow` |
-| `TodoTool` | `todo.rs` | `todo` |
+| `RunWorkflowTool`, `AwaitWorkflowTool` | [`run_workflow.rs`](./run_workflow.rs) | `run_workflow`, `await_workflow` |
+| `TodoTool` | [`todo.rs`](./todo.rs) | `todo` |
`RunWorkflowTool` and `AwaitWorkflowTool` are compiled in only with the
`skills` feature; a build without it omits both tools from the catalog
diff --git a/crates/openhuman-core/src/agent/triage/README.md b/crates/openhuman-core/src/agent/triage/README.md
index 26eb07d0c0..2d01418179 100644
--- a/crates/openhuman-core/src/agent/triage/README.md
+++ b/crates/openhuman-core/src/agent/triage/README.md
@@ -9,9 +9,9 @@ notification ingest); those build a `TriggerEnvelope` and call in.
## Pipeline
-1. Envelope (`envelope.rs`): the caller builds a `TriggerEnvelope` via
+1. Envelope ([`envelope.rs`](./envelope.rs)): the caller builds a `TriggerEnvelope` via
`from_composio`, `from_webhook`, `from_cron` or `from_external`, or by
- filling the struct directly (`desktop/notifications/rpc.rs` does this for
+ filling the struct directly ([`desktop/notifications/rpc.rs`](../../desktop/notifications/rpc.rs) does this for
`TriggerSource::WebviewIntegration`). It carries the `TriggerSource` and
the raw payload, truncated to 8 KB when rendered into the prompt.
2. Evaluator (`evaluator*.rs`): `run_triage` sends the `trigger_triage`
@@ -26,25 +26,25 @@ notification ingest); those build a `TriggerEnvelope` and call in.
`TriggerEscalationFailed`. `decision.rs::parse_triage_decision` parses
the reply tolerantly (fenced JSON, prose around the object, trailing
commas, wrong-case action).
-3. Escalation (`escalation.rs`): `apply_decision` publishes
+3. Escalation ([`escalation.rs`](./escalation.rs)): `apply_decision` publishes
`TriggerEvaluated` for every action. `drop`/`acknowledge` do no further
work. `react`/`escalate` first pass `ApprovalGate::intercept_audited` with
tool key `triage.react` / `triage.escalate`, then build a root
`ParentExecutionContext` (`orchestration::parent_context::build_root_parent`)
and dispatch `trigger_reactor` or `orchestrator` via
`agent::subagent_host::run_subagent`.
-4. Origin (`origin.rs`): every caller scopes an `AgentTurnOrigin` around
+4. Origin ([`origin.rs`](./origin.rs)): every caller scopes an `AgentTurnOrigin` around
`apply_decision` because `AGENT_TURN_ORIGIN` is a task-local and none of
the callers inherit one; an unscoped call reads `Unknown` and the gate
fails closed. `local_trigger_origin` (`Cli`, trust root, no audit row) is
for triggers the machine generated itself; `remote_trigger_origin`
(`TrustedAutomation::Workflow { require_approval: true }`) is for anything
whose payload came from outside.
-5. Events (`events.rs`): thin wrappers around `DomainEvent::Trigger*`
+5. Events ([`events.rs`](./events.rs)): thin wrappers around `DomainEvent::Trigger*`
(`TriggerEvaluated`, `TriggerEscalated`, `TriggerEscalationFailed`) so the
field list lives in one place.
-`routing.rs` resolves the arms. `resolve_provider_with_config` resolves the
+[`routing.rs`](./routing.rs) resolves the arms. `resolve_provider_with_config` resolves the
`chat` workload role and forces the managed backend whenever that
role points at a local runtime, a local CLI delegate, or an incomplete BYOK
route, so the initial attempt never depends on a local model being up.
@@ -59,8 +59,8 @@ the gate. Tests use a `_for_test` variant that skips the permit.
## Not routed through triage
`TriggerEnvelope::from_cron` still exists, but only the manual RPCs
-`agent.triage_evaluate` (`agent/schemas.rs`) and `webhooks.trigger_agent`
-(`skills/webhooks/ops.rs`) build one. The cron scheduler does not call
+`agent.triage_evaluate` ([`agent/schemas.rs`](../schemas.rs)) and `webhooks.trigger_agent`
+([`skills/webhooks/ops.rs`](../../skills/webhooks/ops.rs)) build one. The cron scheduler does not call
`run_triage`: `cron/scheduler/agent_run.rs::run_agent_job` runs the job's
agent directly, and `scheduler/delivery.rs` hard-codes
`triage_action: "react"` / `triage_reason: "Scheduled delivery"` on the
@@ -68,11 +68,11 @@ delivered notification for display.
## Public surface
-Re-exported from `mod.rs`:
+Re-exported from [`mod.rs`](./mod.rs):
- `TriggerEnvelope`, `TriggerSource`: `envelope.rs`.
- `TriageAction`, `TriageDecision`, `parse_triage_decision`, `ParseError`:
- `decision.rs`.
+ [`decision.rs`](./decision.rs).
- `run_triage(&envelope) -> anyhow::Result<TriageOutcome>`, `TriageOutcome`,
`TriageRun`, `TriageResolutionPath`: `evaluator*.rs`. Also `pub` on the
module: `TRIGGER_TRIAGE_AGENT_ID`.
@@ -84,7 +84,7 @@ Re-exported from `mod.rs`:
## Called by
-- `crates/openhuman-core/src/skills/webhooks/bus.rs`: incoming webhook
+- [`crates/openhuman-core/src/skills/webhooks/bus.rs`](../../skills/webhooks/bus.rs): incoming webhook
requests on a tunnel registered to an agent.
- `crates/openhuman-core/src/skills/webhooks/ops.rs`: `webhooks.trigger_agent`
manual RPC (`webhook` / `cron` / `external` sources).
@@ -92,7 +92,7 @@ Re-exported from `mod.rs`:
trigger events; `OPENHUMAN_TRIGGER_TRIAGE_DISABLED`,
`composio.triage_disabled`, and `composio.triage_disabled_toolkits` skip
the pipeline.
-- `crates/openhuman-core/src/integrations/task_sources/route.rs`: proactive
+- [`crates/openhuman-core/src/integrations/task_sources/route.rs`](../../integrations/task_sources/route.rs): proactive
task-source cards targeting `SourceTarget::AgentTodoProactive`.
- `crates/openhuman-core/src/desktop/notifications/rpc.rs`: background
triage spawned after `notification_ingest`; score persisted via
@@ -103,16 +103,16 @@ Re-exported from `mod.rs`:
## Related
-- `crates/openhuman-core/src/agent/registry/agents/trigger_triage/`: the
+- [`crates/openhuman-core/src/agent/registry/agents/trigger_triage/`](../registry/agents/trigger_triage/): the
classifier agent definition; `prompt.md` describes the JSON contract
`decision.rs` parses.
-- `crates/openhuman-core/src/agent/registry/agents/trigger_reactor/`: the
+- [`crates/openhuman-core/src/agent/registry/agents/trigger_reactor/`](../registry/agents/trigger_reactor/): the
single-step sub-agent `react` decisions dispatch to.
-- `crates/openhuman-core/src/cron/scheduler_gate/README.md`: the LLM-permit
+- [`crates/openhuman-core/src/cron/scheduler_gate/README.md`](../../cron/scheduler_gate/README.md): the LLM-permit
gate the local arm waits on.
## Tests
-`envelope_tests.rs`, `decision_tests.rs`, `escalation_tests.rs`,
-`evaluator_tests.rs`, `evaluator_deferral_tests.rs`, `evaluator_fallback_chain_tests.rs`, `events_tests.rs`,
-`origin_tests.rs`, `routing_tests.rs`.
+[`envelope_tests.rs`](./envelope_tests.rs), [`decision_tests.rs`](./decision_tests.rs), [`escalation_tests.rs`](./escalation_tests.rs),
+[`evaluator_tests.rs`](./evaluator_tests.rs), [`evaluator_deferral_tests.rs`](./evaluator_deferral_tests.rs), [`evaluator_fallback_chain_tests.rs`](./evaluator_fallback_chain_tests.rs), [`events_tests.rs`](./events_tests.rs),
+[`origin_tests.rs`](./origin_tests.rs), [`routing_tests.rs`](./routing_tests.rs).
diff --git a/crates/openhuman-core/src/backend/README.md b/crates/openhuman-core/src/backend/README.md
index c388504edf..e0f17e6838 100644
--- a/crates/openhuman-core/src/backend/README.md
+++ b/crates/openhuman-core/src/backend/README.md
@@ -9,9 +9,9 @@ into it; hosts install the actual transport.
The core has no dependency on `tinyhumans-sdk` and holds no hosted URL,
default, environment variable, header policy or product identity of its own.
-All of that belongs to the installed transport, and the helpers in `mod.rs`
+All of that belongs to the installed transport, and the helpers in [`mod.rs`](./mod.rs)
ask it. The only production transport is `SdkBackendTransport` in
-`crates/openhuman-tinyhumans`, built on the vendored SDK.
+[`crates/openhuman-tinyhumans`](../../../openhuman-tinyhumans/), built on the vendored SDK.
## How it works
@@ -56,7 +56,7 @@ current call. The first hit wins:
`run_server_embedded_with_ready` or `run_core_from_args` rather than the
builder. `openhuman_tinyhumans::install` (or `RuntimeBuilder` for library
hosts) does the install.
-3. Under `cfg(test)` only, `PlainHttpTransport` from `transport/plain.rs`.
+3. Under `cfg(test)` only, `PlainHttpTransport` from [`transport/plain.rs`](./transport/plain.rs).
4. Otherwise `BackendTransportError::Unavailable`.
Production has no implicit fallback. A core nobody gave a transport runs
@@ -82,7 +82,7 @@ The two purposes differ only in how an operator override is treated: a
control-plane call must never land on an inference endpoint the user pointed
`api_url` at, while managed inference uses it as given. The transport owns
the defaults, the `BACKEND_URL` / `VITE_BACKEND_URL` overrides and that guard
-(`crates/openhuman-tinyhumans/src/backend/url.rs`).
+([`crates/openhuman-tinyhumans/src/backend/url.rs`](../../../openhuman-tinyhumans/src/backend/url.rs)).
### Sending an authenticated request
@@ -154,15 +154,15 @@ display text:
| Path | What it does |
| --- | --- |
| `mod.rs` | Re-exports, plus `base_url`, `require_base_url`, `inference_base_url`, `product_identity` and `attribution_headers`. No local URL, header or identity state. |
-| `client.rs` | `BackendClient`, `BackendApiError`, `flatten_authed_error`, endpoint checks and `finish_authed_json` classification. |
-| `client/channel.rs` | Channel routes on `BackendClient`: `send_channel_message`, `send_channel_typing`, `send_channel_edit`, `send_channel_delete`, `send_channel_reaction`, `create_channel_thread`, `update_channel_thread`, `list_channel_threads`. |
-| `classify.rs` | `is_budget_exhausted_message`, a one-line wrapper over `tinyinference_providers::is_budget_exhausted_message`. |
+| [`client.rs`](./client.rs) | `BackendClient`, `BackendApiError`, `flatten_authed_error`, endpoint checks and `finish_authed_json` classification. |
+| [`client/channel.rs`](./client/channel.rs) | Channel routes on `BackendClient`: `send_channel_message`, `send_channel_typing`, `send_channel_edit`, `send_channel_delete`, `send_channel_reaction`, `create_channel_thread`, `update_channel_thread`, `list_channel_threads`. |
+| [`classify.rs`](./classify.rs) | `is_budget_exhausted_message`, a one-line wrapper over `tinyinference_providers::is_budget_exhausted_message`. |
| [`transport/`](transport/README.md) | The port: `BackendTransport`, `BackendRequest`, `TransportProfile`, `BaseUrlPurpose`, `BackendTransportError`, the install slot, and shared helpers (`credential_headers`, `parse_body_text`, `unwrap_envelope`, `compose_url`). |
| `transport/plain.rs` | `PlainHttpTransport`, compiled only under `cfg(test)` so the core's wiremock tests need no host crate. It applies no route policy. |
## Key types and entry points
-- `BackendTransport` (`transport/mod.rs`) is the trait a transport
+- `BackendTransport` ([`transport/mod.rs`](./transport/mod.rs)) is the trait a transport
implements: `send_json`, `send_multipart`, `http_client(profile)`,
`base_url(configured, purpose)`, `product_identity`,
`attribution_headers` and `name`. Implementations are process-wide
@@ -172,12 +172,12 @@ display text:
profile (`Api` for control-plane REST, `Integrations` for
`/agent-integrations/*`), base URL, method, path, query pairs, JSON body,
optional credential, and whether to unwrap the `{success, data}` envelope.
-- `BackendTransportError` (`transport/error.rs`) mirrors the SDK error arms
+- `BackendTransportError` ([`transport/error.rs`](./transport/error.rs)) mirrors the SDK error arms
the classifiers match on: `Unavailable`, `Url`, `Http`, `Status`,
`ChannelMessageNotFound`, `ChannelMessageRouteMissing`, `Envelope`,
`Header`, `Decode`, `RouteNotExposed`, `Other`.
- `install_backend_transport`, `resolve_backend_transport`, `is_installed`
- (`transport/install.rs`) manage the process slot.
+ ([`transport/install.rs`](./transport/install.rs)) manage the process slot.
- `BackendClient` (`client.rs`) is the client domains hold. Besides
`authed_json` it has `url_for(path)` and `raw_client()`, which returns the
transport's `Api`-profile `reqwest::Client` (attribution headers, no
@@ -192,21 +192,21 @@ display text:
and wire classification belong to the transport implementation in
`crates/openhuman-tinyhumans` (`src/transport/`, `src/backend/url.rs`,
`src/backend/headers.rs`, `src/backend/product.rs`).
-- Backend routes are defined in `vendor/tinyhumans-sdk`. Add a missing route
+- Backend routes are defined in [`vendor/tinyhumans-sdk`](../../../../vendor/tinyhumans-sdk/). Add a missing route
there (its unexposed-route registry is the policy the transport enforces)
and then name it from the core. Do not recreate route implementations in
this folder.
- Account-bound hosted routes (link tokens, OAuth connect and handoff,
billing, team, webhook tunnels, announcements) are called from
- `crates/openhuman-tinyhumans/src/hosted/` on the SDK's typed clients, not
+ [`crates/openhuman-tinyhumans/src/hosted/`](../../../openhuman-tinyhumans/src/hosted/) on the SDK's typed clients, not
through `BackendClient`. The integration token handoff decrypt lives in
- `crates/openhuman-tinyhumans/src/hosted/oauth/handoff.rs`.
+ [`crates/openhuman-tinyhumans/src/hosted/oauth/handoff.rs`](../../../openhuman-tinyhumans/src/hosted/oauth/handoff.rs).
- Session-token lookup, JWT parsing and `Authorization` formatting live in
`security::credentials::jwt`. The core never obtains, exchanges or validates
a session.
- The Socket.IO handshake URL builder is `platform::socket::url::websocket_url`.
- `IntegrationClient::map_transport_error`
- (`integrations/client/errors.rs`) does the same classification job for
+ ([`integrations/client/errors.rs`](../integrations/client/errors.rs)) does the same classification job for
`/agent-integrations/*` traffic.
- Hosted memory does not go through this port. The TinyMemory engine uses its
own HTTP client and only takes `base_url`, `attribution_headers` and a
@@ -236,16 +236,16 @@ display text:
## Tests
-`client_tests.rs` covers base stripping in `BackendClient::new`, 401
+[`client_tests.rs`](./client_tests.rs) covers base stripping in `BackendClient::new`, 401
classification, `flatten_authed_error` and `backend_api_body_shape`.
-`client_channel_tests.rs` covers channel route shapes and, with a stub
-transport, the mapping of the typed channel-message 404s. `mod_tests.rs` and
-`transport/transport_tests.rs` cover the URL helpers and the port. The 404
+[`client_channel_tests.rs`](./client_channel_tests.rs) covers channel route shapes and, with a stub
+transport, the mapping of the typed channel-message 404s. [`mod_tests.rs`](./mod_tests.rs) and
+[`transport/transport_tests.rs`](./transport/transport_tests.rs) cover the URL helpers and the port. The 404
wire classification is tested where it lives
-(`vendor/tinyhumans-sdk/tests/classify.rs`,
-`crates/openhuman-tinyhumans/src/transport/channel_404_tests.rs`), and the
+([`vendor/tinyhumans-sdk/tests/classify.rs`](../../../../vendor/tinyhumans-sdk/tests/classify.rs),
+[`crates/openhuman-tinyhumans/src/transport/channel_404_tests.rs`](../../../openhuman-tinyhumans/src/transport/channel_404_tests.rs)), and the
attribution header tests are in
-`crates/openhuman-tinyhumans/src/backend/headers_tests.rs` and
-`crates/openhuman-tinyhumans/src/transport/transport_tests.rs`.
+[`crates/openhuman-tinyhumans/src/backend/headers_tests.rs`](../../../openhuman-tinyhumans/src/backend/headers_tests.rs) and
+[`crates/openhuman-tinyhumans/src/transport/transport_tests.rs`](../../../openhuman-tinyhumans/src/transport/transport_tests.rs).
Run with `cargo test -p openhuman backend::` or `pnpm debug rust backend::`.
diff --git a/crates/openhuman-core/src/backend/transport/README.md b/crates/openhuman-core/src/backend/transport/README.md
index 429a42c099..511d86fe5b 100644
--- a/crates/openhuman-core/src/backend/transport/README.md
+++ b/crates/openhuman-core/src/backend/transport/README.md
@@ -16,11 +16,11 @@ panicking.
| File | Purpose |
| --- | --- |
-| `mod.rs` | `BackendTransport` trait, `BackendRequest`, `TransportProfile`, `credential_headers`, `parse_body_text`, `unwrap_envelope`, `compose_url` |
-| `error.rs` | `BackendTransportError`, the core-owned mirror of the variants classifiers match on |
-| `install.rs` | Process-global install/resolve for the transport, plus the `CoreContext`-scoped lookup |
-| `plain.rs` | `cfg(test)`-only reqwest transport, so this crate's tests do not need a host crate |
-| `transport_tests.rs` | Tests for `mod.rs` (included via `#[path]`) |
+| [`mod.rs`](./mod.rs) | `BackendTransport` trait, `BackendRequest`, `TransportProfile`, `credential_headers`, `parse_body_text`, `unwrap_envelope`, `compose_url` |
+| [`error.rs`](./error.rs) | `BackendTransportError`, the core-owned mirror of the variants classifiers match on |
+| [`install.rs`](./install.rs) | Process-global install/resolve for the transport, plus the `CoreContext`-scoped lookup |
+| [`plain.rs`](./plain.rs) | `cfg(test)`-only reqwest transport, so this crate's tests do not need a host crate |
+| [`transport_tests.rs`](./transport_tests.rs) | Tests for `mod.rs` (included via `#[path]`) |
## Key types
@@ -62,7 +62,7 @@ Everything else under `crates/openhuman-core/src/api/` (routes in `rest.rs`,
attribution headers in `headers.rs`, URL resolution in `config.rs`) calls
through this trait rather than building `reqwest` requests directly. The
only production implementation is `SdkBackendTransport` in
-`crates/openhuman-tinyhumans`, built on top of the vendored `tinyhumans-sdk`,
+[`crates/openhuman-tinyhumans`](../../../../openhuman-tinyhumans/), built on top of the vendored `tinyhumans-sdk`,
and installed once per process by `openhuman_tinyhumans::install` (or
`RuntimeBuilder` for library hosts, or `CoreBuilder::backend_transport`).
diff --git a/crates/openhuman-core/src/channels/README.md b/crates/openhuman-core/src/channels/README.md
index 099135f04c..468905a251 100644
--- a/crates/openhuman-core/src/channels/README.md
+++ b/crates/openhuman-core/src/channels/README.md
@@ -2,7 +2,7 @@
This domain connects OpenHuman to external messaging platforms: Slack, Discord, Telegram, WhatsApp (Cloud API and, behind a feature, WhatsApp Web), IRC, Signal, iMessage, Email, Lark, Mattermost, DingTalk, QQ, Linq, Yuanbao, and the local CLI REPL. A message that arrives on one of those platforms is turned into an agent turn, and the agent's reply is sent back to the same chat. The domain also owns the `channels.*` RPC namespace the settings UI uses to connect and test providers, and the subscriber that delivers proactive messages (briefings, cron output) to the user's chosen channel.
-Most provider code is not here. Transports, provider construction, capability flags, remote-control commands, in-chat approval rendering and progressive reply choreography live in the vendored `tinychannels` crate (`vendor/tinychannels/`). This folder is the host side: it supplies credentials, the agent, approvals, voice, persistence and events, and decides policy.
+Most provider code is not here. Transports, provider construction, capability flags, remote-control commands, in-chat approval rendering and progressive reply choreography live in the vendored `tinychannels` crate ([`vendor/tinychannels/`](../../../../vendor/tinychannels/)). This folder is the host side: it supplies credentials, the agent, approvals, voice, persistence and events, and decides policy.
## How it works
@@ -10,16 +10,16 @@ There are two inbound paths. They look similar but run in different places.
### Path 1: native listeners (`start_channels`)
-When the user has connected at least one listening integration, the core spawns the channel runtime. `spawn_channels_service` in `core/runtime/services.rs` captures the current channel session token, loads the config, checks `channels_config.has_listening_integrations()`, and calls `start_channels_with_session`. Setting `OPENHUMAN_DISABLE_CHANNEL_LISTENERS=1` skips the whole thing.
+When the user has connected at least one listening integration, the core spawns the channel runtime. `spawn_channels_service` in [`core/runtime/services.rs`](../core/runtime/services.rs) captures the current channel session token, loads the config, checks `channels_config.has_listening_integrations()`, and calls `start_channels_with_session`. Setting `OPENHUMAN_DISABLE_CHANNEL_LISTENERS=1` skips the whole thing.
-`runtime/startup/start_channels.rs` then does the boot work in this order:
+[`runtime/startup/start_channels.rs`](./runtime/startup/start_channels.rs) then does the boot work in this order:
1. Initialises the event bus and registers the subscribers a messaging core needs (health, thread persistence, Composio triggers, the web-chat surface subscribers, task sources) plus the native `agent.run_turn` handler. That handler must exist before the dispatch loop starts, because every inbound message is answered through it.
2. Resolves the chat model (`resolve_chat_workload` in `startup/chat_workload.rs` picks the managed cloud model or the user's per-workload provider), installs the live `SecurityPolicy`, builds the tool registry, and loads skills.
3. Builds the system prompt as a `ChannelSystemPrompt::refreshing` (see "System prompt" below). The fixed suffix is the XML tool-instruction block plus an advisory "Host access" section rendered by `startup/prompt.rs`.
4. Builds the `ChannelHost` capability surface (`host::build_channel_host`) and calls `tinychannels::build_channels` with a credential-hydrated config (`hydrate_channel_credentials` in `startup/credentials.rs` fills the email password and Yuanbao app secret from the keyring) and `RuntimeProxyClients` (the configured HTTP proxy).
5. Optionally connects the relay WebSocket runtime (`startup/relay.rs`) when `channels_config.relay` is configured.
-6. Spawns one supervised listener per provider (`runtime/supervision.rs`), registers the cron delivery subscriber, the cron channel bridge, the proactive subscriber, and the turn-state and approval-surface subscribers from `host/channel_events.rs`.
+6. Spawns one supervised listener per provider ([`runtime/supervision.rs`](./runtime/supervision.rs)), registers the cron delivery subscriber, the cron channel bridge, the proactive subscriber, and the turn-state and approval-surface subscribers from [`host/channel_events.rs`](./host/channel_events.rs).
7. Runs the dispatch loop until the session is cancelled.
```text
@@ -46,15 +46,15 @@ When the user has connected at least one listening integration, the core spawns
9. publish ChannelMessageProcessed
```
-Per-sender history is kept in memory in `ChannelRuntimeContext` (`context.rs`), keyed by `conversation_history_key` (channel, sender, reply target, thread). When a turn fails with a context-window overflow, the processor compacts that sender's history and asks the user to resend. Turns have a timeout (`message_timeout_secs`). Channel turns do no per-turn memory recall or autosave: memory reaches a session through `context.md`, injected by the session host, and committed turns are ingested from the `ConversationTurnCommitted` event.
+Per-sender history is kept in memory in `ChannelRuntimeContext` ([`context.rs`](./context.rs)), keyed by `conversation_history_key` (channel, sender, reply target, thread). When a turn fails with a context-window overflow, the processor compacts that sender's history and asks the user to resend. Turns have a timeout (`message_timeout_secs`). Channel turns do no per-turn memory recall or autosave: memory reaches a session through `context.md`, injected by the session host, and committed turns are ingested from the `ConversationTurnCommitted` event.
The listener supervisor reports through `OpenHumanListenerObserver`, which publishes `DomainEvent::ChannelConnected`, `ChannelDisconnected` and `HealthRestarted`. The full runtime walk-through, including account lifetime and logout, is in [runtime/README.md](runtime/README.md).
### Path 2: backend-relayed inbound (`ChannelInboundSubscriber`)
-The desktop app usually has no native listeners. Messages for hosted bots arrive over the backend socket instead: `platform/socket/event_handlers.rs` publishes `DomainEvent::ChannelInboundMessage`. `bus::ChannelInboundSubscriber` (`bus/subscriber.rs`) handles it. It is registered on the always-on boot path by `register_domain_subscribers` in `core/runtime/subscribers.rs`, not by `start_channels`, so it works on a core that never starts listeners.
+The desktop app usually has no native listeners. Messages for hosted bots arrive over the backend socket instead: [`platform/socket/event_handlers.rs`](../platform/socket/event_handlers.rs) publishes `DomainEvent::ChannelInboundMessage`. `bus::ChannelInboundSubscriber` ([`bus/subscriber.rs`](./bus/subscriber.rs)) handles it. It is registered on the always-on boot path by `register_domain_subscribers` in [`core/runtime/subscribers.rs`](../core/runtime/subscribers.rs), not by `start_channels`, so it works on a core that never starts listeners.
-The subscriber derives a thread id from (channel, sender, reply target, thread) with `derive_inbound_thread_id`, starts a turn through `web_chat::start_chat`, and watches the web-channel event stream for that request. The reply is shown progressively with `tinychannels::delivery::progressive::ProgressiveReply`: a draft that is edited as text streams in, typing refreshes, and filler bubbles on slow turns, then a finalize. The transport underneath is `BackendProgressiveSender` (`bus/delivery.rs`), which sends through `BackendClient` with idempotency keys and maps typed `BackendApiError`s (`ChannelEditUnsupported`, `MessageNotFound`) to the recoveries the progressive driver expects.
+The subscriber derives a thread id from (channel, sender, reply target, thread) with `derive_inbound_thread_id`, starts a turn through `web_chat::start_chat`, and watches the web-channel event stream for that request. The reply is shown progressively with `tinychannels::delivery::progressive::ProgressiveReply`: a draft that is edited as text streams in, typing refreshes, and filler bubbles on slow turns, then a finalize. The transport underneath is `BackendProgressiveSender` ([`bus/delivery.rs`](./bus/delivery.rs)), which sends through `BackendClient` with idempotency keys and maps typed `BackendApiError`s (`ChannelEditUnsupported`, `MessageNotFound`) to the recoveries the progressive driver expects.
```text
backend socket --> DomainEvent::ChannelInboundMessage
@@ -71,57 +71,57 @@ The subscriber derives a thread id from (channel, sender, reply target, thread)
### Outbound: proactive messages
-`proactive.rs` subscribes to `DomainEvent::ProactiveMessageRequested`. Every proactive message goes to the web channel (`web_chat::publish_web_channel_event`). If the user has set an active external channel and that channel is in the started channel map, it is sent there too. The always-on boot registers a web-only variant (`register_web_only_proactive_subscriber`); the full runtime registers one with the real channel map and publishes its active-channel handle, so `channels.set_default` (through `set_runtime_active_channel`) takes effect without a restart.
+[`proactive.rs`](./proactive.rs) subscribes to `DomainEvent::ProactiveMessageRequested`. Every proactive message goes to the web channel (`web_chat::publish_web_channel_event`). If the user has set an active external channel and that channel is in the started channel map, it is sent there too. The always-on boot registers a web-only variant (`register_web_only_proactive_subscriber`); the full runtime registers one with the real channel map and publishes its active-channel handle, so `channels.set_default` (through `set_runtime_active_channel`) takes effect without a restart.
### Slash commands and remote control
-`routes.rs` intercepts messages starting with `/` before any turn runs. Portable commands (`/models`, `/providers` and the per-sender route override they set) come from `tinychannels::routes`. On providers with the `remote_control` capability, `/status`, `/sessions`, `/new` and `/help` are parsed and executed by `tinychannels::remote`, with `host/remote_control.rs` (`RuntimeRemoteControl`) answering from the runtime context, the thread store and the web-chat session cache.
+[`routes.rs`](./routes.rs) intercepts messages starting with `/` before any turn runs. Portable commands (`/models`, `/providers` and the per-sender route override they set) come from `tinychannels::routes`. On providers with the `remote_control` capability, `/status`, `/sessions`, `/new` and `/help` are parsed and executed by `tinychannels::remote`, with [`host/remote_control.rs`](./host/remote_control.rs) (`RuntimeRemoteControl`) answering from the runtime context, the thread store and the web-chat session cache.
### In-chat approvals
-When a tool call needs approval on a channel whose provider has `chat_approvals`, three pieces cooperate. The dispatch loop runs the turn inside an `ApprovalChatContext` whose thread id is the history key. `ChannelApprovalSurfaceSubscriber` (`host/channel_events.rs`) turns `ApprovalRequested` events into a prompt in that chat through `tinychannels::approvals::ApprovalSurface`. When the user replies yes or no, `try_route_approval_reply` (`runtime/dispatch/processor/approval.rs`) hands it to `ApprovalGate::decide` instead of starting a new turn. Any other text runs as a fresh turn, which cancels the parked call. Providers without the capability (email, CLI, webhooks) keep the "no chat context, allow" behaviour, since a prompt there would only time out.
+When a tool call needs approval on a channel whose provider has `chat_approvals`, three pieces cooperate. The dispatch loop runs the turn inside an `ApprovalChatContext` whose thread id is the history key. `ChannelApprovalSurfaceSubscriber` (`host/channel_events.rs`) turns `ApprovalRequested` events into a prompt in that chat through `tinychannels::approvals::ApprovalSurface`. When the user replies yes or no, `try_route_approval_reply` ([`runtime/dispatch/processor/approval.rs`](./runtime/dispatch/processor/approval.rs)) hands it to `ApprovalGate::decide` instead of starting a new turn. Any other text runs as a fresh turn, which cancels the parked call. Providers without the capability (email, CLI, webhooks) keep the "no chat context, allow" behaviour, since a prompt there would only time out.
### System prompt
-`system_prompt.rs` owns when the prompt is rendered, not its text. `ChannelSystemPrompt` has two variants. `Fixed` is a literal used by tests. `Refreshing` keeps the render inputs (`ChannelPromptInputs`: tool descriptions, skills, model, the fixed suffix) and re-renders only when the identity fingerprint changes. The fingerprint is a hash of `(mtime, len)` for the workspace-root `SOUL.md` and `IDENTITY.md`, so a steady-state message costs two `stat` calls and gets the same `Arc<String>` back, which keeps the provider prefix cache warm. The render itself is `build_system_prompt_with_identity` from `agent/context/channels_prompt.rs`, with the project context (identity files) placed after the tool schemas and access block.
+[`system_prompt.rs`](./system_prompt.rs) owns when the prompt is rendered, not its text. `ChannelSystemPrompt` has two variants. `Fixed` is a literal used by tests. `Refreshing` keeps the render inputs (`ChannelPromptInputs`: tool descriptions, skills, model, the fixed suffix) and re-renders only when the identity fingerprint changes. The fingerprint is a hash of `(mtime, len)` for the workspace-root `SOUL.md` and `IDENTITY.md`, so a steady-state message costs two `stat` calls and gets the same `Arc<String>` back, which keeps the provider prefix cache warm. The render itself is `build_system_prompt_with_identity` from [`agent/context/channels_prompt.rs`](../agent/context/channels_prompt.rs), with the project context (identity files) placed after the tool schemas and access block.
## Layout
| Path | What it does |
| --- | --- |
-| `mod.rs` | Module declarations, the feature-gate split, stable `channels::<provider>` paths and the public re-exports. |
-| `traits.rs` | Ungated re-export of `Channel`, `ChannelMessage`, `ChannelSendExt`, `SendMessage` from `tinychannels-bus`. |
-| `contract_schema.rs` | Ungated conversion of `tinychannels-bus` controller schemas into core `ControllerSchema`s; shared with `openhuman-tinyhumans`. |
+| [`mod.rs`](./mod.rs) | Module declarations, the feature-gate split, stable `channels::<provider>` paths and the public re-exports. |
+| [`traits.rs`](./traits.rs) | Ungated re-export of `Channel`, `ChannelMessage`, `ChannelSendExt`, `SendMessage` from `tinychannels-bus`. |
+| [`contract_schema.rs`](./contract_schema.rs) | Ungated conversion of `tinychannels-bus` controller schemas into core `ControllerSchema`s; shared with `openhuman-tinyhumans`. |
| `providers/` | One-line re-exports of each provider module from `tinychannels::providers`. See [providers/README.md](providers/README.md) for the provider table and how to add one. |
| `host/` | The OpenHuman implementation of the `tinychannels::host` boundary: `build_channel_host` and its adapters (`adapters.rs`), the approval-surface and turn-state subscribers (`channel_events.rs`), and the remote-control host (`remote_control.rs`). |
| `runtime/` | Startup, listener supervision, the account-lifetime session, and the dispatch pipeline. See [runtime/README.md](runtime/README.md). |
| `controllers/` | The `channels.*` RPC namespace and `OpenHumanChannelBackend`. See [controllers/README.md](controllers/README.md). |
-| `bus.rs`, `bus/` | `ChannelInboundSubscriber` (`subscriber.rs`), the backend progressive sender (`delivery.rs`), and the inbound thread-id re-export (`thread_id.rs`). |
+| [`bus.rs`](./bus.rs), `bus/` | `ChannelInboundSubscriber` (`subscriber.rs`), the backend progressive sender (`delivery.rs`), and the inbound thread-id re-export (`thread_id.rs`). |
| `context.rs` | `ChannelRuntimeContext`, per-sender history maps, history compaction, and timeout/backoff constants re-exported from `tinychannels::context`. |
| `routes.rs` | Slash-command parsing and per-sender route selection (provider and model overrides). |
| `proactive.rs` | `ProactiveMessageSubscriber` and the active-channel handle. |
| `system_prompt.rs` | `ChannelSystemPrompt`, `ChannelPromptInputs`, identity fingerprinting. |
-| `commands.rs` | `doctor_channels`: builds channels from the hydrated config and prints `tinychannels::runtime::check_channels_health` results. |
+| [`commands.rs`](./commands.rs) | `doctor_channels`: builds channels from the hydrated config and prints `tinychannels::runtime::check_channels_health` results. |
| `tests/` | Cross-channel integration suite (see Tests). |
## Key types and entry points
- `start_channels` / `start_channels_with_session` (`runtime/startup/start_channels.rs`) boot the native runtime. The `_with_session` form takes a `CancellationToken` captured before config loading, which is what `spawn_channels_service` uses.
-- `session::channel_session` and `session::invalidate_channel_session` (`runtime/session.rs`) hold the process's single `tinychannels::runtime::ChannelSession`. Logout calls `invalidate_channel_session` from `security/credentials/ops/credential.rs`, which cancels the running runtime and everything it owns.
+- `session::channel_session` and `session::invalidate_channel_session` ([`runtime/session.rs`](./runtime/session.rs)) hold the process's single `tinychannels::runtime::ChannelSession`. Logout calls `invalidate_channel_session` from [`security/credentials/ops/credential.rs`](../security/credentials/ops/credential.rs), which cancels the running runtime and everything it owns.
- `ChannelRuntimeContext` (`context.rs`) is the shared state every dispatch worker reads: channel map, tools, prompt, model, histories, route overrides, timeouts, and the full `Config` in production.
-- `process_channel_runtime_message` and `run_message_dispatch_loop` (`runtime/dispatch/processor/`) are the per-message pipeline and its bounded loop.
-- `resolve_target_agent` (`runtime/dispatch/routing.rs`) routes every channel turn to the `orchestrator` agent and builds its visible tool set, falling back to `AgentScoping::unscoped()` when the registry or definition is missing.
-- `build_channel_host` (`host/mod.rs`) assembles the `ChannelHost` from `CoreShutdownRegistry`, `VoiceTranscriber`, `VoiceSynthesizer`, `CoreApprovalGate`, `ConversationHistoryStore`, `OpenHumanEventSink` and `ConfigAllowlistStore`. Reactions, turn dispatch, the run ledger and pairing are left unset.
+- `process_channel_runtime_message` and `run_message_dispatch_loop` ([`runtime/dispatch/processor/`](./runtime/dispatch/processor/)) are the per-message pipeline and its bounded loop.
+- `resolve_target_agent` ([`runtime/dispatch/routing.rs`](./runtime/dispatch/routing.rs)) routes every channel turn to the `orchestrator` agent and builds its visible tool set, falling back to `AgentScoping::unscoped()` when the registry or definition is missing.
+- `build_channel_host` ([`host/mod.rs`](./host/mod.rs)) assembles the `ChannelHost` from `CoreShutdownRegistry`, `VoiceTranscriber`, `VoiceSynthesizer`, `CoreApprovalGate`, `ConversationHistoryStore`, `OpenHumanEventSink` and `ConfigAllowlistStore`. Reactions, turn dispatch, the run ledger and pairing are left unset.
- `ChannelInboundSubscriber` (`bus/subscriber.rs`) is the backend-relayed inbound path.
- `ProactiveMessageSubscriber` (`proactive.rs`) is outbound proactive delivery.
- `ChannelSystemPrompt` (`system_prompt.rs`) is the seed prompt for every turn.
-- `OpenHumanChannelBackend` (`controllers/backend.rs`) implements `tinychannels::ChannelBackend` for the RPC handlers.
-- `ChannelDefinition` and `ChannelAuthMode` are re-exported from `tinychannels::controllers` (through `controllers/definitions.rs`) for declarative provider metadata.
+- `OpenHumanChannelBackend` ([`controllers/backend.rs`](./controllers/backend.rs)) implements `tinychannels::ChannelBackend` for the RPC handlers.
+- `ChannelDefinition` and `ChannelAuthMode` are re-exported from `tinychannels::controllers` (through [`controllers/definitions.rs`](./controllers/definitions.rs)) for declarative provider metadata.
- `build_system_prompt` is a re-export of `agent::context::channels_prompt::build_system_prompt`.
## RPC / CLI surface
-The `channels` namespace is registered from `controllers::all_channels_registered_controllers()` in `core/all.rs`, under `DomainGroup::Channels` and behind the `channels` feature. Schemas come from the `tinychannels-bus` contract.
+The `channels` namespace is registered from `controllers::all_channels_registered_controllers()` in [`core/all.rs`](../core/all.rs), under `DomainGroup::Channels` and behind the `channels` feature. Schemas come from the `tinychannels-bus` contract.
- Provider metadata: `channels.list`, `channels.describe`.
- Connection lifecycle: `channels.connect`, `channels.disconnect` (optionally forgetting the channel's stored conversations), `channels.status`, `channels.test`.
@@ -129,26 +129,26 @@ The `channels` namespace is registered from `controllers::all_channels_registere
- Discord: `channels.discord_list_guilds`, `channels.discord_list_channels`, `channels.discord_check_permissions`.
- Messaging through the backend: `channels.send_message`, `channels.send_reaction`, `channels.create_thread`, `channels.update_thread`, `channels.list_threads`.
-The managed-bot link methods `channels.telegram_login_start`, `telegram_login_check`, `discord_link_start` and `discord_link_check` are part of the contract but are not registered here. They are listed in `HOSTED_CHANNEL_FUNCTIONS` (`controllers/schemas.rs`) and served by `openhuman-tinyhumans` (`hosted/channel_link/`), which converts their schemas with `channels::contract_schema::contract_controller_schema`.
+The managed-bot link methods `channels.telegram_login_start`, `telegram_login_check`, `discord_link_start` and `discord_link_check` are part of the contract but are not registered here. They are listed in `HOSTED_CHANNEL_FUNCTIONS` ([`controllers/schemas.rs`](./controllers/schemas.rs)) and served by `openhuman-tinyhumans` (`hosted/channel_link/`), which converts their schemas with `channels::contract_schema::contract_controller_schema`.
The in-app web chat (RPC namespace `channel`, singular) is a separate domain in `web_chat/`.
## Boundaries
-- Provider transports, provider construction (`tinychannels::build_channels`), `ChannelManager`/`ChannelBackend`, per-provider `ChannelCapabilities`, remote-control commands (`tinychannels::remote`), approval prompts (`tinychannels::approvals`), progressive delivery, the relay transport, connect-form parsing and health checks all belong to `tinychannels` (`vendor/tinychannels/`, repo `tinyhumansai/tinychannels`). The transport-free trait and type contract is `vendor/tinychannels/crates/tinychannels-bus`. Fix provider bugs there, not with a host-side branch on a channel name; add a capability flag upstream instead.
+- Provider transports, provider construction (`tinychannels::build_channels`), `ChannelManager`/`ChannelBackend`, per-provider `ChannelCapabilities`, remote-control commands (`tinychannels::remote`), approval prompts (`tinychannels::approvals`), progressive delivery, the relay transport, connect-form parsing and health checks all belong to `tinychannels` (`vendor/tinychannels/`, repo `tinyhumansai/tinychannels`). The transport-free trait and type contract is [`vendor/tinychannels/crates/tinychannels-bus`](../../../../vendor/tinychannels/crates/tinychannels-bus/). Fix provider bugs there, not with a host-side branch on a channel name; add a capability flag upstream instead.
- The channel system prompt text is in `agent/context/channels_prompt.rs`.
- The agent turn itself is run by the `agent.run_turn` native handler registered by `agent::bus::register_agent_handlers`. The dispatch code never imports the harness directly.
-- Credential storage is `security/credentials/` (`AuthService`); the approval gate and `ApprovalChatContext` are `security/approval/`.
-- Config schema types come from `tinychannels_bus::config` through `config/schema/channels.rs`.
+- Credential storage is [`security/credentials/`](../security/credentials/) (`AuthService`); the approval gate and `ApprovalChatContext` are [`security/approval/`](../security/approval/).
+- Config schema types come from `tinychannels_bus::config` through [`config/schema/channels.rs`](../config/schema/channels.rs).
- Conversation memory ingestion and `forget_channel` are in `memory/conversations/`.
- Backend REST calls go through `backend::BackendClient`; Telegram and Discord link flows that need a TinyHumans account live in `openhuman-tinyhumans`.
- Speech-to-text and text-to-speech are the `voice/` domain, reached through the `host/` adapters.
- Web-chat turns, the web-channel event stream, and the surface subscribers are `web_chat/`.
-- Cron delivery is `cron/bus.rs` (`CronDeliverySubscriber`) and `cron/channel_bridge.rs`; `start_channels` hands them the started channel map.
+- Cron delivery is [`cron/bus.rs`](../cron/bus.rs) (`CronDeliverySubscriber`) and [`cron/channel_bridge.rs`](../cron/channel_bridge.rs); `start_channels` hands them the started channel map.
## Gotchas
-- The `channels` feature (default on; `channels = ["dep:tinychannels", "tinychannels/email", "tinychannels/lark"]` in `crates/openhuman-core/Cargo.toml`) gates almost everything. Three pieces stay ungated because always-on code names them: `traits` (the agent session host's interactive loop and `cron::bus`), `CliChannel` (re-exported from the unconditional `tinychannels-runtime` crate), and `contract_schema` (used by `openhuman-tinyhumans`). The config schema, the `DomainEvent` inbound envelope and security pairing resolve through `tinychannels-bus`, which is unconditional. The gate sheds no transitive packages; its value is compile surface and binary size. The `voice` feature also enables `dep:tinychannels` (for `EmailChannel` only), so a build without `channels` still links the crate unless `voice` is off too. `WhatsAppWebChannel` additionally needs the `whatsapp-web` feature.
+- The `channels` feature (default on; `channels = ["dep:tinychannels", "tinychannels/email", "tinychannels/lark"]` in [`crates/openhuman-core/Cargo.toml`](../../Cargo.toml)) gates almost everything. Three pieces stay ungated because always-on code names them: `traits` (the agent session host's interactive loop and `cron::bus`), `CliChannel` (re-exported from the unconditional `tinychannels-runtime` crate), and `contract_schema` (used by `openhuman-tinyhumans`). The config schema, the `DomainEvent` inbound envelope and security pairing resolve through `tinychannels-bus`, which is unconditional. The gate sheds no transitive packages; its value is compile surface and binary size. The `voice` feature also enables `dep:tinychannels` (for `EmailChannel` only), so a build without `channels` still links the crate unless `voice` is off too. `WhatsAppWebChannel` additionally needs the `whatsapp-web` feature.
- `start_channels` is skipped on cores with no listening integrations, which includes most desktop installs. Anything every core needs (the `ChannelInboundSubscriber`, the web-only proactive subscriber, tool-timeout seeding, self-improvement subscribers, the flows trigger subscriber) is registered in `core/runtime/subscribers.rs`, not in `start_channels`. Put new always-needed wiring there.
- Several registrations in `start_channels` overlap with `bootstrap_core_runtime` (agent handlers, the agent definition registry). They are written to be idempotent; keep them that way.
- The channel session token must be captured before the first `await` on config loading. Otherwise a logout during startup leaves a listener running for the old account.
@@ -157,7 +157,7 @@ The in-app web chat (RPC namespace `channel`, singular) is a separate domain in
## Tests
-Unit tests sit beside their modules as `*_tests.rs` files (for example `bus_tests.rs`, `routes_tests.rs`, `host/host_tests.rs`, `controllers/ops_tests.rs`, `runtime/startup_tests.rs`). The cross-channel integration suite in `tests/` (declared as `#[cfg(all(feature = "channels", test))] mod tests` in `mod.rs`) covers end-to-end dispatch, tool calls, health restarts, prompt assembly, and the Discord and Telegram flows; its `mod.rs` describes each file. Behaviour owned by `tinychannels` is tested upstream.
+Unit tests sit beside their modules as `*_tests.rs` files (for example [`bus_tests.rs`](./bus_tests.rs), [`routes_tests.rs`](./routes_tests.rs), [`host/host_tests.rs`](./host/host_tests.rs), [`controllers/ops_tests.rs`](./controllers/ops_tests.rs), [`runtime/startup_tests.rs`](./runtime/startup_tests.rs)). The cross-channel integration suite in `tests/` (declared as `#[cfg(all(feature = "channels", test))] mod tests` in `mod.rs`) covers end-to-end dispatch, tool calls, health restarts, prompt assembly, and the Discord and Telegram flows; its `mod.rs` describes each file. Behaviour owned by `tinychannels` is tested upstream.
```bash
cargo test -p openhuman channels::
diff --git a/crates/openhuman-core/src/channels/controllers/README.md b/crates/openhuman-core/src/channels/controllers/README.md
index 61842b0551..980dfad324 100644
--- a/crates/openhuman-core/src/channels/controllers/README.md
+++ b/crates/openhuman-core/src/channels/controllers/README.md
@@ -6,10 +6,10 @@ Owns the `channels.*` RPC namespace: provider metadata, connect/disconnect lifec
| Path | Purpose |
| ---------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
-| `backend.rs` | `OpenHumanChannelBackend`, the OpenHuman implementation of `tinychannels::ChannelBackend`. `tinychannels::ChannelManager` calls back into it, and each method forwards to the matching `ops` function. `send_outbound_intent` first tries `tinychannels::relay::send_outbound_intent` when `relay_runtime_fronts_channel` says the relay-websocket transport fronts the channel, then falls back to `ops::channel_send_message` |
-| `definitions.rs` | Re-exports provider metadata (`ChannelDefinition`, `ChannelAuthMode`, `ChannelCapability`, `AuthModeSpec`, `FieldRequirement`, `all_channel_definitions`, `find_channel_definition`) from `tinychannels::controllers` |
+| [`backend.rs`](./backend.rs) | `OpenHumanChannelBackend`, the OpenHuman implementation of `tinychannels::ChannelBackend`. `tinychannels::ChannelManager` calls back into it, and each method forwards to the matching `ops` function. `send_outbound_intent` first tries `tinychannels::relay::send_outbound_intent` when `relay_runtime_fronts_channel` says the relay-websocket transport fronts the channel, then falls back to `ops::channel_send_message` |
+| [`definitions.rs`](./definitions.rs) | Re-exports provider metadata (`ChannelDefinition`, `ChannelAuthMode`, `ChannelCapability`, `AuthModeSpec`, `FieldRequirement`, `all_channel_definitions`, `find_channel_definition`) from `tinychannels::controllers` |
| `ops/` | Business logic behind each RPC handler, grouped by concern (connect, discord, messaging) |
-| `schemas.rs` | `all_registered_controllers` / `all_controller_schemas` and the thin RPC handlers: deserialize params, build a `ChannelManager<OpenHumanChannelBackend>` over the loaded config, call the manager, and shape the `Outcome`. Field schemas come from `tinychannels::controllers::channel_controller_schema`, converted by `from_channel_controller_schema` |
+| [`schemas.rs`](./schemas.rs) | `all_registered_controllers` / `all_controller_schemas` and the thin RPC handlers: deserialize params, build a `ChannelManager<OpenHumanChannelBackend>` over the loaded config, call the manager, and shape the `Outcome`. Field schemas come from `tinychannels::controllers::channel_controller_schema`, converted by `from_channel_controller_schema` |
## RPC surface
@@ -19,19 +19,19 @@ Owns the `channels.*` RPC namespace: provider metadata, connect/disconnect lifec
| Path | Purpose |
| ------------------------------------------------------------------------------------------------------------------------------------------------------ | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
-| `connect.rs` (+ `connect/`: `connect_channel.rs`, `disconnect.rs`, `email.rs`, `memory.rs`, `shared.rs`, `status.rs`, `test_channel.rs`) | `connect_channel`, `disconnect_channel`, `channel_status`, `test_channel`, `get_default_channel`/`set_default_channel`, clearing a disconnected channel's stored conversations through `memory::conversations::forget_channel` (`memory.rs`), email config persistence (`email.rs`; building and verifying email and Yuanbao configs is `tinychannels::controllers::build_email_config`, `tinychannels::providers::verify_email_credentials` and `tinychannels::providers::yuanbao::connect`), `connected_channel_slugs`, `merge_listener_health` (`pub(crate)`, re-exported from `ops/mod.rs` under `#[cfg(test)]`) |
+| `connect.rs` (+ `connect/`: `connect_channel.rs`, `disconnect.rs`, `email.rs`, `memory.rs`, `shared.rs`, `status.rs`, `test_channel.rs`) | `connect_channel`, `disconnect_channel`, `channel_status`, `test_channel`, `get_default_channel`/`set_default_channel`, clearing a disconnected channel's stored conversations through `memory::conversations::forget_channel` (`memory.rs`), email config persistence (`email.rs`; building and verifying email and Yuanbao configs is `tinychannels::controllers::build_email_config`, `tinychannels::providers::verify_email_credentials` and `tinychannels::providers::yuanbao::connect`), `connected_channel_slugs`, `merge_listener_health` (`pub(crate)`, re-exported from [`ops/mod.rs`](./ops/mod.rs) under `#[cfg(test)]`) |
| `discord.rs` | Discord OAuth link flow and guild/channel/permission listing |
| `messaging.rs` | `channel_send_message`, `channel_send_reaction`, `channel_create_thread`, `channel_update_thread`, `channel_list_threads` — all call the TinyHumans backend REST API (`crate::backend::BackendClient`); the only path that reaches the relay transport registry (`tinychannels::relay::runtime`) is `OpenHumanChannelBackend::send_outbound_intent` in `backend.rs` |
| `types.rs` | Re-exports of `tinychannels::controllers` result/snapshot types used by the ops layer |
-`connected_channel_slugs` (from `connect.rs`) is re-exported at `channels::controllers::connected_channel_slugs` for callers outside the controller registry; the `ops/mod.rs` comment cites the welcome agent's onboarding snapshot, but nothing outside `channels/controllers/` calls it today. `types.rs` re-exports the `tinychannels::controllers` result types (`ChannelStatusEntry`, `ChannelSendMessageResult`, and others) rather than defining its own.
+`connected_channel_slugs` (from `connect.rs`) is re-exported at `channels::controllers::connected_channel_slugs` for callers outside the controller registry; the `ops/mod.rs` comment cites the welcome agent's onboarding snapshot, but nothing outside [`channels/controllers/`](./) calls it today. `types.rs` re-exports the `tinychannels::controllers` result types (`ChannelStatusEntry`, `ChannelSendMessageResult`, and others) rather than defining its own.
## Wiring
-`crates/openhuman-core/src/core/all.rs` pushes `crate::channels::controllers::all_channels_registered_controllers()` under `DomainGroup::Channels` behind `#[cfg(feature = "channels")]`. The in-app web chat (`web_chat`, RPC namespace `channel`) is pushed under the same `DomainGroup::Channels` just above it and is not gated.
+[`crates/openhuman-core/src/core/all.rs`](../../core/all.rs) pushes `crate::channels::controllers::all_channels_registered_controllers()` under `DomainGroup::Channels` behind `#[cfg(feature = "channels")]`. The in-app web chat (`web_chat`, RPC namespace `channel`) is pushed under the same `DomainGroup::Channels` just above it and is not gated.
## Tests
-- `backend_tests.rs`.
-- `ops_tests.rs` (declared from `ops/mod.rs`; pulls in `ops_connect_status_tests.rs` and `ops_yuanbao_email_tests.rs`).
-- `schemas_tests.rs`.
+- [`backend_tests.rs`](./backend_tests.rs).
+- [`ops_tests.rs`](./ops_tests.rs) (declared from `ops/mod.rs`; pulls in [`ops_connect_status_tests.rs`](./ops_connect_status_tests.rs) and [`ops_yuanbao_email_tests.rs`](./ops_yuanbao_email_tests.rs)).
+- [`schemas_tests.rs`](./schemas_tests.rs).
diff --git a/crates/openhuman-core/src/channels/providers/README.md b/crates/openhuman-core/src/channels/providers/README.md
index f959fcfca2..da7f997898 100644
--- a/crates/openhuman-core/src/channels/providers/README.md
+++ b/crates/openhuman-core/src/channels/providers/README.md
@@ -1,6 +1,6 @@
# Providers
-Implementations live in `vendor/tinychannels/src/providers/`, not here. `mod.rs` re-exports each provider module from `tinychannels::providers`, which keeps the stable `crate::channels::providers::<name>` path, and via `channels/mod.rs` the shorter `crate::channels::<name>` path. Provider construction is upstream too: `runtime/startup.rs` calls `tinychannels::build_channels` with a credential-hydrated config and the `channels::host` capability surface.
+Implementations live in [`vendor/tinychannels/src/providers/`](../../../../../vendor/tinychannels/src/providers/), not here. [`mod.rs`](./mod.rs) re-exports each provider module from `tinychannels::providers`, which keeps the stable `crate::channels::providers::<name>` path, and via [`channels/mod.rs`](../mod.rs) the shorter `crate::channels::<name>` path. Provider construction is upstream too: `runtime/startup.rs` calls `tinychannels::build_channels` with a credential-hydrated config and the `channels::host` capability surface.
## Providers
@@ -33,11 +33,11 @@ What a provider can do beyond send/receive is declared once, upstream, in `tinyc
- `host/channel_events.rs::ChannelTurnStateSubscriber` records busy state for `/status`.
- `bus/`'s progressive reply shows draft, thinking and filler bubbles only where `progressive_edits` is set.
-Ported providers reach host capabilities (voice, approvals, conversation history, shutdown, event sink) through the `tinychannels::host::ProviderContext` built in `channels::host` instead of calling OpenHuman internals directly; see `channels/host/mod.rs`.
+Ported providers reach host capabilities (voice, approvals, conversation history, shutdown, event sink) through the `tinychannels::host::ProviderContext` built in `channels::host` instead of calling OpenHuman internals directly; see [`channels/host/mod.rs`](../host/mod.rs).
## Adding a provider
-Provider transport, registration (`ChannelDefinition` metadata in `tinychannels::controllers`) and its capability entry belong upstream in `vendor/tinychannels`. Once a provider exists there:
+Provider transport, registration (`ChannelDefinition` metadata in `tinychannels::controllers`) and its capability entry belong upstream in [`vendor/tinychannels`](../../../../../vendor/tinychannels/). Once a provider exists there:
1. Add it to the `pub use tinychannels::providers::{...}` list in `providers/mod.rs`.
2. Add the matching `pub use providers::<name>` / `pub use <name>::<Name>Channel` pair to `channels/mod.rs`.
diff --git a/crates/openhuman-core/src/channels/runtime/README.md b/crates/openhuman-core/src/channels/runtime/README.md
index f3e02d9dc5..cd750eb24d 100644
--- a/crates/openhuman-core/src/channels/runtime/README.md
+++ b/crates/openhuman-core/src/channels/runtime/README.md
@@ -1,24 +1,24 @@
# Runtime
-Boots every enabled channel, keeps their listeners alive, and dispatches inbound messages into the agent loop. `mod.rs` exports `start_channels` and a crate-internal startup entry with a captured session lifetime; `dispatch` and `supervision` internals are `pub(crate)` for `channels/tests/` under `#[cfg(test)]`.
+Boots every enabled channel, keeps their listeners alive, and dispatches inbound messages into the agent loop. [`mod.rs`](./mod.rs) exports `start_channels` and a crate-internal startup entry with a captured session lifetime; `dispatch` and `supervision` internals are `pub(crate)` for [`channels/tests/`](../tests/) under `#[cfg(test)]`.
## Files
| Path | Purpose |
| --------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
-| `startup.rs` (+ `startup/`: `start_channels.rs`, `credentials.rs`, `chat_workload.rs`, `prompt.rs`, `relay.rs`) | `start_channels` builds the `channels::host` capability surface, hydrates secrets that live outside `config.toml` (`hydrate_channel_credentials`: email password, Yuanbao app secret, via `security::credentials::AuthService`), calls `tinychannels::build_channels`, registers the startup bus subscribers, spawns a supervised listener per channel and the optional relay runtime, then runs the dispatch loop |
-| `supervision.rs` | `spawn_supervised_listener` re-runs `Channel::listen` in a loop with exponential backoff plus full jitter, publishing `DomainEvent::ChannelConnected` / `ChannelDisconnected` / `HealthRestarted`; re-exports `tinychannels::runtime::compute_max_in_flight_messages` |
+| [`startup.rs`](./startup.rs) (+ `startup/`: `start_channels.rs`, `credentials.rs`, `chat_workload.rs`, `prompt.rs`, `relay.rs`) | `start_channels` builds the `channels::host` capability surface, hydrates secrets that live outside `config.toml` (`hydrate_channel_credentials`: email password, Yuanbao app secret, via `security::credentials::AuthService`), calls `tinychannels::build_channels`, registers the startup bus subscribers, spawns a supervised listener per channel and the optional relay runtime, then runs the dispatch loop |
+| [`supervision.rs`](./supervision.rs) | `spawn_supervised_listener` re-runs `Channel::listen` in a loop with exponential backoff plus full jitter, publishing `DomainEvent::ChannelConnected` / `ChannelDisconnected` / `HealthRestarted`; re-exports `tinychannels::runtime::compute_max_in_flight_messages` |
| `dispatch/` | The inbound pipeline that turns a `RuntimeChannelMessage` into an agent turn and a reply |
-| `test_support.rs` | `#[cfg(any(test, debug_assertions))]` dispatch harness (`run_dispatch_harness`, `DispatchHarnessOptions`) used by `channels/tests/` and raw coverage |
+| [`test_support.rs`](./test_support.rs) | `#[cfg(any(test, debug_assertions))]` dispatch harness (`run_dispatch_harness`, `DispatchHarnessOptions`) used by `channels/tests/` and raw coverage |
## Account lifetime
-Model authentication and account lifetime are separate. A local or CLI model can run without an OpenHuman backend session, but explicit logout cancels the old account's channel runtime. `spawn_channels_service` captures the channel lifetime before awaiting config loading, so logout also cancels a partially started runtime. `session.rs` holds the process's `tinychannels::runtime::ChannelSession` and stops the runtime on invalidation; owned listener/bridge tasks, dispatch workers, draft updaters, typing tasks, and relay reconnect supervision terminate when their owners drop. A runtime explicitly started again obtains a fresh lifetime; logout does not automatically start listeners for another account.
+Model authentication and account lifetime are separate. A local or CLI model can run without an OpenHuman backend session, but explicit logout cancels the old account's channel runtime. `spawn_channels_service` captures the channel lifetime before awaiting config loading, so logout also cancels a partially started runtime. [`session.rs`](./session.rs) holds the process's `tinychannels::runtime::ChannelSession` and stops the runtime on invalidation; owned listener/bridge tasks, dispatch workers, draft updaters, typing tasks, and relay reconnect supervision terminate when their owners drop. A runtime explicitly started again obtains a fresh lifetime; logout does not automatically start listeners for another account.
## Inbound path
-1. Each provider listener (`spawn_supervised_listener`, one per channel from `tinychannels::build_channels`) sends `traits::ChannelMessage`s on a bounded `mpsc` (capacity 100). A bridge task in `startup/start_channels.rs` wraps each into `RuntimeChannelMessage` and forwards it to the dispatch queue (also capacity 100). The relay runtime (`start_relay_runtime`) writes `RuntimeChannelMessage`s to that queue directly so relay inbound keeps its original TinyChannels envelope.
-2. `run_message_dispatch_loop` (`dispatch/processor.rs`, over `tinychannels::runtime::run_dispatch_loop`) drains the queue under a semaphore sized by `compute_max_in_flight_messages(listener_count)` and spawns a worker per message that calls `process_channel_runtime_message` (`processor/turn.rs`). `process_channel_message` is the `traits::ChannelMessage` wrapper for the same pipeline.
+1. Each provider listener (`spawn_supervised_listener`, one per channel from `tinychannels::build_channels`) sends `traits::ChannelMessage`s on a bounded `mpsc` (capacity 100). A bridge task in [`startup/start_channels.rs`](./startup/start_channels.rs) wraps each into `RuntimeChannelMessage` and forwards it to the dispatch queue (also capacity 100). The relay runtime (`start_relay_runtime`) writes `RuntimeChannelMessage`s to that queue directly so relay inbound keeps its original TinyChannels envelope.
+2. `run_message_dispatch_loop` ([`dispatch/processor.rs`](./dispatch/processor.rs), over `tinychannels::runtime::run_dispatch_loop`) drains the queue under a semaphore sized by `compute_max_in_flight_messages(listener_count)` and spawns a worker per message that calls `process_channel_runtime_message` (`processor/turn.rs`). `process_channel_message` is the `traits::ChannelMessage` wrapper for the same pipeline.
3. `process_channel_runtime_message` publishes `DomainEvent::ChannelMessageReceived`, then: if `channel_has_approval_surface` and `try_route_approval_reply` claims the message as a yes/no answer to a parked approval, stops there; otherwise starts typing, sends the ACK reaction (`select_acknowledgment_reaction`, threaded messages only), opens a streaming draft when the channel supports it, resolves scoping (`resolve_target_agent` + `build_visible_tool_set`), dispatches the turn over `BUS.native()` to the `agent.run_turn` handler (`agent::bus::register_agent_handlers`), sends the reply, and publishes `DomainEvent::ChannelMessageProcessed`.
## `dispatch/`
@@ -34,11 +34,11 @@ Two policy points here: `channel_has_approval_surface` follows the provider's `c
## Called by
-`channels::start_channels` is re-exported from `channels/mod.rs` and spawned by `spawn_channels_service` in `crates/openhuman-core/src/core/runtime/services.rs`, unless `OPENHUMAN_DISABLE_CHANNEL_LISTENERS` is set or `channels_config.has_listening_integrations()` is false. Web-chat-only desktop cores therefore never run it; `bus::ChannelInboundSubscriber` and the web-only proactive subscriber are registered on the always-on boot path in `core/runtime/subscribers.rs` instead.
+`channels::start_channels` is re-exported from [`channels/mod.rs`](../mod.rs) and spawned by `spawn_channels_service` in [`crates/openhuman-core/src/core/runtime/services.rs`](../../core/runtime/services.rs), unless `OPENHUMAN_DISABLE_CHANNEL_LISTENERS` is set or `channels_config.has_listening_integrations()` is false. Web-chat-only desktop cores therefore never run it; `bus::ChannelInboundSubscriber` and the web-only proactive subscriber are registered on the always-on boot path in [`core/runtime/subscribers.rs`](../../core/runtime/subscribers.rs) instead.
## Tests
-- `startup_tests.rs`, `startup_email_secret_tests_tests.rs`, `startup_yuanbao_secret_tests_tests.rs` (secret hydration precedence).
-- `supervision_tests.rs`.
-- `dispatch_tests.rs` (helpers: ACK reaction categories, context block shape), `dispatch/mod_scoping_tests_tests.rs` (`build_visible_tool_set` / `AgentScoping`), `dispatch/mod_approval_surface_gating_tests_tests.rs` (`channel_has_approval_surface`), `dispatch/routing_connected_fallback_tests_tests.rs` (`connected_with_fallback`: authoritative snapshot vs cached fallback on unavailable/timeout).
+- [`startup_tests.rs`](./startup_tests.rs), [`startup_email_secret_tests_tests.rs`](./startup_email_secret_tests_tests.rs), [`startup_yuanbao_secret_tests_tests.rs`](./startup_yuanbao_secret_tests_tests.rs) (secret hydration precedence).
+- [`supervision_tests.rs`](./supervision_tests.rs).
+- [`dispatch_tests.rs`](./dispatch_tests.rs) (helpers: ACK reaction categories, context block shape), [`dispatch/mod_scoping_tests_tests.rs`](./dispatch/mod_scoping_tests_tests.rs) (`build_visible_tool_set` / `AgentScoping`), [`dispatch/mod_approval_surface_gating_tests_tests.rs`](./dispatch/mod_approval_surface_gating_tests_tests.rs) (`channel_has_approval_surface`), [`dispatch/routing_connected_fallback_tests_tests.rs`](./dispatch/routing_connected_fallback_tests_tests.rs) (`connected_with_fallback`: authoritative snapshot vs cached fallback on unavailable/timeout).
- End-to-end dispatch coverage lives in `channels/tests/` (`runtime_dispatch`, `runtime_tool_calls`, `discord_integration`, `telegram_integration`, `health`).
diff --git a/crates/openhuman-core/src/commands/README.md b/crates/openhuman-core/src/commands/README.md
index 506aea6ebf..a67bc4faa6 100644
--- a/crates/openhuman-core/src/commands/README.md
+++ b/crates/openhuman-core/src/commands/README.md
@@ -5,7 +5,7 @@ slash-command menu offer right now? It has a single read-only controller,
`commands.list`, that merges the core's fixed built-in slash commands with the
live skill and workflow catalogs. The frontend calls it once
(`openhuman.commands_list` from
-`app/src/features/conversations/aui/useSlashCommandSource.ts`) instead of
+[`app/src/features/conversations/aui/useSlashCommandSource.ts`](../../../../app/src/features/conversations/aui/useSlashCommandSource.ts)) instead of
making three separate calls.
Listing a command here never runs it. Each entry tells the frontend how to
@@ -34,7 +34,7 @@ ops::commands_list
CommandsListResponse { commands: [CommandEntry, ...] }
```
-The built-ins come from the `BUILTINS` table in `ops.rs`: `/new`, `/clear`,
+The built-ins come from the `BUILTINS` table in [`ops.rs`](./ops.rs): `/new`, `/clear`,
`/plan`, `/build`, `/goal`, `/todo` and `/stop`. For each one the `id` is the
bare name (`"new"`), while `label` and `insert` keep the leading slash
(`"/new"`). The frontend inserts the `insert` text into the composer, and the
@@ -59,10 +59,10 @@ whole palette down, and the built-ins are always returned.
| Path | What it does |
| --- | --- |
-| `mod.rs` | Module declarations, re-exports of `CommandEntry` and `CommandKind`, and `all_commands_registered_controllers` for the registry. |
-| `types.rs` | Wire types: `CommandKind`, `CommandEntry`, `CommandsListResponse`. |
+| [`mod.rs`](./mod.rs) | Module declarations, re-exports of `CommandEntry` and `CommandKind`, and `all_commands_registered_controllers` for the registry. |
+| [`types.rs`](./types.rs) | Wire types: `CommandKind`, `CommandEntry`, `CommandsListResponse`. |
| `ops.rs` | The `BUILTINS` table, the in-process controller lookup, and `commands_list`. |
-| `schemas.rs` | The `commands.list` controller schema and its thin handler. |
+| [`schemas.rs`](./schemas.rs) | The `commands.list` controller schema and its thin handler. |
## Key types and entry points
@@ -78,7 +78,7 @@ whole palette down, and the built-ins are always returned.
- `commands_list` (`ops.rs`) is the business operation and returns
`Outcome<CommandsListResponse>`.
- `all_commands_registered_controllers` (`mod.rs`) is what
- `core/all.rs` pushes into the controller registry.
+ [`core/all.rs`](../core/all.rs) pushes into the controller registry.
## RPC / CLI surface
@@ -98,7 +98,7 @@ is part of the chat surface and always on.
`crate::flows` (backed by the `tinyflows` submodule).
- The menu UI, its local command registry and the merge with
frontend-only commands live in the app (`useSlashCommandSource.ts` and
- `app/src/lib/commands/`).
+ [`app/src/lib/commands/`](../../../../app/src/lib/commands/)).
## Gotchas
@@ -112,6 +112,6 @@ is part of the chat surface and always on.
## Tests
-Tests sit beside each module (`ops_tests.rs`, `schemas_tests.rs`,
-`types_tests.rs`). Run them with `cargo test -p openhuman commands::` or
+Tests sit beside each module ([`ops_tests.rs`](./ops_tests.rs), [`schemas_tests.rs`](./schemas_tests.rs),
+[`types_tests.rs`](./types_tests.rs)). Run them with `cargo test -p openhuman commands::` or
`pnpm debug rust commands::`.
diff --git a/crates/openhuman-core/src/config/README.md b/crates/openhuman-core/src/config/README.md
index 99da1f1fb9..6d4082c579 100644
--- a/crates/openhuman-core/src/config/README.md
+++ b/crates/openhuman-core/src/config/README.md
@@ -13,7 +13,7 @@ Nearly every other domain reads its slice of settings from here (`config.agent`,
### Where the config lives
Every user gets a directory under a shared root. The root is `~/.openhuman`, or `~/.openhuman-staging`
-when the app environment is `staging` (`app_env.rs` reads `OPENHUMAN_APP_ENV` / `VITE_OPENHUMAN_APP_ENV`,
+when the app environment is `staging` ([`app_env.rs`](./app_env.rs) reads `OPENHUMAN_APP_ENV` / `VITE_OPENHUMAN_APP_ENV`,
first at runtime, then as baked in at compile time).
```text
@@ -30,7 +30,7 @@ first at runtime, then as baked in at compile time).
workspace/ agent state: memory, sessions, skills, ...
```
-`schema/load/dirs.rs` resolves the pair `(config dir, workspace dir)` in a fixed order. The first match
+[`schema/load/dirs.rs`](./schema/load/dirs.rs) resolves the pair `(config dir, workspace dir)` in a fixed order. The first match
wins, and the winner is recorded as a `ConfigResolutionSource` in the load logs.
```text
@@ -62,7 +62,7 @@ go to `~/OpenHuman/projects/Files` unless overridden (`resolve_files_dir`).
### Loading
-`Config::load_or_init()` in `schema/load/impl_load.rs` is the authoritative startup path. After resolving
+`Config::load_or_init()` in [`schema/load/impl_load.rs`](./schema/load/impl_load.rs) is the authoritative startup path. After resolving
the directories it takes one of three branches:
```text
@@ -87,7 +87,7 @@ resolve dirs
save, chmod 0600, apply overrides, run_pending
```
-On success the resolved workspace is published to the cache in `schema/load/active_workspace.rs`, so
+On success the resolved workspace is published to the cache in [`schema/load/active_workspace.rs`](./schema/load/active_workspace.rs), so
`active_workspace_dir_cached()` can answer from synchronous code (the Event Log stamps every event this
way). `active_workspace_snapshot()` resolves the workspace again from disk and returns it with a revision
number, for callers that make one decision per workspace switch.
@@ -107,23 +107,23 @@ process-global user's settings.
Overrides are applied after parsing and never written back to disk.
-1. `Config::apply_env_overrides` (`schema/load/env_overlay.rs` plus one submodule per section) reads
+1. `Config::apply_env_overrides` ([`schema/load/env_overlay.rs`](./schema/load/env_overlay.rs) plus one submodule per section) reads
`OPENHUMAN_*` variables such as `OPENHUMAN_MODEL` and `OPENHUMAN_TOOL_DISPATCHER`. Only namespaced
names are honored. Tests call the pure `apply_env_overlay_with` with a map-backed `EnvLookup`
- (`schema/load/env.rs`) so they do not touch the process environment.
+ ([`schema/load/env.rs`](./schema/load/env.rs)) so they do not touch the process environment.
2. The same call publishes process-wide state: the proxy settings go to `set_runtime_proxy_config`
(and into the process environment when `proxy.scope` is `Environment`), and the embedding rate limit
goes to `tinyinference_embeddings`.
-3. CLI launch flags (`openhuman -p <provider> -m <model>`) are applied last by `schema/cli_overrides/`.
- `core/cli.rs` registers them with `set_cli_inference_overrides`, and `save` restores the persisted
+3. CLI launch flags (`openhuman -p <provider> -m <model>`) are applied last by [`schema/cli_overrides/`](./schema/cli_overrides/).
+ [`core/cli.rs`](../core/cli.rs) registers them with `set_cli_inference_overrides`, and `save` restores the persisted
values before serializing so a launch flag never lands in `config.toml`.
### Saving
`Config::save()` clones the config, restores CLI-overridden fields, encrypts secrets with the keyring's
-`SecretStore` (`schema/load/secrets.rs`, `enc2:` ChaCha20-Poly1305 values), serializes to TOML, and
+`SecretStore` ([`schema/load/secrets.rs`](./schema/load/secrets.rs), `enc2:` ChaCha20-Poly1305 values), serializes to TOML, and
writes a temp file that is chmod 0600 before any secret byte is written. It then fsyncs and hands off to
-`schema/load/atomic_commit.rs`, which copies the old file to `config.toml.bak` and renames the temp file
+[`schema/load/atomic_commit.rs`](./schema/load/atomic_commit.rs), which copies the old file to `config.toml.bak` and renames the temp file
into place. The live config is untouched unless the commit succeeds.
### Migrations
@@ -136,8 +136,8 @@ why the managed provider is seeded at creation by `seed_new_workspace` rather th
### Changing settings over RPC
-Each settings group follows the same pattern. A handler in `schemas/controllers/` deserializes params into
-an update struct from `schemas/helpers.rs`, converts it into a `*Patch` type, and calls
+Each settings group follows the same pattern. A handler in [`schemas/controllers/`](./schemas/controllers/) deserializes params into
+an update struct from [`schemas/helpers.rs`](./schemas/helpers.rs), converts it into a `*Patch` type, and calls
`ops::load_and_apply_*`. That function loads the config, applies the patch (`apply_*`), saves, and returns
an `Outcome<serde_json::Value>`. Business rules for each group (validation, model id checks, path
normalization) live in `ops/`, not in the handlers.
@@ -154,16 +154,16 @@ config.update_model_settings (JSON-RPC / CLI)
| Path | What it does |
| --- | --- |
-| `mod.rs` | Module declarations and the flat public API: re-exports the section types, path helpers, proxy helpers and model constants from `schema`, all of `ops` (also as `config::rpc`), and the controller lists. |
-| `schema/` | The `Config` struct (`schema/types/config.rs`), one file per section, defaults, the proxy client, CLI overrides, and the whole load/save pipeline under `schema/load/`. See [schema/README.md](schema/README.md). |
+| [`mod.rs`](./mod.rs) | Module declarations and the flat public API: re-exports the section types, path helpers, proxy helpers and model constants from `schema`, all of `ops` (also as `config::rpc`), and the controller lists. |
+| `schema/` | The `Config` struct ([`schema/types/config.rs`](./schema/types/config.rs)), one file per section, defaults, the proxy client, CLI overrides, and the whole load/save pipeline under [`schema/load/`](./schema/load/). See [schema/README.md](schema/README.md). |
| `ops/` | Settings operations behind the RPC surface: config snapshots, runtime flags, data paths, `reset_local_data`, and the `apply_*` / `load_and_apply_*` pairs per settings group. See [ops/README.md](ops/README.md). |
| `schemas/` | Controller schemas and thin handlers for the `config` namespace. `schema_defs/` holds the `ControllerSchema` definitions by group, `controllers/` the handlers, and `controllers/registry.rs` the lists. |
| `migrations/` | Version-gated startup migrations and `seed_new_workspace`. See [migrations/README.md](migrations/README.md). |
| `workspace/` | Workspace bootstrap (`init_workspace`) and the `workspace.*` RPCs over the editable persona files (`SOUL.md`, `IDENTITY.md`). Registers its own controllers. See [workspace/README.md](workspace/README.md). |
| `app_env.rs` | Reads the app environment (`production`, `staging`) used to pick the root directory. |
-| `daemon.rs` | `DaemonConfig`, a small bundle of `data_dir`, `workspace_dir` and the autonomy, security, reliability, secrets and audit sections, built from a Tauri app data dir by `from_app_data_dir`. Re-exported by `openhuman-embed`. |
-| `tools.rs` | Read-only agent tools over config: `config_snapshot`, `config_get_runtime_flags`, `config_get_client_config`, `config_get_autonomy`, `config_get_search`, `config_resolve_api_url`, `config_get_data_paths`. |
-| `workspace_handle.rs` | `workspace_handle(path)`, a short stable digest of a workspace path. Process-wide streams (Event Log, `core_notification`) carry it instead of the path so home directories never reach exported logs. |
+| [`daemon.rs`](./daemon.rs) | `DaemonConfig`, a small bundle of `data_dir`, `workspace_dir` and the autonomy, security, reliability, secrets and audit sections, built from a Tauri app data dir by `from_app_data_dir`. Re-exported by `openhuman-embed`. |
+| [`tools.rs`](./tools.rs) | Read-only agent tools over config: `config_snapshot`, `config_get_runtime_flags`, `config_get_client_config`, `config_get_autonomy`, `config_get_search`, `config_resolve_api_url`, `config_get_data_paths`. |
+| [`workspace_handle.rs`](./workspace_handle.rs) | `workspace_handle(path)`, a short stable digest of a workspace path. Process-wide streams (Event Log, `core_notification`) carry it instead of the path so home directories never reach exported logs. |
## Key types and entry points
@@ -172,18 +172,18 @@ config.update_model_settings (JSON-RPC / CLI)
| `Config` | `schema/types/config.rs` | The whole persisted document, plus runtime-only fields such as `config_path`, `workspace_dir`, `action_dir` and `recovered_from_corruption`. |
| `Config::load_or_init` | `schema/load/impl_load.rs` | Resolve, read, recover, migrate and decrypt the active user's config. |
| `Config::save` | `schema/load/impl_load.rs` | Encrypt secrets and replace `config.toml` atomically, keeping a `.bak`. |
-| `load_config_with_timeout` | `ops/loader/load.rs` | What domain code should call: timeout, embedder override, registry pricing. |
+| `load_config_with_timeout` | [`ops/loader/load.rs`](./ops/loader/load.rs) | What domain code should call: timeout, embedder override, registry pricing. |
| `load_config_for_workspace_with_timeout` | `ops/loader/load.rs` | Load the config that belongs to a given workspace. |
| `active_workspace_snapshot`, `active_workspace_dir_cached` | `schema/load/dirs.rs`, `schema/load/active_workspace.rs` | Which workspace is active now, async with revision or cached and synchronous. |
-| `user_openhuman_dir`, `pre_login_user_dir`, `write_active_user_id`, `clear_active_user` | `schema/load_user_state.rs` | Per-user directory layout and the `active_user.toml` marker. |
-| `build_runtime_proxy_client`, `apply_runtime_proxy_to_builder` | `schema/proxy.rs` | `reqwest` clients that honor the configured proxy for a named service key. |
-| `migrations::run_pending`, `CURRENT_SCHEMA_VERSION` | `migrations/mod.rs` | The startup migration runner. |
-| `DEFAULT_MODEL`, `MODEL_MANAGED_DEFAULT`, `LEGACY_TIER_MODELS`, `WORKLOAD_ROLES` | `schema/types/model_ids.rs` | Model id constants shared by inference and the settings UI. |
+| `user_openhuman_dir`, `pre_login_user_dir`, `write_active_user_id`, `clear_active_user` | [`schema/load_user_state.rs`](./schema/load_user_state.rs) | Per-user directory layout and the `active_user.toml` marker. |
+| `build_runtime_proxy_client`, `apply_runtime_proxy_to_builder` | [`schema/proxy.rs`](./schema/proxy.rs) | `reqwest` clients that honor the configured proxy for a named service key. |
+| `migrations::run_pending`, `CURRENT_SCHEMA_VERSION` | [`migrations/mod.rs`](./migrations/mod.rs) | The startup migration runner. |
+| `DEFAULT_MODEL`, `MODEL_MANAGED_DEFAULT`, `LEGACY_TIER_MODELS`, `WORKLOAD_ROLES` | [`schema/types/model_ids.rs`](./schema/types/model_ids.rs) | Model id constants shared by inference and the settings UI. |
| `DaemonConfig` | `daemon.rs` | Supervisor-level config bundle for embedders. |
## RPC surface
-All methods are in the `config` namespace and are registered by `core/all.rs` through
+All methods are in the `config` namespace and are registered by [`core/all.rs`](../core/all.rs) through
`all_config_registered_controllers()` under `DomainGroup::Config`. There are 41.
| Group | Methods |
@@ -198,17 +198,17 @@ All methods are in the `config` namespace and are registered by `core/all.rs` th
| Onboarding and UI | `get_onboarding_completed`, `set_onboarding_completed`, `workspace_onboarding_flag_exists`, `workspace_onboarding_flag_set`, `get_analytics_settings`, `update_analytics_settings`, `get_user_timezone`, `update_user_timezone` |
The `workspace` namespace (`file_read`, `file_write`, `file_reset`) is registered separately from
-`workspace/`. The read-only agent tools in `tools.rs` and `workspace/tools.rs` are re-exported through
-`crates/openhuman-core/src/tools/mod.rs`.
+`workspace/`. The read-only agent tools in `tools.rs` and [`workspace/tools.rs`](./workspace/tools.rs) are re-exported through
+[`crates/openhuman-core/src/tools/mod.rs`](../tools/mod.rs).
## Boundaries
- Secret encryption is done by `security::keyring::SecretStore`; this folder only decides which fields
are secrets and when to encrypt or decrypt them.
- The autonomy policy is defined here as data (`AutonomyConfig`, `[autonomy] enabled = false` by
- default) but enforced by `crates/openhuman-core/src/security/` (`SecurityPolicy::from_config`).
+ default) but enforced by [`crates/openhuman-core/src/security/`](../security/) (`SecurityPolicy::from_config`).
- Hosted backend URLs and their environment overrides belong to the installed backend transport
- (`crates/openhuman-tinyhumans/src/backend/url.rs`). `config.api_url` is only the user's stored value.
+ ([`crates/openhuman-tinyhumans/src/backend/url.rs`](../../../openhuman-tinyhumans/src/backend/url.rs)). `config.api_url` is only the user's stored value.
- Credentials and sign-in are not config. The core receives a credential through `auth.set_credential`;
login and `/auth/me` live in the host's session owner (`openhuman_tinyhumans::session`).
- Embedding hosts can supply their own `Config` (`CoreBuilder::config`), in which case
@@ -233,7 +233,7 @@ The `workspace` namespace (`file_read`, `file_write`, `file_reset`) is registere
## Tests
-Tests sit beside their modules as `*_tests.rs` files (`ops_*_tests.rs`, `schemas_tests.rs`,
+Tests sit beside their modules as `*_tests.rs` files (`ops_*_tests.rs`, [`schemas_tests.rs`](./schemas_tests.rs),
`schema/load_*_tests.rs`, one per section under `schema/`, and so on). Tests that mutate
`OPENHUMAN_WORKSPACE` share `TEST_ENV_LOCK` from `mod.rs`.
diff --git a/crates/openhuman-core/src/config/migrations/README.md b/crates/openhuman-core/src/config/migrations/README.md
index c2eba7eccd..8ccf994bfb 100644
--- a/crates/openhuman-core/src/config/migrations/README.md
+++ b/crates/openhuman-core/src/config/migrations/README.md
@@ -18,22 +18,22 @@ Startup data-migration runner gated by `Config::schema_version`. Each migration
| File | Role |
| --- | --- |
-| `crates/openhuman-core/src/config/migrations/mod.rs` | Module docstring + the `run_pending` runner, `seed_new_workspace`, and the `CURRENT_SCHEMA_VERSION` constant; declares each migration as a private `mod`. The 10→11 step (`reseed_cloud_providers`) is written inline here rather than as its own module. |
-| `crates/openhuman-core/src/config/migrations/phase_out_profile_md.rs` | **0→1.** Deletes `{workspace}/PROFILE.md` and strips `### PROFILE.md` blocks from persisted JSONL session transcripts (`session_raw/**`) and `.md` companions (`sessions/**`). Blocking fs I/O. |
-| `crates/openhuman-core/src/config/migrations/unify_ai_provider_settings.rs` | **1→2.** Consolidates scattered AI-provider settings into per-workload provider strings; seeds `cloud_providers` (always an `Openhuman` entry) and migrates a non-backend `inference_url` into a `Custom` cloud entry. Pure in-memory. |
-| `crates/openhuman-core/src/config/migrations/retire_chat_v1_model.rs` | **2→3.** Legacy `chat-v1` migration hook retained for schema-version progression; a no-op (the slug itself is retired by 12→13). Pure in-memory. |
-| `crates/openhuman-core/src/config/migrations/expand_autonomy_defaults.rs` | **3→4.** Additively merges expanded `autonomy.allowed_commands` / `auto_approve` defaults (PR #2500) and bumps `max_actions_per_hour` from the old `20` to `u32::MAX` only when still exactly `20`. Pure in-memory. |
-| `crates/openhuman-core/src/config/migrations/remove_write_auto_approve.rs` | **4→5.** Removes `file_write` / `edit_file` from `autonomy.auto_approve` so Supervised mode resumes its ask-before-edit prompt. Pure in-memory. |
-| `crates/openhuman-core/src/config/migrations/repair_http_request_limits.rs` | **5→6 (a).** Coerces stale-zero `[http_request]` `timeout_secs` / `max_response_size` to schema defaults (30s / 1 MB); a persisted `0` is an instant timeout / empty-body cap that serde defaults don't repair. Pure in-memory. |
-| `crates/openhuman-core/src/config/migrations/reconcile_orphaned_providers.rs` | **5→6 (b).** Resets per-workload `*_provider` strings (and a dangling `primary_cloud`) that point at a cloud provider no longer in `cloud_providers`, which the inference factory hard-errors on; mirrors the factory's exact grammar. Pure in-memory. |
-| `crates/openhuman-core/src/config/migrations/migrate_legacy_embedding_provider.rs` | **6→7.** Rewrites the removed `memory.embedding_provider = "fastembed"` to `ollama` + `bge-m3` when a local Ollama is reachable (`prefer_local`), else to the `managed` cloud default; resets model/dimensions to 1024. Pure in-memory apart from the runner's reachability probe. |
-| `crates/openhuman-core/src/config/migrations/normalize_default_model_tier.rs` | **7→8.** Rewrites a persisted `default_model` of `reasoning-v1` or `reasoning-quick-v1` to the managed default model; every other value (custom/BYOK ids, `None`) is left untouched. Pure in-memory. |
-| `crates/openhuman-core/src/config/migrations/enable_session_shadow_reads.rs` | **8→9.** Flips a persisted `agent.session_shadow_reads = false` to `true` once, because `Config::save` writes every field and the new serde default would never apply to upgraded workspaces. Pure in-memory. |
-| `crates/openhuman-core/src/config/migrations/retire_local_whisper_stt.rs` | **9→10.** Rewrites `stt_provider` (top-level or legacy `local_ai`) values naming the removed local whisper engine (`"whisper"`, `"local"`) to `"cloud"`, which defers to `voice_server.stt_engine`. Pure in-memory. |
+| [`crates/openhuman-core/src/config/migrations/mod.rs`](./mod.rs) | Module docstring + the `run_pending` runner, `seed_new_workspace`, and the `CURRENT_SCHEMA_VERSION` constant; declares each migration as a private `mod`. The 10→11 step (`reseed_cloud_providers`) is written inline here rather than as its own module. |
+| [`crates/openhuman-core/src/config/migrations/phase_out_profile_md.rs`](./phase_out_profile_md.rs) | **0→1.** Deletes `{workspace}/PROFILE.md` and strips `### PROFILE.md` blocks from persisted JSONL session transcripts (`session_raw/**`) and `.md` companions (`sessions/**`). Blocking fs I/O. |
+| [`crates/openhuman-core/src/config/migrations/unify_ai_provider_settings.rs`](./unify_ai_provider_settings.rs) | **1→2.** Consolidates scattered AI-provider settings into per-workload provider strings; seeds `cloud_providers` (always an `Openhuman` entry) and migrates a non-backend `inference_url` into a `Custom` cloud entry. Pure in-memory. |
+| [`crates/openhuman-core/src/config/migrations/retire_chat_v1_model.rs`](./retire_chat_v1_model.rs) | **2→3.** Legacy `chat-v1` migration hook retained for schema-version progression; a no-op (the slug itself is retired by 12→13). Pure in-memory. |
+| [`crates/openhuman-core/src/config/migrations/expand_autonomy_defaults.rs`](./expand_autonomy_defaults.rs) | **3→4.** Additively merges expanded `autonomy.allowed_commands` / `auto_approve` defaults (PR #2500) and bumps `max_actions_per_hour` from the old `20` to `u32::MAX` only when still exactly `20`. Pure in-memory. |
+| [`crates/openhuman-core/src/config/migrations/remove_write_auto_approve.rs`](./remove_write_auto_approve.rs) | **4→5.** Removes `file_write` / `edit_file` from `autonomy.auto_approve` so Supervised mode resumes its ask-before-edit prompt. Pure in-memory. |
+| [`crates/openhuman-core/src/config/migrations/repair_http_request_limits.rs`](./repair_http_request_limits.rs) | **5→6 (a).** Coerces stale-zero `[http_request]` `timeout_secs` / `max_response_size` to schema defaults (30s / 1 MB); a persisted `0` is an instant timeout / empty-body cap that serde defaults don't repair. Pure in-memory. |
+| [`crates/openhuman-core/src/config/migrations/reconcile_orphaned_providers.rs`](./reconcile_orphaned_providers.rs) | **5→6 (b).** Resets per-workload `*_provider` strings (and a dangling `primary_cloud`) that point at a cloud provider no longer in `cloud_providers`, which the inference factory hard-errors on; mirrors the factory's exact grammar. Pure in-memory. |
+| [`crates/openhuman-core/src/config/migrations/migrate_legacy_embedding_provider.rs`](./migrate_legacy_embedding_provider.rs) | **6→7.** Rewrites the removed `memory.embedding_provider = "fastembed"` to `ollama` + `bge-m3` when a local Ollama is reachable (`prefer_local`), else to the `managed` cloud default; resets model/dimensions to 1024. Pure in-memory apart from the runner's reachability probe. |
+| [`crates/openhuman-core/src/config/migrations/normalize_default_model_tier.rs`](./normalize_default_model_tier.rs) | **7→8.** Rewrites a persisted `default_model` of `reasoning-v1` or `reasoning-quick-v1` to the managed default model; every other value (custom/BYOK ids, `None`) is left untouched. Pure in-memory. |
+| [`crates/openhuman-core/src/config/migrations/enable_session_shadow_reads.rs`](./enable_session_shadow_reads.rs) | **8→9.** Flips a persisted `agent.session_shadow_reads = false` to `true` once, because `Config::save` writes every field and the new serde default would never apply to upgraded workspaces. Pure in-memory. |
+| [`crates/openhuman-core/src/config/migrations/retire_local_whisper_stt.rs`](./retire_local_whisper_stt.rs) | **9→10.** Rewrites `stt_provider` (top-level or legacy `local_ai`) values naming the removed local whisper engine (`"whisper"`, `"local"`) to `"cloud"`, which defers to `voice_server.stt_engine`. Pure in-memory. |
| *(inline in `mod.rs`)* | **10→11.** `reseed_cloud_providers`: backfills the managed `openhuman` entry for workspaces that were born past the `== 1` gate with `cloud_providers = []`; reuses `unify_ai_provider_settings::seed_cloud_providers`, which is a no-op on a populated list. On save failure rolls back both the version and the seeded entries. |
| `crates/openhuman-core/src/config/migrations/mod.rs` | **11→12.** Reserializes the config; the retired background-engine block it once rewrote no longer exists, so the save drops it. |
-| `crates/openhuman-core/src/config/migrations/retire_managed_tier_slugs.rs` | **12→13.** Retires the managed tier slugs (`chat-v1`, `agentic-v1`, …): every persisted one (`default_model`, orchestrator/team/delegate pins, `model_routes[].model`) becomes the managed default model (`openrouter/deepseek/deepseek-v4-flash`). Concrete ids and `hint:*` markers are untouched. Pure in-memory. |
-| `crates/openhuman-core/src/config/migrations/mod_tests.rs` | Tests for `run_pending` ordering, gating, rollback-on-save-failure. |
+| [`crates/openhuman-core/src/config/migrations/retire_managed_tier_slugs.rs`](./retire_managed_tier_slugs.rs) | **12→13.** Retires the managed tier slugs (`chat-v1`, `agentic-v1`, …): every persisted one (`default_model`, orchestrator/team/delegate pins, `model_routes[].model`) becomes the managed default model (`openrouter/deepseek/deepseek-v4-flash`). Concrete ids and `hint:*` markers are untouched. Pure in-memory. |
+| [`crates/openhuman-core/src/config/migrations/mod_tests.rs`](./mod_tests.rs) | Tests for `run_pending` ordering, gating, rollback-on-save-failure. |
| `crates/openhuman-core/src/config/migrations/*_tests.rs` | Per-migration unit tests; every migration module mounts its own `<name>_tests.rs` via `#[cfg(test)] #[path]`. |
## Public surface
@@ -73,8 +73,8 @@ Does not own a `store.rs`. Its effects are written through other layers:
## Used by
-- `crates/openhuman-core/src/config/schema/load/impl_load.rs` calls `migrations::run_pending(&mut config)` from `Config::load_or_init` (three call sites) and seeds new configs via `migrations::seed_new_workspace` with `schema_version: CURRENT_SCHEMA_VERSION`.
-- `crates/openhuman-core/src/config/mod.rs` declares `pub mod migrations;`.
+- [`crates/openhuman-core/src/config/schema/load/impl_load.rs`](../schema/load/impl_load.rs) calls `migrations::run_pending(&mut config)` from `Config::load_or_init` (three call sites) and seeds new configs via `migrations::seed_new_workspace` with `schema_version: CURRENT_SCHEMA_VERSION`.
+- [`crates/openhuman-core/src/config/mod.rs`](../mod.rs) declares `pub mod migrations;`.
## Notes / gotchas
diff --git a/crates/openhuman-core/src/config/ops/README.md b/crates/openhuman-core/src/config/ops/README.md
index b08ca39ee0..7248af88b1 100644
--- a/crates/openhuman-core/src/config/ops/README.md
+++ b/crates/openhuman-core/src/config/ops/README.md
@@ -3,8 +3,8 @@
JSON-RPC / CLI controller surface for persisted config and runtime flags: the
mutation half of `config`. `crate::config` re-exports this module both under
its own name and as `rpc` (`pub use ops as rpc`), so most callers write
-`config::rpc::*`. Controllers in `../schemas/` are thin wrappers around the
-functions here: they deserialize RPC params into `../schemas/helpers.rs`
+`config::rpc::*`. Controllers in [`../schemas/`](../schemas/) are thin wrappers around the
+functions here: they deserialize RPC params into [`../schemas/helpers.rs`](../schemas/helpers.rs)
`*SettingsUpdate` structs, map those field-by-field onto the `*SettingsPatch`
structs defined here, and call the corresponding `load_and_apply_*` / `get_*`
fn, which returns `Outcome<T>`.
@@ -13,13 +13,13 @@ fn, which returns `Outcome<T>`.
| File | Responsibility |
| --- | --- |
-| `agent.rs` | Autonomy, agent, agent-paths, and memory-sync settings. |
-| `loader.rs` | Config loading/snapshotting and runtime flags; split into submodules `loader/load.rs`, `loader/paths.rs`, `loader/reset_local_data.rs`, `loader/runtime_flags.rs`, `loader/snapshot.rs`. |
-| `model.rs` | AI-provider, memory, runtime, local-AI, and Composio-trigger settings. |
-| `privacy.rs` | Privacy Mode (`[privacy]`) get/set. |
-| `sandbox.rs` | Sandbox / Docker runtime (`[sandbox]`, `[runtime.docker]`) settings. |
-| `ui.rs` | Browser, analytics, dictation, voice-server, and onboarding-flag settings. |
-| `search.rs` | Search settings: providers, routes, role order, keys, limits, and the web-access allowlist. |
+| [`agent.rs`](./agent.rs) | Autonomy, agent, agent-paths, and memory-sync settings. |
+| [`loader.rs`](./loader.rs) | Config loading/snapshotting and runtime flags; split into submodules [`loader/load.rs`](./loader/load.rs), [`loader/paths.rs`](./loader/paths.rs), [`loader/reset_local_data.rs`](./loader/reset_local_data.rs), [`loader/runtime_flags.rs`](./loader/runtime_flags.rs), [`loader/snapshot.rs`](./loader/snapshot.rs). |
+| [`model.rs`](./model.rs) | AI-provider, memory, runtime, local-AI, and Composio-trigger settings. |
+| [`privacy.rs`](./privacy.rs) | Privacy Mode (`[privacy]`) get/set. |
+| [`sandbox.rs`](./sandbox.rs) | Sandbox / Docker runtime (`[sandbox]`, `[runtime.docker]`) settings. |
+| [`ui.rs`](./ui.rs) | Browser, analytics, dictation, voice-server, and onboarding-flag settings. |
+| [`search.rs`](./search.rs) | Search settings: providers, routes, role order, keys, limits, and the web-access allowlist. |
Each submodule follows the same shape: a `*SettingsPatch` struct with
`Option<T>` fields (`None` = unchanged); an `apply_*(&mut Config, patch)` fn
@@ -42,7 +42,7 @@ dictation and voice-server mutators exist only in `load_and_apply_*` form.
`core_rpc_url_from_env`, `agent_server_status`, `get_dashboard_settings`.
`BROWSER_ALLOW_ALL_ENV` (`OPENHUMAN_BROWSER_ALLOW_ALL`) and
`BROWSER_ALLOW_ALL_RPC_ENABLE_ENV` are `pub(crate)` constants re-exported
- from `mod.rs` only under `#[cfg(test)]`.
+ from [`mod.rs`](./mod.rs) only under `#[cfg(test)]`.
- `model.rs`: `apply_model_settings`, `apply_memory_settings`,
`apply_runtime_settings`, `apply_local_ai_settings`,
`apply_composio_trigger_settings`, `load_and_resolve_api_url`.
diff --git a/crates/openhuman-core/src/config/schema/README.md b/crates/openhuman-core/src/config/schema/README.md
index 5472952b5c..ffe40d44c2 100644
--- a/crates/openhuman-core/src/config/schema/README.md
+++ b/crates/openhuman-core/src/config/schema/README.md
@@ -3,58 +3,58 @@
Defines the `Config` struct, the single source of truth for `config.toml`,
and everything needed to load, save, and migrate it. AGENTS.md points
contributors here: "Rust configuration is defined under
-`crates/openhuman-core/src/config/schema/` and loaded through its config
-operations" (the operations live in `../ops/`, re-exported as `config::rpc`).
+[`crates/openhuman-core/src/config/schema/`](./) and loaded through its config
+operations" (the operations live in [`../ops/`](../ops/), re-exported as `config::rpc`).
-`Config` itself is split into submodules: `types.rs` declares `types/config.rs`
-(the struct definition), `types/model_ids.rs` (model constants), and
-`types/defaults.rs` / `types/output_language.rs` / `types/resolvers.rs` (small
+`Config` itself is split into submodules: [`types.rs`](./types.rs) declares [`types/config.rs`](./types/config.rs)
+(the struct definition), [`types/model_ids.rs`](./types/model_ids.rs) (model constants), and
+[`types/defaults.rs`](./types/defaults.rs) / [`types/output_language.rs`](./types/output_language.rs) / [`types/resolvers.rs`](./types/resolvers.rs) (small
helper types) purely to keep any one file under the repo's ~500-line
-guideline; treat them as one unit. `load_user_state.rs` sits at this level but
-is mounted as a submodule of `load/dirs.rs` via `#[path]`.
+guideline; treat them as one unit. [`load_user_state.rs`](./load_user_state.rs) sits at this level but
+is mounted as a submodule of [`load/dirs.rs`](./load/dirs.rs) via `#[path]`.
## Layout: `[section]` to file to struct
| `config.toml` section | File | Struct |
| --- | --- | --- |
-| `[agent]`, `[orchestrator]`, `[teams.*]`, `[agents.*]` | `agent.rs` | `AgentConfig`, `OrchestratorModelConfig`, `TeamModelConfig`, `DelegateAgentConfig` |
-| `[autonomy]` | `autonomy.rs` | `AutonomyConfig` — feeds `security::SecurityPolicy` |
-| `[[capability_providers]]` | `capability_providers.rs` | `CapabilityProviderConfig` |
-| `[channels_config]`, `[sandbox]` | `channels.rs` | `ChannelsConfig` and per-provider configs re-exported from `tinychannels_bus`; `SandboxConfig`, `ResourceLimitsConfig`, `AuditConfig`, and `SecurityConfig` (only `DaemonConfig` embeds the last one) |
-| `[claude_agent_sdk]` | `claude_agent_sdk.rs` | `ClaudeAgentSdkConfig` |
-| `[[cloud_providers]]`, `primary_cloud`, `*_provider` slugs | `cloud_providers.rs` | `CloudProviderCreds`, `CloudProviderType`, `AuthStyle` |
-| `[context]` | `context.rs` | `ContextConfig` |
-| `[cost]` | `identity_cost.rs` | `CostConfig`, `ModelPricing` |
-| `[dashboard]` | `dashboard.rs` | `DashboardConfig`, `DiagramViewerConfig`, `EventStreamConfig`, `ModelHealthConfig` |
-| `[dictation]` | `dictation.rs` | `DictationConfig`, `DictationActivationMode` |
-| `[ephemeral_route]` | `ephemeral_route.rs` | `EphemeralRoute` |
-| `[cron]` | `cron.rs` | `CronConfig` |
-| `[hooks]` | `hooks.rs` | `HooksConfig` |
-| `[hosting]` | `hosting.rs` | `HostingConfig` |
+| `[agent]`, `[orchestrator]`, `[teams.*]`, `[agents.*]` | [`agent.rs`](./agent.rs) | `AgentConfig`, `OrchestratorModelConfig`, `TeamModelConfig`, `DelegateAgentConfig` |
+| `[autonomy]` | [`autonomy.rs`](./autonomy.rs) | `AutonomyConfig` — feeds `security::SecurityPolicy` |
+| `[[capability_providers]]` | [`capability_providers.rs`](./capability_providers.rs) | `CapabilityProviderConfig` |
+| `[channels_config]`, `[sandbox]` | [`channels.rs`](./channels.rs) | `ChannelsConfig` and per-provider configs re-exported from `tinychannels_bus`; `SandboxConfig`, `ResourceLimitsConfig`, `AuditConfig`, and `SecurityConfig` (only `DaemonConfig` embeds the last one) |
+| `[claude_agent_sdk]` | [`claude_agent_sdk.rs`](./claude_agent_sdk.rs) | `ClaudeAgentSdkConfig` |
+| `[[cloud_providers]]`, `primary_cloud`, `*_provider` slugs | [`cloud_providers.rs`](./cloud_providers.rs) | `CloudProviderCreds`, `CloudProviderType`, `AuthStyle` |
+| `[context]` | [`context.rs`](./context.rs) | `ContextConfig` |
+| `[cost]` | [`identity_cost.rs`](./identity_cost.rs) | `CostConfig`, `ModelPricing` |
+| `[dashboard]` | [`dashboard.rs`](./dashboard.rs) | `DashboardConfig`, `DiagramViewerConfig`, `EventStreamConfig`, `ModelHealthConfig` |
+| `[dictation]` | [`dictation.rs`](./dictation.rs) | `DictationConfig`, `DictationActivationMode` |
+| `[ephemeral_route]` | [`ephemeral_route.rs`](./ephemeral_route.rs) | `EphemeralRoute` |
+| `[cron]` | [`cron.rs`](./cron.rs) | `CronConfig` |
+| `[hooks]` | [`hooks.rs`](./hooks.rs) | `HooksConfig` |
+| `[hosting]` | [`hosting.rs`](./hosting.rs) | `HostingConfig` |
| `[learning]` | `learning.rs` | `LearningConfig`, `ReflectionSource` |
-| `[local_ai]` | `local_ai.rs` | `LocalAiConfig`, `LocalAiUsage` |
-| `[modules]` | `modules.rs` | `ModulesConfig`, `ModuleOverride`: controls only whether compiled-in modules load. The loadable *set* is fixed by `crate::modules::registry` |
-| `[node]` | `node.rs` | `NodeConfig` (managed Node.js toolchain for skills) |
-| `[observability]` | `observability.rs` | `ObservabilityConfig`, `AgentTracingConfig` |
-| `[privacy]` | `privacy.rs` | `PrivacyConfig`, `PrivacyMode` |
-| `[proxy]` | `proxy.rs` | `ProxyConfig`, `ProxyScope`, plus `runtime_proxy_config()` / `set_runtime_proxy_config()` process-wide accessors |
-| `[[model_routes]]`, `[[embedding_routes]]` | `routes.rs` | `ModelRouteConfig`, `EmbeddingRouteConfig` |
-| `[runtime]` (+ `[runtime.docker]`), `[shell]`, `[reliability]`, `[scheduler]` | `runtime.rs` | `RuntimeConfig`, `DockerRuntimeConfig`, `ShellConfig`, `ReliabilityConfig`, `SchedulerConfig` |
-| `[runtime_pool]` | `runtime_pool.rs` | `RuntimePoolConfig`, `RuntimePoolLangConfig` |
-| `[runtime.local_jail]` | `runtime_local_jail.rs` | `LocalJailConfig` — filesystem grants for the local OS jail |
-| `[runtime_python]` | `runtime_python.rs` | `RuntimePythonConfig` |
-| `[scheduler_gate]` | `scheduler_gate.rs` | `SchedulerGateConfig`, `SchedulerGateMode` |
-| `[memory]` (engine, `engines.<id>`, `conversations`, `context`, `sources`, embedding settings) | `memory.rs` | `MemoryConfig`, `MemoryEngineSettings`, `MemoryConversationsConfig`, `MemoryContextConfig`, `MemorySourceConfig` (see `docs/specs/memory-v2.md`) |
-| `[task_sources]` | `task_sources.rs` | `TaskSourcesConfig` |
-| `[tokenjuice]` | `tokenjuice.rs` | `TokenjuiceConfig` |
+| `[local_ai]` | [`local_ai.rs`](./local_ai.rs) | `LocalAiConfig`, `LocalAiUsage` |
+| `[modules]` | [`modules.rs`](./modules.rs) | `ModulesConfig`, `ModuleOverride`: controls only whether compiled-in modules load. The loadable *set* is fixed by `crate::modules::registry` |
+| `[node]` | [`node.rs`](./node.rs) | `NodeConfig` (managed Node.js toolchain for skills) |
+| `[observability]` | [`observability.rs`](./observability.rs) | `ObservabilityConfig`, `AgentTracingConfig` |
+| `[privacy]` | [`privacy.rs`](./privacy.rs) | `PrivacyConfig`, `PrivacyMode` |
+| `[proxy]` | [`proxy.rs`](./proxy.rs) | `ProxyConfig`, `ProxyScope`, plus `runtime_proxy_config()` / `set_runtime_proxy_config()` process-wide accessors |
+| `[[model_routes]]`, `[[embedding_routes]]` | [`routes.rs`](./routes.rs) | `ModelRouteConfig`, `EmbeddingRouteConfig` |
+| `[runtime]` (+ `[runtime.docker]`), `[shell]`, `[reliability]`, `[scheduler]` | [`runtime.rs`](./runtime.rs) | `RuntimeConfig`, `DockerRuntimeConfig`, `ShellConfig`, `ReliabilityConfig`, `SchedulerConfig` |
+| `[runtime_pool]` | [`runtime_pool.rs`](./runtime_pool.rs) | `RuntimePoolConfig`, `RuntimePoolLangConfig` |
+| `[runtime.local_jail]` | [`runtime_local_jail.rs`](./runtime_local_jail.rs) | `LocalJailConfig` — filesystem grants for the local OS jail |
+| `[runtime_python]` | [`runtime_python.rs`](./runtime_python.rs) | `RuntimePythonConfig` |
+| `[scheduler_gate]` | [`scheduler_gate.rs`](./scheduler_gate.rs) | `SchedulerGateConfig`, `SchedulerGateMode` |
+| `[memory]` (engine, `engines.<id>`, `conversations`, `context`, `sources`, embedding settings) | [`memory.rs`](./memory.rs) | `MemoryConfig`, `MemoryEngineSettings`, `MemoryConversationsConfig`, `MemoryContextConfig`, `MemorySourceConfig` (see [`docs/specs/memory-v2.md`](../../../../../docs/specs/memory-v2.md)) |
+| `[task_sources]` | [`task_sources.rs`](./task_sources.rs) | `TaskSourcesConfig` |
+| `[tokenjuice]` | [`tokenjuice.rs`](./tokenjuice.rs) | `TokenjuiceConfig` |
| tool-related sections (see below) | `tools/` | (multiple structs) |
-| `[update]` | `update.rs` | `UpdateConfig`, `UpdateRestartStrategy` |
-| `[voice_server]` | `voice_server.rs` | `VoiceServerConfig`, `SttEngine`, `VoiceActivationMode` |
-| `[[voice_providers]]`, `stt_provider` / `tts_provider` | `voice_providers.rs` | `VoiceProviderCreds`, `BuiltinVoiceProvider`, `BUILTIN_VOICE_PROVIDERS` |
+| `[update]` | [`update.rs`](./update.rs) | `UpdateConfig`, `UpdateRestartStrategy` |
+| `[voice_server]` | [`voice_server.rs`](./voice_server.rs) | `VoiceServerConfig`, `SttEngine`, `VoiceActivationMode` |
+| `[[voice_providers]]`, `stt_provider` / `tts_provider` | [`voice_providers.rs`](./voice_providers.rs) | `VoiceProviderCreds`, `BuiltinVoiceProvider`, `BUILTIN_VOICE_PROVIDERS` |
| top-level `Config` and its scalar keys | `types.rs` (+ `types/config.rs`, `types/model_ids.rs`) | `Config`, `ModelRegistryEntry`, `MODEL_*` / `DEFAULT_MODEL` constants |
-| built-in defaults | `defaults.rs` | `impl Default for Config` and per-field `default_*` fns |
+| built-in defaults | [`defaults.rs`](./defaults.rs) | `impl Default for Config` and per-field `default_*` fns |
-`tools/mod.rs` groups the tool-facing sections: `browser.rs` (`BrowserConfig`,
+[`tools/mod.rs`](./tools/mod.rs) groups the tool-facing sections: `browser.rs` (`BrowserConfig`,
`BrowserComputerUseConfig`), `http.rs` (`HttpRequestConfig`, `CurlConfig`),
`integrations.rs` (`IntegrationsConfig`, `ComposioConfig`, `SecretsConfig`),
`mcp.rs` (`McpServerConfig`, `McpClientConfig`, `GitbooksConfig`),
@@ -64,13 +64,13 @@ is mounted as a submodule of `load/dirs.rs` via `#[path]`.
`direct` route per provider), `roles` (ordered providers per capability role),
`presentation`, limits, and direct keys; fresh installs default to managed Exa
and managed Gemini. Files without `schema_version` carry the single-engine
-format and are migrated on load (`tools/search_migrate.rs`,
+format and are migrated on load ([`tools/search_migrate.rs`](./tools/search_migrate.rs),
`load/migrate.rs::migrate_search_settings`); Parallel keeps its key as a
direct-only provider, and a keyless managed-Parallel selection is dropped. Seltz and SearXNG keep their options in their own sections, but only
the `providers` map decides whether they are on.
Most sections have a matching `*_tests.rs` (some further split into several
-`*_tests.rs` siblings, e.g. `types_model_pin_tests.rs`); this is the repo's
+`*_tests.rs` siblings, e.g. [`types_model_pin_tests.rs`](./types_model_pin_tests.rs)); this is the repo's
file-size-splitting convention, not separate modules.
### Engine selection keys
@@ -78,8 +78,8 @@ file-size-splitting convention, not separate modules.
This is where a config file names which engine handles a given concern. The
keys that select an implementation, rather than tune one:
-- `search.engine` (`SearchConfig.engine`, `tools/search.rs`): one of the
- string constants re-exported from `mod.rs` (`SEARCH_ENGINE_MANAGED`,
+- `search.engine` (`SearchConfig.engine`, [`tools/search.rs`](./tools/search.rs)): one of the
+ string constants re-exported from [`mod.rs`](./mod.rs) (`SEARCH_ENGINE_MANAGED`,
`SEARCH_ENGINE_PARALLEL`, `SEARCH_ENGINE_BRAVE`, `SEARCH_ENGINE_QUERIT`,
`SEARCH_ENGINE_EXA`, `SEARCH_ENGINE_TAVILY`, `SEARCH_ENGINE_DISABLED`), plus
SearXNG through the separate toggle described above.
@@ -95,7 +95,7 @@ sandbox policy contract described under Workspace/identity helpers below.
## Loading
-`Config::load_or_init` (in `load/impl_load.rs`) is the entry point used by
+`Config::load_or_init` (in [`load/impl_load.rs`](./load/impl_load.rs)) is the entry point used by
`config::ops::loader::load_config_with_timeout`. For an existing
`config.toml` it runs, in this order:
@@ -108,17 +108,17 @@ sandbox policy contract described under Workspace/identity helpers below.
`.corrupted[.<ts>]`, trying the `.bak` copy, and finally falling back to
defaults with `recovered_from_corruption = true`.
3. Fill `config_path` / `workspace_dir` / `action_dir` (`resolve_action_dir`),
- then apply the two pre-schema-version legacy rewrites in `load/migrate.rs`
+ then apply the two pre-schema-version legacy rewrites in [`load/migrate.rs`](./load/migrate.rs)
(`migrate_legacy_inference_url`, `migrate_cloud_provider_slugs`).
4. Apply environment-variable overrides through `Config::apply_env_overrides_from`
- in `load/env_overlay.rs`, split into submodules under `load/env_overlay/`
+ in [`load/env_overlay.rs`](./load/env_overlay.rs), split into submodules under [`load/env_overlay/`](./load/env_overlay/)
(`dictation_context.rs`, `learning_memory.rs`, `observability.rs`,
`proxy.rs`, `runtime.rs`, `search.rs`);
- `load/env.rs` is only the `EnvLookup` seam that lets tests supply a fake
+ [`load/env.rs`](./load/env.rs) is only the `EnvLookup` seam that lets tests supply a fake
environment.
-5. Run pending schema migrations (`../migrations/`, via
+5. Run pending schema migrations ([`../migrations/`](../migrations/), via
`migrations::run_pending`), which bump `schema_version` and save as they go.
-6. Decrypt at-rest secrets (`load/secrets.rs`); a legacy `enc:` (XOR) value is
+6. Decrypt at-rest secrets ([`load/secrets.rs`](./load/secrets.rs)); a legacy `enc:` (XOR) value is
force-migrated to `enc2:` (ChaCha20-Poly1305 via `security::keyring`) and
the config is saved again immediately.
@@ -135,7 +135,7 @@ callers can tell "nothing written" (an `Err` before the rename) from "already
committed" (after it) and roll back in-memory state accordingly; the
migrations runner depends on this.
-`load/mod.rs` also exports `CONFIG_OWNER_MISMATCH_MARKER`: the loader appends
+[`load/mod.rs`](./load/mod.rs) also exports `CONFIG_OWNER_MISMATCH_MARKER`: the loader appends
this marker to a config-read failure when the file's owner differs from the
reading process, and `core::observability::expected_error_kind` keys on it to
keep that failure paging instead of being demoted as ordinary user-environment
@@ -150,7 +150,7 @@ Re-exported through `config::mod` and `config::schema::mod`:
- `resolve_action_dir`, `default_action_dir`, `action_dir_env_override`
(`OPENHUMAN_ACTION_DIR`): the agent's sandboxed read/write root.
- `active_workspace_dir` / `active_workspace_dir_cached`: resolve (and
- synchronously cache, via `load/active_workspace.rs`) the workspace the
+ synchronously cache, via [`load/active_workspace.rs`](./load/active_workspace.rs)) the workspace the
loader last resolved, for callers (like the developer Event Log's SSE
stream) that cannot afford a disk read per lookup.
- `PRE_LOGIN_USER_ID` (`"local"`), `pre_login_user_dir`,
@@ -161,7 +161,7 @@ Re-exported through `config::mod` and `config::schema::mod`:
`config` only *describes* these roots. Per AGENTS.md, `action_dir` is the
agent's permitted read/write root, and `workspace_dir` stores internal state
and is never an acting-tool target. Enforcement of that boundary lives in
-`security::SecurityPolicy` (`security/policy/`), not here. `autonomy.rs`
+`security::SecurityPolicy` ([`security/policy/`](../../security/policy/)), not here. `autonomy.rs`
(`AutonomyConfig`) is the config-side half of the same contract: it is read
into `SecurityPolicy` at startup and on every settings change
(`config::ops::agent::apply_autonomy_settings` calls
@@ -178,10 +178,10 @@ model/provider without the override ever reaching the persisted config.
## Tests
-Per-section `*_tests.rs` files, plus `load_tests.rs` (split into
-`load_active_user_and_dirs_tests.rs`, `load_env_overlay_tests.rs`,
-`load_corruption_recovery_tests.rs`, `load_migration_tests.rs`,
-`load_backup_tests.rs`) for the loader/env-override/migration surface.
+Per-section `*_tests.rs` files, plus [`load_tests.rs`](./load_tests.rs) (split into
+[`load_active_user_and_dirs_tests.rs`](./load_active_user_and_dirs_tests.rs), [`load_env_overlay_tests.rs`](./load_env_overlay_tests.rs),
+[`load_corruption_recovery_tests.rs`](./load_corruption_recovery_tests.rs), [`load_migration_tests.rs`](./load_migration_tests.rs),
+[`load_backup_tests.rs`](./load_backup_tests.rs)) for the loader/env-override/migration surface.
## Related docs
diff --git a/crates/openhuman-core/src/config/workspace/README.md b/crates/openhuman-core/src/config/workspace/README.md
index f88269ca17..1d1db9dcf9 100644
--- a/crates/openhuman-core/src/config/workspace/README.md
+++ b/crates/openhuman-core/src/config/workspace/README.md
@@ -1,6 +1,6 @@
# workspace
-Owns workspace layout bootstrap and the editable "Persona Pack" prompt files (`SOUL.md`, `IDENTITY.md`) that drive the agent's personality. Two concerns live here: (1) `init_workspace`, the one-shot setup that creates the default directory tree and copies the bundled prompt/skills files into a fresh workspace (backs CLI `init`-style entrypoints); and (2) read/edit/reset RPCs over a tightly allowlisted set of persona files, so the settings UI can round-trip those prompts without ever exposing an arbitrary path under the workspace. It also carries an unrelated file-watcher state store (see `state.rs` below).
+Owns workspace layout bootstrap and the editable "Persona Pack" prompt files (`SOUL.md`, `IDENTITY.md`) that drive the agent's personality. Two concerns live here: (1) `init_workspace`, the one-shot setup that creates the default directory tree and copies the bundled prompt/skills files into a fresh workspace (backs CLI `init`-style entrypoints); and (2) read/edit/reset RPCs over a tightly allowlisted set of persona files, so the settings UI can round-trip those prompts without ever exposing an arbitrary path under the workspace. It also carries an unrelated file-watcher state store (see [`state.rs`](./state.rs) below).
## Responsibilities
@@ -15,11 +15,11 @@ Owns workspace layout bootstrap and the editable "Persona Pack" prompt files (`S
| File | Role |
| --- | --- |
-| `crates/openhuman-core/src/config/workspace/mod.rs` | Export-focused. Re-exports `ops::*` and the RPC controller-schema pair (`all_workspace_controller_schemas` / `all_workspace_registered_controllers`). |
-| `crates/openhuman-core/src/config/workspace/ops.rs` | `init_workspace(force)` bootstrap logic, the `BOOTSTRAP_FILES` table (`SOUL.md`, `IDENTITY.md`), `bundled_default_contents` (the editable allowlist + reset source of truth), and `ensure_workspace_file`. |
-| `crates/openhuman-core/src/config/workspace/rpc.rs` | Pure-domain persona file API: `WorkspaceFile` type, `read_workspace_file` / `write_workspace_file` / `reset_workspace_file`, `MAX_WORKSPACE_FILE_BYTES`, allowlist enforcement (`ensure_editable`). Returns `Outcome<WorkspaceFile>`. |
-| `crates/openhuman-core/src/config/workspace/schemas.rs` | Controller schemas + `handle_*` fns delegating to `rpc.rs`; loads config to resolve `workspace_dir`. |
-| `crates/openhuman-core/src/config/workspace/tools.rs` | LLM-callable wrappers over the persona-file RPCs: `WorkspaceReadPersonaTool` (default-on), `WorkspaceUpdatePersonaTool`, `WorkspaceResetPersonaTool`, and `WorkspaceInitTool` (all three mutators default-off, gated by the `workspace_manage` toggle in `tools/user_filter.rs`). |
+| [`crates/openhuman-core/src/config/workspace/mod.rs`](./mod.rs) | Export-focused. Re-exports `ops::*` and the RPC controller-schema pair (`all_workspace_controller_schemas` / `all_workspace_registered_controllers`). |
+| [`crates/openhuman-core/src/config/workspace/ops.rs`](./ops.rs) | `init_workspace(force)` bootstrap logic, the `BOOTSTRAP_FILES` table (`SOUL.md`, `IDENTITY.md`), `bundled_default_contents` (the editable allowlist + reset source of truth), and `ensure_workspace_file`. |
+| [`crates/openhuman-core/src/config/workspace/rpc.rs`](./rpc.rs) | Pure-domain persona file API: `WorkspaceFile` type, `read_workspace_file` / `write_workspace_file` / `reset_workspace_file`, `MAX_WORKSPACE_FILE_BYTES`, allowlist enforcement (`ensure_editable`). Returns `Outcome<WorkspaceFile>`. |
+| [`crates/openhuman-core/src/config/workspace/schemas.rs`](./schemas.rs) | Controller schemas + `handle_*` fns delegating to `rpc.rs`; loads config to resolve `workspace_dir`. |
+| [`crates/openhuman-core/src/config/workspace/tools.rs`](./tools.rs) | LLM-callable wrappers over the persona-file RPCs: `WorkspaceReadPersonaTool` (default-on), `WorkspaceUpdatePersonaTool`, `WorkspaceResetPersonaTool`, and `WorkspaceInitTool` (all three mutators default-off, gated by the `workspace_manage` toggle in [`tools/user_filter.rs`](../../tools/user_filter.rs)). |
| `crates/openhuman-core/src/config/workspace/state.rs` | `WatcherStateStore`, a SQLite-backed `path -> last_mtime_secs` table for a vault file watcher, so it can skip re-ingesting unchanged files after a restart. Not otherwise wired to the persona/bootstrap concerns above; currently has no other caller in the tree. |
## Public surface
@@ -42,14 +42,14 @@ Namespace `workspace`; three controllers (defined in `schemas.rs`, all return th
| `openhuman.workspace_file_write` | `filename`, `contents` | Overwrite an editable persona file (size-capped server-side). |
| `openhuman.workspace_file_reset` | `filename` | Restore an editable persona file to its bundled default. |
-Handlers resolve `workspace_dir` from config (`config_rpc::load_config_with_timeout`), trim the filename, delegate to `rpc.rs`, and serialize via `Outcome::into_cli_compatible_json`. Unknown function names yield an `unknown` schema. Wired into the global registry in `crates/openhuman-core/src/core/all.rs`.
+Handlers resolve `workspace_dir` from config (`config_rpc::load_config_with_timeout`), trim the filename, delegate to `rpc.rs`, and serialize via `Outcome::into_cli_compatible_json`. Unknown function names yield an `unknown` schema. Wired into the global registry in [`crates/openhuman-core/src/core/all.rs`](../../core/all.rs).
## Persistence
No dedicated `store.rs`. State is plain files under the configured `workspace_dir`:
- Directories: `memory/`, `sessions/`, `state/`, `cron/`.
-- Files: `SOUL.md`, `IDENTITY.md` (bundled-prompt copies), `skills/README.md`.
+- Files: `SOUL.md`, `IDENTITY.md` (bundled-prompt copies), [`skills/README.md`](../../skills/README.md).
The editable surface is restricted to the `BOOTSTRAP_FILES` allowlist (`SOUL.md`, `IDENTITY.md`); the workspace dir is created on demand by write/reset.
@@ -66,7 +66,7 @@ The editable surface is restricted to the `BOOTSTRAP_FILES` allowlist (`SOUL.md`
## Used by
- `crates/openhuman-core/src/core/all.rs` extends the global controller and schema registries with the workspace controllers (the only external consumer found in-tree). The CLI/JSON-RPC surface reaches `init_workspace` and the persona RPCs through that registry rather than direct calls.
-- `crates/openhuman-core/src/tools/mod.rs` re-exports `workspace::tools::*` into the agent tool catalog.
+- [`crates/openhuman-core/src/tools/mod.rs`](../../tools/mod.rs) re-exports `workspace::tools::*` into the agent tool catalog.
## Notes / gotchas
diff --git a/crates/openhuman-core/src/core/README.md b/crates/openhuman-core/src/core/README.md
index 43f7dd39c2..8ecb038c58 100644
--- a/crates/openhuman-core/src/core/README.md
+++ b/crates/openhuman-core/src/core/README.md
@@ -9,7 +9,7 @@ controller it exposes is implemented by a domain under
`crates/openhuman-core/src/<domain>/` and only wired in here.
Callers are the hosts above the core. The JSON-RPC server in
-`crates/openhuman-rpc`, the `openhuman-core` binary in `crates/openhuman-cli`,
+[`crates/openhuman-rpc`](../../../openhuman-rpc/), the `openhuman-core` binary in [`crates/openhuman-cli`](../../../openhuman-cli/),
the desktop shell, the TUI and `openhuman-embed` all reach domain behavior
through the entry points in this folder.
@@ -21,13 +21,13 @@ A domain exposes an operation by building a `RegisteredController`: a
`ControllerSchema` (namespace, function, description, typed inputs and
outputs) paired with a `ControllerHandler`, which is a plain
`fn(Map<String, Value>) -> ControllerFuture`. The schema types
-(`ControllerSchema`, `FieldSchema`, `TypeSchema`) live in `mod.rs`.
+(`ControllerSchema`, `FieldSchema`, `TypeSchema`) live in [`mod.rs`](./mod.rs).
`TypeSchema` covers scalars, arrays, maps, options, string enums, nested
objects, named refs, and `BoundedU64` for fields backed by a narrower
integer type, so an out-of-range value is refused before dispatch.
Inside the handler, the domain's `ops.rs` returns an `Outcome<T>`
-(`outcome.rs`): a value plus log lines. `Outcome::into_cli_compatible_json`
+([`outcome.rs`](./outcome.rs)): a value plus log lines. `Outcome::into_cli_compatible_json`
serializes it through `apply_log_envelope`, which is the single definition of
the wire shape. With no logs the value goes out bare; with logs it is wrapped
as `{ "result": value, "logs": [...] }`. That means a response's shape depends
@@ -36,14 +36,14 @@ byte-for-byte on purpose, because changing it is a wire change for every
client. `unwrap_rpc` peels `result` and `data` envelopes back off.
Errors travel as `Err(String)`. When a controller needs a typed error, it
-encodes a `StructuredRpcError` (`structured_error.rs`) into that string behind
+encodes a `StructuredRpcError` ([`structured_error.rs`](./structured_error.rs)) into that string behind
the `STRUCTURED_RPC_ERROR_SENTINEL` prefix, and the transport decodes it. A
few surfaces (`threads`, desktop provider surfaces) wrap results in the
-`{data, error, meta}` envelope built by `envelope.rs`.
+`{data, error, meta}` envelope built by [`envelope.rs`](./envelope.rs).
### Registration
-`all.rs` is the registry. `build_registered_controllers` calls every domain's
+[`all.rs`](./all.rs) is the registry. `build_registered_controllers` calls every domain's
`all_*_registered_controllers()` and tags each batch with a `DomainGroup`
through the private `push` helper, so domain modules never see groups.
`build_internal_only_controllers` does the same for methods that are callable
@@ -81,7 +81,7 @@ Every entry carries a `DomainGroup`: `Agent`, `Memory`, `Threads`, `Config`,
`Security`, `Flows`, `Skills`, `Mcp`, `Channels`, `Web3`, `Voice`, `Media`,
`Inference`, `Integrations`, `Automation`, `Runtimes`, `Desktop`, `Hosted`,
`Modules` and `Platform`. The variants track the family directories under
-`crates/openhuman-core/src/`. The live surface (schema listing, dispatch,
+[`crates/openhuman-core/src/`](../). The live surface (schema listing, dispatch,
agent tools, stores, subscribers) is filtered by whether the `DomainSet` of
the ambient `runtime::context::CoreContext` allows the group. With no context
yet (some unit tests), nothing is filtered. Adding a family directory means
@@ -123,7 +123,7 @@ namespace commands, the device tunnel, and `CoreRuntime::invoke`.
```
`validate_params` (in `all.rs`, with message builders and the matcher
-`is_param_validation_error` in `params.rs`) rejects missing required params,
+`is_param_validation_error` in [`params.rs`](./params.rs)) rejects missing required params,
unknown params and values that do not match their declared `TypeSchema`, so
handlers only deserialize input that already passed the schema.
@@ -140,7 +140,7 @@ transport decides severity: names in `KNOWN_PROBE_METHODS` (generic probes
such as `rpc.discover`, and retired calls) stay debug-only, and anything else
is reported to Sentry at warn.
-Session expiry is classified narrowly by `session_expiry.rs`. Only OpenHuman
+Session expiry is classified narrowly by [`session_expiry.rs`](./session_expiry.rs). Only OpenHuman
backend failures (explicit "Session expired" text, the scheduler-gate
`SESSION_EXPIRED` sentinel, missing session guards, and 401s formatted as
`"{METHOD} /path failed (401 ...)"`) count. A provider's 401 does not, so a
@@ -148,10 +148,10 @@ broken BYOK key or Discord token never signs the user out.
### Event bus
-`bus.rs` declares `BUS: OnceBus<DomainEvent>`, the process-wide `tinybus`
+[`bus.rs`](./bus.rs) declares `BUS: OnceBus<DomainEvent>`, the process-wide `tinybus`
singleton. The bus implementation lives in the `tinybus` submodule; the core
keeps only the static, because `OnceBus<E>` is generic over the event type
-and the host is the one that knows `E`. `events.rs` is the event catalog:
+and the host is the one that knows `E`. [`events.rs`](./events.rs) is the event catalog:
`DomainEvent`, a `#[non_exhaustive]` enum whose `domain()` value is appended
to `EVENTS_ROOT` (`/ai/tinyhumans/openhuman/events`) as the routing key.
The catalog is published under `EVENTS_INTERFACE`
@@ -185,7 +185,7 @@ Each subscribing domain owns a `bus.rs`, and subscriber names use
### Auth
-`auth.rs` seeds the per-process RPC bearer into a `OnceLock`, choosing the
+[`auth.rs`](./auth.rs) seeds the per-process RPC bearer into a `OnceLock`, choosing the
first available source:
1. an in-memory handoff from the desktop shell (`init_rpc_token_with_value`),
@@ -202,7 +202,7 @@ the approval-gate session id. `verify_bearer_token` and `bearer_matches` do
the comparison.
Browser `EventSource` cannot send an `Authorization` header, so `/events`
-uses separate bind tokens from `event_bind_tokens.rs`. An authenticated
+uses separate bind tokens from [`event_bind_tokens.rs`](./event_bind_tokens.rs). An authenticated
caller invokes `core.events_subscribe_token { client_id }` and then opens
`/events?client_id=<id>&token=<bind>`. A bind token is 256 random bits, tied
to one `client_id`, consumed on first use, and expires after 60 seconds by
@@ -226,7 +226,7 @@ the first argument:
| `mcp`, `mcp-server` | run the stdio MCP server (`mcp::server::run_stdio_from_cli`) |
| `tui`, `chat` | print a pointer to the separate `openhuman-tui` binary |
| `call --method <m> --params <json>` | one raw RPC call through `invoke_method` (`--params-stdin` reads params from stdin) |
-| `agent dump-prompt / dump-all / prompt-size / list` | prompt inspection tools in `agent_cli.rs` |
+| `agent dump-prompt / dump-all / prompt-size / list` | prompt inspection tools in [`agent_cli.rs`](./agent_cli.rs) |
| `sentry-test` | send a test event to Sentry |
| `<namespace> <function> [--flags]` | generic dispatcher over the registry schemas |
@@ -235,19 +235,19 @@ from their descriptions (`namespace_description` in `all.rs`), and turns
flags into params. A namespace with no function can fall through to a
standalone `RegisteredCliAdapter`: today `voice` (which stays registered with
the `voice` feature off and reports that voice is disabled) and `subsystems`
-(`subsystems_cli.rs`, which prints the subsystem table). Wire new CLI
-behavior through the registry; do not add namespace branches to `cli.rs` or
+([`subsystems_cli.rs`](./subsystems_cli.rs), which prints the subsystem table). Wire new CLI
+behavior through the registry; do not add namespace branches to [`cli.rs`](./cli.rs) or
the JSON-RPC server.
`run` and `serve` need a server, which the core does not contain.
-`server_launcher.rs` holds a `ServerLauncher` port; the host installs one
+[`server_launcher.rs`](./server_launcher.rs) holds a `ServerLauncher` port; the host installs one
(`openhuman_rpc::server::install_cli_server()` in the `openhuman-core` binary
and the desktop app) before calling `run_from_cli_args`. Without it those
subcommands fail with an explanation.
### Logging, redaction and crash reporting
-`logging.rs` sets up the logger per host: `init_for_cli_run`,
+[`logging.rs`](./logging.rs) sets up the logger per host: `init_for_cli_run`,
`init_for_embedded` and `init_for_tui` (which also buffers lines for the TUI
through `tui_log_lines`). Two redaction passes keep secrets out of logs.
`rpc_log::redact_params_for_log` strips sensitive keys (`api_key`, `token`,
@@ -256,16 +256,16 @@ params before the `[rpc:dispatch]` trace line. `log_redaction::scrub_secrets`
pattern-matches secrets in free text and is shared by the Sentry path and the
always-on log path, so the two cannot drift.
-`observability.rs` is the error-reporting policy: `report_error`,
+[`observability.rs`](./observability.rs) is the error-reporting policy: `report_error`,
`report_error_or_expected` and `report_warning_message`, the expected-error
classifier (`expected_error_kind`), and the Sentry `before_send` predicates
that drop deterministic noise (transient provider HTTP statuses and transport
failures, updater blips, session expiry, max-iteration events). It also
-defines the shared `BACKEND_UNAVAILABLE_PREFIX`. `sentry_transport.rs` is a
+defines the shared `BACKEND_UNAVAILABLE_PREFIX`. [`sentry_transport.rs`](./sentry_transport.rs) is a
bounded, nonblocking Sentry transport over the core's reqwest stack, compiled
only with the `crash-reporting` feature.
-`shutdown.rs` listens for SIGINT and SIGTERM (`signal`) and runs cleanup
+[`shutdown.rs`](./shutdown.rs) listens for SIGINT and SIGTERM (`signal`) and runs cleanup
hooks that domains `register`, sequentially in registration order.
### Runtime composition and subsystems
@@ -277,7 +277,7 @@ methods and run agent turns. Serving and background services come second,
through `openhuman_rpc::server::serve` or `CoreRuntime::start_services`.
`ServiceSet`, `DomainSet` and `ToolGroups` narrow what runs. See
[runtime/README.md](runtime/README.md) for the full reference.
-`runtime/mod.rs` also holds `AGENT_WORKER_STACK_BYTES` (20 MiB) and
+[`runtime/mod.rs`](./runtime/mod.rs) also holds `AGENT_WORKER_STACK_BYTES` (20 MiB) and
`MAX_BLOCKING_THREADS` (64). One agent turn is a very large async state
machine and a sub-agent nests another, which overflows tokio's default 2 MiB
worker stack, so every multi-thread runtime that can host a turn (the desktop
@@ -303,15 +303,15 @@ Contract and registry:
| `envelope.rs` | `ApiEnvelope`, `ApiError`, `ApiMeta`, `PaginationMeta`: the `{data, error, meta}` shape some namespaces use. |
| `params.rs` | Params shape (`params_to_object`, `parse_json_params`), validation messages and `is_param_validation_error`. |
| `all.rs` | The registry: `RegisteredController`, `RegisteredCliAdapter`, `DomainGroup`, `ControllerExtension`, `register_controller_extension`, `validate_params`, `schema_for_rpc_method`, `try_invoke_registered_rpc`, `all_http_method_schemas` (adds `core.ping` and `core.version` for `/schema`), `namespace_description`. |
-| `types.rs` | `AppState`, `HostKind`, `InvocationResult`, `approval_gate_boot_decision`. |
+| [`types.rs`](./types.rs) | `AppState`, `HostKind`, `InvocationResult`, `approval_gate_boot_decision`. |
Dispatch and auth:
| Path | What it does |
| --- | --- |
-| `invoke.rs` | `invoke_method` and `default_state`: the in-process entry point and the session-expiry hook. |
-| `dispatch.rs` | `dispatch`: legacy rewrite, `core.*` methods, registry fallback, unknown-method handling, `KNOWN_PROBE_METHODS`. |
-| `legacy_aliases.rs` | `resolve_legacy`: retired method names to canonical ones; mirrors `LEGACY_METHOD_ALIASES` in `app/src/services/rpcMethods.ts`. |
+| [`invoke.rs`](./invoke.rs) | `invoke_method` and `default_state`: the in-process entry point and the session-expiry hook. |
+| [`dispatch.rs`](./dispatch.rs) | `dispatch`: legacy rewrite, `core.*` methods, registry fallback, unknown-method handling, `KNOWN_PROBE_METHODS`. |
+| [`legacy_aliases.rs`](./legacy_aliases.rs) | `resolve_legacy`: retired method names to canonical ones; mirrors `LEGACY_METHOD_ALIASES` in [`app/src/services/rpcMethods.ts`](../../../../app/src/services/rpcMethods.ts). |
| `session_expiry.rs` | `is_session_expired_error` and `is_unconfirmed_unauthorized_error`. |
| `auth.rs` | The per-process RPC bearer: init paths, `get_rpc_token`, `verify_bearer_token`, `bearer_matches`. |
| `event_bind_tokens.rs` | Single-shot bind tokens for the `/events` SSE stream (`issue`, `consume`). |
@@ -324,7 +324,7 @@ Bus:
| --- | --- |
| `bus.rs` | `BUS`, `EVENTS_ROOT`, `EVENTS_INTERFACE`, `EVENTS_VERSION`, `init`, `manifest`, `TracingSubscriber`. |
| `events.rs` | `DomainEvent`, the full event catalog, and its `domain()` routing. |
-| `bus_testing.rs` | Test helpers: `isolated_bus`, `BUS_HANDLER_LOCK`, `mock_bus_stub` and the RAII `MockBusGuard` for native stubs. |
+| [`bus_testing.rs`](./bus_testing.rs) | Test helpers: `isolated_bus`, `BUS_HANDLER_LOCK`, `mock_bus_stub` and the RAII `MockBusGuard` for native stubs. |
CLI:
@@ -339,8 +339,8 @@ Process plumbing:
| Path | What it does |
| --- | --- |
| `logging.rs` | Logger setup per host kind, log directory, file-guard shutdown. |
-| `rpc_log.rs` | `redact_params_for_log`, key-name redaction for dispatch trace logs. |
-| `log_redaction.rs` | `scrub_secrets`, pattern-based secret scrubbing for free-text log and Sentry messages. |
+| [`rpc_log.rs`](./rpc_log.rs) | `redact_params_for_log`, key-name redaction for dispatch trace logs. |
+| [`log_redaction.rs`](./log_redaction.rs) | `scrub_secrets`, pattern-based secret scrubbing for free-text log and Sentry messages. |
| `observability.rs` | Error reporting, expected-error classification, Sentry `before_send` filters, shared error prefixes. |
| `sentry_transport.rs` | Sentry transport over reqwest (`crash-reporting` feature). |
| `shutdown.rs` | SIGINT/SIGTERM signal and the registered shutdown hooks. |
@@ -388,11 +388,11 @@ surface.
handlers the router mounts (`inference::http`, the dictation WebSocket)
stay in their domains behind core's `http-server` feature.
- The bus runtime, broker, native registry and proxies belong to the
- `tinybus` submodule (`vendor/tinybus`). Only the `BUS` static and the event
+ `tinybus` submodule ([`vendor/tinybus`](../../../../vendor/tinybus/)). Only the `BUS` static and the event
catalog live here.
- Hosted backend proxies (`billing`, `team`, `referral`, `announcements`,
`webhooks`, `channel_link`, `oauth`) are registered by
- `crates/openhuman-tinyhumans` as an extension, not built into the core.
+ [`crates/openhuman-tinyhumans`](../../../openhuman-tinyhumans/) as an extension, not built into the core.
- Login, token exchange and `/auth/me` belong to the host's session owner
(`openhuman_tinyhumans::session`, `openhuman_embed::Auth`). Credential
storage and `auth.set_credential` are in `security::credentials`.
@@ -429,7 +429,7 @@ surface.
## Tests
-Tests live beside their modules as `<module>_tests.rs` (`core_mod_tests.rs`
+Tests live beside their modules as `<module>_tests.rs` ([`core_mod_tests.rs`](./core_mod_tests.rs)
for `mod.rs`; the registry, observability and event catalog have several
split files). Run them with:
diff --git a/crates/openhuman-core/src/core/runtime/README.md b/crates/openhuman-core/src/core/runtime/README.md
index 3421868a8b..604f9867b8 100644
--- a/crates/openhuman-core/src/core/runtime/README.md
+++ b/crates/openhuman-core/src/core/runtime/README.md
@@ -136,7 +136,7 @@ existing single-tenant call sites keep working unmodified.
## Shared tokio tuning constants
-`runtime/mod.rs` declares two constants every multi-thread runtime that may
+[`runtime/mod.rs`](../../runtime/mod.rs) declares two constants every multi-thread runtime that may
host an agent turn must set:
- `AGENT_WORKER_STACK_BYTES` (20 MiB): a single agent turn is a very large
diff --git a/crates/openhuman-core/src/cron/README.md b/crates/openhuman-core/src/cron/README.md
index 1b970ae581..8ed401d3a3 100644
--- a/crates/openhuman-core/src/cron/README.md
+++ b/crates/openhuman-core/src/cron/README.md
@@ -55,7 +55,7 @@ jobs, the turn's message id.
### Run claims
-`ops.rs` keeps a process-wide `ACTIVE_RUNS` set. The poll loop claims each due
+[`ops.rs`](./ops.rs) keeps a process-wide `ACTIVE_RUNS` set. The poll loop claims each due
job through `try_acquire_run`, which returns an `ActiveRunGuard` that releases
the claim on drop (including panic and cancellation). The `cron.run` "Run Now"
RPC uses the same set and rejects a second concurrent run of one job. A job
@@ -64,13 +64,13 @@ a scheduled run and a manual run never overlap.
### Executing a job
-`execute_job_with_retry_for_run` (in `scheduler/retry.rs`) dispatches on
+`execute_job_with_retry_for_run` (in [`scheduler/retry.rs`](./scheduler/retry.rs)) dispatches on
`JobType` and wraps all three types in `reliability.scheduler_retries` retries
with exponential backoff starting at `reliability.provider_backoff_ms` (at
least 200 ms).
`shell` jobs run through `run_job_command_with_timeout`
-(`scheduler/shell_job.rs`). Before spawning anything it checks the security
+([`scheduler/shell_job.rs`](./scheduler/shell_job.rs)). Before spawning anything it checks the security
policy in order: `can_act`, `is_rate_limited`, `is_command_allowed`, a scan of
the arguments for forbidden paths, and `record_action` against the action
budget. Any refusal returns a string starting `blocked by security policy:`,
@@ -78,9 +78,9 @@ which the retry loop treats as final. The command has a hard 120 second timeout
(`SHELL_JOB_TIMEOUT_SECS`). With the autonomy policy disabled (the default),
most of these checks are inert; see the project `CLAUDE.md`.
-`agent` jobs run a full agent turn (`scheduler/agent_run.rs`):
+`agent` jobs run a full agent turn ([`scheduler/agent_run.rs`](./scheduler/agent_run.rs)):
-1. `build_run_prompt` (`scheduler/origin_context.rs`) composes the prompt from
+1. `build_run_prompt` ([`scheduler/origin_context.rs`](./scheduler/origin_context.rs)) composes the prompt from
the job's `session_target` (see below).
2. A per-job `model` override is applied to a cloned `Config`.
3. The job's `agent_id` (default `orchestrator`) is looked up in
@@ -102,7 +102,7 @@ most of these checks are inert; see the project `CLAUDE.md`.
An agent failure is classified before anything is logged. The user sees a
canned string from `classify_agent_anyhow_for_user`
-(`scheduler/failure_classification.rs`); the full error chain goes only to
+([`scheduler/failure_classification.rs`](./scheduler/failure_classification.rs)); the full error chain goes only to
observability. Some failures stop the retry loop on the first attempt and skip
the retries-exhausted error report: backend session expired, provider
insufficient credits (402), managed-backend budget exhausted (400), API key
@@ -116,7 +116,7 @@ id and it publishes `DomainEvent::FlowScheduleTick { flow_id }`, which
### After the run
-`persist_job_result_for_run` (`scheduler/run_record.rs`) calls `deliver_run`
+`persist_job_result_for_run` ([`scheduler/run_record.rs`](./scheduler/run_record.rs)) calls `deliver_run`
first, records the run with its `DeliveryStatus`, then decides the job's
future:
@@ -130,7 +130,7 @@ A delivery failure marks the run failed unless `delivery.best_effort` is set.
### Delivery
`DeliveryConfig.mode` decides where output goes. `deliver_run`
-(`scheduler/delivery.rs`) never posts a failed or empty run into a chat (empty
+([`scheduler/delivery.rs`](./scheduler/delivery.rs)) never posts a failed or empty run into a chat (empty
means blank or the placeholder `agent job executed`). Failures still reach the
alerts tab and run history.
@@ -139,7 +139,7 @@ alerts tab and run history.
| `none` | Silent. Output lives in the job's `last_output` only. This is `DeliveryConfig::default()`. |
| `proactive` | Publishes `ProactiveMessageRequested`. `channels::proactive::ProactiveMessageSubscriber` pushes to the in-app web stream and mirrors to `channels_config.active_channel` when set. Used for briefings and other desktop-first output. |
| `announce` | Requires `channel` and `to`. Publishes `CronDeliveryRequested`; `cron::bus::CronDeliverySubscriber` (`cron::delivery`) sends it through the named `tinychannels_bus::Channel`. The `cron_add` tool checks `to` against the channel's `allowed_users`. |
-| `origin` | Sends the reply back into the conversation that created the job (`scheduler/origin_delivery.rs`). Requires `CronJob.origin`. |
+| `origin` | Sends the reply back into the conversation that created the job ([`scheduler/origin_delivery.rs`](./scheduler/origin_delivery.rs)). Requires `CronJob.origin`. |
Origin delivery treats blank output or exactly `NO_REPLY` as `Suppressed`:
nothing is sent and no alert is raised. For a web origin, the reply is stored in
@@ -215,7 +215,7 @@ the floor keep running; `warn_if_high_frequency_agent_job` logs `Cron agent job
### Seeded and system jobs
`seed::seed_proactive_agents` runs when onboarding flips to completed
-(`config/ops/ui.rs`). It dedupes named jobs, prunes a legacy one-shot `welcome`
+([`config/ops/ui.rs`](../config/ops/ui.rs)). It dedupes named jobs, prunes a legacy one-shot `welcome`
job, and creates the `morning_briefing` agent job (daily at 7 AM, `proactive`
delivery) disabled until the user opts in. `seed::prune_retired_jobs` removes
rows for retired features (for example the TinyPlace autopilot, matched by its
@@ -223,23 +223,23 @@ rows for retired features (for example the TinyPlace autopilot, matched by its
System jobs let another domain own a recurring task while still showing up in
the routines list. A system job is a `flow` row whose command is
-`system:<name>` (`system_jobs.rs`). When it fires, cron publishes
+`system:<name>` ([`system_jobs.rs`](./system_jobs.rs)). When it fires, cron publishes
`CronSystemJobDue` and the owning domain does the work. Memory owns the two
current ones, `memory_background` and `memory_sources_sync` (every 15 minutes),
handled in `memory::bus`. `ensure_memory_jobs` is idempotent: it creates a
missing row, reschedules a drifted one, and removes the retired
-`memory_context_refresh` row. It runs from `core/runtime/services.rs` and from
-`security/credentials/ops/user_scope.rs`.
+`memory_context_refresh` row. It runs from [`core/runtime/services.rs`](../core/runtime/services.rs) and from
+[`security/credentials/ops/user_scope.rs`](../security/credentials/ops/user_scope.rs).
## Layout
| Path | What it does |
| --- | --- |
-| `mod.rs` | Module wiring and re-exports. Re-exports the schedule types and pure schedule functions from `tinyflows_schedule` so `cron::CronJob`, `cron::Schedule` and friends resolve here. |
-| `store.rs` | Thin wrapper over `tinyflows_sqlite::schedule`. Turns `Config` into `CronStoreOptions` (`<workspace>/cron/jobs.db`, `cron.max_run_history`, `scheduler.max_tasks`) and forwards job CRUD, due-job queries and run history. |
+| [`mod.rs`](./mod.rs) | Module wiring and re-exports. Re-exports the schedule types and pure schedule functions from `tinyflows_schedule` so `cron::CronJob`, `cron::Schedule` and friends resolve here. |
+| [`store.rs`](./store.rs) | Thin wrapper over `tinyflows_sqlite::schedule`. Turns `Config` into `CronStoreOptions` (`<workspace>/cron/jobs.db`, `cron.max_run_history`, `scheduler.max_tasks`) and forwards job CRUD, due-job queries and run history. |
| `ops.rs` | Business operations: `add_once`, `add_once_at`, `parse_human_delay`, pause/resume, `update_cron_job`, the `ACTIVE_RUNS` claim set, and the async `cron_*` RPC operations. Also re-exported as `cron::rpc`. |
-| `schemas.rs` | Controller schemas and handlers for the `cron` namespace. |
-| `scheduler.rs` | `run`, `tick_once`, `process_due_jobs`, `execute_and_persist_job`. |
+| [`schemas.rs`](./schemas.rs) | Controller schemas and handlers for the `cron` namespace. |
+| [`scheduler.rs`](./scheduler.rs) | `run`, `tick_once`, `process_due_jobs`, `execute_and_persist_job`. |
| `scheduler/retry.rs` | `execute_job_now` (Run Now) and the retry loop across job types. |
| `scheduler/failure_classification.rs` | Canned user messages and the permanent-failure classifiers that halt retries. |
| `scheduler/shell_job.rs` | Security-gated shell execution with a timeout. |
@@ -248,13 +248,13 @@ missing row, reschedules a drifted one, and removes the retired
| `scheduler/delivery.rs` | `deliver_run` and `deliver_job`, the mode switch, and `push_cron_alert`. |
| `scheduler/origin_delivery.rs` | `deliver_to_origin`, `NO_REPLY` suppression, transcript append. |
| `scheduler/run_record.rs` | Persisting a run, one-shot handling, the high-frequency warning. |
-| `origin.rs` | `JobOrigin` capture from the live turn, the approval-gate exemption, and the turn origin a run executes under. |
-| `job_builder.rs` | `create_agent_job`: origin-aware defaults and delivery validation shared by the `cron` and `schedule` tools. |
-| `channel_bridge.rs` | Cron's handle on the channel runtime: per-chat history and live channels, registered by `start_channels`. |
-| `bus.rs` | `CronDeliverySubscriber`, which sends `announce` output to a channel. |
-| `seed.rs` | Built-in proactive jobs and pruning of retired rows. |
+| [`origin.rs`](./origin.rs) | `JobOrigin` capture from the live turn, the approval-gate exemption, and the turn origin a run executes under. |
+| [`job_builder.rs`](./job_builder.rs) | `create_agent_job`: origin-aware defaults and delivery validation shared by the `cron` and `schedule` tools. |
+| [`channel_bridge.rs`](./channel_bridge.rs) | Cron's handle on the channel runtime: per-chat history and live channels, registered by `start_channels`. |
+| [`bus.rs`](./bus.rs) | `CronDeliverySubscriber`, which sends `announce` output to a channel. |
+| [`seed.rs`](./seed.rs) | Built-in proactive jobs and pruning of retired rows. |
| `system_jobs.rs` | `system:<name>` flow rows owned by other domains. |
-| `tools.rs`, `tools/` | Agent tools. See [tools/README.md](tools/README.md). |
+| [`tools.rs`](./tools.rs), `tools/` | Agent tools. See [tools/README.md](tools/README.md). |
| `scheduler_gate/` | Host power and CPU policy for background LLM work. Unrelated to the poll loop. See [scheduler_gate/README.md](scheduler_gate/README.md). |
## Key types and entry points
@@ -290,7 +290,7 @@ missing row, reschedules a drifted one, and removes the retired
## RPC surface
Namespace `cron`, registered through `all_cron_registered_controllers` in
-`core/all.rs`:
+[`core/all.rs`](../core/all.rs):
| Method | What it does |
| --- | --- |
@@ -303,8 +303,8 @@ Namespace `cron`, registered through `all_cron_registered_controllers` in
## Event bus
-Cron publishes, through `core/bus.rs`, these `DomainEvent` variants from
-`core/events.rs`:
+Cron publishes, through [`core/bus.rs`](../core/bus.rs), these `DomainEvent` variants from
+[`core/events.rs`](../core/events.rs):
- `SystemStartup` and `HealthChanged` for component `scheduler`.
- `CronJobTriggered` and `CronJobCompleted` around each scheduled execution
@@ -322,11 +322,11 @@ Cron publishes, through `core/bus.rs`, these `DomainEvent` variants from
service when `cron.enabled` is set, after flows reconcile their schedule
triggers. It also calls `ensure_memory_jobs` and `prune_retired_jobs`.
- `core/all.rs` registers the controllers.
-- `tools/impl/system/schedule.rs` is the `schedule` tool, built on the same
+- [`tools/impl/system/schedule.rs`](../tools/impl/system/schedule.rs) is the `schedule` tool, built on the same
store functions and `create_agent_job`.
-- `channels/runtime/startup/start_channels.rs` registers
+- [`channels/runtime/startup/start_channels.rs`](../channels/runtime/startup/start_channels.rs) registers
`CronDeliverySubscriber` and the channel bridge.
-- `flows/ops/triggers.rs` creates and removes flow schedule rows
+- [`flows/ops/triggers.rs`](../flows/ops/triggers.rs) creates and removes flow schedule rows
(`bind_schedule_trigger` / `unbind_schedule_trigger`), idempotent through
`find_flow_schedule_job`. These rows are never created by the `cron_add`
tool, whose `job_type` is `shell` or `agent` only.
@@ -338,7 +338,7 @@ Cron publishes, through `core/bus.rs`, these `DomainEvent` variants from
- The schedule model, next-run computation, cadence floor and the SQLite store
(schema, CRUD, output truncation, pruning) belong to the `tinyflows`
- submodule (`vendor/tinyflows/crates/tinyflows-schedule` and
+ submodule ([`vendor/tinyflows/crates/tinyflows-schedule`](../../../../vendor/tinyflows/crates/tinyflows-schedule/) and
`tinyflows-sqlite`). Change them there, not in `store.rs`.
- Shell sandboxing policy is `security::SecurityPolicy`. Cron only asks it.
- Flow execution is the `flows` domain. Cron only emits `FlowScheduleTick`.
@@ -351,7 +351,7 @@ Cron publishes, through `core/bus.rs`, these `DomainEvent` variants from
- `scheduler_gate` lives here for historical reasons, but the poll loop does not
consult it. Its consumers are `modules/memory_host.rs` and
- `security/credentials/`.
+ [`security/credentials/`](../security/credentials/).
- Run Now and the poll loop share `ACTIVE_RUNS`. A long-running job blocks its
own next tick, not other jobs.
- A cron agent turn must suppress transcript autoload, or it resumes an
@@ -365,9 +365,9 @@ Cron publishes, through `core/bus.rs`, these `DomainEvent` variants from
## Tests
Tests sit beside their modules as `<module>_tests.rs` (for example
-`scheduler_tests.rs`, which pulls in the `scheduler_*_tests.rs` files, plus
-`store_tests.rs`, `ops_tests.rs`, `origin_tests.rs`, `job_builder_tests.rs`,
-`system_jobs_tests.rs`, `scheduler/origin_*_tests.rs` and the per-tool files in
+[`scheduler_tests.rs`](./scheduler_tests.rs), which pulls in the `scheduler_*_tests.rs` files, plus
+[`store_tests.rs`](./store_tests.rs), [`ops_tests.rs`](./ops_tests.rs), [`origin_tests.rs`](./origin_tests.rs), [`job_builder_tests.rs`](./job_builder_tests.rs),
+[`system_jobs_tests.rs`](./system_jobs_tests.rs), `scheduler/origin_*_tests.rs` and the per-tool files in
`tools/`). The store itself is tested in `tinyflows-sqlite`.
```bash
diff --git a/crates/openhuman-core/src/cron/scheduler_gate/README.md b/crates/openhuman-core/src/cron/scheduler_gate/README.md
index ac6a65e911..6bd3bf0d8d 100644
--- a/crates/openhuman-core/src/cron/scheduler_gate/README.md
+++ b/crates/openhuman-core/src/cron/scheduler_gate/README.md
@@ -15,11 +15,11 @@ Gates background AI work (embeddings, summarisation, triage, local inference) on
| File | Role |
| --- | --- |
-| `crates/openhuman-core/src/cron/scheduler_gate/mod.rs` | Module docstring + re-exports of the public surface. |
-| `crates/openhuman-core/src/cron/scheduler_gate/gate.rs` | The process-wide wiring: the `SharedCore`, the signed-out override, the resume `Notify`, the single-slot LLM semaphore, `init_global(SchedulerGateConfig)`/`update_config`/`current_policy`/`wait_for_capacity`, and the per-tokio-runtime test-state scaffolding. |
-| `crates/openhuman-core/src/cron/scheduler_gate/throttle.rs` | The machinery: `GateCore` (config + signals + policy), the 30s `spawn_sampler` task, `wait_for_capacity` over a caller-owned semaphore, and the `LlmPermit` RAII guard. |
-| `crates/openhuman-core/src/cron/scheduler_gate/signals.rs` | `sample(&SignalEnv)`: battery (via `starship_battery`, behind the `scheduler-gate` feature), CPU usage (via `sysinfo`, two-refresh delta), and server/container detection. |
-| `crates/openhuman-core/src/cron/scheduler_gate/decide.rs` | Pure decision logic: `decide(signals, cfg) -> Policy` over the `Signals` snapshot; `Policy` / `PauseReason` live beside `SchedulerGateConfig` in `config::schema::scheduler_gate`. Evaluation order: user mode override → server mode → power-aware stand-down → hard CPU ceiling → battery/CPU headroom. |
+| [`crates/openhuman-core/src/cron/scheduler_gate/mod.rs`](./mod.rs) | Module docstring + re-exports of the public surface. |
+| [`crates/openhuman-core/src/cron/scheduler_gate/gate.rs`](./gate.rs) | The process-wide wiring: the `SharedCore`, the signed-out override, the resume `Notify`, the single-slot LLM semaphore, `init_global(SchedulerGateConfig)`/`update_config`/`current_policy`/`wait_for_capacity`, and the per-tokio-runtime test-state scaffolding. |
+| [`crates/openhuman-core/src/cron/scheduler_gate/throttle.rs`](./throttle.rs) | The machinery: `GateCore` (config + signals + policy), the 30s `spawn_sampler` task, `wait_for_capacity` over a caller-owned semaphore, and the `LlmPermit` RAII guard. |
+| [`crates/openhuman-core/src/cron/scheduler_gate/signals.rs`](./signals.rs) | `sample(&SignalEnv)`: battery (via `starship_battery`, behind the `scheduler-gate` feature), CPU usage (via `sysinfo`, two-refresh delta), and server/container detection. |
+| [`crates/openhuman-core/src/cron/scheduler_gate/decide.rs`](./decide.rs) | Pure decision logic: `decide(signals, cfg) -> Policy` over the `Signals` snapshot; `Policy` / `PauseReason` live beside `SchedulerGateConfig` in `config::schema::scheduler_gate`. Evaluation order: user mode override → server mode → power-aware stand-down → hard CPU ceiling → battery/CPU headroom. |
| `SIGNAL_ENV` in `gate.rs` | The env-override names: `OPENHUMAN_ON_AC_POWER`, `OPENHUMAN_BATTERY_CHARGE`, `OPENHUMAN_DEPLOYMENT` (plus the Kubernetes / `/.dockerenv` heuristics). |
## Public surface
@@ -58,10 +58,10 @@ No dependency on any other `openhuman` domain or on `crate::core::*`.
Consumed in-process across the codebase (discoverable via `grep scheduler_gate`):
-- Background workers / pipelines: `autocomplete/core/engine.rs`, `task_sources/route.rs`, `agent/triage/evaluator.rs`.
-- Inference layer: `inference/provider/openhuman_backend.rs`, `inference/provider/factory.rs`, `inference/local/service/{vision_embed.rs,public_infer.rs}`, `inference/voice/postprocess.rs`.
+- Background workers / pipelines: `autocomplete/core/engine.rs`, `task_sources/route.rs`, [`agent/triage/evaluator.rs`](../../agent/triage/evaluator.rs).
+- Inference layer: `inference/provider/openhuman_backend.rs`, [`inference/provider/factory.rs`](../../inference/provider/factory.rs), `inference/local/service/{vision_embed.rs,public_infer.rs}`, `inference/voice/postprocess.rs`.
- Credentials lifecycle (signed-out kill switch): `credentials/ops.rs`, `credentials/bus.rs`.
-- Bootstrap / transport: `core/runtime/subscribers.rs` (calls `init_global` during server bootstrap), `core/observability.rs`, plus the domain wiring in `openhuman/mod.rs` and config schema in `config/schema/scheduler_gate.rs`.
+- Bootstrap / transport: [`core/runtime/subscribers.rs`](../../core/runtime/subscribers.rs) (calls `init_global` during server bootstrap), [`core/observability.rs`](../../core/observability.rs), plus the domain wiring in `openhuman/mod.rs` and config schema in [`config/schema/scheduler_gate.rs`](../../config/schema/scheduler_gate.rs).
## Notes / gotchas
diff --git a/crates/openhuman-core/src/cron/tools/README.md b/crates/openhuman-core/src/cron/tools/README.md
index 3539ad5c71..fe25b5d3dd 100644
--- a/crates/openhuman-core/src/cron/tools/README.md
+++ b/crates/openhuman-core/src/cron/tools/README.md
@@ -1,8 +1,8 @@
# Cron tools
Agent-facing tools over the `cron` domain. Six per-operation tools
-(`add.rs`, `list.rs`, `update.rs`, `remove.rs`, `run.rs`, `runs.rs`) are the
-implementation; `collapsed.rs` wraps them into a single action-dispatched
+([`add.rs`](./add.rs), [`list.rs`](./list.rs), [`update.rs`](./update.rs), [`remove.rs`](./remove.rs), [`run.rs`](./run.rs), [`runs.rs`](./runs.rs)) are the
+implementation; [`collapsed.rs`](./collapsed.rs) wraps them into a single action-dispatched
`CronTool`. All seven are re-exported wholesale by `crate::tools` (`pub use
crate::cron::tools::*` in `tools/mod.rs`).
@@ -75,7 +75,7 @@ or immediately execute a stored command or agent prompt on the host.
- `cron` domain: [`../README.md`](../README.md): job/run model, scheduler,
delivery modes, agent-job minimum interval.
-- `crates/openhuman-core/src/tools/impl/system/schedule.rs`: the separate
+- [`crates/openhuman-core/src/tools/impl/system/schedule.rs`](../../tools/impl/system/schedule.rs): the separate
one-shot `schedule` tool built on `cron::add_once` / `cron::add_once_at`;
not part of the collapse above.
- `crates/openhuman-core/src/tools/impl/meta/collapse.rs` (module path
@@ -84,8 +84,8 @@ or immediately execute a stored command or agent prompt on the host.
## Tests
-`add_tests.rs`, `list_tests.rs`, `update_tests.rs`, `remove_tests.rs`,
-`run_tests.rs`, `runs_tests.rs` cover each per-operation tool;
-`collapsed_tests.rs` covers the merged schema, per-action versus fallback
+[`add_tests.rs`](./add_tests.rs), [`list_tests.rs`](./list_tests.rs), [`update_tests.rs`](./update_tests.rs), [`remove_tests.rs`](./remove_tests.rs),
+[`run_tests.rs`](./run_tests.rs), [`runs_tests.rs`](./runs_tests.rs) cover each per-operation tool;
+[`collapsed_tests.rs`](./collapsed_tests.rs) covers the merged schema, per-action versus fallback
permission levels, the unknown-action error, and that every member is
`Hidden`.
diff --git a/crates/openhuman-core/src/desktop/README.md b/crates/openhuman-core/src/desktop/README.md
index f453d3d211..799c02147f 100644
--- a/crates/openhuman-core/src/desktop/README.md
+++ b/crates/openhuman-core/src/desktop/README.md
@@ -6,10 +6,10 @@ the model-health dashboard, the provider respond queue, and opt-in native
desktop control. A headless or embedded host has little use for any of it,
which is why these domains are grouped here and tagged `DomainGroup::Desktop`.
-This is not the Tauri shell. The shell lives in `crates/openhuman-app/` and
+This is not the Tauri shell. The shell lives in [`crates/openhuman-app/`](../../../openhuman-app/) and
owns windows, the tray, and native OS integration. This folder is the
business logic those windows reach over JSON-RPC and Socket.IO. The browser
-SPA uses the same RPC surface; the TUI (`crates/openhuman-tui`) uses little of
+SPA uses the same RPC surface; the TUI ([`crates/openhuman-tui`](../../../openhuman-tui/)) uses little of
it.
## How it works
@@ -39,12 +39,12 @@ Each one meets the frontend in one of two ways:
Request and response flows (the app-state snapshot, the notification list,
model health, the respond queue, desktop status) are ordinary controllers
-registered under `DomainGroup::Desktop` in `core/all.rs`. Push flows use
+registered under `DomainGroup::Desktop` in [`core/all.rs`](../core/all.rs). Push flows use
process-global `tokio::sync::broadcast` channels that the Socket.IO server in
-`crates/openhuman-rpc` subscribes to and forwards. Notifications get onto
+[`crates/openhuman-rpc`](../../../openhuman-rpc/) subscribes to and forwards. Notifications get onto
their channel through `NotificationBridgeSubscriber` (`notifications::bridge`),
which translates selected `DomainEvent`s; it is registered at startup from
-`core/runtime/subscribers.rs`. Overlay attention events are published
+[`core/runtime/subscribers.rs`](../core/runtime/subscribers.rs). Overlay attention events are published
directly by any caller.
### Desktop control
@@ -55,14 +55,14 @@ actions. It is opt-in per computer. The enabled flag lives in
`<workspace>/state/desktop-control.json` and fails closed when the file is
missing or corrupt. Control is only supported on macOS and Windows, and only
when the core's HTTP listener is bound to loopback
-(`set_listener_is_loopback`, set from `core/runtime/builder.rs` once the
+(`set_listener_is_loopback`, set from [`core/runtime/builder.rs`](../core/runtime/builder.rs) once the
address is known). The tools refuse to run when the listener is not loopback
or control is disabled.
The agent tools are `desktop_list_apps`, `desktop_list_windows`,
`desktop_launch`, `desktop_snapshot`, `desktop_find`, `desktop_goal`, and
`desktop_continue_goal` (`DesktopTool` with a `DesktopToolKind`, registered in
-`tools/ops.rs`). A `desktop_goal` call hands one bounded task to the module,
+[`tools/ops.rs`](../tools/ops.rs)). A `desktop_goal` call hands one bounded task to the module,
which runs and verifies several actions in that call. When the operator turns
desktop approvals on (`config.desktop.approvals_enabled`), the module can stop
on a pending action. `confirmation.rs` keeps those one-use decisions for ten
@@ -70,13 +70,13 @@ minutes and exposes them through `desktop_pending` and `desktop_confirm`. With
approvals off (the default), `approvals_disabled_for` lets these seven tools
skip only the approval park; permission caps, denies, OS grants, and the
action budget still apply. The agent-facing instructions are in
-`control/WORKFLOW.md`.
+[`control/WORKFLOW.md`](./control/WORKFLOW.md).
## Layout
| Path | What it does |
| --- | --- |
-| `mod.rs` | Declares the members. Only `control` is feature-gated. |
+| [`mod.rs`](./mod.rs) | Declares the members. Only `control` is feature-gated. |
| [`app_state/`](app_state/README.md) | The snapshot the shell polls (`app_state_snapshot`): stored credential and user, local-AI and service status, onboarding tasks, keyring status, config-recovery notice. Owns `state/app-state.json` and `update_local_state`. |
| `control/` | Opt-in native desktop control: enablement and status (`ops.rs`), pending-action decisions (`confirmation.rs`), the `desktop_*` agent tools (`tools.rs`), and internal-only controllers (`schemas.rs`). `modules` feature only. Agent guidance in `WORKFLOW.md`. |
| [`dashboard/`](dashboard/README.md) | Read-only per-model health table for Settings, built from `model_registry` and the `dashboard.model_health` thresholds. Also the `dashboard_model_health` agent tool. |
@@ -86,18 +86,18 @@ action budget still apply. The agent-facing instructions are in
## Key types and entry points
-- `app_state::snapshot()` (`app_state/ops/snapshot.rs`) assembles
+- `app_state::snapshot()` ([`app_state/ops/snapshot.rs`](./app_state/ops/snapshot.rs)) assembles
`AppStateSnapshot` from peer domains. It never calls the backend; the user
it reports is what the host passed in through `auth.set_credential`.
- `notifications::register_notification_bridge_subscriber(config)` and
`notifications::publish_core_notification` / `subscribe_core_notifications`
- (`notifications/bus.rs`) are the push path for the notification center.
+ ([`notifications/bus.rs`](./notifications/bus.rs)) are the push path for the notification center.
- `overlay::publish_attention(OverlayAttentionEvent)` returns how many
subscribers received the event (zero means it was dropped).
- `control::status`, `control::set_enabled`, and `control::probe`
- (`control/ops.rs`) back the Connections page.
-- `DesktopTool` and `DesktopToolKind` (`control/tools.rs`) are the desktop
- agent tools, re-exported through `tools/mod.rs`.
+ ([`control/ops.rs`](./control/ops.rs)) back the Connections page.
+- `DesktopTool` and `DesktopToolKind` ([`control/tools.rs`](./control/tools.rs)) are the desktop
+ agent tools, re-exported through [`tools/mod.rs`](../tools/mod.rs).
## RPC / CLI surface
@@ -115,11 +115,11 @@ Method names are `openhuman.<namespace>_<function>`.
- Windows, tray, notch window, and OS integration belong to the Tauri shell
(`crates/openhuman-app/`). The notch window host is
- `crates/openhuman-app/src/notch_window.rs`.
-- Socket.IO forwarding belongs to `crates/openhuman-rpc/src/server/socketio.rs`.
+ [`crates/openhuman-app/src/notch_window.rs`](../../../openhuman-app/src/notch_window.rs).
+- Socket.IO forwarding belongs to [`crates/openhuman-rpc/src/server/socketio.rs`](../../../openhuman-rpc/src/server/socketio.rs).
- OS accessibility (AX and IOKit FFI, the Swift helper, focus, permissions,
the Globe key) belongs to the `tinycomputer-accessibility` crate in
- `vendor/tinycomputer` (upstream `tinyhumansai/tinycomputer`). Desktop
+ [`vendor/tinycomputer`](../../../../vendor/tinycomputer/) (upstream `tinyhumansai/tinycomputer`). Desktop
observation, interaction, and Jev-driven goals belong to the `tinycomputer`
module; this folder calls it through `tinycomputer-bus`.
- The live current user belongs to the host's session owner
diff --git a/crates/openhuman-core/src/desktop/app_state/README.md b/crates/openhuman-core/src/desktop/app_state/README.md
index 615ef850ac..45ae80cc7a 100644
--- a/crates/openhuman-core/src/desktop/app_state/README.md
+++ b/crates/openhuman-core/src/desktop/app_state/README.md
@@ -2,20 +2,20 @@
Aggregator that the React shell polls every few seconds (`openhuman.app_state_snapshot`) to render the OS-level chrome: the stored credential and user, local-AI status, service health, onboarding tasks, keyring status, config-recovery notice. Owns the on-disk `app-state.json` and the merge/patch surface for shell-managed local fields. Does NOT own any of the underlying domain state. It assembles snapshots from peer domains and persists shell-side onboarding metadata.
-The snapshot never talks to the backend. The user it reports is the payload the host handed the core with `auth.set_credential` (the host's own `/auth/me` answer); the *live* current user is the session owner's business, the Tauri shell's session cache (`openhuman_tinyhumans::session::CurrentUserCache`), and the frontend merges it in (`app/src/services/coreStateApi.ts`).
+The snapshot never talks to the backend. The user it reports is the payload the host handed the core with `auth.set_credential` (the host's own `/auth/me` answer); the *live* current user is the session owner's business, the Tauri shell's session cache (`openhuman_tinyhumans::session::CurrentUserCache`), and the frontend merges it in ([`app/src/services/coreStateApi.ts`](../../../../../app/src/services/coreStateApi.ts)).
## Key files
| File | Role |
| --- | --- |
-| `mod.rs` | `pub use ops::*`, `recovery_signal::{config_recovered_this_session, latch_from_config}`, and the `all_app_state_*` / `app_state_schemas` controller aggregators. |
-| `ops.rs` | Aggregator only: declares the submodules below and attaches the sibling test file. |
-| `ops/types.rs` | Serde types (`StoredOnboardingTasks`, `StoredAppState`, `AppStateSnapshot`, `RuntimeSnapshot`, `StoredAppStatePatch`). |
-| `ops/state_file.rs` | `app-state.json` load/save with corruption quarantine (`load_stored_app_state`, `save_app_state`). |
-| `ops/runtime_snapshot.rs` | The local-AI + service half of the snapshot (10s cache, single-flighted, #4249). |
-| `ops/snapshot.rs` | `snapshot()` and `update_local_state()`. |
-| `recovery_signal.rs` | Process-lifetime latch for "config.toml was recovered from corruption this session" (#5167). |
-| `schemas.rs` | `app_state` controller schemas and thin handlers. |
+| [`mod.rs`](./mod.rs) | `pub use ops::*`, `recovery_signal::{config_recovered_this_session, latch_from_config}`, and the `all_app_state_*` / `app_state_schemas` controller aggregators. |
+| [`ops.rs`](./ops.rs) | Aggregator only: declares the submodules below and attaches the sibling test file. |
+| [`ops/types.rs`](./ops/types.rs) | Serde types (`StoredOnboardingTasks`, `StoredAppState`, `AppStateSnapshot`, `RuntimeSnapshot`, `StoredAppStatePatch`). |
+| [`ops/state_file.rs`](./ops/state_file.rs) | `app-state.json` load/save with corruption quarantine (`load_stored_app_state`, `save_app_state`). |
+| [`ops/runtime_snapshot.rs`](./ops/runtime_snapshot.rs) | The local-AI + service half of the snapshot (10s cache, single-flighted, #4249). |
+| [`ops/snapshot.rs`](./ops/snapshot.rs) | `snapshot()` and `update_local_state()`. |
+| [`recovery_signal.rs`](./recovery_signal.rs) | Process-lifetime latch for "config.toml was recovered from corruption this session" (#5167). |
+| [`schemas.rs`](./schemas.rs) | `app_state` controller schemas and thin handlers. |
| `*_tests.rs` | Sibling test files attached with `#[cfg(test)] #[path = ...] mod`. |
## Public surface
@@ -40,12 +40,12 @@ The signed-in identity for prompts and Sentry is `security::credentials::identit
## Called by
-- `crates/openhuman-core/src/core/all.rs`: registers `all_app_state_registered_controllers()`; the shell reaches them through `coreRpcClient` → `relay_http_rpc`.
-- `crates/openhuman-core/src/core/runtime/bootstrap.rs`: `latch_from_config` at runtime bootstrap.
-- `crates/openhuman-core/src/agent/session_host/builder/factory.rs`: `load_stored_app_state` to read `onboarding_tasks.enabled_tools` for tool filtering.
-- `crates/openhuman-core/src/security/keyring_consent/ops.rs`: persists the consent choice through `update_local_state`.
+- [`crates/openhuman-core/src/core/all.rs`](../../core/all.rs): registers `all_app_state_registered_controllers()`; the shell reaches them through `coreRpcClient` → `relay_http_rpc`.
+- [`crates/openhuman-core/src/core/runtime/bootstrap.rs`](../../core/runtime/bootstrap.rs): `latch_from_config` at runtime bootstrap.
+- [`crates/openhuman-core/src/agent/session_host/builder/factory.rs`](../../agent/session_host/builder/factory.rs): `load_stored_app_state` to read `onboarding_tasks.enabled_tools` for tool filtering.
+- [`crates/openhuman-core/src/security/keyring_consent/ops.rs`](../../security/keyring_consent/ops.rs): persists the consent choice through `update_local_state`.
## Tests
-- `ops_tests.rs`, `recovery_signal_tests.rs`, `schemas_tests.rs`.
-- JSON-RPC shape: `tests/json_rpc_e2e.rs` (`json_rpc_app_state_snapshot_returns_runtime_shape`), `tests/in_process/config_auth_app_state_connectivity_e2e.rs`.
+- [`ops_tests.rs`](./ops_tests.rs), [`recovery_signal_tests.rs`](./recovery_signal_tests.rs), [`schemas_tests.rs`](./schemas_tests.rs).
+- JSON-RPC shape: [`tests/json_rpc_e2e.rs`](../../../../../tests/json_rpc_e2e.rs) (`json_rpc_app_state_snapshot_returns_runtime_shape`), [`tests/in_process/config_auth_app_state_connectivity_e2e.rs`](../../../../../tests/in_process/config_auth_app_state_connectivity_e2e.rs).
diff --git a/crates/openhuman-core/src/desktop/dashboard/README.md b/crates/openhuman-core/src/desktop/dashboard/README.md
index cb4aa20ae2..2fc8cdf80c 100644
--- a/crates/openhuman-core/src/desktop/dashboard/README.md
+++ b/crates/openhuman-core/src/desktop/dashboard/README.md
@@ -1,6 +1,6 @@
# dashboard
-Aggregate, operator-facing views over local config. Today it owns a single read-only view: the per-model health comparison table rendered in the desktop **Settings → Developer Options → Model Health** panel. The view joins the local `Config::model_registry` with the `dashboard.model_health` thresholds and emits one row per model. Telemetry-driven metric fields (`quality_score`, `hallucination_rate`, `agents_using`, `tasks_evaluated`) are intentional placeholders (`null` / `0`) until a local telemetry pipeline lands. The placeholder contract is documented in `ops.rs` and asserted in its tests. Stateless: no persistence, no event-bus subscribers, no agent tools.
+Aggregate, operator-facing views over local config. Today it owns a single read-only view: the per-model health comparison table rendered in the desktop **Settings → Developer Options → Model Health** panel. The view joins the local `Config::model_registry` with the `dashboard.model_health` thresholds and emits one row per model. Telemetry-driven metric fields (`quality_score`, `hallucination_rate`, `agents_using`, `tasks_evaluated`) are intentional placeholders (`null` / `0`) until a local telemetry pipeline lands. The placeholder contract is documented in [`ops.rs`](./ops.rs) and asserted in its tests. Stateless: no persistence, no event-bus subscribers, no agent tools.
## Responsibilities
@@ -14,10 +14,10 @@ Aggregate, operator-facing views over local config. Today it owns a single read-
| File | Role |
| --- | --- |
-| `crates/openhuman-core/src/desktop/dashboard/mod.rs` | Export-only: module docstring + `mod`/`pub use` re-exports of ops, schemas, and types. |
-| `crates/openhuman-core/src/desktop/dashboard/types.rs` | Wire types: `ModelHealthEntry`, `ModelHealthConfigView`, `ModelHealthResponse` (serde). |
+| [`crates/openhuman-core/src/desktop/dashboard/mod.rs`](./mod.rs) | Export-only: module docstring + `mod`/`pub use` re-exports of ops, schemas, and types. |
+| [`crates/openhuman-core/src/desktop/dashboard/types.rs`](./types.rs) | Wire types: `ModelHealthEntry`, `ModelHealthConfigView`, `ModelHealthResponse` (serde). |
| `crates/openhuman-core/src/desktop/dashboard/ops.rs` | Business logic: `model_health(&Config)` joins registry + thresholds, returns `Outcome<ModelHealthResponse>`. Inline tests cover mapping, thresholds, disabled feature, empty registry. |
-| `crates/openhuman-core/src/desktop/dashboard/schemas.rs` | Controller schemas + registered controller + `handle_dashboard_model_health` handler (loads config via timeout, delegates to `ops::model_health`). Inline tests assert schema stability and list-length parity. |
+| [`crates/openhuman-core/src/desktop/dashboard/schemas.rs`](./schemas.rs) | Controller schemas + registered controller + `handle_dashboard_model_health` handler (loads config via timeout, delegates to `ops::model_health`). Inline tests assert schema stability and list-length parity. |
## Public surface
@@ -34,7 +34,7 @@ Aggregate, operator-facing views over local config. Today it owns a single read-
`ModelHealthEntry`: `id`, `provider`, `cost_per_1m_output` (f64), `vision` (bool), `quality_score` (`f64?`, placeholder), `hallucination_rate` (`f64?`, placeholder), `agents_using` (u64, placeholder 0), `tasks_evaluated` (u64, placeholder 0).
`ModelHealthConfigView`: `hallucination_threshold` (f64), `min_tasks_for_rating` (u64), `evaluation_window_tasks` (u64).
-The handler loads config via `crate::config::rpc::load_config_with_timeout()` and returns CLI-compatible JSON through `Outcome::into_cli_compatible_json()`. Wired into the registry in `crates/openhuman-core/src/core/all.rs` (both `all_dashboard_registered_controllers` and `all_dashboard_controller_schemas`).
+The handler loads config via `crate::config::rpc::load_config_with_timeout()` and returns CLI-compatible JSON through `Outcome::into_cli_compatible_json()`. Wired into the registry in [`crates/openhuman-core/src/core/all.rs`](../../core/all.rs) (both `all_dashboard_registered_controllers` and `all_dashboard_controller_schemas`).
## Persistence
@@ -42,7 +42,7 @@ None. The module reads from in-memory `Config`; it stores no state.
## Dependencies
-- `crate::config` (`Config`, `config::rpc::load_config_with_timeout`), source of the model registry and `dashboard.model_health` thresholds. `DashboardConfig` / `ModelHealthConfig` are defined in `crates/openhuman-core/src/config/schema/dashboard.rs`.
+- `crate::config` (`Config`, `config::rpc::load_config_with_timeout`), source of the model registry and `dashboard.model_health` thresholds. `DashboardConfig` / `ModelHealthConfig` are defined in [`crates/openhuman-core/src/config/schema/dashboard.rs`](../../config/schema/dashboard.rs).
- `crate::core::all` (`ControllerFuture`, `RegisteredController`) and `crate::core` (`ControllerSchema`, `FieldSchema`, `TypeSchema`), controller registry types.
- `crate::core::Outcome`: standard RPC result wrapper.
- `serde` / `serde_json`: wire (de)serialization and handler params.
@@ -55,4 +55,4 @@ None. The module reads from in-memory `Config`; it stores no state.
- **Placeholder contract is load-bearing.** `quality_score` / `hallucination_rate` are always `None` and `agents_using` / `tasks_evaluated` always `0`. The frontend treats null quality/hallucination as "no signal", collapsing badges to `staging`. When telemetry lands, populate these in `ops::model_health`, not in the transport layer.
- Disabled feature (`dashboard.model_health.enabled == false`) returns `Err("model health disabled")`, which the handler surfaces as an RPC error.
-- This is the only view in the domain so far; `mod.rs` is intentionally export-only per the canonical module shape (no `store.rs`, `tools.rs`, or `bus.rs`: the domain is stateless, owns no agent tools, and has no event subscribers).
+- This is the only view in the domain so far; `mod.rs` is intentionally export-only per the canonical module shape (no `store.rs`, [`tools.rs`](./tools.rs), or `bus.rs`: the domain is stateless, owns no agent tools, and has no event subscribers).
diff --git a/crates/openhuman-core/src/desktop/notifications/README.md b/crates/openhuman-core/src/desktop/notifications/README.md
index 0cdb9439a7..187ce6265b 100644
--- a/crates/openhuman-core/src/desktop/notifications/README.md
+++ b/crates/openhuman-core/src/desktop/notifications/README.md
@@ -16,13 +16,13 @@ The notifications domain owns two complementary sub-systems. The **core-bridge**
| File | Role |
| --- | --- |
-| `crates/openhuman-core/src/desktop/notifications/mod.rs` | Export-focused module root; docstring + re-exports of bus helpers, schema registries, and types. |
-| `crates/openhuman-core/src/desktop/notifications/types.rs` | Serde domain types: `CoreNotificationEvent`/`CoreNotificationCategory` (bridge), `IntegrationNotification`, `NotificationStatus`, `NotificationSettings`, `NotificationStats`, and RPC request types. |
-| `crates/openhuman-core/src/desktop/notifications/bus.rs` | `NotificationBridgeSubscriber` (`tinybus::EventHandler<DomainEvent>`, name `notifications::bridge`), the `NOTIFICATION_BUS` broadcast static, `publish_core_notification`/`subscribe_core_notifications`, the pure `event_to_notification` translator, the workspace gate (`store_target` / `should_announce` / `announces_to`, #5931), and `register_notification_bridge_subscriber(config)`. |
-| `crates/openhuman-core/src/desktop/notifications/rpc.rs` | Async RPC handler fns (`handle_ingest`, `handle_list`, `handle_mark_read`, `handle_dismiss`, `handle_mark_acted`, `handle_settings_get`/`_set`, `handle_stats`) + `triage_action_to_score` heuristic. |
-| `crates/openhuman-core/src/desktop/notifications/schemas.rs` | Controller schema defs, the `NOTIFICATION_CONTROLLER_DEFS` table, `all_controller_schemas`/`all_registered_controllers`, and handler wrappers delegating to `rpc.rs`. |
-| `crates/openhuman-core/src/desktop/notifications/store.rs` | SQLite persistence (`integration_notifications` + `notification_settings` + `core_notifications` tables) via a per-call `with_connection` helper; insert/list/dedup/triage-update/status/settings/stats queries plus core-notification persistence (#3805). |
-| `crates/openhuman-core/src/desktop/notifications/{bus,store}_tests.rs`, `{bus,store}_tests_2_tests.rs`, `schemas_tests.rs`, `types_tests.rs` | Sibling test suites, attached with `#[cfg(test)] #[path = ...] mod`. |
+| [`crates/openhuman-core/src/desktop/notifications/mod.rs`](./mod.rs) | Export-focused module root; docstring + re-exports of bus helpers, schema registries, and types. |
+| [`crates/openhuman-core/src/desktop/notifications/types.rs`](./types.rs) | Serde domain types: `CoreNotificationEvent`/`CoreNotificationCategory` (bridge), `IntegrationNotification`, `NotificationStatus`, `NotificationSettings`, `NotificationStats`, and RPC request types. |
+| [`crates/openhuman-core/src/desktop/notifications/bus.rs`](./bus.rs) | `NotificationBridgeSubscriber` (`tinybus::EventHandler<DomainEvent>`, name `notifications::bridge`), the `NOTIFICATION_BUS` broadcast static, `publish_core_notification`/`subscribe_core_notifications`, the pure `event_to_notification` translator, the workspace gate (`store_target` / `should_announce` / `announces_to`, #5931), and `register_notification_bridge_subscriber(config)`. |
+| [`crates/openhuman-core/src/desktop/notifications/rpc.rs`](./rpc.rs) | Async RPC handler fns (`handle_ingest`, `handle_list`, `handle_mark_read`, `handle_dismiss`, `handle_mark_acted`, `handle_settings_get`/`_set`, `handle_stats`) + `triage_action_to_score` heuristic. |
+| [`crates/openhuman-core/src/desktop/notifications/schemas.rs`](./schemas.rs) | Controller schema defs, the `NOTIFICATION_CONTROLLER_DEFS` table, `all_controller_schemas`/`all_registered_controllers`, and handler wrappers delegating to `rpc.rs`. |
+| [`crates/openhuman-core/src/desktop/notifications/store.rs`](./store.rs) | SQLite persistence (`integration_notifications` + `notification_settings` + `core_notifications` tables) via a per-call `with_connection` helper; insert/list/dedup/triage-update/status/settings/stats queries plus core-notification persistence (#3805). |
+| `crates/openhuman-core/src/desktop/notifications/{bus,store}_tests.rs`, `{bus,store}_tests_2_tests.rs`, [`schemas_tests.rs`](./schemas_tests.rs), [`types_tests.rs`](./types_tests.rs) | Sibling test suites, attached with `#[cfg(test)] #[path = ...] mod`. |
## Public surface
@@ -49,7 +49,7 @@ Namespace `notification` (10 controllers, registered via `all_notifications_regi
| `core_list` | `only_unread?` (true), `limit?` (100) | `{ items, unread_count }`: persisted core notifications (#3805), newest first; sync-down for events fired while the app was closed. |
| `core_mark_read` | `id` | `{ ok }` (true when a row matched) |
-Schemas + handlers are wired into the controller registry in `crates/openhuman-core/src/core/all.rs`.
+Schemas + handlers are wired into the controller registry in [`crates/openhuman-core/src/core/all.rs`](../../core/all.rs).
### Core-notification persistence (#3805)
@@ -97,15 +97,15 @@ SQLite DB at `{workspace_dir}/notifications/notifications.db`, opened per-call v
## Used by
- `crates/openhuman-core/src/core/all.rs`: registers the controllers/schemas into the RPC registry.
-- `crates/openhuman-core/src/core/runtime/subscribers.rs`: calls `register_notification_bridge_subscriber(config)` at startup when the Desktop domain group is enabled.
-- `crates/openhuman-rpc/src/server/socketio.rs`: calls `subscribe_core_notifications()` to forward events to web clients.
-- `crates/openhuman-core/src/cron/scheduler/delivery.rs`: writes cron-triggered notifications through `notifications::store` directly; `cron/scheduler_tests*.rs` list them back with `store::list`.
-- `crates/openhuman-core/src/flows/ops/execution.rs` and `crates/openhuman-core/src/security/approval/gate.rs`: call `publish_core_notification` directly to surface flow and approval events.
+- [`crates/openhuman-core/src/core/runtime/subscribers.rs`](../../core/runtime/subscribers.rs): calls `register_notification_bridge_subscriber(config)` at startup when the Desktop domain group is enabled.
+- [`crates/openhuman-rpc/src/server/socketio.rs`](../../../../openhuman-rpc/src/server/socketio.rs): calls `subscribe_core_notifications()` to forward events to web clients.
+- [`crates/openhuman-core/src/cron/scheduler/delivery.rs`](../../cron/scheduler/delivery.rs): writes cron-triggered notifications through `notifications::store` directly; `cron/scheduler_tests*.rs` list them back with `store::list`.
+- [`crates/openhuman-core/src/flows/ops/execution.rs`](../../flows/ops/execution.rs) and [`crates/openhuman-core/src/security/approval/gate.rs`](../../security/approval/gate.rs): call `publish_core_notification` directly to surface flow and approval events.
## Notes / gotchas
- `CoreNotificationEvent` ids embed a publish timestamp, so each cron run / webhook failure / subagent event produces a distinct notification-center entry rather than coalescing.
-- `CoreNotificationCategory` must stay in sync with `NotificationCategory` in `app/src/store/notificationSlice.ts`.
+- `CoreNotificationCategory` must stay in sync with `NotificationCategory` in [`app/src/store/notificationSlice.ts`](../../../../../app/src/store/notificationSlice.ts).
- The ingest RPC returns immediately; triage runs in a spawned task and back-fills the score later. List/stats may show `importance_score: null` (unscored) until triage completes.
- Triage→score mapping is a fixed heuristic in `rpc::triage_action_to_score`: Drop 0.1, Acknowledge 0.35, React 0.65, Escalate 0.9.
- Routing re-reads provider settings just before escalation so a mid-flight settings toggle takes effect; routing requires `score >= importance_threshold` AND `route_to_orchestrator`.
diff --git a/crates/openhuman-core/src/desktop/overlay/README.md b/crates/openhuman-core/src/desktop/overlay/README.md
index 64fedcfb06..fec1a7e15c 100644
--- a/crates/openhuman-core/src/desktop/overlay/README.md
+++ b/crates/openhuman-core/src/desktop/overlay/README.md
@@ -1,6 +1,6 @@
# overlay
-Signals pushed from the core to the desktop **overlay surfaces**, separate WebViews (`app/src/overlay/OverlayApp.tsx` and the macOS notch pill `app/src/notch/NotchApp.tsx`, hosted by `crates/openhuman-app/src/notch_window.rs`) that render short, non-focus-stealing messages over the desktop. The standalone `overlay` window is currently disabled in `crates/openhuman-app/tauri.conf.json`; the notch is the live consumer. Because these surfaces run in their own JS runtime they cannot share Redux state with the main window; each subscribes to its own Socket.IO connection and reacts to events the core broadcasts. This module owns a single fire-and-forget broadcast bus for **attention** events; the Socket.IO transport bridge (`crates/openhuman-rpc/src/server/socketio.rs`) subscribes and forwards them. It is deliberately light: export-focused, one broadcast channel, no persistence and no RPC.
+Signals pushed from the core to the desktop **overlay surfaces**, separate WebViews ([`app/src/overlay/OverlayApp.tsx`](../../../../../app/src/overlay/OverlayApp.tsx) and the macOS notch pill [`app/src/notch/NotchApp.tsx`](../../../../../app/src/notch/NotchApp.tsx), hosted by [`crates/openhuman-app/src/notch_window.rs`](../../../../openhuman-app/src/notch_window.rs)) that render short, non-focus-stealing messages over the desktop. The standalone `overlay` window is currently disabled in [`crates/openhuman-app/tauri.conf.json`](../../../../openhuman-app/tauri.conf.json); the notch is the live consumer. Because these surfaces run in their own JS runtime they cannot share Redux state with the main window; each subscribes to its own Socket.IO connection and reacts to events the core broadcasts. This module owns a single fire-and-forget broadcast bus for **attention** events; the Socket.IO transport bridge ([`crates/openhuman-rpc/src/server/socketio.rs`](../../../../openhuman-rpc/src/server/socketio.rs)) subscribes and forwards them. It is deliberately light: export-focused, one broadcast channel, no persistence and no RPC.
## Responsibilities
@@ -13,9 +13,9 @@ Signals pushed from the core to the desktop **overlay surfaces**, separate WebVi
| File | Role |
| --- | --- |
-| `crates/openhuman-core/src/desktop/overlay/mod.rs` | Module docstring + re-exports only (`publish_attention`, `subscribe_attention_events`, `OverlayAttentionEvent`, `OverlayAttentionTone`). |
-| `crates/openhuman-core/src/desktop/overlay/types.rs` | `OverlayAttentionEvent` (message + optional `id` / `tone` / `ttl_ms` / `source`) with builder helpers, and the `OverlayAttentionTone` enum (`neutral` / `accent` / `success`). |
-| `crates/openhuman-core/src/desktop/overlay/bus.rs` | `Lazy` `tokio::sync::broadcast` channel (capacity 64) plus `publish_attention` / `subscribe_attention_events`; tests live in the sibling `bus_tests.rs`. |
+| [`crates/openhuman-core/src/desktop/overlay/mod.rs`](./mod.rs) | Module docstring + re-exports only (`publish_attention`, `subscribe_attention_events`, `OverlayAttentionEvent`, `OverlayAttentionTone`). |
+| [`crates/openhuman-core/src/desktop/overlay/types.rs`](./types.rs) | `OverlayAttentionEvent` (message + optional `id` / `tone` / `ttl_ms` / `source`) with builder helpers, and the `OverlayAttentionTone` enum (`neutral` / `accent` / `success`). |
+| [`crates/openhuman-core/src/desktop/overlay/bus.rs`](./bus.rs) | `Lazy` `tokio::sync::broadcast` channel (capacity 64) plus `publish_attention` / `subscribe_attention_events`; tests live in the sibling [`bus_tests.rs`](./bus_tests.rs). |
## Public surface
@@ -26,7 +26,7 @@ Signals pushed from the core to the desktop **overlay surfaces**, separate WebVi
## Events
-Not a `DomainEvent` / bus (`crates/openhuman-core/src/core/bus.rs`, `crates/openhuman-core/src/core/events.rs`) participant. It runs its own standalone `tokio::sync::broadcast` channel. The Socket.IO bridge in `crates/openhuman-rpc/src/server/socketio.rs` (`spawn_web_channel_bridge`, task #3) subscribes via `subscribe_attention_events()` and emits each event to the overlay socket as both `overlay:attention` and `overlay_attention`; it logs and continues on `Lagged` and breaks on `Closed`.
+Not a `DomainEvent` / bus ([`crates/openhuman-core/src/core/bus.rs`](../../core/bus.rs), [`crates/openhuman-core/src/core/events.rs`](../../core/events.rs)) participant. It runs its own standalone `tokio::sync::broadcast` channel. The Socket.IO bridge in `crates/openhuman-rpc/src/server/socketio.rs` (`spawn_web_channel_bridge`, task #3) subscribes via `subscribe_attention_events()` and emits each event to the overlay socket as both `overlay:attention` and `overlay_attention`; it logs and continues on `Lagged` and breaks on `Closed`.
## Persistence
@@ -39,8 +39,8 @@ None. State is purely an in-memory broadcast channel; events not consumed when p
## Used by
- `crates/openhuman-rpc/src/server/socketio.rs`: subscribes to the bus and forwards events to the overlay WebView over Socket.IO.
-- `crates/openhuman-core/src/voice/always_on/processor.rs`: `notch_status` publishes "Listening" / "Processing" status messages (`source: "voice"`, with a TTL) that the notch maps to icons. The only in-tree publisher today.
-- `crates/openhuman-core/src/desktop/notifications/bus.rs`: references this module's bus only as a documented pattern to mirror (no code dependency).
+- [`crates/openhuman-core/src/voice/always_on/processor.rs`](../../voice/always_on/processor.rs): `notch_status` publishes "Listening" / "Processing" status messages (`source: "voice"`, with a TTL) that the notch maps to icons. The only in-tree publisher today.
+- [`crates/openhuman-core/src/desktop/notifications/bus.rs`](../notifications/bus.rs): references this module's bus only as a documented pattern to mirror (no code dependency).
## Notes / gotchas
diff --git a/crates/openhuman-core/src/desktop/provider_surfaces/README.md b/crates/openhuman-core/src/desktop/provider_surfaces/README.md
index 080da9a6bd..6e0659e5fd 100644
--- a/crates/openhuman-core/src/desktop/provider_surfaces/README.md
+++ b/crates/openhuman-core/src/desktop/provider_surfaces/README.md
@@ -13,12 +13,12 @@ Local assistive surfaces for third-party provider apps. This domain owns a norma
| File | Role |
| --- | --- |
-| `crates/openhuman-core/src/desktop/provider_surfaces/mod.rs` | Export-only: declares submodules; re-exports `all_provider_surfaces_controller_schemas` / `all_provider_surfaces_registered_controllers`. |
-| `crates/openhuman-core/src/desktop/provider_surfaces/types.rs` | Serde domain types: `ProviderEvent`, `RespondQueueItem`, `RespondQueueListResponse`. Snake_case contract shared by request and response. |
-| `crates/openhuman-core/src/desktop/provider_surfaces/ops.rs` | Business logic / entry points: `ingest_event`, `list_queue`. Wrap results in `ApiEnvelope` + `Outcome`. Tests in sibling `ops_tests.rs`. |
-| `crates/openhuman-core/src/desktop/provider_surfaces/store.rs` | In-memory persistence: process-global `RESPOND_QUEUE` (`OnceLock<Mutex<Vec<…>>>`), `upsert_queue_item`, `list_queue_items`, `clear_queue` (test-only). |
-| `crates/openhuman-core/src/desktop/provider_surfaces/schemas.rs` | Controller registry: `ControllerSchema`s + `handle_*` fns delegating to `ops.rs`. Tests in sibling `schemas_tests.rs`. |
-| `crates/openhuman-core/src/desktop/provider_surfaces/rpc.rs` | Docstring-only placeholder; no code. The handler delegation lives in `schemas.rs`, not here. |
+| [`crates/openhuman-core/src/desktop/provider_surfaces/mod.rs`](./mod.rs) | Export-only: declares submodules; re-exports `all_provider_surfaces_controller_schemas` / `all_provider_surfaces_registered_controllers`. |
+| [`crates/openhuman-core/src/desktop/provider_surfaces/types.rs`](./types.rs) | Serde domain types: `ProviderEvent`, `RespondQueueItem`, `RespondQueueListResponse`. Snake_case contract shared by request and response. |
+| [`crates/openhuman-core/src/desktop/provider_surfaces/ops.rs`](./ops.rs) | Business logic / entry points: `ingest_event`, `list_queue`. Wrap results in `ApiEnvelope` + `Outcome`. Tests in sibling [`ops_tests.rs`](./ops_tests.rs). |
+| [`crates/openhuman-core/src/desktop/provider_surfaces/store.rs`](./store.rs) | In-memory persistence: process-global `RESPOND_QUEUE` (`OnceLock<Mutex<Vec<…>>>`), `upsert_queue_item`, `list_queue_items`, `clear_queue` (test-only). |
+| [`crates/openhuman-core/src/desktop/provider_surfaces/schemas.rs`](./schemas.rs) | Controller registry: `ControllerSchema`s + `handle_*` fns delegating to `ops.rs`. Tests in sibling [`schemas_tests.rs`](./schemas_tests.rs). |
+| [`crates/openhuman-core/src/desktop/provider_surfaces/rpc.rs`](./rpc.rs) | Docstring-only placeholder; no code. The handler delegation lives in `schemas.rs`, not here. |
## Public surface
@@ -31,7 +31,7 @@ Local assistive surfaces for third-party provider apps. This domain owns a norma
## RPC / controllers
-Namespace `provider_surfaces` (two controllers, registered via `crates/openhuman-core/src/core/all.rs`):
+Namespace `provider_surfaces` (two controllers, registered via [`crates/openhuman-core/src/core/all.rs`](../../core/all.rs)):
| Method | Inputs | Output |
| --- | --- | --- |
diff --git a/crates/openhuman-core/src/flows/README.md b/crates/openhuman-core/src/flows/README.md
index bb61fe7847..cdfe9fd1e4 100644
--- a/crates/openhuman-core/src/flows/README.md
+++ b/crates/openhuman-core/src/flows/README.md
@@ -6,7 +6,7 @@ saved-flow lifecycle (create, edit, enable, run, resume, cancel), the bridge
from trigger events to runs, the agent tools and sub-agents that author and
suggest flows, and the adapters that let the vendored `tinyflows` engine call
real OpenHuman services. The engine itself (graph model, validation,
-compilation, execution) lives in `vendor/tinyflows/`.
+compilation, execution) lives in [`vendor/tinyflows/`](../../../../vendor/tinyflows/).
Callers are the JSON-RPC/CLI surface (`flows.*`, used by the Workflows UI), the
event bus (cron ticks and Composio triggers), and agents that hold the flow
@@ -45,27 +45,27 @@ the engine, the capability seam).
### Saving a flow
A graph arrives as raw JSON, from the canvas, an import, a draft promotion or
-an agent tool. `ops::validate_and_migrate_graph` (in `ops/validation.rs`) runs
+an agent tool. `ops::validate_and_migrate_graph` (in [`ops/validation.rs`](./ops/validation.rs)) runs
it through `tinyflows::migrate::migrate` to upgrade older schemas, deserializes
it into a `WorkflowGraph`, and rejects anything `tinyflows::validate::validate`
refuses. Engine-compatibility checks map topology problems onto
`FlowValidationError`.
Agent-authored graphs pass one more stack, `run_builder_gates` in
-`ops/builder_gates.rs`. It is the single definition of the author-time hard
+[`ops/builder_gates.rs`](./ops/builder_gates.rs). It is the single definition of the author-time hard
gates, run in increasing cost order and short-circuiting on the first failure:
engine compatibility, binding resolvability, agent-ref resolvability,
-connection refs (`ops/connection_ref_gate.rs`: a `composio:<toolkit>:<id>` ref
+connection refs ([`ops/connection_ref_gate.rs`](./ops/connection_ref_gate.rs): a `composio:<toolkit>:<id>` ref
must name a connected account of the same toolkit as the slug), tool contracts
-(`ops/tool_contract_gate.rs`: the slug must exist in the live Composio catalog
+([`ops/tool_contract_gate.rs`](./ops/tool_contract_gate.rs): the slug must exist in the live Composio catalog
and every required arg must be present), and required-arg resolvability.
`propose_workflow`, `revise_workflow`, `edit_workflow`, `save_workflow`, and the
`strict` create/update RPC path all route through it, so agent saves and UI
saves cannot validate differently. Softer findings come back as warnings
-instead: `ops/wiring_warnings.rs` flags unwired required args and bindings to
+instead: [`ops/wiring_warnings.rs`](./ops/wiring_warnings.rs) flags unwired required args and bindings to
output fields the action does not produce.
-`flows_create` (in `ops/definitions.rs`) then applies two server-side rules
+`flows_create` (in [`ops/definitions.rs`](./ops/definitions.rs)) then applies two server-side rules
regardless of what the caller asked for:
1. A graph whose trigger fires without a human (`schedule`, `app_event`,
@@ -84,12 +84,12 @@ Every graph change is kept as a revision (`flows_get_history`,
`flows_rollback`).
Drafts are separate, non-live working copies stored as files under
-`<workspace>/flows/drafts/` (`draft_store.rs`, `ops/drafts.rs`). Promoting a
+`<workspace>/flows/drafts/` ([`draft_store.rs`](./draft_store.rs), [`ops/drafts.rs`](./ops/drafts.rs)). Promoting a
draft runs the same create/update gates as a normal save.
### Enabling and triggers
-`flows_set_enabled` (in `ops/triggers.rs`) binds or unbinds the flow's
+`flows_set_enabled` (in [`ops/triggers.rs`](./ops/triggers.rs)) binds or unbinds the flow's
automatic dispatch based on its trigger node:
| Trigger kind | What enabling does |
@@ -101,7 +101,7 @@ automatic dispatch based on its trigger node:
`flows_update` rebinds a schedule when an enabled flow's trigger kind or config
changes, so a new cron expression takes effect. At boot,
-`reconcile_schedule_triggers_on_boot` (called from `core/runtime/services.rs`)
+`reconcile_schedule_triggers_on_boot` (called from [`core/runtime/services.rs`](../core/runtime/services.rs))
re-arms schedules for every enabled flow.
```text
@@ -120,14 +120,14 @@ re-arms schedules for every enabled flow.
### Running a flow
-There are two entry points in `ops/run.rs`. `flows_run` blocks until the run
+There are two entry points in [`ops/run.rs`](./ops/run.rs). `flows_run` blocks until the run
settles; `flows_run_detached` validates synchronously, then spawns the run and
returns `{ run_id, status: "running", detached: true }` at once. The detached
form exists because the harness caps one tool call at 120 seconds and a flow
with a research agent node easily runs longer. The UI "Run" button and the
`run_flow` agent tool use the detached path; the copilot polls `get_flow_run`.
-Both share one body, `run_flow_body` in `ops/execution.rs`:
+Both share one body, `run_flow_body` in [`ops/execution.rs`](./ops/execution.rs):
```text
prepare_flow_run validate declared inputs, compile-check, mint thread_id
@@ -163,14 +163,14 @@ before any run row exists.
A run that reaches a gated node without trust parks as `pending_approval`. Its
state lives in a durable SQLite checkpoint (`checkpoints.db`), so it survives a
-restart. `flows_resume` (in `ops/resume.rs`) continues it, but only after
+restart. `flows_resume` (in [`ops/resume.rs`](./ops/resume.rs)) continues it, but only after
checking that the supplied `approvals` name at least one of the row's actually
pending node ids. The engine treats any resume call as approval, so this guard
is the host's enforcement. `flows_approval_manifest` computes, ahead of time,
every trust key a fully pre-authorized run would need, so the save-and-enable
card can ask once instead of parking node by node.
-`flows_cancel_run` (in `ops/run_management.rs`) signals an in-flight run
+`flows_cancel_run` (in [`ops/run_management.rs`](./ops/run_management.rs)) signals an in-flight run
through `run_registry::cancel` and lets that run's own cancel arm write the
terminal row. For a parked or orphaned run it writes `cancelled` itself and
drops the checkpoint. Two sweeps clean up after crashes:
@@ -179,11 +179,11 @@ process, and `sweep_expired_parked_runs` expires old parked runs.
### After a run
-Three bus subscribers, all constructed in `core/runtime/subscribers.rs`, react
-to run events. `FlowRunDigestSubscriber` (`bus/run_digest.rs`) writes a short
+Three bus subscribers, all constructed in [`core/runtime/subscribers.rs`](../core/runtime/subscribers.rs), react
+to run events. `FlowRunDigestSubscriber` ([`bus/run_digest.rs`](./bus/run_digest.rs)) writes a short
digest of each successful run into memory, tagged `flow:<id>` and
`flow_run_digest`, keeping the newest 50 per flow. `DedupCommitSubscriber`
-(`bus/dedup_commit.rs`) settles the `dedup` node's exactly-once contract: on
+([`bus/dedup_commit.rs`](./bus/dedup_commit.rs)) settles the `dedup` node's exactly-once contract: on
success it folds each node's tentative key set into its committed set; on
failure it drops the tentative keys so the items are retried. Commits are
serialized per flow. `FlowTriggerSubscriber` is the trigger bridge described
@@ -193,15 +193,15 @@ above.
Two built-in sub-agents live under `agents/`, each with an `agent.toml` and a
`prompt::build`, registered by path from the `BUILTINS` slice in
-`agent/registry/agents/loader.rs`:
+[`agent/registry/agents/loader.rs`](../agent/registry/agents/loader.rs):
- `workflow_builder` is the authoring copilot. `flows_build` (in
- `ops/builder.rs`) runs one turn of it from a structured request (create,
+ [`ops/builder.rs`](./ops/builder.rs)) runs one turn of it from a structured request (create,
revise, repair, build), streams progress onto a chat thread when asked
- (`ops/streaming.rs`), and returns the `workflow_proposal` it produced plus its
- final text. `ops/trail_off.rs` detects a turn that ended in a question or a
+ ([`ops/streaming.rs`](./ops/streaming.rs)), and returns the `workflow_proposal` it produced plus its
+ final text. [`ops/trail_off.rs`](./ops/trail_off.rs) detects a turn that ended in a question or a
gate failure instead of a proposal. The overall bound is 600 seconds.
-- `flow_discovery` is a read-only scout. `flows_discover` (in `ops/discovery.rs`)
+- `flow_discovery` is a read-only scout. `flows_discover` (in [`ops/discovery.rs`](./ops/discovery.rs))
runs it over the user's data; it ends by calling `suggest_workflows`, and the
suggestions are stored for the UI (`flows_list_suggestions`,
`flows_dismiss_suggestion`, `flows_mark_suggestion_built`).
@@ -217,7 +217,7 @@ makes a real Composio call, limited to Read-scope actions on a connected
toolkit. `resume_flow_run` is `Execute`-gated because resuming lets approved
nodes fire.
-The long authoring manual is a bundled skill (`skills/mod.rs`, needs both the
+The long authoring manual is a bundled skill ([`skills/mod.rs`](./skills/mod.rs), needs both the
`flows` and `skills` features): the portable `flow-authoring` pages from
`tinyflows-copilot`, registered with OpenHuman's native skill runtime. Binding
rules stay in the agent prompt; reference material the model looks up goes in
@@ -226,9 +226,9 @@ the skill.
### Flow memory
Memory has no namespaces, so a flow's memory is the set of items tagged
-`flow:<id>` (plus `flows`). The tag helpers in `memory_tools.rs` (`flow_tag`,
+`flow:<id>` (plus `flows`). The tag helpers in [`memory_tools.rs`](./memory_tools.rs) (`flow_tag`,
`flow_key_tag`, `flow_meta`, `flow_filter`, `cross_flow_filter`,
-`remember_keyed`, `forget_matching`, `FLOWS_TAG`) are re-exported from `mod.rs`
+`remember_keyed`, `forget_matching`, `FLOWS_TAG`) are re-exported from [`mod.rs`](./mod.rs)
so the digest subscriber, `flows_delete`, the `memory` node adapter
(`tinyflows::memory_adapter::OpenHumanMemory`) and the agent tools all tag the
same way.
@@ -240,18 +240,18 @@ Top level:
| Path | What it does |
| --- | --- |
| `mod.rs` | Module declarations and re-exports: model types from `tinyflows_catalog`, node contracts, store helpers for the seam, flow-memory helpers. |
-| `ops.rs`, `ops/` | Business operations returning `Outcome<T>`. See the table below. |
-| `schemas.rs`, `schemas/`, `schemas_handlers.rs` | Controller schemas (split into `builder_schemas.rs`, `definition_schemas.rs`, `draft_schemas.rs`, `run_schemas.rs`) and thin handlers that load config, read params and call `ops::flows_*`. |
-| `store.rs` | Binds `tinyflows_sqlite::flows` to `<workspace_dir>/flows`. Every function only substitutes the directory; anything else in a body is host policy leaking into persistence. |
+| [`ops.rs`](./ops.rs), `ops/` | Business operations returning `Outcome<T>`. See the table below. |
+| [`schemas.rs`](./schemas.rs), `schemas/`, [`schemas_handlers.rs`](./schemas_handlers.rs) | Controller schemas (split into `builder_schemas.rs`, `definition_schemas.rs`, `draft_schemas.rs`, `run_schemas.rs`) and thin handlers that load config, read params and call `ops::flows_*`. |
+| [`store.rs`](./store.rs) | Binds `tinyflows_sqlite::flows` to `<workspace_dir>/flows`. Every function only substitutes the directory; anything else in a body is host policy leaking into persistence. |
| `draft_store.rs` | Same binding for `tinyflows_sqlite::drafts`. |
-| `bus.rs`, `bus/` | The three subscribers: `trigger.rs`, `run_digest.rs`, `dedup_commit.rs`. |
-| `tools.rs` | `ProposeWorkflowTool` (`propose_workflow`) and `RunFlowTool` (`run_flow`). |
-| `builder_tools.rs`, `builder_tools/` | The 22 `workflow_builder` tools, split by role: `draft_revise.rs`, `draft_edit.rs`, `draft_validate.rs`, `flow_reads.rs`, `run_control.rs`, `persistence.rs`, `connection_reads.rs`, `catalog_search.rs`, `tool_contract.rs`, `kind_reads.rs`, `dry_run.rs`. |
-| `discovery_tools.rs` | `SuggestWorkflowsTool` (`suggest_workflows`). |
+| [`bus.rs`](./bus.rs), `bus/` | The three subscribers: `trigger.rs`, `run_digest.rs`, `dedup_commit.rs`. |
+| [`tools.rs`](./tools.rs) | `ProposeWorkflowTool` (`propose_workflow`) and `RunFlowTool` (`run_flow`). |
+| [`builder_tools.rs`](./builder_tools.rs), `builder_tools/` | The 22 `workflow_builder` tools, split by role: `draft_revise.rs`, `draft_edit.rs`, `draft_validate.rs`, `flow_reads.rs`, `run_control.rs`, `persistence.rs`, `connection_reads.rs`, `catalog_search.rs`, `tool_contract.rs`, `kind_reads.rs`, `dry_run.rs`. |
+| [`discovery_tools.rs`](./discovery_tools.rs) | `SuggestWorkflowsTool` (`suggest_workflows`). |
| `memory_tools.rs` | `FlowMemoryRecallTool`, `FlowMemoryRememberTool`, and the flow-memory tag helpers. |
| `agents/` | `workflow_builder/` and `flow_discovery/` built-in agent definitions and prompt builders. |
-| `catalogue.rs` | `flow_entries` lists saved flows as `Workflow` entries with `WorkflowScope::Flow`, so the skill catalogue and `skill_search` show one list. |
-| `node_contracts.rs` | Host overlay on `tinyflows::catalog`'s node-kind contracts (which `tool_call` slugs resolve to Composio or native `oh:` tools, which trigger kinds dispatch here). |
+| [`catalogue.rs`](./catalogue.rs) | `flow_entries` lists saved flows as `Workflow` entries with `WorkflowScope::Flow`, so the skill catalogue and `skill_search` show one list. |
+| [`node_contracts.rs`](./node_contracts.rs) | Host overlay on `tinyflows::catalog`'s node-kind contracts (which `tool_call` slugs resolve to Composio or native `oh:` tools, which trigger kinds dispatch here). |
| `skills/` | Registers the bundled `flow-authoring` skill. |
| `tinyflows/` | The capability seam. See [tinyflows/README.md](tinyflows/README.md). |
@@ -271,17 +271,17 @@ Top level:
- `ops::flows_run` / `ops::flows_run_detached` (`ops/run.rs`): start a run,
blocking or fire-and-forget.
- `ops::flows_create` / `ops::flows_update` (`ops/definitions.rs`,
- `ops/updates.rs`): the save paths that enforce born-disabled and forced
+ [`ops/updates.rs`](./ops/updates.rs)): the save paths that enforce born-disabled and forced
approval.
- `ops::validate_and_migrate_graph` (`ops/validation.rs`): the one
structural-validation door.
- `run_builder_gates` (`ops/builder_gates.rs`): the agent-authored hard-gate
stack.
-- `RunRowFinalizer` (`ops/run_rows.rs`): drop guard that keeps a run row from
+- `RunRowFinalizer` ([`ops/run_rows.rs`](./ops/run_rows.rs)): drop guard that keeps a run row from
being wedged at `running`.
- `tinyflows::build_capabilities` / `tinyflows::open_flow_checkpointer`
- (`tinyflows/caps/`): wire the engine to OpenHuman for one run.
-- `bus::FlowTriggerSubscriber` (`bus/trigger.rs`): the trigger-to-run bridge.
+ ([`tinyflows/caps/`](./tinyflows/caps/)): wire the engine to OpenHuman for one run.
+- `bus::FlowTriggerSubscriber` ([`bus/trigger.rs`](./bus/trigger.rs)): the trigger-to-run bridge.
- Model types, re-exported from `tinyflows_catalog` and not owned here: `Flow`,
`FlowConnection`, `FlowDraft`, `FlowImport`, `FlowRevision`, `FlowRun`,
`FlowRunStep`, `FlowRunTrigger`, `FlowSuggestion`, `FlowValidation`,
@@ -292,7 +292,7 @@ Top level:
All methods live in the `flows` namespace (`openhuman.flows_<name>` over
JSON-RPC), registered through `all_flows_registered_controllers()` in
-`core/all.rs`.
+[`core/all.rs`](../core/all.rs).
| Group | Methods |
| --- | --- |
@@ -302,7 +302,7 @@ JSON-RPC), registered through `all_flows_registered_controllers()` in
| Discovery | `discover`, `list_suggestions`, `dismiss_suggestion`, `mark_suggestion_built` |
| Drafts | `draft_create`, `draft_get`, `draft_update`, `draft_list`, `draft_delete`, `draft_promote` |
-Agent tools: `core`'s `tools/ops.rs` adds 27 flows tools to the tool list
+Agent tools: `core`'s [`tools/ops.rs`](../tools/ops.rs) adds 27 flows tools to the tool list
(`propose_workflow`, `run_flow`, the 22 builder tools, `suggest_workflows`,
`flow_memory_recall`, `flow_memory_remember`), each behind the `flows` feature.
@@ -316,7 +316,7 @@ Agent tools: `core`'s `tools/ops.rs` adds 27 flows tools to the tool list
Fix engine and storage behavior there, not here.
- `cron/` owns scheduling. This domain only arms and removes `JobType::Flow`
jobs; the scheduler publishes `DomainEvent::FlowScheduleTick`.
-- `integrations/composio/` owns the Composio catalog, connections and trigger
+- [`integrations/composio/`](../integrations/composio/) owns the Composio catalog, connections and trigger
ingestion. Flows reads them for gates, pickers and `tool_call` execution.
- `memory/` owns storage. Flows only tags items.
- The approval gate (`approval::gate`) decides when a node parks. The approval
@@ -332,7 +332,7 @@ Agent tools: `core`'s `tools/ops.rs` adds 27 flows tools to the tool list
reference is a registration site (`core::all`, the subscribers in
`core::runtime::subscribers`, the boot sweeps in `core::runtime::services`,
the tool list in `tools::ops`, the `BUILTINS` entries, the catalogue extension
- in `agent/session_host/builder/factory.rs`), and a registration site wants
+ in [`agent/session_host/builder/factory.rs`](../agent/session_host/builder/factory.rs)), and a registration site wants
absence when the feature is off. A stub would make `flows.*` a known method
that fails at runtime. If an always-compiled domain ever gains a real `use
crate::flows::...`, convert to the facade-plus-stub shape used by `voice/`.
@@ -347,8 +347,8 @@ Agent tools: `core`'s `tools/ops.rs` adds 27 flows tools to the tool list
## Tests
-Tests sit beside their modules as `*_tests.rs` files (`ops_tests.rs`,
-`bus_tests.rs`, `schemas_tests.rs`, the builder tool and agent prompt tests,
+Tests sit beside their modules as `*_tests.rs` files ([`ops_tests.rs`](./ops_tests.rs),
+[`bus_tests.rs`](./bus_tests.rs), [`schemas_tests.rs`](./schemas_tests.rs), the builder tool and agent prompt tests,
and the seam's own suite under `tinyflows/`). `store.rs` has no test
attachment; the store's behavior is covered in `tinyflows-sqlite`.
@@ -361,5 +361,5 @@ Related docs: [gitbooks/features/workflows.md](../../../../gitbooks/features/wor
(user-facing feature), [gitbooks/developing/architecture/flows-on-tinyagents.md](../../../../gitbooks/developing/architecture/flows-on-tinyagents.md)
(run pipeline and security model; it still describes lowering onto
`tinyagents`, while the vendored crate now carries its own runtime under
-`vendor/tinyflows/crates/tinyflows/src/graph/`), and
+[`vendor/tinyflows/crates/tinyflows/src/graph/`](../../../../vendor/tinyflows/crates/tinyflows/src/graph/)), and
[../cron/README.md](../cron/README.md) (`JobType::Flow`).
diff --git a/crates/openhuman-core/src/flows/tinyflows/README.md b/crates/openhuman-core/src/flows/tinyflows/README.md
index d3e1e13277..1d4b48ef81 100644
--- a/crates/openhuman-core/src/flows/tinyflows/README.md
+++ b/crates/openhuman-core/src/flows/tinyflows/README.md
@@ -1,7 +1,7 @@
# tinyflows capability seam
Wires the vendored `tinyflows` workflow engine (validate → compile → run over
-its own in-crate state-graph runtime, `vendor/tinyflows/`) to real OpenHuman
+its own in-crate state-graph runtime, [`vendor/tinyflows/`](../../../../../vendor/tinyflows/)) to real OpenHuman
services. `tinyflows` knows nothing about OpenHuman. Every effect a flow node
can have (calling an LLM, running an agent, making an HTTP request, running
code, calling a tool, reading/writing state, resolving a sub-workflow,
@@ -13,7 +13,7 @@ security model); this README covers only the host seam.
## Layout
-- `mod.rs`: export-focused. Re-exports `caps::build_capabilities` and
+- [`mod.rs`](./mod.rs): export-focused. Re-exports `caps::build_capabilities` and
`caps::open_flow_checkpointer`, the two entry points `flows::ops*.rs`
calls to drive a run; re-exports `tinyflows_sqlite::checkpoint` as
`checkpoint_sqlite` under its historical path.
@@ -58,7 +58,7 @@ security model); this README covers only the host seam.
the assistant uses), `composio.rs` for everything else (Composio
actions; must stay the catch-all backend since Composio slugs carry no
prefix).
-- `memory_adapter.rs`: `OpenHumanMemory`, the `MemoryProvider` adapter for
+- [`memory_adapter.rs`](./memory_adapter.rs): `OpenHumanMemory`, the `MemoryProvider` adapter for
the `memory` node. Routes every operation through the same `tier.rs` gate
pair as the other acting adapters (`CommandClass::Read` for
`recall`/`search`/`flavour`/`people`, `CommandClass::Write` for
@@ -69,12 +69,12 @@ security model); this README covers only the host seam.
`recall` returns the engine's answer plus citations, `search` raw hits;
`flavour` and `people` are unsupported in v2 (unknown slug / empty
listing).
-- `observability.rs`: `tinyflows::observability::RunObserver` impls:
+- [`observability.rs`](./observability.rs): `tinyflows::observability::RunObserver` impls:
`FlowRunObserver`, which persists live
steps via `flows::upsert_flow_run_step` and publishes
`DomainEvent::FlowRunProgress` twice per non-trigger node so the frontend
can render a run live.
-- `langfuse_export.rs`: after a run settles, exports its durable
+- [`langfuse_export.rs`](./langfuse_export.rs): after a run settles, exports its durable
`GraphObservation` slice as one Langfuse trace via `tinyagents`'
`GraphLangfuseExporter`, tagged with the Langfuse Agent Graph view keys.
@@ -85,7 +85,7 @@ The contract is spelled out in
this module holds the outer gate. `tier.rs` consults the user's autonomy
tier for each acting node's `CommandClass` and forces an `ApprovalGate`
round-trip on `Prompt`, even when the saved flow's own `require_approval` is
-false. Composio `tool_call` nodes additionally pass `caps/ops.rs`'s
+false. Composio `tool_call` nodes additionally pass [`caps/ops.rs`](./caps/ops.rs)'s
deny-by-default curation check (`is_curated_flow_tool`), stricter than the
agent loop's because a flow author's slug is free-form and never round-trips
through live tool discovery; `tools/composio.rs` documents why the tier gate
@@ -101,9 +101,9 @@ new origin wrapper.
## Tests
-`tinyflows_tests.rs` (capability-seam smoke tests against the real engine;
+[`tinyflows_tests.rs`](./tinyflows_tests.rs) (capability-seam smoke tests against the real engine;
note the real `HttpRequestTool` blocks loopback, so HTTP coverage asserts the
SSRF/allowlist rejections rather than a mock round-trip),
-`memory_adapter_tests.rs` (the `memory` node adapter against an in-memory
+[`memory_adapter_tests.rs`](./memory_adapter_tests.rs) (the `memory` node adapter against an in-memory
reference engine), plus a `<module>_tests.rs` file beside most modules
above.
diff --git a/crates/openhuman-core/src/hooks/README.md b/crates/openhuman-core/src/hooks/README.md
index 018e32e751..546edd87fb 100644
--- a/crates/openhuman-core/src/hooks/README.md
+++ b/crates/openhuman-core/src/hooks/README.md
@@ -10,7 +10,7 @@ runs here unchanged, and the reverse holds too.
This folder is the OpenHuman host side only. The engine, the `hooks.json`
contract, config loading, matching and the process runner live upstream in
-`tinyagents_runtime::command_hooks` (`vendor/tinyagents`, crate
+`tinyagents_runtime::command_hooks` ([`vendor/tinyagents`](../../../../vendor/tinyagents/), crate
`tinyagents-runtime`). What stays here is the glue: one process-global engine
built with OpenHuman's product name, shell and model, a bridge that mounts it
on the harness's tool and turn seams, direct entry points for the moments that
@@ -18,15 +18,15 @@ have no seam, and the `hooks` RPC namespace.
"Hook" means two other things elsewhere in the codebase. The in-process Rust
traits an embedding host installs (`ToolHook` and `PostTurnHook` in
-`agent/hooks.rs`, plus `agent/stop_hooks.rs`) are the seams this module rides
-on. Inbound webhook ingestion (`skills/webhooks/`, RPC namespace `webhooks`)
+[`agent/hooks.rs`](../agent/hooks.rs), plus [`agent/stop_hooks.rs`](../agent/stop_hooks.rs)) are the seams this module rides
+on. Inbound webhook ingestion ([`skills/webhooks/`](../skills/webhooks/), RPC namespace `webhooks`)
is unrelated.
## How it works
### Boot
-`core/runtime/bootstrap.rs` calls `crate::hooks::init(&cfg)` during core boot.
+[`core/runtime/bootstrap.rs`](../core/runtime/bootstrap.rs) calls `crate::hooks::init(&cfg)` during core boot.
`ops::init` does the following, in order:
1. Calls `set_host_context` with the workspace roots (the configured
@@ -137,14 +137,14 @@ the conversation decides whether to start another turn.
### Moments without a tool seam
-`ops.rs` has one function per lifecycle moment that is not a tool call. Each
+[`ops.rs`](./ops.rs) has one function per lifecycle moment that is not a tool call. Each
checks `engine.has_hooks(event)` first and returns immediately when nothing is
registered, so call sites can invoke them unconditionally.
| Function | Event | Caller |
| --- | --- | --- |
-| `prompt_submitted` | `beforeSubmitPrompt` | `web_chat/ops/start_chat.rs`, before a prompt reaches the agent |
-| `subagent_starting` | `subagentStart` | `agent/subagent_host/ops/runner.rs`, before a sub-agent spawns |
+| `prompt_submitted` | `beforeSubmitPrompt` | [`web_chat/ops/start_chat.rs`](../web_chat/ops/start_chat.rs), before a prompt reaches the agent |
+| `subagent_starting` | `subagentStart` | [`agent/subagent_host/ops/runner.rs`](../agent/subagent_host/ops/runner.rs), before a sub-agent spawns |
| `session_started` | `sessionStart` | not called yet |
| `session_ended` | `sessionEnd` | not called yet |
| `pre_compact` | `preCompact` | not called yet |
@@ -162,7 +162,7 @@ both. `subagent_starting` returns `Err(reason)` when the child must not run.
Most hooks are `command`: spawn a program, write the event JSON to its stdin,
read a decision from its stdout. A `prompt` hook is a policy written in
English. The engine calls back into the host through `PromptEvaluator`, which
-`host.rs` implements with `prompt_eval::evaluate`. That function loads the
+[`host.rs`](./host.rs) implements with `prompt_eval::evaluate`. That function loads the
config with `load_config_with_timeout`, applies the hook's optional model
override to that copy's `default_model`, and makes a one-shot
`inference::ops::inference_prompt` call capped at 200 output tokens. The
@@ -173,12 +173,12 @@ hook costs a model call per event, so they belong on rare, high-stakes moments.
| Path | What it does |
| --- | --- |
-| `mod.rs` | Module declarations; re-exports `init`, `PromptVerdict` and the controller aggregators. |
+| [`mod.rs`](./mod.rs) | Module declarations; re-exports `init`, `PromptVerdict` and the controller aggregators. |
| `host.rs` | The process-global `HookEngine` (`engine()`), the `HookEnvironment` built from `PRODUCT_NAME`, the home dir, `agent::platform_shell::build_tokio_command` and the prompt evaluator, and `reload`. |
-| `bridge.rs` | `ConfiguredHookBridge`: the `ToolHook` and `PostTurnHook` impls, derived-event mapping and payload shaping, and the translation from `HookOutput` to `ToolHookDecision`. |
+| [`bridge.rs`](./bridge.rs) | `ConfiguredHookBridge`: the `ToolHook` and `PostTurnHook` impls, derived-event mapping and payload shaping, and the translation from `HookOutput` to `ToolHookDecision`. |
| `ops.rs` | `init` and the direct entry points for non-tool lifecycle moments. |
-| `prompt_eval.rs` | Model evaluation for `prompt`-kind hooks. |
-| `schemas.rs` | The `hooks` RPC namespace. |
+| [`prompt_eval.rs`](./prompt_eval.rs) | Model evaluation for `prompt`-kind hooks. |
+| [`schemas.rs`](./schemas.rs) | The `hooks` RPC namespace. |
## Key types and entry points
@@ -193,7 +193,7 @@ hook costs a model call per event, so they belong on rare, high-stakes moments.
## RPC surface
Namespace `hooks`, registered through `all_hooks_registered_controllers` in
-`core/all.rs`:
+[`core/all.rs`](../core/all.rs):
| Method | What it does |
| --- | --- |
@@ -213,12 +213,12 @@ even for observing events, since a detached dispatch would report nothing.
follow-up queueing belong to `tinyagents_runtime::command_hooks` in the
`tinyagents` repo. Fix or extend those there, then move the gitlink. See its
own `README.md` under
- `vendor/tinyagents/crates/tinyagents-runtime/src/command_hooks/`.
+ [`vendor/tinyagents/crates/tinyagents-runtime/src/command_hooks/`](../../../../vendor/tinyagents/crates/tinyagents-runtime/src/command_hooks/).
- The `ToolHook` / `PostTurnHook` seams and how the harness runs them belong
- to `agent/hooks.rs` and `agent/tinyagents/middleware/embedder_hooks.rs`.
+ to `agent/hooks.rs` and [`agent/tinyagents/middleware/embedder_hooks.rs`](../agent/tinyagents/middleware/embedder_hooks.rs).
- Approval and the autonomy policy belong to `security/`. A hook's `allow`
only lets a call continue to them.
-- Product-facing docs for hook authors live in `gitbooks/developing/hooks.md`.
+- Product-facing docs for hook authors live in [`gitbooks/developing/hooks.md`](../../../../gitbooks/developing/hooks.md).
## Gotchas
@@ -246,7 +246,7 @@ even for observing events, since a detached dispatch would report nothing.
## Tests
-`bridge_tests.rs` sits beside `bridge.rs` (derived events, payload shaping,
+[`bridge_tests.rs`](./bridge_tests.rs) sits beside `bridge.rs` (derived events, payload shaping,
decision translation). The engine, config, matcher and exec tests live with
the engine in `tinyagents-runtime`. Run the host tests with
`cargo test -p openhuman hooks::` or `pnpm debug rust hooks::`.
diff --git a/crates/openhuman-core/src/hosting/README.md b/crates/openhuman-core/src/hosting/README.md
index 08dc2eace4..d88ed9f1e6 100644
--- a/crates/openhuman-core/src/hosting/README.md
+++ b/crates/openhuman-core/src/hosting/README.md
@@ -8,11 +8,11 @@ database is provisioned and connected, and the order a launch runs in. This
module owns the OpenHuman side: where the credential comes from, which
workspace the agent deploys from, and whether the tools are offered at all.
-The whole domain is one file, `mod.rs`, around a single type, `Account`.
+The whole domain is one file, [`mod.rs`](./mod.rs), around a single type, `Account`.
## How it works
-At tool-registry build time, `tools::ops` (in `src/tools/ops.rs`) asks this
+At tool-registry build time, `tools::ops` (in [`src/tools/ops.rs`](../tools/ops.rs)) asks this
module for an account. If one resolves, the account's ten tools are appended
to the agent's tool list. If none resolves, nothing is registered.
@@ -58,7 +58,7 @@ plain strings, so a host (OpenCompany keeps one hosting key per company in that
company's secret store) can reach the tools without naming `tinyhosts` in its
own dependency graph.
-Configuration lives in `HostingConfig` (`src/config/schema/hosting.rs`):
+Configuration lives in `HostingConfig` ([`src/config/schema/hosting.rs`](../config/schema/hosting.rs)):
`enabled`, `provider` (default `vercel`), `api_key` (empty means "read the
provider's environment variable"), and `team` (empty means the personal
account). Its `Debug` impl redacts the key.
@@ -83,7 +83,7 @@ account). Its `Debug` impl redacts the key.
## Agent tools
-All ten are implemented in `vendor/tinyhosts/src/tools/`. Tools with an
+All ten are implemented in [`vendor/tinyhosts/src/tools/`](../../../../vendor/tinyhosts/src/tools/). Tools with an
external effect return `true` from `Tool::external_effect`, which the agent
harness reads to route the call through approval.
@@ -122,7 +122,7 @@ enforces it.
- Provider behavior (endpoints, deployment states, database provisioning,
launch ordering, the tool implementations and their argument validation)
- belongs to `tinyhosts` (`vendor/tinyhosts`, upstream
+ belongs to `tinyhosts` ([`vendor/tinyhosts`](../../../../vendor/tinyhosts/), upstream
`tinyhumansai/tinyhosts`). Nothing in this module knows the word
`readyState`, and nothing in `tinyhosts` knows what a workspace is.
- Approval routing belongs to the agent harness, via `external_effect`.
@@ -147,7 +147,7 @@ enforces it.
## Tests
-`hosting_tests.rs` covers the seam only: account resolution from config and
+[`hosting_tests.rs`](./hosting_tests.rs) covers the seam only: account resolution from config and
the tool set handed back. The tools themselves, workspace containment, and the
rollback guard are tested in `tinyhosts` against a mock of the provider API.
diff --git a/crates/openhuman-core/src/inference/README.md b/crates/openhuman-core/src/inference/README.md
index 3cb950743c..8e03979672 100644
--- a/crates/openhuman-core/src/inference/README.md
+++ b/crates/openhuman-core/src/inference/README.md
@@ -18,7 +18,7 @@ chat, flows, scheduling and channels all call into it.
Every caller starts with a role (`chat`, `reasoning`, `agentic`, `coding`, `vision`, `memory`,
`embeddings`, `learning`, and so on) or a model hint like `hint:reasoning`. The factory in
-`provider/factory.rs` resolves that in three steps.
+[`provider/factory.rs`](./provider/factory.rs) resolves that in three steps.
```text
caller (agent turn, memory summarizer, flows node, RPC prompt)
@@ -62,7 +62,7 @@ missing credentials produce actionable errors instead of a silent fallback.
Background roles (`vision`, `embeddings`, `memory`, `agentic`, `burst`) fall back to the primary
cloud provider when their own route is unset, because they run tier models that local runtimes and
-most BYOK slugs do not serve. `provider/fallback_diagnostics.rs` exists so that when this fallback
+most BYOK slugs do not serve. [`provider/fallback_diagnostics.rs`](./provider/fallback_diagnostics.rs) exists so that when this fallback
lands on a provider with no credentials, the error says it was a background role that fell back,
instead of naming a slug the user never configured.
@@ -70,7 +70,7 @@ Hints and retired tier slugs never reach the managed backend verbatim. `tiers.rs
role (`role_for_model_tier`) or to the concrete managed default (`resolve_model_for_hint`), while
raw catalog ids a user pins on an agent (for example `openrouter/deepseek/deepseek-v4-pro`) pass
through unchanged (`is_raw_passthrough_model`). The TinyAgents workload router that consumes this
-for agent turns is in `agent/tinyagents/routes.rs`.
+for agent turns is in [`agent/tinyagents/routes.rs`](../agent/tinyagents/routes.rs).
There are two families of entry points. `create_chat_model*` in `factory/chat_model.rs` is for
one-shot callers (summaries, sentiment, prompts). `create_turn_chat_model*` in
@@ -79,7 +79,7 @@ through the same gates and constructors.
### The managed backend model
-`provider/openhuman_backend_model.rs` is a host `ChatModel` for the OpenHuman backend. It cannot be
+[`provider/openhuman_backend_model.rs`](./provider/openhuman_backend_model.rs) is a host `ChatModel` for the OpenHuman backend. It cannot be
a plain `tinyinference` OpenAI preset for three reasons: the session bearer is resolved fresh per
call, the request carries a top-level `thread_id` so the backend can group logs and align cache
keys, and the response carries an `openhuman.{billing,usage}` envelope with the charged USD that
@@ -87,11 +87,11 @@ the generic parser drops. The model re-projects that envelope
(`openhuman_backend_model_usage.rs`) so usage meters see real costs. When the bearer's `exp` has
already passed, or the backend rejects it, it publishes `DomainEvent::SessionExpired`.
-`provider/openai_codex.rs` is related but is not a model. When ChatGPT/Codex OAuth tokens exist
+[`provider/openai_codex.rs`](./provider/openai_codex.rs) is related but is not a model. When ChatGPT/Codex OAuth tokens exist
for the `openai` slug, `resolve_openai_codex_routing` re-targets that slug at the Codex backend
with the account and originator headers. The OAuth flow itself (start, complete, import from the
-Codex CLI, status, disconnect) and its token store live in `security/credentials/openai_oauth/`;
-this domain only exposes the RPC wrappers in `ops.rs`.
+Codex CLI, status, disconnect) and its token store live in [`security/credentials/openai_oauth/`](../security/credentials/openai_oauth/);
+this domain only exposes the RPC wrappers in [`ops.rs`](./ops.rs).
### Local runtimes
@@ -118,18 +118,18 @@ model is missing.
`LocalAiService` is a process-lifetime singleton holding the last probe verdict.
`inference.update_local_settings` resets it so the next status poll re-probes. Local STT through
whisper.cpp is retired; speech-to-text goes through the engine configured in
-`voice_server.stt_engine` (see `config/migrations/retire_local_whisper_stt.rs`), and the speech
+`voice_server.stt_engine` (see [`config/migrations/retire_local_whisper_stt.rs`](../config/migrations/retire_local_whisper_stt.rs)), and the speech
bindings call `crate::voice::create_stt_provider` for it. Local TTS uses a Piper binary the user
installed (`PIPER_BIN` or `PATH`).
-`agent_chat_for` in `host_runtime/ops/agent_chat.rs` is the native agent-turn entry used by
+`agent_chat_for` in [`host_runtime/ops/agent_chat.rs`](./host_runtime/ops/agent_chat.rs) is the native agent-turn entry used by
`openhuman-rpc` and `openhuman-embed`. It runs the turn under the agent's own `CoreContext`,
resumes the thread's session with `ResumeMode::Session`, and is boxed on purpose so other crates
do not each instantiate its state machine.
### Context windows
-The context window drives pre-dispatch trimming and the compaction trigger, so `context_window.rs`
+The context window drives pre-dispatch trimming and the compaction trigger, so [`context_window.rs`](./context_window.rs)
resolves it per turn in this order:
```text
@@ -142,10 +142,10 @@ resolves it per turn in this order:
logged at warn once per model
```
-The discovery request comes from `provider/factory/discovery.rs` (`model_limits_request`), built
+The discovery request comes from [`provider/factory/discovery.rs`](./provider/factory/discovery.rs) (`model_limits_request`), built
from the same endpoint and credential resolution the chat factory uses. The resolved value is
remembered, so the synchronous `context_window_for_model` (usage meters, the context breakdown)
-reports the same number the turn used. `model_context.rs` also answers vision capability through
+reports the same number the turn used. [`model_context.rs`](./model_context.rs) also answers vision capability through
`model_supports_vision` and the user's `model_registry` `vision` flag.
### Failures
@@ -172,10 +172,10 @@ A failed provider call passes through several layers, each with one job:
```
Provider-text matching itself (including the budget-phrase matcher) is upstream in
-`tinyinference`. `auth_error_registry.rs` is the single record of rejected BYO keys: the
+`tinyinference`. [`auth_error_registry.rs`](./auth_error_registry.rs) is the single record of rejected BYO keys: the
notification center gets one event per failure episode, and the AI settings page reads the live
list through `inference.provider_auth_errors`. Entries clear when the user updates or removes the
-key in the credentials domain. `failure_copy/halt.rs` holds the summaries the loop guards record
+key in the credentials domain. [`failure_copy/halt.rs`](./failure_copy/halt.rs) holds the summaries the loop guards record
when they stop a turn for repeated tool failures.
### The OpenAI-compatible endpoint
@@ -191,21 +191,21 @@ picks the provider the same way a provider string does.
| Path | What it does |
| --- | --- |
-| `mod.rs` | Module declarations and re-exports. Also `local_runtime_config` (projects `config.local_ai` into TinyInference's input), `local_vision_mode`, `disabled_local_ai_status`, the `LocalModelConfig` impl for `Config`, and `INFERENCE_COMPILED_IN`. |
+| [`mod.rs`](./mod.rs) | Module declarations and re-exports. Also `local_runtime_config` (projects `config.local_ai` into TinyInference's input), `local_vision_mode`, `disabled_local_ai_status`, the `LocalModelConfig` impl for `Config`, and `INFERENCE_COMPILED_IN`. |
| `ops.rs` | `inference_*` business operations returning `Outcome<T>`: status, prompt, summarize, vision, sentiment, provider tests, model listing, settings updates, OpenAI OAuth wrappers, diagnostics. Demotes expected user-config failures to `warn!`. |
-| `schemas.rs`, `schemas/` | The `inference.*` controller registry. `catalog.rs` has the schemas; `prompt_handlers.rs`, `settings_handlers.rs`, `oauth_handlers.rs` and `claude_code_handlers.rs` hold the thin handlers. |
+| [`schemas.rs`](./schemas.rs), `schemas/` | The `inference.*` controller registry. `catalog.rs` has the schemas; `prompt_handlers.rs`, `settings_handlers.rs`, `oauth_handlers.rs` and `claude_code_handlers.rs` hold the thin handlers. |
| `context_window.rs` | Per-turn context-window resolution (override, provider, local profile, static guess). |
| `model_context.rs` | Static context-window table, the remembered window lookup, and vision capability checks. |
| `auth_error_registry.rs` | Process-lived registry of rejected BYO provider keys, with a once-per-episode latch. |
| `failure_copy/` | `table.rs` maps a failure class to the wire `error_type`, source, retry verdict and user copy. `halt.rs` has loop-guard halt summaries. |
| `provider/` | Model construction and provider policy. See [`provider/README.md`](provider/README.md). |
-| `provider/factory.rs`, `provider/factory/` | Provider-string grammar and model construction: `routing`, `tiers`, `primary_cloud`, `access_gates`, `credentials`, `managed_backend`, `local_runtime`, `cloud_slug`, `subprocess_providers`, `discovery`, `chat_model`, `turn_model`. |
+| `provider/factory.rs`, [`provider/factory/`](./provider/factory/) | Provider-string grammar and model construction: `routing`, `tiers`, `primary_cloud`, `access_gates`, `credentials`, `managed_backend`, `local_runtime`, `cloud_slug`, `subprocess_providers`, `discovery`, `chat_model`, `turn_model`. |
| `provider/openhuman_backend_model*.rs` | Managed backend `ChatModel`, its call path and its usage/billing projection. |
| `provider/openai_codex.rs` | Codex routing metadata for the `openai` slug when Codex OAuth is connected. |
-| `provider/error_code.rs`, `provider/error_classify.rs` | Managed `errorCode` extraction and Sentry ownership; OpenHuman policy over TinyInference's classifier. |
+| [`provider/error_code.rs`](./provider/error_code.rs), [`provider/error_classify.rs`](./provider/error_classify.rs) | Managed `errorCode` extraction and Sentry ownership; OpenHuman policy over TinyInference's classifier. |
| `provider/fallback_diagnostics.rs` | Explains background-role fallback when it hits a provider with no credentials. |
-| `provider/ops/` | `http_error/` (classification and `api_error`), `models/` (model catalog listing, local-runtime and OpenRouter entries), `provider_factory.rs` (`ProviderRuntimeOptions`, `list_providers`). |
-| `provider/types.rs` | Host DTOs kept at product and RPC boundaries: `ChatResponse`, `ProviderDelta`, `BilledUsage`, `AGENT_TURN_MAX_OUTPUT_TOKENS`. |
+| [`provider/ops/`](./provider/ops/) | `http_error/` (classification and `api_error`), `models/` (model catalog listing, local-runtime and OpenRouter entries), `provider_factory.rs` (`ProviderRuntimeOptions`, `list_providers`). |
+| [`provider/types.rs`](./provider/types.rs) | Host DTOs kept at product and RPC boundaries: `ChatResponse`, `ProviderDelta`, `BilledUsage`, `AGENT_TURN_MAX_OUTPUT_TOKENS`. |
| `host_runtime/` | Product policy, RPC and speech bindings over `tinyinference_local`. See [`host_runtime/README.md`](host_runtime/README.md). |
| `embedding_host/` | Embedding provider selection (managed, Voyage, OpenAI, Cohere, Ollama, custom, noop) and the `embeddings.*` RPC. See [`embedding_host/README.md`](embedding_host/README.md). |
| `tokenjuice/` | Host adapter for the TinyJuice tool-output compression module, the `juice_retrieve` recovery tool, and the `tokenjuice.*` RPC. See [`tokenjuice/README.md`](tokenjuice/README.md). |
@@ -214,23 +214,23 @@ picks the provider the same way a provider string does.
## Key types and entry points
- `create_chat_model`, `create_chat_model_with_model_id`, `create_chat_model_from_string` (in
- `provider/factory/chat_model.rs`) build a model for one-shot work from a role or an explicit
+ [`provider/factory/chat_model.rs`](./provider/factory/chat_model.rs)) build a model for one-shot work from a role or an explicit
provider string.
-- `create_turn_chat_model*` (`provider/factory/turn_model.rs`, crate-private) build the model for
+- `create_turn_chat_model*` ([`provider/factory/turn_model.rs`](./provider/factory/turn_model.rs), crate-private) build the model for
an agent turn.
-- `provider_for_role` (`provider/factory/routing.rs`) returns the configured provider string for a
- role. `resolve_model_for_hint` and `role_for_model_tier` (`provider/factory/tiers.rs`) handle
+- `provider_for_role` ([`provider/factory/routing.rs`](./provider/factory/routing.rs)) returns the configured provider string for a
+ role. `resolve_model_for_hint` and `role_for_model_tier` ([`provider/factory/tiers.rs`](./provider/factory/tiers.rs)) handle
`hint:*` markers.
- `probe_inference_readiness` (`provider/factory/chat_model.rs`) checks that a role can actually
run: it builds the model and, for the managed backend, makes one cheap completion.
- `BYOK_INCOMPLETE_SENTINEL` (`provider/factory.rs`) marks a BYOK route with missing pieces.
- `OpenHumanBackendModel` (`provider/openhuman_backend_model.rs`) is the managed backend model.
-- `host_runtime::global` (`host_runtime/core.rs`) returns the `LocalAiService` singleton.
+- `host_runtime::global` ([`host_runtime/core.rs`](./host_runtime/core.rs)) returns the `LocalAiService` singleton.
- `agent_chat_for` and `agent_chat_reply_for` (`host_runtime/ops/agent_chat.rs`) run an agent turn
natively. `INFERENCE_AGENT_CHAT` (`schemas.rs`) is the wire method name hosts reference.
- `context_window_for_model` (`model_context.rs`) and `resolve_context_window`
(`context_window.rs`) answer window sizes.
-- `api_error` (`provider/ops/http_error/dispatch.rs`) is the single entry for turning a failed
+- `api_error` ([`provider/ops/http_error/dispatch.rs`](./provider/ops/http_error/dispatch.rs)) is the single entry for turning a failed
provider response into a classified error.
- `auth_error_registry::{record, clear, snapshot}` track rejected BYO keys.
- `test_provider_override` (`provider/factory.rs`) injects a mock `ChatModel` process-wide. It
@@ -238,7 +238,7 @@ picks the provider the same way a provider string does.
## RPC / CLI surface
-All controllers are pushed into the registry in `core/all.rs` under `DomainGroup::Inference`.
+All controllers are pushed into the registry in [`core/all.rs`](../core/all.rs) under `DomainGroup::Inference`.
`inference.*` from `schemas.rs`:
@@ -251,18 +251,18 @@ All controllers are pushed into the registry in `core/all.rs` under `DomainGroup
- Claude Code: `claude_code_status`, `claude_code_auth_status`, `claude_code_settings`,
`claude_code_set_full_access`.
-`inference.*` from `host_runtime/schemas.rs`: `agent_chat`, `agent_chat_simple`, `transcribe`,
+`inference.*` from [`host_runtime/schemas.rs`](./host_runtime/schemas.rs): `agent_chat`, `agent_chat_simple`, `transcribe`,
`transcribe_bytes`, `tts`, `test_connection`.
-`embeddings.*` from `embedding_host/schemas.rs`: `get_settings`, `update_settings`, `set_api_key`,
+`embeddings.*` from [`embedding_host/schemas.rs`](./embedding_host/schemas.rs): `get_settings`, `update_settings`, `set_api_key`,
`clear_api_key`, `embed`, `test_connection`.
-`tokenjuice.*` from `tokenjuice/schemas.rs`: `detect`, `compress`, `cache_stats`, `retrieve`,
+`tokenjuice.*` from [`tokenjuice/schemas.rs`](./tokenjuice/schemas.rs): `detect`, `compress`, `cache_stats`, `retrieve`,
`settings_get`, `settings_update`, `savings_stats`, `savings_reset`.
Legacy names such as `openhuman.local_ai_*`, `openhuman.update_local_ai_settings` and
`openhuman.providers_list_models` are rewritten to the canonical methods by
-`core/legacy_aliases.rs` (and `app/src/services/rpcMethods.ts` on the frontend). The download,
+[`core/legacy_aliases.rs`](../core/legacy_aliases.rs) (and [`app/src/services/rpcMethods.ts`](../../../../app/src/services/rpcMethods.ts) on the frontend). The download,
asset-status, Piper-installer, preset and device-profile controllers no longer exist.
Outside JSON-RPC, `http::router()` serves `/v1/chat/completions` and `/v1/models`.
@@ -270,18 +270,18 @@ Outside JSON-RPC, `http::router()` serves `/v1/chat/completions` and `/v1/models
## Events and persistence
This domain publishes but does not subscribe; there is no `bus.rs`. `SessionExpired` comes from
-`provider/ops/http_error/auth_failure.rs` and `provider/openhuman_backend_model.rs`.
+[`provider/ops/http_error/auth_failure.rs`](./provider/ops/http_error/auth_failure.rs) and `provider/openhuman_backend_model.rs`.
`ProviderApiKeyRejected` comes from `auth_failure.rs`, gated by `auth_error_registry`.
There is no `store.rs`. Routing, provider and local settings persist through `config` (`config/ops/
model.rs` and friends). Provider keys live in the encrypted auth-profile store under
-`provider:<slug>` (`provider/factory/credentials.rs` also tries the legacy bare `<slug>`). The
-built-in BYOK presets behind Connections, API keys, LLM are in `config/schema/cloud_providers.rs`.
+`provider:<slug>` ([`provider/factory/credentials.rs`](./provider/factory/credentials.rs) also tries the legacy bare `<slug>`). The
+built-in BYOK presets behind Connections, API keys, LLM are in [`config/schema/cloud_providers.rs`](../config/schema/cloud_providers.rs).
OpenHuman stores no model artifacts.
## Boundaries
-- `tinyinference` (vendored at `vendor/tinyagents/vendor/tinyinference`) owns provider wire
+- `tinyinference` (vendored at [`vendor/tinyagents/vendor/tinyinference`](../../../../vendor/tinyagents/vendor/tinyinference/)) owns provider wire
clients, model capability hints, temperature rules, provider-neutral error classification,
endpoint probing for local runtimes, effective model-id resolution, and embedding providers.
Fix provider-transport bugs there.
@@ -316,8 +316,8 @@ OpenHuman stores no model artifacts.
## Tests
-Tests sit beside their modules as `<module>_tests.rs` (for example `ops_tests.rs`,
-`context_window_tests.rs`, `provider/factory_tests.rs`). Tests that touch the runtime singleton or
+Tests sit beside their modules as `<module>_tests.rs` (for example [`ops_tests.rs`](./ops_tests.rs),
+[`context_window_tests.rs`](./context_window_tests.rs), [`provider/factory_tests.rs`](./provider/factory_tests.rs)). Tests that touch the runtime singleton or
shared config take `inference_test_guard()` / `inference_test_guard_async()` from
-`host_runtime/mod.rs`. Run them with `cargo test -p openhuman inference::` or
-`pnpm debug rust inference`. JSON-RPC behavior is covered in `tests/json_rpc_e2e.rs`.
+[`host_runtime/mod.rs`](./host_runtime/mod.rs). Run them with `cargo test -p openhuman inference::` or
+`pnpm debug rust inference`. JSON-RPC behavior is covered in [`tests/json_rpc_e2e.rs`](../../../../tests/json_rpc_e2e.rs).
diff --git a/crates/openhuman-core/src/inference/embedding_host/README.md b/crates/openhuman-core/src/inference/embedding_host/README.md
index 57c8d3a24d..6a25107d95 100644
--- a/crates/openhuman-core/src/inference/embedding_host/README.md
+++ b/crates/openhuman-core/src/inference/embedding_host/README.md
@@ -9,7 +9,7 @@ applied to embeddings.
## Providers
-Declared in `mod.rs` and resolved by `factory.rs`:
+Declared in [`mod.rs`](./mod.rs) and resolved by [`factory.rs`](./factory.rs):
- **Managed** (default): routed through the OpenHuman backend's
`POST /openai/v1/embeddings` (Voyage-backed). Works on a fresh install with
@@ -27,11 +27,11 @@ Declared in `mod.rs` and resolved by `factory.rs`:
| File | Role |
| --- | --- |
| `mod.rs` | Module docs and re-exports. Declares the provider list above. |
-| `provider_trait.rs` | Re-exports `EmbeddingProvider` and `format_embedding_signature` from `tinymemory_api::host`, and defines `TinyInferenceEmbeddingProvider`, the adapter from a TinyInference `EmbeddingModel` to the memory host's trait. |
+| [`provider_trait.rs`](./provider_trait.rs) | Re-exports `EmbeddingProvider` and `format_embedding_signature` from `tinymemory_api::host`, and defines `TinyInferenceEmbeddingProvider`, the adapter from a TinyInference `EmbeddingModel` to the memory host's trait. |
| `factory.rs` | OpenHuman's binding onto TinyInference's embedding factory: `create_embedding_provider_with_credentials`, `create_embedding_provider_with_config`, and `default_embedding_provider_with_config` (falls back to a `Noop` model if the configured provider fails to build). |
-| `cloud_adapter.rs` | `OpenHumanCloudEmbeddingModel`: the managed-provider transport, with OpenHuman's own bearer-token and egress-guard wiring around the crate-owned `CloudEmbeddingModel`. |
-| `rpc.rs` + `rpc/` (`api_keys.rs`, `embed.rs`, `settings.rs`) | The `embeddings` RPC handlers: get/update settings, set/clear API key, embed text, test a connection. |
-| `schemas.rs` | Controller schemas and thin handlers for the `embeddings` RPC namespace, registered as `all_embeddings_controller_schemas` / `all_embeddings_registered_controllers`. |
+| [`cloud_adapter.rs`](./cloud_adapter.rs) | `OpenHumanCloudEmbeddingModel`: the managed-provider transport, with OpenHuman's own bearer-token and egress-guard wiring around the crate-owned `CloudEmbeddingModel`. |
+| [`rpc.rs`](./rpc.rs) + `rpc/` (`api_keys.rs`, `embed.rs`, `settings.rs`) | The `embeddings` RPC handlers: get/update settings, set/clear API key, embed text, test a connection. |
+| [`schemas.rs`](./schemas.rs) | Controller schemas and thin handlers for the `embeddings` RPC namespace, registered as `all_embeddings_controller_schemas` / `all_embeddings_registered_controllers`. |
## Why the trait lives here, not in the engine
diff --git a/crates/openhuman-core/src/inference/host_runtime/README.md b/crates/openhuman-core/src/inference/host_runtime/README.md
index a5791ebd1b..3ce85bfcde 100644
--- a/crates/openhuman-core/src/inference/host_runtime/README.md
+++ b/crates/openhuman-core/src/inference/host_runtime/README.md
@@ -9,11 +9,11 @@ installs and runs that runtime and pulls its models; neither crate downloads,
installs, or spawns anything. This directory contains only OpenHuman policy
and integration seams:
-- `core.rs`: process-wide service ownership.
-- `ops.rs` and `ops/`: RPC operations, prompt access checks, agent dispatch,
+- [`core.rs`](./core.rs): process-wide service ownership.
+- [`ops.rs`](./ops.rs) and `ops/`: RPC operations, prompt access checks, agent dispatch,
scheduler-gate acquisition, and temporary-file handling.
-- `schemas.rs`: OpenHuman controller registration and wire compatibility.
-- `service/speech.rs`: OpenHuman STT credential routing and Piper output.
+- [`schemas.rs`](./schemas.rs): OpenHuman controller registration and wire compatibility.
+- [`service/speech.rs`](./service/speech.rs): OpenHuman STT credential routing and Piper output.
- `service/transcription.rs`: channel-facing transcription adapter shape.
Code here must call TinyInference directly. Do not copy local-runtime behavior
diff --git a/crates/openhuman-core/src/inference/provider/README.md b/crates/openhuman-core/src/inference/provider/README.md
index 43d53f0870..713fca77af 100644
--- a/crates/openhuman-core/src/inference/provider/README.md
+++ b/crates/openhuman-core/src/inference/provider/README.md
@@ -6,11 +6,11 @@ supports. This is the chat-model half of OpenHuman's pluggable-engine story
(see [gitbooks/developing/engines.md](../../../../../gitbooks/developing/engines.md)):
the model a turn runs on is chosen by config, not by code change. Was
previously `providers/` (pre-consolidation single-crate layout); see
-`../README.md` for how this fits into the wider `inference` domain.
+[`../README.md`](../README.md) for how this fits into the wider `inference` domain.
## Public surface
-- **Factory** (`factory.rs` + `factory/`: `routing.rs`, `tiers.rs`, `turn_model.rs`, `subprocess_providers.rs`, `access_gates.rs`, `chat_model.rs`, `cloud_slug.rs`, `credentials.rs`, `local_runtime.rs`, `managed_backend.rs`, `primary_cloud.rs`), `create_chat_model`,
+- **Factory** ([`factory.rs`](./factory.rs) + `factory/`: `routing.rs`, `tiers.rs`, `turn_model.rs`, `subprocess_providers.rs`, `access_gates.rs`, `chat_model.rs`, `cloud_slug.rs`, `credentials.rs`, `local_runtime.rs`, `managed_backend.rs`, `primary_cloud.rs`), `create_chat_model`,
`create_chat_model_from_string[_with_model_id]`,
`create_chat_model_with_model_id`, `provider_for_role`, `role_for_model_tier`,
`probe_inference_readiness`, `BYOK_INCOMPLETE_SENTINEL`. Parses the
@@ -23,9 +23,9 @@ previously `providers/` (pre-consolidation single-crate layout); see
[gitbooks/features/model-routing/local-and-byok-models.md](../../../../../gitbooks/features/model-routing/local-and-byok-models.md)
for the user-facing side of local and BYOK routing.
- **Models**: `OpenHumanBackendModel` + `PROVIDER_LABEL`
- (`openhuman_backend_model.rs`); OpenAI-compatible and Anthropic builders live
+ ([`openhuman_backend_model.rs`](./openhuman_backend_model.rs)); OpenAI-compatible and Anthropic builders live
in `tinyinference_llm::providers` and are called directly.
-- **DTOs** (`types.rs`): `ChatResponse`, `ProviderDelta`,
+- **DTOs** ([`types.rs`](./types.rs)): `ChatResponse`, `ProviderDelta`,
`ToolCall`, `UsageInfo`, `AGENT_TURN_MAX_OUTPUT_TOKENS`.
- **Error classifiers**: reusable classifiers live in
`tinyinference_llm::classification`; this directory retains OpenHuman managed-backend and telemetry policy.
@@ -37,13 +37,13 @@ previously `providers/` (pre-consolidation single-crate layout); see
| Managed OpenHuman backend | `openhuman_backend_model.rs` | `openhuman` / `cloud` (session JWT + billing metadata) |
| OpenAI-compatible (BYOK cloud slugs, local runtimes) | `tinyinference_llm::providers::openai` | `<slug>:<model>`, `ollama:<model>`, `lmstudio:<model>`, `mlx:<model>`, `omlx:<model>`, `local-openai:<model>` |
| Anthropic Messages API (prompt caching) | `tinyinference_llm::providers::anthropic` | `<slug>:<model>` whose endpoint is the first-party Messages API and native tool calling is on |
-| Codex OAuth / Responses API | `openai_codex.rs` host OAuth selection plus `tinyinference_llm::providers::openai::codex` metadata | the `openai` cloud slug once Codex OAuth tokens exist |
+| Codex OAuth / Responses API | [`openai_codex.rs`](./openai_codex.rs) host OAuth selection plus `tinyinference_llm::providers::openai::codex` metadata | the `openai` cloud slug once Codex OAuth tokens exist |
| Claude Agent SDK subprocess | `tinyagents_harness::providers::claude_agent_sdk` | `claude_agent_sdk` / `claude_agent_sdk:<model>` |
| Claude Code CLI subprocess | `tinyagents_harness::providers::claude_code` (see the [Claude Code provider guide](../../../../../gitbooks/developing/providers/claude-code.md)) | `claude-code:<model>` |
## Calls into
-- `tinyinference_llm::model::ChatModel` (`vendor/tinyagents/vendor/tinyinference`):
+- `tinyinference_llm::model::ChatModel` ([`vendor/tinyagents/vendor/tinyinference`](../../../../../vendor/tinyagents/vendor/tinyinference/)):
the trait every transport implements.
- `crate::config`: cloud-provider schema (`AuthStyle`, slug reservation),
`Config::claude_agent_sdk`, abstract tier model constants.
@@ -53,7 +53,7 @@ previously `providers/` (pre-consolidation single-crate layout); see
explicit run-thread plumbing consumed while building a managed model.
- `crate::security::live_policy` + `crate::security::egress`: Privacy-Mode
`LocalOnly` refusal and `EgressDescriptor` emission at the factory chokepoint
- (`factory/access_gates.rs`).
+ ([`factory/access_gates.rs`](./factory/access_gates.rs)).
- `crate::inference::host_runtime`: `profile::is_local_provider_string`, Ollama /
LM Studio base-url resolution for local provider strings.
- `crate::inference::auth_error_registry`: surfaces OpenHuman per-provider auth errors
@@ -62,7 +62,7 @@ previously `providers/` (pre-consolidation single-crate layout); see
`ops/http_error/auth_failure.rs::publish_backend_session_expired` and
`openhuman_backend_model.rs` publish `DomainEvent::SessionExpired` when the
managed backend reports an auth failure, so the credentials layer can
- clear/refresh the session; `ops/http_error/auth_failure.rs` also publishes
+ clear/refresh the session; [`ops/http_error/auth_failure.rs`](./ops/http_error/auth_failure.rs) also publishes
`DomainEvent::ProviderApiKeyRejected` the first time a BYO key is rejected.
- `crate::mcp::server::local` (via the vendored `claude_code` driver), the Claude Code
provider points the sandboxed `claude` subprocess at the in-process MCP
@@ -72,15 +72,15 @@ previously `providers/` (pre-consolidation single-crate layout); see
## Called by
`grep -rn 'inference::provider::' crates/openhuman-core/src` shows the main
-consumers: the agent harness (`agent/session_host/builder/factory.rs`,
+consumers: the agent harness ([`agent/session_host/builder/factory.rs`](../../agent/session_host/builder/factory.rs),
`agent/session_host/runtime*.rs`, `agent/subagent_host/ops/*`,
-`agent/tinyagents/host/model_resolver.rs`), `web_chat/session.rs` and
-`web_chat/web_errors/` (`classify.rs`, `budget.rs`, `retry.rs`, `timeout.rs`,
+[`agent/tinyagents/host/model_resolver.rs`](../../agent/tinyagents/host/model_resolver.rs)), [`web_chat/session.rs`](../../web_chat/session.rs) and
+[`web_chat/web_errors/`](../../web_chat/web_errors/) (`classify.rs`, `budget.rs`, `retry.rs`, `timeout.rs`,
`backend_error_code.rs`, `provider_detail.rs`, `response_predicates.rs`), `voice/factory/{helpers,mod}.rs`,
-`inference/ops.rs` / `inference/schemas/` /
-`inference/http/server.rs`,
-`flows/tinyflows/caps/{llm,prompt,agent}.rs`, `cron/scheduler/failure_classification.rs`
-(`is_budget_exhausted_message`), and `threads/ops/usage.rs` (`UsageInfo`).
+[`inference/ops.rs`](../ops.rs) / [`inference/schemas/`](../schemas/) /
+[`inference/http/server.rs`](../http/server.rs),
+`flows/tinyflows/caps/{llm,prompt,agent}.rs`, [`cron/scheduler/failure_classification.rs`](../../cron/scheduler/failure_classification.rs)
+(`is_budget_exhausted_message`), and [`threads/ops/usage.rs`](../../threads/ops/usage.rs) (`UsageInfo`).
## Sub-modules
@@ -89,20 +89,20 @@ consumers: the agent harness (`agent/session_host/builder/factory.rs`,
(`list_configured_models`), `provider_factory` (`ProviderRuntimeOptions`,
`list_providers`).
Preserves the original `pub use ops::*` contract split out of a single `ops.rs`.
-- Claude Code CLI provider: `tinyagents_harness::providers::claude_code` in `vendor/tinyagents`; see the [Claude Code provider guide](../../../../../gitbooks/developing/providers/claude-code.md).
+- Claude Code CLI provider: `tinyagents_harness::providers::claude_code` in [`vendor/tinyagents`](../../../../../vendor/tinyagents/); see the [Claude Code provider guide](../../../../../gitbooks/developing/providers/claude-code.md).
## Tests
-- `factory_tests.rs`, `factory_crate_native_tests.rs`,
- `factory_egress_fallback_tests.rs`, `factory_route_resolution_tests.rs`,
- `factory_test_provider_override_tests.rs`: provider-string parsing, access
+- [`factory_tests.rs`](./factory_tests.rs), [`factory_crate_native_tests.rs`](./factory_crate_native_tests.rs),
+ [`factory_egress_fallback_tests.rs`](./factory_egress_fallback_tests.rs), [`factory_route_resolution_tests.rs`](./factory_route_resolution_tests.rs),
+ [`factory_test_provider_override_tests.rs`](./factory_test_provider_override_tests.rs): provider-string parsing, access
gates, and model construction.
-- `ops_tests.rs`, `ops_tests_error_suppression_tests.rs`,
- `ops_tests_models_parsing_tests.rs`, `ops/http_error_tests.rs`, `ops/models_tests.rs`: error
+- [`ops_tests.rs`](./ops_tests.rs), [`ops_tests_error_suppression_tests.rs`](./ops_tests_error_suppression_tests.rs),
+ [`ops_tests_models_parsing_tests.rs`](./ops_tests_models_parsing_tests.rs), [`ops/http_error_tests.rs`](./ops/http_error_tests.rs), [`ops/models_tests.rs`](./ops/models_tests.rs): error
classification and model listing.
- Claude Code provider tests live with the provider in
- `vendor/tinyagents/crates/tinyagents-harness/src/providers/claude_code/`.
-- `openhuman_backend_model_tests.rs`: managed host transport; reusable provider
+ [`vendor/tinyagents/crates/tinyagents-harness/src/providers/claude_code/`](../../../../../vendor/tinyagents/crates/tinyagents-harness/src/providers/claude_code/).
+- [`openhuman_backend_model_tests.rs`](./openhuman_backend_model_tests.rs): managed host transport; reusable provider
builder and Codex tests live in TinyInference and TinyAgents.
Local runtime chat providers (Ollama, LM Studio, MLX, oMLX, local-openai)
diff --git a/crates/openhuman-core/src/inference/tokenjuice/README.md b/crates/openhuman-core/src/inference/tokenjuice/README.md
index c07b4fd227..9886d5df52 100644
--- a/crates/openhuman-core/src/inference/tokenjuice/README.md
+++ b/crates/openhuman-core/src/inference/tokenjuice/README.md
@@ -17,14 +17,14 @@ OpenHuman-owned files:
| Path | Role |
| --- | --- |
-| `mod.rs` | TinyBus calls (through `tinyjuice_bus::names::methods` constants), config installation, pass-through fallback, and savings wiring. |
-| `types.rs` | Re-export of the `tinyjuice-bus` contract (`tinyjuice_bus::types::{AgentTokenjuiceCompression, CompressOptions, CompressedOutput, CompressorKind, ContentHint, ContentKind}` and `tinyjuice_bus::wire::{CacheStats, CompactResponse, InstallRequest, RangeUnit, RetrieveRange}`) under the paths ~40 call sites in this crate already use. |
-| `schemas.rs` | JSON-RPC controller schemas and handlers. |
-| `config_patch.rs` | Partial update shape for the `[tokenjuice]` config block. |
-| `repl_tools.rs` | The three REPL tools (`juice_find`, `juice_extract`, `juice_summarize`) over a stored result. TinyJuice owns the ops and declarations (`tinyjuice::repl::tools`, cargo feature `tinytools`); the CCR store lives in the module, so each call fetches the original with `Retrieve` and hands the stock tool a one-entry store. Registered by `tools/ops.rs` only while `repl_handle_active(config)`. |
-| `tools.rs` | OpenHuman agent tool implementation for the retrieve tool (`RETRIEVE_TOOL_NAME = "juice_retrieve"`; `"tokenjuice_retrieve"` is a recognized recovery-tool alias, not the tool's registered name, see `RECOVERY_TOOL_NAMES`). |
+| [`mod.rs`](./mod.rs) | TinyBus calls (through `tinyjuice_bus::names::methods` constants), config installation, pass-through fallback, and savings wiring. |
+| [`types.rs`](./types.rs) | Re-export of the `tinyjuice-bus` contract (`tinyjuice_bus::types::{AgentTokenjuiceCompression, CompressOptions, CompressedOutput, CompressorKind, ContentHint, ContentKind}` and `tinyjuice_bus::wire::{CacheStats, CompactResponse, InstallRequest, RangeUnit, RetrieveRange}`) under the paths ~40 call sites in this crate already use. |
+| [`schemas.rs`](./schemas.rs) | JSON-RPC controller schemas and handlers. |
+| [`config_patch.rs`](./config_patch.rs) | Partial update shape for the `[tokenjuice]` config block. |
+| [`repl_tools.rs`](./repl_tools.rs) | The three REPL tools (`juice_find`, `juice_extract`, `juice_summarize`) over a stored result. TinyJuice owns the ops and declarations (`tinyjuice::repl::tools`, cargo feature `tinytools`); the CCR store lives in the module, so each call fetches the original with `Retrieve` and hands the stock tool a one-entry store. Registered by [`tools/ops.rs`](../../tools/ops.rs) only while `repl_handle_active(config)`. |
+| [`tools.rs`](./tools.rs) | OpenHuman agent tool implementation for the retrieve tool (`RETRIEVE_TOOL_NAME = "juice_retrieve"`; `"tokenjuice_retrieve"` is a recognized recovery-tool alias, not the tool's registered name, see `RECOVERY_TOOL_NAMES`). |
| `ml/` | Bridge from TinyJuice's optional ML callback into the shared `runtime::python_server` Kompress backend (ModernBERT token/sentence salience); opt-in via `config.tokenjuice.ml_compression_enabled` (default off), degrades gracefully when the flag is off or the runtime server is unavailable. |
-| `savings.rs` | OpenHuman model-pricing attribution and persisted dashboard stats. |
+| [`savings.rs`](./savings.rs) | OpenHuman model-pricing attribution and persisted dashboard stats. |
TinyJuice-owned engine pieces:
@@ -86,9 +86,9 @@ callback stay here.
`crate::modules::host::runtime()`; without the feature `proxy` errors and the
pass-through fallback applies.
- Controllers are registered from `crate::inference::tokenjuice::all_tokenjuice_registered_controllers()`,
- called by `core/all.rs`.
+ called by [`core/all.rs`](../../core/all.rs).
- `tools/ops.rs` registers `crate::inference::tokenjuice::TokenjuiceRetrieveTool::new()`
- in the agent tool catalog (it is not re-exported through `tools/mod.rs`) and
+ in the agent tool catalog (it is not re-exported through [`tools/mod.rs`](../../tools/mod.rs)) and
treats every `RECOVERY_TOOL_NAMES` entry as a recovery tool. The registered
tool name is `RETRIEVE_TOOL_NAME` (`"juice_retrieve"`);
`"tokenjuice_retrieve"` and `LEGACY_RETRIEVE_TOOL_NAME`
@@ -107,5 +107,5 @@ callback stay here.
their answers from being stored behind a second handle (their own
`max_result_size_chars` still caps them). The bus `Repl` member is not used
from here: it is not yet a `tinyjuice-bus` name constant.
-- Contract crate: `tinyjuice-bus` (`vendor/tinyjuice/crates/tinyjuice-bus`,
- path dependency in `crates/openhuman-core/Cargo.toml`).
+- Contract crate: `tinyjuice-bus` ([`vendor/tinyjuice/crates/tinyjuice-bus`](../../../../../vendor/tinyjuice/crates/tinyjuice-bus/),
+ path dependency in [`crates/openhuman-core/Cargo.toml`](../../../Cargo.toml)).
diff --git a/crates/openhuman-core/src/integrations/README.md b/crates/openhuman-core/src/integrations/README.md
index e47e381cde..79806fdcde 100644
--- a/crates/openhuman-core/src/integrations/README.md
+++ b/crates/openhuman-core/src/integrations/README.md
@@ -5,9 +5,9 @@ OpenHuman backend. It owns `IntegrationClient`, the one HTTP client every
backend-proxied integration uses for `/agent-integrations/*`, a small family
of managed agent tools built on it (Google Places, stock and market data,
Twilio calls), and three child sub-domains: Composio connectors, task sources,
-and managed file storage. Callers are the tool registry in `tools/ops.rs`, the
-controller registry in `core/all.rs`, and a few other domains (`web3`,
-`modules/connectors.rs`, `tools/schemas/apify.rs`) that borrow the client.
+and managed file storage. Callers are the tool registry in [`tools/ops.rs`](../tools/ops.rs), the
+controller registry in [`core/all.rs`](../core/all.rs), and a few other domains (`web3`,
+[`modules/connectors.rs`](../modules/connectors.rs), [`tools/schemas/apify.rs`](../tools/schemas/apify.rs)) that borrow the client.
Most integrations never see a provider API key. The backend holds the keys,
bills each call, applies rate limits and markup, and returns a
@@ -18,7 +18,7 @@ endpoint path and a JSON body.
### Building a client
-`build_client(&Config)` in `client/pricing.rs` decides whether integrations
+`build_client(&Config)` in [`client/pricing.rs`](./client/pricing.rs) decides whether integrations
are available at all. It returns `Option<Arc<IntegrationClient>>`:
```text
@@ -55,7 +55,7 @@ gate their own tool registration.
### One JSON request
`post`, `get`, `patch` and `delete` all go through `request_json` in
-`client/requests.rs`. The steps run in this order:
+[`client/requests.rs`](./client/requests.rs). The steps run in this order:
```text
request_json(method, path, body)
@@ -76,7 +76,7 @@ JSON traffic does not use a `reqwest::Client` built here. It rides the
process-wide `BackendTransport` port (`crate::backend::transport`), which
`openhuman-tinyhumans` installs. The `Integrations` profile sets TLS, the
timeout and the attribution headers, including the sanitized `x-sdk-name`
-product identity (see `crates/openhuman-tinyhumans/src/backend/headers.rs`).
+product identity (see [`crates/openhuman-tinyhumans/src/backend/headers.rs`](../../../openhuman-tinyhumans/src/backend/headers.rs)).
The client asks the transport not to unwrap the envelope so `parse_envelope`
can see `success: false` and report the backend's own `error` string.
@@ -86,7 +86,7 @@ method accepts both a bare payload and a `success: false` envelope.
### Errors
-`map_transport_error` in `client/errors.rs` turns a `BackendTransportError`
+`map_transport_error` in [`client/errors.rs`](./client/errors.rs) turns a `BackendTransportError`
into an `anyhow::Error` and routes it through
`core::observability::report_error_or_expected` so expected failures stay out
of Sentry:
@@ -110,7 +110,7 @@ sign-out.
### Budget gate
-`client/budget_gate.rs` refuses managed calls once the account's AI credits
+[`client/budget_gate.rs`](./client/budget_gate.rs) refuses managed calls once the account's AI credits
are exhausted, so a tool call does not spend a round trip the backend would
reject. `managed_budget_applies_to_path` limits it to `/agent-integrations/*`
minus `/agent-integrations/pricing`, and it only runs when the client was built
@@ -133,7 +133,7 @@ backoff.
### Binary downloads
-`get_bytes` in `client/download.rs` is the one request that does not use the
+`get_bytes` in [`client/download.rs`](./client/download.rs) is the one request that does not use the
backend transport. It only accepts
`/agent-integrations/file-storage/files/<id>/download` and refuses anything
else. That route answers with a 302 to a presigned S3 URL, and `get_bytes`
@@ -161,7 +161,7 @@ Composio key has no backend session to serve that route.
`tools/ops.rs` builds one client with `build_client` and registers this
folder's tools only if it gets one, each family behind its
`config.integrations.<provider>.is_active()` flag (`IntegrationToggle` in
-`config/schema/tools/integrations.rs`: `enabled`, plus a non-empty `api_key`
+[`config/schema/tools/integrations.rs`](../config/schema/tools/integrations.rs): `enabled`, plus a non-empty `api_key`
in BYO mode):
| Toggle | Tools | Backend paths |
@@ -174,7 +174,7 @@ File storage tools come from `file_storage::build_file_storage_tools`, called
separately from `tools/ops.rs`, because they need `action_dir` and a
`SecurityPolicy` rather than a toggle. Composio tools come from
`composio::all_composio_agent_tools`. All three families are re-exported into
-the global tool namespace by `tools/mod.rs`:
+the global tool namespace by [`tools/mod.rs`](../tools/mod.rs):
```rust
pub use crate::integrations::composio::tools::*;
@@ -190,20 +190,20 @@ a `DomainSet` without integrations hides them.
| Path | What it does |
| --- | --- |
-| `mod.rs` | Module declarations and re-exports (`IntegrationClient`, `build_client`, `pricing_for_config`, the shared types, `tinytools::ToolScope`). |
-| `client.rs` | Declares the `client/` submodules and re-exports the public pieces. See [client/README.md](client/README.md). |
-| `client/construct.rs` | The `IntegrationClient` struct, its constructors, URL sanitization, credential-endpoint checks and `auth_headers`. |
+| [`mod.rs`](./mod.rs) | Module declarations and re-exports (`IntegrationClient`, `build_client`, `pricing_for_config`, the shared types, `tinytools::ToolScope`). |
+| [`client.rs`](./client.rs) | Declares the `client/` submodules and re-exports the public pieces. See [client/README.md](client/README.md). |
+| [`client/construct.rs`](./client/construct.rs) | The `IntegrationClient` struct, its constructors, URL sanitization, credential-endpoint checks and `auth_headers`. |
| `client/requests.rs` | Route guard, egress disclosure and enforcement, budget check, and the JSON verbs plus `upload_multipart`. |
| `client/errors.rs` | Transport error mapping, 401 handling for both credential kinds, envelope parsing, bounded error-detail extraction. |
| `client/download.rs` | `get_bytes`: the two-client download with manual redirect following. |
| `client/pricing.rs` | Pricing cache, `pricing_for_config`, `build_client`. |
| `client/budget_gate.rs` | Credits-exhausted pre-check and the shared `/teams/me/usage` failure backoff. |
-| `types.rs` | `BackendResponse<T>` envelope and the pricing types. |
-| `tools.rs`, `tools/` | The managed tools: `google_places.rs`, `stock_prices.rs`, `twilio.rs`. `tools.rs` only declares and re-exports. |
+| [`types.rs`](./types.rs) | `BackendResponse<T>` envelope and the pricing types. |
+| [`tools.rs`](./tools.rs), `tools/` | The managed tools: `google_places.rs`, `stock_prices.rs`, `twilio.rs`. `tools.rs` only declares and re-exports. |
| [`composio/`](composio/README.md) | Composio connector sub-domain: toolkit catalogs, connections, triggers, direct-auth mode, the `tinyconnectors` module bridge, `composio_*` agent tools and RPC. |
| [`task_sources/`](task_sources/README.md) | Pulls work items from GitHub, Notion, Linear and ClickUp through the Composio providers, dedups and enriches them, and drops cards on the `task-sources` thread board. |
| [`file_storage/`](file_storage/README.md) | `storage_*` tools over the backend's S3-backed file storage (upload, download, list, link, visibility, delete). |
-| `test_support.rs`, `test_support_backend.rs` | In-process axum fake of the integration backend (`spawn_fake_integration_backend`, records every request). Not a module of this domain: `tools/ops_tests.rs` includes it with `#[path = "../integrations/test_support.rs"]`. |
+| [`test_support.rs`](./test_support.rs), [`test_support_backend.rs`](./test_support_backend.rs) | In-process axum fake of the integration backend (`spawn_fake_integration_backend`, records every request). Not a module of this domain: [`tools/ops_tests.rs`](../tools/ops_tests.rs) includes it with `#[path = "../integrations/test_support.rs"]`. |
## Key types and entry points
@@ -242,13 +242,13 @@ This folder registers no controllers of its own. Its children do, both under
## Boundaries
- Web search is not here. Provider implementations, tool schemas and role
- dispatch live in the `vendor/tinysearch` module (owned by the `tinysearch`
+ dispatch live in the [`vendor/tinysearch`](../../../../vendor/tinysearch/) module (owned by the `tinysearch`
repo); OpenHuman's host policy over it (routes, enabled providers, which
- tool surface is active) is in `crates/openhuman-core/src/search/`.
+ tool surface is active) is in [`crates/openhuman-core/src/search/`](../search/).
`integrations.parallel` and `integrations.tinyfish` remain in the config
schema for old files; `tools/ops.rs` registers no search tools from them.
- The backend transport, attribution headers, backend URL defaults and
- product identity belong to `crates/openhuman-tinyhumans` (`backend/`). The
+ product identity belong to [`crates/openhuman-tinyhumans`](../../../openhuman-tinyhumans/) (`backend/`). The
core only asks through `crate::backend`. Classification of what a backend
response means stays in the transport; this folder only maps the typed
errors it gets back.
@@ -258,9 +258,9 @@ This folder registers no controllers of its own. Its children do, both under
the credentials subscriber that handles `DomainEvent::SessionExpired`. This
folder only publishes the event.
- OAuth connector module behavior (account linking, action execution,
- webhooks) belongs to `vendor/tinyconnectors`; `composio/` holds the host
+ webhooks) belongs to [`vendor/tinyconnectors`](../../../../vendor/tinyconnectors/); `composio/` holds the host
side.
-- Media generation (`media/generation/`) and web3 (`web3/client.rs`) reuse
+- Media generation ([`media/generation/`](../media/generation/)) and web3 ([`web3/client.rs`](../web3/client.rs)) reuse
`IntegrationClient` but live in their own domains.
## Gotchas
@@ -284,10 +284,10 @@ This folder registers no controllers of its own. Its children do, both under
## Tests
-Tests sit beside their modules: `client_tests.rs` (which includes the
-`x-sdk-name` check across both transports), `client_api_key_tests.rs`,
-`client_error_propagation_tests.rs`, `client_session_expiry_tests.rs`,
-`client/budget_gate_tests.rs`, `client/pricing_tests.rs`, `mod_tests.rs` and
+Tests sit beside their modules: [`client_tests.rs`](./client_tests.rs) (which includes the
+`x-sdk-name` check across both transports), [`client_api_key_tests.rs`](./client_api_key_tests.rs),
+[`client_error_propagation_tests.rs`](./client_error_propagation_tests.rs), [`client_session_expiry_tests.rs`](./client_session_expiry_tests.rs),
+[`client/budget_gate_tests.rs`](./client/budget_gate_tests.rs), [`client/pricing_tests.rs`](./client/pricing_tests.rs), [`mod_tests.rs`](./mod_tests.rs) and
`tools/*_tests.rs`. Each child sub-domain carries its own.
```bash
diff --git a/crates/openhuman-core/src/integrations/client/README.md b/crates/openhuman-core/src/integrations/client/README.md
index 86ad8c4056..ab03a03aab 100644
--- a/crates/openhuman-core/src/integrations/client/README.md
+++ b/crates/openhuman-core/src/integrations/client/README.md
@@ -10,12 +10,12 @@ budget gating live in one place instead of being copied per domain.
| File | Role |
| --- | --- |
-| `construct.rs` | The `IntegrationClient` type and its constructors. Holds the backend URL, the app-session auth token, a separate `reqwest::Client` for downloads, and a lazily-fetched pricing cache. Also sanitizes a misconfigured `backend_url` that carries an inference-style path (issue #2075). |
-| `requests.rs` | Outbound request plumbing: route guards (refusing intentionally unexposed routes such as `webhooks`/`admin`), egress disclosure and enforcement, budget gating, and the JSON verb methods (`post`/`get`/`patch`/`delete`/`upload_multipart`). |
-| `download.rs` | Raw-bytes download support. The file-storage download route 302-redirects to a presigned S3 URL; `get_bytes` reads `Content-Type` and `Content-Disposition` off the response since the JSON envelope helpers do not carry them. |
-| `budget_gate.rs` | Refuses `/agent-integrations/*` calls once the account's AI credits are exhausted, so a tool call never burns a backend round trip the backend would reject anyway. Reads `GET /teams/me/usage` through `BackendOAuthClient` with a one-minute failure backoff to avoid flooding Sentry on a persistent outage. |
-| `pricing.rs` | The pricing cache on `IntegrationClient` plus `pricing_for_config`, which short-circuits to empty pricing in Composio direct mode (no backend session exists to serve `/agent-integrations/pricing` there). |
-| `errors.rs` | Backend error classification: extracting a readable detail from an error body, and handling the session-JWT 401 to session-expiry recovery path. |
+| [`construct.rs`](./construct.rs) | The `IntegrationClient` type and its constructors. Holds the backend URL, the app-session auth token, a separate `reqwest::Client` for downloads, and a lazily-fetched pricing cache. Also sanitizes a misconfigured `backend_url` that carries an inference-style path (issue #2075). |
+| [`requests.rs`](./requests.rs) | Outbound request plumbing: route guards (refusing intentionally unexposed routes such as `webhooks`/`admin`), egress disclosure and enforcement, budget gating, and the JSON verb methods (`post`/`get`/`patch`/`delete`/`upload_multipart`). |
+| [`download.rs`](./download.rs) | Raw-bytes download support. The file-storage download route 302-redirects to a presigned S3 URL; `get_bytes` reads `Content-Type` and `Content-Disposition` off the response since the JSON envelope helpers do not carry them. |
+| [`budget_gate.rs`](./budget_gate.rs) | Refuses `/agent-integrations/*` calls once the account's AI credits are exhausted, so a tool call never burns a backend round trip the backend would reject anyway. Reads `GET /teams/me/usage` through `BackendOAuthClient` with a one-minute failure backoff to avoid flooding Sentry on a persistent outage. |
+| [`pricing.rs`](./pricing.rs) | The pricing cache on `IntegrationClient` plus `pricing_for_config`, which short-circuits to empty pricing in Composio direct mode (no backend session exists to serve `/agent-integrations/pricing` there). |
+| [`errors.rs`](./errors.rs) | Backend error classification: extracting a readable detail from an error body, and handling the session-JWT 401 to session-expiry recovery path. |
## How auth works
diff --git a/crates/openhuman-core/src/integrations/composio/README.md b/crates/openhuman-core/src/integrations/composio/README.md
index 6faa28eb38..65da3ffe24 100644
--- a/crates/openhuman-core/src/integrations/composio/README.md
+++ b/crates/openhuman-core/src/integrations/composio/README.md
@@ -4,7 +4,7 @@ Backend-proxied (and optionally direct/BYO-key) access to Composio's 1000+ OAuth
A third path underlies most of the above: profile fetch and action execution
now go through the loaded `tinyconnectors` module (via
-`module_client.rs`) rather than an in-process engine (`tinymemory` v1.13.4
+[`module_client.rs`](./module_client.rs)) rather than an in-process engine (`tinymemory` v1.13.4
deleted the old in-process Composio pipeline outright: 72 files, ~18.3k
lines) because reaching a connected account needs a credential this crate
must not hold. `tinyconnectors-bus` is the wire contract for that module
@@ -32,8 +32,8 @@ individually (twelve chances to gate one differently, with a gates-off
build failing wherever the compiler happens to hit first), the gate lives
once, here, and every handler reads the same either way.
-`tinyconnectors-bus` (`vendor/tinyconnectors/crates/tinyconnectors-bus`,
-declared in `crates/openhuman-core/Cargo.toml` lines ~486-496) supplies the member names
+`tinyconnectors-bus` ([`vendor/tinyconnectors/crates/tinyconnectors-bus`](../../../../../vendor/tinyconnectors/crates/tinyconnectors-bus/),
+declared in [`crates/openhuman-core/Cargo.toml`](../../../Cargo.toml) lines ~486-496) supplies the member names
(`module_client::methods`) and payload types with no transport and no
behaviour; it compiles none of the connector itself. A gates-off build can
still name a member and match on the contract; it just cannot call one.
@@ -45,33 +45,33 @@ triggers) from a real transport failure.
| File | Role |
| --- | --- |
-| `crates/openhuman-core/src/integrations/composio/mod.rs` | Module doc + declarations; re-exports types, ops, schemas, agent tools, trigger-history, and provider/bus types. |
-| `crates/openhuman-core/src/integrations/composio/types.rs` | Serde domain types mirroring backend response envelopes (toolkits, connections, tools, execute, triggers, trigger events/history). Includes drift-tolerant `de_string_or_object` deserializers. |
-| `crates/openhuman-core/src/integrations/composio/ops/` | RPC-facing `composio_*` operations returning `Outcome<T>`, split by concern (see [Ops layout](#ops-layout)). |
-| `crates/openhuman-core/src/integrations/composio/schemas.rs` + `schemas/` (`registry.rs`, `definitions.rs`, `handlers_identity.rs`, `handlers_tools.rs`, `handlers_connections.rs`, `handlers_triggers.rs`, `params.rs`, `util.rs`) | Controller schemas + `handle_*` handlers; `all_controller_schemas` / `all_registered_controllers` (`schemas/registry.rs`). |
-| `crates/openhuman-core/src/integrations/composio/client.rs` + `client/` (`factory.rs`, `direct.rs`) | Route resolution only: `ComposioRoute` (Backend/Direct) and `resolve_composio_route` (`client/factory.rs`) keep the mode/credential decision and its user-facing errors on the host; the Composio HTTP client itself is the `tinyconnectors` module. `direct_list_connections` / `direct_list_tools` (`client/direct.rs`) are the two direct-mode v3 reads: they run the `tinyconnectors` library's `DirectRoute` in-process (it owns `limit=200`, `toolkit_versions=latest`, repeated `tags=` and the v3 reshaping) behind the host's invalid-key gate (`direct_auth`). |
+| [`crates/openhuman-core/src/integrations/composio/mod.rs`](./mod.rs) | Module doc + declarations; re-exports types, ops, schemas, agent tools, trigger-history, and provider/bus types. |
+| [`crates/openhuman-core/src/integrations/composio/types.rs`](./types.rs) | Serde domain types mirroring backend response envelopes (toolkits, connections, tools, execute, triggers, trigger events/history). Includes drift-tolerant `de_string_or_object` deserializers. |
+| [`crates/openhuman-core/src/integrations/composio/ops/`](./ops/) | RPC-facing `composio_*` operations returning `Outcome<T>`, split by concern (see [Ops layout](#ops-layout)). |
+| [`crates/openhuman-core/src/integrations/composio/schemas.rs`](./schemas.rs) + `schemas/` (`registry.rs`, `definitions.rs`, `handlers_identity.rs`, `handlers_tools.rs`, `handlers_connections.rs`, `handlers_triggers.rs`, `params.rs`, `util.rs`) | Controller schemas + `handle_*` handlers; `all_controller_schemas` / `all_registered_controllers` ([`schemas/registry.rs`](./schemas/registry.rs)). |
+| [`crates/openhuman-core/src/integrations/composio/client.rs`](./client.rs) + `client/` (`factory.rs`, `direct.rs`) | Route resolution only: `ComposioRoute` (Backend/Direct) and `resolve_composio_route` ([`client/factory.rs`](./client/factory.rs)) keep the mode/credential decision and its user-facing errors on the host; the Composio HTTP client itself is the `tinyconnectors` module. `direct_list_connections` / `direct_list_tools` ([`client/direct.rs`](./client/direct.rs)) are the two direct-mode v3 reads: they run the `tinyconnectors` library's `DirectRoute` in-process (it owns `limit=200`, `toolkit_versions=latest`, repeated `tags=` and the v3 reshaping) behind the host's invalid-key gate (`direct_auth`). |
| `crates/openhuman-core/src/integrations/composio/module_client.rs` | The `tinyconnectors` module bridge: the one `modules`-feature `#[cfg]` switch, `methods` re-exported from `tinyconnectors_bus`, and member-failure classification (`is_unsupported_by_route`, error-prefix peeling). |
-| `crates/openhuman-core/src/integrations/composio/tools.rs` + `tools/` (`authorize.rs`, `connect.rs`, `list_connections.rs`, `list_toolkits.rs`, `list_tools.rs`, `execute.rs`, `registry.rs`, `visibility.rs`) | Agent tools (`ComposioListToolkitsTool`, `ComposioListConnectionsTool`, `ComposioAuthorizeTool`, `ComposioConnectTool`, `ComposioListToolsTool`, `ComposioExecuteTool`) + `all_composio_agent_tools`; scope/visibility gating (`resolve_action_scope`, `evaluate_tool_visibility`). |
+| [`crates/openhuman-core/src/integrations/composio/tools.rs`](./tools.rs) + `tools/` (`authorize.rs`, `connect.rs`, `list_connections.rs`, `list_toolkits.rs`, `list_tools.rs`, `execute.rs`, `registry.rs`, `visibility.rs`) | Agent tools (`ComposioListToolkitsTool`, `ComposioListConnectionsTool`, `ComposioAuthorizeTool`, `ComposioConnectTool`, `ComposioListToolsTool`, `ComposioExecuteTool`) + `all_composio_agent_tools`; scope/visibility gating (`resolve_action_scope`, `evaluate_tool_visibility`). |
| `crates/openhuman-core/src/integrations/composio/client/{credential,network,direct}.rs` | The direct (BYO-key) reads. `credential.rs` is the key plus a validated base URL (HTTPS-or-loopback guard); `network.rs` resolves the host's `tool.composio` proxy and TLS policy for the module; `direct.rs` calls the module's stateless `ListConnectionsDirect` / `ListToolsDirect` members (the credential rides on the request, so the configured route is untouched and an unsaved key can be probed) under the host's invalid-key gate (`direct_auth`). Redirects are refused and failures are rendered with the messages users see by the module; the v3 paths and reshaping are `tinyconnectors::client::DirectRoute`. |
-| `crates/openhuman-core/src/integrations/composio/action_tool.rs` | `ComposioActionTool`: a `Tool` wrapping exactly one Composio action, constructed as a `ToolExposure::Deferred` tool per action of every connected toolkit (`tools/orchestrator_tools.rs`, and `agent/session_host/recorded_tools.rs` when a resumed thread rebuilds its recorded actions), reached by the orchestrator through `tool_search`. |
-| `crates/openhuman-core/src/integrations/composio/contract_gate.rs` | Late-bound action contract gate (#4853): on an action's first call this turn, surfaces the full live contract (via `catalog::fetch_live_toolkit_catalog`) as a recoverable tool error before executing, so the retry has the real schema in context. |
-| `crates/openhuman-core/src/integrations/composio/catalog.rs` + `catalog/` (`contract.rs`, `lookups.rs`, `probe.rs`) | Live Composio tool contracts (`fetch_live_toolkit_catalog`, `ToolContract`, in `catalog/contract.rs`): the unfiltered mode-aware `list_tools` schema (the module's `ListTools` member on the backend route, or direct v3 `direct_list_tools`) plus a bounded read-only response probe (`probe_tool_output_sample`, `catalog/probe.rs`) when a schema publishes no `output_parameters`. |
-| `crates/openhuman-core/src/integrations/composio/connected_integrations.rs` + `connected_integrations/` (`cache.rs`, `fetch.rs`, `fetch_uncached.rs`) | Cached active-connections lookups (`cached_active_integrations`, `fetch_connected_integrations*`) reconciled against `list_connections`. |
-| `crates/openhuman-core/src/integrations/composio/execute_dispatch.rs` | Host entry for running one action: applies egress enforcement/disclosure, then calls the module's `EXECUTE` member (prepare → retry → error mapping all run in `tinyconnectors`). Used by the `composio_execute` agent tool, `tools.composio_execute`, the memory host, LinkedIn enrichment and the output probe. |
-| `crates/openhuman-core/src/integrations/composio/googlecalendar_args.rs` | Host IANA time-zone lookup; the calendar defaulting itself is `tinyconnectors::execute::apply_calendar_query_defaults` (#1714). |
-| `crates/openhuman-core/src/integrations/composio/identity.rs` | Resolves the connected account username for a toolkit via the connector module profile-fetch path (used by skill preflight identity gate). |
-| `crates/openhuman-core/src/integrations/composio/identity_store.rs` | Persists connected-account identities in `<workspace>/integrations/composio_identities.json`. |
-| `crates/openhuman-core/src/integrations/composio/file_store.rs` | Atomic JSON file helpers for the identity and user-scope files under `<workspace>/integrations/`. |
-| `crates/openhuman-core/src/integrations/composio/direct_auth/mod.rs` | Direct-mode API-key health tracking: a process-local consecutive-401-failure counter (keyed by a non-logged key fingerprint) that short-circuits repeated invalid-key polling. |
-| `crates/openhuman-core/src/integrations/composio/trigger_history.rs` | Process-global `OnceLock` handle to `tinyconnectors::triggers::TriggerArchive` (`init_global`/`global`). |
-| `crates/openhuman-core/src/integrations/composio/bus.rs` + `bus/` | Trigger, connection-created and config-changed subscribers, and their registration. |
-| `crates/openhuman-core/src/integrations/composio/providers/mod.rs` | Re-exports the curated catalogs, scope verdicts, identity vocabulary and run types from `contract/`. |
-| `crates/openhuman-core/src/integrations/composio/contract/` | The Composio vocabulary: catalogs, scopes, profiles, run shapes, task shapes. Plain data and pure functions. |
+| [`crates/openhuman-core/src/integrations/composio/action_tool.rs`](./action_tool.rs) | `ComposioActionTool`: a `Tool` wrapping exactly one Composio action, constructed as a `ToolExposure::Deferred` tool per action of every connected toolkit ([`tools/orchestrator_tools.rs`](../../tools/orchestrator_tools.rs), and [`agent/session_host/recorded_tools.rs`](../../agent/session_host/recorded_tools.rs) when a resumed thread rebuilds its recorded actions), reached by the orchestrator through `tool_search`. |
+| [`crates/openhuman-core/src/integrations/composio/contract_gate.rs`](./contract_gate.rs) | Late-bound action contract gate (#4853): on an action's first call this turn, surfaces the full live contract (via `catalog::fetch_live_toolkit_catalog`) as a recoverable tool error before executing, so the retry has the real schema in context. |
+| [`crates/openhuman-core/src/integrations/composio/catalog.rs`](./catalog.rs) + `catalog/` (`contract.rs`, `lookups.rs`, `probe.rs`) | Live Composio tool contracts (`fetch_live_toolkit_catalog`, `ToolContract`, in [`catalog/contract.rs`](./catalog/contract.rs)): the unfiltered mode-aware `list_tools` schema (the module's `ListTools` member on the backend route, or direct v3 `direct_list_tools`) plus a bounded read-only response probe (`probe_tool_output_sample`, [`catalog/probe.rs`](./catalog/probe.rs)) when a schema publishes no `output_parameters`. |
+| [`crates/openhuman-core/src/integrations/composio/connected_integrations.rs`](./connected_integrations.rs) + `connected_integrations/` (`cache.rs`, `fetch.rs`, `fetch_uncached.rs`) | Cached active-connections lookups (`cached_active_integrations`, `fetch_connected_integrations*`) reconciled against `list_connections`. |
+| [`crates/openhuman-core/src/integrations/composio/execute_dispatch.rs`](./execute_dispatch.rs) | Host entry for running one action: applies egress enforcement/disclosure, then calls the module's `EXECUTE` member (prepare → retry → error mapping all run in `tinyconnectors`). Used by the `composio_execute` agent tool, `tools.composio_execute`, the memory host, LinkedIn enrichment and the output probe. |
+| [`crates/openhuman-core/src/integrations/composio/googlecalendar_args.rs`](./googlecalendar_args.rs) | Host IANA time-zone lookup; the calendar defaulting itself is `tinyconnectors::execute::apply_calendar_query_defaults` (#1714). |
+| [`crates/openhuman-core/src/integrations/composio/identity.rs`](./identity.rs) | Resolves the connected account username for a toolkit via the connector module profile-fetch path (used by skill preflight identity gate). |
+| [`crates/openhuman-core/src/integrations/composio/identity_store.rs`](./identity_store.rs) | Persists connected-account identities in `<workspace>/integrations/composio_identities.json`. |
+| [`crates/openhuman-core/src/integrations/composio/file_store.rs`](./file_store.rs) | Atomic JSON file helpers for the identity and user-scope files under `<workspace>/integrations/`. |
+| [`crates/openhuman-core/src/integrations/composio/direct_auth/mod.rs`](./direct_auth/mod.rs) | Direct-mode API-key health tracking: a process-local consecutive-401-failure counter (keyed by a non-logged key fingerprint) that short-circuits repeated invalid-key polling. |
+| [`crates/openhuman-core/src/integrations/composio/trigger_history.rs`](./trigger_history.rs) | Process-global `OnceLock` handle to `tinyconnectors::triggers::TriggerArchive` (`init_global`/`global`). |
+| [`crates/openhuman-core/src/integrations/composio/bus.rs`](./bus.rs) + `bus/` | Trigger, connection-created and config-changed subscribers, and their registration. |
+| [`crates/openhuman-core/src/integrations/composio/providers/mod.rs`](./providers/mod.rs) | Re-exports the curated catalogs, scope verdicts, identity vocabulary and run types from `contract/`. |
+| [`crates/openhuman-core/src/integrations/composio/contract/`](./contract/) | The Composio vocabulary: catalogs, scopes, profiles, run shapes, task shapes. Plain data and pure functions. |
| `*_tests.rs` | Sibling test suites for each file. |
## Ops layout
-`ops/mod.rs`'s module doc lists the submodule split:
+[`ops/mod.rs`](./ops/mod.rs)'s module doc lists the submodule split:
| Sub-module | Contents |
| --- | --- |
@@ -128,7 +128,7 @@ Namespace `composio`, exposed as `openhuman.composio_*`:
| `composio.get_mode` | Current routing mode + whether a direct-mode key is set (never returns the key). |
| `composio.set_api_key` / `composio.clear_api_key` | Store/clear direct-mode Composio API key (key never logged/returned). |
-Handlers delegate to `ops/`; scope handlers delegate to `ops::user_scopes`. Exports wired into `crates/openhuman-core/src/core/all.rs`.
+Handlers delegate to `ops/`; scope handlers delegate to `ops::user_scopes`. Exports wired into [`crates/openhuman-core/src/core/all.rs`](../../core/all.rs).
## Agent tools
@@ -136,7 +136,7 @@ From `tools.rs` (`all_composio_agent_tools`, registered only when `agent::subage
## Events
-The subscribers live in `bus/`. All three are registered by one call, `register_composio_trigger_subscriber()`, from `crates/openhuman-core/src/core/runtime/subscribers.rs` after trigger history initialization:
+The subscribers live in `bus/`. All three are registered by one call, `register_composio_trigger_subscriber()`, from [`crates/openhuman-core/src/core/runtime/subscribers.rs`](../../core/runtime/subscribers.rs) after trigger history initialization:
- **`ComposioTriggerSubscriber`**, reacts to `DomainEvent::ComposioTriggerReceived` (published by `platform::socket::event_handlers` when the backend emits `composio:trigger`); archives the event to `trigger_history` and routes it through `agent::triage::run_triage` unless `OPENHUMAN_TRIGGER_TRIAGE_DISABLED`, `composio.triage_disabled`, or `composio.triage_disabled_toolkits` opts out.
- **`ComposioConnectionCreatedSubscriber`**, reacts to `DomainEvent::ComposioConnectionCreated` (published by `composio_authorize`); waits for the connection to go active, invalidates and eagerly warms the integrations cache, then (after onboarding, for toolkits with a native identity provider) fetches the profile.
@@ -157,7 +157,7 @@ Published from `ops/` via `crate::core::bus::BUS.publish` (`crate::core::events:
- `crate::config`: `Config` / `ComposioConfig` (`mode`, `entity_id`), `config::rpc` config loading.
- `crate::modules`: loads the `tinyconnectors` native module that `module_client.rs` calls into (behind the `modules` feature).
- `tinyconnectors_bus`: the wire contract (member names, payload types) for the `tinyconnectors` module call surface; a plain dependency, not feature-gated.
-- `crate::agent::harness`: sandbox mode (`current_sandbox_mode` / `SandboxMode`) for tool gating; `current_task_recency_window` applied through `tinyconnectors::execute::{apply_window_args, filter_response}` in `tools/execute.rs`.
+- `crate::agent::harness`: sandbox mode (`current_sandbox_mode` / `SandboxMode`) for tool gating; `current_task_recency_window` applied through `tinyconnectors::execute::{apply_window_args, filter_response}` in [`tools/execute.rs`](./tools/execute.rs).
- `tinytools`: `Tool`, `ToolResult`, `ToolCategory`, `PermissionLevel`, `ToolCallOptions`.
- `crate::security`: `SecurityPolicy` / `ToolOperation` for direct-tool gating.
- `crate::security::credentials`: encrypted store for the direct-mode API key.
@@ -170,24 +170,24 @@ Published from `ops/` via `crate::core::bus::BUS.publish` (`crate::core::events:
## Used by
- `crates/openhuman-core/src/core/all.rs`: registers the controllers.
-- `crates/openhuman-core/src/tools/{mod,ops}.rs`, `tools/schemas/composio.rs`: wires agent tools into the tool registry.
+- `crates/openhuman-core/src/tools/{mod,ops}.rs`, [`tools/schemas/composio.rs`](../../tools/schemas/composio.rs): wires agent tools into the tool registry.
- `crates/openhuman-core/src/core/runtime/subscribers.rs`: at startup initializes trigger history and registers the three bus subscribers.
-- `crates/openhuman-core/src/agent/**`: session-host tool assembly (deferred per-action tools, recorded-tool rebuild), triage escalation and debug (e.g. `agent/subagent_host/`, `agent/orchestration/tools/`, `agent/debug/mod.rs`).
-- `crates/openhuman-core/src/platform/socket/event_handlers.rs`: parses `composio:trigger` and publishes `ComposioTriggerReceived`.
-- `crates/openhuman-core/src/agent/prompts/connected_identities.rs`: renders connected identities into the agent prompt.
-- `crates/openhuman-core/src/skills/preflight.rs`: identity gate via `connection_identity`.
-- `crates/openhuman-core/src/security/credentials/ops/composio.rs`: direct-mode API key storage.
-- `crates/openhuman-core/src/channels/runtime/dispatch/routing.rs`: channel routing over connected integrations.
-- `crates/openhuman-core/src/flows/**` (`ops/catalog.rs`, `ops/connection_ref_gate.rs`, `ops/tool_contract_gate.rs`, `ops/connections.rs`, `ops/wiring_warnings.rs`, `ops/approval_manifest.rs`, `ops/builder.rs`, `tinyflows/caps/tools/composio.rs`), workflow builder capability adapters over the catalog.
+- `crates/openhuman-core/src/agent/**`: session-host tool assembly (deferred per-action tools, recorded-tool rebuild), triage escalation and debug (e.g. [`agent/subagent_host/`](../../agent/subagent_host/), [`agent/orchestration/tools/`](../../agent/orchestration/tools/), [`agent/debug/mod.rs`](../../agent/debug/mod.rs)).
+- [`crates/openhuman-core/src/platform/socket/event_handlers.rs`](../../platform/socket/event_handlers.rs): parses `composio:trigger` and publishes `ComposioTriggerReceived`.
+- [`crates/openhuman-core/src/agent/prompts/connected_identities.rs`](../../agent/prompts/connected_identities.rs): renders connected identities into the agent prompt.
+- [`crates/openhuman-core/src/skills/preflight.rs`](../../skills/preflight.rs): identity gate via `connection_identity`.
+- [`crates/openhuman-core/src/security/credentials/ops/composio.rs`](../../security/credentials/ops/composio.rs): direct-mode API key storage.
+- [`crates/openhuman-core/src/channels/runtime/dispatch/routing.rs`](../../channels/runtime/dispatch/routing.rs): channel routing over connected integrations.
+- `crates/openhuman-core/src/flows/**` (`ops/catalog.rs`, `ops/connection_ref_gate.rs`, `ops/tool_contract_gate.rs`, [`ops/connections.rs`](./ops/connections.rs), `ops/wiring_warnings.rs`, `ops/approval_manifest.rs`, `ops/builder.rs`, `tinyflows/caps/tools/composio.rs`), workflow builder capability adapters over the catalog.
- `crates/openhuman-core/src/integrations/task_sources/**`: re-exports `NormalizedTask`/`TaskContainer`/`TaskFetchFilter`/`TaskKind` from `providers/mod.rs` (its fetch stage is stubbed since `ComposioProvider::fetch_tasks` went away).
- `crates/openhuman-core/src/modules/{connectors_tests,memory_host}.rs`: module loader tests/wiring for the connector bridge.
-- `crates/openhuman-core/src/core/observability.rs`: matches `direct_auth::COMPOSIO_INVALID_API_KEY_ANCHOR` / `_USER_MESSAGE` when classifying errors.
+- [`crates/openhuman-core/src/core/observability.rs`](../../core/observability.rs): matches `direct_auth::COMPOSIO_INVALID_API_KEY_ANCHOR` / `_USER_MESSAGE` when classifying errors.
## Notes / gotchas
- **Mode-aware routing (#1710)**: the `ops/` layer calls the connector module (`module_client::call*`) for every member, and the module reconciles the backend/direct route from live config on each call, so a `composio.mode` toggle is honoured per call. Two host-side exceptions: `list_connections` in direct mode uses `resolve_composio_route` + `direct_list_connections` (the in-process `DirectRoute` over the host transport, so the host proxy/TLS settings, per-client loopback overrides and the pre-store key probe apply); execution goes through `execute_dispatch.rs`, which is a thin egress gate over the module's `EXECUTE`. Operations a route does not offer (e.g. the toolkit allowlist or triggers in direct mode) come back as a named refusal, recognised by `module_client::is_unsupported_by_route`, and are rendered as empty rather than as an outage. `ops::error_utils::resolve_client` survives only for tests.
- **`ops/` is split by concern** (see [Ops layout](#ops-layout)) rather than one large file.
-- **Error classification matters for the UI**: `execute` may return pre-classified `[composio:error:<class>] …` strings (parsed by `app/src/lib/composio/formatters.ts`); `ops/execute.rs` preserves them rather than re-wrapping.
+- **Error classification matters for the UI**: `execute` may return pre-classified `[composio:error:<class>] …` strings (parsed by [`app/src/lib/composio/formatters.ts`](../../../../../app/src/lib/composio/formatters.ts)); [`ops/execute.rs`](./ops/execute.rs) preserves them rather than re-wrapping.
- **Sentry funnel**: `report_composio_op_error` re-tags op-layer failures under `domain="composio"` with `failure="non_2xx"|"transport"` (+ extracted backend status) so transient 5xx leaks are dropped by `before_send` while genuine bugs surface.
- **Type drift tolerance**: trigger types use `de_string_or_object` / `de_opt_string_or_object` to accept upstream fields that flip between string and object shapes.
- **Direct-mode 401 short-circuit** (`direct_auth/mod.rs`): after `DIRECT_INVALID_API_KEY_THRESHOLD` (3) consecutive `401 Invalid API key` responses for the same fingerprinted key, further polls short-circuit with a stable user-facing message instead of re-hitting Composio.
diff --git a/crates/openhuman-core/src/integrations/file_storage/README.md b/crates/openhuman-core/src/integrations/file_storage/README.md
index 7c62cd1c76..bd27d37fa1 100644
--- a/crates/openhuman-core/src/integrations/file_storage/README.md
+++ b/crates/openhuman-core/src/integrations/file_storage/README.md
@@ -24,13 +24,13 @@ and TTL enforcement.
| File | Role |
| --- | --- |
-| `mod.rs` | Export-only module root; re-exports `build_file_storage_tools` and the six `Storage*Tool` structs. |
-| `types.rs` | Serde types for backend responses (`UploadResponse`, `ListFilesResponse`, `FileMeta`, `LinkResponse`, `DeleteResponse`). |
-| `tools/mod.rs` | Module doc listing the backend endpoints and billing model; declares and re-exports the tool submodules. |
-| `tools/helpers.rs` | Shared helpers: `resolve_upload_path`, `validate_file_id`, `validate_visibility`, `sanitize_filename`, `action_dir_for_context`, `readonly_autonomy_block`. |
-| `tools/upload.rs`, `tools/download.rs`, `tools/list.rs`, `tools/link.rs`, `tools/visibility.rs`, `tools/delete.rs` | `StorageUploadFileTool`, `StorageDownloadFileTool`, `StorageListFilesTool`, `StorageGetLinkTool`, `StorageSetVisibilityTool`, `StorageDeleteFileTool` respectively, one `Tool` impl per file. |
-| `tools/registry.rs` | The `build_file_storage_tools` builder. |
-| `tools_tests.rs` | Tool metadata/schema tests and path-resolution/sanitization unit tests. |
+| [`mod.rs`](./mod.rs) | Export-only module root; re-exports `build_file_storage_tools` and the six `Storage*Tool` structs. |
+| [`types.rs`](./types.rs) | Serde types for backend responses (`UploadResponse`, `ListFilesResponse`, `FileMeta`, `LinkResponse`, `DeleteResponse`). |
+| [`tools/mod.rs`](./tools/mod.rs) | Module doc listing the backend endpoints and billing model; declares and re-exports the tool submodules. |
+| [`tools/helpers.rs`](./tools/helpers.rs) | Shared helpers: `resolve_upload_path`, `validate_file_id`, `validate_visibility`, `sanitize_filename`, `action_dir_for_context`, `readonly_autonomy_block`. |
+| [`tools/upload.rs`](./tools/upload.rs), [`tools/download.rs`](./tools/download.rs), [`tools/list.rs`](./tools/list.rs), [`tools/link.rs`](./tools/link.rs), [`tools/visibility.rs`](./tools/visibility.rs), [`tools/delete.rs`](./tools/delete.rs) | `StorageUploadFileTool`, `StorageDownloadFileTool`, `StorageListFilesTool`, `StorageGetLinkTool`, `StorageSetVisibilityTool`, `StorageDeleteFileTool` respectively, one `Tool` impl per file. |
+| [`tools/registry.rs`](./tools/registry.rs) | The `build_file_storage_tools` builder. |
+| [`tools_tests.rs`](./tools_tests.rs) | Tool metadata/schema tests and path-resolution/sanitization unit tests. |
## Agent Tools
@@ -77,7 +77,7 @@ the sole construction entry point. It returns an empty tool list when
configured, or the user is not signed in), otherwise builds a
`SecurityPolicy` from `root_config.autonomy` and returns all six tools.
-Called from `crates/openhuman-core/src/tools/ops.rs` (around line 905):
+Called from [`crates/openhuman-core/src/tools/ops.rs`](../../tools/ops.rs) (around line 905):
```rust
tools.extend(crate::integrations::file_storage::build_file_storage_tools(...));
@@ -85,8 +85,8 @@ tools.extend(crate::integrations::file_storage::build_file_storage_tools(...));
The tool structs are exported only from this module
(`crate::integrations::file_storage::Storage*Tool`); unlike the sibling
-`integrations/tools.rs` family they are not re-exported through
-`crates/openhuman-core/src/tools/mod.rs`, because nothing constructs them
+[`integrations/tools.rs`](../tools.rs) family they are not re-exported through
+[`crates/openhuman-core/src/tools/mod.rs`](../../tools/mod.rs), because nothing constructs them
outside `build_file_storage_tools`.
## Dependencies
diff --git a/crates/openhuman-core/src/integrations/task_sources/README.md b/crates/openhuman-core/src/integrations/task_sources/README.md
index 2ff2980a51..f6bd975a8c 100644
--- a/crates/openhuman-core/src/integrations/task_sources/README.md
+++ b/crates/openhuman-core/src/integrations/task_sources/README.md
@@ -1,24 +1,24 @@
# task_sources
-Proactive ingestion of work items from external tools. A **task source** is a user-configured pull from a Composio-backed provider (GitHub, Notion, Linear, ClickUp) with a per-provider filter. A periodic poll runs a fetch → dedup → enrich → route pipeline that records each item in the ingestion ledger and, for proactive sources, dispatches a triage turn so an agent can start working immediately. **The fetch stage is currently a stub**: `ComposioProvider::fetch_tasks` was deleted upstream (tinymemory v1.13.4) with no replacement, so `pipeline::fetch_tasks_unavailable` refuses every toolkit and only the surrounding stages (dedup, enrichment, routing, storage, reconciliation) are live, see [Notes](#notes--gotchas). The domain mirrors the `cron` layering: `mod.rs` is export-only, business logic lives in sibling modules, persistence is SQLite, and the RPC surface is wired through `schemas.rs`.
+Proactive ingestion of work items from external tools. A **task source** is a user-configured pull from a Composio-backed provider (GitHub, Notion, Linear, ClickUp) with a per-provider filter. A periodic poll runs a fetch → dedup → enrich → route pipeline that records each item in the ingestion ledger and, for proactive sources, dispatches a triage turn so an agent can start working immediately. **The fetch stage is currently a stub**: `ComposioProvider::fetch_tasks` was deleted upstream (tinymemory v1.13.4) with no replacement, so `pipeline::fetch_tasks_unavailable` refuses every toolkit and only the surrounding stages (dedup, enrichment, routing, storage, reconciliation) are live, see [Notes](#notes--gotchas). The domain mirrors the `cron` layering: [`mod.rs`](./mod.rs) is export-only, business logic lives in sibling modules, persistence is SQLite, and the RPC surface is wired through [`schemas.rs`](./schemas.rs).
## Responsibilities
- Persist per-source configs (provider + filter + schedule + routing target + optional pinned connection / static executor).
-- Periodically poll enabled sources (`periodic.rs`) on a global 10-minute tick honoring per-source `interval_secs` (floored to 60s).
-- Translate a typed `FilterSpec` into the provider-agnostic `TaskFetchFilter` (`filter.rs`); the fetch itself is stubbed (`pipeline::fetch_tasks_unavailable`) until a task-fetch surface exists again.
-- Dedup ingested items with an edit-aware SHA-256 content hash; re-ingest only when the upstream task changed (`store.rs` + `pipeline.rs`).
-- Deterministically enrich raw tasks into agent-ready ones, urgency heuristic, summary, linked assignee, templated agent prompt (`enrich.rs`).
-- Route enriched tasks: for proactive sources, dispatch a triage turn through the same path Composio webhooks use; collect-only sources stop at the ledger (`route.rs`).
-- Fire a one-shot fetch when a matching Composio connection is created (`bus.rs`).
-- Expose an `openhuman.task_sources_*` RPC surface for CRUD, manual fetch/sync, filter preview, container listing, ingested-task listing, and status (`schemas.rs` + `ops.rs`).
+- Periodically poll enabled sources ([`periodic.rs`](./periodic.rs)) on a global 10-minute tick honoring per-source `interval_secs` (floored to 60s).
+- Translate a typed `FilterSpec` into the provider-agnostic `TaskFetchFilter` ([`filter.rs`](./filter.rs)); the fetch itself is stubbed (`pipeline::fetch_tasks_unavailable`) until a task-fetch surface exists again.
+- Dedup ingested items with an edit-aware SHA-256 content hash; re-ingest only when the upstream task changed ([`store.rs`](./store.rs) + [`pipeline.rs`](./pipeline.rs)).
+- Deterministically enrich raw tasks into agent-ready ones, urgency heuristic, summary, linked assignee, templated agent prompt ([`enrich.rs`](./enrich.rs)).
+- Route enriched tasks: for proactive sources, dispatch a triage turn through the same path Composio webhooks use; collect-only sources stop at the ledger ([`route.rs`](./route.rs)).
+- Fire a one-shot fetch when a matching Composio connection is created ([`bus.rs`](./bus.rs)).
+- Expose an `openhuman.task_sources_*` RPC surface for CRUD, manual fetch/sync, filter preview, container listing, ingested-task listing, and status (`schemas.rs` + [`ops.rs`](./ops.rs)).
## Key files
| File | Role |
| --- | --- |
| `crates/openhuman-core/src/integrations/task_sources/mod.rs` | Export-only: module docstring, `mod`/`pub mod` decls, `pub use` re-exports, and the `all_task_sources_*` controller registry pair. |
-| `crates/openhuman-core/src/integrations/task_sources/types.rs` | Serde domain types: `ProviderSlug`, `FilterSpec` (provider-tagged enum), `SourceTarget`, `FetchReason`, `TaskSource`, `TaskSourcePatch`, `EnrichedTask`, `FetchOutcome`. |
+| [`crates/openhuman-core/src/integrations/task_sources/types.rs`](./types.rs) | Serde domain types: `ProviderSlug`, `FilterSpec` (provider-tagged enum), `SourceTarget`, `FetchReason`, `TaskSource`, `TaskSourcePatch`, `EnrichedTask`, `FetchOutcome`. |
| `crates/openhuman-core/src/integrations/task_sources/store.rs` | SQLite persistence (`<workspace>/task_sources/sources.db`): `task_sources` + `ingested_tasks` tables, dedup `content_hash`, migrate-on-open. |
| `crates/openhuman-core/src/integrations/task_sources/ops.rs` | RPC-facing business logic returning `Outcome<T>`: `list`/`get`/`add`/`update`/`remove`/`fetch`/`sync`/`list_tasks`/`preview_filter`/`list_databases`/`status`. |
| `crates/openhuman-core/src/integrations/task_sources/schemas.rs` | `task_sources` controller schemas + `all_controller_schemas` / `all_registered_controllers` + thin `handle_*` param parsers delegating to `ops.rs`. |
@@ -28,10 +28,10 @@ Proactive ingestion of work items from external tools. A **task source** is a us
| `crates/openhuman-core/src/integrations/task_sources/route.rs` | `route_enriched`: dispatches a scheduler-gated triage turn for proactive sources; collect-only sources are a no-op past the ledger. |
| `crates/openhuman-core/src/integrations/task_sources/periodic.rs` | `start_periodic_poll`: global tick scheduler; per-source due-timing in a process-global map; `run_one_tick` is `pub(crate)` for tests. |
| `crates/openhuman-core/src/integrations/task_sources/bus.rs` | `TaskSourcesConnectionSubscriber` + `register_task_sources_subscriber`: one-shot fetch on `ComposioConnectionCreated`. |
-| `crates/openhuman-core/src/integrations/task_sources/tools.rs` | LLM-callable wrappers over `ops.rs`: see [Agent tools](#agent-tools) below. |
-| `crates/openhuman-core/src/integrations/task_sources/store_tests.rs` | Sibling test suite for `store.rs`. |
-| `crates/openhuman-core/src/integrations/task_sources/pipeline_tests.rs` | Sibling test suite for `pipeline.rs`. |
-| `crates/openhuman-core/src/integrations/task_sources/tools_tests.rs` | Sibling test suite for `tools.rs`. |
+| [`crates/openhuman-core/src/integrations/task_sources/tools.rs`](./tools.rs) | LLM-callable wrappers over `ops.rs`: see [Agent tools](#agent-tools) below. |
+| [`crates/openhuman-core/src/integrations/task_sources/store_tests.rs`](./store_tests.rs) | Sibling test suite for `store.rs`. |
+| [`crates/openhuman-core/src/integrations/task_sources/pipeline_tests.rs`](./pipeline_tests.rs) | Sibling test suite for `pipeline.rs`. |
+| [`crates/openhuman-core/src/integrations/task_sources/tools_tests.rs`](./tools_tests.rs) | Sibling test suite for `tools.rs`. |
## Public surface
@@ -60,14 +60,14 @@ Namespace `task_sources` (methods `openhuman.task_sources_<function>`):
| `list_databases` | List selectable containers (Notion databases) for a provider. Currently always errors (fetch stub). |
| `status` | Domain master switch + default interval + source counts. |
-Handlers parse params and delegate to `ops.rs`; schemas reference `FilterSpec`, `TaskSource`, `TaskSourcePatch`, `FetchOutcome`, `NormalizedTask`. Registered into the global registry via `crates/openhuman-core/src/core/all.rs`.
+Handlers parse params and delegate to `ops.rs`; schemas reference `FilterSpec`, `TaskSource`, `TaskSourcePatch`, `FetchOutcome`, `NormalizedTask`. Registered into the global registry via [`crates/openhuman-core/src/core/all.rs`](../../core/all.rs).
## Agent tools
`tools.rs` wraps `ops.rs` as thin LLM-callable shims, each parses args,
calls the matching `ops` function, and emits its `Outcome::value` as JSON.
Read/observe tools are default-enabled; the persistent-config mutators are
-default-OFF and must be explicitly allowlisted via `tools/user_filter.rs`
+default-OFF and must be explicitly allowlisted via [`tools/user_filter.rs`](../../tools/user_filter.rs)
(the `task_source_manage` filter group covers `add`/`update`/`remove`).
| Tool name | Struct | Backing op | Default |
@@ -83,7 +83,7 @@ default-OFF and must be explicitly allowlisted via `tools/user_filter.rs`
| `task_source_remove` | `TaskSourceRemoveTool` | `ops::remove` | OFF (`task_source_manage`) |
Re-exported into the global agent tool registry via
-`crates/openhuman-core/src/tools/mod.rs`
+[`crates/openhuman-core/src/tools/mod.rs`](../../tools/mod.rs)
(`pub use crate::integrations::task_sources::tools::*;`).
`task_source_fetch` and `task_source_preview_filter` advertise themselves
@@ -93,7 +93,7 @@ restored.
## Events
-Publishes (via `BUS.publish`, domain `"task_sources"` in `core/events.rs`):
+Publishes (via `BUS.publish`, domain `"task_sources"` in [`core/events.rs`](../../core/events.rs)):
- `DomainEvent::TaskSourceFetched`: after a successful fetch pass (counts: fetched/routed/skipped).
- `DomainEvent::TaskSourceTaskIngested`: per newly routed task (provider, external_id, title, urgency).
@@ -106,12 +106,12 @@ Subscribes:
Startup wiring is split across three sites; both entry points are idempotent
(`OnceLock`), so the overlap is harmless:
-- `crates/openhuman-core/src/core/runtime/subscribers.rs` calls
+- [`crates/openhuman-core/src/core/runtime/subscribers.rs`](../../core/runtime/subscribers.rs) calls
`crate::integrations::task_sources::bus::register_task_sources_subscriber()`.
-- `crates/openhuman-core/src/core/runtime/services.rs` calls
+- [`crates/openhuman-core/src/core/runtime/services.rs`](../../core/runtime/services.rs) calls
`crate::integrations::task_sources::start_periodic_poll()` when the
`ServiceSet`'s task-source polling bootstrap job is enabled.
-- `crates/openhuman-core/src/channels/runtime/startup/start_channels.rs`
+- [`crates/openhuman-core/src/channels/runtime/startup/start_channels.rs`](../../channels/runtime/startup/start_channels.rs)
(`start_channels_inner`) calls both `register_task_sources_subscriber()`
and `start_periodic_poll()` again for the channels runtime path.
@@ -141,7 +141,7 @@ The additive idempotent `ingested_tasks.card_id` migration preserves older datab
- `crates/openhuman-core/src/channels/runtime/startup/start_channels.rs`: `start_channels` registers the subscriber and starts the poll for the channels runtime.
- `crates/openhuman-core/src/core/events.rs`: defines/classifies the three `TaskSource*` event variants under domain `"task_sources"`.
- `crates/openhuman-core/src/tools/mod.rs`: re-exports `tools.rs`'s agent tools into the global tool registry.
-- `crates/openhuman-core/src/config/schema/`: `TaskSourcesConfig` block feeding domain defaults.
+- [`crates/openhuman-core/src/config/schema/`](../../config/schema/): `TaskSourcesConfig` block feeding domain defaults.
## Notes / gotchas
diff --git a/crates/openhuman-core/src/mcp/README.md b/crates/openhuman-core/src/mcp/README.md
index 60e8086605..3688b6ecc3 100644
--- a/crates/openhuman-core/src/mcp/README.md
+++ b/crates/openhuman-core/src/mcp/README.md
@@ -41,7 +41,7 @@ other MCP hosts that call into it.
### The service holder
-`host.rs` keeps a process-wide map (`HOSTS`) from workspace path to one
+[`host.rs`](./host.rs) keeps a process-wide map (`HOSTS`) from workspace path to one
`McpHost`. An `McpHost` wraps the `tinymcp` service and exposes its three
parts: `dynamic()` (the user-declared registry), `static_servers()` (the
TOML-declared set) and `audit()` (the write-audit store). The library holds no
@@ -83,14 +83,14 @@ definition).
Three things are host policy rather than protocol:
- Prompt-injection detection over remote tool definitions.
- `registry::tools_safe_for_agent` (`registry/mod.rs`) drops a tool whose
+ `registry::tools_safe_for_agent` ([`registry/mod.rs`](./registry/mod.rs)) drops a tool whose
description trips a rule, and logs and publishes `McpToolRejected` with the
rule code only, never the offending text. The lexical half (control
characters, prompt-template fences, length caps) lives in the
`tinymcp-bus` contract and is applied by its display accessors.
- Events. `tinymcp` reports outcomes in return values. Turning them into
- `DomainEvent`s happens here: `registry/ops.rs` for RPC-driven lifecycle
- events, `registry/supervisor_events.rs` for what the reconnect supervisor
+ `DomainEvent`s happens here: [`registry/ops.rs`](./registry/ops.rs) for RPC-driven lifecycle
+ events, [`registry/supervisor_events.rs`](./registry/supervisor_events.rs) for what the reconnect supervisor
observed, and `tools_safe_for_agent` for rejections. `audit/` publishes
nothing.
- The proxy decision. `host::proxy_for_mcp` applies OpenHuman's proxy scope
@@ -102,7 +102,7 @@ Three things are host policy rather than protocol:
The static set is declared in config TOML (`[[mcp_client.servers]]`) and is
reached through `mcp::config_servers` and the `mcp_list_servers`,
`mcp_list_tools` and `mcp_call_tool` bridge tools plus per-tool
-`mcp_<server>_<tool>` tools in `tools/impl/network/`. The dynamic set is the
+`mcp_<server>_<tool>` tools in [`tools/impl/network/`](../tools/impl/network/). The dynamic set is the
user's `mcp.json` document, edited through `mcp_clients.config_get` and
`config_set`, browsed from the Smithery and official catalogs, and reached
through the `mcp_registry_*` tools and installed-server actions. Both are
@@ -112,7 +112,7 @@ compiled out with the `mcp` feature.
| Path | What it does |
| --- | --- |
-| `mod.rs` | Family root: `start`, `start_boot_jobs`, the configured tool-cache refresh, the supervisor spawn, and the `http_client` and `config_servers` re-export modules. |
+| [`mod.rs`](./mod.rs) | Family root: `start`, `start_boot_jobs`, the configured tool-cache refresh, the supervisor spawn, and the `http_client` and `config_servers` re-export modules. |
| `host.rs` | The per-workspace `McpHost` holder, config conversion (`client_config`, `static_registry`), `oauth_redirect_uri`, `proxy_for_mcp`. |
| [`registry/`](registry/README.md) | The `mcp_clients` RPC namespace (including `mcp.json`), the `mcp_registry_*` agent tools, installed-server action tools (`action_tool.rs`), supervisor event translation, the injection screen, and the `boot`, `supervisor`, `oauth` and `connections` helpers. |
| [`audit/`](audit/README.md) | The `mcp_audit` RPC namespace over the write-audit log. |
@@ -126,7 +126,7 @@ directories, and hold only `pub use` re-exports of `tinymcp`:
`redact_endpoint`, `render_tool_result`, and `tinymcp_bus` wire types
(`McpRemoteTool`, `McpServerToolResult`, `McpSseEvent`, the OAuth challenge
and metadata types). It is always compiled because the ungated `gitbooks`
- tool (`tools/impl/network/gitbooks.rs`) dials `McpHttpClient`.
+ tool ([`tools/impl/network/gitbooks.rs`](../tools/impl/network/gitbooks.rs)) dials `McpHttpClient`.
- `config_servers` (`mcp` feature): `McpStdioClient`, `McpRegistrySource`,
`McpServerDefinition`, `McpServerRegistry`, `McpTransportClient`, and
`tinymcp_bus::McpAuthConfig` re-exported as `McpDefinitionAuth`. That is a
@@ -150,18 +150,18 @@ directories, and hold only `pub use` re-exports of `tinymcp`:
## RPC surface
-Registered through `core/all.rs`:
+Registered through [`core/all.rs`](../core/all.rs):
-- `mcp_clients.*` (`registry/schemas/`): `registry_search`,
+- `mcp_clients.*` ([`registry/schemas/`](./registry/schemas/)): `registry_search`,
`registry_get`, `registry_settings_get`, `registry_settings_set`,
`installed_list`, `config_get`, `config_set`, `update_env`, `uninstall`,
`set_enabled`, `detect_auth`, `oauth_begin`, `connect`, `disconnect`,
`status`, `list_tools`, `tool_call`. On the wire these are
`openhuman.mcp_clients_<function>`.
-- `mcp_audit.list` (`audit/schemas.rs`): rows from the write-audit log.
+- `mcp_audit.list` ([`audit/schemas.rs`](./audit/schemas.rs)): rows from the write-audit log.
The `openhuman-core mcp` server is not an RPC domain. It is a CLI entry wired
-through `core/cli.rs` that translates each MCP `tools/call` into an existing
+through [`core/cli.rs`](../core/cli.rs) that translates each MCP `tools/call` into an existing
registered core RPC method.
Agent tools registered from this folder: `mcp_registry_search`,
@@ -174,7 +174,7 @@ servers. There is no install tool: servers are added by the user in
## Boundaries
-- `tinymcp` (`vendor/tinymcp`, repo `tinyhumansai/tinymcp`) owns the
+- `tinymcp` ([`vendor/tinymcp`](../../../../vendor/tinymcp/), repo `tinyhumansai/tinymcp`) owns the
transports, handshakes, OAuth discovery, the dynamic registry and its
SQLite store, the supervisor, the write-audit store, and the generic server
half (`tinymcp::server`). Fix protocol or client behavior there and move the
@@ -186,12 +186,12 @@ servers. There is no install tool: servers are added by the user in
`McpAuthConfig`, which `host.rs` converts from.
- The `mcp_*` bridge tools over the static set live in
`tools/impl/network/`; MCP tools in the cross-surface discovery registry
- are assembled by `tools/registry/`.
+ are assembled by [`tools/registry/`](../tools/registry/).
- `tinymcp` is a path dependency on `vendor/tinymcp` with
`default-features = false` (see the `tinymcp` block in
- `crates/openhuman-core/Cargo.toml` for why it is not the pinned release).
+ [`crates/openhuman-core/Cargo.toml`](../../Cargo.toml) for why it is not the pinned release).
The loadable-module release pin is in
- `modules/registry/records_mcp_connectors.rs`.
+ [`modules/registry/records_mcp_connectors.rs`](../modules/registry/records_mcp_connectors.rs).
## Gotchas
@@ -209,7 +209,7 @@ servers. There is no install tool: servers are added by the user in
## Tests
-Each module has a sibling `*_tests.rs` (`host_tests.rs`, and the suites under
+Each module has a sibling `*_tests.rs` ([`host_tests.rs`](./host_tests.rs), and the suites under
`registry/`, `audit/` and `server/`, including the wire and HTTP golden tests
in `server/`). Run with `cargo test -p openhuman mcp::` or
`pnpm debug rust mcp`, and check the disabled build with
diff --git a/crates/openhuman-core/src/mcp/audit/README.md b/crates/openhuman-core/src/mcp/audit/README.md
index a545d330ef..3ae3d67234 100644
--- a/crates/openhuman-core/src/mcp/audit/README.md
+++ b/crates/openhuman-core/src/mcp/audit/README.md
@@ -18,15 +18,15 @@ more.
| File | Role |
| --- | --- |
-| `mod.rs` | Facade: re-exports the payload types (`types` module, from `tinymcp_bus`), `record_write`/`list_writes` (delegating to the `mcp::host` service's `AuditStore`), and the schema re-exports. |
-| `schemas.rs` / `schemas_tests.rs` | The `mcp_audit.list` controller: schema (`limit`/`offset`/`since_ms`/`client_filter`/`tool_filter`/`success_only` inputs, `records` output) and its handler, which loads the config, deserializes the params into `McpWriteListQuery`, and calls `list_writes`. |
-| `stub.rs` | The `mcp`-less mirror: `record_write` is a no-op returning `Ok(0)`, `list_writes` returns `Ok(vec![])`. |
+| [`mod.rs`](./mod.rs) | Facade: re-exports the payload types (`types` module, from `tinymcp_bus`), `record_write`/`list_writes` (delegating to the `mcp::host` service's `AuditStore`), and the schema re-exports. |
+| [`schemas.rs`](./schemas.rs) / [`schemas_tests.rs`](./schemas_tests.rs) | The `mcp_audit.list` controller: schema (`limit`/`offset`/`since_ms`/`client_filter`/`tool_filter`/`success_only` inputs, `records` output) and its handler, which loads the config, deserializes the params into `McpWriteListQuery`, and calls `list_writes`. |
+| [`stub.rs`](./stub.rs) | The `mcp`-less mirror: `record_write` is a no-op returning `Ok(0)`, `list_writes` returns `Ok(vec![])`. |
## RPC surface
`mcp_audit.list` is the only controller, registered through
`all_mcp_audit_internal_controllers` in `build_internal_only_controllers`
-(`core/all.rs`, ~line 1020): routable over RPC for the desktop UI/CLI, but
+([`core/all.rs`](../../core/all.rs), ~line 1020): routable over RPC for the desktop UI/CLI, but
not exposed to agents. The handler deserializes its params straight into
`tinymcp_bus::McpWriteListQuery` and hands them to `list_writes`; the
filter and limit semantics (`limit` default 50 / max 500 via
@@ -56,7 +56,7 @@ appears never to have happened, rather than erroring.
## Used by
-- `crates/openhuman-core/src/mcp/server/write_dispatch.rs`: `audit_write`
+- [`crates/openhuman-core/src/mcp/server/write_dispatch.rs`](../server/write_dispatch.rs): `audit_write`
/ `audit_write_rejection[_without_config]` call `audit::record_write` off
the hot path (`spawn_blocking`, or a thread when no runtime is current)
for every MCP write-tool attempt, success and rejection; `record_write`
diff --git a/crates/openhuman-core/src/mcp/registry/README.md b/crates/openhuman-core/src/mcp/registry/README.md
index 4aff25b37d..911cf7d462 100644
--- a/crates/openhuman-core/src/mcp/registry/README.md
+++ b/crates/openhuman-core/src/mcp/registry/README.md
@@ -22,16 +22,16 @@ keep working. The Rust module path is `crate::mcp::registry`.
| File | Role |
| --- | --- |
-| `mod.rs` | Module declarations, the `connections`/`store`/`boot`/`supervisor`/`oauth` re-export facades, and `tools_safe_for_agent` (the prompt-injection scan). |
-| `ops.rs` / `ops_tests.rs` | `mcp_clients_*` RPC handler bodies, each delegates to the service `mcp::host` holds. |
-| `config_ops.rs` | `mcp_clients_config_get` / `config_set`: the `RpcOutcome` envelope, domain events and background connects over `tinymcp`'s `McpRegistry::render_config_doc` / `apply_config_doc` (the `mcp.json` contract and reconciliation live in `tinymcp::registry::config_doc`). |
-| `schemas/` (`mod.rs`, `registry.rs`, `handlers.rs`, `params.rs`), `schemas_tests.rs` | Controller schema registry and dispatch. |
-| `supervisor_events.rs` / `supervisor_events_tests.rs` | Maps a supervisor tick's `TickReport` into `DomainEvent`s. |
-| `bus.rs` / `bus_tests.rs` | `McpClientEventSubscriber`: logs lifecycle events for observability. |
-| `tools.rs` / `tools_tests.rs` | Agent-facing `mcp_registry_*` tools: adapters over `tinymcp_bus::agent_tools::RegistryTool` specs (name, description, schema are the contract's), mapping effect to permission/exposure and executing through `ops.rs`. |
-| `action_tool.rs` / `action_tool_tests.rs` | One deferred agent tool per action on a connected server, built from `tinymcp_bus::agent_tools::action_tool_specs` with `tools_safe_for_agent` as the admission filter; execution re-checks the current connection and routes through `ops.rs`. |
-| `helpers.rs` | Shared identifier validation, workspace-service resolution, and env-key injection used by the handlers. |
-| `stub.rs` | The `mcp`-less mirror of the always-on surface: `all_mcp_registry_registered_controllers` (empty), `boot`, `bus`, `supervisor`, `oauth`, and the three `connections` lookups always-on callers name. |
+| [`mod.rs`](./mod.rs) | Module declarations, the `connections`/`store`/`boot`/`supervisor`/`oauth` re-export facades, and `tools_safe_for_agent` (the prompt-injection scan). |
+| [`ops.rs`](./ops.rs) / [`ops_tests.rs`](./ops_tests.rs) | `mcp_clients_*` RPC handler bodies, each delegates to the service `mcp::host` holds. |
+| [`config_ops.rs`](./config_ops.rs) | `mcp_clients_config_get` / `config_set`: the `RpcOutcome` envelope, domain events and background connects over `tinymcp`'s `McpRegistry::render_config_doc` / `apply_config_doc` (the `mcp.json` contract and reconciliation live in `tinymcp::registry::config_doc`). |
+| `schemas/` (`mod.rs`, `registry.rs`, `handlers.rs`, `params.rs`), [`schemas_tests.rs`](./schemas_tests.rs) | Controller schema registry and dispatch. |
+| [`supervisor_events.rs`](./supervisor_events.rs) / [`supervisor_events_tests.rs`](./supervisor_events_tests.rs) | Maps a supervisor tick's `TickReport` into `DomainEvent`s. |
+| [`bus.rs`](./bus.rs) / [`bus_tests.rs`](./bus_tests.rs) | `McpClientEventSubscriber`: logs lifecycle events for observability. |
+| [`tools.rs`](./tools.rs) / [`tools_tests.rs`](./tools_tests.rs) | Agent-facing `mcp_registry_*` tools: adapters over `tinymcp_bus::agent_tools::RegistryTool` specs (name, description, schema are the contract's), mapping effect to permission/exposure and executing through `ops.rs`. |
+| [`action_tool.rs`](./action_tool.rs) / [`action_tool_tests.rs`](./action_tool_tests.rs) | One deferred agent tool per action on a connected server, built from `tinymcp_bus::agent_tools::action_tool_specs` with `tools_safe_for_agent` as the admission filter; execution re-checks the current connection and routes through `ops.rs`. |
+| [`helpers.rs`](./helpers.rs) | Shared identifier validation, workspace-service resolution, and env-key injection used by the handlers. |
+| [`stub.rs`](./stub.rs) | The `mcp`-less mirror of the always-on surface: `all_mcp_registry_registered_controllers` (empty), `boot`, `bus`, `supervisor`, `oauth`, and the three `connections` lookups always-on callers name. |
## Modules re-exported over `tinymcp`
@@ -65,7 +65,7 @@ keep working. The Rust module path is `crate::mcp::registry`.
`registry_settings_get`, `registry_settings_set`, `set_enabled`.
`config_ops.rs` adds `config_get` and `config_set`: the `mcp.json`
document. All are registered by `schemas::all_registered_controllers`
-(`schemas/registry.rs`).
+([`schemas/registry.rs`](./schemas/registry.rs)).
`config_set` is a *replace*: a server absent from the document is
uninstalled, a new one is inserted as an `InstalledServer` built straight
@@ -110,8 +110,8 @@ for the stays-down/restored/parked cases, the desktop notification bridge.
`mcp_registry_uninstall`: thin shims over `ops.rs`. Discovery/observe/
connect/call tools are default-ON; `uninstall` (a persistent write of
installed state) ships default-OFF, gated behind the `mcp_manage` toggle in
-`tools/user_filter.rs`. There is no install tool: servers are declared by
-the user in `mcp.json`. Re-exported by `tools/mod.rs` behind
+[`tools/user_filter.rs`](../../tools/user_filter.rs). There is no install tool: servers are declared by
+the user in `mcp.json`. Re-exported by [`tools/mod.rs`](../../tools/mod.rs) behind
`#[cfg(feature = "mcp")]`. The generic `mcp_list_servers`/`mcp_call_tool`
bridge tools live elsewhere and are a distinct surface from these
`mcp_registry_*` tools.
@@ -135,23 +135,23 @@ same real type in both builds.
## Used by
-- `crates/openhuman-core/src/core/all.rs` (~line 444), registers
+- [`crates/openhuman-core/src/core/all.rs`](../../core/all.rs) (~line 444), registers
`all_mcp_registry_registered_controllers()`.
-- `crates/openhuman-core/src/mcp/mod.rs`: `start`/`start_boot_jobs` wire up
+- [`crates/openhuman-core/src/mcp/mod.rs`](../mod.rs): `start`/`start_boot_jobs` wire up
`bus::init()`, `boot::spawn_installed_servers`, and the reconnect
supervisor.
- `tinymcp`'s live connection map is the process cache: startup connects
installed servers, and connect, disconnect, config updates, and reconnects
update the map. `connected_overview()` reads tool snapshots from that map;
it does not call an MCP server on each chat turn.
-- `crates/openhuman-rpc/src/server/http/oauth_mcp.rs`: the `/oauth/mcp/callback`
+- [`crates/openhuman-rpc/src/server/http/oauth_mcp.rs`](../../../../openhuman-rpc/src/server/http/oauth_mcp.rs): the `/oauth/mcp/callback`
route calls `oauth::complete`.
-- `crates/openhuman-core/src/tools/registry/ops.rs` and
- `crates/openhuman-core/src/agent/registry/agents/orchestrator/prompt.rs`:
+- [`crates/openhuman-core/src/tools/registry/ops.rs`](../../tools/registry/ops.rs) and
+ [`crates/openhuman-core/src/agent/registry/agents/orchestrator/prompt.rs`](../../agent/registry/agents/orchestrator/prompt.rs):
read `mcp::registry::connections` to list connected servers/tools for the
tool catalog and the orchestrator prompt.
- `crates/openhuman-core/src/agent/session_host/turn/core_turn.rs`: reads
`connections::connected_overview()` when assembling a turn.
-- `crates/openhuman-core/src/platform/about_app/catalog_auth_channels_team.rs`: the
+- [`crates/openhuman-core/src/platform/about_app/catalog_auth_channels_team.rs`](../../platform/about_app/catalog_auth_channels_team.rs): the
`channels.mcp_registry_browse` / `mcp_server_install` /
`mcp_server_connect` capability entries.
diff --git a/crates/openhuman-core/src/mcp/server/README.md b/crates/openhuman-core/src/mcp/server/README.md
index fa1238bbeb..d1c0d7a6c1 100644
--- a/crates/openhuman-core/src/mcp/server/README.md
+++ b/crates/openhuman-core/src/mcp/server/README.md
@@ -1,8 +1,8 @@
# mcp/server
-Opt-in **Model Context Protocol (MCP) server** that exposes a curated, security-gated slice of OpenHuman's tool surface (Memory v2 reads/writes, core/agent introspection, subagent execution, web search) and bundled prompt assets to external MCP clients (Claude Desktop, Cursor, Windsurf, …). Started via `openhuman-core mcp`: stdio transport by default, or `--transport http` for Streamable HTTP + SSE on a local bind address. It is a JSON-RPC dispatcher, not a registered RPC domain: it has no `schemas.rs`/controllers and is wired only through `crates/openhuman-core/src/core/cli.rs`, translating each MCP `tools/call` into an existing registered core RPC method.
+Opt-in **Model Context Protocol (MCP) server** that exposes a curated, security-gated slice of OpenHuman's tool surface (Memory v2 reads/writes, core/agent introspection, subagent execution, web search) and bundled prompt assets to external MCP clients (Claude Desktop, Cursor, Windsurf, …). Started via `openhuman-core mcp`: stdio transport by default, or `--transport http` for Streamable HTTP + SSE on a local bind address. It is a JSON-RPC dispatcher, not a registered RPC domain: it has no `schemas.rs`/controllers and is wired only through [`crates/openhuman-core/src/core/cli.rs`](../../core/cli.rs), translating each MCP `tools/call` into an existing registered core RPC method.
-The generic server half — JSON-RPC protocol, client-provenance sessions, argument validators, and the stdio and Streamable HTTP transports — lives in `tinymcp::server` (`vendor/tinymcp`). This module is the host half: it implements `tinymcp::McpServerHandler` (`handler.rs`) over OpenHuman's config, security policy, write audit, agent turns, tool catalog, prompt resources and subagent depth.
+The generic server half — JSON-RPC protocol, client-provenance sessions, argument validators, and the stdio and Streamable HTTP transports — lives in `tinymcp::server` ([`vendor/tinymcp`](../../../../../vendor/tinymcp/)). This module is the host half: it implements `tinymcp::McpServerHandler` ([`handler.rs`](./handler.rs)) over OpenHuman's config, security policy, write audit, agent turns, tool catalog, prompt resources and subagent depth.
## Responsibilities
@@ -19,18 +19,18 @@ The generic server half — JSON-RPC protocol, client-provenance sessions, argum
| File | Role |
| --- | --- |
-| `crates/openhuman-core/src/mcp/server/mod.rs` | Module docstring + private submodule decls; re-exports `run_http`/`run_http_reporting`/`HttpServerConfig`, `run_stdio_from_cli`, `ensure_local_http`/`LocalMcpEndpoint`, `current_subagent_depth`/`HEADER_SUBAGENT_DEPTH`, `tool_specs`/`McpToolSpec`. |
+| [`crates/openhuman-core/src/mcp/server/mod.rs`](./mod.rs) | Module docstring + private submodule decls; re-exports `run_http`/`run_http_reporting`/`HttpServerConfig`, `run_stdio_from_cli`, `ensure_local_http`/`LocalMcpEndpoint`, `current_subagent_depth`/`HEADER_SUBAGENT_DEPTH`, `tool_specs`/`McpToolSpec`. |
| `crates/openhuman-core/src/mcp/server/handler.rs` | `OpenHumanMcpHandler`, the `tinymcp::McpServerHandler` every transport serves: `serverInfo` (`openhuman-core` + instructions), the `mcp` source-type prefix, `tools/list` from the config-gated catalog, `tools/call` through `tools::dispatch` inside the request's subagent-depth scope, and the prompt resources. |
-| `crates/openhuman-core/src/mcp/server/tools/` | Tool catalog and dispatch: `mod.rs` (facade; re-exports `tinymcp::ToolCallError`), `types.rs` (`McpToolSpec` and the limit/tag constants, ungated so `McpToolSpec` is one real type in both builds), `specs.rs` (`tool_specs`/`base_tool_specs`/`tool_specs_for_loaded_config` builders and the `server_tool_spec` conversion), `params.rs` (OpenHuman's per-tool argument policy → RPC params, over `tinymcp::server::args`), `dispatch.rs` (`call_tool`/`list_tool_specs`, policy enforcement, subagent handlers). |
-| `crates/openhuman-core/src/mcp/server/write_dispatch.rs` | Write/audit pipeline for `memory.learn`/`memory.forget`: config load, act-policy enforcement, RPC dispatch to `openhuman.memory_learn` / `openhuman.memory_forget`, audit-record write (success/rejection) via `crate::mcp::audit::record_write`, PII-redacting arg summaries. |
-| `crates/openhuman-core/src/mcp/server/resources.rs` | Static `RESOURCE_CATALOG` of compile-time-embedded (`include_str!`) prompt markdown, served as `tinymcp::ResourceSpec`s and read by URI (`-32002` when unknown). Test cross-checks catalog vs `agent::agents::BUILTINS`. |
-| `crates/openhuman-core/src/mcp/server/http.rs` | OpenHuman's `run_http`/`run_http_reporting`: `tinymcp::run_http_reporting` bound to the handler. Gated on `all(feature = "mcp", feature = "http-server")`; `http-server` forwards `tinymcp/server-http`. |
-| `crates/openhuman-core/src/mcp/server/local.rs` | Lazily-started, process-wide in-process loopback HTTP MCP server (`ensure_local_http`, `LocalMcpEndpoint`). Lets the sandboxed `claude` subprocess (Claude Code provider) reach OpenHuman's memory/tools over loopback without the MCP server inheriting Claude Code's OS jail; a per-process random bearer token stops any other local process from talking to it. |
-| `crates/openhuman-core/src/mcp/server/subagent_depth.rs` | Per-delegation-chain depth tracking for `agent.run_subagent`, propagated across the loopback MCP HTTP hop via the `X-OpenHuman-Subagent-Depth` header (read by `handler.rs` from `tinymcp`'s `RequestContext`) so nested Claude Code subagent calls are bounded without penalizing unrelated parallel callers. |
-| `crates/openhuman-core/src/mcp/server/stdio.rs` | CLI entry `run_stdio_from_cli` (arg parse: `--transport`/`--host`/`--port`/`--auth-token`/`-v`/`--help`), logging init, then `tinymcp::run_stdio` or `run_http` with the handler. |
-| `crates/openhuman-core/src/mcp/server/stub.rs` | The `mcp`-less mirror of `run_stdio_from_cli`, `ensure_local_http`/`LocalMcpEndpoint`, and `tool_specs`: disabled-error / empty-catalog bodies so always-on callers (`core/cli.rs`, the Claude Code driver, `tools/registry/ops.rs`) keep a stable surface. |
-| `crates/openhuman-core/src/mcp/server/wire_golden_tests.rs`, `http_golden_tests.rs` | Golden wire fixtures captured before the move to `tinymcp`: exact protocol bytes and HTTP status/body/header behavior. A diff here is a wire change. `test_support.rs` is the one seam they call through. |
-| `crates/openhuman-core/src/mcp/server/tools_tests.rs` | Sibling `#[cfg(test)]` suite for `tools/` (via `#[path]`). |
+| [`crates/openhuman-core/src/mcp/server/tools/`](./tools/) | Tool catalog and dispatch: `mod.rs` (facade; re-exports `tinymcp::ToolCallError`), `types.rs` (`McpToolSpec` and the limit/tag constants, ungated so `McpToolSpec` is one real type in both builds), `specs.rs` (`tool_specs`/`base_tool_specs`/`tool_specs_for_loaded_config` builders and the `server_tool_spec` conversion), `params.rs` (OpenHuman's per-tool argument policy → RPC params, over `tinymcp::server::args`), `dispatch.rs` (`call_tool`/`list_tool_specs`, policy enforcement, subagent handlers). |
+| [`crates/openhuman-core/src/mcp/server/write_dispatch.rs`](./write_dispatch.rs) | Write/audit pipeline for `memory.learn`/`memory.forget`: config load, act-policy enforcement, RPC dispatch to `openhuman.memory_learn` / `openhuman.memory_forget`, audit-record write (success/rejection) via `crate::mcp::audit::record_write`, PII-redacting arg summaries. |
+| [`crates/openhuman-core/src/mcp/server/resources.rs`](./resources.rs) | Static `RESOURCE_CATALOG` of compile-time-embedded (`include_str!`) prompt markdown, served as `tinymcp::ResourceSpec`s and read by URI (`-32002` when unknown). Test cross-checks catalog vs `agent::agents::BUILTINS`. |
+| [`crates/openhuman-core/src/mcp/server/http.rs`](./http.rs) | OpenHuman's `run_http`/`run_http_reporting`: `tinymcp::run_http_reporting` bound to the handler. Gated on `all(feature = "mcp", feature = "http-server")`; `http-server` forwards `tinymcp/server-http`. |
+| [`crates/openhuman-core/src/mcp/server/local.rs`](./local.rs) | Lazily-started, process-wide in-process loopback HTTP MCP server (`ensure_local_http`, `LocalMcpEndpoint`). Lets the sandboxed `claude` subprocess (Claude Code provider) reach OpenHuman's memory/tools over loopback without the MCP server inheriting Claude Code's OS jail; a per-process random bearer token stops any other local process from talking to it. |
+| [`crates/openhuman-core/src/mcp/server/subagent_depth.rs`](./subagent_depth.rs) | Per-delegation-chain depth tracking for `agent.run_subagent`, propagated across the loopback MCP HTTP hop via the `X-OpenHuman-Subagent-Depth` header (read by `handler.rs` from `tinymcp`'s `RequestContext`) so nested Claude Code subagent calls are bounded without penalizing unrelated parallel callers. |
+| [`crates/openhuman-core/src/mcp/server/stdio.rs`](./stdio.rs) | CLI entry `run_stdio_from_cli` (arg parse: `--transport`/`--host`/`--port`/`--auth-token`/`-v`/`--help`), logging init, then `tinymcp::run_stdio` or `run_http` with the handler. |
+| [`crates/openhuman-core/src/mcp/server/stub.rs`](./stub.rs) | The `mcp`-less mirror of `run_stdio_from_cli`, `ensure_local_http`/`LocalMcpEndpoint`, and `tool_specs`: disabled-error / empty-catalog bodies so always-on callers (`core/cli.rs`, the Claude Code driver, [`tools/registry/ops.rs`](../../tools/registry/ops.rs)) keep a stable surface. |
+| [`crates/openhuman-core/src/mcp/server/wire_golden_tests.rs`](./wire_golden_tests.rs), `http_golden_tests.rs` | Golden wire fixtures captured before the move to `tinymcp`: exact protocol bytes and HTTP status/body/header behavior. A diff here is a wire change. [`test_support.rs`](./test_support.rs) is the one seam they call through. |
+| [`crates/openhuman-core/src/mcp/server/tools_tests.rs`](./tools_tests.rs) | Sibling `#[cfg(test)]` suite for `tools/` (via `#[path]`). |
## Public surface
@@ -60,12 +60,12 @@ This module exposes **no** registered core RPC methods (no `schemas.rs`, no cont
## Agent tools
-It does **not** own any agent tools in the `tools.rs`/`crates/openhuman-core/src/tools` sense. The "tools" here are **MCP-protocol tools** advertised to external clients:
+It does **not** own any agent tools in the `tools.rs`/[`crates/openhuman-core/src/tools`](../../tools/) sense. The "tools" here are **MCP-protocol tools** advertised to external clients:
- Read-only (`ToolOperation::Read`): `core.list_tools`, `core.tool_instructions`, `agent.list_subagents`, `memory.recall`, `memory.fetch`, `memory.list`, `web_search`, `web_answer`, `searxng_search` (listed only when a search provider can serve them; `crate::search::providers`).
- Act-policy (`ToolOperation::Act`): `agent.run_subagent` (annotated destructive/open-world), and `memory.learn` (annotated non-destructive, non-idempotent, local-only) and `memory.forget` (annotated destructive/idempotent, local-only).
-Argument bounds enforced in-layer: memory `limit` capped at `MEMORY_MAX_LIMIT` (100; rejected, not clamped); `memory.forget` capped at 100 ids; `filter` is validated field by field (MetaFilter of `docs/specs/memory-v2.md`); `memory.fetch` `mode` is one of keyword/vector/hybrid but must be supported by the active engine (both launch engines: `hybrid` only); `web_search` and `web_answer` `max_results` capped at `SEARCH_MAX_RESULTS` (20).
+Argument bounds enforced in-layer: memory `limit` capped at `MEMORY_MAX_LIMIT` (100; rejected, not clamped); `memory.forget` capped at 100 ids; `filter` is validated field by field (MetaFilter of [`docs/specs/memory-v2.md`](../../../../../docs/specs/memory-v2.md)); `memory.fetch` `mode` is one of keyword/vector/hybrid but must be supported by the active engine (both launch engines: `hybrid` only); `web_search` and `web_answer` `max_results` capped at `SEARCH_MAX_RESULTS` (20).
## Events
@@ -92,7 +92,7 @@ No `store.rs`. The only durable side effect is the **MCP write-audit log**, writ
## Used by
-- `crates/openhuman-core/src/core/cli.rs`: dispatches `mcp` / `mcp-server` subcommands to `run_stdio_from_cli`; the only production entry point for the stdio/HTTP transports. `crates/openhuman-core/src/platform/about_app/catalog_conversation_intelligence.rs` lists it as `intelligence.mcp_server`.
+- `crates/openhuman-core/src/core/cli.rs`: dispatches `mcp` / `mcp-server` subcommands to `run_stdio_from_cli`; the only production entry point for the stdio/HTTP transports. [`crates/openhuman-core/src/platform/about_app/catalog_conversation_intelligence.rs`](../../platform/about_app/catalog_conversation_intelligence.rs) lists it as `intelligence.mcp_server`.
- `crates/openhuman-core/src/inference/provider/claude_code/driver.rs`: calls `ensure_local_http` on each Claude Code turn to hand the sandboxed `claude` subprocess a loopback MCP endpoint.
- `crates/openhuman-core/src/tools/registry/ops.rs`: reads `McpToolSpec`/`tool_specs()` (via `crate::mcp::server::McpToolSpec`) to fold this server's advertised tools into the agent tool registry catalog.
- The other `mcp/` members (`mcp::host`, `mcp::registry`, `mcp::audit`) are siblings in the broader MCP feature set, not consumers of this server's code paths. `mcp::http_client` is a re-export module of `tinymcp`, used here only by the test-only `McpHttpClient` HTTP round-trip.