Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/ISSUE_TEMPLATE/bug_report.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ body:
attributes:
label: Language
description: Which language track is affected?
placeholder: python or typescript
placeholder: Python
validations:
required: true
- type: input
Expand Down
50 changes: 3 additions & 47 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@ jobs:
runs-on: ubuntu-latest
outputs:
python: ${{ steps.classify.outputs.python }}
typescript: ${{ steps.classify.outputs.typescript }}
markdown: ${{ steps.classify.outputs.markdown }}
steps:
- name: Check out repository
Expand All @@ -36,7 +35,6 @@ jobs:
fi

run_python=false
run_typescript=false
run_markdown=false
run_all=false

Expand All @@ -49,12 +47,9 @@ jobs:
.markdownlint-cli2.jsonc|*.md)
run_markdown=true
;;
python/*|context_compiler_example_integrations/*|pyproject.toml|uv.lock|scripts/validate_python.sh)
python/*|context_compiler_example_integrations/*|pyproject.toml|uv.lock|.pre-commit-config.yaml)
run_python=true
;;
typescript/*|scripts/validate_typescript.sh|scripts/validate_typescript_fast.sh)
run_typescript=true
;;
*)
run_all=true
;;
Expand All @@ -63,13 +58,11 @@ jobs:

if [[ "${run_all}" == true ]]; then
run_python=true
run_typescript=true
run_markdown=true
fi

{
echo "python=${run_python}"
echo "typescript=${run_typescript}"
echo "markdown=${run_markdown}"
} >> "${GITHUB_OUTPUT}"

Expand Down Expand Up @@ -111,14 +104,8 @@ jobs:
- name: Sync Python dependencies
run: uv sync --locked --group dev --no-editable

- name: Run Ruff check
run: uv run --no-sync ruff check

- name: Run Ruff format check
run: uv run --no-sync ruff format --check

- name: Run mypy
run: uv run --no-sync mypy
- name: Run pre-commit checks
run: uv run --no-sync pre-commit run --all-files

python-validation:
needs: changes
Expand Down Expand Up @@ -147,34 +134,3 @@ jobs:

- name: Run Python tests
run: uv run --no-sync pytest python/tests

typescript-validation:
needs: changes
if: needs.changes.outputs.typescript == 'true'
runs-on: ubuntu-latest
steps:
- name: Check out repository
uses: actions/checkout@v7

- name: Set up Node.js
uses: actions/setup-node@v6
with:
node-version: "22"
cache: npm
cache-dependency-path: |
typescript/examples/schema_selection/vercel_ai_sdk_generate_object/package-lock.json
typescript/starter_apps/node/basic/package-lock.json
typescript/starter_apps/node/with_drafter/package-lock.json
typescript/starter_apps/nextjs/basic/package-lock.json
typescript/starter_apps/nextjs/with_drafter/package-lock.json

- name: Install TypeScript example dependencies
run: |
npm ci --prefix typescript/examples/schema_selection/vercel_ai_sdk_generate_object
npm ci --prefix typescript/starter_apps/node/basic
npm ci --prefix typescript/starter_apps/node/with_drafter
npm ci --prefix typescript/starter_apps/nextjs/basic
npm ci --prefix typescript/starter_apps/nextjs/with_drafter

- name: Run TypeScript validation
run: ./scripts/validate_typescript.sh
34 changes: 0 additions & 34 deletions .github/workflows/publish-npm.yml

This file was deleted.

2 changes: 1 addition & 1 deletion .github/workflows/publish-python.yml
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ jobs:
run: uv sync --group dev --no-editable

- name: Run Python validation
run: ./scripts/validate_python.sh
run: uv run --no-sync pre-commit run --all-files

- name: Build Python distributions
run: uv build
Expand Down
10 changes: 3 additions & 7 deletions AGENTS.md
Original file line number Diff line number Diff line change
Expand Up @@ -56,20 +56,16 @@ Domains are teaching aids. Enforcement points are primary.

## Validation

- Canonical Python validation: `./scripts/validate_python.sh`
- Fast TypeScript validation: `./scripts/validate_typescript_fast.sh`
- Canonical TypeScript validation: `./scripts/validate_typescript.sh`
- Canonical Python validation: `uv run pre-commit run --all-files`
- Markdown validation: `npx --yes markdownlint-cli2`
- Before reporting a task complete or opening a PR, run validation relevant to the changed files.
- If Python files changed, run `./scripts/validate_python.sh`.
- If TypeScript files changed, run at least `./scripts/validate_typescript_fast.sh`. Use `./scripts/validate_typescript.sh` for canonical or full TypeScript validation when appropriate.
- If Python files changed, run `uv run pre-commit run --all-files`.
- If Markdown files changed, run `npx --yes markdownlint-cli2`.
- If multiple areas changed, run all relevant checks.
- Report the exact validation commands and results.
- If a required or relevant validation command cannot be run, report why instead of saying the task is complete.
- Python contributors may use local hooks: `uv run pre-commit run --all-files`
- Do not require TypeScript contributors to install or use Python pre-commit tooling for TypeScript validation.
- CI is the authoritative cross-language validation path.
- CI is the authoritative validation path.

## Example design requirements

Expand Down
18 changes: 2 additions & 16 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,29 +16,15 @@ Contributions are typically submitted via fork and pull request:

Before opening a pull request, run the validation relevant to the files you changed.

- If Python files changed, run `./scripts/validate_python.sh`.
- If TypeScript files changed, run at least `./scripts/validate_typescript_fast.sh`.
- Use `./scripts/validate_typescript.sh` for canonical or full TypeScript validation when appropriate.
- Run `uv run pre-commit run --all-files` for Python validation.
- If Markdown files changed, run `npx --yes markdownlint-cli2`.
- If multiple areas changed, run all relevant checks.
- Report the exact validation commands and results in your PR or handoff notes.
- If a required or relevant validation command cannot be run, report why instead of saying the work is complete.

For a full local setup, you may use:

```bash
uv sync --group dev
```

Python contributors may use `uv run pre-commit run --all-files` for the
lightweight local hook set.

TypeScript contributors can run `./scripts/validate_typescript_fast.sh` or
`./scripts/validate_typescript.sh` directly.

For a local Markdown-only check, run `npx --yes markdownlint-cli2`.

CI is the authoritative cross-language validation path.
CI is the authoritative validation path.

## What belongs here

Expand Down
40 changes: 16 additions & 24 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@ These examples show how authoritative state changes application behavior at runt

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`](https://github.com/rlippmann/context-compiler) and [`context-compiler`](https://github.com/rlippmann/context-compiler-ts).
- Directive recognition can optionally be added with [`context-compiler-directive-drafter`](https://github.com/rlippmann/context-compiler-directive-drafter) and [`context-compiler-directive-drafter`](https://github.com/rlippmann/context-compiler-directive-drafter-ts).
- The core authority contract is provided by [`context-compiler`](https://github.com/rlippmann/context-compiler).
- Directive recognition can optionally be added with [`context-compiler-directive-drafter`](https://github.com/rlippmann/context-compiler-directive-drafter).
- This repository focuses on where authoritative state changes runtime behavior.

*Prompt reinjection* influences ***model behavior***.
Expand All @@ -23,46 +23,42 @@ Each example:

## Start here

Start with [Python guide](python/README.md) or [TypeScript guide](typescript/README.md) if you want language-level orientation first.
Start with the [Python guide](python/README.md).

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.
Python includes generic examples and reference integrations.

## Ecosystem map

| Project | Question |
| --- | --- |
| [context-compiler (Python)](https://github.com/rlippmann/context-compiler), [context-compiler (TypeScript)](https://github.com/rlippmann/context-compiler-ts) | What is the authority contract? |
| [context-compiler-directive-drafter (Python)](https://github.com/rlippmann/context-compiler-directive-drafter), [context-compiler-directive-drafter (TypeScript)](https://github.com/rlippmann/context-compiler-directive-drafter-ts) | How is authority acquired? |
| [context-compiler](https://github.com/rlippmann/context-compiler) | What is the authority contract? |
| [context-compiler-directive-drafter](https://github.com/rlippmann/context-compiler-directive-drafter) | How is authority acquired? |
| [context-compiler-example-integrations](https://github.com/rlippmann/context-compiler-example-integrations) | Where can authority be enforced? |

## Enforcement-point catalog

| Enforcement Point | Domain | Technology |
| --- | --- | --- |
| [Gateway middleware](python/examples/gateway_middleware/README.md) | Customer support routing | generic Python / TypeScript, LiteLLM Proxy |
| [Schema selection](python/examples/schema_selection/README.md) | Order / incident intake | generic Python / TypeScript, Ollama, LiteLLM, Vercel AI SDK |
| [Checkpoint continuation](python/examples/checkpoint_continuation/README.md) | Travel booking | generic Python / TypeScript, FastAPI, Node, Next.js |
| [Execution authorization](python/examples/execution_authorization/README.md) | Expense approval | generic Python / TypeScript, Node |
| [Retrieval filtering](python/examples/retrieval_filtering/README.md) | HR policy lookup | generic Python / TypeScript, ChromaDB |
| [Request construction / context assembly](python/examples/prompt_construction/README.md) | Writing assistant | generic Python / TypeScript, LiteLLM, Open WebUI, Next.js |
| [Tool gating](python/examples/tool_gating/README.md) | Calendar / email / admin | generic Python / TypeScript, MCP |
| [Gateway middleware](python/examples/gateway_middleware/README.md) | Customer support routing | Python, LiteLLM Proxy |
| [Schema selection](python/examples/schema_selection/README.md) | Order / incident intake | Python, Ollama, LiteLLM |
| [Checkpoint continuation](python/examples/checkpoint_continuation/README.md) | Travel booking | Python, FastAPI |
| [Execution authorization](python/examples/execution_authorization/README.md) | Expense approval | Python |
| [Retrieval filtering](python/examples/retrieval_filtering/README.md) | HR policy lookup | Python, ChromaDB |
| [Request construction / context assembly](python/examples/prompt_construction/README.md) | Writing assistant | Python, LiteLLM, Open WebUI |
| [Tool gating](python/examples/tool_gating/README.md) | Calendar / email / admin | Python, MCP |

## Organization

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.

## Current layout

- [python/README.md](python/README.md) - Python examples and reference integrations
- [typescript/README.md](typescript/README.md) - TypeScript examples and starter apps

## Adding examples

Expand All @@ -81,9 +77,8 @@ Canonical repo-level validation commands:

```bash
uv sync --group dev --no-editable
./scripts/validate_python.sh
./scripts/validate_typescript_fast.sh
./scripts/validate_typescript.sh
uv run pre-commit run --all-files
npx --yes markdownlint-cli2
```

Python contributors may install and run local pre-commit hooks:
Expand All @@ -93,10 +88,7 @@ uv run pre-commit install
uv run pre-commit run --all-files
```

TypeScript contributors can run the validation scripts directly without
installing Python pre-commit tooling.

CI is the authoritative cross-language validation path.
CI runs Python validation through pre-commit and Markdown lint separately.

## License

Expand Down
2 changes: 1 addition & 1 deletion python/examples/checkpoint_continuation/fastapi/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -61,5 +61,5 @@ From the repository root:

```bash
uv run pytest python/tests/test_fastapi_checkpoint_continuation_example.py
./scripts/validate_python.sh
uv run pre-commit run --all-files
```
Original file line number Diff line number Diff line change
Expand Up @@ -73,5 +73,5 @@ uv run --no-sync pytest python/tests/test_expense_approval_example.py
- Canonical Python validation:

```bash
./scripts/validate_python.sh
uv run pre-commit run --all-files
```
Original file line number Diff line number Diff line change
Expand Up @@ -88,5 +88,5 @@ uv run --no-sync pytest python/tests/test_prompt_construction_writing_assistant.
- Repo Python validation:

```bash
./scripts/validate_python.sh
uv run pre-commit run --all-files
```
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,7 @@ metadata filters. It does not currently demonstrate premise-driven relevance.

## Why this example is Python-only

This repository does not require Python and TypeScript parity for
technology-specific examples.
This repository does not require parity for technology-specific examples.

This example is Python-only because ChromaDB has a clean local Python client
path for a small runnable example.
Expand Down Expand Up @@ -116,5 +115,5 @@ uv run --no-sync pytest python/tests/test_chromadb_retrieval_filtering_example.p
- Canonical Python validation:

```bash
./scripts/validate_python.sh
uv run pre-commit run --all-files
```
Original file line number Diff line number Diff line change
Expand Up @@ -119,5 +119,5 @@ uv run --no-sync pytest python/tests/test_retrieval_filtering_example.py
- Canonical Python validation:

```bash
./scripts/validate_python.sh
uv run pre-commit run --all-files
```
2 changes: 1 addition & 1 deletion python/reference_integrations/litellm_proxy/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -243,7 +243,7 @@ upstream with the injected compiler contract, verifies the directive-drafter
path preserves the original forwarded user prompt text, and shuts each proxy
down cleanly.

It is intentionally not part of `./scripts/validate_python.sh`.
It is intentionally not part of the default pre-commit suite.

Run it from the repo root:

Expand Down
19 changes: 0 additions & 19 deletions scripts/validate_python.sh

This file was deleted.

Loading