Speed — does it scale?
Brief 51

Latency Budget Audit

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.

LATENCY.md4 phases8 lenses~2.9k chars

Free & open · no signup · read-only — it ends by asking · nothing leaves your machine

What it does

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.

What it looks for

8 lenses it looks through

Phase 2 sweeps the codebase through every one of these, citing file and line for each finding.

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

The deliverable

What lands in your repo

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.

LATENCY.md
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
One file. Evidence-backed. It ends by asking before touching anything.
How it works

What it makes the agent do

Every Goal Prompt follows the same four steps, so results are consistent and repeatable — no matter which one you run.

1
Phase 1

Define the runs

Pick the 1–3 user-facing runs that matter.

2
Phase 2

Audit through 8 lenses

Stage decomposition — queue wait, retrieval, prompt assembly, time-to-first-token, generation, tool calls, post-proces…

3
Phase 3

Curate

Build the budget.

4
Phase 4

Report

Create LATENCY.md at repo root.

Get started

Three ways to run this Goal Prompt

01 · COPY

Paste it in

Copy it and paste it into your agent inside the repo you want checked.

02 · INSTALL

As a slash command

Install the goal plugin once — two commands — then just type /goal:latency-budget-audit.

1/plugin marketplace add GhostlyGawd/goal-prompts
2/plugin install goal@goal-prompts

Or install only this Goal Prompt as /goal-latency-budget-audit:

curl -fsSL https://goal-prompts.vercel.app/install | BRIEF=51 sh
03 · AGENT

From an agent (MCP)

Let an agent fetch it mid-conversation, or pull the raw Goal Prompt by URL.

https://goal-prompts.vercel.app/raw/51.md
Transparency

The exact prompt

Nothing hidden — this is the whole Goal Prompt, verbatim. Read it in a minute, edit it, or copy it as-is.

Read the full brief (2,912 characters)
# 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

House rules for this Goal Prompt

  • 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
Keep exploring

More Speed briefs

Runs inside these playbooks — curated sequences you can launch with one paste: