Skip to main content

Intent contract tagging, validation and semantic mapping for codebases.

Project description

Intract

AI Cost Tracking

PyPI Version Python License AI Cost Human Time Model

  • 🤖 LLM usage: $2.5558 (14 commits)
  • 👤 Human dev: ~$749 (7.5h @ $100/h, 30min dedup)

Generated on 2026-06-01 using openrouter/qwen/qwen3-coder-next


Intract is an intent-contract layer for codebases and software delivery artifacts.

It lets you describe, validate and monitor intent across:

code
functions
classes
files
project manifests
API endpoints
Dockerfiles
CI/CD workflows
Kubernetes manifests
DevOps artifacts

Intract is not primarily a programming language. It is a contract system for short, portable intent declarations.

Quick example

# @intract.v1 scope:function intent:validate:user_permission priority:1 domain:security input:user,resource output:allowed effect:none forbid:write,network validate:input_presence,return_value,no_forbidden_effect meaning:"check whether user can modify resource without changing state"
def can_update_resource(user, resource):
    return user.is_admin or resource.owner_id == user.id

Run:

python -m intract scan .
python -m intract validate .

External Target Addressing (Toon Manifests)

In addition to inline annotations, Intract supports two ways of defining quality gates and intent contracts:

  1. Inline Comments: Using @intract.v1 in source files.
  2. External manifests (Toon Manifests): Decoupled files (.toon or intract.toon.yaml) that specify precise coordinates (targets) for files, functions, lines, and XPaths.

1. Płaski format URI linia po linii (.toon)

Pliki .toon używają struktury URI do prostego i przejrzystego przypisywania kontraktów na poziomie konkretnych linii, funkcji lub selektorów:

# Flat target-based URI rules
intract://src/calc.py?func=add#id=pure-addition&intent=pure-add&forbid=write
intract://src/calc.py?func=write_to_log&line=13#id=log-write&intent=write-log&require=write

2. Manifest YAML z targetowaniem (intract.toon.yaml)

Możesz również zdefiniować zasady w formacie YAML, podając sekcję target:

version: intract.v1
contracts:
  - id: addition-check
    intent: pure:addition
    forbid: [write]
    target:
      file: src/calc.py
      function: add

Więcej informacji i pełne przykłady znajdziesz w katalogu examples/toon/.

Documentation

Start here:

Important project locations

Core:

Operational modules:

Analysis engine:

Plugins and integrations:

Schemas and templates:

Examples:

SDKs:

CI / packaging:

Installation

pip install -e .[dev]

Main commands

python -m intract scan .
python -m intract validate .
python -m intract check .
python -m intract check --staged
python -m intract check --changed --base main
python -m intract check . --format sarif --output intract.sarif
python -m intract check-manifest intract.yaml
python -m intract coverage .
python -m intract duplicates .
python -m intract graph . --format mermaid
python -m intract watch .
python -m intract tickets .
python -m intract artifact Dockerfile
python -m intract artifact openapi.yaml
python -m intract engine suggest .
python -m intract engine drift .
python -m intract engine run .

Run examples

python examples/integration_tests/run_examples.py

Expected:

example_01: pass
example_02: violation + planfile-compatible ticket
example_03: watch/engine/drift works

Project manifest

Generate:

python -m intract init .

Validate:

python -m intract check-manifest intract.yaml
python -m intract validate . --manifest intract.yaml

Pre-commit

Example .pre-commit-config.yaml:

repos:
  - repo: local
    hooks:
      - id: intract
        name: intract intent contracts
        entry: intract check --staged
        language: system
        pass_filenames: false

SARIF / GitHub Code Scanning

python -m intract check . --format sarif --output intract.sarif

GitHub workflow:

License

Licensed under Apache-2.0.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

intract-0.5.9.tar.gz (2.2 MB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

intract-0.5.9-py3-none-any.whl (88.7 kB view details)

Uploaded Python 3

File details

Details for the file intract-0.5.9.tar.gz.

File metadata

  • Download URL: intract-0.5.9.tar.gz
  • Upload date:
  • Size: 2.2 MB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.13.7

File hashes

Hashes for intract-0.5.9.tar.gz
Algorithm Hash digest
SHA256 98eb8b72c990ce9bc8bccdec71b563db89b5513400297d0d0df9164b630d7f84
MD5 b9897d3177d143ac5dd2d1f7f672edce
BLAKE2b-256 90718e6c099581388b8badfc4018857de2a097d80fe1c84382f0e86a4f9fa20c

See more details on using hashes here.

File details

Details for the file intract-0.5.9-py3-none-any.whl.

File metadata

  • Download URL: intract-0.5.9-py3-none-any.whl
  • Upload date:
  • Size: 88.7 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.13.7

File hashes

Hashes for intract-0.5.9-py3-none-any.whl
Algorithm Hash digest
SHA256 7f5a5e903313c37398d4b0101fcef71b65acfedfa1645407e67577353746fb57
MD5 6fc5c976059bc72224b29dd763077a7b
BLAKE2b-256 a0156cb66ad02546fa56c1cfb8f1d6ca23e8722645040c5b6cbd843c3bee67a9

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page