FACET  by rokoss21

A deterministic markup language for AI orchestration and prompting

Created 8 months ago
286 stars

Top 91.5% on SourcePulse

GitHubView on GitHub
Project Summary

FACET (Feature-Aware Contracted Extension for Text) is a markup language designed to bring determinism, reproducibility, and robustness to AI prompting and orchestration. It addresses the common issues of ad-hoc prompts and brittle scripts by providing a human-readable, machine-deterministic way to define AI instructions. The primary benefit for developers building AI systems is the ability to create reliable, contract-enforced AI pipelines that compile to a single canonical JSON output, eliminating ambiguity and enabling predictable execution.

How It Works

FACET operates through a compile-time pipeline. Human-readable .facet files are processed by a parser that expands imports, resolves variables, evaluates conditionals, performs static type and contract validation, and executes pure lens transformations. This process yields a single, canonical JSON output, ensuring deterministic results. The core innovation lies in its "contract-first" approach, using @output to enforce JSON Schema on AI model responses, effectively turning prompts into APIs with guarantees. Compile-time features like @import, @vars, @var_types, and if="EXPR" provide modularity, parameterization, and static checking before runtime.

Quick Start & Requirements

  • Installation: pip install facet-lang
  • Prerequisites: Python ≥ 3.9
  • Usage: Command-line interface (facet canon) and Python API (facet_lang.canonize). Examples are provided for both CLI and programmatic use.

Highlighted Details

  • Deterministic Output: Guarantees a single, canonical JSON output from any given .facet source.
  • Contract-First Prompting: Enforces output schemas on AI models via @output contracts.
  • Compile-Time Intelligence: Supports modularity (@import), parameterization (@vars), and static typing (@var_types) before execution.
  • Pure Transformation Pipelines: Lenses (|>) offer deterministic, side-effect-free data transformations.
  • Security Model: Features allowlisted imports, sandboxed lenses, and explicit variable passing, preventing implicit environment access.

Maintenance & Community

The project is authored by Emil Rokossovskiy (@rokoss21). The roadmap indicates active development towards features like Language Server Protocol (LSP) support for IDEs, SDKs in TypeScript and Rust, and CI/CD integrations. A vision for an "Orchestration Stack" including an MCP Server and Plugin Registry is outlined.

Licensing & Compatibility

The project is licensed under the MIT license, which is permissive for commercial use and integration into closed-source projects.

Limitations & Caveats

FACET is presented as a foundational technology with a clear roadmap for future tooling and integrations, suggesting it is still evolving. While the design emphasizes security and determinism, specific details on performance benchmarks or known runtime limitations are not extensively detailed in the README.

Health Check
Last Commit

8 months ago

Responsiveness

Inactive

Pull Requests (30d)
0
Issues (30d)
0
Star History
351 stars in the last 30 days

Explore Similar Projects

Feedback? Help us improve.