{"slug": "clawdos-an-ai-coding-agent-for-dos", "title": "ClawDOS – An AI coding agent for DOS", "summary": "A developer built ClawDOS, an AI coding agent harness that runs natively on an IBM PC XT — an 8088 at 4.77 MHz with 640K of RAM and a CGA card — with 100% of the repository written by Claude. The 176 KB HARNESS.EXE speaks the Claude Messages API directly, writing requests, parsing streamed replies, running tools and keeping conversations on disk, while a separate bridge PC handles TLS; in one demo, a request to write, compile and run a primes program returned its answer 64 seconds after Enter, 26 of them spent compiling, linking and running. The project also produced a WarGames tribute of five Turbo C files, 15 KB of source and a WG.EXE under 10 KB, with a timer-interrupt hook capturing 320x200 four-colour CGA screenshots as 16 KB PNGs for the agent to inspect.", "body_md": "**An AI coding agent for DOS.**\n\n  It runs on an IBM PC XT: an 8088 at 4.77 MHz, 640K of RAM, a CGA card.\n\n**A (real) human’s note:**\n\n**Backstory:** The IBM PC was my first computer. Rather, it was my parents’ first personal computer that I got to use at a very early age.\n\nIt was already obsolete by the time I was old enough to use it, but at 5 years old it was a magical device that I could make do different things depending on what I typed.\n\nI learned how to type and use DOS so that I could launch some early “Learn the Alphabet” games that my mom had bought me. I learned some elementary-level use of BASIC, but at the time that didn’t progress much further than making some number guessing games and other small projects.\n\nFrom there, many years passed but I still have some of the original parts of that PC. I have a collection of vintage machines that mean something to me, with my fully maxed-out IBM PC 5160 being the centerpiece of my collection. It still has a working 20 MB hard drive, but that’s disconnected in favor of a PicoMEM that lets me emulate a hard drive off of an SD card, making experimentation and play much easier.\n\n**Old, meet new. New, meet old:** I love intersections of old and new technology. What better way to cross the two than building an AI coding agent to run on DOS on original hardware?\n\nAnd of course, what better to build it than an AI coding agent?\n\nI (read: Claude) built this for my own entertainment. I wanted to see how far I could push an AI coding agent to build something given out of the (modern) norm of constraints. Also, can that something it built then build other somethings? 100% of this repo is written by Claude, with the exception of the text within this box.\n\nAs explained in more detail below, the harness runs on the native OS and hardware and relies on a “bridge” PC in order to handle TLS, which would’ve been more than what an 8088 could handle.\n\nType `CLAWDOS` at the `C:\\>` prompt and talk to Claude. It reads and edits the\nfiles on your disk, writes programs, compiles them with Turbo C, runs them and\nlooks at what they draw on the screen. It keeps notes between conversations and\npicks up where it left off.\n\nThe whole harness runs on the PC. `HARNESS.EXE` is a 176 KB DOS program that\nspeaks the Claude Messages API itself: it writes the requests, parses the\nstreamed reply, runs the tools and keeps every conversation on its own disk.\nThe 8088 does everything but TLS.\n\nEvery screen below comes from a 5160 at 4.77 MHz, emulated in 86Box. The conversations are with the live API.\n\nOne message: *“Write PRIMES.C: print the primes below 100. Compile it with\nTurbo C and run it.”* ClawDOS reads its guide to the compilers on this machine,\nwrites the source, then compiles, links and runs it in a single tool call. The\nanswer is on the screen 64 seconds after Enter, 26 of them spent compiling,\nlinking and running.\n\nThe compiler gets the machine to itself. For a build, ClawDOS saves its state and leaves memory, Turbo C runs with about 450K free, and the harness comes back on the same conversation with the program’s output in hand.\n\nClawDOS wrote this tribute to the 1983 film on the PC itself: a vector world\nmap, missiles arcing over the pole, a tic-tac-toe endgame, and a score for the\nPC speaker or an AdLib card. Five files of Turbo C, 15 KB of source, a\n`WG.EXE` under 10 KB.\n\nHere it is running on the real 5160, filmed off its IBM monitor:\n\n[▶ Watch the WarGames demo on YouTube](https://www.youtube.com/watch?v=Jok7MQi-16Q)\n\nStart a new conversation and “your WarGames demo” is all it needs. ClawDOS\nopens the note it saved in `C:\\MEMORY`, finds the latest build, and recalls\nthe palette trick the war scene plays on the CGA.\n\nThat `Run` call asked for a screenshot 25 seconds in. A timer-interrupt hook\ncopies the CGA’s video memory at that moment, the 8088 encodes it as a PNG, and\nthe picture goes to Claude with the tool result. This is the file the PC made,\n320x200 in four colours, 16 KB:\n\nAnd this is what Claude made of it:\n\nAsked to make the demo exit on its own, ClawDOS goes looking. It searches the sources for the keyboard wait, reads the file, says what it found and edits one line. Each tool call shows in the transcript with its result, and between them Claude says what it is about to do.\n\nText art in sixteen colours, straight into the transcript, and music on the PC\nspeaker in GW-BASIC’s `PLAY` language.\n\n**A chat screen built for the CGA.** Replies stream onto the screen as they\narrive, word-wrapped at 80 columns in code page 437. Writes are timed to the\nretrace, so there is no snow. The transcript scrolls in hardware through the\nCRTC start address, with PgUp and PgDn to go back. The spinner and its seconds\nrun from the timer interrupt and keep moving while the PC is busy.\n\n**Eighteen tools.** Claude works on the machine through these:\n\n| Tools | What they do | \n|---|---|\n| `sysinfo` ,`dir` ,`read` ,`search` | Look at the system, list directories, read files as text or hex, find text across files | \n| `write` ,`edit` ,`delete` ,`mkdir` ,`rename` | Create and change files; `edit` replaces one piece of a file in place | \n| `run` | Run DOS programs and batch files and read back what they printed, up to twelve commands in a call, with a screenshot on request | \n| `peek` ,`poke` ,`port` | Read and write memory and I/O ports | \n| `play` ,`textart` | PC speaker music and coloured CP437 art | \n| `memory_list` ,`memory_read` ,`memory_write` | Its own notes, kept in `C:\\MEMORY` | \n\n**A development kit on the disk.** Two assemblers (TINYASM and WASM),\nBruce’s C, GW-BASIC and the lDebug debugger, plus Turbo C 2.0, installed from\nyour own floppy images in `external/`. All of them are proven on the 8088, and\nClawDOS knows how to drive each one.\n\n**Memories and skills.** Memories are what ClawDOS learns on your PC: what you\nbuilt together, what worked, what you like. Skills are guides that ship with\nit, such as the dev tools and CGA demo effects. Both are plain text files on\nthe disk, listed in every conversation’s system prompt and read when they fit\nthe task. F4 browses the memories:\n\n**Safe mode.** On by default. Anything that changes a file, memory or a port\nasks `Allow ...? (y/n)` first. F3 turns it off.\n\n**Conversations that last.** Every chat is a file on the disk in the API’s own\nmessage format. F6 lists them, Enter reopens one, and your next message\ncarries it on. A chat cut off by the power switch reopens too.\n\n**Any model, mid-conversation.** `/model` lists the providers in\n`CLAWDOS.CFG` and switches between them and their models without losing the\nconversation. F5 sets how hard Claude thinks, from low to max. Any host that\nspeaks the Messages API works.\n\n**Easy on a slow link.** The system prompt and tools are cached by the API.\nAfter a conversation’s first request the PC uploads only what is new, so a tool\nresult goes up in about 500 bytes. A dropped connection or an overloaded API\nis retried, and the turn carries on.\n\n**A flight recorder.** `CLAWDOS.LOG` has a line for every round: time to first\ntoken, upload size and time, tokens in and out, cache reads.\n\n```\napi anthropic claude-opus-5-5 round=1 ttft=2750 total=4015 up=165 len=1784 stop=tool_use in=2 out=221 cr=5543 cw=739 th=cont\nrelaunch: program 61.5 s, CLAWDOS away 82.3 s\nflowchart LR\n    subgraph DOS[\"IBM PC XT (8088, 640K, CGA)\"]\n        direction TB\n        subgraph APP[\"HARNESS.EXE\"]\n            direction TB\n            UI[\"Chat screen\"]\n            LOOP[\"Agent loop<br/>Messages API requests, SSE and JSON,<br/>history on disk\"]\n            TOOLS[\"Tools<br/>files, search, DOS programs, screenshots,<br/>memory and ports, speaker\"]\n        end\n        NET[\"mTCP + packet driver\"]\n        APP <--> NET\n    end\n\n    TUNNEL[\"TLS tunnel<br/>copies bytes\"]\n    API[\"Claude Messages API\"]\n\n    NET <-->|\"plain HTTP\"| TUNNEL\n    TUNNEL <-->|\"HTTPS\"| API\n```\n\n| **Machine** | IBM PC XT 5160: 8088 at 4.77 MHz, 640K, CGA. A PicoMEM card supplies the disk (an image on microSD), WiFi as an NE2000, EMS and a battery clock | \n| **Code** | 13,000 lines of C and C++, built with Open Watcom for the 8086 instruction set | \n| **Programs** | `HARNESS.EXE` , 176 KB, the whole harness.`CLAWDOS.EXE` , 29 KB, the launcher you type | \n| **System** | FreeDOS 1.4 with mTCP for TCP/IP | \n| **API** | The Claude Messages API, streamed: tool use, images, prompt caching, message threads | \n| **TLS** | A tunnel on another machine, `tunnel/tunnel.py` ,`socat` or`stunnel` . It copies bytes between a plain port and`api.anthropic.com:443` . It can also hold the API key, so the key never touches the PC’s disk | \n| **Memory** | A program ClawDOS runs gets 200K beside the harness, or 450K when the harness steps out | \n| **Tests** | 31 boot tests in DOSBox-X against a mock API, unit tests that run on DOS, and runs on 86Box’s 8088 | \n\n[docs/API.md](http://ricapar.net/ClawDOS/docs/API.html) has exactly what ClawDOS sends and what it expects back.\n\nYou need a Mac or a Windows PC with Python 3, and an Anthropic API key. On\nWindows the command is `python`.\n\n```\npython3 scripts/setup-tools.py          # fetch the compilers, FreeDOS, mTCP and the emulators\necho ANTHROPIC_API_KEY=sk-ant-... > .env\npython3 scripts/build.py                # build/CLAWDOS.IMG, a bootable disk\npython3 tunnel/tunnel.py                # the TLS tunnel, on port 8443\npython3 scripts/run86box.py             # boot an IBM PC XT\n```\n\nAt the `C:\\>` prompt, type `CLAWDOS`.\n\nNo key? `python3 tunnel/mockapi.py` plays the API offline: type\n`CLAWDOS 10.0.2.2:18023` and send `!help`.\n\n**On a real PC:** build with the address of the machine running the tunnel\n(`python3 scripts/build.py --tunnel 192.168.1.10:8443`), copy `CLAWDOS.IMG` to\nthe PicoMEM’s microSD card, pick it as the hard disk in the PicoMEM’s menu,\nboot, and type `CLAWDOS`. Later builds update the card’s image in place and\nkeep its memories and chats\n(`python3 scripts/build.py --update /path/to/CLAWDOS.IMG`).\n\n| Key |  | \n|---|---|\n| Enter | Send | \n| Esc | Stop a reply, or clear the input | \n| Up / Down | Recall earlier messages | \n| PgUp / PgDn | Scroll back | \n| F1 | Help | \n| F2 | New chat | \n| F3 | Safe mode on or off | \n| F4 | Memories | \n| F5 | Effort: low, medium, high, xhigh, max | \n| F6 | Earlier chats | \n| F10 | Quit | \n\n`/model`, `/chats`, `/memories`, `/new` and `/quit` work from the input box.\n`CLAWDOS -m \"...\"` sends a message from the command line and `-c NAME` reopens\na chat.\n\n| [docs/MANUAL.md](http://ricapar.net/ClawDOS/docs/MANUAL.html) | Setup in full, real hardware, the image updater, other providers, every setting | \n| [docs/API.md](http://ricapar.net/ClawDOS/docs/API.html) | What ClawDOS sends to the API and expects back | \n| [docs/ROADMAP.md](http://ricapar.net/ClawDOS/docs/ROADMAP.html) | The plan, the benchmark and the memory map | \n\n| Path | What | \n|---|---|\n| `src/harness/` | HARNESS.EXE: the chat screen, the turn, the tools | \n| `src/clawdos/` | CLAWDOS.EXE, the launcher | \n| `lib/` | The pieces: screen, console, network and HTTP, the API request writer and stream parser, JSON, history, the tool executors, screenshots and the PNG encoder | \n| `tunnel/` | The TLS tunnel and the mock Messages API | \n| `image/` | What goes on the disk: the manifest, the system prompt, the tool schemas, the skills, the tests | \n| `scripts/` | Build, disk image tools, the emulator runners and test harnesses | \n| `tests/unit/` | DOSUNIT.EXE, the unit tests that run on DOS | \n\nClawDOS is free software under the GNU General Public License, version 3 or (at your option)\nany later version: see [LICENSE](https://github.com/Ricapar/ClawDOS/blob/main/LICENSE). HARNESS.EXE links mTCP, which is GPLv3. The FreeDOS\nboot sector in `src/boot/freedos` is vendored unmodified under its own GPLv2-or-later license\n(its `COPYING`). Disk images you build hold other people’s software (FreeDOS, mTCP, and Turbo C\nfrom your own floppies): don’t redistribute an image with Turbo C on it.\n\nClawDOS stands on [mTCP](http://www.brutman.com/mTCP/), [FreeDOS](https://www.freedos.org/),\n[Open Watcom](https://github.com/open-watcom/open-watcom-v2), the\n[PicoMEM](https://github.com/FreddyVRetro/ISA-PicoMEM), [86Box](https://86box.net/) and\n[DOSBox-X](https://dosbox-x.com/).", "url": "https://wpnews.pro/news/clawdos-an-ai-coding-agent-for-dos", "canonical_source": "http://ricapar.net/ClawDOS/", "published_at": "2026-11-21 05:38:01+00:00", "updated_at": "2026-11-21 06:42:55.180560+00:00", "lang": "en", "topics": ["ai-agents", "ai-tools", "developer-tools", "large-language-models"], "entities": ["ClawDOS", "Claude", "IBM PC XT", "IBM PC 5160", "Turbo C", "HARNESS.EXE", "86Box", "Anthropic"], "also_reported_by": [], "takeaway": "Running the agent harness natively on the 8088 and offloading only TLS to a bridge PC let ClawDOS compile and run a Turbo C program in a single tool call, with the answer on screen 64 seconds after Enter.", "recommendation": {"advice": "Keep the agent harness on the target machine and offload only what the hardware cannot do — here TLS — to a bridge PC, saving state so compilers get ~450K free memory and returning output to the same conversation.", "playbook": "agent-architecture", "playbook_url": "https://wpnews.pro/playbooks/agent-architecture"}, "alternates": {"html": "https://wpnews.pro/news/clawdos-an-ai-coding-agent-for-dos", "markdown": "https://wpnews.pro/news/clawdos-an-ai-coding-agent-for-dos.md", "text": "https://wpnews.pro/news/clawdos-an-ai-coding-agent-for-dos.txt", "jsonld": "https://wpnews.pro/news/clawdos-an-ai-coding-agent-for-dos.jsonld"}}