Compress tool outputs, logs, files, and RAG chunks before they reach the LLM. 20% fewer tokens for coding agents, 60-95% fewer tokens for JSON, same answers. Library, proxy, MCP server.
Python agentaianthropicclaude-codecompressioncontext-engineeringcontext-windowcursorfastapilangchainllmmcpopenaiprompt-engineeringproxypythonragtoken-optimizationtokenstypescript
docs(ccr): correct stale 5-minute TTL hints to 30 minutes (#2224)
Zhenjia ZHOU5de12f75e3d9
diff --git a/crates/headroom-core/src/ccr/backends/in_memory.rs b/crates/headroom-core/src/ccr/backends/in_memory.rsindex 9e5646630..efb6b5376 100644--- a/crates/headroom-core/src/ccr/backends/in_memory.rs+++ b/crates/headroom-core/src/ccr/backends/in_memory.rs@@ -20,7 +20,7 @@ use crate::ccr::{CcrStore, DEFAULT_CAPACITY, DEFAULT_TTL};/// In-memory CCR store backed by [`DashMap`] for sharded concurrent/// access.///-/// - **TTL**: 5 minutes by default. Entries past their TTL are dropped+/// - **TTL**: 30 minutes by default. Entries past their TTL are dropped/// on the next `get` (lazy expiry — no background reaper thread)./// - **Capacity**: 1000 entries by default. When `put` would push us/// past capacity, the oldest entry (per insertion order) is evicted.@@ -46,7 +46,7 @@ struct Entry {}impl InMemoryCcrStore {- /// Default: 1000 entries, 5-minute TTL.+ /// Default: 1000 entries, 30-minute TTL.pub fn new() -> Self {Self::with_capacity_and_ttl(DEFAULT_CAPACITY, DEFAULT_TTL)}diff --git a/crates/headroom-core/src/ccr/backends/mod.rs b/crates/headroom-core/src/ccr/backends/mod.rsindex 504ff1c10..3d86d933a 100644--- a/crates/headroom-core/src/ccr/backends/mod.rs+++ b/crates/headroom-core/src/ccr/backends/mod.rs@@ -42,7 +42,7 @@ pub enum CcrBackendConfig {}impl CcrBackendConfig {- /// Production default: SQLite at `path`, 5-minute TTL.+ /// Production default: SQLite at `path`, 30-minute TTL.pub fn sqlite_default(path: PathBuf) -> Self {Self::Sqlite {path,diff --git a/crates/headroom-core/src/ccr/backends/sqlite.rs b/crates/headroom-core/src/ccr/backends/sqlite.rsindex 8eaf3bc77..14cc32cc3 100644--- a/crates/headroom-core/src/ccr/backends/sqlite.rs+++ b/crates/headroom-core/src/ccr/backends/sqlite.rs@@ -49,7 +49,7 @@ use crate::ccr::CcrStore;pub struct SqliteCcrStore {conn: Mutex<Connection>,/// Default TTL applied on every `put`. Mirrors Python's- /// `compression_store` 5-minute window.+ /// `compression_store` 30-minute window.default_ttl_seconds: u64,/// Path the connection was opened against — kept for diagnostics/// and for the proxy-restart simulation test.diff --git a/headroom/transforms/smart_crusher.py b/headroom/transforms/smart_crusher.pyindex 796b8ce61..6e4ae6d1c 100644--- a/headroom/transforms/smart_crusher.py+++ b/headroom/transforms/smart_crusher.py@@ -1144,7 +1144,7 @@ class SmartCrusher(Transform):except Exception as e: # pragma: no cover - defensivelogger.debug("CCR mirror: cannot get compression_store (%s)", e)return- # The TTL on the Python store defaults to 5 minutes — same as+ # The TTL on the Python store defaults to 30 minutes — same as# the Rust store's `DEFAULT_TTL` (see crates/headroom-core/src/# ccr/mod.rs). No need to override.try:diff --git a/plugins/openclaw/src/tools/headroom-retrieve.ts b/plugins/openclaw/src/tools/headroom-retrieve.tsindex d5e0d1c5c..af32cb3ac 100644--- a/plugins/openclaw/src/tools/headroom-retrieve.ts+++ b/plugins/openclaw/src/tools/headroom-retrieve.ts@@ -62,7 +62,7 @@ export function createHeadroomRetrieveTool(config: RetrieveToolConfig) {} catch (error) {return JSON.stringify({error: `Retrieval failed: ${error}`,- hint: "The compressed content may have expired (default TTL: 5 minutes)",+ hint: "The compressed content may have expired (default TTL: 30 minutes)",});}},diff --git a/plugins/opencode/src/retrieve.ts b/plugins/opencode/src/retrieve.tsindex 2ac4040d7..0ea5d46b7 100644--- a/plugins/opencode/src/retrieve.ts+++ b/plugins/opencode/src/retrieve.ts@@ -64,7 +64,7 @@ export function createHeadroomRetrieveTool(config: RetrieveToolConfig) {} catch (error) {return JSON.stringify({error: `Retrieval failed: ${error}`,- hint: "The compressed content may have expired (default TTL: 5 minutes)",+ hint: "The compressed content may have expired (default TTL: 30 minutes)",});}},