Skip to content

Repository files navigation

faf

Persistent Project Context for Rust. cargo add faf and you're in.

FAF defines. MD instructs. AI codes.

One crate, full ecosystem. Parse, validate, compile, and broadcast .faf files in Rust.

FAF (Foundational AI-context Format) is the IANA-registered format for persistent AI project context (application/vnd.faf+yaml). This meta-crate re-exports everything you need.

Install

cargo add faf

With Radio Protocol + Axum middleware:

cargo add faf --features radio,axum

Quick Start

use faf::{parse, binary};

let yaml = std::fs::read_to_string("project.faf")?;

// Parse
let doc = parse(&yaml)?;
println!("{} — {}% AI-ready", doc.project_name(), doc.score().unwrap_or(0));

// Compile to FAFb binary
let fafb = binary::compile(&yaml)?;
println!("{} bytes YAML → {} bytes FAFb", yaml.len(), fafb.len());

Feature Flags

Feature Default Crate What you get
sdk yes faf-rust-sdk Parse, validate, compile, FAFb binary format
radio no faf-radio-rust Radio Protocol — broadcast AI context via WebSocket
axum no faf-rust-sdk/axum FafContext extractor + FafLayer middleware

Radio Protocol

Broadcast AI context once, every tool receives:

use faf::faf_radio_rust::{RadioClient, RadioConfig};

let mut client = RadioClient::new(RadioConfig::grok());
client.connect().await?;
client.tune(vec!["91.0".into()]).await?;

// Broadcast metadata on a frequency
client.broadcast("91.0", serde_json::json!({
    "type": "fafb",
    "project": "my-app",
    "size": 220,
})).await?;

Axum Middleware

Inject .faf project context into every request:

use faf::{FafLayer, FafContext};

let app = Router::new()
    .route("/", get(handler))
    .layer(FafLayer::discover());

async fn handler(faf: FafContext) -> String {
    format!("Project: {}", faf.project_name())
}

Ecosystem

Crate Version What
faf 0.3.0 This meta-crate
faf-rust-sdk 1.3.0 Core SDK — parse, validate, compile, FAFb
faf-radio-rust 0.2.0 Radio Protocol client
rust-faf-mcp 0.1.0 MCP server for .faf

Also available in TypeScript, Python, and Zig.

If faf has been useful, consider starring the repo — it helps others find it.

Links

License

MIT


Built by Wolfe James | faf.one

About

Persistent Project Context for Rust — IANA-registered .faf format · cargo add faf meta-crate

Topics

Resources

Code of conduct

Security policy

Stars

1 star

Watchers

0 watching

Forks

Releases

Packages

Used by

Contributors

Languages