Settings
pw code reads its configuration from a user settings file in your home directory, with optional per-workspace files you can check into a project. Common settings can also be changed from inside a session with the interactive /settings menu.
Settings Files
Settings are read from these files, lowest to highest precedence. A higher file overrides a lower one key by key:
| File | Scope | What it can set |
|---|---|---|
~/.config/agents/settings.json | User, shared with other agent tools | Hooks only: hooks, disableAllHooks, allowedEnvVars |
~/.config/pw/code.json | User | Every key |
<workspace>/.mcp.json | Project | mcpServers only |
<workspace>/.agents/settings.json | Project, typically checked in | Every key except the user-only keys below |
<repo-root>/.agents/settings.local.json | Local, personal | Every key except the user-only keys below |
~/.config/pw/code.jsonholds your own settings and is written with owner-only permissions (0600). Both user paths honorXDG_CONFIG_HOMEand are the same on macOS and Linux. The first timepw coderuns,code.jsonis created from thecodesection of an older~/.config/pw/settings.jsonif one exists..agents/settings.local.jsonlives at the repository root, so one file covers every subdirectory you start in. In a git worktree it is read from the main checkout. Adding a rule to it with/permissionsalso adds it to your global git excludes, so it is not committed.~/.config/agents/settings.jsonis read for hooks only. Allow rules placed there are ignored with a warning; keep them incode.json.
User-only keys are read from ~/.config/pw/code.json alone. A workspace file that sets them has no effect, so a cloned repository cannot change them: sessionRetentionDays, remoteControl, trustedSkills, disabledSkills, agentsGrouping, agentsKeymap, disableAllHooks, allowedEnvVars, and workspaceSettingsTrust.
A few keys combine instead of overriding:
permissions.allowrules fromcode.json,.agents/settings.json,.agents/settings.local.json, and the--allowedToolsflag all apply together.hooksfrom every layer run; see Hooks.mcpServersis replaced wholesale, not merged: the highest-precedence file that defines it supplies the entire server set. See MCP Servers.disableSkillShellExecutioncan be turned on by a workspace file, but not turned back off when your user settings turn it on.
Workspace Trust
Workspace configuration only applies after you approve it. The first time pw code starts in a workspace whose configuration it has not seen before, it lists the files and asks whether to apply them. The prompt covers:
.mcp.jsonMCP servers.agents/settings.jsonand the repository's.agents/settings.local.json- Agent definitions in
.agents/agents/ - Custom commands in
.agents/commands/and.pw/code/commands/ - Skills in
.agents/skills/of the workspace and each parent directory up to the repository root
Your answer is remembered for that exact content: if any of the files change, you are asked again at the next launch. Until you approve, none of the workspace files apply and the session runs on your user settings alone.
Project hooks are not enabled by this prompt. They have their own trust step, /hooks trust.
Non-interactive runs never prompt. Unapproved workspace configuration is ignored with a notice on stderr, so launch pw code interactively once in a workspace you want scripts to use. Approvals are stored in code.json under the workspaceSettingsTrust key, which is managed automatically.
Key Reference
All keys are optional.
Model and Permissions
| Key | Type | Default | Description |
|---|---|---|---|
model | string | none | Model ID to start with (e.g. Jake.Thayne:openai/gpt-5.2). Updated automatically to the model you last used. |
allocation | string | none | Budget allocation for org: provider models. Updated to the one you last used. |
effort | string | none | Reasoning effort sent with requests: none, minimal, low, medium, high, xhigh, or max. Unset uses the provider default. Support varies by model. Updated to the one you last chose. |
permissionMode | string | accept-edits | Startup permission mode: read-only, accept-edits, bypass-permissions, or plan. See Mode Precedence. |
permissions.allow | string[] | [] | Allow rules that pre-approve tool calls, e.g. "Bash(git status:*)". |
permissions.deny, permissions.ask | string[] | none | Accepted and kept in the file, but not enforced yet. A file that sets them gets a warning. |
allowedTools | string[] | none | Older spelling of permissions.allow. Still read from your user settings and moved to permissions.allow on the next save. In a workspace file it is ignored with a warning to move the rules to permissions.allow. |
remoteControl | object | see below | What the web app may do on this machine. User-only. See Remote Control. |
remoteControl fields, all set from /settings:
| Field | Default | Description |
|---|---|---|
newSessions | false | Start new sessions with remote control on. A resumed session keeps the setting it had. |
start | false | Let the web app start new sessions on this machine. |
maxPermissionMode | accept-edits | The highest permission mode a remote client may use. Remote turns are clamped to it. |
selfConnect | true | Let the pw code daemon connect to the platform itself while a session is open to remote control. Off leaves the machine reachable only through a pw agent. |
Turns and Context
| Key | Type | Default | Description |
|---|---|---|---|
maxTurnTokens | number | 0 | Per-turn token budget; the turn stops when it is exceeded. 0 = unlimited. See Usage & Costs. |
maxTurns | number | 0 | Cap on agentic steps in one turn of the main session. 0 = unlimited. When the cap is reached, the agent is asked for a final summary instead of the turn ending with an error. |
compactAt | number | 0 | Live context size, in tokens, at which the conversation is automatically compacted. 0 = the model's context window minus 20% of it, with at most 100,000 tokens held back; 102,400 when the window is unknown. A value above the known window's default is lowered to that default. See Usage & Costs. |
autoCompactWindow | number | 0 | Size automatic compaction as if the context window were this many tokens, for a model whose window is larger than you want to fill. 0 = the model's own window. |
Interface
| Key | Type | Default | Description |
|---|---|---|---|
includeCoAuthoredBy | boolean | true | Attribution on commits and pull requests the agent creates. See below. |
autoScroll | boolean | true | Keep the transcript pinned to the bottom as output streams. |
reduceMotion | boolean | false | Disable the working-spinner animation. |
mouseClicks | boolean | false | Let mouse clicks act on the interface (select picker rows, toggle blocks, drag-select). Wheel scrolling always works. |
agentsGrouping | string | project | How the agents list groups sessions: project, status, or model. User-only. |
agentsKeymap | object | none | Rebinds keys in the agents list: an action name mapped to a list of keys. An empty list unbinds the action. User-only. |
agentsKeymap actions: help, open, filter_next, filter_prev, group, search, new, new_worktree, resume, fork, rename, toggle_pin, stop, archive, hide, and delete. open_agents has no default and adds keys that open the agents list from the chat.
Sessions and Subagents
| Key | Type | Default | Description |
|---|---|---|---|
sessionRetentionDays | number | 0 | A positive number deletes sessions untouched for that many days; resuming a session resets its clock. The sweep runs in the pw code daemon when it starts and every 6 hours after. 0 or a negative value keeps sessions forever. User-only. See Sessions & Resume. |
disableSubagents | boolean | false | Withhold the delegation tool entirely, so the agent cannot spawn subagents. |
subagentConcurrency | number | 0 | How many subagent tasks may run at once. 0 = default (10). |
subagentMaxTurns | number | 0 | Default cap on agentic steps per delegated task. 0 = default (30); a negative value removes the cap. A custom agent's maxTurns overrides it. |
subagentTimeoutMinutes | number | 0 | Default budget for how long a delegated task may go without making progress. 0 = default (15 minutes); a negative value removes the budget. A custom agent's timeoutMinutes overrides it. |
subagentDepth | number | 0 | How deep subagents may nest. 0 or 1 = subagents cannot spawn their own subagents. |
subagentModel | string | none | Default model for delegated tasks. Empty = inherit the session's model. |
For what the subagent keys control in practice, see Subagents.
Integrations and Skills
| Key | Type | Default | Description |
|---|---|---|---|
mcpServers | object | {} | MCP server definitions. |
hooks | object | {} | Hooks keyed by event name. |
disableAllHooks | boolean | false | Turn every hook off. User-only. |
allowedEnvVars | string[] | [] | Environment variables an http hook may use in its headers. User-only. |
disableSkillShellExecution | boolean | false | Stop skills and custom commands from running shell placeholders and from adding their allowed-tools grants. A workspace file can turn it on, but not off. |
trustedSkills, disabledSkills | array | [] | Your skill trust and enable decisions. Managed by /skills; do not edit by hand. User-only. |
Example
{
"model": "Jake.Thayne:openai/gpt-5.2",
"permissionMode": "accept-edits",
"permissions": {
"allow": ["Bash(git status:*)", "Bash(go test:*)"]
},
"compactAt": 80000,
"includeCoAuthoredBy": false,
"sessionRetentionDays": 90,
"subagentConcurrency": 4,
"subagentModel": "Jake.Thayne:openai/gpt-5.2-mini",
"mcpServers": {
"docs": {
"command": "npx",
"args": ["-y", "docs-mcp-server"]
}
}
}Mode Precedence
A session starts in the mode from the first of these that is set:
- The
--permission-modeflag. - When resuming, the mode the session last ran in.
- The
permissionModesetting. accept-edits.
When you start with --agent and that custom agent sets permissionMode, it can lower the mode but never raise it.
The /settings Menu
Run /settings in an interactive session to change common settings without editing files. Type to filter the rows, move with the arrow keys, and press Enter to change the highlighted row; Esc closes the menu. Changes are saved to ~/.config/pw/code.json immediately.
| Row | What it does |
|---|---|
| Permission mode | Cycles read-only → accept-edits → bypass-permissions → plan. See Permissions. |
| Co-authored-by trailer | Toggles commit and pull request attribution on or off. |
| Auto-scroll | Toggles following the transcript as output streams. |
| Reduce motion | Toggles the working-spinner animation. |
| Mouse clicks | Toggles click interaction with the interface; scrolling and text selection always work. |
| Subagents | Enables or disables delegating tasks to subagents. |
| Subagent concurrency | Opens a number box for the parallel-task limit. Enter applies, Esc cancels; leaving it empty keeps the current value. |
| Subagent nesting depth | Opens a number box; 1 means subagents cannot spawn their own subagents. |
| Subagent model | Opens a model picker for the default delegated-task model. Shows (inherit session) when unset. |
| Session retention | Opens a number box for the sweep window in days; 0 keeps sessions forever. See Sessions & Resume. |
| Auto-compact window | Opens a number box for autoCompactWindow, in tokens. Unset uses the model's own window. |
| Model | Opens the model picker to change the session's model. |
| Allocation | Opens the allocation picker (org providers). See Models & Allocations. |
| Remote control for new sessions | Toggles remoteControl.newSessions. |
| Allow remote session start | Toggles remoteControl.start. |
| Remote permission ceiling | Cycles remoteControl.maxPermissionMode. |
Commit and PR Attribution
When includeCoAuthoredBy is enabled (the default), the agent ends every commit message it creates with an attribution line and a Co-Authored-By: pw code <noreply@parallelworks.com> trailer, and ends the pull requests it opens with the same attribution line. Turning it off with the Co-authored-by trailer row in /settings applies to the current session's future commits, not just the next launch.
Environment Variables
| Variable | Effect |
|---|---|
XDG_CONFIG_HOME, XDG_STATE_HOME, XDG_CACHE_HOME | Move the config, state, and cache directories. See Where the CLI stores files. |
MCP_TIMEOUT | Default connection timeout for MCP servers that do not set their own timeout. A bare number is milliseconds; a value such as 60s also works. |
VISUAL, EDITOR | The editor that opens a plan for editing. VISUAL wins when both are set. |
PW_CODE_MOUSE | 0 or false turns off mouse tracking entirely, so your terminal's own text selection works. |
CLAUDE_CODE_DISABLE_CRON | 1 turns off scheduling: /loop, the scheduling tools, and the firing of tasks already scheduled in a session. |
Related Documentation
- pw code Overview: Feature overview and quick start
- Permissions: Permission modes and allow rules
- Hooks: The
hookskey and hook trust - MCP Servers: The
mcpServerskey and.mcp.json - Remote Control: The
remoteControlkeys - Subagents: Behavior behind the subagent keys
- Models & Allocations: Model IDs and budget allocations
- Sessions & Resume: Session storage and retention
- Slash Commands:
/settingsand other in-session commands