Skip to main content

Crate faf_rust_sdk

Crate faf_rust_sdk 

Source
Expand description

FAF Rust SDK — the whole Rust FAF surface behind one import.

faf-rust-sdk re-exports two crates so downstream code has one dependency for the whole Rust FAF surface:

  • faf-kernel — parse, validate, and score .faf files (the kernel).
  • faf-fafb — the compiled binary form, re-exported here under the binary module.

As of 3.0 the SDK contains no logic of its own; it is a stable import surface. The kernel is the single source of truth — the same faf-kernel object scores in the CLI, the MCP server, WASM, and the edge worker, so parity is a property of the build, not a test that has to be re-run.

§Example

use faf_rust_sdk::{parse, score};

let content = r#"
faf_version: 2.5.0
project:
  name: my-project
  goal: Build something great
"#;

let faf = parse(content).unwrap();
assert_eq!(faf.project_name(), "my-project");

let result = score(content).unwrap();
assert!(result.score <= 100);

Modules§

binary
The compiled binary form of .faf — FAFb v2 (re-export of faf-fafb).

Structs§

AiInstructions
Agent-facing guardrails and working-style notes, surfaced in AGENTS.md.
ContextQuality
Self-reported metrics on how complete the context is.
FafData
A complete parsed .faf file — the root of the context document.
FafFile
Parsed FAF file with convenient accessors
FafbHeader
The 32-byte FAFB file header
Flags
Helper struct for working with flags
HumanContext
The human side of the project — the 6 W’s.
InstantContext
The fast-path context an AI assistant reads first.
Mk4Result
The result of an Mk4 scoring run.
Mk4Scorer
The Mk4 scoring engine.
Preferences
Working preferences that shape how the project should be developed.
Priority
Priority level with semantic meaning
Project
Core project identity — the one block every .faf file has.
SectionEntry
A single section entry in the section table
SectionTable
The section table containing all section entries
Security
Secrets handling guidance — what agents must never read or commit.
Stack
The technical stack — one field per layer.
State
Where the project is right now.
ValidationResult
Validation result

Enums§

CompressionLevel
Compression levels
FafError
FAF parsing errors
FafbError
Errors that can occur when working with .fafb files
FindError
Errors from find operations
SlotState
The three technical states of a FAF slot.

Constants§

TOTAL_SLOTS
The total number of FAF slots. The kernel always scores against all 33; “21-base” files simply carry the 12 enterprise slots as slotignored.
VERSION
Library version

Functions§

compress
Compress FAF to specified level
estimate_tokens
Get estimated token count for compression level
find_and_parse
Find and parse FAF file in one call
find_faf_file
Find FAF file starting from given directory, walking up to parents
parse
Parse FAF content from string
parse_file
Parse FAF from file path
score
Score a .faf YAML document against the 33-slot model.
stringify
Serialize FAF back to YAML string
tier_name
Canonical tier name for a score — source of truth: tiers.ts.
tier_symbol
Canonical tier symbol — Trophy 🏆 is the ONLY emoji; sub-Trophy tiers use clean Unicode geometric symbols. The medal-emoji ladder is history.
validate
Validate FAF file structure