Guide

Advanced

Signature-Based Locking

REAP uses a cryptographic nonce chain to enforce stage ordering. Without a valid nonce, the AI agent cannot advance to the next stage — even if it tries to skip ahead.

text
Stage Command          current.yml              /reap.next
─────────────          ───────────              ──────────
generate nonce ──────→ store hash(nonce)
return nonce to AI                         ←── AI passes nonce
                                               verify hash(nonce)
                                               ✓ advance stage

How It Works

  1. Stage command (e.g. /reap.objective) generates a random nonce
  2. The nonce's SHA-256 hash is stored in current.yml
  3. The nonce is returned to the AI agent in the JSON response
  4. /reap.next receives the nonce, hashes it, and compares against current.yml
  5. Match → stage advances. Mismatch → rejected.

Prompt-Only vs Signature-Based

ThreatPrompt-OnlySignature-Based
Skipping stagesRelies on AI complianceBlocked — no valid nonce
Forging tokensN/AInfeasible — one-way hash
Replaying old noncesN/ABlocked — single-use, stage-bound
Prompt injectionVulnerableNonce is external to prompt context

📄 Related Article: New workflow control method for harness engineering — Signature-Based Locking

Lineage Compression

As generations accumulate, lineage archives are automatically compressed during the Completion stage.

LevelInputOutputTriggerProtection
Level 1Generation folder (5 artifacts)gen-XXX-{hash}.md (40 lines)lineage > 5,000 lines + 5+ generationsRecent 3 + DAG leaf nodes
Level 2100+ Level 1 filesSingle epoch.mdLevel 1 files > 100Recent 9 + fork points

DAG preservation: Level 1 files retain metadata in frontmatter. Level 2 epoch.md stores a generations hash chain. Fork guard: all local/remote branches are scanned before Level 2 compression — fork points are protected. Epoch-compressed generations cannot be used as merge bases.

Entry Modes

Specified with reap init --mode. Controls how the Genome is initially structured.

ModeDescription
greenfieldBuild a new project from scratch. Default mode. Genome starts empty and grows.
migrationBuild anew while referencing an existing system. Genome is seeded with analysis of the existing system.
adoptionApply REAP to an existing codebase. Genome starts from templates and is populated during the first generation's Learning stage.