Skip to content

Instantly share code, notes, and snippets.

@dabit3
dabit3 / you_couldve_invented_openclaw.md
Last active February 13, 2026 05:03
You Could've Invented OpenClaw

What makes OpenClaw powerful is surprisingly simple: it's a gateway that connects an AI agent to your messaging apps, gives it tools to interact with your computer, and lets it remember who you are across conversations.

The complexity comes from handling multiple channels simultaneously, managing persistent sessions, coordinating multiple agents, and making the whole thing reliable enough to run 24/7 on your machine.

In this post, I'll start from scratch and build up to OpenClaw's architecture step by step, showing how you could have invented it yourself from first principles, using nothing but a messaging API, an LLM, and the desire to make AI actually useful outside the chat window.

End goal: understand how persistent AI assistants work, so you can build your own.

First, let's establish the problem

# Create a new worktree and branch from within current git directory.
ga() {
if [[ -z "$1" ]]; then
echo "Usage: ga [branch name]"
exit 1
fi
local branch="$1"
local base="$(basename "$PWD")"
local path="../${base}--${branch}"
@martinwoodward
martinwoodward / mermaid.md
Created February 11, 2022 20:34
GitHub HTML Rendering Pipeline
```mermaid
sequenceDiagram
    participant dotcom
    participant iframe
    participant viewscreen
    dotcom->>iframe: loads html w/ iframe url
    iframe->>viewscreen: request template
    viewscreen->>iframe: html & javascript
 iframe->>dotcom: iframe ready
@garystafford
garystafford / get_aws_product_list.sh
Last active May 14, 2022 19:02
One-liner to retrieve a list of all AWS products from aws.amazon.com/products sorted by product category (requires jq). Worked as of 2022-01-03. Page format tends to change a lot...
curl --silent --compressed \
'https://aws.amazon.com/api/dirs/items/search?item.directoryId=aws-products&sort_by=item.additionalFields.productCategory&sort_order=asc&size=500&item.locale=en_US' \
| jq -r '.items[].item | .additionalFields.productCategory + " | " + .additionalFields.productName' \
| sort
{
"us-east-1": {
"city": "Ashburn",
"state": "Virginia",
"country": "United States",
"countryCode": "US",
"latitude": 38.9445,
"longitude": -77.4558029,
"region": "North America",
"iataCode": "IAD"
@pahud
pahud / bootstrap.sh
Last active September 27, 2024 14:27
AWS SSO + Codespaces
#!/bin/bash
# video demo - https://www.youtube.com/watch?v=Y8TyE_DNds8
mkdir ~/.tmp && cd $_
# install aws-cli v2
curl "https://awscli.amazonaws.com/awscli-exe-linux-x86_64.zip" -o "awscliv2.zip" && \
unzip awscliv2.zip && \
sudo ./aws/install
@singledigit
singledigit / api.yaml
Created September 24, 2020 17:42
Example of an AWS Lambda Destinations configuration for AWS Lambda functions within an application.
# You don't need this, but here it is anyways :)
openapi: "3.0.1"
info:
title: "Translation API (Async)"
version: "1.0.0"
paths:
/:
post:
summary: Create new translation request
@dabit3
dabit3 / SingleTableAppSync.md
Last active January 24, 2026 12:01
GraphQL Single Table Design with DynamoDB and AWS AppSync

GraphQL

GraphQL Schema

type Customer {
  id: ID!
  email: String!
}
@singledigit
singledigit / template.yaml
Created August 18, 2020 22:06
Creating an EventBridge rule with API Gateway as the target in AWS SAM
AWSTemplateFormatVersion: '2010-09-09'
Transform: AWS::Serverless-2016-10-31
Description: Event Bridge -> API Gateway
Resources:
RestApiGateway:
Type: AWS::Serverless::Api
Properties:
StageName: Prod
@dabit3
dabit3 / reactstreaming.js
Last active November 10, 2022 04:46
React Streaming code from live broadcast
import React from 'react';
import logo from './logo.svg';
import './App.css';
import ReactPlayer from 'react-player'
import { HashRouter, Link, Switch, Route } from 'react-router-dom'
import AuthComponent from './AuthComponent'
import { Auth, API } from 'aws-amplify'
import { createComment as CreateComment } from './graphql/mutations'
import { listComments as ListComments } from './graphql/queries'
import { onCreateComment as OnCreateComment } from './graphql/subscriptions'