AI-powered validation tool that ensures code changes match Jira story requirements
Project description
AI Intent Tracker with Jira Integration
Automatically validate that code changes match Jira story requirements using AI. Prevent scope creep and ensure developers work on what they committed to.
The Problem
- Scope Creep: Developers working on PROJ-123 but changing unrelated code
- Difficult Reviews: Managers can't tell if PR matches the Jira story
- Lost Context: Code changes don't align with ticket requirements
- Compliance: No audit trail linking code to business requirements
The Solution
AI Intent Tracker validates every commit against Jira stories:
- Git Hook: Automatically validates commits before they're made (optional)
- Jira Integration: Extracts intent from Jira story descriptions
- AI Validation: Checks if code changes match the story (0-10 score)
- PR Reports: Manager sees alignment scores before approving
Key Features
- Jira Story Validation - Automatic intent from Jira tickets
- Pre-commit Hooks - Block misaligned commits before they happen (optional)
- AI-Powered Analysis - GPT-4 validates code vs story requirements
- PR Dashboard - Manager-friendly validation reports
- Scope Creep Detection - Catches unrelated changes automatically
- Zero Friction - Works with existing git workflow
- Security Scanning - AI-powered vulnerability detection
Quick Start (5 Minutes)
1. Install (1 min)
git clone https://github.com/yourusername/intent_aware_git.git
cd intent_aware_git
pip install -r requirements.txt
pip install -e .
2. Configure Jira (2 min)
# Copy template
cp .env.example .env
# Edit .env with your credentials:
# JIRA_URL=https://yourcompany.atlassian.net
# JIRA_EMAIL=you@company.com
# JIRA_API_TOKEN=<your_token>
# OPENAI_API_KEY=<your_key>
Get Jira API token: https://id.atlassian.com/manage-profile/security/api-tokens
3A. Server-Side Only (Zero Setup)
# Add .github/workflows/pr-summary.yml to your repo
# Add secrets to GitHub repo settings
# Done! Validation happens automatically on PRs
3B. Client-Side (Optional - For Instant Feedback)
cd /path/to/your/project
intent install-hooks
4. Use It
# Make changes
git add .
# Commit with Jira ID
git commit -m "PROJ-123: Add OAuth authentication"
# With hook: validates immediately
# Without hook: validates on PR (GitHub Action)
How It Works
Two-Tier Architecture
Tier 1: Server-Side (Always Active)
Developer → commit → push → PR → GitHub Action validates → Manager reviews
↑ Zero setup, can't bypass
What Happens:
- Developer commits with Jira ID:
PROJ-123: Add feature - Pushes to GitHub
- GitHub Action automatically:
- Extracts PROJ-123
- Fetches story from Jira
- Validates with AI
- Posts report as PR comment
- Sets status check (pass/fail)
- Manager reviews before merge
Tier 2: Client-Side (Optional)
Developer → commit → pre-commit hook validates → instant feedback
What Happens:
- Developer installs hook:
intent install-hooks - On commit, hook:
- Extracts Jira ID
- Fetches story
- Validates with AI
- Blocks if score < 3/10
- Developer gets instant feedback
Validation Flow
graph LR
A[Commit with PROJ-123] --> B[Extract Jira ID]
B --> C[Fetch Jira Story]
C --> D[Get Git Diff]
D --> E[AI Validation]
E --> F{Score >= 3?}
F -->|Yes| G[Pass]
F -->|No| H[Block]
Developer Workflow
Regular Developer (No Setup)
# 1. Work on Jira story
# 2. Make changes
git add .
# 3. Commit normally with Jira ID
git commit -m "PROJ-456: Add OAuth2 login button"
# 4. Push
git push origin feature-branch
# 5. Create PR
# → GitHub Action validates automatically
# → Posts alignment report
Power User (With Hook)
# One-time setup
intent install-hooks
# Then commit as normal
git commit -m "PROJ-456: Add OAuth2 login button"
# → Hook validates immediately (5 seconds)
# → Get instant feedback
# → GitHub Action still validates on PR
Manager Workflow
Review PR with Auto-Generated Report
Pull Request #234: "Add OAuth and fix styling"
Status Checks:
[PASS] intent-validation - Passed
Comment from AI Intent Tracker:
---
## Jira Story Validation Report
### PROJ-123: Add OAuth2 authentication
**Alignment Score:** 9/10 (Confidence: 95%)
**Status:** aligned
**Key Functionality Present:** Yes
**What Aligns:**
- OAuth2 flow implementation present
- Token validation logic added
- Proper error handling included
**Suggestions:**
- Consider adding unit tests for token refresh
### Summary
- Average Score: 9.0/10
- Stories Validated: 1
- Critical Issues: 0
Manager Actions:
- Approve (high score)
- Review carefully (medium score)
- Request changes (low score)
Example Output
Pre-commit Hook Output
[INFO] Validating commit against Jira story...
[SUCCESS] Found Jira ID: PROJ-123
[INFO] Fetching Jira story PROJ-123...
[SUCCESS] Story: Add OAuth2 authentication
Type: Story | Status: In Progress
[ANALYSIS] Intent Alignment:
Score: 9/10 | Confidence: 95% | Status: aligned
[OK] Key functionality present
[OK] GOOD alignment
[MATCHES] What aligns:
• OAuth2 flow implementation present
• Token validation logic added
• Proper error handling included
[SUCCESS] Commit validation passed!
Scope Creep Detection
[CRITICAL] MISMATCH - Code does NOT implement stated intent!
Score: 2/10 [FAIL]
[WARNING] Discrepancies:
• Story says "fix styling" but OAuth system was refactored
• Database schema changes not mentioned in story
• Auth configuration modified - out of scope
[SUGGESTIONS]
• Split into multiple stories
• Current changes should be PROJ-790, PROJ-791
• Only style changes belong in PROJ-789
[BLOCKED] Commit blocked due to alignment < 3/10
Use Cases
1. Scope Creep Detection
Story: PROJ-789: Fix login button styling
What Developer Changed:
- LoginButton.css (expected)
- AuthSystem.js (unexpected)
- database/schema.sql (unexpected)
Result: Score 2/10 → Blocked → Developer splits into proper stories
2. Multi-Story PR
git commit -m "PROJ-100: Add user profile page"
git commit -m "PROJ-101: Add profile photo upload"
git commit -m "PROJ-102: Add profile edit form"
Result: Each story validated separately, granular feedback per story
3. Emergency Bypass
# Production hotfix
SKIP_INTENT_VALIDATION=1 git commit -m "HOTFIX: Fix crash"
Project Structure
ai-intent-tracker/
│
├── cli/ # Python CLI code
│ ├── commands.py # CLI commands
│ ├── jira_client.py # Jira API integration
│ ├── ai_validator.py # AI validation logic
│ ├── install_hooks.py # Git hook installer
│ └── utils.py # Helpers
│
├── hooks/
│ └── pre-commit # Git pre-commit hook
│
├── .github/
│ └── workflows/
│ └── pr-summary.yml # PR validation action
│
├── tests/ # Unit tests
├── README.md
├── requirements.txt
└── setup.py
Configuration
Environment Variables
# Required for Jira integration
JIRA_URL=https://yourcompany.atlassian.net
JIRA_EMAIL=you@company.com
JIRA_API_TOKEN=your_token_here
# Required for AI validation
OPENAI_API_KEY=your_openai_key
# Optional: Control validation behavior
ENABLE_AI_VALIDATION=true
SKIP_INTENT_VALIDATION=false
GitHub Secrets (For PR Validation)
Add these to your repository settings:
JIRA_URLJIRA_EMAILJIRA_API_TOKENOPENAI_API_KEY
Make Validation Required
Repository Settings → Branches → main →
☑️ Require status checks to pass
☑️ intent-validation
Now PRs can't be merged without passing validation!
Benefits by Role
For Developers
- Catch scope creep early
- Learn from AI suggestions
- Clear definition of "on-task"
- Optional instant feedback
For Managers
- See alignment before review
- Block scope creep automatically
- Save review time
- Data-driven decisions
For Teams
- Reduce wasted development time
- Improve estimate accuracy
- Compliance audit trail
- Better sprint execution
Troubleshooting
"Jira authentication failed"
- Check JIRA_EMAIL and JIRA_API_TOKEN in .env
- Verify API token is valid: https://id.atlassian.com/manage-profile/security/api-tokens
- Test:
curl -u your.email@company.com:token https://yourcompany.atlassian.net/rest/api/3/myself
"Jira issue not found"
- Verify issue ID format:
PROJECT-123(uppercase) - Check issue exists and you have access
- Test in Jira UI first
"OpenAI API error"
- Verify OPENAI_API_KEY is valid
- Check API quota/billing at https://platform.openai.com/usage
- Or disable AI:
ENABLE_AI_VALIDATION=false
Hook not running
# Check hook is installed
ls -la .git/hooks/pre-commit
# Check it's executable
chmod +x .git/hooks/pre-commit
# Test manually
.git/hooks/pre-commit
Advanced Usage
Commit Message Formats
All these work:
"PROJ-123: Add feature"
"[PROJ-123] Add feature"
"PROJ-123 Add feature"
"Add feature (PROJ-123)"
Skip Validation (Optional - Rarely Needed)
Most commits work normally without any special markers. Only use these for edge cases:
# Normal commit (no skip marker needed)
git commit -m "PROJ-123: Add OAuth feature"
# → Validates automatically
# Skip validation (only when needed)
git commit -m "PROJ-123: Emergency hotfix [skip-validation]"
git commit -m "Update README [no-validation]"
# Alternative: environment variable
SKIP_INTENT_VALIDATION=1 git commit -m "Config tweak"
When to skip (rare cases):
- Emergency production hotfixes
- README/docs updates
- Version bumps, config changes
You DON'T need skip markers for:
- Normal feature work
- Bug fixes
- Code without tests (validation is flexible)
- Any commit that roughly matches your Jira story
Custom Scoring Threshold
Edit .github/workflows/pr-summary.yml:
# Block if score < 5 (default is 3)
if critical_issues or score < 5:
sys.exit(1)
What's Next
Immediate Improvements
- Cache Jira stories (reduce API calls)
- Offline mode (store stories locally)
- Better error messages
- Add unit tests
Short Term
- VS Code extension (one-click install)
- Team dashboard (web UI)
- Historical analytics
- Support GitLab/Bitbucket
Long Term
- Linear/Asana/Azure DevOps support
- Custom validation rules
- On-prem deployment option
- Enterprise licensing
Contributing
Contributions are welcome! Please feel free to submit a Pull Request.
- Fork the repo
- Create your feature branch (
git checkout -b feature/AmazingFeature) - Commit your changes (
git commit -m 'Add some AmazingFeature') - Push to the branch (
git push origin feature/AmazingFeature) - Open a Pull Request
License
This project is licensed under the MIT License - see the LICENSE file for details.
Acknowledgments
- OpenAI for GPT-4 API
- Atlassian for Jira API
- The open-source community
Support
- Email: your.email@example.com
- Issues: GitHub Issues
- 💬 Discussions: GitHub Discussions
Made with ❤️ for better code reviews
**3. Commit with Jira ID**
```bash
# Commit message MUST include Jira ID
git commit -m "PROJ-123: Add OAuth2 authentication"
# The pre-commit hook will:
# → Extract PROJ-123 from message
# → Fetch story details from Jira
# → Analyze code changes vs story intent with AI
# → Block commit if misaligned (score < 3/10)
# → Warn if low alignment (score < 5/10)
4. Push and create PR
git push origin feature-branch
# GitHub Action automatically runs on PR
# → Validates all commits against their Jira stories
# → Posts validation report as PR comment
# → Shows alignment scores for manager review
Manager Workflow
1. Review PR with validation report
- PR comment shows alignment scores for each Jira story
- See what matches vs what doesn't
- Get AI-generated suggestions
- Identify scope creep automatically
2. Approve or request changes
- High alignment (7-10/10) → safe to approve
- Medium (5-7/10) → review carefully
- Low (<5/10) → request changes
Example Output
Pre-commit Hook
[INFO] Validating commit against Jira story...
[SUCCESS] Found Jira ID: PROJ-123
[INFO] Fetching Jira story PROJ-123...
[SUCCESS] Story: Add OAuth2 authentication
Type: Story | Status: In Progress
[INFO] Running AI validation against Jira story...
[ANALYSIS] Intent Alignment:
Score: 9/10 | Confidence: 95% | Status: aligned
[OK] Key functionality present
[OK] GOOD alignment - Changes match intent well
[MATCHES] What aligns:
• OAuth2 flow implementation present
• Token validation logic added
• Proper error handling included
[SUCCESS] Commit validation passed!
PR Comment
## Jira Story Validation Report
### PROJ-123: Add OAuth2 authentication
**Alignment Score:** 9/10 (Confidence: 95%)
**Status:** aligned
**Key Functionality Present:** Yes
**What Aligns:**
- OAuth2 flow implementation present
- Token validation logic added
- Proper error handling included
**Suggestions:**
- Consider adding unit tests for token refresh
- Document OAuth2 configuration in README
---
### Summary
- **Average Score:** 9.0/10
- **Stories Validated:** 1
- **Critical Issues:** 0
- **Low Alignment:** 0
- **Good Alignment:** 1
Advanced Configuration
Skip Validation (Emergency)
# Skip all validation
SKIP_INTENT_VALIDATION=1 git commit -m "PROJ-123: Hotfix"
# Skip only AI validation
ENABLE_AI_VALIDATION=false git commit -m "PROJ-123: Minor change"
GitHub Secrets
Add these to your repository secrets for PR validation:
JIRA_URLJIRA_EMAILJIRA_API_TOKENOPENAI_API_KEY
Features
- 🎯 Jira Story Validation: Automatic intent from Jira tickets
- 🔒 Pre-commit Hooks: Block misaligned commits before they happen
- 🤖 AI-Powered Analysis: GPT-4 validates code vs story requirements
- 📊 PR Dashboard: Manager-friendly validation reports
- 🚫 Scope Creep Detection: Catches unrelated changes automatically
- ⚡ Zero Friction: Works with existing git workflow
- 🔐 Security Scanning: AI-powered vulnerability detection
How It Works
- Developer starts work on Jira story PROJ-123
- Makes code changes and stages them
- Commits with
git commit -m "PROJ-123: description" - Pre-commit hook:
- Extracts PROJ-123 from message
- Fetches story from Jira API
- Analyzes code diff vs story with AI
- Blocks if score < 3/10
- GitHub Action validates entire PR
- Manager reviews alignment report before merge
Benefits
For Developers
- Catch scope creep early
- Get AI feedback on alignment
- Learn what "on-task" looks like
- Automatic documentation of intent
For Managers
- See alignment before code review
- Identify scope issues at PR time
- Data-driven approval decisions
- Audit trail for compliance
For Teams
- Reduce wasted review time
- Improve estimate accuracy
- Better sprint planning
- Clear commit-to-story mapping
Troubleshooting
"Jira authentication failed"
- Check JIRA_EMAIL and JIRA_API_TOKEN in .env
- Verify API token is valid: https://id.atlassian.com/manage-profile/security/api-tokens
"Jira issue not found"
- Verify issue ID format: PROJECT-123 (uppercase)
- Check issue exists and you have access
"OpenAI API error"
- Verify OPENAI_API_KEY is valid
- Check API quota/billing
- Or disable AI:
ENABLE_AI_VALIDATION=false
Contributing
Contributions are welcome! Please feel free to submit a Pull Request.
Project details
Release history Release notifications | RSS feed
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 ai_intent_tracker-1.0.0.tar.gz.
File metadata
- Download URL: ai_intent_tracker-1.0.0.tar.gz
- Upload date:
- Size: 22.6 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
f089bd91870226daa66e5b844bdb2e37a2ae6bb584e7ccb51f52730504840ffa
|
|
| MD5 |
12c585b3c8def7c96040660bb5f20ccb
|
|
| BLAKE2b-256 |
4cdbb0e26fbaed08e316f629b45903f0bb946833065c40b88c8aa037c7a9768d
|
File details
Details for the file ai_intent_tracker-1.0.0-py3-none-any.whl.
File metadata
- Download URL: ai_intent_tracker-1.0.0-py3-none-any.whl
- Upload date:
- Size: 22.7 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
a1f06a971343653b56b15d06c6488f7b8a2641f73265515bcf97da5603e2ac5b
|
|
| MD5 |
2a11c717085bbd93b8b388ce9e343e9e
|
|
| BLAKE2b-256 |
5652e989c79b631987c37b9805ef0e95e3a140d2d04f4ab3313cc6d84c0303c5
|