The fastest, cheapest, most efficient open-source agent harness. Run more than 500 agents on a $10 VPS.
Rust agent-orchestrationai-agentsai-assistantdesktopllmlocal-firstmcppersonal-aiprivacyrustsecond-braintauri
fix(agent): correct evaluator prompt to use proper triage context
Steven Enamakelb304196fb937
diff --git a/crates/openhuman-core/src/agent/library/ops_tests.rs b/crates/openhuman-core/src/agent/library/ops_tests.rsindex c7c4507f85..1e30e42845 100644--- a/crates/openhuman-core/src/agent/library/ops_tests.rs+++ b/crates/openhuman-core/src/agent/library/ops_tests.rs@@ -62,8 +62,6 @@ fn metadata_projection_omits_prompt_and_paths() {assert_eq!(display.direct_tool_count, 2);assert!(!display.uses_wildcard_tools);assert_eq!(display.subagent_ids, vec!["critic"]);- assert!(display.includes_profile);- assert!(!display.includes_memory_md);assert!(!display.includes_memory_context);assert!(display.can_run_as_user_facing_worker);assert!(!display.write_capable);diff --git a/crates/openhuman-core/src/agent/triage/evaluator/prompt.rs b/crates/openhuman-core/src/agent/triage/evaluator/prompt.rsindex b9d5c6e8f8..66b0830896 100644--- a/crates/openhuman-core/src/agent/triage/evaluator/prompt.rs+++ b/crates/openhuman-core/src/agent/triage/evaluator/prompt.rs@@ -14,7 +14,7 @@ pub(crate) fn extract_inline_prompt(def: &AgentDefinition) -> Option<String> {PromptSource::Inline(body) if !body.is_empty() => Some(body.clone()),PromptSource::Dynamic(build) => {use crate::agent::prompts::{- ConnectedIntegration, LearnedContextData, PromptContext, PromptTool, ToolCallFormat,+ ConnectedIntegration, PromptContext, PromptTool, ToolCallFormat,};let empty_tools: Vec<PromptTool<'_>> = Vec::new();let empty_integrations: Vec<ConnectedIntegration> = Vec::new();diff --git a/crates/openhuman-core/src/core/all.rs b/crates/openhuman-core/src/core/all.rsindex 959ef8b9f9..b5bd5f260b 100644--- a/crates/openhuman-core/src/core/all.rs+++ b/crates/openhuman-core/src/core/all.rs@@ -919,11 +919,10 @@ fn build_internal_only_controllers() -> Vec<GroupedController> {/// omitted. With no active context, or under `DomainSet::full()`, this returns/// the complete set (byte-identical to pre-#4796).pub fn all_registered_controllers() -> Vec<RegisteredController> {- let caps = crate::core::runtime::context::CoreContext::current_memory_capabilities();let view = registry_view();let found = view.iter()- .filter(|g| group_allowed(g.group) && capability_allowed_in(caps, g.capability))+ .filter(|g| group_allowed(g.group)).map(|g| g.controller.clone()).collect();found@@ -937,11 +936,10 @@ pub fn all_registered_controllers() -> Vec<RegisteredController> {/// [`all_registered_controllers`], so `/schema` omits gated namespaces/// automatically under `harness()`.pub fn all_controller_schemas() -> Vec<ControllerSchema> {- let caps = crate::core::runtime::context::CoreContext::current_memory_capabilities();let view = registry_view();let found = view.iter()- .filter(|g| group_allowed(g.group) && capability_allowed_in(caps, g.capability))+ .filter(|g| group_allowed(g.group)).map(|g| g.controller.schema.clone()).collect();found@@ -1090,91 +1088,6 @@ pub fn rpc_method_from_parts(namespace: &str, function: &str) -> Option<String>found}-/// The memory-driver capability family a controller's surface requires, looked-/// up in the **UNFILTERED** registry.-///-/// Returns `None` when no controller with that `(namespace, function)` is-/// registered anywhere — a genuine typo. Returns `Some(None)` when the-/// controller exists and is ungated, and `Some(Some(c))` when it exists and-/// needs family `c`.-///-/// The `Option<Option<_>>` is the whole point: it is what lets the CLI tell-/// "no such command" apart from "this command exists but the bound driver does-/// not advertise its family". Every *filtered* lookup ([`schema_for_rpc_method`],-/// [`all_controller_schemas`]) collapses those two into one absence, which is-/// correct for `/rpc` and for agent tools (`docs/specs/kernel.md` §3.3) and-/// wrong for a human at a terminal — the CLI is §3.3's one named exception.-///-/// Scoped to the agent-facing [`registry`] exactly like [`rpc_method_from_parts`],-/// the other lookup that backs CLI routing: an internal-only controller is not-/// CLI-invokable in any configuration, so reporting a capability fact for one-/// would name a cause that is not the reason the command is unavailable.-pub fn capability_for_parts(namespace: &str, function: &str) -> Option<Option<Capability>> {- let view = registry_view();- let found = view- .iter()- .find(|g| {- g.controller.schema.namespace == namespace && g.controller.schema.function == function- })- .map(|g| g.capability);- found-}--/// The memory-driver capability family required by an RPC method, looked up in-/// the **UNFILTERED** registry.-///-/// This is the method-name counterpart of [`capability_for_parts`]. The raw-/// `openhuman call --method …` CLI form has no namespace/function split, but-/// must still produce the CLI's configuration-fact diagnostic before it-/// dispatches a capability-gated method.-pub fn capability_for_rpc_method(method: &str) -> Option<Option<Capability>> {- let view = registry_view();- let found = view- .iter()- .find(|g| g.controller.rpc_method_name() == method)- .map(|g| g.capability);- found-}--/// The capability a whole namespace's surface requires, when every controller-/// in it agrees — looked up in the **UNFILTERED** registry.-///-/// `None` when the namespace does not exist at all, or when nothing in it is-/// gated, or when its controllers span more than one family. Used for the-/// unknown-namespace case: a namespace whose controllers are ALL gated on one-/// family disappears from the CLI's namespace list entirely, so there is no-/// function name left to look up.-///-/// Deliberately conservative — it reports a family only when that family is the-/// sole gate across the namespace, so a mixed namespace (like `memory`, which-/// spans four families plus host surface) yields `None` and falls back to the-/// ordinary unknown-namespace message rather than naming one family-/// misleadingly.-pub fn sole_capability_for_namespace(namespace: &str) -> Option<Capability> {- let mut found: Option<Capability> = None;- let mut any = false;- let view = registry_view();- for grouped in view- .iter()- .filter(|g| g.controller.schema.namespace == namespace)- {- any = true;- match (grouped.capability, found) {- // An ungated member means the namespace does not vanish wholesale- // because of one family, so naming one would be a lie.- (None, _) => return None,- (Some(c), None) => found = Some(c),- (Some(c), Some(prev)) if c == prev => {}- (Some(_), Some(_)) => return None,- }- }- if any {- found- } else {- None- }-}-/// Retrieves the schema for a specific RPC method.////// Checks both the agent-facing registry and the internal registry so that@@ -1188,18 +1101,12 @@ pub fn schema_for_rpc_method(method: &str) -> Option<ControllerSchema> {// call with bad params would return the controller's validation error// instead of method-not-found, leaking the hidden RPC surface. No ambient// context ⇒ `group_allowed` is `true` ⇒ unfiltered, identical to pre-#4796.- //- // The memory-capability gate (M5.2) rides here for exactly the same reason:- // a `memory_tree.*` method hidden because the bound driver never advertised- // `tree` must not leak back out through a param-validation error.let view = registry_view();let found = view.iter().chain(internal_registry().iter()).find(|g| {- g.controller.rpc_method_name() == method- && group_allowed(g.group)- && capability_allowed(g.capability)+ g.controller.rpc_method_name() == method && group_allowed(g.group)}).map(|g| g.controller.schema.clone());found@@ -1445,17 +1352,6 @@ pub async fn try_invoke_registered_rpc(return None;}- // Memory-capability gate (M5.2). Deliberately a SECOND block rather than a- // clause folded into the check above, so the two gates log distinguishably:- // an operator seeing an absent `memory_tree.*` needs to know whether it was- // the DomainSet or the bound driver's advertised capability set.- if !capability_allowed(grouped.capability) {- log::debug!(- "[rpc][capability-gate] method '{method}' suppressed — memory capability {:?} not advertised by the bound driver",- grouped.capability- );- return None;- }let handler = grouped.controller.handler;// Establish the ambient CoreContext for the duration of the handler sodiff --git a/crates/openhuman-core/src/flows/README.md b/crates/openhuman-core/src/flows/README.mdindex afba01b25c..248cd2944d 100644--- a/crates/openhuman-core/src/flows/README.md+++ b/crates/openhuman-core/src/flows/README.md@@ -35,7 +35,7 @@ from always-compiled code.## Public surface- `pub mod ops` (split into submodules under `ops/`, e.g. `ops/execution.rs`, `ops/resume.rs`, `ops/builder.rs`, `ops/triggers.rs`, `ops/drafts.rs`, `ops/discovery.rs`, `ops/wiring_warnings.rs`, `ops/inference_readiness.rs`), CRUD (`flows_create/get/list/update/delete/duplicate/import/validate`), revision history (`flows_get_history`, `flows_rollback`), run lifecycle (`flows_run`, `flows_run_detached`, `flows_resume`, `flows_cancel_run`, `flows_list_runs`, `flows_list_all_runs`, `flows_get_run`, `flows_prune_runs`), `flows_set_enabled` (only `schedule` triggers need an enable-time binding, `cron::add_flow_schedule_job` / `cron::remove_job`; `app_event` flows are matched at dispatch time against enabled flows, and `webhook` binding is logged as not implemented), builder (`flows_build`, `flows_build_cancel`, `flows_search_tool_catalog`, `flows_get_tool_contract`, `flows_list_connections`, `flows_required_connections`, `flows_approval_manifest`), discovery (`flows_discover`, `flows_list_suggestions`, `flows_dismiss_suggestion`, `flows_mark_suggestion_built`), drafts (`flows_draft_create/get/update/list/delete/promote`), and boot/periodic reconciliation (`sweep_orphaned_running_runs_on_boot`, `reconcile_schedule_triggers_on_boot`, `sweep_expired_parked_runs`).-- `pub mod bus` (split into `bus/trigger.rs`, `bus/run_digest.rs`, `bus/dedup_commit.rs`), three subscribers, all constructed in `core/runtime/subscribers.rs`: `FlowTriggerSubscriber` (the trigger → run bridge: `DomainEvent::FlowScheduleTick` and `ComposioTriggerReceived` are matched against enabled flows' trigger nodes and spawn `ops::flows_run`; `WebhookIncomingRequest` is observed and logged only, webhook dispatch is not implemented), `FlowRunDigestSubscriber` (on a successful `FlowRunFinished`, writes a run digest into the flow's private memory namespace), and `DedupCommitSubscriber` (on `FlowRunFinished`, commits or rolls back every `dedup` node's tentative key set). `extract_trigger_kind` / `extract_trigger_config` are reused by `ops` to decide what `flows_set_enabled` and `flows_update` must bind or rebind.+- `pub mod bus` (split into `bus/trigger.rs`, `bus/run_digest.rs`, `bus/dedup_commit.rs`), three subscribers, all constructed in `core/runtime/subscribers.rs`: `FlowTriggerSubscriber` (the trigger → run bridge: `DomainEvent::FlowScheduleTick` and `ComposioTriggerReceived` are matched against enabled flows' trigger nodes and spawn `ops::flows_run`; `WebhookIncomingRequest` is observed and logged only, webhook dispatch is not implemented), `FlowRunDigestSubscriber` (on a successful `FlowRunFinished`, stores a run digest document tagged `flow:<id>` + `flow_run_digest`, keeping the newest 50 per flow), and `DedupCommitSubscriber` (on `FlowRunFinished`, commits or rolls back every `dedup` node's tentative key set). `extract_trigger_kind` / `extract_trigger_config` are reused by `ops` to decide what `flows_set_enabled` and `flows_update` must bind or rebind.- `pub mod catalogue`: lists saved flows as `Workflow` entries with `WorkflowScope::Flow` in the shared skill catalogue, so `skill_search` sees one list instead of skills and flows separately.- `pub mod node_contracts`: host overlay on `tinyflows::catalog`'s node-kind contracts: attaches host-specific facts (which `tool_call` slugs resolve to Composio vs. native `oh:` tools, which trigger kinds actually dispatch here) without touching the portable contracts. Re-exports `all_node_kind_contracts`, `node_kind_contract`, `NODE_KINDS`, `ConfigField`, `PortSpec`, `NodeKindContract`.- `mod store` / `mod draft_store` (private), bind `tinyflows_sqlite::flows` / `tinyflows_sqlite::drafts` to `<workspace_dir>/flows`; `kv_get`, `kv_set`, and `upsert_flow_run_step` are re-exported from `store` (the `StateStore` seam is `tinyflows_sqlite::flows::SqliteStateStore`) and the run observer.@@ -43,7 +43,7 @@ from always-compiled code.- `pub mod tools`: `ProposeWorkflowTool`, `RunFlowTool`. All 27 tool structs below are re-exported by glob from `crates/openhuman-core/src/tools/mod.rs` and pushed onto the agent tool list in `tools/ops.rs` under `#[cfg(feature = "flows")]`.- `pub mod builder_tools` (split into submodules under `builder_tools/`: `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`), the authoring toolset: `ReviseWorkflowTool`, `EditWorkflowTool`, `ValidateWorkflowTool`, `GetFlowHistoryTool`, `ListFlowRunsTool`, `ResumeFlowRunTool`, `CancelFlowRunTool`, `CreateWorkflowTool`, `DuplicateFlowTool`, `ListConnectableToolkitsTool`, `ListFlowsTool`, `GetFlowTool`, `GetFlowRunTool`, `ListFlowConnectionsTool`, `SearchToolCatalogTool`, `GetToolContractTool`, `GetToolOutputSampleTool`, `ListAgentDefinitionsTool`, `ListNodeKindsTool`, `GetNodeKindContractTool`, `DryRunWorkflowTool`, `SaveWorkflowTool`.- `pub mod discovery_tools`: `SuggestWorkflowsTool`.-- `pub mod memory_tools`: `FlowMemoryRecallTool`, `FlowMemoryRememberTool`, plus `flow_namespace` / `FLOW_MEMORY_NAMESPACE_PREFIX` / `cross_flow_recall` (re-exported from `mod.rs` because the tinyflows `memory` node's `OpenHumanMemory` adapter needs byte-identical `scope: "flows"` results).+- `pub mod memory_tools`: `FlowMemoryRecallTool`, `FlowMemoryRememberTool`, plus the flow-memory tag helpers (`flow_tag`, `flow_key_tag`, `flow_meta`, `flow_filter`, `cross_flow_filter`, `remember_keyed`, `forget_matching`, `FLOWS_TAG`) re-exported from `mod.rs` so the digest subscriber, `flows_delete` and the `OpenHumanMemory` adapter tag identically. Memory v2 has no namespaces: a flow's memory is the items tagged `flow:<id>`.- `pub mod agents`: first-class built-in sub-agents: `workflow_builder` (authoring copilot) and `flow_discovery` (read-only suggestion scout); their `agent.toml` and `prompt::build` are referenced by path from the `BUILTINS` slice in `agent/registry/agents/loader.rs`.- `pub mod skills` (needs both `flows` and `skills` features), registers the portable `tinyflows-copilot` `flow-authoring` manual with OpenHuman's native skill runtime.- `pub mod tinyflows`: the capability seam (`caps/`) implementing `tinyflows`'s traits over real OpenHuman services, plus `observability.rs` (`FlowRunObserver`), `memory_adapter.rs` (`OpenHumanMemory`), and `langfuse_export.rs`. Has its own [README](tinyflows/README.md).@@ -55,7 +55,7 @@ from always-compiled code.- `crates/openhuman-core/src/agent/tinyagents/`: message/tool-call/usage conversions used by the `llm` and `prompt` capabilities; `agent` nodes pass an explicit run context into nested harness turns through the `agent` capability (`tinyflows/caps/agent.rs`).- `crates/openhuman-core/src/cron/`: `add_flow_schedule_job` arms a schedule-triggered flow as a `JobType::Flow` cron job; the scheduler fires it by publishing `DomainEvent::FlowScheduleTick`, which `bus::FlowTriggerSubscriber` picks up.- `crates/openhuman-core/src/skills/`: the `Workflow` / `WorkflowScope` catalogue types used by `catalogue.rs`, and the native `BundledSkill` mechanism that exposes the portable `tinyflows-copilot` authoring manual.-- `crates/openhuman-core/src/memory/`: `memory_tools`/`tinyflows::memory_adapter` read/write agent memory under the `flows` scope.+- `crates/openhuman-core/src/memory/`: `memory_tools`, `bus::run_digest`, `ops::flows_delete` and `tinyflows::memory_adapter` read/write memory v2 through `memory::ops` with `flow:<id>` / `flows` tag filters.## Called by@@ -67,7 +67,7 @@ from always-compiled code.## Tests-- `tinyflows/` has its own suite: `memory_adapter_tests.rs`, `memory_node_e2e_tests.rs`, `observability_tests.rs`, `langfuse_export_tests.rs`, `tinyflows_tests.rs`, and `caps/*_tests.rs`.+- `tinyflows/` has its own suite: `memory_adapter_tests.rs`, `observability_tests.rs`, `langfuse_export_tests.rs`, `tinyflows_tests.rs`, and `caps/*_tests.rs`.- Not compiled: `store.rs` has no test attachment; it is a leftover from moving the model and store into `tinyflows-catalog` / `tinyflows-sqlite`. (`types_tests.rs` was removed: `flows::types` is `tinyflows_catalog::types`, whose own suite covers it.)## Related docsdiff --git a/crates/openhuman-core/src/flows/tinyflows/README.md b/crates/openhuman-core/src/flows/tinyflows/README.mdindex d02e61b8dc..d3e1e13277 100644--- a/crates/openhuman-core/src/flows/tinyflows/README.md+++ b/crates/openhuman-core/src/flows/tinyflows/README.md@@ -63,8 +63,12 @@ security model); this README covers only the host seam.pair as the other acting adapters (`CommandClass::Read` for`recall`/`search`/`flavour`/`people`, `CommandClass::Write` for`remember`/`forget`); `remember`/`forget` hard-refuse any scope other than- `"flow"`, and `scope: "flow"` shares the `flow_namespace` the- `flow_memory_*` agent tools use.+ `"flow"`. Scopes are memory v2 tag filters: `user` reads everything,+ `flow` reads the run's own `flow:<id>` items, `flows` reads every flow's+ items (tag `flows`) — the same tags the `flow_memory_*` agent tools use.+ `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:`FlowRunObserver`, which persists livesteps via `flows::upsert_flow_run_step` and publishes@@ -100,7 +104,6 @@ new origin wrapper.`tinyflows_tests.rs` (capability-seam smoke tests against the real engine;note the real `HttpRequestTool` blocks loopback, so HTTP coverage asserts theSSRF/allowlist rejections rather than a mock round-trip),-`memory_node_e2e_tests.rs` (the `memory` node through the real engine,-adapter, and on-disk store; kept apart from `tinyflows_tests.rs` because the-unit tests only exercise error paths against an empty workspace), plus a-`<module>_tests.rs` file beside most modules above.+`memory_adapter_tests.rs` (the `memory` node adapter against an in-memory+reference engine), plus a `<module>_tests.rs` file beside most modules+above.