Give a renewals manager's AI assistant a good sandbox. Its commands can reach only the synced team folder, a short list of hosts and no secrets. Then it merges two customers who are not the same customer. The sandbox did its job: the write was inside the folder it was allowed to change. The merge is still real, in a file her whole team works from, the moment it happens. A wall decides what an agent can reach. It does not decide where its writes land.

Thesis: Keeping an agent's mistakes off the things that matter takes a different object, not a stronger wall. Let the agent work on a copy or a frozen view, so its writes land in a private layer you can read, and let a separate, narrow step apply a reviewed list of changes to the original. Scope the copy to the piece the task needs, and replace direct identifiers with stand-ins where the data allows. Be honest about the limits: discarding the layer undoes only what stayed in it, and stand-ins hide names, not identity.

When Agents Need a Sandbox asked five questions of any agent, and its closing note gives this chapter one of them: where the agent's writes land, on the real files or on a copy. Whom it acts as is still a chapter to come.


Frozen view, private layer, apply step

4 steps

    Built one piece at a time: a frozen view, a private layer, the agent and the apply step.

    Read this figure as text
    1. A frozen view: a snapshot of the renewals folder and the CRM accounts in scope, frozen so colleagues’ edits cannot change it mid-task. The agent cannot change it either.
    2. A private layer on top holds everything the agent writes, as one set of changes you can read.
    3. The agent, with secrets removed from its copy and no write access to the original, writes only into the private layer.
    4. The apply step, a separate, narrow step as its own identity and not the agent, holds the only write access. It carries the change list into the original, where the result is applied.

    Sandboxed Writes Are Still Real Writes

    What an Agent Sandbox Bounds showed the usual file bound: writes confined to the project folder and a temporary directory. That bound is about reach. Inside the allowed folder, the agent writes to the real files. A wrong merge, or one steered by a note someone typed into a customer record, as in Prompt Injection Is a Design Problem, is real as soon as the file is saved. Her teammates may open it within the minute.

    In Permissions Decide What Runs Unasked, contained work runs on its own, because the damage stays in a sandbox that is thrown away. On her laptop, nothing is thrown away. The folder is the one that matters.

    The fix is not a stronger wall. It is a different object. The agent works on a copy or a frozen view, and its writes land somewhere private.


    Four Ways to Protect the Original

    There are four ways to keep an agent's writes off the original, a ladder from lightest to strongest.

    Deny the write. The agent can read the folder and cannot change it. Nothing is copied and nothing needs undoing, but there is also nowhere to work. A cleanup that cannot write is not a cleanup.

    A read-only view. Mount the folder read-only, as container runtimes allow (Docker bind mounts are writable by default until you set readonly). Same result: it can read, cannot write, so it cannot do the job. Check the details, too: Kubernetes documents that on Linux a read-only mount is not recursively read-only by default, so a file system mounted beneath it can stay writable.

    An overlay. The agent sees the original as a lower layer it cannot change, and every write lands in a private upper layer on the same machine. Linux overlayfs works this way: the lower file system "does not need to be writable", a file is copied up the first time it is written, and a delete is recorded as a whiteout in the upper layer. A container's file system is the same idea: its image layers are read-only and its changes go to a thin writable layer. So is a Hyper-V differencing disk, where changes go to the child disk and the parent is left unchanged. So is a copy-on-write clone: a ZFS clone is a writable file system that starts as a snapshot's contents. For code, a git worktree on its own branch plays the same role.

    A full copy on a separate machine. The agent runs on a machine that never holds the original at all. No mount, path or credential leads back to it. This is the bank's design in What an Agent Sandbox Bounds: a fresh microVM per job, writing only to its own checkout, with a person merging the result.

    Rung The agent can What it gives you What it lacks
    Deny the write Read the original Nothing to undo Nowhere to work
    Read-only view Read the original Nothing to undo Still nowhere to work
    Overlay, same machine Read the original, write a private layer The changes as one readable layer; keep or discard The original is still on the same machine, one wrong mount away
    Full copy, separate machine Read and write a copy The agent's machine never holds the original Cost, a copy to keep fresh, one more place the data lives

    That is the point of the ladder. The goal is not read-only. It is that the agent is attached to a different object than the one that matters. Read-only protects the original by stopping the work. An overlay or a copy protects it by giving the work somewhere else to go.

    One caution on overlays. The kernel documentation says changes to the underlying file systems while the overlay is mounted are not allowed. A shared folder that colleagues keep editing is a poor lower layer. Freeze it first: take a snapshot, and lay the overlay over that.


    Keep or Discard

    A wall gives you a yes or a no at the moment of each write. A private layer gives you something better at the end: the exact set of changes, as a thing you can read. An overlay's upper directory holds every new and changed file and every deletion. docker container diff lists each path as added, deleted or changed. A worktree has git diff. A small public tool, try, runs a command on an overlay, then try summary lists what changed and try commit applies it.

    Then there are two exits.

    Keep. A separate, narrow step applies a reviewed list of changes to the original, and that step holds the only write access. It is not the agent. It should refuse any change outside the folders the task named, show deletions and renames explicitly, and compare each file against the version the copy started from: if a colleague changed it meanwhile, stop and ask rather than overwrite. Review of the list itself is the subject of Check the Work Before It Lands.

    Discard. Throw the layer away. Docker's documentation puts it plainly: when the container is deleted, the writable layer is deleted too.

    Be honest about the limit. Discarding undoes what was written in the layer and nothing that already left it. A push, a sent message or a call to another system happened outside the layer, and no discard brings it back. Those actions belong to the permissions chapter: outward or irreversible, they wait for a person.


    Step 1 of 7

    Deny the write, or a read-only view

    The two lightest rungs let the agent read the folder but not write to it. The original is safe, and the cleanup has nowhere to happen.

    Pick an exit:

    Read this figure as text

    Steps

    1. Deny the write, or a read-only view: The two lightest rungs let the agent read the folder but not write to it. The original is safe, and the cleanup has nowhere to happen. Nothing moves. The original stands locked; the rail lights the first two rungs, each marked as having nowhere to work.
    2. An overlay: An overlay needs a base that holds still, so the folder is frozen first. The agent sees that frozen view and cannot change it. The rail moves to the third rung. A freeze arrow draws from the original, and a frozen view slides out of it.
    3. A private layer: Each write the agent makes goes into its own layer on top, and the frozen view beneath stays as it was. A message it sends goes outside the layer. The agent appears above the frozen view, and its writes settle on it as three violet layers. A sent message leaves to the side.
    4. A full copy on a separate machine: At the strongest rung the agent works on a copy on another machine. The original is not there, and nothing on that machine can reach it. The rail moves to the fourth rung. A dashed boundary draws round the copy, the agent and its layer, leaving the original outside. The freeze arrow fades: nothing leads back. The copy's label changes to say so, and the layer's label now calls it an overlay on the copy.
    5. Keep or Discard: With every change in one layer, you can read the whole set before you decide. Then the work either goes in or goes away. Two exits draw from the layer: Keep, and Discard.
    6. Keep: To keep the work, a separate step applies the reviewed changes to the original. That step, not the agent, is the only thing that can write there. Discard dims. A lane draws from Keep through the apply step and into the original.
    7. Discard: To discard, delete the layer, and the original is as it was. The sent message has already left, and deleting the layer cannot call it back. Keep dims. The violet layer travels into Discard and is gone, leaving its outline. The sent message is ringed: it stays sent.

    Scope It to a Piece

    The agent rarely needs the drive. It needs a folder. But storage copies whole units: a snapshot covers a whole volume or file system, a container image a whole tree. So scoping is a second step, and there are four ways to take it.

    • Lay the data out so the unit that gets copied is already small: one folder per team or per task on its own file system, not one share for everyone.
    • Expose one sub-path of the copy. Kubernetes' subPath, for one, mounts "a sub-path inside the referenced volume instead of its root".
    • Mount one directory into the runtime, and nothing else.
    • Let the person choose what leaves the device: she picks the renewals folder, and only that is copied.

    Scoping breaks things, and you should know which. Links that point outside the piece resolve to nothing, or worse, to the original. Files the task needs that sit outside it are missing, and the agent may guess. And an index, a cache or a folder of earlier versions inside the piece can list the names of files outside it.


    Stand-ins for Names

    A copy keeps the original safe from the agent's writes. It does not keep the data from the model's reads. For that, use stand-ins. Replace direct identifiers with opaque tokens before the agent reads anything.

    • Names, emails, account numbers become tokens such as C-7F2A. The same customer gets the same token in every file, so joins and counts still work.
    • Numbers stay as they are, unless the size itself is the secret. The agent can still sort balances and flag accounts unpaid over 90 days. Scale the amounts and that threshold silently breaks.
    • Secrets are removed outright, never tokenised. Nothing should need them back.

    At the apply step, a key the agent never holds turns the tokens in its results back into names. The token can be a lookup in a table kept outside the sandbox, or deterministic encryption under a key held there. Where a field must keep its length and character set, format-preserving encryption does that; NIST SP 800-38G specifies the methods, and its 2025 draft revision drops one of the two, FF3, leaving FF1.

    Stand-ins fit tables, logs and fields with a known shape, where you declare which columns are identifiers instead of detecting them. They fit poorly in free text, where detection tools themselves say they cannot promise to find every identifier (Presidio, first built at Microsoft and now an independent project, for one, says "there is no guarantee that Presidio will find all sensitive information"). They fit poorly in spreadsheets full of formulas, which carry constants and cached values. They do not fit a desktop the agent sees as screenshots: the pixels show the real names.

    Know what they cost the task, too. Tokens keep exact equality. "J. Smith" and "John Smith" become two tokens, so a duplicate hunt that relies on near-matching names gets harder.

    The honest claim is that direct identifiers are not disclosed to the model, never that the data cannot be identified. Context can still give identity away: researchers have shown language models inferring personal attributes such as location and income from ordinary text. And for whoever holds the key it is still personal data; the GDPR's Recital 26 says as much of pseudonymised data. Stand-ins reduce what the model sees. They do not change what your organisation holds.


    {n} steps

      Step through the order: tokens before the agent reads anything, real names back at the apply step.

      Read this figure as text

      Illustrative rows, as the real data and as the agent sees them:

      • Ada Example: 12 days unpaid, balance 4,200; token C-7F2A.
      • Bo Sample: 45 days unpaid, balance 3,100; token C-03BD.
      • Cy Placeholder: 120 days unpaid, balance 5,650; token C-C418.
      1. Real data
        A copy keeps the original safe from the agent’s writes, not from the model’s reads: as it stands, the model would read every name. The rows are illustrative.
      2. What the agent sees
        Before the agent reads anything, names become opaque tokens. The same customer gets the same token in every file, and the numbers stay as they are.
      3. The agent’s result
        The agent can still flag accounts unpaid over 90 days, working on tokens alone. Its result names a token, not a customer.
      4. What the person gets
        A key the agent never holds turns tokens back into names. It can be a lookup table or an encryption key.
      5. At the apply step
        The key turns the agent’s result back into real names.
      6. Where it stops
        Direct identifiers are not disclosed to the model; context can still give identity away. Free text and formula spreadsheets fit poorly, screenshots not at all.

      An Example: The Customer Cleanup on a Copy

      Here is the cleanup redone.

      1. Freeze and scope. Snapshot the team folder and copy only the renewals folder. On the CRM side, export the accounts in scope; if your CRM offers a test copy, that works too.
      2. Swap in stand-ins. Customer names, emails and account numbers become tokens. Amounts and dates stay. API keys in a config file are removed.
      3. Let it work. The assistant runs against the copy with an overlay on top. For the CRM, it writes a change list (merge these two records, fix this contact), not calls to the CRM.
      4. Read the layer. She gets one list: the files changed, the files deleted and each proposed CRM merge, turned back into real names by the step that holds the key. Say one merge joins two different customers. She strikes it.
      5. Apply. A narrow step with the only write access to the folder and the CRM applies the rest, after checking that nobody changed those files or records since the snapshot. Any that did change come back to her.

      Nothing in the shared folder changed until step 5, and only what she read.


      When the Opposite Wins

      You already work on a copy. Code in git with branches and pull requests is the overlay and the apply step already. The bank's CI agent gets a fresh copy per job and changes nothing until a person merges. Adding another layer is ceremony.

      The task only reads. A summary or a report that writes nothing to the original needs a read-only view, not a private layer.

      The strongest objection: copies cost more than they save. They have real costs. A copy goes stale while the agent works, so long tasks drift from the original. Applying back can conflict with changes others made meanwhile, and someone resolves those by hand. A copy of sensitive data is one more place it lives, to secure and delete; and a token key is one secret that reverses everything. For a short task on files you alone own, with a backup you trust, a careful sandbox may be enough. For a shared folder and a CRM her team depends on, the costs buy the property a wall cannot give: the original changes only on purpose.


      What to Do Next

      1. Find where your agents' writes land. For each, ask: if it saves a wrong file now, who sees it, and when?
      2. Pick a rung per task. Read-only for reading tasks; an overlay or worktree for local work; a separate machine when the original must never be in reach.
      3. Freeze before you overlay anything other people edit.
      4. Build the apply step first, as its own identity with the only write access, refusing out-of-scope paths and stopping on conflicts.
      5. Scope the copy to the folder the task needs, and check for links and indexes that point outside it.
      6. Declare identifier columns and swap them for tokens; leave numbers alone; remove secrets; keep the key at the apply step.
      7. List what a discard cannot undo for each agent, and put those actions behind a person who sees the exact effect, or out of the agent's credentials.

      Next: a change list still carries someone's name. The Agent Acts for You, Not as You gives the assistant and the apply step identities of their own.


      Related reading: What an Agent Sandbox Bounds for the walls this chapter builds on, Permissions Decide What Runs Unasked for the actions a discard cannot reach, Check the Work Before It Lands for reviewing the change list, Confidence Is Not Consent on irreversible writes, The Agent Acts for You, Not as You on the second gap, whom the agent acts as, and The Agent Sandbox You Already Run for agents that drive a whole desktop.