This is a comprehensive AI-powered Git automation system that combines episodic memory, intelligent code generation, and automated GitHub operations. The system enables developers to create, update, and manage code repositories using natural language descriptions and AI-powered code generation.
- AI-Powered Code Generation: Uses LLM models to generate production-ready code based on natural language descriptions
- Automated GitHub Operations: Directly commits, updates, and deletes files in GitHub repositories
- Episodic Memory System: Remembers project state and progress across multiple development cycles
- Intelligent Workflow Orchestration: Manages complex development workflows with multiple AI agents
- Real-time Code Updates: Immediate code modifications without manual intervention
The system consists of several interconnected components:
- AI Agents: Specialized agents for different development tasks
- Episodic Memory: Persistent storage for project state and progress
- GitHub Integration: Direct repository management via GitHub API
- Workflow Orchestrator: Coordinates agent activities and manages development cycles
- Cron Scheduler: Automated execution of development tasks
- REST API: HTTP endpoints for manual operations and system management
- Project Overview
- System Architecture
- Key Components
- Installation & Setup
- Configuration
- API Reference
- Workflow Explanation
- Usage Examples
- Troubleshooting
- Development Guide
- Idea Generation Agent: Creates project specifications and ideas
- Planning Agent: Breaks down projects into implementable tasks
- Repository Management Agent: Sets up and manages GitHub repositories
- Development Agent: Generates actual code for specific tasks
- Quality Assurance Agent: Reviews and validates generated code
- Project State Tracking: Remembers current project status
- Task Progress: Tracks completed and remaining tasks
- Repository Information: Stores GitHub repository details
- Development History: Maintains log of all development activities
- Initial Cycle Management: Handles project setup and initialization
- Daily Development Cycles: Manages ongoing development tasks
- Agent Coordination: Ensures proper sequence of agent execution
- State Management: Maintains consistency across development phases
- Repository Operations: Create, update, delete files and folders
- Commit Management: Automated commit messages and version control
- Branch Handling: Support for multiple branches and workflows
- Conflict Resolution: Handles file conflicts and modifications
- Node.js: Version 18 or higher
- Git: Latest version
- GitHub Account: With Personal Access Token
- OpenAI API Key (or Google Gemini API Key)
git clone <your-repository-url>
cd git-automationnpm installCreate a .env file in the root directory:
# GitHub Configuration
GITHUB_TOKEN=your_github_personal_access_token
# AI Model Configuration
MODEL_PROVIDER=openai # or "gemini"
OPENAI_API_KEY=your_openai_api_key
GOOGLE_API_KEY=your_google_api_key
# Application Configuration
PORT=3000
COMMIT_MODE=test # or "production"
# Optional: Repository Override
GITHUB_REPO_NAME=your_default_repo_name
GITHUB_REPO_URL=https://github.com/username/repo
# Optional: Notification Services
SLACK_TOKEN=your_slack_token
SLACK_CHANNEL=#general- Go to GitHub Settings β Developer settings β Personal access tokens
- Generate a new token with these permissions:
repo(Full control of private repositories)workflow(Update GitHub Action workflows)admin:org(if working with organization repositories)
npm start
# or
node index.js| Variable | Description | Required | Default |
|---|---|---|---|
GITHUB_TOKEN |
GitHub Personal Access Token | β Yes | - |
MODEL_PROVIDER |
AI Model Provider (openai/gemini) | β No | openai |
OPENAI_API_KEY |
OpenAI API Key | β Yes* | - |
GOOGLE_API_KEY |
Google Gemini API Key | β Yes* | - |
PORT |
Application Port | β No | 3000 |
COMMIT_MODE |
Commit Schedule Mode | β No | test |
GITHUB_REPO_NAME |
Default Repository Name | β No | Auto-generated |
GITHUB_REPO_URL |
Default Repository URL | β No | Auto-generated |
*Required based on MODEL_PROVIDER selection
- Interval: Every 2 minutes
- Cron Pattern:
*/2 * * * * - Use Case: Development and testing
- Interval: Daily at 9:00 AM
- Cron Pattern:
0 9 * * * - Use Case: Production deployments
http://localhost:3000/api
POST /api/git-agent/runPurpose: Execute the main development workflow (initial setup or development cycle)
Request Body:
{
"projectName": "My Awesome Project",
"description": "A web application for task management",
"complexity": "intermediate",
"techConstraints": ["Node.js", "React", "MongoDB"]
}Parameters:
projectName(optional): Specific project name/ideadescription(optional): Additional context about the projectcomplexity(optional):beginner,intermediate, oradvancedtechConstraints(optional): Array of technology requirements
Response:
{
"success": true,
"data": {
"projectSpec": "Project specification JSON",
"plan": "Implementation plan with tasks",
"repo": "Repository information",
"status": "Project status"
},
"message": "Initial project setup completed successfully"
}Get Scheduler Status:
GET /api/git-agent/cron/statusStart Scheduler:
POST /api/git-agent/cron/startStop Scheduler:
POST /api/git-agent/cron/stopRestart Scheduler:
POST /api/git-agent/cron/restartManual Trigger:
POST /api/git-agent/cron/triggerGet Project Status:
GET /api/git-agent/statusDebug Current State:
GET /api/git-agent/debugReset Project:
POST /api/git-agent/resetForce Reset:
POST /api/git-agent/force-resetContinue Development:
POST /api/git-agent/continuePOST /api/code-update/updatePurpose: Update or create code files using AI generation
Request Body:
{
"repoName": "my-project",
"filePath": "src/utils/validator.js",
"change": "Add input validation for email addresses",
"branch": "main",
"commitMessage": "feat: add email validation"
}Parameters:
repoName(required): GitHub repository namefilePath(required): Path to the file to update/createchange(required): Description of the changebranch(optional): Target branch (defaults to "main")commitMessage(optional): Custom commit message
DELETE /api/code-update/deletePurpose: Delete files or folders from GitHub repository
Request Body:
{
"repoName": "my-project",
"filePath": "src/utils/oldFile.js",
"branch": "main",
"commitMessage": "Remove deprecated file"
}Parameters:
repoName(required): GitHub repository namefilePath(required): Path to the file/folder to deletebranch(optional): Target branch (defaults to "main")commitMessage(optional): Custom commit message
User Request β Idea Generation β Project Planning β Repository Setup β Memory Storage
- Idea Generation: AI creates project specification based on user input
- Project Planning: Breaks down project into implementable tasks
- Repository Setup: Creates GitHub repository with initial structure
- Memory Storage: Saves project state and plan to episodic memory
Cron Trigger β Task Selection β Code Generation β GitHub Commit β Memory Update
- Task Selection: Picks next uncompleted task from the plan
- Code Generation: AI generates code for the selected task
- GitHub Commit: Commits generated code to the repository
- Memory Update: Updates progress and moves to next task
Input Validation β Agent Execution β Result Processing β State Update β Response
- Input Validation: Validates request parameters and authentication
- Agent Execution: Runs appropriate AI agent for the task
- Result Processing: Processes agent output and validates results
- State Update: Updates project state and memory
- Response: Returns formatted response to user
curl -X POST http://localhost:3000/api/git-agent/run \
-H "Content-Type: application/json" \
-d '{
"projectName": "Task Management App",
"description": "A web application for managing personal and team tasks",
"complexity": "intermediate",
"techConstraints": ["Node.js", "React", "MongoDB", "Express"]
}'curl -X GET http://localhost:3000/api/git-agent/statuscurl -X POST http://localhost:3000/api/code-update/update \
-H "Content-Type: application/json" \
-d '{
"repoName": "task-management-app",
"filePath": "src/components/TaskForm.js",
"change": "Add form validation for task title and due date",
"commitMessage": "feat: add form validation"
}'curl -X DELETE http://localhost:3000/api/code-update/delete \
-H "Content-Type: application/json" \
-d '{
"repoName": "task-management-app",
"filePath": "src/utils/oldHelper.js",
"commitMessage": "Remove deprecated helper functions"
}'# Check status
curl -X GET http://localhost:3000/api/git-agent/cron/status
# Start scheduler
curl -X POST http://localhost:3000/api/git-agent/cron/start
# Stop scheduler
curl -X POST http://localhost:3000/api/git-agent/cron/stop# Update code in feature branch
curl -X POST http://localhost:3000/api/code-update/update \
-H "Content-Type: application/json" \
-d '{
"repoName": "my-project",
"filePath": "src/features/user-auth.js",
"change": "Implement JWT authentication middleware",
"branch": "feature/user-auth",
"commitMessage": "feat: implement JWT authentication"
}'# Create multiple files
for file in "auth.js" "validation.js" "database.js"; do
curl -X POST http://localhost:3000/api/code-update/update \
-H "Content-Type: application/json" \
-d "{
\"repoName\": \"my-project\",
\"filePath\": \"src/utils/$file\",
\"change\": \"Create $file utility module\"
}"
doneProblem: GITHUB_TOKEN not found in environment variables
Solution:
- Check
.envfile exists - Verify token is correctly set
- Ensure token has required permissions
Problem: Repository 'repo-name' not found
Solution:
- Verify repository name is correct
- Check GitHub token has access to repository
- Ensure repository exists and is not private
Problem: Failed to generate code
Solution:
- Verify API key is valid
- Check API quota/limits
- Ensure MODEL_PROVIDER is correctly set
Problem: Scheduler not starting or running Solution:
- Check cron status endpoint
- Verify environment variables
- Restart the scheduler manually
Problem: Project state not persisting Solution:
- Check memory service configuration
- Verify file permissions
- Reset project state if needed
# Check system status
curl -X GET http://localhost:3000/api/git-agent/debug
# Debug current state
curl -X POST http://localhost:3000/api/git-agent/debug-state
# Check cron status
curl -X GET http://localhost:3000/api/git-agent/cron/status
# Force reset project
curl -X POST http://localhost:3000/api/git-agent/force-resetgit-automation/
βββ agent/ # AI agent implementations
β βββ agents.js # Core agent functions
β βββ developmentAgent.js # Code generation agent
β βββ workflow.js # Workflow orchestration
βββ controllers/ # API controllers
β βββ gitAgentController.js # Main workflow controller
β βββ codeUpdateController.js # Code update/delete controller
βββ routes/ # API route definitions
β βββ gitAgentRoutes.js # Main workflow routes
β βββ codeUpdateRoutes.js # Code update routes
βββ services/ # Business logic services
β βββ memoryService.js # Episodic memory management
β βββ cronScheduler.js # Automated task scheduling
β βββ notificationService.js # Notification handling
βββ utils/ # Utility functions
β βββ model.js # AI model configuration
β βββ features.js # GitHub repository utilities
βββ config/ # Configuration files
βββ index.js # Application entry point
βββ WORKFLOW_README.md # This documentation
- Add agent function to
agent/agents.js - Update workflow orchestration in
agent/workflow.js - Add memory integration in
services/memoryService.js
- Create controller function
- Add route definition
- Update documentation
- Modify
services/memoryService.js - Update agent integration
- Add new state tracking
# Start application
npm start
# Test endpoints with curl commands
curl -X POST http://localhost:3000/api/git-agent/run \
-H "Content-Type: application/json" \
-d '{"projectName": "test-project"}'# Run tests (if implemented)
npm test
# Check API health
curl -X GET http://localhost:3000/api/git-agent/status- Episodic Memory: Long-term memory for specific events and experiences
- AI Agents: Autonomous software entities that perform specific tasks
- Workflow Orchestration: Coordination of multiple processes and systems
- GitOps: Git-based operations and infrastructure management
- GitHub Issues: Report bugs and request features
- Discussions: Ask questions and share ideas
- Contributing: Guidelines for contributing to the project
This Git Automation Workflow system represents a significant advancement in AI-powered development automation. By combining episodic memory, intelligent agents, and direct GitHub integration, it provides developers with a powerful tool for managing code repositories and automating development workflows.
The system is designed to be:
- Intelligent: Uses AI to understand and execute development tasks
- Efficient: Automates repetitive development processes
- Reliable: Maintains state and progress across sessions
- Extensible: Easy to add new features and capabilities
- User-Friendly: Simple API interface for all operations
Whether you're a solo developer looking to automate your workflow or a team lead managing multiple projects, this system provides the tools and infrastructure needed to streamline development processes and increase productivity.
Happy Coding! π
For questions, issues, or contributions, please refer to the project's GitHub repository.