condensate

The middleware

One tool gateway and one set of rules under the agents you already run.

On this page

Put one tool gateway and one set of rules under the agents you already run, without changing how they talk to their model.

What the middleware is

The middleware is the Condensate service that watches what agents do. It can add a note to an agent's next message or block a tool call before it runs. It gives an agent two connections. One MCP endpoint serves every tool server you connect, so you configure your tools once for every agent. One hook carries the agent's events, such as a prompt, a tool call or a stop, to Condensate's policy checks. The agent keeps its own model loop. Claude Code, Codex and Condensate's own agent all connect to it, and Engines explains what each one sends.

How it works

Two connections, two responsibilities
Tool access
HarnessRequests a tool
MCP endpointChecks and routes the call
UpstreamExecutes the tool
Policy hooks
Harness eventTriggers a wired hook
PolicyProduces a verdict
Hook shimReturns it to the harness
MCP routes tool calls. Hooks carry lifecycle events and decisions. Both paths must be configured in the client harness.

The top row is tool access. Your agent asks the middleware's endpoint for a tool, the endpoint checks the caller and routes the call to the tool server that owns it, and the result comes back counted. The bottom row is policy. At fixed points, such as before a tool call or when the agent stops, the agent sends an event, the policy produces an answer, and the hook turns that answer into a block, a note or nothing. Both connections are set up in the agent. Connecting tools alone doesn't turn an outside session into a Condensate thread.

You want toRead
Serve your MCP servers from one endpoint and point an agent at itConnect an upstream
Let the middleware block, note or continue an agent, and install the pluginHooks and the plugin
Give each kind of task its own notes and make a review prove its work before it stopsGuidance-note profiles
Let a model make several tool calls in one program, and count what agents spendCode mode and credits
Install the Condensate plugin in Claude Code or Codex and check it worksHook up Claude Code and Codex

How far it may go

A consent tier sets how far the middleware may intervene in a caller's sessions. CONDENSATE_CONSENT_TIER sets the tier for the whole deployment. When it is unset, no tier limits the middleware, so set one when you want to hold it back.

TierWhat the middleware may do
observeRecord observations. No intervention.
annotateAdd notes to sessions and deny governed calls.
steerAlso send corrective messages to the agent.
autonomousAlso force the agent to keep going, and interrupt it.
supervisedPer caller only, through CONDENSATE_SUPERVISED_PRINCIPALS. Watcher and advisor models may also read the session. Refused as the deployment-wide tier.

Under any tier below autonomous, the checklist stop sends nothing, and the agent stops when it chooses.

The judge

The middleware runs detectors over each session. They fire on repeat counts, line thresholds and regular expressions, so a detector can't tell a stuck agent from a careful one that repeats itself on purpose. The judge reviews each firing by asking TypeSafe whether the firing is real and which level of intervention the agent should get. CONDENSATE_STEERING_JUDGE sets the mode.

ModeWhat happens
offNo firing reaches TypeSafe. The default without TYPESAFE_API_KEY.
shadowThe judge reviews every firing and logs its decision beside the detector's. Nothing a session reads changes. The default when TYPESAFE_API_KEY is set.
gateThe judge's answer decides. A firing scored below CONDENSATE_JUDGE_REAL_FLOOR, 0.5 by default, is suppressed. A real one is acted on at the level the judge asks for, capped by the caller's consent tier.

The runtime's own agents

The runtime, the service that runs and stores agent threads, attaches its agents to the middleware once a key is in place, so Condensate's agents get the same notes as a Claude Code session you run yourself. It reads the key from ~/.config/condensate/middleware/api-key, one line, with no group or other access, or from the file CONDENSATE_MIDDLEWARE_API_KEY_FILE names. The middleware must accept the same key, for example as CONDENSATE_LOCAL_API_KEY.

If the default key file is missing and CONDENSATE_MIDDLEWARE_URL is not set, the runtime starts agents without guidance, logs steering off: <reason> at boot, and reports steering as off with the reason in its /health. If you set that URL or name another key file and the key can't be read, every agent start fails with the reason. CONDENSATE_STEERING=off turns the attachment off on purpose.

To give your own application durable Condensate threads and task controls, use the runtime SDK instead.

Reference

The backend listens on http://127.0.0.1:4787, or the port CONDENSATE_PORT names.

AddressWhat it is
POST /mcpThe MCP endpoint. Takes initialize, ping, tools/list and tools/call. harness__set_mode is one of the tools it serves.
POST /hooksWhere the hook sends events.
/ledger?session=<thread id>&limit=<n>One session's intervention rows.
/watcher/*, /credits/topupWatcher notes and credit top-ups.
GET /healthzWhether the backend is up.

Every address above except /healthz needs a caller check. With none configured, and without CONDENSATE_ALLOW_DEV_PRINCIPAL=1, they answer HTTP 503.

curl --fail-with-body "http://127.0.0.1:4787/ledger?session=THREAD_ID&limit=100" \
  -H "x-condensate-key: $CONDENSATE_LOCAL_API_KEY"

x-condensate-key carries the caller's key, and x-api-key or Authorization: Bearer carry the same key the way the hook and the plugin send it. x-condensate-session names the session a tool call belongs to.

Setting on the middlewareWhat it does
CONDENSATE_CONSENT_TIERThe deployment-wide tier: observe, annotate, steer or autonomous.
CONDENSATE_SUPERVISED_PRINCIPALSThe callers under the supervised tier, comma-separated.
CONDENSATE_STEERING_JUDGEThe judge's mode: off, shadow or gate.
TYPESAFE_API_KEYThe key the judge calls TypeSafe with.
CONDENSATE_JUDGE_REAL_FLOORBelow this score a firing is judged not real, in gate mode. Default 0.5.
CONDENSATE_HOLDOUT_FRACTIONThe share of steer and autonomous sessions that are only observed. Default 0.
Setting on the runtimeWhat it does
CONDENSATE_MIDDLEWARE_URLAnother middleware to attach agents to. With it set and no readable key, every start fails.
CONDENSATE_MIDDLEWARE_API_KEY_FILEAnother key file than ~/.config/condensate/middleware/api-key.
CONDENSATE_STEERING=offNo guidance for the runtime's agents.

The middleware's other settings are on the pages that use them: upstreams and the caller check, the hook, notes and profiles, and code mode and credits.