intent-drift
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.
Metadata
Release files for intent-drift 0.1.2
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| intent_drift-0.1.2.tar.gz | 22.0 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| intent_drift-0.1.2-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 51.1 kB
Release files / intent_drift-0.1.2.tar.gz
| Download URL | intent_drift-0.1.2.tar.gz |
|---|---|
| Size | 22.0 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
f032b8ac59e01a8fa4aa492fb4b9f0dc479f8df6b83ddd2ffd2d530002568b3f
|
|
BLAKE2b-256 checksum How to use checksums |
bbbac802a67560b5aca0e38a25480574f2005b3672e93972abde0dbbe9da31ce
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Aug 31, 2026.
Transparency logRelease files / intent_drift-0.1.2-py3-none-any.whl
| Download URL | intent_drift-0.1.2-py3-none-any.whl |
|---|---|
| Size | 29.0 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
b568a819ca43e8c1b4e6212b387db74db7ff27a7a958f0586f8c685fff7ce370
|
|
BLAKE2b-256 checksum How to use checksums |
ad7d5a73351e6e2e220ff18b30fd1bfac3a786c7cc0d6c0cd307544f3096a151
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Aug 31, 2026.
Transparency log