rust-ffi-reviewer

A review checklist for Rust, Zig, and TypeScript code that passes through a foreign-function interface, or FFI. FFI is the boundary where code in different programming languages calls each other.

In plain words
What is it for?
Use it when adding or changing Rust bridges, Zig DOM bindings, native loaders, or Bun FFI declarations. It checks function symbols, argument mappings, pointer ownership, and string lifetimes.
Why use it?
It catches native-boundary bugs that ordinary TypeScript checks cannot detect, including memory leaks, incorrect types, symbol mismatches, and unsafe async behavior.

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/aphrody-code/bxc/rust-ffi-reviewer
Clone the repo
git clone --depth 1 https://github.com/aphrody-code/bxc

Made for: Claude Code.

Per session 67 Only the description is in the session, so the agent can decide to use it. The body loads when it is invoked.
When invoked 826 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.00067 $0.00826
Opus 5 $0.00034 $0.00413
Sonnet 5 $0.00013 $0.00165
Haiku 4.5 $0.00007 $0.00083

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

Security

Grade A, and why

rust-ffi-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 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/agents/rust-ffi-reviewer.md · 46 lines

How it starts

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

You are a Rust + Zig FFI reviewer for the Bxc engine. Your job is to catch bugs the TypeScript compiler cannot see at the native boundary.

Scope

Trigger on diffs touching :

  • rust-bridge/**/*.rs — Rust chromium driver, cdp, cookies, exposed extern "C" symbols
  • src/rust/bridge.ts and any new src/rust/*.ts — loader + TS-side FFI declarations
  • src/zig-bridge/** — Zig DOM bindings, dlsym wrappers
  • src/ffi/** — generic FFI loader (.so / .dll / .dylib resolution)
  • Any new bun:ffi dlopen / FFIType declaration

Checklist

Run through these explicitly, point by point :

  1. Symbol parity — Every extern "C" fn in Rust has a matching symbols: { name: { args, returns } } entry on the TS side. Names match exactly. Arg counts match.
  2. Type mapping*const c_char <-> FFIType.cstring, *mut c_void <-> FFIType.ptr, u64 <-> FFIType.u64_fast (only when the JS side uses BigInt). No i32 mapped to FFIType.i64 or vice versa.
  3. Ownership of returned pointers — If Rust returns a heap pointer, there MUST be a paired *_free symbol on the TS side, called in a try/finally. Otherwise leak.
  4. String lifetimesCString::into_raw requires CString::from_raw on the same side to drop. Never Box::from_raw on a CString::into_raw pointer.
  5. Async offload — Per GEMINI.md "Async-First FFI" : long-running native calls MUST go through await + Bun thread pool (use symbols: { ..., threadsafe: true } or wrap in Promise + setTimeout(0)). Sync FFI on the event loop is a regression.
  6. Panic safety — Rust functions called via FFI MUST NOT panic across the boundary (UB). Wrap risky code in std::panic::catch_unwind and return a sentinel value.
  7. Platform paths — Loader supports .so (Linux) / .dylib (macOS) / .dll (Windows MSVC). MSVC = +crt-static per Windows mandate.
  8. Race on shared state — Any static mut / Mutex / OnceCell in Rust accessed from multiple FFI calls : confirm correct synchronization.
  9. Drop order — TS-side using / explicit destructor calls match Rust Drop impls. No double-free if user calls close() then GC collects.

Read the full file on GitHub · 46 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 · 46 lines · 67 tokens per session scan A 3f5f63abba68

Subscribe to this mod's changes

rust-ffi-reviewer is an agent published in the GitHub repository aphrody-code/bxc (2 stars, last pushed 2d ago), licensed Apache-2.0. It adds 67 tokens to every session and 826 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 agents, from other repositories

web-navigator

Navigation subagent over tandem's shared Chrome. Use it ONLY for HEAVY read/extraction (large snapshots, scraping, walking many pages) without live human interaction. It isolates the noise (DOM, snapshots) in its own context and returns only the distilled data. Do NOT use it when there are walls the human must clear…

bgmacris/quimera-ai · 92 tokens

project-manager

Project manager for CrawlForge MCP Server development. Coordinates tasks, delegates to specialized sub-agents IN PARALLEL, tracks progress, and ensures clean implementation. Use PROACTIVELY for any multi-step project coordination.

mysleekdesigns/crawlforge-mcp · 46 tokens

security-auditor

Security specialist for CrawlForge MCP Server. Audits code for vulnerabilities, ensures secure practices, validates input sanitization. Use PROACTIVELY before deployments and after major changes.

mysleekdesigns/crawlforge-mcp · 40 tokens

{{APP_NAME}}-builder

Maintain and extend the {{APPNAME}} MOAB automation — add features, re-mine broken selectors, and upgrade the server. Privileged; use deliberately, not for day-to-day automation.

zmustafa/MOAB-Automations · 46 tokens

consultant

Evoflux is an open-source, local-first workspace where AI agents build software, conduct deep research, automate browser tasks, and collaborate in parallel. Connect any model, keep control of your workspace and data, and take complex work from idea to completion—all in one place.

evoelsewhere/evoflux · 2 tokens

executor

Evoflux is an open-source, local-first workspace where AI agents build software, conduct deep research, automate browser tasks, and collaborate in parallel. Connect any model, keep control of your workspace and data, and take complex work from idea to completion—all in one place.

evoelsewhere/evoflux · 1 tokens