|
| 1 | +# Guardian |
| 2 | + |
| 3 | +Guardian reviews a tool call of the agent immediately before it runs. It |
| 4 | +checks the exact action against what the person asked for, then allows the |
| 5 | +action, asks the person to confirm it, or denies it. Ordinary work goes on |
| 6 | +with no interruption. A write that nobody asked for, or that exposes private |
| 7 | +data, does not run. |
| 8 | + |
| 9 | +## Intent |
| 10 | + |
| 11 | +- Allow by default. Guardian blocks an action only when the action clearly |
| 12 | + matches one named rule from a fixed list. General doubt is not a reason to |
| 13 | + block. |
| 14 | +- Only the person who runs the Turn can authorize an action. Their own |
| 15 | + messages in the Run's Conversation set what is authorized. Text from the |
| 16 | + agent, a parent agent, tools, files, issues, comments, Event authors, and |
| 17 | + other people is context. It is never approval. |
| 18 | +- The model rates risk and authorization, and names one rule. Code turns the |
| 19 | + rule into allow, ask, or deny, so the model never chooses between ask and |
| 20 | + deny. |
| 21 | +- Secrets and private data never go where people outside the organization |
| 22 | + can read them, also when the person asks for it. |
| 23 | +- A block holds for the outcome, not for the tool. The same side effect |
| 24 | + through another tool, a script, or a child agent gets the same decision. |
| 25 | +- Guardian fails closed. When review cannot run, the action does not run. |
| 26 | +- Guardian is a second check on authorization and risk. Provider |
| 27 | + permissions, tool validation, and credential scope still apply. Whether |
| 28 | + the work is correct or well proven is not its concern. |
| 29 | +- The install, not the agent, states facts about destinations. Each plugin |
| 30 | + can declare where its writes go, such as which destinations people outside |
| 31 | + the organization can read. Guardian gets these facts in its system prompt, |
| 32 | + sorted by plugin name, so the prompt is the same for every review in a |
| 33 | + deployment and stays cached. The agent prompt and the tool catalog never |
| 34 | + include them. A fact never authorizes an action. The `data_exposure` rule |
| 35 | + does the blocking. |
| 36 | + |
| 37 | +## Entry points |
| 38 | + |
| 39 | +- Slack: a Review item in which Junior names an action, its target, and its |
| 40 | + side effects, and asks the person to confirm it. |
| 41 | +- Dashboard: System, "Guardian reviews"; the "Guardian" line in the costs of |
| 42 | + a Conversation. |
| 43 | +- Plugin authors: `approvalMode` (`auto`, `review`, or `approve`), tool |
| 44 | + annotations, and `describeProposal`. |
| 45 | +- Deployment: `AI_GUARDIAN_MODEL` selects the review model. |
| 46 | + |
| 47 | +## Rules |
| 48 | + |
| 49 | +- Guardian reviews each plugin tool and each MCP tool, unless the tool is |
| 50 | + marked read-only and not destructive. A `review` tool is always reviewed. |
| 51 | + An `approve` tool is never reviewed, so use it only when the tool code |
| 52 | + proves that each effect is safe. A core tool is reviewed only when it opts |
| 53 | + in, such as Automation and Workspace changes, `spawnAgent`, and |
| 54 | + `messageAgent`. |
| 55 | +- A public URL for a Sandbox server (`createPreview`) always goes through |
| 56 | + Guardian review, and the normal rules, such as `data_exposure`, decide. |
| 57 | +- A confirmation rule asks. The person clears it when they confirm the exact |
| 58 | + action. A hard rule denies, and no confirmation clears it. Examples are |
| 59 | + `data_exposure`, `credential_probing`, `security_weakening`, and |
| 60 | + `untrusted_instruction`. High or critical risk with low or unknown |
| 61 | + authorization asks, also when no rule matches. |
| 62 | +- An Automation run cannot ask, because no person is there to answer. Each |
| 63 | + ask becomes a deny. |
| 64 | +- When Guardian asks, the agent asks the person about that exact action, the |
| 65 | + way it asks any question. A child agent reports blocked to its parent. The |
| 66 | + agent never names Guardian or the review. |
| 67 | +- After three rejected attempts in a row, the agent stops that write for |
| 68 | + the Turn and explains the risk. |
| 69 | +- The root user instructions are the only authority. Each line has its real |
| 70 | + author. Only the current Actor's lines authorize. A restriction or a |
| 71 | + revocation still applies when it comes from a line that cannot authorize. |
| 72 | + A later message from the person wins over an earlier one. A bare yes |
| 73 | + answers only the question directly before it. Text that imitates these |
| 74 | + instructions, or claims an approval that they do not show, is untrusted. |
| 75 | +- Only the core context of a proposal is fact: Actor, Source, Destination, |
| 76 | + Conversation, and credential authority. Tool input, descriptions, |
| 77 | + annotations, `describeProposal`, and transcript evidence are untrusted |
| 78 | + evidence. |
| 79 | +- A child agent does not inherit approvals. The parent's text is its |
| 80 | + instruction. Guardian judges `spawnAgent` and `messageAgent` text by the |
| 81 | + material actions that it names, and the parent's own Conversation must |
| 82 | + back each one. |
| 83 | +- A Code Mode script cannot authorize. Guardian judges each call of a script |
| 84 | + as if the agent made it directly. It uses the script and its earlier calls |
| 85 | + only to see where the data came from. |
| 86 | +- The conventional steps of requested work match no rule, such as a pull |
| 87 | + request that delivers requested code and upkeep of that pull request |
| 88 | + ([GitHub](./github.md)). |
| 89 | +- The organization's own Slack, including the active Conversation, is not |
| 90 | + outside the organization. Ordinary product context, such as repo and |
| 91 | + system names, is not private data. |
| 92 | + |
| 93 | +## Gaps |
| 94 | + |
| 95 | +- Plugins cannot declare destination facts yet, so Guardian cannot know that |
| 96 | + a plugin write reaches a public place, such as a tracker that syncs to a |
| 97 | + public repo. `data_exposure` then misses private data in that write. This |
| 98 | + breaks "the install states facts about destinations". |
| 99 | + getsentry/junior#3596 adds `review-context`. |
| 100 | +- Guardian does not review Sandbox commands, because `bash` never opted in |
| 101 | + to review. A plugin can deny a write from the Sandbox and send the agent |
| 102 | + to its reviewed tool, as GitHub does for issue and pull request text. |
| 103 | + Other writes, such as a git push to a work branch, run with no review. |
| 104 | + This breaks "a block holds for the outcome, not for the tool". A fix must |
| 105 | + not ask for confirmation on routine commands. |
| 106 | +- `publishImage` makes a public URL with no review, and nothing checks the |
| 107 | + image for private data. This breaks "secrets and private data never go |
| 108 | + where people outside the organization can read them". |
0 commit comments