Safeguard
Developer Tools•

Read-only, plan, or edit mode: which should an AI coding agent use?

Start agents in read-only or plan mode, allow edits in a sandbox, and keep command and network actions gated. A decision guide for choosing a mode by task.

Safeguard Security Team
7 min read

Use the least powerful mode that finishes the task. Read-only suits exploring unfamiliar code, plan mode suits proposing a change for a human to approve, and edit mode suits contained changes in a sandbox. Command execution and network access deserve their own gates whichever mode you pick.

What the modes mean

Tools name these differently, so judge by capability:

  • Read-only. The agent can read files and answer questions. It cannot change anything.
  • Plan. The agent reads, then produces a proposed set of steps or a diff for a person to approve before anything happens.
  • Edit. The agent changes files in the working directory, sometimes with confirmation per change.
  • Act. The agent edits and also runs commands, installs packages, or calls external services.

The last category is where the risk concentrates. The OWASP Top 10 for LLM Applications describes Excessive Agency (LLM06) as an agent holding more functionality, permission, or autonomy than needed, and the modes are a practical dial for each.

Matching mode to task

TaskSuggested modeWhy
Understanding an unfamiliar repositoryRead-onlyNo need to change anything
Reviewing a pull requestRead-onlyOutput is comments, not edits
Designing a refactorPlanHuman approves the approach first
Fixing a small bug with a testEdit in a sandboxContained, easy to review as a diff
Upgrading dependenciesPlan, then edit with checksNeeds review of what changes
Running a build or migrationAct, sandboxed, with approvalsNeeds commands, so contain it
Anything touching production configDo not use an agent unattendedImpact is too high

Escalation, not default

Treat higher modes as something a developer steps up into for a reason. Start every session read-only or plan. Escalate when the plan looks right. After the task, drop back down. Tools that remember the last mode can leave people in act mode all week, so check how yours behaves.

Pair each mode with a control

  1. Read-only. Still limit what files are readable. See what files an agent should never read.
  2. Plan. Keep the plan. A saved plan is an audit record.
  3. Edit. Work on a branch or copy, and review the diff.
  4. Act. Sandbox, scoped credentials, approval for installs and new hosts, and logging.

Why plan mode helps reviewers

A reviewer who sees a plan first can catch a wrong approach before there is a large diff to read. It also exposes scope: if the plan touches pipeline files for a typo fix, that is a signal. Many teams find that plan first reduces both risk and rework.

Set defaults centrally

If your tool allows it, set the default mode by environment. Laptops might default to plan, CI jobs to a fixed action list, shared servers to read-only. Document the exceptions. Our post on enforcing team settings for a coding agent covers keeping settings from drifting.

Test the mode itself

Do not assume read-only means read-only. In a throwaway repository, ask a read-only agent to change a file and to run a command. Both should fail. Repeat after upgrades.

Safeguard can help at the dependency and pipeline end of this: SBOM and dependency scanning, reachability analysis, policies and gates on pull requests, and agent identity. You can try a free scan at gold.safeguard.sh/scan.

A worked example: one feature, three modes

A developer wants to add rate limiting to an API. She uses three modes in sequence.

PhaseModeWhat the agent doesWhat the developer does
ExploreRead-onlySummarizes the request handling code and lists where limits could fitReads the summary, corrects a wrong assumption
DesignPlanProposes four steps: add middleware, add config, add tests, update docsRejects the docs step, asks for a smaller middleware change
BuildEdit in sandboxMakes the changes on a branch and runs testsReviews the diff, notices a changed test, asks why
FinishBack to read-onlyAnswers questions about edge casesOpens the pull request herself

At no point did the agent run commands that reached outside the sandbox, and each step ended with a person making a decision. The wrong assumption was caught in phase one, before any code existed, which saved review time later.

Mode switching rules

  1. Start in the lowest mode that does the job.
  2. Step up only after the previous mode's output looks right.
  3. Step back down when the task changes.
  4. Never carry act mode over a weekend or into an unrelated task.
  5. If the tool remembers modes between sessions, check what it remembered before you begin.

What each mode still needs

ModeResidual riskControl
Read-onlyReads sensitive files, ingests hostile textFile scope limits, treat input as untrusted
PlanA convincing but wrong planReviewer reads the plan against the real code
EditBad edits, weakened testsBranch, diff review, required checks
ActCommands, installs, networkSandbox, allowlist, approvals, logs

Central defaults by environment

EnvironmentDefault modeWho can change it
Developer laptopPlanDeveloper, within policy
Shared serverRead-onlyPlatform team
Continuous integrationFixed action listPipeline owner
Restricted repositoriesOffSecurity

Common errors

  • Assuming a mode named read-only blocks everything. Test it.
  • Leaving a long running session in act mode after the task changed.
  • Treating a plan as approval for everything the agent later does, when the agent may deviate.
  • Not saving the plan, which loses a useful record of what was agreed.

A quick habit

At the start of each session, say out loud which mode you are in and why. It sounds silly, but it prevents the drift to maximum autonomy that happens when people are busy.

Try it yourself

Click through it at your own pace, or open it full screen.

Click through and notice where checks run after the edit phase, whatever mode produced the change.

Quick check

Is plan mode safe?

It is safer because nothing changes until a person approves, but the agent still reads files and may fetch content, so the read side needs limits too.

Who decides when to escalate?

The developer, within limits that policy sets per environment.

Can plan mode be bypassed?

Depending on the tool, a user can switch modes. That is why central defaults, logs, and server side branch protection still matter.

Sources

Last reviewed: 19 October 2026.

Never miss an update

Weekly insights on software supply chain security, delivered to your inbox.

Self-healing security runs on Safeguard.

Your first fix PR is minutes away.

No sales call required, even your agent can complete the purchase over MCP.