Virtual Working Copies
Status: π Investigating
Proposed: December 2025
Overviewβ
Virtual working copies are a key innovation in Atomic VCS that enable massive AI agent parallelism. Instead of requiring disk-based working directories for each agent, sessions maintain in-memory virtual working copies that track only diffs, not full file copies.
What It Isβ
A virtual working copy is an in-memory data structure that tracks file modifications without materializing them on disk.
Session {
pristine_state: HashMap<Path, FileState>, // Files from parent changes
virtual_edits: HashMap<Path, Vec<Edit>>, // Agent's modifications (diffs only)
change_builder: ChangeRecord, // Change being constructed
}
How It Worksβ
Traditional VCS (Git)β
Agent β Write files to disk β Git reads files β Computes diffs β Creates commit
πΎ Disk I/O πΎ Disk I/O
Virtual Working Copy (Atomic Sessions)β
Agent β API call β Session computes diff in memory β Creates change
π§ Memory only
Key Operationsβ
Write Fileβ
session.write_file("users.rs", new_content)
What happens internally:
- Load pristine state (what file looks like in parent changes) - lazy
- Compute diff between pristine and new content - in memory
- Add diff hunks to change record - only store diffs
- Update virtual edits for subsequent reads - keep minimal state
Read Fileβ
content = session.read_file("config.toml")
What happens internally:
- Check virtual_edits first (did agent already modify this?)
- If yes: return the modified content
- If no: load from pristine state (parent changes)
Commitβ
change_hash = session.commit()
What happens internally:
- Finalize change record with all accumulated hunks
- Write ONE change file to
.atomic/changes/ - Dispose of session memory
The "Aha!" Momentβ
Without Virtual Working Copiesβ
100 agents working simultaneously:
βββ Agent 1: /tmp/workspace-1/ (500MB on disk)
βββ Agent 2: /tmp/workspace-2/ (500MB on disk)
βββ ...
βββ Agent 100: /tmp/workspace-100/ (500MB on disk)
Total: 50GB disk space
Coordination: Filesystem locks, merge conflicts
Cleanup: Delete 100 directories
With Virtual Working Copiesβ
100 agents working simultaneously:
βββ Agent 1: session_1 (5MB in RAM - diffs only)
βββ Agent 2: session_2 (5MB in RAM - diffs only)
βββ ...
βββ Agent 100: session_100 (5MB in RAM - diffs only)
Total: 500MB RAM (100Γ smaller!)
Coordination: Zero (isolated memory sessions)
Cleanup: Free memory (instant)
Not Like Git Stashesβ
| Feature | Git Stash | Virtual Working Copy |
|---|---|---|
| Storage location | .git/ on disk | Process memory |
| Requires working copy | Yes | No |
| Purpose | Temporary storage for humans | Execution environment for agents |
| Scalability | One per developer | Thousands per system |
| Isolation | None (shared working copy) | Complete (separate memory space) |
The Database Analogyβ
Git is like editing database files directly:
Edit users.db file β Database reads file β Computes changes
Atomic sessions are like SQL:
INSERT INTO users (name, email) VALUES ('Alice', 'alice@example.com');
-- The SQL statement IS the change description
-- No need to materialize rows in files first
Similarly, session API calls are the change description:
session.write_file("users.rs", content) # Like SQL INSERT
# The API call IS the transformation
# No need to materialize files on disk first
Memory Efficiencyβ
What's NOT Storedβ
- β Full file contents for all files
- β Complete working copy tree
- β Unchanged files
What IS Storedβ
- β Diffs (hunks) only
- β Files that were actually modified
- β Lazy-loaded pristine state (only when needed)
Example:
- Repository: 10,000 files, 500MB total
- Agent modifies: 50 files, adds 1000 lines
- Session memory: ~5MB (just the diffs!)
Lazy Loadingβ
Sessions load pristine state on demand:
# Create session - loads NOTHING
session = atomic.session.create()
# Read file - loads ONLY this file's pristine state
config = session.read_file("config.toml") # ~10KB loaded
# Write new file - NO pristine needed
session.write_file("feature.rs", code) # 0KB pristine loaded
# Write to 50 files - loads ONLY those 50 files' pristine
for file in changes:
session.write_file(file.path, file.content) # ~500KB total loaded
# Commit - memory usage minimal throughout
session.commit()
Real-World Example: Kira Specβ
Scenarioβ
Generate 1000 lines of code across 50 files
Git Approachβ
# Must materialize full working copy
os.makedirs("agent-workspace-12345")
for file in spec_output:
write_file(f"workspace/{file.path}", file.content) # πΎ 50 disk writes
git.add("*") # πΎ Git reads all 50 files back
git.commit() # Creates commit from computed diffs
shutil.rmtree("agent-workspace-12345") # Cleanup
# Total disk I/O: 100+ operations
# Disk space during: ~20MB
Session Approachβ
# No working copy needed
session = atomic.session.create() # π§ 0KB memory
for file in spec_output:
# Loads pristine (if exists), computes diff, stores hunk
session.write_file(file.path, file.content) # π§ ~5MB memory total
session.commit() # πΎ ONE disk write (change file)
# Total disk I/O: 1 operation
# Memory during: ~5MB
Benefit: 100Γ less I/O, 4Γ less memory, instant cleanup
When to Use Virtual Working Copiesβ
β Perfect Forβ
- Headless agents (CI bots, code generators)
- Multi-agent swarms (100+ agents in parallel)
- Spec executors (Kira, automated refactoring)
- Memory-constrained environments
- High-throughput change generation
β οΈ Less Relevant Forβ
- IDE-based agents (already have working copy)
- Single human developer workflows
- Interactive file editing
Key Takeawayβ
Virtual working copies make Atomic the first VCS where changes are first-class operations, not artifacts computed from file diffs. This enables AI agents to work at unprecedented scale without the filesystem bottlenecks of traditional VCS.
The paradigm shift:
- Git: Files β Diffs β Commits (state-based)
- Atomic: Operations β Changes (transformation-based)
Sessions let agents speak the transformation language natively, without the overhead of state materialization.
For Investorsβ
Virtual working copies represent a fundamental architectural innovation that enables:
- 100Γ Cost Reduction: 100 agents require 500MB RAM vs 50GB disk space (Git approach)
- Massive Scalability: Support 1000+ concurrent AI agents on commodity hardware
- Zero Coordination Overhead: Each session isolated in memory, no filesystem conflicts
- Instant Provisioning/Cleanup: Memory allocation/deallocation vs directory creation/deletion
This is not an incremental improvementβit's the infrastructure for AI-native development at scale. As AI-generated code becomes the majority of code written, traditional VCS becomes the bottleneck. Virtual working copies eliminate that bottleneck.
Market Impact: Every AI coding platform (GitHub Copilot, Cursor, Devin, etc.) currently fights the filesystem coordination problem. Virtual working copies make that problem obsolete.