L6: Observation Compression (AGGRESSIVE) Inspired by claw-compactor's 97% compression on tool results. Tool call results (especially large ones) are summarized to key info only. This is the biggest compression win - tool outputs can be 10KB+ but only ~200 chars of actual useful
// Source: https://github.com/BlockRunAI/ClawRouter | License: MIT | Copyright 2026 BlockRunAI
// Provided via justclaw.it.com; keep this notice with the code.
/**
* L6: Observation Compression (AGGRESSIVE)
*
* Inspired by claw-compactor's 97% compression on tool results.
* Tool call results (especially large ones) are summarized to key info only.
*
* This is the biggest compression win - tool outputs can be 10KB+ but
* only ~200 chars of actual useful information.
*/
import { NormalizedMessage } from "../types.js";
interface ObservationResult {
messages: NormalizedMessage[];
charsSaved: number;
observationsCompressed: number;
}
// Max length for tool results before compression kicks in
const TOOL_RESULT_THRESHOLD = 500;
// Max length to compress tool results down to
cons
... (truncated -- full source via MCP)
See the full source, get the GitHub permalink, and search 40K more like it.
Get a free API key