Permission boundaries for coding assistants and agents
Compare chat, edit and agent modes and limit repository, network and tool access so consequential actions need approval.
By Invicly Tech, , in Prompt Engineering and Vibe Coding. About 10 minutes to read.
In short
A coding assistant can only do harm with the access you give it. Chat modes answer questions, edit modes change files, and agent modes also run commands and call tools. Set the narrowest scope that gets the job done and make the assistant ask before any action you cannot easily undo.
Think of it like this: Think of a contractor in your house: you give them one room, a key that works for one day, and you ask them to check with you before they knock down a wall.
Explained simply
A coding assistant is a helper that lives in your editor. In its simplest form it only talks: you ask, it answers. In a stronger form it can change your files. In the strongest form, often called agent mode, it can also run commands, read command output and try again by itself.
More power means more risk. A chat answer that is wrong costs you a minute. An agent that runs a wrong delete command can cost you a day. So the first rule is to pick the weakest mode that still does the job.
The second rule is to shrink what the assistant can see and reach. Open one project, not your whole home folder. Allow only the tools the task needs. Turn off network access if the task does not use it.
The third rule is to keep a human in the loop for anything that is hard to undo. Deleting files, installing packages, pushing code and calling outside services should always stop and ask. Afterwards, read the action log to see what really happened.
Press Play on a diagram to walk through it one step at a time.
- Answers questions about code
- Does not change files
- Lowest risk
- You copy any result yourself
- Proposes changes to files you pick
- You accept or reject each diff
- Scope is the files you name
- No terminal access
- Plans and runs many steps
- Can edit files and run commands
- Can call external tools
- Needs approval rules and review
- 1Network
Which hosts the tools may reach
- 2Tools
Which tools and servers are enabled
- 3Terminal
Which commands run without asking
- 4Files
Which folders and repositories are in scope
- 5Approval
Which actions always stop and ask
- You to Assistant: Fix the failing test1Fix the failing test
- Assistant to You: Asks: run npm install left-pad?2Asks: run npm install left-pad?
- You to Assistant: Denies, asks for a reason3Denies, asks for a reason
- Assistant to Terminal: Runs npm test (allow-listed)4Runs npm test (allow-listed)
- Terminal to Assistant: Returns the test output5Returns the test output
- Assistant to You: Proposes a code fix as a diff6Proposes a code fix as a diff
In depth
Modes are a power ladder
Tools name their modes differently, but most offer three steps. Ask or chat mode reads context and answers. Edit mode proposes changes to files you choose and shows a diff you accept or reject. Agent mode plans a task, edits several files, runs terminal commands and may call external tools. Some tools also have a plan mode that writes a plan and changes nothing.
Check your own tool's documentation for exact names and settings, because they change between versions. What stays the same is the idea: each step up gives the assistant more reach, so each step up needs a stronger reason and stronger review.
- Chat: learn and explore
- Edit: change files you named
- Agent: multi-step work with commands
- Plan: think first, change nothing
Scope: files, network and terminal
Scope has three parts. File scope is the folder or repository the assistant can read and write. Keep it to one project and exclude folders with secrets. Network scope is which hosts tools may contact; a task that fixes a CSS bug needs none. Terminal scope is which commands run on their own.
A good starting policy for the terminal is deny by default. Allow only read-only commands such as ls, cat, git status, git diff and your test command. Everything else asks first. If your tool offers a sandbox or a dev container, run agents there, so a mistake damages a disposable environment and not your laptop.
- Run without asking
- ls and cat
- git status and git diff
- npm test
- Always ask
- rm and mv
- npm install
- git push and git reset
- curl and any network call
- Never allow
- Reading .env files
- Editing CI secrets
Approval and the action log
Approval prompts turn a silent action into a decision. Read each one: what command, in which folder, why. If you cannot explain it, say no and ask the assistant to justify it. Over time you can allow-list commands you have seen many times, but review the list now and then.
The action log is your audit trail. After a run, scan it for commands you did not expect, files outside the task and network calls. Then run git diff and read every change. The log tells you what was done; the diff tells you what it left behind. If the two do not match, stop and find out why.
- Read the command, folder and reason
- Allow-list slowly, review the list
- Scan the log for surprises
- Finish with a full git diff
Learn it in 5 short steps
About 30m each. Track them with a timer in your plan.
- 1Compare chat, edit and agent modes~30m
- 2Limit files and repositories in scope~30m
- 3Restrict network and terminal access~30m
- 4Require approval for risky actions~30m
- 5Review the action log~30m
Key points
- Pick the least powerful mode that does the task: chat to learn, edit to change files, agent only when it needs to run commands.
- Open only the folder or repository the task needs. A smaller workspace is a smaller blast radius.
- Approve terminal commands one by one at first. Allow-list only read-only commands such as listing files or running tests.
- Always require a human decision for deleting files, installing packages, pushing code, touching secrets and calling the network.
- Read the action log after each run. It is your evidence of what the assistant really did.
Key terms
Tap a card to flip it. 0/5 known
Examples
Task: add a unit test for formatPrice()
Mode: agent
Scope: open only the shop-demo folder
Auto-approve: ls, cat, npm test
Always ask: rm, npm install, git push, any network call
After the run: read the action log, then git diffA permission plan written before the run starts.
Setting up a safe agent run
You want an agent to add a test for a price formatter in a small demo project. Step 1: open only the demo folder, not your home directory. Step 2: choose agent mode because it must run the tests. Step 3: allow npm test and read-only git commands, and keep everything else on ask. Step 4: after the run, read the log and the diff. Expected evidence: one new test file, one test command in the log, no installs, no network calls.
Mode: agent
Workspace: ~/code/shop-demo (one folder)
Auto-approve: ls, cat, git status, git diff, npm test
Ask first: everything else
Blocked: .env, deployment config
Check after: action log, then git diffCatching a surprise in the log
After a run, the log shows a curl command to an unknown host. Step 1: stop and do not rerun. Step 2: find which prompt or file made the assistant do it. Step 3: check git status for files that changed. Step 4: revert with git restore or discard the branch if anything looks wrong. Step 5: tighten the policy so curl needs approval, then rerun. The lesson is that the log found a problem the final summary never mentioned.
git status --short
git diff --stat
git restore . # discard uncommitted edits
git clean -n # dry run: list untracked files that would goQuick reference
- Chat explains, edit changes files you name, agent runs commands too.
- Start with the least powerful mode that does the job.
- Open one project folder, never your whole home directory.
- Allow-list read-only commands; ask for delete, install, push, network.
- Run agents in a dev container or sandbox when you can.
- After every run: read the action log, then git diff.
Common mistakes
- Turning on approve-everything to save clicks. One bad step then runs with no check.
- Opening a parent folder that holds many projects, so the assistant can reach files unrelated to the task.
- Skipping the action log because the final answer looked fine.
Quick quiz
Pick an answer to see if you're right and why.
Practice exercises
Try each one yourself first. Use the hint if you get stuck, then compare with the solution.
- Exercise 1easy
Write a one-line mode choice for three tasks: explain a regex, rename a prop in one file, and fix tests by running them.
- Exercise 2medium
Write an allow and ask policy for a small Node project. Include at least four allowed commands and four that must ask.
- Exercise 3hard
Run a real agent task in a throwaway repo with your policy on. Capture the action log, find one command you would not have approved, and write what you would change in the policy.
Check yourself
Answer in your head, reveal, then be honest with yourself.
Feel confident about this topic?
Frequently asked questions
- Is agent mode unsafe?
- Not by itself. It is powerful, so it needs a small scope, approval rules and review. Used that way it is a normal part of many teams' work.
- Should I just approve everything to go faster?
- No. Approve-everything removes the only check between a wrong step and your files. Allow-list safe commands instead.
- Where do I find the action log?
- It depends on the tool. Look for the chat or agent history, the terminal panel and the tool's output view, then confirm with git diff.