Slash Commands
Copair includes built-in slash commands for common actions and supports user-defined custom commands with prompt templates.
Built-in Commands
| Command | Description |
|---|---|
/help | Show available commands and usage hints |
/model [name] | Switch to a different AI model mid-session |
/clear | Clear the current conversation history |
/cost | Show token usage and estimated cost for the session |
/exit | End the session |
/session list | List all sessions for the current project |
/session resume [id] | Resume a previous session |
/session rename <name> | Rename the current session |
/session delete <id> | Delete a stored session |
/session save | Force a mid-session save/snapshot |
/session info | Show current session details (identifier, messages, tokens) |
/workflow <name> | Run a named workflow |
/commands | List all custom commands from ~/.copair/commands/ and .copair/commands/ |
Tab Completion
Press Tab to auto-complete:
- Commands:
/ses+ Tab →/session - Subarguments:
/session re+ Tab →/session resume - File paths: relative to your working directory
- Model names: from your configured providers
- Session identifiers: for
/session resume
Press Tab twice to see all available completions.
Custom Commands
Define reusable commands with prompt templates that automate repetitive tasks.
Defining Commands
Create markdown files with YAML frontmatter in your project or global config directory:
<!-- .copair/commands/review.md -->
---
name: review
description: Code review the current changes
args:
- name: focus
description: "Area to focus on: security, performance, style, or general"
default: general
---
Review the git diff for the current branch against main.
Focus area: {{focus}}
Check for:
- Logic errors and edge cases
- Security concerns
- Performance implications
Provide specific, actionable feedback.Variable Interpolation
Use {{variable}} placeholders in the markdown body. Variables come from the args defined in the frontmatter:
<!-- .copair/commands/test.md -->
---
name: test
description: Run tests for a specific file
args:
- name: file
description: Path to the file to test
required: true
---
Run the tests for {{file}} and fix any failures.
After fixing, run the tests again to confirm they pass.Usage:
> /test file=src/auth.ts
Additional built-in variables: {{env.VAR_NAME}}, {{model}}, {{cwd}}, {{branch}}.
Discovery
All commands — built-in and custom — are discoverable via /help and tab completion. Custom commands appear alongside built-in ones in the command list.
Next Steps
- Workflows — Multi-step YAML workflows for complex tasks
- Configuration Reference — Where command files are loaded from