$git clone https://github.com/rokoss21/FACETA deterministic markup language for the AI era.
| 1 | # FACET — Feature-Aware Contracted Extension for Text |
| 2 | |
| 3 | **A deterministic markup language for the AI era.** |
| 4 | |
| 5 | <div align="center"> |
| 6 | <img src="https://raw.githubusercontent.com/rokoss21/FACET/main/assets/logo.png" alt="FACET Logo" width="100%" height="auto" style="max-width: 600px;"> |
| 7 | <br> |
| 8 | <h3>🚀 Feature-Aware Contracted Extension for Text</h3> |
| 9 | <p><em>Human-readable, machine-deterministic instructions for AI systems.</em></p> |
| 10 | </div> |
| 11 | |
| 12 | [-4c1)](https://github.com/rokoss21/FACET/blob/main/FACET-Language-Spec-v1.1-r3.md) |
| 13 | [](https://github.com/rokoss21/FACET/blob/main/FACET-Language-Spec-v1.1-r3.md) |
| 14 | [](#) |
| 15 | [](#) |
| 16 | [](https://github.com/rokoss21) |
| 17 | |
| 18 | <!-- PyPI badges --> |
| 19 | [](https://pypi.org/project/facet-lang/) |
| 20 | [](https://pypi.org/project/facet-lang/) |
| 21 | [](https://pypi.org/project/facet-lang/) |
| 22 | [](https://github.com/rokoss21/FACET/blob/main/LICENSE) |
| 23 | |
| 24 | --- |
| 25 | |
| 26 | ## ✨ What is FACET? |
| 27 | |
| 28 | **FACET** is a markup language for authoring, managing, and executing instructions for AI systems. It merges the **clarity of plain text** with the **rigor of code** to build **reproducible** AI pipelines. |
| 29 | |
| 30 | Every FACET document compiles to a **single canonical JSON** — no YAML-style ambiguity, no hidden magic. Version **v1.1** turns FACET into a **compile-time configuration language** with modularity, logic, static typing, and a pure transformation pipeline (*lenses*). |
| 31 | |
| 32 | --- |
| 33 | |
| 34 | ## 🧠 How FACET Works |
| 35 | |
| 36 | ``` |
| 37 | +------------------+ +------------------+ +-----------------+ |
| 38 | | | | | | | |
| 39 | | .facet file | --> | FACET Parser | --> | Canonical JSON | |
| 40 | | (Source Text) | | (Lenses, | | (Output) | |
| 41 | | | | Contracts) | | | |
| 42 | +------------------+ +------------------+ +-----------------+ |
| 43 | | | | |
| 44 | |-- Facets (@user) |-- Data transforms |-- Deterministic |
| 45 | |-- Attributes (name="") |-- Schema validation |-- Reproducible |
| 46 | |-- Lenses (|> trim) |-- Type checking |-- Tool‑ready |
| 47 | |-- Contracts (@output) |-- Error handling |-- Always valid |
| 48 | ``` |
| 49 | |
| 50 | At authoring time you write readable `.facet` files. The reference parser expands imports, resolves variables, applies conditionals, validates types/contracts, and executes pure lens pipelines — producing a single canonical JSON that downstream tools can rely on. |
| 51 | |
| 52 | --- |
| 53 | |
| 54 | ## 🚀 The Innovation (Why Now, Why FACET) |
| 55 | |
| 56 | Modern AI stacks drown in a mix of ad-hoc prompts, brittle scripts, and ambiguous configs. FACET replaces that with **contracts and determinism**. |
| 57 | |
| 58 | * **Deterministic by design:** One source → one canonical JSON. No surprises. |
| 59 | * **Contract-first prompting:** Use `@output` to enforce **JSON Schema** on model responses. Prompts stop being strings and become **APIs with guarantees**. |
| 60 | * **Compile-time intelligence:** `@import`, `@vars`, `@var_types`, and `if="EXPR"` give вам модульность, параметризацию и статическую проверку ещё до запуска. |
| 61 | * **Pure transformation pipeline:** **Lenses (`|>`)** — встроенные детерминированные функции (в т.ч. `choose(seed)`/`shuffle(seed)`), без I/O и сайд-эффектов. |
| 62 | * **Security model:** Import allowlists, sandboxed lenses, отсутствие неявного доступа к окружению. |
| 63 | |
| 64 | **FACET doesn’t just configure AI — it programs the instruction itself.** |
| 65 | |
| 66 | --- |
| 67 | |
| 68 | ## 🥊 FACET vs. Existing Options |
| 69 | |
| 70 | | Capability / Tooling |