Skip to main content
Glama
fast-jev-compaction

fast-jev-compaction

by Li-ship-dot

Fast Jev Compaction for Agent Hosts

This repository adapts fast-jev-compaction as a portable Agent plugin. It exposes the same MCP server to Agent hosts and keeps a .codex-plugin/ compatibility manifest for Codex.

It exposes an on-demand MCP tool, compact_transcript, that uses TypeSafe Jev to decide which tool calls and tool results can be removed or truncated while keeping retained transcript content verbatim. It does not replace a host's internal automatic compaction.

Install as an Agent plugin

npm install
npm run typecheck
npm test
npm run build

The portable entrypoint is plugin.json with mcp.json and skills/. Codex can also load .codex-plugin/plugin.json with .mcp.json. The two MCP files are intentionally identical so either loader gets the same server configuration.

Set TYPESAFE_API_KEY before using the MCP tool. The supplied transcript's compaction state is sent to https://api.typesafe.ai/v1/systemone by default. Set TYPESAFE_BASE_URL to use a compatible endpoint. Do not send secrets or private transcripts without checking the data boundary.

Related MCP server: mcp-token-optimizer

Agent-neutral transcript contract

compact_transcript accepts a messages array. The canonical shape is:

{
  "role": "assistant",
  "text": "",
  "toolUses": [{"tool_use_id": "call-1", "tool": "Read", "input": {"path": "README.md"}}],
  "toolResults": []
}

The MCP adapter also accepts common content, tool_calls, toolCalls, tool_results, and tool_call_id aliases from Agent hosts. Tool-role messages are normalized to the internal result representation; no tool from the supplied transcript is executed.

Options accepted by compact_transcript include:

  • messages: transcript messages with role, text, toolUses, and optional toolResults;

  • options: optional thresholds and token budgets from the original library;

  • model: optional per-call model override; the MCP server reads TYPESAFE_API_KEY from its environment.

The result contains the compacted messages, per-call decisions, and stats.

Development

npm run typecheck
npm test
npm run build
npm run validate:plugin

The original MIT license and core compaction implementation are retained. Claude Code-specific hooks are intentionally not part of this portable Agent plugin.

Tool Schema Changelog

Recent tool additions, removals, and schema changes observed during successful MCP inspections.

Loading tool schema changelog…

    Related MCP Connectors

    Related MCP Servers

    • A
      license
      Not graded
      quality
      B
      maintenance
      Provides deterministic context compaction and safety gating for AI agents, preserving original messages verbatim while dropping irrelevant ones and flagging destructive commands.
      2
      MIT
    • F
      license
      Not graded
      quality
      Not graded
      maintenance
      Enables MCP-compatible clients and autonomous agents to dynamically compress long-horizon context by pruning verbose tool outputs, HTML boilerplate, and semantic redundancy by 40-70%. It reduces token burn and latency through deterministic, zero-dependency processing.
      -
    • A
      license
      Not graded
      quality
      Not graded
      maintenance
      Enables agents to deterministically shrink multi-turn conversation history and prompts by stripping verbose boilerplate and filler tokens while preserving critical tool parameters and named entities. This lets users cut inference costs by roughly 40-60% without losing essential context, running either as a native MCP server over JSON-RPC stdio or as an importable zero-dependency Python module.
      MIT