This website uses cookies

Read our Privacy policy and Terms of use for more information.

Say we're designing an AI agent to review pull requests. A developer changes a download handler, the agent reads the diff, and its review says the change leaves a stream open. Before I'd change the code, I'd want to know who was supposed to close that stream. The answer might be in a file the agent never opened.

That gives us some architecture to work out. How does the agent ask for another file? What decides whether it's allowed to read it? What does the developer see if the read fails? All three decisions can disappear inside a box labeled “agent” on a whiteboard.

I use OSERE to think through designs like this. It stands for Outcome, Scope, Execution, Recovery, and Evidence. Inside Execution, I use ARC to name the Actions, assign Responsibilities, and draw the Connections. Here's how that works in a code-review exercise I developed in Excalidraw.

Five OSERE checkpoints with Actions, Responsibilities, and Connections inside Execution.

ARC starts inside Execution, once we've agreed on what the reviewer needs and what the agent can do.

Outcome and Scope give the agent a job

“Review this pull request” could mean explaining a change, finding a bug, or deciding whether to merge. I'd ask the maintainer which decision they're trying to make. In this exercise, they want to know whether the change introduces a defect. A useful finding tells them what triggers the problem, where to look, and why the change causes it.

For this first version, the agent can read one approved repository and return findings to the maintainer. The maintainer owns edits and the merge. There's no need to give this reviewer write access. We'll pin the two commits we're comparing. Call the base B1 and the proposed change H1. If the agent follows a caller into another file, it needs the version that belongs to that review.

I borrowed a practice from NASA's Systems Engineering Handbook called functional decomposition. I describe the work the system needs to do before deciding whether a model, a person, or ordinary code should do it. NASA’s guide to system design, §4.3

Execution is where I use ARC

Actions. I start with verbs. Pin the change, gather the diff, trace who owns the stream, assess the early return, and give the maintainer the result. H1 adds an early return for invalid input. Here's the handler in the exercise.

def download(stream, valid):
    if not valid:
        return "invalid"
    data = stream.read()
    stream.close()
    return data

We can see exactly which line gets skipped. To call it a leak, we still need to know whether the caller handed cleanup over to this function.

Responsibilities. The review application accepts the maintainer's request and displays the result. Its harness is the code that runs the agent. It pins the comparison, prepares the model's input, checks proposed tool calls against the review's permissions, runs allowed calls, and records the results. The model can spot the early return and ask to read the helper that defines who owns the stream. A repository reader fetches the source. These responsibilities can live in one application.

Connections. Here's what I'd write on the arrow from the harness to the reader. The request names the approved repository, H1, the helper's path, and a limit on how much to read. The reply identifies the revision actually read, the lines returned, and whether the excerpt was cut short. The harness includes that reply in the next model call. If the excerpt ends halfway through the cleanup rule, the model can ask for the rest.

The harness checks the model’s request for the ownership helper. The reader returns source from H1, and the maintainer receives a review tied to that revision.

Follow the request for the ownership helper. The reply changes what the model can say about the early return.

Suppose the helper assigns cleanup to the handler and the caller relies on that guarantee. Now the finding can point to the ownership rule and the new return that skips cleanup on invalid input. The application can check that both citations exist at H1. The maintainer can inspect the reasoning behind the claim.

Recovery changes what the maintainer sees

What if the helper read times out? The harness can retry against H1 within its budget. If the read still fails, the report should name the missing file and leave the leak question open. An empty findings list would hide the difference between “we checked cleanup” and “we couldn't establish who owns it.”

That failure sends me back to Execution. If the reader only returns a string, how would the harness tell an empty file from a failed read? I'd change the reply to carry a read status. Recovery just changed what I need to draw on an arrow.

Evidence comes back to the original question

I'd give the reviewer two versions of the handler. In one, invalid input returns before cleanup. In the other, a finally block closes the stream on that same path. Does the reviewer catch the first defect, leave the corrected version alone, and cite the code that explains its decision? Then I'd withhold the helper and check whether the report shows partial coverage. Those are the checks I'd run before trusting this design.

Try it on your own architecture diagram. Pick one arrow coming back from a tool. Write down what the next component needs when the call succeeds, fails, or returns half an answer. In our review, that arrow determines whether the maintainer gets a bug they can act on or a question they still need to investigate.

© 2026 Nnenna Ndukwe.

Reply

Avatar

or to participate