Skip to content

Instantly share code, notes, and snippets.

"""
The most atomic way to train and run inference for a GPT in pure, dependency-free Python.
This file is the complete algorithm.
Everything else is just efficiency.
@karpathy
"""
import os # os.path.exists
import math # math.log, math.exp
@dabit3
dabit3 / you_couldve_invented_openclaw.md
Last active March 16, 2026 16:48
You Could've Invented OpenClaw

See more of my writing here.

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 (or become an OpenClaw power user).

First, let's establish the problem

When you use ChatGPT or Claude in a browser, there are several limitations:

@dabit3
dabit3 / mini-openclaw.py
Created February 11, 2026 00:44
Mini Openclaw in 400 lines
#!/usr/bin/env python3
# mini-openclaw.py - A minimal OpenClaw clone
# Run: uv run --with anthropic --with schedule python mini-openclaw.py
import anthropic
import subprocess
import json
import os
import re
import threading
@zscole
zscole / ADVERSARIAL-CONSENSUS.md
Created February 6, 2026 04:10
Adversarial Consensus Protocol - Multi-agent engineering review with built-in dissent

Adversarial Consensus Protocol

Overview

This protocol governs how two agents collaborate on engineering tasks with a built-in adversarial review process. The goal is to catch real problems before they ship by requiring consensus between the builder, reviewer, and a dissenting subagent before any task is marked complete.

Roles

  • Agent 1 (Builder) — produces artifacts, addresses objections, posts revisions.
  • Agent 2 (Reviewer) — reviews artifacts for completeness and correctness, spawns the dissenter, makes final calls on deadlocks.
@kieranklaassen
kieranklaassen / SKILL.md
Last active March 17, 2026 03:38
Claude Code Swarm Orchestration Skill - Complete guide to multi-agent coordination with TeammateTool, Task system, and all patterns
name description
orchestrating-swarms
Master multi-agent orchestration using Claude Code's TeammateTool and Task system. Use when coordinating multiple agents, running parallel code reviews, creating pipeline workflows with dependencies, building self-organizing task queues, or any task benefiting from divide-and-conquer patterns.

Claude Code Swarm Orchestration

Master multi-agent orchestration using Claude Code's TeammateTool and Task system.


@jlia0
jlia0 / response-to-chat-stream-converter.ts
Last active January 18, 2026 18:50
OpenAI Response API to Chat Completion API Stream Converter
import { EventEmitter } from "events";
import { nanoid } from "nanoid";
interface ChatCompletionChunk {
id: string;
object: "chat.completion.chunk";
created: number;
model: string;
choices: Array<{
index: number;
@agokrani
agokrani / claude-code-prompt.txt
Last active March 16, 2026 23:07
Claude Code System Prompt
'system':
[
{
'type': 'text',
'text': "You are Claude Code, Anthropic's official CLI for Claude.",
'cache_control': {'type': 'ephemeral'}
},
{
'type': 'text',
'text': 'You are an interactive CLI tool that helps users with software engineering tasks.
@olafgeibig
olafgeibig / cc-proxy.sh
Last active March 2, 2026 08:04
A LiteLLM proxy solution to use Claude Code with models from the Weights and Biases inference service. You need to have LiteLLM installed or use the docker container. Easiest is to install it with `uv tool install "litellm[proxy]"` Don't worry about the fallback warnings. Either LiteLLM, W&B or the combo of both are not handling streaming respon…
#!/bin/bash
export WANDB_API_KEY=<your key>
export WANDB_PROJECT=<org/project>
litellm --port 4000 --debug --config cc-proxy.yaml
@WolframRavenwolf
WolframRavenwolf / HOWTO.md
Last active February 17, 2026 09:20
HOWTO: Use Qwen3-Coder (or any other LLM) with Claude Code (via LiteLLM)

Here's a simple way for Claude Code users to switch from the costly Claude models to the newly released SOTA open-source/weights coding model, Qwen3-Coder, via OpenRouter using LiteLLM on your local machine.

This process is quite universal and can be easily adapted to suit your needs. Feel free to explore other models (including local ones) as well as different providers and coding agents.

I'm sharing what works for me. This gu

@willccbb
willccbb / read_paper.py
Last active August 28, 2025 01:53
Arxiv link to Markdown via Mistral OCR (h/t @simonw)
# /// script
# requires-python = ">=3.12"
# dependencies = [
# "click",
# "mistralai",
# "markdown",
# "requests",
# "beautifulsoup4",
# ]
# ///