Improve a codebase
Deliver small improvements one at a time, or one focused refactor, without a ticket
In this example you have Orbital improve a codebase without a ticket. Start the shipped improve-codebase workflow for one worthwhile improvement, or reduce-complexity for one focused refactor.
About five minutes to start. Both workflows stop after one improvement, or immediately when nothing worthwhile is found.
Before you start
Section titled “Before you start”1. Choose a workflow
Section titled “1. Choose a workflow”| Use | When |
|---|---|
improve-codebase |
You want one worthwhile improvement supported by evidence. |
reduce-complexity |
You want one refactor of the most complex code. |
2. Start the run
Section titled “2. Start the run”Follow the part for the workflow you chose.
Run improve-codebase
Section titled “Run improve-codebase”-
Choose New task, pick the project and choose
improve-codebase.
Choose the workflow, then point it somewhere in the goal box. -
Point it somewhere, or leave the default goal, “Find and deliver one worthwhile improvement anywhere in the codebase.” To narrow it, write your own, such as
Improve test coverage of the billing module. -
Choose Start run.
The run finds one worthwhile improvement, delivers it as a merged pull request, and stops after cleanup:
| Step | What it does |
|---|---|
| discover | Looks for one worthwhile improvement and says why. |
| Deliver | If it finds one, the run makes a worktree, implements the improvement with a review loop, and delivers the pull request to merge. |
| Clean up | The run cleans up and ends. |
| No candidate | If it finds nothing worth doing, the run ends immediately without creating a worktree. |
Run reduce-complexity
Section titled “Run reduce-complexity”-
Choose New task, pick the project and choose
reduce-complexity. -
Optionally write a goal, such as
Only look at the src/api folder. -
Choose Start run.
The pick step measures complexity and picks the function most worth simplifying. The run then refactors it in a worktree, delivers one pull request and stops.
What you get
Section titled “What you get”improve-codebase delivers at most one improvement per run. When discovery finds nothing worthwhile, it succeeds without creating a worktree or pull request.
reduce-complexity leaves one pull request with the refactor, except in two cases:
| Outcome | When |
|---|---|
| Succeeded, without a worktree | Nothing is worth simplifying. |
| Failed, without a pull request | The refactor was not safe. |
Run it on a schedule
Section titled “Run it on a schedule”With the Triggers feature on, the ready-made rule “Improve the codebase every weekday morning” starts a run at 9:00 on weekdays. Its goal is “Find and make one small improvement to the codebase”. Choose improve-codebase, reduce-complexity or your own workflow for it. Each scheduled run of improve-codebase considers one improvement and ends. See triggers.

Related
Section titled “Related”- Shipped workflows: every step of
improve-codebaseandreduce-complexity - Worktrees and delivery: how each improvement reaches a merged pull request
- Make a trigger rule: start runs on a schedule