whatisgithub

What is kernel-rsi?

byin-cwi/kernel-rsi — explained in plain English

Analysis updated 2026-05-18

0LeanAudience · researcherComplexity · 5/5Setup · hard

In one sentence

An experiment where an AI agent rewrites its own proof-generating code to certify ever-larger prime numbers, verified step by step by the Lean theorem prover.

Mindmap

mindmap
  root((kernel-rsi))
    What it does
      AI rewrites its own proof code
      Certifies bigger primes each round
      Checked by Lean kernel
    Tech stack
      Lean
      Python
      Lean 4 kernel
    Use cases
      Study AI self improvement
      Compare LLM vs random mutation
      Reproduce prime experiment
    Audience
      Researchers
      AI safety enthusiasts

Code map

Detail Auto

An interactive map of this repo's files and how they connect — its source is parsed live in your browser. Click Visualize to build it.

filefunction / class

What do people build with it?

USE CASE 1

Study whether AI self-improvement claims hold up under a rigorous, unforgeable verifier

USE CASE 2

Compare an LLM-driven code rewriting loop against random parameter mutation

USE CASE 3

Learn how a formal kernel can ground an AI agent's claims of progress

USE CASE 4

Reproduce the prime certification experiment with a different proposer model

What is it built with?

LeanPythonLean 4 kernel

How does it compare?

byin-cwi/kernel-rsitrailofbits/scroll-fvtripp-smith/lean-lfse
Stars00
LanguageLeanLeanLean
Last pushed2026-05-14
MaintenanceMaintained
Setup difficultyhardhardmoderate
Complexity5/55/54/5
Audienceresearcherresearcherdeveloper

Figures from each repo's GitHub metadata at analysis time.

How do you get it running?

Difficulty · hard Time to first run · 1h+

Requires Lean 4 (pure core, no mathlib) plus the Claude Code CLI for the AI-driven condition.

No license information was found in the README.

So what is it?

Kernel rsi is an experiment that tests whether an AI coding agent can improve its own code in a way that is actually verified as correct, rather than just claiming to improve. The project asks an AI agent to write a small Python program that proves a number is a prime number, with the proof checked by a separate tool called the Lean kernel. The agent is then allowed to rewrite its own program over and over, each time trying to prove a bigger prime number. The key idea is that nothing here can be faked. Every proof the agent produces is independently rechecked by the Lean kernel, a program that either accepts a proof as valid or rejects it, with no partial credit and no shortcuts allowed. If the agent tries to cheat, its score simply becomes zero. This is different from many AI self improvement experiments, where success is judged by a fixed benchmark score that can sometimes be gamed. Here the target, the digit count of a certified prime, has no upper limit, so there is nothing for the agent to memorize in advance. The experiment compared two approaches over 15 rounds. One let an AI agent read its own code and rewrite it to fix problems it found, and the other made small random changes to settings without any AI involved. Starting from a program that could certify a 128 digit prime, the AI powered version worked its way up to a 4096 digit prime, while the random mutation approach got stuck at 256 digits because it hit a structural limitation in the code that no simple setting could fix. The AI noticed the underlying code problem, rewrote it using a more efficient method, and kept improving from there. The project requires Python and Lean 4, plus the Claude Code command line tool to run the AI powered condition. It includes scripts to verify the checking system itself is trustworthy, run either experimental condition, and regenerate the result charts. The repository is written mostly in Lean and currently has no stars on GitHub. It offers a plain look at how the two conditions behaved round by round, plus an explicit account of what the results do and do not prove about AI self improvement.

Copy-paste prompts

Prompt 1
Explain how the Lean kernel verifies a primality proof in this project
Prompt 2
Walk me through what happens in a single round of the meta_loop.py hill-climb
Prompt 3
Show me the code changes the LLM proposer made to go from 256 to 4096 digits
Prompt 4
Help me run the random mutation control condition for kernel-rsi

Frequently asked questions

What is kernel-rsi?

An experiment where an AI agent rewrites its own proof-generating code to certify ever-larger prime numbers, verified step by step by the Lean theorem prover.

What language is kernel-rsi written in?

Mainly Lean. The stack also includes Lean, Python, Lean 4 kernel.

What license does kernel-rsi use?

No license information was found in the README.

How hard is kernel-rsi to set up?

Setup difficulty is rated hard, with roughly 1h+ to a first successful run.

Who is kernel-rsi for?

Mainly researcher.

Open on GitHub → Ask about another repo

This repo across BitVibe Labs

Verify against the repo before relying on details.