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-compiler. - Directive recognition can optionally be added with
context-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
This repository contains the Python examples and reference integrations. Use the enforcement-point catalog below to find the runtime behavior you want to inspect.
| Project | Question |
|---|---|
| context-compiler | What is the authority contract? |
| context-compiler-directive-drafter | How is authority acquired? |
| context-compiler-example-integrations | Where can authority be enforced? |
| Enforcement Point | Domain | Technology |
|---|---|---|
| Gateway middleware | Customer support routing | Python, LiteLLM Proxy |
| Schema selection | Order / incident intake | Python, Ollama, LiteLLM |
| Checkpoint continuation | Travel booking | Python, FastAPI |
| Execution authorization | Expense approval | Python |
| Retrieval filtering | HR policy lookup | Python, ChromaDB |
| Request construction / context assembly | Writing assistant | Python, LiteLLM, Open WebUI |
| Tool gating | Calendar / email / admin | Python, MCP |
Install the package from PyPI for the shared examples and core dependency:
pip install "context-compiler-example-integrations"Add an extra for the examples you want to run locally:
pip install "context-compiler-example-integrations[drafter]"for Directive Drafter examplespip install "context-compiler-example-integrations[retrieval]"for ChromaDB retrieval examplespip install "context-compiler-example-integrations[fastapi]"for FastAPI variantspip install "context-compiler-example-integrations[litellm]"for LiteLLM examples and reference integrationspip install "context-compiler-example-integrations[all]"for all package-managed optional dependencies
Open WebUI is not installed by this package. Its reference integration assumes that Open WebUI is already installed and configured as the host runtime.
The repository also includes runtime-specific integrations for:
Use a repository checkout to explore an example:
- Choose an enforcement point from the catalog above.
- Open its README for setup, runtime, and validation instructions.
- Run the example from the repository root as documented.
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
uv run pre-commit run --all-files
npx --yes markdownlint-cli2Contributors may install and run local pre-commit hooks:
uv run pre-commit install
uv run pre-commit run --all-filesCI runs pre-commit and Markdown lint separately.
Apache-2.0