OpenClaw Self-learning Agent
An OpenClaw-style personal AI agent accessible via Telegram that learns by creating, discovering, and executing skills stored in a persistent space - teaching itself new capabilities from every conversation and waking up on a heartbeat schedule to tend to its own workspace.
The OpenClaw Self-learning Agent blueprint implements an open-ended AI assistant inspired by the OpenClaw philosophy: an autonomous agent with a persistent workspace, shell access, and the ability to teach itself new skills over time. Accessible via Telegram and driven by a heartbeat trigger, it combines the platform's skill system with shell execution to create an agent that genuinely self-improves.
The Self-learning Loop
Most AI agents are static - they can only do what was configured at design time. This agent breaks that pattern with a four-step loop:
- Discover - the agent lists existing skills to see what it already knows how to do.
- Execute - if a matching skill exists, the agent reads it and follows its instructions using shell execution.
- Learn - if no skill exists, the agent figures out how to accomplish the task, then writes a new skill file capturing what it learned.
- Improve - the next time the same request (or a similar one) comes in, the skill is already there. Over time the skill library grows organically from real usage.
Architecture
The agent has a single skillset with five abilities connected to one persistent space:
- List Skills (
space/skill/list) - scans the space for skill files and returns their names and descriptions. This is how the agent introspects its own knowledge base. - Read Skills (
space/skill/read) - loads the full content of a skill by path. The agent reads instructions just in time. - Create Skills (
space/skill/create) - writes new skill files to the space. This is how the agent learns - it crystallizes successful approaches into reusable skills. - Bash (
shell/exec) - executes shell commands in the space's sandbox. Skills can include shell commands, scripts, API calls, or any other executable instructions. - Read/Write Files (
shell/rw) - reads and writes arbitrary files in the space for configuration, data, and outputs.
Telegram Integration
The Telegram integration makes the agent always within reach. Message it from your phone to ask a question, assign a task, or teach it something new. The persistent space means everything the agent learns carries over to the next conversation - including skills, downloaded files, saved data, and environment configuration.
Skill Format
Each skill is a SKILL.md file under .skills/<name>/ with
frontmatter metadata:
---
name: Fetch and Summarize URL
description: Downloads a web page and produces a concise summary
---
# Fetch and Summarize URL
## Instructions
1. Use curl to download the URL content
2. Extract the main text content
3. Produce a 3-5 sentence summary
4. Save the summary to /outputs/<domain>-summary.md
The name and description fields are what the List Skills ability
returns, so the agent can match skills to requests without reading
every file.
Why This Works
- Compounding value - the agent starts with no skills and accumulates them from real usage. After a few weeks, it handles most of the user's recurring requests without figuring anything out from scratch.
- Portable knowledge - skills are plain Markdown files in the space. They can be browsed, edited, exported, or even copied to another agent.
- Transparent behavior - every capability the agent has is visible as a file. There is no hidden logic - if you want to know why the agent did something a certain way, read the skill.
- Recoverable - if a skill produces bad results, delete or edit it. The agent will either use the updated version or learn again from scratch.
Heartbeat
Like any OpenClaw-style agent, this one does not just wait for commands. A scheduled heartbeat trigger wakes the agent periodically so it can review its workspace, consolidate recently learned skills, clean up stale outputs, and run any maintenance routines it has taught itself. The heartbeat turns the agent from a reactive tool into a proactive assistant that tends to its own environment.
Getting Started
- Set your Telegram bot token on the Telegram integration.
- Message the agent with a task - it will attempt to complete it and offer to save what it learned as a skill.
- Over time, check the Space File Browser to see the growing skill library.
- Edit or delete skills as needed to steer the agent's behavior.
- The heartbeat trigger runs every 6 hours by default - adjust the schedule to suit your needs.
Backstory
Common information about the bot's experience, skills and personality. For more information, see the Backstory documentation.
Skillset
This example uses a dedicated Skillset. Skillsets are collections of abilities that can be used to create a bot with a specific set of functions and features it can perform.
List Skills
Lists all skills the agent has learned. Returns the name, description, and path of each skill found in the workspace.Read Skills
Reads the full content of one or more skill files by path. Use List Skills first to discover available paths.Create Skills
Creates new skill files in the workspace. Use this to save learned approaches as reusable skills for future conversations.Bash
Execute shell commands and scripts in the workspace sandboxRw
Read or write files in the workspace for configuration, data, and outputs
Terraform Code
This blueprint can be deployed using Terraform, enabling infrastructure-as-code management of your ChatBotKit resources. Use the code below to recreate this example in your own environment.
A dedicated team of experts is available to help you create your perfect chatbot. Reach out via or chat for more information.