Cortex
Search help⌘K

How sessions are kept to their context

Updated 18 November 2026Cortex 0.26.04 min read
On this page

The layers per agent, what is denied by default, and what is not stopped.

Each session starts in its context's folder and works in it, plus any extra roots you gave the context. What holds it there depends on the agent. This article says what is enforced, what is denied by default, and what is not stopped. The words to use are "kept to its context", and this article is honest about how far that goes.

What it is for

Cortex expects mistakes and hidden instructions, not an enemy. The cases it is built for:

  • a session edits files in the wrong context, through a wrong folder or an overly broad pattern;
  • a command an agent runs touches files outside the context;
  • an agent reads a PDF or a Markdown file that hides instructions ("prompt injection"), and is told to read your SSH keys or another context.

It is not a boundary against a hostile person using your Mac.

Each agent, in its own way

Claude Code Codex Cortex Agent
What holds it Deny rules Cortex writes for each launch, enforced by Claude Code Codex's own sandbox and approval policy, as set in its own config Cortex's own path checks and permission modes
What it covers Claude's file tools only. Its shell is not bound by them Whatever Codex's sandbox covers. Claude's rules do not apply to Codex Every file path its tools take. Every write, edit, command and fetch asks
The OS sandbox When you switch it on in Settings → Isolation When you switch it on. Codex's own sandbox is then turned off, since it cannot run inside it Always, whatever the switch says

The OS sandbox is described in Turn on the OS sandbox. It is off by default.

What the rules for Claude Code deny

For each launch Cortex sets the session's folder as its starting point and passes extra roots only if the context has them. It then denies Claude's file tools access to these, reading, and editing where it matters most:

  • your SSH keys (~/.ssh), ~/.aws, ~/.gnupg and the GitHub CLI's ~/.config/gh;
  • the macOS Keychain folder;
  • Cortex's own vector stores, which a session reaches only through its own context's tools;
  • every other context's folder, and
  • by default, every other context's stored transcripts.

You can let a context read other contexts' transcripts with Deny other contexts' transcripts, in that context's Context Settings…. The default for new contexts is in Settings → Isolation. See Context settings.

What every agent gets

  • A trimmed environment. An agent starts with a short list of variables: who you are, your language, your login PATH. Not the whole environment of the app.
  • The SSH agent only if asked. A context passes the SSH agent to its sessions only if you switch on Pass the SSH agent for it.
  • Extra roots on purpose. Folders you add as extra roots are treated exactly like the context's own folder, by both the rules and the OS sandbox.

What is not stopped

  • The network is never limited. An agent can fetch or send over the network, with or without the OS sandbox. Approve commands with that in mind.
  • Commands, with the OS sandbox off. Claude's deny rules bind its file tools, not a shell command. A command it runs, such as rm, git or a script, can still read outside the context. Turn on the OS sandbox if that matters. The same holds for Codex's commands beyond what its own sandbox covers.
  • Terminal tabs. A terminal tab runs you, not an agent. It is not confined, and it reopens in the folder it was last in, even outside its context.
  • Codex in the background. A Codex agent that works for a mini, a room or a task has no terminal to ask on. What it is not allowed to do is refused, not asked about.

What you can still decide

For Claude Code, the permission mode is your own per session. For the Cortex Agent, see Permission modes. Mini, room and task launches follow the same layers, with their own access settings.

Everything here belongs to the personal setup of a single user on a Mac. It stops a session wandering. It does not turn a Mac into a place where an untrusted person could safely run code.

Something wrong or missing? Tell us

Open this page in your browser