perf

A performance guide for a gateway that forwards requests to other services. It defines tests and profiling steps for measuring added delay and memory allocations.

In plain words
What is it for?
Use it when gateway benchmarks fail, when changing request-handling code, or when investigating latency and memory use.
Why use it?
It replaces guesses about speed with repeatable measurements and helps locate the code causing slowdowns.

Skill for Claude CodeCodex

Install

Getting it into your agent

One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.

agentmods
npx agentmods add skills/fold-run/fold/perf
Any agent
npx skills add fold-run/fold --skill perf
Clone the repo
git clone --depth 1 https://github.com/fold-run/fold

Made for: Claude Code, Codex.

Per session 63 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 607 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. Scan, not verified.
Origin original No closer match found in the catalogue.
Token cost

What it costs to keep this loaded

Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.

ModelPer sessionOnce invoked
Fable 5 $0.00063 $0.00607
Opus 5 $0.00032 $0.00303
Sonnet 5 $0.00013 $0.00121
Haiku 4.5 $0.00006 $0.00061

Measured 2d ago against content hash 22720d0dc8cb, method: parsed. Prices are Anthropic first-party input rates as of 2026-08-30, from the pricing page.

Security

Grade A, and why

perf scanned grade A with 0 findings against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured 2d ago.

A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.

Nothing flagged

None of the 26 patterns this scan looks for appear in this file: no shell pipes, no recursive deletes, no credential paths, no hidden text, no instruction-override or anti-refusal phrasing, no agent-config snooping. That is not a guarantee, it is the absence of the things that are checkable.

.claude/skills/perf/SKILL.md · 51 lines

How it starts

The opening of the file, as written. The whole thing — 51 lines — stays where its author put it; the contents beside it link to each section on GitHub.

fold proxy-path performance

The merge gate: added p50 through the gateway < 5 ms (bench/latency_test.go TestAddedLatencyGate, skipped unless FOLD_BENCH=1). Performance here is a test, not a vibe — every claim needs a BENCH_RESULT number behind it.

The gate has a blind spot, by design. Its fixture is one upstream with one trivial tool, so it measures the proxy hop and nothing that scales with federation size. For anything touching the list path — merge, policy filtering, namespacing, cursors — the instrument is go test ./gateway -run '^$' -bench BenchmarkFederatedListTools -benchmem, and allocations per request are the signal to watch (they are stable across machines in a way ns/op is not). FOLD_LOAD_UPSTREAMS / FOLD_LOAD_TOOLS give tools/perf the same federated shape.

Workflow

  1. Measure: launch the bench-profiler agent (yellow) to run the gate, get a clean baseline via stash-bisect if the working diff touched the proxy path, and profile if the gate is blown. It returns numbers and top contributors with file:line.

  2. Fix using the repo's pattern — per-request work moves to snapshot-build time:

    • Anything derivable from config alone (compiled matchers, key prefixes, indexes, namespace tables) is computed once when the routes snapshot is built and read per-request from the snapshot.
    • Hot-path keys: preallocate/intern rather than fmt.Sprintf per request.
    • Never fix latency by buffering less correctly — streaming pass-through is an invisibility requirement, not an optimization.
    • Never fix by loosening the gate threshold or skipping the bench.
  3. Verify: re-run make bench 2–3 times, then make race (snapshot precomputation moves state — races follow), then make check.

  4. Report the before/after BENCH_RESULT lines verbatim.

When the gate fails in CI but passes locally

CI runners are slower and noisier. Compare the CI run's BENCH_RESULT against recent green runs (gh run view --log on both) before concluding regression vs flake. A genuine regression shows in added_p50 relative to direct_p50, not in absolute numbers.

Read the full file on GitHub · 51 lines

Changes

What this file has done since we first saw it

Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.

  1. 2d ago First seen · 51 lines · 63 tokens per session scan A 22720d0dc8cb

Subscribe to this mod's changes

perf is a skill published in the GitHub repository fold-run/fold (1 stars, last pushed 2d ago), licensed Apache-2.0. It adds 63 tokens to every session and 607 once invoked, about $0.0003 per session on Opus 5. A static security scan graded it A with 0 findings. No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-31.

Related

Other skills, from other repositories

hotplex-release

通过判断 SemVer 影响、整理 CHANGELOG、对账版本面和验证发布输入来准备或发布 HotPlex 版本。不要用于主机二进制更新、运行时诊断或文档巡逻。.

hrygo/hotplex · 52 tokens

hotplex-docs-patrol

维护 HotPlex 当前文档,将代码、配置、API 或发布变更映射到 BFS 可达文档,只修复已验证的文档漂移。不要用于普通润色、运行时诊断或版本发布。.

hrygo/hotplex · 57 tokens

hotplex-stt-tts

初始化或修复 HotPlex 本地 STT 和 MOSS TTS 运行时,包括 Python 依赖、官方模型、配置和验收。仅在明确授权主机变更时使用;只读检查请使用 hotplex-cli 或 hotplex-diagnostics。.

hrygo/hotplex · 65 tokens

hotplex-diagnostics

深入诊断 HotPlex Gateway、Worker、Session、日志或反馈链异常。普通 status/doctor/security/config 只读检查属于 hotplex-cli;安装、更新、重启、配置写入和 Admin 变更属于 hotplex-operator。.

hrygo/hotplex · 59 tokens

hotplex-cli

使用 HotPlex CLI 处理 Cron、明确请求的 Slack 操作、普通用户聊天命令指引,以及只读 status、doctor、security、config 诊断。不要用于飞书写操作、发布、服务安装、二进制更新或 Admin 变更。.

hrygo/hotplex · 63 tokens

hotplex-operator

运维或初始化 HotPlex 主机,覆盖首次 onboard、服务安装/启动、二进制更新、主机配置、审计检查和 Admin 变更。仅在明确授权的 operator 上下文中使用。.

hrygo/hotplex · 54 tokens