Skip to content

Instantly share code, notes, and snippets.

@gwthompson
gwthompson / you_couldve_invented_openclaw.md
Created February 11, 2026 21:22 — forked from dabit3/you_couldve_invented_openclaw.md
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

@gwthompson
gwthompson / Example Output.md
Created May 2, 2022 20:42 — forked from jglev/Example Output.md
Use Obsidian Notes' Templater Plugin (https://github.com/SilentVoid13/Templater) to add links to GitHub Issues from specific public or private repositories using a searchable prompt

Screenshot of suggester prompt

Resulting output:

[`octocat/Hello-World #1053`](https://github.com/octocat/Hello-World/issues/1053)
@gwthompson
gwthompson / Today's Pollen Count.js
Created May 30, 2021 14:33 — forked from simonbs/Today's Pollen Count.js
Shows the current pollen counts. Pulls data from a Danish provider and only works in Denmark.
// Variables used by Scriptable.
// These must be at the very top of the file. Do not edit.
// icon-color: deep-green; icon-glyph: sun;
const STATION_VIBORG = "49"
const STATION_CPH = "48"
const GRASS_ID = "28"
const PREVIEW_WIDGET = false
// Pass your station ID here. See the constants above.
@gwthompson
gwthompson / circuitpyton_disable_usb_boot.py
Created May 18, 2021 03:23 — forked from todbot/circuitpyton_disable_usb_boot.py
Disable USB devices in CircuitPython in boot.py
# circuitpython_disable_usb_boot.py
# Turn on/off certain USB features based on touching RX & TX pins
# Squeeze TX & RX pins with fingers to enable CIRCUITPY & REPL
# Otherwise, they are turned off
# CircuitPython 7.x only
# Rename this as "boot.py" in your CIRCUITPY drive on a QT PY
# @todbot 17 May 2021
import time
import board
@gwthompson
gwthompson / code.py
Created May 16, 2021 22:49 — forked from elementc/code.py
serial byte read on keybow2040
import math
import board
from keybow2040 import Keybow2040, number_to_xy, hsv_to_rgb
import usb_cdc
# Some constants
FULLBRIGHT = 1
MINBRIGHT = 0.05
# Set up Keybow
@gwthompson
gwthompson / trinkey_theramin_code.py
Created May 2, 2021 01:11 — forked from todbot/trinkey_theramin_code.py
Trinkey MIDI Theramin (will also work on any other CircuitPyton devices with `touchio`)
# Trinkey Theramin!
# 2021 @todbot
#
import time
import board
import neopixel
import touchio
import usb_midi
import adafruit_midi
from adafruit_midi.note_on import NoteOn
@gwthompson
gwthompson / code.py
Created April 30, 2021 13:08
Keybow RP2040 Moode player control deck with rainbow lights
# SPDX-FileCopyrightText: 2021 Sandy Macdonald
#
# SPDX-License-Identifier: MIT
# Adaptation from Sandy MacDonald Examples
# A simple example of how to set up a keymap and HID keyboard on Keybow 2040.
# You'll need to connect Keybow 2040 to a computer, as you would with a regular
# USB keyboard.
# Drop the keybow2040.py file into your `lib` folder on your `CIRCUITPY` drive.
@gwthompson
gwthompson / trinkey_dance_code.py
Created April 29, 2021 22:35 — forked from todbot/trinkey_dance_code.py
Trinkey Dance Party : fun pulsing colors for NeoTrinkey
# Trinkey dance party
# 2021 @todbot
import time
import board
import neopixel
import random
leds = neopixel.NeoPixel(board.NEOPIXEL, 4, brightness=0.3, auto_write=False)
bpm = 130
ms_per_beat = int(60e3 / bpm / 16)
i=0
@gwthompson
gwthompson / applescript_from_mac.py
Created April 19, 2021 03:57 — forked from peter-jung/applescript_from_mac.py
How to call an Applescript from Python on Mac?
import subprocess, sys
applescript='''
tell application "System Events"
set processName to name of processes whose frontmost is true
do shell script "echo " & processName
end tell
'''
args = [item for x in [("-e",l.strip()) for l in applescript.split('\n') if l.strip() != ''] for item in x]
proc = subprocess.Popen(["osascript"] + args ,stdout=subprocess.PIPE )
progname = proc.stdout.read().strip()
const YOUTUBE_API = "https://youtube.googleapis.com/youtube/v3"
const API_KEY = "YOUR_KEY_HERE"
const channelIdArray = [
"UCT6iAerLNE-0J1S_E97UAuQ", // YongYea
"UC9PBzalIcEQCsiIkq36PyUA", // Digital Foundry
"UCoTIpyf8_RGzJ1LPTmvadaA", // CENTRAL
"UCNvzD7Z-g64bPXxGzaQaa4g", // gameranx
"UCcGL_0yoZTskvlgAixaEjEg", // whatoplay
"UCawsJGDMV6IOm6z9yiOyIsQ", // Cronosfera
"UC-zfTtp6tir7yJIrpsgS0dA", // Intoxi Anime