GEARS: how we chained SHIFT's agents into workflows
- SHIFT runs thousands of tasks a month, but each agent solved one isolated task. Between the steps of a larger piece of work, a person copied one task's report into the next one's prompt, and the fleet grew faster than our capacity to follow it.
- GEARS chains SHIFT tasks into declarative workflows, with steps in sequence and in parallel, review loops that only end on a clean review, and human approval at the decision points, all with a budget, live cost and an audit trail.
- SHIFT built it in 8 days, with Claude Code orchestrating and a person making the product decisions: agents opened all 76 PRs, there were 516 automatic reviews, and the median gap between merges was 35 minutes.
- In production, 14 workflows ran 211 tasks for US$ 188. The most complete case rewrote the base template of our Java services, the deterministic foundation the agents rely on, in 93 tasks and about US$ 71.
- The next step is to open GEARS to teams and start workflows from events, triggers and schedules, not only from people.
On Monday, November 16, at 3:18 p.m., I opened Claude Code in the SHIFT monorepo and typed: “we’re about to implement a huge new feature here, called gears.” I also asked for SHIFT itself to do the implementation, in atomic tasks that could prove they worked.
The first workflow ran in production on Tuesday at 9:37 a.m., with two tasks that cost fifteen cents.
A week later GEARS had 76 merged pull requests, a new service in the cluster, a drag-and-drop visual editor and phone notifications. One of its workflows had already taken the PRD for a full rewrite of an application and delivered the merged PR, with 79 files and almost 3,800 lines, in 93 agent tasks that cost 71 dollars.
No person wrote the code of GEARS. SHIFT opened all 76 PRs. The process we used to build it (a brief per package, a SHIFT task, automatic review, fixes, approval and merge) is the same process GEARS automates.
How we build software now
GEARS is part of a larger change in how the company builds software.
For a long time we worked in the traditional flow: a big backlog, two-week sprints, handoffs between whoever specifies, implements and reviews, PRs waiting in a queue and a release at the end of the cycle. Delivery moved at the pace of the slowest queue.
Today the work is more fluid and organic. A spec becomes a task, the task becomes a PR, the PR gets an automatic review against the repository’s own rules, and the feature ships when it’s ready. The product changes every day in small, reviewed increments. That pace depends on our confidence in SHIFT, because every change comes from a tracked task with its cost, log, review and evidence.
Today the company builds 100% of its software with AI. GEARS is the latest case: agents opened and reviewed all 76 of its PRs, and a person made the product decisions.
SHIFT reached production in March, when much of the conversation about AI in engineering was still about autocomplete and chat. In late October it reached the Cerquinhos, our distributed personal agents, which launch and follow SHIFT tasks from the conversation. On November 13 it reached every engineer’s AI CLI through our AI toolkit’s plugin, and on November 16 we started the workflow layer.
With 100% of the software going through agents, the risk becomes each team using AI its own way. Without a standard you get dozens of ways to fix a bug, review a PR or specify a feature, each with its own shortcuts and risks. So we are standardizing: we find the flows that repeat across teams and turn each one into a single workflow that every team runs with its own repository, people and context, under the same rules for budget, permissions, approval and audit.
Each team is free to run the process when it needs to, and the company knows the process is the same everywhere, reviewed and auditable. When following the standard takes less effort than working around it, standardization grows on its own, and GEARS is what turns a shared flow into something that runs.
The problem GEARS solves
If you read the earlier posts, you know SHIFT: you describe a task in plain language, an agent runs in an ephemeral container, and you get back a PR, a review comment or a report. It handles thousands of tasks a month, and an automatic reviewer comments on practically every PR in the company.
Engineering work rarely fits in one task, though. Fixing a bug properly means reproducing and diagnosing it, implementing the fix with tests, reviewing, fixing what the review found, reviewing again, getting an approval, updating the docs and running the full regression suite. Each step is a SHIFT task, and between steps there was a person copying one task’s report into the next prompt, waiting for it to finish, reading the review and deciding whether another round made sense. The tasks ran on their own, but the sequence depended on someone following it, and the fleet grew much faster than our capacity to follow it.
What GEARS is
GEARS is a workflow orchestrator for agents. A workflow is a graph of steps declared in YAML, and each step becomes a SHIFT task. GEARS creates the tasks, follows each one, feeds one step’s output into the next, evaluates conditions, repeats the review loop until it comes back clean and pauses when a person has to decide.
Four node types cover the cases we have found: task, parallel, loop and approval. A run of the bug-fix flow described above goes like this:
↔ swipe to see the whole picture
A complete run, illustrated: every workflow step dispatches a task to SHIFT, the result flows back into the workflow, the review repeats until it's clean and the run stops where a person has to decide.
The part of the YAML with the most design decisions is the review loop:
- id: review-cycle
type: loop
depends_on: [implement]
exit_when: "{{nodes.review.blocking_count == 0}}"
nodes:
- id: review
type: task
title: "Review the PR"
agent: pr-reviewer-v2
output: comment
pr_url: "{{nodes.implement.pr_url}}"
desc: "Review {{nodes.implement.pr_url}} against .shift/review.md."
- id: fix
type: task
depends_on: [review]
when: "{{nodes.review.blocking_count > 0}}"
title: "Fix the findings"
fix_review: review
The blocking_count comes from the structured findings that SHIFT’s reviewer already records on every review, with severity, rule, file and line. The model doesn’t have to write JSON into its report for GEARS to understand the result.
The fix_review: review line asks SHIFT for that review’s fix plan. That endpoint returns the complete body of the fixer task, already pointed at the PR’s branch, and GEARS only chains the pieces.
The loop ends when the review comes back with no blocking findings. When it gets stuck, because the reviewer keeps raising a point only a person can settle, GEARS pauses and asks whoever requested the run. That person decides and runs one more round, accepts as is, or stops, and the decision stays attached to every later task in the run.
↔ swipe to see the whole picture
The loop that asks: when the review doesn't converge, the run's requester decides and runs one more round, accepts as is, or stops. The screens in this post are simplified versions of GEARS's own, with sample data.
Architecture decisions
GEARS is a separate application that talks to SHIFT only over HTTP, like any other API client. It runs as one process with a loop that advances active runs every 30 seconds, and it keeps its state in Firestore. The process can die between creating a task and recording that it did, so it records its intent before calling SHIFT and, when it comes back, reconciles whatever was left half done. A chaos suite kills the process at every write of a full run and checks that no task ends up duplicated or orphaned.
A run produces one branch and one PR. The PR opens as a draft and is only marked ready at the end, so it gets reviewed once. Before that rule, one test run triggered 8 extra automatic reviews because of intermediate PRs.
How we built GEARS
Before any code, we checked the PRD against SHIFT’s code, and eleven assumptions were wrong. At the top of the spec went the rule: when the document and the code disagree, the code wins.
Then I asked Claude Code to interview me in rounds, with each decision opening the ones that depended on it and each question coming with a recommendation, until no ambiguity was left. At 3:39 p.m., 21 minutes after the first prompt, the spec was merged. It had almost 800 lines (today it’s over 1,500), split into work packages written for agents to execute one at a time, each with its own acceptance criteria.
The roles were clear. The Claude Code session broke down the work, wrote each package’s brief, picked the Shifty and model, launched the task, followed it to the end, read the diff and decided the next step. Local subagents on smaller models could read the repository and critique a brief, but they didn’t write code. SHIFT wrote everything: each package became a task and a PR, mostly on Sonnet, and small fixes went to Haiku. On every PR, SHIFT’s reviewers ran a security review and a code review against the repository’s rules (.shift/review.md), and their findings became a fix task generated from the review’s fix plan. I answered the questions, made the product trade-offs, tested in production and sent feedback. The session was allowed to approve and merge on my behalf once both reviewers were satisfied and the checks passed.
One afternoon the session started prototyping code locally, “just to validate the brief”, and I stopped it: “you’ll not code anything here”. If SHIFT is the product, the work has to run on it, where it is tracked, reviewed and paid for.
The briefs improved on the first day. The reviewer found problems in two rounds in a row on the first package, and the instruction became to write briefs so the reviewer would find nothing. Briefs swapped “check X” for closed rules, started listing every test case and began requiring evidence: the suite before, the suite after and a runtime check.
Every square below is one agent execution during those eight days, in the order it happened:
↔ swipe to see the whole picture
Real data from November 16 to 24: 158 tasks that wrote and fixed GEARS, 516 automatic reviews and, from day two, 211 tasks run by GEARS itself. The squares follow chronological order, not clock time.
Monday brought the spec and the first cut, and Tuesday the first production run and the visual editor. On Thursday, after using GEARS in production, I sent 20 feedback items, which became 20 PRs in a little over a day, with 68 tasks, 173 reviews and US$ 216. Friday brought the loop that asks and the screen redesign, and the following Tuesday the UX round.
None of these PRs waited for a release window. A merge to main triggers the production deploy with no approval step, and the 76 PRs went in one at a time, as their reviews closed:
↔ swipe to see the whole picture
Real data for the 76 PRs, November 16 to 24. The stream on top follows the order in which the PRs opened, not clock time; the chart below uses each merge's real time.
While one package was in review, the next was being written and a third was getting fixes. At times 6 PRs were open and 6 tasks were running at once. The median gap between one merge and the next was 35 minutes, the peak was 38 merges in 24 hours, and 25 merges landed between midnight and 7 a.m. My feedback took between a few hours and a day to reach production, and the GEARS I opened in the morning had changed since the night before.
Building all of this took about 160 SHIFT tasks and roughly US$ 515 of agent compute, not counting the automatic reviews (billed separately) or the Claude Code session that did the orchestrating.
The sequence the session repeated for eight days (brief, task, review, fix, review again, approval and merge) fits in a workflow, plan-to-pr, which now runs on GEARS.
On the 18th, the first spec-driven development workflow to run for real wrote the spec for a feature of GEARS itself.
Results in production
In eight days GEARS ran 14 workflows that launched 211 SHIFT tasks at a total cost of US$ 188. Almost 70% of them ran on Sonnet and 30% on Haiku. Picking the model per step cuts cost, because triage and reports run on a smaller model and writing and review on a larger one.
The most complete case was a foundation piece: the observability reference application. It is the base template of our Java services. Until the rewrite, it had two trivial endpoints, observability only in a README section, and 3 tests.
With agents, that base matters even more. The agent follows the pattern it finds in the repository, and you can only trust what it delivers when there is a deterministic way to check it: layers verified by an architecture test, static analysis, build gates, a suite that runs without infrastructure, and observability that shows the behavior at runtime. That foundation is the base of the agentic engineering pyramid. Workflows and reviews sit on top of it, and agents at the top.
↔ swipe to see the whole picture
The agentic engineering pyramid. The rewrite strengthened the base, in the template our Java services start from.
The rewrite went through two GEARS workflows. The first wrote the spec, the plan and 8 work packages, with a review loop and a human approval at every stage, and the second implemented the packages in a single PR, with code and security reviews on each. It took 93 tasks, about US$ 71 and roughly seven hours. The base template now comes with traces, metrics, correlated logs and profiles ready for GCP, an architecture test, build gates and 84 tests, where there used to be 3. The stg deploy needed a fix the next day, outside the run.
The four earlier definition attempts were closed. Each one exposed a gap that we fixed in GEARS before the next attempt, and the workflow went through five versions, numbered v4 to v8, alongside the engine.
A plan-to-pr run turned a persistence fix request in a product repository into a PR, with 5 tasks and US$ 4. Another, larger one is in review and tightens the baseline checks of SHIFT’s monorepo.
What GEARS can do today
↔ swipe to see the whole picture
The runs list: per-step progress, status, requester, duration and live cost, with the runs waiting for your decision highlighted.
↔ swipe to see the whole picture
A run stopped at the human gate: triage, implementation and two review rounds done, and the merge waiting for approval. The approver sees what they are approving.
| Capability | In practice |
|---|---|
| Declarative graph | task, parallel, loop and approval; dependencies and conditions in a closed grammar (==, >, contains…) |
| Data between steps | any step can read an earlier step’s summary, report, handoff, PRs, branch, findings and blocking count |
| Review loops | end when the review comes back clean, can be unlimited within the budget, and ask a person when they get stuck |
| Human gates | approve, request changes (the loop runs again with the comment) or reject. Approvers see the output of what they approve, and only the run’s requester or the designated approver can decide |
| One run, one branch, one PR | a draft until the end, marked ready exactly once |
| Several repositories per step | SHIFT repository lists and aliases, each repository under the same branch rule |
| Governance | budget and deadline per run, live cost, spending cap honored, every decision recorded |
| Visual editor | drag and drop on React Flow, YAML generated with comments preserved, errors shown on the card, workflows saved and shared |
| Monitoring | live run graph, a summary card with variables, inputs, reports and PRs, phone notifications when a run ends or an approval is waiting |
| Operations | OpenTelemetry to the same standard as SHIFT’s orchestrator, deployed with Helm in the same cluster |
Where to use it across the company
Almost every team has processes with several steps that depend on someone following each one. Some that already fit in a workflow:
- bug fixes with a deadline, with triage, fix, review loop, approval, docs and regression (the example in this post);
- security remediation across dozens of repositories, with one step over an alias that groups the team’s repositories, a security review loop and an approval before the merge;
- framework or dependency upgrades, with a plan, packages, a check of every package and one PR per run;
- system migrations, with a step that understands the legacy system, the implementation in the new structure and integrated end-to-end tests that validate it, in a loop that only ends at 100% success, which is what makes the output trustworthy;
- spec-driven development, with questions answered during definition and one approval per stage, as in the rewrite of the observability application.
Today a person starts every run. SHIFT is already past that stage: many of its tasks start without anyone asking, from an opened PR that calls the reviewer or from a schedule. GEARS will follow the same path. A remediation workflow can start from a security alert, a bug-fix workflow from a labeled issue and a dependency upgrade at a fixed time, and people come in where there is a decision to make. That is how the process matures: the common flow becomes the default path and stops depending on someone remembering to run it.
↔ swipe to see the whole picture
The maturity steps: SHIFT is already started by people, events and schedules; GEARS is started by people today, and events, triggers and schedules are the next step.
A platform team writes the workflow once, with the review rules and evidence it requires, and any team runs it with its own repository and input. Budget, a named approver, cost per run and an audit trail come with it, because every step is a SHIFT task with its log, summary and handoff.
Nobody has to memorize the schema. The visual editor builds the workflow as you drag steps, and our AI toolkit has a skill in which an agent interviews you about your process and writes the YAML, already validated.
↔ swipe to see the whole picture
The visual editor: drag steps, pick the Shifty, model and repository (the output comes from the Shifty), see errors right on the card and take the YAML with you.
Next steps
For now GEARS is limited to SHIFT administrators while we settle the access model. The next step is to open it to teams and, together with them, find the flows that repeat and turn them into shared workflows.
Everyone has access to the same models, so the agent that writes code makes little difference on its own. The result depends on the process around it: who reviews, when to stop, who decides, what it costs and what gets recorded. GEARS has handled that part in production since November 17, with budgets, an audit trail and merged PRs, and it was built by the same fleet it orchestrates.
This post was written by: Allan Martins | COE - Architecture.