# --restricted Flag

> It starts a locked session for a shared box.

**Field:** Artificial Intelligence  
**Category:** Claude Code  
**Also known as:** claude --restricted, Restricted mode

## Think of it like

It is like a guest room. The guest may read, but may not cook or use the tools.

## Definition

--restricted starts a locked-down session, for a test harness on a shared machine. It removes the tools that run commands or code, and WebFetch, unless you name each one in --tools. File tools stay inside the working folders. It reads only managed settings and --settings, and refuses bypass mode and cloud sessions. It needs Claude Code 2.1.248 or later.

## Example

Emma's team scores models on a shared server. Each run uses --restricted, so Claude cannot run commands or read anyone's settings on that box.

## Example code

```bash
claude --restricted -p "Answer the question in task.md"
```

Run a test with no shell and no web fetch.

## Why it matters

A shared machine stays safe even when the prompt asks for something it should not.

## Common mistake

Adding --tools "default" to get the shell back. The default set does not count. Name each tool you want.

## Three principles

- **No shell, no code.** Unless named.
- **Working folders only.** For files.
- **No bypass, no cloud.** Refused.

## Related terms

- [--tools Flag](https://learn.benibix.com/term/ai/tools-flag)
- [--safe-mode Flag](https://learn.benibix.com/term/ai/safe-mode-flag)
- [Claude Code Sandbox](https://learn.benibix.com/term/ai/claude-code-sandbox)
- [Bypass Permissions Mode](https://learn.benibix.com/term/ai/bypass-permissions-mode)

## Told apart from

- [--safe-mode vs --restricted](https://learn.benibix.com/compare/safe-mode-flag-vs-restricted-flag): People think --safe-mode and --restricted are both a locked-down mode, and they are not. --safe-mode turns off your add-ons, such as skills, plugins and hooks, to find the one that causes a fault. Your tools still work. --restricted is for a test harness on a shared machine. It takes away the tools that run commands. It reads only managed settings and what --settings passes.

## Taught in

- [Tool and Settings Flags](https://learn.benibix.com/learn/ai-claude-code-commands/tool-and-settings-flags): Claude Code Commands, 15/17

![What still loads under --safe-mode and under --restricted.](https://learn.benibix.com/diagrams/flag-safe-restricted.svg)

---

Source: https://learn.benibix.com/term/ai/restricted-flag
Author: Behnia Zarei (a developer in Vienna, Austria, who builds and teaches data, AI and business intelligence at BENIBIX)
Publisher: BENIBIX Learn (https://learn.benibix.com/)
Last updated: 2026-11-16
Licence: CC BY 4.0 (https://creativecommons.org/licenses/by/4.0/). Quote freely with attribution.
