why-i-didn-t-fork-openclaw-how-to-build-a-serverless-agent-tmd
8,872 chars · 2,218 tokensUTF-8 · LF
# Why I didn't fork OpenClaw: How to build a serverless agent that can do anything.
---

A lot of people are asking me how TrustClaw works. Here is a technical deep dive into how it works (and why it does so well), and why it is actually a lot simpler to build than you would expect.
So simple, in fact, I spent 3 days building it. 2 of which was wasted on infrastructure that I deleted (more on that later).
In this article I am going to touch on:
Why not fork OpenClaw?
What inspiration did you take from OpenClaw?
How does it have access to 1000+ apps?
How does it have infinite memory?
How does it “work 24/7”?
How did you get Telegram working?
Cool, how can I deploy it myself?
Flashback to 3 months ago @openclaw had taken the internet by storm and I was immediately inspired to build some way to make it easier for non-technical people (and lazy people like me) to spin up their own personal agent without having to deploy their own instance or buy a mac mini.
Initially, my idea was to automatically deploy a virtual machine for each user, so they can immediately begin chatting with their OpenClaw without having to worry about the logistics. A lot of cool companies and indie hackers began doing this too!
But, I didn’t just want to help them “spin it up”, I wanted to help them “set it up” and actually make it useful for their everyday tasks. OpenClaw typically acquires capability through plugins, skills, MCPs, CLIs, which may be pretty confusing for the everyday user that just wants the agent to “connect to Gmail”.
So my goal was to create a version with no plugins, no skills, just “apps” that you could install in one click (e.g. Gmail, Notion, GitHub, etc.). A nice, simple abstraction for the non-technical user. And of course, wrap this up in something that feels so good and intuitive to use.
Why not fork OpenClaw?
I was so excited by my idea I personally bought the domain trustclaw.app and spent the next 2 days heads down setting up all the infrastructure and when I finally got it working I realized… what if I don’t need a virtual machine at all? What if I don’t need to fork OpenClaw?
Lol, but in all seriousness, for everyday tasks, do I really need to give my personal assistant its own machine?
Sending emails, creating playlists, searching Google? Ok this one is obvious, Composio covers all of the common stuff.
Ok but what about apps that Composio doesn’t have? Composio has a really good browser tool, it can even give the user a link to monitor and interact with the browser session.
Ok… what about writing code? Composio has a workbench tool, it can execute code in a sandbox and cache, process and visualize outputs. If it needs a whole coding environment it can invoke agents, Devin, whatever coding agents you like.
Ok… but I really need it to do something on my computer… Composio even has an integration that lets you trigger specific commands remotely on your machine. So… if you really needs your terminal, specifically, you can!
Like the amount of tools we have is so absurd, I even found a way to make it spin up an AI agent to spam call my fiancé (shoutout @nikos1 for putting up with me).
And it's not only about the fact that the agent can “technically” do all these things with Composio, it's that this system was specifically designed for it to do all these things and it does them incredibly well. Composio has this continual learning layer where it is always improving the plans (“skills”). So over time, the tools have become insanely optimized for agents to use.
Before I get flamed for this take, I just want to clarify I would not recommend this approach for tasks like coding or video editing that strongly benefit from having a stable environment (not just one-off cloud agent invocations/sandboxes). If this sounds like you, but you still want the benefits of Composio, we have also launched the Composio CLI for OpenClaw!
How does it have access to 1000+ apps?
Adding this capability was as simple as giving the agent the 6 meta-tools (that's it), which enables it to take action across 1000+ apps, scoped to the user’s session like this:
And that is the action layer.
What inspiration did you take from OpenClaw?
TrustClaw is not a fork of OpenClaw. But the orchestration is heavily inspired! Shoutout to @steipete and the OpenClaw team!
This is attributed in the source with file:line pointers back to the original repos!
From OpenClaw I kept the soul / identity / personality prompt structure. Splitting the system prompt into a soul layer (who the agent is) and the user prompt is a real UX win. It makes the assistant feel like a character instead of a tool.
From pi (the harness underneath OpenClaw, shoutout @badlogicgames & team) I kept the compaction algorithm.
From OpenClaw I also kept the adaptive chunking.
The only intentional architectural difference is memory. In OpenClaw there are many options for memory. In TrustClaw, pgvector RAG is baked into the agent loop so users don’t have to think about it.
How does it have infinite memory?
Before compaction I run a “memory flush”. It is a pretty straightforward and effective idea. When context is approaching the compaction threshold, we fire a separate LLM call with only memory tools and prompt the model to persist durable facts into pgvector. THEN compaction wipes the conversation. So important stuff survives the summary. That’s how you emulates infinite context.
Frankly, the memory system has its issues, but it does the job. It is lossy, not so great at putting together an episodic series of events. If you have any ideas on how to improve it please do not hesitate to contribute!
How does it “work 24/7”?
The agent can schedule itself. There’s a schedule tool with create / list / delete actions. OpenClaw by default wakes every 30 min. With TrustClaw I did not add any defaults, mostly just because that is the way I preferred it.
The user can just say “text me every morning with the weather and what I have going on for the day”, and it will just schedule itself to do that.
Implementation: vercel.json has a cron hitting GET /api/cron/trustclaw every minute. That endpoint does an atomic claim with UPDATE … RETURNING, groups due jobs by instance, then dispatches one fetch per instance to /api/cron/trustclaw/execute. The claim looks roughly like:
Three things to notice:
The lock prevents duplicates if two cron ticks race each other.
The stale-lock recovery branch handles crashed serverless invocations, anything held over 10 minutes is fair game again.
And setting nextRunAt = NULL on claim means a long-running job (>60s) won’t get re-picked by the next minute’s tick, the dispatcher reschedules it after it finishes.
When I was preparing to open source the project I chose @vercel because I wanted the entire project to be easy to deploy! Because I am using database + redis through Vercel stores, Vercel’s AI Gateway, using Vercel’s CRON service was the cherry on top. Seriously, this entire project can be deployed in a single command and it is incredibly satisfying. Oh, and I made a Vercel template too, so you can deploy it without even looking at code.
How did you get Telegram working?
OpenClaw’s telegram setup is a bit more difficult for non-technical folks. You create your own bot through BotFather, paste the token into an .env, configure a webhook URL pointing at your gateway and for some reason you can only generate the webhook token via hitting their API. Reasonable flow for a developer, and you end up with a bot that’s yours. But TrustClaw users include people who don’t know what a webhook is, so that path is a dead end for them.
TrustClaw has one shared Telegram bot. To link your account you click a button in the dashboard, get a short code, send /start <code> to the bot from your phone, done. The bot keeps a map of chat ID → instance ID and routes every incoming message back into the same prepareAgentRun() loop above. Cron jobs deliver their output to Telegram automatically if you’ve linked. So “every morning at 8, summarize my Slack DMs and ping me on Telegram” works out of the box with zero infrastructure on the user’s side.
Cool, how can I deploy it myself?
The project supports multiple users outside of the box (auth handled by @better_auth) so it is the perfect starter template for your next project!
You can check out the full instructions and deploy via our Vercel Template without touching any code at github.com/ComposioHQ/trustclaw! Or you can use the command line:
Fork it, or just steal the parts you like, that’s what this writeup is for :)
Happy hacking!

ref · pACQnCPPxmdbot.com/c/pACQnCPP
