Skip to content

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

refactor(tokenjuice): rename tinyjuice_retrieve to juice_retrieve

Steven Enamakeldbc9f0b6e24c
diff --git a/app/src/features/conversations/tools/__fixtures__/coreToolNames.json b/app/src/features/conversations/tools/__fixtures__/coreToolNames.json
index 10b6f73b18..f004979afc 100644
--- a/app/src/features/conversations/tools/__fixtures__/coreToolNames.json
+++ b/app/src/features/conversations/tools/__fixtures__/coreToolNames.json
@@ -193,7 +193,7 @@
"task_source_remove",
"task_source_status",
"task_source_update",
- "tinyjuice_retrieve",
+ "juice_retrieve",
"todo",
"tool_call",
"tool_search",
diff --git a/app/src/features/conversations/tools/toolSpecs.ts b/app/src/features/conversations/tools/toolSpecs.ts
index 373587a7f2..d8d9a3aa22 100644
--- a/app/src/features/conversations/tools/toolSpecs.ts
+++ b/app/src/features/conversations/tools/toolSpecs.ts
@@ -194,7 +194,7 @@ export const EXACT_TOOL_SPECS: Record<string, ToolSpec> = {
current_time: spec('checkTime', ClockIcon, 'system'),
resolve_time: spec('resolveDate', ClockIcon, 'system', { chip: chip.text('expr') }),
retrieve_tool_output: spec('retrieveOutput', ArchiveRestoreIcon, 'system'),
- tinyjuice_retrieve: spec('retrieveOutput', ArchiveRestoreIcon, 'system'),
+ juice_retrieve: spec('retrieveOutput', ArchiveRestoreIcon, 'system'),
// REPL tools over a stored (handle) tool result; they reuse existing phrases.
juice_find: spec('searchCode', TextSearchIcon, 'system', { chip: chip.text('query') }),
juice_extract: spec('extractDetails', LayersIcon, 'system'),
diff --git a/crates/openhuman-core/src/agent/registry/agents/orchestrator/agent.toml b/crates/openhuman-core/src/agent/registry/agents/orchestrator/agent.toml
index 0545cf8a8e..943a9ece1a 100644
--- a/crates/openhuman-core/src/agent/registry/agents/orchestrator/agent.toml
+++ b/crates/openhuman-core/src/agent/registry/agents/orchestrator/agent.toml
@@ -29,15 +29,12 @@ omit_profile = false
# prior conversations and distilled user preferences. Frozen per
# session (KV-cache contract on `AgentDefinition::omit_memory_md`).
omit_memory_md = false
-# Memory retrieval is ON-DEMAND, not pre-emptive. The orchestrator used to
-# run `agent_memory` eagerly before every turn (`trigger_memory_agent =
-# "always"`), spawning a full ≤15-iteration memory subagent on every
-# message — including trivial ones — before it had even read the user's
-# intent. That cost a blocking agentic round-trip per turn for a guarantee
-# the model rarely needed. Instead, `agent_memory` is listed in the
-# `[subagents]` allowlist below, which synthesises a `delegate_retrieve_memory`
-# tool the orchestrator calls only when a message actually needs the deep
-# memory-tree walk. (The frozen MEMORY.md digest still anchors every turn.)
+# Memory retrieval is ON-DEMAND, not pre-emptive, and it is one direct `memory`
+# tool (`ask` | `keyword_search` | `learn`). The orchestrator used to run
+# `agent_memory` eagerly before every turn, then to offer it as a second
+# `retrieve_memory` delegate beside `memory_recall`: two near-identical ways to
+# search the same store. Now there is one. (The frozen MEMORY.md digest still
+# anchors every turn.)
# Delegation surface. The `collect_orchestrator_tools` helper reads this
# at agent-build time and synthesises one `delegate_*` tool per entry:
diff --git a/crates/openhuman-core/src/agent/session_host/builder/builder_tests.rs b/crates/openhuman-core/src/agent/session_host/builder/builder_tests.rs
index 5964d63d18..097437b258 100644
--- a/crates/openhuman-core/src/agent/session_host/builder/builder_tests.rs
+++ b/crates/openhuman-core/src/agent/session_host/builder/builder_tests.rs
@@ -411,7 +411,7 @@ fn is_empty_tool_scope_distinguishes_the_three_states() {
#[tokio::test]
async fn a_summarized_agent_sees_the_recovery_tool_with_compaction_off() {
- // A summary's footer names `tinyjuice_retrieve`, and summaries run with
+ // A summary's footer names `juice_retrieve`, and summaries run with
// the compaction router off (the default). The orchestrator is the agent
// that gets them, so it must see the tool whatever the router says.
use crate::agent::session_host::types::OpenHumanSessionHost;
diff --git a/crates/openhuman-core/src/agent/session_host/builder/mod.rs b/crates/openhuman-core/src/agent/session_host/builder/mod.rs
index e7213bb89b..9126ab8ac2 100644
--- a/crates/openhuman-core/src/agent/session_host/builder/mod.rs
+++ b/crates/openhuman-core/src/agent/session_host/builder/mod.rs
@@ -177,7 +177,7 @@ pub(super) fn visible_tool_specs_for_policy(
.collect()
}
-/// Ensure the CCR recovery tool (`tinyjuice_retrieve`) is a member of a
+/// Ensure the CCR recovery tool (`juice_retrieve`) is a member of a
/// non-empty visibility allowlist. Compaction runs on every agent's tool
/// output, so any agent with a curated `ToolScope::Named` list must still be
/// able to act on a `⟦tj:…⟧` marker. Only the live tool is added; the legacy
diff --git a/crates/openhuman-core/src/agent/tinyagents/host/definition_registry.rs b/crates/openhuman-core/src/agent/tinyagents/host/definition_registry.rs
index 5dd4676ed6..ac92a08e52 100644
--- a/crates/openhuman-core/src/agent/tinyagents/host/definition_registry.rs
+++ b/crates/openhuman-core/src/agent/tinyagents/host/definition_registry.rs
@@ -330,7 +330,7 @@ impl OpenHumanDefinitionRegistry {
names.extend(delegation_tools.iter().cloned());
}
// A curated belt still has to reach the tools a compacted
- // result names (`tinyjuice_retrieve`, `juice_find`, …). The
+ // result names (`juice_retrieve`, `juice_find`, …). The
// session adds them to its visible set; without the same
// names here the harness allowlist rejects every call to them
// as an unknown tool. A zero-tool belt stays zero-tool.
diff --git a/crates/openhuman-core/src/agent/tinyagents/host/definition_registry_tests.rs b/crates/openhuman-core/src/agent/tinyagents/host/definition_registry_tests.rs
index 31264db905..03761a59fe 100644
--- a/crates/openhuman-core/src/agent/tinyagents/host/definition_registry_tests.rs
+++ b/crates/openhuman-core/src/agent/tinyagents/host/definition_registry_tests.rs
@@ -577,7 +577,7 @@ fn named_scope_admits_the_tinyjuice_tools_a_handle_names() {
def.tools = ToolScope::Named(vec!["file_read".into()]);
let registered = Arc::new(vec![
"file_read".to_string(),
- "tinyjuice_retrieve".to_string(),
+ "juice_retrieve".to_string(),
"juice_find".to_string(),
"juice_extract".to_string(),
"juice_summarize".to_string(),
@@ -588,7 +588,7 @@ fn named_scope_admits_the_tinyjuice_tools_a_handle_names() {
.project(&def)
.tools;
for name in [
- "tinyjuice_retrieve",
+ "juice_retrieve",
"juice_find",
"juice_extract",
"juice_summarize",
diff --git a/crates/openhuman-core/src/config/schema/context.rs b/crates/openhuman-core/src/config/schema/context.rs
index 3b2e1cb9e8..5d0aadd5fa 100644
--- a/crates/openhuman-core/src/config/schema/context.rs
+++ b/crates/openhuman-core/src/config/schema/context.rs
@@ -110,10 +110,10 @@ pub struct ContextConfig {
/// stored in the CCR cache and replaced by a stats line, a short head and a
/// handle. The model reads that, and queries the rest with `juice_find`,
/// `juice_extract` and `juice_summarize` (registered only while this switch
- /// is on) or takes the whole original with `tinyjuice_retrieve`. No model
+ /// is on) or takes the whole original with `juice_retrieve`. No model
/// call is involved, so it cannot stall on a slow summarizer. With
/// `repl_handle_enabled = false` the result is instead compressed to one
- /// blob with a `⟦tj:<hash>⟧` marker for `tinyjuice_retrieve`.
+ /// blob with a `⟦tj:<hash>⟧` marker for `juice_retrieve`.
///
/// **On by default.** It was off from the 2026-09 latency work, when a
/// compacted view cost a retrieval round trip more often than it saved
diff --git a/crates/openhuman-core/src/config/schema/tokenjuice.rs b/crates/openhuman-core/src/config/schema/tokenjuice.rs
index 039b6f59e0..f690559118 100644
--- a/crates/openhuman-core/src/config/schema/tokenjuice.rs
+++ b/crates/openhuman-core/src/config/schema/tokenjuice.rs
@@ -32,7 +32,7 @@ pub struct TokenjuiceConfig {
/// `router_enabled`, `ccr_enabled` and `context.compaction_enabled`. In this
/// mode the LLM summary stage is skipped for results big enough to get a
/// handle. Turn off to keep the one-blob compression and the
- /// `tinyjuice_retrieve` round trip.
+ /// `juice_retrieve` round trip.
#[serde(default = "default_true")]
pub repl_handle_enabled: bool,
/// Also write each stored original to
diff --git a/crates/openhuman-core/src/inference/tokenjuice/README.md b/crates/openhuman-core/src/inference/tokenjuice/README.md
index 4d81559584..c07b4fd227 100644
--- a/crates/openhuman-core/src/inference/tokenjuice/README.md
+++ b/crates/openhuman-core/src/inference/tokenjuice/README.md
@@ -22,7 +22,7 @@ OpenHuman-owned files:
| `schemas.rs` | JSON-RPC controller schemas and handlers. |
| `config_patch.rs` | Partial update shape for the `[tokenjuice]` config block. |
| `repl_tools.rs` | The three REPL tools (`juice_find`, `juice_extract`, `juice_summarize`) over a stored result. TinyJuice owns the ops and declarations (`tinyjuice::repl::tools`, cargo feature `tinytools`); the CCR store lives in the module, so each call fetches the original with `Retrieve` and hands the stock tool a one-entry store. Registered by `tools/ops.rs` only while `repl_handle_active(config)`. |
-| `tools.rs` | OpenHuman agent tool implementation for the retrieve tool (`RETRIEVE_TOOL_NAME = "tinyjuice_retrieve"`; `"tokenjuice_retrieve"` is a recognized recovery-tool alias, not the tool's registered name, see `RECOVERY_TOOL_NAMES`). |
+| `tools.rs` | OpenHuman agent tool implementation for the retrieve tool (`RETRIEVE_TOOL_NAME = "juice_retrieve"`; `"tokenjuice_retrieve"` is a recognized recovery-tool alias, not the tool's registered name, see `RECOVERY_TOOL_NAMES`). |
| `ml/` | Bridge from TinyJuice's optional ML callback into the shared `runtime::python_server` Kompress backend (ModernBERT token/sentence salience); opt-in via `config.tokenjuice.ml_compression_enabled` (default off), degrades gracefully when the flag is off or the runtime server is unavailable. |
| `savings.rs` | OpenHuman model-pricing attribution and persisted dashboard stats. |
@@ -58,7 +58,7 @@ Everything with state stays where it was, reached only through TinyBus:
| Behind the module boundary | Why it stays |
| --- | --- |
| `compress::route` / `compress_content` | Picks a compressor from the rule engine and records savings. |
-| `cache/`: the CCR store, retrieval markers, disk tier, ranged retrieval | Owns a disk tier and a marker vocabulary (`⟦tj:<hash>⟧`) the module must resolve. `tinyjuice_retrieve` is the model-facing half and is unchanged. |
+| `cache/`: the CCR store, retrieval markers, disk tier, ranged retrieval | Owns a disk tier and a marker vocabulary (`⟦tj:<hash>⟧`) the module must resolve. `juice_retrieve` is the model-facing half and is unchanged. |
| `rules/`, `reduce/`, `ml/` | Rule tables, execution reduction, the ModernBERT callback. |
Why a content transform is not allowed to go through the bus: reaching it there
@@ -90,7 +90,7 @@ callback stay here.
- `tools/ops.rs` registers `crate::inference::tokenjuice::TokenjuiceRetrieveTool::new()`
in the agent tool catalog (it is not re-exported through `tools/mod.rs`) and
treats every `RECOVERY_TOOL_NAMES` entry as a recovery tool. The registered
- tool name is `RETRIEVE_TOOL_NAME` (`"tinyjuice_retrieve"`);
+ tool name is `RETRIEVE_TOOL_NAME` (`"juice_retrieve"`);
`"tokenjuice_retrieve"` and `LEGACY_RETRIEVE_TOOL_NAME`
(`"retrieve_tool_output"`) are recognized aliases only. Only
`RECOVERY_TOOL_VISIBLE` (the live tool) is force-added to a curated
diff --git a/crates/openhuman-core/src/inference/tokenjuice/repl_tools.rs b/crates/openhuman-core/src/inference/tokenjuice/repl_tools.rs
index a0a40479e3..5df8619e30 100644
--- a/crates/openhuman-core/src/inference/tokenjuice/repl_tools.rs
+++ b/crates/openhuman-core/src/inference/tokenjuice/repl_tools.rs
@@ -10,7 +10,7 @@
//! (`tinyjuice::repl::tools::repl_tools`, the `tinytools` feature). Its CCR
//! store, though, lives inside the module behind the bus, so a store handed to
//! `repl_tools` in this process would be empty. Each wrapper here therefore
-//! fetches the original through the same `Retrieve` call `tinyjuice_retrieve`
+//! fetches the original through the same `Retrieve` call `juice_retrieve`
//! makes, gives the stock tool a one-entry store holding it, and returns what
//! the stock tool answers. The ops, argument parsing, size caps and
//! read-only/concurrency flags are TinyJuice's, unchanged.
diff --git a/crates/openhuman-core/src/tools/ops.rs b/crates/openhuman-core/src/tools/ops.rs
index 97d4ad08b2..a0bd2474ec 100644
--- a/crates/openhuman-core/src/tools/ops.rs
+++ b/crates/openhuman-core/src/tools/ops.rs
@@ -1305,7 +1305,7 @@ fn tool_group(name: &str) -> crate::core::all::DomainGroup {
}
// Inference: the CCR retrieval surface. Matched against the crate's own
// constant list rather than a name prefix — the live tool is
- // `tinyjuice_retrieve`, and `tokenjuice_retrieve` / `retrieve_tool_output`
+ // `juice_retrieve`, and `tokenjuice_retrieve` / `retrieve_tool_output`
// are migration aliases, so a prefix rule silently missed the real one.
if crate::inference::tokenjuice::RECOVERY_TOOL_NAMES.contains(&name)
|| crate::inference::tokenjuice::is_repl_tool(name)
diff --git a/crates/openhuman-core/src/tools/ops_tests.rs b/crates/openhuman-core/src/tools/ops_tests.rs
index f2e0a7c786..6a9fc994c2 100644
--- a/crates/openhuman-core/src/tools/ops_tests.rs
+++ b/crates/openhuman-core/src/tools/ops_tests.rs
@@ -339,7 +339,7 @@ const REPRESENTATIVE: &[(&str, crate::core::all::DomainGroup)] = {
("composio_execute", G::Integrations),
("dashboard_model_health", G::Desktop),
("node_exec", G::Runtimes),
- ("tinyjuice_retrieve", G::Inference),
+ ("juice_retrieve", G::Inference),
("shell", G::Platform),
]
};
diff --git a/crates/openhuman-core/src/tools/ops_tests_capability_gating_tests.rs b/crates/openhuman-core/src/tools/ops_tests_capability_gating_tests.rs
index 1931a3de4e..b245c33135 100644
--- a/crates/openhuman-core/src/tools/ops_tests_capability_gating_tests.rs
+++ b/crates/openhuman-core/src/tools/ops_tests_capability_gating_tests.rs
@@ -213,7 +213,7 @@ fn default_tools_omits_flows_tools_when_feature_off() {
///
/// This is the guard that would have caught the #4808 leak by construction, and
/// it caught a live one on the way in: the `Inference` rule matched
-/// `tokenjuice_` while the real tool is `tinyjuice_retrieve`, so CCR retrieval
+/// `tokenjuice_` while the real tool is `juice_retrieve`, so CCR retrieval
/// was falling through to `Platform`.
///
/// The failure it prevents is silent. A family whose tools have no `tool_group`
diff --git a/gitbooks/developing/architecture/agent-harness.md b/gitbooks/developing/architecture/agent-harness.md
index 74b876a573..dd31032999 100644
--- a/gitbooks/developing/architecture/agent-harness.md
+++ b/gitbooks/developing/architecture/agent-harness.md
@@ -289,7 +289,7 @@ Long tool-calling chains can blow past the context window. Two layers handle tha
Some tool calls return enormous payloads - a Composio action dumping 200 KB of JSON, a web scrape returning 50 KB of markdown, a `file_read` over a multi-thousand-line log. Hard-truncating mid-payload drops whatever happens to land past the cut.
-When a tool result exceeds the summarizer's threshold (`summarizer_payload_threshold_tokens`, default 4 000), TinyJuice's summary stage summarizes it before it enters the parent's history. The parent agent sees only the summary. There is one summarizer, and TinyJuice owns it: it decides when a summary is worth writing, writes the extraction prompt (identifiers and key facts first), caches identical summaries, trips a per-thread breaker after three failures, and offloads the original to CCR so the `tinyjuice_retrieve` footer can recover it exactly. The model call itself belongs to the host. `ToolOutputMiddleware` binds a unary child of the current turn through `PayloadSummarizer::prepare`, registers it under a context token (`inference/tokenjuice/generate.rs`), and the module calls back through `MlHost.Generate`. Only the orchestrator carries a summary model, and it always sees `tinyjuice_retrieve`, even with the compaction router off, because a summary's footer names it. A result that qualified for a summary and did not get one is labelled as unsummarized, whether the module or the host failed, so the model does not re-run the tool for one. Summary reuse and the breaker are scoped to the thread, or to the run when there is no thread. Hard truncation remains the downstream backstop when summarization fails, or when the payload is so large that an LLM call on it makes no economic sense.
+When a tool result exceeds the summarizer's threshold (`summarizer_payload_threshold_tokens`, default 4 000), TinyJuice's summary stage summarizes it before it enters the parent's history. The parent agent sees only the summary. There is one summarizer, and TinyJuice owns it: it decides when a summary is worth writing, writes the extraction prompt (identifiers and key facts first), caches identical summaries, trips a per-thread breaker after three failures, and offloads the original to CCR so the `juice_retrieve` footer can recover it exactly. The model call itself belongs to the host. `ToolOutputMiddleware` binds a unary child of the current turn through `PayloadSummarizer::prepare`, registers it under a context token (`inference/tokenjuice/generate.rs`), and the module calls back through `MlHost.Generate`. Only the orchestrator carries a summary model, and it always sees `juice_retrieve`, even with the compaction router off, because a summary's footer names it. A result that qualified for a summary and did not get one is labelled as unsummarized, whether the module or the host failed, so the model does not re-run the tool for one. Summary reuse and the breaker are scoped to the thread, or to the run when there is no thread. Hard truncation remains the downstream backstop when summarization fails, or when the payload is so large that an LLM call on it makes no economic sense.
**Caller focus.** A tool can opt in to an optional `summary_focus` argument by adding `tokenjuice::focus::summary_focus_property()` to its schema; `web_fetch` and `web_search_tool` do. The model uses it to say what it needs from the result, for example "the rate limits". `before_tool` removes the argument from the call before validation, so the tool never sees it. Only a tool whose schema carries that exact property loses it; any other tool with a parameter of the same name keeps it. It reaches TinyJuice with the result, where it steers the summary, keys its cache, and ranks text for the deterministic compressors. A tool that caps its own output, such as `web_fetch`, is normally left to cap-and-spill. When the caller gives a focus, it is summarized as well, because paging the raw page cannot answer a question.
diff --git a/gitbooks/features/token-compression.md b/gitbooks/features/token-compression.md
index ef763a195d..89546ac6eb 100644
--- a/gitbooks/features/token-compression.md
+++ b/gitbooks/features/token-compression.md
@@ -94,9 +94,9 @@ The model then queries the stored original with three read-only tools, none of w
| `juice_extract` | Links or headings from HTML or Markdown output. |
| `juice_summarize` | Size, outline or JSON shape, then head and tail, or the parts most relevant to a `hint`. |
-Answers are size-capped, and an unknown or evicted handle is an error. `tinyjuice_retrieve` still returns the whole original. Because a handle preview is built without a model call, it also replaces the LLM summary for results big enough to get one, so a slow summarizer cannot stall the turn. The three tools are registered (about 1.5 KB of schema) only while this mode is in effect.
+Answers are size-capped, and an unknown or evicted handle is an error. `juice_retrieve` still returns the whole original. Because a handle preview is built without a model call, it also replaces the LLM summary for results big enough to get one, so a slow summarizer cannot stall the turn. The three tools are registered (about 1.5 KB of schema) only while this mode is in effect.
-Opt out of the whole feature with `context.compaction_enabled = false` or `OPENHUMAN_COMPACTION=0`. Keep compaction but return to the one-blob compression and `tinyjuice_retrieve` with `tokenjuice.repl_handle_enabled = false` (`OPENHUMAN_TOKENJUICE_REPL_HANDLE_ENABLED=0`). Set `tokenjuice.repl_save_enabled = true` to also write each stored original to `<workspace>/.tokenjuice/repl/<handle>.txt` (mode 0600) so an agent can script over it; that puts raw tool output on disk and nothing prunes it.
+Opt out of the whole feature with `context.compaction_enabled = false` or `OPENHUMAN_COMPACTION=0`. Keep compaction but return to the one-blob compression and `juice_retrieve` with `tokenjuice.repl_handle_enabled = false` (`OPENHUMAN_TOKENJUICE_REPL_HANDLE_ENABLED=0`). Set `tokenjuice.repl_save_enabled = true` to also write each stored original to `<workspace>/.tokenjuice/repl/<handle>.txt` (mode 0600) so an agent can script over it; that puts raw tool output on disk and nothing prunes it.
---
@@ -156,7 +156,7 @@ Everything lives under the `[tokenjuice]` config block (`crates/openhuman-core/s
- **CCR:** `ccr_enabled`, `ccr_disk_enabled`, `max_cache_entries`, `max_cache_bytes`, `ccr_ttl_secs`.
- **Per-kind:** `search_enabled`, `code_enabled`, `html_enabled`, plus the `ml_*` keys.
- **RPC** (`openhuman.tokenjuice_*`): `detect`, `compress` (dry-run the pipeline), `settings_get` / `settings_update` (live partial patch), `cache_stats`, `retrieve`, `savings_stats`, `savings_reset`.
-- **Agent tools:** `tinyjuice_retrieve` recovers a whole offloaded original; `juice_find`, `juice_extract` and `juice_summarize` query one by handle. All are read-only.
+- **Agent tools:** `juice_retrieve` recovers a whole offloaded original; `juice_find`, `juice_extract` and `juice_summarize` query one by handle. All are read-only.
- **Debugging:** start the core with `RUST_LOG=openhuman_core::inference::tokenjuice=debug` to watch detection, matching, and how much each blob is trimmed.
---
diff --git a/tests/json_rpc_e2e.rs b/tests/json_rpc_e2e.rs
index 3db0048b51..c8d9da11f3 100644
--- a/tests/json_rpc_e2e.rs
+++ b/tests/json_rpc_e2e.rs
@@ -10855,7 +10855,7 @@ encrypt = false
# Keep tool-result content raw: the workflow_builder agent runs the reasoning
# tier with Full TokenJuice compaction, which CCR-compresses a large
-# `propose_workflow` result into a `tinyjuice_retrieve` reference. `flows_build`
+# `propose_workflow` result into a `juice_retrieve` reference. `flows_build`
# extracts the proposal from the agent's tool history by JSON-parsing that
# content, so compaction must stay off for the arc to be observable in-test.
[context]