Skip to main content

intent-drift

PyPI version Python versions License

Dependency-free Python library that detects intent drift in AI-assisted development: it compares the original goal against the current plan and execution activity, and returns an explainable alignment report.

Install

pip install intent-drift   # Python >= 3.10

Quick Start

from intent_alignment import IntentAlignmentEngine

engine = IntentAlignmentEngine()

context = {
    "original_goal": {
        "text": "Reduce the application's memory usage.",
        "constraints": ["Stay under 100MB RAM"],
        "success_criteria": ["Peak memory < 50MB"],
    },
    "current_plan": {
        "summary": "Optimizing startup initialization for faster load.",
        "steps": ["Profile initialization", "Optimize startup sequence"],
    },
    "execution_context": {
        "edited_files": ["startup.py"],
        "git_diff": "+ def optimize_startup(): ...",
        "recent_messages": ["Working on startup optimization"],
        "reasoning_summary": "Focusing on startup performance",
    },
}

report = engine.evaluate(context)
print(report.overall_alignment)  # 0-100
print(report.status)             # e.g. "Moderate_Drift"
print(report.confidence)         # 0-100
print(report.recommendation)

evaluate() accepts a plain dict or an AlignmentContext dataclass. Use intent_alignment.report.render_report(report) to render the full text report (evidence, risk, and per-provider breakdown).

How It Works

The engine runs the context through pluggable evidence providers — goal alignment, constraints, scope, architecture, execution, file graph, dependencies, requirement coverage, and problematic findings. Each emits weighted evidence that is aggregated into an overall alignment score, confidence, status, and recommendation. No external NLP dependencies: matching is transparent token/alias-based, so every score is traceable to specific input text.

Extending

Implement EvidenceProvider (collect(context) -> list[Evidence]) and register it with engine.add_provider(provider).

Layout

src/intent_alignment/
├── engine.py     # IntentAlignmentEngine, provider registration
├── models.py     # AlignmentContext, AlignmentReport, Evidence, ScoreComponent
├── scoring.py    # Weighted aggregation of provider evidence
├── report.py     # render_report() -> human-readable text
├── utils.py      # Status, confidence, summary, risk, recommendation
└── evidence/     # EvidenceProvider base + 9 providers + shared analysis helpers
tests/            # Unit and integration test suite
examples/         # example_usage.py

Development

python -m venv .venv && source .venv/bin/activate
pip install -e ".[dev]"
pytest tests/

See CHANGELOG.md for releases. License: MIT.

Download files

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

Source Distribution

intent_drift-0.1.1.tar.gz (22.0 kB view details)

Uploaded Source

Built Distribution

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

intent_drift-0.1.1-py3-none-any.whl (29.0 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: intent_drift-0.1.1.tar.gz
  • Upload date:
  • Size: 22.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/7.0.0 CPython/3.13.14

File hashes

Hashes for intent_drift-0.1.1.tar.gz
Algorithm Hash digest
SHA256 756418e88dc69244b7a7224f1cde676f515692c3ec18d071cdc89a716e14d2e6
MD5 a0ebd4d283b462fd5c88814b9d379de2
BLAKE2b-256 7aa2dc216ae7f6026125645e95eba8794460a22052799d743a008e2c6bc2f45e

See more details on using hashes here.

Provenance

The following attestation bundles were made for intent_drift-0.1.1.tar.gz:

Publisher: publish.yml on shauryagangrade/intent-drift

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

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

File metadata

  • Download URL: intent_drift-0.1.1-py3-none-any.whl
  • Upload date:
  • Size: 29.0 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/7.0.0 CPython/3.13.14

File hashes

Hashes for intent_drift-0.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 9c226bbe6fb023176e1263f47e40e5ff778e4fd95b81436b15775fe4c86fb227
MD5 69083c0a4d92c9d3adf567b74333e9d5
BLAKE2b-256 40c9d1b489019c7b82b08202a43b4bfc9f4c4d66d8f6c885f48c5113c9ec3f16

See more details on using hashes here.

Provenance

The following attestation bundles were made for intent_drift-0.1.1-py3-none-any.whl:

Publisher: publish.yml on shauryagangrade/intent-drift

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Release history Release notifications | RSS feed

This release

0.1.1 This release

2 files

0.1.0

2 files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page