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.
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
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
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
756418e88dc69244b7a7224f1cde676f515692c3ec18d071cdc89a716e14d2e6
|
|
| MD5 |
a0ebd4d283b462fd5c88814b9d379de2
|
|
| BLAKE2b-256 |
7aa2dc216ae7f6026125645e95eba8794460a22052799d743a008e2c6bc2f45e
|
Provenance
The following attestation bundles were made for intent_drift-0.1.1.tar.gz:
Publisher:
publish.yml on shauryagangrade/intent-drift
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
intent_drift-0.1.1.tar.gz -
Subject digest:
756418e88dc69244b7a7224f1cde676f515692c3ec18d071cdc89a716e14d2e6 - Sigstore transparency entry: 2484330452
- Sigstore integration time:
-
Permalink:
shauryagangrade/intent-drift@9d06130d50c92137cf97f335d98782af9adb33b6 -
Branch / Tag:
refs/heads/main - Owner: https://github.com/shauryagangrade
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@9d06130d50c92137cf97f335d98782af9adb33b6 -
Trigger Event:
workflow_dispatch
-
Statement type:
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
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
9c226bbe6fb023176e1263f47e40e5ff778e4fd95b81436b15775fe4c86fb227
|
|
| MD5 |
69083c0a4d92c9d3adf567b74333e9d5
|
|
| BLAKE2b-256 |
40c9d1b489019c7b82b08202a43b4bfc9f4c4d66d8f6c885f48c5113c9ec3f16
|
Provenance
The following attestation bundles were made for intent_drift-0.1.1-py3-none-any.whl:
Publisher:
publish.yml on shauryagangrade/intent-drift
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
intent_drift-0.1.1-py3-none-any.whl -
Subject digest:
9c226bbe6fb023176e1263f47e40e5ff778e4fd95b81436b15775fe4c86fb227 - Sigstore transparency entry: 2484330453
- Sigstore integration time:
-
Permalink:
shauryagangrade/intent-drift@9d06130d50c92137cf97f335d98782af9adb33b6 -
Branch / Tag:
refs/heads/main - Owner: https://github.com/shauryagangrade
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@9d06130d50c92137cf97f335d98782af9adb33b6 -
Trigger Event:
workflow_dispatch
-
Statement type: