Architecture
Glider operates with your AI coding CLI. It works with Claude Code, with Cursor Agent and
with Antigravity (agy). Glider is one Go program (cmd/glider).
It has three network interfaces and one shared completion pipeline. No code in that
pipeline makes a decision from the name of the CLI.
The network interfaces
| Interface | Port | Config | Function |
|---|---|---|---|
| Gateway | :8080 | server.proxy_port | Gives the OpenAI /v1/* endpoints, and the Anthropic /v1/messages. Set Override Base URL in the CLI to this address. |
| MITM proxy | :8082 (and :8083 for transparent mode) | mitm.port | Decrypts CONNECT traffic and transparent traffic. Does the delegation and the origin passthrough. Refer to MITM. |
| Dashboard | :8081 | server.dashboard_port | Gives the operator interface, the REST /api/* endpoints and the /ws WebSocket. It also serves this documentation. |
┌────────────────────────────────── glider.exe (one process) ──────────────────────────────────┐
│ │
│ ┌─────────────────┐ Complete() ┌────────────────────────────┐ │
│ │ Gateway :8080 │────────────────▶│ Shared harness │──▶ Ollama / vLLM / BYOK │
│ │ internal/api │ │ PipelineCompleter │ │
│ └─────────────────┘ │ router · transform · │ │
│ │ executor · metrics · │ │
│ ┌─────────────────┐ DecideLocal / │ contextgraph │ │
│ │ MITM :8082 │ CompleteLocal ▶│ │──▶ CLI's own origin │
│ │ internal/mitm │ └─────────────▲──────────────┘ (passthrough) │
│ └─────────────────┘ │ │
│ │ REST / WS │
│ ┌─────────────────┐ │ │
│ │ Dashboard :8081 │───────────────────────────────┘ │
│ └─────────────────┘ │
│ Disk: ~/.glider/{mitm,history,context} · configs/*.yaml (watched) │
└──────────────────────────────────────────────────────────────────────────────────────────────┘
The shared pipeline
Each completion goes through one orchestrator.PipelineCompleter. This is true
for the gateway and for MITM. Only CompleteOptions.OriginPassthrough is
different. For a request that is not local, the gateway uses your own cloud key. But MITM
sends the request to the origin of the CLI.
CompletionRequest → ApplyModelAlias (model_aliases: for example, gpt-4o → qwen2.5-coder:14b) → Tokenizer.EstimateRequestTokens → router.Engine.Route (refer to routing.html for the full priority sequence) → [origin gate — MITM only. A request that is not local → ErrOriginPassthrough] → episodes + BoundLocalContext (local only. Never the full history.) → Transformer.Apply (you must turn this on. It is off when you start.) → Executor.Execute (Ollama | vLLM | OpenAI | Anthropic. Backup sequence, circuit breaker.) → metrics + contextgraph events
A message with a /vendor flag (/claude, /cursor-agent
or /agy) does not go into this pipeline. DelegateHandler takes the
message first. On the gateway, the /v1/messages route takes it.
Refer to Delegation.
The packages
| Package | Function |
|---|---|
api | Gives the gateway HTTP endpoints /v1/chat/completions, /v1/responses and /v1/models |
orchestrator | Holds PipelineCompleter, the backup sequence, the circuit breaker, the VRAM control and the fan-out |
router | Applies the rules in priority sequence: explicit, sticky, classifier, Starlark, then the token limit |
mitm | Decrypts CONNECT traffic and transparent traffic. Holds the Cursor Agent RPC hub and the delegate handler. |
vendors | Does the delegation to another CLI: it finds the CLIs, runs them, relays the permissions and continues a run |
ngl | Native Glider Language. It gives one message format for all vendors (Turn, Part and EditViews). |
cursorrpc | Cursor only. Reads the Connect protobuf data and encodes and decodes RunSSE. |
contextgraph | Keeps the event log that Glider only adds to, and the graph of entities. Refer to Context. |
backend | Gives the completion clients ollama, vllm and cloud (OpenAI and Anthropic) |
transform | Counts the tokens, applies BoundLocalContext and can change a prompt |
vram | Monitors nvidia-smi, applies the allocation strategy, reserves and releases memory, and makes the eviction plan |
metrics | Sends data from the collector to the bus (the dashboard WebSocket) and to the history file |
dashboard | Gives the operator interface and the REST and WebSocket API. It also serves this documentation. |
config | Reads the YAML, checks it, and monitors the file for changes |
hotswap | Holds the registry of the modules that can accept a new config (fan_out, backends and classifier) |
procinfo | Finds the PID and the process name from a TCP connection |
tray | Gives the system tray icon and the Exit command. This applies to Windows only. |
tools | Holds the internal tools, the MCP servers and the sandbox of the workspace. Refer to Tools & MCP. |
mcp | Speaks the MCP protocol: the transport with stdio, the Streamable HTTP client, and the authorization for GitHub. |
summarizer | Adapts a backend for inference to the shape that the compaction of the continuity record needs. Refer to Context. |
contextkit | Keeps the state of a session, an episode and a turn budget for the swarm and the loop. |
plugin | Gives the life cycle and the capabilities of a plugin of Glider. |
runstate | Says if the previous run of Glider stopped correctly. A stop that is not clean can leave the rules of the redirector on the machine. |
atomicfile | Writes a file completely, or not at all. A file with a part of its content is worse than no new file. |
fileacl | Limits who can read a file with sensitive content, such as a token. |
safego | Starts a goroutine with a long life, and it does not let a panic stop the program. |
procutil | Small helpers for one OS, to start a process. |
webviewshell | Puts the dashboard in a window of the operating system, in place of a browser tab. |
When you must restart Glider
config.Provider.Watch):
the routing rules, the model aliases, the transform config, the log level, the backend and
model clients, and the hot-swap modules.
You must restart Glider after you change these: the ports, the MITM CA, the
MITM host list, and the transparent interception settings.
What Glider does after a failure
| Condition | Result |
|---|---|
| Circuit breaker | Glider counts the failures of each backend. After 5 failures it stops that backend for 30 seconds. Then it sends one test request. |
| Backup sequence | Glider examines the health, the circuit breaker and the warm condition. If the local model fails, Glider uses your cloud key. You can turn this off. If all backends fail, Glider gives error 502. |
ErrOriginPassthrough | MITM only. For a request that is not local, Glider sends the request to the origin of the CLI. The credentials do not change. |
| A local failure in hybrid mode | Glider sends the request to the origin. The setting is mitm.origin_on_local_error. |
| Pure local mode | Set origin_on_local_error: false. Glider then shows the error and does not use the origin. |
Notes on concurrency
- Glider replaces the
Configand therouter.Enginewith anatomic.Pointer. A reader does not stop while Glider reads a new config. - The gateway and MITM call
PipelineCompleter.Handleat the same time. The structure does not change, and its dependencies are safe for concurrent use. Do not keep the data of one request on it. - Glider stops the subprocess of a headless delegate call when the HTTP request ends. No background task continues after the request. An
interactivetemplate is different: it is the default for/agy, and it opens a separate console session. Glider does not wait for that session and does not stop it. - The Cursor hub (
AgentFulfillHub) protects itswaiting,pendingandfamilymaps with one mutex. Refer to MITM for the details.
The config profiles
configs/glider.yaml— the default profile. It uses the gateway and MITM.configs/glider.local.yaml— Ollama only, with no cloud backup. Refer to Pure local.configs/glider.cloud.yaml— primarily cloud, with MITM off.