Skip to main content

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:

🤝 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

intent_drift-0.1.0.tar.gz (22.9 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.0-py3-none-any.whl (29.2 kB view details)

Uploaded Python 3

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

Hashes for intent_drift-0.1.0.tar.gz
Algorithm Hash digest
SHA256 459504d7bdc8fb15b31a0cd879c8f495756eba1ff1371db93eebd060aacc7066
MD5 554f9b0e6a8cee9d049f10ea3ab10c7b
BLAKE2b-256 a10362c1374e4d7e3db9f74c17dc319fe2b0dd300e30024a674445276dbee47e

See more details on using hashes here.

Provenance

The following attestation bundles were made for intent_drift-0.1.0.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.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

Hashes for intent_drift-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 0ca1a803edddde978b3c0d6ccc32a757f7cdd6fbb91aa08f4490f2ac309b9d2c
MD5 02b89e6e0ebcc38699d23c7a91819e1d
BLAKE2b-256 47e182ca878a9e952b3ca2e9daaa421fbf41800d6e995d5dc3fbb03d2349d516

See more details on using hashes here.

Provenance

The following attestation bundles were made for intent_drift-0.1.0-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

0.1.1

2 files

This release

0.1.0 This release

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