AI Coding Assistant CLI Slash Commands: A Complete Guide
A practical guide to the slash commands available in AI coding assistant CLI tools, covering session management, context handling, task orchestration, model selection, code review, and cost control. Learn what each command does, when to use it, and how to combine them into an efficient terminal workflow.
AI Coding Assistant CLI Slash Commands: A Complete Guide
When working with an AI coding assistant in the terminal, productivity often depends less on the underlying model and more on whether developers can invoke the right commands quickly and accurately. The CLI compresses session management, task orchestration, context handling, model selection, and quality review into a set of slash commands, forming a lightweight yet complete operating interface. Understanding the semantics and combinations of these commands is the key step from “usable” to “effective.” This article organizes the common slash commands by functional domain, adding usage scenarios and caveats to help you build a clear mental model.
Session Initialization and Context Management
Every high-quality human-AI collaboration starts with explicit context agreements. The /init command generates a structured memory file in the repository root, recording the project’s tech stack, directory conventions, build process, and coding standards. From then on, the assistant reads this file automatically at the start of each session, sparing you from repeatedly explaining “what this project is.” For long-lived projects, this file should be updated continuously as the architecture evolves, not treated as a one-time artifact.
As the conversation progresses, the context window gradually fills with history. The /compact command summarizes and compresses the existing conversation to free up token space, and it lets you specify which content to preserve. When context usage exceeds roughly 80%, it’s better to compact proactively rather than wait for the window to overflow and truncate passively. The companion /context command visualizes the token distribution across modules in the context window, helping you determine whether conversation history, file contents, or tool outputs are consuming the most space, so you can make targeted cleanup decisions.
The /memory command provides a view-and-edit entry point for all memory files in the project. Memory files are essentially persistent project knowledge, suited for conventions reused across sessions, while /compact handles temporary in-session context. The two have distinct roles and should not be conflated.
Side-Channel Questions and Session Rollback
While the assistant is generating output, developers often have quick questions they don’t want polluting the main conversation. The /btw command provides a side-channel question mechanism: neither the question nor the answer is written into the main conversation history or consumes main-context quota, and it supports parallel questions while the assistant is still outputting. This is ideal for quickly confirming an API’s usage, the meaning of a field, or doing small-scale exploration without interrupting the main task.
By contrast, /rewind rolls the session state back to a historical checkpoint, undoing prior operations. Compared with aborting the session and starting over, rollback preserves the accumulated context before the checkpoint and only discards what came after—a more precise error-correction mechanism. When you notice the assistant has modified multiple files in the wrong direction, rolling back is usually more reliable than undoing changes one by one.
Task Orchestration and Subagent Management
Complex tasks often need to be split and processed in parallel. The /agents command manages subagents, supporting viewing, creating, and editing them. The value of subagents lies in breaking large tasks into parallel units with single responsibilities—for example, one subagent handles interface-layer refactoring while another fills in tests, with the main session handling coordination and integration. A sensible subagent split can significantly reduce the complexity of any single context.
The /tasks command shows all tasks currently running in the background; its alias /bashes hints that these tasks typically correspond to background command execution. While a long task runs, you can keep working in the main session and check background progress anytime via /tasks, avoiding constant terminal polling.
Plan Mode and Model Selection
/plan enters pure plan mode: it only outputs a proposed approach, without modifying files or executing commands. This mode suits technical design reviews before implementation, or confirming the path before a risky refactor. You can append task descriptions so the assistant produces a step-by-step plan around a specific goal. Separating planning from execution is an effective practice for controlling change risk.
/model switches the underlying model, supporting toggles between a high-capability version, a balanced version, and a lightweight version, as well as custom models. The selection principle is simple: use the high-capability model for complex reasoning and architecture design, and the lightweight model for everyday completions and formatting tweaks. When switching models frequently, watch for context compatibility to avoid jarring shifts in output style.
/effort further adjusts the model’s reasoning depth, offering deep reasoning and balanced modes. Deep reasoning suits hard problems, but token consumption rises significantly, so don’t make it your default. Treat reasoning depth as an on-demand “heavy weapon” rather than a permanent setting to balance quality and cost.
Code Review and Quality Assurance
/code-review reviews the current diff, looking for correctness issues as well as improvements in reusability, simplicity, and efficiency. Adding the --fix flag applies fixes directly, making it a good automated quality gate before committing. When integrating review with your version control workflow, review before committing to keep obvious problems out of the main branch.
/hooks shows hook configurations; hooks run shell commands automatically before or after tool executions, commonly for code formatting and lint checks. Hooks embed quality checks into the tool-call lifecycle so that standards enforcement doesn’t depend on developer memory. Keep hook commands short and idempotent, and avoid running time-consuming full builds inside hooks.
Status, Cost, and Permission Control
/status displays runtime state, including the logged-in account, current model, working directory, and software version—it’s the first stop for troubleshooting environment issues. /cost and its alias /usage tally token consumption for the current session and estimate costs, useful for periodic checks during long sessions to prevent runaway spending.
/permissions controls tool invocation permissions, letting you configure whether certain tool types require manual confirmation on every call. For high-risk operations like file writes and command execution, per-call confirmation reduces the chance of mistakes; for read-only tools, you can relax the policy to reduce interruptions.
Configuration and External Integrations
/config opens the settings panel for themes, default parameters, and editor modes. /mcp manages external protocol service connections, integrating the assistant with code hosting, issue management, databases, and other external systems, extending its reach from the local repository to a fuller workflow. /skills shows the workflow skill packs loaded in the current session, helping you understand your available capabilities. /feedback submits feedback or bug reports and automatically attaches the current session context, saving you from manually collecting logs. /help lists all available commands, including custom, plugin, and external-protocol commands—the natural starting point for exploring capabilities.
Conclusion
The shared design philosophy behind these commands is to treat the session as a state to be managed, not a one-off Q&A. Initialization establishes conventions; compaction and visualization govern context; side channels and rollback control information flow; subagents and task management enable parallelism; planning and review safeguard quality; and cost and permission controls set the guardrails. Start by mastering the five high-frequency commands—/init, /compact, /context, /plan, and /code-review—then gradually fold the rest into your daily workflow. The value of commands lies not in their number, but in being invoked by the right person at the right time.
