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: $0.4398 (1 commits)
  • 👤 Human dev: ~$200 (2.0h @ $100/h, 30min dedup)

Generated on 2026-05-29 using openrouter/qwen/qwen3-coder-next


Intract is a lightweight intent-contract system for codebases.

Intract is not primarily a programming language. It is a contract layer for code intent. A contract may be a single line, an inline comment, or a multi-file intent.yaml manifest.

Inline contract

# @intract.v1 scope:function intent:validate:user_permission priority:1 domain:security input:user,resource output:allowed effect:none forbid:write,network require:none 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

Multi-file manifest

project:
  name: redup

contracts:
  - id: project.analysis
    scope: project
    intent: analyze:code_duplication
    priority: 1
    domain: project
    input: [source_tree]
    output: [DuplicationMap, RefactorSuggestion]
    effect: [read]
    forbid: [network]
    require:
      - scan.project_files
      - extract.code_blocks
      - detect.duplicates
      - group.duplicates
      - render.report
    validate:
      - required_intents
      - no_forbidden_effect
    meaning: "Project should analyze source code duplication and produce refactoring guidance."

files:
  src/redup/core/scanner/__init__.py:
    - scope: file
      intent: scan:project_files
      priority: 1
      domain: scanner
      input: [ScanConfig]
      output: [file_list]
      effect: [read]
      forbid: [network]
      meaning: "Scanner file should collect project source files."

CLI

pip install -e .[dev]

intract scan .
intract validate .
intract validate . --manifest intent.yaml --json
intract init .

Validation statuses

Status Meaning
pass Contract is satisfied.
partial Contract is partly satisfied but missing evidence or sub-intents.
fail Contract is not satisfied.
violation Contract matches but violates a forbidden constraint.
unknown Not enough information to decide.

Contract fields

Field Example Meaning
scope function Level: line, block, function, class, file, module, project.
intent validate:user_permission Main action and object.
priority 1 Importance from 1 to 5.
domain security Architectural/business domain.
input user,resource Expected inputs.
output allowed Expected output.
effect read Allowed/declared side effects.
forbid write,network Forbidden effects.
require scan.project_files Required sub-intents.
validate input_presence,no_forbidden_effect Validation rules to apply.
meaning "..." Human-readable explanation.

Plugins and SDKs

This package now includes a plugin registry and SDK templates for:

  • Python plugin packages through project.entry-points
  • TypeScript / Node SDK
  • Go SDK
  • Rust SDK
  • Java SDK
  • C# SDK
  • config templates for intract.yaml, pre-commit, GitHub Actions, Dockerfile, OpenAPI

See:

docs/plugins.md
docs/quick-enable.md
templates/
sdks/

Watch and engine

Intract can now behave like a logical linter running during development:

intract watch .
intract watch . --planfile
intract engine suggest .
intract engine drift .
intract engine run . --planfile
intract tickets .

watch observes logical file changes in real time using content hashes and reruns validation. engine scans the codebase, extracts logical fragments, suggests Intract contracts and detects drift. tickets exports failed, partial or violating results as planfile-compatible ticket files.

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.3.1.tar.gz (298.0 kB view details)

Uploaded Source

Built Distribution

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

intract-0.3.1-py3-none-any.whl (31.2 kB view details)

Uploaded Python 3

File details

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

File metadata

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

File hashes

Hashes for intract-0.3.1.tar.gz
Algorithm Hash digest
SHA256 a434dbc34fa824f9404a613f2b9e251282de9fbda52f45c9c8c2d3c22c5270c9
MD5 e5d33481ad23c73bf067a9c787ec30db
BLAKE2b-256 6a55fe1723f58eab19ea094a4f022353f4ce28d2fb63a4bc17103b6cbe8e8fb6

See more details on using hashes here.

File details

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

File metadata

  • Download URL: intract-0.3.1-py3-none-any.whl
  • Upload date:
  • Size: 31.2 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.3.1-py3-none-any.whl
Algorithm Hash digest
SHA256 e03727846513fceb6ee12a296ed9dbb05dae02f9fcec9bcef067e9de5f1a13a0
MD5 06bfc057270d22c2ee8f6f5531155fd0
BLAKE2b-256 6a1ae2678225dcea0baa75bc955e708a2511a00592ccd2ced2ffaed4ce146253

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