How to Build a Personal OpenClaw Agent with ChatBotKit
OpenClaw is an emerging agentic architecture built around a simple but powerful idea: an AI agent should carry persistent identity, accumulate memory across sessions, and teach itself new capabilities over time. Instead of starting from zero every conversation, an OpenClaw agent bootstraps from its own files - loading who it is, what it remembers, and what it can do - before it says a word.
In this tutorial you will build your own personal OpenClaw-style agent on ChatBotKit. You will start with the foundational three-file pattern (Soul, Memory, Tools), then extend it with shell access, self-learning skills, Telegram integration, and a heartbeat schedule that lets the agent tend to its own workspace while you sleep.
What You'll Build
A personal AI agent that:
- Bootstraps its identity from a persistent Soul file on every session start
- Remembers everything by reading and writing a Memory file across conversations
- Teaches itself new skills by creating reusable skill files from successful interactions
- Executes shell commands in an isolated sandbox with persistent file storage
- Reaches you on Telegram so you can message it from anywhere
- Wakes up on a schedule to review its workspace, consolidate skills, and clean up
Prerequisites
- A ChatBotKit account
- A Telegram account and a bot token from @BotFather
- Familiarity with the Blueprint Designer
- Approximately 30-45 minutes
Quick start: If you want to skip ahead, fork the OpenClaw Self-learning Agent blueprint from the examples catalogue and jump to Step 7.
Understanding the OpenClaw Architecture
Before building, it helps to understand the three primitives that define an OpenClaw agent:
| Primitive | Purpose | Access model |
|---|---|---|
| Soul | Immutable identity - values, personality, core directives | Read-only |
| Memory | Working memory - accumulated facts, context, ongoing tasks | Read-write |
| Tools | Capability registry - learned skills, macros, custom instructions | Append-only |
Every session begins with a bootstrap sequence: the agent discovers its files, loads Soul, loads Memory, loads Tools, and only then engages the user. This sequencing ensures the agent is fully contextualised before it speaks.
The self-learning extension adds a fourth loop on top of this foundation:
- Discover - list existing skills to see what the agent already knows
- Execute - if a matching skill exists, read it and follow its instructions
- Learn - if no skill exists, figure out the task and save a new skill file
- Improve - next time the same request comes in, the skill is already there
Over time, the agent builds a growing library of capabilities from real usage.
Step 1: Create the Blueprint
- In your ChatBotKit dashboard, navigate to Blueprints in the sidebar.
- Click Create and select Blueprint.
- Name it "My OpenClaw Agent".
- Click Design to open the Blueprint Designer.
- Choose the Blank option to start with an empty canvas containing a bot and a skillset.
You now have two resources on the canvas: a Bot and a Skillset. Everything else will be added step by step.
Step 2: Define the Soul, Memory, and Tools Files
The three-file pattern is the heart of the OpenClaw architecture. Each file is a standard ChatBotKit file resource.
- In the Blueprint Designer, add three File resources to the canvas.
- Configure each one:
Soul file:
- Name:
Soul - Description: The agent's immutable identity - core values, personality, and foundational directives. Read at startup. Never overwrite.
Memory file:
- Name:
Memory - Description: The agent's working memory - accumulated facts, past conversation context, ongoing tasks, and learned preferences.
Tools file:
- Name:
Tools - Description: The agent's capability registry - custom instructions, macros, and extended skills the agent has learned or created over time.
- Open the Soul file and write your agent's identity. This is where you define who your agent is. Here is an example to get you started:
Tip: The Soul file is read-only by convention. Write it once and let it shape every response the agent gives. If you want a different personality, edit the Soul - do not ask the agent to overwrite it.
Step 3: Add Bootstrap Abilities
The agent needs system abilities to discover and load its files at session start.
- Open your Skillset in the Blueprint Designer.
- Add the following abilities:
List Agent Files:
- Name:
[SYSTEM] List Agent Files - Description: Lists all file resources in the blueprint and returns their IDs and names. Call this first on every session start.
- Instruction:
Load Agent File by ID:
- Name:
[SYSTEM] Load Agent File by ID - Description: Loads the full content of any file by its ID. Use this to read the Soul and Tools files.
- Instruction:
Read Agent Memory:
- Name:
[SYSTEM] Read Agent Memory - Description: Reads the current content of the Memory file. Call this during bootstrap to restore working memory.
- Instruction:
Write Agent Memory:
- Name:
[SYSTEM] Write Agent Memory - Description: Writes updated content to the Memory file. Call this at the end of every meaningful conversation.
- Instruction:
Note: For Read Agent Memory and Write Agent Memory, replace
<your-memory-file-id>with the actual resource reference to your Memory file. In the Blueprint Designer, you can link the ability directly to the file resource so the ID is resolved automatically.
Step 4: Write the Bot Backstory
The backstory is the system prompt that instructs the agent how to behave. This is where you encode the bootstrap sequence and operational rules.
- Open the Bot resource in the Blueprint Designer.
- Connect it to your Skillset.
- Set the Backstory to:
- Choose a model (Claude 4.6 Sonnet works well for agentic workloads).
Step 5: Test the Foundation
Before adding self-learning capabilities, verify the bootstrap sequence works.
- Open the Chat interface from your blueprint.
- Send any message. The agent should immediately begin its bootstrap sequence - listing files, loading Soul, loading Memory, then loading Tools - before responding to you.
- Have a short conversation and ask the agent to remember something.
- At the end, the agent should write to Memory.
- Start a new conversation and verify the agent loads the memory from the previous session.
If the agent does not bootstrap on its own, check that:
- All four system abilities are connected to the skillset
- The skillset is connected to the bot
- The backstory includes the explicit bootstrap instructions
Step 6: Add Self-Learning Capabilities
Now extend the agent so it can teach itself new skills. This requires a Space for persistent file storage and additional abilities.
-
Add a Space resource to the canvas.
- Name:
Agent Workspace - Description: Persistent workspace for the agent. Skills under
.skills/, outputs under/outputs/.
- Name:
-
Add the following abilities to your Skillset, each connected to the Space:
List Skills:
- Name:
List Skills - Description: Lists all skills the agent has learned. Returns the name, description, and path of each skill.
- Instruction:
Read Skills:
- Name:
Read Skills - Description: Reads the full content of a skill file by path.
- Instruction:
Create Skills:
- Name:
Create Skills - Description: Creates new skill files in the workspace.
- Instruction:
Bash:
- Name:
Bash - Description: Execute shell commands and scripts in the workspace sandbox.
- Instruction:
Read/Write Files:
- Name:
Read/Write Files - Description: Read or write files in the workspace.
- Instruction:
- Update the Bot backstory to include the self-learning loop. Append the following after the existing rules:
Step 7: Connect Telegram
Make your agent reachable from anywhere by adding a Telegram integration.
- Open @BotFather on Telegram.
- Send
/newbotand follow the prompts to create a bot. Copy the bot token. - In the Blueprint Designer, add a Telegram Integration resource.
- Connect it to your Bot.
- Paste the bot token into the Bot Token field.
- Enable Attachments if you want to send files to your agent.
- Save the blueprint and deploy.
Message your bot on Telegram. It should bootstrap from its Soul, Memory, and Tools, then respond to you. Everything it learns carries over to the next conversation.
Step 8: Add a Heartbeat Schedule
An OpenClaw agent should not just wait for commands. A heartbeat trigger wakes it periodically to maintain its own workspace.
- Add a Trigger Integration resource to the canvas.
- Connect it to your Bot.
- Configure it:
- Name:
Heartbeat - Schedule:
0 */6 * * *(every 6 hours - adjust to your preference) - Session Duration:
1800000(30 minutes) - Max Iterations:
50 - Trigger Prompt:
- Name:
The heartbeat turns your agent from a reactive tool into a proactive assistant that improves itself between conversations.
Step 9: Customize Your Agent
Now that the foundation is in place, make it yours. Here are some ideas:
Personalise the Soul. The example Soul is generic. Write one that reflects your actual needs - a research assistant, a DevOps helper, a writing companion. The more specific the Soul, the more focused the agent becomes.
Seed initial skills. You do not have to wait for the agent to learn everything from scratch. Create skill files manually in the Space to give it a head start:
Add more integrations. Telegram is just one option. You can connect the same bot to Slack, Discord, WhatsApp, or the web widget. The agent's identity and memory carry over regardless of the channel.
Tune the heartbeat. A 6-hour schedule works for most use cases, but you can make it more or less frequent. You can also add multiple triggers with different prompts - one for skill maintenance, another for a daily briefing.
How the Pieces Fit Together
Here is a summary of the architecture you have built:
Troubleshooting
The agent does not bootstrap on session start
- Verify the backstory includes the explicit four-step bootstrap sequence.
- Check that all
[SYSTEM]abilities are added to the skillset and the skillset is connected to the bot. - Try sending "bootstrap" as your first message to prompt the sequence manually.
Memory is not persisting between sessions
- Ensure Read Agent Memory and Write Agent Memory reference the correct Memory file ID.
- Check that the agent is actually calling Write Agent Memory at the end of conversations. You can verify this in the conversation logs.
Skills are not being saved
- Confirm the Space is connected to the skill abilities (List Skills, Read Skills, Create Skills).
- Ask the agent to list its skills - if it returns an error, the Space connection is missing.
Telegram messages are not reaching the agent
- Verify the bot token is correct in the Telegram Integration settings.
- Make sure the blueprint is deployed (not just saved).
- Send
/startto the bot on Telegram to initialise the connection.
Heartbeat is not firing
- Check the Trigger Integration schedule syntax (standard cron format).
- Make sure the Trigger Integration is connected to the Bot.
- Review the trigger logs in the dashboard to see if it ran and what happened.
Next Steps
- Explore the OpenClaw Reference Architecture blueprint for the minimal three-file pattern without self-learning
- Read How to Design Your Own AI Agent Architecture to understand how OpenClaw fits into the broader landscape of agent patterns
- Try the Files as Skills blueprint for an alternative approach to dynamic skill loading
- Build a Shell-powered API Agent to give your OpenClaw agent authenticated API access
https://chatbotkit.com/tutorials/how-to-build-a-personal-openclaw-agent