DEV Community

Cover image for Turning Claude Code Into an Autonomous Developer
Ion
Ion

Posted on

Turning Claude Code Into an Autonomous Developer

Imagine you run a book club. You file a Jira ticket saying, “I cancelled Thursday’s meeting. It disappeared from the calendar, but everyone still got the reminder email.” You’ve told me what happened, what you expected and where to start looking. Asking you which Git repository owns Thursday would be a bit much.

I made up the ticket, but it gets to the reason I built this. When I open Claude Code, I usually start in the right directory. I’ve already made quite an important decision on its behalf. Could it start where a developer starts on Monday morning, with a Jira issue that might need changes in several repositories?

The short version of what I learned: the interesting design decision wasn’t which model to use. It was where a model is allowed to decide anything at all. In my setup that’s two places. Everything around them is ordinary code that checks what the model did before anything else depends on it. Making it autonomous was less about what I gave Claude Code and more about what I took away.

The idea

I figured I needed a Lambda to answer the door, Step Functions to organise the work and an ECS container to run Claude Code. So I built it. I was more or less right about the number of moving parts. I was optimistic about how much time I would spend on permissions.

Workflow or agent? Somewhere in between

Step Functions decides what runs next, when to retry and when to stop. Triage gets one model call to decide whether a ticket is clear enough. The autonomy starts inside the development container. Once Claude Code picks up the ticket, it decides which files to read, which tests to run and what to try when they fail. I can draw the workflow before I run it. I have to watch the agent to find out how it solves Thursday’s reminder problem.

Of eight steps, two ask a model: triage and development. Code handles the rest and a human decides whether to merge.

I drew that line on purpose. When one model checks another model’s work, a confident mistake can pass straight through. A test suite, a signature check or a conditional write gives the same answer every time, and I can read it afterwards. So each model decision is followed by something that isn’t a model. Triage returns a list of missing details, and code decides whether that list is empty. Claude reports implemented, and the worker runs the tests again before anyone believes it.

Why build it myself instead of using a ready-made service

If my task already lived in a GitHub repository, I’d happily assign it to Copilot. Here, the person reporting a problem knows the product. They might never have seen the source code. I wanted to start from their description, give the agent working copies of the related projects and let it follow a bug across them.

Running the worker in my AWS network lets me decide which private package registries and test services it can reach. Copilot can run on a self-hosted runner too. One detail I found interesting in GitHub’s instructions is that you disable its built-in firewall and configure the network controls yourself. I also wanted control over what starts a job, what instructions Claude loads and where the model sees my code. I considered Bedrock AgentCore, but wiring up the pieces myself sounded more fun. GitHub’s guide to self-hosted agent runners

The step the benchmarks skip

Most coding-agent scores you’ll see come from SWE-bench or its variants. Each task gives the agent an issue and a repository, already checked out at the right commit. That’s a fair way to compare models. It also starts after the question my book club ticket asks first: which code is this about? With thirty repositories in the catalogue, finding the right one, or the right two, is the first thing I’d have to work out myself. I wanted a system where that step is part of the job, and where I can measure it. SWE-bench

Following one issue through the system

A signed Jira event moves through triage, a four-container worker, independent checks and patch storage.

1. The webhook: the only door

A Jira event arrives over HTTPS at API Gateway. A Lambda verifies the HMAC signature against the raw request body, then uses a read-only credential from Parameter Store to read the issue. Someone may have taken the ticket back while the event was on its way. It has to be in the right project and assigned to the agent.

To keep the PoC simple, I only pick up issues in “To Do”. Once this first step is stable and secure, I’ll add support for the other states in the Jira workflow.

2. Triage: “do I understand what you want?”

Triage checks that the revision is still current, then gives Claude Haiku 4.5 one call to read the description, comments and up to five images. It returns a structured verdict. A missing product decision or a missing detail that prevents useful work goes on the reporter’s list. Technical questions stay with the developer. Triage also records security concerns, such as sensitive data in a screenshot or instructions in the ticket trying to steer the agent. I treat that as a smoke alarm, not a lock. A model asked to spot prompt injection can be fooled by the same injection, so the controls that matter come later and don’t depend on the model noticing.

Does the reporter actually owe me an answer? “Reminders are wrong” could use a follow-up. “Everyone got the reminder after I cancelled the meeting” already gives the developer somewhere to start. Whether the bug is in the calendar or the email service is our question to answer.

3. Guessing the repositories without a model

Picking where to look first costs zero extra tokens. Plain code matches clues in the ticket against a repository catalogue. The shortlist tells the worker where to install dependencies. It can still read the other projects, and an empty shortlist is a valid answer. Here’s a shortened, fictional triage result for the book-club ticket.

{
  "enoughInformation": true,
  "missing": [],
  "securityConcerns": [],
  "repositoryCandidates": [
    { "name": "club-diary", "matched": "calendar" },
    { "name": "club-post", "matched": "reminder email" }
  ]
}
Enter fullscreen mode Exit fullscreen mode

4. One developer at a time

Triage can run in parallel. Development gets one slot in DynamoDB, claimed with a conditional write. Waiting jobs check back every 30 seconds. If the workflow holding the slot dies, the next one checks the old execution, finds its Fargate task, stops it if necessary and waits for confirmation before taking over. A timer alone can’t tell me whether the previous developer is dead or just having a difficult afternoon. Age never frees the slot. If the coordinator can’t prove the old task has stopped, it keeps waiting and tells me. Anyone who has debugged a distributed lock without a fencing token will recognise the reasoning. Two agents editing the same working copies is not a bug I want to reproduce.

5. Preparing a clean, sanitized input

Once it has the slot, the coordinator reads Jira again. If the ticket has changed, the attempt stops. Otherwise it writes a size-limited input file to S3, strips attachment links and credential-like values, and lists attachments by type. Triage can look at screenshots, but the development worker gets text. If the screenshot contains the whole specification, the workflow records a request for the relevant details in writing.

6. The Fargate task: four containers, four jobs

Each attempt gets a fresh Fargate task on a private subnet. Four containers share the work.

  • Prepare refreshes Git mirrors on EFS using a read-only token for the Git server. It makes fresh working copies and keeps protected files out of them.
  • Dependencies installs packages in the shortlisted projects with install scripts and plugins disabled.
  • Test database gives this attempt its own database so the worker can exercise the code as it would in CI.
  • Develop runs Claude Code as a non-root user with a read-only root filesystem. It can edit the working copies. The Git token and the shared cache stay with the preparation steps.

7. Claude Code as the developer

Claude Code runs headless, with a budget and a turn limit. Its instructions ask it to work the way I’d want a new colleague to: record which tests already fail before touching anything, make the change, run the focused tests, then the full suite and static analysis, and fix only what it broke. Without the baseline, every test that was already failing looks like the agent’s fault, and it will happily spend its budget “fixing” it. For our ticket it could trace the cancellation from the calendar to the queued email, write a test that reproduces the unwanted reminder, and fix the code. It can run the test again and repair a failure in the same session. Its final answer follows a schema and can say implemented, investigated, needs_input with one question, or failed. Sometimes finding where the cancellation gets lost is a useful answer in its own right.

8. Trust, but verify

Claude’s own summary is an input here, not the verdict. After Claude exits, the worker builds one patch per changed repository against its recorded base commit. It checks that each patch applies, checks syntax, runs the full test suite where dependencies are installed, and runs static analysis on the changed files it covers. A failed check fails the attempt. A skipped suite gets a reason. That distinction matters when I’m looking at a perfectly tidy patch wondering whether anyone actually ran it.

The worker saves the patches and transcript to S3 and writes result.json last. That final file tells the coordinator the worker has finished writing. It checks the result against the attempt and the container exit codes, records the outcome and releases the slot. I get the patch to review.

The AWS architecture

Here’s the whole system on one page. The numbers match the steps above.

The AWS architecture: API Gateway and a webhook Lambda, a Step Functions workflow with triage and coordinator Lambdas, Amazon Bedrock, DynamoDB, and a Fargate task in a private subnet with EFS, a NAT gateway and an S3 gateway endpoint. The local dashboard reads Step Functions executions, DynamoDB, S3 and CloudWatch Logs.

The shape is simple. A serverless control plane decides what runs: API Gateway, a webhook Lambda, a Step Functions workflow with two Lambdas, and DynamoDB. One Fargate task in a private subnet does the work. Everything that stores data stays in eu-west-2, and the model calls stay in the UK and EU. The control plane costs almost nothing while it waits. The VPC doesn’t.

My laptop sits outside all of it. The dashboard reads the Step Functions executions, DynamoDB, the S3 buckets and CloudWatch Logs with read-only access. It never writes, and nothing in AWS calls it.

Built as a PoC, on purpose

Several choices are there because this is a proof of concept. Each was the quickest option that was safe enough for one person and test tickets. Each also has a production replacement I’ve already picked.

Seven changes from PoC to production: Secrets Manager, customer managed KMS keys, interface endpoints, Network Firewall on the NAT gateway, Resolver DNS Firewall, a separate test task, and two AZs with remote state.

Secrets. The Jira and Git tokens are SecureString parameters in Parameter Store, standard tier, encrypted with the AWS managed key. Terraform writes them from write-only values, so they never appear in the plan or the state. For three values in one account, that’s fine. Production moves them to Secrets Manager, with a customer managed key, a resource policy on each secret, and rotation where the provider lets me automate it.

Keys. Almost everything at rest is encrypted, but with AWS managed keys. DynamoDB, EFS and Parameter Store use the service defaults, and the run bucket uses SSE-S3. Production uses customer managed KMS keys, one per kind of data: source code (the Git mirrors, patches and transcripts), prompts and replies (the Bedrock invocation logs in S3 and CloudWatch), and operational records. A key policy is a second lock that an over-broad IAM policy can’t open by itself, and every decrypt appears in CloudTrail. Reading the invocation logs, which hold ticket text and code, should need permission on their key, not just on the log group. There’s a small bonus too. My failure-alert SNS topic is unencrypted today, because EventBridge can’t publish to a topic that uses the AWS managed SNS key. A customer managed key with the right key policy fixes that.

AWS traffic. Today the worker reaches Bedrock, ECR and CloudWatch Logs through the NAT gateway. Only S3 has a gateway endpoint. Production adds interface endpoints for each AWS service the task uses, Bedrock runtime included, so that traffic never goes near the internet path. Bedrock interface endpoints

Internet egress. This is the change that matters most for an agent. The worker’s security group allows HTTPS to any address, because security groups filter on IP addresses and the hosts I need don’t publish stable ones. Production puts AWS Network Firewall on the NAT gateway with a default-drop policy and a domain allow-list: the Git server and the package registry, nothing else. For HTTPS it matches the server name the client sends in the TLS handshake. AWS added the NAT gateway association this month, and London is one of its Regions. Network Firewall domain filtering · NAT Gateway association

DNS. Network Firewall doesn’t see queries sent to the VPC’s own resolver, and DNS is the classic quiet way to smuggle data out. Route 53 Resolver DNS Firewall covers that path with its own allow-list. DNS Firewall and Network Firewall

One caveat I’d want a reviewer to push on: the client chooses the server name it sends. Code that opens its own TLS connection can name an allowed host and connect somewhere else. That’s why the firewall isn’t the whole answer. Test code, which I can’t review in advance, moves to a task with no internet route at all, as described in the security section below. The firewall then only has to police the preparation steps, which run code I wrote with install scripts switched off. TLS inspection would close the gap further, at the price of running a certificate authority.

Cost. A firewall endpoint costs about $0.40 an hour in Ireland, roughly eight times London’s NAT gateway, though AWS waives the NAT gateway charges when the two are paired. For a worker that runs one task at a time, it becomes the biggest fixed line on the bill. I’d still pay it before this listens to a real Jira project. Network Firewall pricing

Everything else.

  • Two Availability Zones instead of one. The worker runs one task at a time, so this is about the NAT path and the endpoints, not throughput.
  • Terraform state in S3 with locking and its own key. Today it’s a local file, which works for exactly one person.
  • VPC flow logs and firewall logs, so the dashboard can show what the worker tried to reach, not only what it was allowed to.
  • A separate AWS account for the worker, with the dashboard reading through a read-only role.

Locking down Claude Code

This is the bit I spent the most time on. On my laptop I want Claude to pick up project instructions. An unattended worker reading several repositories is a different arrangement. If one project can quietly load a hook, who decided what runs when the agent opens the next project?

Nothing unreviewed gets loaded

Each attempt starts with a fresh home directory, a clean configuration and an instruction file I control. I planted instruction files, an agent, a skill, a hook and an MCP configuration in test repositories, then checked what loaded during a live Bedrock run. The worker ignored them. I also tried the CLI’s bare mode. It removed some of the tools I actually needed. That was a short experiment.

Allow-lists, not deny-lists

I use Claude Code’s dontAsk mode. The worker gives Claude file tools inside the working copies and two commands I wrote: repo-git for read-only Git operations and repo-test for the permitted checks. Anything outside the allowed set is refused automatically. If Claude wants help reading a large file, it can call one read-only summariser. That’s the entire team.

Small surprises along the way

I pinned every model alias the CLI knows, including the bigger ones, to the model I’d chosen. Even then, the CLI still probed other models at startup. The task role denied those calls, because IAM allows exactly two models. I’d have missed that detail if I’d only looked at the final patch. The general lesson: the agent’s configuration says what it should do, and IAM says what it can do. I want both.

Models: Haiku and Sonnet, for now

Haiku 4.5 handles triage and the read-only summariser. Sonnet 4.6 runs the development session at medium effort. My rule for the PoC is to start with the cheapest model that does each job well enough. One lesson from my AWS account was to make a real call before changing the configuration. Some models listed in the region still refused a request from my account.

Why Bedrock and why EU only

My geographic boundary for model calls includes the UK and the EU. I call Bedrock in London. Sonnet runs there in-Region, while Haiku uses an EU inference profile that can route a request within its geography. IAM permits those specific choices and excludes global profiles.

That distinction matters when someone asks where the text of a ticket went. In financial services, for example, DORA requires contracts to identify where the relevant services run and where data is processed and stored, with advance notice of planned location changes. The London and EU boundary is my choice for this project. DORA, Article 30(2)(b)

How I plan to compare models

I already have a small evaluation for triage. For development I want to replay the same tickets from the same starting commits, changing the model or its effort setting each time. It’s a small, private SWE-bench that starts one step earlier, at the Jira ticket. I plan to score four things, in this order:

  • Localisation. Did it change the repositories and files a developer would have changed?
  • Checks. Did the worker’s own test run and static analysis pass?
  • Merge. Would I merge the patch, as it is or with small edits?
  • Cost per patch I’d merge. Tokens, turns and elapsed time, divided by the patches that passed the previous question.

The last number is the one I’d show to someone deciding whether this is worth running. A cheap model that needs three attempts can cost more than an expensive one that gets there once, and a cheap patch I throw away costs the most of all.

Seeing everything: the monitoring dashboard

A small read-only dashboard runs on my machine and streams updates to the browser. It pulls together Step Functions executions, DynamoDB records, CloudWatch logs and Bedrock invocation logs, including larger logged responses from S3.

One session ID to rule them all

Every webhook delivery gets its own session ID. It follows the job into the Step Functions execution, the development events and the metadata sent to Bedrock. Within a session, the Bedrock request ID connects each model call to its exact prompt and response. In one live test, all 17 development calls matched the invocation log, down to the token counts. After joining that many logs together, I allowed myself a small celebration.

A session ID created by the webhook travels through Step Functions and the worker, reaches Bedrock as request metadata and ends up in the invocation log, where the dashboard joins it with the call records.

The piece that made this work without an observability vendor is Bedrock’s request metadata. Every call Claude Code makes carries a signed X-Amzn-Bedrock-Request-Metadata header with the session and attempt IDs, and Bedrock writes them into its model invocation log. Claude Code makes those calls, not my code, so I couldn’t wrap them in my own tracing. The header gets the IDs through anyway. Bedrock per-request metadata

What you can see in a session

At a glance I can see whether the webhook accepted the issue, what happened to development, how many calls it took and their estimated cost. If a ticket took ten minutes, I can expand the timeline and see how much of that it spent waiting for the slot. I can also see the repositories that changed, the checks that ran and the reason a suite was skipped. That’s usually more useful than reading ten minutes of Claude thinking.

Here’s what that looks like for a real development attempt, from the overall result down to individual model calls. The screenshots are from the running PoC, with internal details redacted.

Development session overview: outcome, verification checks, token usage and estimated costs.

Execution timeline: individual model calls correlated with the worker’s activity and Step Functions events.

Security: what is done and what is accepted

What is in place

Jira and Git access are read-only. The worker runs on a private subnet with no public IP, and the development container gets neither the Git token nor the shared repository cache. Prompts and replies stay out of the ordinary worker events. The Bedrock invocation logs do contain them, so anyone who can read those logs can see ticket text and code. That matters when deciding who gets dashboard access.

The risk I accepted (for now)

There’s one boundary I still want to move. Running a test means executing code from the repository, including code Claude just wrote. Today those tests run beside Claude with outbound HTTPS. A restricted tool list helps control Claude’s actions, but the test code itself can use the network.

Simon Willison calls this combination the lethal trifecta: private data, untrusted content and a way to send data out. My develop container has all three. The ticket is untrusted text, the working copies are private code, and test code can reach any HTTPS host. The lethal trifecta

The develop container sits where untrusted content, private data and outbound HTTPS overlap. Controls already in place are listed beside the one gap still open.

Here’s the concrete version. A ticket with the right instructions could get Claude to write a “test” that reads the task role’s temporary credentials from the process environment, or posts the source code somewhere. IAM limits what those credentials can do: two models and one S3 prefix. Limited isn’t the same as harmless, and the source code is the bit I care about. Before production, I want tests in a separate task with no internet route and only the private AWS endpoints they need. That removes the third ingredient from the code I can’t review in advance.

Today tests share the development container and its outbound connection. The planned design puts tests in a separate task with no internet route.

What it costs

A local container run using Haiku cost about $0.03 in model calls. Two local CLI runs testing the Sonnet setup cost about $0.15 combined. For the Fargate worker I budgeted roughly $0.10 an hour for compute. Those are different numbers answering different questions. I still need a run of representative tickets to tell you what a patch worth merging costs. The NAT gateway, meanwhile, is quite happy to bill me between experiments. In London that’s about $0.05 an hour, or roughly $36 a month whether anything runs or not. That’s about 1,200 of those Haiku container runs.

Ways of working

I used Terraform for AWS and Node.js for the workflow code. Claude Code helped build the system that runs Claude Code. Codex reviewed the changes, including a security pass with Daybreak Blue. I worked through small plans for the infrastructure, worker, orchestration, dashboard and test verification. One rule earned its keep. Every change to a workflow step includes an update to its diagram and status in the architecture document. It saves both me and the next model session from having to guess which version of the plan we built.

Most tests run locally with stand-ins for the model and external tools. I can run the real state machine and coordinator against fake AWS services, test the container image locally, then spend actual money on the few questions only a live Bedrock call can answer.

Where it stands today

The webhook endpoint, Step Functions workflow and Fargate worker are deployed in London. The worker images are published, the task definition is registered and development is switched on. Jira itself is the missing connection. Today I send a signed event from a local script to the deployed endpoint, using the same signature check Jira will go through. The dashboard stays on my machine.

Is it better than Copilot or Claude on GitHub?

For a bug already filed in the right GitHub repository, I’d use what’s there. I can assign the issue to Copilot or ask Claude to work on it through GitHub Actions. Either way, I can get a pull request to review without spending my evening looking after a Fargate worker. Copilot on GitHub · Claude Code on GitHub Actions

Thursday’s reminder is the case where I’d pick my setup. The organiser can file one Jira ticket without knowing who owns the calendar or the email service. My worker can trace the bug through both, change either or both in one attempt, and hand me a patch for each repository it touched. The comparison I’d like to make is how much time that saves the developer who would otherwise have to work out where the ticket belongs.

What I’d tell a team trying this

None of this needs my exact stack. These are the parts I’d keep if I started again.

  • Decide where judgment lives before choosing a model. Write down which steps a model decides and what checks each decision. Model choice is easier to change later than that map.
  • Treat the model’s report as an input. Let code decide pass or fail, from tests and exit codes the agent doesn’t control.
  • Treat the ticket as untrusted input. List your own trifecta and remove one ingredient wherever the agent runs code.
  • Put one ID on everything before the first live run. Adding a trace afterwards means reading logs by timestamp and hoping.
  • Measure cost per patch you’d merge, not cost per token.

What comes next

Before I leave it listening, I want to isolate the tests, handle duplicate deliveries and make sure each issue revision is claimed once. Then I’ll register the webhook in Jira. The next useful step is to close the loop with the reporter. A blocked agent should post its one question on the issue. A successful one should open a pull request, with a human deciding whether to merge.

The part I’m most curious to measure is how often the agent works out where a change belongs. If it can follow Thursday’s cancelled meeting across two projects and bring me a small patch I understand, I’ll happily put it back on Jira duty on Friday.


Note: As I’m not a native English speaker, I used AI tools to review and refine the language of this article while keeping my original tone and ideas.


Originally published on Medium.

Top comments (0)