Intent Alignment Engine
A production-quality, open-source Python library that helps AI coding agents detect and prevent intent drift during development sessions.
🎯 Vision
AI coding agents frequently begin working toward the correct objective, but gradually shift toward solving a different problem. This engine acts as an independent "second opinion" that continuously evaluates whether the current work remains aligned with the original request.
🔧 Features
- Evidence-Based Reasoning: Evaluates multiple independent forms of evidence rather than simple similarity scoring
- Explainable Assessments: Every conclusion is traceable to specific evidence points
- Pluggable Architecture: Easy to extend with new evidence providers
- Timeline Tracking: Monitor alignment drift over time
- Framework Agnostic: Works with any AI coding agent (Claude Code, Codex, Gemini, etc.)
- Type Safe: Full type hints with Pydantic models and dataclasses
- Well Tested: Comprehensive unit and integration tests
📦 Installation
pip install intent-drift
🚀 Quick Start
from intent_alignment import IntentAlignmentEngine
from intent_alignment.models import AlignmentContext
engine = IntentAlignmentEngine()
context = AlignmentContext(
original_goal="Reduce the application's memory usage.",
current_plan="Optimizing startup latency for faster initialization.",
execution_context={
"edited_files": ["main.py", "startup.py"],
"git_diff": "+ def optimize_startup():\n+ # ... startup optimizations\n",
"recent_commands": ["pip install numpy", "python -m profiler"],
"reasoning_summary": "Focusing on startup performance improvements"
}
)
report = engine.evaluate(context)
print(f"Overall Alignment: {report.overall_alignment}%")
print(f"Status: {report.status}")
print(f"Confidence: {report.confidence}%")
print(f"Recommendation: {report.recommendation}")
📊 Example Output
Intent Alignment Report
Overall Alignment
68%
Status
Moderate Drift
Confidence
89%
Original Goal
Reduce the application's memory usage.
Current Goal
Optimize startup initialization.
Summary
The current work has gradually shifted toward startup performance rather than runtime memory reduction.
Evidence
✓ Goal partially overlaps
✓ Constraints remain satisfied
⚠ Edited files primarily affect startup logic
⚠ Current implementation no longer targets memory allocation
⚠ Dependency changes favor performance over memory optimization
Risk
Additional work is unlikely to improve runtime memory usage.
Recommendation
Pause and confirm whether startup optimization was intentional before continuing.
🏗️ Architecture
intent-drift/
├── src/
│ └── intent_alignment/
│ ├── __init__.py
│ ├── engine.py # Main engine class
│ ├── models.py # Data models (Pydantic/dataclasses)
│ ├── parser.py # Context parsing utilities
│ ├── evidence/ # Evidence provider implementations
│ │ ├── __init__.py
│ │ ├── base.py # Abstract EvidenceProvider
│ │ ├── goal_provider.py
│ │ ├── constraint_provider.py
│ │ ├── scope_provider.py
│ │ ├── file_graph_provider.py
│ │ ├── dependency_provider.py
│ │ ├── architecture_provider.py
│ │ ├── plan_provider.py
│ │ └── execution_provider.py
│ ├── scoring.py # Evidence scoring and aggregation
│ ├── report.py # Report generation
│ └── api.py # Public API interface
├── tests/
│ ├── unit/
│ └── integration/
├── examples/
├── docs/
├── pyproject.toml
└── LICENSE
🧪 Testing
Run the test suite:
pytest tests/
📚 Documentation
See the docs/ directory for:
- Architecture Overview
- Evidence Providers
- Public API Reference
- Extending the Engine
- Contributing Guidelines
🤝 Contributing
Contributions are welcome! Please read our Contributing Guidelines for details on our code of conduct and the process for submitting pull requests.
📄 License
This project is licensed under the MIT License - see the LICENSE file for details.
🙏 Acknowledgments
Inspired by the challenges of intent drift in AI-assisted development and the need for transparent, explainable alignment checking mechanisms.
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.0.tar.gz.
File metadata
- Download URL: intent_drift-0.1.0.tar.gz
- Upload date:
- Size: 22.9 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via:
twine/7.0.0 CPython/3.13.14
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
459504d7bdc8fb15b31a0cd879c8f495756eba1ff1371db93eebd060aacc7066
|
|
| MD5 |
554f9b0e6a8cee9d049f10ea3ab10c7b
|
|
| BLAKE2b-256 |
a10362c1374e4d7e3db9f74c17dc319fe2b0dd300e30024a674445276dbee47e
|
Provenance
The following attestation bundles were made for intent_drift-0.1.0.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.0.tar.gz -
Subject digest:
459504d7bdc8fb15b31a0cd879c8f495756eba1ff1371db93eebd060aacc7066 - Sigstore transparency entry: 2406505218
- Sigstore integration time:
-
Permalink:
shauryagangrade/intent-drift@6f584605a2f02c8d24abf51879b9ede00fc1330f -
Branch / Tag:
refs/tags/v0.1.0 - Owner: https://github.com/shauryagangrade
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@6f584605a2f02c8d24abf51879b9ede00fc1330f -
Trigger Event:
push
-
Statement type:
File details
Details for the file intent_drift-0.1.0-py3-none-any.whl.
File metadata
- Download URL: intent_drift-0.1.0-py3-none-any.whl
- Upload date:
- Size: 29.2 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 |
0ca1a803edddde978b3c0d6ccc32a757f7cdd6fbb91aa08f4490f2ac309b9d2c
|
|
| MD5 |
02b89e6e0ebcc38699d23c7a91819e1d
|
|
| BLAKE2b-256 |
47e182ca878a9e952b3ca2e9daaa421fbf41800d6e995d5dc3fbb03d2349d516
|
Provenance
The following attestation bundles were made for intent_drift-0.1.0-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.0-py3-none-any.whl -
Subject digest:
0ca1a803edddde978b3c0d6ccc32a757f7cdd6fbb91aa08f4490f2ac309b9d2c - Sigstore transparency entry: 2406505231
- Sigstore integration time:
-
Permalink:
shauryagangrade/intent-drift@6f584605a2f02c8d24abf51879b9ede00fc1330f -
Branch / Tag:
refs/tags/v0.1.0 - Owner: https://github.com/shauryagangrade
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@6f584605a2f02c8d24abf51879b9ede00fc1330f -
Trigger Event:
push
-
Statement type: