Skip to content

Commit 8130fa6

Browse files
author
yifanxuaaa
committed
docs: clarify LayerStack mental model
1 parent d2b3ab4 commit 8130fa6

1 file changed

Lines changed: 42 additions & 6 deletions

File tree

‎README.md‎

Lines changed: 42 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ Traditional copies of an agent workspace duplicate unchanged bytes and directory
3838

3939
## Core model
4040

41-
A single local SQLite **Store** contains durable history and canonical objects. A **Workspace** is an ephemeral projection of one branch that can be executed, committed, discarded, and ended explicitly.
41+
A single local SQLite **Store** contains durable history and canonical objects. A **LayerStack** is an ordered history of immutable **Layers**, with the newest Layer at the top and the genesis Layer at the bottom. Each Layer can fork multiple **Branches**; each Branch can create multiple ephemeral **Workspaces**. A Workspace can be committed back to its Branch, and the Branch head can then be added as a new Layer on the LayerStack.
4242

4343
| Concept | Lifetime | Role |
4444
| --- | --- | --- |
@@ -49,15 +49,51 @@ A single local SQLite **Store** contains durable history and canonical objects.
4949
| **Workspace** | Ephemeral | A private copy-on-write working environment projected onto a host directory or through container FUSE. |
5050
| **Client** | Process-bound | Binds one Store, one monitor, and one workspace manager. |
5151

52-
The normal lifecycle is:
52+
The mental model is:
5353

5454
```text
55-
LayerStack → Branch → Workspace → Execute → Commit or discard → End
56-
│
57-
└──────────────→ Add branch head as a new Layer
55+
LayerStack
56+
newest Layer at the top
57+
oldest at bottom
58+
59+
┌────────────────────────┐
60+
│ L2 │
61+
│ from Branch D @ D2 │
62+
├────────────────────────┤
63+
│ L1 │
64+
│ from Branch B @ B2 │
65+
├────────────────────────┤
66+
│ L0 genesis │
67+
└────────────────────────┘
68+
69+
L2 ──┬── fork ──▶ Branch E ──┬── create ──▶ Workspace E1
70+
│ └── create ──▶ Workspace E2
71+
│
72+
└── fork ──▶ Branch F ──┬── create ──▶ Workspace F1
73+
└── create ──▶ Workspace F2
74+
75+
L1 ──┬── fork ──▶ Branch C ──┬── create ──▶ Workspace C1
76+
│ └── create ──▶ Workspace C2
77+
│
78+
└── fork ──▶ Branch D ──┬── create ──▶ Workspace D1
79+
└── create ──▶ Workspace D2
80+
│
81+
└── commit ──▶ Commit D2
82+
│
83+
└── Add ──▶ L2
84+
85+
L0 ──┬── fork ──▶ Branch A ──┬── create ──▶ Workspace A1
86+
│ └── create ──▶ Workspace A2
87+
│
88+
└── fork ──▶ Branch B ──┬── create ──▶ Workspace B1
89+
└── create ──▶ Workspace B2
90+
│
91+
└── commit ──▶ Commit B2
92+
│
93+
└── Add ──▶ L1
5894
```
5995

60-
Each `workspace exec` starts a fresh process. `commit` publishes the current state to the branch; `end` removes the ephemeral projection and never commits implicitly.
96+
A LayerStack is the durable sequence; Branches are lines of work rooted at a Layer; Workspaces are disposable executions created from a Branch. `commit` publishes a Workspace’s changes to its Branch, while `Add` promotes the Branch head into a new immutable Layer. Each `workspace exec` starts a fresh process, and `end` removes the ephemeral projection without committing implicitly.
6197

6298
## Quickstart
6399

0 commit comments

Comments
 (0)