Skip to content

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

feat(tools): add rules tool module

Steven Enamakelc7d5f242d976
diff --git a/crates/openhuman-core/src/tools/rules/mod.rs b/crates/openhuman-core/src/tools/rules/mod.rs
new file mode 100644
index 0000000000..c7203191e5
--- /dev/null
+++ b/crates/openhuman-core/src/tools/rules/mod.rs
@@ -0,0 +1,27 @@
+//! OpenHuman's composition of tool rules.
+//!
+//! The vocabulary is [`tinytools::ToolRules`] and the enforcement is the
+//! tinyagents loop's tool gate (`RunPolicy::tool_rules`), which applies one
+//! rule set to the catalogue, `tool_search` and every call. This module only
+//! decides *which* rules a turn carries and in what context:
+//!
+//! - `[tool_rules]` in `config.toml` — the operator's global layer;
+//! - an agent definition's `disallowed_tools` (name globs) and `tool_rules`;
+//! - a sub-agent inherits its parent's layers and adds its own, so a child is
+//! never less restricted than the run that spawned it.
+//!
+//! Layers stack in a [`tinytools::ToolRuleSet`]: every layer must admit a
+//! tool, so adding one can only narrow.
+//!
+//! The context the rules' `when` conditions match is built by
+//! [`rule_context`]: `channel`, `agent` and `origin`.
+
+mod ops;
+
+pub use ops::{
+ agent_rule_layer, glob_list_matches, rule_context, session_rule_set, turn_rule_policy,
+};
+
+#[cfg(test)]
+#[path = "ops_tests.rs"]
+mod tests;