Skip to content

Commit 633d767

Browse files
committed
docs: clarify flat physical structure with tree logical structure for SDS protocols
1 parent 2171fb1 commit 633d767

File tree

1 file changed

+43
-6
lines changed

1 file changed

+43
-6
lines changed

AGENTS.md

Lines changed: 43 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -130,22 +130,58 @@ For defining domain protocol specifications:
130130

131131
**SDS supports recursive protocol hierarchy**:
132132

133+
**IMPORTANT**: Physical structure is **FLAT**, logical structure is **TREE**.
134+
135+
**Physical Structure** (flat directory layout):
136+
```bash
137+
specs/protocol/
138+
├── 001-order-protocol/ # All at same level
139+
├── 002-order-creation/
140+
├── 003-payment-processing/
141+
├── 013-credit-card-payment/ # Same level, not nested
142+
├── 014-digital-wallet-payment/
143+
└── 015-bank-transfer-payment/
144+
```
145+
146+
**Logical Structure** (tree via frontmatter):
133147
```
134148
001-order-protocol (root)
135149
├── 002-order-creation (leaf)
136150
├── 003-payment-processing (parent)
137-
├── 013-credit-card-payment (leaf)
138-
├── 014-digital-wallet-payment (leaf)
139-
└── 015-bank-transfer-payment (leaf)
151+
│ ├── 013-credit-card-payment (leaf)
152+
│ ├── 014-digital-wallet-payment (leaf)
153+
│ └── 015-bank-transfer-payment (leaf)
140154
└── 004-fulfillment (leaf)
141155
```
142156

157+
**Why flat physical structure?**
158+
- ✅ Simple paths: `specs/protocol/013-credit-card-payment/`
159+
- ✅ FEATURE independence: Each protocol is a standalone FEATURE
160+
- ✅ Flexible numbering: 003's children can be 013-015 (skip 004-012)
161+
- ✅ Git branch friendly: Branch name = directory name
162+
- ✅ Easy reorganization: Change parent in frontmatter, no file moves
163+
143164
**Key features**:
144165
- **Any protocol can be a parent**: If complex, run plan → tasks → implement to create sub-protocols
145166
- **Unlimited depth**: Sub-protocols can have their own sub-protocols
146167
- **Context tracking**: Via YAML frontmatter (protocol_id, parent, root, type)
147168
- **Unified commands**: Same commands work at all levels
148169

170+
**How relationships are maintained**:
171+
- **Physical**: All protocols are sibling directories under `specs/protocol/`
172+
- **Logical**: Parent-child relationships declared in YAML frontmatter
173+
```yaml
174+
---
175+
protocol_id: 013-credit-card-payment
176+
parent: 003-payment-processing # ← Declares logical parent
177+
root: 001-order-protocol
178+
type: leaf
179+
---
180+
```
181+
- **Parent → Child**: Parent's `spec.md` lists sub-protocols in "Sub-Specifications" table
182+
- **Child → Parent**: Child's `spec.md` shows "Parent chain" breadcrumb navigation
183+
- **Benefit**: Change relationships by editing frontmatter, no directory restructuring needed
184+
149185
**Example workflow** (Level 2 splitting):
150186
```bash
151187
# At root (001)
@@ -159,10 +195,11 @@ cd specs/protocol/003-payment-processing/
159195
/metaspec.sds.implement → Creates 013-015
160196
```
161197

162-
**Protocol relationships**:
163-
- **Parent → Child**: Parent's spec.md lists sub-protocols in "Sub-Specifications" section
198+
**Protocol relationships** (logical, not physical):
199+
- **Parent → Child**: Parent's `spec.md` lists sub-protocols in "Sub-Specifications" table
164200
- **Child → Parent**: Child's frontmatter declares `parent: {parent-id}`
165-
- **Parent chain**: Tracked in frontmatter and displayed as breadcrumb
201+
- **Parent chain**: Tracked in frontmatter, displayed as breadcrumb in child's `spec.md`
202+
- **All protocols are sibling directories**: Relationships exist in metadata, not file structure
166203

167204
**See [Recommended Practice: Two-Feature Architecture](#recommended-practice-two-feature-architecture) for protocol + toolkit separation.**
168205

0 commit comments

Comments
 (0)