Expand description
faf-kernel — the FAF kernel.
Parse, validate, and score .faf files (IANA-registered
application/vnd.faf+yaml). This crate is the single source of truth
consumed by every FAF shell — CLI, MCP server, WASM, edge worker.
§Example
use faf_kernel::{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);Structs§
- Context
Quality - Self-reported metrics on how complete the context is.
- FafData
- A complete parsed
.faffile — the root of the context document. - FafFile
- Parsed FAF file with convenient accessors
- Human
Context - The human side of the project — the 6 W’s.
- Instant
Context - 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.
- Project
- Core project identity — the one block every
.faffile has. - Stack
- The technical stack — one field per layer.
- State
- Where the project is right now.
- Validation
Result - Validation result
Enums§
- Compression
Level - Compression levels
- FafError
- FAF parsing errors
- Find
Error - Errors from find operations
- Slot
State - 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
.fafYAML 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