Claude31
Claude31 is a small agentic coding harness for Windows 3.11. It contains an editor with syntax highlighting, a project tree and an agent that reads, writes, builds and runs C programs on your machine, talking to Anthropic’s Claude over TLS.
It is a 16-bit Windows program that runs both in x86 virtual machines and on actual x86 hardware. Here’s a demo:
This 1.44 MB floppy disk image holds the complete Claude31 source, but no executable; INSTALL.BAT builds it using the open source OpenWatcom toolchain (once you have installed it as described below).
Claude31 is free software released under the GNU GPL version 2.
Requirements
Software
- MS-DOS 6.22
- Windows for Workgroups 3.11, running in 386 enhanced mode
- Microsoft TCP/IP-32 for Windows for Workgroups (install via Network Setup > Network Drivers > Unlisted or Updated Protocol)
- OpenWatcom v2 (the open-watcom-v2 project on GitHub). Install to
C:\WATCOM - If installing on a virtual machine,
OAKCDROM.SYSmay be helpful to get the WATCOM installer into your environment via emulated CD-ROM drive. You can find this file on a Windows 98 boot disk.
Virtual Machine
Create an 86Box VM with the following settings:
- [1993] Socket 4, [i430LX] Intel Premiere/PCI, 32 MB RAM
- CPU: Intel Pentium OverDrive, 133 MHz, no Softfloat FPU
- Display: [ISA] Tseng Labs ET4000AX
- Input: PS/2 Keyboard, PS/2 Mouse
- Sound (optional): [ISA] Sound Blaster v1.0
- Network: [ISA] Novell NE2000, SLiRP mode
- Serial Port: COM1 on named pipe (if you want Claude31’s logs)
- Storage Controllers: skip
- Hard Disk: [Generic] RAM Disk, 504 MB (CHS: 1024, 16, 63), IDE
- Floppy drive: 1x 3.5" 1.44M
- CD-ROM Drive: ATAPI bus, 0:1 channel, 8x speed, 86Box 86B_CD 3.50
Bare Metal Hardware
Claude31 has been tested on the Asus Eee PC 4G Surf. It may run on other machines, but no promises. You will need to use the dd utility to create an MS-DOS boot disk on a USB stick, boot to that, and install MS-DOS 6.22. If the Eee previously ran Linux, you may also need to run FDISK /MBR to make the SSD bootable. Once MS-DOS 6.22 is installed, you can install Windows.
Note that the Eee PC’s BIOS treats any thumb drive you booted from as a floppy disk drive (A:), and any other disk attached at boot as an extra hard drive (D:). The SSD is your C: drive.
If using the Asus Eee PC, you will also need to download this driver to use the Ethernet adapter. When running Windows setup, tell Windows that you have an unlisted network card, and point it to this driver.
Install
- Install OpenWatcom. When you do, run a “Selective installation”, and under “Target operating systems” ensure both Windows 3.x and DOS targets are checked. Leave all other options at defaults.
- Put this disk in
A:(orD:) and, in File Manager, select the drive. - Double-click
INSTALL.BAT. INSTALL copies everything toC:\CLAUDE31, buildsCLAUDE31.EXEfrom source, and installs it. The build takes a few minutes emulated; it is much faster on the Eee’s Celeron-M. - Run
C:\CLAUDE31\CLAUDE31.EXE. On the first run it asks for your API key and COM port where it can dump its logs (the Eee PC has no COM port). Both settings go intoC:\CLAUDE31\HARNESS.INIand can be changed later via File > Setup.
How to Use
File > New Project...— type a full path, likeC:\PROJECTS\HELLO, and press OK. The folder is created, along with some project structure and a MAKEFILE that buildsSRC\HELLO.CtoBUILD\HELLO.EXE.File > Open Project...— open thePROJECT.C31file in any Claude31 project folder to open that project.
Enter a task in the bottom box and press Enter; for example:
Write a program that shows the time in a window. Build and run.
The log shows your prompts and the agent’s replies and tool use. Hitting the Escape key while in the task box stops a task. The agent can read, write, edit, list, delete and rename files in the project, run wmake or the compiler, and run a program. NOTE: It cannot see the screen, or for that matter anything the program prints! If your program crashes, or something looks weird, say so in the chat.
Each project keeps its ongoing conversation in a file, TRANS.TXT in the C31WORK directory. Claude > New transcript clears it. The transcript is how the agent knows what came before; you should clear it in between unrelated tasks.
If a file named AGENTS.TXT exists at the project root, its contents are handed to the agent at every turn, appended to the system prompt. This is useful for code conventions, specific hazards or guidelines, and project-specific quirks. Keep it short and sweet: a page of house rules, not an instruction manual. Hard cap at 4 KB; if the file is larger than that, the harness ignores it altogether, with a note in the log.
The editor saves files as UTF-8, which means you can write any language in your comments. Stick to ASCII though in any string literals; Windows 3.11 was unaware of UTF-8, so anything past the ~ symbol is likely to render as goofy. The diskette’s copy of GNU Unifont includes coverage for the Latin-1 range, punctuation, arrows, symbols and box drawing characters; anything else shows as a small tofu box. You can install a fuller version of Unifont with support for the full basic multilingual plane, plus Plane 1 — emoji! — via a supplementary diskette.
Having Claude31 Change Itself
The full source for Claude31 is installed in C:\CLAUDE31\SRC. Go to File > Open Project, open C:\CLAUDE31\PROJECT.C31 and ask for the change; the agent edits the source and builds two copies of the program: BUILD\CLAUDE31.EXE (which you can INSTALL over the existing CLAUDE31.EXE) and BUILD\C31_DEV.EXE (which the harness can run to preview changes). C31_DEV.EXE will open with no API key and the Setup dialog showing, since it will have no HARNESS.INI file available to it. This is expected. If you want to work with a project using your newly changed program:
- Quit Claude31.
- Open
C:\CLAUDE31in File Manager. - Double-click
INSTALL.BATto install the new build. The old executable will be backed up toCLAUDE31.BAK, in case you need to restore it.
Be liberal with the use of the Claude > New transcript action; the whole transcript is sent with each conversation turn, so when a task is done, clear it out so that the next task starts clean. A long transcript with cruft from a previous task makes the agent worse at the next one.
Settings (HARNESS.INI)
api
key- your API keymodel- defaultclaude-sonnet-5max_tokens- default 16000effort- choose from low, medium, high, xhigh, max
net
timeout- seconds before giving up, default 60keepalive- set to 1, this keeps the TLS session open between turns
agent
max_turnsper task (default 12, increase as needed)run_timeoutfor when you@@RUNthe program (default 10 s)
compile
watcom- path to the dev tools, default:C:\WATCOMtimeout- seconds to let a build run (default 180 s)
log
com- Set to mirror the log to a serial port, blank to disablebaud- baud for the serial portfile- when set to 1, also writesLOG.TXTbeside the programdiag- set to 1 to dump diagnostics to the chat as well asLOG.TXT
project
dir- the default project to open at start, set whenever you open a project
font
unifont- path toUNIFONT.U16for more Unicode coverage; default is fine
Security
Windows 3.11 did not ship with TLS. In fact, it didn’t even ship with TCP/IP! As such, it’s kind of a hack to get a Win16 app like this to talk to a modern API. But with Claude’s help, we got there:
- I’ve updated the wolfSSL Win16 port from dialup.net to do server certificate validation.
- Claude31 gathers entropy from keystrokes, mouse movements and other sources to ensure proper random number generation for session keys.
- The
ROOTS.PEMfile contains root certificates that can vouch forapi.anthropic.com.
Is this bulletproof? Oh my god no. It also requires having a computer powerful enough to do the encryption math before the connection times out, which means you’re never going to run this on an 80486. But a Pentium seems to cut it in emulation. And it’s downright trivial for a modern (read: 2007-era) Celeron M like the one in the Eee PC.
Your API key is still, of course, stored in plain text in HARNESS.INI, and you’re connecting an operating system that predates SSL to the Star Wars cantina that is The Internet, so, yeah. Point is, use an API key created just for this experiment, turn off auto-reload, and delete it when you’re done.
Source and License
- Claude31: GNU General Public License, version 2
WOLFSSL2.DLL: fork of wolfSSL 5.5.4, GNU General Public License, version 2. Source available here; upstream code hereUNIFONT.U16: GNU Unifont 17.0.05, SIL Open Font License version 1.1. Source available at unifoundry.com