> ## Documentation Index
> Fetch the complete documentation index at: https://glassray.ai/docs/llms.txt
> Use this file to discover all available pages before exploring further.

# Glassray Coach

> The local edition of Glassray - run the whole loop on your own machine. One command, one embedded database, zero cloud.

Glassray Coach is a **fully local** AI-agent debugger. Point any OTLP-speaking agent at it, watch traces land live, then run **deviation discovery** and **evals** over them - all on `127.0.0.1`, with nothing leaving your machine.

It's the same loop as hosted Glassray, packaged as one process you run yourself: great for trying Glassray before connecting production, debugging locally, working offline, or running in CI.

Setup is one paste: on an empty store, `glassray-coach start` (and the dashboard's empty state) hands you an **onboarding prompt for your coding agent** - paste it into Claude Code, Codex, or Copilot and it discovers your flows and rules from your code, wires tracing, and verifies the first trace lands. Then you just run your agent.

<Note>
  Coach binds `127.0.0.1` only and every route enforces a loopback guard. Your traces stay on your machine - no account, no upload.
</Note>

## What you get

<CardGroup cols={2}>
  <Card title="Live trace viewer" icon="wave-pulse">
    Traces stream in as your agent runs. Open any one for a full span waterfall, inputs/outputs/attributes, and one-click **Replay** of an LLM step.
  </Card>

  <Card title="Deviation discovery" icon="ghost">
    An LLM judge reads your traces and clusters the recurring ways your agent misbehaves - the silent failures ordinary monitoring misses.
  </Card>

  <Card title="Durable flows" icon="diagram-project">
    Name your agent's behaviours once - a selector query and/or a plain-language rule, or **inferred straight from your agent's code** (`flows discover`) - and Coach classifies every new trace into them in the background, across sessions.
  </Card>

  <Card title="Self-rerunning evals" icon="circle-check">
    Turn any deviation - or a single trace - into a pass/fail check scoped to its flow. When enough new traces land, the eval **reruns on its own** and flags **regressions**.
  </Card>

  <Card title="Self-healing fixes" icon="wand-magic-sparkles">
    One click turns a deviation into a concrete fix - instructions you paste into your coding agent (what to grep for, which files, across prompt / tools / guardrails / code).
  </Card>

  <Card title="Flows as code" icon="file-code">
    Flows, run recipes, and your code root live in `glassray.yaml` - round-tripped with `pull` / `push` and gated in CI with `check`, so your rule suite travels with the repo.
  </Card>

  <Card title="A/B experiments" icon="flask">
    Compare a baseline against a candidate - say a cheaper model - over the same rule suite, and read the verdicts side by side.
  </Card>

  <Card title="Runs on your model" icon="microchip">
    Analysis runs against your local Claude subscription (zero-config), a metered API key, or a deterministic offline `mock`.
  </Card>
</CardGroup>

## The loop

```mermaid theme={null}
flowchart LR
  cap["Your agent runs<br/>→ traces stream in"] --> see["See<br/>Traces + Replay"]
  see --> find["Find<br/>Run discovery"]
  find --> scope["Scope<br/>Durable flows"]
  scope --> fix["Fix<br/>Generate fix"]
  fix --> verify["Verify<br/>Flow-scoped evals<br/>auto-rerun"]
  verify -.->|catch regressions,<br/>hands-free| scope
```

* **See** - every run lands live; open a trace to inspect the waterfall or replay an LLM call with an edited prompt.
* **Find** - discovery clusters recurring failures into **deviation types**, each with a plain-language rule.
* **Scope** - name the behaviour as a durable **flow** (a selector query and/or a plain-language rule); Coach classifies new traffic into it in the background, so the scope stays current across sessions.
* **Fix** - click **Generate fix** on a deviation and Coach writes a concrete fix as instructions for your coding agent (Claude Code / Cursor): what to grep for, the likely files, and the ordered edits across prompt, tools, guardrails, and code.
* **Verify** - save the deviation's rule as an eval bound to its flow; as fresh traces classify in, the eval **reruns automatically**, the pass rate climbs, and anything that breaks a formerly-passing case is flagged as a **regression**. Mark the deviation **resolved** to close the loop.

## Coach vs. hosted Glassray

<CardGroup cols={2}>
  <Card title="Coach - local" icon="laptop-code">
    One process on your machine. Your traces never leave. No account. Best for trying Glassray, local debugging, offline, and CI.
  </Card>

  <Card title="Glassray - hosted" icon="cloud" href="/getting-started">
    A continuous loop over your **production** traffic that learns intent from your code and proposes **code-level fixes** as pull requests. [Join the alpha](https://glassray.ai/waitlist).
  </Card>
</CardGroup>

## Next steps

<CardGroup cols={2}>
  <Card title="Quickstart" icon="rocket" href="/coach/quickstart">
    Get Coach running and see your first trace in about three minutes.
  </Card>

  <Card title="Send traces" icon="plug" href="/coach/instrument">
    Instrument your agent with the SDK or any OTLP exporter.
  </Card>

  <Card title="Find & fix deviations" icon="ghost" href="/coach/analyze">
    Run discovery, save evals, and prove your fixes with a worked example.
  </Card>

  <Card title="CLI & coding agents" icon="terminal" href="/coach/cli">
    Every command, plus the agent skill (Claude Code, Codex, Copilot) that drives the whole loop.
  </Card>
</CardGroup>
