
OpenClaw is the most populated self-hosted personal AI assistant in the world right now. From the perspective of an AI Agent developer, it is not only a AI tool, but also one of the best real-world references for agent design patterns. It helps us create more sophisticated designs when building our agents. In this article, I will go down the rabbit hole and ultimately build a conceptual model.
Conceptual Model
The following diagram is the conceptual model I built.
OpenClaw Conceptual Model (Open with Draw.io)
I built the model from two sources of truth:
- The official documentation at https://docs.openclaw.ai/ . To verify the source of truth, You can open the diagram in draw.io and click the links to the documentation.
- Tracing LLM prompt and tools-calling logs from a running OpenClaw
Documentation Analysis
The official documentation is rich in content. However, the pages are not organized as a step-by-step guide for building up concepts. As a result, I often get lost when navigating the documentation website. It lacks a conceptual map and the explicit relationships between concepts. After going though the pages, I tried my best to extract the relationships between concepts.
Mastering Prompt Inspection
The “secret sauce” of most AI applications lies within their LLM prompts. However, tracing LLM traffic can feel like falling down a rabbit hole of unstructured data.
Effective observability typically relies on two primary methos: tracing and sampling. In this setup, I use OpenRouter as the LLM gateway. It supports a tracing replication mechanism called Broadcast. I configured it sent tracing data to my publicly accessible self-hosted Langfuse service.
Environment Setup
To demonstrate prompt inspection, we need a scenarios where OpenClaw executes specific Skills. I used my self-hosted Home Assistant instance, which manages my smart home devices, as the target environment. To integrate the two, I installed the necessary skills from https://clawhub.ai/dbhurley/homeassistant into following directory:
~/.openclaw/workspace/skills/homeassistant .
Don’t forgot to set the environment variables. It may be configuared at ~/.openclaw/.env
HA_URL=http://your-ha-host:8123
HA_TOKEN=your_ha_token
Understanding Agent Skill Magic
Open the OpenClaw Dashboard and start a new chat session with the following prompt:
Any smart home device in my study room?
Why use OpenClaw Dashboard other than IM client? While OpenClaw supports popular IM clients like Telegram or WhatsApp, the native Dashboard is superior for development and debugging. Unlike standard chat interfaces, the dashboard provides a high-visibility “inspection mode”. It displays the exact tool-calling parameters the agent is preparing and the raw results returned by the system in real-time. The transparency is crucial for verifying.
Next, open the Langfuse Dashboard and navigate to the Tracing page, you will see a list of captured traces; let’s analysis the first two traces in chronological order. The analysis help us to understand the magic of agent skill discovery, loading and tool calling.
1. Skill Discovering
LLM Input - Messages:
|
|
LLM Input - tools declare:
|
|
LLM Output:
|
|
The LLM initiates a tool call to read the skill documentation: "read{"path": "~/.openclaw/workspace/skills/homeassistant/SKILL.md"}"
2. Skill Loading
Upon receiving the tool call from LLM, the agent executes the read function to load the contents of ~/.openclaw/workspace/skills/homeassistant/SKILL.md and sends it back.
LLM Input:
|
|
LLM output:
|
|
After learning from the documentation of homeassistant skill, the LLM initiates an exec tool call to access the Home Assistant HTTP API. What is particularly clever here is the security design: the agent does not pass literal tokens or credentials to the LLM. Instead, the skill utilizes environment variables, ensuring that sensitive secrets are never exposed within the LLM’s context or stored in the trace history.