agile-context-engineering 0.1.0 → 0.2.1

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.
Files changed (84) hide show
  1. package/LICENSE +30 -0
  2. package/README.md +272 -78
  3. package/agents/ace-code-discovery-analyst.md +245 -0
  4. package/agents/ace-code-integration-analyst.md +248 -0
  5. package/agents/ace-code-reviewer.md +375 -0
  6. package/agents/ace-product-owner.md +361 -0
  7. package/agents/ace-project-researcher.md +606 -0
  8. package/agents/ace-research-synthesizer.md +228 -0
  9. package/agents/ace-technical-application-architect.md +287 -0
  10. package/agents/ace-wiki-mapper.md +334 -0
  11. package/agile-context-engineering/src/ace-tools.js +2881 -0
  12. package/agile-context-engineering/src/ace-tools.test.js +1089 -0
  13. package/agile-context-engineering/templates/_command.md +54 -0
  14. package/agile-context-engineering/templates/_workflow.xml +17 -0
  15. package/agile-context-engineering/templates/config.json +0 -0
  16. package/agile-context-engineering/templates/product/external-solution.xml +832 -0
  17. package/agile-context-engineering/templates/product/feature.xml +361 -0
  18. package/agile-context-engineering/templates/product/integration-solution.xml +0 -0
  19. package/agile-context-engineering/templates/product/product-backlog.xml +231 -0
  20. package/agile-context-engineering/templates/product/product-vision.xml +227 -0
  21. package/agile-context-engineering/templates/product/story-integration-solution.xml +1014 -0
  22. package/agile-context-engineering/templates/product/story-technical-solution.xml +1025 -0
  23. package/agile-context-engineering/templates/product/story-wiki.xml +190 -0
  24. package/agile-context-engineering/templates/product/story.xml +451 -0
  25. package/agile-context-engineering/templates/wiki/coding-standards.xml +493 -0
  26. package/agile-context-engineering/templates/wiki/decizions.xml +115 -0
  27. package/agile-context-engineering/templates/wiki/guide.xml +137 -0
  28. package/agile-context-engineering/templates/wiki/module-discovery.xml +174 -0
  29. package/agile-context-engineering/templates/wiki/pattern.xml +159 -0
  30. package/agile-context-engineering/templates/wiki/subsystem-architecture.xml +343 -0
  31. package/agile-context-engineering/templates/wiki/subsystem-structure.xml +235 -0
  32. package/agile-context-engineering/templates/wiki/system-architecture.xml +254 -0
  33. package/agile-context-engineering/templates/wiki/system-cross-cutting.xml +197 -0
  34. package/agile-context-engineering/templates/wiki/system-structure.xml +178 -0
  35. package/agile-context-engineering/templates/wiki/system.xml +381 -0
  36. package/agile-context-engineering/templates/wiki/tech-debt-index.xml +125 -0
  37. package/agile-context-engineering/templates/wiki/testing-framework.xml +283 -0
  38. package/agile-context-engineering/templates/wiki/wiki-readme.xml +276 -0
  39. package/agile-context-engineering/utils/questioning.xml +111 -0
  40. package/agile-context-engineering/utils/ui-formatting.md +300 -0
  41. package/agile-context-engineering/workflows/execute-story.xml +1145 -0
  42. package/agile-context-engineering/workflows/help.xml +540 -0
  43. package/agile-context-engineering/workflows/init-coding-standards.xml +386 -0
  44. package/agile-context-engineering/workflows/map-story.xml +797 -0
  45. package/agile-context-engineering/workflows/map-subsystem.xml +1177 -0
  46. package/agile-context-engineering/workflows/map-system.xml +672 -0
  47. package/agile-context-engineering/workflows/plan-backlog.xml +1356 -0
  48. package/agile-context-engineering/workflows/plan-feature.xml +1495 -0
  49. package/agile-context-engineering/workflows/plan-product-vision.xml +342 -0
  50. package/agile-context-engineering/workflows/plan-story.xml +909 -0
  51. package/agile-context-engineering/workflows/research-external-solution.xml +659 -0
  52. package/agile-context-engineering/workflows/research-integration-solution.xml +712 -0
  53. package/agile-context-engineering/workflows/research-story-wiki.xml +474 -0
  54. package/agile-context-engineering/workflows/research-technical-solution.xml +762 -0
  55. package/agile-context-engineering/workflows/review-story.xml +281 -0
  56. package/bin/install.js +102 -166
  57. package/commands/ace/execute-story.md +137 -0
  58. package/commands/ace/help.md +93 -0
  59. package/commands/ace/init-coding-standards.md +83 -0
  60. package/commands/ace/map-story.md +156 -0
  61. package/commands/ace/map-subsystem.md +138 -0
  62. package/commands/ace/map-system.md +92 -0
  63. package/commands/ace/plan-backlog.md +83 -0
  64. package/commands/ace/plan-feature.md +89 -0
  65. package/commands/ace/plan-product-vision.md +81 -0
  66. package/commands/ace/plan-story.md +145 -0
  67. package/commands/ace/research-external-solution.md +138 -0
  68. package/commands/ace/research-integration-solution.md +135 -0
  69. package/commands/ace/research-story-wiki.md +116 -0
  70. package/commands/ace/research-technical-solution.md +147 -0
  71. package/commands/ace/review-story.md +109 -0
  72. package/package.json +5 -8
  73. package/agents/executor.md +0 -88
  74. package/agents/planner.md +0 -78
  75. package/agents/researcher.md +0 -77
  76. package/agents/verifier.md +0 -116
  77. package/commands/ace-execute-story.md +0 -114
  78. package/commands/ace-init.md +0 -254
  79. package/commands/ace-plan-epic.md +0 -79
  80. package/commands/ace-plan-feature.md +0 -78
  81. package/commands/ace-plan-project.md +0 -205
  82. package/commands/ace-plan-story.md +0 -97
  83. package/commands/ace-refine-story.md +0 -90
  84. package/commands/ace-verify-story.md +0 -127
@@ -0,0 +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>
@@ -0,0 +1,197 @@
1
+ <system-cross-cutting>
2
+ <purpose>
3
+ Template for `.docs/wiki/subsystems/[subsystem-name]/cross-cutting/<concern-name>.md` — a
4
+ concern that spans multiple systems within a codebase subsystem. Answers "How does this
5
+ shared infrastructure/concern work, and how do I plug into it?"
6
+
7
+ Each cross-cutting doc describes shared infrastructure or mechanisms that multiple domain
8
+ systems depend on. It is the document an AI agent reads to understand how to register,
9
+ configure, or interact with shared concerns.
10
+
11
+ Examples of cross-cutting concerns:
12
+ - Dependency injection and container registration
13
+ - Factory/registry registration patterns
14
+ - Event systems, invalidation, pub/sub
15
+ - Serialization/deserialization
16
+ - Error handling and logging infrastructure
17
+ - Authentication/authorization middleware
18
+ - Cache/invalidation infrastructure
19
+ - Shared abstract base classes
20
+
21
+ Complements:
22
+ - systems/ docs (domain systems that USE these cross-cutting concerns)
23
+ - patterns/ docs (reusable structural patterns, not shared infrastructure)
24
+ - guides/ docs (task recipes that reference cross-cutting setup steps)
25
+ </purpose>
26
+
27
+ <template>
28
+ <overview>
29
+ # [Cross-Cutting Concern]
30
+
31
+ ## Overview
32
+ What this concern addresses, why it exists. One paragraph.
33
+ </overview>
34
+
35
+ <how-it-works>
36
+ ## How It Works
37
+
38
+ The pattern/mechanism used. Reference actual code locations.
39
+
40
+ 1. **Step**: Description at `file:ClassName.method`
41
+ 2. **Step**: Description at `file:ClassName.method`
42
+ 3. **Step**: Description at `file:ClassName.method`
43
+ </how-it-works>
44
+
45
+ <registration-and-setup>
46
+ ## Registration / Setup
47
+
48
+ Where and how components register with this concern.
49
+ - **Container**: `file:container.ts:registerServices`
50
+ - **Factory**: `file:DrawingFactory.ts:DrawingFactory`
51
+ - **Registry**: `file:DrawingRegistry.ts:DrawingRegistry`
52
+ </registration-and-setup>
53
+
54
+ <usage>
55
+ ## Usage
56
+
57
+ How other systems interact with this concern.
58
+
59
+ ```typescript
60
+ // Usage pattern (inline only if non-obvious)
61
+ ```
62
+ </usage>
63
+
64
+ <current-registrations>
65
+ ## Current Registrations / Implementations
66
+
67
+ What is currently registered/using this concern:
68
+ - `TrendLine` registered at `file:container.ts:registerDrawings`
69
+ - `ParallelChannel` registered at `file:container.ts:registerDrawings`
70
+ - ...
71
+ </current-registrations>
72
+
73
+ <integration-points>
74
+ ## Integration Points
75
+
76
+ Where this concern connects to other systems.
77
+ - [System A](../systems/system-a.md) — uses this for [purpose]
78
+ - [System B](../systems/system-b.md) — uses this for [purpose]
79
+ </integration-points>
80
+
81
+ <gotchas>
82
+ ## Gotchas
83
+
84
+ Common mistakes when working with this concern.
85
+ - [Common mistake 1]
86
+ - [Common mistake 2]
87
+ </gotchas>
88
+
89
+ <tech-debt>
90
+ ## Tech Debt
91
+
92
+ Known quality issues in this cross-cutting concern discovered during story code reviews.
93
+ Items are added by the wiki mapper and removed when fixed by a future story.
94
+ Include ONLY if this concern has known tech debt items. Omit section entirely if clean.
95
+
96
+ ### [Short descriptive title of the issue]
97
+ - **Severity:** high | medium | low
98
+ - **File:** `[file-path:SymbolName]`
99
+ - **Description:** What the issue is, why it matters, and what could go wrong
100
+ if left unfixed. For cross-cutting concerns, note which dependent systems are affected.
101
+ - **Discovered during:** [story-id] — [story title]
102
+
103
+ ### [Another issue]
104
+ - **Severity:** ...
105
+ - **File:** ...
106
+ - **Description:** ...
107
+ - **Discovered during:** ...
108
+ </tech-debt>
109
+ </template>
110
+
111
+ <guidelines>
112
+
113
+ **Documentation Style:**
114
+ - EXTREMELY SUCCINCT — every word must add value
115
+ - NO FLUFF — direct, actionable information only
116
+ - Bullet points over paragraphs
117
+ - Code references as `file-path:ClassName.methodName` (not line numbers)
118
+ - Inline snippets ONLY for usage patterns and registration examples
119
+ - **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.**
120
+
121
+ **Overview:**
122
+ - ONE paragraph. What the concern does and why it exists.
123
+ - Focus on what an agent needs to know to interact with this concern.
124
+
125
+ **How It Works:**
126
+ - Numbered steps explaining the mechanism.
127
+ - Reference actual code locations — not theoretical descriptions.
128
+ - If the mechanism has a flow (event dispatching, DI resolution), show a mermaid sequence diagram.
129
+
130
+ **Registration / Setup:**
131
+ - The MOST CRITICAL section for AI agents. They need to know WHERE to register new things.
132
+ - List every registration point with exact file paths.
133
+ - Show the registration pattern (inline code only if non-obvious).
134
+
135
+ **Usage:**
136
+ - How consuming code interacts with this concern.
137
+ - Inline code snippet ONLY if the usage pattern is non-obvious.
138
+ - If usage is straightforward (e.g., inject via constructor), a one-liner suffices.
139
+
140
+ **Current Registrations / Implementations:**
141
+ - Complete list of everything currently registered/using this concern.
142
+ - Agent uses this to verify its new registration is consistent with existing ones.
143
+ - Update when new registrations are added.
144
+
145
+ **Integration Points:**
146
+ - Cross-reference with markdown links to system docs that depend on this concern.
147
+ - Helps agents understand the blast radius of changes to this concern.
148
+
149
+ **Gotchas:**
150
+ - Registration order dependencies, naming conventions, initialization timing.
151
+ - Anything that silently fails if done wrong.
152
+
153
+ **Tech Debt:**
154
+ - One `###` subsection per known issue — NOT a table. Each issue needs enough context
155
+ for an agent to understand the problem without reading the code.
156
+ - For cross-cutting concerns, always note which dependent systems are affected.
157
+ - Severity: `high` (security, data loss, production instability), `medium` (quality,
158
+ maintainability), `low` (cosmetic, minor inefficiency).
159
+ - Always link to the discovering story for traceability.
160
+ - REMOVE items when fixed by a future story.
161
+ - Omit the entire section if no tech debt exists in this concern.
162
+
163
+ **What does NOT belong here:**
164
+ - Domain-specific logic (that's in systems/ docs)
165
+ - Reusable structural patterns (that's in patterns/ docs)
166
+ - Step-by-step task recipes (that's in guides/ docs)
167
+ - Story numbers, sprint context, revision history
168
+ - Testing instructions, performance benchmarks
169
+
170
+ </guidelines>
171
+
172
+ <evolution>
173
+
174
+ This is a LIVING document — updated when the cross-cutting concern changes.
175
+
176
+ **Update triggers:**
177
+ - New registration added (update Current Registrations list)
178
+ - Registration mechanism changed (new file, new pattern)
179
+ - New integration point discovered
180
+ - New gotcha discovered
181
+ - Setup/initialization process changed
182
+ - Tech debt discovered or resolved in this concern's files
183
+
184
+ **NOT an update trigger:**
185
+ - New feature that registers with existing mechanism without changing it
186
+ - Bug fix in one registered component
187
+ - Internal refactoring of the mechanism that doesn't change the external API
188
+
189
+ **Update rules:**
190
+ - ADD new registrations to the list
191
+ - UPDATE Registration / Setup if the process changed
192
+ - ADD new gotchas as they are discovered
193
+ - REMOVE registrations for deleted components
194
+
195
+ </evolution>
196
+
197
+ </system-cross-cutting>
@@ -0,0 +1,178 @@
1
+ <system-structure>
2
+ <purpose>
3
+ Template for `.docs/wiki/system-wide/system-structure.md` — the physical file organization
4
+ at the system level. Answers "what subsystems exist and where do they live?"
5
+
6
+ Complements system-architecture.md (which shows conceptual design and flows).
7
+ Complements per-subsystem structure docs (which go deep into each subsystem's internals).
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
+
12
+ **Monoliths have subsystems too.** A monolith with bounded contexts, feature modules,
13
+ or domain packages gets one subsystem-structure doc per module — same as microservices.
14
+ The only difference is deployment topology, not documentation structure.
15
+ </purpose>
16
+
17
+ <template>
18
+ <directory-layout>
19
+ ## Directory Layout
20
+
21
+ [ASCII box-drawing tree of directories with purpose - use ├── └── │ characters for tree structure only]
22
+
23
+ Show enough depth to identify subsystems and shared code, but stop at subsystem
24
+ boundaries — internal detail belongs in per-subsystem docs.
25
+
26
+ ```
27
+ [project-root]/
28
+ ├── [dir]/ # [Purpose]
29
+ ├── [dir]/ # [Purpose]
30
+ │ ├── [subdir]/ # [Purpose]
31
+ │ └── [subdir]/ # [Purpose]
32
+ ├── [dir]/ # [Purpose]
33
+ └── [file] # [Purpose]
34
+ ```
35
+ </directory-layout>
36
+
37
+ <subsystem-index>
38
+ ## Subsystem Index
39
+
40
+ Quick reference — which directory is which subsystem.
41
+
42
+ | Directory | Subsystem | Purpose |
43
+ |-----------|-----------|---------|
44
+ | `[path]` | [Subsystem Name] | [One-line responsibility] |
45
+ | `[path]` | [Subsystem Name] | [One-line responsibility] |
46
+
47
+ Per-subsystem structure docs: `.docs/wiki/subsystems/[subsystem-name]/structure.md`
48
+ </subsystem-index>
49
+
50
+ <shared-directories>
51
+ ## Shared Directories
52
+
53
+ Code, libraries, or infrastructure that spans multiple subsystems.
54
+
55
+ **[Directory Name]:**
56
+ - Path: `[path]`
57
+ - Purpose: [What it provides across subsystems]
58
+ - Contains: [Types of files]
59
+ - Used by: [Which subsystems depend on it]
60
+
61
+ **[Directory Name]:**
62
+ - Path: `[path]`
63
+ - Purpose: [What it provides]
64
+ - Contains: [Types of files]
65
+ - Used by: [Which subsystems]
66
+ </shared-directories>
67
+
68
+ <root-configuration>
69
+ ## Root Configuration
70
+
71
+ Build configs, workspace setup, and infrastructure files at the project root.
72
+
73
+ **Workspace / Monorepo:**
74
+ - [Tool]: `[config file]` — [What it configures]
75
+
76
+ **Build / Dev:**
77
+ - `[path]`: [Purpose]
78
+ - `[path]`: [Purpose]
79
+
80
+ **CI/CD:**
81
+ - `[path]`: [Purpose]
82
+
83
+ **Environment:**
84
+ - `[path]`: [Purpose — e.g., "env template, actual values not committed"]
85
+ </root-configuration>
86
+
87
+ <naming-conventions>
88
+ ## System-Wide Naming Conventions
89
+
90
+ Patterns that apply across all subsystems.
91
+
92
+ **Directories:**
93
+ - [Pattern]: [Example]
94
+
95
+ **Files:**
96
+ - [Pattern]: [Example]
97
+
98
+ **Special Patterns:**
99
+ - [Pattern]: [Example]
100
+ </naming-conventions>
101
+
102
+ <special-directories>
103
+ ## Special Directories
104
+
105
+ Directories with special meaning — generated, build output, tooling.
106
+
107
+ **[Directory]:**
108
+ - Path: `[path]`
109
+ - Purpose: [e.g., "Build output", "Generated code", "Package cache"]
110
+ - Source: [e.g., "Auto-generated by X", "Build artifacts"]
111
+ - Committed: [Yes/No]
112
+ </special-directories>
113
+ </template>
114
+
115
+ <guidelines>
116
+
117
+ **Directory Layout:**
118
+ - Go deep enough to show where subsystems and shared code live, but stop at subsystem
119
+ boundaries. Internal subsystem structure belongs in per-subsystem docs
120
+ - Every directory gets a `# Purpose` comment
121
+ - Use ASCII box-drawing characters: `├── └── │`
122
+ - Do NOT list individual files except at root level (package.json, README, etc.)
123
+
124
+ **Subsystem Index:**
125
+ - One row per subsystem. This is the first thing agents scan
126
+ - Path should point to the subsystem root directory
127
+ - Purpose must be one line — if you need more, it goes in the subsystem doc
128
+ - Link to per-subsystem docs so agents know where to find detail
129
+
130
+ **Identifying subsystems by project type:**
131
+ - Microservices: each service directory = one subsystem
132
+ - Monolith modules: each bounded context / feature module = one subsystem
133
+ - Monorepo packages: each publishable package = one subsystem
134
+ - Hybrid: mix of all three — anything with a clear responsibility boundary
135
+
136
+ **Monolith examples:**
137
+ - Django app with `users/`, `orders/`, `payments/` apps → 3 subsystems
138
+ - .NET solution with `Auth.Module`, `Billing.Module`, `Notifications.Module` → 3 subsystems
139
+ - Express app with `src/features/auth/`, `src/features/checkout/` → 2 subsystems
140
+ - Small CLI tool with no clear modules → 1 subsystem (the whole app)
141
+
142
+ **Shared Directories:**
143
+ - Only list directories used by 2+ subsystems
144
+ - Common examples: shared libraries, generated clients, design tokens, DB migrations
145
+ - If a "shared" dir is only used by one subsystem, it belongs in that subsystem's doc
146
+
147
+ **Root Configuration:**
148
+ - Focus on files a developer needs to know about when setting up or building
149
+ - DO NOT list every dotfile. Focus on the ones that matter
150
+ - NEVER include contents of .env files — note existence only
151
+
152
+ **What does NOT belong here:**
153
+ - Conceptual architecture (that's system-architecture.md)
154
+ - Internal subsystem structure (that's subsystem-structure docs)
155
+ - Technology stack details (that's system-architecture.md tech-stack section)
156
+ - Code conventions (that's a separate conventions doc)
157
+
158
+ </guidelines>
159
+
160
+ <evolution>
161
+
162
+ Update when the physical organization of the system changes.
163
+
164
+ **Update triggers:**
165
+ - New subsystem added (new service, new module, new package)
166
+ - Subsystem removed, split, or merged
167
+ - Shared directory added or removed
168
+ - Workspace/monorepo configuration changed
169
+ - Root-level config files added or removed
170
+
171
+ **NOT an update trigger:**
172
+ - New files within an existing subsystem (per-subsystem docs)
173
+ - New features within existing structure
174
+ - Internal refactoring that doesn't change directory layout
175
+
176
+ </evolution>
177
+
178
+ </system-structure>