codingsoul

Agent Smith – Open Source Agent That Turns Issues into Pull Requests

Agent Smith is an open source AI coding agent. You point it at a ticket — GitHub Issue, Azure DevOps Work Item, Jira, GitLab — and it clones your repo, analyzes the codebase, generates an implementation plan, writes the code, runs tests, and opens a pull request. Ticket in, PR out. Fully automated.

You say, you’ve seen that before, what’s the difference?

It runs on your infrastructure. No SaaS, no account, no subscription. You bring your own API key (Claude, OpenAI, or Gemini), configure your repo, and let it run — locally, in Docker, on your K8s cluster, or as a GitHub Action. The entire codebase, including all prompts and architecture docs, is open source.

I built it in a few days using structured prompts and an AI coding assistant. The same approach the agent uses on your tickets is the approach I used to build it. Have a look here in the agent smith repository.


TL;DR — Try It

Docker:

docker run --rm \
  -e ANTHROPIC_API_KEY="$ANTHROPIC_API_KEY" \
  -e GITHUB_TOKEN="$GITHUB_TOKEN" \
  -v $(pwd)/config:/app/config \
  agentsmith:latest --headless "fix #42 in my-project"

Local:

dotnet run --project src/AgentSmith.Host -- "fix #42 in my-project"

Configure your project in agentsmith.yml, point it at your repo, and go. GitHub, Azure DevOps, GitLab, Jira — all supported. Nothing leaves your infrastructure except the LLM API calls.


The Shift

Here’s what I believe is happening right now, and why I built this.

The work of software development is shifting. Not disappearing — shifting. The leverage you have as a developer is moving away from writing implementation code and toward structuring the context that makes good implementation possible.

That means writing precise tickets that a machine can act on. Defining coding principles that produce consistent output. Documenting architecture decisions as machine-readable context, not just human-readable afterthoughts. Reviewing and steering instead of line-by-line typing.

This requires more engineering discipline, not less. Garbage context in, garbage code out. The quality of your output no longer depends on how fast you type — it depends on how well you structure your intent.

Agent Smith is my attempt to put this into practice. Not as a prototype or a demo, but as a tool I actually use. And the way I built it proves the point: I structured (by now) 17 phases of architecture prompts, defined strict coding principles, and let an AI assistant generate the implementation. The same workflow Agent Smith now runs on your tickets is the workflow I used to build Agent Smith itself.

There will always be vibe coding in the IDE. There will always be problems where you don’t even consider an agent. But for well-scoped, ticket-driven work, I guess everybody has a lot of that in his backlog, the speed-up is real.

And what’s coming next makes it more interesting: interactive agents that ask clarifying questions in Slack or Teams, where the conversation happens where your team already works. Not fire-and-forget, but a dialogue at a higher level of abstraction.


Why Context Is Everything

The difference between an agent that produces garbage and one that produces usable code is not the model. It’s the context.

Agent Smith loads a coding-principles.md at runtime and injects it into every LLM call:

  • Max 20 lines per method. No exceptions.
  • Max 120 lines per class. Split when needed.
  • SOLID principles. Dependency inversion everywhere.
  • No magic strings. No god classes. No commented-out code.

These aren’t suggestions. They’re constraints the agent treats as non-negotiable. With these principles in context, the LLM produces small, focused classes with clean interfaces. Without them, you get the same 500-line spaghetti that every model defaults to.

But coding principles alone aren’t enough. Agent Smith uses a full context stack:

Architecture prompts. 17 phases of structured design documents define the domain, contracts, patterns, and boundaries. The agent doesn’t decide the architecture — it follows it. These prompts are in the repo. You can read every one of them.

Model registry. A cost-aware routing layer sends scout tasks (file discovery) to cheap, fast models and primary coding tasks to more capable ones. You don’t burn expensive tokens on work that doesn’t need them.

Prompt caching and context compaction. System prompts get cached across agentic loop iterations. When conversations grow too long, a summarization model compresses earlier context while preserving what matters. The agent can work on large codebases without blowing up the context window or your budget.

You can swap all of this. Different coding principles, different models, different providers. The config file drives everything.


How I Built It

Agent Smith was built with the same approach it now uses on your tickets. That’s not a coincidence — it’s the point.

I started by thinking about where the gaps are. There are plenty of AI coding tools, but most are either locked behind SaaS subscriptions or tightly coupled to a single platform. I wanted something self-hosted, provider-agnostic, and open — something you can point at your own infrastructure and just run.

So I defined an architecture. Clean Architecture, DDD, command/handler pattern for the pipeline, provider abstractions for everything. Then I wrote the coding principles — the same coding-principles.md that Agent Smith now loads at runtime. 20 lines per method, 120 per class, SOLID, no exceptions. These became the rules for both me and the agent.

From there, I broke the work into phases. Each phase got its own structured prompt: domain entities, contracts, providers, factories, pipeline execution, CLI, Docker. One phase at a time, each building on the last. An AI coding assistant in the IDE did the implementation — I provided the context, reviewed the output, and steered.

After phase 8, I ran it for the first time. Agent Smith’s first task was to work on itself — I pointed it at its own repo and told it to implement Issue #1: “Add a README.” A few small fixes later, it worked. The agent cloned its own code, read its own architecture, and wrote its own documentation.

This was the moment I was smiling. Some very small issues, mostly due to my not-so-big-amount-of-tokens in Claude API usage. But if just worked.

Three days and a few more phases later, it was running on a second provider. Azure DevOps instead of GitHub, Docker instead of local, headless mode. Complete success on the first try — PR created, ticket closed, comment posted. The numbers from that run:

MetricValue
Scout modelclaude-haiku-4-5
Primary modelclaude-sonnet-4
Input tokens7,978
Output tokens1,110
Cache hit rate37%
Costfractions of a cent

Same pipeline, different provider, same result. The architecture held. And the meta-lesson was clear: structured context and AI-assisted execution isn’t just how Agent Smith works on tickets — it’s how Agent Smith was built.

Have a lock at how to start it and the resulting log.

source .env && docker run --rm \
-e ANTHROPIC_API_KEY="$ANTHROPIC_API_KEY" \
-e AZURE_DEVOPS_TOKEN="$AZURE_DEVOPS_TOKEN" \
-v $(pwd)/config:/app/config \
-v ~/.ssh:/home/agentsmith/.ssh:ro \
agentsmith:latest \
--headless "fix #54 in agent-smith-test" 2>&1
info: AgentSmith.Application.UseCases.ProcessTicketUseCase[0]
Processing input: fix #54 in agent-smith-test
info: AgentSmith.Application.Services.RegexIntentParser[0]
Parsed intent: Ticket=54, Project=agent-smith-test
info: AgentSmith.Application.UseCases.ProcessTicketUseCase[0]
Running pipeline 'fix-bug' for project 'agent-smith-test', ticket 54
info: AgentSmith.Application.Services.PipelineExecutor[0]
Starting pipeline with 9 commands
info: AgentSmith.Application.Services.PipelineExecutor[0]
[1/9] Executing FetchTicketCommand...
info: AgentSmith.Application.Commands.CommandExecutor[0]
Executing FetchTicketContext...
info: AgentSmith.Application.Commands.Handlers.FetchTicketHandler[0]
Fetching ticket 54...
info: AgentSmith.Application.Commands.CommandExecutor[0]
FetchTicketContext completed: Ticket 54 fetched from AzureDevOps
info: AgentSmith.Application.Services.PipelineExecutor[0]
[1/9] FetchTicketCommand completed: Ticket 54 fetched from AzureDevOps
info: AgentSmith.Application.Services.PipelineExecutor[0]
[2/9] Executing CheckoutSourceCommand...
info: AgentSmith.Application.Commands.CommandExecutor[0]
Executing CheckoutSourceContext...
info: AgentSmith.Application.Commands.Handlers.CheckoutSourceHandler[0]
Checking out branch fix/54...
info: AgentSmith.Infrastructure.Providers.Source.AzureReposSourceProvider[0]
Cloning https://dev.azure.com/holgerleichsenring/agent-smith-test/_git/agent-smith-test to /tmp/agentsmith/azuredevops/agent-smith-test/agent-smith-test
info: AgentSmith.Infrastructure.Providers.Source.AzureReposSourceProvider[0]
Checked out branch fix/54 in /tmp/agentsmith/azuredevops/agent-smith-test/agent-smith-test
info: AgentSmith.Application.Commands.CommandExecutor[0]
CheckoutSourceContext completed: Repository checked out to /tmp/agentsmith/azuredevops/agent-smith-test/agent-smith-test
info: AgentSmith.Application.Services.PipelineExecutor[0]
[2/9] CheckoutSourceCommand completed: Repository checked out to /tmp/agentsmith/azuredevops/agent-smith-test/agent-smith-test
info: AgentSmith.Application.Services.PipelineExecutor[0]
[3/9] Executing LoadCodingPrinciplesCommand...
info: AgentSmith.Application.Commands.CommandExecutor[0]
Executing LoadCodingPrinciplesContext...
info: AgentSmith.Application.Commands.Handlers.LoadCodingPrinciplesHandler[0]
Loading coding principles from ./config/coding-principles.md...
info: AgentSmith.Application.Commands.CommandExecutor[0]
LoadCodingPrinciplesContext completed: Loaded coding principles (3524 chars)
info: AgentSmith.Application.Services.PipelineExecutor[0]
[3/9] LoadCodingPrinciplesCommand completed: Loaded coding principles (3524 chars)
info: AgentSmith.Application.Services.PipelineExecutor[0]
[4/9] Executing AnalyzeCodeCommand...
info: AgentSmith.Application.Commands.CommandExecutor[0]
Executing AnalyzeCodeContext...
info: AgentSmith.Application.Commands.Handlers.AnalyzeCodeHandler[0]
Analyzing code in /tmp/agentsmith/azuredevops/agent-smith-test/agent-smith-test...
info: AgentSmith.Application.Commands.CommandExecutor[0]
AnalyzeCodeContext completed: Code analysis completed: 1 files found
info: AgentSmith.Application.Services.PipelineExecutor[0]
[4/9] AnalyzeCodeCommand completed: Code analysis completed: 1 files found
info: AgentSmith.Application.Services.PipelineExecutor[0]
[5/9] Executing GeneratePlanCommand...
info: AgentSmith.Application.Commands.CommandExecutor[0]
Executing GeneratePlanContext...
info: AgentSmith.Application.Commands.Handlers.GeneratePlanHandler[0]
Generating plan for ticket 54...
info: AgentSmith.Application.Commands.Handlers.GeneratePlanHandler[0]
Plan generated: Create a MIT LICENSE file at the repository root with standard MIT license text, current year, and placeholder author name (1 steps)
info: AgentSmith.Application.Commands.CommandExecutor[0]
GeneratePlanContext completed: Plan generated with 1 steps
info: AgentSmith.Application.Services.PipelineExecutor[0]
[5/9] GeneratePlanCommand completed: Plan generated with 1 steps
info: AgentSmith.Application.Services.PipelineExecutor[0]
[6/9] Executing ApprovalCommand...
info: AgentSmith.Application.Commands.CommandExecutor[0]
Executing ApprovalContext...
info: AgentSmith.Application.Commands.Handlers.ApprovalHandler[0]
Plan summary: Create a MIT LICENSE file at the repository root with standard MIT license text, current year, and placeholder author name
[1] Create: Create LICENSE file with standard MIT license text using current year (2024) and placeholder author name
info: AgentSmith.Application.Commands.Handlers.ApprovalHandler[0]
Headless mode: auto-approving plan
info: AgentSmith.Application.Commands.CommandExecutor[0]
ApprovalContext completed: Plan approved by user
info: AgentSmith.Application.Services.PipelineExecutor[0]
[6/9] ApprovalCommand completed: Plan approved by user
info: AgentSmith.Application.Services.PipelineExecutor[0]
[7/9] Executing AgenticExecuteCommand...
info: AgentSmith.Application.Commands.CommandExecutor[0]
Executing AgenticExecuteContext...
info: AgentSmith.Application.Commands.Handlers.AgenticExecuteHandler[0]
Executing plan with 1 steps...
info: AgentSmith.Infrastructure.Providers.Agent.ClaudeAgentProvider[0]
Running scout agent with model claude-haiku-4-5-20251001
info: AgentSmith.Infrastructure.Providers.Agent.ClaudeAgentProvider[0]
Scout agent starting file discovery with model claude-haiku-4-5-20251001
info: AgentSmith.Infrastructure.Providers.Agent.ClaudeAgentProvider[0]
Scout discovered 1 relevant files using 6276 tokens
info: AgentSmith.Infrastructure.Providers.Agent.ClaudeAgentProvider[0]
Agent completed after 4 iterations
info: AgentSmith.Infrastructure.Providers.Agent.ClaudeAgentProvider[0]
Token usage summary: 7978 input, 1110 output, 1564 cache-create, 4692 cache-read, Cache hit rate: 37.0 %, Iterations: 9
info: AgentSmith.Infrastructure.Providers.Agent.ClaudeAgentProvider[0]
Agentic execution completed with 1 file changes
info: AgentSmith.Infrastructure.Providers.Agent.ClaudeAgentProvider[0]
Token usage summary: 7978 input, 1110 output, 1564 cache-create, 4692 cache-read, Cache hit rate: 37.0 %, Iterations: 9
info: AgentSmith.Application.Commands.Handlers.AgenticExecuteHandler[0]
Agentic execution completed: 1 files changed
info: AgentSmith.Application.Commands.CommandExecutor[0]
AgenticExecuteContext completed: Agentic execution completed: 1 files changed
info: AgentSmith.Application.Services.PipelineExecutor[0]
[7/9] AgenticExecuteCommand completed: Agentic execution completed: 1 files changed
info: AgentSmith.Application.Services.PipelineExecutor[0]
[8/9] Executing TestCommand...
info: AgentSmith.Application.Commands.CommandExecutor[0]
Executing TestContext...
info: AgentSmith.Application.Commands.Handlers.TestHandler[0]
Running tests for 1 changes...
warn: AgentSmith.Application.Commands.Handlers.TestHandler[0]
No test framework detected, skipping tests
info: AgentSmith.Application.Commands.CommandExecutor[0]
TestContext completed: No test framework detected, skipping tests
info: AgentSmith.Application.Services.PipelineExecutor[0]
[8/9] TestCommand completed: No test framework detected, skipping tests
info: AgentSmith.Application.Services.PipelineExecutor[0]
[9/9] Executing CommitAndPRCommand...
info: AgentSmith.Application.Commands.CommandExecutor[0]
Executing CommitAndPRContext...
info: AgentSmith.Application.Commands.Handlers.CommitAndPRHandler[0]
Creating PR for ticket 54 with 1 changes...
info: AgentSmith.Infrastructure.Providers.Source.AzureReposSourceProvider[0]
Committed and pushed changes: fix: Add a LICENSE file with MIT license text (#54)
info: AgentSmith.Infrastructure.Providers.Source.AzureReposSourceProvider[0]
Pull request created: https://dev.azure.com/holgerleichsenring/agent-smith-test/_git/agent-smith-test/pullrequest/4
info: AgentSmith.Application.Commands.Handlers.CommitAndPRHandler[0]
Pull request created: https://dev.azure.com/holgerleichsenring/agent-smith-test/_git/agent-smith-test/pullrequest/4
info: AgentSmith.Application.Commands.Handlers.CommitAndPRHandler[0]
Ticket 54 closed with summary
info: AgentSmith.Application.Commands.CommandExecutor[0]
CommitAndPRContext completed: Pull request created: https://dev.azure.com/holgerleichsenring/agent-smith-test/_git/agent-smith-test/pullrequest/4
info: AgentSmith.Application.Services.PipelineExecutor[0]
[9/9] CommitAndPRCommand completed: Pull request created: https://dev.azure.com/holgerleichsenring/agent-smith-test/_git/agent-smith-test/pullrequest/4
info: AgentSmith.Application.Services.PipelineExecutor[0]
Pipeline completed successfully
info: AgentSmith.Application.UseCases.ProcessTicketUseCase[0]
Ticket 54 processed successfully: Pipeline completed successfully
Success: Pipeline completed successfully

And it worked like a charm.


What’s Next

Agent Smith currently works as a CLI tool and GitHub Action. Interactive chat interfaces for Slack, Teams, and other platforms are in progress — agents that run as ephemeral containers on K8s, stream progress in real time, and ask you questions when they need clarification.

The code is open source. The prompts are in the repo. All 17 phases, the coding principles, the architecture docs — everything that makes it work is there for you to read, fork, and adapt.

github.com/holgerleichsenring/agent-smith

One response to “Agent Smith – Open Source Agent That Turns Issues into Pull Requests”

Leave a Reply to BlogThree’s Take on Show HN: Agent Smith – open-source agent that turns issues into pull requests | blogthree – blogthree Cancel reply

Your email address will not be published. Required fields are marked *