whatisgithub

What is smallest-agent?

obra/smallest-agent — explained in plain English

Analysis updated 2026-05-18

103ShellAudience · developerComplexity · 2/5Setup · easy

In one sentence

An experiment testing how small a working AI coding agent can be, shrunk down to a 493 byte JavaScript file with unrestricted shell access.

Mindmap

mindmap
  root((smallest-agent))
    What it does
      Minimal AI coding agent
      493 byte JS file
    Tech stack
      JavaScript
      Shell
      Terser
    Process
      Built from larger agent
      Shrunk with Claude
    Risks
      Unrestricted shell access
      Can delete files
    Purpose
      Technical curiosity
      Not production tool

Code map

Detail Auto

An interactive map of this repo's files and how they connect — its source is parsed live in your browser. Click Visualize to build it.

filefunction / class

What do people build with it?

USE CASE 1

See how minimal an AI agent loop can be written in JavaScript.

USE CASE 2

Study the readable, commented version to understand the tiny agent's logic.

USE CASE 3

Use it as a teaching example of code minification with terser.

What is it built with?

JavaScriptShellTerser

How does it compare?

obra/smallest-agentzzzhhh1/mg-koyebhypnguyen1209/offensive-claude
Stars103105106
LanguageShellShellShell
Setup difficultyeasymoderateeasy
Complexity2/52/53/5
Audiencedeveloperdeveloperdeveloper

Figures from each repo's GitHub metadata at analysis time.

How do you get it running?

Difficulty · easy Time to first run · 5min

The agent can run any shell command on your machine, including destructive ones, so use with caution.

So what is it?

This project is an experiment to see how small a working AI coding agent can be made. The author started with a larger version roughly equivalent to Claude Code, then used Claude itself to shrink the code repeatedly over about 20 minutes until almost nothing was left. The result is a JavaScript file that is 493 bytes, which is very small for a working program. A separate commented version of the same file exists with cleaner variable names so it is easier to read and understand what the tiny version is doing. A tool called terser is used to compress the readable version down into the minimal final file. The agent connects to a live AI API and can execute shell commands on your computer. The README includes a smoke test that sends a greeting, runs a command to generate a unique identifier, and tries a command that is expected to fail, to verify basic operation. The README includes a prominent warning that the agent has unrestricted access to run any shell command on your system. It can read files, write files, install software, or delete things. The warning is written bluntly: it might decide to erase all your files. This project is meant as a technical curiosity and demonstration, not a production tool to use without caution.

Copy-paste prompts

Prompt 1
Walk me through how this 493 byte agent connects to an AI API and runs shell commands.
Prompt 2
Show me how terser compresses the readable version into the minimal file.
Prompt 3
Help me trace through the commented version to understand each line's purpose.

Frequently asked questions

What is smallest-agent?

An experiment testing how small a working AI coding agent can be, shrunk down to a 493 byte JavaScript file with unrestricted shell access.

What language is smallest-agent written in?

Mainly Shell. The stack also includes JavaScript, Shell, Terser.

How hard is smallest-agent to set up?

Setup difficulty is rated easy, with roughly 5min to a first successful run.

Who is smallest-agent for?

Mainly developer.

Open on GitHub → Ask about another repo

This repo across BitVibe Labs

Verify against the repo before relying on details.