Skip to content

About

A human powered ruby VM

Resources

Stars

0 stars

Watchers

0 watching

Forks

Repository files navigation

human-ruby

Ruby is fast. Mass produced. Impersonal. What if it wasn't? What if we could return to a simpler time, when every computation was handcrafted by a real human being?

A Ruby VM where the CPU is you.

the vm is made of people

the vm is people!

human-ruby compiles your Ruby program to "bytecode" in a spreadsheet format designed to be run by people.

It is based on the mruby bytecode (actually uses the mrbc compiler).

It supports

  • running the program locally using Excel.
  • using a cloud-provided human processing unit (Amazon MTurk).
  • It also has an auto mode to simulate a human running the program.

This was built for a talk at RubyConf 2026.

How it works

  1. mrbc (mruby's compiler) parses your Ruby and emits bytecode.
  2. The bytecode is broken down into sub-steps and compiled into a spreadsheet.
  3. The operator executes the program by walking the steps.
  4. The CLI watches the file and acts as the program's stdio.

Setup

You need:

  • Ruby 3.4 (see .ruby-version)
  • Python 3 with openpyxl (used to render the spreadsheet. Will eventually be ported to Ruby and merged into the bin.)
  • mruby, built from source, at ./mruby (a symlink works too) — tested against mruby master (4.0.0 development)
  • A spreadsheet app — Excel or LibreOffice, anything that opens .xlsx and saves it back.
git clone git@github.com:JoeDupuis/human-ruby.git
cd human-ruby
git clone https://github.com/mruby/mruby.git
(cd mruby && rake)      # builds mruby/bin/mrbc
bundle install
pip3 install openpyxl   # skip if your python already has it

If you use devenv, devenv shell provides Ruby and Python (with openpyxl) for you — you still build mruby yourself.

Running locally

human-ruby mirrors ruby:

bin/human-ruby examples/while_loop.rb

This compiles the program, generates while_loop.xlsx, opens it in your spreadsheet app, and starts watching the file. Execute the program by following the workbook's steps.

Useful flags:

Flag What it does
-o FILE output path (default ./<name>.xlsx)
--no-open don't launch the spreadsheet app
--inputs a,b,c provide ARGV
--keep-values regenerate without losing the cells you already filled
-v, --verbose print the workbook path and streaming status

To only generate the workbook — for handing to someone else — use compile:

bin/human-ruby compile examples/fact.rb -o fact.xlsx

Running in auto mode (--auto)

Simulates the human: an executor drives LibreOffice headlessly. Useful for verifying a workbook actually runs to completion. Requires LibreOffice.

bin/human-ruby run examples/fact.rb --auto
Flag What it does
--auto-trace stream the per-tick trace to stderr
--auto-max-steps N bail out after N ticks (headless tests, infinite loops)

Running on Mechanical Turk (--mturk)

Provision a human processing unit from the cloud. Biological serverless compute.

You need:

  • AWS credentials for an account registered as an MTurk Sandbox requester. Put them in a named profile and pass --aws-profile.
  • A Microsoft account with OneDrive — the workbook is hosted there so the worker can run it in Excel for the web. The first run walks you through a device-code login and caches the token. Google Sheets is not yet supported.
bin/human-ruby run examples/bump.rb --mturk --aws-profile mturk --verbose

What happens: the workbook is uploaded to OneDrive (folder set by --mturk-folder, default human-ruby), shared through an anonymous edit link, and posted as a HIT on the worker sandbox. The run ends when they reach the exit code. If a worker abandons or breaks a segment, it's re-posted for a fresh worker (--max-attempts-per-segment). Every segment's filled sheet is archived under traces/.

Knobs you'll want:

Flag What it does
--segment-steps N fence long programs into ~N-step segments, each posted as its own paid HIT (default: auto-sized from the hourly rate so each HIT stays under MTurk's $10 cap)
--hourly-rate DOLLARS pay rate used to price each HIT (default 17.00)
--max-spend DOLLARS / --max-hits N pause and ask before blowing the budget
--hit-timeout SECONDS post a backup worker if a HIT sits unanswered
--resume RUN_ID pick an interrupted run back up from its last checkpoint

There are many more flags — run bin/human-ruby --help for the full list.

To clean the sandbox account between experiments (stale HITs also make the worker preview page show old content), flush everything:

bin/human-ruby mturk-flush --aws-profile mturk

It expires every HIT, approves any submitted assignments, and deletes them; HITs a worker still holds are reported as skipped (exit code 1) — rerun once they're abandoned.

What Ruby works?

It's real mruby bytecode underneath, and the workbook renderer covers essentially the whole mruby instruction set: integers, strings, arrays, hashes, ranges, if/while/until, method definitions, classes, instance/global/class variables, blocks, exceptions, puts/gets. Core methods like Array#each and Integer#times aren't faked — their genuine mruby bytecode is stitched into the workbook and the operator steps through them too.

Certain choices to keep the VM simple to run, especially around cell types (integer vs string), have been taken that could result in bugs or different behavior vs mruby.

Development

bundle exec rake test        # fast structural suite (~1m)
bundle exec rake test:all    # everything, parallel

The mruby source in ./mruby doubles as the reference for opcode semantics — the point of the project is that the human VM follows it faithfully.

About

A human powered ruby VM

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages