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.
Stage Command current.yml /reap.next
───────────── ─────────── ──────────
generate nonce ──────→ store hash(nonce)
return nonce to AI ←── AI passes nonce
verify hash(nonce)
✓ advance stageHow It Works
- Stage command (e.g. /reap.objective) generates a random nonce
- The nonce's SHA-256 hash is stored in current.yml
- The nonce is returned to the AI agent in the JSON response
- /reap.next receives the nonce, hashes it, and compares against current.yml
- Match → stage advances. Mismatch → rejected.
Prompt-Only vs Signature-Based
| Threat | Prompt-Only | Signature-Based |
|---|---|---|
| Skipping stages | Relies on AI compliance | Blocked — no valid nonce |
| Forging tokens | N/A | Infeasible — one-way hash |
| Replaying old nonces | N/A | Blocked — single-use, stage-bound |
| Prompt injection | Vulnerable | Nonce 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.
| Level | Input | Output | Trigger | Protection |
|---|---|---|---|---|
| Level 1 | Generation folder (5 artifacts) | gen-XXX-{hash}.md (40 lines) | lineage > 5,000 lines + 5+ generations | Recent 3 + DAG leaf nodes |
| Level 2 | 100+ Level 1 files | Single epoch.md | Level 1 files > 100 | Recent 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.
| Mode | Description |
|---|---|
| greenfield | Build a new project from scratch. Default mode. Genome starts empty and grows. |
| migration | Build anew while referencing an existing system. Genome is seeded with analysis of the existing system. |
| adoption | Apply REAP to an existing codebase. Genome starts from templates and is populated during the first generation's Learning stage. |
