Skip to Content

DocsConcepts

Folder rules

A rule gives a folder, and everything under it, a profile, a set of MCP servers, or both.

View source

This page explains how turno decides which account and which MCP servers a folder gets.

A rule covers a folder and everything under it

turno profile assign ~/code/acme work

writes a [[projects]] rule into config.toml:

~/.config/turno/config.toml
[[projects]]
path = "~/code/acme"
profile = "work"
~/code/personalno rule: the default profile
├─ acme/workturno profile assign ~/code/acme work
│ ├─ api/workunder acme, so the same rule
│ └─ web/worka git worktree matches its main repository's rule
├─ oss/personaldefault, with a server set: mcp_deny = ["mail"]
└─ notes/personalno rule: the default profile

turno auto resolves the profile for the current folder: the rule with the longest matching path wins, a git worktree counts as its main repository, and a folder without a rule uses default.

Ask what a folder resolves to, and why:

turno profile which ~/code/acme
~/code/acme
  assigned: work (project ~/code/acme)
  using now: work

When there is no rule

SituationWhat turno auto does
A rule names a profileopens that profile
No rule, default is setopens the default profile
No rule, no defaultruns the agent's own command (claude, codex, ...)
No rule, no default, system = ""exits 3: there is no default account
A rule names a profile that does not existexits 3, with the command that fixes it

turno profile unassign <dir> removes a folder's rules.

One rule per agent

A folder can have one rule per agent. turno profile assign <dir> <profile> adds a rule for the profile's agent, and turno auto --agent codex resolves among Codex profiles. Defaults of the other agents live under [agents.<agent>] (guide).

Server sets: which MCP servers a folder sees

A rule may carry a profile, a server set, or both:

~/.config/turno/config.toml
[[projects]]
path = "~/code/acme"
profile = "work"
mcp = ["issues", "docs"]      # only these servers, by their name in mcp.toml

[[projects]]
path = "~/code/oss"
mcp_deny = ["mail"]           # every server but these

mcp keeps only the listed servers; mcp_deny then removes servers. The rule with the longest path that has a set wins: a nested rule replaces its parent's set, it does not add to it.

Every agent config still lists every server; the gateway hides the rest per session, from the folder the session sends. A hidden server answers with no tools and a line that says which rule hides it, and is never started. turno profile which <dir> shows the set of a folder, and turno profile assign and unassign change only the profile part of a rule and keep its set.

Check your rules

turno config check    # parses config.toml, mcp.toml and accounts.toml

It warns about server names that are not in mcp.toml and about remote servers that skip the gateway, which a set cannot hide. Every key is in the config.toml reference.

On this page