원클릭으로
bench-check
Run benchmarks against a saved baseline, detect performance regressions, and update the baseline — guards against silent slowdowns
Codex 또는 Claude로 설치 이 Prompt를 복사해 Codex, Claude 또는 다른 어시스턴트에 붙여 넣으면 Skill 페이지를 검토하고 설치를 진행할 수 있습니다.
메뉴
Run benchmarks against a saved baseline, detect performance regressions, and update the baseline — guards against silent slowdowns
Codex 또는 Claude로 설치 이 Prompt를 복사해 Codex, Claude 또는 다른 어시스턴트에 붙여 넣으면 Skill 페이지를 검토하고 설치를 진행할 수 있습니다.
SOC 직업 분류 기준
Adopt extracted helpers — find dead symbols from forge, wire them into consumers, replace duplicated inline patterns, and gate on dead-symbol delta (Titan Paradigm Phase 4.5)
Adopt extracted helpers — find dead symbols from forge, wire them into consumers, replace duplicated inline patterns, and gate on dead-symbol delta (Titan Paradigm Phase 4.5)
Validate staged changes — codegraph checks + project lint/build/test, auto-rollback on failure, pass/fail commit gate (Titan Paradigm Phase 4)
Audit codebase files against the 4-pillar quality manifesto using RECON work batches, with batch processing and context budget management (Titan Paradigm Phase 2)
Map a codebase's dependency graph, identify hotspots, name logical domains, propose work batches, and produce a ranked priority queue for autonomous cleanup (Titan Paradigm Phase 1)
Local repo maintenance — clean stale worktrees, remove dirt files, sync with main, update codegraph, prune branches, and verify repo health
| name | bench-check |
| description | Run benchmarks against a saved baseline, detect performance regressions, and update the baseline — guards against silent slowdowns |
| argument-hint | [--save-baseline | --compare-only | --threshold 15] (default: compare + save) |
| allowed-tools | Bash, Read, Write, Edit, Glob, Grep, Agent |
Run the project's benchmark suite, compare results against a saved baseline, flag regressions beyond a threshold, and optionally update the baseline. Prevents silent performance degradation between releases.
$ARGUMENTS may contain:
--save-baseline — run benchmarks and save as the new baseline (no comparison)--compare-only — compare against baseline without updating it--threshold N — regression threshold percentage (default: 15%)scripts/benchmark.js (build speed, query latency)scripts/incremental-benchmark.js (incremental build tiers)scripts/query-benchmark.js (query depth scaling)scripts/embedding-benchmark.js (search recall) — optional, skip if embedding deps missing$ARGUMENTS:
SAVE_ONLY=true if --save-baselineCOMPARE_ONLY=true if --compare-onlyTHRESHOLD=N from --threshold N (default: 15)generated/bench-check/baseline.json
--save-baseline: warn that this will be an initial baseline runRun each benchmark script and collect results. Each script outputs JSON to stdout.
output=$(timeout 300 node scripts/benchmark.js 2>&1)
exit_code=$?
If exit_code is 124: record "timeout" for this suite and skip to the next suite.
Else if exit_code is non-zero: record "error: $output" for this suite and skip to the next suite.
Extract:
buildTime (ms) — per engine (native, WASM)queryTime (ms) — per query typenodeCount, edgeCount — graph sizeoutput=$(timeout 300 node scripts/incremental-benchmark.js 2>&1)
exit_code=$?
If exit_code is 124: record "timeout" for this suite and skip to the next suite.
Else if exit_code is non-zero: record "error: $output" for this suite and skip to the next suite.
Extract:
noOpRebuild (ms) — time for no-change rebuildsingleFileRebuild (ms) — time after one file changeimportResolution (ms) — resolution throughputoutput=$(timeout 300 node scripts/query-benchmark.js 2>&1)
exit_code=$?
If exit_code is 124: record "timeout" for this suite and skip to the next suite.
Else if exit_code is non-zero: record "error: $output" for this suite and skip to the next suite.
Extract:
fnDeps scaling by depthfnImpact scaling by depthdiffImpact latencyoutput=$(timeout 300 node scripts/embedding-benchmark.js 2>&1)
exit_code=$?
If exit_code is 124: record "timeout" for this suite and skip to the next suite.
Else if exit_code is non-zero: record "error: $output" for this suite and skip to the next suite.
Extract:
embeddingTime (ms)recall at Hit@1, Hit@3, Hit@5, Hit@10Timeout: Each benchmark gets 5 minutes max (
timeout 300). Exit code 124 indicates timeout — record"timeout"for that suite and continue.
Errors: If a benchmark script fails (non-zero exit), record
"error: <message>"and continue with remaining benchmarks.
Build a flat metrics object from all benchmark results:
{
"timestamp": "<ISO 8601>",
"version": "<from package.json>",
"gitRef": "<current HEAD short SHA>",
"metrics": {
"build.native.ms": 1234,
"build.wasm.ms": 2345,
"query.fnDeps.depth3.ms": 45,
"query.fnImpact.depth3.ms": 67,
"query.diffImpact.ms": 89,
"incremental.noOp.ms": 12,
"incremental.singleFile.ms": 34,
"incremental.importResolution.ms": 56,
"graph.nodes": 500,
"graph.edges": 1200,
"embedding.time.ms": 3000,
"embedding.recall.hit1": 0.85,
"embedding.recall.hit5": 0.95
}
}
Adapt the metric keys to match whatever the benchmark scripts actually output — the above are representative. The goal is a flat key→number map for easy comparison.
Skip this phase if SAVE_ONLY=true or no baseline exists.
For each metric in the current run:
baseline == 0, mark the delta as "N/A — baseline was zero" and treat the metric as informational only (not a regression or improvement)delta_pct = ((current - baseline) / baseline) * 100THRESHOLD% (for time metrics) or decreased by more than THRESHOLD% (for recall/quality metrics)THRESHOLD% (time) or increased (quality)Direction awareness: For latency metrics (ms), higher = worse. For recall/quality metrics, higher = better. For count metrics (nodes, edges), changes are informational only — not regressions.
| Metric | Baseline | Current | Delta | Status |
|---|---|---|---|---|
| build.native.ms | 1200 | 1500 | +25% | REGRESSION |
| query.fnDeps.depth3.ms | 45 | 43 | -4.4% | stable |
Before evaluating verdicts, verify that at least one benchmark produced valid numeric results.
If metrics is empty (all suites produced "error" or "timeout" records):
BENCH-CHECK ABORTED — no valid benchmark results (all suites failed or timed out)ABORTED.Based on comparison results:
BENCH-CHECK PASSED — no regressions beyond {THRESHOLD}% thresholdCOMPARE_ONLY: update baseline with current resultsBENCH-CHECK FAILED — {N} regressions detectedgit log --oneline <baseline-ref>..HEAD to find what changedcodegraph diff-impact <baseline-ref> -T to find structural changesCOMPARE_ONLY is set: print a warning that no baseline exists and stop here — do not proceed to Phase 5 or Phase 6. No baseline is saved and no report is written.BENCH-CHECK — initial baseline saved and save current results as baseline--save-baseline)BENCH-CHECK — baseline overwritten (previous: <old gitRef>, new: <new gitRef>)Skip this phase if COMPARE_ONLY is set. Compare-only mode never writes or commits baselines.
Skip this phase if regressions were detected in Phase 4. The baseline is only updated on a clean run.
Skip this phase if the ABORTED pre-condition was triggered in Phase 4. The baseline must not be overwritten with empty data.
When saving (initial run, --save-baseline, or passed comparison):
Write to generated/bench-check/baseline.json:
{
"savedAt": "<ISO 8601>",
"version": "<package version>",
"gitRef": "<HEAD short SHA>",
"threshold": $THRESHOLD,
"metrics": { ... }
}
Also append a one-line summary to generated/bench-check/history.ndjson:
{"timestamp":"...","version":"...","gitRef":"...","metrics":{...}}
This creates a running log of benchmark results over time.
After writing both files, commit the baseline so it is a shared reference point:
git add generated/bench-check/baseline.json generated/bench-check/history.ndjson
git diff --cached --quiet -- generated/bench-check/baseline.json generated/bench-check/history.ndjson || git commit generated/bench-check/baseline.json generated/bench-check/history.ndjson -m "chore: update bench-check baseline (<gitRef>)"
git addfirst so that newly created files (first run) are staged;--cachedthen detects them correctly. Without this,git diff --quietignores untracked files and the baseline is never committed on the first run.
Skip this phase (write no report) if COMPARE_ONLY was set and no baseline existed, AND the ABORTED pre-condition was not triggered. That early-exit case was already handled in Phase 4 — writing a "BASELINE SAVED" report here would be misleading since no baseline was saved. When ABORTED, always write the ABORTED report regardless of other flags.
Write a human-readable report to generated/bench-check/BENCH_REPORT_<date>.md.
If the ABORTED pre-condition was triggered (no valid benchmark results): write a minimal report — this check MUST come before the SAVE_ONLY/first-run check, because when all benchmarks fail on a --save-baseline or first run, SAVE_ONLY would also be true but no baseline was actually saved:
# Benchmark Report — <date>
**Version:** X.Y.Z | **Git ref:** abc1234 | **Threshold:** $THRESHOLD%
## Verdict: ABORTED — no valid benchmark results
All benchmark suites failed or timed out. See Phase 1 error records for details.
## Raw Results
<!-- Error/timeout records from each suite -->
If SAVE_ONLY is set or no prior baseline existed (first run): write a shortened report — omit the "Comparison vs Baseline" and "Regressions" sections since no comparison was performed:
# Benchmark Report — <date>
**Version:** X.Y.Z | **Git ref:** abc1234 | **Threshold:** $THRESHOLD%
## Verdict: BASELINE SAVED — no comparison performed
## Raw Results
<!-- Full JSON output from each benchmark -->
Otherwise (comparison was performed): write the full report with comparison and verdict:
# Benchmark Report — <date>
**Version:** X.Y.Z | **Git ref:** abc1234 | **Threshold:** $THRESHOLD%
## Verdict: PASSED / FAILED
## Comparison vs Baseline
<!-- Full comparison table with all metrics -->
## Regressions (if any)
<!-- Detail each regression with possible causes -->
## Trend (if history.ndjson has 3+ entries)
<!-- Show trend for key metrics: build time, query time, graph size -->
## Raw Results
<!-- Full JSON output from each benchmark -->
PASSED (0 regressions) | FAILED (N regressions) | BASELINE SAVED | ABORTED (all suites failed)generated/bench-check/ — create the directory if needed