Memory & Personalization
💭

Managing Conversation History and Context

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

5 分鐘閱讀|
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

準備好使用AI助理了嗎?

今天就開始使用Claw for All。無需設定,無需終端機,註冊即可使用。

開始使用

相關指南