bxc-rust-ffi

bxc-rust-ffi is a skill for Claude Code from aphrody-code/bxc. It costs 108 tokens per session (879 once invoked), scanned A, original, Apache-2.0.

A Rust-to-Bun bridge for the bxc project, using a compiled native library and a C-compatible interface. Bun is a JavaScript runtime, while FFI lets code in one language call functions written in another.

In plain words
What is it for?
Use it when changing rust-bridge code, Rust crates, Bun integrations, SQLite workspace settings, exported functions, or release builds.
Why use it?
It documents the constraints needed to build and call the Rust code reliably, including shared SQLite dependencies, asynchronous work, errors, and platform-specific libraries.

Skill for Claude Code

Written for Claude Code: shipped in a Claude Code plugin. Also seen: mentions CLAUDE.md.

Part of the bxc plugin — 22 skills, 3 commands shipped together

Good fit Use it when changing rust-bridge code, Rust crates, Bun integrations, SQLite workspace settings, exported functions, or release builds.

Compare 6 skills from other repositories ↓
Install with agentmods
npx agentmods add skills/aphrody-code/bxc/bxc-rust-ffi
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.

Any agent
npx skills add aphrody-code/bxc --skill bxc-rust-ffi
Clone the repo
git clone --depth 1 https://github.com/aphrody-code/bxc

Made for: Claude Code.

Or install bxc, the plugin that ships this one along with the rest of its 22 skills, 3 commands.

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 bxc-rust-ffi

README.md
[![agentmods](https://agentmods.dev/badge/skills/aphrody-code/bxc/bxc-rust-ffi/github.svg)](https://agentmods.dev/skills/aphrody-code/bxc/bxc-rust-ffi)
Your own site
<a href="https://agentmods.dev/skills/aphrody-code/bxc/bxc-rust-ffi"><img src="https://agentmods.dev/badge/skills/aphrody-code/bxc/bxc-rust-ffi/github.svg" alt="Measured on agentmods" height="20"></a>

Or the 80×15 button, for a site that already has a row of RSS and ATOM ones. Only the verdict fits; the numbers stay here.

agentmods 80×15 button for bxc-rust-ffi

Your own site · 80×15
<a href="https://agentmods.dev/skills/aphrody-code/bxc/bxc-rust-ffi"><img src="https://agentmods.dev/badge/skills/aphrody-code/bxc/bxc-rust-ffi.svg" alt="Reviewed on agentmods" width="80" height="20"></a>
Per session 108 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 879 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. A grade says what 26 rules found in the file — not that it is safe.
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.00108 $0.00879
Opus 5.5 $0.00043 $0.00352
Sonnet 5.5 $0.00022 $0.00176
Haiku 4.5 $0.00011 $0.00088

Measured 1mo ago against content hash 1bb287bd6b61, method: parsed. Prices are Anthropic first-party input rates as of 2026-10-07, from the pricing page.

Security

Grade A, and why

bxc-rust-ffi 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 1mo 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.

plugins/bxc/skills/bxc-rust-ffi/SKILL.md · 56 lines

How it starts

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

bxc Rust FFI (cdylib for Bun)

The hot path of bxc lives in Rust, exposed to Bun via cdylib + N-API style FFI (or raw extern "C" with bun:ffi or manual).

Crate Layout (in rust-bridge/)

  • bxc-rust-bridge (the cdylib crate exporting bxc_* symbols)
  • crates/x-client (native X GraphQL/REST + rusqlite store + ranking helpers)
  • crates/x-algorithm (pure Rust port of xai-org/x-algorithm For You ranking, used via FFI or re-exported)

Critical Rules

  • Single rusqlite: libsqlite3-sys "links" = "sqlite3". Only one version of rusqlite (0.37) can be linked in the cdylib. All crates in the workspace must use { workspace = true } for rusqlite.
  • Workspace Cargo.toml: Define [workspace.dependencies] rusqlite = { version = "0.37", features = ["bundled"] } etc. Use in member crates.
  • no_mangle + extern "C": For symbols called from Bun (or via the bridge lib).
  • Async in FFI: Use tokio::runtime::Builder::new_current_thread().enable_all().build().unwrap().block_on(...) inside the extern "C" fn. Never leak runtimes.
  • Error handling: Return *mut c_char (JSON or null). Caller frees with CString.
  • Build: cargo build -p bxc-rust-bridge --release (or via bun run build:linux). Output in rust-bridge/target/release/libbxc_rust_bridge.{so,dylib,dll}

Cross-Platform Notes

  • Linux: .so (default target)
  • macOS: .dylib (x86_64-apple-darwin + aarch64-apple-darwin for universal if needed)
  • Windows: .dll (x86_64-pc-windows-msvc). Also produce .exe for standalone tools.
  • In Bun code: use dlopen with platform-specific name or process.platform + process.arch to pick the right file. Provide BXC_RUST_BRIDGE_LIB override.

Common FFI Pattern (from bxc)

#[no_mangle]
pub extern "C" fn bxc_x_algorithm_rank(
    candidates_json: *const c_char,
    context_json: *const c_char,
    top_k: i32,
) -> *mut c_char {
    // parse with serde, call pure algo, return CString::new(json).unwrap().into_raw()
}

Bun side lazily dlopen the lib on first use; falls back to pure JS for some paths (title, stripTags, markdown) if cdylib missing.

Read the full file on GitHub · 56 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. 1mo ago Changed · +1 lines 1bb287bd6b61
  2. 1mo ago First seen · 55 lines · 108 tokens per session scan A 32ed57145be5

Subscribe to this mod's changes

bxc-rust-ffi is a skill published in the GitHub repository aphrody-code/bxc (3 stars, last pushed 1mo ago), licensed Apache-2.0. It adds 108 tokens to every session and 879 once invoked, about $0.0004 per session on Opus 5.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

rust-crate-ci

Load before editing any Rust crate in this repo (currently runners/swarm-sandbox-runner). Covers the mandatory local validation gate, common rustfmt/clippy pitfalls, and Windows-specific Rust correctness patterns that CI enforces but are hard to catch locally without a Windows toolchain.

ZaxbyHub/opencode-swarm · 60 tokens

rust-learner

Learn Rust language features and crate updates. Use when user asks about Rust version changelog, what's new in Rust, crate updates, Cargo.toml dependencies, tokio/serde/axum features, or any Rust ecosystem questions.

actionbook/actionbook · 51 tokens

Agent Browser Automation

Fast Rust-based headless browser automation CLI with Node.js fallback for AI agents, featuring navigation, clicking, typing, snapshots, and structured commands optimized for agent workflows.

PramodDutta/qaskills · 37 tokens

rewrite-in-rust

Assess, plan, execute, and verify migrations of existing software to Rust. Use for requests to rewrite, port, migrate, or oxidize a codebase, library, module, application, or subsystem in Rust, including RIIR requests. Adapts to the source language and repository; supports incremental replacement, a separate complete…

Firstp1ck/pi-coding-agent-forge · 152 tokens

using-claude-cli

How to drive claude (Claude Code) as a non-interactive CLI tool — headless runs, MCP servers, permissions, output formats, and piping. Use when scripting Claude, spawning a sub-agent from another process, or wiring Claude into CI/automation.

developerz-ai/ui-debugger-mcp · 61 tokens

rust-migration

C/C++ to idiomatic Rust conversion patterns and pipeline. Covers pointer translation, memory management, error handling, string conversion, struct patterns, and quality gates. Use when: convert C to Rust, migrate to Rust, C to Rust patterns, Rust migration, rewrite in Rust.

JuanMarchetto/agent-skills · 60 tokens