ctxgate

command
v0.186.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 28, 2026 License: BSD-3-Clause Imports: 17 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Overview

ctxgate cuts token spend without a human step and without thinning what the model reasons from.

ctxgate --precompact          # a PreCompact hook: what to keep, what to drop
ctxgate --hook [--max N]      # a PreToolUse hook on SendMessage
ctxgate report [--since 168h] # the context-size distribution of the calls

⛔ WHY IT EXISTS. Measured 2026-11-20 over 7 days and 104,263 API calls: cost is the re-reading of huge contexts. Calls carrying >= 400k tokens are 36 % of the calls and 64 % of every cache-read token; sonnet sub-agents carry 23 % of the cache reads in those buckets, because a resumed sub-agent keeps its whole history and the rule "follow-ups go to the SAME agent" resumes it again and again. One agent accumulated more than 900k. No hook can trigger a compaction, so the two levers are the text a compaction is told to preserve, and a refusal to resume an agent that has grown past a cap.

A refusal is not a verdict: whatever ctxgate cannot read, it allows.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL