serejaris/personal-corp-os / skills/benchmark
benchmark
VerifiedUse when choosing between engines or models for an agent pipeline and the answer must come from measurement on your own data, not from marketing pages: speech recognition for meeting recordings, the model that turns a transcript into notes, the critic model that checks it. Runs every variant in an isolated container, measures time, cost per hour of input (USD and RUB, with price source and date) and quality (WER/CER and course terms for ASR; code checks plus a judge of a different model for LLM steps), writes results.json/csv and one static analytics page. Triggers on "бенчмарк", "сравни движки", "сколько стоит час записи", "какую модель взять для пайплайна", "benchmark the pipeline", "compare ASR engines".
| File | Kind | Size |
|---|---|---|
| SKILL.md | skill md | 7.3 KB |
| examples/adapter_example.py | script | 4.9 KB |
| prices.example.json | config | 3.3 KB |
| scripts/asr.py | script | 10.8 KB |
| scripts/claude_step.py | script | 5.8 KB |
| scripts/common.py | script | 2.1 KB |
| scripts/llm.py | script | 4.0 KB |
| scripts/report.py | script | 10.4 KB |
| scripts/score.py | script | 14.6 KB |
| task.example.json | config | 1.7 KB |
scripts/claude_step.py
View on GitHub"""One headless agent step (`claude -p`) against a chosen model provider.
Claude Code is the harness for every LLM variant, so the model is the only thing
that changes between variants: same tools, same prompt, same permissions.
Non-Anthropic models are reached through Anthropic-compatible endpoints.
from claude_step import run_step
res = run_step(prompt, cwd=Path("..."), provider="zai", model="glm-5.3",
log_dir=Path("logs"), name="canon")
res -> {"ok", "wall_s", "num_turns", "usage": {...}, "model_usage": {...},
"cost_usd_reported", "result", "error"}
Providers (keys come from env; values are never written to logs):
zai https://api.z.ai/api/anthropic ZAI_API_KEY
openrouter https://openrouter.ai/api OPENROUTER_API_KEY
deepseek https://api.deepseek.com/anthropic DEEPSEEK_API_KEY
anthropic-api Anthropic API ANTHROPIC_API_KEY
anthropic-oauth Claude subscription setup-token CLAUDE_CODE_OAUTH_TOKEN
anthropic-local the login already present on this machine (no key passed)
"""
from __future__ import annotations
import json
import os
import shutil
import subprocess
import time
from pathlib import Path
PROVIDERS = {
"zai": {"base_url": "https://api.z.ai/api/anthropic", "token_env": "ZAI_API_KEY"},
"openrouter": {"base_url": "https://openrouter.ai/api", "token_env": "OPENROUTER_API_KEY"},
"deepseek": {"base_url": "https://api.deepseek.com/anthropic", "token_env": "DEEPSEEK_API_KEY"},
"anthropic-api": {"api_key_env": "ANTHROPIC_API_KEY"},
"anthropic-oauth": {"oauth_env": "CLAUDE_CODE_OAUTH_TOKEN"},
"anthropic-local": {},
}
DEFAULT_DISALLOWED = ["Bash(git:*)", "Bash(gh:*)", "Bash(sudo:*)", "Bash(curl:*)", "Bash(wget:*)", "Bash(ssh:*)",
"WebFetch", "WebSearch"]
def provider_env(provider: str, model: str) -> dict:
cfg = PROVIDERS[provider]
keep = ("HOME", "LANG", "LC_ALL", "USER", "LOGNAME", "TERM", "TMPDIR")
env = {k: os.environ[k] for k in keep if k in os.environ}
env["PATH"] = os.environ.get("PATH", "/usr/local/bin:/usr/bin:/bin")
env["CLAUDE_CODE_DISABLE_NONESSENTIAL_TRAFFIC"] = "1"
env["API_TIMEOUT_MS"] = "3000000"
if "base_url" in cfg:
env["ANTHROPIC_BASE_URL"] = cfg["base_url"]
env["ANTHROPIC_AUTH_TOKEN"] = os.environ[cfg["token_env"]]
env["ANTHROPIC_API_KEY"] = ""
# background and sub-agent calls must hit the same model, or the variant is mixed
for tier in ("OPUS", "SONNET", "HAIKU"):
env[f"ANTHROPIC_DEFAULT_{tier}_MODEL"] = model
env["CLAUDE_CODE_SUBAGENT_MODEL"] = model
elif "api_key_env" in cfg:
env["ANTHROPIC_API_KEY"] = os.environ[cfg["api_key_env"]]
elif "oauth_env" in cfg:
env["CLAUDE_CODE_OAUTH_TOKEN"] = os.environ[cfg["oauth_env"]]
return env
def run_step(prompt: str, *, cwd: Path, provider: str, model: str, log_dir: Path, name: str,
timeout: int = 3600, disallowed: list[str] | None = None, claude_bin: str | None = None) -> dict:
claude = claude_bin or os.environ.get("BENCH_CLAUDE") or shutil.which("claude") or "claude"
# --setting-sources project,local: the machine owner's user settings, user agents and user
# CLAUDE.md stay out of the run (a user-defined subagent once joined a benchmark run).
cmd = [claude, "-p", prompt, "--output-format", "json", "--permission-mode", "bypassPermissions",
"--no-session-persistence", "--setting-sources", "project,local",
"--disallowedTools", *(disallowed or DEFAULT_DISALLOWED)]
if model and model != "default":
cmd += ["--model", model]
log_dir.mkdir(parents=True, exist_ok=True)
(log_dir / f"{name}.prompt.md").write_text(prompt, encoding="utf-8")
t0 = time.monotonic()
try:
p = subprocess.run(cmd, cwd=cwd, env=provider_env(provider, model), capture_output=True, text=True,
timeout=timeout)
out, err, code = p.stdout, p.stderr, p.returncode
except subprocess.TimeoutExpired as exc:
out, err, code = (exc.stdout or b"").decode() if isinstance(exc.stdout, bytes) else (exc.stdout or ""), \
f"timeout after {timeout}s", -1
wall = round(time.monotonic() - t0, 2)
(log_dir / f"{name}.stdout.json").write_text(out, encoding="utf-8")
if err.strip():
(log_dir / f"{name}.stderr.txt").write_text(err[-4000:], encoding="utf-8")
res = {"name": name, "provider": provider, "model": model, "wall_s": wall, "exit": code, "ok": False}
try:
data = json.loads(out.strip().splitlines()[-1]) if out.strip() else {}
except json.JSONDecodeError:
data = {}
mu = data.get("modelUsage") or {}
# top-level "usage" covers the main thread only; modelUsage includes sub-agents
totals = {"input_tokens": sum(m.get("inputTokens", 0) for m in mu.values()),
"cache_creation_input_tokens": sum(m.get("cacheCreationInputTokens", 0) for m in mu.values()),
"cache_read_input_tokens": sum(m.get("cacheReadInputTokens", 0) for m in mu.values()),
"output_tokens": sum(m.get("outputTokens", 0) for m in mu.values())}
res.update({
"ok": code == 0 and not data.get("is_error", True),
"num_turns": data.get("num_turns"),
"duration_api_ms": data.get("duration_api_ms"),
"usage": totals if mu else {k: data.get("usage", {}).get(k, 0) for k in
("input_tokens", "cache_creation_input_tokens", "cache_read_input_tokens", "output_tokens")},
"model_usage": mu,
"subagents": (data.get("subagent_stats") or {}).get("by_type", {}),
"cost_usd_reported": data.get("total_cost_usd"),
"result": (data.get("result") or "")[-2000:],
"error": None if code == 0 else (err or out)[-400:],
})
return res
Related skills
| Skill | Stars | Updated | Works with | Status | Install |
|---|---|---|---|---|---|
| writing-skillsobra/superpowersUse when creating new skills, editing existing skills, or verifying skills work before deployment | Stars: 322k | Updated | Claude CodeCodex | Verified | Install |
| xlsxanthropics/skillsUse this skill any time a spreadsheet file is the primary input or output. This means any task where the user wants to: open, read, edit, or fix an existing .xlsx, .xlsm, .xltx, .csv, or .tsv file (e.g., adding columns, computing formulas, formatting, charting, cleaning messy data); create a new spreadsheet from scratch or from other data sources; or convert between tabular file formats. Trigger especially when the user references a spreadsheet file by name or path — even casually (like "the xlsx in my downloads") — and wants something done to it or produced from it. Also trigger for cleaning or restructuring messy tabular data files (malformed rows, misplaced headers, junk data) into proper spreadsheets. The deliverable must be a spreadsheet file. Do NOT trigger when the primary deliverable is a Word document, HTML report, standalone Python script, database pipeline, or Google Sheets API integration, even if tabular data is involved. | Stars: 198k | Updated | Claude CodeCodex | Verified | Install |
| shipping-and-launchaddyosmani/agent-skillsPrepares production launches. Use when preparing to deploy to production, or when asking what needs to be in place before shipping. Use when you need a pre-launch checklist, when setting up monitoring, when planning a staged rollout, or when you need a rollback strategy. | Stars: 119k | Updated | Claude CodeCodex | Verified | Install |
| childhoodthedotmack/claude-memBabysit a shipped release after merge, publication, or deployment. Verify published packages, production behavior, installed plugins, and late CI or user reports until the observation window is clean; use babysit for PR readiness before release. | Stars: 118k | Updated | Claude CodeCodex | Verified | Install |