Patterns · working with agents

From idea to a running deploy.

How does a change get from an idea to a live system without anyone, human or agent, taking a shortcut? Every change takes the same road: a branch, a pull request, shared checks, an automatic merge, a documented deploy and two checks on the running system. The few places a person has to step in are written down, not improvised.

The flow

Change lifecycle: from an idea to a running deploy, and what happens on failure Three lanes, read left to right. An idea is parked in an inbox, then specified and planned. A plan review gate hangs below: a sound plan goes on to a branch and a pull request, an unsound one goes back to be re-planned. A shared CI suite checks the pull request. If every check is green it goes straight to auto-merge; if the sensitive-path check fails it waits for me to review and approve it first. After the merge an agent deploys by the documented path, a smoke check and a security check on the running system run, and the agent reports what was checked. If either check fails, the deploy is rolled back and the work stops. sound unsound: re-plan all green sensitive paths approved fails: roll back, then stop 1 An idea or a side task 2 Parked in the inbox 3 Spec, plan lead model 4 Review of the plan 5 Branch, PR not on main 6 CI checks shared suite 7 I review sensitive PRs 8 Merge auto, rebase 9 Deploys known path 10 Smoke own check 11 Security live system 12 Reports what ran I DECIDE AN AGENT ACTS A GATE CHECKS
  • I decide
  • An agent acts
  • A gate checks

Numbers match the steps below.

Steps

  1. MeHave an idea, or a side task comes up

    Either I ask for something, or a follow-up or "verify later" appears in the middle of other work.

  2. An agentParks it in the inbox at once

    A to-do that comes out of a conversation is written down straight away, not at wrap-up, with one line to say so. The session that finishes an item ticks it. Ideas never live only in a chat.

  3. Lead modelWrites the spec and the plan

    Specs stay with the strongest model. How a plan is made and executed is the previous page.

  4. Plan reviewReviews a plan that touches more than one file, a repo or a live system

    Every finding is answered before kickoff. An unsound verdict returns the plan to step 3.

  5. An agentWorks on a branch and opens a pull request

    Branch, then pull request, then auto-merge by rebase. Main is never pushed to without my explicit OK, and before any merge or deploy the agent follows the written ship procedure.

  6. CIRuns the repo's tests and the shared checks

    One reusable suite runs the same checks in every repo: shell and config linting, secret scanning, syntax checks, dependency and configuration scans, and a check on whether the change touches something sensitive. The branch must be up to date. A red check is a stop: re-run once if it plainly flaked, report it if it fails twice.

  7. MeReview and approve, only when sensitive paths change

    The change touches something that decides what gates a merge or what is exposed. It stays open until I review it and apply the approval label. Agents never apply that label, and a later push fails the check again.

  8. Merge gateMerges by rebase when the required checks are green

    Auto-merge does the merge. Nobody merges with an admin override, or edits branch protection, the required checks or the CI workflow to get a change through.

  9. An agentDeploys only by the repo's documented path

    The procedure lists one command per repo. The deploy script fast-forwards the checkout, records a rollback point, rebuilds and runs the two checks that follow. Interactive sessions confirm before a live deploy. A merged change stays undeployed until someone deploys it.

  10. SmokeThe repo's own smoke script

    It runs inside the deploy script. If something shipped without it, it is run by hand. A failure goes to the rollback path, then stops.

  11. Live securityChecks the running system, not the diff

    It looks for new listening ports, new critical findings in the image compared with the previous one, the expected refusal on the authenticated API, and the expected 404 for strangers. A failure goes to the rollback path, then stops.

  12. An agentReports what ran and what was checked

    The merged changes, the deploy command and target, the checks that passed, and the security summary. After a rollback it also says what failed and what state the system is in. Anything not checked is written as "not verified". The word "deployed" needs a passing security line.

Guardrails

What stops it

Gates, not goodwill

  • Required checks on every gated repo; no step is skipped because a change only touches docs.
  • No admin override, and no edits to protection, required checks or the workflow to get through.
  • Code reaches the server only through the documented deploy, and a drift alert fires when a checkout falls behind or is edited in place.
  • A new project starts from a scaffold that already has CI and a smoke script.

What waits for me

My label, my deploy

  • Any change where the sensitive-path check fails, until I approve it. Only a written rule keeps agents off the label, which is why I apply it myself.
  • Edge and network changes: merging lands the change, and I run the deploy.
  • Anything that needs root. Agents never run it; they write the commands into the report.
  • Also: waivers, security code fixes, major version bumps, and auth or data changes.

What happens on failure

Roll back, then stop

  • Open a revert change, merge it when green, deploy again, and re-run the same two checks.
  • Then stop. No fix-forward, no retry, no hand edits to the database, no silencing the failing check.
  • Two failures of one automation: stop, report state and side effects, and hand over the manual steps.

The idea

Make the safe path the only path, and make it boring. One road for every change means an agent cannot talk its way around a gate, and a gate that fails has a pre-agreed outcome: roll back, then stop. Human attention is spent on a short written list of exceptions, so my approval means something when it is asked for.

Copied