Where the seconds go. Decomposes p50 and p95 of the runs users feel into stages — queue, retrieval, first token, tools — and names the stage worth attacking.
Free & open · no signup · read-only — it ends by asking · nothing leaves your machine
You are working inside this repo. Mission: decompose the latency of the runs users actually feel — p50 and p95, stage by stage — and name the stages worth attacking versus the ones already fine.
Read-only pass. Your only write is the report file. Read existing timers, traces, and logs where they exist; estimate from code where they don't.
Phase 2 sweeps the codebase through every one of these, citing file and line for each finding.
queue wait, retrieval, prompt assembly, time-to-first-token, generation, tool calls, post-processing: a number or an honest estimate for each
what makes the slow tail slow: retries, cold starts, long inputs, contended resources; p95 is a different animal from p50 and gets its own diagnosis
awaits in sequence with no data dependency; fan-out opportunities in tool calls and retrieval
time-to-first-token and streaming: what could render early; a fast-feeling eight seconds beats a silent five
prompt and context sizes versus need; the tokens that cost milliseconds on every single run
identical work done repeatedly: embeddings, tool results, static context blocks
per-stage budgets that fail fast, or one global timeout that ships the worst case to the user
the stages nobody can measure; you cannot attack what you cannot see
One structured report at the repo root — or in reports/, if you keep one — the same shape every time, ready for a teammate — or the optional Studio — to act on.
Every Goal Prompt follows the same four steps, so results are consistent and repeatable — no matter which one you run.
Pick the 1–3 user-facing runs that matter.
Stage decomposition — queue wait, retrieval, prompt assembly, time-to-first-token, generation, tool calls, post-proces…
Build the budget.
Create LATENCY.md at repo root.
Copy it and paste it into your agent inside the repo you want checked.
Install the goal plugin once — two commands — then just type /goal:latency-budget-audit.
/plugin marketplace add GhostlyGawd/goal-prompts/plugin install goal@goal-promptsOr install only this Goal Prompt as /goal-latency-budget-audit:
curl -fsSL https://goal-prompts.vercel.app/install | BRIEF=51 shLet an agent fetch it mid-conversation, or pull the raw Goal Prompt by URL.
https://goal-prompts.vercel.app/raw/51.mdNothing hidden — this is the whole Goal Prompt, verbatim. Read it in a minute, edit it, or copy it as-is.
# Goal: Latency Budget Audit You are working inside this repo. Mission: decompose the latency of the runs users actually feel — p50 and p95, stage by stage — and name the stages worth attacking versus the ones already fine. Read-only pass. Your only write is the report file. Read existing timers, traces, and logs where they exist; estimate from code where they don't. ## Phase 1 — Define the runs - Pick the 1–3 user-facing runs that matter: a chat turn, a job, a page, a pipeline. - Find what timing already exists — logs, traces, metrics, or nothing — and note precisely which stages are measurable today and which will be estimates. ## Phase 2 — Audit through 8 lenses 1. **Stage decomposition** — queue wait, retrieval, prompt assembly, time-to-first-token, generation, tool calls, post-processing: a number or an honest estimate for each 2. **The p95 gap** — what makes the slow tail slow: retries, cold starts, long inputs, contended resources; p95 is a different animal from p50 and gets its own diagnosis 3. **Serial that could be parallel** — awaits in sequence with no data dependency; fan-out opportunities in tool calls and retrieval 4. **Perceived vs actual** — time-to-first-token and streaming: what could render early; a fast-feeling eight seconds beats a silent five 5. **Payload fit** — prompt and context sizes versus need; the tokens that cost milliseconds on every single run 6. **Cache absences** — identical work done repeatedly: embeddings, tool results, static context blocks 7. **Timeout architecture** — per-stage budgets that fail fast, or one global timeout that ships the worst case to the user 8. **Instrumentation gaps** — the stages nobody can measure; you cannot attack what you cannot see ## Phase 3 — Curate - Build the budget: stage · p50 · p95 · share of total · verdict (fine / attack). - Rank attacks by seconds saved on the p95 path per unit of effort. ## Phase 4 — Report Create `LATENCY.md` at repo root: 1. **The budget table** — the full decomposition, measured versus estimated flagged honestly 2. **The p95 story** — what the slow tail is made of 3. **Attacks** — ranked; parallelization and streaming usually beat micro-optimizations 4. **Instrumentation first** — the timers to add wherever an estimate stood in for a number Start the report with today's date. If `LATENCY.md` already exists from a previous run, read it first and lead with what changed since. ## Rules - Every number is labeled measured or estimated — never launder a guess - Optimize the user's clock, not the flame graph's aesthetics - No user-facing request path in this repo? Say so in a one-paragraph null report and stop — a null result is a valid finding. - If a `reports/` directory exists at the repo root, write the report there instead of the root. - Before asking, present the top findings as a ranked list in plain words - Report only — end by asking which attacks to make
reports/ directory exists at the repo root, write the report there instead of the root.The broad latency pass — wasted renders, main-thread stalls, startup waterfalls — ranked by what the user actually feels on common paths.
Simulate 10x users, data, and traffic on paper — find what breaks first, at what threshold, and the cheapest mitigation.
The database access patterns that fall over as data and traffic grow — N+1s, missing indexes, unbounded reads, and lock contention.
What the browser actually downloads — oversized bundles, unsplit code, heavy dependencies, and unoptimized assets that slow first paint.
Runs inside these playbooks — curated sequences you can launch with one paste: