Synced from Hive. This page is pulled from hivecommons/hive@v5 during the docs build. Edit the canonical source in the Hive repository.
Cortex and a ClankeR (Contributor Relay)
Audience and fit
This page is for someone who already runs a ClankeR and wants their own per-request view of what the relay spends and where it sends traffic. The relay runs on your machine, outside any hive’s proxy, so the hive has no wire visibility into that traffic and can neither show it to you nor account for it.
Cortex is a third-party tool, maintained by its own project (rossoctl/cortex). It is not shipped by Hive, it is not required to run a relay, and Hive does not integrate with it. You install it, trust its CA, and read its output on your own terms. Nothing on this page asks a hive operator to change anything.
What it gives
With Cortex as the relay’s HTTPS proxy, its agentop viewer shows:
- Per-request tokens and cost. The model, input, cache-read, cache-write, output and reasoning tokens, and a cost. A gateway’s own reported cost is used when it sends one; otherwise the tokens are priced at the bundled provider rates.
- A session and subagent timeline. One time axis per session with the main agent and each subagent, model time, tool time, retries, and time spent waiting.
- Egress the hive never sees. The hosts each session called and their errors, including the relay’s calls to your provider and the hosts it contacts at your forge and at the hive.
What it does not change
Cortex does not:
- change task admission: the same filters, trust tier, cooldown and quota checks apply;
- change task credentials: the hive still issues the same short-lived forge credential for each task;
- change what the hive allows, or which repositories and branches a task may touch;
- change the relay’s completion reporting: the verdict and evidence reach the hive as before.
It does not make the relay part of a hive’s governed path. A hive’s own proxy and credential handling remain the boundary the hive relies on; a local observer is yours, and its presence or absence is invisible to the hive.
Setup
Cortex runs as one binary on macOS or Linux and needs no account or cluster. The install command and the viewer commands below are from its documentation; see Getting started and Any other agent.
These commands were not executed on the machine that wrote this page. No Cortex binary was installed there. Treat them as the project’s documented commands, not as verified output, and read that project’s own troubleshooting page if a step fails.
-
Install Cortex:
curl -fsSL https://www.rossoctl.dev/cortex/install.sh | shSetup lists what it will change and asks once. It installs
agentopandcortexunder~/.local/bin, adds that directory to your shell profile, writes~/.cortex/config.yaml, and starts the proxy on127.0.0.1:47600. Open a new terminal afterwards so the updatedPATHapplies. -
Run the relay so its HTTPS traffic goes through the proxy. The documented way to do this for a process that has no settings file of its own is
agentop exec, which setsHTTP_PROXY,HTTPS_PROXYand their lowercase spellings to the local proxy and adds the bridge CA to the child’s trust settings. Everything after--passes through unchanged. From a Hive checkout, with<backend>replaced by the backend the relay drives, the native relay mode is:agentop exec -- just contribute-hive <backend> localIf you prefer to keep one long-lived shell for the relay, apply the same environment to that shell and start the relay normally:
eval "$(agentop exec --print)" just contribute-hive <backend> localagentop exec --printprints the export lines derived from the running proxy, so its proxy address and CA paths match the proxy that is actually serving. Do not copy those values by hand.Alternatively, if the relay’s backend is one Cortex connects directly,
agentop configure <name> enable(claude-code,opencode,codex,boborpi) writes the proxy settings into that backend’s own settings file, which the relay’s launched CLI then reads. This routes every session of that backend on the machine through Cortex, not only relay tasks, so preferagentop execwhen you want the view scoped to the relay. -
Watch it:
agentop observeA relay task appears as a session row with its events, tokens and cost. Press
Enterto open the events,Tfor the timeline, and$for spend by model, endpoint or agent.agentop cost --window month --by agentprints the same spend summary without the viewer.If no row appears, run
agentop doctor, which names the failing piece and the command that repairs it.
Limits of the setup
- Container routes do not inherit this. The Compose workflow, and the Homebrew
hive-contributewrapper around the pinned contributor image, run the relay inside a container. The proxy variables applied to the host shell, or to thejustprocess, are not passed into that container by default, so the relay’s traffic there would bypass Cortex. This page covers the nativelocalrelay mode, where the relay process inherits the environment. - Backend recognition. Cortex parses and names sessions for the agents it supports. A backend it does not recognize still sends its traffic through the proxy, but its requests may be visible without that backend’s own parser and session attribution.
Security: it can see the credentials the hive issues
Cortex is a local TLS-intercepting proxy. It decrypts HTTPS with a CA generated on your machine (under ~/.cortex/ca), passes the request through its pipeline, and re-encrypts it toward the origin.
When you put it in front of the relay, it can observe every HTTPS request the relay makes. That includes the short-lived forge credentials the hive hands out for a task, and, if the relay’s control connection to the hive is proxied as well, the token material on that connection. It also includes the relay’s provider traffic, prompts, completions and tool results. Its session data is written to disk as described below.
What to do about that:
- Keep non-provider hosts out of interception. Cortex ships a default passthrough list (GitHub, the Go module proxy and checksum database, and package registries) that tunnels those hosts instead of decrypting them. Any host not on the list is intercepted. For a forge or control endpoint that is not on the default list, add it under
tls_bridge.passthrough_hosts_extrain~/.cortex/config.yaml. Note that settingtls_bridge.passthrough_hostsyourself replaces the default list,passthrough_hosts: []intercepts everything, andtls_bridge.fail_closeddrops the default list too. Changes to these keys need a restart. - Or accept the exposure explicitly. If you would rather see the full request path, including the forge calls, enable it with that exposure understood. That is a deliberate choice, not a default anyone should drift into.
- Trust its CA deliberately. The relay’s tools must trust the bridge CA, or their HTTPS calls fail.
agentop execandagentop exec --printadd the CA to the child process; if you set the proxy variables by hand, you must also supplyNODE_EXTRA_CA_CERTSand the replacing bundle variables, or the relay’s CLI will not be able to verify the intercepted connections.agentop doctorlists programs that Cortex is passing through unread. - Know what is stored. The session archive under
~/.cortex/sessionskeeps prompts, completions, tool arguments and tool results, and the request bodies and headers it saw. Credential-named headers and query parameters are removed; request bodies are not redacted. The cost ledger under~/.cortex/costkeeps per-minute totals for 31 days. Directories are0700and files0600, and the archive is readable by anyone who can read your home directory. The session API is unauthenticated but loopback-bound and rejects non-loopbackHostheaders.agentop uninstall --purgeremoves~/.cortex. - Know what leaves the machine. The default configuration has
metrics_pushon: Cortex sends aggregate savings counters to a central collector every 60 seconds, and its documentation states that no prompt, path, host, session or key is included. Turn it off withmetrics_push.enabled: falsein~/.cortex/config.yamland restart the proxy.
A local observer is a convenience for you. It is not a security control, and it does not substitute for the hive’s own checks, credential scoping or egress policy.
Unsupported
Two placements are out of scope and are not supported:
- In front of a hive’s own proxy. A hive’s proxy and credential handling are the path the hive governs. Placing a personal intercepting proxy in that path is not something Hive supports, and doing so would break the boundary the hive relies on rather than merely observe it.
- Inside a hive pod. Hive does not support running Cortex as part of a hive deployment or alongside a hive’s own agents. Cortex documents a Kubernetes sidecar mode of its own, but that is its project’s concern, not a Hive integration.