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.1500 (1 commits)
  • 👤 Human dev: ~$100 (1.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.

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.1.1.tar.gz (253.7 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.1.1-py3-none-any.whl (15.4 kB view details)

Uploaded Python 3

File details

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

File metadata

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

File hashes

Hashes for intract-0.1.1.tar.gz
Algorithm Hash digest
SHA256 82873431c01037ae0a67874dcc7eb837636edda493b0bbd21068d0fbbe7b2965
MD5 b3f85dbed3884790c779aeef3db6fa00
BLAKE2b-256 2de06c06adadcc56d01410fc54a94554450b1d8cb06be595b9061be7dfa616a6

See more details on using hashes here.

File details

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

File metadata

  • Download URL: intract-0.1.1-py3-none-any.whl
  • Upload date:
  • Size: 15.4 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.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 4b604a8eee59e54c9bb7ac61d45a89b583efcba9f7e1f29d66fc45b7c05f20f4
MD5 bd97e12e638adc0e5d023ed04efe8746
BLAKE2b-256 6fae5efa45a45fb27ecdcc16f1c814b0d21a130e236915ebcdd4957e2001f592

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