← Back to OpenClaw DocsComponent

Agents & Sessions

Every conversation in OpenClaw runs inside an isolated agent session — its own context window, tool permissions, and workspace files. Sessions persist across Gateway restarts so you can pick up exactly where you left off, even from a different device.

How Agents Use Context Engineering — covering Claude Code, Manus, and more

Description

In OpenClaw, an agent is the AI process that reads messages, reasons about them, calls tools, and produces replies. You don't instantiate agents manually — the Gateway creates one automatically the first time a new conversation arrives on any channel.

Each agent runs inside a session — an isolated context window with its own transcript, tool permissions, and loaded workspace files. The agent has no awareness of other sessions running on the same Gateway; isolation is guaranteed at the session level.

Agents are model-agnostic: the same agent definition works with Claude, GPT, Grok, or any other provider you configure. Swap the model alias and the agent's behaviour changes accordingly — no code changes required.

Agents support tool use: they can read files, run shell commands, call APIs, search the web, and invoke skills — all within the permissions defined in .claude/settings.json. Complex tasks can be delegated to sub-agents, which are child sessions spawned inline and merged back when done.

What it does

  • Creates a dedicated context window per conversation — no cross-contamination between users or channels.
  • Persists transcript files so sessions survive Gateway restarts.
  • Supports sub-agents: sessions can spawn child sessions for parallel tasks.
  • Loads workspace files (SOUL.md, USER.md, MEMORY.md) on start to give the agent identity and memory.
  • Lets you resume any session by key from any device or channel.

CLI commands

Minimum version:openclaw 2026.6.0+

List all active sessions

openclaw session list

Resume a session by key

openclaw session resume <session-key>

Show a session's transcript

openclaw session history <session-key>

Kill a session

openclaw session kill <session-key>

Workspace files that shape every session

SOUL.md

Persona and tone. The agent reads this to know how to behave.

USER.md

Information about the user — name, timezone, preferences.

MEMORY.md

Index of persistent memories injected into every turn. Keep it lean.

AGENTS.md

Agent-level rules and conventions for this workspace.