agile-context-engineering 0.2.2 → 0.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +82 -0
- package/LICENSE +51 -51
- package/README.md +324 -323
- package/agents/ace-research-synthesizer.md +228 -228
- package/agents/ace-technical-application-architect.md +28 -0
- package/agents/ace-wiki-mapper.md +445 -334
- package/agile-context-engineering/src/ace-tools.test.js +1089 -1089
- package/agile-context-engineering/templates/_command.md +53 -53
- package/agile-context-engineering/templates/_workflow.xml +16 -16
- package/agile-context-engineering/templates/product/product-backlog.xml +231 -231
- package/agile-context-engineering/templates/product/story-integration-solution.xml +1 -0
- package/agile-context-engineering/templates/product/story-wiki.xml +4 -0
- package/agile-context-engineering/templates/wiki/coding-standards.xml +38 -0
- package/agile-context-engineering/templates/wiki/decizions.xml +115 -115
- package/agile-context-engineering/templates/wiki/guide.xml +137 -137
- package/agile-context-engineering/templates/wiki/module-discovery.xml +174 -174
- package/agile-context-engineering/templates/wiki/pattern.xml +159 -159
- package/agile-context-engineering/templates/wiki/system-architecture.xml +254 -254
- package/agile-context-engineering/templates/wiki/system-cross-cutting.xml +197 -197
- package/agile-context-engineering/templates/wiki/system.xml +381 -381
- package/agile-context-engineering/templates/wiki/walkthrough.xml +255 -0
- package/agile-context-engineering/templates/wiki/wiki-readme.xml +297 -276
- package/agile-context-engineering/utils/questioning.xml +110 -110
- package/agile-context-engineering/workflows/execute-story.xml +1219 -1145
- package/agile-context-engineering/workflows/help.xml +540 -540
- package/agile-context-engineering/workflows/init-coding-standards.xml +386 -386
- package/agile-context-engineering/workflows/map-story.xml +1046 -797
- package/agile-context-engineering/workflows/map-subsystem.xml +2 -1
- package/agile-context-engineering/workflows/map-walkthrough.xml +457 -0
- package/agile-context-engineering/workflows/plan-feature.xml +1495 -1495
- package/agile-context-engineering/workflows/plan-story.xml +36 -1
- package/agile-context-engineering/workflows/research-integration-solution.xml +1 -0
- package/agile-context-engineering/workflows/research-story-wiki.xml +2 -1
- package/agile-context-engineering/workflows/research-technical-solution.xml +1 -0
- package/agile-context-engineering/workflows/review-story.xml +281 -281
- package/agile-context-engineering/workflows/update.xml +238 -207
- package/bin/install.js +8 -0
- package/commands/ace/execute-story.md +1 -0
- package/commands/ace/help.md +93 -93
- package/commands/ace/init-coding-standards.md +83 -83
- package/commands/ace/map-story.md +165 -156
- package/commands/ace/map-subsystem.md +140 -138
- package/commands/ace/map-system.md +92 -92
- package/commands/ace/map-walkthrough.md +127 -0
- package/commands/ace/plan-feature.md +89 -89
- package/commands/ace/plan-story.md +15 -1
- package/commands/ace/review-story.md +109 -109
- package/commands/ace/update.md +56 -54
- package/hooks/ace-check-update.js +62 -62
- package/hooks/ace-statusline.js +89 -89
- package/package.json +4 -3
|
@@ -1,254 +1,254 @@
|
|
|
1
|
-
<system-architecture>
|
|
2
|
-
<purpose>
|
|
3
|
-
Template for `.docs/wiki/system-wide/system-architecture.md` — the living high-level
|
|
4
|
-
architecture document. Captures L1/L2 views (C4 model), core runtime flows, and tech stack.
|
|
5
|
-
|
|
6
|
-
Complements per-subsystem docs (which cover L3 Component and L4 Code levels).
|
|
7
|
-
Complements STRUCTURE.md (which shows physical file/folder layout).
|
|
8
|
-
|
|
9
|
-
A "subsystem" is any cohesive code unit with a clear responsibility boundary —
|
|
10
|
-
whether deployed as a microservice, a monolith module, or a library package.
|
|
11
|
-
</purpose>
|
|
12
|
-
|
|
13
|
-
<template>
|
|
14
|
-
<system-overview>
|
|
15
|
-
## System Overview
|
|
16
|
-
|
|
17
|
-
[2-3 sentences. What does this system do and who uses it? Product language, not jargon.
|
|
18
|
-
This orients the reader before they look at any diagrams.]
|
|
19
|
-
</system-overview>
|
|
20
|
-
|
|
21
|
-
<c4-l1-system-context>
|
|
22
|
-
<diagram lang="mermaid" type="C4Context">
|
|
23
|
-
## L1: System Context
|
|
24
|
-
|
|
25
|
-
```mermaid
|
|
26
|
-
C4Context
|
|
27
|
-
title System Context - [System Name]
|
|
28
|
-
|
|
29
|
-
Person(user1, "[Primary User Role]", "[What they do with the system]")
|
|
30
|
-
Person(user2, "[Secondary User Role]", "[What they do]")
|
|
31
|
-
|
|
32
|
-
System(system, "[System Name]", "[Core purpose - one line]")
|
|
33
|
-
|
|
34
|
-
System_Ext(ext1, "[External System 1]", "[What it provides/consumes]")
|
|
35
|
-
System_Ext(ext2, "[External System 2]", "[What it provides/consumes]")
|
|
36
|
-
|
|
37
|
-
Rel(user1, system, "[Uses]", "[HTTPS/WebSocket]")
|
|
38
|
-
Rel(system, ext1, "[Fetches/Sends]", "[REST/WebSocket]")
|
|
39
|
-
Rel(ext2, system, "[Pushes]", "[Protocol]")
|
|
40
|
-
```
|
|
41
|
-
</diagram>
|
|
42
|
-
|
|
43
|
-
<external-integrations-overview>
|
|
44
|
-
### External Integrations
|
|
45
|
-
|
|
46
|
-
| External System | Direction | What Flows | Protocol |
|
|
47
|
-
|----------------|-----------|------------|----------|
|
|
48
|
-
| [System 1] | Inbound | [Data/events description] | [REST/WS/gRPC] |
|
|
49
|
-
| [System 2] | Outbound | [Data/events description] | [Protocol] |
|
|
50
|
-
| [System 3] | Bidirectional | [Data/events description] | [Protocol] |
|
|
51
|
-
</external-integrations-overview>
|
|
52
|
-
</c4-l1-system-context>
|
|
53
|
-
|
|
54
|
-
<c4-l2-container>
|
|
55
|
-
<diagram lang="mermaid" type="flowchart LR">
|
|
56
|
-
## L2: Subsystem Overview
|
|
57
|
-
|
|
58
|
-
```mermaid
|
|
59
|
-
flowchart LR
|
|
60
|
-
subgraph Users
|
|
61
|
-
user([fa:fa-user User Role])
|
|
62
|
-
end
|
|
63
|
-
|
|
64
|
-
subgraph Core["Core Services"]
|
|
65
|
-
sub1["Subsystem 1<br/><small>Tech · One-line responsibility</small>"]
|
|
66
|
-
sub2["Subsystem 2<br/><small>Tech · One-line responsibility</small>"]
|
|
67
|
-
end
|
|
68
|
-
|
|
69
|
-
subgraph Workers["Background Workers"]
|
|
70
|
-
sub3["Subsystem 3<br/><small>Tech · One-line responsibility</small>"]
|
|
71
|
-
end
|
|
72
|
-
|
|
73
|
-
subgraph Data["Data Stores"]
|
|
74
|
-
db1[(Data Store<br/><small>Tech</small>)]
|
|
75
|
-
cache1[(Cache<br/><small>Tech</small>)]
|
|
76
|
-
end
|
|
77
|
-
|
|
78
|
-
subgraph Messaging["Messaging"]
|
|
79
|
-
mq1>Message Broker<br/><small>Tech</small>]
|
|
80
|
-
end
|
|
81
|
-
|
|
82
|
-
subgraph External["External Systems"]
|
|
83
|
-
ext1["External System<br/><small>From L1</small>"]
|
|
84
|
-
end
|
|
85
|
-
|
|
86
|
-
user -->|"HTTPS"| sub1
|
|
87
|
-
sub1 -->|"HTTP/gRPC"| sub2
|
|
88
|
-
sub2 -->|"SQL"| db1
|
|
89
|
-
sub2 -->|"Publishes"| mq1
|
|
90
|
-
mq1 -->|"Consumes"| sub3
|
|
91
|
-
sub3 -->|"R/W"| cache1
|
|
92
|
-
sub1 -->|"REST"| ext1
|
|
93
|
-
```
|
|
94
|
-
</diagram>
|
|
95
|
-
|
|
96
|
-
<subsystem-responsibility-matrix>
|
|
97
|
-
### Subsystem Responsibility Matrix
|
|
98
|
-
|
|
99
|
-
| Subsystem | Responsibility | Owns (Data) | Publishes | Consumes | Tech |
|
|
100
|
-
|-----------|---------------|-------------|-----------|----------|------|
|
|
101
|
-
| [Sub 1] | [One-line purpose] | [Tables/schemas] | [Events/APIs exposed] | [Events/APIs called] | [Lang + framework] |
|
|
102
|
-
| [Sub 2] | [One-line purpose] | [Tables/schemas] | [Events/APIs exposed] | [Events/APIs called] | [Lang + framework] |
|
|
103
|
-
</subsystem-responsibility-matrix>
|
|
104
|
-
|
|
105
|
-
<communication-patterns>
|
|
106
|
-
### Communication Patterns
|
|
107
|
-
|
|
108
|
-
| From | To | Pattern | Protocol | Purpose |
|
|
109
|
-
|------|----|---------|----------|---------|
|
|
110
|
-
| [Sub 1] | [Sub 2] | Sync request-response | [HTTP/gRPC] | [Why this call exists] |
|
|
111
|
-
| [Sub 2] | [Sub 3] | Async event | [Kafka/Redis pub-sub] | [Why async over sync] |
|
|
112
|
-
| [Sub 3] | [Sub 1] | Real-time push | [SignalR/WebSocket] | [Why push over poll] |
|
|
113
|
-
</communication-patterns>
|
|
114
|
-
</c4-l2-container>
|
|
115
|
-
|
|
116
|
-
<main-flows>
|
|
117
|
-
## Core Flows
|
|
118
|
-
|
|
119
|
-
The flows that define this system's core value. Subsystem-to-subsystem level only —
|
|
120
|
-
internal class-level details belong in per-subsystem docs.
|
|
121
|
-
|
|
122
|
-
<diagram lang="mermaid" type="sequenceDiagram">
|
|
123
|
-
### Flow: [Flow Name]
|
|
124
|
-
|
|
125
|
-
[One sentence: what this achieves and when it triggers.]
|
|
126
|
-
|
|
127
|
-
```mermaid
|
|
128
|
-
sequenceDiagram
|
|
129
|
-
participant Actor as [User/External]
|
|
130
|
-
participant S1 as [Subsystem 1]
|
|
131
|
-
participant S2 as [Subsystem 2]
|
|
132
|
-
participant MQ as [Broker]
|
|
133
|
-
participant S3 as [Subsystem 3]
|
|
134
|
-
participant DB as [Data Store]
|
|
135
|
-
|
|
136
|
-
Actor->>S1: [Trigger]
|
|
137
|
-
S1->>S2: [What passes]
|
|
138
|
-
S2->>DB: [Operation]
|
|
139
|
-
DB-->>S2: [Result]
|
|
140
|
-
S2->>MQ: [Publish event]
|
|
141
|
-
MQ-->>S3: [Consume]
|
|
142
|
-
S3-->>S1: [Push update]
|
|
143
|
-
S1-->>Actor: [Outcome]
|
|
144
|
-
```
|
|
145
|
-
</diagram>
|
|
146
|
-
</main-flows>
|
|
147
|
-
|
|
148
|
-
<tech-stack>
|
|
149
|
-
## Tech Stack
|
|
150
|
-
|
|
151
|
-
| Category | Technology | Version | Purpose |
|
|
152
|
-
|----------|-----------|---------|---------|
|
|
153
|
-
| Backend | [e.g., .NET] | [8.0] | [API services] |
|
|
154
|
-
| Frontend | [e.g., Next.js] | [15] | [Web application] |
|
|
155
|
-
| Database | [e.g., PostgreSQL] | [16] | [Primary store] |
|
|
156
|
-
| Cache | [e.g., Redis] | [7] | [Caching, pub/sub] |
|
|
157
|
-
| Messaging | [e.g., Kafka] | [3.x] | [Event streaming] |
|
|
158
|
-
| Real-time | [e.g., SignalR] | [-] | [Client push] |
|
|
159
|
-
</tech-stack>
|
|
160
|
-
|
|
161
|
-
<key-system-wide-architectural-decisions>
|
|
162
|
-
## Key System Wide Architectural Decisions
|
|
163
|
-
|
|
164
|
-
System-wide decisions only. Per-subsystem decisions live in per-subsystem docs.
|
|
165
|
-
|
|
166
|
-
| Decision | Rationale |
|
|
167
|
-
|----------|-----------|
|
|
168
|
-
| [e.g., Clean Architecture per service] | [Consistent boundaries, testability] |
|
|
169
|
-
| [e.g., Kafka over RabbitMQ] | [Need replay, ordering, high throughput] |
|
|
170
|
-
</key-system-wide-architectural-decisions>
|
|
171
|
-
</template>
|
|
172
|
-
|
|
173
|
-
<guidelines>
|
|
174
|
-
|
|
175
|
-
**ALL visual representations of architecture, dependencies, flows, or relationships MUST be ```mermaid fenced code blocks. NO ASCII arrows (->), NO dependency trees, NO PlantUML. Only mermaid. The ONLY ASCII exception is file trees.**
|
|
176
|
-
|
|
177
|
-
**System Overview:**
|
|
178
|
-
- 2-3 sentences maximum. Orients the AI before it reads diagrams
|
|
179
|
-
- Product language — a PM should understand it
|
|
180
|
-
- NOT a product vision or mission statement. Just "what this system does and who uses it"
|
|
181
|
-
|
|
182
|
-
**L1 System Context (`c4-l1-system-context`):**
|
|
183
|
-
- The ENTIRE system is ONE box — do NOT show internal subsystems
|
|
184
|
-
- Show ALL user roles (human actors) and ALL external systems (third-party)
|
|
185
|
-
- Diagram arrows: label with WHAT flows and WHICH protocol
|
|
186
|
-
- External = anything your team does NOT deploy. If you deploy it, it's a subsystem in L2
|
|
187
|
-
- Integrations table: one row per external system. Keep it simple — direction, data, protocol
|
|
188
|
-
|
|
189
|
-
**L2 Container (`c4-l2-container`):**
|
|
190
|
-
- Use `flowchart LR` with small focused subgraphs — data pipeline reads naturally left-to-right
|
|
191
|
-
- Group related nodes into subgraphs (e.g., "Core Services", "Data Stores", "External Systems")
|
|
192
|
-
- Keep subgraphs small (2-4 nodes each) — split large groups rather than making one big subgraph
|
|
193
|
-
- One node per subsystem (see "subsystem" definition in purpose)
|
|
194
|
-
- Data stores and message brokers are SEPARATE nodes — they are NOT subsystems
|
|
195
|
-
- Subsystem matrix is the quick-reference — agents scan this FIRST to find "who does what"
|
|
196
|
-
- Communication patterns table explains WHY each link exists and whether it's sync/async.
|
|
197
|
-
The diagram shows topology; the table explains rationale
|
|
198
|
-
- Do NOT show components within subsystems — that's L3, handled by per-subsystem docs
|
|
199
|
-
|
|
200
|
-
**Subsystem examples by project type:**
|
|
201
|
-
- Microservices: each service = one subsystem
|
|
202
|
-
- Monolith: each bounded context/module = one subsystem
|
|
203
|
-
- Monorepo packages: each publishable package = one subsystem
|
|
204
|
-
- Hybrid: mix of all three — anything with a clear boundary is a subsystem
|
|
205
|
-
|
|
206
|
-
**Core Flows (`main-flows`):**
|
|
207
|
-
- Generate however many flows define the system's core value (usually 1-2)
|
|
208
|
-
- Subsystem-to-subsystem only — NO classes, NO method names, NO file references
|
|
209
|
-
- If a flow needs internal detail, that belongs in the subsystem's `systems/*.md` doc
|
|
210
|
-
- These are C4 Dynamic Diagrams at the Container level
|
|
211
|
-
- Choose flows a NEW TEAM MEMBER must understand to work on the system
|
|
212
|
-
|
|
213
|
-
**Tech Stack:**
|
|
214
|
-
- List what's ACTUALLY in use, not aspirational
|
|
215
|
-
- One row per technology. Group by category
|
|
216
|
-
- If a technology is used by only one subsystem, mention it in Purpose
|
|
217
|
-
|
|
218
|
-
**Key System Wide Architectural Decisions:**
|
|
219
|
-
- System-wide only (e.g., "all services use Clean Architecture")
|
|
220
|
-
- Per-subsystem decisions go in per-subsystem docs
|
|
221
|
-
- Keep under 10 rows. This is a bird's eye view, not a decision log
|
|
222
|
-
- Decision + Rationale only. No tracking, no status, no dates
|
|
223
|
-
|
|
224
|
-
</guidelines>
|
|
225
|
-
|
|
226
|
-
<evolution>
|
|
227
|
-
|
|
228
|
-
This document evolves at STRUCTURAL changes only — not every story or bugfix.
|
|
229
|
-
|
|
230
|
-
**Update triggers:**
|
|
231
|
-
- New subsystem added, or existing one split/merged
|
|
232
|
-
- New external integration added or removed
|
|
233
|
-
- Core flow fundamentally changed (not just a step added)
|
|
234
|
-
- Tech stack changed (new database, new framework, migration)
|
|
235
|
-
- Communication pattern between subsystems changed
|
|
236
|
-
- New system-wide architectural decision made
|
|
237
|
-
|
|
238
|
-
**NOT an update trigger:**
|
|
239
|
-
- New feature within an existing subsystem (per-subsystem docs)
|
|
240
|
-
- Bug fixes or internal refactoring
|
|
241
|
-
- New API endpoints within existing subsystem
|
|
242
|
-
- New tables within existing subsystem's database
|
|
243
|
-
|
|
244
|
-
**After structural change:**
|
|
245
|
-
1. L1 still accurate? (new external system? removed integration?)
|
|
246
|
-
2. L2 still accurate? (new subsystem? new data store? new broker?)
|
|
247
|
-
3. Subsystem matrix need a new row or updated cell?
|
|
248
|
-
4. Core flow shape changed? (rare)
|
|
249
|
-
5. Tech stack changed?
|
|
250
|
-
6. New system-wide decision to log?
|
|
251
|
-
|
|
252
|
-
</evolution>
|
|
253
|
-
|
|
254
|
-
</system-architecture>
|
|
1
|
+
<system-architecture>
|
|
2
|
+
<purpose>
|
|
3
|
+
Template for `.docs/wiki/system-wide/system-architecture.md` — the living high-level
|
|
4
|
+
architecture document. Captures L1/L2 views (C4 model), core runtime flows, and tech stack.
|
|
5
|
+
|
|
6
|
+
Complements per-subsystem docs (which cover L3 Component and L4 Code levels).
|
|
7
|
+
Complements STRUCTURE.md (which shows physical file/folder layout).
|
|
8
|
+
|
|
9
|
+
A "subsystem" is any cohesive code unit with a clear responsibility boundary —
|
|
10
|
+
whether deployed as a microservice, a monolith module, or a library package.
|
|
11
|
+
</purpose>
|
|
12
|
+
|
|
13
|
+
<template>
|
|
14
|
+
<system-overview>
|
|
15
|
+
## System Overview
|
|
16
|
+
|
|
17
|
+
[2-3 sentences. What does this system do and who uses it? Product language, not jargon.
|
|
18
|
+
This orients the reader before they look at any diagrams.]
|
|
19
|
+
</system-overview>
|
|
20
|
+
|
|
21
|
+
<c4-l1-system-context>
|
|
22
|
+
<diagram lang="mermaid" type="C4Context">
|
|
23
|
+
## L1: System Context
|
|
24
|
+
|
|
25
|
+
```mermaid
|
|
26
|
+
C4Context
|
|
27
|
+
title System Context - [System Name]
|
|
28
|
+
|
|
29
|
+
Person(user1, "[Primary User Role]", "[What they do with the system]")
|
|
30
|
+
Person(user2, "[Secondary User Role]", "[What they do]")
|
|
31
|
+
|
|
32
|
+
System(system, "[System Name]", "[Core purpose - one line]")
|
|
33
|
+
|
|
34
|
+
System_Ext(ext1, "[External System 1]", "[What it provides/consumes]")
|
|
35
|
+
System_Ext(ext2, "[External System 2]", "[What it provides/consumes]")
|
|
36
|
+
|
|
37
|
+
Rel(user1, system, "[Uses]", "[HTTPS/WebSocket]")
|
|
38
|
+
Rel(system, ext1, "[Fetches/Sends]", "[REST/WebSocket]")
|
|
39
|
+
Rel(ext2, system, "[Pushes]", "[Protocol]")
|
|
40
|
+
```
|
|
41
|
+
</diagram>
|
|
42
|
+
|
|
43
|
+
<external-integrations-overview>
|
|
44
|
+
### External Integrations
|
|
45
|
+
|
|
46
|
+
| External System | Direction | What Flows | Protocol |
|
|
47
|
+
|----------------|-----------|------------|----------|
|
|
48
|
+
| [System 1] | Inbound | [Data/events description] | [REST/WS/gRPC] |
|
|
49
|
+
| [System 2] | Outbound | [Data/events description] | [Protocol] |
|
|
50
|
+
| [System 3] | Bidirectional | [Data/events description] | [Protocol] |
|
|
51
|
+
</external-integrations-overview>
|
|
52
|
+
</c4-l1-system-context>
|
|
53
|
+
|
|
54
|
+
<c4-l2-container>
|
|
55
|
+
<diagram lang="mermaid" type="flowchart LR">
|
|
56
|
+
## L2: Subsystem Overview
|
|
57
|
+
|
|
58
|
+
```mermaid
|
|
59
|
+
flowchart LR
|
|
60
|
+
subgraph Users
|
|
61
|
+
user([fa:fa-user User Role])
|
|
62
|
+
end
|
|
63
|
+
|
|
64
|
+
subgraph Core["Core Services"]
|
|
65
|
+
sub1["Subsystem 1<br/><small>Tech · One-line responsibility</small>"]
|
|
66
|
+
sub2["Subsystem 2<br/><small>Tech · One-line responsibility</small>"]
|
|
67
|
+
end
|
|
68
|
+
|
|
69
|
+
subgraph Workers["Background Workers"]
|
|
70
|
+
sub3["Subsystem 3<br/><small>Tech · One-line responsibility</small>"]
|
|
71
|
+
end
|
|
72
|
+
|
|
73
|
+
subgraph Data["Data Stores"]
|
|
74
|
+
db1[(Data Store<br/><small>Tech</small>)]
|
|
75
|
+
cache1[(Cache<br/><small>Tech</small>)]
|
|
76
|
+
end
|
|
77
|
+
|
|
78
|
+
subgraph Messaging["Messaging"]
|
|
79
|
+
mq1>Message Broker<br/><small>Tech</small>]
|
|
80
|
+
end
|
|
81
|
+
|
|
82
|
+
subgraph External["External Systems"]
|
|
83
|
+
ext1["External System<br/><small>From L1</small>"]
|
|
84
|
+
end
|
|
85
|
+
|
|
86
|
+
user -->|"HTTPS"| sub1
|
|
87
|
+
sub1 -->|"HTTP/gRPC"| sub2
|
|
88
|
+
sub2 -->|"SQL"| db1
|
|
89
|
+
sub2 -->|"Publishes"| mq1
|
|
90
|
+
mq1 -->|"Consumes"| sub3
|
|
91
|
+
sub3 -->|"R/W"| cache1
|
|
92
|
+
sub1 -->|"REST"| ext1
|
|
93
|
+
```
|
|
94
|
+
</diagram>
|
|
95
|
+
|
|
96
|
+
<subsystem-responsibility-matrix>
|
|
97
|
+
### Subsystem Responsibility Matrix
|
|
98
|
+
|
|
99
|
+
| Subsystem | Responsibility | Owns (Data) | Publishes | Consumes | Tech |
|
|
100
|
+
|-----------|---------------|-------------|-----------|----------|------|
|
|
101
|
+
| [Sub 1] | [One-line purpose] | [Tables/schemas] | [Events/APIs exposed] | [Events/APIs called] | [Lang + framework] |
|
|
102
|
+
| [Sub 2] | [One-line purpose] | [Tables/schemas] | [Events/APIs exposed] | [Events/APIs called] | [Lang + framework] |
|
|
103
|
+
</subsystem-responsibility-matrix>
|
|
104
|
+
|
|
105
|
+
<communication-patterns>
|
|
106
|
+
### Communication Patterns
|
|
107
|
+
|
|
108
|
+
| From | To | Pattern | Protocol | Purpose |
|
|
109
|
+
|------|----|---------|----------|---------|
|
|
110
|
+
| [Sub 1] | [Sub 2] | Sync request-response | [HTTP/gRPC] | [Why this call exists] |
|
|
111
|
+
| [Sub 2] | [Sub 3] | Async event | [Kafka/Redis pub-sub] | [Why async over sync] |
|
|
112
|
+
| [Sub 3] | [Sub 1] | Real-time push | [SignalR/WebSocket] | [Why push over poll] |
|
|
113
|
+
</communication-patterns>
|
|
114
|
+
</c4-l2-container>
|
|
115
|
+
|
|
116
|
+
<main-flows>
|
|
117
|
+
## Core Flows
|
|
118
|
+
|
|
119
|
+
The flows that define this system's core value. Subsystem-to-subsystem level only —
|
|
120
|
+
internal class-level details belong in per-subsystem docs.
|
|
121
|
+
|
|
122
|
+
<diagram lang="mermaid" type="sequenceDiagram">
|
|
123
|
+
### Flow: [Flow Name]
|
|
124
|
+
|
|
125
|
+
[One sentence: what this achieves and when it triggers.]
|
|
126
|
+
|
|
127
|
+
```mermaid
|
|
128
|
+
sequenceDiagram
|
|
129
|
+
participant Actor as [User/External]
|
|
130
|
+
participant S1 as [Subsystem 1]
|
|
131
|
+
participant S2 as [Subsystem 2]
|
|
132
|
+
participant MQ as [Broker]
|
|
133
|
+
participant S3 as [Subsystem 3]
|
|
134
|
+
participant DB as [Data Store]
|
|
135
|
+
|
|
136
|
+
Actor->>S1: [Trigger]
|
|
137
|
+
S1->>S2: [What passes]
|
|
138
|
+
S2->>DB: [Operation]
|
|
139
|
+
DB-->>S2: [Result]
|
|
140
|
+
S2->>MQ: [Publish event]
|
|
141
|
+
MQ-->>S3: [Consume]
|
|
142
|
+
S3-->>S1: [Push update]
|
|
143
|
+
S1-->>Actor: [Outcome]
|
|
144
|
+
```
|
|
145
|
+
</diagram>
|
|
146
|
+
</main-flows>
|
|
147
|
+
|
|
148
|
+
<tech-stack>
|
|
149
|
+
## Tech Stack
|
|
150
|
+
|
|
151
|
+
| Category | Technology | Version | Purpose |
|
|
152
|
+
|----------|-----------|---------|---------|
|
|
153
|
+
| Backend | [e.g., .NET] | [8.0] | [API services] |
|
|
154
|
+
| Frontend | [e.g., Next.js] | [15] | [Web application] |
|
|
155
|
+
| Database | [e.g., PostgreSQL] | [16] | [Primary store] |
|
|
156
|
+
| Cache | [e.g., Redis] | [7] | [Caching, pub/sub] |
|
|
157
|
+
| Messaging | [e.g., Kafka] | [3.x] | [Event streaming] |
|
|
158
|
+
| Real-time | [e.g., SignalR] | [-] | [Client push] |
|
|
159
|
+
</tech-stack>
|
|
160
|
+
|
|
161
|
+
<key-system-wide-architectural-decisions>
|
|
162
|
+
## Key System Wide Architectural Decisions
|
|
163
|
+
|
|
164
|
+
System-wide decisions only. Per-subsystem decisions live in per-subsystem docs.
|
|
165
|
+
|
|
166
|
+
| Decision | Rationale |
|
|
167
|
+
|----------|-----------|
|
|
168
|
+
| [e.g., Clean Architecture per service] | [Consistent boundaries, testability] |
|
|
169
|
+
| [e.g., Kafka over RabbitMQ] | [Need replay, ordering, high throughput] |
|
|
170
|
+
</key-system-wide-architectural-decisions>
|
|
171
|
+
</template>
|
|
172
|
+
|
|
173
|
+
<guidelines>
|
|
174
|
+
|
|
175
|
+
**ALL visual representations of architecture, dependencies, flows, or relationships MUST be ```mermaid fenced code blocks. NO ASCII arrows (->), NO dependency trees, NO PlantUML. Only mermaid. The ONLY ASCII exception is file trees.**
|
|
176
|
+
|
|
177
|
+
**System Overview:**
|
|
178
|
+
- 2-3 sentences maximum. Orients the AI before it reads diagrams
|
|
179
|
+
- Product language — a PM should understand it
|
|
180
|
+
- NOT a product vision or mission statement. Just "what this system does and who uses it"
|
|
181
|
+
|
|
182
|
+
**L1 System Context (`c4-l1-system-context`):**
|
|
183
|
+
- The ENTIRE system is ONE box — do NOT show internal subsystems
|
|
184
|
+
- Show ALL user roles (human actors) and ALL external systems (third-party)
|
|
185
|
+
- Diagram arrows: label with WHAT flows and WHICH protocol
|
|
186
|
+
- External = anything your team does NOT deploy. If you deploy it, it's a subsystem in L2
|
|
187
|
+
- Integrations table: one row per external system. Keep it simple — direction, data, protocol
|
|
188
|
+
|
|
189
|
+
**L2 Container (`c4-l2-container`):**
|
|
190
|
+
- Use `flowchart LR` with small focused subgraphs — data pipeline reads naturally left-to-right
|
|
191
|
+
- Group related nodes into subgraphs (e.g., "Core Services", "Data Stores", "External Systems")
|
|
192
|
+
- Keep subgraphs small (2-4 nodes each) — split large groups rather than making one big subgraph
|
|
193
|
+
- One node per subsystem (see "subsystem" definition in purpose)
|
|
194
|
+
- Data stores and message brokers are SEPARATE nodes — they are NOT subsystems
|
|
195
|
+
- Subsystem matrix is the quick-reference — agents scan this FIRST to find "who does what"
|
|
196
|
+
- Communication patterns table explains WHY each link exists and whether it's sync/async.
|
|
197
|
+
The diagram shows topology; the table explains rationale
|
|
198
|
+
- Do NOT show components within subsystems — that's L3, handled by per-subsystem docs
|
|
199
|
+
|
|
200
|
+
**Subsystem examples by project type:**
|
|
201
|
+
- Microservices: each service = one subsystem
|
|
202
|
+
- Monolith: each bounded context/module = one subsystem
|
|
203
|
+
- Monorepo packages: each publishable package = one subsystem
|
|
204
|
+
- Hybrid: mix of all three — anything with a clear boundary is a subsystem
|
|
205
|
+
|
|
206
|
+
**Core Flows (`main-flows`):**
|
|
207
|
+
- Generate however many flows define the system's core value (usually 1-2)
|
|
208
|
+
- Subsystem-to-subsystem only — NO classes, NO method names, NO file references
|
|
209
|
+
- If a flow needs internal detail, that belongs in the subsystem's `systems/*.md` doc
|
|
210
|
+
- These are C4 Dynamic Diagrams at the Container level
|
|
211
|
+
- Choose flows a NEW TEAM MEMBER must understand to work on the system
|
|
212
|
+
|
|
213
|
+
**Tech Stack:**
|
|
214
|
+
- List what's ACTUALLY in use, not aspirational
|
|
215
|
+
- One row per technology. Group by category
|
|
216
|
+
- If a technology is used by only one subsystem, mention it in Purpose
|
|
217
|
+
|
|
218
|
+
**Key System Wide Architectural Decisions:**
|
|
219
|
+
- System-wide only (e.g., "all services use Clean Architecture")
|
|
220
|
+
- Per-subsystem decisions go in per-subsystem docs
|
|
221
|
+
- Keep under 10 rows. This is a bird's eye view, not a decision log
|
|
222
|
+
- Decision + Rationale only. No tracking, no status, no dates
|
|
223
|
+
|
|
224
|
+
</guidelines>
|
|
225
|
+
|
|
226
|
+
<evolution>
|
|
227
|
+
|
|
228
|
+
This document evolves at STRUCTURAL changes only — not every story or bugfix.
|
|
229
|
+
|
|
230
|
+
**Update triggers:**
|
|
231
|
+
- New subsystem added, or existing one split/merged
|
|
232
|
+
- New external integration added or removed
|
|
233
|
+
- Core flow fundamentally changed (not just a step added)
|
|
234
|
+
- Tech stack changed (new database, new framework, migration)
|
|
235
|
+
- Communication pattern between subsystems changed
|
|
236
|
+
- New system-wide architectural decision made
|
|
237
|
+
|
|
238
|
+
**NOT an update trigger:**
|
|
239
|
+
- New feature within an existing subsystem (per-subsystem docs)
|
|
240
|
+
- Bug fixes or internal refactoring
|
|
241
|
+
- New API endpoints within existing subsystem
|
|
242
|
+
- New tables within existing subsystem's database
|
|
243
|
+
|
|
244
|
+
**After structural change:**
|
|
245
|
+
1. L1 still accurate? (new external system? removed integration?)
|
|
246
|
+
2. L2 still accurate? (new subsystem? new data store? new broker?)
|
|
247
|
+
3. Subsystem matrix need a new row or updated cell?
|
|
248
|
+
4. Core flow shape changed? (rare)
|
|
249
|
+
5. Tech stack changed?
|
|
250
|
+
6. New system-wide decision to log?
|
|
251
|
+
|
|
252
|
+
</evolution>
|
|
253
|
+
|
|
254
|
+
</system-architecture>
|