dotFactory

Who signs off on code an agent wrote?

By Simone Mosciatti

Agents are writing more of our pull requests than they used to. The interesting question is no longer "can the model produce a patch?" It is: who signs off on a change an agent wrote?

Claude Ship has a clean answer: a policy file in the repo, .claude/approvals.yml, that decides when a change can be approved and whether Claude may do that itself. We think about it a little differently. In dotFactory, a new pull request can start a Run. You run whatever workflow you want, you make sure CI is green, and then a small model step tells you whether the change needs a deep review. If it doesn't, you can merge the exact commit you checked. If it does, you either pause for a person, or leave the PR open with a comment that explains why.

If you want the rules as a file next to the code, start with Claude Ship. If you want the sign-off itself to be a workflow you can read, start with a factory. They can sit next to each other.

What does a policy file decide?

Claude Ship moves a pull request through review, fixes, and an approval decision. Code Review looks at the change, and Claude Approvals reads a policy you commit on the default branch. That policy can ask for a person on some paths, and it can let Claude approve the routine ones.

That is a good design if you already live in GitHub and want a smarter CODEOWNERS. What it does not give you is a workflow around the PR: your own checks, a split between "this can land" and "this should wait," and a merge pinned to the commit you actually looked at.

How would a factory sign off?

Picture a Monday morning. An agent has opened three pull requests: a typo in a README, a lockfile bump, and a rewrite of how you check auth cookies. You do not want the same process for all three, and you also do not want a model quietly merging the third one because a prompt said "use your judgment."

A kind: github trigger can start a Run when a pull request is opened or updated. From there the factory is yours — fetch the change, run your own steps, call an agent, or skip all of that.

Then you check that CI is clean. ci_status reads the newest Actions run for the branch. It is a read, not a wait. If tests are still running, start from the workflow_run webhook when CI finishes, or let the merge step refuse until the head is green.

Now the judgment call. You give an agent step a typed out: — { needs_review: bool, reason: text, risk: text } — and the platform turns that into a JSON schema the model must satisfy. Downstream steps branch on needs_review. They are not parsing a paragraph and hoping.

If the change looks safe, github_merge can land it. You pass the SHA you classified. Before it merges, the platform checks again: the head is still that SHA, CI on that head is green, the branch is not stale, and no review of the same commit carries a :hold. A later push does not sneak through.

If the change needs a person, you have two honest options. A human gate pauses the Run until someone fills a form, with the reason and the risk as context. Or you post a github_comment — it leaves a review on the pull request — and leave the PR open. The factory will not invent a gate you did not write.

Here is the shape of that graph. It is illustrative, but the node names and the guards match the language.

type ReviewCall = {
  needs_review: bool
  reason: text
  risk: text
}

trigger on_pr:
  kind: github
  config: {
    path:    "/api/github/webhook"
    target:  { one: { repo: "acme/app" } }
    event:   pull_request
    actions: ["opened", "synchronize", "reopened"]
  }
  out:
    pr:         { number: int, url: text }
    commit:     text
    repository: { name: text, url: text }

runner agent:
  kind: opencode
  in: open
  out: open

step classify:
  runner: agent
  in:
    prompt: "Does this change need a deep review?"
    pr:     on_pr.pr
    commit: on_pr.commit
    files:  pr_context(
      token:  github_token(repo: "acme/app", scope: { "pull_requests": "read" })
      repo:   "acme/app"
      number: on_pr.pr.number
    )
  out: { review: ReviewCall }

step merge:
  kind: github_merge
  when: classify.review.needs_review == false
  config: { method: "squash" }
  in:
    token:  github_token(
      repo:  "acme/app"
      scope: { "contents": "write", "pull_requests": "write", "checks": "read", "statuses": "read" }
    )
    repo:   "acme/app"
    number: on_pr.pr.number
    sha:    on_pr.commit
    body:   classify.review.reason

step comment:
  kind: github_comment
  when: classify.review.needs_review == true
  config: { event: "COMMENT" }
  in:
    token:  github_token(repo: "acme/app", scope: { "pull_requests": "write" })
    repo:   "acme/app"
    number: on_pr.pr.number
    body:   classify.review.reason

Swap the comment step for a kind: gate if you want the Run to wait. After someone approves, you can still merge the same SHA.

Why we like this better as a workflow

A policy file is a list of rules. A factory is a path. We find it easier to trust a path we can open on the Run page: the PR arrived, CI was green, the model returned needs_review: false, and the merge named a SHA.

dotFactory is a hosted service. You cannot self-host the platform. You can run compute in your own AWS account, and the .fct specification is open if you want to implement a different one. The FAQ and dotFactory vs GitHub Actions are good next stops.

Frequently asked questions

Does a policy file mean a person no longer has to review?

Only if you set it up that way. Claude Approvals can ask for a human, or it can let Claude approve what the policy allows. A factory is more explicit: low-risk changes can merge, and everything else either waits on a gate or stays open with a comment.

How does the factory decide whether a change needs review?

You do. A model step returns a typed record, and when: guards send the Run down one branch or the other. You can feed it the PR's description and changed files with pr_context.

What if CI is still running when the pull request arrives?

ci_status does not wait. Start a Run from a workflow_run delivery when CI completes, or rely on github_merge, which will not land a commit unless CI on that SHA is green.

Can I host the platform myself?

No. Compute can still run in your AWS account, and the language spec is public. To try a factory, start with Your First Factory or the getting-started guide.

Portrait of Simone Mosciatti

Written by

Simone has spent more than 10 years building software, from research at CERN to big tech at AWS and fast-growing startups like Rippling. These days he's building dotFactory, because he thinks writing software should feel a lot more like running a well-oiled factory.