Accelerated Intelligence

Stage 2: Logic

The Art of Understanding Relationships

"How do these parts connect and interact?"

Stage 2: Logic

"How do these parts connect and interact?"

Purpose of This Stage

Logic is the second stage, and it depends entirely on Grammar being solid. Logic answers the questions: "How do these parts connect? What causes what? What are the rules? What happens if I change this?"

In classical education, Logic was taught to students around ages 11-14 - the age when children naturally begin questioning everything and arguing. The curriculum channeled that instinct into formal reasoning: cause and effect, if-then relationships, identifying contradictions, distinguishing correlation from causation.

For OpenClaw, Logic means understanding how the seven core components interact as a system. When a message arrives on WhatsApp, what path does it take through the architecture? Why does session memory work differently from workspace memory? What happens when the AI model's context window fills up?

The test for whether you have completed Logic is not whether you can recite facts but whether you can predict outcomes.


Module 2.1: The Three-Layer Architecture

Learning Objectives:

  • Understand the three layers of OpenClaw's architecture
  • Trace a message from input to output through all layers
  • Identify which layer a problem exists in based on symptoms

The Three Layers

OpenClaw is organized into three conceptual layers. Understanding this architecture is the key to troubleshooting, customization, and mastery.

Layer 1: The Foundation (Gateway)

The Gateway is the base layer. It is a single process that runs continuously in the background. Everything else depends on it. If the Gateway crashes, the entire system goes down. The Gateway handles:

  • Network listening (on port 18789 by default)
  • Authentication and security
  • Routing messages between components
  • Managing agent lifecycles
  • Coordinating tool execution
  • Logging and diagnostics

Layer 2: The Connections (Channels & Nodes)

The middle layer consists of all the ways the outside world connects to the Gateway. This includes:

  • Channels: Platform-specific adapters (WhatsApp, Telegram, Discord, Slack, etc.)
  • Nodes: Companion devices (iPhone, iPad, Android, secondary computers)
  • Control UI: The web dashboard for managing OpenClaw
  • Terminal UI: The command-line interface

Each connection in this layer is independent. If WhatsApp breaks, Telegram still works. If your iPhone disconnects, your Mac node continues functioning.

Layer 3: The Intelligence (Agent & AI Model)

The top layer is where the actual "thinking" happens:

  • Agent: The orchestrator that receives requests, decides which tools to use, manages memory, and coordinates responses
  • AI Model: The language model (Claude, GPT, etc.) that generates responses and makes decisions
  • Tools: The specific capabilities the agent can invoke
  • Skills: The instruction bundles that guide complex tasks

Module 2.2: Message Flow

Learning Objectives:

  • Trace the complete path of a message from user input to response
  • Understand what happens at each step
  • Identify where delays, errors, or data loss can occur

The Six-Step Journey

When you send a message to your OpenClaw assistant, here is exactly what happens:

Step 1: Platform Capture

You type a message in WhatsApp (or Telegram, Discord, etc.) and hit send. The message lives on that platform's servers first.

Step 2: Channel Adapter Receives

The OpenClaw channel adapter for that platform (running as part of the Gateway) polls or listens for new messages. When it detects your message, it downloads it and translates it into OpenClaw's internal message format.

Step 3: Gateway Routes

The Gateway receives the standardized message from the channel adapter. It looks up which agent should handle this message (based on the channel, user, and session). It then routes the message to that agent.

Step 4: Agent Processes

The agent receives the message and loads the relevant context:

  • Session history (recent conversation)
  • Workspace memory files
  • Available tools and skills
  • System instructions (AGENTS.md, SOUL.md, TOOLS.md)

The agent constructs a prompt that includes your message plus all this context, and sends it to the AI model.

Step 5: AI Model Responds

The AI model (Claude, GPT, etc.) processes the prompt and generates a response. This might be:

  • A text reply
  • A tool invocation (run a command, read a file, etc.)
  • Multiple steps in sequence

If the response includes tool calls, the agent executes them and may send follow-up prompts to the AI model with the tool results.

Step 6: Response Returns

Once the agent has a final response, it sends it back to the Gateway. The Gateway routes it to the appropriate channel adapter. The channel adapter translates it back into the platform's format and posts it. You see the response in WhatsApp.

Where Things Can Go Wrong

  • Step 2: If the channel adapter crashes or loses authentication, messages never reach the Gateway
  • Step 3: If the Gateway cannot find the agent or session, the message is dropped
  • Step 4: If session history is too long, compaction may have lost important context
  • Step 5: If the AI model is down, rate-limited, or out of credits, no response is generated
  • Step 6: If the channel loses connection during response posting, the message may be lost or duplicated

Module 2.3: Configuration Logic - What Controls What

Learning Objectives:

  • Understand the relationship between the config file and runtime behavior
  • Know what changes require a restart vs. what hot-reloads
  • Understand the three tiers of skills and their trust implications

Configuration Changes and Their Effects

If You Change...Then This Happens...
The AI model in configThe agent uses a different brain on the next message. No restart needed (hot-reload). Like swapping which chef is in the kitchen.
A channel settingThe Gateway reconnects to that platform. Other channels continue working uninterrupted.
SOUL.mdThe agent's personality changes on the next conversation turn. Like updating an employee's personality profile.
AGENTS.mdThe agent's core behavior instructions change. This is the most impactful edit you can make - it is the agent's entire job description and rulebook.
A skill is installedThe agent gains a new capability. Skills are discovered at runtime and selectively injected into the prompt only when relevant - not every skill loads on every message.
The Gateway tokenAll connected clients must re-authenticate. Like changing the office door code - everyone needs the new password.
Session reset settingsChanges when conversations expire and get wiped. Default is daily at 4 AM. Misconfiguring this can cause the "my agent forgot everything" frustration.

The Three Tiers of Skills

Skills come in three categories, and understanding the distinction matters enormously for both security and reliability:

Bundled Skills - come pre-installed with OpenClaw. Maintained by the core team. Generally safe and well-tested. These are like the software that comes pre-installed on a new computer.

Managed Skills - community-created skills available through the OpenClaw ecosystem. Quality and safety vary widely. Some are excellent. Some are poorly written. Some could be malicious. Always read the SKILL.md before installing. These are like third-party apps from an app store with no review process.

Workspace Skills - skills you create yourself in your agent's workspace/skills/ directory. You control the quality and safety because you wrote them. These are like custom macros or scripts you build for your own use.

Security Warning: Skills Can Be Dangerous

Skills can run code on your computer. Cisco's AI security research team tested a third-party OpenClaw skill and found it performed data exfiltration and prompt injection without user awareness. The skill repository lacks adequate vetting to prevent malicious submissions. This is not a theoretical risk - it has been demonstrated. Only install skills you trust, review the SKILL.md file before installing, and prefer sandboxed execution for anything from an unknown source.


Module 2.4: Memory and State

Learning Objectives:

  • Understand the difference between session memory, workspace memory, and compacted memory
  • Know why the agent "forgets" things and how to prevent it
  • Learn how to structure information for long-term retention

Three Types of Memory

Session Memory (Short-term, Volatile)

This is the conversation transcript - the raw back-and-forth messages in the current session. It lives in RAM and in temporary session files. Session memory is:

  • Fast: Immediately available to the agent
  • Detailed: Contains every word of the conversation
  • Temporary: Resets daily (default: 4 AM) or when manually cleared
  • Limited: Subject to compaction when it gets too long

Workspace Memory (Medium-term, Persistent)

This is information the agent explicitly saves to files in its workspace directory. Workspace memory is:

  • Persistent: Survives session resets and compaction
  • Searchable: The agent can search for and retrieve specific files
  • Manual: Requires the agent to actively write and read files
  • Fallible: If the agent does not search for the right file, it behaves as if the information does not exist

Compacted Memory (Long-term, Lossy)

When a session grows too long, older messages are summarized to make room. Compacted memory is:

  • Compressed: Details are lost, only summaries remain
  • Automatic: Happens without user intervention when thresholds are hit
  • Irreversible: Once compacted, the original detail cannot be recovered
  • Silent: The agent does not warn you that compaction is happening

Why the Agent "Forgets"

The most common frustration with OpenClaw is memory loss. Understanding why it happens requires understanding three mechanisms:

  1. Session resets: Sessions expire daily by default. When a session resets, the agent loses all conversation context unless important facts were saved to workspace memory files first.

  2. Compaction: When a session grows too long, older content is summarized (lossy). Details, credentials, and specific instructions shared early in a conversation can be lost during compaction.

  3. Memory search failures: Even when information is saved to workspace files, the agent must search for it. If the search does not return the right file, the agent behaves as if it does not know the information.

Best Practices

  • Never share credentials in chat. Store them in config files or workspace environment files.
  • Instruct the agent to save important information. Add explicit instructions in AGENTS.md like: "Before any session ends or resets, save all important context, decisions, and action items to MEMORY.md."
  • Use workspace files for persistent data. Anything that needs to survive session resets must be written to the workspace.
  • Monitor session length. If you are in the middle of a complex task and the session is getting long, explicitly ask the agent to save state before continuing.

Module 2.5: Security Model

Learning Objectives:

  • Understand the security boundaries of OpenClaw
  • Know the difference between local-only and exposed setups
  • Recognize the most common security mistakes and their consequences

Defense in Depth

OpenClaw's security is built on multiple layers:

Network binding: By default, the Gateway only listens on localhost (127.0.0.1). Nobody outside your computer can reach it. This is the most important security feature and should not be changed without understanding the consequences.

Authentication token: Even local connections can require a password-like token. If someone gains access to your computer (physically or remotely), this token prevents them from controlling the Gateway.

Device pairing: New devices (iPhones, iPads, other computers) must be approved before they can connect to the Gateway. This prevents unknown devices from connecting even if they can reach the Gateway's network address.

Sandboxing: Tools can run inside Docker containers so they cannot damage your main system. This limits the blast radius if a malicious skill or prompt injection causes the agent to execute harmful commands.

Channel-level controls: You can restrict which users, groups, and roles the agent responds to on each platform. This prevents unauthorized people from commanding your agent.

The Most Dangerous Mistake

The most dangerous and most common mistake is exposing your Gateway to the public internet without proper authentication. Security researchers found over 30,000 exposed OpenClaw instances in a single two-week analysis period in early 2026.

If someone reaches your Gateway, they can:

  • Control your agent
  • Read your data
  • Send messages as you
  • Act on your behalf across every connected service

Never expose the Gateway to the internet. If you need remote access, use Tailscale or an SSH tunnel.


Ready for the Quiz?

You have learned how OpenClaw's components interact as a system. Now it is time to test your understanding. You need to score 70% or higher to unlock the Rhetoric stage.

The quiz will cover:

  • The three-layer architecture
  • Message flow and routing
  • Memory types and limitations
  • Security boundaries

Take your time and think through each question carefully.

Ready to Test Your Understanding?

Take the Logic Stage quiz to prove you understand how OpenClaw's components interact. You need 70% or higher to unlock the Rhetoric stage.