Start here
Design
The factory assay is becoming, the ideas it is built on, and the decisions it keeps to.
A way of getting features built by coding agents from several vendors, with a person deciding what gets built and what gets merged. assay is its orchestrator.
This page is the design, and most of it is not built. What assay does today is in running, one flow worked through is in an example flow, and the order of work is in the TODO.
What it is for
- Take a piece of work from "what I want" to a reviewed branch, with as little of the person's time as the risk allows.
- Use each vendor's agents where they do best, and spread work across their separate usage limits.
- Keep every agent fenced to what its step needs.
- Let a project say what its steps are: which models, which harness, how many agents, what each is asked.
- Show the person where a piece of work stands and what every agent did to it.
Principles
- One primitive: a step. Deciding, building, reviewing and arbitrating are the same thing with different inputs, workspaces and models. A step that runs a command and no agent is the same thing again.
- The wheel is turned by hand first. The aim is that a request goes in and a reviewed branch comes out for the person to merge, with nothing asked of them between. Until running by hand has shown what a flow needs, a step runs when the person starts it. Either way a step reads what earlier steps left and adds its own, so turning by hand and turning unattended are the same flow, and a project can choose which.
- The state is a folder the person can read. Where a feature stands, what each agent was asked, what it did and what changed are files in one place.
- The builder never vouches alone. Something other than the builder stands behind the result: reviewers of another model, a command the flow runs, or the person.
- No agent writes shared state. An agent reads its inputs and writes a result to its own output folder. assay puts the result where it belongs. So every container can be sealed, and agent output is untrusted text until something has looked at it.
- Guard effects, not calls. The container is thrown away and nothing leaves it except through assay, so most guardrails act on the boundary and on the result.
- Flows belong to the project. assay knows how to run a step, not which steps a project has. Patterns that keep coming up become steps assay ships with, and not before.
- Only the person merges. Agents commit freely in their own clone, and assay brings their commits back as a branch in the project's repo.
Words
| Word | Means |
|---|---|
| Feature | One piece of work, one branch |
| Flow | The steps a feature goes through |
| Step | One part of a flow |
| Turn | One run of a step |
| Session | One agent within a turn |
| Edge | The step that follows a step |
Who owns what
| Owner | Owns |
|---|---|
| assay | Steps, sessions, the feature folder |
| git | Code, on a feature branch |
| The project | Its flow, rules, toolchain and paths |
| archr | The final review |
What a feature is meant to do lives in its folder and not in the repo: it is finished at merge, where a rule about the project lasts.
A flow
A flow is the project's own: its steps, who runs each, and where each leads. assay ships none. The shape expected most often takes a piece of work from what the person wants to a branch they merge:
- something works out what is to be made, and writes it down, perhaps as an attended session
- a builder makes it, or several from different vendors, each on its own branch
- a command runs the project's build and tests, the one thing in the flow that is not an opinion
- other agents review what came back, each perhaps with a concern of its own
- something reads the reviews and says whether the work is accepted, goes back to a builder, or needs the design decided again, which is the person's
- the person merges
An example flow is one such, worked through. A flow need not make a branch: a step that looks over code and leaves a report, or one that sorts what has come in and leaves requests, is a flow too.
Each of these is one turn of the wheel, by the person or by assay for them, and a turn back to an earlier step is a turn like any other. Two things stop a wheel assay is turning. A step that is the person's waits for them. And a feature has a limit on its turns, so a flow that keeps sending work back stops and says so, and does not spend without end. The prompts of each step are written by hand to begin with. After some rounds on test and real projects, the ones that hold up become steps assay provides: a review with a defined prompt and output, an arbitration with defined outcomes.
A step
A step is one file in the project: what assay needs to run it, and then what the step is asked to do. The first part says:
- Who runs it: agents, one session each, with a harness, a model and an effort; or a command and no agent, in the same kind of sealed container. An agent may have a role, and the step's text may have parts that only a role is asked, so several agents on one step can each be asked something different: a reviewer for security, one for the interface, one that tries to break the thing.
- What goes in beyond what the step before it produced, and what comes out beyond its output, each by name: what a step names.
- What follows.
Every step has one output, under the same name whatever the step: the design, a builder's notes, a review, everything a command printed. It is the one document a session leaves, and there is no separate message: whatever a step has to tell whoever is next, it says in its output. A turn is always handed what the step before it produced, whatever step that was, and whatever the person has said since. So a step names only the standing documents it needs from further back, a design or a review, by the name of the step that made them, and is handed the one from that step's latest finished turn, however the flow arrived there; never the reasons it might be turned again, which arrive as what the step before it produced. A step names no files, in its keys or in its text. Where a step file names something of assay's own, the branch, the request, the history, the settings, the end of the flow, the person, the name is marked as assay's, so no name a project gives a step can be mistaken for one or is forbidden.
It is kept to those few keys. A step that needs more than them is a sign the flow wants another step.
A session is given two folders and never the feature folder: one it can only read, holding exactly the files that go in, and one it writes its files to. assay fills the first and takes from the second only what the step says comes out. So what passes between steps follows from the step files and the one rule, and the part of a prompt that says what the session has and what it must hand back is made by assay, leaving the step's own text to say what is being asked. Between the two go the project's standing rules for what agents write, kept in one file of its own and carried into every agent's prompt.
What a step has to say and where the flow goes after it are kept apart. A reviewer's verdict and its points are in its output, and the flow goes to the arbitrator whatever they are. So most steps have one way on and choose nothing. Where a step does choose:
- A command goes one way if it passes and another if it fails, by its exit.
- An agent is offered the ways on by name, each with when to take it, and leaves the name of the one it took. An arbitrator's are to accept, to send the work back to a builder, or to stop for the person because the design must be decided again. assay takes its answer only if it is one of those offered, since agent output is untrusted text.
A way on may lead to the person, in place of a step, which is the flow as it was written: the flow stops there with that turn's output in front of them, and they turn whichever step they choose. Any agent may also ask the person, by leaving a question in place of finishing, which stops the wheel the same way and is the exception no step file writes down. And any agent may tell the person something without stopping: what it assumed where it was not told, which the person should know and need not answer. What it tells them is kept apart from its output, which the next step reads and the person does not, and assay shows it to them when the turn ends and in the feature's report. How a session ended is otherwise for assay to work out from what it left: an agent writes prose and, at most, a few words that assay checks against what it offered: the way on it chose, a setting it changed. A flow ends at a step with nothing after it, and the branch is then the person's to merge.
The person is in the same stream as the steps: what they say when they turn a step, an answer, a correction, one more thing they want, is kept with the turn of that step and handed to it, with anything they said to a turn since the last that did not fail.
A command step is how a flow runs a test harness. A project's tests are not one thing run in one place: a flow may run one harness after building, another before merging, several, or none, and builders and reviewers may run the same ones inside their own sessions.
What a step names
A step file names two kinds of thing: the project's own steps, for their output, and what is the feature's, marked @. What a step lists to be handed, it reads. What it lists to hand back, it writes, and assay puts in place.
| Name | Handed | Handed back |
|---|---|---|
| a step | its output | |
@request |
what was asked for | |
@history |
what has happened | |
@branch |
the repo, at the branch | its commits |
@settings |
the feature's settings | changes to them |
A feature may be about another: one that looks over what another made, or over how its flow went. @about/ before any of these names but the branch is the same thing of that feature, to read and never to write, and that feature's branch is where its sessions start. A turn may name the feature it is about for that turn alone, so one long-lived feature can look at each run as it finishes, with its own earlier output as its memory of the others. That is how a project looks back on its own flow: a step reads a finished feature's history and what its steps said, and says how the flow did; another reads the last few of those and proposes a change to the flow, as a branch the person merges.
Settings
Settings are a feature's short standing facts: how much review it wants, how far its spec should go. Each is a name and a word. The project declares them, with the words each may take, since what an agent writes is untrusted and assay takes only a value it was told to expect.
- The person sets them as they make the feature.
- A step that hands back
@settingsmay change them: a triage that reads the request and judges how much review the work wants, a spec that knows better. Sessions of one turn that set one differently stop the flow for the person, as those that choose differently do. - A step handed
@settingsis told them. - assay reads them to say who runs. An agent may name the words of a setting at which it runs, so a low one gives a single fast reader and a high one the whole panel.
A setting's value is worked out and not kept: what the feature was made with, then what each turn set, in the order they happened. So going back on a turn goes back on what it set, and the history says who set what.
A setting is not where steps tell each other things: that is a step's output. Nor is it the way on a step chooses, which belongs to one turn and is gone with it, where a setting stands for the whole feature. The two are taken the same way, a word checked against those offered.
The feature folder
What a project is to assay is in one folder, .assay/, which is committed: the project's config, its toolchain and its flow. The flow that governs a turn is the one in the project's working tree when the turn starts, committed or not, so the person can adjust a flow, try it and adjust it again. No session's checkout has .assay/, so nothing a session does to its own clone changes the flow it is part of. It is not hidden: like anything committed, a session can read it through git. A session whose commits touch .assay/ has that flagged for the person, since merging them would change the flow.
What has happened to a project is in a second folder beside it, .assay-state/, which git does not see. Its features/ holds the state of each feature: beside the code it concerns, found from the project's path alone, and never given to a session. Keeping the two apart means either can be linked, copied or moved whole: a flow shared between projects, or state kept outside the repo.
A feature is made by name and given the project's next number, so 003-notes is the third feature made and no two clash. What is true of the whole of it is kept at the top of its folder: what it is for, the step it begins at, the commit it starts from or that it follows HEAD, the settings it was made with, the feature it is about, and where its request came from.
Every turn adds a folder to a feature, numbered in the order turns happened, so a step run again is a new folder and the list is the feature's history. What the person said as they turned a step is in that turn's folder, and a turn that was gone back on stays in the list, marked reverted, though what follows is worked out as if it were not there.
.assay-state/features/<feature>/
feature.json what is true of the whole feature
request.md what the person asked for
001-spec/
002-build/
003-test/
004-review/
005-arbitrate/
006-build/ the same step, turned again, with what the person said
A turn's folder holds what its sessions were handed, a folder for each session, with what it was sent, what it handed back and how it went, and the turn's account of itself, step.json:
- where it is: running, done, or waiting for the person
- what went in: the files it read, by their names in the feature folder, and the commit it started from
- what ran: each session's harness, model, time and cost, or the command
- what came out: the files written, and the commit returned
- how it ended, and the step that follows
It is written when a turn starts and again when it ends, so the last one is where the feature stands, and there is no second account to fall out of step with it.
What a turn produced lives with that turn. What it was handed is kept beside it as it was handed, and each session's prompt as sent, as the record of what ran, since the flow it was made from may have changed since. Everything in the account is a name within the feature folder or a commit in the repo, never a path on the machine, so the folder can be moved, linked or kept. What a step has to say stays in its own files as prose; the account holds only what something else must act on.
The files are assay's own. Anything else that wants a feature's state, archr, a page showing a flow's progress, a CI system, asks assay, which answers in a form that does not change when the files do. assay depends on none of them. A finished feature's folder is the record of why its change was made, and can be kept.
Attended sessions
Two parts of the work are a conversation and not a step that runs unattended: working out with an agent what is wanted, and looking over a result with one at the end. An agent talked to on the desktop itself has the person's files and credentials, which is what every other session is kept from.
An attended session is the same container, fence, workspace and sign-in as any other, with the person's terminal on the harness's own interface in place of assay driving it. It reads the repo and writes to one folder, and what comes out of it is a file there: a request, notes on a branch. assay keeps no stream of it, so its record is what the harness keeps and what it wrote.
The workspace
What a session works on besides the files its step hands it, and how it gets there without fetching or rebuilding what was already built.
A clone of the repo
A project's config sits in the folder its sessions work in, which may be one part of a larger repo, such as stt/ in gf. The config's include lists what else a session needs from the repo, relative to that folder: ../cabal, ../deps. The session's checkout is those and nothing else, bar the .gitattributes and .gitignore files a correct checkout needs.
- The repo's git folder is mounted read-only, and none of its working tree. Inside the container a clone shares its objects, checks out only the session's paths, and starts a branch at the base commit. LFS files come from the repo's own store. Nothing is fetched over the network and nothing is copied but the files checked out.
- The agent commits in that clone. The repo on the host, with its hooks and config, is never writable from inside.
- At the end assay takes the new commits out as a git bundle and fetches them into the project's repo as a branch. A fetch writes objects and a ref and runs nothing.
- A feature's first turn starts from
HEAD, or from a commit the person names, and with no commit named stops if the working tree has uncommitted changes outside.assay/: what goes into a session is what was committed. Later turns start from the feature's branch. The person can carry on working in the repo while a turn runs. - A step that only reads, such as a review, gets the same clone at the branch it is reading, and returns files and no branch.
- None of this is secrecy. The clone shares every object the repo has, so a session can read anything ever committed, whatever is checked out.
No repo
A step need not have a repo. Its session then has only the files it was handed and the folder it writes to, with no history behind them. This is for a step whose worth depends on the agent not seeing something, which a clone cannot promise: the files the step is given are all there is.
Images
Three layers, the one that changes least at the bottom:
- Toolchain: the project's Dockerfile, or assay's fixed default, Debian with common tools, when it has none. It must be Debian or Ubuntu based, since assay's layer uses apt and some CLIs need glibc.
- assay's layer: what assay needs itself: iptables for the fence, curl and certificates for the installers, the agent user.
- Warm workspace, one per base commit: the clone at that commit after the project's prepare command, such as a build and an asset cook, saved as an image.
Harnesses are beside the image, not in it. Each harness at a version is installed once on the machine into a volume of its own, shared by every project, and a session mounts read-only only the one it runs. A new version of one harness rebuilds nothing, and a harness that cannot be installed stops only the steps that use it.
Every session and command on a base commit starts from its warm image. A container's files are copy-on-write over the image, so starting one copies nothing and parallel sessions share one copy on disk. A build inside is incremental from the warm state; a command step that must not trust that can start from the layer below and build from nothing.
Guardrails
Four layers. The first, second and fourth are the real guardrails; the third is steering.
- The sandbox, during the run. For anything with an effect outside the container: network by named host, read-only mounts, and no credentials but the agent's own sign-in and any the step's policy names, such as a key for an outside API or a database. It cannot be argued with or scripted around.
- assay, on the result. After a session, assay inspects what came back and says in the step's folder which rules it broke. It works the same for every harness. To start with:
- the diff adds a binary or a file over 1 MiB, or touches
.assay/ - the diff touches paths the step was told to leave alone
- tests were deleted or assertions weakened
- a dependency was added, which needs the person
- the diff contains a credential the session was given
- the diff adds a binary or a file over 1 MiB, or touches
- Harness hooks, during the run. A hook refuses a named call before it happens and tells the agent why. Hooks differ per harness and can be bypassed, so nothing that matters rests on them alone. Their value is that an agent told it may not edit something adapts, where one that finds out at the result has wasted the session.
- Budgets. A cap on time and tokens for each step. assay ends the session at the limit.
A step's policy is one block of config: what it can see, which hosts, which credentials, which paths it must leave alone, the result rules and the budget.
The record
Kept per session, in two layers. The second is the one to trust.
- What the agent says it did: its event stream, which holds every tool call. Good for reading how a session went.
- What happened at the boundary: files changed, every host the session tried to reach, what the sandbox refused, and which result rules it broke. A script the agent wrote can do things its stream never mentions, but it cannot cross the boundary unrecorded.
Refusals and broken rules are part of the record. A model that keeps hitting the same rule is saying its prompt is unclear or the model is wrong for the step.
The report
One report per feature: what the person reads to judge a merge, what says how well the flow worked, and what a step that looks back on the flow reads in place of every session's stream. It is a pure function over the feature folder and the repo, made by ordinary code and no agent, and says, from what assay recorded and nothing an agent claimed:
- What is to be merged: the branch, its commits, how much it changes, any flags on them, and what was proven on its last commit, which is each command step that passed there.
- How it got here: each lap in a line, a lap being a change to the code and what was said of it before the next change, with how each turn ended and the file to read for each. What the person said and was asked. Turns that were reverted, apart from the rest.
- What it took: time from the first turn to the last, split into turns running and waiting for the person; time, tokens and cost for each step and each harness and model, added up over its turns; how much of the whole was spent in each lap, so what was spent after the first is plain. Cost is one measure across harnesses, which each report it on their own basis or not at all: a session's tokens at a list price for its model, and not a bill. Where no price is kept or set for a model, its harness's own figure stands in, marked wherever it is counted. It says which set of prices its turns were costed from.
- What each session did, from its recorded stream, read in the same updates it showed as it ran: its tool calls by kind, how many failed, and the ways they failed most, each with a count.
- What stands out, as plain facts and no advice: a session that took or cost several times what another of the same turn did; a step turned more than twice; a turn that failed or was interrupted; a choice that sent the work back; sessions that chose or set differently; tool calls that failed.
A step is handed it by name, as it is handed the history, so a look back at the flow starts from the report and goes to the folder only for what the report cannot say.
Two things the report is meant to give need more than ordinary code over the record, and are not in it:
- For a review: what it raised, and how much of that the arbitration upheld, which needs the prose of both read.
- Use of each account's limits, where the vendor exposes it, read before and after each step. This is not yet known to be obtainable for every vendor, and a before-and-after reading is only right when nothing else is using the account.
The same figures across a project's features are what picks the models for each step, so each is kept in a form that can be added up: a figure per session, never only a sentence. A reviewer whose points are mostly overruled loses its place; a cheap builder whose work holds first time earns more of it.
Models, harnesses and credentials
- A step names its agents: harness, model, effort, and how many.
- A harness is a driver in assay: how to install it, how to start it, what it may reach and which credentials it is given. Adding one is small, so a step can use whichever harness gives the best result for its model.
- assay talks to every harness in the shapes of the Agent Client Protocol (ACP). A session is started, given a model, an effort and a mode, sent prompts, cancelled and resumed. It reports messages, tool calls with their input and output, usage, cost and the account's limits as ACP updates, so the record and everything that reads it see one format whichever harness ran.
- A harness that speaks ACP itself, such as Grok or agy, needs only its data. For one that does not, assay has a small adapter of its own that translates the harness's two-way protocol into ACP inside assay: Claude Code's stream-json control protocol, Codex's app-server. No third-party adapter goes in the image, and the harness can be updated on its own.
- A prompt's turn is over when the agent has ended it and nothing it left running in the background is still going, since an agent carries on in a turn of its own when that work ends.
- Running out of time is a cancel, then a prompt in the same session asking the agent to finish with what it has.
- Subscription logins are expected to work only in the vendor's own harness. A third-party harness needs an API key, so it draws on API credit.
- A harness's version follows the CLI installed on the desktop unless the project pins one. Every session records the version it ran, and the installs of versions not in use are removed.
- The harnesses a project uses are the ones its flow's steps name. Its config says of a harness only what it changes, a pinned version or extra arguments and hosts. None is in its image: a session mounts its own harness alone.
- Claude's long-lived token is preferred over a copied login. It is supplied as an environment variable, and unlike a login that refreshes, several sessions can share it without invalidating each other.
- A step that is one structured call and not an agent session can use the API directly. Nothing should depend on that.
- Prices are public data, so they are kept on the machine and not copied into each project: a set for every model the harnesses offer, named by a hash of its rates, fetched only when the person asks. A project's own price for a model stands in for the kept one. Each turn records the set it was costed from, so a cost already recorded can be traced and does not move when prices do.
Where it runs
- The factory runs on one machine, the desktop. The project repos and feature folders live there and nowhere else.
- The laptop is a terminal onto it, with no repos of its own. archr runs on the desktop over ssh.
- Branches are the only thing that leaves the factory.
What a project needs
- A
.assay/folder, in the folder its sessions work in, with.assay-state/made beside it: its config, which names its harnesses, the paths a session needs and the command that warms them; its flow, a file for each step; and a Dockerfile for its toolchain, unless the default does. - Standing rules for what agents write, in
.assay/rules.md, for the prompts to carry. - Whatever test harnesses its flow runs, as commands.