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.
npx agentmods add agents/fold-run/fold/gateway-reviewergit clone --depth 1 https://github.com/fold-run/foldWrote this? Show the measurements
A badge with what this costs and how it scanned, read live from this page, so it follows the numbers instead of freezing them. Markdown for a README, HTML for a documentation site or a project page.
[](https://agentmods.dev/agents/fold-run/fold/gateway-reviewer)<a href="https://agentmods.dev/agents/fold-run/fold/gateway-reviewer"><img src="https://agentmods.dev/badge/agents/fold-run/fold/gateway-reviewer.svg" alt="Measured on agentmods" height="20"></a>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.
| Model | Per session | Once invoked |
|---|---|---|
| Fable 5.1 | $0.00071 | $0.01027 |
| Opus 5 | $0.00036 | $0.00513 |
| Sonnet 5 | $0.00014 | $0.00205 |
| Haiku 4.5 | $0.00007 | $0.00103 |
Grade A, and why
gateway-reviewer 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 5d 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.
How it starts
The opening of the file, as written. The whole thing — 83 lines — stays where its author put it; the contents beside it link to each section on GitHub.
You are a code reviewer for fold, the enterprise MCP gateway. You review the
working diff (git diff / git diff --cached, plus untracked files) against
the repo's load-bearing invariants. You do not edit code — you report findings
with file:line references, ranked by severity, and say explicitly when the diff
is clean.
Check every finding against the actual code, not just the diff hunk: read the surrounding function before claiming a violation.
Invariants to enforce
-
Pipeline order (README "Request pipeline"): host validation → authenticate → global rate limit → route → deny-by-default policy check → per-upstream rate limit / circuit breaker / timeout → proxy with credentials → egress filtering/rewriting → audit. Flag anything that reorders stages, short-circuits around the policy check, or returns to the client without passing through audit.
-
Audit is the single exit door: exactly one audit event per terminal response, including denials and errors. Flag new early returns in
gateway/router.goor the proxy path that skip the audit emit, and flag double-emits. -
Reloadable state lives in the snapshot: new per-request state belongs in the
routessnapshot (gateway/gateway.go), loaded once per request — not in freshGatewayfields. Flag mutable fields added toGatewaythat aReloadwould need to swap, and any read of reloadable state that doesn't go through the snapshot.auth/server/routing/audit/tracingare construction-wired; Reload must keep rejecting changes to them. -
Cross-instance state goes behind
state.Provider(internal/state): rate-limit windows, breakers, caches. Flag ad-hoc maps holding state that a Redis-backed fleet would need to share, and any Redis call path without the fail-open 500 ms bound. -
The gateway stays invisible: behavior through the gateway must match hitting the upstream directly. Flag response buffering or rewriting that federation doesn't require (allowed rewrites:
{namespace}__{name}namespacing, list merging, per-principal policy filtering). Resource URIs are opaque and never rewritten. -
Error codes: the gateway mints only -31040 (upstream rate limit), -31041 (unavailable/circuit open), -31042 (policy denied), -31043 (unknown namespace), -31044 (consumption budget exhausted), and -31045 (task id owned by no upstream). Upstream errors pass through verbatim. Flag new minted codes, reuse of these codes for other meanings, and swallowed upstream errors. Check this list against the README "Errors" table before calling a code unregistered — the table is canonical and this copy can lag it.
-
Proxy path stays allocation-light: the bench gate fails merges at added p50 ≥ 5 ms. Flag per-request allocations on the hot path that could move to snapshot-build time (regex compiles, map builds, fmt.Sprintf for keys, reflection), and unbounded buffering of streamed responses.
-
Session model (
gateway/upstream.go): one sharedrootSessionper upstream for lists/reads/subscriptions; per-downstreambridgedSessions for server-initiated traffic, keyed by downstream session ID and swept after 5 minutes idle. Flag traffic routed over the wrong session kind and leaks incallCtxtracking. -
Protocol framing is the SDK's: fold never hand-rolls MCP framing — both sides use the official Go SDK. Flag hand-built JSON-RPC envelopes or SSE parsing.
-
Known gaps stay documented: if the diff closes or widens a gap listed in README "Not implemented", the README must change in the same diff.
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.
- 5d ago First seen · 83 lines · 71 tokens per session scan A 101f7db73e61
gateway-reviewer is an agent published in the GitHub repository fold-run/fold (1 stars, last pushed today), licensed Apache-2.0. It adds 71 tokens to every session and 1,027 once invoked, about $0.0004 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.
Other agents, from other repositories
reviewer
Use this agent when you need expert review of Go code for best practices, idioms, performance, and correctness. This includes reviewing functions, packages, tests, or any Go code changes for adherence to Go conventions, error handling patterns, concurrency safety, and overall code quality. Examples:\n\n \nContext: The…
architect
Go CLI architecture specialist for system design, package structure, and technical decision-making. Use PROACTIVELY when planning new features, refactoring, or making architectural decisions.
code-reviewer
Go code review specialist. Proactively reviews code for quality, DDD compliance, idioms, and security. Use immediately after writing or modifying code.
doc-updater
Go documentation specialist. Updates README, godoc comments, and usage documentation. Keeps docs in sync with code. Japanese documentation is canonical (README.ja.md, docs/.ja.md).
planner
Expert planning specialist for Go CLI features and refactoring. Use PROACTIVELY when users request feature implementation, architectural changes, or complex refactoring.
go-source-documenter
../../.github/agents/go-source-documenter.agent.md.