intent-drift 0.1.0__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- intent_drift-0.1.0/LICENSE +21 -0
- intent_drift-0.1.0/PKG-INFO +185 -0
- intent_drift-0.1.0/README.md +149 -0
- intent_drift-0.1.0/pyproject.toml +141 -0
- intent_drift-0.1.0/setup.cfg +4 -0
- intent_drift-0.1.0/src/intent_alignment/__init__.py +16 -0
- intent_drift-0.1.0/src/intent_alignment/api.py +4 -0
- intent_drift-0.1.0/src/intent_alignment/engine.py +121 -0
- intent_drift-0.1.0/src/intent_alignment/evidence/__init__.py +27 -0
- intent_drift-0.1.0/src/intent_alignment/evidence/analysis.py +353 -0
- intent_drift-0.1.0/src/intent_alignment/evidence/base.py +34 -0
- intent_drift-0.1.0/src/intent_alignment/evidence/providers/__init__.py +24 -0
- intent_drift-0.1.0/src/intent_alignment/evidence/providers/architecture_provider.py +82 -0
- intent_drift-0.1.0/src/intent_alignment/evidence/providers/constraint_provider.py +112 -0
- intent_drift-0.1.0/src/intent_alignment/evidence/providers/dependency_provider.py +86 -0
- intent_drift-0.1.0/src/intent_alignment/evidence/providers/execution_provider.py +76 -0
- intent_drift-0.1.0/src/intent_alignment/evidence/providers/file_graph_provider.py +91 -0
- intent_drift-0.1.0/src/intent_alignment/evidence/providers/goal_provider.py +78 -0
- intent_drift-0.1.0/src/intent_alignment/evidence/providers/problematic_findings_provider.py +79 -0
- intent_drift-0.1.0/src/intent_alignment/evidence/providers/requirement_coverage_provider.py +96 -0
- intent_drift-0.1.0/src/intent_alignment/evidence/providers/scope_provider.py +99 -0
- intent_drift-0.1.0/src/intent_alignment/models.py +37 -0
- intent_drift-0.1.0/src/intent_alignment/report.py +83 -0
- intent_drift-0.1.0/src/intent_alignment/scoring.py +102 -0
- intent_drift-0.1.0/src/intent_alignment/utils.py +149 -0
- intent_drift-0.1.0/src/intent_drift.egg-info/PKG-INFO +185 -0
- intent_drift-0.1.0/src/intent_drift.egg-info/SOURCES.txt +28 -0
- intent_drift-0.1.0/src/intent_drift.egg-info/dependency_links.txt +1 -0
- intent_drift-0.1.0/src/intent_drift.egg-info/requires.txt +13 -0
- intent_drift-0.1.0/src/intent_drift.egg-info/top_level.txt +1 -0
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Shaurya Gangrade
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
|
@@ -0,0 +1,185 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: intent-drift
|
|
3
|
+
Version: 0.1.0
|
|
4
|
+
Summary: A production-quality library for detecting intent drift in AI-assisted development
|
|
5
|
+
Author-email: Shaurya Gangrade <shauryagangrade11@gmail.com>
|
|
6
|
+
License-Expression: MIT
|
|
7
|
+
Project-URL: Homepage, https://github.com/shauryagangrade/intent-drift
|
|
8
|
+
Project-URL: Repository, https://github.com/shauryagangrade/intent-drift
|
|
9
|
+
Project-URL: Issues, https://github.com/shauryagangrade/intent-drift/issues
|
|
10
|
+
Project-URL: Documentation, https://github.com/shauryagangrade/intent-drift#readme
|
|
11
|
+
Keywords: intent-drift,ai-agents,alignment,llm,quality-assurance,evaluation
|
|
12
|
+
Classifier: Development Status :: 3 - Alpha
|
|
13
|
+
Classifier: Intended Audience :: Developers
|
|
14
|
+
Classifier: Programming Language :: Python :: 3
|
|
15
|
+
Classifier: Programming Language :: Python :: 3.10
|
|
16
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
17
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
18
|
+
Classifier: Topic :: Software Development :: Libraries
|
|
19
|
+
Classifier: Topic :: Software Development :: Quality Assurance
|
|
20
|
+
Classifier: Topic :: Scientific/Engineering :: Artificial Intelligence
|
|
21
|
+
Requires-Python: >=3.10
|
|
22
|
+
Description-Content-Type: text/markdown
|
|
23
|
+
License-File: LICENSE
|
|
24
|
+
Provides-Extra: dev
|
|
25
|
+
Requires-Dist: pytest>=7.0.0; extra == "dev"
|
|
26
|
+
Requires-Dist: pytest-cov>=4.0.0; extra == "dev"
|
|
27
|
+
Requires-Dist: black>=23.0.0; extra == "dev"
|
|
28
|
+
Requires-Dist: ruff>=0.1.0; extra == "dev"
|
|
29
|
+
Requires-Dist: mypy>=1.0.0; extra == "dev"
|
|
30
|
+
Requires-Dist: pre-commit>=3.0.0; extra == "dev"
|
|
31
|
+
Provides-Extra: docs
|
|
32
|
+
Requires-Dist: sphinx>=6.0.0; extra == "docs"
|
|
33
|
+
Requires-Dist: sphinx-rtd-theme>=1.3.0; extra == "docs"
|
|
34
|
+
Requires-Dist: myst-parser>=1.0.0; extra == "docs"
|
|
35
|
+
Dynamic: license-file
|
|
36
|
+
|
|
37
|
+
# Intent Alignment Engine
|
|
38
|
+
|
|
39
|
+
A production-quality, open-source Python library that helps AI coding agents detect and prevent intent drift during development sessions.
|
|
40
|
+
|
|
41
|
+
## 🎯 Vision
|
|
42
|
+
|
|
43
|
+
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.
|
|
44
|
+
|
|
45
|
+
## 🔧 Features
|
|
46
|
+
|
|
47
|
+
- **Evidence-Based Reasoning**: Evaluates multiple independent forms of evidence rather than simple similarity scoring
|
|
48
|
+
- **Explainable Assessments**: Every conclusion is traceable to specific evidence points
|
|
49
|
+
- **Pluggable Architecture**: Easy to extend with new evidence providers
|
|
50
|
+
- **Timeline Tracking**: Monitor alignment drift over time
|
|
51
|
+
- **Framework Agnostic**: Works with any AI coding agent (Claude Code, Codex, Gemini, etc.)
|
|
52
|
+
- **Type Safe**: Full type hints with Pydantic models and dataclasses
|
|
53
|
+
- **Well Tested**: Comprehensive unit and integration tests
|
|
54
|
+
|
|
55
|
+
## 📦 Installation
|
|
56
|
+
|
|
57
|
+
```bash
|
|
58
|
+
pip install intent-drift
|
|
59
|
+
```
|
|
60
|
+
|
|
61
|
+
## 🚀 Quick Start
|
|
62
|
+
|
|
63
|
+
```python
|
|
64
|
+
from intent_alignment import IntentAlignmentEngine
|
|
65
|
+
from intent_alignment.models import AlignmentContext
|
|
66
|
+
|
|
67
|
+
engine = IntentAlignmentEngine()
|
|
68
|
+
|
|
69
|
+
context = AlignmentContext(
|
|
70
|
+
original_goal="Reduce the application's memory usage.",
|
|
71
|
+
current_plan="Optimizing startup latency for faster initialization.",
|
|
72
|
+
execution_context={
|
|
73
|
+
"edited_files": ["main.py", "startup.py"],
|
|
74
|
+
"git_diff": "+ def optimize_startup():\n+ # ... startup optimizations\n",
|
|
75
|
+
"recent_commands": ["pip install numpy", "python -m profiler"],
|
|
76
|
+
"reasoning_summary": "Focusing on startup performance improvements"
|
|
77
|
+
}
|
|
78
|
+
)
|
|
79
|
+
|
|
80
|
+
report = engine.evaluate(context)
|
|
81
|
+
|
|
82
|
+
print(f"Overall Alignment: {report.overall_alignment}%")
|
|
83
|
+
print(f"Status: {report.status}")
|
|
84
|
+
print(f"Confidence: {report.confidence}%")
|
|
85
|
+
print(f"Recommendation: {report.recommendation}")
|
|
86
|
+
```
|
|
87
|
+
|
|
88
|
+
## 📊 Example Output
|
|
89
|
+
|
|
90
|
+
```
|
|
91
|
+
Intent Alignment Report
|
|
92
|
+
|
|
93
|
+
Overall Alignment
|
|
94
|
+
68%
|
|
95
|
+
|
|
96
|
+
Status
|
|
97
|
+
Moderate Drift
|
|
98
|
+
|
|
99
|
+
Confidence
|
|
100
|
+
89%
|
|
101
|
+
|
|
102
|
+
Original Goal
|
|
103
|
+
Reduce the application's memory usage.
|
|
104
|
+
|
|
105
|
+
Current Goal
|
|
106
|
+
Optimize startup initialization.
|
|
107
|
+
|
|
108
|
+
Summary
|
|
109
|
+
The current work has gradually shifted toward startup performance rather than runtime memory reduction.
|
|
110
|
+
|
|
111
|
+
Evidence
|
|
112
|
+
✓ Goal partially overlaps
|
|
113
|
+
✓ Constraints remain satisfied
|
|
114
|
+
⚠ Edited files primarily affect startup logic
|
|
115
|
+
⚠ Current implementation no longer targets memory allocation
|
|
116
|
+
⚠ Dependency changes favor performance over memory optimization
|
|
117
|
+
|
|
118
|
+
Risk
|
|
119
|
+
Additional work is unlikely to improve runtime memory usage.
|
|
120
|
+
|
|
121
|
+
Recommendation
|
|
122
|
+
Pause and confirm whether startup optimization was intentional before continuing.
|
|
123
|
+
```
|
|
124
|
+
|
|
125
|
+
## 🏗️ Architecture
|
|
126
|
+
|
|
127
|
+
```
|
|
128
|
+
intent-drift/
|
|
129
|
+
├── src/
|
|
130
|
+
│ └── intent_alignment/
|
|
131
|
+
│ ├── __init__.py
|
|
132
|
+
│ ├── engine.py # Main engine class
|
|
133
|
+
│ ├── models.py # Data models (Pydantic/dataclasses)
|
|
134
|
+
│ ├── parser.py # Context parsing utilities
|
|
135
|
+
│ ├── evidence/ # Evidence provider implementations
|
|
136
|
+
│ │ ├── __init__.py
|
|
137
|
+
│ │ ├── base.py # Abstract EvidenceProvider
|
|
138
|
+
│ │ ├── goal_provider.py
|
|
139
|
+
│ │ ├── constraint_provider.py
|
|
140
|
+
│ │ ├── scope_provider.py
|
|
141
|
+
│ │ ├── file_graph_provider.py
|
|
142
|
+
│ │ ├── dependency_provider.py
|
|
143
|
+
│ │ ├── architecture_provider.py
|
|
144
|
+
│ │ ├── plan_provider.py
|
|
145
|
+
│ │ └── execution_provider.py
|
|
146
|
+
│ ├── scoring.py # Evidence scoring and aggregation
|
|
147
|
+
│ ├── report.py # Report generation
|
|
148
|
+
│ └── api.py # Public API interface
|
|
149
|
+
├── tests/
|
|
150
|
+
│ ├── unit/
|
|
151
|
+
│ └── integration/
|
|
152
|
+
├── examples/
|
|
153
|
+
├── docs/
|
|
154
|
+
├── pyproject.toml
|
|
155
|
+
└── LICENSE
|
|
156
|
+
```
|
|
157
|
+
|
|
158
|
+
## 🧪 Testing
|
|
159
|
+
|
|
160
|
+
Run the test suite:
|
|
161
|
+
|
|
162
|
+
```bash
|
|
163
|
+
pytest tests/
|
|
164
|
+
```
|
|
165
|
+
|
|
166
|
+
## 📚 Documentation
|
|
167
|
+
|
|
168
|
+
See the [docs/](docs/) directory for:
|
|
169
|
+
- [Architecture Overview](docs/architecture.md)
|
|
170
|
+
- [Evidence Providers](docs/evidence_providers.md)
|
|
171
|
+
- [Public API Reference](docs/api.md)
|
|
172
|
+
- [Extending the Engine](docs/extending.md)
|
|
173
|
+
- [Contributing Guidelines](CONTRIBUTING.md)
|
|
174
|
+
|
|
175
|
+
## 🤝 Contributing
|
|
176
|
+
|
|
177
|
+
Contributions are welcome! Please read our [Contributing Guidelines](CONTRIBUTING.md) for details on our code of conduct and the process for submitting pull requests.
|
|
178
|
+
|
|
179
|
+
## 📄 License
|
|
180
|
+
|
|
181
|
+
This project is licensed under the MIT License - see the [LICENSE](LICENSE) file for details.
|
|
182
|
+
|
|
183
|
+
## 🙏 Acknowledgments
|
|
184
|
+
|
|
185
|
+
Inspired by the challenges of intent drift in AI-assisted development and the need for transparent, explainable alignment checking mechanisms.
|
|
@@ -0,0 +1,149 @@
|
|
|
1
|
+
# Intent Alignment Engine
|
|
2
|
+
|
|
3
|
+
A production-quality, open-source Python library that helps AI coding agents detect and prevent intent drift during development sessions.
|
|
4
|
+
|
|
5
|
+
## 🎯 Vision
|
|
6
|
+
|
|
7
|
+
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.
|
|
8
|
+
|
|
9
|
+
## 🔧 Features
|
|
10
|
+
|
|
11
|
+
- **Evidence-Based Reasoning**: Evaluates multiple independent forms of evidence rather than simple similarity scoring
|
|
12
|
+
- **Explainable Assessments**: Every conclusion is traceable to specific evidence points
|
|
13
|
+
- **Pluggable Architecture**: Easy to extend with new evidence providers
|
|
14
|
+
- **Timeline Tracking**: Monitor alignment drift over time
|
|
15
|
+
- **Framework Agnostic**: Works with any AI coding agent (Claude Code, Codex, Gemini, etc.)
|
|
16
|
+
- **Type Safe**: Full type hints with Pydantic models and dataclasses
|
|
17
|
+
- **Well Tested**: Comprehensive unit and integration tests
|
|
18
|
+
|
|
19
|
+
## 📦 Installation
|
|
20
|
+
|
|
21
|
+
```bash
|
|
22
|
+
pip install intent-drift
|
|
23
|
+
```
|
|
24
|
+
|
|
25
|
+
## 🚀 Quick Start
|
|
26
|
+
|
|
27
|
+
```python
|
|
28
|
+
from intent_alignment import IntentAlignmentEngine
|
|
29
|
+
from intent_alignment.models import AlignmentContext
|
|
30
|
+
|
|
31
|
+
engine = IntentAlignmentEngine()
|
|
32
|
+
|
|
33
|
+
context = AlignmentContext(
|
|
34
|
+
original_goal="Reduce the application's memory usage.",
|
|
35
|
+
current_plan="Optimizing startup latency for faster initialization.",
|
|
36
|
+
execution_context={
|
|
37
|
+
"edited_files": ["main.py", "startup.py"],
|
|
38
|
+
"git_diff": "+ def optimize_startup():\n+ # ... startup optimizations\n",
|
|
39
|
+
"recent_commands": ["pip install numpy", "python -m profiler"],
|
|
40
|
+
"reasoning_summary": "Focusing on startup performance improvements"
|
|
41
|
+
}
|
|
42
|
+
)
|
|
43
|
+
|
|
44
|
+
report = engine.evaluate(context)
|
|
45
|
+
|
|
46
|
+
print(f"Overall Alignment: {report.overall_alignment}%")
|
|
47
|
+
print(f"Status: {report.status}")
|
|
48
|
+
print(f"Confidence: {report.confidence}%")
|
|
49
|
+
print(f"Recommendation: {report.recommendation}")
|
|
50
|
+
```
|
|
51
|
+
|
|
52
|
+
## 📊 Example Output
|
|
53
|
+
|
|
54
|
+
```
|
|
55
|
+
Intent Alignment Report
|
|
56
|
+
|
|
57
|
+
Overall Alignment
|
|
58
|
+
68%
|
|
59
|
+
|
|
60
|
+
Status
|
|
61
|
+
Moderate Drift
|
|
62
|
+
|
|
63
|
+
Confidence
|
|
64
|
+
89%
|
|
65
|
+
|
|
66
|
+
Original Goal
|
|
67
|
+
Reduce the application's memory usage.
|
|
68
|
+
|
|
69
|
+
Current Goal
|
|
70
|
+
Optimize startup initialization.
|
|
71
|
+
|
|
72
|
+
Summary
|
|
73
|
+
The current work has gradually shifted toward startup performance rather than runtime memory reduction.
|
|
74
|
+
|
|
75
|
+
Evidence
|
|
76
|
+
✓ Goal partially overlaps
|
|
77
|
+
✓ Constraints remain satisfied
|
|
78
|
+
⚠ Edited files primarily affect startup logic
|
|
79
|
+
⚠ Current implementation no longer targets memory allocation
|
|
80
|
+
⚠ Dependency changes favor performance over memory optimization
|
|
81
|
+
|
|
82
|
+
Risk
|
|
83
|
+
Additional work is unlikely to improve runtime memory usage.
|
|
84
|
+
|
|
85
|
+
Recommendation
|
|
86
|
+
Pause and confirm whether startup optimization was intentional before continuing.
|
|
87
|
+
```
|
|
88
|
+
|
|
89
|
+
## 🏗️ Architecture
|
|
90
|
+
|
|
91
|
+
```
|
|
92
|
+
intent-drift/
|
|
93
|
+
├── src/
|
|
94
|
+
│ └── intent_alignment/
|
|
95
|
+
│ ├── __init__.py
|
|
96
|
+
│ ├── engine.py # Main engine class
|
|
97
|
+
│ ├── models.py # Data models (Pydantic/dataclasses)
|
|
98
|
+
│ ├── parser.py # Context parsing utilities
|
|
99
|
+
│ ├── evidence/ # Evidence provider implementations
|
|
100
|
+
│ │ ├── __init__.py
|
|
101
|
+
│ │ ├── base.py # Abstract EvidenceProvider
|
|
102
|
+
│ │ ├── goal_provider.py
|
|
103
|
+
│ │ ├── constraint_provider.py
|
|
104
|
+
│ │ ├── scope_provider.py
|
|
105
|
+
│ │ ├── file_graph_provider.py
|
|
106
|
+
│ │ ├── dependency_provider.py
|
|
107
|
+
│ │ ├── architecture_provider.py
|
|
108
|
+
│ │ ├── plan_provider.py
|
|
109
|
+
│ │ └── execution_provider.py
|
|
110
|
+
│ ├── scoring.py # Evidence scoring and aggregation
|
|
111
|
+
│ ├── report.py # Report generation
|
|
112
|
+
│ └── api.py # Public API interface
|
|
113
|
+
├── tests/
|
|
114
|
+
│ ├── unit/
|
|
115
|
+
│ └── integration/
|
|
116
|
+
├── examples/
|
|
117
|
+
├── docs/
|
|
118
|
+
├── pyproject.toml
|
|
119
|
+
└── LICENSE
|
|
120
|
+
```
|
|
121
|
+
|
|
122
|
+
## 🧪 Testing
|
|
123
|
+
|
|
124
|
+
Run the test suite:
|
|
125
|
+
|
|
126
|
+
```bash
|
|
127
|
+
pytest tests/
|
|
128
|
+
```
|
|
129
|
+
|
|
130
|
+
## 📚 Documentation
|
|
131
|
+
|
|
132
|
+
See the [docs/](docs/) directory for:
|
|
133
|
+
- [Architecture Overview](docs/architecture.md)
|
|
134
|
+
- [Evidence Providers](docs/evidence_providers.md)
|
|
135
|
+
- [Public API Reference](docs/api.md)
|
|
136
|
+
- [Extending the Engine](docs/extending.md)
|
|
137
|
+
- [Contributing Guidelines](CONTRIBUTING.md)
|
|
138
|
+
|
|
139
|
+
## 🤝 Contributing
|
|
140
|
+
|
|
141
|
+
Contributions are welcome! Please read our [Contributing Guidelines](CONTRIBUTING.md) for details on our code of conduct and the process for submitting pull requests.
|
|
142
|
+
|
|
143
|
+
## 📄 License
|
|
144
|
+
|
|
145
|
+
This project is licensed under the MIT License - see the [LICENSE](LICENSE) file for details.
|
|
146
|
+
|
|
147
|
+
## 🙏 Acknowledgments
|
|
148
|
+
|
|
149
|
+
Inspired by the challenges of intent drift in AI-assisted development and the need for transparent, explainable alignment checking mechanisms.
|
|
@@ -0,0 +1,141 @@
|
|
|
1
|
+
[build-system]
|
|
2
|
+
requires = ["setuptools>=77.0", "wheel"]
|
|
3
|
+
build-backend = "setuptools.build_meta"
|
|
4
|
+
|
|
5
|
+
[project]
|
|
6
|
+
name = "intent-drift"
|
|
7
|
+
version = "0.1.0"
|
|
8
|
+
description = "A production-quality library for detecting intent drift in AI-assisted development"
|
|
9
|
+
readme = "README.md"
|
|
10
|
+
authors = [
|
|
11
|
+
{name = "Shaurya Gangrade", email = "shauryagangrade11@gmail.com"}
|
|
12
|
+
]
|
|
13
|
+
license = "MIT"
|
|
14
|
+
license-files = ["LICENSE"]
|
|
15
|
+
keywords = [
|
|
16
|
+
"intent-drift",
|
|
17
|
+
"ai-agents",
|
|
18
|
+
"alignment",
|
|
19
|
+
"llm",
|
|
20
|
+
"quality-assurance",
|
|
21
|
+
"evaluation",
|
|
22
|
+
]
|
|
23
|
+
classifiers = [
|
|
24
|
+
"Development Status :: 3 - Alpha",
|
|
25
|
+
"Intended Audience :: Developers",
|
|
26
|
+
"Programming Language :: Python :: 3",
|
|
27
|
+
"Programming Language :: Python :: 3.10",
|
|
28
|
+
"Programming Language :: Python :: 3.11",
|
|
29
|
+
"Programming Language :: Python :: 3.12",
|
|
30
|
+
"Topic :: Software Development :: Libraries",
|
|
31
|
+
"Topic :: Software Development :: Quality Assurance",
|
|
32
|
+
"Topic :: Scientific/Engineering :: Artificial Intelligence"
|
|
33
|
+
]
|
|
34
|
+
requires-python = ">=3.10"
|
|
35
|
+
dependencies = []
|
|
36
|
+
|
|
37
|
+
[project.optional-dependencies]
|
|
38
|
+
dev = [
|
|
39
|
+
"pytest>=7.0.0",
|
|
40
|
+
"pytest-cov>=4.0.0",
|
|
41
|
+
"black>=23.0.0",
|
|
42
|
+
"ruff>=0.1.0",
|
|
43
|
+
"mypy>=1.0.0",
|
|
44
|
+
"pre-commit>=3.0.0",
|
|
45
|
+
]
|
|
46
|
+
docs = [
|
|
47
|
+
"sphinx>=6.0.0",
|
|
48
|
+
"sphinx-rtd-theme>=1.3.0",
|
|
49
|
+
"myst-parser>=1.0.0",
|
|
50
|
+
]
|
|
51
|
+
|
|
52
|
+
[project.urls]
|
|
53
|
+
Homepage = "https://github.com/shauryagangrade/intent-drift"
|
|
54
|
+
Repository = "https://github.com/shauryagangrade/intent-drift"
|
|
55
|
+
Issues = "https://github.com/shauryagangrade/intent-drift/issues"
|
|
56
|
+
Documentation = "https://github.com/shauryagangrade/intent-drift#readme"
|
|
57
|
+
|
|
58
|
+
[tool.setuptools.packages.find]
|
|
59
|
+
where = ["src"]
|
|
60
|
+
|
|
61
|
+
[tool.pytest.ini_options]
|
|
62
|
+
testpaths = ["tests"]
|
|
63
|
+
python_files = ["test_*.py"]
|
|
64
|
+
python_classes = ["Test*"]
|
|
65
|
+
python_functions = ["test_*"]
|
|
66
|
+
addopts = "-v --tb=short"
|
|
67
|
+
|
|
68
|
+
[tool.black]
|
|
69
|
+
line-length = 100
|
|
70
|
+
target-version = ['py310', 'py311', 'py312']
|
|
71
|
+
include = '\.pyi?$'
|
|
72
|
+
extend-exclude = '''
|
|
73
|
+
/(
|
|
74
|
+
# directories
|
|
75
|
+
\.git
|
|
76
|
+
| \.hg
|
|
77
|
+
| \.mypy_cache
|
|
78
|
+
| \.tox
|
|
79
|
+
| \.venv
|
|
80
|
+
| _build
|
|
81
|
+
| buck-out
|
|
82
|
+
| build
|
|
83
|
+
| dist
|
|
84
|
+
)/
|
|
85
|
+
'''
|
|
86
|
+
|
|
87
|
+
[tool.ruff]
|
|
88
|
+
line-length = 100
|
|
89
|
+
target-version = "py310"
|
|
90
|
+
|
|
91
|
+
[tool.ruff.lint]
|
|
92
|
+
select = [
|
|
93
|
+
"E", # pycodestyle errors
|
|
94
|
+
"W", # pycodestyle warnings
|
|
95
|
+
"F", # pyflakes
|
|
96
|
+
"I", # isort
|
|
97
|
+
"B", # flake8-bugbear
|
|
98
|
+
"C4", # flake8-comprehensions
|
|
99
|
+
"UP", # pyupgrade
|
|
100
|
+
]
|
|
101
|
+
ignore = [
|
|
102
|
+
"E501", # line too long, handled by black
|
|
103
|
+
"B008", # do not perform function calls in argument defaults
|
|
104
|
+
]
|
|
105
|
+
exclude = [
|
|
106
|
+
".git",
|
|
107
|
+
".mypy_cache",
|
|
108
|
+
".tox",
|
|
109
|
+
".venv",
|
|
110
|
+
"_build",
|
|
111
|
+
"buck-out",
|
|
112
|
+
"build",
|
|
113
|
+
"dist",
|
|
114
|
+
]
|
|
115
|
+
|
|
116
|
+
[tool.mypy]
|
|
117
|
+
python_version = "3.10"
|
|
118
|
+
warn_return_any = true
|
|
119
|
+
warn_unused_configs = true
|
|
120
|
+
disallow_untyped_defs = true
|
|
121
|
+
disallow_incomplete_defs = true
|
|
122
|
+
check_untyped_defs = true
|
|
123
|
+
disallow_untyped_decorators = true
|
|
124
|
+
no_implicit_optional = true
|
|
125
|
+
warn_redundant_casts = true
|
|
126
|
+
warn_unused_ignores = true
|
|
127
|
+
warn_no_return = true
|
|
128
|
+
show_error_codes = true
|
|
129
|
+
|
|
130
|
+
[tool.coverage.run]
|
|
131
|
+
source = ["src/intent_alignment"]
|
|
132
|
+
branch = true
|
|
133
|
+
|
|
134
|
+
[tool.coverage.report]
|
|
135
|
+
exclude_lines = [
|
|
136
|
+
"pragma: no cover",
|
|
137
|
+
"def __repr__",
|
|
138
|
+
"raise AssertionError",
|
|
139
|
+
"raise NotImplementedError",
|
|
140
|
+
"if __name__ == .__main__.:"
|
|
141
|
+
]
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
from . import api as api
|
|
2
|
+
from . import evidence as evidence_providers
|
|
3
|
+
from .engine import IntentAlignmentEngine
|
|
4
|
+
from .models import AlignmentContext, AlignmentReport, Evidence, ScoreComponent
|
|
5
|
+
|
|
6
|
+
__version__ = "0.1.0"
|
|
7
|
+
|
|
8
|
+
__all__ = [
|
|
9
|
+
"IntentAlignmentEngine",
|
|
10
|
+
"AlignmentContext",
|
|
11
|
+
"AlignmentReport",
|
|
12
|
+
"Evidence",
|
|
13
|
+
"ScoreComponent",
|
|
14
|
+
"evidence_providers",
|
|
15
|
+
"api",
|
|
16
|
+
]
|
|
@@ -0,0 +1,121 @@
|
|
|
1
|
+
from typing import Any
|
|
2
|
+
|
|
3
|
+
from .evidence import EvidenceProvider
|
|
4
|
+
from .models import AlignmentContext, AlignmentReport
|
|
5
|
+
|
|
6
|
+
|
|
7
|
+
class IntentAlignmentEngine:
|
|
8
|
+
"""Main engine for intent alignment analysis."""
|
|
9
|
+
|
|
10
|
+
def __init__(self):
|
|
11
|
+
"""Initialize the engine with default evidence providers."""
|
|
12
|
+
self.providers: list[EvidenceProvider] = []
|
|
13
|
+
self._register_default_providers()
|
|
14
|
+
|
|
15
|
+
def _register_default_providers(self) -> None:
|
|
16
|
+
"""Register the default set of evidence providers."""
|
|
17
|
+
# Import providers here to avoid circular imports
|
|
18
|
+
from .evidence.providers import (
|
|
19
|
+
ArchitectureProvider,
|
|
20
|
+
ConstraintProvider,
|
|
21
|
+
DependencyProvider,
|
|
22
|
+
ExecutionProvider,
|
|
23
|
+
FileGraphProvider,
|
|
24
|
+
GoalProvider,
|
|
25
|
+
ProblematicFindingsProvider,
|
|
26
|
+
RequirementCoverageProvider,
|
|
27
|
+
ScopeProvider,
|
|
28
|
+
)
|
|
29
|
+
|
|
30
|
+
self.providers = [
|
|
31
|
+
GoalProvider(),
|
|
32
|
+
ConstraintProvider(),
|
|
33
|
+
ScopeProvider(),
|
|
34
|
+
ArchitectureProvider(),
|
|
35
|
+
ExecutionProvider(),
|
|
36
|
+
FileGraphProvider(),
|
|
37
|
+
DependencyProvider(),
|
|
38
|
+
RequirementCoverageProvider(),
|
|
39
|
+
ProblematicFindingsProvider(),
|
|
40
|
+
]
|
|
41
|
+
|
|
42
|
+
def add_provider(self, provider: EvidenceProvider) -> None:
|
|
43
|
+
"""Register an evidence provider to use during evaluation."""
|
|
44
|
+
self.providers.append(provider)
|
|
45
|
+
|
|
46
|
+
def evaluate(self, context: AlignmentContext) -> AlignmentReport:
|
|
47
|
+
"""
|
|
48
|
+
Analyze the alignment between original goal and current implementation.
|
|
49
|
+
|
|
50
|
+
Args:
|
|
51
|
+
context: Alignment context containing goal, plan, and execution data.
|
|
52
|
+
Accepts either an :class:`AlignmentContext` or a plain dict with
|
|
53
|
+
the same three keys. Providers always receive a plain dict view.
|
|
54
|
+
|
|
55
|
+
Returns:
|
|
56
|
+
Alignment report with assessment results
|
|
57
|
+
"""
|
|
58
|
+
# Accept a plain dict for convenience (e.g. example scripts and tests
|
|
59
|
+
# that construct context inline) and normalize to AlignmentContext.
|
|
60
|
+
context_dict: dict[str, Any]
|
|
61
|
+
if isinstance(context, AlignmentContext):
|
|
62
|
+
context_dict = {
|
|
63
|
+
"original_goal": context.original_goal,
|
|
64
|
+
"current_plan": context.current_plan,
|
|
65
|
+
"execution_context": context.execution_context,
|
|
66
|
+
}
|
|
67
|
+
elif isinstance(context, dict):
|
|
68
|
+
context_dict = {
|
|
69
|
+
"original_goal": context.get("original_goal", {}),
|
|
70
|
+
"current_plan": context.get("current_plan", {}),
|
|
71
|
+
"execution_context": context.get("execution_context", {}),
|
|
72
|
+
}
|
|
73
|
+
else:
|
|
74
|
+
raise TypeError(
|
|
75
|
+
"evaluate() expects an AlignmentContext or a dict with "
|
|
76
|
+
"'original_goal', 'current_plan', 'execution_context' keys."
|
|
77
|
+
)
|
|
78
|
+
|
|
79
|
+
# Collect evidence from all registered providers
|
|
80
|
+
all_evidence = []
|
|
81
|
+
for provider in self.providers:
|
|
82
|
+
all_evidence.extend(provider.collect(context_dict))
|
|
83
|
+
|
|
84
|
+
# Import scoring functions
|
|
85
|
+
from .scoring import compute_weighted_score
|
|
86
|
+
from .utils import (
|
|
87
|
+
compute_confidence,
|
|
88
|
+
determine_status,
|
|
89
|
+
generate_recommendation,
|
|
90
|
+
generate_risk_assessment,
|
|
91
|
+
generate_summary,
|
|
92
|
+
)
|
|
93
|
+
|
|
94
|
+
# Compute weighted score and alignment breakdown
|
|
95
|
+
weighted_score, component_scores = compute_weighted_score(all_evidence, self.providers)
|
|
96
|
+
|
|
97
|
+
# Calculate confidence based on evidence consistency and confidence scores
|
|
98
|
+
confidence = compute_confidence(all_evidence)
|
|
99
|
+
|
|
100
|
+
# Determine status based on alignment score
|
|
101
|
+
status = determine_status(weighted_score)
|
|
102
|
+
|
|
103
|
+
# Generate report components
|
|
104
|
+
summary = generate_summary(component_scores, weighted_score)
|
|
105
|
+
risk = generate_risk_assessment(all_evidence, component_scores)
|
|
106
|
+
recommendation = generate_recommendation(component_scores, weighted_score)
|
|
107
|
+
|
|
108
|
+
# Create the alignment report
|
|
109
|
+
report = AlignmentReport(
|
|
110
|
+
overall_alignment=weighted_score,
|
|
111
|
+
confidence=confidence,
|
|
112
|
+
status=status,
|
|
113
|
+
breakdown=component_scores,
|
|
114
|
+
summary=summary,
|
|
115
|
+
evidence=all_evidence,
|
|
116
|
+
risk=risk,
|
|
117
|
+
recommendation=recommendation,
|
|
118
|
+
timeline=[], # Timeline would be populated with historical data in a real implementation
|
|
119
|
+
)
|
|
120
|
+
|
|
121
|
+
return report
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
"""Evidence providers package - exports all available providers."""
|
|
2
|
+
|
|
3
|
+
from ..models import Evidence
|
|
4
|
+
from .base import EvidenceProvider
|
|
5
|
+
from .providers.architecture_provider import ArchitectureProvider
|
|
6
|
+
from .providers.constraint_provider import ConstraintProvider
|
|
7
|
+
from .providers.dependency_provider import DependencyProvider
|
|
8
|
+
from .providers.execution_provider import ExecutionProvider
|
|
9
|
+
from .providers.file_graph_provider import FileGraphProvider
|
|
10
|
+
from .providers.goal_provider import GoalProvider
|
|
11
|
+
from .providers.problematic_findings_provider import ProblematicFindingsProvider
|
|
12
|
+
from .providers.requirement_coverage_provider import RequirementCoverageProvider
|
|
13
|
+
from .providers.scope_provider import ScopeProvider
|
|
14
|
+
|
|
15
|
+
__all__ = [
|
|
16
|
+
"EvidenceProvider",
|
|
17
|
+
"Evidence",
|
|
18
|
+
"GoalProvider",
|
|
19
|
+
"ConstraintProvider",
|
|
20
|
+
"ScopeProvider",
|
|
21
|
+
"ArchitectureProvider",
|
|
22
|
+
"ExecutionProvider",
|
|
23
|
+
"FileGraphProvider",
|
|
24
|
+
"DependencyProvider",
|
|
25
|
+
"RequirementCoverageProvider",
|
|
26
|
+
"ProblematicFindingsProvider",
|
|
27
|
+
]
|