> ## 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.

# Coach quickstart

> Get Glassray Coach running, send your first trace, and surface your first deviation - in about three minutes.

Everything here runs locally. You'll need **Node 20.6+** - that's the only prerequisite.

Prefer to watch first? This short walkthrough covers installing Coach and a quick tour of using it - then follow the written steps below.

<iframe src="https://www.youtube.com/embed/fQTTEMOctkM" title="Glassray Coach - install and quick tour" style={{ width: "100%", aspectRatio: "16 / 9", borderRadius: "0.75rem", border: "0" }} allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture; web-share" allowFullScreen />

<Steps>
  <Step title="Start Coach" icon="play">
    Run it once with npx, or install it permanently - same result:

    <CodeGroup>
      ```bash Run once (npx) theme={null}
      npx @glassray/coach start
      ```

      ```bash Install permanently theme={null}
      npm i -g @glassray/coach   # puts `glassray-coach` on your PATH - see the CLI docs for nvm/EACCES notes
      glassray-coach start
      ```
    </CodeGroup>

    Coach starts a server, an embedded database, and the dashboard - all in one process - and prints everything you need to connect an agent:

    ```
    Glassray Coach is running

      Dashboard  http://127.0.0.1:5899/
      Ingest     http://127.0.0.1:5899/v1/traces
      API key    glsk_local_…
    ```

    It opens **[http://127.0.0.1:5899](http://127.0.0.1:5899)** for you. On a fresh store you'll land on a **Waiting for traces** screen - and both the terminal and the dashboard hand you a **copy-paste onboarding prompt** for your coding agent, with that ingest key already baked in.

    <Tip>
      Something not right? `glassray-coach doctor` checks your Node version, the port, and that the data directory is writable - with one-line fixes.
    </Tip>
  </Step>

  <Step title="Hand setup to your coding agent" icon="wand-magic-sparkles">
    The fastest path: in an interactive terminal, `start` offers a setup menu on a fresh store - choose **Run Claude Code here** and it runs your own `claude` headlessly on the onboarding prompt, with a live activity feed and `git commit`/`git push` hard-blocked, so the wiring lands as an uncommitted diff you review. Or take the prompt yourself: click **Copy prompt** on the dashboard (or pick the copy option in the menu) and paste it into Claude Code, Codex, or Copilot in your agent's repo. Either way your agent installs the Coach skill, discovers your flows and rules straight from your code (`flows discover`), wires tracing to the printed endpoint + key, verifies the first trace lands, and reports its coverage. From then on you only run your agent.

    Prefer to wire it yourself? The next step is the manual version - and the dashboard keeps the same recipes one tab away.
  </Step>

  <Step title="Send a trace (by hand)" icon="plug">
    Point your agent at Coach - two env vars, both printed when Coach starts:

    ```bash theme={null}
    export GLASSRAY_ENDPOINT="http://127.0.0.1:5899"
    export GLASSRAY_API_KEY="glsk_local_…"   # your local ingest key
    ```

    Then with the [`@glassray/tracing`](/coach/instrument) SDK it's a few lines:

    ```ts theme={null}
    import { Glassray } from "@glassray/tracing";

    const glassray = new Glassray({ environment: "local", agent: "support-bot" });

    await glassray.trace("handle-ticket", { customer: "acme" }, async (t) => {
      const reply = await t.llm("answer", { model: "claude-opus-4-8", provider: "anthropic" }, () =>
        callModel(),
      );
      await t.tool("lookup-order", () => lookupOrder("4821"));
      return reply;
    });
    await glassray.flush();
    ```

    No agent wired up yet? The dashboard's empty state has a raw-OTLP recipe too - see [Send traces](/coach/instrument) for every option.
  </Step>

  <Step title="Watch it land - live" icon="wave-pulse">
    Back in the browser, the trace appears **instantly** - no refresh. Open **Traces → a row** for the span waterfall and an inspector with every input, output, and attribute. Select an LLM span and hit **Replay** to re-issue it with an edited prompt.
  </Step>

  <Step title="Find recurring deviations" icon="ghost">
    Once you've captured a batch of runs, go to **Deviations → Run discovery**. Coach's judge reads your traces and clusters the recurring ways your agent strays - the *silent* failures, not just crashes.

    <Info>
      Discovery needs a model. With Claude Code installed, Coach uses your local `~/.claude` automatically - no key. Or pick a provider and models on the dashboard's **Settings** page; see [providers](/coach/cli#llm-provider) for the full list.
    </Info>
  </Step>

  <Step title="Generate a fix, then lock it in" icon="wand-magic-sparkles">
    Open a deviation and click **Generate fix** - Coach writes a concrete fix as instructions you paste into Claude Code or Cursor (what to grep for, which files, the exact edits). Click **Save as eval** to freeze the deviation's rule into a repeatable pass/fail check, and bind it to a **flow** - a durable, named scope for that behaviour (e.g. "order-status questions") that Coach keeps classifying new traffic into. (You can also **Save as eval** straight from a trace's detail view.)

    Apply the fix and send fresh traffic - that's it: the new traces classify into the flow in the background, the eval **reruns on its own** once enough land, the pass rate climbs, and anything that breaks a formerly-passing case is flagged as a **regression**. Then **Mark resolved**.

    <Check>
      That's the whole self-healing loop - see it, find it, scope it, fix it, and it proves itself from then on. Walk through it end to end in [Find & fix deviations](/coach/analyze).
    </Check>
  </Step>
</Steps>

## Next steps

<CardGroup cols={2}>
  <Card title="Send traces" icon="plug" href="/coach/instrument">
    The SDK, raw OTLP, and how to capture inputs and tokens.
  </Card>

  <Card title="Find & fix deviations" icon="ghost" href="/coach/analyze">
    A worked example: discover → codify → fix → prove no regression.
  </Card>

  <Card title="CLI & coding agents" icon="terminal" href="/coach/cli">
    Every command, provider config, and the cross-agent skill.
  </Card>

  <Card title="Overview" icon="book-open" href="/coach/overview">
    What Coach is and how it fits alongside hosted Glassray.
  </Card>
</CardGroup>
