AI Pair Programming Through Git
LLM Agents Hackathon - December 2024
Reimagining AI Pair Programming
Today's AI coding assistants force developers into cumbersome workflows that break established software engineering practices.
Our Solution
GitIQ reimagines AI pair programming by using Git as the primary interface, operating as a lightweight agent that behaves like a real software engineering colleague.
The Team
IQ
GitIQ Bot
AI Pair Programming Assistant
Contact: gitiq.bot@gmail.com
GitHub: @gitiq-bot
5,091 lines added, 2,542 lines changed
Fun fact: This team member wrote most of its own code!
The Problem
Chat-based Solutions
Constant context-switching between chat and IDE
Manual copy-paste workflows
No integration with development tools
Incomplete responses with placeholders
IDE Integration
Better workflow integration
Lacks code provenance tracking
No preservation of AI-generated decisions
Poor fit with team code review practices
Unintended changes leak into codebase
Our Approach
Instead of AI as a chat tool or IDE plugin, GitIQ introduces AI as a coworker
Uses Git as the primary interface - just like a real team member
Creates complete Pull Requests with proper documentation
Preserves context through commit messages and metadata
Handles multi-file changes as coherent units
Integrates naturally with existing review workflows
Works with any editor/IDE since changes flow through Git
How It Works
1
Describe desired changes in natural language
2
GitIQ creates a semantically-named branch
3
AI makes changes across selected files
4
Changes committed with detailed messages
5
PR created with comprehensive documentation
6
Human reviews and comments on proposed change
7
GitIQ proposes amends PR with additional commits
Simple Architecture
Focused on simplicity and standard tools
Pure Python with Flask backend
Simple HTML/JavaScript frontend
Git operations via GitPython
LLM integration for code generation
Local filesystem monitoring
Streaming status updates
State completely lives in git/Github PRs
Zero-dependency philosophy:
No frameworks except Flask
No build tools or preprocessors
Standard library preferred
Pure functions and simple data structures
Example Commit
Implement JWT-based authentication system
Model: gpt-4-turbo-preview
Prompt: Update the user authentication to use JWT tokens instead of session cookies
Description: Implemented JWT-based authentication system to replace session cookies,
enhancing security and enabling stateless authentication.
Files modified:
Key Benefits
Natural Integration
Operates like a real engineering colleague through familiar Git workflows
Complete Changes
Generates full PRs instead of fragmentary code snippets
Full Traceability
Every change tracked with its prompt and model metadata
Looking Ahead
Multi-modal input support (screenshots/screencapture)
File-level streaming updates
Enhanced PR comment-driven iterations
Prompt history support in UI
Get Started
Join us in reimagining AI pair programming
📁 GitHub: github.com/shapor/gitiq
🎥 Demo: https://www.youtube.com/watch?v=9YhMlo8qr2c
Appendix: Agent Architecture
flowchart TB
subgraph UserInterface["User Interface Layer"]
UI["Web UI"]
StreamClient["Stream Client"]
end
subgraph Orchestration["Orchestration Layer"]
StreamProcessor["Stream Processing Agent"]
EventBus["Event Bus"]
end
subgraph LLMAgents["LLM Agents"]
CodeGen["Code Generation Agent\n- Analyzes files\n- Generates changes\n- Creates new files"]
PRGen["PR Generation Agent\n- Creates branch names\n- Writes PR descriptions\n- Generates commit msgs"]
CommentAgent["Comment Processing Agent\n- Processes @mentions\n- Generates responses\n- Handles change requests"]
end
subgraph GitAgents["Git Agents"]
LocalGit["Local Git Agent\n- Manages branches\n- Stages changes\n- Creates commits"]
GitHubAgent["GitHub Agent\n- Creates PRs\n- Pushes branches\n- Manages comments"]
PollAgent["PR Polling Agent\n- Monitors open PRs\n- Detects new comments\n- Triggers responses"]
end
subgraph ExternalAPIs["External APIs"]
LLMProvider["LLM Provider\n(OpenAI/Anthropic)"]
GitHubAPI["GitHub API"]
Git["Local Git\nRepository"]
end
UI --> StreamClient
StreamClient --> StreamProcessor
StreamProcessor --> EventBus
EventBus --> CodeGen & PRGen & CommentAgent
EventBus --> LocalGit & GitHubAgent
CodeGen & PRGen & CommentAgent --> LLMProvider
LocalGit --> Git
GitHubAgent --> GitHubAPI
PollAgent --> GitHubAPI
PollAgent --> EventBus
CodeGen --> PRGen
CommentAgent --> CodeGen
GitHubAgent --> PollAgent
classDef interface fill:#ffffff,stroke:#24292E
classDef orchestration fill:#f8fafc,stroke:#24292E
classDef llmagents fill:#f1f5f9,stroke:#24292E
classDef gitagents fill:#e2e8f0,stroke:#24292E
classDef external fill:#2563EB,stroke:#24292E,color:#ffffff
class UI,StreamClient interface
class StreamProcessor,EventBus orchestration
class CodeGen,PRGen,CommentAgent llmagents
class LocalGit,GitHubAgent,PollAgent gitagents
class LLMProvider,GitHubAPI,Git external
Appendix: Backend Flow
sequenceDiagram
participant U as User/Browser
participant A as Flask API
participant SP as Stream Processor
participant L as LLM Client
participant G as Git Ops
participant GH as GitHub API
participant GHP as GitHub Poller
U->>A: POST /api/pr/create/stream
activate A
A->>SP: Initialize Stream
activate SP
SP->>G: Read Selected Files
G-->>SP: File Contents
SP->>L: Generate Changes (prompt + files)
L-->>SP: Generated Code Changes
SP->>L: Generate Branch/PR Metadata
L-->>SP: Branch Name, PR Title, Description
SP->>G: Create Branch
G-->>SP: Branch Created
SP->>G: Write File Changes
G-->>SP: Changes Written
SP->>G: Commit Changes
G-->>SP: Changes Committed
SP->>G: Push Branch
G-->>SP: Branch Pushed
SP->>GH: Create Pull Request
GH-->>SP: PR Created
SP-->>A: Stream Complete
deactivate SP
A-->>U: SSE Complete
deactivate A
rect rgb(241, 245, 249)
Note over GHP: Background Thread
loop Every 60 seconds
GHP->>GH: Get Open PRs
GH-->>GHP: Open PRs List
loop Each PR
GHP->>GH: Get New Comments
GH-->>GHP: PR Comments
opt Has @gitiq-bot mention
GHP->>L: Process Comment Prompt
L-->>GHP: Generated Response
GHP->>GH: Post Response Comment
GH-->>GHP: Comment Posted
end
end
end
end
rect rgb(226, 232, 240)
Note over SP: Stream Events Flow
SP->>U: Stage: read_files
SP->>U: Stage: generate_changes
SP->>U: Stage: generate_metadata
SP->>U: Stage: create_branch
SP->>U: Stage: apply_changes
SP->>U: Stage: commit_changes
SP->>U: Stage: push_changes
SP->>U: Stage: create_pr
SP->>U: Complete
end
rect rgb(37, 99, 235)
Note over L: LLM Prompts
Note over L: 1. Code Generation
Note over L: 2. Branch/PR Naming
Note over L: 3. PR Description
Note over L: 4. Comment Responses
end