Skip to content

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

docs: add README files for core modules and update building guide

Steven Enamakel9ebf13ca5a6e
diff --git a/crates/openhuman-core/src/agent/session_host/README.md b/crates/openhuman-core/src/agent/session_host/README.md
new file mode 100644
index 0000000000..f3c3b48483
--- /dev/null
+++ b/crates/openhuman-core/src/agent/session_host/README.md
@@ -0,0 +1,64 @@
+# Session host
+
+`OpenHumanSessionHost` is the stateful entry point for a chat turn: the single
+execution tier that the `channels`, `local_ai`, and `cron` layers call when a
+conversation needs to make progress. It is a product shell over TinyAgents,
+not a second implementation of the agent loop. `tinyagents_runtime::Session`
+owns generic history, raw transcript reconciliation, prefix stability, tool
+snapshots, resume, and persistence; this module supplies the model and tool
+execution, the product transcript dialect, prompt policy, and the hooks that
+run after each turn commits.
+
+## Layout
+
+| File | Role |
+| --- | --- |
+| `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()` |
+| `runtime/` | Public accessors, `run_single`, `run_interactive` |
+| `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 |
+
+Import `OpenHumanSessionHost` and `SessionHostBuilder` from `crate::agent`,
+which re-exports them from here. The child files are an implementation
+detail.
+
+## Sessions and resume
+
+A conversation's durable identity is `tinyagents_session::transcript::SessionRef`,
+derived from the thread id and the agent id, with no timestamp in the stem,
+so one conversation always resolves to the same file. `session_api.rs` binds
+that identity with `set_thread_id` and resumes with `ResumeMode::Session`; it
+does not mint stems, seed history by hand, or pick a transcript by recency.
+
+A resumed session's prompt and tool list are frozen: both were recorded on
+the transcript, and restoring them verbatim is what keeps the provider's
+prefix cache warm across a restart. `recorded_tools.rs` exists because of
+that freeze: it turns previously recorded Composio actions back into
+deferred executors instead of dropping them when a cache goes cold, and
+`prelude_integrations.rs` re-fetches integrations on the first turn of every
+session instance rather than only on a brand-new thread.
+
+Compaction never erases history. It seals the current generation and opens
+the next one, recording the sealed generation as the new one's parent; the
+sealed file stays on disk, and `session_api.rs` is what lets a caller list a
+long conversation's generations without reading the whole chain.
+
+## Where next
+
+- `crate::agent::tinyagents::host` for the run-context type this module
+ 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
+ module wraps rather than reimplements.
diff --git a/crates/openhuman-core/src/modules/README.md b/crates/openhuman-core/src/modules/README.md
index d4d73c7d4e..5faec60d83 100644
--- a/crates/openhuman-core/src/modules/README.md
+++ b/crates/openhuman-core/src/modules/README.md
@@ -55,7 +55,7 @@ layer.
## Loading pipeline
1. `registry::find(id)` looks up the compiled-in `ModuleRecord`.
-2. `resolution::table().claim(id)` gives the caller `Run`, `Wait`, or `Done` —
+2. `resolution::table().claim(id)` gives the caller `Run`, `Wait`, or `Done`:
the first caller for a module resolves it as a process-lifetime task;
everyone else waits on a watch channel (`ops.rs`).
3. Resolution order is cheapest first: already serving on the host's broker,
diff --git a/crates/openhuman-core/src/platform/proc_metrics/README.md b/crates/openhuman-core/src/platform/proc_metrics/README.md
index 8b344587cf..027c26d0ee 100644
--- a/crates/openhuman-core/src/platform/proc_metrics/README.md
+++ b/crates/openhuman-core/src/platform/proc_metrics/README.md
@@ -39,8 +39,8 @@ budget and CI-gate ceiling for the embedded agent roster (#5046).
## Process trees
-`sample_tree` (in `tree.rs`) measures a process *and all of its descendants*
-— the interpreter children a skill run or shell tool spawns: returning a
+`sample_tree` (in `tree.rs`) measures a process and all of its descendants,
+the interpreter children a skill run or shell tool spawns, returning a
`TreeSample` (`self_sample`, `children: Vec<ChildSample>`, `tree_rss_kib`).
Descendant lookups that fail (a child that raced away, a permission error)
are skipped with a stderr note rather than aborting the sample.
diff --git a/crates/openhuman-core/src/security/approval/README.md b/crates/openhuman-core/src/security/approval/README.md
index 1d76124033..63b4569f34 100644
--- a/crates/openhuman-core/src/security/approval/README.md
+++ b/crates/openhuman-core/src/security/approval/README.md
@@ -20,7 +20,7 @@ Interactive approval workflow for supervised mode (issue #1339). `ApprovalGate`
| `crates/openhuman-core/src/security/approval/mod.rs` | Export-focused: module docstring, `pub mod` decls, `pub use` re-exports including the controller-schema pair. |
| `crates/openhuman-core/src/security/approval/gate.rs` | `ApprovalGate` struct + `DecideMiss`, `DEFAULT_APPROVAL_TTL` (10 minutes) and the shorter `COPILOT_APPROVAL_TTL`, the `ApprovalChatContext` / `FlowRunContext` task-locals, `parse_approval_reply`, and the `ApprovalGateBootState` record. |
| `crates/openhuman-core/src/security/approval/gate_setup.rs` (`include!`d by `gate.rs`, as are the next two) | `ApprovalGate::init_global`/`try_global` (process-global install, re-install-safe) and the private constructor. |
-| `crates/openhuman-core/src/security/approval/gate_intercept.rs` | `intercept`/`intercept_audited`/`intercept_audited_bounded` — the origin check, allowlist short-circuit, persist-and-park flow, and cancellation-safe bounded park used by the Flow Canvas copilot live-run path. |
+| `crates/openhuman-core/src/security/approval/gate_intercept.rs` | `intercept`/`intercept_audited`/`intercept_audited_bounded`: the origin check, allowlist short-circuit, persist-and-park flow, and cancellation-safe bounded park used by the Flow Canvas copilot live-run path. |
| `crates/openhuman-core/src/security/approval/gate_state.rs` | `decide` (resolves the parked future, emits `ApprovalDecided`), `classify_decide_miss`, `record_execution` (best-effort terminal audit row), `list_pending`/`list_recent_decisions`, the flow-trust helpers, and the thread→request routing lookups. |
| `crates/openhuman-core/src/security/approval/store.rs` | SQLite persistence (`pending_approvals` table). `insert_pending`, `decide`, `get_decision`, `record_execution`, `list_pending`, `list_recent_decisions`, `purge_session`, `expire_stale`, plus idempotent column migration for the v1 schema. |
| `crates/openhuman-core/src/security/approval/types.rs` | Serde domain types: `PendingApproval`, `ApprovalAuditEntry`, `ApprovalDecision`, `GateOutcome`, `ExecutionOutcome`. |
@@ -45,7 +45,7 @@ Namespace `approval` (registered via `all_approval_registered_controllers`, cons
| Method | Inputs | Output |
| --- | --- | --- |
-| `approval.list_pending` | — | `pending: PendingApproval[]` |
+| `approval.list_pending` | none | `pending: PendingApproval[]` |
| `approval.list_recent_decisions` | `limit?: u64` (1-500, default 50) | `decisions: ApprovalAuditEntry[]` |
| `approval.get_gate_state` | — | `state: ApprovalGateBootState` (installed / disabled-by-env / override-ignored / host tag) |
| `approval.decide` | `request_id: string`, `decision: string` (`approve_once` / `approve_always_for_tool` / `approve_always_for_flow` / `deny`) | `decided: PendingApproval` |
diff --git a/gitbooks/developing/building-rust-core.md b/gitbooks/developing/building-rust-core.md
index 8bc010ae8d..6ed19e554c 100644
--- a/gitbooks/developing/building-rust-core.md
+++ b/gitbooks/developing/building-rust-core.md
@@ -72,7 +72,7 @@ copy nested under `vendor/tinyagents/`.
git submodule update --init --recursive vendor/
```
-Desktop/Tauri work has extra requirements on top of this — follow [Getting
+Desktop/Tauri work has extra requirements on top of this: follow [Getting
Set Up](getting-set-up.md) for those.
## 3. Build commands
@@ -119,7 +119,7 @@ on Linux, lld on macOS) can cut a large slice off every incremental relink.
opt-in, but the easiest path is:
```bash
-# installs mold/lld detection into $CARGO_HOME/config.toml — never the
+# installs mold/lld detection into $CARGO_HOME/config.toml, never the
# repo's tracked .cargo/config.toml, so it's a per-machine opt-in
scripts/dev-setup-linker.sh