Skip to content

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

chore: files changed crates/openhuman-core/src/config/schema/context.rs,crates/openhuman-core/src/co

Steven Enamakel907a1ba46074
diff --git a/crates/openhuman-core/src/config/schema/context.rs b/crates/openhuman-core/src/config/schema/context.rs
index 0e841a6fa6..3b2e1cb9e8 100644
--- a/crates/openhuman-core/src/config/schema/context.rs
+++ b/crates/openhuman-core/src/config/schema/context.rs
@@ -103,18 +103,26 @@ pub struct ContextConfig {
pub prefer_markdown_tool_output: bool,
/// Switch for tokenjuice tool-output compaction (Stage 1a). When `true`,
- /// large structured tool outputs (build/test logs, diffs, JSON arrays) are
- /// content-aware compressed *before* the [`Self::tool_result_budget_bytes`]
- /// byte cap and before they enter history, with a `⟦tj:<hash>⟧` marker the
- /// model can redeem through `tinyjuice_retrieve`.
+ /// large tool outputs are handled by the TinyJuice module *before* the
+ /// [`Self::tool_result_budget_bytes`] byte cap and before they enter history.
///
- /// **Off by default** since the 2026-09 latency work: in practice the
- /// compacted view cost the model a retrieval round trip more often than it
- /// saved context, and every curated belt paid for the retrieve tool's
- /// schema on every turn. The per-tool char cap and the shared byte
- /// backstop (which persists oversized output for `file_read`) stay on.
- /// Turn it back on via config or `OPENHUMAN_COMPACTION=1`.
- #[serde(default)]
+ /// With `[tokenjuice] repl_handle_enabled` (the default) a large result is
+ /// 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
+ /// 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`.
+ ///
+ /// **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
+ /// context, every curated belt paid for the retrieve schema, and the LLM
+ /// summary could stall a turn. The handle path avoids the stall and gives
+ /// the model queries instead of a blind retrieve. The per-tool char cap and
+ /// the shared byte backstop apply either way. Opt out with
+ /// `compaction_enabled = false` or `OPENHUMAN_COMPACTION=0`.
+ #[serde(default = "default_true")]
pub compaction_enabled: bool,
}
@@ -159,7 +167,7 @@ impl Default for ContextConfig {
session_memory: SessionMemoryConfig::default(),
summarizer_model: None,
prefer_markdown_tool_output: default_true(),
- compaction_enabled: false,
+ compaction_enabled: default_true(),
}
}
}
diff --git a/crates/openhuman-core/src/config/schema/tokenjuice.rs b/crates/openhuman-core/src/config/schema/tokenjuice.rs
index f65d746d8b..039b6f59e0 100644
--- a/crates/openhuman-core/src/config/schema/tokenjuice.rs
+++ b/crates/openhuman-core/src/config/schema/tokenjuice.rs
@@ -12,8 +12,9 @@ use serde::{Deserialize, Serialize};
#[serde(default)]
pub struct TokenjuiceConfig {
/// Master switch for the content router. When `false`, tool output passes
- /// through uncompacted. Off by default: see `ContextConfig::compaction_enabled`.
- #[serde(default)]
+ /// through uncompacted. On by default; it only acts while
+ /// `ContextConfig::compaction_enabled` is also on.
+ #[serde(default = "default_true")]
pub router_enabled: bool,
/// Whether lossy compressions offload the original to the CCR store and emit
/// a `⟦tj:<hash>⟧` retrieval footer. Disabling makes compaction one-way.
@@ -23,6 +24,23 @@ pub struct TokenjuiceConfig {
/// retrieval survives memory eviction (written by the core only).
#[serde(default)]
pub ccr_disk_enabled: bool,
+ /// Store a large result behind a handle and show the model a stats line, a
+ /// short head and the handle, instead of one compressed blob. The model then
+ /// queries the stored original with `juice_find`, `juice_extract` and
+ /// `juice_summarize`, which are registered only while this is in effect
+ /// (see `crate::inference::tokenjuice::repl_handle_active`). Needs
+ /// `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.
+ #[serde(default = "default_true")]
+ pub repl_handle_enabled: bool,
+ /// Also write each stored original to
+ /// `<workspace>/.tokenjuice/repl/<handle>.txt` (mode 0600) so the agent can
+ /// script over it. Off by default: it puts raw tool output on disk, and
+ /// nothing prunes the directory.
+ #[serde(default)]
+ pub repl_save_enabled: bool,
/// Max number of originals retained in the in-memory CCR store.
#[serde(default = "default_max_cache_entries")]
pub max_cache_entries: usize,
@@ -107,8 +125,10 @@ fn default_ml_device() -> String {
impl Default for TokenjuiceConfig {
fn default() -> Self {
Self {
- router_enabled: false,
+ router_enabled: true,
ccr_enabled: true,
+ repl_handle_enabled: true,
+ repl_save_enabled: false,
ccr_disk_enabled: false,
max_cache_entries: default_max_cache_entries(),
max_cache_bytes: default_max_cache_bytes(),