Run as a bifrost LLMPlugin¶
Embed the context-guru pipeline inside an existing bifrost deployment — no separate process, no transport of its own.
Steps¶
-
Build a pipeline and store from your config:
-
Construct the plugin and register it:
-
Wrap the transport with the expand loop if you need reversibility (see below).
Where it sits¶
PreRequestHookruns the pipeline overreq.ChatRequestin place — the canonical mutate phase. Non-chat requests pass through. It never aborts a request; fail-open lives inside the pipeline.- Session id comes from the
context-guru-sessioncontext value (set by the transport from the request header or Anthropicmetadata.user_id), falling back to a content hash. PreLLMHook/PostLLMHookare pass-throughs. The expand loop cannot be a hook — it must re-invoke upstream. Put it in a transport wrapper: run the pipeline, forward, then resolve<<cg:HASH>>markers with the sharedexpand/package and the store before returning, capped at 3 rounds. That is exactly what the shipped proxy does.
Troubleshooting
Markers reach my clients unexpanded. The plugin alone does not recover anything — the
expand loop lives in the transport wrapper, not in a hook. Either add the wrapper or run a
lossless-only pipeline (format, toon, cachesplit) so no marker is ever written.
Every request lands in the same session. The transport has to set the
context-guru-session context value. Without it the fallback is a content hash, which
changes whenever the head of the conversation changes.
Non-chat requests are untouched. By design — PreRequestHook passes them through.
For the standalone proxy and the AuthBridge plugin, see Host adapters.