# The default ub-agents loop

The loop every repository starts with after `ub-agents init`: an issue is scoped, implemented, reviewed and merged by your own coding agents, handing off through GitHub labels.

## Why it exists

A coding session can produce a useful patch and still leave you arranging a review, checking CI and remembering to merge. The default loop connects those steps through GitHub labels. Preparation scopes the issue, the implementer writes the change, a reviewer checks the exact commit that will merge, and the integrator merges it once your gates (required checks and merge rules) pass. See [how the loop works](https://agents.uberblick.ai/docs/how-the-loop-works.md).

## What you gain

- A reviewed, merged change without coordinating every handoff.
- Nothing to host: GitHub holds the queue and your launchers run your own coding agents.
- Roles, labels and outcomes are plain configuration you can read and change.

## Where a person steps in

What work starts, any question about scope or policy, and every merge your policy keeps for you.

## The flow

```flow
flow v0
# The default loop, with each scenario kept beside the diagram it plays.

columns rework main stop

section "Issue"
text start col=main "A maintainer adds the first label"
pill needs-preparation tone=muted
box issue-preparer "writes scope and criteria"
pill ready tone=done

section "Pull request"
box implementer "codes, checks, opens the PR"
pill needs-review tone=agent
box reviewer "reviews the exact commit"
pill ready-to-merge tone=done
box integrator "checks the candidate, merges"
end merged "Merged · issue closed"

pill needs-changes col=rework row=reviewer tone=rework

panel human col=stop row=needs-review span=3 tone=stop
  pill needs-human
  muted "or an Action needed comment"
  rule
  strong "A person decides"
  text "answers on GitHub"
  muted "then restarts an eligible role"

start --> needs-preparation
needs-preparation --> issue-preparer : trigger
issue-preparer --> ready : prepared
ready --> implementer
implementer --> needs-review : handed-off
needs-review --> reviewer
reviewer --> ready-to-merge : approved
ready-to-merge --> integrator
integrator --> merged : merged

reviewer --> needs-changes tone=rework : changes-requested
ready-to-merge -.-> needs-changes tone=rework to=bottom.2 : on-conflict · launcher
integrator --> needs-changes tone=rework to=bottom.1 : changes-requested
needs-changes --> implementer tone=rework from=top to=left label=end : revise the same PR

issue-preparer --> human tone=stop to=top.2 : needs-human
implementer --> human tone=stop to=top.1 : blocked
reviewer --> human tone=stop : blocked
integrator --> human tone=stop : maintainer-merge, blocked

legend
  pill tone=done "GitHub label" sample=ready
  box "agent role"
  panel tone=stop "a person decides"
  dashed tone=rework "set by the launcher"

play "Clean merge"
  tempo 1.8s
  step start actor="Maintainer" "Write an issue and label it needs-preparation"
  step needs-preparation actor="Loop picks" "Claim the next eligible issue"
  step issue-preparer 2.4s actor="Issue preparer" "Set the scope and give each acceptance criterion a check"
  step ready actor="Loop hands off" "The issue is ready for implementation"
  step implementer 2.6s actor="Implementer" "Implement, run the checks and open a pull request"
  step needs-review actor="Loop hands off" "The pull request is ready for review"
  step reviewer 2.4s actor="Reviewer" "Review the exact head commit against the acceptance criteria"
  step ready-to-merge actor="Loop hands off" "The reviewed pull request is ready for merge checks"
  step integrator 2.6s actor="Integrator" "No conflicts, checks pass on this head, and policy allows merging"
  step merged 3s actor="Merged" "The pull request merges and its linked issue closes"

play "One fix round"
  tempo 1.8s
  step implementer actor="Implementer" "Open a pull request with the first implementation"
  step needs-review actor="Loop hands off" "Send the candidate for review"
  step reviewer 2.4s actor="Reviewer" "Find a change that needs another pass"
  step needs-changes actor="Loop hands back" "Label the same pull request needs-changes"
  step implementer 2.4s actor="Implementer" "Apply the findings and check the revision"
  step needs-review actor="Loop hands off" "Send the new head for another review"
  step reviewer 2.4s actor="Reviewer" "The revision meets the acceptance criteria"
  step ready-to-merge actor="Loop hands off" "Approve the revised candidate"
  step integrator 2.6s actor="Integrator" "Checks pass on the head that will merge; policy allows it"
  step merged 3s actor="Merged" "The pull request merges after one fix round"

play "Main moves on"
  tempo 1.8s
  step reviewer actor="Reviewer" "Approve the pull request at its current head"
  step ready-to-merge actor="Loop hands off" "The approved pull request waits for the integrator"
  step needs-changes 2.6s actor="Launcher" "Another merge moved main and GitHub reports a conflict; send it back without a run"
  step implementer 2.6s actor="Implementer" "Merge main into the same branch, resolve the conflict and rerun the checks"
  step needs-review actor="Loop hands off" "Send the new head for review"
  step reviewer 2.4s actor="Reviewer" "Review the resolution on the exact new head"
  step ready-to-merge actor="Loop hands off" "Approve the updated candidate"
  step integrator 2.6s actor="Integrator" "No conflicts now, and checks pass on this head"
  step merged 3s actor="Merged" "The pull request merges on top of the new main"

play "A person decides"
  tempo 1.8s
  step ready actor="Loop picks" "Start the next eligible issue"
  step implementer 2.6s actor="Implementer" "A scope decision needs a person; report the question and stop"
  step human 3s actor="Maintainer" "Answer on GitHub and restart an eligible role once the decision is clear"
```

## Adopt it

Give your coding agent this prompt:

```text
I came across ub-agents (https://github.com/uberblick-ai/ub-agents, docs at https://agents.uberblick.ai), a loop that turns labelled GitHub issues into reviewed, merged pull requests with my own coding agents. Before I spend time on it, give me an honest, independent assessment. Read the README, the docs and enough of the source and tests to judge it yourself instead of repeating its own claims.

Then tell me: what it does and how the loop works in practice; where it is strong; where it is weak, risky or immature (the access it needs, its security model, cost, failure modes, maintenance burden); how good its code, tests and documentation are; and which teams and repositories it suits and which it does not.

Then ask me which of my repositories I have in mind. Look at that repository (its size, tests, CI, branch protection, and how we review and merge today) and tell me plainly whether you would adopt ub-agents there, adopt it with changes, or skip it, and why.

If you recommend adopting it, give me a step-by-step installation guide for that repository based on the current docs: prerequisites, installing ub-agents, running ub-agents init, the labels and settings it needs, a small first issue to try it on, and how to stop or remove it again. Do not install or change anything until I say so.
```
