Skip to content

kimwwk/fully-automated-remote-agent-experiments

Repository files navigation

Autonomous Coding Agent

An autonomous coding agent powered by Claude Agent SDK and task-master AI that implements features from a structured task list.

Overview

This agent:

  • Connects to task-master MCP server to fetch tasks
  • Reads project context from PRD.md
  • Autonomously implements one task at a time
  • Creates feature branches and commits changes
  • Marks tasks as complete

Prerequisites

  1. Node.js - for task-master-ai
  2. Python 3.11+ - for Claude Agent SDK
  3. uv - Python package manager (recommended)
  4. Git - for version control operations

Installation

1. Install task-master-ai globally

npm install -g task-master-ai

2. Set up Python environment

# Initialize project (if not already done)
uv init

# Install dependencies
uv add claude-agent-sdk rich python-dotenv

3. Configure environment variables

cp .env.example .env
# Edit .env and add your API keys

Required:

  • ANTHROPIC_API_KEY - Your Anthropic API key

Optional:

  • PERPLEXITY_API_KEY - For task-master research features

Target Repository Setup

Your target repository should contain:

  1. tasks.json - Task list managed by task-master
  2. PRD.md (optional) - Product Requirements Document for context

Initialize task-master in your target repo:

cd /path/to/your/project
task-master init

Usage

Basic Usage

uv run python coding_agent.py --repo-path /path/to/target/repo

With Specific Model

# Use Haiku (faster, cheaper)
uv run python coding_agent.py --repo-path /path/to/target/repo --model haiku

# Use Sonnet (balanced)
uv run python coding_agent.py --repo-path /path/to/target/repo --model sonnet

# Use Opus (most capable)
uv run python coding_agent.py --repo-path /path/to/target/repo --model opus

How It Works

  1. Task Fetching: Agent queries task-master MCP to get the next pending task
  2. Context Gathering: Reads PRD.md and existing codebase to understand requirements
  3. Planning: Creates its own internal todo list to plan implementation
  4. Implementation: Writes/modifies code autonomously following existing patterns
  5. Version Control: Creates a feature branch and commits changes
  6. Completion: Marks task as complete via task-master

Agent Workflow

[Start] → Connect to task-master MCP
       → Run 'task-master next'
       → Read PRD.md for context
       → Create internal todo list
       → Implement task
       → Create feature branch
       → Commit changes
       → Mark task complete
       → [Done]

Architecture

  • Agent SDK: Handles Claude API communication and tool orchestration
  • MCP Server: task-master-ai provides task management interface
  • Autonomous Mode: Agent creates its own plan and executes independently
  • Single Task Focus: Implements one task per run for better quality

Example Output

Starting Coding Agent
Target Repository: /home/user/my-project
Model: sonnet
============================================================

Sending task to agent...

[Agent creates todo list]
[Agent fetches next task from task-master]
[Agent reads PRD and existing code]
[Agent implements feature]
[Agent creates branch and commits]
[Agent marks task complete]

============================================================
Agent completed task!

Configuration

The agent automatically configures task-master MCP with your environment:

{
    "taskmaster-ai": {
        "command": "npx",
        "args": ["-y", "--package=task-master-ai", "task-master-ai"],
        "env": {
            "ANTHROPIC_API_KEY": "...",
            "MODEL": "claude-3-7-sonnet-20250219",
            "REPO_PATH": "/path/to/target/repo"
        }
    }
}

Troubleshooting

Agent can't find tasks

  • Ensure tasks.json exists in target repo
  • Run task-master list manually to verify tasks

MCP connection issues

  • Check ANTHROPIC_API_KEY is set correctly
  • Verify task-master-ai is installed: npm list -g task-master-ai

Git errors

  • Ensure target repo is a valid git repository
  • Check you have write permissions

Future Enhancements

  • Sub-agent for writing unit tests
  • Pre-commit hooks for test validation
  • Multi-task batch processing
  • PR creation and submission
  • Continuous mode (loop through all tasks)

Resources

License

MIT

About

Building autonomous AI development team - agents that make decisions like humans (dev, QA, code review) using Claude Code Agent SDK

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors