Last updated · Santosh Kumar Radha

A coding agent that runs for hours on a large change

How to hand a large refactor, migration or multi-file fix to a coding agent that works unattended for hours, with budgets, tests and its own branch.

CodeAF, the open-source (Apache 2.0) coding agent by AgentField, has a built-in agent for this job: senior-dev, which takes one large change, works alone for an hour or more on a branch of its own, runs your build and tests on what it hands in, and stops at $10 and 3 hours by default. You settle the brief once, because it asks nothing while it works.

At a glance

CodeAF senior-dev
Start it/senior-dev <brief> in a conversation, or codeaf senior-dev "<brief>" at a shell
Where the work landsa private copy of your repository, on a task branch such as task/rename-loadconfig-to-loadsetting-7d6220; your own branch never moves
Default ceiling$10 and 3 hours, lower if the conversation has less left
Proof before hand-inruns the build and test commands it discovers, or the ones you pin with --verify-build and --verify-test
Steeringtype a note while it works; it reads it before its next model call, until it submits
Close the terminalthe task keeps running in the folder's engine
Modelsany model CodeAF can reach, chosen per call, with a switch when one fails or is rate-limited
PlatformsmacOS and Linux; absent from Windows builds

Step 1: write the brief as the finished state

senior-dev "works alone, for an hour or more when the change needs it, and asks nothing", so everything it needs goes in the brief: the change, its scope and what done means. A good brief names a check: rename LoadConfig to LoadSettings everywhere; done means go test ./... passes. If you are still working out what the change is, talk it through in the chat first and then say "give this to senior-dev". The chat reads the code and writes the brief, and in the documented run it found the code change already existed and briefed only the missing test.

Step 2: start it, with the checks pinned

In a conversation on your repository:

text
/senior-dev rename LoadConfig to LoadSettings everywhere; done means go test ./... passes

At a shell, pin the commands it must run on the finished tree when your project's build is not discoverable from CI, scripts or language defaults:

sh
codeaf senior-dev run --verify-build "npm run build" --verify-test "npm test" -- "Implement the settled change with its tests"

senior-dev runs those commands itself on the submitted tree; its model cannot change them. From a script or another agent, codeaf senior-dev --max-cost 5 --json "<brief>" streams one JSON record per line and leaves the branch for you (headless docs). That is the shape for a coding agent in CI, and for fixing GitHub issues end to end.

Step 3: leave, and steer only if you need to

Your terminal is a view, not the worker. The conversation lives in the folder's engine, so "close the window and replies keep arriving, tasks keep running" (keeps working). Open the task and type a note to steer; once senior-dev submits, the tree is frozen and later notes cannot change it. Every model call is priced and held to the ceiling, and you can set limits for the day and each conversation too (budgets).

Step 4: review the ending, then merge

When the run ends, the chat reads the ending for you and offers to merge work that passed, or fixes a small gap or sends the work back with a sharper brief, at most twice on its own. Before you say yes, read the verification result (a folder of loose files can finish with no build or tests run, and the ending says so), the diff, and anything marked not done. A passing check is evidence, not a guarantee.

A large legacy refactor: split it first

One senior-dev run carries one change. A legacy codebase migration is usually the same small change in many places, and CodeAF handles that shape with a /task brief that names the parts and says "one part per package, all at once". In the migrate every package playbook, eight Go packages moved off io/ioutil in 1 minute and 13 seconds of wall time, for $0.77 against an estimate of $0.20, each part running its own tests and the whole tree checked once at the end. Use senior-dev for the cross-cutting pieces that need one owner, and the split for the repetitive rest.

What the long budget buys

senior-dev's 3-hour ceiling matches the budget per task in AgentField's DeepSWE comparison, where every harness ran deepseek/deepseek-v4-flash-0731. senior-dev solved 62 of 113 tasks (54.9%), the most of ten harnesses in that comparison, with a mean of 54 minutes per task and 22 cents a task. That was one pass, run by us; the benchmark page lists every caveat.

When something else fits better

  • Claude Code has subagents, each running "in its own context window with a custom system prompt, specific tool access, and independent permissions", background agents, and cloud sessions that run "on cloud infrastructure instead of your machine". If your team is on Claude models and wants long work to run off your laptop, it is the natural choice.
  • Codex cloud tasks each have "its own workspace and can keep working while your computer is asleep", and you can open a pull request from the result. CodeAF runs only on machines you control, so a sleeping laptop stops it.
  • OpenHands is MIT-licensed, with a self-hosted control center (Agent Canvas) that can also drive Claude Code and Codex, plus OpenHands Cloud. It suits teams that want a browser workspace for many agents. See CodeAF vs OpenHands.
  • Devin is "an autonomous AI software engineer that can write, run and test code", reached from a web app or by tagging it in Slack or Teams. It fits teams that want a hosted agent and no local setup.

Questions people ask

Can a coding agent run for hours without babysitting?

Yes, within limits you set. CodeAF's senior-dev works alone on its own branch for up to 3 hours and $10 by default, runs your build and tests on what it hands in, and keeps running if you close the terminal. You still review the result before it merges.

What stops a long run from spending too much?

CodeAF prices every model call before it runs and holds senior-dev to its ceiling, $10 and 3 hours by default, lower when the conversation has less left. A daily limit ($500 by default) and a per-task limit ($5 for ordinary tasks) sit above it, and --max-cost sets your own figure at the shell.

Will it keep working if my laptop goes to sleep?

No. CodeAF's tasks survive a closed terminal, but nothing runs while the machine sleeps or you are logged out. For overnight work, run the conversation on a machine that stays on with codeaf chat --host devbox, over your own ssh.

Is a run that passed safe to merge?

Not automatically. senior-dev runs the build and tests it discovers or that you pinned, but a folder with no discoverable tests can finish without running any, and the ending says so. Read the verification result and the diff before merging; the chat asks before it merges.

Does senior-dev work on Windows?

Not today. The senior-dev specialist is built into CodeAF on macOS and Linux and absent from Windows builds.

What is the best AI agent for refactoring a large legacy codebase?

It depends on whether the change needs one owner or many hands. With CodeAF, hand a cross-cutting change to senior-dev and split a wide, repetitive migration into one part per package with /task; both work on their own branch and run your tests. Review the result as you would a colleague's large pull request.

Sources

Last updated 2026-11-21. Checked against the CodeAF docs and the Claude Code, Codex, OpenHands and Devin documentation on that date.