gateway-reviewer

gateway-reviewer is an agent for Claude Code from fold-run/fold. It costs 71 tokens per session (1,027 once invoked), scanned A, original, Apache-2.0.

A code-review agent for checking changes to an enterprise MCP gateway against its architectural rules. An MCP gateway controls how requests are authenticated, routed, limited, proxied, and recorded.

In plain words
What is it for?
Use it after substantial changes to gateway, authentication, policy, or proxy code, especially when checking request flow, error handling, audit coverage, or route allocation.
Why use it?
It catches changes that reorder security stages, skip audit records, misuse reloadable state, or violate other gateway safeguards. It reports findings with file and line references without editing the code.

Agent for Claude Code

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 agents/fold-run/fold/gateway-reviewer
Clone the repo
git clone --depth 1 https://github.com/fold-run/fold

Made for: Claude Code.

Wrote 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.

agentmods badge for gateway-reviewer

README.md
[![agentmods](https://agentmods.dev/badge/agents/fold-run/fold/gateway-reviewer.svg)](https://agentmods.dev/agents/fold-run/fold/gateway-reviewer)
Your own site
<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>
Per session 71 Only the description is in the session, so the agent can decide to use it. The body loads when it is invoked.
When invoked 1,027 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.1 $0.00071 $0.01027
Opus 5 $0.00036 $0.00513
Sonnet 5 $0.00014 $0.00205
Haiku 4.5 $0.00007 $0.00103

Measured 5d ago against content hash 101f7db73e61, method: parsed. Prices are Anthropic first-party input rates as of 2026-09-05, from the pricing page.

Security

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.

.claude/agents/gateway-reviewer.md · 83 lines

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

  1. 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.

  2. Audit is the single exit door: exactly one audit event per terminal response, including denials and errors. Flag new early returns in gateway/router.go or the proxy path that skip the audit emit, and flag double-emits.

  3. Reloadable state lives in the snapshot: new per-request state belongs in the routes snapshot (gateway/gateway.go), loaded once per request — not in fresh Gateway fields. Flag mutable fields added to Gateway that a Reload would need to swap, and any read of reloadable state that doesn't go through the snapshot. auth/server/routing/audit/tracing are construction-wired; Reload must keep rejecting changes to them.

  4. 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.

  5. 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.

  6. 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.

  7. 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.

  8. Session model (gateway/upstream.go): one shared rootSession per upstream for lists/reads/subscriptions; per-downstream bridgedSessions 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 in callCtx tracking.

  9. 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.

  10. 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.

Read the full file on GitHub · 83 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. 5d ago First seen · 83 lines · 71 tokens per session scan A 101f7db73e61

Subscribe to this mod's changes

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.