Memory & Personalization
💭

Managing Conversation History and Context

Control how OpenClaw handles conversation history, context windows, and session management.

5 min read|
conversation historycontext windowsession

How Context Works

OpenClaw maintains conversation context to provide coherent multi-turn interactions. Understanding how this works helps you get better responses.

Context Components

Each message to the AI includes:

  1. System prompt — Your base instructions
  2. USER.md — Your personal profile
  3. MEMORY.md — Long-term facts
  4. Conversation history — Recent messages in the current session
  5. Skill instructions — Active skill context
  6. Tool results — Output from any tools used

Context Window Limits

AI models have a maximum context window (e.g., 200K tokens for Claude). OpenClaw manages this by:

  • Keeping recent messages in full
  • Summarizing older messages when approaching the limit
  • Always including system prompt, memory, and user profile

Session Management

Clearing Context

Start fresh without losing memory:

  • "Clear the conversation" or "Start over"
  • Send /clear in the chat
  • This clears conversation history but keeps MEMORY.md and USER.md

Continuing Context

By default, context persists within a channel session. Switching channels starts a new session unless cross-channel context is enabled.

History Storage

Conversation logs are stored locally in your workspace:

~/.openclaw/history/
  telegram/
    2026-02-18.json
  whatsapp/
    2026-02-18.json

Configuration

{
  "context": {
    "max_history_messages": 50,
    "summarize_after": 30,
    "cross_channel": false,
    "persist_history": true
  }
}

Options

  • max_history_messages: How many messages to keep in context
  • summarize_after: When to start summarizing older messages
  • cross_channel: Share context across channels
  • persist_history: Save conversation logs to disk

Tips for Better Context

  • Reference earlier messages explicitly: "Like I said earlier about X"
  • Clear context when starting a new topic to avoid confusion
  • Use memory for permanent facts, not conversation context
  • Long conversations benefit from periodic summaries
conversation historycontext windowsessionchat historycontext management

Ready for your AI assistant?

Get started with Claw for All today. No setup, no terminal, just sign up and go.

Get Started

Related Guides