Skip to content

Permissions & Safety

Chord is a coding agent that can read files, modify files, execute commands, and call external tools. Inspect actions before approving them. Permission rules control risk; they are not an operating-system sandbox.

  • Keep high-risk actions as ask by default
  • Use deny for actions that are clearly dangerous or unnecessary
  • Use allow only for low-risk, predictable actions
  • Put API keys in auth.yaml or environment variables; do not commit them into project files

Typical permission states:

  • allow: automatically permit the call.
  • ask: require confirmation before execution.
  • deny: reject the call. A wildcard deny (including the shorthand tool: deny) removes the tool from the model’s tool list completely, hiding its schema. A concrete pattern deny rejects matching calls while leaving the tool visible.

Rules are matched by tool name (see Built-in tools):

  • Order and precedence: tool removal is determined by the last matching rule for that tool name, and only when that rule’s own pattern is the wildcard *. Therefore, broad deny fallbacks should be placed first, followed by specific allow exceptions. Two control tools are exempt from wildcard-only denial (compact_context and done), and edit / apply_patch share denial between their formats; see Special permission semantics.
  • Matching dimensions: shell rules match whole command lines, whereas delete and write rules match normalized file paths. Specifying delete: allow for a path does not authorize running rm on that path in the shell. Typos in tool names silently leave rules unmatched.

When a tool call triggers an ask rule, a confirmation dialog appears:

  • Reviewing triggering rules: when the request includes matched rules, the dialog lists them under Rules requiring approval (N) below the parameter summary (e.g., shell: "rm *" → ask). Some approval paths omit this list; review the tool and arguments in every case.
  • Editing arguments (E): press E to open the full JSON parameter editor. Submitting executes the call with your modified arguments.
  • Saving rules (M): press M to choose a rule for future calls, then Enter to save it and allow this call. These choices are separate from the rules that triggered the current prompt.

For delete, the picker ranks parent-directory rules by how many requested paths they cover. The global * option is always available; the repository-wide ** option appears only when all requested paths are in the repository. Neither broad option is selected by default.

For shell, the picker offers command-prefix, command-word, and global rules. A flag prefix such as rm -rf * is marked as broad: it allows any matching paths, including paths outside the current request. The * matches spaces and later arguments, so it does not limit every path argument to a directory. To enter an exact command pattern, press E inside the rule picker.

Permissions can be defined in Agent config. Start with this recommended personal-development template, then tighten or relax it for your project’s risk profile:

permission:
"*": allow
handoff: deny
delegate: deny
delete: ask
web_fetch:
"localhost:8000": ask
"169.254.0.0/16": deny
"10.0.0.0/8": deny
"192.168.0.0/16": deny
shell:
"sudo *": ask
"rm *": ask
"rmdir *": ask
"mv *": ask
"dd *": ask
"truncate *": ask
"shred *": ask
"git add *": ask
"git checkout *": ask
"git clean *": ask
"git commit *": ask
"git push *": ask
"git reset *": ask
"git restore *": ask
"git tag *": ask

This means: allow most tools by default; disable handoff and delegate; require confirmation for file deletion, selected WebFetch URL patterns, and common high-risk shell/git commands. Permission rules use “last match wins”, so the more specific web_fetch and shell rules above override the top-level "*": allow. This is reasonable for a single-user trusted workspace; shared repositories, team services, or automated headless deployments should tighten it further.

This page starts from "*": allow as a trusted-workspace baseline; for a least-privilege baseline instead, the builder agent in Configuration: Agent config starts from "*": deny and opts in only to the tools a role needs.

Permission matching examines the tool call and the repository the session works in. For shell, only the command string is matched: a workdir argument does not participate. For file tools (read, write, edit, apply_patch, delete, view_image), the target path is normalized before rules are matched: a path inside any checkout of the current repository becomes repository-relative (src/main.go), so foo.go, ./foo.go, internal/../foo.go, and an absolute spelling of the same file all hit the same rule no matter which checkout or subdirectory the session runs in. Paths outside every checkout stay absolute. When no repository resolves (a plain directory, or no git binary), the session working directory takes the repository’s place.

Normalization expands ~, resolves relative paths against the tool’s working directory, and cleans . / ... When that spelling already lies inside a checkout, Chord keeps its repository-relative spelling for matching: alias/sample.go still matches as alias/sample.go even if alias points elsewhere. Only a path with no checkout match is resolved through symlinks to try to map it back into a checkout; a path still outside keeps its original absolute spelling. Rules do not check every target in a symlink chain.

File-tool rule patterns are scoped by their form:

  • * matches every path spelling, meaning “any path”.
  • A relative pattern (**, src/**, tmp/*) only matches normalized relative paths, i.e. paths inside the scope described above. ** means “any path in the repository”, covering every checkout; when no repository resolves it means “any path under the working directory”. ./** is accepted as the same thing.
  • An absolute pattern (/Users/me/other/**, ~/other/**, /**) only matches paths outside every checkout. /** means “every absolute path”; combining it with ** covers the same ground as *. On Windows, home-relative patterns accept either separator (~\other\** and ~/other/**).
  • An absolute rule does not match a file inside the repository; write the in-repository rule in relative form instead.

This configuration lets the agent delete anything inside the repository and the system temp directory, while .git, .chord, and any AGENTS.md still need confirmation:

permission:
delete:
"*": ask
"**": allow
"/tmp/*": allow
"/private/tmp/*": allow
".git": ask
".git/*": ask
"**/.git": ask
"**/.git/*": ask
".chord": ask
".chord/*": ask
"**/.chord": ask
"**/.chord/*": ask
"AGENTS.md": ask
"**/AGENTS.md": ask

Rules use last-match-wins ordering, so the broad ** allow comes first and the narrower rules after it bring the protected paths back to confirmation. Outside the repository a path keeps the spelling the caller used, so /tmp/* and /private/tmp/* are both listed: on macOS /tmp is a symlink to /private/tmp, and only the matching spelling hits the rule.

Shell rules only constrain the submitted command string: they do not sandbox the command’s filesystem effects, and an allowed command can still cd elsewhere, invoke another program, or act on an absolute path. Use narrow shell patterns for approval policy and an OS-level sandbox when actual filesystem confinement is required.

web_fetch rule patterns use network-aware host matching. A pattern has the shape host[:port]:

  • host: a domain (example.com), a domain wildcard (*.internal, *), a literal IP (127.0.0.1, ::1), or a CIDR range (10.0.0.0/8, 169.254.0.0/16, fd00::/8). Bracket IPv6 addresses and IPv6 CIDRs when specifying a port, for example [fd00::/8]:443.
  • port: omit it (or use *) for any; use a single port (8080) or a range (8000-9000). When the requested URL omits its port, the port defaults from the URL scheme (http→80, https→443).
  • Scheme and path patterns are not supported.
web_fetch:
"*": allow # default: allow everything
"0.0.0.0/8": deny
"10.0.0.0/8": deny
"127.0.0.0/8": deny
"169.254.0.0/16": deny # cloud metadata endpoint
"192.168.0.0/16": deny
"*:8000-9000": ask # any host on these ports needs confirmation
"*.internal": deny # internal domains

Matching happens before the request is sent, against the URL the model supplied, and again before following each HTTP redirect. Redirect targets must match an allow rule; an ask target stops the fetch unless YOLO relaxes that rule. IP/CIDR rules block redirect URLs that name a matching literal IP. The resolved connection IP is not checked, so a hostname that resolves to an internal address can still pass its hostname rule. Treat these rules as intent-level gating, not a network sandbox.

Most tools use the literal allow / ask / deny meaning above, but a few orchestration tools intentionally have extra coupling so permission settings match the workflow Chord can safely run:

  • edit and apply_patch are one file-editing tool family with two model-facing formats (patch is accepted as a legacy alias for apply_patch). A rule for one editor applies to the other editor when the other editor has no explicit same-tool rule. This includes deny: *: allow followed by edit: deny disables both edit and apply_patch, because apply_patch inherits the edit-family denial. Configure both names when you want different behavior per format. For example, edit: allow plus apply_patch: deny disables apply_patch but keeps edit available, so GPT/o-series models fall back to edit; conversely, apply_patch: allow plus edit: deny keeps apply_patch available for non-GPT models that would otherwise prefer edit.

  • apply_patch also subsumes write and delete for the paths inside one patch: an added or updated file is also checked against any rule that names write, a deleted file and a move’s source against any rule that names delete. Those rules can only make the decision stricter (deny > ask > allow); a wildcard default such as "*": allow does not leak in. A delete: deny therefore cannot be circumvented by removing files through a patch.

  • present does not deliver files from the .chord/ directory of the checkout a file belongs to. That tree is private working state — task notes, plans, memory records, skills, project config — so a wildcard allow must not turn it into user-facing delivery cards. A file inside a known checkout is judged by its path under that checkout’s root, not under the delivering agent’s: a linked worktree that itself lives under .chord (worktree.root: .chord/worktrees) keeps delivering its ordinary files — also when the main agent delivers them — while its own .chord and every other workspace’s stay protected. To deliver one of these files anyway, name its path in a present rule: a pattern built only from wildcards and separators ("*", "./*", "**/*") names no path, so it cannot lift this default, just as the "*" tool pattern is skipped. When several present rules match, the last one wins:

    permission:
    "*": allow
    present:
    ".chord/plans/*": allow

    The allowance is scoped to the paths it matches, so it opens that plan directory without delivering task notes. The check matches the .chord segment case-sensitively and is an intent gate rather than a confidentiality boundary.

  • handoff and done are treated as control gates. Setting either one to deny hides or disables that workflow. Setting it to allow or ask makes the workflow available; Chord may still show local confirmation at the actual handoff/finish point (for example the loop done confirmation). This means ask is not a second, stronger workflow mode for these tools: it mainly keeps the tool visible/available while preserving Chord’s built-in confirmation gate. The trade-off avoids confusing the model with an available control tool that is later impossible to complete, while still preventing silent role switches or premature loop exits.

  • done is the loop workflow’s exit signal: Chord mounts it only while a loop is running, and /loop on is refused with a toast when a rule denies done, so done: deny reserves loop termination for you. See Usage: /loop continuous execution mode.

  • delegate matches its agent_type argument, so a role can restrict delegation to selected SubAgent definitions. For example, the ordered rules below deny every target except reviewer and require confirmation before delegating to tester:

    permission:
    delegate:
    "*": deny
    reviewer: allow
    tester: ask

    Patterns are globs, so rev* covers every target whose name starts with rev. The Delegate tool schema is the only place a SubAgent’s name and description reach the model: its agent_type enum and description list exactly the targets this role may use, so a denied target is invisible to the model, and a call naming one anyway is rejected before the worker starts. If every configured SubAgent target is denied, Delegate is hidden.

  • delegate also controls the delegation workflow as a group. If it is entirely disabled by an effective wildcard deny, Chord disables SubAgent cancellation via cancel, hides nested delegate/cancel from SubAgents, and limits SubAgent notify to owner-only follow-up instead of arbitrary target routing. The reason is that cancelling or targeting other delegated tasks is part of managing delegated workstreams; allowing those pieces while disabling delegation would create a partial control plane that can interfere with work the role is not allowed to orchestrate.

  • cancel therefore depends on delegate: even if cancel: allow is configured, cancel is denied when delegate is disabled. To allow a role to cancel delegated work, enable both delegate and cancel.

  • question: ask is normalized to allow. The question tool already asks the user a structured question and waits for their answer, so adding a separate permission confirmation before asking the question would create a redundant prompt without reducing the risk of the final decision.

  • Two control tools are exempt from wildcard-only rules, because the feature that makes them reachable is itself the authorization: compact_context and done. An allowlist role’s "*": deny neither hides them nor rejects their calls; otherwise enabling model-driven compaction or starting a loop would silently do nothing. Only a rule that names the tool overrides this: deny removes it, ask keeps it and confirms each call, allow matches the default. Narrow globs such as compact_* count as naming it, and so do rules written with an argument pattern, since neither tool takes a permission-matching argument. Neither has an external side effect (one shrinks the context, the other ends a loop), so a wildcard rule has no capability to protect here.

  • YOLO keeps the role’s capability set as configured. On the main agent, ask decisions pass without confirmation. A scoped deny is lifted only when the tool’s effective full-scope rule is allow or ask: for example, shell: allow lets YOLO lift a later "rm *": deny. A narrow grant such as "git *": allow does not grant the rest of the tool’s scope, and a configuration containing only denies grants nothing. Default denies and allowlist boundaries keep rejecting, using the same tool-name patterns and edit/apply_patch inheritance as ordinary permission checks. A read-only role stays read-only; change its rules or switch roles to grant more capabilities. Switching YOLO off restores the configured decisions. The toggle leaves the system prompt, tool descriptions, schemas, and visibility unchanged, so it does not rebuild the request prefix.

    • Directory membership does not follow the toggle: a scoped deny naming a delegate agent type or a skill keeps rejecting, so the delegate and skill catalogs stay exactly as configured. handoff, delegate, and cancel resolve through the configured rules as they do without YOLO: allow stays allowed, a wildcard deny default decides the same way, and an ask rule passes without raising the confirmation dialog like every other ask. YOLO therefore never adds an orchestration capability the rules do not already grant: a single-agent role such as builder stays single-agent while YOLO is on, because its own rules deny handoff and delegate.
    • done keeps its dedicated semantics: deny still removes the loop exit, an explicit ask on done already passes without a dialog, and the loop completion confirmation is a separate flow YOLO does not touch. compact_context follows the ordinary ask handling: an explicit ask passes while YOLO is on like every other ask, and deny still removes the tool or workflow.
    • SubAgents evaluate their own configured rules and inherit the mode at execution time: while YOLO is on, their ask decisions pass without raising the shared confirmation dialog, while their deny rules keep rejecting (a read-only worker keeps its write: deny). Switching YOLO off restores their confirmations on later calls. The asymmetry with the main agent is deliberate: a SubAgent’s ruleset is the delegation contract its parent handed it, so YOLO may remove a worker’s confirmations but must not widen the scope it was delegated with.

Permissions are Agent-level configuration, not a simple global switch.

For shell, a specific allow pattern such as "git *": allow does not auto-allow a command that carries extra work: unquoted shell separators (;, &&, ||, |, &, or newlines), command substitution ($(...) or backticks, including inside double quotes), process substitution (<(...) or >(...), which spawns a subcommand of its own), an environment assignment or declaration (PATH=..., LD_PRELOAD=..., or any other variable, and export/declare/local of the same, whether it prefixes the command or stands on its own line), and a quote the scan cannot resolve (an unterminated quote, or a trailing backslash). Those calls fall through to the next matching rule, typically ask or deny.

Metacharacters that are literal payload (single-quoted, or escaped with a backslash) still match the narrow rule. Use this as a safety backstop, not as shell sandboxing; keep broad rules like shell: allow or shell: { "*": allow } for only fully trusted roles.

A command-specific allow does, however, cover the full capability of that command, including output redirections. If echo * is allowed, then echo secret > ~/.bashrc, echo x >> file, and data > /dev/tcp/host/port are all allowed: the redirection target is part of the same command text, not a separate tool call, so it is not matched or gated on its own. An environment-assignment prefix is different: LD_PRELOAD=./x.so echo hi is matched as the whole LD_PRELOAD=... echo hi text, so it falls through to the next matching rule instead of riding on echo *. A rule written for the command’s own text still decides the outcome: an assignment that keeps a narrow allow from matching cannot push a denied command into a broader rule, nor let a narrow ask fall through to a broad allow. The same holds for paths: rm -rf /tmp/scratch/* does not confine the grant to /tmp/scratch. Rules match the whole command text, and * swallows spaces and every later argument, so rm -rf /tmp/scratch/x AGENTS.md is allowed as well. To authorize by path, write the rule for delete, write, or one of the other file tools, which normalize the path before matching it.

Grant a command-level allow only to commands whose worst case (arbitrary file writes via redirection) you accept; otherwise keep them at ask.

Chord recognizes some shell commands as provably read-only so they can run in parallel with other reads instead of serializing the turn. The judgment is conservative: any uncertainty means “not read-only”. Pipes and && / || / ; chains count as read-only only when every side is read-only, command / nice unwrap one level, and redirections other than <, <<<, or 2>&1-style fd duplication veto. Unknown flags veto, so a new write option in a future tool version fails closed. rg is read-only only with --no-config: without it, RIPGREP_CONFIG_PATH can add --pre and run an external command. Words the shell would rewrite veto as well: pathname expansion (*, ?, [), backslash quote removal, brace expansion ({...}), and $'...' ANSI-C escapes are all resolved before the command sees its argv and could turn an innocent-looking operand into a flag (a file named -o makes sort * run as sort -o ...). The same characters inside quotes are literal payload and stay allowed.

This classification never changes permissions: an ask / deny rule still wins, and a read-only command still asks when your rules say so. If a read-only command still runs serially, that is the classifier staying conservative, not a bug. If you ever see a write batched alongside other tools, report it as a bug with the exact command string.

shell can execute system commands and should be treated carefully. shell is intentionally non-interactive whether the command runs in the foreground or as a background job: Chord does not wire model-controlled stdin into child processes, Unix child processes run without a controlling TTY, and high-confidence interactive commands are rejected before execution.

Plain stdin reads such as shell read/select observe EOF instead of waiting for model input; provide data explicitly with a pipe, here-doc, file, or arguments when a command expects input. Login wizards, terminal editors, pagers/full-screen TUIs, password prompts, and commands that require /dev/tty should be run manually in a real terminal or rewritten with explicit non-interactive input/flags.

Platform notes for shell (foreground or background job):

  • On Unix, Chord starts child processes in a new session and cleans up by process group on timeout/cancellation.
  • On Windows, Chord still keeps shell non-interactive for foreground commands and background jobs, but there is no Unix-equivalent setsid/process-group control path here; timeout/cancellation cleanup falls back to direct process termination and may be less complete for descendant processes.

Common rewrites:

  • Use git commit -m "message" or git commit -F file instead of editor-driven git commit
  • For amend flows that should preserve the existing message, use explicit non-editor forms such as git commit --amend --no-edit or git commit --amend -C HEAD
  • Avoid interactive Git patch workflows (git add -p, git commit -p, git stash -p) from shell; stage explicit pathspecs or run them manually
  • Remove TTY allocation flags from container commands (docker exec -it, docker run -t, podman run -t, kubectl exec -it) unless you are running them manually in a real terminal
  • Use npm init -y / --yes or provide all required options explicitly
  • Use sudo -n when you want sudo to fail non-interactively instead of prompting
  • Pipe input or use a here-doc when a command truly accepts non-interactive stdin

Recommendations:

  • Keep file deletion, bulk rewrites, network downloads, and database operations as ask or deny by default
  • Use web_fetch patterns to gate local/private services or sensitive endpoints: by host/port (web_fetch: { "localhost:8000": ask }) or by address range (web_fetch: { "169.254.0.0/16": deny, "*:8000-9000": ask })
  • Set allow only for a small set of predictable development commands
  • Do not treat permission matching as a security sandbox

Important: Chord’s permission matching is product-level risk control, not OS-level isolation or a security sandbox.

File tools act directly on the workspace; they are not a dry run. Use Git for important repositories and keep production configuration, deployment scripts, and secret files subject to ask.

Action Effect
write Create a file or replace an entire existing regular file.
edit / apply_patch Change local content; patches can also add, move, and delete files. Independent file groups may succeed partially, so inspect applied changes before retrying.
delete Delete a file without requiring a complete read first. Deleting a symbolic link removes the link, not its target; write refuses to follow symbolic links.
read / view_image / grep Leave files unchanged, but their content enters the conversation context and model prompts; avoid directing the model to read files containing secret keys or sensitive data.

On Unix, write and edit reject symbolic links in the final path component; apply_patch also rejects symbolic-link file targets. These file-target checks do not reject symbolic links in parent directories.

  • Whole-file replacement: write does not refuse solely because the model has not read the current version. Unread, partially read, or subsequently changed content is backed up when possible, with the location reported in the result. Content matching the model’s most recent write or edit needs no additional backup.
  • Unreadable previous content: the write may still proceed without a backup; the result warns about the risk. A new file does not require a previous-version backup.
  • Local edits: edit and apply_patch check their anchors against the current file. If a changed file still has valid anchors, editing may proceed after a warning, with a best-effort backup of risky non-empty previous content.
  • Deletion: if the model has not observed the file’s current content, Chord attempts to back up its exact disk bytes, including empty files. Backups do not follow symbolic links.

Backups are limited to 10 per path, 200 per session, 10 MiB per file, and 50 MiB per session. A failed or oversized backup does not stop a local edit, and the failure may appear only in logs. Session backups are not a substitute for version control; cleaning up a session also deletes its backups.

Path-reading tools reject restricted device paths such as /dev/stdin, /dev/stdout, and /dev/stderr. Local text tools prefer UTF-8 or BOM-marked Unicode, with limited support for encodings such as GB18030, Big5, and Shift-JIS. Ambiguous or unsupported encodings fail with an error. web_fetch decodes the character set declared by the HTTP response.

  • Store API keys in ~/.config/chord/auth.yaml when possible
  • Environment-variable references are also supported
  • Do not put real secrets in example configs, scripts, or project repositories
  • Restrict auth.yaml permissions, for example chmod 600 ~/.config/chord/auth.yaml

Project-level configuration and capability declarations — .chord/config.yaml, agent definitions, commands, and skills — are repository content, not user settings. Chord compares them against the effective configuration without the project layer and asks only when the delta can start a process, redirect traffic, or rewrite another control: MCP servers, hooks, LSP servers, provider/proxy changes, an existing role’s permission widened or not provably more restrictive, external agent backend startup declarations, a command or skill shadowing a global one, or a skill with fork context / tool grants. A declaration that cannot be parsed also requires confirmation. New guidance-only agents, new commands, and ordinary skills apply without a prompt — they are guidance you invoke or decline at use time. When confirmation is needed, the prompt lists the specific changes under Changes that need your approval. Declining or dismissing it starts without the project layer.

Permission comparisons preserve rule order and restrictions. An external agent’s backend.command, launch_args, and env can start a local process when delegated; the role’s tool rules do not constrain that process itself. Configuration, agent definitions, and command templates load from the same bytes used for assessment and disclosure, so a subsequent file edit cannot replace reviewed content during startup.

An authorization, when one is needed, is bound to the declaration files by content: adding, removing, or changing any of them re-asks if the change is high-risk. A low-risk layer stores no authorization and is re-assessed at every start, so a later high-risk edit — or a global-baseline change that promotes the delta — is still gated. The record is stored as project-trust.json in your state directory (~/.local/state/chord/project-trust.json by default, or $CHORD_STATE_DIR/project-trust.json when set); chord doctor config shows the status and store path, and chord doctor config --revoke-project-trust revokes it. Non-interactive entries (chord headless, ACP, chord mcp login, and the provider login and refresh flows under chord auth) refuse to apply an unauthorized high-risk project layer and exit with instructions; --skip-project-config and --trust-project-config provide one-run alternatives.

The gate is a consent boundary, not a sandbox. It covers what the configuration declares, not everything a repository contains: scripts the configuration runs, dependencies, and ordinary source code are trusted once the repository is checked out. AGENTS.md instructions and project memory also remain guidance-only, but their text reaches the model like any other repository content and can steer its behavior — review them as part of trusting a project. See Configuration: Trust gate for project configuration for the full behavior.

chord headless is suitable as a lower-level control plane for bots/gateways, but it does not provide multi-tenant isolation, browser security boundaries, or complete permission hosting by itself.

If you connect it to a chat platform, automation system, or team service, enforce additional controls in the outer layer:

  • Which working directories may be accessed
  • Which commands may be called
  • Who can approve high-risk operations
  • How events are audited and retained

Chord can integrate with:

  • provider APIs
  • LSP
  • MCP
  • Hooks
  • local shell commands

Language servers (LSP) analyze a discovered workspace and may read files beyond the edited target. Their workspace root does not change which path a file-tool permission rule matches, and their reads are not checked against those rules. Use OS-level isolation when their filesystem access must be confined.

Each capability expands the runtime boundary. Before enabling one, confirm:

  • Whether you really need it
  • Which resources it can read or write
  • How to roll back or disable it when it fails
  • Whether sensitive data may be sent to an external service
  • In shared repositories or team environments, do not globally allow by default
  • Expose only the minimum necessary Hook and MCP tools