# Integrate `Telemetry` from Motion Garden

You are helping me add the **Telemetry** component to an existing project.
Everything you need is below — full source, dependencies, props and the
behavioural contract. Read it all before writing anything.

- **Component:** Telemetry
- **Category:** Power-User Systems
- **Summary:** A metric board that behaves as one instrument instead of eight sparklines. Hovering any tile broadcasts a single timestamp and every other tile resolves its own value at that same instant, so a latency spike and a queue backing up are visibly the same event rather than two coincidences. Threshold breaches are recorded on the sample rather than on a pixel, so the scar travels with its data and is still there forty seconds after the value recovered.
- **Reference:** https://motion-garden.netlify.app/components/telemetry
- **Full catalog (for you, the agent):** https://motion-garden.netlify.app/llms.txt

## Stack this source assumes

- React 19 with the Next.js App Router (never the `pages/` directory)
- TypeScript, strict
- Tailwind CSS v4, CSS-first config (utilities are inline; no `tailwind.config` needed)

If my project differs, adapt the integration — but do not rewrite the animation math to suit a different stack. Ask me first.

## Dependencies

```bash
# Telemetry needs no npm packages
```

## Design tokens this source uses

Some classes in the source are Motion Garden theme tokens, not stock Tailwind (`text-ink`, `bg-panel`, `font-display` and the like). Without them, parts of the component render unstyled. Add this to my global CSS, after the Tailwind import:

```css
@theme {
  --font-display: "Space Mono", ui-monospace, "SFMono-Regular", monospace;
}

@theme inline {
  --color-panel: var(--sg-panel);
  --color-hairline: var(--sg-hairline);
  --color-ink: var(--sg-ink);
  --color-ink-mute: var(--sg-ink-mute);
}

:root {
  --sg-panel: #ffffff;
  --sg-hairline: #dde2e7;
  --sg-ink: #16191d;
  --sg-ink-mute: #878e97;
}

.dark {
  --sg-panel: #101215;
  --sg-hairline: #2a2f36;
  --sg-ink: #e2e6e9;
  --sg-ink-mute: #6c737c;
}
```

The values are Motion Garden's own light and dark themes. If my project already has tokens for these roles, point the `--sg-*` variables at mine instead and tell me which you mapped. `.dark` assumes class-based dark mode — adapt the selector to how my project switches themes.

`font-display` expects Space Mono, and this CSS only names it. Load the font (with `next/font/google`, for example) or put my own display face first in the stack; until then it falls back to the system monospace.

## Files to create

2 files — all of them are required. Paths are as shipped; the component may live anywhere in my project, but keep every peer file at the exact path shown so the import aliases resolve.

### 1. `components/registry/telemetry/telemetry.tsx`

```tsx
"use client";

import { memo, useEffect, useMemo, useRef } from "react";
import { useAnimationLoop, type Metrics } from "@/hooks/use-animation-loop";

export type TelemetryColumns = "2" | "3" | "4";
export type TelemetryFill = "none" | "gradient" | "solid";

interface TelemetryProps {
  tiles?: number;
  columns?: TelemetryColumns;
  sampleRate?: number;
  history?: number;
  smoothing?: number;
  threshold?: number;
  scars?: boolean;
  cursor?: boolean;
  fill?: TelemetryFill;
  traceColor?: string;
  breachColor?: string;
  paused?: boolean;
  reducedMotion?: boolean;
  className?: string;
}

interface Metric {
  name: string;
  unit: string;
  base: number;
  span: number;
  drift: number;
  noise: number;
  spike: number;
  digits: number;
}

const METRICS: Metric[] = [
  { name: "p99 latency", unit: "ms", base: 60, span: 180, drift: 0.09, noise: 0.1, spike: 0.02, digits: 0 },
  { name: "throughput", unit: "rps", base: 1900, span: 1100, drift: 0.05, noise: 0.05, spike: 0, digits: 0 },
  { name: "error rate", unit: "%", base: 0.02, span: 2.4, drift: 0.04, noise: 0.06, spike: 0.035, digits: 2 },
  { name: "cpu", unit: "%", base: 22, span: 62, drift: 0.07, noise: 0.07, spike: 0.008, digits: 0 },
  { name: "heap", unit: "MB", base: 480, span: 380, drift: 0.03, noise: 0.03, spike: 0, digits: 0 },
  { name: "queue depth", unit: "", base: 2, span: 180, drift: 0.06, noise: 0.09, spike: 0.03, digits: 0 },
  { name: "cache hit", unit: "%", base: 90, span: 9, drift: 0.05, noise: 0.04, spike: 0, digits: 1 },
  { name: "connections", unit: "", base: 620, span: 520, drift: 0.04, noise: 0.05, spike: 0.006, digits: 0 },
  { name: "gc pause", unit: "ms", base: 2, span: 38, drift: 0.11, noise: 0.12, spike: 0.03, digits: 1 },
  { name: "disk io", unit: "MB/s", base: 40, span: 220, drift: 0.08, noise: 0.09, spike: 0.012, digits: 0 },
  { name: "retries", unit: "", base: 0, span: 42, drift: 0.1, noise: 0.14, spike: 0.028, digits: 0 },
  { name: "saturation", unit: "%", base: 30, span: 60, drift: 0.06, noise: 0.06, spike: 0.01, digits: 0 },
];

function mulberry32(seed: number): () => number {
  let a = seed >>> 0;
  return () => {
    a = (a + 0x6d2b79f5) >>> 0;
    let t = Math.imul(a ^ (a >>> 15), 1 | a);
    t = (t + Math.imul(t ^ (t >>> 7), 61 | t)) ^ t;
    return ((t ^ (t >>> 14)) >>> 0) / 4294967296;
  };
}

function hexToRgb(hex: string): [number, number, number] {
  const h = hex.replace("#", "");
  const full = h.length === 3 ? h.split("").map((c) => c + c).join("") : h;
  const n = parseInt(full, 16);
  if (Number.isNaN(n) || full.length !== 6) return [255, 255, 255];
  return [(n >> 16) & 255, (n >> 8) & 255, n & 255];
}

interface Series {
  values: Float32Array;
  breached: Uint8Array;
  head: number;
  filled: number;
  phase: number;
  freq: [number, number, number];
  level: number;
  smoothed: number;
  rng: () => number;
}

const Telemetry = memo(
  ({
    tiles = 8,
    columns = "4",
    sampleRate = 8,
    history = 45,
    smoothing = 0.25,
    threshold = 0.82,
    scars = true,
    cursor = true,
    fill = "gradient",
    traceColor = "#a855f7",
    breachColor = "#f87171",
    paused = false,
    reducedMotion = false,
    className,
  }: TelemetryProps) => {
    const containerRef = useRef<HTMLDivElement>(null);
    const canvasRefs = useRef<(HTMLCanvasElement | null)[]>([]);
    const plotRefs = useRef<(HTMLDivElement | null)[]>([]);
    const readoutRefs = useRef<(HTMLSpanElement | null)[]>([]);
    const drawRef = useRef<((dt: number) => void | false) | null>(null);
    const measureRef = useRef<((m: Metrics) => void) | null>(null);

    const cursorRef = useRef({ at: 0, active: false });

    const count = Math.max(1, Math.min(METRICS.length, Math.round(tiles)));
    const shown = useMemo(() => METRICS.slice(0, count), [count]);

    const live = useRef({
      sampleRate, history, smoothing, threshold, scars, cursor, fill,
      traceColor, breachColor, reducedMotion,
    });
    live.current = {
      sampleRate, history, smoothing, threshold, scars, cursor, fill,
      traceColor, breachColor, reducedMotion,
    };

    const loop = useAnimationLoop({
      target: containerRef,
      halted: paused || reducedMotion,
      dpr: "auto",
      onResize: (metrics) => measureRef.current?.(metrics),
      onFrame: ({ dt }) => (drawRef.current ? drawRef.current(dt) : false),
    });

    useEffect(() => {
      const container = containerRef.current;
      if (!container) return;

      const rate = Math.max(1, Math.round(live.current.sampleRate));
      const windowSeconds = Math.max(5, Math.round(live.current.history));
      const capacity = Math.max(8, rate * windowSeconds);

      const series: Series[] = shown.map((m, i) => ({
        values: new Float32Array(capacity),
        breached: new Uint8Array(capacity),
        head: 0,
        filled: 0,
        phase: i * 1.37,
        freq: [
          0.42 + ((i * 0.618) % 1) * 0.62,
          0.15 + ((i * 0.379) % 1) * 0.3,
          1.2 + ((i * 0.827) % 1) * 1.4,
        ],
        level: 0.5,
        smoothed: 0.5,
        rng: mulberry32(0x9e37 + i * 7919),
      }));

      const advance = (s: Series, m: Metric, step: number) => {
        s.phase += step * (0.35 + m.drift * 4);
        const wave =
          Math.sin(s.phase * s.freq[0]) * 0.28 +
          Math.sin(s.phase * s.freq[1] + 1.1) * 0.17 +
          Math.sin(s.phase * s.freq[2] + 2.3) * 0.06;
        const jitter = (s.rng() - 0.5) * 2 * m.noise;
        let next = 0.5 + wave + jitter;
        if (m.spike > 0 && s.rng() < m.spike * step * 8) {
          next += 0.35 + s.rng() * 0.45;
        }
        s.level = Math.max(0, Math.min(1, next));
      };

      const push = (s: Series, value: number, breach: boolean) => {
        s.values[s.head] = value;
        s.breached[s.head] = breach ? 1 : 0;
        s.head = (s.head + 1) % capacity;
        if (s.filled < capacity) s.filled++;
      };

      const sampleOnce = (s: Series, m: Metric, step: number) => {
        const l = live.current;
        advance(s, m, step);
        const k = Math.max(0, Math.min(0.95, l.smoothing));
        s.smoothed = s.smoothed * k + s.level * (1 - k);
        push(s, s.smoothed, s.smoothed >= l.threshold);
      };

      for (let i = 0; i < series.length; i++) {
        for (let k = 0; k < capacity; k++) {
          sampleOnce(series[i], shown[i], 1 / rate);
        }
      }

      let accumulator = 0;

      const sizeCanvases = (dpr: number) => {
        for (let i = 0; i < canvasRefs.current.length; i++) {
          const canvas = canvasRefs.current[i];
          const plot = plotRefs.current[i];
          if (!canvas || !plot) continue;
          const box = plot.getBoundingClientRect();
          const w = Math.max(1, Math.floor(box.width));
          const h = Math.max(1, Math.floor(box.height));
          canvas.width = Math.max(1, Math.round(w * dpr));
          canvas.height = Math.max(1, Math.round(h * dpr));
          canvas.style.width = `${w}px`;
          canvas.style.height = `${h}px`;
          const ctx = canvas.getContext("2d");
          if (ctx) ctx.setTransform(dpr, 0, 0, dpr, 0, 0);
        }
      };

      const at = (s: Series, frac: number): { value: number; breach: boolean } => {
        const back = Math.round((1 - frac) * (capacity - 1));
        const idx = (s.head - 1 - back + capacity * 2) % capacity;
        return { value: s.values[idx], breach: s.breached[idx] === 1 };
      };

      const drawTile = (i: number) => {
        const l = live.current;
        const canvas = canvasRefs.current[i];
        if (!canvas) return;
        const ctx = canvas.getContext("2d");
        if (!ctx) return;
        const s = series[i];
        const m = shown[i];

        const width = parseFloat(canvas.style.width) || 1;
        const height = parseFloat(canvas.style.height) || 1;

        ctx.clearRect(0, 0, width, height);
        if (s.filled < 2) return;

        const [tr, tg, tb] = hexToRgb(l.traceColor);
        const [br, bg, bb] = hexToRgb(l.breachColor);

        const pad = 3;
        const plotH = Math.max(1, height - pad * 2);
        const xAt = (k: number) => (k / (capacity - 1)) * width;
        const yAt = (v: number) => pad + (1 - v) * plotH;

        const valueAt = (k: number) => {
          const idx = (s.head - capacity + k + capacity * 2) % capacity;
          return { v: s.values[idx], b: s.breached[idx] === 1 };
        };

        if (l.fill !== "none") {
          ctx.beginPath();
          ctx.moveTo(0, height);
          for (let k = 0; k < capacity; k++) ctx.lineTo(xAt(k), yAt(valueAt(k).v));
          ctx.lineTo(width, height);
          ctx.closePath();
          if (l.fill === "gradient") {
            const grad = ctx.createLinearGradient(0, 0, 0, height);
            grad.addColorStop(0, `rgba(${tr}, ${tg}, ${tb}, 0.34)`);
            grad.addColorStop(1, `rgba(${tr}, ${tg}, ${tb}, 0.02)`);
            ctx.fillStyle = grad;
          } else {
            ctx.fillStyle = `rgba(${tr}, ${tg}, ${tb}, 0.16)`;
          }
          ctx.fill();
        }

        ctx.strokeStyle = `rgba(${br}, ${bg}, ${bb}, 0.28)`;
        ctx.setLineDash([2, 3]);
        ctx.lineWidth = 1;
        ctx.beginPath();
        ctx.moveTo(0, yAt(l.threshold));
        ctx.lineTo(width, yAt(l.threshold));
        ctx.stroke();
        ctx.setLineDash([]);

        ctx.lineWidth = 1.4;
        ctx.lineJoin = "round";
        ctx.strokeStyle = `rgba(${tr}, ${tg}, ${tb}, 0.95)`;
        ctx.beginPath();
        for (let k = 0; k < capacity; k++) {
          const x = xAt(k);
          const y = yAt(valueAt(k).v);
          if (k === 0) ctx.moveTo(x, y);
          else ctx.lineTo(x, y);
        }
        ctx.stroke();

        if (l.scars) {
          ctx.strokeStyle = `rgba(${br}, ${bg}, ${bb}, 0.9)`;
          ctx.lineWidth = 1;
          for (let k = 0; k < capacity; k++) {
            const point = valueAt(k);
            if (!point.b) continue;
            const x = xAt(k);
            ctx.beginPath();
            ctx.moveTo(x, yAt(point.v) - 3);
            ctx.lineTo(x, yAt(point.v) + 3);
            ctx.stroke();
          }
        }

        const c = cursorRef.current;
        if (l.cursor && c.active) {
          const x = c.at * width;
          const point = at(s, c.at);
          ctx.strokeStyle = `rgba(${tr}, ${tg}, ${tb}, 0.55)`;
          ctx.lineWidth = 1;
          ctx.beginPath();
          ctx.moveTo(x, 0);
          ctx.lineTo(x, height);
          ctx.stroke();

          ctx.fillStyle = point.breach
            ? `rgba(${br}, ${bg}, ${bb}, 1)`
            : `rgba(${tr}, ${tg}, ${tb}, 1)`;
          ctx.beginPath();
          ctx.arc(x, yAt(point.value), 2.6, 0, Math.PI * 2);
          ctx.fill();
        }

        const node = readoutRefs.current[i];
        if (node) {
          const point = l.cursor && c.active ? at(s, c.at) : at(s, 1);
          const real = m.base + point.value * m.span;
          node.textContent = `${real.toFixed(m.digits)}${m.unit ? ` ${m.unit}` : ""}`;
          node.style.color = point.breach ? l.breachColor : "";
        }
      };

      drawRef.current = (dt) => {
        const l = live.current;
        const step = 1 / Math.max(1, Math.round(l.sampleRate));

        accumulator += Math.min(dt, 0.5);
        let guard = 0;
        while (accumulator >= step && guard < 30) {
          for (let i = 0; i < series.length; i++) sampleOnce(series[i], shown[i], step);
          accumulator -= step;
          guard++;
        }

        for (let i = 0; i < series.length; i++) drawTile(i);
      };

      measureRef.current = ({ dpr }) => {
        sizeCanvases(dpr);
        for (let i = 0; i < series.length; i++) drawTile(i);
      };

      loop.resize();
      loop.start();

      return () => {
        drawRef.current = null;
        measureRef.current = null;
      };
      // eslint-disable-next-line react-hooks/exhaustive-deps
    }, [shown, sampleRate, history]);

    const track = (event: React.PointerEvent<HTMLDivElement>) => {
      const box = event.currentTarget.getBoundingClientRect();
      if (box.width === 0) return;
      cursorRef.current.at = Math.max(
        0,
        Math.min(1, (event.clientX - box.left) / box.width),
      );
      cursorRef.current.active = true;
      loop.paint();
    };
    const release = () => {
      cursorRef.current.active = false;
      loop.paint();
    };

    return (
      <div
        ref={containerRef}
        className={className ?? "grid h-full w-full gap-2 p-3"}
        style={{
          gridTemplateColumns: `repeat(${Math.max(1, Number(columns) || 4)}, minmax(0, 1fr))`,
        }}
        onPointerLeave={release}
      >
        {shown.map((metric, i) => (
          <div
            key={metric.name}
            className="flex min-h-0 min-w-0 flex-col overflow-hidden rounded-md border border-hairline bg-panel/50 p-2"
          >
            <div className="flex items-baseline justify-between gap-2">
              <span className="truncate font-display text-[9px] tracking-[0.18em] text-ink-mute uppercase">
                {metric.name}
              </span>
              <span
                ref={(node) => {
                  readoutRefs.current[i] = node;
                }}
                className="font-mono text-[11px] text-ink tabular-nums"
              >
                —
              </span>
            </div>
            <div
              ref={(node) => {
                plotRefs.current[i] = node;
              }}
              className="relative mt-1.5 min-h-0 flex-1 select-none"
              onPointerMove={track}
            >
              <canvas
                ref={(node) => {
                  canvasRefs.current[i] = node;
                }}
                className="absolute top-0 left-0 block touch-none"
              />
            </div>
          </div>
        ))}
      </div>
    );
  },
);

Telemetry.displayName = "Telemetry";

export default Telemetry;
```

### 2. `hooks/use-animation-loop.ts` — peer hook, required

```tsx
"use client";

import { useCallback, useEffect, useLayoutEffect, useMemo, useRef } from "react";

export interface Metrics {
  width: number;
  height: number;
  dpr: number;
  bufferWidth: number;
  bufferHeight: number;
}

export interface FrameInfo {
  now: number;
  dt: number;
  elapsed: number;
  frame: number;
}

export interface AnimationLoopHandle {
  start(): void;
  stop(): void;
  paint(): void;
  resize(): void;
  readonly running: boolean;
}

export interface AnimationLoopOptions {
  target: React.RefObject<HTMLElement | null>;
  halted?: boolean;
  dpr?: number | "auto";
  onResize?(metrics: Metrics): void;
  onFrame?(info: FrameInfo): void | false;
  paintWhenHalted?: boolean;
  resizeDebounceMs?: number;
  gl?(): WebGLRenderingContext | WebGL2RenderingContext | null | undefined;
  onDispose?(): void;
  deps?: unknown[];
}

const MAX_DT = 1 / 15;

export function useAnimationLoop(
  options: AnimationLoopOptions,
): AnimationLoopHandle {
  const opts = useRef(options);
  useLayoutEffect(() => {
    opts.current = options;
  });

  const raf = useRef<number | null>(null);
  const timer = useRef<ReturnType<typeof setTimeout> | null>(null);
  const running = useRef(false);
  const disposed = useRef(false);
  const startedAt = useRef(0);
  const last = useRef(0);
  const frame = useRef(0);

  const measure = useCallback((): Metrics | null => {
    const el = opts.current.target.current;
    if (!el) return null;
    const rect = el.getBoundingClientRect();
    const cap = opts.current.dpr ?? "auto";
    const limit = cap === "auto" ? 2 : cap;
    const dpr = Math.min(
      typeof window === "undefined" ? 1 : window.devicePixelRatio || 1,
      limit,
    );
    return {
      width: rect.width,
      height: rect.height,
      dpr,
      bufferWidth: Math.max(1, Math.round(rect.width * dpr)),
      bufferHeight: Math.max(1, Math.round(rect.height * dpr)),
    };
  }, []);

  const tick = useCallback(function tick(now: number) {
    if (disposed.current) return;

    if (startedAt.current === 0) startedAt.current = now;
    const dt = last.current === 0 ? 0 : Math.min((now - last.current) / 1000, MAX_DT);
    last.current = now;

    const info: FrameInfo = {
      now,
      dt,
      elapsed: (now - startedAt.current) / 1000,
      frame: frame.current++,
    };

    const verdict = opts.current.onFrame?.(info);

    if (disposed.current) return;

    if (verdict === false || opts.current.halted) {
      running.current = false;
      raf.current = null;
      return;
    }
    raf.current = requestAnimationFrame(tick);
  }, []);

  const start = useCallback(() => {
    if (disposed.current || running.current) return;
    running.current = true;
    last.current = 0;
    raf.current = requestAnimationFrame(tick);
  }, [tick]);

  const stop = useCallback(() => {
    running.current = false;
    if (raf.current !== null) {
      cancelAnimationFrame(raf.current);
      raf.current = null;
    }
  }, []);

  const paint = useCallback(() => start(), [start]);

  const resize = useCallback(() => {
    const metrics = measure();
    if (!metrics) return;
    opts.current.onResize?.(metrics);
    if (opts.current.paintWhenHalted !== false) paint();
    else if (!opts.current.halted) start();
  }, [measure, paint, start]);

  const deps = options.deps ?? [];

  useEffect(() => {
    disposed.current = false;
    const el = opts.current.target.current;
    if (!el) return;

    const run = () => {
      if (disposed.current) return;
      resize();
    };

    const observer = new ResizeObserver(() => {
      const wait = opts.current.resizeDebounceMs ?? 0;
      if (wait <= 0) {
        run();
        return;
      }
      if (timer.current !== null) clearTimeout(timer.current);
      timer.current = setTimeout(() => {
        timer.current = null;
        run();
      }, wait);
    });
    observer.observe(el);

    resize();
    if (!opts.current.halted) start();

    return () => {
      disposed.current = true;
      running.current = false;
      if (raf.current !== null) {
        cancelAnimationFrame(raf.current);
        raf.current = null;
      }
      if (timer.current !== null) {
        clearTimeout(timer.current);
        timer.current = null;
      }
      observer.disconnect();
      opts.current.onDispose?.();
      const context = opts.current.gl?.();
      context?.getExtension("WEBGL_lose_context")?.loseContext();
      startedAt.current = 0;
      last.current = 0;
      frame.current = 0;
    };
    // eslint-disable-next-line react-hooks/exhaustive-deps
  }, deps);

  const halted = options.halted ?? false;
  useEffect(() => {
    if (!halted) start();
  }, [halted, start]);

  return useMemo<AnimationLoopHandle>(
    () => ({
      start,
      stop,
      paint,
      resize,
      get running() {
        return running.current;
      },
    }),
    [start, stop, paint, resize],
  );
}
```


## Props

| Prop | Type | Default | Description |
| --- | --- | --- | --- |
| `tiles` | `number` | `8` | Metrics on the board. Every tile shares one clock and one cursor, so this is also how many traces a single hover has to answer at once — the coordination is the component, and it only becomes legible above about six. Range 3–12. |
| `columns` | `"2" | "3" | "4"` | `"4"` | Grid width. Narrow columns make each trace taller relative to its width and exaggerate every wobble; wide ones flatten them into something you can actually compare across rows. |
| `sampleRate` | `number` | `8` | How often each ring buffer takes a sample, held independent of the frame rate on purpose. The buffer advances on its own accumulator, so a machine dropping to 30fps shows the same history as one at 120 — a chart whose past depends on the viewer's GPU is lying about the data. Range 1–30 Hz. |
| `history` | `number` | `45` | How much past each trace shows. Ring capacity is this times the sample rate and is allocated once, so raising either reallocates rather than grows and the memory stays bounded. Range 10–180 s. |
| `smoothing` | `number` | `0.25` | Exponential moving average applied on the way into the buffer. It smooths the stored series rather than the drawing, so the cursor reads exactly the numbers you can see — a readout that disagrees with its own trace is worse than a noisy one. Range 0–0.95. |
| `threshold` | `number` | `0.82` | Normalised level a metric has to cross to count as a breach. Normalised because the tiles do not share units — a percentage and a megabyte have to be comparable for one cursor and one rule to mean anything across the board. Range 0.5–0.99. |
| `scars` | `boolean` | `true` | Keep a permanent mark on the trace where a breach happened. A flash you missed is a flash that did not happen; the scar is what makes an unattended board worth glancing at. |
| `cursor` | `boolean` | `true` | The shared time cursor. Turning it off leaves eight ordinary sparklines, which is the clearest way to see what it was doing. |
| `fill` | `"none" | "gradient" | "solid"` | `"gradient"` | Area under the trace. Gradient reads as volume without competing with the line; solid is denser and better at small tile sizes; none is the honest choice when several traces would otherwise imply a stack that does not exist. |
| `traceColor` | `string (hex)` | `"#a855f7"` | The line, the fill ramp, and the cursor rule. |
| `breachColor` | `string (hex)` | `"#f87171"` | The threshold rule, the scar, and the readout while the cursor sits on a breached sample. One colour across all three, so a scar is visibly the same event as the reading that produced it. |

## Usage

```tsx
import Telemetry from "@/components/registry/telemetry/telemetry";

<Telemetry
  tiles={8}
  columns="4"
  sampleRate={8}
  history={45}
  smoothing={0.25}
  threshold={0.82}
  scars={true}
  cursor={true}
  fill="gradient"
  traceColor="#a855f7"
  breachColor="#f87171"
/>
```

The import path matches the file path above; change it if you move the component. Every value shown is the documented default — pass only what you actually want to change. The snippet lists the tunable props only: if the component's props type in the source requires others (content, handlers, data), pass those too.

## Integration rules

- Keep the `"use client"` directive. This is a client component and will not render as a Server Component.
- It fills its parent. Give the wrapper an explicit height (or a definite grid area) — against a height-auto parent it collapses to nothing.
- It takes a `reducedMotion` prop and quiesces when true. Wire it to a `prefers-reduced-motion` listener rather than hardcoding `false`.
- It runs a free-running animation loop. Halt it when off-screen or backgrounded if you care about battery.
- The `touch-action: none` on the hit target is load-bearing — without it a finger drag scrolls the page instead of driving the effect. Do not strip it as a stray utility class.
- The peer hook is required, not optional. Copy it to `hooks/use-animation-loop.ts` so the component's `@/hooks/use-animation-loop` import resolves.
- It owns a GPU/canvas context and releases it on unmount. Preserve the cleanup return — leaking contexts kills the tab after a few navigations.

## Your task

1. Tell me where in my project this should live and why.
2. Create the files above verbatim.
3. Add the design tokens to my global CSS, or map them to tokens I already have.
4. Wire the component into the place I point you at, with sensible props for that context.
5. Flag anything in my setup that conflicts with the stack assumptions above.

Do not restyle the component or alter the animation math unless I ask.
