Talk about your project

leobranding.net@gmail.com
We reply within 24 hours

A Multi Agent Content Pipeline Across Three Repositories: A Case Study

This case study shows how a multi agent content pipeline splits writing, review, scheduling and publishing across three repositories, and where a human steps in.

This post describes my own system. It runs LEO Branding's own blog. No client project sits behind it, and I make no claim about results for anyone else. I report what the repositories do and what went wrong while I built them.

Why one blog needed three repositories and several agents

A blog looks like one job: write, check, publish. In practice it is four jobs with different failure modes. Writing can drift from the facts. Review can contradict itself. Scheduling can fire too early. Publishing can duplicate a post. If one agent does all four, one mistake travels the whole way unchecked.

So I split the work, and the split follows where the data lives.

The first repository is the content repository. It holds the strategy files, the facts, the role definitions, the ledger and the posts themselves. A scheduled weekly run in this repository writes English-master blog posts with Vietnamese translations. Code checks and reviewers gate each post. The run then opens a pull request that a human reviews and merges.

The second repository is notion-test, the page store. Its pages can carry a publish-at time and a source-language field, and its agent API reads and writes both. That is what lets a scheduled English-source post be handed to a publisher.

The third repository is paste-flow, the publisher. It decides when a page goes live. It publishes a ready post only once its publish-at time has passed, and it never publishes a Vietnamese child page on its own.

The website repository also matters, though it is not one of the three. It documents the publishing contract that ties the others together. The contract says the content repository writes English-master posts with Vietnamese translations behind a code gate and four reviewers. Approved posts are pushed into notion-test with a publish-at time. Paste-flow publishes at that slot without translating.

The cost of this split is plain. Three repositories mean three places where a rule can be changed without the others knowing. Most of this post is about how I keep that from hurting. The gain is that each repository has one reason to change.

If you are weighing a similar design, that is the first question to ask. Not "how many agents", but "where does each kind of state live, and who is allowed to change it".

The weekly batch: roles as markdown files and a ledger of post states

A reader who plans a multi-agent setup usually worries about control. Agents with broad access and loose instructions are hard to reason about. I handled that in two ways: roles are plain files, and permissions are narrow.

Each agent role is a markdown file. The agent definitions are thin wrappers around those files. A role file is easy to read, easy to diff in a pull request, and easy to argue with. When a reviewer misbehaves, I open one file and see exactly what it was told. The trade-off is that a role file is prose, and prose can be ambiguous. I came back to that cost in a real batch, described below.

Access is narrow on purpose. Only the strategist agent has web search. Only the fact-sync agent reads the other source repositories. Beyond that, no agent in the pipeline has a shell, and the orchestrator's dangerous git and GitHub commands are blocked by deny rules in its settings. That costs flexibility. An agent cannot fix a problem by running a command. It must report the problem and wait. For a content pipeline, I accept that.

The ledger is the second control. It is one file with one row per post slug, covering both languages. A slug moves through the states queued, written, reviewed, in-pr and merged. There is also a hold state for a post that should not move. The ledger answers simple questions without asking any agent: which posts exist and which are waiting for review.

Before any pull request opens, the gate runs. Each reviewer agent returns exactly one JSON object that must match a findings schema, and the batch skill assembles those objects into a per-post review file. The post gate itself is code. It checks banned phrases and numbers that no measured fact backs, in the post body and in its SEO text. A redaction filter scans every fact and every published tag for network addresses, host names and key patterns, and a hit stops the batch. A guard command hashes the gate's own inputs, such as the facts, strategy, tools, roles and build configuration, before the gate and before the pull request. Any drift stops the batch.

That last control closes a gap people often miss. If an agent can edit the rules that check its own output, the check proves little. Hashing the inputs makes a rule change visible and deliberate.

The human step comes after all this. The pull request waits for a person to review and merge it. The batch does not publish anything. It proposes.

One real failure shows why the checks need a second look. In one batch both posts were held because the funnel reviewer asked for a contact link that the writer and link-reviewer roles forbade. Each role was reasonable alone. Together they could never agree. The fix allowed exactly one contact link across the roles.

The handoff: from merged pull request to a scheduled publish

Merging is a human decision, and everything after it is mechanical. After a human merges the batch pull request, a bridge command pushes the merged posts into notion-test. This is the handoff.

The bridge does a few jobs. It creates the page for each merged slug. Posts are written with internal links in a slug-based placeholder form, and the bridge rewrites them to real page links when it pushes the post. The cost is that the bridge now owns a piece of link logic, so a bug there changes every post it touches. The Vietnamese child page gets one adjustment. The bridge swaps the English pillar tag for its Vietnamese counterpart on that page only, because paste-flow publishes each page's tags as they are.

The order of writes matters most. The bridge writes the publish-at time and the source language first. It sets the ready status only after that succeeds. This order protects against a quiet failure. Suppose an older notion-test would drop those fields. If the bridge set the ready status first, the page would look ready with no schedule, and a publisher could read that as publish now. With the schedule first, the run aborts instead of publishing at once. A loud stop is cheaper than an early post.

Paste-flow then does its part. It publishes a ready post only once the publish-at time has passed. For an English-source post, it publishes the Vietnamese child page as written and skips the translation step. The translation already happened upstream, inside the gated batch, so a second translation would only add a place for errors.

Two more rules protect the human. The bridge skips a page in the writing status that already has a publish-at time, treating it as a human hold, and it never rewrites that page. If I park a post, the pipeline leaves it alone. And the bridge creates a page only for a slug that was in a batch pull request and is now merged. It records created slugs locally, so a post a human deleted is never recreated. Deleting a page must stay final. A system that quietly restores what you removed is one you stop trusting.

The human stays in the loop at three points. The first is the pull request review and merge. The second is the hold, where a person can park a page by giving it a schedule while it is still being written. The third is deletion, which the bridge respects. None of these is a ceremony. Each one is a place where the system is built to defer.

What breaks between repositories and how the contracts catch it

Inside one repository, a test catches most breakage. Between repositories, the thing that breaks is the agreement, and an agreement is hard to test. Here are the failures I met and the contract that answers each.

A schedule that cannot be read. When a stored publish-at value fails validation, notion-test reports an error flag instead of dropping the value. That lets the publisher set an error status rather than read it as publish now. Paste-flow does the matching thing: it moves the parent page to an error status when the value cannot be parsed, instead of publishing it at once. Both sides choose the safe direction. A missing schedule should block a post, not release it.

Two validators that disagree. The client and the server both check the publish-at format. If their rules differ, one side accepts what the other rejects. A notion-test gate test compares the regex source of the two validators and runs both over one shared set of boundary cases. This is a small test, but it guards exactly the seam where two codebases must agree.

A copy that publishes twice. Importing a notion-test backup drops the publish-at time and lowers a ready page back to the writing status. An imported copy therefore never auto-publishes a duplicate post. The default is to do nothing.

A decision made on stale data. Review of the paste-flow scheduling change found that an error status was patched from a list snapshot without re-reading the page. The fix moved that decision to the detail read. A list can be old by the time you act on it. When a write changes state, read the single item again first.

A failure that looked like many failures. The bridge treats per-post failures as non-fatal, so the batch continues. It treats client-error responses, a missing key or a bad configuration as an abort. The line between the two matters. One bad post should not stop the other posts. A wrong key should stop everything, because every post would fail the same way.

That rule was tested for real. Under the secret-injecting runner on Windows, starting the bridge through the package manager shim failed with exit status one. The batch read that as per-post failures, so merged posts were never pushed until the bridge started node directly. The classification was right in design, but the failure arrived in a shape it did not expect.

What do these cases share? Each one is a default chosen for safety. Unknown schedule means error. Imported copy means writing. Deleted page stays deleted. Schedule is written before status. Some of these came out of reviewing real changes.

The costs are real. These defaults make the pipeline slower to publish and more likely to stop. A person must sometimes look at a halted batch and decide. I prefer that to a pipeline that always finishes and sometimes posts the wrong thing.

If you are building something similar, start with the handoff points, not the agents. List every place state crosses a repository boundary. For each one, write down what the receiver does when the value is missing, late or malformed. Then give the human a clear place to hold, review and delete.

See the multi-agent system service page for the service itself. If you want to talk through how this would map onto your own process, you can contact me.