Skip to content

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

chore: checkpoint agent runtime migration before upstream merge

Steven Enamakel8ea13167ec50
diff --git a/.github/workflows/ci-lite.yml b/.github/workflows/ci-lite.yml
index ce180da498..381f26da36 100644
--- a/.github/workflows/ci-lite.yml
+++ b/.github/workflows/ci-lite.yml
@@ -153,6 +153,8 @@ jobs:
- 'scripts/ci/assert-coverage-presence.sh'
- 'scripts/ci/coverage-presence-allowlist.txt'
- 'scripts/ci/check-openhuman-rust-layout.mjs'
+ - 'scripts/ci/check-agent-runtime-boundary.mjs'
+ - 'scripts/ci/agent-runtime-boundary-baseline.json'
- 'scripts/ci/list-feature-gated-rust-tests.mjs'
- 'Cargo.toml'
- 'crates/openhuman-core/**'
@@ -431,6 +433,10 @@ jobs:
if: needs.changes.outputs['rust-core'] == 'true'
run: node scripts/ci/check-openhuman-rust-layout.mjs
+ - name: Enforce agent runtime ownership boundary
+ if: needs.changes.outputs['rust-core'] == 'true'
+ run: pnpm agent:runtime-boundary
+
- name: Enforce Linux TLS dependency policy
if: needs.changes.outputs['rust-core'] == 'true' || needs.changes.outputs['rust-tauri'] == 'true'
run: bash scripts/check-linux-tls-dependencies.sh
diff --git a/.sdd-progress.md b/.sdd-progress.md
new file mode 100644
index 0000000000..a9ea0fc559
--- /dev/null
+++ b/.sdd-progress.md
@@ -0,0 +1,32 @@
+Objective: migrate host-independent agent runtime/helpers into TinyAgents family with direct imports and no compatibility shims.
+Base: migrate-inference-to-tinyinference @ 8c90600688a143e8bd377a2296db5d626bea5095
+Plan: docs/plans/migrate-agent-runtime-to-tinyagents.md
+Spec: docs/specs/agent-runtime-upstream-boundary.md
+
+Audit: complete (OpenHuman agent tree + TinyAgents/TinyTools/TinyInference capabilities reviewed).
+Documentation: complete (boundary spec + executable plan + helper packages + ownership waves; final review PASS with no findings).
+Wave 2 preflight: complete (central integrator ownership, context/tool handoff, and context-led registry/graph conversion reviewed read-only).
+Task -1: complete (git_attribution removed; focused behavioral Git-hardening test passed; re-review spec PASS and quality PASS with no findings).
+Task 0: complete (455 exact line-sensitive violations; checker scans all OpenHuman crates and TinyAgents facades; locked vendored test 5/5; Terra re-review spec PASS and quality PASS).
+Task 1: in progress (TinyTools leaf complete and Terra-reviewed at 7a40010; ready upstream PR #6 updated and local per-file coverage green; TinyAgents consumers remain).
+Task 2: pending.
+Task 3: in progress (TinyInference leaf complete and Terra-reviewed with no findings at 6ffab82; ready upstream PR #13; TinyAgents consumers remain).
+Task 4: pending.
+Task 5: pending.
+Task 6: pending.
+Task 7: pending.
+Task 8: pending.
+Task 9: pending.
+Task 10: pending.
+Task 11: pending.
+Task 12: pending.
+
+Decisions:
+- Direct imports only; no forwarding modules, type aliases, or compatibility re-exports for migrated APIs.
+- OpenHuman keeps product policy, security, durable wire formats, persistence, RPC/UI projection, configuration, and concrete host adapters.
+- Do not add tinyagents-inspect in this migration; diagnostics remain a later independently justified extraction.
+- Specialized tdd-implementer/code-reviewer roles were unavailable; use scoped worker agents and read-only explorer reviewers while preserving the same implementation/review gates.
+
+Wave 1 bases:
+- TinyTools: 1eb3dade18b56c67dacbe16ae92ce42b0a097b7a
+- TinyInference: 6db1968d1463791e1823c808808da64b9579b8fc
diff --git a/crates/openhuman-core/src/agent/README.md b/crates/openhuman-core/src/agent/README.md
index 38f1c69ec4..aba51c0e53 100644
--- a/crates/openhuman-core/src/agent/README.md
+++ b/crates/openhuman-core/src/agent/README.md
@@ -26,7 +26,6 @@ Multi-agent orchestration domain. Owns the LLM tool-calling loop, sub-agent disp
| `debug/` | Renders the exact system prompt a live session would see for a given agent, via `Agent::from_config_for_agent` |
| `experience/` | Local procedural operating experience capture for self-learning ([README](experience/README.md)) |
| `file_state/` | Process-wide read/write stamps so parallel sub-agents and worker threads detect stale file contents before writing |
-| `git_attribution/` (`pub(crate)`) | Temporary `prepare-commit-msg` hook that appends OpenHuman's co-author trailer to agent-made commits |
| `harness/` | `Agent`/`AgentBuilder`, session lifecycle, sub-agent runner, definitions, fork context — the tool-calling loop itself ([README](harness/README.md)) |
| `harness_init/` | One-time first-run provisioning (Python/spaCy/Kompress/Node) before the harness can run ([README](harness_init/README.md)) |
| `learning/` | Reflection, tool-outcome tracking, user-profile inference from transcripts ([README](learning/README.md)) |
diff --git a/crates/openhuman-core/src/agent/git_attribution/git_attribution_tests.rs b/crates/openhuman-core/src/agent/git_attribution/git_attribution_tests.rs
deleted file mode 100644
index 8c673ef378..0000000000
--- a/crates/openhuman-core/src/agent/git_attribution/git_attribution_tests.rs
+++ /dev/null
@@ -1,202 +0,0 @@
-#[cfg(unix)]
-#[test]
-fn hook_adds_openhuman_trailer_without_disabling_repository_hook() {
- use std::os::unix::fs::PermissionsExt;
- use std::process::Command;
-
- let temp = tempfile::tempdir().unwrap();
- let repo = temp.path().join("repo");
- std::fs::create_dir(&repo).unwrap();
- let git = |args: &[&str]| {
- let output = Command::new("git")
- .args(args)
- .current_dir(&repo)
- .output()
- .unwrap();
- assert!(
- output.status.success(),
- "git {args:?}: {}",
- String::from_utf8_lossy(&output.stderr)
- );
- };
- git(&["init", "-q"]);
- git(&["config", "user.name", "Test"]);
- git(&["config", "user.email", "[email protected]"]);
- let own_hook = repo.join(".git/hooks/prepare-commit-msg");
- std::fs::write(
- &own_hook,
- "#!/bin/sh\nprintf 'repo-hook-ran\\n' >> \"$1\"\n",
- )
- .unwrap();
- std::fs::set_permissions(&own_hook, std::fs::Permissions::from_mode(0o755)).unwrap();
- std::fs::write(repo.join("a"), "a").unwrap();
- git(&["add", "a"]);
-
- let hook_env = super::hook::test_hook_env(Some(std::ffi::OsStr::new(
- "'test.openhuman-inherited'='kept' 'core.hooksPath'='/definitely-not-the-openhuman-hook'",
- )));
- let output = Command::new("git")
- .args(["commit", "-q", "-m", "subject"])
- .current_dir(&repo)
- .envs(&hook_env)
- .output()
- .unwrap();
- assert!(
- output.status.success(),
- "{}",
- String::from_utf8_lossy(&output.stderr)
- );
- let output = Command::new("git")
- .args(["log", "-1", "--format=%B"])
- .current_dir(&repo)
- .output()
- .unwrap();
- let message = String::from_utf8(output.stdout).unwrap();
- assert!(message.contains("repo-hook-ran"), "{message:?}");
- assert!(message.contains(super::hook::TRAILER), "{message:?}");
-
- let inherited = Command::new("git")
- .args(["config", "--get", "test.openhuman-inherited"])
- .current_dir(&repo)
- .envs(&hook_env)
- .output()
- .unwrap();
- assert!(inherited.status.success());
- assert_eq!(String::from_utf8(inherited.stdout).unwrap().trim(), "kept");
-}
-
-#[cfg(unix)]
-#[test]
-fn hook_env_does_not_drop_inherited_parameters_containing_non_utf8() {
- use std::os::unix::ffi::{OsStrExt, OsStringExt};
-
- let inherited_bytes = b"'test.openhuman-inherited'='before-\xff-after' 'test.second'='kept'";
- let inherited = std::ffi::OsStr::from_bytes(inherited_bytes);
- let hook_env = super::hook::test_hook_env(Some(inherited));
- let parameters = hook_env
- .get(std::ffi::OsStr::new("GIT_CONFIG_PARAMETERS"))
- .unwrap()
- .clone()
- .into_vec();
-
- assert!(parameters.starts_with(inherited_bytes));
- assert_eq!(parameters[inherited_bytes.len()], b' ');
- assert!(parameters[inherited_bytes.len() + 1..].starts_with(b"'core.hooksPath'='"));
- assert!(parameters.contains(&0xff));
-
- let output = std::process::Command::new("git")
- .args(["config", "--get", "test.openhuman-inherited"])
- .envs(&hook_env)
- .output()
- .unwrap();
- assert!(
- output.status.success(),
- "{}",
- String::from_utf8_lossy(&output.stderr)
- );
- assert_eq!(output.stdout, b"before-\xff-after\n");
-}
-
-/// A repository-set command-valued key must not reach a shell-spawned `git`.
-///
-/// `core.fsmonitor` is the probe because it is the one entry of the family
-/// that git actually executes with stdout piped: `core.pager` and
-/// `core.editor` are skipped without a terminal, so a test built on either
-/// would pass whether or not the hardening existed. `git status` runs the
-/// fsmonitor program, the repository config is agent-writable, and the
-/// program is arbitrary — which is the whole shape of the hole.
-///
-/// The assertion is on behaviour, not on the env var: a test that only checked
-/// `GIT_CONFIG_PARAMETERS` contained the right string would pass just as
-/// happily if git ignored it.
-#[cfg(unix)]
-#[test]
-fn a_repository_fsmonitor_does_not_run_under_the_shell_git_environment() {
- use std::os::unix::fs::PermissionsExt;
- use std::process::Command;
-
- let temp = tempfile::tempdir().unwrap();
- let repo = temp.path().join("repo");
- std::fs::create_dir(&repo).unwrap();
- let marker = temp.path().join("fsmonitor-ran");
-
- let git = |args: &[&str]| {
- let output = Command::new("git")
- .args(args)
- .current_dir(&repo)
- .output()
- .unwrap();
- assert!(
- output.status.success(),
- "git {args:?}: {}",
- String::from_utf8_lossy(&output.stderr)
- );
- };
- git(&["init", "-q"]);
- git(&["config", "user.name", "Test"]);
- git(&["config", "user.email", "[email protected]"]);
- std::fs::write(repo.join("a"), "a").unwrap();
-
- // An "fsmonitor" that records that it was executed at all. Exiting
- // non-zero makes git fall back to a normal scan, so `git status` still
- // succeeds either way and the marker is the only signal.
- let hook = temp.path().join("fsmonitor.sh");
- std::fs::write(
- &hook,
- format!("#!/bin/sh\ntouch '{}'\nexit 1\n", marker.display()),
- )
- .unwrap();
- std::fs::set_permissions(&hook, std::fs::Permissions::from_mode(0o755)).unwrap();
- git(&["config", "core.fsmonitor", hook.to_str().unwrap()]);
-
- // Baseline: without the hardening the repository's program really does
- // run, so the assertion below is discriminating rather than vacuous.
- let bare = Command::new("git")
- .args(["status", "--porcelain"])
- .current_dir(&repo)
- .output()
- .unwrap();
- assert!(bare.status.success());
- assert!(
- marker.exists(),
- "the fixture fsmonitor never ran, so this test proves nothing"
- );
- std::fs::remove_file(&marker).unwrap();
-
- // Now with the environment the shell tool hands every command.
- let hook_env = super::hook::test_hook_env(None);
- let mut cmd = Command::new("git");
- cmd.args(["status", "--porcelain"]).current_dir(&repo);
- for (key, value) in &hook_env {
- cmd.env(key, value);
- }
- let output = cmd.output().unwrap();
- assert!(
- output.status.success(),
- "git status failed under the shell git environment: {}",
- String::from_utf8_lossy(&output.stderr)
- );
- assert!(
- !marker.exists(),
- "the repository's core.fsmonitor ran under the shell git environment"
- );
-}
-
-/// The shell environment must not silently sign commits with the host's key.
-#[cfg(unix)]
-#[test]
-fn the_shell_git_environment_forces_commit_signing_off() {
- let env = super::hook::test_hook_env(None);
- let parameters = env
- .get(std::ffi::OsStr::new("GIT_CONFIG_PARAMETERS"))
- .expect("the shell git environment sets GIT_CONFIG_PARAMETERS")
- .to_string_lossy()
- .into_owned();
- for expected in crate::tools::implementations::filesystem::SHELL_NEUTRALISED_CONFIG {
- let (key, value) = expected.split_once('=').unwrap();
- assert!(
- parameters.contains(&format!("'{key}'='{value}'")),
- "`{expected}` is missing from GIT_CONFIG_PARAMETERS: {parameters}"
- );
- }
-}
diff --git a/crates/openhuman-core/src/agent/git_attribution/hook.rs b/crates/openhuman-core/src/agent/git_attribution/hook.rs
deleted file mode 100644
index e002f48d68..0000000000
--- a/crates/openhuman-core/src/agent/git_attribution/hook.rs
+++ /dev/null
@@ -1,162 +0,0 @@
-use std::collections::HashMap;
-#[cfg(unix)]
-use std::ffi::{OsStr, OsString};
-#[cfg(unix)]
-use std::path::PathBuf;
-#[cfg(unix)]
-use std::sync::OnceLock;
-
-/// OpenHuman's commit trailer.
-pub const TRAILER: &str = "Co-authored-by: OpenHuman <[email protected]>";
-
-#[cfg(unix)]
-const HOOKS: &[&str] = &[
- "applypatch-msg",
- "pre-applypatch",
- "post-applypatch",
- "pre-commit",
- "pre-merge-commit",
- "prepare-commit-msg",
- "commit-msg",
- "post-commit",
- "pre-rebase",
- "post-checkout",
- "post-merge",
- "pre-push",
- "post-rewrite",
- "pre-auto-gc",
- "push-to-checkout",
- "reference-transaction",
- "sendemail-validate",
- "post-index-change",
-];
-
-#[cfg(unix)]
-const SHIM: &str = r#"#!/bin/sh
-# OpenHuman hook shim. Delegate to the repository hook before attributing.
-hook_name=$(basename "$0")
-self_dir=$(CDPATH= cd -- "$(dirname -- "$0")" && pwd)
-# Suppress only our injected config while resolving the repository's configured
-# hook path. A project may intentionally set core.hooksPath away from .git/hooks.
-orig_dir=$(GIT_CONFIG_COUNT=0 GIT_CONFIG_PARAMETERS= git config --path --get core.hooksPath 2>/dev/null)
-if [ -z "$orig_dir" ]; then
- orig_dir=$(GIT_CONFIG_COUNT=0 GIT_CONFIG_PARAMETERS= git rev-parse --git-path hooks 2>/dev/null)
-fi
-if [ -n "$orig_dir" ] && [ "$orig_dir" != "$self_dir" ] && [ -x "$orig_dir/$hook_name" ]; then
- "$orig_dir/$hook_name" "$@" || exit $?
-fi
-
-[ "$hook_name" = "prepare-commit-msg" ] || exit 0
-case "$2" in merge|squash) exit 0 ;; esac
-git interpret-trailers --in-place --if-exists addIfDifferent \
- --trailer "$OPENHUMAN_GIT_ATTRIBUTION" "$1" 2>/dev/null || true
-"#;
-
-#[cfg(unix)]
-static HOOK_DIR: OnceLock<Option<PathBuf>> = OnceLock::new();
-
-/// Environment values that activate OpenHuman's commit-attribution hook.
-///
-/// The result is intended for an agent-owned child process. It does not change
-/// repository configuration or the parent application's environment.
-#[cfg(unix)]
-pub fn hook_env() -> HashMap<OsString, OsString> {
- let Some(dir) = HOOK_DIR.get_or_init(|| build_hook_dir().ok()).as_ref() else {
- return HashMap::new();
- };
- build_hook_env(dir, std::env::var_os("GIT_CONFIG_PARAMETERS").as_deref())
-}
-
-#[cfg(unix)]
-fn build_hook_env(
- dir: &std::path::Path,
- inherited_parameters: Option<&OsStr>,
-) -> HashMap<OsString, OsString> {
- use std::os::unix::ffi::{OsStrExt, OsStringExt};
-
- let mut parameters = inherited_parameters
- .map(|value| value.as_bytes().to_vec())
- .unwrap_or_default();
- if !parameters.is_empty() {
- parameters.push(b' ');
- }
- parameters.extend_from_slice(b"'core.hooksPath'='");
- for byte in dir.as_os_str().as_bytes() {
- if *byte == b'\'' {
- parameters.extend_from_slice(b"'\\''");
- } else {
- parameters.push(*byte);
- }
- }
- parameters.push(b'\'');
- push_neutralised_config(&mut parameters);
-
- HashMap::from([
- (OsString::from("OPENHUMAN_GIT_ATTRIBUTION"), TRAILER.into()),
- // Parameters outrank GIT_CONFIG_COUNT. Preserve settings inherited
- // from the parent harness, then append our hook so it wins if that
- // harness also selected a hook path.
- (
- OsString::from("GIT_CONFIG_PARAMETERS"),
- OsString::from_vec(parameters),
- ),
- ])
-}
-
-#[cfg(not(unix))]
-pub fn hook_env() -> HashMap<std::ffi::OsString, std::ffi::OsString> {
- HashMap::new()
-}
-
-/// Append the shell-safe git config overrides to a `GIT_CONFIG_PARAMETERS`
-/// buffer.
-///
-/// `GIT_CONFIG_PARAMETERS` is how git itself propagates `-c` to child
-/// processes, so these land at `-c` precedence: above the repository's own
-/// config, which in an agent-writable workspace is the thing an attacker gets
-/// to author. Several git config keys name a command git then runs —
-/// `core.fsmonitor` on `git status`, `core.pager` and `core.editor` on the
-/// commands that use them — and until `git_operations` moved behind a tool
-/// pack, `shell git` was the one path that got none of that hardening.
-///
-/// The list, and the reasoning about what is deliberately left out of it,
-/// lives with the rest of the policy in `tools::impl::filesystem`.
-///
-/// Later entries win, so this is appended after the hooks path rather than
-/// before: nothing here sets `core.hooksPath`, but the ordering is the
-/// contract and worth keeping explicit.
-#[cfg(unix)]
-fn push_neutralised_config(parameters: &mut Vec<u8>) {
- for entry in crate::tools::implementations::filesystem::SHELL_NEUTRALISED_CONFIG {
- let Some((key, value)) = entry.split_once('=') else {
- continue;
- };
- parameters.push(b' ');
- parameters.push(b'\'');
- parameters.extend_from_slice(key.as_bytes());
- parameters.extend_from_slice(b"'='");
- parameters.extend_from_slice(value.as_bytes());
- parameters.push(b'\'');
- }
-}
-
-#[cfg(unix)]
-fn build_hook_dir() -> std::io::Result<PathBuf> {
- use std::io::Write;
- use std::os::unix::fs::PermissionsExt;
-
- let dir = tempfile::tempdir()?.keep();
- for name in HOOKS {
- let path = dir.join(name);
- let mut file = std::fs::File::create(&path)?;
- file.write_all(SHIM.as_bytes())?;
- std::fs::set_permissions(&path, std::fs::Permissions::from_mode(0o755))?;
- }
- Ok(dir)
-}
-
-#[cfg(all(unix, test))]
-pub(super) fn test_hook_env(inherited_parameters: Option<&OsStr>) -> HashMap<OsString, OsString> {
- let dir = build_hook_dir().expect("create OpenHuman hook directory");
- build_hook_env(&dir, inherited_parameters)
-}
diff --git a/crates/openhuman-core/src/agent/git_attribution/mod.rs b/crates/openhuman-core/src/agent/git_attribution/mod.rs
deleted file mode 100644
index 26151e23e3..0000000000
--- a/crates/openhuman-core/src/agent/git_attribution/mod.rs
+++ /dev/null
@@ -1,13 +0,0 @@
-//! Git commit attribution for changes made by the OpenHuman agent.
-//!
-//! Agent shell commands inherit a temporary `prepare-commit-msg` hook which
-//! appends OpenHuman's co-author trailer. The hook directory contains shims for
-//! every client-side hook, so a repository's validation hooks continue to run.
-
-mod hook;
-
-pub use hook::hook_env;
-
-#[cfg(test)]
-#[path = "git_attribution_tests.rs"]
-mod tests;
diff --git a/crates/openhuman-core/src/agent/mod.rs b/crates/openhuman-core/src/agent/mod.rs
index 8948110c0a..7df32dd87e 100644
--- a/crates/openhuman-core/src/agent/mod.rs
+++ b/crates/openhuman-core/src/agent/mod.rs
@@ -26,7 +26,6 @@ pub mod dispatcher;
pub mod error;
pub mod experience;
pub mod file_state;
-pub(crate) mod git_attribution;
pub mod harness;
pub mod harness_init;
pub mod hooks;
diff --git a/crates/openhuman-core/src/tools/impl/filesystem/git_operations_config.rs b/crates/openhuman-core/src/tools/impl/filesystem/git_operations_config.rs
index 4e07f94ffd..641d0fa276 100644
--- a/crates/openhuman-core/src/tools/impl/filesystem/git_operations_config.rs
+++ b/crates/openhuman-core/src/tools/impl/filesystem/git_operations_config.rs
@@ -163,11 +163,9 @@ pub(super) const NEUTRALISED_CONFIG: &[&str] = &[
/// - `diff.external`. Unsuppressable by value for the same reason, and the fix
/// `git_operations` uses — `--no-ext-diff` — is an argv change this path
/// cannot make. A repository that sets it keeps it, and that is a known gap.
-/// - `core.hooksPath`. Not a gap here but a different owner: the shell already
-/// points it at OpenHuman's attribution hook directory, whose shims
-/// deliberately delegate onward to whatever the repository configured. Hooks
-/// therefore still run under `shell`, by design — see the module docs on
-/// `agent::git_attribution`.
+/// - `core.hooksPath`. There is no portable inert value for it, and overriding
+/// it would change ordinary shell behavior by suppressing repository hooks.
+/// Shell-invoked git therefore keeps the repository's configured hooks.
pub(crate) const SHELL_NEUTRALISED_CONFIG: &[&str] = &[
"core.fsmonitor=",
"core.pager=cat",
@@ -180,6 +178,30 @@ pub(crate) const SHELL_NEUTRALISED_CONFIG: &[&str] = &[
"commit.gpgSign=false",
];
+/// Environment overrides applied to arbitrary commands launched by the shell
+/// tool so any nested `git` process receives the safe subset above.
+///
+/// Preserve ambient `GIT_CONFIG_PARAMETERS` exactly, including non-UTF-8
+/// bytes, because git uses it to propagate a parent's `-c` settings. The
+/// safety overrides are appended so they win when the same key is repeated.
+pub(crate) fn shell_git_env() -> std::collections::HashMap<std::ffi::OsString, std::ffi::OsString> {
+ let mut parameters = std::env::var_os("GIT_CONFIG_PARAMETERS").unwrap_or_default();
+ for entry in SHELL_NEUTRALISED_CONFIG {
+ let Some((key, value)) = entry.split_once('=') else {
+ continue;
+ };
+ if !parameters.is_empty() {
+ parameters.push(" ");
+ }
+ parameters.push(format!("'{key}'='{value}'"));
+ }
+
+ std::collections::HashMap::from([(
+ std::ffi::OsString::from("GIT_CONFIG_PARAMETERS"),
+ parameters,
+ )])
+}
+
/// A path git will read as an empty config file.
///
/// `GIT_CONFIG_GLOBAL` must name something readable-and-empty rather than be
diff --git a/crates/openhuman-core/src/tools/impl/filesystem/git_operations_config_tests.rs b/crates/openhuman-core/src/tools/impl/filesystem/git_operations_config_tests.rs
index 9b9ca16d8d..e821abd433 100644
--- a/crates/openhuman-core/src/tools/impl/filesystem/git_operations_config_tests.rs
+++ b/crates/openhuman-core/src/tools/impl/filesystem/git_operations_config_tests.rs
@@ -10,7 +10,7 @@
//! the fixtures in the sibling test module stay reachable.
use super::super::git_operations_config::{
- normalise_config_key, NEUTRALISED_CONFIG, SHELL_NEUTRALISED_CONFIG,
+ normalise_config_key, shell_git_env, NEUTRALISED_CONFIG, SHELL_NEUTRALISED_CONFIG,
};
// The fixtures stay in `git_operations_tests.rs` and are shared rather than
// duplicated: both modules are children of `git_operations`, so `pub(super)`
@@ -572,9 +572,10 @@ fn the_shell_subset_never_invents_a_key_the_main_policy_does_not_have() {
///
/// Each would break ordinary work rather than harden it: an empty
/// `core.sshCommand` is a command git tries to execute (the same trap the
-/// `diff.external` note records), and `core.hooksPath` belongs to the
-/// attribution shim. Re-adding any of them looks like tightening security and
-/// is actually an outage, so it should be a conscious edit here first.
+/// `diff.external` note records), while overriding `core.hooksPath` would
+/// suppress repository hooks. Re-adding any of them looks like tightening
+/// security and is actually an outage, so it should be a conscious edit here
+/// first.
#[test]
fn the_shell_subset_keeps_its_documented_exclusions() {
for excluded in ["core.sshCommand=", "diff.external=", "core.hooksPath="] {
@@ -585,3 +586,71 @@ fn the_shell_subset_keeps_its_documented_exclusions() {
);
}
}
+
+#[test]
+fn shell_git_environment_forces_the_safe_config_subset() {
+ let env = shell_git_env();
+ let parameters = env
+ .get(std::ffi::OsStr::new("GIT_CONFIG_PARAMETERS"))
+ .expect("the shell git environment sets GIT_CONFIG_PARAMETERS")
+ .to_string_lossy();
+
+ for expected in SHELL_NEUTRALISED_CONFIG {
+ let (key, value) = expected.split_once('=').unwrap();
+ assert!(
+ parameters.contains(&format!("'{key}'='{value}'")),
+ "`{expected}` is missing from GIT_CONFIG_PARAMETERS: {parameters}"
+ );
+ }
+}
+
+/// Exercise the environment through Git itself rather than only checking its
+/// serialization. A syntactically plausible `GIT_CONFIG_PARAMETERS` value is
+/// not useful if Git rejects it, and `core.fsmonitor=` must actually override
+/// the command-valued setting in the repository config.
+#[cfg(unix)]
+#[test]
+fn shell_git_environment_is_accepted_and_neutralises_repository_fsmonitor() {
+ let tmp = TempDir::new().unwrap();
+ init_git_repo(tmp.path());
+ let marker = plant_fsmonitor_hook(tmp.path());
+
+ // Prove this Git version and repository really do invoke the planted
+ // fsmonitor hook. Without this control, an absent marker below could be a
+ // false positive caused by Git never consulting the setting.
+ let plain = hermetic(
+ std::process::Command::new("git")
+ .arg("status")
+ .current_dir(tmp.path()),
+ )
+ .output()
+ .expect("failed to run the unhardened control command");
+ assert!(
+ plain.status.success(),
+ "the unhardened control command failed: {}",
+ String::from_utf8_lossy(&plain.stderr)
+ );
+ assert!(
+ marker.exists(),
+ "the unhardened control did not execute the planted fsmonitor hook"
+ );
+ std::fs::remove_file(&marker).unwrap();
+
+ let env = shell_git_env();
+ let mut hardened = std::process::Command::new("git");
+ hardened.arg("status").current_dir(tmp.path());
+ hermetic(&mut hardened).envs(env);
+ let output = hardened
+ .output()
+ .expect("failed to run git with the shell hardening environment");
+
+ assert!(
+ output.status.success(),
+ "Git rejected the shell hardening environment: {}",
+ String::from_utf8_lossy(&output.stderr)
+ );
+ assert!(
+ !marker.exists(),
+ "Git executed repository core.fsmonitor despite the shell hardening environment"
+ );
+}
diff --git a/crates/openhuman-core/src/tools/impl/filesystem/mod.rs b/crates/openhuman-core/src/tools/impl/filesystem/mod.rs
index 1fbefd5116..9c06995916 100644
--- a/crates/openhuman-core/src/tools/impl/filesystem/mod.rs
+++ b/crates/openhuman-core/src/tools/impl/filesystem/mod.rs
@@ -34,7 +34,7 @@ mod tests;
/// Re-exported from the module that owns the whole policy so the `shell` tool
/// and `git_operations` cannot drift into two different answers about which
/// config keys are dangerous.
-pub(crate) use git_operations_config::SHELL_NEUTRALISED_CONFIG;
+pub(crate) use git_operations_config::shell_git_env;
pub use apply_patch::ApplyPatchTool;
pub use csv_export::CsvExportTool;
diff --git a/crates/openhuman-core/src/tools/impl/system/shell.rs b/crates/openhuman-core/src/tools/impl/system/shell.rs
index 5fc90e854c..9c783162f9 100644
--- a/crates/openhuman-core/src/tools/impl/system/shell.rs
+++ b/crates/openhuman-core/src/tools/impl/system/shell.rs
@@ -403,9 +403,9 @@ impl ShellTool {
}
}
- // Attribute commits made by this agent-owned shell, without persisting
- // anything in the user's repository or global Git configuration.
- for (key, value) in crate::agent::git_attribution::hook_env() {
+ // Keep command-valued repository Git settings from executing host
+ // programs when a shell command happens to invoke git.
+ for (key, value) in crate::tools::implementations::filesystem::shell_git_env() {
cmd.env(key, value);
}
@@ -533,11 +533,8 @@ impl ShellTool {
}
}
- // The local/no-op sandbox inherits this process's temporary hook
- // directory, so commits made through a sandboxed shell are attributed
- // just like native-shell commits. Docker backends safely ignore an
- // unavailable host path rather than changing repository configuration.
- extra_env.extend(crate::agent::git_attribution::hook_env());
+ // Apply the same Git config hardening to local and sandboxed shells.
+ extra_env.extend(crate::tools::implementations::filesystem::shell_git_env());
// Sandbox backends require a finite deadline. Without an explicit
// `timeout_secs`, substitute the generous effective-unbounded cap so a
diff --git a/docs/README.md b/docs/README.md
index 7a89d18def..82b84eceb2 100644
--- a/docs/README.md
+++ b/docs/README.md
@@ -48,5 +48,19 @@ Translations of the root `README.md`, linked from its language bar:
`README.de.md`, `README.ja-JP.md`, `README.ko.md`, `README.ur-pk.md`,
`README.zh-CN.md`.
-There is no `docs/plans/`; it was removed in `0017c58d86` and design notes now
-live beside the code.
+Domain-local design notes live beside their code. The agent-runtime migration is
+a temporary exception because it coordinates four repositories and cannot be
+owned accurately by one source directory:
+
+- `specs/agent-runtime-upstream-boundary.md` — normative ownership boundary and
+ deletion criteria.
+- `plans/migrate-agent-runtime-to-tinyagents.md` — bottom-up, test-first work
+ packages.
+- `plans/migrate-agent-runtime-helper-packages.md` — executable RED/GREEN tasks
+ for audited host-free helpers.
+- `plans/migrate-agent-runtime-waves.md` — non-overlapping ownership waves,
+ handoff gates, and final validation.
+
+Remove these four cross-repository migration documents when the final
+OpenHuman cutover lands; durable architecture changes must be reflected in
+`gitbooks/developing/architecture/` and the beside-code agent README instead.
diff --git a/docs/plans/migrate-agent-runtime-helper-packages.md b/docs/plans/migrate-agent-runtime-helper-packages.md
new file mode 100644
index 0000000000..33ccf874d9
--- /dev/null
+++ b/docs/plans/migrate-agent-runtime-helper-packages.md
@@ -0,0 +1,89 @@
+# Agent runtime helper migration packages
+
+These tasks extend Task 2 in
+[`migrate-agent-runtime-to-tinyagents.md`](migrate-agent-runtime-to-tinyagents.md).
+Every GREEN step includes direct consumer imports and deletion of the old path;
+facades and re-exports in OpenHuman or TinyAgents are forbidden.
+
+## Task 2a: Move context statistics and prompt mechanics
+
+**Files:** TinyAgents harness `src/context/` and `src/prompt/`; OpenHuman
+`agent/context/`, especially `agent/context/stats.rs`, and direct consumers.
+
+**RED:** Port fixtures that calculate message/tool/image/token statistics,
+preserve tool-call/result pairing, assemble ordered prompt sections, enforce
+section budgets, and report truncation provenance. Confirm the absent APIs fail:
+
+```bash
+cargo test --manifest-path vendor/tinyagents/Cargo.toml -p tinyagents-harness context_stats
+cargo test --manifest-path vendor/tinyagents/Cargo.toml -p tinyagents-harness prompt_mechanics
+```
+
+**GREEN:** Move only host-free statistics and prompt assembly mechanics. Accept
+message, section, tokenizer, and budget inputs through crate-native types or
+callbacks; do not name OpenHuman context, memory, profile, or prompt assets.
+Direct-import the owner everywhere, delete the OpenHuman helpers and
+`context/prompt.rs`, then re-run both focused tests, `cargo check -p openhuman`,
+and the boundary checker.
+
+## Task 2b: Move behavior-free prompt render helpers
+
+**Files:** TinyAgents harness `src/prompt/`; OpenHuman `agent/prompts/`,
+`agent/harness/instructions.rs`, tests, and callers.
+
+**RED:** Port exact-output fixtures for headings, optional/empty sections,
+escaping, tool catalog blocks, stable ordering, and byte/token caps. Use only
+caller-supplied content, with no OpenHuman product copy.
+
+```bash
+cargo test --manifest-path vendor/tinyagents/Cargo.toml -p tinyagents-harness prompt_render
+```
+
+**GREEN:** Move reusable render blocks to the harness. Keep product prompts and
+product section selection in OpenHuman. Direct-import every helper, delete the
+forwarding functions/modules, and re-run the focused test, root cargo check,
+and boundary checker. No TinyAgents crate may re-export the helpers.
+
+## Task 2c: Direct-import multimodal marker, MIME, and data-URI helpers
+
+**Files:** TinyAgents harness multimodal module; OpenHuman
+`agent/multimodal.rs`, attachment resolution, model adapters, and tests.
+
+**RED:** Port table-driven tests for marker recognition, case-insensitive MIME
+parsing, supported/unsupported media, base64 and percent-encoded data URIs,
+malformed payload rejection, size limits, and text/image ordering. Add a host
+test proving authorization happens before file bytes reach the generic helper.
+
+```bash
+cargo test --manifest-path vendor/tinyagents/Cargo.toml -p tinyagents-harness multimodal
+pnpm debug rust multimodal
+```
+
+**GREEN:** Move pure marker/MIME/data-URI parsing and rendering upstream. Keep
+file access, attachment lookup, authorization, and size policy in OpenHuman.
+Direct-import the owner, delete old exports, and re-run both focused commands,
+root cargo check, and the boundary checker.
+
+## Task 2d: Move embedding and retriever interfaces
+
+**Files:** TinyInference embedding traits/tests; TinyAgents harness retriever
+traits/tests; OpenHuman `agent/tinyagents/{embeddings,retriever}.rs`,
+provider/config, memory adapters, and tests.
+
+**RED:** Add provider-neutral tests for batched embeddings, stable input/result
+order, dimension/usage metadata, empty/error responses, cancellation,
+retrieval limits/scores/metadata, and a fake retriever in context composition.
+Add OpenHuman tests proving provider configuration and memory scope stay host
+owned.
+
+```bash
+cargo test --manifest-path vendor/tinyagents/vendor/tinyinference/Cargo.toml --workspace embedding
+cargo test --manifest-path vendor/tinyagents/Cargo.toml -p tinyagents-harness retriever
+pnpm debug rust retriever
+```
+
+**GREEN:** Put model-boundary embedding types/traits in TinyInference and
+generic retrieval contracts in the harness. Keep provider construction,
+credentials, memory queries, scope, and policy in OpenHuman adapters.
+Direct-import owners, delete both OpenHuman facades, and re-run all three
+commands, root cargo check, and the boundary checker.
diff --git a/docs/plans/migrate-agent-runtime-to-tinyagents.md b/docs/plans/migrate-agent-runtime-to-tinyagents.md
new file mode 100644
index 0000000000..28e6384711
--- /dev/null
+++ b/docs/plans/migrate-agent-runtime-to-tinyagents.md
@@ -0,0 +1,464 @@
+# Migrate the OpenHuman agent runtime to TinyAgents
+
+> Implementation must proceed bottom-up and test-first. Each task removes the
+> old path in the same change that switches its consumers. Do not add shims,
+> aliases, forwarding modules, or dual live paths.
+
+## Objective
+
+Make `tinyagents-harness` the only agent runtime. Move host-independent helper
+and execution code from `crates/openhuman-core/src/agent/` into the appropriate
+vendored crate, wire the existing ten OpenHuman host adapters into a new
+host-capability-driven harness entry point, switch every live route, and delete
+the manual assembly/task-local shells.
+
+The normative ownership and audit matrix are in
+`docs/specs/agent-runtime-upstream-boundary.md`.
+
+## Repository and integration order
+
+The repositories are nested and must be landed bottom-up:
+
+1. `vendor/tinyagents/vendor/tinytools` — branch, tests, commit, push, PR to the
+ canonical TinyTools upstream.
+2. `vendor/tinyagents/vendor/tinyinference` — independent branch/PR to the
+ canonical TinyInference upstream.
+3. `vendor/tinyagents` — after the two dependency PRs land (or while pinned to
+ their review commits), update its nested gitlinks and implement harness,
+ registry, and graph changes; PR to canonical TinyAgents upstream.
+4. OpenHuman — update `vendor/tinyagents` gitlink, switch host code and routes,
+ delete migrated code, then PR to `tinyhumansai/openhuman` against
+ `migrate-inference-to-tinyinference` (or its canonical successor if that
+ branch has landed).
+
+Create only the superproject worktree. Do not create nested worktrees in any
+submodule. Preserve every auto-commit; never squash. A submodule commit must be
+reachable from its upstream PR before the parent gitlink is published.
+
+## Task 0: Lock the boundary with failing architecture checks
+
+**Files**
+
+- Add `scripts/ci/check-agent-runtime-boundary.mjs`.
+- Add its command to root `package.json` and the appropriate CI Lite area.
+- Add/extend TinyAgents dependency-boundary tests under
+ `vendor/tinyagents/crates/tinyagents-integration-tests/tests/`.
+
+**RED**
+
+Write checks that fail on the current tree and report exact imports for:
+
+- every `tinyagents_harness::tool_calling` import or module declaration;
+- `crate::agent::{dispatcher,pformat}` and the listed `harness::{parse,
+ instructions,tool_filter}` paths;
+- `SharedToolAdapter`, `ToolAdapter`, `spec_to_schema`,
+ `execute_openhuman_tool`, `assemble_turn_harness`, and
+ `run_turn_via_tinyagents_shared`;
+- production use of the agent task-local accessors listed in the spec;
+- OpenHuman `pub use` of types owned by `tinyagents*`, `tinytools*`, or
+ `tinyinference*`;
+- TinyAgents facade modules or public re-exports that preserve a moved
+ TinyTools/TinyInference/TinyAgents path, including `pub use tinytools_agent`
+ from `tinyagents-harness`, behavior-free modules whose public surface is only
+ forwarded items, and local aliases/wrappers named after moved symbols;
+- host-free TinyAgents crates depending on `openhuman` or naming OpenHuman
+ domain types.
+
+Allow a checked-in temporary baseline of exact existing violations so this
+task can land green; every later task removes entries, and the final task
+deletes the baseline. Do not allow wildcards or path-wide exclusions.
+
+**GREEN**
+
+Run `pnpm rust:layout`, the new checker, and the TinyAgents integration test.
+
+## Task 1: Make `tinytools` the sole tool vocabulary
+
+**Repository:** nested TinyTools first, then TinyAgents consumers.
+
+**Files**
+
+- `vendor/tinyagents/vendor/tinytools/crates/tinytools/src/{tool,result,call,
+ context,spec}/` and tests.
+- `vendor/tinyagents/crates/tinyagents-harness/src/tool/` and registry/agent
+ loop tests.
+- Later OpenHuman consumers under `crates/openhuman-core/src/tools/`.
+
+**RED**
+
+Add TinyAgents tests proving a registered `Arc<dyn tinytools::Tool>`:
+
+- receives a `tinytools::ToolRunContext` containing workspace, thread id and
+ output cap;
+- has model-supplied injected values stripped before host injection and schema
+ validation;
+- preserves content blocks, markdown preference and reported errors;
+- honors timeout/cancellation and emits call-id/name/elapsed correlation as a
+ harness event without mutating `tinytools::ToolResult`;
+- exposes canonical permission/scope/runtime declarations to policy.
+
+**GREEN**
+
+Remove the public duplicate harness `Tool`, `ToolResult`, `ToolPolicy`, and
+schema vocabulary. Change `AgentHarness::register_tool` and registries to
+accept `Arc<dyn tinytools::Tool>`. Keep correlation in a harness-owned internal
+invocation outcome. Update sub-agent tools and registry capabilities to
+implement the canonical trait.
+
+Then change OpenHuman tool implementations to implement `tinytools::Tool`
+directly and delete `agent/tinyagents/tools.rs` and
+`agent/tinyagents/convert.rs`. Do not add an OpenHuman blanket adapter.
+
+**Verify**
+
+```bash
+cargo test --manifest-path vendor/tinyagents/vendor/tinytools/Cargo.toml --workspace
+cargo test --manifest-path vendor/tinyagents/Cargo.toml -p tinyagents-harness -p tinyagents-registry
+cargo check --manifest-path Cargo.toml -p openhuman
+pnpm agent:runtime-boundary
+```
+
+## Task 2: Import tool-call protocols directly from `tinytools-agent`
+
+**Files**
+
+- `vendor/tinyagents/vendor/tinytools/crates/tinytools-agent/src/`.
+- `vendor/tinyagents/crates/tinyagents-harness/Cargo.toml` and every TinyAgents
+ direct consumer.
+- OpenHuman `Cargo.toml`, `crates/openhuman-core/Cargo.toml`, prompts, model
+ adapters, and parsing tests.
+
+**RED**
+
+Port the OpenHuman XML/JSON/P-Format edge-case fixtures to
+`tinytools-agent` tests, including positional-schema recovery, prose
+preservation, unknown tools, fenced calls, malformed argument recovery, and
+tool-cycle pairing.
+
+**GREEN**
+
+Add direct `tinytools-agent` dependencies where used. Replace every
+`tinyagents_harness::tool_calling::*` and OpenHuman helper import with
+`tinytools_agent::*`/`tinytools_agent::dialect::*`. Delete:
+
+- `vendor/tinyagents/crates/tinyagents-harness/src/tool_calling/mod.rs`;
+- `crates/openhuman-core/src/agent/dispatcher.rs` and tests;
+- `crates/openhuman-core/src/agent/pformat.rs` and tests;
+- `crates/openhuman-core/src/agent/harness/parse.rs` and tests;
+- forwarding helpers in `harness/instructions.rs`, `harness/tool_filter.rs`,
+ `context/prompt.rs`, and `registry/tools.rs` after direct consumer updates.
+
+Do not preserve the former paths with `pub use`.
+
+Tasks 2a–2d cover the remaining audited helpers with executable RED/GREEN
+steps in
+[`migrate-agent-runtime-helper-packages.md`](migrate-agent-runtime-helper-packages.md):
+context statistics and prompt mechanics, render helpers, multimodal parsing,
+and embedding/retriever interfaces. Complete them before Task 3 consumers are
+cut over.
+
+## Task 3: Move model metadata and decorators to `tinyinference-llm`
+
+**Repository:** nested TinyInference.
+
+**Files**
+
+- `vendor/tinyagents/vendor/tinyinference/crates/tinyinference-llm/src/model/`
+ (split into `types`, `decorators`, and `observer` if necessary), `usage`,
+ `stream`, and tests.
+- OpenHuman `agent/tinyagents/{model,abort_guard,resolved_route,routes}.rs`.
+
+**RED**
+
+Port tests for:
+
+- max-token clamping and default/profile application;
+- resolved provider/model/route identity for sync and stream responses;
+- cache-read, cache-creation, reasoning, charged-amount, and context-window
+ usage round trips without `raw` metadata;
+- stable run/model-call correlation across deltas and terminal response;
+- an unfinished stream aborting its producer when dropped;
+- observer callbacks firing once on success, failure, cache hit, and fallback.
+
+**GREEN**
+
+Add native typed metadata and generic decorators/observers in
+`tinyinference-llm`. Move `MaxTokensModel`, `ProfileOverrideModel`,
+`RouteRecordingModel`, and abort-on-drop behavior there. Replace the
+OpenHuman raw `openhuman_usage_meta` envelope and FIFO usage side channel with
+typed response/usage fields. Keep OpenHuman provider conversion and pricing
+policy at the provider/host boundary.
+
+Delete the OpenHuman decorator definitions, `UsageCarryMiddleware`, and the
+resolved-route task-local. Consumers import TinyInference types directly.
+
+## Task 4: Make recursive run context explicit
+
+**Repository:** TinyAgents harness and graph.
+
+**Files**
+
+- `vendor/tinyagents/crates/tinyagents-harness/src/context/{types,mod,test}.rs`.
+- `vendor/tinyagents/crates/tinyagents-harness/src/tool/types.rs` (or its
+ canonical-tool replacement).
+- `vendor/tinyagents/crates/tinyagents-harness/src/subagent/`.
+- `vendor/tinyagents/crates/tinyagents-graph/src/recursion/` and tests.
+
+**RED**
+
+Test `RunContext::child` for lineage, maximum depth, cancellation, events,
+stores, workspace, thread id, output cap, steering, streaming mode, and
+metadata inheritance. Add concurrent-child tests proving values cannot bleed
+between sibling runs.
+
+**GREEN**
+
+Add `RunLineage` and `RunContext::child` as specified. Pass explicit context to
+sub-agent tools and graph nodes. A child must use the same host-driven harness
+entry point as its parent.
+
+In OpenHuman, define one owned `OpenHumanRunContext` (near the host bundle, not
+in a generic crate) containing origin, progress, hook/sink handles, artifact
+scope, attachments, dispatch/recency/fork state, subagent usage and route
+observer. Replace reads of:
+
+- `fork_context`, `sandbox_context`, `spawn_depth_context`,
+ `task_recency_context`, `turn_attachments_context`, `turn_dispatch_guard`,
+ `turn_subagent_usage`;
+- `progress_sink`, `resolved_route`, `run_cancellation_context`,
+ `thread_context`, `turn_origin`, and `turn_workspace` task-local scopes.
+
+Delete each task-local module once its final caller receives context directly.
+Do not put an opaque global map behind the new API.
+
+## Task 5: Activate `HostCapabilities` in `AgentHarness`
+
+**Repository:** TinyAgents harness.
+
+**Files**
+
+- `vendor/tinyagents/crates/tinyagents-harness/src/runtime/{types,mod,test}.rs`.
+- Add `src/runtime/agent.rs` (or equivalently focused module) for
+ `AgentTurnRequest` and host-driven invocation.
+- `src/host/*`, `src/agent_loop/*`, and integration tests.
+
+**RED**
+
+Build recording implementations for all ten traits and assert exact lifecycle
+ordering for a terminal answer, tool round, denied tool, model failure,
+cancelled turn, and recursive child. Assert absent optional capabilities are
+not called and missing required capabilities produce a typed configuration
+error before any model call.
+
+**GREEN**
+
+Add the `HostCapabilities` field, `with_host_capabilities`, `invoke_agent`, and
+`invoke_agent_stream`. Drive definition/model/context/security/budget/progress/
+memory/learning/outcome/experience through the bundle. Preserve lower-level
+explicit-model invocation as a separate SDK API; it must not silently fabricate
+host capabilities.
+
+Update `HostCapabilities` trait requests only where live invocation proves
+context is missing. Keep request/value types serde/std-oriented and free of
+OpenHuman dependencies.
+
+## Task 6: Move definitions into `tinyagents-registry`
+
+**Files**
+
+- `vendor/tinyagents/crates/tinyagents-registry/src/definition/` and tests.
+- `crates/openhuman-core/src/agent/harness/{definition*,builtin_definitions*,
+ agent_graph.rs}`.
+- OpenHuman `agent/registry/` and host `definition_registry.rs`.
+
+**RED**
+
+Move fixtures for TOML parsing, built-in/custom precedence, unknown compiled-out
+delegates, tier validation, sandbox/tool scopes, prompt sources, and stable
+diagnostics into registry tests.
+
+**GREEN**
+
+Make registry definitions the only definition types used by the harness.
+OpenHuman maps built-in prompt/profile/config sources into registry inputs and
+implements `DefinitionRegistry` over that store. Keep product enablement and
+RPC display DTOs in OpenHuman. Delete OpenHuman generic definition types and
+thin graph/type re-exports; update all consumers to direct imports.
+
+## Task 7: Move generic graph and delegation lifecycle
+
+**Files**
+
+- `vendor/tinyagents/crates/tinyagents-graph/src/{delegation,orchestration,
+ recursion,todos}/` and tests.
+- OpenHuman `agent/orchestration/`, `agent/task_board.rs`,
+ `agent/task_dispatcher/`, and `agent/tinyagents/{delegation,orchestration,
+ topology,todos}.rs`.
+
+**RED**
+
+Port tests for plan/execute/review/finalize, resume/checkpoint, steering,
+parallel failure policy, max depth, todo CAS/selection/cadence, and topology
+export. Use fake host-driven agents, not OpenHuman types.
+
+**GREEN**
+
+Move lifecycle algorithms and return crate-native events/outcomes. Keep
+OpenHuman worktree policy, RPC/controllers, delivery, workflow product rules,
+and durable product ledger projection. Delete thin delegation/orchestration/
+todo wrappers and import graph APIs directly. Relocate the legacy task-board
+migration to an OpenHuman startup migration module rather than leaving a
+facade solely to host it.
+
+## Task 8: Absorb generic middleware into the harness
+
+Implement this as small vertical commits. For every middleware: first port its
+behavioral tests to TinyAgents, then move the implementation, then switch and
+delete the OpenHuman copy. Keep policy supplied through host traits, typed
+configuration, or callbacks.
+
+### 8a. Argument recovery and structured output
+
+- Move `arg_recovery`, required-output extraction/repair, relaxed parsing, and
+ final-call wrap-up into existing harness invalid-argument/structured policy.
+- Delete OpenHuman `harness/required_output.rs`, `middleware/arg_recovery.rs`,
+ and `middleware/final_call_wrap_up.rs` after direct imports.
+
+### 8b. Context trimming, cache layout, and summarization
+
+- Move image-aware trim, prompt-cache layout guard, context ladder,
+ payload-summarizer contract/orchestration, and generic compression policy.
+- Keep OpenHuman model resolver/config and artifact/memory callbacks.
+- Prove tool-call/result pairing, images, cache prefixes, token budgets,
+ compaction provenance, and summarizer failure fallback.
+
+### 8c. No-progress and repeated failures
+
+- Fold adjacent repeats, run-wide recurrence, eviction reset, repeated tool
+ failure, and terminal inference failure into `tinyagents_harness::no_progress`
+ and run policy.
+- Test recurrence identity, compaction eviction, successful repeats,
+ thresholds, and child-run isolation.
+
+### 8d. Output shaping, redaction, and artifacts
+
+- Move generic recursive JSON/text redaction traversal, size limiting,
+ summarization decision, trusted-verbatim handling, handoff storage mechanics,
+ and artifact-index/TOC injection.
+- Inject host redactor/artifact store callbacks. Keep action-dir authorization,
+ credential sources, and OpenHuman artifact persistence in the host.
+- Test nested secrets, malformed/large values, byte limits, markdown, exact
+ artifact links, and absent-store behavior.
+
+### 8e. Host-policy middleware
+
+- Replace approval, CLI/RPC-only, cost, memory, exposure, outcome, hooks and
+ policy middleware mechanics with calls made by host-capability invocation.
+- Keep only OpenHuman trait implementations and denial/audit persistence.
+- Confirm authorization occurs after canonical argument injection and before
+ execution, and denial cannot be bypassed through aliases/packed calls.
+
+### 8f. Remaining harness helpers
+
+- Replace OpenHuman `harness/run_queue/` with direct
+ `tinyagents_harness::run_queue` use after moving its remaining parity tests.
+- Move host-free archivist lifecycle/recap heuristics behind upstream memory
+ and store traits; keep OpenHuman memory-tree persistence, product events and
+ policy in the host adapter.
+- Move artifact-offload sizing/chunking/handoff/extraction mechanics, including
+ `ResultHandoffCache`, into `tinyagents-harness::handoff`; inject the
+ OpenHuman action-dir artifact store and authorization callback.
+- Keep `tool_result_artifacts/` as the host store implementation, not as an
+ upstream re-export facade.
+- Port cache bounds, chunk reconstruction, authorization, missing/expired
+ handles, recap ordering and queue fairness tests before deleting each host
+ helper.
+
+## Task 9: Build and test the OpenHuman host bundle
+
+**Files**
+
+- `crates/openhuman-core/src/agent/tinyagents/host/mod.rs` and ten adapter files.
+- Add focused integration tests beside the bundle or under root `tests/` with
+ explicit `[[test]]` entries when new root test files are created.
+
+**RED**
+
+Write a single end-to-end harness test that constructs the real OpenHuman
+bundle with fake domain backends and proves all ten adapters are reached by a
+live `invoke_agent` turn. Add security regressions for always-forbidden paths,
+action-dir escape, unknown command classification, approval default/expiry,
+untrusted input screening, memory scope/self-echo, and credential redaction.
+
+**GREEN**
+
+Add one `build_host_capabilities(...) -> HostCapabilities<_>` construction
+site. Resolve existing `TODO(phase4)` gaps with real domain calls or explicitly
+omit an optional capability; never register an erroring placeholder. Move
+`turn_models.rs`, host config mapping, and policy-denial persistence beside
+their adapters. Remove test-only accessors that construct individual adapters.
+
+## Task 10: Switch every live route to host-driven invocation
+
+**Files/callers**
+
+- `agent/harness/session/turn/graph.rs` and session runtime.
+- `agent/bus.rs`, channel/CLI paths, cron agent jobs, task dispatcher, triage,
+ sub-agent tools, workflow runs, web chat, and embed harness.
+- `crates/openhuman-embed/` public prompt-to-reply path.
+
+**RED**
+
+For each route, add a test asserting the request reaches
+`invoke_agent[_stream]` with agent id, crate-native messages, explicit
+`OpenHumanRunContext`, turn origin/access, workspace/config path, and inherited
+cancellation. Add parity tests for streaming, early exit, steering, tool
+timeline, terminal progress, error mapping, usage/cost, and child events.
+
+**GREEN**
+
+Switch all routes. Keep durable `ChatMessage` conversion only where reading or
+writing existing OpenHuman storage/import/export contracts. `openhuman_embed::Harness`
+must still enter through `CoreRuntime::invoke`, use one harness per process,
+and set workspace/config/origin correctly.
+
+There is no runtime flag or fallback to `run_turn_via_tinyagents_shared`.
+
+## Task 11: Delete the OpenHuman runtime shell and direct-import all owners
+
+**Delete after `rg` proves no consumers**
+
+- `agent/tinyagents/{harness_assembly,harness_context_ladder,
+ harness_tool_registration,turn_runner,convert,tools,abort_guard}.rs`;
+- migrated `model`, `routes`, `resolved_route`, middleware, summarizer,
+ outcome/finalization, task-local, delegation/orchestration/todo files;
+- old generic `agent/harness/` files and session/subagent loop code superseded
+ by `AgentHarness`;
+- `dispatcher.rs`, `pformat.rs`, graph/tool/parse/filter re-export facades;
+- broad exports from `agent/tinyagents/mod.rs`, then the module itself if only
+ host-owned children remain (relocate those children under clear product
+ modules first).
+
+Update README/architecture docs to describe OpenHuman as a host. Remove stale
+tests rather than leaving tests of deleted wrappers; their behavior must
+already exist at the owning crate or host integration level.
+
+Run the boundary checker with an empty baseline and these explicit searches:
+
+```bash
+rg -n "run_turn_via_tinyagents_shared|assemble_turn_harness|SharedToolAdapter|ToolAdapter|spec_to_schema|execute_openhuman_tool" crates vendor/tinyagents/crates
+rg -n "tinyagents_harness::tool_calling|crate::agent::(dispatcher|pformat)" crates vendor/tinyagents/crates
+rg -n "tokio::task_local!" crates/openhuman-core/src/agent
+```
+
+Any remaining task-local requires a documented proof that it is not a policy,
+correctness, recursion, cancellation, workspace, or observability input.
+
+## Task 12: Stage, validate, and land bottom-up
+
+The exact non-overlapping ownership waves, handoff gates, full validation
+commands, and landing checks are in
+[`migrate-agent-runtime-waves.md`](migrate-agent-runtime-waves.md). A later wave
+must not begin until its gate is satisfied. In particular, no consumer deletion
+may precede a tested upstream owner API, and no OpenHuman cutover may precede a
+TinyAgents commit that records its TinyTools and TinyInference gitlinks.
diff --git a/docs/plans/migrate-agent-runtime-waves.md b/docs/plans/migrate-agent-runtime-waves.md
new file mode 100644
index 0000000000..084ffe4511
--- /dev/null
+++ b/docs/plans/migrate-agent-runtime-waves.md
@@ -0,0 +1,149 @@
+# Agent runtime migration waves
+
+This is the execution and validation companion to
+[`migrate-agent-runtime-to-tinyagents.md`](migrate-agent-runtime-to-tinyagents.md).
+The boundary remains normative in
+[`../specs/agent-runtime-upstream-boundary.md`](../specs/agent-runtime-upstream-boundary.md).
+
+## Ownership rule
+
+Ownership below is exclusive for the duration of a wave. An owner may edit only
+the listed paths. Cross-owner consumer edits wait for the integration wave;
+owners hand off tested commits rather than editing another owner's files. All
+agents share the superproject worktree, preserve concurrent edits and automatic
+checkpoint commits, and never create nested worktrees or squash commits.
+
+## Wave 0: Enforcement
+
+One OpenHuman enforcement owner owns only `scripts/ci/check-agent-runtime-boundary.mjs`,
+its package/CI registration, its exact temporary baseline, and migration docs.
+The checker must fail for both OpenHuman and TinyAgents compatibility facades,
+forwarding modules, aliases, wrappers, and public re-exports of moved APIs.
+
+**Gate 0:** the checker fails without the exact baseline, passes with it, and
+TinyAgents dependency-boundary tests pass. Record the baseline count and paths
+in the handoff message.
+
+## Wave 1: Leaf contracts
+
+These owners may work concurrently because their paths do not overlap:
+
+| Owner | Exclusive paths | Tasks |
+| --- | --- | --- |
+| TinyTools leaf owner | `vendor/tinyagents/vendor/tinytools/**` | canonical tool vocabulary and tool-call protocols from Tasks 1–2 |
+| TinyInference leaf owner | `vendor/tinyagents/vendor/tinyinference/**` | model metadata/decorators from Task 3 and embedding contracts from Task 2d |
+
+Neither owner edits TinyAgents gitlinks, Cargo manifests outside its nested
+repository, or OpenHuman consumers.
+
+**Gate 1:** each leaf workspace is formatted, tested, linted, committed, pushed,
+and represented by a ready upstream PR. Each handoff names the commit SHA and
+the exact public imports that replace the old paths.
+
+## Wave 2: TinyAgents consumers and primitives
+
+One central dependency integrator exclusively owns TinyAgents' TinyTools and
+TinyInference gitlinks, every Cargo manifest and lockfile, crate roots, and
+workspace integration tests. It first pins the Gate 1 commits, then applies
+component handoffs and performs the residual mechanical direct-import consumer
+sweep. No component owner edits those paths.
+
+Before coupled work begins, the context owner gives the tool-loop owner an
+explicit context/tool API handoff. Context and tool-loop owners may then develop
+concurrently on non-overlapping paths. Registry/graph conversion follows that
+published context API:
+
+| Owner | Exclusive paths | Tasks |
+| --- | --- | --- |
+| Tool-loop owner | harness `src/tool/**`, all harness `src/agent_loop/**`, and their tests | Tasks 1–2 direct imports; no facade |
+| Context owner | harness `src/context/**`, `src/prompt/**`, `src/multimodal/**`, `src/retriever/**`, `src/subagent/**`, and their tests | Tasks 2a–2d and only the harness-context portion of Task 4 |
+| Registry/graph owner | `vendor/tinyagents/crates/tinyagents-{registry,graph}/src/**` except `lib.rs`, and their module tests | graph-recursion portion of Task 4 and Tasks 6–7 |
+
+Component owners provide exact API, export, and dependency handoffs; the
+integrator applies them after their commits. If two tasks need the same
+`agent_loop` file, the context owner hands its required interface to the
+tool-loop owner instead of editing that file. The integrator retains each
+crate's `Cargo.toml`, `lib.rs`, and integration-test roots. Finally, the
+integrator deletes `tool_calling` and duplicate exports outright: no shim,
+facade, alias, or compatibility re-export remains.
+
+**Gate 2:** the TinyAgents workspace passes format, tests, clippy, and the
+dependency-boundary suite. Its public API directly names leaf owners, contains
+no compatibility module/re-export, and its commit records both Gate 1 gitlinks.
+
+## Wave 3: Host-driven harness
+
+Work is sequential because runtime and middleware meet in the agent loop:
+
+1. The harness runtime owner exclusively edits harness `src/runtime/**`,
+ `src/host/**`, remaining `src/agent_loop/**`, `src/middleware/**`,
+ `src/structured/**`, `src/no_progress/**`, `src/handoff/**`,
+ `src/run_queue/**`, `src/summarization/**`, `src/memory/**`,
+ `src/artifacts/**`, and tests beneath or dedicated to those destinations for
+ Tasks 5 and 8.
+2. After its commit, that owner integrates the Wave 2 context, tool, registry,
+ and graph APIs; no Wave 2 owner continues editing harness files.
+
+**Gate 3:** recording-host tests prove all ten capabilities and every terminal
+path; recursive children use the same entry point and explicit context; generic
+middleware parity tests pass; the full TinyAgents workspace is green. Push a
+ready TinyAgents PR and hand off its commit SHA plus migration import map.
+
+## Wave 4: OpenHuman cutover
+
+One OpenHuman integration owner exclusively edits
+`crates/openhuman-core/src/agent/**`, related direct consumers, Cargo manifests,
+tests, and the TinyAgents gitlink. Sequence the work internally:
+
+1. pin the Gate 3 TinyAgents commit;
+2. convert canonical tools/model metadata and the Tasks 2a–2d helpers;
+3. complete Task 4's OpenHuman portion by replacing agent task-local reads
+ with the explicit `OpenHumanRunContext` passed into the upstream harness and
+ graph APIs, then delete each obsolete task-local module;
+4. build and test the ten-capability host bundle;
+5. switch routes one by one with route parity tests;
+6. delete old paths, wrappers, remaining task-locals, and the temporary checker
+ baseline.
+
+Other agents may review but must not edit these paths during the cutover.
+
+**Gate 4:** the boundary checker passes with no baseline; all direct-import
+searches in Task 11 are empty; OpenHuman narrow and full suites pass; the audit
+matrix matches the tree. The TinyAgents commit must already be reachable from
+its upstream PR before the OpenHuman gitlink is published.
+
+## Final validation
+
+Run narrow tests after every task. Before any PR is ready, run:
+
+```bash
+cargo fmt --manifest-path vendor/tinyagents/vendor/tinytools/Cargo.toml --all -- --check
+cargo test --manifest-path vendor/tinyagents/vendor/tinytools/Cargo.toml --workspace
+cargo clippy --manifest-path vendor/tinyagents/vendor/tinytools/Cargo.toml --workspace --all-targets -- -D warnings
+cargo fmt --manifest-path vendor/tinyagents/vendor/tinyinference/Cargo.toml --all -- --check
+cargo test --manifest-path vendor/tinyagents/vendor/tinyinference/Cargo.toml --workspace
+cargo clippy --manifest-path vendor/tinyagents/vendor/tinyinference/Cargo.toml --workspace --all-targets -- -D warnings
+cargo fmt --manifest-path vendor/tinyagents/Cargo.toml --all -- --check
+cargo test --manifest-path vendor/tinyagents/Cargo.toml --workspace
+cargo clippy --manifest-path vendor/tinyagents/Cargo.toml --workspace --all-targets -- -D warnings
+pnpm rust:layout
+pnpm docs:generate
+pnpm docs:check
+pnpm typecheck
+pnpm lint
+pnpm i18n:check
+cargo check --manifest-path Cargo.toml
+cargo check --manifest-path crates/openhuman-app/Cargo.toml
+pnpm debug rust
+pnpm test
+```
+
+Run long CI-equivalent commands through `scripts/ci-cancel-aware.sh`; never
+export `CARGO_TARGET_DIR`. Feature changes also require enabled/disabled builds
+and `scripts/ci/check-feature-forwarding.mjs`. New root Rust tests need explicit
+Cargo `[[test]]` entries.
+
+Finally, `git diff --submodule=log` must show the expected nested commits; every
+nested commit must be pushed with a ready canonical-upstream PR; OpenHuman must
+contain no moved compatibility export; and durable architecture documentation
+must describe the final host-only design.
diff --git a/docs/specs/agent-runtime-upstream-boundary.md b/docs/specs/agent-runtime-upstream-boundary.md
new file mode 100644
index 0000000000..a9e8e3e476
--- /dev/null
+++ b/docs/specs/agent-runtime-upstream-boundary.md
@@ -0,0 +1,348 @@
+# Agent runtime upstream boundary
+
+**Status:** migration specification
+**Scope:** `crates/openhuman-core/src/agent/` and the vendored `tinyagents`,
+`tinytools`, and `tinyinference` repositories
+**Compatibility policy:** breaking, direct imports only; no compatibility modules,
+type aliases, forwarding wrappers, or OpenHuman re-export facades
+
+## Goal
+
+OpenHuman must become a host of the TinyAgents harness rather than a second
+agent runtime. Code that describes an agent loop, model/tool protocol,
+recursion, middleware mechanics, or graph lifecycle belongs in the smallest
+reusable upstream crate. OpenHuman retains product policy, durable product wire
+formats, UI/RPC projection, configuration, and adapters that implement the
+upstream host traits.
+
+This is a full import migration. A moved API is imported from its owning crate
+at every call site. Old paths are deleted in the same work package. There is no
+transition period in which both paths compile.
+
+## Non-negotiable boundaries
+
+### Move upstream
+
+- Model-facing tool syntax, parsing, catalogue rendering, transcript pairing,
+ and P-Format live in `tinytools-agent`.
+- The canonical tool trait, declaration, result blocks, permissions, runtime
+ hints, and run-context vocabulary live in `tinytools`.
+- Model request/response metadata, usage, resolved route identity, streaming
+ correlation, abort-on-drop, and generic `ChatModel` decorators live in
+ `tinyinference-llm`.
+- The agent loop, host-capability invocation, context inheritance, generic
+ middleware, summarization mechanics, handoff mechanics, and generic event
+ vocabulary live in `tinyagents-harness`.
+- Agent-definition parsing, validation, and named definition lookup live in
+ `tinyagents-registry`.
+- Delegation, recursion, task/todo selection, and generic graph lifecycle live
+ in `tinyagents-graph`.
+
+### Keep in OpenHuman
+
+- `ChatMessage`, `ConversationMessage`, and other durable OpenHuman transcript
+ wire types. Conversion to/from `tinyinference_llm::message::Message` occurs
+ only at legacy disk/import/export boundaries; live turns use crate-native
+ messages.
+- Security policy, approval, origin/taint rules, action-directory enforcement,
+ workspace guards, credential handling, and sandbox selection.
+- OpenHuman configuration, tier selection, provider credentials, provider
+ construction, pricing, charged-cost accounting, and product feature gates.
+- Product prompts, profiles, memory, learning, experience, artifacts,
+ integrations, channels, triage business rules, and task-board business
+ behavior.
+- RPC schemas/controllers, `DomainEvent`, `AgentProgress`, frontend timeline
+ projection, Langfuse transport, and other product observability exports.
+- OpenHuman host implementations of the ten TinyAgents capability traits.
+- OpenHuman run journals, legacy import, replay controllers, orphan reaping,
+ and migrations whose on-disk layout is an OpenHuman compatibility contract.
+
+Keeping a domain in OpenHuman does not justify keeping generic helper code next
+to it. The host should pass product behavior through a trait or callback and
+import the generic mechanism directly.
+
+## The current architectural defect
+
+`tinyagents_harness::host::HostCapabilities<State>` already bundles ten seams:
+`ContextComposer`, `DefinitionRegistry`, `SecurityGate`, `ModelResolver`,
+`AgentMemory`, `BudgetGate`, `ProgressSink`, `LearningSink`,
+`ToolOutcomeClassifier`, and `ExperienceStore`. OpenHuman implements all ten in
+`agent/tinyagents/host/`.
+
+The bundle is dead infrastructure today. `AgentHarness` has no host-capability
+field, no `with_host_capabilities`, and no host-driven `invoke_agent` entry
+point. Production instead constructs models, tools, middleware, context, and
+side channels manually in `harness_assembly.rs` and `turn_runner.rs`. Merely
+moving helpers while leaving that path intact would preserve two runtimes and
+is not completion.
+
+The P0 upstream contract is therefore:
+
+```rust
+pub struct AgentTurnRequest {
+ pub agent_id: String,
+ pub messages: Vec<tinyinference_llm::message::Message>,
+}
+
+impl<State: Send + Sync, Ctx: Send + Sync> AgentHarness<State, Ctx> {
+ pub fn with_host_capabilities(
+ &mut self,
+ host: HostCapabilities<State>,
+ ) -> &mut Self;
+
+ pub async fn invoke_agent(
+ &self,
+ request: AgentTurnRequest,
+ context: RunContext<Ctx>,
+ state: &State,
+ ) -> Result<AgentRun>;
+
+ pub async fn invoke_agent_stream(
+ &self,
+ request: AgentTurnRequest,
+ context: RunContext<Ctx>,
+ state: &State,
+ ) -> Result<AgentStream>;
+}
+```
+
+The exact ownership/borrowing details may follow existing harness conventions,
+but these semantics are required:
+
+1. resolve the definition and model through the bundle;
+2. compose and screen context before the first model call;
+3. authorize every tool call;
+4. acquire and record budget around every model call;
+5. emit progress without allowing sink failure to fail the turn;
+6. recall optional memory/experience only when configured;
+7. classify tool outcomes through the optional classifier;
+8. notify learning/experience after the terminal outcome;
+9. run child agents through the same entry point and inherited context;
+10. fail explicitly when the high-level entry point lacks required host
+ capabilities. The lower-level model-name invocation may remain for SDK
+ users that deliberately assemble a harness themselves.
+
+## Migration packages from the audit
+
+The implementation plan expands these audited packages into test-first tasks;
+the labels remain useful for review and completion tracking:
+
+| Package | Required result |
+| --- | --- |
+| **A — direct imports and facade purge** | Import `tinytools-agent` directly; delete `dispatcher.rs`, `pformat.rs`, `harness/parse.rs`, `harness/instructions.rs`, `harness/tool_filter.rs`, `context/prompt.rs`, `registry/tools.rs`, the handoff wrapper, and behavior-free graph re-exports. |
+| **B — TinyInference ownership** | Move max-token/default/profile decorators, route identity, typed usage/provider metadata, call correlation, and abort-on-drop stream behavior to `tinyinference-llm`. |
+| **C — canonical tool vocabulary** | Use `tinytools::Tool`/`ToolResult` end to end; make the harness bridge canonical tool context into its loop; delete OpenHuman tool adapters and conversions. |
+| **D — live host invocation** | Give `AgentHarness` a real `HostCapabilities`-driven entry point, wire all ten OpenHuman adapters, and replace correctness-sensitive task-locals with explicit recursively inherited `RunContext` data. |
+| **E — generic middleware absorption** | Move argument recovery through existing invalid-argument policy, trimming, cache layout, required-output repair, no-progress/failure guards, final-call wrap-up, summarizer mechanics, recursive redaction/output shaping, handoff, and artifact-index/TOC mechanics into the harness. |
+| **F — route cutover and deletion** | Switch every live route to the host-driven API, delete manual harness assembly and the task-local runtime shell, and leave only product adapters/policy/durable boundaries in OpenHuman. |
+
+Packages are dependency-ordered as C/B, A, D, registry/graph work, E, then F.
+No package is complete while its old path or a forwarding replacement remains.
+
+## Canonical cross-crate APIs
+
+### `tinytools` and `tinytools-agent`
+
+`tinytools::Tool`, `tinytools::ToolSpec`, `tinytools::ToolResult`,
+`tinytools::ToolCallOptions`, and `tinytools::ToolRunContext` are the sole tool
+vocabulary. `tinyagents-harness` must not expose a second public Tool trait or
+ToolResult shape. Harness-only correlation (`call_id`, elapsed time, run id)
+belongs to an internal invocation record/event, not the tool result.
+
+`AgentHarness::register_tool` accepts `Arc<dyn tinytools::Tool>`. The harness
+implements its execution context as `tinytools::ToolRunContext` and performs
+injected-argument, timeout, cancellation, and event handling around the
+canonical call. OpenHuman tools implement `tinytools::Tool` directly; the
+`SharedToolAdapter`, `ToolAdapter`, `spec_to_schema`, and
+`execute_openhuman_tool` bridge disappear.
+
+All users import parsing APIs from `tinytools_agent::{...}` or
+`tinytools_agent::dialect::{...}`. Delete
+`tinyagents_harness::tool_calling`, OpenHuman `agent::dispatcher`,
+`agent::pformat`, `harness::parse`, and any forwarding definitions.
+
+The same direct-import rule applies between TinyAgents crates. A harness,
+registry, or graph module must not preserve a former path by publicly
+re-exporting a TinyTools, TinyInference, or sibling TinyAgents API. Facades,
+type aliases, forwarding traits/functions, and behavior-free wrapper modules
+are migration failures even if OpenHuman no longer contains the shim.
+
+### `tinyinference-llm`
+
+The inference crate owns information that is true at a model call boundary:
+
+- `Usage` represents input, output, cache-read, cache-creation, reasoning,
+ charged amount, and context-window figures without hiding fields in
+ `ModelResponse::raw`.
+- request/response/stream events carry stable run/call correlation and resolved
+ provider/model/route identity.
+- reusable decorators own max-token bounding, profile/default application,
+ route observation, usage observation, and abort-on-drop streaming. Their
+ callbacks are generic observers; they do not name OpenHuman types.
+- OpenHuman maps its provider DTO at the provider boundary and keeps pricing
+ policy and tier selection host-side.
+
+This removes `MaxTokensModel`, `ProfileOverrideModel`, `RouteRecordingModel`,
+the raw `openhuman_usage_meta` envelope, `UsageCarryMiddleware`, and
+`AbortOnDrop` from `agent/tinyagents/`.
+
+### Explicit recursive context
+
+No behavior required by a child run may depend on a Tokio task-local. Extend
+`RunConfig`/`RunContext` with explicit lineage and a child constructor:
+
+```rust
+pub struct RunLineage {
+ pub root_run_id: RunId,
+ pub parent_run_id: Option<RunId>,
+ pub depth: usize,
+}
+
+impl<Ctx> RunContext<Ctx> {
+ pub fn child<ChildCtx>(
+ &self,
+ config: RunConfig,
+ data: ChildCtx,
+ ) -> Result<RunContext<ChildCtx>>;
+}
+```
+
+`child` inherits cancellation, events, stores, workspace, thread lineage,
+output/depth limits, steering policy, and serializable metadata according to a
+documented rule. OpenHuman's `Ctx` contains explicit host handles/values for
+origin, progress, stop hooks, artifact scope, attachments, dispatch guard,
+recency, fork/cache context, subagent usage, and resolved-route observation.
+Sub-agent tools receive it from `ToolExecutionContext`; detached tasks clone
+the owned handles explicitly. Task-locals may remain only for process-local
+conveniences that are neither correctness nor policy inputs, and the final
+forbidden-symbol check lists the old scopes.
+
+### Definitions and graphs
+
+Definition source parsing, validation, tier/delegate validation, and lookup are
+`tinyagents-registry` responsibilities. OpenHuman retains built-in prompt
+assets, profile persistence, enablement, and conversion into registry inputs.
+Callers use registry types directly; OpenHuman does not re-export them.
+
+Generic delegation state machines, recursive run lifecycle, steering registry,
+topology export, and todo selection are `tinyagents-graph` responsibilities.
+OpenHuman retains workflow RPC/domain decisions, worktree creation policy,
+delivery, durable product ledgers, and graph-event projection.
+
+Do not add `tinyagents-inspect` during the initial migration. Diagnostics can
+be added as a separate crate later if multiple consumers need a stable
+inspection API; creating it now would turn relocation into an API-design
+detour.
+
+## Exhaustive audit matrix
+
+The disposition is for production ownership after migration. “Delete” means
+all consumers import the owner directly, not that behavior is dropped.
+
+### Top-level `agent/` inventory
+
+| Current path | Disposition | Owner / rationale |
+| --- | --- | --- |
+| `artifacts/` | Keep | OpenHuman artifact persistence and action-dir policy; move generic artifact-index/TOC middleware mechanics to harness. |
+| `context/` | Split | Keep product context/session-memory inputs; move prompt/context mechanics and stats helpers that name no host type to harness. Delete `context/prompt.rs` facade. |
+| `debug/` | Keep | Product debug/RPC rendering; import harness diagnostics directly. |
+| `experience/` | Keep | Product store, RPC, and prompt data; accessed via `ExperienceStore`. |
+| `file_state/` | Keep | OpenHuman parallel-write safety policy; pass explicit context rather than task-local scope. |
+| `git_attribution/` | Delete | Obsolete host feature; removed independently before this migration. |
+| `harness/` | Split then shrink | Move generic definitions, recursion, parsing, filtering, graph and loop helpers to TinyAgents; keep public OpenHuman session facade only until live callers use the crate harness, then replace it with host construction/routing. |
+| `harness_init/` | Keep | Product dependency provisioning/startup service. |
+| `learning/` | Keep | Product learning/profile policy behind `LearningSink`. Generic post-turn callback timing moves to harness. |
+| `library/` | Keep | Product-facing safe definition projection/RPC DTO. |
+| `orchestration/` | Split | Move generic graph lifecycle/delegation/selection; keep worktrees, workflow business rules, delivery, RPC, ledgers, and host tools. |
+| `plan_review/` | Keep | OpenHuman interactive approval policy and RPC state. |
+| `profiles/` | Keep | Product persistence/prompts/connectors; project definitions into registry. |
+| `progress_tracing.rs`, `progress_tracing/` | Keep | OpenHuman UI/Langfuse projection and transport. Generic observations/events remain upstream. |
+| `prompts/` | Keep/Split | Keep bundled product prompts and section content. Move behavior-free render helpers/building blocks that name no product type to harness/prompt. |
+| `registry/` | Split | Keep enablement, custom-agent persistence, product defaults and RPC; move definition parsing/validation/lookup to `tinyagents-registry`; delete thin `registry/tools.rs`. |
+| `session_db/` | Keep | OpenHuman RPC controllers over TinyAgents ledger. |
+| `session_import/` | Keep | Legacy OpenHuman source and disk migration. |
+| `task_dispatcher/` | Split | Keep service/poller/executor and product tool binding; generic claim/select/prompt algorithms belong in `tinyagents-graph::todos`. |
+| `tinyagents/` | Split/Delete | Host adapters and product journal/projections stay; generic assembly, model/tool wrappers, middleware, task-local routing and graph wrappers move upstream, then the integration facade disappears. |
+| `tools/` | Keep | Product control tools, changed to implement `tinytools::Tool` directly. Generic todo/delegation mechanics move to graph/harness. |
+| `tools.rs` | Keep aggregator | Re-export OpenHuman-owned product tools only; import all upstream types at use sites. |
+| `triage/` | Keep | OpenHuman trigger business domain and RPC. It invokes the host-driven harness. |
+| `bus.rs` | Keep | Process-wide OpenHuman bus registration. |
+| `cost.rs` | Keep/Split | Keep pricing/tier accounting; model-call usage carrier and aggregation primitives move to inference/harness. |
+| `dispatcher.rs` | Delete | Use `tinytools-agent::dialect` directly. |
+| `error.rs` | Keep/Shrink | Product-facing errors and RPC mapping only; loop/model/tool errors originate upstream. |
+| `hooks.rs`, `stop_hooks.rs` | Keep adapter | Product hook policy; generic callback/control machinery is harness-owned and values are explicit in context. |
+| `host_runtime.rs`, `platform_shell.rs` | Keep | Host execution/shell policy shared with sandbox. |
+| `message_convert.rs` | Keep at boundary | Only legacy persistence/import/provider boundaries may convert; remove it from live harness assembly. |
+| `messages.rs` | Keep | Durable OpenHuman transcript wire contract. |
+| `multimodal.rs` | Split | Keep file access/security and host attachment resolution; import marker/MIME/data-URI mechanics from harness directly, with no re-exports. |
+| `pformat.rs` | Delete | Import `tinytools-agent` directly. |
+| `progress.rs`, `progress_sink.rs` | Keep adapter | UI contract/sink mapping remain; task-local delivery becomes explicit `RunContext` data. |
+| `schemas.rs` | Keep | OpenHuman RPC controllers. |
+| `task_board.rs` | Delete facade | Call `tinyagents_graph::todos` directly; keep only product migrations at their owning startup module. |
+| `task_session.rs` | Keep/Shrink | OpenHuman conversation/task binding; use host-driven invocation. |
+| `tool_policy.rs` | Keep policy | Product restrictions/approval facts; invoke through `SecurityGate`/canonical tool declarations. |
+| `turn_origin.rs`, `turn_workspace.rs` | Keep types/delete scopes | Product origin/workspace rules remain, but task-local accessors are replaced by explicit run context. |
+| `mod.rs`, `README.md` | Update | Export only OpenHuman-owned public API and describe the host boundary. |
+| top-level `*_tests.rs` | Move or rewrite | Generic behavior tests move with their implementation; remaining tests cover OpenHuman adapters, wire formats, policy, and routes. |
+
+### `agent/harness/` generic candidates
+
+| Current area | Destination | Final OpenHuman state |
+| --- | --- | --- |
+| `definition*`, `builtin_definitions*`, `agent_graph.rs` | `tinyagents-registry` / `tinyagents-graph` | Host supplies product sources; direct imports. |
+| `parse.rs`, `instructions.rs`, `tool_filter.rs` | `tinytools-agent` / `tinyagents-harness` | Delete. |
+| `graph.rs` and thin graph re-exports | `tinyagents-graph` | Delete facade. |
+| `required_output.rs` | `tinyagents-harness::structured` | Delete after parity tests. |
+| `memory_protocol.rs`, context ladder helpers | `tinyagents-harness` | Product memory adapter remains. |
+| `archivist/` | Split | Move generic lifecycle/recap heuristics behind memory/store traits; keep OpenHuman memory-tree persistence, events, and policy in its adapter. |
+| `artifact_offload/` | Split | Move size/chunk/handoff policy mechanics to harness; keep action-dir authorization and OpenHuman artifact store callbacks. |
+| `run_queue/` | `tinyagents-harness::run_queue` | Delete the OpenHuman copy/facade after parity tests and direct imports. |
+| `tool_result_artifacts/` | Keep host store | OpenHuman action-dir artifact persistence implementing the upstream artifact callback/store seam. |
+| `credentials.rs`, `memory_context.rs`, `memory_context_safety.rs` | Keep host policy/adapters | Feed explicit context/capability requests; move only host-free formatting/traversal helpers. |
+| `fork_context.rs`, `sandbox_context.rs`, `spawn_depth_context.rs`, `task_recency_context.rs`, `turn_attachments_context.rs`, `turn_dispatch_guard.rs`, `turn_subagent_usage.rs` | explicit `RunContext`/child context | Delete task-local shells. |
+| `subagent_runner/` generic recursion/drive | host-capability `invoke_agent` + `tinyagents-graph` | Keep only OpenHuman request/result mapping if still needed. |
+| `subagent_runner/handoff.rs`, `extract_tool.rs` | `tinyagents-harness::handoff` | Delete OpenHuman wrapper/cache after upstream storage/chunk/extract parity and direct imports. |
+| `session/` loop/turn assembly | `AgentHarness::invoke_agent[_stream]` | Keep OpenHuman transcript/checkpoint persistence and a thin product-facing constructor only if it adds a real OpenHuman API; no runtime duplication. |
+| credentials, memory, profile, prompt and sandbox inputs | Host adapters | Keep host implementations; no generic mechanics. |
+
+### `agent/tinyagents/` inventory
+
+| Current path | Disposition |
+| --- | --- |
+| `host/*` | Keep as the ten OpenHuman adapter implementations; wire all into one bundle factory. |
+| `harness_assembly.rs`, `harness_context_ladder.rs`, `harness_tool_registration.rs`, `turn_runner.rs` | Delete after host-driven invocation owns assembly and live routes switch. |
+| `convert.rs`, `tools.rs` | Delete after canonical `tinytools::Tool` adoption. |
+| `model.rs`, `abort_guard.rs`, `resolved_route.rs`, route/usage helpers in `routes.rs` | Move generic pieces to `tinyinference-llm`; keep tier/fallback choice in host model resolver; delete task-local route slot. |
+| `middleware/{arg_recovery,message_trim,prompt_cache,repeat_progress,repeated_failure,final_call_wrap_up,artifact_index_toc,credential_scrub}.rs` | Move generic mechanism to harness, parameterized by policy/callbacks. |
+| `middleware/{approval,cli_rpc_only,cost_budget,embedder_hooks,memory_protocol,packed_tool_route,tool_exposure,tool_outcome_capture,tool_output,tool_policy,turn_context}.rs` | Split: upstream lifecycle/mechanics; OpenHuman policy and domain adapters remain behind host traits/context. No forwarding middleware module. |
+| `middleware/loop_guards.rs` | Move generic terminal/no-progress behavior to harness. |
+| `payload_summarizer.rs`, `summarize.rs` | Move generic summarizer orchestration/trait to harness; OpenHuman model selection/config adapter stays. |
+| `turn_policy.rs`, `turn_outcome.rs`, `turn_run_error.rs`, `turn_run_finalize.rs` | Move generic run policy/outcome/finalization upstream; retain product error/progress/cost projection only. |
+| `turn_models.rs`, remaining `routes.rs` | Keep as `ModelResolver` implementation/config projection, then relocate under the host adapter rather than an integration facade. |
+| `thread_context.rs`, `run_cancellation_context.rs`, `stop_hooks.rs`, `steering_forwarder.rs` | Replace with explicit run/child context; keep only product stop-hook adapter. |
+| `orchestration.rs`, `delegation.rs`, `topology.rs` | Move generic lifecycle/helpers to graph; keep product topology composition only where it genuinely names product graphs. |
+| `observability/*` | Keep OpenHuman projection (`AgentProgress`, cost, Langfuse); move reusable graph/event/cap mechanics upstream and import directly. |
+| `journal.rs`, `reaper.rs`, `replay/*` | Keep because layout/RPC are product durability contracts; use upstream journal traits directly. |
+| `todos.rs` | Delete facade; retain one-shot OpenHuman migration in a product startup/migration module. |
+| `embeddings.rs`, `retriever.rs` | Move generic interfaces/adapters upstream where host-free; keep provider/config and memory-domain binding. |
+| `config.rs`, `policy_denial.rs` | Keep product mapping/audit persistence, but relocate beside their host adapters; delete the broad `tinyagents/mod.rs` facade. |
+
+## Acceptance criteria
+
+- Every production turn route calls `AgentHarness::invoke_agent` or
+ `invoke_agent_stream` with a `HostCapabilities` bundle.
+- All ten OpenHuman host adapters have live-path contract tests; none is only
+ test-referenced.
+- There is one public tool trait/result vocabulary (`tinytools`) and one
+ tool-call dialect owner (`tinytools-agent`).
+- Live history is crate-native; OpenHuman transcript conversion appears only
+ at persistence/import/export boundaries.
+- Recursive child runs use `RunContext::child`; no listed agent task-local is
+ read for policy, cancellation, workspace, origin, progress, route, or
+ recursion state.
+- No moved symbol is re-exported from OpenHuman or from a compatibility module
+ in TinyAgents, including a facade over TinyTools, TinyInference, or a sibling
+ TinyAgents crate.
+- `rg` finds none of the deleted modules or adapter names in production code.
+- Security, approval, always-forbidden paths, action-dir isolation, and default
+ denial behavior are unchanged and covered by host integration tests.
diff --git a/package.json b/package.json
index 04822e2f9a..fc156f5b4b 100644
--- a/package.json
+++ b/package.json
@@ -56,6 +56,7 @@
"rust:check": "pnpm --filter openhuman-app rust:check",
"rust:clippy": "cargo clippy -p openhuman -- -D warnings && pnpm --filter openhuman-app rust:clippy",
"rust:layout": "node scripts/ci/check-openhuman-rust-layout.mjs",
+ "agent:runtime-boundary": "node scripts/ci/check-agent-runtime-boundary.mjs",
"typecheck": "pnpm --filter openhuman-app compile",
"tauri:ios:init": "bash scripts/ios-init.sh",
"tauri:ios:dev": "pnpm --filter openhuman-app tauri:ios:dev",
diff --git a/scripts/ci/agent-runtime-boundary-baseline.json b/scripts/ci/agent-runtime-boundary-baseline.json
new file mode 100644
index 0000000000..1a3de7f6aa
--- /dev/null
+++ b/scripts/ci/agent-runtime-boundary-baseline.json
@@ -0,0 +1,3187 @@
+[
+ {
+ "rule": "openhuman-agent-facade",
+ "path": "crates/openhuman-core/src/agent/agent_tests.rs",
+ "line": 27,
+ "text": "use crate::agent::dispatcher::{",
+ "occurrence": 1
+ },
+ {
+ "rule": "openhuman-agent-facade",
+ "path": "crates/openhuman-core/src/agent/dispatcher_tests.rs",
+ "line": 2,
+ "text": "use crate::agent::pformat::PFormatToolParams;",
+ "occurrence": 1
+ },
+ {
+ "rule": "openhuman-agent-facade",
+ "path": "crates/openhuman-core/src/agent/dispatcher.rs",
+ "line": 38,
+ "text": "use crate::agent::pformat::PFormatRegistry;",
+ "occurrence": 1
+ },
+ {
+ "rule": "openhuman-agent-facade",
+ "path": "crates/openhuman-core/src/agent/harness/graph.rs",
+ "line": 168,
+ "text": "use crate::agent::dispatcher::ToolDispatcher;",
+ "occurrence": 1
+ },
+ {
+ "rule": "openhuman-agent-facade",
+ "path": "crates/openhuman-core/src/agent/harness/graph.rs",
+ "line": 170,
+ "text": "crate::agent::dispatcher::NativeToolDispatcher.to_provider_messages(&outcome.conversation)",
+ "occurrence": 1
+ },
+ {
+ "rule": "openhuman-agent-facade",
+ "path": "crates/openhuman-core/src/agent/harness/graph.rs",
+ "line": 175,
+ "text": "crate::agent::dispatcher::XmlToolDispatcher.to_provider_messages(&outcome.conversation)",
+ "occurrence": 1
+ },
+ {
+ "rule": "openhuman-agent-facade",
+ "path": "crates/openhuman-core/src/agent/harness/harness_gap_tests.rs",
+ "line": 46,
+ "text": "use crate::agent::harness::parse::parse_tool_calls;",
+ "occurrence": 1
+ },
+ {
+ "rule": "openhuman-agent-facade",
+ "path": "crates/openhuman-core/src/agent/harness/harness_gap_tests.rs",
+ "line": 77,
+ "text": "use crate::agent::harness::parse::parse_tool_calls;",
+ "occurrence": 1
+ },
+ {
+ "rule": "openhuman-agent-facade",
+ "path": "crates/openhuman-core/src/agent/harness/harness_gap_tests.rs",
+ "line": 105,
+ "text": "use crate::agent::harness::parse::parse_tool_calls;",
+ "occurrence": 1
+ },
+ {
+ "rule": "openhuman-agent-facade",
+ "path": "crates/openhuman-core/src/agent/harness/harness_gap_tests.rs",
+ "line": 130,
+ "text": "use crate::agent::harness::parse::parse_tool_calls;",
+ "occurrence": 1
+ },
+ {
+ "rule": "openhuman-agent-facade",
+ "path": "crates/openhuman-core/src/agent/harness/harness_gap_tests.rs",
+ "line": 147,
+ "text": "use crate::agent::harness::parse::parse_tool_calls;",
+ "occurrence": 1
+ },
+ {
+ "rule": "openhuman-agent-facade",
+ "path": "crates/openhuman-core/src/agent/harness/harness_gap_tests.rs",
+ "line": 158,
+ "text": "use crate::agent::harness::parse::parse_tool_calls;",
+ "occurrence": 1
+ },
+ {
+ "rule": "openhuman-agent-facade",
+ "path": "crates/openhuman-core/src/agent/harness/harness_gap_tests.rs",
+ "line": 177,
+ "text": "use crate::agent::harness::parse::parse_tool_calls;",
+ "occurrence": 1
+ },
+ {
+ "rule": "openhuman-agent-facade",
+ "path": "crates/openhuman-core/src/agent/harness/session/builder/builder_tests_tool_spec_views_tests.rs",
+ "line": 133,
+ "text": ".tool_dispatcher(Box::new(crate::agent::dispatcher::XmlToolDispatcher))",
+ "occurrence": 1
+ },
+ {
+ "rule": "openhuman-agent-facade",
+ "path": "crates/openhuman-core/src/agent/harness/session/builder/factory.rs",
+ "line": 7,
+ "text": "use crate::agent::dispatcher::{NativeToolDispatcher, PFormatToolDispatcher, XmlToolDispatcher};",
+ "occurrence": 1
+ },
+ {
+ "rule": "openhuman-agent-facade",
+ "path": "crates/openhuman-core/src/agent/harness/session/builder/factory.rs",
+ "line": 1058,
+ "text": "let pformat_registry = crate::agent::pformat::build_registry_from_refs(",
+ "occurrence": 1
+ },
+ {
+ "rule": "openhuman-agent-facade",
+ "path": "crates/openhuman-core/src/agent/harness/session/builder/factory.rs",
+ "line": 1066,
+ "text": "let tool_dispatcher: Box<dyn crate::agent::dispatcher::ToolDispatcher> =",
+ "occurrence": 1
+ },
+ {
+ "rule": "openhuman-agent-facade",
+ "path": "crates/openhuman-core/src/agent/harness/session/builder/setters.rs",
+ "line": 149,
+ "text": "tool_dispatcher: Box<dyn crate::agent::dispatcher::ToolDispatcher>,",
+ "occurrence": 1
+ },
+ {
+ "rule": "openhuman-agent-facade",
+ "path": "crates/openhuman-core/src/agent/harness/session/runtime_tests.rs",
+ "line": 2,
+ "text": "use crate::agent::dispatcher::XmlToolDispatcher;",
+ "occurrence": 1
+ },
+ {
+ "rule": "openhuman-agent-facade",
+ "path": "crates/openhuman-core/src/agent/harness/session/runtime_tests.rs",
+ "line": 171,
+ "text": "crate::agent::dispatcher::ParsedToolCall {",
+ "occurrence": 1
+ },
+ {
+ "rule": "openhuman-agent-facade",
+ "path": "crates/openhuman-core/src/agent/harness/session/runtime_tests.rs",
+ "line": 176,
+ "text": "crate::agent::dispatcher::ParsedToolCall {",
+ "occurrence": 1
+ },
+ {
+ "rule": "openhuman-agent-facade",
+ "path": "crates/openhuman-core/src/agent/harness/session/runtime/turn_helpers.rs",
+ "line": 5,
+ "text": "use crate::agent::dispatcher::ParsedToolCall;",
+ "occurrence": 1
+ },
+ {
+ "rule": "openhuman-agent-facade",
+ "path": "crates/openhuman-core/src/agent/harness/session/session_tests.rs",
+ "line": 9,
+ "text": "use crate::agent::dispatcher::{NativeToolDispatcher, XmlToolDispatcher};",
+ "occurrence": 1
+ },
+ {
+ "rule": "openhuman-agent-facade",
+ "path": "crates/openhuman-core/src/agent/harness/session/turn_checkpoint_and_wrapup_tests.rs",
+ "line": 42,
+ "text": "let first_block = crate::agent::harness::parse::extract_json_values(&response)",
+ "occurrence": 1
+ },
+ {
+ "rule": "openhuman-agent-facade",
+ "path": "crates/openhuman-core/src/agent/harness/session/turn_checkpoint_and_wrapup_tests.rs",
+ "line": 220,
+ "text": "let registry = crate::agent::pformat::build_registry(&tools);",
+ "occurrence": 1
+ },
+ {
+ "rule": "openhuman-agent-facade",
+ "path": "crates/openhuman-core/src/agent/harness/session/turn_required_output_tests.rs",
+ "line": 335,
+ "text": "let first_block = crate::agent::harness::parse::extract_json_values(&response)",
+ "occurrence": 1
+ },
+ {
+ "rule": "openhuman-agent-facade",
+ "path": "crates/openhuman-core/src/agent/harness/session/turn_tests.rs",
+ "line": 2,
+ "text": "use crate::agent::dispatcher::{PFormatToolDispatcher, ToolDispatcher, XmlToolDispatcher};",
+ "occurrence": 1
+ },
+ {
+ "rule": "openhuman-agent-facade",
+ "path": "crates/openhuman-core/src/agent/harness/session/turn/mod.rs",
+ "line": 11,
+ "text": "use crate::agent::dispatcher::ParsedToolCall;",
+ "occurrence": 1
+ },
+ {
+ "rule": "openhuman-agent-facade",
+ "path": "crates/openhuman-core/src/agent/harness/session/types.rs",
+ "line": 11,
+ "text": "use crate::agent::dispatcher::ToolDispatcher;",
+ "occurrence": 1
+ },
+ {
+ "rule": "openhuman-agent-facade",
+ "path": "crates/openhuman-core/src/agent/harness/subagent_runner/ops/graph/dispatch.rs",
+ "line": 399,
+ "text": "use crate::agent::dispatcher::ToolDispatcher;",
+ "occurrence": 1
+ },
+ {
+ "rule": "openhuman-agent-facade",
+ "path": "crates/openhuman-core/src/agent/harness/subagent_runner/ops/graph/dispatch.rs",
+ "line": 401,
+ "text": "crate::agent::dispatcher::NativeToolDispatcher.to_provider_messages(&outcome.conversation)",
+ "occurrence": 1
+ },
+ {
+ "rule": "openhuman-agent-facade",
+ "path": "crates/openhuman-core/src/agent/harness/subagent_runner/ops/graph/dispatch.rs",
+ "line": 403,
+ "text": "crate::agent::dispatcher::XmlToolDispatcher.to_provider_messages(&outcome.conversation)",
+ "occurrence": 1
+ },
+ {
+ "rule": "openhuman-agent-facade",
+ "path": "crates/openhuman-core/src/agent/harness/subagent_runner/ops/runner.rs",
+ "line": 1338,
+ "text": "use crate::agent::dispatcher::{",
+ "occurrence": 1
+ },
+ {
+ "rule": "openhuman-agent-facade",
+ "path": "crates/openhuman-core/src/agent/harness/subagent_runner/ops/runner.rs",
+ "line": 1341,
+ "text": "use crate::agent::pformat::PFormatRegistry;",
+ "occurrence": 1
+ },
+ {
+ "rule": "openhuman-agent-facade",
+ "path": "crates/openhuman-core/src/agent/harness/subagent_runner/tool_prep_tests.rs",
+ "line": 265,
+ "text": "let hits = crate::agent::harness::tool_filter::filter_actions_by_prompt(",
+ "occurrence": 1
+ },
+ {
+ "rule": "openhuman-agent-facade",
+ "path": "crates/openhuman-core/src/agent/harness/tool_result_artifacts/mod.rs",
+ "line": 12,
+ "text": "use crate::agent::dispatcher::ToolExecutionResult;",
+ "occurrence": 1
+ },
+ {
+ "rule": "openhuman-agent-facade",
+ "path": "crates/openhuman-core/src/agent/orchestration/tools/spawn_parallel_agents_tests.rs",
+ "line": 3,
+ "text": "use crate::agent::dispatcher::NativeToolDispatcher;",
+ "occurrence": 1
+ },
+ {
+ "rule": "openhuman-agent-facade",
+ "path": "crates/openhuman-core/src/agent/tinyagents/model_g1_usage_tests_tests.rs",
+ "line": 7,
+ "text": "fn empty_registry() -> crate::agent::pformat::PFormatRegistry {",
+ "occurrence": 1
+ },
+ {
+ "rule": "openhuman-agent-facade",
+ "path": "crates/openhuman-core/src/agent/tinyagents/model_g1_usage_tests_tests.rs",
+ "line": 8,
+ "text": "crate::agent::pformat::PFormatRegistry::default()",
+ "occurrence": 1
+ },
+ {
+ "rule": "openhuman-agent-facade",
+ "path": "crates/openhuman-core/src/agent/tinyagents/model.rs",
+ "line": 41,
+ "text": "fn pformat_registry_from_request(request: &ModelRequest) -> crate::agent::pformat::PFormatRegistry {",
+ "occurrence": 1
+ },
+ {
+ "rule": "openhuman-agent-facade",
+ "path": "crates/openhuman-core/src/agent/tinyagents/model.rs",
+ "line": 48,
+ "text": "crate::agent::pformat::PFormatToolParams::from_schema(&t.parameters),",
+ "occurrence": 1
+ },
+ {
+ "rule": "openhuman-agent-facade",
+ "path": "crates/openhuman-core/src/agent/tinyagents/model.rs",
+ "line": 74,
+ "text": "pformat_registry: &crate::agent::pformat::PFormatRegistry,",
+ "occurrence": 1
+ },
+ {
+ "rule": "openhuman-agent-facade",
+ "path": "crates/openhuman-core/src/agent/tinyagents/model.rs",
+ "line": 170,
+ "text": "&crate::agent::pformat::PFormatRegistry::default(),",
+ "occurrence": 1
+ },
+ {
+ "rule": "openhuman-runtime-bridge",
+ "path": "crates/openhuman-core/src/agent/harness/graph.rs",
+ "line": 37,
+ "text": "use crate::agent::tinyagents::run_turn_via_tinyagents_shared;",
+ "occurrence": 1
+ },
+ {
+ "rule": "openhuman-runtime-bridge",
+ "path": "crates/openhuman-core/src/agent/harness/graph.rs",
+ "line": 117,
+ "text": "let outcome = run_turn_via_tinyagents_shared(",
+ "occurrence": 1
+ },
+ {
+ "rule": "openhuman-runtime-bridge",
+ "path": "crates/openhuman-core/src/agent/harness/session/turn/graph.rs",
+ "line": 37,
+ "text": "run_turn_via_tinyagents_shared, TinyagentsTurnOutcome, TurnContextMiddleware,",
+ "occurrence": 1
+ },
+ {
+ "rule": "openhuman-runtime-bridge",
+ "path": "crates/openhuman-core/src/agent/harness/session/turn/graph.rs",
+ "line": 115,
+ "text": "run_turn_via_tinyagents_shared(",
+ "occurrence": 1
+ },
+ {
+ "rule": "openhuman-runtime-bridge",
+ "path": "crates/openhuman-core/src/agent/harness/subagent_runner/ops/graph/dispatch.rs",
+ "line": 13,
+ "text": "use crate::agent::tinyagents::{run_turn_via_tinyagents_shared, SubagentScope};",
+ "occurrence": 1
+ },
+ {
+ "rule": "openhuman-runtime-bridge",
+ "path": "crates/openhuman-core/src/agent/harness/subagent_runner/ops/graph/dispatch.rs",
+ "line": 262,
+ "text": "let run_result = Box::pin(run_turn_via_tinyagents_shared(",
+ "occurrence": 1
+ },
+ {
+ "rule": "openhuman-runtime-bridge",
+ "path": "crates/openhuman-core/src/agent/tinyagents/convert_tests.rs",
+ "line": 10,
+ "text": "let schema = spec_to_schema(&spec);",
+ "occurrence": 1
+ },
+ {
+ "rule": "openhuman-runtime-bridge",
+ "path": "crates/openhuman-core/src/agent/tinyagents/convert.rs",
+ "line": 11,
+ "text": "pub(crate) fn spec_to_schema(spec: &ToolSpec) -> ToolSchema {",
+ "occurrence": 1
+ },
+ {
+ "rule": "openhuman-runtime-bridge",
+ "path": "crates/openhuman-core/src/agent/tinyagents/harness_assembly.rs",
+ "line": 110,
+ "text": "pub(super) fn assemble_turn_harness(",
+ "occurrence": 1
+ },
+ {
+ "rule": "openhuman-runtime-bridge",
+ "path": "crates/openhuman-core/src/agent/tinyagents/harness_tool_registration.rs",
+ "line": 14,
+ "text": "use crate::agent::tinyagents::tools::{EarlyExitHook, SharedToolAdapter};",
+ "occurrence": 1
+ },
+ {
+ "rule": "openhuman-runtime-bridge",
+ "path": "crates/openhuman-core/src/agent/tinyagents/harness_tool_registration.rs",
+ "line": 82,
+ "text": "if let Some(mut adapter) = SharedToolAdapter::for_name(tool_sets.to_vec(), name) {",
+ "occurrence": 1
+ },
+ {
+ "rule": "openhuman-runtime-bridge",
+ "path": "crates/openhuman-core/src/agent/tinyagents/middleware/arg_recovery.rs",
+ "line": 123,
+ "text": ".map(|tool| crate::agent::tinyagents::convert::spec_to_schema(&tool.spec()))",
+ "occurrence": 1
+ },
+ {
+ "rule": "openhuman-runtime-bridge",
+ "path": "crates/openhuman-core/src/agent/tinyagents/mod.rs",
+ "line": 92,
+ "text": "pub(crate) use turn_runner::run_turn_via_tinyagents_shared;",
+ "occurrence": 1
+ },
+ {
+ "rule": "openhuman-runtime-bridge",
+ "path": "crates/openhuman-core/src/agent/tinyagents/tools_tests.rs",
+ "line": 61,
+ "text": "execute_openhuman_tool(&HangingTool, call(\"hang\", serde_json::json!({})), None).await;",
+ "occurrence": 1
+ },
+ {
+ "rule": "openhuman-runtime-bridge",
+ "path": "crates/openhuman-core/src/agent/tinyagents/tools_tests.rs",
+ "line": 75,
+ "text": "let result = execute_openhuman_tool(",
+ "occurrence": 1
+ },
+ {
+ "rule": "openhuman-runtime-bridge",
+ "path": "crates/openhuman-core/src/agent/tinyagents/tools.rs",
+ "line": 80,
+ "text": "pub(crate) struct ToolAdapter {",
+ "occurrence": 1
+ },
+ {
+ "rule": "openhuman-runtime-bridge",
+ "path": "crates/openhuman-core/src/agent/tinyagents/tools.rs",
+ "line": 85,
+ "text": "impl ToolAdapter {",
+ "occurrence": 1
+ },
+ {
+ "rule": "openhuman-runtime-bridge",
+ "path": "crates/openhuman-core/src/agent/tinyagents/tools.rs",
+ "line": 94,
+ "text": "impl Tool<()> for ToolAdapter {",
+ "occurrence": 1
+ },
+ {
+ "rule": "openhuman-runtime-bridge",
+ "path": "crates/openhuman-core/src/agent/tinyagents/tools.rs",
+ "line": 104,
+ "text": "super::convert::spec_to_schema(&self.inner.spec())",
+ "occurrence": 1
+ },
+ {
+ "rule": "openhuman-runtime-bridge",
+ "path": "crates/openhuman-core/src/agent/tinyagents/tools.rs",
+ "line": 116,
+ "text": "Ok(execute_openhuman_tool(self.inner.as_ref(), call, None).await)",
+ "occurrence": 1
+ },
+ {
+ "rule": "openhuman-runtime-bridge",
+ "path": "crates/openhuman-core/src/agent/tinyagents/tools.rs",
+ "line": 125,
+ "text": "Ok(execute_openhuman_tool(self.inner.as_ref(), call, Some(&context)).await)",
+ "occurrence": 1
+ },
+ {
+ "rule": "openhuman-runtime-bridge",
+ "path": "crates/openhuman-core/src/agent/tinyagents/tools.rs",
+ "line": 194,
+ "text": "pub(crate) async fn execute_openhuman_tool(",
+ "occurrence": 1
+ },
+ {
+ "rule": "openhuman-runtime-bridge",
+ "path": "crates/openhuman-core/src/agent/tinyagents/tools.rs",
+ "line": 322,
+ "text": "pub(crate) struct SharedToolAdapter {",
+ "occurrence": 1
+ },
+ {
+ "rule": "openhuman-runtime-bridge",
+ "path": "crates/openhuman-core/src/agent/tinyagents/tools.rs",
+ "line": 332,
+ "text": "impl SharedToolAdapter {",
+ "occurrence": 1
+ },
+ {
+ "rule": "openhuman-runtime-bridge",
+ "path": "crates/openhuman-core/src/agent/tinyagents/tools.rs",
+ "line": 348,
+ "text": "schema: super::convert::spec_to_schema(&spec),",
+ "occurrence": 1
+ },
+ {
+ "rule": "openhuman-runtime-bridge",
+ "path": "crates/openhuman-core/src/agent/tinyagents/tools.rs",
+ "line": 363,
+ "text": "impl Tool<()> for SharedToolAdapter {",
+ "occurrence": 1
+ },
+ {
+ "rule": "openhuman-runtime-bridge",
+ "path": "crates/openhuman-core/src/agent/tinyagents/tools.rs",
+ "line": 398,
+ "text": "impl SharedToolAdapter {",
+ "occurrence": 1
+ },
+ {
+ "rule": "openhuman-runtime-bridge",
+ "path": "crates/openhuman-core/src/agent/tinyagents/tools.rs",
+ "line": 411,
+ "text": "let result = execute_openhuman_tool(tool.as_ref(), call, context).await;",
+ "occurrence": 1
+ },
+ {
+ "rule": "openhuman-runtime-bridge",
+ "path": "crates/openhuman-core/src/agent/tinyagents/turn_runner.rs",
+ "line": 30,
+ "text": "use crate::agent::tinyagents::harness_assembly::{assemble_turn_harness, AssembledTurnHarness};",
+ "occurrence": 1
+ },
+ {
+ "rule": "openhuman-runtime-bridge",
+ "path": "crates/openhuman-core/src/agent/tinyagents/turn_runner.rs",
+ "line": 35,
+ "text": "use crate::agent::tinyagents::tools::ToolAdapter;",
+ "occurrence": 1
+ },
+ {
+ "rule": "openhuman-runtime-bridge",
+ "path": "crates/openhuman-core/src/agent/tinyagents/turn_runner.rs",
+ "line": 79,
+ "text": "harness.register_tool(Arc::new(ToolAdapter::new(tool)));",
+ "occurrence": 1
+ },
+ {
+ "rule": "openhuman-runtime-bridge",
+ "path": "crates/openhuman-core/src/agent/tinyagents/turn_runner.rs",
+ "line": 201,
+ "text": "pub(crate) async fn run_turn_via_tinyagents_shared(",
+ "occurrence": 1
+ },
+ {
+ "rule": "openhuman-runtime-bridge",
+ "path": "crates/openhuman-core/src/agent/tinyagents/turn_runner.rs",
+ "line": 256,
+ "text": "} = assemble_turn_harness(",
+ "occurrence": 1
+ },
+ {
+ "rule": "openhuman-runtime-bridge",
+ "path": "crates/openhuman-core/src/mcp/server/tools/dispatch.rs",
+ "line": 4,
+ "text": "use crate::agent::tinyagents::convert::spec_to_schema;",
+ "occurrence": 1
+ },
+ {
+ "rule": "openhuman-runtime-bridge",
+ "path": "crates/openhuman-core/src/mcp/server/tools/dispatch.rs",
+ "line": 242,
+ "text": ".map(|spec| spec_to_schema(spec))",
+ "occurrence": 1
+ },
+ {
+ "rule": "openhuman-task-local",
+ "path": "crates/openhuman-core/src/agent/bus.rs",
+ "line": 37,
+ "text": "use super::harness::{run_channel_turn_via_graph, with_current_sandbox_mode};",
+ "occurrence": 1
+ },
+ {
+ "rule": "openhuman-task-local",
+ "path": "crates/openhuman-core/src/agent/bus.rs",
+ "line": 294,
+ "text": "let (text, resolved_route) = with_resolved_provider_route_scope(async {",
+ "occurrence": 1
+ },
+ {
+ "rule": "openhuman-task-local",
+ "path": "crates/openhuman-core/src/agent/bus.rs",
+ "line": 295,
+ "text": "let text = turn_origin::with_origin(",
+ "occurrence": 1
+ },
+ {
+ "rule": "openhuman-task-local",
+ "path": "crates/openhuman-core/src/agent/bus.rs",
+ "line": 299,
+ "text": "with_current_sandbox_mode(sandbox_mode, async {",
+ "occurrence": 1
+ },
+ {
+ "rule": "openhuman-task-local",
+ "path": "crates/openhuman-core/src/agent/bus.rs",
+ "line": 327,
+ "text": "let resolved_route = current_resolved_provider_route();",
+ "occurrence": 1
+ },
+ {
+ "rule": "openhuman-task-local",
+ "path": "crates/openhuman-core/src/agent/harness/fork_context.rs",
+ "line": 170,
+ "text": "tokio::task_local! {",
+ "occurrence": 1
+ },
+ {
+ "rule": "openhuman-task-local",
+ "path": "crates/openhuman-core/src/agent/harness/fork_context.rs",
+ "line": 174,
+ "text": "pub static PARENT_CONTEXT: ParentExecutionContext;",
+ "occurrence": 1
+ },
+ {
+ "rule": "openhuman-task-local",
+ "path": "crates/openhuman-core/src/agent/harness/fork_context.rs",
+ "line": 180,
+ "text": "pub static AGENT_CONTEXT_PREPARED_SOURCES: Arc<Vec<AgentContextPreparedSource>>;",
+ "occurrence": 1
+ },
+ {
+ "rule": "openhuman-task-local",
+ "path": "crates/openhuman-core/src/agent/harness/fork_context.rs",
+ "line": 187,
+ "text": "pub fn current_parent() -> Option<ParentExecutionContext> {",
+ "occurrence": 1
+ },
+ {
+ "rule": "openhuman-task-local",
+ "path": "crates/openhuman-core/src/agent/harness/fork_context.rs",
+ "line": 188,
+ "text": "PARENT_CONTEXT.try_with(|ctx| ctx.clone()).ok()",
+ "occurrence": 1
+ },
+ {
+ "rule": "openhuman-task-local",
+ "path": "crates/openhuman-core/src/agent/harness/fork_context.rs",
+ "line": 199,
+ "text": "PARENT_CONTEXT.scope(ctx, Box::pin(future)).await",
+ "occurrence": 1
+ },
+ {
+ "rule": "openhuman-task-local",
+ "path": "crates/openhuman-core/src/agent/harness/fork_context.rs",
+ "line": 204,
+ "text": "pub fn current_agent_context_prepared_sources() -> Vec<AgentContextPreparedSource> {",
+ "occurrence": 1
+ },
+ {
+ "rule": "openhuman-task-local",
+ "path": "crates/openhuman-core/src/agent/harness/fork_context.rs",
+ "line": 205,
+ "text": "AGENT_CONTEXT_PREPARED_SOURCES",
+ "occurrence": 1
+ },
+ {
+ "rule": "openhuman-task-local",
+ "path": "crates/openhuman-core/src/agent/harness/fork_context.rs",
+ "line": 222,
+ "text": "AGENT_CONTEXT_PREPARED_SOURCES",
+ "occurrence": 1
+ },
+ {
+ "rule": "openhuman-task-local",
+ "path": "crates/openhuman-core/src/agent/harness/memory_context.rs",
+ "line": 122,
+ "text": "let current_thread_id = crate::agent::tinyagents::thread_context::current_thread_id();",
+ "occurrence": 1
+ },
+ {
+ "rule": "openhuman-task-local",
+ "path": "crates/openhuman-core/src/agent/harness/mod.rs",
+ "line": 31,
+ "text": "pub mod fork_context;",
+ "occurrence": 1
+ },
+ {
+ "rule": "openhuman-task-local",
+ "path": "crates/openhuman-core/src/agent/harness/mod.rs",
+ "line": 40,
+ "text": "pub mod sandbox_context;",
+ "occurrence": 1
+ },
+ {
+ "rule": "openhuman-task-local",
+ "path": "crates/openhuman-core/src/agent/harness/mod.rs",
+ "line": 42,
+ "text": "mod spawn_depth_context;",
+ "occurrence": 1
+ },
+ {
+ "rule": "openhuman-task-local",
+ "path": "crates/openhuman-core/src/agent/harness/mod.rs",
+ "line": 44,
+ "text": "pub mod task_recency_context;",
+ "occurrence": 1
+ },
+ {
+ "rule": "openhuman-task-local",
+ "path": "crates/openhuman-core/src/agent/harness/mod.rs",
+ "line": 47,
+ "text": "pub mod turn_attachments_context;",
+ "occurrence": 1
+ },
+ {
+ "rule": "openhuman-task-local",
+ "path": "crates/openhuman-core/src/agent/harness/mod.rs",
+ "line": 48,
+ "text": "pub mod turn_dispatch_guard;",
+ "occurrence": 1
+ },
+ {
+ "rule": "openhuman-task-local",
+ "path": "crates/openhuman-core/src/agent/harness/mod.rs",
+ "line": 49,
+ "text": "pub mod turn_subagent_usage;",
+ "occurrence": 1
+ },
+ {
+ "rule": "openhuman-task-local",
+ "path": "crates/openhuman-core/src/agent/harness/mod.rs",
+ "line": 63,
+ "text": "pub use sandbox_context::{current_sandbox_mode, with_current_sandbox_mode};",
+ "occurrence": 1
+ },
+ {
+ "rule": "openhuman-task-local",
+ "path": "crates/openhuman-core/src/agent/harness/mod.rs",
+ "line": 64,
+ "text": "pub(crate) use spawn_depth_context::{current_spawn_depth, with_spawn_depth, MAX_SPAWN_DEPTH};",
+ "occurrence": 1
+ },
+ {
+ "rule": "openhuman-task-local",
+ "path": "crates/openhuman-core/src/agent/harness/mod.rs",
+ "line": 66,
+ "text": "pub use task_recency_context::{current_task_recency_window, with_task_recency_window};",
+ "occurrence": 1
+ },
+ {
+ "rule": "openhuman-task-local",
+ "path": "crates/openhuman-core/src/agent/harness/sandbox_context.rs",
+ "line": 25,
+ "text": "tokio::task_local! {",
+ "occurrence": 1
+ },
+ {
+ "rule": "openhuman-task-local",
+ "path": "crates/openhuman-core/src/agent/harness/sandbox_context.rs",
+ "line": 30,
+ "text": "pub static CURRENT_AGENT_SANDBOX_MODE: SandboxMode;",
+ "occurrence": 1
+ },
+ {
+ "rule": "openhuman-task-local",
+ "path": "crates/openhuman-core/src/agent/harness/sandbox_context.rs",
+ "line": 38,
+ "text": "pub fn current_sandbox_mode() -> Option<SandboxMode> {",
+ "occurrence": 1
+ },
+ {
+ "rule": "openhuman-task-local",
+ "path": "crates/openhuman-core/src/agent/harness/sandbox_context.rs",
+ "line": 39,
+ "text": "CURRENT_AGENT_SANDBOX_MODE.try_with(|mode| *mode).ok()",
+ "occurrence": 1
+ },
+ {
+ "rule": "openhuman-task-local",
+ "path": "crates/openhuman-core/src/agent/harness/sandbox_context.rs",
+ "line": 56,
+ "text": "CURRENT_AGENT_SANDBOX_MODE",
+ "occurrence": 1
+ },
+ {
+ "rule": "openhuman-task-local",
+ "path": "crates/openhuman-core/src/agent/harness/session/builder/factory.rs",
+ "line": 1518,
+ "text": "let root = crate::agent::turn_workspace::current()?;",
+ "occurrence": 1
+ },
+ {
+ "rule": "openhuman-task-local",
+ "path": "crates/openhuman-core/src/agent/harness/session/turn/core_turn.rs",
+ "line": 261,
+ "text": "if self.auto_save && crate::agent::turn_origin::current_is_user_authored() {",
+ "occurrence": 1
+ },
+ {
+ "rule": "openhuman-task-local",
+ "path": "crates/openhuman-core/src/agent/harness/session/turn/core_turn.rs",
+ "line": 288,
+ "text": "crate::agent::tinyagents::thread_context::current_thread_id();",
+ "occurrence": 1
+ },
+ {
+ "rule": "openhuman-task-local",
+ "path": "crates/openhuman-core/src/agent/harness/session/turn/core_turn.rs",
+ "line": 670,
+ "text": "harness::with_parent_context(",
+ "occurrence": 1
+ },
+ {
+ "rule": "openhuman-task-local",
+ "path": "crates/openhuman-core/src/agent/harness/session/turn/core_turn.rs",
+ "line": 672,
+ "text": "harness::with_agent_context_prepared_sources(",
+ "occurrence": 1
+ },
+ {
+ "rule": "openhuman-task-local",
+ "path": "crates/openhuman-core/src/agent/harness/session/turn/core_turn.rs",
+ "line": 674,
+ "text": "harness::turn_attachments_context::with_current_turn_image_placeholders(",
+ "occurrence": 1
+ },
+ {
+ "rule": "openhuman-task-local",
+ "path": "crates/openhuman-core/src/agent/harness/session/turn/core_turn.rs",
+ "line": 682,
+ "text": "harness::with_parent_context(",
+ "occurrence": 1
+ },
+ {
+ "rule": "openhuman-task-local",
+ "path": "crates/openhuman-core/src/agent/harness/session/turn/core_turn.rs",
+ "line": 684,
+ "text": "harness::with_agent_context_prepared_sources(",
+ "occurrence": 1
+ },
+ {
+ "rule": "openhuman-task-local",
+ "path": "crates/openhuman-core/src/agent/harness/session/turn/core_turn.rs",
+ "line": 686,
+ "text": "harness::turn_attachments_context::with_current_turn_image_placeholders(",
+ "occurrence": 1
+ },
+ {
+ "rule": "openhuman-task-local",
+ "path": "crates/openhuman-core/src/agent/harness/session/turn/core/experience_context.rs",
+ "line": 141,
+ "text": "let result = harness::with_parent_context(parent_context.clone(), async move {",
+ "occurrence": 1
+ },
+ {
+ "rule": "openhuman-task-local",
+ "path": "crates/openhuman-core/src/agent/harness/session/turn/core/failed_turn.rs",
+ "line": 79,
+ "text": "crate::agent::turn_origin::current_request_id()",
+ "occurrence": 1
+ },
+ {
+ "rule": "openhuman-task-local",
+ "path": "crates/openhuman-core/src/agent/harness/session/turn/core/harness_turn.rs",
+ "line": 173,
+ "text": "crate::agent::harness::turn_subagent_usage::with_turn_collector(",
+ "occurrence": 1
+ },
+ {
+ "rule": "openhuman-task-local",
+ "path": "crates/openhuman-core/src/agent/harness/session/turn/core/harness_turn.rs",
+ "line": 210,
+ "text": "crate::agent::harness::turn_dispatch_guard::with_dispatch_guard(",
+ "occurrence": 1
+ },
+ {
+ "rule": "openhuman-task-local",
+ "path": "crates/openhuman-core/src/agent/harness/session/turn/graph.rs",
+ "line": 33,
+ "text": "use crate::agent::harness::{with_current_sandbox_mode, SandboxMode};",
+ "occurrence": 1
+ },
+ {
+ "rule": "openhuman-task-local",
+ "path": "crates/openhuman-core/src/agent/harness/session/turn/graph.rs",
+ "line": 114,
+ "text": "with_current_sandbox_mode(graph.sandbox_mode, async {",
+ "occurrence": 1
+ },
+ {
+ "rule": "openhuman-task-local",
+ "path": "crates/openhuman-core/src/agent/harness/session/turn/session_io/background_tasks.rs",
+ "line": 78,
+ "text": "let result = harness::with_parent_context(parent_ctx, fut).await;",
+ "occurrence": 1
+ },
+ {
+ "rule": "openhuman-task-local",
+ "path": "crates/openhuman-core/src/agent/harness/session/turn/session_io/transcript_persist.rs",
+ "line": 56,
+ "text": "thread_id: crate::agent::tinyagents::thread_context::current_thread_id(),",
+ "occurrence": 1
+ },
+ {
+ "rule": "openhuman-task-local",
+ "path": "crates/openhuman-core/src/agent/harness/session/turn/session_io/transcript_persist.rs",
+ "line": 119,
+ "text": "let request_id = crate::agent::turn_origin::current_request_id();",
+ "occurrence": 1
+ },
+ {
+ "rule": "openhuman-task-local",
+ "path": "crates/openhuman-core/src/agent/harness/session/turn/tools.rs",
+ "line": 35,
+ "text": "let workspace_descriptor = harness::current_parent()",
+ "occurrence": 1
+ },
+ {
+ "rule": "openhuman-task-local",
+ "path": "crates/openhuman-core/src/agent/harness/spawn_depth_context.rs",
+ "line": 44,
+ "text": "tokio::task_local! {",
+ "occurrence": 1
+ },
+ {
+ "rule": "openhuman-task-local",
+ "path": "crates/openhuman-core/src/agent/harness/spawn_depth_context.rs",
+ "line": 52,
+ "text": "pub(crate) fn current_spawn_depth() -> usize {",
+ "occurrence": 1
+ },
+ {
+ "rule": "openhuman-task-local",
+ "path": "crates/openhuman-core/src/agent/harness/subagent_runner/extract_tool.rs",
+ "line": 589,
+ "text": "thread_id: crate::agent::tinyagents::thread_context::current_thread_id(),",
+ "occurrence": 1
+ },
+ {
+ "rule": "openhuman-task-local",
+ "path": "crates/openhuman-core/src/agent/harness/subagent_runner/ops/graph/transcript.rs",
+ "line": 99,
+ "text": "thread_id: crate::agent::tinyagents::thread_context::current_thread_id(),",
+ "occurrence": 1
+ },
+ {
+ "rule": "openhuman-task-local",
+ "path": "crates/openhuman-core/src/agent/harness/subagent_runner/ops/mod.rs",
+ "line": 73,
+ "text": "pub(super) use crate::agent::harness::{current_spawn_depth, with_spawn_depth, MAX_SPAWN_DEPTH};",
+ "occurrence": 1
+ },
+ {
+ "rule": "openhuman-task-local",
+ "path": "crates/openhuman-core/src/agent/harness/subagent_runner/ops/runner.rs",
+ "line": 411,
+ "text": "match turn_dispatch_guard::check() {",
+ "occurrence": 1
+ },
+ {
+ "rule": "openhuman-task-local",
+ "path": "crates/openhuman-core/src/agent/harness/subagent_runner/ops/runner.rs",
+ "line": 451,
+ "text": "let parent = current_parent().ok_or(SubagentRunError::NoParentContext)?;",
+ "occurrence": 1
+ },
+ {
+ "rule": "openhuman-task-local",
+ "path": "crates/openhuman-core/src/agent/harness/subagent_runner/ops/runner.rs",
+ "line": 453,
+ "text": "let current_depth = current_spawn_depth();",
+ "occurrence": 1
+ },
+ {
+ "rule": "openhuman-task-local",
+ "path": "crates/openhuman-core/src/agent/harness/subagent_runner/ops/runner.rs",
+ "line": 557,
+ "text": "turn_dispatch_guard::record_subagent_elapsed(started.elapsed());",
+ "occurrence": 1
+ },
+ {
+ "rule": "openhuman-task-local",
+ "path": "crates/openhuman-core/src/agent/harness/subagent_runner/ops/runner.rs",
+ "line": 598,
+ "text": "let run_result = with_spawn_depth(attempted_depth, async {",
+ "occurrence": 1
+ },
+ {
+ "rule": "openhuman-task-local",
+ "path": "crates/openhuman-core/src/agent/harness/subagent_runner/ops/runner.rs",
+ "line": 600,
+ "text": "with_current_sandbox_mode(definition.sandbox_mode, async {",
+ "occurrence": 1
+ },
+ {
+ "rule": "openhuman-task-local",
+ "path": "crates/openhuman-core/src/agent/harness/subagent_runner/ops/runner.rs",
+ "line": 601,
+ "text": "with_parent_context(parent_for_subagent.clone(), async {",
+ "occurrence": 1
+ },
+ {
+ "rule": "openhuman-task-local",
+ "path": "crates/openhuman-core/src/agent/harness/subagent_runner/ops/runner.rs",
+ "line": 636,
+ "text": "turn_dispatch_guard::record_subagent_elapsed(started.elapsed());",
+ "occurrence": 1
+ },
+ {
+ "rule": "openhuman-task-local",
+ "path": "crates/openhuman-core/src/agent/harness/subagent_runner/ops/runner.rs",
+ "line": 1744,
+ "text": "crate::agent::harness::turn_subagent_usage::record_subagent_usage(",
+ "occurrence": 1
+ },
+ {
+ "rule": "openhuman-task-local",
+ "path": "crates/openhuman-core/src/agent/harness/task_recency_context.rs",
+ "line": 23,
+ "text": "tokio::task_local! {",
+ "occurrence": 1
+ },
+ {
+ "rule": "openhuman-task-local",
+ "path": "crates/openhuman-core/src/agent/harness/task_recency_context.rs",
+ "line": 27,
+ "text": "pub static TASK_RECENCY_WINDOW: Duration;",
+ "occurrence": 1
+ },
+ {
+ "rule": "openhuman-task-local",
+ "path": "crates/openhuman-core/src/agent/harness/task_recency_context.rs",
+ "line": 35,
+ "text": "pub fn current_task_recency_window() -> Option<Duration> {",
+ "occurrence": 1
+ },
+ {
+ "rule": "openhuman-task-local",
+ "path": "crates/openhuman-core/src/agent/harness/task_recency_context.rs",
+ "line": 36,
+ "text": "let window = TASK_RECENCY_WINDOW.try_with(|w| *w).ok();",
+ "occurrence": 1
+ },
+ {
+ "rule": "openhuman-task-local",
+ "path": "crates/openhuman-core/src/agent/harness/task_recency_context.rs",
+ "line": 59,
+ "text": "let out = TASK_RECENCY_WINDOW.scope(window, future).await;",
+ "occurrence": 1
+ },
+ {
+ "rule": "openhuman-task-local",
+ "path": "crates/openhuman-core/src/agent/harness/turn_attachments_context.rs",
+ "line": 20,
+ "text": "tokio::task_local! {",
+ "occurrence": 1
+ },
+ {
+ "rule": "openhuman-task-local",
+ "path": "crates/openhuman-core/src/agent/harness/turn_attachments_context.rs",
+ "line": 22,
+ "text": "pub static CURRENT_TURN_IMAGE_PLACEHOLDERS: Vec<String>;",
+ "occurrence": 1
+ },
+ {
+ "rule": "openhuman-task-local",
+ "path": "crates/openhuman-core/src/agent/harness/turn_attachments_context.rs",
+ "line": 26,
+ "text": "pub fn current_turn_image_placeholders() -> Vec<String> {",
+ "occurrence": 1
+ },
+ {
+ "rule": "openhuman-task-local",
+ "path": "crates/openhuman-core/src/agent/harness/turn_attachments_context.rs",
+ "line": 27,
+ "text": "CURRENT_TURN_IMAGE_PLACEHOLDERS",
+ "occurrence": 1
+ },
+ {
+ "rule": "openhuman-task-local",
+ "path": "crates/openhuman-core/src/agent/harness/turn_attachments_context.rs",
+ "line": 42,
+ "text": "CURRENT_TURN_IMAGE_PLACEHOLDERS",
+ "occurrence": 1
+ },
+ {
+ "rule": "openhuman-task-local",
+ "path": "crates/openhuman-core/src/agent/harness/turn_dispatch_guard.rs",
+ "line": 239,
+ "text": "tokio::task_local! {",
+ "occurrence": 1
+ },
+ {
+ "rule": "openhuman-task-local",
+ "path": "crates/openhuman-core/src/agent/harness/turn_subagent_usage.rs",
+ "line": 66,
+ "text": "tokio::task_local! {",
+ "occurrence": 1
+ },
+ {
+ "rule": "openhuman-task-local",
+ "path": "crates/openhuman-core/src/agent/harness/turn_subagent_usage.rs",
+ "line": 83,
+ "text": "pub(crate) fn record_subagent_usage(task_id: &str, agent_id: &str, usage: SubagentUsage) {",
+ "occurrence": 1
+ },
+ {
+ "rule": "openhuman-task-local",
+ "path": "crates/openhuman-core/src/agent/orchestration/agent_teams/runtime.rs",
+ "line": 161,
+ "text": "let inherited_origin = crate::agent::turn_origin::capture();",
+ "occurrence": 1
+ },
+ {
+ "rule": "openhuman-task-local",
+ "path": "crates/openhuman-core/src/agent/orchestration/agent_teams/runtime.rs",
+ "line": 163,
+ "text": "crate::agent::turn_origin::with_inherited_origin(",
+ "occurrence": 1
+ },
+ {
+ "rule": "openhuman-task-local",
+ "path": "crates/openhuman-core/src/agent/orchestration/delegation.rs",
+ "line": 21,
+ "text": "use crate::agent::harness::fork_context::{current_parent, with_parent_context};",
+ "occurrence": 1
+ },
+ {
+ "rule": "openhuman-task-local",
+ "path": "crates/openhuman-core/src/agent/orchestration/delegation.rs",
+ "line": 141,
+ "text": "if current_parent().is_some() {",
+ "occurrence": 1
+ },
+ {
+ "rule": "openhuman-task-local",
+ "path": "crates/openhuman-core/src/agent/orchestration/delegation.rs",
+ "line": 147,
+ "text": "with_parent_context(parent, run).await",
+ "occurrence": 1
+ },
+ {
+ "rule": "openhuman-task-local",
+ "path": "crates/openhuman-core/src/agent/orchestration/ops.rs",
+ "line": 167,
+ "text": "let parent = current_parent().ok_or(OrchestrationError::NoParentContext)?;",
+ "occurrence": 1
+ },
+ {
+ "rule": "openhuman-task-local",
+ "path": "crates/openhuman-core/src/agent/orchestration/ops.rs",
+ "line": 399,
+ "text": "let handle = tokio::spawn(crate::agent::turn_origin::propagate(",
+ "occurrence": 1
+ },
+ {
+ "rule": "openhuman-task-local",
+ "path": "crates/openhuman-core/src/agent/orchestration/ops.rs",
+ "line": 400,
+ "text": "crate::agent::turn_workspace::propagate(async move {",
+ "occurrence": 1
+ },
+ {
+ "rule": "openhuman-task-local",
+ "path": "crates/openhuman-core/src/agent/orchestration/ops.rs",
+ "line": 402,
+ "text": "let result = with_parent_context(parent, async move {",
+ "occurrence": 1
+ },
+ {
+ "rule": "openhuman-task-local",
+ "path": "crates/openhuman-core/src/agent/orchestration/parent_context/builder.rs",
+ "line": 166,
+ "text": "if current_parent().is_some() {",
+ "occurrence": 1
+ },
+ {
+ "rule": "openhuman-task-local",
+ "path": "crates/openhuman-core/src/agent/orchestration/parent_context/builder.rs",
+ "line": 170,
+ "text": "Ok(with_parent_context(parent, fut).await)",
+ "occurrence": 1
+ },
+ {
+ "rule": "openhuman-task-local",
+ "path": "crates/openhuman-core/src/agent/orchestration/spawn_parallel_graph/run.rs",
+ "line": 11,
+ "text": "use crate::agent::harness::fork_context::current_parent;",
+ "occurrence": 1
+ },
+ {
+ "rule": "openhuman-task-local",
+ "path": "crates/openhuman-core/src/agent/orchestration/spawn_parallel_graph/run.rs",
+ "line": 53,
+ "text": "let parent = match current_parent() {",
+ "occurrence": 1
+ },
+ {
+ "rule": "openhuman-task-local",
+ "path": "crates/openhuman-core/src/agent/orchestration/tools/agent_prepare_context/scout_run.rs",
+ "line": 6,
+ "text": "use crate::agent::harness::fork_context::{current_parent, AgentContextPreparedSource};",
+ "occurrence": 1
+ },
+ {
+ "rule": "openhuman-task-local",
+ "path": "crates/openhuman-core/src/agent/orchestration/tools/agent_prepare_context/scout_run.rs",
+ "line": 11,
+ "text": "use crate::agent::tinyagents::thread_context::current_thread_id;",
+ "occurrence": 1
+ },
+ {
+ "rule": "openhuman-task-local",
+ "path": "crates/openhuman-core/src/agent/orchestration/tools/agent_prepare_context/scout_run.rs",
+ "line": 258,
+ "text": "let parent_session = current_parent()",
+ "occurrence": 1
+ },
+ {
+ "rule": "openhuman-task-local",
+ "path": "crates/openhuman-core/src/agent/orchestration/tools/agent_prepare_context/scout_run.rs",
+ "line": 261,
+ "text": "let progress_sink = current_parent().and_then(|p| p.on_progress.clone());",
+ "occurrence": 1
+ },
+ {
+ "rule": "openhuman-task-local",
+ "path": "crates/openhuman-core/src/agent/orchestration/tools/agent_prepare_context/scout_run.rs",
+ "line": 396,
+ "text": "if let (Some(parent), Some(thread_id)) = (current_parent(), current_thread_id()) {",
+ "occurrence": 1
+ },
+ {
+ "rule": "openhuman-task-local",
+ "path": "crates/openhuman-core/src/agent/orchestration/tools/agent_prepare_context/tool.rs",
+ "line": 7,
+ "text": "use crate::agent::harness::fork_context::{current_agent_context_prepared_sources, current_parent};",
+ "occurrence": 1
+ },
+ {
+ "rule": "openhuman-task-local",
+ "path": "crates/openhuman-core/src/agent/orchestration/tools/agent_prepare_context/tool.rs",
+ "line": 50,
+ "text": "let Some(parent) = current_parent() else {",
+ "occurrence": 1
+ },
+ {
+ "rule": "openhuman-task-local",
+ "path": "crates/openhuman-core/src/agent/orchestration/tools/agent_prepare_context/tool.rs",
+ "line": 197,
+ "text": "let prepared_sources = current_agent_context_prepared_sources();",
+ "occurrence": 1
+ },
+ {
+ "rule": "openhuman-task-local",
+ "path": "crates/openhuman-core/src/agent/orchestration/tools/close_subagent.rs",
+ "line": 3,
+ "text": "use crate::agent::harness::fork_context::current_parent;",
+ "occurrence": 1
+ },
+ {
+ "rule": "openhuman-task-local",
+ "path": "crates/openhuman-core/src/agent/orchestration/tools/close_subagent.rs",
+ "line": 64,
+ "text": "let parent = match current_parent() {",
+ "occurrence": 1
+ },
+ {
+ "rule": "openhuman-task-local",
+ "path": "crates/openhuman-core/src/agent/orchestration/tools/close_subagent.rs",
+ "line": 73,
+ "text": "let parent_thread_id = crate::agent::tinyagents::thread_context::current_thread_id();",
+ "occurrence": 1
+ },
+ {
+ "rule": "openhuman-task-local",
+ "path": "crates/openhuman-core/src/agent/orchestration/tools/continue_subagent.rs",
+ "line": 12,
+ "text": "use crate::agent::harness::fork_context::current_parent;",
+ "occurrence": 1
+ },
+ {
+ "rule": "openhuman-task-local",
+ "path": "crates/openhuman-core/src/agent/orchestration/tools/continue_subagent.rs",
+ "line": 217,
+ "text": "let parent = match current_parent() {",
+ "occurrence": 1
+ },
+ {
+ "rule": "openhuman-task-local",
+ "path": "crates/openhuman-core/src/agent/orchestration/tools/dispatch.rs",
+ "line": 4,
+ "text": "use crate::agent::harness::fork_context::current_parent;",
+ "occurrence": 1
+ },
+ {
+ "rule": "openhuman-task-local",
+ "path": "crates/openhuman-core/src/agent/orchestration/tools/dispatch.rs",
+ "line": 57,
+ "text": "let parent_ctx = current_parent();",
+ "occurrence": 1
+ },
+ {
+ "rule": "openhuman-task-local",
+ "path": "crates/openhuman-core/src/agent/orchestration/tools/dispatch.rs",
+ "line": 83,
+ "text": "crate::agent::harness::turn_attachments_context::current_turn_image_placeholders();",
+ "occurrence": 1
+ },
+ {
+ "rule": "openhuman-task-local",
+ "path": "crates/openhuman-core/src/agent/orchestration/tools/dispatch.rs",
+ "line": 122,
+ "text": "crate::agent::tinyagents::thread_context::current_thread_id().is_some();",
+ "occurrence": 1
+ },
+ {
+ "rule": "openhuman-task-local",
+ "path": "crates/openhuman-core/src/agent/orchestration/tools/dispatch.rs",
+ "line": 191,
+ "text": "if let Some(progress) = current_parent().and_then(|p| p.on_progress.clone()) {",
+ "occurrence": 1
+ },
+ {
+ "rule": "openhuman-task-local",
+ "path": "crates/openhuman-core/src/agent/orchestration/tools/dispatch.rs",
+ "line": 271,
+ "text": "if let Some(progress) = current_parent().and_then(|p| p.on_progress.clone()) {",
+ "occurrence": 1
+ },
+ {
+ "rule": "openhuman-task-local",
+ "path": "crates/openhuman-core/src/agent/orchestration/tools/dispatch.rs",
+ "line": 316,
+ "text": "if let Some(progress) = current_parent().and_then(|p| p.on_progress.clone()) {",
+ "occurrence": 1
+ },
+ {
+ "rule": "openhuman-task-local",
+ "path": "crates/openhuman-core/src/agent/orchestration/tools/dispatch.rs",
+ "line": 380,
+ "text": "if let Some(progress) = current_parent().and_then(|p| p.on_progress.clone()) {",
+ "occurrence": 1
+ },
+ {
+ "rule": "openhuman-task-local",
+ "path": "crates/openhuman-core/src/agent/orchestration/tools/list_subagents.rs",
+ "line": 3,
+ "text": "use crate::agent::harness::fork_context::current_parent;",
+ "occurrence": 1
+ },
+ {
+ "rule": "openhuman-task-local",
+ "path": "crates/openhuman-core/src/agent/orchestration/tools/list_subagents.rs",
+ "line": 52,
+ "text": "let parent = match current_parent() {",
+ "occurrence": 1
+ },
+ {
+ "rule": "openhuman-task-local",
+ "path": "crates/openhuman-core/src/agent/orchestration/tools/list_subagents.rs",
+ "line": 60,
+ "text": "let parent_thread_id = crate::agent::tinyagents::thread_context::current_thread_id();",
+ "occurrence": 1
+ },
+ {
+ "rule": "openhuman-task-local",
+ "path": "crates/openhuman-core/src/agent/orchestration/tools/spawn_async_subagent_execute.rs",
+ "line": 56,
+ "text": "let parent = match current_parent() {",
+ "occurrence": 1
+ },
+ {
+ "rule": "openhuman-task-local",
+ "path": "crates/openhuman-core/src/agent/orchestration/tools/spawn_async_subagent_execute.rs",
+ "line": 106,
+ "text": "crate::agent::tinyagents::thread_context::current_thread_id();",
+ "occurrence": 1
+ },
+ {
+ "rule": "openhuman-task-local",
+ "path": "crates/openhuman-core/src/agent/orchestration/tools/spawn_async_subagent_execute.rs",
+ "line": 425,
+ "text": "let join = tokio::spawn(crate::agent::turn_origin::propagate(",
+ "occurrence": 1
+ },
+ {
+ "rule": "openhuman-task-local",
+ "path": "crates/openhuman-core/src/agent/orchestration/tools/spawn_async_subagent_execute.rs",
+ "line": 426,
+ "text": "crate::agent::turn_workspace::propagate(async move {",
+ "occurrence": 1
+ },
+ {
+ "rule": "openhuman-task-local",
+ "path": "crates/openhuman-core/src/agent/orchestration/tools/spawn_async_subagent_execute.rs",
+ "line": 441,
+ "text": "let result = with_parent_context(background_parent, async move {",
+ "occurrence": 1
+ },
+ {
+ "rule": "openhuman-task-local",
+ "path": "crates/openhuman-core/src/agent/orchestration/tools/spawn_async_subagent_execute.rs",
+ "line": 442,
+ "text": "crate::agent::tinyagents::thread_context::with_thread_id(",
+ "occurrence": 1
+ },
+ {
+ "rule": "openhuman-task-local",
+ "path": "crates/openhuman-core/src/agent/orchestration/tools/spawn_async_subagent.rs",
+ "line": 8,
+ "text": "use crate::agent::harness::fork_context::{current_parent, with_parent_context};",
+ "occurrence": 1
+ },
+ {
+ "rule": "openhuman-task-local",
+ "path": "crates/openhuman-core/src/agent/orchestration/tools/spawn_parallel_agents.rs",
+ "line": 16,
+ "text": "use crate::agent::tinyagents::current_run_cancellation;",
+ "occurrence": 1
+ },
+ {
+ "rule": "openhuman-task-local",
+ "path": "crates/openhuman-core/src/agent/orchestration/tools/spawn_parallel_agents.rs",
+ "line": 125,
+ "text": "let cancellation = current_run_cancellation().unwrap_or_else(|| {",
+ "occurrence": 1
+ },
+ {
+ "rule": "openhuman-task-local",
+ "path": "crates/openhuman-core/src/agent/orchestration/tools/spawn_subagent_tool_impl.rs",
+ "line": 188,
+ "text": "if let Some(parent_ctx) = current_parent() {",
+ "occurrence": 1
+ },
+ {
+ "rule": "openhuman-task-local",
+ "path": "crates/openhuman-core/src/agent/orchestration/tools/spawn_subagent_tool_impl.rs",
+ "line": 225,
+ "text": "let parent_ctx = current_parent();",
+ "occurrence": 1
+ },
+ {
+ "rule": "openhuman-task-local",
+ "path": "crates/openhuman-core/src/agent/orchestration/tools/spawn_subagent_tool_impl.rs",
+ "line": 378,
+ "text": "crate::agent::tinyagents::thread_context::current_thread_id().is_some();",
+ "occurrence": 1
+ },
+ {
+ "rule": "openhuman-task-local",
+ "path": "crates/openhuman-core/src/agent/orchestration/tools/spawn_subagent_tool_impl.rs",
+ "line": 412,
+ "text": "let parent_session = current_parent()",
+ "occurrence": 1
+ },
+ {
+ "rule": "openhuman-task-local",
+ "path": "crates/openhuman-core/src/agent/orchestration/tools/spawn_subagent_tool_impl.rs",
+ "line": 422,
+ "text": "let worker_thread_id = current_parent().and_then(|p| {",
+ "occurrence": 1
+ },
+ {
+ "rule": "openhuman-task-local",
+ "path": "crates/openhuman-core/src/agent/orchestration/tools/spawn_subagent_tool_impl.rs",
+ "line": 424,
+ "text": "crate::agent::tinyagents::thread_context::current_thread_id()?;",
+ "occurrence": 1
+ },
+ {
+ "rule": "openhuman-task-local",
+ "path": "crates/openhuman-core/src/agent/orchestration/tools/spawn_subagent_tool_impl.rs",
+ "line": 449,
+ "text": "if let Some(progress) = current_parent().and_then(|p| p.on_progress.clone()) {",
+ "occurrence": 1
+ },
+ {
+ "rule": "openhuman-task-local",
+ "path": "crates/openhuman-core/src/agent/orchestration/tools/spawn_subagent_tool_impl.rs",
+ "line": 492,
+ "text": "let progress_sink = current_parent().and_then(|p| p.on_progress.clone());",
+ "occurrence": 1
+ },
+ {
+ "rule": "openhuman-task-local",
+ "path": "crates/openhuman-core/src/agent/orchestration/tools/spawn_subagent_tool_impl.rs",
+ "line": 572,
+ "text": "let workspace_dir = current_parent()",
+ "occurrence": 1
+ },
+ {
+ "rule": "openhuman-task-local",
+ "path": "crates/openhuman-core/src/agent/orchestration/tools/spawn_subagent.rs",
+ "line": 16,
+ "text": "use crate::agent::harness::fork_context::current_parent;",
+ "occurrence": 1
+ },
+ {
+ "rule": "openhuman-task-local",
+ "path": "crates/openhuman-core/src/agent/orchestration/tools/spawn_worker_thread.rs",
+ "line": 13,
+ "text": "use crate::agent::harness::fork_context::current_parent;",
+ "occurrence": 1
+ },
+ {
+ "rule": "openhuman-task-local",
+ "path": "crates/openhuman-core/src/agent/orchestration/tools/spawn_worker_thread.rs",
+ "line": 152,
+ "text": "let parent = current_parent().ok_or_else(|| anyhow::anyhow!(\"no parent context\"))?;",
+ "occurrence": 1
+ },
+ {
+ "rule": "openhuman-task-local",
+ "path": "crates/openhuman-core/src/agent/orchestration/tools/spawn_worker_thread.rs",
+ "line": 156,
+ "text": "let current_thread_id = crate::agent::tinyagents::thread_context::current_thread_id()",
+ "occurrence": 1
+ },
+ {
+ "rule": "openhuman-task-local",
+ "path": "crates/openhuman-core/src/agent/orchestration/tools/steer_subagent.rs",
+ "line": 10,
+ "text": "use crate::agent::harness::fork_context::current_parent;",
+ "occurrence": 1
+ },
+ {
+ "rule": "openhuman-task-local",
+ "path": "crates/openhuman-core/src/agent/orchestration/tools/steer_subagent.rs",
+ "line": 105,
+ "text": "let parent = match current_parent() {",
+ "occurrence": 1
+ },
+ {
+ "rule": "openhuman-task-local",
+ "path": "crates/openhuman-core/src/agent/orchestration/tools/wait_subagent.rs",
+ "line": 10,
+ "text": "use crate::agent::harness::fork_context::current_parent;",
+ "occurrence": 1
+ },
+ {
+ "rule": "openhuman-task-local",
+ "path": "crates/openhuman-core/src/agent/orchestration/tools/wait_subagent.rs",
+ "line": 127,
+ "text": "let parent = match current_parent() {",
+ "occurrence": 1
+ },
+ {
+ "rule": "openhuman-task-local",
+ "path": "crates/openhuman-core/src/agent/orchestration/workflow_runs/engine/lifecycle.rs",
+ "line": 69,
+ "text": "let inherited_origin = crate::agent::turn_origin::capture();",
+ "occurrence": 1
+ },
+ {
+ "rule": "openhuman-task-local",
+ "path": "crates/openhuman-core/src/agent/orchestration/workflow_runs/engine/lifecycle.rs",
+ "line": 73,
+ "text": "crate::agent::turn_origin::with_inherited_origin(",
+ "occurrence": 1
+ },
+ {
+ "rule": "openhuman-task-local",
+ "path": "crates/openhuman-core/src/agent/orchestration/workflow_runs/engine/lifecycle.rs",
+ "line": 197,
+ "text": "let inherited_origin = crate::agent::turn_origin::capture();",
+ "occurrence": 1
+ },
+ {
+ "rule": "openhuman-task-local",
+ "path": "crates/openhuman-core/src/agent/orchestration/workflow_runs/engine/lifecycle.rs",
+ "line": 201,
+ "text": "crate::agent::turn_origin::with_inherited_origin(",
+ "occurrence": 1
+ },
+ {
+ "rule": "openhuman-task-local",
+ "path": "crates/openhuman-core/src/agent/plan_review/tool.rs",
+ "line": 103,
+ "text": "let origin = turn_origin::current().unwrap_or(AgentTurnOrigin::Unknown);",
+ "occurrence": 1
+ },
+ {
+ "rule": "openhuman-task-local",
+ "path": "crates/openhuman-core/src/agent/progress_sink.rs",
+ "line": 47,
+ "text": "tokio::task_local! {",
+ "occurrence": 1
+ },
+ {
+ "rule": "openhuman-task-local",
+ "path": "crates/openhuman-core/src/agent/progress_sink.rs",
+ "line": 51,
+ "text": "pub static AGENT_PROGRESS_SINK: ProgressSink;",
+ "occurrence": 1
+ },
+ {
+ "rule": "openhuman-task-local",
+ "path": "crates/openhuman-core/src/agent/progress_sink.rs",
+ "line": 63,
+ "text": "AGENT_PROGRESS_SINK.scope(sink, Box::pin(fut)).await",
+ "occurrence": 1
+ },
+ {
+ "rule": "openhuman-task-local",
+ "path": "crates/openhuman-core/src/agent/progress_sink.rs",
+ "line": 70,
+ "text": "pub fn current_progress_sink() -> Option<ProgressSink> {",
+ "occurrence": 1
+ },
+ {
+ "rule": "openhuman-task-local",
+ "path": "crates/openhuman-core/src/agent/progress_sink.rs",
+ "line": 71,
+ "text": "AGENT_PROGRESS_SINK.try_with(|s| s.clone()).ok()",
+ "occurrence": 1
+ },
+ {
+ "rule": "openhuman-task-local",
+ "path": "crates/openhuman-core/src/agent/schemas.rs",
+ "line": 404,
+ "text": "crate::agent::turn_origin::with_origin(",
+ "occurrence": 1
+ },
+ {
+ "rule": "openhuman-task-local",
+ "path": "crates/openhuman-core/src/agent/task_dispatcher/executor.rs",
+ "line": 227,
+ "text": "crate::agent::turn_origin::with_origin(",
+ "occurrence": 1
+ },
+ {
+ "rule": "openhuman-task-local",
+ "path": "crates/openhuman-core/src/agent/task_dispatcher/executor.rs",
+ "line": 234,
+ "text": "crate::agent::tinyagents::thread_context::with_thread_id(thread_id.to_string(), run)",
+ "occurrence": 1
+ },
+ {
+ "rule": "openhuman-task-local",
+ "path": "crates/openhuman-core/src/agent/tinyagents/host/agent_memory.rs",
+ "line": 360,
+ "text": "let current_thread_id_ref = crate::agent::tinyagents::thread_context::current_thread_id();",
+ "occurrence": 1
+ },
+ {
+ "rule": "openhuman-task-local",
+ "path": "crates/openhuman-core/src/agent/tinyagents/mod.rs",
+ "line": 51,
+ "text": "pub mod resolved_route;",
+ "occurrence": 1
+ },
+ {
+ "rule": "openhuman-task-local",
+ "path": "crates/openhuman-core/src/agent/tinyagents/mod.rs",
+ "line": 54,
+ "text": "pub(crate) mod run_cancellation_context;",
+ "occurrence": 1
+ },
+ {
+ "rule": "openhuman-task-local",
+ "path": "crates/openhuman-core/src/agent/tinyagents/mod.rs",
+ "line": 58,
+ "text": "pub mod thread_context;",
+ "occurrence": 1
+ },
+ {
+ "rule": "openhuman-task-local",
+ "path": "crates/openhuman-core/src/agent/tinyagents/mod.rs",
+ "line": 84,
+ "text": "pub(crate) use run_cancellation_context::current_run_cancellation;",
+ "occurrence": 1
+ },
+ {
+ "rule": "openhuman-task-local",
+ "path": "crates/openhuman-core/src/agent/tinyagents/model.rs",
+ "line": 439,
+ "text": "super::record_resolved_provider_route(&self.provider, &self.model);",
+ "occurrence": 1
+ },
+ {
+ "rule": "openhuman-task-local",
+ "path": "crates/openhuman-core/src/agent/tinyagents/payload_summarizer.rs",
+ "line": 66,
+ "text": "use crate::agent::harness::fork_context::{current_parent, ParentExecutionContext};",
+ "occurrence": 1
+ },
+ {
+ "rule": "openhuman-task-local",
+ "path": "crates/openhuman-core/src/agent/tinyagents/payload_summarizer.rs",
+ "line": 371,
+ "text": "let parent = current_parent().ok_or_else(|| {",
+ "occurrence": 1
+ },
+ {
+ "rule": "openhuman-task-local",
+ "path": "crates/openhuman-core/src/agent/tinyagents/payload_summarizer.rs",
+ "line": 609,
+ "text": "let thread = super::thread_context::current_thread_id().unwrap_or_default();",
+ "occurrence": 1
+ },
+ {
+ "rule": "openhuman-task-local",
+ "path": "crates/openhuman-core/src/agent/tinyagents/resolved_route.rs",
+ "line": 23,
+ "text": "tokio::task_local! {",
+ "occurrence": 1
+ },
+ {
+ "rule": "openhuman-task-local",
+ "path": "crates/openhuman-core/src/agent/tinyagents/resolved_route.rs",
+ "line": 24,
+ "text": "static RESOLVED_PROVIDER_ROUTE: RouteSlot;",
+ "occurrence": 1
+ },
+ {
+ "rule": "openhuman-task-local",
+ "path": "crates/openhuman-core/src/agent/tinyagents/resolved_route.rs",
+ "line": 32,
+ "text": "let out = RESOLVED_PROVIDER_ROUTE",
+ "occurrence": 1
+ },
+ {
+ "rule": "openhuman-task-local",
+ "path": "crates/openhuman-core/src/agent/tinyagents/resolved_route.rs",
+ "line": 39,
+ "text": "pub fn record_resolved_provider_route(provider: impl Into<String>, model: impl Into<String>) {",
+ "occurrence": 1
+ },
+ {
+ "rule": "openhuman-task-local",
+ "path": "crates/openhuman-core/src/agent/tinyagents/resolved_route.rs",
+ "line": 46,
+ "text": "let wrote = RESOLVED_PROVIDER_ROUTE",
+ "occurrence": 1
+ },
+ {
+ "rule": "openhuman-task-local",
+ "path": "crates/openhuman-core/src/agent/tinyagents/resolved_route.rs",
+ "line": 65,
+ "text": "pub fn current_route_slot() -> Option<RouteSlot> {",
+ "occurrence": 1
+ },
+ {
+ "rule": "openhuman-task-local",
+ "path": "crates/openhuman-core/src/agent/tinyagents/resolved_route.rs",
+ "line": 66,
+ "text": "RESOLVED_PROVIDER_ROUTE.try_with(|slot| slot.clone()).ok()",
+ "occurrence": 1
+ },
+ {
+ "rule": "openhuman-task-local",
+ "path": "crates/openhuman-core/src/agent/tinyagents/resolved_route.rs",
+ "line": 78,
+ "text": "RESOLVED_PROVIDER_ROUTE.scope(slot, Box::pin(future)).await",
+ "occurrence": 1
+ },
+ {
+ "rule": "openhuman-task-local",
+ "path": "crates/openhuman-core/src/agent/tinyagents/resolved_route.rs",
+ "line": 81,
+ "text": "pub fn current_resolved_provider_route() -> Option<ResolvedProviderRoute> {",
+ "occurrence": 1
+ },
+ {
+ "rule": "openhuman-task-local",
+ "path": "crates/openhuman-core/src/agent/tinyagents/resolved_route.rs",
+ "line": 82,
+ "text": "let route = RESOLVED_PROVIDER_ROUTE",
+ "occurrence": 1
+ },
+ {
+ "rule": "openhuman-task-local",
+ "path": "crates/openhuman-core/src/agent/tinyagents/run_cancellation_context.rs",
+ "line": 10,
+ "text": "tokio::task_local! {",
+ "occurrence": 1
+ },
+ {
+ "rule": "openhuman-task-local",
+ "path": "crates/openhuman-core/src/agent/tinyagents/run_cancellation_context.rs",
+ "line": 11,
+ "text": "static CURRENT_RUN_CANCELLATION: CancellationToken;",
+ "occurrence": 1
+ },
+ {
+ "rule": "openhuman-task-local",
+ "path": "crates/openhuman-core/src/agent/tinyagents/run_cancellation_context.rs",
+ "line": 16,
+ "text": "pub(crate) fn current_run_cancellation() -> Option<CancellationToken> {",
+ "occurrence": 1
+ },
+ {
+ "rule": "openhuman-task-local",
+ "path": "crates/openhuman-core/src/agent/tinyagents/run_cancellation_context.rs",
+ "line": 17,
+ "text": "CURRENT_RUN_CANCELLATION.try_with(Clone::clone).ok()",
+ "occurrence": 1
+ },
+ {
+ "rule": "openhuman-task-local",
+ "path": "crates/openhuman-core/src/agent/tinyagents/run_cancellation_context.rs",
+ "line": 26,
+ "text": "CURRENT_RUN_CANCELLATION.scope(token, future).await",
+ "occurrence": 1
+ },
+ {
+ "rule": "openhuman-task-local",
+ "path": "crates/openhuman-core/src/agent/tinyagents/thread_context.rs",
+ "line": 58,
+ "text": "tokio::task_local! {",
+ "occurrence": 1
+ },
+ {
+ "rule": "openhuman-task-local",
+ "path": "crates/openhuman-core/src/agent/tinyagents/thread_context.rs",
+ "line": 59,
+ "text": "static THREAD_ID: Option<String>;",
+ "occurrence": 1
+ },
+ {
+ "rule": "openhuman-task-local",
+ "path": "crates/openhuman-core/src/agent/tinyagents/thread_context.rs",
+ "line": 80,
+ "text": "THREAD_ID.scope(value, fut).await",
+ "occurrence": 1
+ },
+ {
+ "rule": "openhuman-task-local",
+ "path": "crates/openhuman-core/src/agent/tinyagents/thread_context.rs",
+ "line": 86,
+ "text": "pub fn current_thread_id() -> Option<String> {",
+ "occurrence": 1
+ },
+ {
+ "rule": "openhuman-task-local",
+ "path": "crates/openhuman-core/src/agent/tinyagents/thread_context.rs",
+ "line": 87,
+ "text": "THREAD_ID",
+ "occurrence": 1
+ },
+ {
+ "rule": "openhuman-task-local",
+ "path": "crates/openhuman-core/src/agent/tinyagents/turn_runner.rs",
+ "line": 33,
+ "text": "use crate::agent::tinyagents::run_cancellation_context::with_run_cancellation;",
+ "occurrence": 1
+ },
+ {
+ "rule": "openhuman-task-local",
+ "path": "crates/openhuman-core/src/agent/tinyagents/turn_runner.rs",
+ "line": 476,
+ "text": ".then(crate::agent::harness::turn_dispatch_guard::current)",
+ "occurrence": 1
+ },
+ {
+ "rule": "openhuman-task-local",
+ "path": "crates/openhuman-core/src/agent/tinyagents/turn_runner.rs",
+ "line": 509,
+ "text": "}) = crate::agent::turn_origin::current()",
+ "occurrence": 1
+ },
+ {
+ "rule": "openhuman-task-local",
+ "path": "crates/openhuman-core/src/agent/tinyagents/turn_runner.rs",
+ "line": 530,
+ "text": ".or_else(|| match crate::agent::turn_origin::current() {",
+ "occurrence": 1
+ },
+ {
+ "rule": "openhuman-task-local",
+ "path": "crates/openhuman-core/src/agent/tinyagents/turn_runner.rs",
+ "line": 585,
+ "text": "let run_result = with_run_cancellation(cancellation.clone(), async {",
+ "occurrence": 1
+ },
+ {
+ "rule": "openhuman-task-local",
+ "path": "crates/openhuman-core/src/agent/tools/delegate_to_personality.rs",
+ "line": 4,
+ "text": "use crate::agent::harness::fork_context::current_parent;",
+ "occurrence": 1
+ },
+ {
+ "rule": "openhuman-task-local",
+ "path": "crates/openhuman-core/src/agent/tools/delegate_to_personality.rs",
+ "line": 106,
+ "text": "let parent_ctx = match current_parent() {",
+ "occurrence": 1
+ },
+ {
+ "rule": "openhuman-task-local",
+ "path": "crates/openhuman-core/src/agent/tools/todo.rs",
+ "line": 201,
+ "text": "let Some(parent) = crate::agent::harness::fork_context::current_parent() else {",
+ "occurrence": 1
+ },
+ {
+ "rule": "openhuman-task-local",
+ "path": "crates/openhuman-core/src/agent/tools/todo.rs",
+ "line": 213,
+ "text": "let Some(thread_id) = thread_context::current_thread_id() else {",
+ "occurrence": 1
+ },
+ {
+ "rule": "openhuman-task-local",
+ "path": "crates/openhuman-core/src/agent/tools/update_task.rs",
+ "line": 148,
+ "text": "if let Some(parent) = crate::agent::harness::fork_context::current_parent() {",
+ "occurrence": 1
+ },
+ {
+ "rule": "openhuman-task-local",
+ "path": "crates/openhuman-core/src/agent/triage/escalation.rs",
+ "line": 22,
+ "text": "use crate::agent::harness::fork_context::{with_parent_context, ParentExecutionContext};",
+ "occurrence": 1
+ },
+ {
+ "rule": "openhuman-task-local",
+ "path": "crates/openhuman-core/src/agent/triage/escalation.rs",
+ "line": 314,
+ "text": "let outcome = with_parent_context(parent_ctx, async {",
+ "occurrence": 1
+ },
+ {
+ "rule": "openhuman-task-local",
+ "path": "crates/openhuman-core/src/agent/turn_origin.rs",
+ "line": 177,
+ "text": "pub fn current_is_user_authored() -> bool {",
+ "occurrence": 1
+ },
+ {
+ "rule": "openhuman-task-local",
+ "path": "crates/openhuman-core/src/agent/turn_origin.rs",
+ "line": 181,
+ "text": "tokio::task_local! {",
+ "occurrence": 1
+ },
+ {
+ "rule": "openhuman-task-local",
+ "path": "crates/openhuman-core/src/agent/turn_origin.rs",
+ "line": 186,
+ "text": "pub static AGENT_TURN_ORIGIN: AgentTurnOrigin;",
+ "occurrence": 1
+ },
+ {
+ "rule": "openhuman-task-local",
+ "path": "crates/openhuman-core/src/agent/turn_origin.rs",
+ "line": 202,
+ "text": "AGENT_TURN_ORIGIN.scope(origin, Box::pin(fut)).await",
+ "occurrence": 1
+ },
+ {
+ "rule": "openhuman-task-local",
+ "path": "crates/openhuman-core/src/agent/turn_origin.rs",
+ "line": 209,
+ "text": "AGENT_TURN_ORIGIN.try_with(|o| o.clone()).ok()",
+ "occurrence": 1
+ },
+ {
+ "rule": "openhuman-task-local",
+ "path": "crates/openhuman-core/src/agent/turn_origin.rs",
+ "line": 264,
+ "text": "Some(origin) => with_origin(origin, fut).await,",
+ "occurrence": 1
+ },
+ {
+ "rule": "openhuman-task-local",
+ "path": "crates/openhuman-core/src/agent/turn_origin.rs",
+ "line": 300,
+ "text": "Some(origin) => with_origin(origin, fut).await,",
+ "occurrence": 1
+ },
+ {
+ "rule": "openhuman-task-local",
+ "path": "crates/openhuman-core/src/agent/turn_origin.rs",
+ "line": 392,
+ "text": "pub fn current_request_id() -> Option<String> {",
+ "occurrence": 1
+ },
+ {
+ "rule": "openhuman-task-local",
+ "path": "crates/openhuman-core/src/agent/turn_workspace.rs",
+ "line": 46,
+ "text": "tokio::task_local! {",
+ "occurrence": 1
+ },
+ {
+ "rule": "openhuman-task-local",
+ "path": "crates/openhuman-core/src/agent/turn_workspace.rs",
+ "line": 50,
+ "text": "pub static AGENT_TURN_WORKSPACE: PathBuf;",
+ "occurrence": 1
+ },
+ {
+ "rule": "openhuman-task-local",
+ "path": "crates/openhuman-core/src/agent/turn_workspace.rs",
+ "line": 65,
+ "text": "AGENT_TURN_WORKSPACE.scope(root, Box::pin(fut)).await",
+ "occurrence": 1
+ },
+ {
+ "rule": "openhuman-task-local",
+ "path": "crates/openhuman-core/src/agent/turn_workspace.rs",
+ "line": 74,
+ "text": "AGENT_TURN_WORKSPACE.try_with(|root| root.clone()).ok()",
+ "occurrence": 1
+ },
+ {
+ "rule": "openhuman-task-local",
+ "path": "crates/openhuman-core/src/agent/turn_workspace.rs",
+ "line": 93,
+ "text": "Some(root) => with_workspace(root, fut).await,",
+ "occurrence": 1
+ },
+ {
+ "rule": "openhuman-task-local",
+ "path": "crates/openhuman-core/src/cron/scheduler/agent_run.rs",
+ "line": 147,
+ "text": "crate::agent::turn_origin::with_origin(",
+ "occurrence": 1
+ },
+ {
+ "rule": "openhuman-task-local",
+ "path": "crates/openhuman-core/src/cron/scheduler/agent_run.rs",
+ "line": 162,
+ "text": "crate::agent::harness::with_task_recency_window(",
+ "occurrence": 1
+ },
+ {
+ "rule": "openhuman-task-local",
+ "path": "crates/openhuman-core/src/desktop/notifications/rpc.rs",
+ "line": 18,
+ "text": "use crate::agent::turn_origin::with_origin;",
+ "occurrence": 1
+ },
+ {
+ "rule": "openhuman-task-local",
+ "path": "crates/openhuman-core/src/desktop/notifications/rpc.rs",
+ "line": 187,
+ "text": "with_origin(origin, apply_decision(triage_run, &envelope)).await",
+ "occurrence": 1
+ },
+ {
+ "rule": "openhuman-task-local",
+ "path": "crates/openhuman-core/src/flows/memory_tools.rs",
+ "line": 69,
+ "text": "match turn_origin::current() {",
+ "occurrence": 1
+ },
+ {
+ "rule": "openhuman-task-local",
+ "path": "crates/openhuman-core/src/flows/ops.rs",
+ "line": 58,
+ "text": "use crate::agent::turn_origin::{with_origin, AgentTurnOrigin, TrustedAutomationSource};",
+ "occurrence": 1
+ },
+ {
+ "rule": "openhuman-task-local",
+ "path": "crates/openhuman-core/src/flows/ops/builder.rs",
+ "line": 175,
+ "text": "let run = with_origin(",
+ "occurrence": 1
+ },
+ {
+ "rule": "openhuman-task-local",
+ "path": "crates/openhuman-core/src/flows/ops/builder.rs",
+ "line": 184,
+ "text": "let run = crate::agent::tinyagents::thread_context::with_thread_id(",
+ "occurrence": 1
+ },
+ {
+ "rule": "openhuman-task-local",
+ "path": "crates/openhuman-core/src/flows/ops/builder.rs",
+ "line": 232,
+ "text": "let run = with_origin(AgentTurnOrigin::Cli, agent.run_single(&prompt));",
+ "occurrence": 1
+ },
+ {
+ "rule": "openhuman-task-local",
+ "path": "crates/openhuman-core/src/flows/ops/discovery.rs",
+ "line": 42,
+ "text": "use crate::agent::turn_origin::{with_origin, AgentTurnOrigin};",
+ "occurrence": 1
+ },
+ {
+ "rule": "openhuman-task-local",
+ "path": "crates/openhuman-core/src/flows/ops/discovery.rs",
+ "line": 73,
+ "text": "let run = with_origin(AgentTurnOrigin::Cli, agent.run_single(FLOW_DISCOVER_PROMPT));",
+ "occurrence": 1
+ },
+ {
+ "rule": "openhuman-task-local",
+ "path": "crates/openhuman-core/src/flows/ops/discovery.rs",
+ "line": 80,
+ "text": "crate::agent::tinyagents::thread_context::with_thread_id(target.thread_id.clone(), run)",
+ "occurrence": 1
+ },
+ {
+ "rule": "openhuman-task-local",
+ "path": "crates/openhuman-core/src/flows/ops/execution.rs",
+ "line": 272,
+ "text": "with_origin(",
+ "occurrence": 1
+ },
+ {
+ "rule": "openhuman-task-local",
+ "path": "crates/openhuman-core/src/flows/ops/resume.rs",
+ "line": 302,
+ "text": "with_origin(",
+ "occurrence": 1
+ },
+ {
+ "rule": "openhuman-task-local",
+ "path": "crates/openhuman-core/src/flows/tinyflows/caps/agent.rs",
+ "line": 596,
+ "text": "let escalated_origin = escalated_origin_for_nested_harness(turn_origin::current());",
+ "occurrence": 1
+ },
+ {
+ "rule": "openhuman-task-local",
+ "path": "crates/openhuman-core/src/flows/tinyflows/caps/agent.rs",
+ "line": 609,
+ "text": "Box::pin(turn_origin::with_origin(",
+ "occurrence": 1
+ },
+ {
+ "rule": "openhuman-task-local",
+ "path": "crates/openhuman-core/src/flows/tinyflows/caps/tier.rs",
+ "line": 104,
+ "text": "match escalated_origin_for_prompt(tier_decision, turn_origin::current()) {",
+ "occurrence": 1
+ },
+ {
+ "rule": "openhuman-task-local",
+ "path": "crates/openhuman-core/src/flows/tinyflows/caps/tier.rs",
+ "line": 112,
+ "text": "turn_origin::with_origin(",
+ "occurrence": 1
+ },
+ {
+ "rule": "openhuman-task-local",
+ "path": "crates/openhuman-core/src/flows/tinyflows/memory_adapter.rs",
+ "line": 100,
+ "text": "match turn_origin::current() {",
+ "occurrence": 1
+ },
+ {
+ "rule": "openhuman-task-local",
+ "path": "crates/openhuman-core/src/hooks/ops.rs",
+ "line": 61,
+ "text": "if let Some(turn_root) = crate::agent::turn_workspace::current() {",
+ "occurrence": 1
+ },
+ {
+ "rule": "openhuman-task-local",
+ "path": "crates/openhuman-core/src/inference/host_runtime/ops/agent_chat.rs",
+ "line": 219,
+ "text": "if let Some(tx) = crate::agent::progress_sink::current_progress_sink() {",
+ "occurrence": 1
+ },
+ {
+ "rule": "openhuman-task-local",
+ "path": "crates/openhuman-core/src/inference/host_runtime/ops/agent_chat.rs",
+ "line": 230,
+ "text": "let run = crate::agent::turn_origin::with_origin(",
+ "occurrence": 1
+ },
+ {
+ "rule": "openhuman-task-local",
+ "path": "crates/openhuman-core/src/inference/host_runtime/ops/agent_chat.rs",
+ "line": 237,
+ "text": "crate::agent::tinyagents::thread_context::with_thread_id(id, run).await",
+ "occurrence": 1
+ },
+ {
+ "rule": "openhuman-task-local",
+ "path": "crates/openhuman-core/src/inference/host_runtime/ops/agent_chat.rs",
+ "line": 295,
+ "text": "crate::agent::tinyagents::thread_context::with_thread_id(id, run).await",
+ "occurrence": 1
+ },
+ {
+ "rule": "openhuman-task-local",
+ "path": "crates/openhuman-core/src/inference/host_runtime/ops/turn_guards.rs",
+ "line": 134,
+ "text": "crate::agent::turn_origin::current()",
+ "occurrence": 1
+ },
+ {
+ "rule": "openhuman-task-local",
+ "path": "crates/openhuman-core/src/inference/provider/openhuman_backend_model.rs",
+ "line": 447,
+ "text": "fn with_thread_id(mut request: ModelRequest) -> ModelRequest {",
+ "occurrence": 1
+ },
+ {
+ "rule": "openhuman-task-local",
+ "path": "crates/openhuman-core/src/inference/provider/openhuman_backend_model.rs",
+ "line": 448,
+ "text": "let Some(thread_id) = thread_context::current_thread_id() else {",
+ "occurrence": 1
+ },
+ {
+ "rule": "openhuman-task-local",
+ "path": "crates/openhuman-core/src/inference/provider/openhuman_backend_model.rs",
+ "line": 558,
+ "text": "let response = match model.invoke(state, with_thread_id(request)).await {",
+ "occurrence": 1
+ },
+ {
+ "rule": "openhuman-task-local",
+ "path": "crates/openhuman-core/src/inference/provider/openhuman_backend_model.rs",
+ "line": 582,
+ "text": "match model.stream(state, with_thread_id(request)).await {",
+ "occurrence": 1
+ },
+ {
+ "rule": "openhuman-task-local",
+ "path": "crates/openhuman-core/src/integrations/composio/action_tool.rs",
+ "line": 34,
+ "text": "use crate::agent::harness::current_sandbox_mode;",
+ "occurrence": 1
+ },
+ {
+ "rule": "openhuman-task-local",
+ "path": "crates/openhuman-core/src/integrations/composio/action_tool.rs",
+ "line": 179,
+ "text": "if matches!(current_sandbox_mode(), Some(SandboxMode::ReadOnly)) {",
+ "occurrence": 1
+ },
+ {
+ "rule": "openhuman-task-local",
+ "path": "crates/openhuman-core/src/integrations/composio/tools/execute.rs",
+ "line": 10,
+ "text": "use crate::agent::harness::current_sandbox_mode;",
+ "occurrence": 1
+ },
+ {
+ "rule": "openhuman-task-local",
+ "path": "crates/openhuman-core/src/integrations/composio/tools/execute.rs",
+ "line": 11,
+ "text": "use crate::agent::harness::current_task_recency_window;",
+ "occurrence": 1
+ },
+ {
+ "rule": "openhuman-task-local",
+ "path": "crates/openhuman-core/src/integrations/composio/tools/execute.rs",
+ "line": 153,
+ "text": "if matches!(current_sandbox_mode(), Some(SandboxMode::ReadOnly)) {",
+ "occurrence": 1
+ },
+ {
+ "rule": "openhuman-task-local",
+ "path": "crates/openhuman-core/src/integrations/composio/tools/execute.rs",
+ "line": 225,
+ "text": "let task_window_since = current_task_recency_window().map(|w| {",
+ "occurrence": 1
+ },
+ {
+ "rule": "openhuman-task-local",
+ "path": "crates/openhuman-core/src/integrations/task_sources/route.rs",
+ "line": 18,
+ "text": "use crate::agent::turn_origin::with_origin;",
+ "occurrence": 1
+ },
+ {
+ "rule": "openhuman-task-local",
+ "path": "crates/openhuman-core/src/integrations/task_sources/route.rs",
+ "line": 258,
+ "text": "with_origin(origin, apply_decision(run, &envelope))",
+ "occurrence": 1
+ },
+ {
+ "rule": "openhuman-task-local",
+ "path": "crates/openhuman-core/src/mcp/registry/ops.rs",
+ "line": 665,
+ "text": "let reply_result = crate::agent::turn_origin::with_origin(",
+ "occurrence": 1
+ },
+ {
+ "rule": "openhuman-task-local",
+ "path": "crates/openhuman-core/src/mcp/server/tools/dispatch.rs",
+ "line": 385,
+ "text": "crate::agent::turn_origin::with_origin(origin, agent.run_single(&prompt)),",
+ "occurrence": 1
+ },
+ {
+ "rule": "openhuman-task-local",
+ "path": "crates/openhuman-core/src/memory/agent/tools.rs",
+ "line": 13,
+ "text": "use crate::agent::harness::fork_context::current_parent;",
+ "occurrence": 1
+ },
+ {
+ "rule": "openhuman-task-local",
+ "path": "crates/openhuman-core/src/memory/agent/tools.rs",
+ "line": 121,
+ "text": "let parent = current_parent();",
+ "occurrence": 1
+ },
+ {
+ "rule": "openhuman-task-local",
+ "path": "crates/openhuman-core/src/memory/goals/enrich.rs",
+ "line": 19,
+ "text": "use crate::agent::turn_origin::{with_origin, AgentTurnOrigin, TrustedAutomationSource};",
+ "occurrence": 1
+ },
+ {
+ "rule": "openhuman-task-local",
+ "path": "crates/openhuman-core/src/memory/goals/enrich.rs",
+ "line": 136,
+ "text": "let response = with_origin(origin, agent.run_single(&prompt))",
+ "occurrence": 1
+ },
+ {
+ "rule": "openhuman-task-local",
+ "path": "crates/openhuman-core/src/memory/sync/composio/bus/trigger_subscriber.rs",
+ "line": 10,
+ "text": "use crate::agent::turn_origin::with_origin;",
+ "occurrence": 1
+ },
+ {
+ "rule": "openhuman-task-local",
+ "path": "crates/openhuman-core/src/memory/sync/composio/bus/trigger_subscriber.rs",
+ "line": 218,
+ "text": "if let Err(e) = with_origin(origin, apply_decision(run, &envelope)).await {",
+ "occurrence": 1
+ },
+ {
+ "rule": "openhuman-task-local",
+ "path": "crates/openhuman-core/src/memory/tools/search/hybrid_search.rs",
+ "line": 261,
+ "text": "let exclude_session_id = crate::agent::tinyagents::thread_context::current_thread_id();",
+ "occurrence": 1
+ },
+ {
+ "rule": "openhuman-task-local",
+ "path": "crates/openhuman-core/src/platform/socket/medulla/mod.rs",
+ "line": 48,
+ "text": "use crate::agent::turn_origin::{with_origin, AgentTurnOrigin};",
+ "occurrence": 1
+ },
+ {
+ "rule": "openhuman-task-local",
+ "path": "crates/openhuman-core/src/platform/socket/medulla/mod.rs",
+ "line": 249,
+ "text": "let turn = Box::pin(with_origin(origin, agent.run_single(&next_input)));",
+ "occurrence": 1
+ },
+ {
+ "rule": "openhuman-task-local",
+ "path": "crates/openhuman-core/src/security/approval/gate_intercept.rs",
+ "line": 22,
+ "text": "let origin = turn_origin::current().unwrap_or(AgentTurnOrigin::Unknown);",
+ "occurrence": 1
+ },
+ {
+ "rule": "openhuman-task-local",
+ "path": "crates/openhuman-core/src/security/policy/path_checks.rs",
+ "line": 533,
+ "text": "if let Some(turn_root) = crate::agent::turn_workspace::current() {",
+ "occurrence": 1
+ },
+ {
+ "rule": "openhuman-task-local",
+ "path": "crates/openhuman-core/src/skills/runtime/run_machinery.rs",
+ "line": 187,
+ "text": "let inherited_origin = crate::agent::turn_origin::current()",
+ "occurrence": 1
+ },
+ {
+ "rule": "openhuman-task-local",
+ "path": "crates/openhuman-core/src/skills/runtime/run_machinery.rs",
+ "line": 291,
+ "text": "crate::agent::turn_origin::with_origin(",
+ "occurrence": 1
+ },
+ {
+ "rule": "openhuman-task-local",
+ "path": "crates/openhuman-core/src/skills/webhooks/bus.rs",
+ "line": 317,
+ "text": "crate::agent::turn_origin::with_origin(",
+ "occurrence": 1
+ },
+ {
+ "rule": "openhuman-task-local",
+ "path": "crates/openhuman-core/src/skills/webhooks/ops.rs",
+ "line": 207,
+ "text": "crate::agent::turn_origin::with_origin(",
+ "occurrence": 1
+ },
+ {
+ "rule": "openhuman-task-local",
+ "path": "crates/openhuman-core/src/threads/goals/continuation.rs",
+ "line": 32,
+ "text": "use crate::agent::tinyagents::thread_context::with_thread_id;",
+ "occurrence": 1
+ },
+ {
+ "rule": "openhuman-task-local",
+ "path": "crates/openhuman-core/src/threads/goals/continuation.rs",
+ "line": 33,
+ "text": "use crate::agent::turn_origin::{with_origin, AgentTurnOrigin, TrustedAutomationSource};",
+ "occurrence": 1
+ },
+ {
+ "rule": "openhuman-task-local",
+ "path": "crates/openhuman-core/src/threads/goals/continuation.rs",
+ "line": 199,
+ "text": "let result = with_thread_id(",
+ "occurrence": 1
+ },
+ {
+ "rule": "openhuman-task-local",
+ "path": "crates/openhuman-core/src/threads/goals/continuation.rs",
+ "line": 201,
+ "text": "with_origin(origin, agent.run_single(&prompt)),",
+ "occurrence": 1
+ },
+ {
+ "rule": "openhuman-task-local",
+ "path": "crates/openhuman-core/src/threads/goals/runtime.rs",
+ "line": 31,
+ "text": "use crate::agent::tinyagents::thread_context::current_thread_id;",
+ "occurrence": 1
+ },
+ {
+ "rule": "openhuman-task-local",
+ "path": "crates/openhuman-core/src/threads/goals/runtime.rs",
+ "line": 38,
+ "text": "let thread_id = current_thread_id()?;",
+ "occurrence": 1
+ },
+ {
+ "rule": "openhuman-task-local",
+ "path": "crates/openhuman-core/src/threads/goals/runtime.rs",
+ "line": 52,
+ "text": "let thread_id = current_thread_id()?;",
+ "occurrence": 1
+ },
+ {
+ "rule": "openhuman-task-local",
+ "path": "crates/openhuman-core/src/threads/goals/runtime.rs",
+ "line": 74,
+ "text": "let Some(thread_id) = current_thread_id() else {",
+ "occurrence": 1
+ },
+ {
+ "rule": "openhuman-task-local",
+ "path": "crates/openhuman-core/src/threads/goals/runtime.rs",
+ "line": 103,
+ "text": "let Some(thread_id) = current_thread_id() else {",
+ "occurrence": 1
+ },
+ {
+ "rule": "openhuman-task-local",
+ "path": "crates/openhuman-core/src/threads/goals/runtime.rs",
+ "line": 130,
+ "text": "let Some(thread_id) = current_thread_id() else {",
+ "occurrence": 1
+ },
+ {
+ "rule": "openhuman-task-local",
+ "path": "crates/openhuman-core/src/threads/goals/runtime.rs",
+ "line": 151,
+ "text": "crate::agent::turn_origin::current(),",
+ "occurrence": 1
+ },
+ {
+ "rule": "openhuman-task-local",
+ "path": "crates/openhuman-core/src/threads/goals/runtime.rs",
+ "line": 176,
+ "text": "let Some(thread_id) = current_thread_id() else {",
+ "occurrence": 1
+ },
+ {
+ "rule": "openhuman-task-local",
+ "path": "crates/openhuman-core/src/threads/goals/tools.rs",
+ "line": 22,
+ "text": "use crate::agent::tinyagents::thread_context::current_thread_id;",
+ "occurrence": 1
+ },
+ {
+ "rule": "openhuman-task-local",
+ "path": "crates/openhuman-core/src/threads/goals/tools.rs",
+ "line": 40,
+ "text": "current_thread_id().ok_or_else(|| {",
+ "occurrence": 1
+ },
+ {
+ "rule": "openhuman-task-local",
+ "path": "crates/openhuman-core/src/threads/todos/ops.rs",
+ "line": 80,
+ "text": "let Some(parent) = crate::agent::harness::fork_context::current_parent() else {",
+ "occurrence": 1
+ },
+ {
+ "rule": "openhuman-task-local",
+ "path": "crates/openhuman-core/src/tools/impl/system/node_exec.rs",
+ "line": 290,
+ "text": "crate::agent::harness::current_sandbox_mode(),",
+ "occurrence": 1
+ },
+ {
+ "rule": "openhuman-task-local",
+ "path": "crates/openhuman-core/src/tools/impl/system/npm_exec.rs",
+ "line": 288,
+ "text": "crate::agent::harness::current_sandbox_mode(),",
+ "occurrence": 1
+ },
+ {
+ "rule": "openhuman-task-local",
+ "path": "crates/openhuman-core/src/tools/impl/system/python_exec.rs",
+ "line": 248,
+ "text": "crate::agent::harness::current_sandbox_mode(),",
+ "occurrence": 1
+ },
+ {
+ "rule": "openhuman-task-local",
+ "path": "crates/openhuman-core/src/tools/impl/system/shell.rs",
+ "line": 376,
+ "text": "crate::agent::harness::current_sandbox_mode(),",
+ "occurrence": 1
+ },
+ {
+ "rule": "openhuman-task-local",
+ "path": "crates/openhuman-core/src/voice/realtime_harness/agent.rs",
+ "line": 13,
+ "text": "use crate::agent::turn_origin::{with_origin, AgentTurnOrigin};",
+ "occurrence": 1
+ },
+ {
+ "rule": "openhuman-task-local",
+ "path": "crates/openhuman-core/src/voice/realtime_harness/agent.rs",
+ "line": 159,
+ "text": "let scoped_run = crate::agent::tinyagents::thread_context::with_thread_id(",
+ "occurrence": 1
+ },
+ {
+ "rule": "openhuman-task-local",
+ "path": "crates/openhuman-core/src/voice/realtime_harness/agent.rs",
+ "line": 163,
+ "text": "let fut = with_origin(",
+ "occurrence": 1
+ },
+ {
+ "rule": "openhuman-task-local",
+ "path": "crates/openhuman-core/src/web_chat/ops/turn_guards.rs",
+ "line": 93,
+ "text": "crate::agent::turn_origin::with_origin(",
+ "occurrence": 1
+ },
+ {
+ "rule": "openhuman-task-local",
+ "path": "crates/openhuman-core/src/web_chat/run_task.rs",
+ "line": 265,
+ "text": "let result = match crate::agent::tinyagents::thread_context::with_thread_id(",
+ "occurrence": 1
+ },
+ {
+ "rule": "openhuman-task-local",
+ "path": "crates/openhuman-embed/src/lib.rs",
+ "line": 74,
+ "text": "current_progress_sink, with_progress_sink, ProgressSink, AGENT_PROGRESS_SINK,",
+ "occurrence": 1
+ },
+ {
+ "rule": "openhuman-task-local",
+ "path": "crates/openhuman-embed/src/turn.rs",
+ "line": 365,
+ "text": "openhuman_core::agent::progress_sink::with_progress_sink(",
+ "occurrence": 1
+ },
+ {
+ "rule": "openhuman-task-local",
+ "path": "crates/openhuman-embed/src/turn.rs",
+ "line": 367,
+ "text": "openhuman_core::agent::turn_origin::with_origin(origin, dispatch),",
+ "occurrence": 1
+ },
+ {
+ "rule": "openhuman-task-local",
+ "path": "crates/openhuman-embed/src/turn.rs",
+ "line": 372,
+ "text": "openhuman_core::agent::turn_origin::with_origin(origin, dispatch).await",
+ "occurrence": 1
+ },
+ {
+ "rule": "openhuman-task-local",
+ "path": "crates/openhuman-embed/src/turn.rs",
+ "line": 375,
+ "text": "openhuman_core::agent::progress_sink::with_progress_sink(sink, dispatch).await",
+ "occurrence": 1
+ },
+ {
+ "rule": "openhuman-tool-calling-facade",
+ "path": "crates/openhuman-core/src/agent/dispatcher.rs",
+ "line": 42,
+ "text": "use tinyagents_harness::tool_calling::dialect::{",
+ "occurrence": 1
+ },
+ {
+ "rule": "openhuman-tool-calling-facade",
+ "path": "crates/openhuman-core/src/agent/dispatcher.rs",
+ "line": 145,
+ "text": "calls: Vec<tinyagents_harness::tool_calling::ParsedToolCall>,",
+ "occurrence": 1
+ },
+ {
+ "rule": "openhuman-tool-calling-facade",
+ "path": "crates/openhuman-core/src/agent/dispatcher.rs",
+ "line": 260,
+ "text": "format: tinyagents_harness::tool_calling::dialect::ToolCallFormat,",
+ "occurrence": 1
+ },
+ {
+ "rule": "openhuman-tool-calling-facade",
+ "path": "crates/openhuman-core/src/agent/dispatcher.rs",
+ "line": 262,
+ "text": "use tinyagents_harness::tool_calling::dialect::ToolCallFormat as Crate;",
+ "occurrence": 1
+ },
+ {
+ "rule": "openhuman-tool-calling-facade",
+ "path": "crates/openhuman-core/src/agent/harness/parse.rs",
+ "line": 15,
+ "text": "pub(crate) use tinyagents_harness::tool_calling::{",
+ "occurrence": 1
+ },
+ {
+ "rule": "openhuman-tool-calling-facade",
+ "path": "crates/openhuman-core/src/agent/harness/parse.rs",
+ "line": 24,
+ "text": "pub(crate) use tinyagents_harness::tool_calling::{",
+ "occurrence": 1
+ },
+ {
+ "rule": "openhuman-tool-calling-facade",
+ "path": "crates/openhuman-core/src/agent/harness/parse.rs",
+ "line": 34,
+ "text": "use tinyagents_harness::tool_calling::ParsedToolCall;",
+ "occurrence": 1
+ },
+ {
+ "rule": "openhuman-tool-calling-facade",
+ "path": "crates/openhuman-core/src/agent/pformat.rs",
+ "line": 23,
+ "text": "pub use tinyagents_harness::tool_calling::{",
+ "occurrence": 1
+ },
+ {
+ "rule": "openhuman-tool-calling-facade",
+ "path": "crates/openhuman-core/src/agent/pformat.rs",
+ "line": 51,
+ "text": "tinyagents_harness::tool_calling::build_registry(",
+ "occurrence": 1
+ },
+ {
+ "rule": "openhuman-tool-calling-facade",
+ "path": "crates/openhuman-core/src/agent/prompts/sections.rs",
+ "line": 15,
+ "text": "use tinyagents_harness::tool_calling::dialect::render_pformat_catalogue;",
+ "occurrence": 1
+ },
+ {
+ "rule": "openhuman-upstream-reexport",
+ "path": "crates/openhuman-core/src/agent/harness/archivist/boundary.rs",
+ "line": 202,
+ "text": "pub use tinyinference_embeddings::incremental_mean_embedding;",
+ "occurrence": 1
+ },
+ {
+ "rule": "openhuman-upstream-reexport",
+ "path": "crates/openhuman-core/src/agent/harness/artifact_offload/mod.rs",
+ "line": 63,
+ "text": "pub use tinyagents_harness::artifacts::{",
+ "occurrence": 1
+ },
+ {
+ "rule": "openhuman-upstream-reexport",
+ "path": "crates/openhuman-core/src/agent/harness/parse.rs",
+ "line": 15,
+ "text": "pub(crate) use tinyagents_harness::tool_calling::{",
+ "occurrence": 1
+ },
+ {
+ "rule": "openhuman-upstream-reexport",
+ "path": "crates/openhuman-core/src/agent/harness/parse.rs",
+ "line": 24,
+ "text": "pub(crate) use tinyagents_harness::tool_calling::{",
+ "occurrence": 1
+ },
+ {
+ "rule": "openhuman-upstream-reexport",
+ "path": "crates/openhuman-core/src/agent/harness/run_queue/mod.rs",
+ "line": 20,
+ "text": "pub use tinyagents_harness::run_queue::QueueStatus;",
+ "occurrence": 1
+ },
+ {
+ "rule": "openhuman-upstream-reexport",
+ "path": "crates/openhuman-core/src/agent/harness/subagent_runner/handoff.rs",
+ "line": 37,
+ "text": "pub(crate) use tinyagents_harness::handoff::{",
+ "occurrence": 1
+ },
+ {
+ "rule": "openhuman-upstream-reexport",
+ "path": "crates/openhuman-core/src/agent/harness/tool_filter.rs",
+ "line": 17,
+ "text": "pub use tinyagents_harness::tool::MIN_CONFIDENT_HITS;",
+ "occurrence": 1
+ },
+ {
+ "rule": "openhuman-upstream-reexport",
+ "path": "crates/openhuman-core/src/agent/multimodal.rs",
+ "line": 51,
+ "text": "pub use tinyagents_harness::multimodal::{FilePayload, MultimodalError};",
+ "occurrence": 1
+ },
+ {
+ "rule": "openhuman-upstream-reexport",
+ "path": "crates/openhuman-core/src/agent/orchestration/types.rs",
+ "line": 12,
+ "text": "pub use tinyagents_graph::orchestration::OrchestrationTaskStatus;",
+ "occurrence": 1
+ },
+ {
+ "rule": "openhuman-upstream-reexport",
+ "path": "crates/openhuman-core/src/agent/orchestration/worktree.rs",
+ "line": 56,
+ "text": "pub use tinyagents_harness::workspace::{",
+ "occurrence": 1
+ },
+ {
+ "rule": "openhuman-upstream-reexport",
+ "path": "crates/openhuman-core/src/agent/pformat.rs",
+ "line": 23,
+ "text": "pub use tinyagents_harness::tool_calling::{",
+ "occurrence": 1
+ },
+ {
+ "rule": "openhuman-upstream-reexport",
+ "path": "crates/openhuman-core/src/agent/task_board.rs",
+ "line": 18,
+ "text": "pub use tinyagents_graph::todos::{",
+ "occurrence": 1
+ },
+ {
+ "rule": "openhuman-upstream-reexport",
+ "path": "crates/openhuman-core/src/agent/tinyagents/delegation.rs",
+ "line": 53,
+ "text": "pub(crate) use tinyagents_graph::delegation::{",
+ "occurrence": 1
+ },
+ {
+ "rule": "openhuman-upstream-reexport",
+ "path": "crates/openhuman-core/src/agent/tinyagents/delegation.rs",
+ "line": 67,
+ "text": "pub(crate) use tinyagents_graph::delegation::{",
+ "occurrence": 1
+ },
+ {
+ "rule": "openhuman-upstream-reexport",
+ "path": "crates/openhuman-core/src/agent/tinyagents/orchestration.rs",
+ "line": 25,
+ "text": "pub(crate) use tinyagents_graph::orchestration::OrchestrationTaskStatus;",
+ "occurrence": 1
+ },
+ {
+ "rule": "openhuman-upstream-reexport",
+ "path": "crates/openhuman-core/src/agent/tinyagents/orchestration.rs",
+ "line": 27,
+ "text": "pub(crate) use tinyagents_graph::orchestration::SteeringRegistry;",
+ "occurrence": 1
+ },
+ {
+ "rule": "openhuman-upstream-reexport",
+ "path": "crates/openhuman-core/src/agent/tinyagents/orchestration.rs",
+ "line": 28,
+ "text": "pub(crate) use tinyagents_graph::orchestration::{",
+ "occurrence": 1
+ },
+ {
+ "rule": "openhuman-upstream-reexport",
+ "path": "crates/openhuman-core/src/agent/tinyagents/orchestration.rs",
+ "line": 35,
+ "text": "pub(crate) use tinyagents_harness::ids::TaskId;",
+ "occurrence": 1
+ },
+ {
+ "rule": "openhuman-upstream-reexport",
+ "path": "crates/openhuman-core/src/agent/tinyagents/orchestration.rs",
+ "line": 37,
+ "text": "pub(crate) use tinyagents_harness::steering::{",
+ "occurrence": 1
+ },
+ {
+ "rule": "openhuman-upstream-reexport",
+ "path": "crates/openhuman-core/src/inference/host_runtime/service/mod.rs",
+ "line": 7,
+ "text": "pub use tinyinference_local::service::LocalAiService;",
+ "occurrence": 1
+ },
+ {
+ "rule": "openhuman-upstream-reexport",
+ "path": "crates/openhuman-core/src/inference/mod.rs",
+ "line": 43,
+ "text": "pub use tinyinference_local::status::{",
+ "occurrence": 1
+ },
+ {
+ "rule": "openhuman-upstream-reexport",
+ "path": "crates/openhuman-core/src/skills/types.rs",
+ "line": 16,
+ "text": "pub use tinytools::{ToolContent, ToolResult};",
+ "occurrence": 1
+ },
+ {
+ "rule": "openhuman-upstream-reexport",
+ "path": "crates/openhuman-core/src/threads/goals/mod.rs",
+ "line": 19,
+ "text": "pub use tinyagents_graph::goals::{ThreadGoal, ThreadGoalStatus};",
+ "occurrence": 1
+ },
+ {
+ "rule": "openhuman-upstream-reexport",
+ "path": "crates/openhuman-core/src/threads/todos/ops.rs",
+ "line": 23,
+ "text": "pub use tinyagents_graph::todos::{parse_status, render_markdown, CardPatch};",
+ "occurrence": 1
+ },
+ {
+ "rule": "openhuman-upstream-reexport",
+ "path": "crates/openhuman-core/src/threads/todos/runs.rs",
+ "line": 20,
+ "text": "pub use tinyagents_graph::todos::runs::{",
+ "occurrence": 1
+ },
+ {
+ "rule": "openhuman-upstream-reexport",
+ "path": "crates/openhuman-core/src/tools/schema.rs",
+ "line": 6,
+ "text": "pub use tinyagents_harness::tool::{CleaningStrategy, SchemaCleanr, GEMINI_UNSUPPORTED_KEYWORDS};",
+ "occurrence": 1
+ },
+ {
+ "rule": "openhuman-upstream-reexport",
+ "path": "crates/openhuman-core/src/tools/traits.rs",
+ "line": 22,
+ "text": "pub use tinytools::{",
+ "occurrence": 1
+ },
+ {
+ "rule": "openhuman-upstream-reexport",
+ "path": "crates/openhuman-core/src/voice/cloud_transcribe.rs",
+ "line": 9,
+ "text": "pub use tinyinference_voice::cloud::{CloudTranscribeOptions, CloudTranscribeResult};",
+ "occurrence": 1
+ },
+ {
+ "rule": "tinyagents-forwarding-module",
+ "path": "vendor/tinyagents/crates/tinyagents-harness/src/tool_calling/mod.rs",
+ "line": 7,
+ "text": "pub use tinytools_agent::*;",
+ "occurrence": 1
+ },
+ {
+ "rule": "tinyagents-moved-symbol-alias",
+ "path": "vendor/tinyagents/crates/tinyagents-harness/src/tool/types.rs",
+ "line": 29,
+ "text": "pub struct ToolResult {",
+ "occurrence": 1
+ },
+ {
+ "rule": "tinyagents-moved-symbol-alias",
+ "path": "vendor/tinyagents/crates/tinyagents-harness/src/tool/types.rs",
+ "line": 321,
+ "text": "pub struct ToolPolicy {",
+ "occurrence": 1
+ },
+ {
+ "rule": "tinyagents-moved-symbol-alias",
+ "path": "vendor/tinyagents/crates/tinyagents-harness/src/tool/types.rs",
+ "line": 342,
+ "text": "pub trait Tool<State: Send + Sync>: Send + Sync {",
+ "occurrence": 1
+ },
+ {
+ "rule": "tinyagents-moved-symbol-alias",
+ "path": "vendor/tinyagents/crates/tinyagents-harness/src/tool/types.rs",
+ "line": 463,
+ "text": "pub struct ToolRegistry<State> {",
+ "occurrence": 1
+ },
+ {
+ "rule": "tinyagents-openhuman-domain-name",
+ "path": "vendor/tinyagents/crates/tinyagents-harness/src/providers/claude_code/bridge.rs",
+ "line": 4,
+ "text": "pub(crate) struct ChatMessage {",
+ "occurrence": 1
+ },
+ {
+ "rule": "tinyagents-openhuman-domain-name",
+ "path": "vendor/tinyagents/crates/tinyagents-harness/src/providers/claude_code/bridge.rs",
+ "line": 9,
+ "text": "impl ChatMessage {",
+ "occurrence": 1
+ },
+ {
+ "rule": "tinyagents-openhuman-domain-name",
+ "path": "vendor/tinyagents/crates/tinyagents-harness/src/providers/claude_code/driver.rs",
+ "line": 71,
+ "text": "use super::bridge::{ChatMessage, ChatResponse, ProviderDelta};",
+ "occurrence": 1
+ },
+ {
+ "rule": "tinyagents-openhuman-domain-name",
+ "path": "vendor/tinyagents/crates/tinyagents-harness/src/providers/claude_code/driver.rs",
+ "line": 226,
+ "text": "pub messages: &'a [ChatMessage],",
+ "occurrence": 1
+ },
+ {
+ "rule": "tinyagents-openhuman-domain-name",
+ "path": "vendor/tinyagents/crates/tinyagents-harness/src/providers/claude_code/input_builder_tests.rs",
+ "line": 3,
+ "text": "fn msg(role: &str, content: &str) -> ChatMessage {",
+ "occurrence": 1
+ },
+ {
+ "rule": "tinyagents-openhuman-domain-name",
+ "path": "vendor/tinyagents/crates/tinyagents-harness/src/providers/claude_code/input_builder_tests.rs",
+ "line": 5,
+ "text": "\"system\" => ChatMessage::system(content),",
+ "occurrence": 1
+ },
+ {
+ "rule": "tinyagents-openhuman-domain-name",
+ "path": "vendor/tinyagents/crates/tinyagents-harness/src/providers/claude_code/input_builder_tests.rs",
+ "line": 6,
+ "text": "\"user\" => ChatMessage::user(content),",
+ "occurrence": 1
+ },
+ {
+ "rule": "tinyagents-openhuman-domain-name",
+ "path": "vendor/tinyagents/crates/tinyagents-harness/src/providers/claude_code/input_builder_tests.rs",
+ "line": 7,
+ "text": "\"assistant\" => ChatMessage::assistant(content),",
+ "occurrence": 1
+ },
+ {
+ "rule": "tinyagents-openhuman-domain-name",
+ "path": "vendor/tinyagents/crates/tinyagents-harness/src/providers/claude_code/input_builder_tests.rs",
+ "line": 8,
+ "text": "_ => ChatMessage::tool(content),",
+ "occurrence": 1
+ },
+ {
+ "rule": "tinyagents-openhuman-domain-name",
+ "path": "vendor/tinyagents/crates/tinyagents-harness/src/providers/claude_code/input_builder_tests.rs",
+ "line": 132,
+ "text": "&[ChatMessage::user(",
+ "occurrence": 1
+ },
+ {
+ "rule": "tinyagents-openhuman-domain-name",
+ "path": "vendor/tinyagents/crates/tinyagents-harness/src/providers/claude_code/input_builder_tests.rs",
+ "line": 151,
+ "text": "&[ChatMessage::user(\"read [IMAGE:/etc/hostname]\")],",
+ "occurrence": 1
+ },
+ {
+ "rule": "tinyagents-openhuman-domain-name",
+ "path": "vendor/tinyagents/crates/tinyagents-harness/src/providers/claude_code/input_builder_tests.rs",
+ "line": 162,
+ "text": "ChatMessage::user(\"earlier [OH_IMAGE:data:image/png;base64,QUJD]\"),",
+ "occurrence": 1
+ },
+ {
+ "rule": "tinyagents-openhuman-domain-name",
+ "path": "vendor/tinyagents/crates/tinyagents-harness/src/providers/claude_code/input_builder_tests.rs",
+ "line": 163,
+ "text": "ChatMessage::assistant(\"old answer\"),",
+ "occurrence": 1
+ },
+ {
+ "rule": "tinyagents-openhuman-domain-name",
+ "path": "vendor/tinyagents/crates/tinyagents-harness/src/providers/claude_code/input_builder_tests.rs",
+ "line": 164,
+ "text": "ChatMessage::user(\"latest\"),",
+ "occurrence": 1
+ },
+ {
+ "rule": "tinyagents-openhuman-domain-name",
+ "path": "vendor/tinyagents/crates/tinyagents-harness/src/providers/claude_code/input_builder_tests.rs",
+ "line": 181,
+ "text": "ChatMessage::user(\"first steering\"),",
+ "occurrence": 1
+ },
+ {
+ "rule": "tinyagents-openhuman-domain-name",
+ "path": "vendor/tinyagents/crates/tinyagents-harness/src/providers/claude_code/input_builder_tests.rs",
+ "line": 182,
+ "text": "ChatMessage::user(\"second steering\"),",
+ "occurrence": 1
+ },
+ {
+ "rule": "tinyagents-openhuman-domain-name",
+ "path": "vendor/tinyagents/crates/tinyagents-harness/src/providers/claude_code/input_builder_tests.rs",
+ "line": 183,
+ "text": "ChatMessage::assistant(\"answer\"),",
+ "occurrence": 1
+ },
+ {
+ "rule": "tinyagents-openhuman-domain-name",
+ "path": "vendor/tinyagents/crates/tinyagents-harness/src/providers/claude_code/input_builder_tests.rs",
+ "line": 184,
+ "text": "ChatMessage::user(\"latest\"),",
+ "occurrence": 1
+ },
+ {
+ "rule": "tinyagents-openhuman-domain-name",
+ "path": "vendor/tinyagents/crates/tinyagents-harness/src/providers/claude_code/input_builder_tests.rs",
+ "line": 194,
+ "text": "&[ChatMessage::user(",
+ "occurrence": 1
+ },
+ {
+ "rule": "tinyagents-openhuman-domain-name",
+ "path": "vendor/tinyagents/crates/tinyagents-harness/src/providers/claude_code/input_builder_tests.rs",
+ "line": 209,
+ "text": "&[ChatMessage::user(",
+ "occurrence": 1
+ },
+ {
+ "rule": "tinyagents-openhuman-domain-name",
+ "path": "vendor/tinyagents/crates/tinyagents-harness/src/providers/claude_code/input_builder.rs",
+ "line": 14,
+ "text": "use super::bridge::ChatMessage;",
+ "occurrence": 1
+ },
+ {
+ "rule": "tinyagents-openhuman-domain-name",
+ "path": "vendor/tinyagents/crates/tinyagents-harness/src/providers/claude_code/input_builder.rs",
+ "line": 22,
+ "text": "pub fn build_stdin(messages: &[ChatMessage], is_new_session: bool) -> Vec<u8> {",
+ "occurrence": 1
+ },
+ {
+ "rule": "tinyagents-openhuman-domain-name",
+ "path": "vendor/tinyagents/crates/tinyagents-harness/src/providers/claude_code/input_builder.rs",
+ "line": 32,
+ "text": "let non_system: Vec<&ChatMessage> = messages.iter().filter(|m| m.role != \"system\").collect();",
+ "occurrence": 1
+ },
+ {
+ "rule": "tinyagents-openhuman-domain-name",
+ "path": "vendor/tinyagents/crates/tinyagents-harness/src/providers/claude_code/input_builder.rs",
+ "line": 95,
+ "text": "fn prior_conversation_preamble(non_system: &[&ChatMessage], end: usize) -> Option<String> {",
+ "occurrence": 1
+ },
+ {
+ "rule": "tinyagents-openhuman-domain-name",
+ "path": "vendor/tinyagents/crates/tinyagents-harness/src/providers/claude_code/mod_tests.rs",
+ "line": 26,
+ "text": "let a = vec![ChatMessage::user(\"hello world\")];",
+ "occurrence": 1
+ },
+ {
+ "rule": "tinyagents-openhuman-domain-name",
+ "path": "vendor/tinyagents/crates/tinyagents-harness/src/providers/claude_code/mod_tests.rs",
+ "line": 28,
+ "text": "ChatMessage::user(\"hello world\"),",
+ "occurrence": 1
+ },
+ {
+ "rule": "tinyagents-openhuman-domain-name",
+ "path": "vendor/tinyagents/crates/tinyagents-harness/src/providers/claude_code/mod_tests.rs",
+ "line": 29,
+ "text": "ChatMessage::assistant(\"hi\"),",
+ "occurrence": 1
+ },
+ {
+ "rule": "tinyagents-openhuman-domain-name",
+ "path": "vendor/tinyagents/crates/tinyagents-harness/src/providers/claude_code/mod_tests.rs",
+ "line": 36,
+ "text": "let a = vec![ChatMessage::user(\"alpha\")];",
+ "occurrence": 1
+ },
+ {
+ "rule": "tinyagents-openhuman-domain-name",
+ "path": "vendor/tinyagents/crates/tinyagents-harness/src/providers/claude_code/mod_tests.rs",
+ "line": 37,
+ "text": "let b = vec![ChatMessage::user(\"beta\")];",
+ "occurrence": 1
+ },
+ {
+ "rule": "tinyagents-openhuman-domain-name",
+ "path": "vendor/tinyagents/crates/tinyagents-harness/src/providers/claude_code/mod.rs",
+ "line": 19,
+ "text": "use bridge::{ChatMessage, ChatResponse, ProviderDelta};",
+ "occurrence": 1
+ },
+ {
+ "rule": "tinyagents-openhuman-domain-name",
+ "path": "vendor/tinyagents/crates/tinyagents-harness/src/providers/claude_code/mod.rs",
+ "line": 164,
+ "text": "messages: &[ChatMessage],",
+ "occurrence": 1
+ },
+ {
+ "rule": "tinyagents-openhuman-domain-name",
+ "path": "vendor/tinyagents/crates/tinyagents-harness/src/providers/claude_code/mod.rs",
+ "line": 195,
+ "text": "fn request_messages(request: &ModelRequest) -> Vec<ChatMessage> {",
+ "occurrence": 1
+ },
+ {
+ "rule": "tinyagents-openhuman-domain-name",
+ "path": "vendor/tinyagents/crates/tinyagents-harness/src/providers/claude_code/mod.rs",
+ "line": 212,
+ "text": "ChatMessage::new(role, content)",
+ "occurrence": 1
+ },
+ {
+ "rule": "tinyagents-openhuman-domain-name",
+ "path": "vendor/tinyagents/crates/tinyagents-harness/src/providers/claude_code/mod.rs",
+ "line": 341,
+ "text": "fn thread_key_from_messages(messages: &[ChatMessage]) -> String {",
+ "occurrence": 1
+ },
+ {
+ "rule": "tinyagents-tool-calling-facade",
+ "path": "vendor/tinyagents/crates/tinyagents-harness/src/lib.rs",
+ "line": 54,
+ "text": "pub mod tool_calling;",
+ "occurrence": 1
+ },
+ {
+ "rule": "tinyagents-tool-calling-facade",
+ "path": "vendor/tinyagents/crates/tinyagents-harness/src/tool_calling/mod.rs",
+ "line": 7,
+ "text": "pub use tinytools_agent::*;",
+ "occurrence": 1
+ },
+ {
+ "rule": "tinyagents-upstream-reexport",
+ "path": "vendor/tinyagents/crates/tinyagents-graph/src/lib.rs",
+ "line": 53,
+ "text": "pub use tinyagents_harness::error::{Result, TinyAgentsError};",
+ "occurrence": 1
+ },
+ {
+ "rule": "tinyagents-upstream-reexport",
+ "path": "vendor/tinyagents/crates/tinyagents-harness/src/tool_calling/mod.rs",
+ "line": 7,
+ "text": "pub use tinytools_agent::*;",
+ "occurrence": 1
+ },
+ {
+ "rule": "tinyagents-upstream-reexport",
+ "path": "vendor/tinyagents/crates/tinyagents-harness/src/tool/mod.rs",
+ "line": 35,
+ "text": "pub use tinytools::{",
+ "occurrence": 1
+ },
+ {
+ "rule": "tinyagents-upstream-reexport",
+ "path": "vendor/tinyagents/crates/tinyagents-harness/src/tool/types.rs",
+ "line": 25,
+ "text": "pub(crate) use tinyinference_llm::tool::{ToolCall, ToolDelta, ToolFormat, ToolSchema};",
+ "occurrence": 1
+ },
+ {
+ "rule": "tinyagents-upstream-reexport",
+ "path": "vendor/tinyagents/crates/tinyagents-harness/src/tool/types.rs",
+ "line": 193,
+ "text": "pub use tinytools::SandboxMode;",
+ "occurrence": 1
+ },
+ {
+ "rule": "tinyagents-upstream-reexport",
+ "path": "vendor/tinyagents/crates/tinyagents-harness/src/workspace/types.rs",
+ "line": 19,
+ "text": "pub use tinytools::WorkspaceDescriptor;",
+ "occurrence": 1
+ },
+ {
+ "rule": "tinyagents-upstream-reexport",
+ "path": "vendor/tinyagents/crates/tinyagents-registry/src/catalog.rs",
+ "line": 22,
+ "text": "pub use tinyagents_harness::cost::ModelPricing;",
+ "occurrence": 1
+ },
+ {
+ "rule": "tinyagents-upstream-reexport",
+ "path": "vendor/tinyagents/crates/tinyagents-registry/src/lib.rs",
+ "line": 35,
+ "text": "pub use tinyagents_harness::error::{Result, TinyAgentsError};",
+ "occurrence": 1
+ },
+ {
+ "rule": "tinyagents-upstream-reexport",
+ "path": "vendor/tinyagents/crates/tinyagents-session/src/lib.rs",
+ "line": 78,
+ "text": "pub use tinyagents_harness::error::{Result, TinyAgentsError};",
+ "occurrence": 1
+ }
+]
diff --git a/scripts/ci/check-agent-runtime-boundary.mjs b/scripts/ci/check-agent-runtime-boundary.mjs
new file mode 100644
index 0000000000..c6a0af79e6
--- /dev/null
+++ b/scripts/ci/check-agent-runtime-boundary.mjs
@@ -0,0 +1,380 @@
+#!/usr/bin/env node
+
+import { readFile, readdir, writeFile } from "node:fs/promises";
+import { dirname, relative, resolve } from "node:path";
+import { fileURLToPath } from "node:url";
+
+const repoRoot = resolve(dirname(fileURLToPath(import.meta.url)), "../..");
+const baselinePath = resolve(repoRoot, "scripts/ci/agent-runtime-boundary-baseline.json");
+const openhumanCratesRoot = resolve(repoRoot, "crates");
+const tinyagentsRoot = resolve(repoRoot, "vendor/tinyagents/crates");
+const writeBaseline = process.argv.includes("--write-baseline");
+const noBaseline = process.argv.includes("--no-baseline");
+
+// Product types need not start with `OpenHuman`, so this is an explicit,
+// reviewed inventory rather than a naming convention.
+const openhumanDomainTypes = new Set([
+ "AgentDefinitionDisplay", "AgentDefinitionModel", "AgentProfile", "AgentProfileStore",
+ "AgentProgress", "ApprovalDecision", "ChatMessage", "ConversationMessage",
+ "ConversationMessagePatch", "ConversationMessageRecord", "DomainEvent",
+ "IntegrationAccount", "OpenHumanConfig", "OpenHumanRunContext", "ToolExecutionResult",
+ "ToolResultMessage", "TurnOrigin", "UserProfileHook", "WorkspacePolicy",
+]);
+
+// Names moved out of compatibility layers. Values identify their sole owner;
+// declarations in any other TinyAgents crate are facades even if private.
+const movedSymbolOwners = new Map([
+ ["Tool", "tinytools"], ["ToolResult", "tinytools"], ["ToolPolicy", "tinytools"],
+ ["ToolSchema", "tinytools"], ["ToolCall", "tinytools"],
+ ["ToolCallOptions", "tinytools"], ["ToolRunContext", "tinytools"],
+ ["WorkspaceDescriptor", "tinytools"], ["ToolContent", "tinytools"],
+ ["ToolRegistry", "tinytools"],
+ ["ChatModel", "tinyinference-llm"], ["ModelRequest", "tinyinference-llm"],
+ ["ModelResponse", "tinyinference-llm"], ["Message", "tinyinference-llm"],
+ ["MessageDelta", "tinyinference-llm"], ["Usage", "tinyinference-llm"],
+ ["UsageTotals", "tinyinference-llm"],
+ ["AgentHarness", "tinyagents-harness"], ["AgentTurnRequest", "tinyagents-harness"],
+ ["HostCapabilities", "tinyagents-harness"], ["RunConfig", "tinyagents-harness"],
+ ["RunContext", "tinyagents-harness"], ["CancellationToken", "tinyagents-harness"],
+ ["RetryPolicy", "tinyagents-harness"], ["FallbackPolicy", "tinyagents-harness"],
+]);
+
+const bridgeSymbols = [
+ "SharedToolAdapter", "ToolAdapter", "spec_to_schema", "execute_openhuman_tool",
+ "assemble_turn_harness", "run_turn_via_tinyagents_shared",
+];
+const deletedTaskLocalModules = [
+ "fork_context", "sandbox_context", "spawn_depth_context", "task_recency_context",
+ "turn_attachments_context", "turn_dispatch_guard", "turn_subagent_usage",
+ "resolved_route", "run_cancellation_context", "thread_context",
+];
+const taskLocalAccessors = [
+ "current_parent", "with_parent_context", "current_agent_context_prepared_sources",
+ "with_agent_context_prepared_sources", "current_sandbox_mode", "with_current_sandbox_mode",
+ "current_spawn_depth", "with_spawn_depth", "current_task_recency_window",
+ "with_task_recency_window", "current_turn_image_placeholders",
+ "with_current_turn_image_placeholders", "with_dispatch_guard", "record_subagent_usage",
+ "with_turn_collector", "current_progress_sink", "with_progress_sink",
+ "with_resolved_provider_route_scope", "record_resolved_provider_route", "current_route_slot",
+ "with_route_slot", "current_resolved_provider_route", "current_run_cancellation",
+ "with_run_cancellation", "current_thread_id", "with_thread_id", "current_is_user_authored",
+ "with_origin", "with_inherited_origin", "current_request_id",
+];
+const taskLocalStatics = [
+ "PARENT_CONTEXT", "AGENT_CONTEXT_PREPARED_SOURCES", "CURRENT_AGENT_SANDBOX_MODE",
+ "TASK_RECENCY_WINDOW", "CURRENT_TURN_IMAGE_PLACEHOLDERS", "AGENT_PROGRESS_SINK",
+ "RESOLVED_PROVIDER_ROUTE", "CURRENT_RUN_CANCELLATION", "THREAD_ID", "AGENT_TURN_ORIGIN",
+ "AGENT_TURN_WORKSPACE",
+];
+
+async function filesUnder(root, predicate) {
+ const found = [];
+ async function visit(directory) {
+ for (const entry of await readdir(directory, { withFileTypes: true })) {
+ const path = resolve(directory, entry.name);
+ if (entry.isDirectory()) await visit(path);
+ else if (predicate(path)) found.push(path);
+ }
+ }
+ await visit(root);
+ return found.sort();
+}
+
+function isTestPath(path) {
+ return /(?:^|\/)(?:tests?|examples)(?:\/|$)|(?:_tests?|test)\.rs$/.test(path);
+}
+
+function escapeRegex(value) {
+ return value.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
+}
+
+// Mask comments and literals while retaining line locations. Rust permits
+// nested block comments and raw strings, so both are handled explicitly.
+function rustCode(source) {
+ let result = "";
+ let index = 0;
+ let blockDepth = 0;
+ let state = "code";
+ let rawHashes = "";
+ const blank = (char) => (char === "\n" || char === "\r" ? char : " ");
+ while (index < source.length) {
+ const char = source[index];
+ const next = source[index + 1];
+ if (state === "line") {
+ result += blank(char);
+ if (char === "\n") state = "code";
+ index += 1;
+ continue;
+ }
+ if (state === "block") {
+ if (char === "/" && next === "*") {
+ blockDepth += 1; result += " "; index += 2;
+ } else if (char === "*" && next === "/") {
+ blockDepth -= 1; result += " "; index += 2;
+ if (blockDepth === 0) state = "code";
+ } else {
+ result += blank(char); index += 1;
+ }
+ continue;
+ }
+ if (state === "quoted" || state === "char") {
+ result += blank(char);
+ if (char === "\\") {
+ if (next !== undefined) {
+ result += blank(next); index += 2;
+ } else index += 1;
+ } else {
+ if ((state === "quoted" && char === '"') || (state === "char" && char === "'")) state = "code";
+ index += 1;
+ }
+ continue;
+ }
+ if (state === "raw") {
+ if (char === '"' && source.slice(index + 1, index + 1 + rawHashes.length) === rawHashes) {
+ result += " ".repeat(rawHashes.length + 1); index += rawHashes.length + 1; state = "code";
+ } else {
+ result += blank(char); index += 1;
+ }
+ continue;
+ }
+ if (char === "/" && next === "/") {
+ result += " "; index += 2; state = "line";
+ } else if (char === "/" && next === "*") {
+ result += " "; index += 2; blockDepth = 1; state = "block";
+ } else if (char === '"') {
+ result += " "; index += 1; state = "quoted";
+ } else if (char === "'" && isRustCharLiteral(source, index)) {
+ result += " "; index += 1; state = "char";
+ } else if (char === "r") {
+ const raw = source.slice(index).match(/^r(#{0,255})"/);
+ if (raw) {
+ result += " ".repeat(raw[0].length); index += raw[0].length; rawHashes = raw[1]; state = "raw";
+ } else {
+ result += char; index += 1;
+ }
+ } else {
+ result += char; index += 1;
+ }
+ }
+ return result;
+}
+
+function isRustCharLiteral(source, start) {
+ const first = source.codePointAt(start + 1);
+ if (first === undefined) return false;
+ if (first === 0x5c) {
+ const escapeStart = start + 2;
+ const escape = source[escapeStart];
+ if (escape === undefined) return false;
+ if ("\\'\"nrt0".includes(escape)) return source[escapeStart + 1] === "'";
+ if (escape === "x") return /^[0-9a-fA-F]{2}'/.test(source.slice(escapeStart + 1));
+ if (escape === "u") {
+ const close = source.indexOf("}", escapeStart + 1);
+ return close >= 0 && /^\{[0-9a-fA-F_]+\}$/.test(source.slice(escapeStart + 1, close + 1)) && source[close + 1] === "'";
+ }
+ return false;
+ }
+ const width = String.fromCodePoint(first).length;
+ return source[start + 1 + width] === "'";
+}
+
+function codeLines(source) {
+ const code = rustCode(source).split(/\r?\n/);
+ const raw = source.split(/\r?\n/);
+ return code.map((text, index) => ({ line: index + 1, text, raw: raw[index] ?? "" }));
+}
+
+function compactRustPath(text) {
+ return text.replace(/\s*::\s*/g, "::");
+}
+
+function isUpstreamPath(text) {
+ return /\b(?:tinyagents(?:_[a-z0-9_]+)?|tinytools(?:_[a-z0-9_]+)?|tinyinference(?:_[a-z0-9_]+)?)\s*::/i.test(text);
+}
+
+function isDependencyTable(header) {
+ return /(?:^|\.)(?:dev-|build-)?dependencies\s*$/i.test(header.trim());
+}
+
+function nestedDependencyName(header) {
+ const match = header.match(/(?:^|\.)(?:dev-|build-)?dependencies\s*\.\s*([A-Za-z0-9_-]+)\s*$/i);
+ return match?.[1];
+}
+
+function tomlWithoutComment(line) {
+ let quoted = false;
+ let escaped = false;
+ for (let index = 0; index < line.length; index += 1) {
+ const char = line[index];
+ if (char === '"' && !escaped) quoted = !quoted;
+ if (char === "#" && !quoted) return line.slice(0, index);
+ escaped = char === "\\" && !escaped;
+ if (char !== "\\") escaped = false;
+ }
+ return line;
+}
+
+function cargoOpenhumanDependencyLines(source) {
+ const findings = [];
+ let table = "";
+ let nestedDependency = "";
+ for (const [offset, raw] of source.split(/\r?\n/).entries()) {
+ const line = tomlWithoutComment(raw);
+ const tableMatch = line.match(/^\s*\[([^\]]+)]\s*$/);
+ if (tableMatch) {
+ table = tableMatch[1].replace(/\s+/g, "");
+ nestedDependency = nestedDependencyName(table) ?? "";
+ if (/^openhuman(?:[-_][A-Za-z0-9_-]+)?$/i.test(nestedDependency)) findings.push({ line: offset + 1, text: raw });
+ continue;
+ }
+ if (!isDependencyTable(table) && !nestedDependency) continue;
+ const keyMatch = line.match(/^\s*([A-Za-z0-9_-]+)\s*=/);
+ const key = keyMatch?.[1] ?? "";
+ const namesOpenhuman = /^openhuman(?:[-_][A-Za-z0-9_-]+)?$/i.test(key);
+ const aliasesOpenhuman = /\bpackage\s*=\s*["']openhuman(?:[-_][A-Za-z0-9_-]+)?["']/i.test(line);
+ if (namesOpenhuman || aliasesOpenhuman) findings.push({ line: offset + 1, text: raw });
+ }
+ return findings;
+}
+
+function tinyagentsCrateName(path) {
+ return relative(tinyagentsRoot, path).match(/^([^/\\]+)/)?.[1] ?? "";
+}
+
+function isBehaviorFreeForwarder(source) {
+ let remaining = rustCode(source);
+ remaining = remaining.replace(/^\s*#\s*\[[^\n]*]\s*$/gm, "");
+ remaining = remaining.replace(/(?:pub(?:\s*\([^)]*\))?\s+)?use\s+[\s\S]*?;/g, "");
+ return !/[A-Za-z0-9_]/.test(remaining);
+}
+
+function assertSelfTests() {
+ const fixture = [
+ "[dependencies.openhuman]", "version = \"1\"",
+ "[target.'cfg(unix)'.dev-dependencies]", "host = { package = \"openhuman-core\", version = \"1\" }",
+ "[workspace.dependencies]", "openhuman_tools = \"1\"",
+ "[build-dependencies]", "helper = { package = \"openhuman\" }",
+ "[dev-dependencies.host]", "package = 'openhuman'",
+ ].join("\n");
+ if (cargoOpenhumanDependencyLines(fixture).length !== 5) throw new Error("agent-runtime boundary self-test: Cargo dependency form escaped detection");
+ if (!["ChatMessage", "ConversationMessage", "ToolResultMessage"].every((name) => openhumanDomainTypes.has(name))) throw new Error("agent-runtime boundary self-test: durable transcript inventory regressed");
+ const masked = rustCode('/* openhuman :: AgentProgress */ let x = openhuman :: AgentProgress; // tinytools::Tool');
+ if (!compactRustPath(masked).includes("openhuman::AgentProgress") || masked.includes("tinytools::Tool")) throw new Error("agent-runtime boundary self-test: Rust masking/path normalization regressed");
+ const lifetimeMasked = rustCode("fn borrow<'a>(message: &'a ChatMessage) { 'retry: loop { let _ = openhuman :: ChatMessage; break 'retry; } }");
+ if (!compactRustPath(lifetimeMasked).includes("openhuman::ChatMessage") || !lifetimeMasked.includes("&'a ChatMessage")) throw new Error("agent-runtime boundary self-test: Rust lifetimes or labels hid code");
+ const literalMasked = rustCode("let marker = 'x'; let text = \"openhuman :: ChatMessage\"; // openhuman :: ChatMessage");
+ if (literalMasked.includes("openhuman") || literalMasked.includes("marker = 'x'")) throw new Error("agent-runtime boundary self-test: Rust literals or comments leaked into scan");
+ if (!isBehaviorFreeForwarder("pub(crate) use tinytools::Tool;\n")) throw new Error("agent-runtime boundary self-test: private forwarding module escaped detection");
+ const beforeMove = stable([{ rule: "fixture", path: "fixture.rs", line: 7, text: "use openhuman::ChatMessage;" }]);
+ const afterMove = stable([{ rule: "fixture", path: "fixture.rs", line: 8, text: "use openhuman::ChatMessage;" }]);
+ if (JSON.stringify(beforeMove) === JSON.stringify(afterMove)) throw new Error("agent-runtime boundary self-test: physical moves escaped the exact baseline");
+}
+
+assertSelfTests();
+
+const findings = [];
+function add(rule, path, line, text) {
+ findings.push({ rule, path: relative(repoRoot, path), line, text: text.trim() });
+}
+
+// Scan every OpenHuman crate: facades are not restricted to agent/.
+for (const path of await filesUnder(openhumanCratesRoot, (path) => path.endsWith(".rs") && /\/src\//.test(path))) {
+ const rel = relative(repoRoot, path);
+ for (const { line, text, raw } of codeLines(await readFile(path, "utf8"))) {
+ if (!text.trim()) continue;
+ const compact = compactRustPath(text);
+ if (/\btinyagents_harness::tool_calling\b/.test(compact)) add("openhuman-tool-calling-facade", path, line, raw);
+ if (/\bcrate::agent::(?:dispatcher|pformat|harness::(?:parse|instructions|tool_filter))\b/.test(compact)) add("openhuman-agent-facade", path, line, raw);
+ for (const symbol of bridgeSymbols) if (new RegExp(`\\b${escapeRegex(symbol)}\\b`).test(text)) add("openhuman-runtime-bridge", path, line, raw);
+ if (!isTestPath(rel)) {
+ const isListedTaskLocalFile = /\/(?:fork_context|sandbox_context|spawn_depth_context|task_recency_context|turn_attachments_context|turn_dispatch_guard|turn_subagent_usage|progress_sink|resolved_route|run_cancellation_context|thread_context|turn_origin|turn_workspace)\.rs$/.test(path);
+ const namesTaskLocalAccessor = taskLocalAccessors.some((name) => new RegExp(`\\b${escapeRegex(name)}\\s*\\(`).test(text) || (/\b(?:pub(?:\([^)]*\))?\s+)?use\b/.test(text) && new RegExp(`\\b${escapeRegex(name)}\\b`).test(text)));
+ const namesTaskLocalStatic = taskLocalStatics.some((name) => new RegExp(`\\b${escapeRegex(name)}\\b`).test(text));
+ const usesGenericAccessor = /\b(?:turn_origin|turn_workspace|turn_dispatch_guard)::(?:current|capture|propagate|spawn|spawn_unlabelled|check|record_subagent_elapsed|with_workspace)\b/.test(compact) || (/\/turn_workspace\.rs$/.test(path) && /\bwith_workspace\s*\(/.test(text));
+ const declaresDeletedModule = deletedTaskLocalModules.some((name) => new RegExp(`\\bmod\\s+${escapeRegex(name)}\\s*;`).test(text));
+ if ((isListedTaskLocalFile && /\btokio\s*::\s*task_local!/.test(text)) || namesTaskLocalAccessor || namesTaskLocalStatic || usesGenericAccessor || declaresDeletedModule) add("openhuman-task-local", path, line, raw);
+ }
+ if (/\bpub(?:\s*\([^)]*\))?\s+use\s+(?:tinyagents(?:_[a-z_]+)?|tinytools(?:_[a-z_]+)?|tinyinference(?:_[a-z_]+)?)\s*::/i.test(text)) add("openhuman-upstream-reexport", path, line, raw);
+ }
+}
+
+for (const path of await filesUnder(tinyagentsRoot, (path) => path.endsWith(".rs") || path.endsWith("Cargo.toml"))) {
+ const source = await readFile(path, "utf8");
+ if (path.endsWith("Cargo.toml")) {
+ for (const item of cargoOpenhumanDependencyLines(source)) add("tinyagents-openhuman-dependency", path, item.line, item.text);
+ continue;
+ }
+ const crateName = tinyagentsCrateName(path);
+ const lines = codeLines(source);
+ let firstForwardingLine;
+ for (const { line, text, raw } of lines) {
+ if (!text.trim()) continue;
+ const compact = compactRustPath(text);
+ if (/\b(?:pub(?:\s*\([^)]*\))?\s+)?mod\s+tool_calling\s*;/.test(text)) add("tinyagents-tool-calling-facade", path, line, raw);
+ if (/\bpub(?:\s*\([^)]*\))?\s+use\s+(?:tinyagents(?:_[a-z_]+)?|tinytools(?:_[a-z_]+)?|tinyinference(?:_[a-z_]+)?)\s*::/i.test(text)) add("tinyagents-upstream-reexport", path, line, raw);
+ if (/\b(?:pub(?:\s*\([^)]*\))?\s+)?use\s+tinytools_agent(?:\s*::|\s*;)/.test(text)) add("tinyagents-tool-calling-facade", path, line, raw);
+ if (isUpstreamPath(text) && firstForwardingLine === undefined) firstForwardingLine = { line, raw };
+ const declaration = text.match(/\b(?:pub(?:\s*\([^)]*\))?\s+)?(?:type|struct|enum|trait|fn)\s+([A-Za-z_][A-Za-z0-9_]*)\b/);
+ if (declaration) {
+ const owner = movedSymbolOwners.get(declaration[1]);
+ if (owner && !crateName.startsWith(owner)) add("tinyagents-moved-symbol-alias", path, line, raw);
+ }
+ if (/\b(?:pub(?:\s*\([^)]*\))?\s+)?type\s+[A-Za-z_][A-Za-z0-9_]*[^=]*=\s*(?:tinyagents(?:_[a-z_]+)?|tinytools(?:_[a-z_]+)?|tinyinference(?:_[a-z_]+)?)\s*::/i.test(text) || /\b(?:pub(?:\s*\([^)]*\))?\s+)?struct\s+[A-Za-z_][A-Za-z0-9_]*\s*\(\s*(?:tinyagents(?:_[a-z_]+)?|tinytools(?:_[a-z_]+)?|tinyinference(?:_[a-z_]+)?)\s*::/i.test(text)) add("tinyagents-moved-symbol-alias", path, line, raw);
+ if (/\bopenhuman(?:\s*::|_[A-Za-z0-9_]*\s*::)/i.test(compact)) add("tinyagents-openhuman-domain-name", path, line, raw);
+ for (const name of openhumanDomainTypes) {
+ if (new RegExp(`\\b${escapeRegex(name)}\\b`).test(text)) {
+ add("tinyagents-openhuman-domain-name", path, line, raw);
+ break;
+ }
+ }
+ }
+ if (firstForwardingLine && isBehaviorFreeForwarder(source)) add("tinyagents-forwarding-module", path, firstForwardingLine.line, firstForwardingLine.raw);
+}
+
+findings.sort((a, b) => a.rule.localeCompare(b.rule) || a.path.localeCompare(b.path) || a.line - b.line || a.text.localeCompare(b.text));
+
+function stable(records) {
+ const occurrences = new Map();
+ return records.map(({ rule, path, line, text }) => {
+ // Physical source locations are part of the temporary debt contract: a
+ // moved violation is stale debt, not a silently accepted occurrence.
+ const base = `${rule}\0${path}\0${line}\0${text}`;
+ const occurrence = (occurrences.get(base) ?? 0) + 1;
+ occurrences.set(base, occurrence);
+ return { rule, path, line, text, occurrence };
+ });
+}
+
+if (writeBaseline) {
+ await writeFile(baselinePath, `${JSON.stringify(stable(findings), null, 2)}\n`);
+ console.log(`Wrote ${findings.length} exact agent-runtime boundary violations to ${relative(repoRoot, baselinePath)}.`);
+ process.exit(0);
+}
+
+let expected = [];
+if (!noBaseline) {
+ try {
+ expected = JSON.parse(await readFile(baselinePath, "utf8"));
+ } catch (error) {
+ console.error(`Unable to read ${relative(repoRoot, baselinePath)}: ${error.message}`);
+ process.exit(1);
+ }
+}
+const actualStable = stable(findings);
+const expectedKeys = new Set(expected.map(JSON.stringify));
+const actualKeys = new Set(actualStable.map(JSON.stringify));
+const added = findings.filter((_, index) => !expectedKeys.has(JSON.stringify(actualStable[index])));
+const stale = expected.filter((record) => !actualKeys.has(JSON.stringify(record)));
+if (added.length || stale.length) {
+ console.error("Agent-runtime ownership boundary changed.");
+ if (added.length) {
+ console.error(`\nUnbaselined violations (${added.length}):`);
+ for (const item of added) console.error(` ${item.rule}: ${item.path}:${item.line}: ${item.text}`);
+ }
+ if (stale.length) {
+ console.error(`\nStale baseline entries (${stale.length}); remove them:`);
+ for (const item of stale) console.error(` ${item.rule}: ${item.path}: ${item.text} [${item.occurrence}]`);
+ }
+ process.exit(1);
+}
+console.log(`Agent-runtime boundary holds (${findings.length} temporary exact violations baselined).`);
diff --git a/vendor/tinyagents b/vendor/tinyagents
index 22230c5dbf..b703d9e28a 160000
--- a/vendor/tinyagents
+++ b/vendor/tinyagents
@@ -1 +1 @@
-Subproject commit 22230c5dbf8c66b7a25464a2986138483b88e29b
+Subproject commit b703d9e28ae4daa4ab4dc78e04bc494ee5d24d71