agentleFS
kvantatechkvantatech/RedLine/.github/skills/compare-to-baseline/SKILL.md

compare-to-baseline

Skill1 starsChanged 3 months agoMITView on GitHub

Type: skill (deterministic) · Used by: perf-run-one, perf-sweep, run-k6-action gate · Status: LIVE (P1) You will compare the parsed run contract against the team's saved baseline and emit a verdict. Follow these steps exactly — no model judgment. Required: - run_id — string; used to locate reports/<run_id>/contract.json - team — e.g. demo-web - profile — e.g. api-benchmark, browser-journey, load, spike, soak, stress - exit_code — integer from run-k6-script output Reject and STOP if: - reports/<run_id>/contract.json does not exist If the…

The file

We split this skill into the rules it gives an agent

4 rules. About 0 are common, 1 is distinctive, and 3 are very specific to this project.

  • ≈0

    Common · estimate

    Many files like this have a rule of this kind.

  • ≈1

    Distinctive · estimate

    This author's own choices. Worth a look.

  • 3

    Very specific

    Tied to their project's names, files or tools. Probably skip.

  • Common
  • Distinctive
  • Very specific
  1. Very specific:

    If the mapped baseline file does not exist → emit overall_verdict: "no-baseline" and STOP (not an error.

    line 23
  2. Very specific:

    Env guard: after reading the baseline, verify its env field matches the run's env input.

    line 31
  3. Distinctive:

    Never score a run against another environment's thresholds.

    line 33
  4. Very specific:

    Read, Write, Bash (only to run node compare-core.js) — no MCP, no model calls.

    line 128

≈ “Common” is an estimate: at least 1 in 5 of the 350,495 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.

Keep what fits and drop the rest. Your version, ready for your agents.
Files
SKILL.md

compare-to-baseline

Compare a new run against the saved baseline → green / red.

Type: skill (deterministic) · Used by: perf-run-one, perf-sweep, run-k6-action gate · Status: LIVE (P1)


Prompt

You will compare the parsed run contract against the team's saved baseline and emit a verdict. Follow these steps exactly — no model judgment.

1 — Validate inputs

Required:

  • run_id — string; used to locate reports/<run_id>/contract.json
  • team — e.g. demo-web
  • profile — e.g. api-benchmark, browser-journey, load, spike, soak, stress
  • exit_code — integer from run-k6-script output

Reject and STOP if:

  • reports/<run_id>/contract.json does not exist

If the mapped baseline file does not exist → emit overall_verdict: "no-baseline" and STOP (not an error; baselines are seeded at P2).

Baseline filename mapping (env-aware):

  • env == stg → baselines/<team>.<profile>.json (stg is the default; no suffix)
  • env != stg → baselines/<team>.<profile>.<env>.json (e.g. baselines/demo-web.api-benchmark.prod.json)

e.g. demo-web + api-benchmark + stg → baselines/demo-web.api-benchmark.json

Env guard: after reading the baseline, verify its env field matches the run's env input. Mismatch → emit overall_verdict: "no-baseline" with reason "env mismatch: baseline=<x>, run=<y>" and STOP. Never score a run against another environment's thresholds.

2 — Read inputs

Read:

  • reports/<run_id>/contract.json
  • baselines/<team>.<profile>.json

3 — Run compare-core logic

Preferred path (guaranteed gate parity): execute the ONE compare-core implementation directly — it handles every step below, writes verdict.json, and prints the summary line:

node .github/actions/run-k6-action/compare-core.js \
  --contract reports/<run_id>/contract.json \
  --baseline baselines/<team>.<profile>.json \
  --exit-code <exit_code> --run-id <run_id> \
  --out reports/<run_id>/verdict.json

Exit 0 covers green/red/no-baseline in report-only mode; read overall_verdict from the written verdict.json. Only fall back to applying the rules manually (below) if Node is unavailable.

Apply the compare-core verdict rules exactly:

a. Exit code 97 → immediate FAIL

b. Missing endpoints → red For each endpoint/metric defined in the baseline, check if it appears in contract.endpoints.

  • Baseline uses endpoints[].name or a top-level metrics object keyed by metric name (browser-journey style)
  • Match by name field in contract endpoints, OR by metric field if present

c. Per-endpoint verdict For each matched endpoint:

p95 == null         → red
p95 <= p95_red_ms   → green
else                → red
error_rate > error_rate_red → red (override)

d. Overall verdict = worst of all endpoint verdicts (fail > red > green)

e. Compute deltas

delta_ms  = p95_ms - p95_red_ms
delta_pct = (delta_ms / p95_red_ms) * 100  (1 decimal)

4 — Write verdict.json

Write to reports/<run_id>/verdict.json:

{
  "run_id": "<run_id>",
  "team": "<team>",
  "profile": "<profile>",
  "env": "<from contract or baseline>",
  "overall_verdict": "green" | "red" | "fail" | "no-baseline",
  "exit_code": <n>,
  "endpoints": [
    {
      "name": "<string>",
      "metric": "<string>",
      "p95_ms": <integer or null>,
      "p95_red_ms": <integer>,
      "delta_ms": <integer>,
      "delta_pct": <float>,
      "verdict": "green" | "red",
      "reason": "<only if not green>"
    }
  ],
  "missing_endpoints": [],
  "summary_line": "<one line: e.g. 'GREEN — GET /api/config p95=668ms (within threshold ≤900ms)' or 'RED — GET /api/config p95=1250ms (threshold 900ms, +350ms +38.9%)'>"
}

5 — Return

Return:

{
  "verdict_path": "reports/<run_id>/verdict.json",
  "overall_verdict": "<verdict>",
  "summary_line": "<one line>"
}

Tools

Read, Write, Bash (only to run node compare-core.js) — no MCP, no model calls.


Data

  • Reads: reports/<run_id>/contract.json, baselines/<team>.<profile>.json
  • Writes: reports/<run_id>/verdict.json

Hard rules

  1. One verdict implementation — this skill applies compare-core logic verbatim. Do not invent a second compare path.
  2. No baseline = no-baseline verdict, not an error — baselines are seeded at P2; before that, the workflow records no-baseline and continues.
  3. Exit 97 = FAIL — never evaluate thresholds on a crashed run.
  4. Missing endpoint = red — a baseline endpoint absent from the contract is always red.
  5. No model calls — zero autonomy; this runs on the gate hot path.

Frozen skill registry: AGENTS.md in this repo

Download now (ZIP)

Does it work?

Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.

No reviews yet

People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.

  • It worked
  • Partly
  • It didn't
What did you use it for? e.g. Reviewing pull requests in a Rails app

Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.

Your trail

Files you open will collect here, so you can find them again.

Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.

Now do this for your own.

Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.