context-guru

module
v0.3.4 Latest Latest
Warning

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

Go to latest
Published: Oct 1, 2026 License: Apache-2.0

README

context-guru

context-guru

Provider-agnostic context engineering for LLM agents.

Docs Go Reference License Go 1.26


context-guru cuts the token cost of your agent's traffic in two ways: carry less context (drop redundant tool output, collapse superseded runs, summarize before you hit the limit), and pay less for what you still carry (keep your prompt cache warm, split the volatile tail off the system prompt so the rest stays cacheable). Paying less is the default — it's on out of the box, before you opt into anything that trims content.

Full docs: rossoctl.github.io/context-guru.

Install (Claude Code plugin)

/plugin marketplace add rossoctl/context-guru
/plugin install context-guru@context-guru
/reload-plugins     # REQUIRED — next lines else answer "Unknown command"
/permissions        # add a new rule → paste the line below → Project settings (local)
Bash(/Users/{you}/.claude/plugins/cache/context-guru/**)
/context-guru:install

Check what it's saving:

/context-guru:status

It reports the preset and cache strategy running, and the dollars saved so far — keep-alive savings, any content-trimming savings, and the net. Want the raw numbers instead of the reading of them? /context-guru:status --stats prints the /stats endpoint verbatim.

If you want to also carry less, not just pay less, opt into content trimming:

/context-guru:preset-picker   # → conservative, the safe first step into trimming
Status line

A terminal status line is installed on by default alongside the plugin. Run this command to turn it off/on:

/context-guru:statusline off/on

More: docs/how-to/install-plugin.md, or ask /context-guru:statusline to enable an extra segment or turn it back on.

Presets

Change what gets trimmed with:

/context-guru:preset-picker

It's an effort ladder — each tier is everything in the one before it, plus more:

Preset What it adds Spends on its own
off nothing — requests forwarded untouched (the default; only keep-alive spends, if that's on) no
conservative deterministic trimming of tool output (repeats, dead runs) — no model calls no
medium conservative plus a cheap model that keeps only what looks relevant in recent tool output yes
high medium plus a summarizer that compacts older turns once the context window is nearly full yes
xhigh high plus a periodic deep-adjudication sweep over turns whose prompt cache has gone cold — the deepest cut yes

Run the picker above any time to switch tiers — it explains each one before asking which to set. A restart is required — it takes effect at the next proxy start, not the current session; run /context-guru:status afterward to confirm it stuck. Full pipelines: docs/reference/presets.md.

Everything else — architecture, the full benchmark, every component, the proxy/gateway path, config reference — is in docs/design.md and docs/get-started/how-it-saves.md.

Updating

The proxy binary is what matters and what changes often. A routed session checks for a newer release every 5 minutes and tells you once, with three answers: update now, always update automatically, or do nothing for that release. Update it any time with:

/context-guru:update

The plugin itself (skills, hooks, scripts) rarely needs updating — most releases only touch the proxy binary, which /context-guru:update already covers. If you do want the latest plugin code:

/plugin marketplace update rossoctl/context-guru
/reload-plugins

More: docs/how-to/install-plugin.md.

Troubleshooting

If something breaks and Claude can't fix it, run the recovery script — no session, no proxy, no network needed:

~/.local/state/context-guru/context-guru-reset

Prefer it over /context-guru:uninstall or /plugin uninstall context-guru@context-guru when a session is actually stuck: a dead proxy fails every request, including the ones an uninstall command would need. More: docs/how-to/install-plugin.md#troubleshooting.

The two are not the same, though. /context-guru:uninstall undoes one install — the one routing the project you run it in — and leaves any other alone; the recovery script un-routes every settings file the plugin edited, machine-wide one included.

/context-guru:uninstall

More: docs/how-to/install-plugin.md.

Upgrading from project level to user level

Installed in one project and now want it everywhere? Install again with --global and keep both — each gets its own port, and a project you later reset falls back to the machine-wide one.

/context-guru:install --global

More: docs/how-to/install-plugin.md.

License

Apache-2.0. See LICENSE. A Rossoctl platform component.

Directories

Path Synopsis
adapters
bifrost
Package bifrost adapts context-guru's pipeline to bifrost's LLMPlugin interface: our components run as a pre-LLM-call hook (design D2).
Package bifrost adapts context-guru's pipeline to bifrost's LLMPlugin interface: our components run as a pre-LLM-call hook (design D2).
Package apply is the one place the pipeline meets a raw wire request, shared by every host adapter (the bifrost proxy and an in-process sidecar plugin).
Package apply is the one place the pipeline meets a raw wire request, shared by every host adapter (the bifrost proxy and an in-process sidecar plugin).
cmd
cg-selarm command
cg-selarm runs one adjudication ARM against the rebuilt selection corpus and writes its decisions.
cg-selarm runs one adjudication ARM against the rebuilt selection corpus and writes its decisions.
context-guru-proxy command
Command context-guru-proxy is the LLM proxy integration and the eval-containers gateway.
Command context-guru-proxy is the LLM proxy integration and the eval-containers gateway.
Package components defines context-guru's component model: the abstract API every context-engineering operation implements, the per-component report used for metrics, the runtime context handed to each component, and the pipeline that stacks them in configured order.
Package components defines context-guru's component model: the abstract API every context-engineering operation implements, the per-component report used for metrics, the runtime context handed to each component, and the pipeline that stacks them in configured order.
all
Package all blank-imports every built-in component so their init() registrations run.
Package all blank-imports every built-in component so their init() registrations run.
dsl
Package dsl is a declarative, user-extensible text-filter engine, adapted from rtk's TOML filter DSL (design D11).
Package dsl is a declarative, user-extensible text-filter engine, adapted from rtk's TOML filter DSL (design D11).
offload
Package offload holds the lossy-but-reversible components (they drop bytes and stash the original for the expand tool loop).
Package offload holds the lossy-but-reversible components (they drop bytes and stash the original for the expand tool loop).
reformat
Package reformat holds the lossless components (they repack the request denser or add caching hints without losing information).
Package reformat holds the lossless components (they repack the request denser or add caching hints without losing information).
Package config loads context-guru's configuration and builds a pipeline from it.
Package config loads context-guru's configuration and builds a pipeline from it.
Package dash is context-guru's persistent observability layer: the durable per-request store behind the dashboard, the off-hot-path capture pipeline that fills it, the JSON/SSE API the UI reads, and the embedded single-file UI.
Package dash is context-guru's persistent observability layer: the durable per-request store behind the dashboard, the off-hot-path capture pipeline that fills it, the JSON/SSE API the UI reads, and the embedded single-file UI.
examples
llm-d-service/client command
Command client is a minimal, dependency-free example of calling the context-guru compaction service the way the llm-d-router request-inline-compaction step does: POST the inference request body to the service and, on a 200 with a non-empty JSON object, use the returned (smaller) body in place of the original.
Command client is a minimal, dependency-free example of calling the context-guru compaction service the way the llm-d-router request-inline-compaction step does: POST the inference request body to the service and, on a 200 with a non-empty JSON object, use the returned (smaller) body in place of the original.
Package expand holds the host-agnostic half of reversibility (design D6, after headroom's CCR): the marker format Offload components write, the expand(id) tool definition injected per provider, and resolution of a stashed original from the Store.
Package expand holds the host-agnostic half of reversibility (design D6, after headroom's CCR): the marker format Offload components write, the expand(id) tool definition injected per provider, and resolution of a stashed original from the Store.
internal
adjudicate
Package adjudicate declares the context-maintenance tool the cold-sweep adjudication asks with, and the wire helpers that keep it byte-stable in the prompt-cache prefix.
Package adjudicate declares the context-maintenance tool the cold-sweep adjudication asks with, and the wire helpers that keep it byte-stable in the prompt-cache prefix.
buildinfo
Package buildinfo exposes version metadata stamped at build time via -ldflags.
Package buildinfo exposes version metadata stamped at build time via -ldflags.
cheapmodel
Package cheapmodel provides a minimal Anthropic Messages client used as the engine's injected extraction model.
Package cheapmodel provides a minimal Anthropic Messages client used as the engine's injected extraction model.
compactionpoint
Package compactionpoint answers ONE question: at what provider-billed input does a conversation's own compaction mechanism act?
Package compactionpoint answers ONE question: at what provider-billed input does a conversation's own compaction mechanism act?
coref
Package coref builds the Tier-1 co-reference index that co-reference-aware compaction decides from: for each tool output in a request, which identifiers that output INTRODUCED, and whether any later turn carried them forward.
Package coref builds the Tier-1 co-reference index that co-reference-aware compaction decides from: for each tool output in a request, which identifiers that output INTRODUCED, and whether any later turn carried them forward.
extract
Package extract is the cheap-model tool-output extractor.
Package extract is the cheap-model tool-output extractor.
logging
Package logging is context-guru's logging plumbing: the level/format/sink decision, the credential scrubber that sits in front of every handler, and the per-request logger that carries tenant and session onto the lines of one request's lifecycle — including the ones written after the response, off the request path (see With, and the boundary named there).
Package logging is context-guru's logging plumbing: the level/format/sink decision, the credential scrubber that sits in front of every handler, and the per-request logger that carries tenant and session onto the lines of one request's lifecycle — including the ones written after the response, off the request path (see With, and the boundary named there).
modelinfo
Package modelinfo resolves a model's context window (max input tokens) DYNAMICALLY, so context-guru's triggers can scale with the model rather than hard-coding thresholds.
Package modelinfo resolves a model's context window (max input tokens) DYNAMICALLY, so context-guru's triggers can scale with the model rather than hard-coding thresholds.
redact
Package redact holds the credential-scrubbing primitives: the patterns that recognise a credential in arbitrary text, and the key-name test that recognises one by the name it is stored under.
Package redact holds the credential-scrubbing primitives: the patterns that recognise a credential in arbitrary text, and the key-name test that recognises one by the name it is stored under.
skills
Package skills parses Claude Code's skills listing — the prose block that declares which skills a request carries.
Package skills parses Claude Code's skills listing — the prose block that declares which skills a request carries.
tokens
Package tokens estimates token counts using a real BPE tokenizer (o200k_base, the modern GPT family encoding) — an accurate offline proxy.
Package tokens estimates token counts using a real BPE tokenizer (o200k_base, the modern GPT family encoding) — an accurate offline proxy.
treesitter
This file is the pure-Go face of the treesitter package: when the cg_skeleton tag is absent, the real cgo implementation (treesitter.go) is excluded and this empty package takes its place, so `go build ./...` under CGO_ENABLED=0 links no tree-sitter grammars.
This file is the pure-Go face of the treesitter package: when the cg_skeleton tag is absent, the real cgo implementation (treesitter.go) is excluded and this empty package takes its place, so `go build ./...` under CGO_ENABLED=0 links no tree-sitter grammars.
Package kvcache is the KV-cache TTL domain: the per-request analysis dataset the dashboard's KV-cache page reads, the pricing model for the six things a prompt-cache policy can spend money on, the Strategy interface a TTL policy (or a future learned predictor) implements, and the historical replay simulator that scores one strategy against another.
Package kvcache is the KV-cache TTL domain: the per-request analysis dataset the dashboard's KV-cache page reads, the pricing model for the six things a prompt-cache policy can spend money on, the Strategy interface a TTL policy (or a future learned predictor) implements, and the historical replay simulator that scores one strategy against another.
Package metrics turns component/run reports into telemetry.
Package metrics turns component/run reports into telemetry.
Package modes holds the per-session state context-guru's operating modes need.
Package modes holds the per-session state context-guru's operating modes need.
Package proxy is the context-guru HTTP proxy: it runs the component pipeline on inbound chat requests, then forwards them to the configured upstream provider.
Package proxy is the context-guru HTTP proxy: it runs the component pipeline on inbound chat requests, then forwards them to the configured upstream provider.
Package proxyapp re-exports the handful of internal symbols a host needs to build its own context-guru proxy binary.
Package proxyapp re-exports the handful of internal symbols a host needs to build its own context-guru proxy binary.
Package schema holds the helpers this project layers over bifrost's message schema: token counting, deep-clone, MessageText/SetMessageText, Rewritable, ToolCalls (which pairs a tool result with the call that produced it), SessionHead, and static message-SHAPE validation.
Package schema holds the helpers this project layers over bifrost's message schema: token counting, deep-clone, MessageText/SetMessageText, Rewritable, ToolCalls (which pairs a tool result with the call that produced it), SessionHead, and static message-SHAPE validation.
Package session resolves the conversation key that state is scoped to.
Package session resolves the conversation key that state is scoped to.
both hosts (bifrost proxy, sidecar plugin) share it.
both hosts (bifrost proxy, sidecar plugin) share it.
Package tenant is the control plane for a hosted, multi-user context-guru: who the users are, which token identifies them, and what configuration their traffic runs under.
Package tenant is the control plane for a hosted, multi-user context-guru: who the users are, which token identifies them, and what configuration their traffic runs under.

Jump to

Keyboard shortcuts

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