BLOG

🌱 digital garden

Based in Nice, France - CET (UTC+1)

BLOG

🌱 digital garden

Nice, France - CET (UTC+1)

BLOG

🌱 digital garden

NICE, France - CET (UTC+1)

Agents and borrowed authority

The internal agent at Tunis Events answers questions about live production data, acts on them under approval and writes its own code. It has no identity of its own, and everything it may do is a file in a repository it cannot write.

We wanted one box between every person at Tunis Events and every system it owns.

╭─ what we wanted to build ───────────────────────────────────────╮
│                                                                 │
│  staff         ╮                    ╭  ticketing                │
│  organisers    │                    │  payments and the ledger  │
│  on-site crew  ┼──▸ one chat box ──▸┼  the cashless wallet      │
│  finance       │                    │  the marketplace, the CRM │
│  engineering   ╯                    ╰  and the code behind it   │
│                                                                 │
╰─────────────────────────────────────────────────────────────────╯
╭─ what we wanted to build ───────────────────────────────────────╮
│                                                                 │
│  staff         ╮                    ╭  ticketing                │
│  organisers    │                    │  payments and the ledger  │
│  on-site crew  ┼──▸ one chat box ──▸┼  the cashless wallet      │
│  finance       │                    │  the marketplace, the CRM │
│  engineering   ╯                    ╰  and the code behind it   │
│                                                                 │
╰─────────────────────────────────────────────────────────────────╯

Tunis Events is a ticketing platform: around twenty services with their own payment gateway, a double-entry ledger, reconciliation against Tunisian banks, a cashless wallet used at festivals, a marketplace and a CRM, run by a team small enough that an hour spent pulling a number out of a database is an hour not spent shipping. The box answers questions from live production data, and will later act on those answers and write the code they turn out to need.

Drawn exactly like that, it is also an unbounded capability sitting between everyone in the company and everything it owns, which is why almost none of the work is in the box.

There are two ways to give a language model that access. The common one is an API key, a tool list and a prompt explaining what not to do, and its failure mode is structural: the policy and the attacker's text share a context window. The other rests on two decisions. The agent gets no identity, so it can only ever act with the authorisation of whoever asked. And the complete list of what it can do is a file in a repository it cannot write.

This is the second one.

The whole system on one page

╭─ 1  SURFACES ────────────────────────────────────────────╮
│  web chat · WhatsApp · email · webhooks · CI             │
│  a surface carries a message and an identity             │
├─ 2  CONTROL PLANE ─────────────────────── ▾ an identity ─┤
│  router · policy engine · budget · run store             │
│  decides which agent, at which level, for how much       │
├─ 3  AGENTS ──────────────────────────── ▾ a run context ─┤
│  analyst · operator · author · reviewer                  │
│  no shell, no filesystem, no network of their own        │
├─ 4  GATE ────────────────────────── ▾ a declared action ─┤
│  allowlist · scrubber · size cap · approval queue        │
│  the only code path from an agent to the world           │
├─ 5  SYSTEMS ─────────────────────── ▾ the asker's token ─┤
│  the product services, their own guards unchanged        │
├─ 6  LEDGER ───────────────────────── ▾ traces and costs ─┤
│  runs · action calls · denials · approvals · evals       │
╰──────────────────────────────────────────────────────────╯
╭─ 1  SURFACES ────────────────────────────────────────────╮
│  web chat · WhatsApp · email · webhooks · CI             │
│  a surface carries a message and an identity             │
├─ 2  CONTROL PLANE ─────────────────────── ▾ an identity ─┤
│  router · policy engine · budget · run store             │
│  decides which agent, at which level, for how much       │
├─ 3  AGENTS ──────────────────────────── ▾ a run context ─┤
│  analyst · operator · author · reviewer                  │
│  no shell, no filesystem, no network of their own        │
├─ 4  GATE ────────────────────────── ▾ a declared action ─┤
│  allowlist · scrubber · size cap · approval queue        │
│  the only code path from an agent to the world           │
├─ 5  SYSTEMS ─────────────────────── ▾ the asker's token ─┤
│  the product services, their own guards unchanged        │
├─ 6  LEDGER ───────────────────────── ▾ traces and costs ─┤
│  runs · action calls · denials · approvals · evals       │
╰──────────────────────────────────────────────────────────╯

Two things about that stack. The gate is the only path, not the preferred one: the agent process has no shell, no filesystem and no outbound network, so there is no second route to argue it into. And the systems plane did not change. No agent endpoint, no service account, no agent mode in the ticketing API. The authorisation that protects an organiser's dashboard protects the agent, because it is the same code reached through the same door.

Three things you can ask it for

The chat box has one entry point and three outcomes, and they differ only in what they emit.

╭───────────────────────────────────────────────────────────────╮
│  you ask for            what comes out                        │
├───────────────────────────────────────────────────────────────┤
│  a question             an answer, with its trace under it    │
│  a feature or a fix     a pull request on the product repo    │
│  a change to the agent  a pull request on control, admin only │
╰───────────────────────────────────────────────────────────────╯
╭───────────────────────────────────────────────────────────────╮
│  you ask for            what comes out                        │
├───────────────────────────────────────────────────────────────┤
│  a question             an answer, with its trace under it    │
│  a feature or a fix     a pull request on the product repo    │
│  a change to the agent  a pull request on control, admin only │
╰───────────────────────────────────────────────────────────────╯

A question runs read actions against live data and comes back in seconds for a few cents. "Which organisers took money last month and have not been paid out" is the whole interaction: no approval, no side effect, nothing to undo.

A feature or a fix is the same conversation with a different ending. "The cashout page shows the wrong fee on refunded orders" becomes a task, a branch, a diff, a CI run, a blind eval run and a reviewer agent on a fresh context, and it stops at a pull request. The agent never merges and never deploys. A person reads one diff and presses the button, and the deploy, the health check and the rollback after it are machinery.

A change to the agent itself is the same pipeline pointed at the control repository: a new action, a new skill, a widened rule. It is restricted to an administrator asking for it, and that restriction is about not spending reviewer attention on an agent's opinion of its own limits. It is not what makes it safe. What makes it safe is that self-modification is not a privileged mode at all. It is an ordinary pull request against a file with a human code owner, and the agent is not that code owner, so an agent rewriting its own rules and an intern rewriting them go through exactly the same gate.

That is the property worth stating plainly: the authority is identical in all three. Reading, proposing a product change and proposing a change to itself are all bounded by the asker's token and the declared action list. Only the artefact at the end differs.

The agent has no identity of its own

It holds no service account, no API key and no database handle. It calls the platform with the asker's access token, so its reach is exactly theirs, decided by guards that already exist and are already tested. Its authority is borrowed, and it cannot exceed what was lent. There is no second permission system to keep in sync and nothing privileged to steal: a confused deputy needs a deputy holding authority of its own, and there isn't one.

  person         ╮  signs in once. the token is theirs
                 │
  surface        ┤  resolves an identity, never a channel
                 │
  control plane  ┤  a run context: subject, scope, level,
                 │  budget, time to live
                 │
  agent          ┤  no credential of its own, and no ambient
                 │  authority to borrow
                 │
  gate           ┤  allowlist match, scrub, cap, wrap, then
                 │  call with the asker's own token
                 │
  the API        ┤  its own guards decide. no agent exception
                 │
  the answer     ╯  with every action it took listed under it
  person         ╮  signs in once. the token is theirs
                 │
  surface        ┤  resolves an identity, never a channel
                 │
  control plane  ┤  a run context: subject, scope, level,
                 │  budget, time to live
                 │
  agent          ┤  no credential of its own, and no ambient
                 │  authority to borrow
                 │
  gate           ┤  allowlist match, scrub, cap, wrap, then
                 │  call with the asker's own token
                 │
  the API        ┤  its own guards decide. no agent exception
                 │
  the answer     ╯  with every action it took listed under it

The mechanics are where this usually goes wrong, so: the role claim is re-read on refresh rather than cached for the life of the session, which puts revocation inside minutes. Organisation scope rides in a header the API decodes itself, and naming an organisation grants nothing, the token still has to carry the right to act for it. A question about somebody else's event comes back 403 from the API rather than as a refusal the model composed, which is the only kind of refusal worth having.

The browser holds a cookie rather than a token, which is not a contradiction of the above. OIDC mints the token; the cookie carries the session behind it. Access and refresh tokens stay server side, keyed by an encrypted httpOnly SameSite cookie, and the server attaches the bearer. Ordinary backend-for-frontend, for the ordinary reason that a refresh token readable by script is worth more than every answer this agent will ever produce. It also leaves refresh with the only component that can do it safely, which matters here because a run outlives an access token and nothing inside the agent is permitted to go and get one.

The objection to all of this is that inheritance is a ceiling, not least privilege, and a platform administrator's token is broad. True. The gate narrows it per action and per level, so a run's effective authority is the intersection rather than the union, and the direction of travel is token exchange: a short-lived, audience-restricted, action-scoped token derived from the asker's. Inheritance is the floor of the design, not the ambition.

One question, end to end

╭─ a run ────────────────────────────────────────────────────────╮
│  asked     which organisers took money last month and          │
│            have not been paid out?                             │
├────────────────────────────────────────────────────────────────┤
│  actions   payouts.list_unsettled  from=10-01 to=10-31         │
│            ledger.balance          org=···         x6          │
│            holds.list              org=···         x6          │
├────────────────────────────────────────────────────────────────┤
│  answer    six organisations with a balance and no payout.     │
│            four are held pending a document, which the         │
│            question did not ask about and the answer           │
│            gives anyway.                                       │
│                                                                │
│            organisation │ balance │ last payout │ holds        │
│            ─────────────┬─────────┬─────────────┬──────        │
│            ···                                                 │
├────────────────────────────────────────────────────────────────┤
│  under it  the twelve calls above, each one openable           │
╰────────────────────────────────────────────────────────────────╯
╭─ a run ────────────────────────────────────────────────────────╮
│  asked     which organisers took money last month and          │
│            have not been paid out?                             │
├────────────────────────────────────────────────────────────────┤
│  actions   payouts.list_unsettled  from=10-01 to=10-31         │
│            ledger.balance          org=···         x6          │
│            holds.list              org=···         x6          │
├────────────────────────────────────────────────────────────────┤
│  answer    six organisations with a balance and no payout.     │
│            four are held pending a document, which the         │
│            question did not ask about and the answer           │
│            gives anyway.                                       │
│                                                                │
│            organisation │ balance │ last payout │ holds        │
│            ─────────────┬─────────┬─────────────┬──────        │
│            ···                                                 │
├────────────────────────────────────────────────────────────────┤
│  under it  the twelve calls above, each one openable           │
╰────────────────────────────────────────────────────────────────╯

That trace is the run rather than a summary composed afterwards, and it renders under every answer. The same question from an organiser's account returns one row instead of six, because their token carries their organisation and the API filters on it exactly as it does for the dashboard. No organiser mode to get wrong, no second query to maintain, no prompt asking the model to be careful.

What I cannot show you is whether the answers are good. Cost, duration, action count and every gap are logged per run, so the material for an honest claim is accumulating. It has been accumulating for days, not months.

Rules, actions, skills

Three kinds of file change what the system can do, and all three live in the control repository rather than in a database or a dashboard, because a row is something a write path eventually reaches and a file behind branch protection is not.

export const RULES = {
  roles: {
    analyst:  { levels: ["read"], budgetUsd: 2 },
    operator: { levels: ["read", "write"], budgetUsd: 5 },
    finance:  { levels: ["read", "write", "guarded"],
                budgetUsd: 5 },
  },
  limits: {
    maxTurnsPerRun: 30,
    maxActionsPerRun: 40,
    maxResultBytes: 60_000,
    runTimeoutMs: 600_000,
    concurrentRuns: 2,
  },
  approvals: {
    ttlMinutes: 60,
    singleUse: true,
    guardedRequiresTypedSubject: true,
    approverMayNotBeAsker: true,
  },
} as const;
export const RULES = {
  roles: {
    analyst:  { levels: ["read"], budgetUsd: 2 },
    operator: { levels: ["read", "write"], budgetUsd: 5 },
    finance:  { levels: ["read", "write", "guarded"],
                budgetUsd: 5 },
  },
  limits: {
    maxTurnsPerRun: 30,
    maxActionsPerRun: 40,
    maxResultBytes: 60_000,
    runTimeoutMs: 600_000,
    concurrentRuns: 2,
  },
  approvals: {
    ttlMinutes: 60,
    singleUse: true,
    guardedRequiresTypedSubject: true,
    approverMayNotBeAsker: true,
  },
} as const;

read runs freely, write produces a dry run and waits for a person, and guarded wants a typed confirmation and covers anything that moves money. Budgets belong in the same file, because an agent without a cost ceiling is not a product, it is an invoice.

An action is a declaration rather than something the model discovered.

defineAction({
  name: "payouts.list_unsettled",
  level: "read",
  scope: "organisation",
  summary: "Organisations with a positive balance and no " +
           "payout in the period.",
  input: z.object({
    from: z.date(),
    to: z.date(),
    minBalance: z.number().optional(),
  }),
  output: PayoutRow.array(),
  call: (ctx, i) => ctx.api.get("/payouts/unsettled", i),
});
defineAction({
  name: "payouts.list_unsettled",
  level: "read",
  scope: "organisation",
  summary: "Organisations with a positive balance and no " +
           "payout in the period.",
  input: z.object({
    from: z.date(),
    to: z.date(),
    minBalance: z.number().optional(),
  }),
  output: PayoutRow.array(),
  call: (ctx, i) => ctx.api.get("/payouts/unsettled", i),
});
defineAction({
  name: "payouts.execute",
  level: "guarded",
  scope: "organisation",
  summary: "Pay an organisation's balance to its bank.",
  input: z.object({
    organisationId: Id,
    amount: Money,
    reference: z.string(),
    idempotencyKey: z.string().uuid(),
  }),
  preview: (ctx, i) =>
    ctx.api.post("/payouts", { ...i, dryRun: true }),
  call: (ctx, i) => ctx.api.post("/payouts", i),
  owner: "finance",
});
defineAction({
  name: "payouts.execute",
  level: "guarded",
  scope: "organisation",
  summary: "Pay an organisation's balance to its bank.",
  input: z.object({
    organisationId: Id,
    amount: Money,
    reference: z.string(),
    idempotencyKey: z.string().uuid(),
  }),
  preview: (ctx, i) =>
    ctx.api.post("/payouts", { ...i, dryRun: true }),
  call: (ctx, i) => ctx.api.post("/payouts", i),
  owner: "finance",
});

The summary line is rendered into the prompt, so the documentation and the enforcement are the same array and cannot drift apart. The preview runs the production code path behind a flag the API understands, because a preview assembled from a second code path is a lie with extra steps. The idempotency key sits in the input rather than in the client, because a retry after a timeout must not pay an organiser twice and the only component that can guarantee that is the one that owns the ledger. owner is a human team, enforced by code owners rather than etiquette. And nothing is inferred: the gate does not walk an OpenAPI document exposing everything marked GET, because the method is not a permission model and every mature API has at least one read-shaped endpoint that writes.

Which is the short answer to why this is not simply MCP. MCP is a transport and a decent one. A transport does not say who wrote the list, where the list lives, or who is accountable for each line of it, and pointing a model at a server that enumerates your whole API is an efficient way to discover that read-shaped endpoint.

Rules say what is allowed and actions say what is possible. Neither says how a competent colleague would actually go about it, which is the third file.

---
name: close-the-month
when: someone asks what is owed, or for the settlement
actions: [payouts.list_unsettled, ledger.balance, holds.list]
---

1. Take the period from the question. If it is unclear, ask.
2. List unsettled balances for that period.
3. For each one, read the ledger balance and any holds, and
   explain a difference rather than reporting the larger
   number.
4. Return a table. Never a total without the rows under it.
---
name: close-the-month
when: someone asks what is owed, or for the settlement
actions: [payouts.list_unsettled, ledger.balance, holds.list]
---

1. Take the period from the question. If it is unclear, ask.
2. List unsettled balances for that period.
3. For each one, read the ledger balance and any holds, and
   explain a difference rather than reporting the larger
   number.
4. Return a table. Never a total without the rows under it.

That skill produced the trace above, including the part of the answer nobody asked for. Skills load when the router judges them relevant rather than riding along in every prompt, which is an attention budget rather than a storage one, and they are where the local knowledge accumulates: the difference between a wallet top-up and a ticket sale, why a festival's bar totals and its cashless totals are allowed to disagree for an hour. A skill grants nothing. Its action list is checked against the rules at load time, and a mismatch is a startup error rather than an escalation.

Where the three files live matters as much as what is in them.

              ╭────────────────────╮
              │     author agent   │
              ╰─────────┴──────────╯
   opens a pull request,  │  opens a pull request,
   never a merge     ╭─────┴─────╮   never a merge
                     ▾               ▾
╭─ product ───────────────────╮  ╭─ control ───────────────────╮
│  services                   │  │  rules.ts   the policy      │
│  the APIs                   │  │  actions/   the manifest    │
│  migrations                 │  │  skills/    the playbooks   │
╰─────────────────────────────╯  ╰─────────────────────────────╯

╭─ evals (private) ───────────╮  ╭─ guardrails (no repo) ──────╮
│  question set, answers      │  │  branch protection          │
│  injection corpus           │  │  required reviewers         │
│  regression cases           │  │  deploy secrets             │
│  CI reads it, agents never  │  │  runtime credentials        │
╰────────────┴────────────────╯  ╰─────────────┴───────────────╯
             │  pass or fail                    │  blocks the
             ╰────────────▸ author agent ◂──╯  merge
              ╭────────────────────╮
              │     author agent   │
              ╰─────────┴──────────╯
   opens a pull request,  │  opens a pull request,
   never a merge     ╭─────┴─────╮   never a merge
                     ▾               ▾
╭─ product ───────────────────╮  ╭─ control ───────────────────╮
│  services                   │  │  rules.ts   the policy      │
│  the APIs                   │  │  actions/   the manifest    │
│  migrations                 │  │  skills/    the playbooks   │
╰─────────────────────────────╯  ╰─────────────────────────────╯

╭─ evals (private) ───────────╮  ╭─ guardrails (no repo) ──────╮
│  question set, answers      │  │  branch protection          │
│  injection corpus           │  │  required reviewers         │
│  regression cases           │  │  deploy secrets             │
│  CI reads it, agents never  │  │  runtime credentials        │
╰────────────┴────────────────╯  ╰─────────────┴───────────────╯
             │  pass or fail                    │  blocks the
             ╰────────────▸ author agent ◂──╯  merge

Control is separate from product so that widening the surface is a reviewable event with a name on it rather than a line inside a feature branch. The evals are private and the author agent receives a boolean, because a model handed the failing assertion fixes the assertion. And the guardrails are in neither repository: branch protection, required reviewers, deploy secrets and runtime credentials live in the forge and on the servers, which is the one invariant I would not trade for convenience. It covers self-modification too. The agent may open a pull request against the policy file. The file has a human code owner and the agent is not it.

The gate

╭──────────────────────────────────────────────────────────────────╮
│  a question                                                      │
├──────────────────────────────────────────────────────────────────┤
│  1  edge       TLS, rate limit, a second lock on the door        │
│  2  session    encrypted cookie, the tokens held server side,    │
│                a fail-closed matcher, the role re-read           │
│  3  run gate   concurrency, per-thread lock, wall clock          │
│  4  process    no shell, no files, no network, no host config,   │
│                an environment allowlist and not a filter         │
│  5  action     exact name, typed input, deny by default          │
│  6  the token  the API's own guards decide, not a copy           │
│  7  scrubber   credentials and bank identifiers removed,         │
│                failing closed on anything it cannot parse        │
│  8  size cap   oversized results cut, the agent told to narrow   │
│  9  framing    results wrapped and labelled as untrusted data    │
├──────────────────────────────────────────────────────────────────┤
│  an answer, with every action listed under it                    │
│  the ledger: every call, every denial, every cost                │
╰──────────────────────────────────────────────────────────────────╯
╭──────────────────────────────────────────────────────────────────╮
│  a question                                                      │
├──────────────────────────────────────────────────────────────────┤
│  1  edge       TLS, rate limit, a second lock on the door        │
│  2  session    encrypted cookie, the tokens held server side,    │
│                a fail-closed matcher, the role re-read           │
│  3  run gate   concurrency, per-thread lock, wall clock          │
│  4  process    no shell, no files, no network, no host config,   │
│                an environment allowlist and not a filter         │
│  5  action     exact name, typed input, deny by default          │
│  6  the token  the API's own guards decide, not a copy           │
│  7  scrubber   credentials and bank identifiers removed,         │
│                failing closed on anything it cannot parse        │
│  8  size cap   oversized results cut, the agent told to narrow   │
│  9  framing    results wrapped and labelled as untrusted data    │
├──────────────────────────────────────────────────────────────────┤
│  an answer, with every action listed under it                    │
│  the ledger: every call, every denial, every cost                │
╰──────────────────────────────────────────────────────────────────╯

Three of those are load-bearing. The scrubber fails closed, because the body it cannot parse and walk is exactly the one whose contents are unknown, and failing open protects you from precisely the payloads you already understand. The permission callback is a deny rather than a filter: declared actions are pre-approved so it is never reached on the normal path, and anything that does reach it is by definition undeclared. The size cap is a cost ceiling and a data minimisation rule in one mechanism, with the side effect of pushing aggregation into the API where it belongs.

Organiser text reaches a context window by design. It is written on the public internet, stored in our database and returned by our API, which is a path most "connect your agent to your data" products have but have not drawn. The trifecta needs private data, untrusted content and an egress. We cannot drop the first two, so the architecture removes the third. Results are wrapped in a labelled block whose closing tag is escaped, and the prompt says that results are data; neither of those is what I rely on. What I rely on is that the analyst has no write actions, no shell, no network and no way to name a destination, and that its only output is a reply to the authenticated asker rendered beside the actions it took. A successful injection buys a wrong sentence in front of the reader least likely to believe it. That is containment rather than prevention, and it holds exactly as long as the analyst stays read-only.

Writes, and what happens when a run dies

╭─ approval required ────────────────────────────────╮
│  payouts.execute                          guarded  │
├────────────────────────────────────────────────────┤
│  organisation    the one named in the question     │
│  amount          the balance the dry run returned  │
│  destination     its registered bank account       │
│  fees            as the dry run returned them      │
│  balance after   what the ledger will say          │
├────────────────────────────────────────────────────┤
│  asked by        the person who started the run    │
│  expires         60 minutes, single use            │
├────────────────────────────────────────────────────┤
│  [ decline ]        [ type the name to approve ]   │
╰────────────────────────────────────────────────────╯
╭─ approval required ────────────────────────────────╮
│  payouts.execute                          guarded  │
├────────────────────────────────────────────────────┤
│  organisation    the one named in the question     │
│  amount          the balance the dry run returned  │
│  destination     its registered bank account       │
│  fees            as the dry run returned them      │
│  balance after   what the ledger will say          │
├────────────────────────────────────────────────────┤
│  asked by        the person who started the run    │
│  expires         60 minutes, single use            │
├────────────────────────────────────────────────────┤
│  [ decline ]        [ type the name to approve ]   │
╰────────────────────────────────────────────────────╯

Those are the fields rather than a screenshot, since a real card carries a real balance. The preview comes from the production path, the approval is bound to that payload's hash so any change kills the card, the call is made with the approver's token so the ledger names whoever pressed, and the approval is single use and expires.

Partial failure gets the dull treatment it deserves. A run is restartable, not resumable: nobody continues a half-finished sequence from a stale context. Reads have no effect and writes carry the key, so a replay either repeats the answer or lands on the completed payout. Outcomes are written once and the first write wins, so a run that fails after the answer was saved does not overwrite it with an error, and a run that dies before recording anything still leaves a row with its last action and its cost. The failure worth engineering against is not the crash, it is the crash that leaves no trace.

The loop

  intake   a question · an alert · a failed eval · a gap
              │
              ▾
           router
              ├──────────────┬──────────────╮
              ▾              ▾              ▾
        answer now       operator        author
        from live        dry run         branch
                              │              │
                              ▾              ▾
                      [1] a person    pull request
                          approves         │
                              │              ▾
                              ▾        CI · types · tests
                       executed with        │
                       the approver's       ▾
                       token, a receipt  blind evals
                       in the ledger        │
                                            ▾
                                     reviewer agent,
                                     fresh context
                                            │
                                            ▾
                                  [2] a person merges
                                            │
                                            ▾
                                     deploy, health check,
                                     automatic rollback
  intake   a question · an alert · a failed eval · a gap
              │
              ▾
           router
              ├──────────────┬──────────────╮
              ▾              ▾              ▾
        answer now       operator        author
        from live        dry run         branch
                              │              │
                              ▾              ▾
                      [1] a person    pull request
                          approves         │
                              │              ▾
                              ▾        CI · types · tests
                       executed with        │
                       the approver's       ▾
                       token, a receipt  blind evals
                       in the ledger        │
                                            ▾
                                     reviewer agent,
                                     fresh context
                                            │
                                            ▾
                                  [2] a person merges
                                            │
                                            ▾
                                     deploy, health check,
                                     automatic rollback

A gap is a first-class outcome. When no action can answer, the agent records one sentence about what was missing and says so rather than improvising, and querying those rows gives a backlog written by the people doing the work as a side effect of trying to work. An error log says something broke. A gap log says somebody wanted something that does not exist.

The reviewer is a separate agent on a fresh context, because an agent that has just written two hundred lines has spent its entire context convincing itself they are correct. It gets the diff, the spec and the tests, and nothing about how the diff came to exist.

Three places need a person: a write action, a merge, and any live money operation, the last of which never enters the automated path at all. The count matters as much as the placement. A queue that fires thirty times a day is a queue nobody reads, and a human approving without reading is worse than no human, because the trail now says somebody agreed.


Written with AI assistance from work item artifacts.