DEV Community

Cover image for The Rule Was on the Other Branch
JaviMaligno
JaviMaligno

Posted on Originally published at javieraguilar.ai

The Rule Was on the Other Branch

Every team I have worked with keeps its practices in a dozen places. The PR checklist lives in one repository. Who promotes to production is on a wiki page for the whole organisation. The branch a project integrates into is a convention of that project. The test command is in a README, unless it moved to a Makefile. And a good part of it lives only in the heads of the people who have been there longest.

People absorb this over months. An agent starts every session without any of it, or with a copy someone pasted into a prompt that went stale the week after.

So I built delivery-loop, a plugin for Claude Code and Codex that takes a task from its ticket to a change verified in a test environment and handed over. Taking a task to the end is not new by itself. What makes it work in more than one place is where the agent gets the practices of the place it runs in, how they are shared between the people who use it, and how they stay current without anyone maintaining them.

The loop, phase by phase

First, what the loop does. A task goes through ten phases; a small one skips the spec, the open questions and the plan.

The ten phases of the loop in four groups: understand (start, spec, gaps, plan), build (implement, review), prove (integrate until the test environment serves the exact commit, live verification with evidence per requirement) and hand over (promote or hand off, close the ticket).

Ten phases in four groups. A small task goes from start straight to implement.

  • Understand. It checks whether the work is already done (a ticket marked as pending can be in production through a PR that never cited it), creates an isolated workspace and sizes the task. It turns the ticket or document into points with stable IDs, separates what only a person can decide, and writes a plan that another agent reviews before any code.
  • Build. Tests first, then the change, in commits tied to the IDs; then an independent review by whichever reviewers the profile names.
  • Prove. After merging, it waits until the test environment serves that exact commit, not until the deploy says success. Then it checks every ID against the deployed environment. Wherever there is something to see, the evidence is visual: screenshots or a recording, uploaded to the ticket. An API or a queue gets a real response instead.
  • Hand over. Promotion to production, or, when that belongs to someone else, an explicit hand-off with the prepared material. Then the ticket moves to done with its evidence, and branches, workspaces and test data are cleaned up.

Almost every one of those steps leans on a practice of the place: which ticket state means "in review", who reviews, which branch to integrate into, how a change reaches the test environment, who promotes. That is what the profiles are for.

Each practice is written once, at its level

The plugin's core names no tool. Everything specific to a place goes in a profile, and profiles come in levels that mirror where practices already live. "Promotion to production belongs to the platform team" is true for the whole organisation, so it goes in the organisation profile. "This repo integrates into develop" is true for one repository, so it goes there. Nothing is copied into every repo, and nothing is in the plugin.

Five profile levels from far to near: plugin defaults, updated with the plugin; user, written once by each person; organisation, shared and maintained in one place; project, shared and installed only by those who work on it; repository, committed to the repo and updated with it. The nearest level wins, except for invariants.

Levels merge from far to near and the nearest wins, except invariants such as "production is never tested against", which no lower level can relax. The amber levels are the shared ones: written once, by whoever knows, for everyone.

Built to be shared

This is what makes it worth setting up. An organisation keeps its profiles in one private repository: the organisation level and one profile per project. A new person installs the plugin, runs one script, and gets the organisation profile plus the profiles of the projects whose repos they actually have. Nothing else.

Someone has to write that shared part first, but not by hand. The first run in an organisation detects what it can and asks one short round about the rest, and each answer is written at its level, organisation and project included. Publishing those files to the shared repo is what spares everyone after from the same round. From then on it fills in as people work: a rule someone adds, a project someone starts.

What is left for them is small and mostly written once:

  • Their user profile. Their accounts, their machine's limits, the browser tool they use. Written once, kept forever, and never part of a shared file: the shared repo's CI checks that no shared profile holds personal data.
  • Each new repo. The first run in a repo without a profile detects what it can (remote, branch protection, CI jobs, test runners, deploy configuration) and asks only what detection cannot settle, once, with a recommended answer. The result is committed in the repo, so the next colleague who pulls it gets it without running anything. For a client's repository, the same profile stays local, inside .git, so it is never pushed to the client.

Nobody re-learns the organisation. When a rule changes for everyone, it changes in one place with a PR, and everyone gets it on the next install. When a repo changes its integration branch, the profile in that repo changes with it.

Same plugin, two organisations

I run it in two organisations that work very differently. In one, the integration branch is develop, a change reaches the test environment by bumping a version in a separate config repository, and promotion beyond that belongs to another team. In the other, several client projects each have their own environments and release process, reviews include the company's own review agents, and client repositories must never receive our files.

The core is the same in both, unchanged, in Claude Code and in Codex. Every one of those differences is a line in a profile at its level. The public repo carries only fictitious example profiles; the real ones live in each organisation's private repo.

Keeping them current

A profile that was right when written goes stale on its own, the same way the memories my agent keeps did: never wrong when written, describing a state that expired. So the profile is treated as something to re-check, not to trust:

  • At the start of every task, a cheap recheck compares the profile with what the repo shows. A mismatch updates that datum at its level and gets one line in the report.
  • Any datum older than 30 days is verified again before the loop relies on it.
  • When the profile and another source disagree, the newer dated source wins, and the stale one is fixed where it lives, so the fix reaches everyone who shares that level.
  • The profiles are merged again mid-task, because rules can change while the work is in progress.

The rule was on the other branch

Keeping the practices current is only half of it. The agent also has to read the current ones, and that is where a real run surprised me.

A repository I work in had added a rule to its PR checklist: a person must attest that they have reviewed any AI-generated code before it ships. One run stopped before merging and asked me for that review. Two earlier runs in the same repository had merged without it. The rule was current and in the right place, the integration branch. But all three sessions had been launched from a checkout sitting on an older branch, whose instruction files predate the rule. The work then happened in a fresh worktree on the integration branch. The run that stopped happened to re-read the instructions there; the others worked from the copy they started with.

Sessions start from a checkout on an old branch whose instruction files have no review rule. The work happens in a worktree on the integration branch, where the rule exists. A run that re-reads the worktree's instructions stops before merging; one that keeps the launch copy merges without the rule.

The rule existed and was current. Whether it applied depended on which copy of the practices the agent was reading.

So now it is not left to chance: when a session was launched from a branch other than the integration or production branch, the plugin reads the repository's instruction files from the workspace where the work happens and logs which branch they came from.

Fewer questions on the way

Shared, current profiles are also what let the loop run without stopping to ask. Before starting, it probes every capability the task will use with a real call, because configured is not authenticated and authenticated is not working: a tool listed as connected can fail on its first call, and gh auth status can report one account while commands run as another. Whatever fails is raised in a single round, and the answer is saved at its level so no one asks again. What remains for a person are the decisions that are genuinely theirs: a business call, a client-facing text, the attestation that rule exists to protect.

Where to start

The phases are the visible part. What makes them work anywhere is the idea underneath: each practice written once, at the level where it is true, shared with everyone who needs it, re-checked before anyone relies on it, and read from the branch where the work actually happens. Nobody has to keep the agent up to date, because the practices it reads are the same ones the team already keeps.

If your team wants to try it, one person runs it on a real ticket and publishes the organisation and project profiles it writes. The repository has a fictitious example of every level to compare against.


delivery-loop on GitHub (MIT). Install in Claude Code with claude plugin marketplace add JaviMaligno/delivery-loop, or in Codex with codex plugin marketplace add JaviMaligno/delivery-loop. More of what I package for agents in Plugins & Skills.


Originally published on javieraguilar.ai

Want to see more AI agent projects? Check out my portfolio where I showcase multi-agent systems, MCP development, and compliance automation.

Top comments (0)