Collaboration

Merge Generation

Need User Feedback

When diverged branches need to be merged, REAP runs a specialized 6-stage lifecycle called Merge Generation — separate from the normal generation lifecycle. The core principle: align the genome first, then merge source code.

Why is Merge Generation different from a regular git merge?

A regular git merge only resolves source code conflicts. But when two branches evolve independently — each with their own generations, genome changes, and design decisions — merging source code alone isn't enough. The genome (architecture principles, conventions, constraints, business rules) may have diverged too. Merge Generation adds three critical steps before the source merge: detecting genome divergence, mating (resolving genome conflicts), and verifying genome-source consistency after the merge. This ensures that the merged codebase isn't just compile-clean, but also design-consistent.

Regular git merge

Source conflicts → resolve → commit. Design consistency is not checked. Semantic conflicts go undetected.

Merge Generation

Genome align first → source merge guided by genome → verify genome-source consistency → validate → commit. Invisible semantic conflicts are caught.

Why genome alignment comes first

Resolving source code conflicts does not guarantee the absence of semantic conflicts. Two pieces of code can merge cleanly — no git conflicts at all — yet contradict each other in intent, architecture, or business logic. Only genome-based reasoning can detect these invisible conflicts: does the merged code still follow the architecture principles? Are the conventions consistent? Do the business rules align? This is why REAP aligns the genome before touching source code. Once the genome is settled, it becomes the authoritative guide for resolving source conflicts — not just syntactically, but semantically.

Stage Order

StageWhat happensArtifact
DetectScan the target branch via git refs. Find the common ancestor using DAG BFS. Extract genome diffs. Classify conflicts as WRITE-WRITE or CROSS-FILE.01-detect.md
MatePresent all genome conflicts to the human. For WRITE-WRITE: choose A, B, or merge manually. For CROSS-FILE: check logical compatibility. The genome must be fully resolved before proceeding.02-mate.md
MergeRun git merge --no-commit with the target branch. Resolve any source conflicts guided by the finalized genome. Check for semantic conflicts — code that compiles but contradicts the genome.03-merge.md
ReconcileVerify genome-source consistency after merge. AI compares genome and source code. User confirms any inconsistencies found. If issues exist, regress to Merge or Mate.04-reconcile.md
ValidationRun all mechanical testing commands (test, lint, build, type check). If any fail, regress to Merge or Mate.05-validation.md
CompletionCommit the merged result. Record the merge in meta.yml with type: merge and both parents. Archive to lineage.06-completion.md

Conflict Types

TypeDescriptionResolution
WRITE-WRITESame genome file modified on both branchesHuman decides: keep A, keep B, or merge
CROSS-FILEDifferent genome files modified, but both branches changed genomeHuman reviews for logical compatibility
Source conflictGit merge conflict in source codeResolved guided by finalized genome
Semantic conflictCode merges cleanly but contradicts the genome (architecture, conventions, business rules)Detected in Reconcile stage — AI compares genome and source, user confirms resolution
No conflictNo genome or source conflictsProceeds automatically

Merge Regression

Validation or Reconcile failure can regress to Merge or Mate. Merge can regress to Mate if a genome issue is discovered. Regression rules follow the same pattern as normal generations — reason recorded in timeline and artifact.

current.yml Structure (Merge)