π§± The Lego Story
How Atomic thinks about your codeβand why it changes everything
The Photo Album Problemβ
Imagine you're building an elaborate Lego spaceship with your friends. You want to track every change so you can go back in time, share your work, and collaborate without stepping on each other's bricks.
Traditional version control (like Git) works like a photo album.
Every time someone makes a change, Git takes a photograph of the entire spaceship. Want to see what changed? Compare two photos pixel by pixel. Want to merge two people's work? Overlay the photos and hope the differences don't clash.
πΈ Photo 1 πΈ Photo 2 πΈ "What changed?"
βββββββββββ βββββββββββ
β π΄ β β π΄ β "Hmm, comparing
β π’ β β β π‘ β β millions of pixels...
β π΅ β β π’ β something moved?"
βββββββββββ β π΅ β
βββββββββββ
This works, but it has problems:
- Comparing photos is expensive β especially for large projects
- Photos don't understand structure β they just see pixels (text lines)
- Merging is guesswork β when two photos differ, Git tries to blend them like Photoshop
The Atomic Way: Smart Bricksβ
Atomic doesn't take photos. Instead, each Lego brick knows its neighbors.
When you snap a brick into place, it remembers:
- What's above me? (
up_context) - What's below me? (
down_context)
βββββββββββββββββββββββββββββββββββββββββββββββ
β β
β π΄ "I'm connected to the base plate" β
β β β
β βΌ β
β π’ "π΄ is above me, π΅ is below me" β
β β β
β βΌ β
β π΅ "π’ is above me" β
β β
βββββββββββββββββββββββββββββββββββββββββββββββ
The structure understands itself. No photos needed.
Adding a Brick: The Magic of Contextβ
When you want to add a new yellow brick between the red and green ones, you don't update a photo. You simply declare:
"This yellow brick connects below π΄ and above π’"
Before After
π΄ π΄
β β
βΌ βΌ
π’ β π‘ β NEW! "I go between π΄ and π’"
β β
βΌ βΌ
π΅ π’
β
βΌ
π΅
Atomic records this as a change with context:
NewVertex {
up_context: [π΄], // "I connect below the red brick"
down_context: [π’], // "I connect above the green brick"
content: π‘ // "I am the yellow brick"
}
The existing bricks don't need to change. The structure naturally relinks.
Removing a Brick: Ghost Connectionsβ
What happens when you remove a brick? In Git, the photo just shows it's gone. In Atomic, something more elegant happens.
When you remove the green brick, Atomic doesn't just delete it. It creates a "ghost edge" β a memory that something used to be there.
Before After
π΄ π΄
β β
βΌ β
π’ β Β·Β·Β· (ghost: π’ was here)
β β
βΌ βΌ
π΅ π΅
Why does this matter?
- You can always undo β the connection history is preserved
- Merges understand deletions β if Alice deletes π’ while Bob modifies it, Atomic knows exactly what happened
- No orphaned changes β everything maintains its context
The Merge Magic: Structural Conflictsβ
Here's where Atomic truly shines.
Scenario: Alice and Bob both want to add a brick between π΄ and π’.
What Git Does (Photo Comparison)β
Git compares photos and sees two different images. It tries to guess how to blend them:
Alice's Photo Bob's Photo Git's Confusion
π΄ π΄ "Two different photos...
β β let me try to merge
βΌ βΌ the pixels...
π‘ π£
β β CONFLICT! Which color
βΌ βΌ goes where?!"
π’ π’
Git sees text that differs and tries to interleave lines. Sometimes it works. Sometimes you get a jumbled mess of conflict markers.
What Atomic Does (Graph Structure)β
Atomic doesn't compare photos. It looks at what each person declared:
Alice's Change: Bob's Change:
NewVertex { NewVertex {
up_context: [π΄], up_context: [π΄],
down_context: [π’], down_context: [π’],
content: π‘ content: π£
} }
Both changes say: "I belong between π΄ and π’."
Atomic recognizes this as a structural conflict β not a text-munging problem:
π΄
β
ββββββββ¬βββββββ
β β β
βΌ βΌ β
π‘ ββ π£ β "Both claim the same spot.
β β β User decides the order."
ββββββββ΄βββββββ
β
βΌ
π’
The conflict is explicit and structural. You're not deciphering garbled text β you're deciding: "Should Alice's brick or Bob's brick come first?"
Why Order Doesn't Matter: Commutativityβ
Here's the mathematical magic of Atomic.
In Git, the order you receive changes matters:
- Apply Alice's change, then Bob's β might get one result
- Apply Bob's change, then Alice's β might get a different result (or conflict!)
In Atomic, order doesn't matter:
- Apply Alice's change, then Bob's β same graph
- Apply Bob's change, then Alice's β same graph
Alice first, then Bob: Bob first, then Alice:
π΄ π΄
β β
βββββββββ βββββββββ
βΌ βΌ βΌ βΌ
π‘ π£ === π‘ π£
β β β β
βββββ¬ββββ βββββ¬ββββ
β β
βΌ βΌ
π’ π’
IDENTICAL RESULT!
This is called commutativity β the order of operations doesn't change the outcome. It's why Atomic can handle 100+ AI agents making changes simultaneously without chaos.
From Bricks to Codeβ
Let's translate the Lego analogy back to real code:
| Lego Concept | Code Equivalent |
|---|---|
| A brick | A line (or chunk) of code |
Brick above (up_context) | The line(s) before this one |
Brick below (down_context) | The line(s) after this one |
| Adding a brick | Inserting new code |
| Removing a brick | Deleting code (with ghost edges) |
| Two bricks claiming same spot | Two people editing the same location |
When you write this code:
function greet(name) {
console.log("Hello, " + name);
}
Atomic doesn't snapshot the file. It records:
Line 1: "function greet(name) {"
up_context: [start of file]
down_context: [line 2]
Line 2: " console.log("Hello, " + name);"
up_context: [line 1]
down_context: [line 3]
Line 3: "}"
up_context: [line 2]
down_context: [end of file]
Each line knows its neighbors. The structure is the truth.
The Big Pictureβ
| Traditional VCS (Git) | Atomic |
|---|---|
| πΈ Takes photos (snapshots) | π Tracks connections (graph) |
| π Compares pixels (text diff) | π§ Understands structure (context) |
| π² Guesses merges (heuristics) | β Knows exactly what happened |
| β οΈ Order-dependent operations | βΎοΈ Commutative operations |
| π° Conflict markers in text | π― Structural conflict resolution |
Try It Yourselfβ
Ready to experience the difference? The best way to understand Atomic is to use it:
# Create a new repository
atomic init my-project
cd my-project
# Create a file
echo "Hello World" > greeting.txt
# Add and record
atomic add greeting.txt
atomic record -m "Add greeting"
# See the graph structure
atomic log --graph
When you make your first merge with Atomic, you'll feel the difference. No more deciphering <<<<<<< conflict markers. Just clear, structural understanding of what changed.
Summaryβ
π§± Traditional VCS: Takes photos, compares pixels, guesses at merges
π Atomic: Each piece knows its neighbors, structure is explicit, merges are mathematical
The Lego analogy captures Atomic's core insight: code isn't just text to be photographedβit's a structure to be understood. By tracking connections instead of snapshots, Atomic transforms version control from pixel-comparison guesswork into graph-based certainty.