The fastest, cheapest, most efficient open-source agent harness. Run more than 500 agents on a $10 VPS.
Rust agent-orchestrationai-agentsai-assistantdesktopllmlocal-firstmcppersonal-aiprivacyrustsecond-braintauri
fix(agent): correct context ladder to use harness context schema
Steven Enamakel3a029c4b2a2b
diff --git a/crates/openhuman-core/src/agent/tinyagents/harness_context_ladder.rs b/crates/openhuman-core/src/agent/tinyagents/harness_context_ladder.rsindex 7c11059985..b2ebda9599 100644--- a/crates/openhuman-core/src/agent/tinyagents/harness_context_ladder.rs+++ b/crates/openhuman-core/src/agent/tinyagents/harness_context_ladder.rs@@ -67,7 +67,7 @@ pub(super) fn install_context_ladder(//// 1. `ContextCompressionMiddleware` — the **summarization** step. Once the// running token estimate crosses `window * SUMMARIZE_THRESHOLD_FRACTION`- // (90% of *this model's* context window, or the absolute+ // (min(80% of *this model's* context window, 350k tokens), or the absolute// `compaction_trigger_tokens` override), it folds the older slice of the// transcript into a single LLM-generated, user-role checkpoint (keeping// system messages + the recent window verbatim). This is keyed to whatever model@@ -298,7 +298,8 @@ pub(super) fn compression_middleware(/// The summarization policy for this turn, or `None` when compaction has/// nothing to size against.///-/// Normally 90% of the model's context window. `trigger_override` (the+/// Normally `min(80% of the model's context window, 350k tokens)` (TinyAgents+/// `summarization_policy`). `trigger_override` (the/// `[context].compaction_trigger_tokens` / `OPENHUMAN_COMPACTION_TRIGGER_TOKENS`/// bench knob) pins the trigger to that absolute token count instead, and/// enables compaction even when the window is unknown.diff --git a/crates/openhuman-core/src/agent/tinyagents/harness_context_ladder_tests.rs b/crates/openhuman-core/src/agent/tinyagents/harness_context_ladder_tests.rsindex 90397cc515..0307333780 100644--- a/crates/openhuman-core/src/agent/tinyagents/harness_context_ladder_tests.rs+++ b/crates/openhuman-core/src/agent/tinyagents/harness_context_ladder_tests.rs@@ -9,10 +9,13 @@ fn no_window_and_no_override_installs_no_compression() {}#[test]-fn a_known_window_triggers_at_ninety_percent() {+fn a_known_window_triggers_at_eighty_percent_capped_at_350k() {let policy = compression_policy(Some(200_000), None).expect("policy");- assert_eq!(policy.trigger_budget(), 180_000);+ assert_eq!(policy.trigger_budget(), 160_000);assert_eq!(policy.keep_last, DEFAULT_SUMMARIZE_KEEP_LAST);+ // DeepSeek V4 Flash's discovered 1M window compacts at 350k, not ~840k.+ let policy = compression_policy(Some(1_048_576), None).expect("policy");+ assert!(policy.trigger_budget().abs_diff(350_000) <= 1);}#[test]diff --git a/crates/openhuman-core/src/config/schema/context.rs b/crates/openhuman-core/src/config/schema/context.rsindex 42d8541178..caaf6d2bc1 100644--- a/crates/openhuman-core/src/config/schema/context.rs+++ b/crates/openhuman-core/src/config/schema/context.rs@@ -126,7 +126,8 @@ pub struct ContextConfig {pub compaction_enabled: bool,/// Absolute token count at which context compaction (the summarization- /// step) fires, overriding the default of 90% of the model's context+ /// step) fires, overriding the default of min(80% of the model's context+ /// window, 350k tokens) (the rest of this sentence describes the/// window. Also enables compaction for a model whose window is unknown.////// For benchmarks and debugging that need compaction to happen early;