An autonomous agent that implements GitHub Issues using Claude Code in headless mode.
Works with any GitHub repository — not limited to a specific tech stack or project type.
GitHub Issue (label: agent-task)
│
▼
Agent polls every 5 min
│
▼
Git: clone/pull + create new branch
│
▼
Claude Code (headless):
- Reads the entire repository
- Understands the architecture
- Implements the issue
- Builds & tests
- Fixes errors autonomously
│
▼
Git: commit + push
│
▼
GitHub: Create PR + close issue
| Raw API approach | Claude Code (this agent) |
|---|---|
| No repository awareness | Reads the entire codebase |
| Regex-based file parsing | Direct file editing with context |
| No build/test awareness | Runs builds/tests automatically |
| Fixes without context | Iterates with full context |
| ~100 lines of glue code | Claude does the heavy lifting |
# Node.js (>= 18)
node --version
# Claude Code CLI installieren
npm install -g @anthropic-ai/claude-code
# Python deps
pip install -r requirements.txtCopy .env.example to .env and fill in your credentials:
cp .env.example .envThen edit .env:
# Required
GITHUB_TOKEN=ghp_... # GitHub Personal Access Token (repo scope)
ANTHROPIC_API_KEY=sk-ant-... # Anthropic API Key
AGENT_REPO=owner/your-repo # Target repository
# Optional
AGENT_POLL_INTERVAL=300 # Polling interval in seconds (default: 300)
AGENT_ISSUE_LABEL=agent-task # Issue label to watch (default: agent-task)
AGENT_MAX_TURNS=30 # Max Claude Code turns (default: 30)
AGENT_REPO_PATH=./repo # Local clone path (default: ./repo)How to get tokens:
- GITHUB_TOKEN: Create a Personal Access Token with
reposcope - ANTHROPIC_API_KEY: Get your API key from Anthropic Console
The agent reads CLAUDE.md from your repository root to understand your project's architecture and coding standards.
Example provided: The included CLAUDE.md is configured for Connect-A-PIC-Pro (C# / Avalonia / MVVM project). You should:
- Copy it to your target repository:
cp CLAUDE.md /path/to/your/repo/CLAUDE.md - Adapt it to your project's needs (tech stack, testing framework, architecture patterns)
Key sections to customize:
- File size limits (e.g., 250 lines for C#)
- Architecture patterns (MVVM, Clean Architecture, etc.)
- Testing requirements (xUnit, Jest, pytest, etc.)
- Build commands (
dotnet build,npm test,cargo build, etc.) - Vertical Slice requirement — ensure PRs include UI + backend + tests
# Run continuously (polls every 5 minutes)
python main.py
# Run once for testing
python main.py --once
# Or use the provided script
./run_agent.shCreate an issue on GitHub with the label agent-task (or your custom label from .env):
Example for Connect-A-PIC-Pro:
Title: Add loss budget analyzer for optical paths
Body:
Implement a loss budget analysis feature that calculates total optical loss along signal paths.
Requirements:
- Core analyzer class in Connect-A-Pic-Core/Analysis/
- ViewModel with ObservableProperty and RelayCommand
- AXAML panel in MainWindow.axaml (right side properties area)
- Unit tests for core logic
- Integration test for Core → ViewModel flow
- Must follow vertical slice architecture (Core + ViewModel + View + Tests)
The agent will automatically:
- Pull latest changes from
main - Create a new branch
agent/issue-{number}-{timestamp} - Implement the full vertical slice
- Run builds and tests until they pass
- Create a PR and close the issue
All agent activity is logged to agent.log and printed to stdout simultaneously.
--dangerously-skip-permissionsis required for headless mode. This allows Claude Code to read/write files and execute commands autonomously.- Only run on trusted machines — your dev machine or isolated environments.
- The agent never commits directly to
main— always creates feature branches. - The
repo/directory is local only and not tracked in Git.
To run the agent on another machine (e.g., work computer):
- Clone this repository:
git clone https://github.com/aignermax/autonomous-issue-agent.git - Install dependencies (see Setup section above)
- Configure
.envwith your tokens - Run
python main.py
The repo/ directory will be automatically cloned on first run.
This agent was originally developed for Connect-A-PIC-Pro, a photonic circuit design tool built with C# / Avalonia.
The included CLAUDE.md demonstrates:
- Vertical Slice Architecture (Core + ViewModel + View + Tests)
- File size limits (max 250 lines per new file)
- MVVM patterns with CommunityToolkit.Mvvm
- Testing strategy (xUnit + Shouldly + Moq)
Adapt these patterns to your own project's needs.
- Docker container for isolated execution
- Webhooks instead of polling (GitHub → Agent)
- Token budget tracking per issue
- Multi-issue queue with prioritization
- Slack/Discord notifications on PR creation
MIT License - see LICENSE for details.
Contributions welcome! Feel free to open issues or submit PRs.