This repository contains a Python reference implementation of intentc, a compiler that turns intent packages into verifiable artifacts.
Agents working in this repo should preserve deterministic compiler behavior and favor small, testable changes.
- Language: Python
- Environment and dependency manager:
uv - Pinned Python:
3.14.2
- Sync dependencies:
uv sync --dev - Run commands inside the project environment:
uv run <command>
PyYAMLfor intent authoring inputjsonschemafor schema validationtyperfor the CLIpytestfor testsrufffor linting
- Keep modules small and focused on one compiler concern.
- Prefer creating a newer small module with a clear single responsibility and public API over extending an existing module that already has a different concern.
- Start a module as a single file such as
mymodule.py. - If a module grows too large, split it into a package such as
mymodule/, but keep the responsibility clear and avoid nested packages. - Design public APIs explicitly. Public APIs are classes or functions intended for use by other modules.
- Add proper unit tests for public APIs.
- Modules should depend only on public APIs from other modules.
- Do not use non-public APIs across modules.
- Treat names prefixed with
_as non-public implementation details. - Use type hints on public functions and prefer explicit return types.
- Favor pure functions for normalization, validation, and artifact generation.
- Use
pathlibfor filesystem work. - Keep I/O at the edges of the codebase.
- Prefer dataclasses or typed mappings over loose dictionary mutation.
- Raise explicit domain-specific errors for schema, normalization, and compile failures.
- Keep output deterministic by sorting keys and normalizing ordering before serialization.
Before finishing a change, keep ruff clean and cover behavior with pytest.
Common checks:
uv run ruff check intentc tests toolsuv run pytest
For compiler smoke coverage:
uv run python tools/intentc/scripts/ci_compile_gate.py
Use these files as the planning and specification sources of truth:
docs/intents/webhook-idempotency.intent.yamlplanning/intentc/implementation-plan.mdplanning/intentc/backlog.yamlplanning/intentc/enforcement-implementation-plan.mdplanning/intentc/enforcement-backlog.yamlplanning/intentc/traceability-matrix-template.yamlplanning/intentc/risk-and-decisions.mdplanning/intentc/enforcement-risk-and-decisions.mdprompts/02-intentc-enforcement.prompt.mdtools/intentc/schema/intent-package-v1alpha1.schema.jsontools/intentc/spec/compiler-pipeline.mdtools/intentc/spec/generation-manifest.schema.json
uv run python -m intentc validate docs/intents/webhook-idempotency.intent.yaml
uv run python -m intentc compile docs/intents/webhook-idempotency.intent.yaml --out /tmp/intentc-build
Expected compile outputs include:
normalized.intent.jsontraceability.graph.jsonclauses.index.jsonreports/coverage-map.jsonreports/missing-coverage.jsontests/*.featuretests/test_inv_*.pypolicies/**runtime/**generation-manifest.json
uv run python -m intentc generation-manifest /tmp/intentc-build/normalized.intent.json
- Prefer minimal, working increments.
- Do not introduce nondeterministic output formats.
- When modifying compiler outputs, update tests that assert emitted artifacts.
- When changing manifest structure, also update the manifest schema and related tests.
- When working on enforcement, align with
planning/intentc/enforcement-backlog.yamlandprompts/02-intentc-enforcement.prompt.md. - Keep changes consistent with the repository's Python-first, CLI-driven workflow.