Kian Kyars

Building a Regex Engine with a team of parallel Claudes

February 10, 2026

Inspired by Nicholas Carlini’s C compiler agent team experiment.

TL;DR

I tasked two Opus 4.6 agents to build a regex engine, then walked away. Here is the repo.

Over 14 Claude Code sessions, the agent team wrote ~1700 lines of code, and now I have a working Rust regex engine:

kian@Kian regex %   cargo run -- "a+b*" "xxaaabbbzz"
   Compiling regex-engine v0.1.0 (/Users/kian/Developer/regex)
    Finished `dev` profile [unoptimized + debuginfo] target(s) in 1.06s
     Running `target/debug/regex-engine 'a+b*' xxaaabbbzz`
MATCH:aaabbb

Setup

This experiment required three separate pieces:

  1. A remote which the agents could push to and build their work

  2. A server for running the agents on the cloned remote (the original experiment uses Docker containers; I do not)

  3. A third directory (which is my main contribution) called regex that with the harnessing not provided by the original post, namely:

Workflow

I ran two agents in parallel with a loop script.

Each agent loop does:

  1. Clone the repo into workspace-<agent_id> if not already.
  2. git pull --rebase origin main.
  3. Run Claude on yolo mode with the shared prompt.
  4. Append session output to per-agent log files.
  5. Sleep briefly and repeat.

Coordination primitives in the repo:

Analysis

Where the real work happened

The implementation progress came from a small number of successful sessions:

Coordination

Two things that helped

Replication

If you would like to replicate these results, it suffices to:

git clone git@github.com:kiankyars/parallel-ralph.git
mv parallel-ralph/regex .
# rm -rf parallel-ralph
chmod 700 regex/*.sh
./regex/launch_agents.sh 2

The above assumes you have the Claude Code CLI installed on your machine, along with screen and a few other standard Linux packages.

Future Work

Today I am building SQLite from scratch, but this time I’m going to use both Codex and Claude on the same project to see how heterogeneous agents interact with each other. I considered using a lock TTL (time to live) and automatic stale-lock cleanup to prevent agents from being blocked by abandoned lock files.

Multi-agent

I’m thinking of having specialized agent roles as well. Here is what Carlini did:

I tasked one agent with coalescing any duplicate code it found. I put another in charge of improving the performance of the compiler itself, and a third I made responsible for outputting efficient compiled code. I asked another agent to critique the design of the project from the perspective of a Rust developer, and make structural changes to the project to improve the overall code quality, and another to work on documentation.

Appendix

Code size

Agent sessions

Usage

Notes on the Anthropic approach

Citation

@misc{kyars2026regex,
  author = {Kian Kyars},
  title = {Building a Regex Engine with a team of parallel Claudes},
  year = {2026},
  month = feb,
  day = {10},
  howpublished = {\url{https://kiankyars.github.io/machine_learning/2026/02/10/regex.html}},
  note = {Blog post}
}