Introduction

OpenClaw provides a set of built-in slash commands that let you control your agent session directly from the chat interface. These commands manage sessions, switch models, compact context, and control message sending behavior. Understanding every built-in command is essential for efficient daily use of OpenClaw.

Key Concepts

  • /new: Creates a new agent session, resetting the conversation context
  • /reset: Clears the current session history while keeping the session alive
  • /stop: Terminates the current agent session completely
  • /status: Shows the current session state, active model, and resource usage
  • /model: Switches the active model for the current session
  • /compact: Compresses the conversation context to reduce token usage
  • /context: Displays the current context window usage and limits
  • /send on|off: Toggles whether the agent automatically sends messages or queues them

Real World Context

A developer is deep in a debugging session with their OpenClaw agent. The conversation has grown long and the agent is getting slow due to context bloat. Instead of starting a new session and losing the debugging progress, they run /compact to compress the context. Later, they switch to a more powerful model with /model anthropic:claude-sonnet-4-20250514 for a particularly complex analysis, then switch back to a lighter model afterward.

Deep Dive

Session Management

The three session commands form a lifecycle:

bash
/new      # Create a fresh session with clean context
/reset    # Clear history but keep the session alive
/stop     # Terminate the session entirely

The /new command is useful when you want to start a completely fresh conversation. /reset is gentler: it clears the message history but preserves session metadata and configuration. /stop terminates the session, which triggers the command:stop hook if one is configured.

Session Introspection

Two commands help you understand the current session state:

bash
/status   # Shows model, token usage, session ID, uptime
/context  # Shows context window: used tokens vs limit

The /status command provides a comprehensive overview including the active model, total tokens used in the session, the session identifier, and how long the session has been active. The /context command focuses specifically on the context window, showing how many tokens are currently in the conversation context versus the model's maximum context limit.

Model Switching

Switch models mid-conversation without creating a new session:

bash
/model anthropic:claude-sonnet-4-20250514
/model openai:gpt-4o
/model anthropic:claude-haiku-3

Each command switches the active model immediately. The conversation history is preserved, so the new model picks up where the previous one left off. This is useful for switching to a more capable model for complex reasoning tasks and back to a lighter model for simple interactions.

Context Management

When conversations grow long, context compression saves tokens:

bash
/compact  # Compress the conversation context

The /compact command summarizes the conversation history into a shorter representation while preserving the key facts and decisions. This reduces token usage for subsequent turns without losing important context.

Send Control

The /send toggle controls message delivery behavior:

bash
/send off  # Queue messages instead of sending immediately
/send on   # Resume automatic message sending

When /send off is active, the agent composes responses but holds them in a queue instead of sending to the channel. This is useful when you want to review and edit agent responses before they are delivered, or when you are working on sensitive topics where you want manual control over what gets sent.

Common Pitfalls

  • Using /new when /reset would suffice: /new creates an entirely new session, losing session-level metadata. /reset only clears history.
  • Forgetting to /compact in long sessions: Context bloat gradually slows responses and increases costs. Compact regularly in extended sessions.
  • Leaving /send off accidentally: If you toggle send off and forget about it, the agent queues responses that never reach the channel.

Best Practices

  • Check /context periodically during long sessions to monitor context usage before it becomes a problem.
  • Use /compact proactively rather than waiting for context limits to degrade performance.
  • Switch to lighter models with /model for simple tasks to save costs, and switch back for complex reasoning.

Summary

  • /new, /reset, and /stop manage the session lifecycle with increasing severity
  • /status and /context provide introspection into session state and token usage
  • /model switches the active model mid-conversation without losing history
  • /compact compresses context to reduce token usage in long sessions
  • /send on|off toggles automatic message delivery for manual review control
✓ Completed