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 instructions/palnilsson/panda-gateway/claude-mdgit clone --depth 1 https://github.com/PalNilsson/panda-gatewayWrote 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/instructions/palnilsson/panda-gateway/claude-md)<a href="https://agentmods.dev/instructions/palnilsson/panda-gateway/claude-md"><img src="https://agentmods.dev/badge/instructions/palnilsson/panda-gateway/claude-md.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.02824 | $0.02824 |
| Opus 5 | $0.01412 | $0.01412 |
| Sonnet 5 | $0.00565 | $0.00565 |
| Haiku 4.5 | $0.00282 | $0.00282 |
Grade A, and why
panda-gateway CLAUDE.md scanned grade A with 1 finding 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.
Makes network callslowCapability
Not a fault in itself. Listed so you know the mod talks to something, and to what.
curl http://127.0.0.1:8090/healthz How it starts
The opening of the file, as written. The whole thing — 118 lines — stays where its author put it; the contents beside it link to each section on GitHub.
CLAUDE.md
This file provides guidance to Claude Code (claude.ai/code) when working with code in this repository.
Project Overview
PanDA Gateway is a thin, stateless MCP routing layer between the PanDA Monitor (or any MCP client) and upstream MCP servers (Bamboo MCP, PanDA MCP, and future additions). It exposes a single MCP endpoint (Streamable HTTP) and routes each tools/call to the correct upstream based on a namespace prefix in the tool name. It carries no LLM logic, no planning, no synthesis.
Human-facing docs live in docs/: architecture.md (components, design decisions), catalog-and-search.md (tool catalog + RAG), security-and-resilience.md (trust model, hardening, failure recovery — read before any non-local deployment change). This file is the Claude-Code-specific companion to those, not a replacement.
Commands
# Install (runtime)
pip install -e .
# Install for development
pip install -e ".[dev]"
# Install with OpenTelemetry support
pip install -e ".[observability]"
# Run tests
python -m pytest tests/
# Run a single test file
python -m pytest tests/test_registry.py -v
# Lint
flake8 panda_gateway tests
# Type check
pyright
# Run the gateway (HTTP mode)
panda-gateway --config gateway.minimal.toml
# Run in stdio mode (development)
panda-gateway --config gateway.minimal.toml --stdio
# Health check
curl http://127.0.0.1:8090/healthz
Requires Python ≥ 3.11.
Architecture
PanDA Monitor (MCP client)
│ MCP / Streamable HTTP (Bearer token)
▼
┌─────────────────────────────────────────────┐
│ PanDA Gateway │
│ GatewayServer · UpstreamRegistry · Router │
└─────────────────────────────────────────────┘
│ │ │
Bamboo MCP PanDA MCP (future)
bamboo.* panda.*
Module responsibilities
config.py— Pydantic models loaded from TOML. Config path comes from--configCLI flag orPANDA_GATEWAY_CONFIGenv var. Secrets (tokens) are never in the TOML; the file only names the env var or file path that holds them. All models setextra = "forbid": an unknown/misspelled TOML key raises at load time.auth.py— Inbound pure-ASGIBearerAuthMiddleware(constant-time compare; only/healthzis unauthenticated) and outboundTokenProviders:EnvTokenProviderandFileTokenProvider(re-reads the file on every reconnect for OIDC token renewal).registry.py— OneUpstreamHandleper upstream, each running a supervisor task: open transport, initialise aClientSession(bounded byinit_timeout), run the paginatedtools/listprobe (bounded byprobe_timeout, fully following pagination vianextCursor, bounded by_MAX_PROBE_PAGES, committed to the catalog only once all pages succeed) —stateonly becomesUPonce this first probe succeeds, not right afterinitialize()— then the two-tier health loop (liveness ping every 45 s bounded byping_timeout,tools/listprobe every 12 min). On failure — including one reported by the router viareport_failure()for a routed call that hit a broken session — reconnect with exponential backoff + jitter (consecutive-failure count resets after a reconnect completes init and its first probe, not only on clean shutdown).report_failure()is generation-guarded: a stale report about an already-replaced session is a no-op.UpstreamRegistry.start()runs each supervisor behind an outer crash boundary (_supervise) so an unexpected exception in one upstream's lifecycle can never cancel sibling upstreams or the app's own task group — they share oneanyiotask group (seeserver.py/cli.py). Outbound redirects are off by default per upstream (allow_redirects); httpx stripsAuthorizationbut not custom headers likeX-Auth-Tokenon a cross-origin redirect.router.py— Splits<namespace><sep><tool>on the first separator, looks the namespace up in the registry, forwards the call verbatim. Returns JSON-RPC-32602for unknown namespace,-32603for a configured but DOWN upstream. A transport/protocol failure observed here (not a mere call-level timeout, and not a legitimate upstream tool error — those come back as ordinaryisErrorresults, never raised) is reported to the owning handle viareport_failure(), forcing an immediate reconnect instead of waiting for the next scheduled health check.catalog.py— Per-namespace cache of probed tool lists with a SHA-256 fingerprint over the entireToolmodel (not hand-picked fields, so a change tooutputSchema/annotations/title/etc. is detected too), plus a ChromaDBRagIndex(cosine similarity over tool description embeddings) forgateway.search_tools. Reindexing embeds the replacement documents before mutating the collection, thenupserts new entries and removes only stale ones — a failed embed never empties a namespace's index.RagIndex.query(..., namespaces=...)filters results to the caller's currently-UP namespaces so search never suggests an unavailable tool.server.py— Assembles everything into a FastAPI app; registers thegateway.search_toolstool and the/healthzendpoint. Uses a rawCallToolRequesthandler (not the@server.call_tool()decorator) soMcpErrorpropagates as a genuine JSON-RPC error rather than anisErrortool result.observability.py— Optional OTel tracing; no-op when the SDK/endpoint is absent.cli.py— Entry point (panda-gatewayscript), parses--configand--stdioflags.
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 · 118 lines · 2,824 tokens per session scan A 0feaac20cb93
panda-gateway CLAUDE.md is an instructions file published in the GitHub repository PalNilsson/panda-gateway (0 stars, last pushed 1mo ago), licensed Apache-2.0. It adds 2,824 tokens to every session, about $0.0141 per session on Opus 5. A static security scan graded it A with 1 finding (makes network calls). No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-31.
Other instructions, from other repositories
vscode buildNext.instructions.md
Working notes and architecture documentation for the new esbuild-based build system in build/next. Use when making changes to the new build pipeline (transpile/bundle commands, NLS plugin, source-map handling, resource copying, or self-hosting watch tasks).
codex AGENTS.md
AGENTS.md instructions for openai/codex, covering rust/codex-rs, the codex-core crate, code review rules, crate api surface and model visible context.
vscode oss-third-party-notices.instructions.md
Instructions for microsoft/vscode, covering vs code oss third-party-notices pipeline, architecture, pipeline flow in ci, applying the notice (cutover) and fallback chain (never fail the build).
spec-kit AGENTS.md
AGENTS.md instructions for github/spec-kit, covering agents.md, about spec kit and specify, quickstart — add a new integration in 5 steps, integration architecture and integrationmanifest — file tracking.
next.js AGENTS.md
AGENTS.md instructions for vercel/next.js, covering next.js development guide, codebase structure, monorepo overview, core package: packages/next and other important packages.
langchain AGENTS.md
AGENTS.md instructions for langchain-ai/langchain, covering global development guidelines for the langchain monorepo, corridor security analysis, project architecture and context, monorepo structure and development tools & commands.