AoAH Day 1: Building a Base32 Crockford library in OCaml / Dec 2025

Let's start day 1 of the Advent of Agentic Humps with a gentle introduction to agentic coding. Firstly, I've chosen to exclusively use Claude Code for this since it's CLI driven. I tried some of the other Copilot and Cursor IDEs, but I just couldn't adjust to how busy the displays were.

With Claude, my setup first involved a custom devcontainer using Docker on a Linux host, and my local Mac laptop. I coordinate both of these via Git repositories hosted up at Tangled with a self-hosted knot.

Remote sandboxed Docker devcontainer

I setup a remote Docker container on a Linux host where I can leave the agent running unattended in a sandbox. I coded up a custom Claude devcontainer for this which takes care of firewalling the agent at the DNS level and installing relevant OCaml packages.

With this setup, I can run claude --dangerously-skip-permissions and have it only access my repositories on Tangled and GitHub.

As a bit of fun, the wrapper slopper script to start the session passes the session shell output back to Claude afterwards, to give it an opportunity to rewrite the Dockerfile with additional libraries I installed. It's shaky, but it occasionally does something useful.

The Claude devcontainer works great with tmux and Docker sandboxing
The Claude devcontainer works great with tmux and Docker sandboxing

Local development

On my Mac and Linux desktops, I just use Claude code directly with my usual vi-based OCaml coding setup. This is just a straightforward addition to my usual workflow with Claude running in a terminal.

The only major change is that I assume that all code generated is slop by default, and is so until "promoted" via review and manual editing to the next level. I therefore stage all my work-in-progress slop code in a dedicate slop repository which I'll reset and delete regularly. This is a convenient way of doing coordination, nothing more.

Getting started with the first library: Crockford base32

Problem. I've integrated my blog with Rogue Scholar but the mechanism for doing so required generating Base32 encoded random DOIs for the Rogue Scholar DOI assigner to pick up from my blog feed. There is no existing Base32 library in OCaml, so let's make one.

Approach. I looked over at the spec, and also (with permission from Martin Fenner) at his reference Go implementation on GitHub. I then instructed Claude to synthesise a spec from the online spec and the Go implementation, and used Sonnet 4.5 to come up with a plan. I then instructed it to write the OCaml implementation as a single module with no dependencies other than the stdlib. I then separately had a session to take just the OCaml interface file and synthesise alcotest-based checks from the spec, to act as test cases.

Results. The crockford code is up with online docs. I assigned co-copyright to Front Matter due to cross-generating the code with their implemenation as a reference. Unsure if this is the right thing to do, but it seems better to be generous about copyright assignment in this case.

Reflections. This is a pretty simple day 1 task, as it's a single module of OCaml and relatively easy to test. Still, I had to be careful to not just generate the tests in the same session as the code to ensure that the agent didn't just specialise the tests to the code it had written.

Onto Day 2 then, where we'll build a more substantive JSONfeed library!


Loading recent items...