What runtime behavior changes when authoritative state exists?
These examples show how authoritative state changes application behavior at runtime.
Each example demonstrates a single enforcement point where premise and policy influence what a host allows, routes, retrieves, builds, or executes.
- The core authority contract is provided by
context-compilerandcontext-compiler. - Directive recognition can optionally be added with
context-compiler-directive-drafterandcontext-compiler-directive-drafter. - This repository focuses on where authoritative state changes runtime behavior.
Prompt reinjection influences model behavior.
Context Compiler influences runtime behavior.
Each example:
- demonstrates a single runtime enforcement point
- uses explicit authoritative state
- remains meaningful with an adversarial model stub
- focuses on the enforcement point rather than the framework
Start with Python guide or TypeScript guide if you want language-level orientation first.
Use the enforcement-point catalog below when you already know which runtime behavior you want to inspect.
Both language tracks include generic examples. TypeScript also includes starter apps. Python also includes reference integrations.
| Project | Question |
|---|---|
| context-compiler (Python), context-compiler (TypeScript) | What is the authority contract? |
| context-compiler-directive-drafter (Python), context-compiler-directive-drafter (TypeScript) | How is authority acquired? |
| context-compiler-example-integrations | Where can authority be enforced? |
| Enforcement Point | Domain | Technology |
|---|---|---|
| Gateway middleware | Customer support routing | generic Python / TypeScript, LiteLLM Proxy |
| Schema selection | Order / incident intake | generic Python / TypeScript, Ollama, LiteLLM, Vercel AI SDK |
| Checkpoint continuation | Travel booking | generic Python / TypeScript, FastAPI, Node, Next.js |
| Execution authorization | Expense approval | generic Python / TypeScript, Node |
| Retrieval filtering | HR policy lookup | generic Python / TypeScript, ChromaDB |
| Request construction / context assembly | Writing assistant | generic Python / TypeScript, LiteLLM, Open WebUI, Next.js |
| Tool gating | Calendar / email / admin | generic Python / TypeScript, MCP |
Examples are organized by enforcement point.
- Python includes generic examples and reference integrations.
- TypeScript includes generic examples and starter apps.
- Available examples differ between Python and TypeScript.
- python/README.md - Python examples and reference integrations
- typescript/README.md - TypeScript examples and starter apps
Examples in this repo should:
- use explicit authoritative state
- avoid deriving Context Compiler state from model output
- remain meaningful with an adversarial stub
- demonstrate observable runtime behavior changes
See CONTRIBUTING.md and AGENTS.md for more detail.
Canonical repo-level validation commands:
uv sync --group dev --no-editable
./scripts/validate_python.sh
./scripts/validate_typescript_fast.sh
./scripts/validate_typescript.shPython contributors may install and run local pre-commit hooks:
uv run pre-commit install
uv run pre-commit run --all-filesTypeScript contributors can run the validation scripts directly without installing Python pre-commit tooling.
CI is the authoritative cross-language validation path.
Apache-2.0