caliber-jev-compaction
Reviewed
at commit 06ebf14
Sends data to TypeSafe (api.typesafe.ai), Vercel AI Gateway (ai-gateway.vercel.sh)
Verbatim Jev-guided compaction for Claude Code sessions.
0 upvotes
Log in to upvote or save- Made by
- caliber-ai-org
- Pinned commit
-
06ebf1412a88f0a15451044ff48396cda3415e09 - What we checked
-
Replaces Claude Code's built-in compaction. When the session compacts, it sends a trimmed copy of the conversation to TypeSafe's Jev model, using your own TypeSafe or Vercel AI Gateway key. The copy holds your prompts, Claude's replies and tool inputs, with tool outputs reduced to their length. Jev scores each older tool call, and the tool calls and outputs it marks as stale are permanently removed from the context, not summarized. It also starts compaction itself once the context is 60% full. If no key is set, the Jev call fails, or too little would be saved, it falls back to the normal summary. It reads its API key from plugin settings or environment variables, reads no files, runs no programs and stores nothing.
Review details
Static review of the source at the pinned commit; not run. hooks/hooks.json loads hooks/compaction.ts, which imports caliber/gateway.ts, caliber/transport.ts, lib/compact.ts, lib/request.ts, lib/state.ts and lib/types.ts. lib/client.ts, lib/messages.ts and lib/index.ts are present but not imported by the hook. Two hooks are registered. session.compact resolves credentials in this order: userConfig gatewayApiKey, userConfig apiKey, then AI_GATEWAY_API_KEY and TYPESAFE_API_KEY via $.env.get or the env block from $.settings.read. It builds a Jev state of the whole history: context text, a goal made of the last three user prompts (500 chars each), each message's text (abridged in stages if over maxStateTokens, default 25000) and each tool call's input (JSON, up to 1000 chars) with only an ok/error note and the character count of the result. It POSTs this with $.http.fetch to https://api.typesafe.ai/v1/systemone (TypeSafe key) or https://ai-gateway.vercel.sh/v4/ai/evaluation-model (Gateway key; the base URL can be changed by the user through gatewayBaseUrl), with the key as a Bearer token, in as many batches as maxRequestTokens requires. Calls are scored with two probability questions. Below keepThreshold (0.5), a result is cut to its first 300 chars plus a note, or the call and its result are dropped. The first message and the newest 6 are pinned. It returns { messages } to replace the history when the estimated reduction is at least 25%; otherwise, or on any error (missing key, HTTP error, malformed answer, history too large), it calls next(event) for the built-in summary. It writes decisions with $.ui.log and shows a 15 s $.ui.toast. turn.complete reads $.session.usage() and calls $.session.compact() once context.percent reaches compactAtPercent (default 60), guarded against re-entry. No eval, no child processes, no file access, no $.store, no obfuscated code.
- What it uses
-
- Reads your prompts: yes
- Sees tool calls: yes
- Blocks or changes tool calls: no
- Reads or writes files: no
- Runs programs on your machine: no
- Calls the model (uses tokens): no
- Sends data over the network: yes
- Stores data: no
- Shows something on screen: yes
- Hooked events
Made this mod? Add a badge to your README
Paste this into your README. The badge says reviewed once the current version has been reviewed, and links readers to this page.
[](https://modsforclaude.com/mods/caliber-jev-compaction/)