Slash Commands
Slash commands let you control a pw code session without leaving the conversation. Type / in the composer to open the command palette, which filters as you type and lists built-in commands, skills, custom commands, and MCP prompts. Press Tab to complete the highlighted command, or Enter to run it. /help prints the built-in commands only.
Built-In Commands
| Command | Description |
|---|---|
/agents | Open the agents list to browse, start, and manage every session on this machine. See The Agents List. |
/allocation [allocation-name] | Show or change the budget allocation (org providers only). With no name, opens a picker. |
/auth | Sign in again from the terminal running pw code. |
/autocompact [auto|<tokens>] | Set the context size at which the conversation is summarized automatically. |
/clear | Clear the conversation and start fresh. |
/compact [focus] | Compact the conversation now, optionally telling the summary what to focus on. |
/cost | Show token usage and estimated cost. |
/diff | Show the git diff for the workspace. |
/effort [level] | Show or change the reasoning effort. With no level, opens a slider. |
/fork <task> | Fork this conversation into a subagent with its full history. |
/goal [condition|clear|pause|resume] | Keep working toward a condition, checked after every turn, until it is met. |
/help | List the built-in commands. |
/hooks [trust|reload] | Browse configured hooks; trust enables project hooks, reload re-reads settings. |
/loop [interval] [prompt] | Repeat a prompt on a fixed interval, or let the model pace itself. |
/mcp | Browse MCP servers: view their tools, reconnect, enable, or disable them. |
/model [model-name] | Show or change the current model. With no name, opens the model picker. |
/permissions | View and manage allow rules. |
/plan [open|<description>] | Switch to plan mode, or show the session's plan. |
/remote-control [on|off|status] | Make this session viewable and drivable from the web app. Alias: /rc. |
/rename [name] | Rename the session. With no name, one is generated from the conversation. |
/resume | Resume a previous session from a picker. |
/rewind | Restore code, the conversation, or both to an earlier prompt. |
/settings | Change pw code settings. |
/skills | List, reload, enable, disable, and trust skills. |
/status | Show session status. |
/tasks | List background shell commands the agent started. |
/usage | Show provider usage and reset times. |
/version | Show the CLI version. |
Commands that are sometimes hidden
/usage only appears when the selected model's provider reports usage information. /loop is turned off when the CLAUDE_CODE_DISABLE_CRON environment variable is set to 1.
The composer has two other prefixes: @ references files and subagents, and ! runs a shell command yourself. See Interface & Shortcuts.
/effort
/effort <level> sets how hard the model reasons on each turn: default, none, minimal, low, medium, high, xhigh, or max. Models support different subsets, and /effort rejects a level the current model does not support. Bare /effort opens a slider; use ←/→ to choose and Enter to apply. The choice is saved for future sessions and shown beside the model in the status line. To set it at launch, pass --effort.
/autocompact
/autocompact <tokens> caps how large the conversation may grow before it is summarized automatically. The setting is global: it applies across models and future sessions, and the effective limit is the smaller of this value and the model's context window.
- Token counts accept
500k,1m, or200000. A bare number from 100 to 1000 means thousands, so200is 200K. auto(orreset,unset,default) returns to each model's own context window.- Bare
/autocompactshows the current value.
/permissions
| Form | Effect |
|---|---|
/permissions | List allow rules, numbered and grouped by where they are saved. |
/permissions add [user|project|local] <rule> | Add a rule. The scope defaults to local, which applies to this repository only. |
/permissions remove <rule|#> | Remove a rule by its text or its number in the list. |
See Allow Rules for rule syntax.
/auth
/auth signs you in again through your browser, or with a device code you can open on any device. When browser sign-in is not available, such as in a session attached to another resource, it asks you to paste an API key or token into a hidden prompt instead. Credentials typed on the same line as /auth are ignored, so they never reach the conversation or your prompt history.
Commands While the Agent Is Working
Most slash commands wait in the queue until the current turn ends. Some run right away:
/cost,/status,/help,/diff, and/versionprint their output immediately./goaland/remote-control(/rc) take effect immediately, so you can stop a goal loop or open the session to the web app mid-turn./model,/allocation,/effort,/mcp,/hooks, and/agentswith no arguments, and/settings, open their pickers immediately.
/resume and /rewind replace the conversation, so they always wait for the turn to finish.
Custom Slash Commands
You can define your own slash commands as markdown files. A file named <name>.md becomes the command /name, and its body is the prompt sent to the agent when you run it.
pw code looks for command files in these locations, in order of precedence:
<workspace>/.agents/commands/: project commands, shared with your group through version control<workspace>/.pw/code/commands/: older project location, still read~/.config/agents/commands/: personal commands, available in every workspace (respectsXDG_CONFIG_HOME)~/.pw/code/commands/and~/.claude/commands/: personal fallbacks, still read
When the same command name exists in several locations, the first one found wins.
Project commands require approval
Command files in the workspace are part of the configuration pw code asks you to approve at launch. See Workspace Trust.
File Format
An optional frontmatter block sets how the command appears and what it may do:
description: the one-line description shown next to the command. Without one, the first line of the body is used.argument-hint: appended to the command name in the palette to show what arguments it expects.allowed-tools: tools the command's turn may use without prompting, as with skill tool grants. Personal commands get these grants directly. A project command gets them, and any dynamic context shell output in its body, only after you run/skills trust <name>; until then its prompt still runs, without them.
The body is a prompt template. These placeholders are substituted when the command runs:
$ARGUMENTS(or$ARGS): everything typed after the command name$ARGUMENTS[N], or$0through$9: individual arguments, 0-based, so$0is the first one. Arguments are split shell-style, so a quoted"a b"counts as one. A position with no argument is left as literal text.
Unless the body consumes the whole string through $ARGUMENTS or $ARGS, the arguments are also appended as a trailing ARGUMENTS: line, so nothing you typed is silently dropped. Write \$0 to keep a placeholder literal. Skills use the same placeholders and add named arguments.
Example
Save this as .agents/commands/fix-issue.md in your workspace:
---
description: Investigate and fix a GitHub issue
argument-hint: <issue-number>
---
Look up GitHub issue #$0 with `gh issue view $0`.
Reproduce the problem, implement a fix, and run the relevant tests.
Summarize the root cause when you are done.Then run it from the composer:
/fix-issue 123The agent receives the body with $0 replaced by 123 and works through it as a normal turn.
MCP prompts are slash commands too
Connected MCP servers can expose prompt templates, which appear in the palette as /mcp__<server>__<prompt>. See MCP Servers for how arguments are passed.
Skills Are Slash Commands Too
Skills are instruction bundles that also appear in the palette as /name. They go beyond a single prompt file: a skill can ship supporting files, request tool grants for its turn, inline live shell output, and be invoked by the agent on its own when a task matches its description.
A typed /name resolves in the order built-in → skill → custom command, so a built-in name can never be shadowed, and a skill wins over a same-named custom command.
Related Documentation
- pw code Overview: Feature overview and quick start
- Plans, Goals & Checkpoints:
/plan,/goal,/loop, and/rewind - Remote Control & Agents:
/rcand/agents - Skills: Instruction bundles invoked by you or the agent
- Subagents: Fork conversations and delegate tasks
- MCP Servers: Connect external tools and prompts
- Permissions: Permission modes and allow rules
- Sessions & Resume: Save, rename, and resume sessions
- Usage & Costs: Track token usage and spend
- Settings: Configure
pw code - Interface & Shortcuts: Keyboard shortcuts and the composer