Jev Compactor

•
2
•

Compacts AI agent context by selectively dropping irrelevant messages verbatim and safety-gating destructive commands.

jev-compactor is a TypeScript library, CLI, and MCP server designed to efficiently manage an AI agent's context window without resorting to summarization. Leveraging TypeSafe's Jev model, it identifies and removes messages deemed irrelevant to the current goal, while preserving the exact original content of the remaining messages. Beyond compaction, it proactively identifies and gates dangerous commands like `rm -rf` and potential data exfiltration, providing a robust safety layer for AI agent operations. It offers significant cost and latency advantages over traditional LLM-based summarization, making it ideal for maintaining critical context in long, tool-using agent sessions.

主な機能

01Framework-agnostic integration: seamlessly wraps OpenAI, Anthropic, LangChain clients, or works with plain message arrays.
02Attributable compaction reports: provides reasons and probabilities for every message dropped.
03Deterministic context compaction: drops irrelevant messages while keeping retained content verbatim, no summarization.
04AI agent safety gating: detects and blocks destructive commands, data exfiltration, and thrashing loops pre-model call.
05Cost-effective and low-latency: processes context 30-250x cheaper and 1.4-170x faster than LLM-based summarization.
061 GitHub stars

ユースケース

01Implementing explainable context management and proactive safety checks against harmful actions in AI agent workflows.
02Ensuring the preservation of critical, verbatim details like file paths and error messages throughout an agent's operation.
03Managing context windows for AI agents engaged in long, tool-using sessions where history exceeds token limits.