Chain-of-thought folds

Each reasoning step folds one idea into the next. Real attempts define which folds are likely; a Markov chain Monte Carlo sampler then explores every chain of thought the agent could take, the way origami configuration spaces are sampled.

Fold graph

current samplereal attempt #6never observed
start → read_file P = 0.256 · sampled 0.0%start → run_shell P = 0.488 · sampled 0.0%start → think P = 0.140 · sampled 0.0%edit_file → run_shell P = 0.684 · sampled 0.0%edit_file → verify P = 0.158 · sampled 0.0%read_file → observe P = 0.816 · sampled 0.0%run_shell → observe P = 0.879 · sampled 0.0%observe → edit_file P = 0.239 · sampled 0.0%observe → read_file P = 0.182 · sampled 0.0%observe → think P = 0.239 · sampled 0.0%observe → verify P = 0.239 · sampled 0.0%observe → ✓ pass P = 0.068 · sampled 0.0%think → edit_file P = 0.333 · sampled 0.0%think → read_file P = 0.182 · sampled 0.0%think → run_shell P = 0.182 · sampled 0.0%think → verify P = 0.182 · sampled 0.0%verify → ✓ pass P = 0.421 · sampled 0.0%verify → ✗ fail P = 0.421 · sampled 0.0%startstart visited in 0% of samplesedit_fileact:edit_file visited in 0% of samplesread_fileact:read_file visited in 0% of samplesrun_shellact:run_shell visited in 0% of samplesobserveobserve visited in 0% of samplesthinkthink visited in 0% of samplesverifyverify visited in 0% of samples✓ passpass visited in 0% of samples✗ failfail visited in 0% of samples

Folded chains

Current MCMC sample· 9 folds · total surprise 8.2
fold 0run_shell0.72 nats
fold 1observe0.13 nats
fold 2read_file1.70 nats
fold 3observe0.20 nats
fold 4read_file1.70 nats
fold 5observe0.20 nats
fold 6think1.43 nats
fold 7verify1.70 nats
fold 8✗ fail0.44 nats
Real attempt #6 (failed)· 9 folds · total surprise 8.2
fold 0run_shell0.72 nats
fold 1observe0.13 nats
fold 2read_file1.70 nats
fold 3observe0.20 nats
fold 4read_file1.70 nats
fold 5observe0.20 nats
fold 6think1.43 nats
fold 7verify1.70 nats
fold 8✗ fail0.44 nats

Crease angle = surprise of that fold (−log P). Sharp creases are unusual jumps from one idea to the next; mountain and valley folds alternate, keeping the strip flat.

Most visited chains

Run the sampler to estimate which chains of thought dominate.

How it works

  • States are kinds of steps: think, act with a tool, observe a result, get verified.
  • Folds are transitions between them, with probabilities learned from the 7 real attempts (smoothed, so unseen folds stay possible).
  • Energy of a chain = total surprise of its folds, plus β if it ends in failure. Chains are sampled with probability ∝ e−E/T.
  • Metropolis–Hastings proposes refolding, inserting or removing a step, or flipping the outcome, and accepts with probability min(1, e−ΔE/T × proposal ratio).
  • Inspired by Hikaru Kuribayashi's MCMC sampling of origami and linkage configuration spaces (Regeneron ISEF 2026).