siesa-agents 2.1.2 → 2.1.3-dev.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.
Files changed (114) hide show
  1. package/README.md +83 -83
  2. package/bin/install.js +400 -400
  3. package/bin/prepare-publish.js +26 -26
  4. package/bin/restore-folders.js +26 -26
  5. package/bmad-core/agent-teams/team-all.yaml +15 -15
  6. package/bmad-core/agent-teams/team-fullstack.yaml +19 -19
  7. package/bmad-core/agent-teams/team-ide-minimal.yaml +11 -11
  8. package/bmad-core/agent-teams/team-no-ui.yaml +14 -14
  9. package/bmad-core/agents/analyst.md +84 -84
  10. package/bmad-core/agents/architect.md +94 -94
  11. package/bmad-core/agents/backend-agent.md +189 -189
  12. package/bmad-core/agents/bmad-master.md +110 -110
  13. package/bmad-core/agents/bmad-orchestrator.md +147 -147
  14. package/bmad-core/agents/dev.md +81 -81
  15. package/bmad-core/agents/frontend-agent.md +168 -168
  16. package/bmad-core/agents/pm.md +84 -84
  17. package/bmad-core/agents/po.md +79 -79
  18. package/bmad-core/agents/qa.md +91 -91
  19. package/bmad-core/agents/sm.md +65 -65
  20. package/bmad-core/agents/ux-expert.md +69 -69
  21. package/bmad-core/checklists/architect-checklist.md +440 -440
  22. package/bmad-core/checklists/backend-checklist.md +142 -142
  23. package/bmad-core/checklists/change-checklist.md +184 -184
  24. package/bmad-core/checklists/frontend-checklist.md +105 -105
  25. package/bmad-core/checklists/pm-checklist.md +372 -372
  26. package/bmad-core/checklists/po-master-checklist.md +434 -434
  27. package/bmad-core/checklists/story-dod-checklist.md +96 -96
  28. package/bmad-core/checklists/story-draft-checklist.md +155 -155
  29. package/bmad-core/core-config.yaml +22 -22
  30. package/bmad-core/data/backend-standards.md +439 -439
  31. package/bmad-core/data/bmad-kb.md +809 -809
  32. package/bmad-core/data/brainstorming-techniques.md +38 -38
  33. package/bmad-core/data/elicitation-methods.md +156 -156
  34. package/bmad-core/data/frontend-standards.md +323 -323
  35. package/bmad-core/data/technical-preferences.md +5 -5
  36. package/bmad-core/data/test-levels-framework.md +148 -148
  37. package/bmad-core/data/test-priorities-matrix.md +174 -174
  38. package/bmad-core/enhanced-ide-development-workflow.md +248 -248
  39. package/bmad-core/install-manifest.yaml +230 -230
  40. package/bmad-core/tasks/advanced-elicitation.md +119 -119
  41. package/bmad-core/tasks/apply-qa-fixes.md +150 -150
  42. package/bmad-core/tasks/brownfield-create-epic.md +162 -162
  43. package/bmad-core/tasks/brownfield-create-story.md +149 -149
  44. package/bmad-core/tasks/correct-course.md +72 -72
  45. package/bmad-core/tasks/create-brownfield-story.md +314 -314
  46. package/bmad-core/tasks/create-component.md +102 -102
  47. package/bmad-core/tasks/create-deep-research-prompt.md +280 -280
  48. package/bmad-core/tasks/create-doc.md +103 -103
  49. package/bmad-core/tasks/create-entity.md +132 -132
  50. package/bmad-core/tasks/create-feature.md +90 -90
  51. package/bmad-core/tasks/create-next-story.md +114 -114
  52. package/bmad-core/tasks/create-service.md +117 -117
  53. package/bmad-core/tasks/create-use-case.md +140 -140
  54. package/bmad-core/tasks/document-project.md +345 -345
  55. package/bmad-core/tasks/execute-checklist.md +88 -88
  56. package/bmad-core/tasks/facilitate-brainstorming-session.md +138 -138
  57. package/bmad-core/tasks/generate-ai-frontend-prompt.md +53 -53
  58. package/bmad-core/tasks/index-docs.md +175 -175
  59. package/bmad-core/tasks/kb-mode-interaction.md +77 -77
  60. package/bmad-core/tasks/nfr-assess.md +345 -345
  61. package/bmad-core/tasks/qa-gate.md +163 -163
  62. package/bmad-core/tasks/review-story.md +316 -316
  63. package/bmad-core/tasks/risk-profile.md +355 -355
  64. package/bmad-core/tasks/scaffold-backend.md +110 -110
  65. package/bmad-core/tasks/scaffold-frontend.md +78 -78
  66. package/bmad-core/tasks/shard-doc.md +187 -187
  67. package/bmad-core/tasks/test-design.md +176 -176
  68. package/bmad-core/tasks/trace-requirements.md +266 -266
  69. package/bmad-core/tasks/validate-next-story.md +136 -136
  70. package/bmad-core/templates/architecture-tmpl.yaml +662 -662
  71. package/bmad-core/templates/brainstorming-output-tmpl.yaml +156 -156
  72. package/bmad-core/templates/brownfield-architecture-tmpl.yaml +477 -477
  73. package/bmad-core/templates/brownfield-prd-tmpl.yaml +281 -281
  74. package/bmad-core/templates/competitor-analysis-tmpl.yaml +307 -307
  75. package/bmad-core/templates/front-end-architecture-tmpl.yaml +258 -258
  76. package/bmad-core/templates/front-end-spec-tmpl.yaml +350 -350
  77. package/bmad-core/templates/fullstack-architecture-tmpl.yaml +824 -824
  78. package/bmad-core/templates/market-research-tmpl.yaml +253 -253
  79. package/bmad-core/templates/prd-tmpl.yaml +203 -203
  80. package/bmad-core/templates/project-brief-tmpl.yaml +222 -222
  81. package/bmad-core/templates/qa-gate-tmpl.yaml +103 -103
  82. package/bmad-core/templates/story-tmpl.yaml +138 -138
  83. package/bmad-core/user-guide.md +530 -530
  84. package/bmad-core/utils/bmad-doc-template.md +327 -327
  85. package/bmad-core/utils/workflow-management.md +71 -71
  86. package/bmad-core/workflows/brownfield-fullstack.yaml +298 -298
  87. package/bmad-core/workflows/brownfield-service.yaml +188 -188
  88. package/bmad-core/workflows/brownfield-ui.yaml +198 -198
  89. package/bmad-core/workflows/greenfield-fullstack.yaml +241 -241
  90. package/bmad-core/workflows/greenfield-service.yaml +207 -207
  91. package/bmad-core/workflows/greenfield-ui.yaml +236 -236
  92. package/bmad-core/working-in-the-brownfield.md +606 -606
  93. package/claude/commands/BMad/agents/backend.md +187 -187
  94. package/claude/commands/BMad/agents/frontend.md +150 -150
  95. package/claude/hooks/file-restriction-hook.py +51 -0
  96. package/claude/hooks/track-agent.py +67 -0
  97. package/claude/settings.local.json +37 -1
  98. package/github/b-mad-expert.md +742 -742
  99. package/github/chatmodes/analyst.chatmode.md +89 -89
  100. package/github/chatmodes/architect.chatmode.md +97 -97
  101. package/github/chatmodes/backend.chatmode.md +194 -194
  102. package/github/chatmodes/bmad-master.chatmode.md +115 -115
  103. package/github/chatmodes/bmad-orchestrator.chatmode.md +152 -152
  104. package/github/chatmodes/dev.chatmode.md +86 -86
  105. package/github/chatmodes/frontend.chatmode.md +157 -157
  106. package/github/chatmodes/pm.chatmode.md +89 -89
  107. package/github/chatmodes/po.chatmode.md +84 -84
  108. package/github/chatmodes/qa.chatmode.md +96 -96
  109. package/github/chatmodes/sm.chatmode.md +70 -70
  110. package/github/chatmodes/ux-expert.chatmode.md +74 -74
  111. package/index.js +9 -9
  112. package/package.json +37 -37
  113. package/vscode/mcp.json +11 -11
  114. package/vscode/settings.json +12 -12
@@ -1,345 +1,345 @@
1
- <!-- Powered by BMAD™ Core -->
2
-
3
- # Document an Existing Project
4
-
5
- ## Purpose
6
-
7
- Generate comprehensive documentation for existing projects optimized for AI development agents. This task creates structured reference materials that enable AI agents to understand project context, conventions, and patterns for effective contribution to any codebase.
8
-
9
- ## Task Instructions
10
-
11
- ### 1. Initial Project Analysis
12
-
13
- **CRITICAL:** First, check if a PRD or requirements document exists in context. If yes, use it to focus your documentation efforts on relevant areas only.
14
-
15
- **IF PRD EXISTS**:
16
-
17
- - Review the PRD to understand what enhancement/feature is planned
18
- - Identify which modules, services, or areas will be affected
19
- - Focus documentation ONLY on these relevant areas
20
- - Skip unrelated parts of the codebase to keep docs lean
21
-
22
- **IF NO PRD EXISTS**:
23
- Ask the user:
24
-
25
- "I notice you haven't provided a PRD or requirements document. To create more focused and useful documentation, I recommend one of these options:
26
-
27
- 1. **Create a PRD first** - Would you like me to help create a brownfield PRD before documenting? This helps focus documentation on relevant areas.
28
-
29
- 2. **Provide existing requirements** - Do you have a requirements document, epic, or feature description you can share?
30
-
31
- 3. **Describe the focus** - Can you briefly describe what enhancement or feature you're planning? For example:
32
- - 'Adding payment processing to the user service'
33
- - 'Refactoring the authentication module'
34
- - 'Integrating with a new third-party API'
35
-
36
- 4. **Document everything** - Or should I proceed with comprehensive documentation of the entire codebase? (Note: This may create excessive documentation for large projects)
37
-
38
- Please let me know your preference, or I can proceed with full documentation if you prefer."
39
-
40
- Based on their response:
41
-
42
- - If they choose option 1-3: Use that context to focus documentation
43
- - If they choose option 4 or decline: Proceed with comprehensive analysis below
44
-
45
- Begin by conducting analysis of the existing project. Use available tools to:
46
-
47
- 1. **Project Structure Discovery**: Examine the root directory structure, identify main folders, and understand the overall organization
48
- 2. **Technology Stack Identification**: Look for package.json, requirements.txt, Cargo.toml, pom.xml, etc. to identify languages, frameworks, and dependencies
49
- 3. **Build System Analysis**: Find build scripts, CI/CD configurations, and development commands
50
- 4. **Existing Documentation Review**: Check for README files, docs folders, and any existing documentation
51
- 5. **Code Pattern Analysis**: Sample key files to understand coding patterns, naming conventions, and architectural approaches
52
-
53
- Ask the user these elicitation questions to better understand their needs:
54
-
55
- - What is the primary purpose of this project?
56
- - Are there any specific areas of the codebase that are particularly complex or important for agents to understand?
57
- - What types of tasks do you expect AI agents to perform on this project? (e.g., bug fixes, feature additions, refactoring, testing)
58
- - Are there any existing documentation standards or formats you prefer?
59
- - What level of technical detail should the documentation target? (junior developers, senior developers, mixed team)
60
- - Is there a specific feature or enhancement you're planning? (This helps focus documentation)
61
-
62
- ### 2. Deep Codebase Analysis
63
-
64
- CRITICAL: Before generating documentation, conduct extensive analysis of the existing codebase:
65
-
66
- 1. **Explore Key Areas**:
67
- - Entry points (main files, index files, app initializers)
68
- - Configuration files and environment setup
69
- - Package dependencies and versions
70
- - Build and deployment configurations
71
- - Test suites and coverage
72
-
73
- 2. **Ask Clarifying Questions**:
74
- - "I see you're using [technology X]. Are there any custom patterns or conventions I should document?"
75
- - "What are the most critical/complex parts of this system that developers struggle with?"
76
- - "Are there any undocumented 'tribal knowledge' areas I should capture?"
77
- - "What technical debt or known issues should I document?"
78
- - "Which parts of the codebase change most frequently?"
79
-
80
- 3. **Map the Reality**:
81
- - Identify ACTUAL patterns used (not theoretical best practices)
82
- - Find where key business logic lives
83
- - Locate integration points and external dependencies
84
- - Document workarounds and technical debt
85
- - Note areas that differ from standard patterns
86
-
87
- **IF PRD PROVIDED**: Also analyze what would need to change for the enhancement
88
-
89
- ### 3. Core Documentation Generation
90
-
91
- [[LLM: Generate a comprehensive BROWNFIELD architecture document that reflects the ACTUAL state of the codebase.
92
-
93
- **CRITICAL**: This is NOT an aspirational architecture document. Document what EXISTS, including:
94
-
95
- - Technical debt and workarounds
96
- - Inconsistent patterns between different parts
97
- - Legacy code that can't be changed
98
- - Integration constraints
99
- - Performance bottlenecks
100
-
101
- **Document Structure**:
102
-
103
- # [Project Name] Brownfield Architecture Document
104
-
105
- ## Introduction
106
-
107
- This document captures the CURRENT STATE of the [Project Name] codebase, including technical debt, workarounds, and real-world patterns. It serves as a reference for AI agents working on enhancements.
108
-
109
- ### Document Scope
110
-
111
- [If PRD provided: "Focused on areas relevant to: {enhancement description}"]
112
- [If no PRD: "Comprehensive documentation of entire system"]
113
-
114
- ### Change Log
115
-
116
- | Date | Version | Description | Author |
117
- | ------ | ------- | --------------------------- | --------- |
118
- | [Date] | 1.0 | Initial brownfield analysis | [Analyst] |
119
-
120
- ## Quick Reference - Key Files and Entry Points
121
-
122
- ### Critical Files for Understanding the System
123
-
124
- - **Main Entry**: `src/index.js` (or actual entry point)
125
- - **Configuration**: `config/app.config.js`, `.env.example`
126
- - **Core Business Logic**: `src/services/`, `src/domain/`
127
- - **API Definitions**: `src/routes/` or link to OpenAPI spec
128
- - **Database Models**: `src/models/` or link to schema files
129
- - **Key Algorithms**: [List specific files with complex logic]
130
-
131
- ### If PRD Provided - Enhancement Impact Areas
132
-
133
- [Highlight which files/modules will be affected by the planned enhancement]
134
-
135
- ## High Level Architecture
136
-
137
- ### Technical Summary
138
-
139
- ### Actual Tech Stack (from package.json/requirements.txt)
140
-
141
- | Category | Technology | Version | Notes |
142
- | --------- | ---------- | ------- | -------------------------- |
143
- | Runtime | Node.js | 16.x | [Any constraints] |
144
- | Framework | Express | 4.18.2 | [Custom middleware?] |
145
- | Database | PostgreSQL | 13 | [Connection pooling setup] |
146
-
147
- etc...
148
-
149
- ### Repository Structure Reality Check
150
-
151
- - Type: [Monorepo/Polyrepo/Hybrid]
152
- - Package Manager: [npm/yarn/pnpm]
153
- - Notable: [Any unusual structure decisions]
154
-
155
- ## Source Tree and Module Organization
156
-
157
- ### Project Structure (Actual)
158
-
159
- ```text
160
- project-root/
161
- ├── src/
162
- │ ├── controllers/ # HTTP request handlers
163
- │ ├── services/ # Business logic (NOTE: inconsistent patterns between user and payment services)
164
- │ ├── models/ # Database models (Sequelize)
165
- │ ├── utils/ # Mixed bag - needs refactoring
166
- │ └── legacy/ # DO NOT MODIFY - old payment system still in use
167
- ├── tests/ # Jest tests (60% coverage)
168
- ├── scripts/ # Build and deployment scripts
169
- └── config/ # Environment configs
170
- ```
171
-
172
- ### Key Modules and Their Purpose
173
-
174
- - **User Management**: `src/services/userService.js` - Handles all user operations
175
- - **Authentication**: `src/middleware/auth.js` - JWT-based, custom implementation
176
- - **Payment Processing**: `src/legacy/payment.js` - CRITICAL: Do not refactor, tightly coupled
177
- - **[List other key modules with their actual files]**
178
-
179
- ## Data Models and APIs
180
-
181
- ### Data Models
182
-
183
- Instead of duplicating, reference actual model files:
184
-
185
- - **User Model**: See `src/models/User.js`
186
- - **Order Model**: See `src/models/Order.js`
187
- - **Related Types**: TypeScript definitions in `src/types/`
188
-
189
- ### API Specifications
190
-
191
- - **OpenAPI Spec**: `docs/api/openapi.yaml` (if exists)
192
- - **Postman Collection**: `docs/api/postman-collection.json`
193
- - **Manual Endpoints**: [List any undocumented endpoints discovered]
194
-
195
- ## Technical Debt and Known Issues
196
-
197
- ### Critical Technical Debt
198
-
199
- 1. **Payment Service**: Legacy code in `src/legacy/payment.js` - tightly coupled, no tests
200
- 2. **User Service**: Different pattern than other services, uses callbacks instead of promises
201
- 3. **Database Migrations**: Manually tracked, no proper migration tool
202
- 4. **[Other significant debt]**
203
-
204
- ### Workarounds and Gotchas
205
-
206
- - **Environment Variables**: Must set `NODE_ENV=production` even for staging (historical reason)
207
- - **Database Connections**: Connection pool hardcoded to 10, changing breaks payment service
208
- - **[Other workarounds developers need to know]**
209
-
210
- ## Integration Points and External Dependencies
211
-
212
- ### External Services
213
-
214
- | Service | Purpose | Integration Type | Key Files |
215
- | -------- | -------- | ---------------- | ------------------------------ |
216
- | Stripe | Payments | REST API | `src/integrations/stripe/` |
217
- | SendGrid | Emails | SDK | `src/services/emailService.js` |
218
-
219
- etc...
220
-
221
- ### Internal Integration Points
222
-
223
- - **Frontend Communication**: REST API on port 3000, expects specific headers
224
- - **Background Jobs**: Redis queue, see `src/workers/`
225
- - **[Other integrations]**
226
-
227
- ## Development and Deployment
228
-
229
- ### Local Development Setup
230
-
231
- 1. Actual steps that work (not ideal steps)
232
- 2. Known issues with setup
233
- 3. Required environment variables (see `.env.example`)
234
-
235
- ### Build and Deployment Process
236
-
237
- - **Build Command**: `npm run build` (webpack config in `webpack.config.js`)
238
- - **Deployment**: Manual deployment via `scripts/deploy.sh`
239
- - **Environments**: Dev, Staging, Prod (see `config/environments/`)
240
-
241
- ## Testing Reality
242
-
243
- ### Current Test Coverage
244
-
245
- - Unit Tests: 60% coverage (Jest)
246
- - Integration Tests: Minimal, in `tests/integration/`
247
- - E2E Tests: None
248
- - Manual Testing: Primary QA method
249
-
250
- ### Running Tests
251
-
252
- ```bash
253
- npm test # Runs unit tests
254
- npm run test:integration # Runs integration tests (requires local DB)
255
- ```
256
-
257
- ## If Enhancement PRD Provided - Impact Analysis
258
-
259
- ### Files That Will Need Modification
260
-
261
- Based on the enhancement requirements, these files will be affected:
262
-
263
- - `src/services/userService.js` - Add new user fields
264
- - `src/models/User.js` - Update schema
265
- - `src/routes/userRoutes.js` - New endpoints
266
- - [etc...]
267
-
268
- ### New Files/Modules Needed
269
-
270
- - `src/services/newFeatureService.js` - New business logic
271
- - `src/models/NewFeature.js` - New data model
272
- - [etc...]
273
-
274
- ### Integration Considerations
275
-
276
- - Will need to integrate with existing auth middleware
277
- - Must follow existing response format in `src/utils/responseFormatter.js`
278
- - [Other integration points]
279
-
280
- ## Appendix - Useful Commands and Scripts
281
-
282
- ### Frequently Used Commands
283
-
284
- ```bash
285
- npm run dev # Start development server
286
- npm run build # Production build
287
- npm run migrate # Run database migrations
288
- npm run seed # Seed test data
289
- ```
290
-
291
- ### Debugging and Troubleshooting
292
-
293
- - **Logs**: Check `logs/app.log` for application logs
294
- - **Debug Mode**: Set `DEBUG=app:*` for verbose logging
295
- - **Common Issues**: See `docs/troubleshooting.md`]]
296
-
297
- ### 4. Document Delivery
298
-
299
- 1. **In Web UI (Gemini, ChatGPT, Claude)**:
300
- - Present the entire document in one response (or multiple if too long)
301
- - Tell user to copy and save as `docs/brownfield-architecture.md` or `docs/project-architecture.md`
302
- - Mention it can be sharded later in IDE if needed
303
-
304
- 2. **In IDE Environment**:
305
- - Create the document as `docs/brownfield-architecture.md`
306
- - Inform user this single document contains all architectural information
307
- - Can be sharded later using PO agent if desired
308
-
309
- The document should be comprehensive enough that future agents can understand:
310
-
311
- - The actual state of the system (not idealized)
312
- - Where to find key files and logic
313
- - What technical debt exists
314
- - What constraints must be respected
315
- - If PRD provided: What needs to change for the enhancement]]
316
-
317
- ### 5. Quality Assurance
318
-
319
- CRITICAL: Before finalizing the document:
320
-
321
- 1. **Accuracy Check**: Verify all technical details match the actual codebase
322
- 2. **Completeness Review**: Ensure all major system components are documented
323
- 3. **Focus Validation**: If user provided scope, verify relevant areas are emphasized
324
- 4. **Clarity Assessment**: Check that explanations are clear for AI agents
325
- 5. **Navigation**: Ensure document has clear section structure for easy reference
326
-
327
- Apply the advanced elicitation task after major sections to refine based on user feedback.
328
-
329
- ## Success Criteria
330
-
331
- - Single comprehensive brownfield architecture document created
332
- - Document reflects REALITY including technical debt and workarounds
333
- - Key files and modules are referenced with actual paths
334
- - Models/APIs reference source files rather than duplicating content
335
- - If PRD provided: Clear impact analysis showing what needs to change
336
- - Document enables AI agents to navigate and understand the actual codebase
337
- - Technical constraints and "gotchas" are clearly documented
338
-
339
- ## Notes
340
-
341
- - This task creates ONE document that captures the TRUE state of the system
342
- - References actual files rather than duplicating content when possible
343
- - Documents technical debt, workarounds, and constraints honestly
344
- - For brownfield projects with PRD: Provides clear enhancement impact analysis
345
- - The goal is PRACTICAL documentation for AI agents doing real work
1
+ <!-- Powered by BMAD™ Core -->
2
+
3
+ # Document an Existing Project
4
+
5
+ ## Purpose
6
+
7
+ Generate comprehensive documentation for existing projects optimized for AI development agents. This task creates structured reference materials that enable AI agents to understand project context, conventions, and patterns for effective contribution to any codebase.
8
+
9
+ ## Task Instructions
10
+
11
+ ### 1. Initial Project Analysis
12
+
13
+ **CRITICAL:** First, check if a PRD or requirements document exists in context. If yes, use it to focus your documentation efforts on relevant areas only.
14
+
15
+ **IF PRD EXISTS**:
16
+
17
+ - Review the PRD to understand what enhancement/feature is planned
18
+ - Identify which modules, services, or areas will be affected
19
+ - Focus documentation ONLY on these relevant areas
20
+ - Skip unrelated parts of the codebase to keep docs lean
21
+
22
+ **IF NO PRD EXISTS**:
23
+ Ask the user:
24
+
25
+ "I notice you haven't provided a PRD or requirements document. To create more focused and useful documentation, I recommend one of these options:
26
+
27
+ 1. **Create a PRD first** - Would you like me to help create a brownfield PRD before documenting? This helps focus documentation on relevant areas.
28
+
29
+ 2. **Provide existing requirements** - Do you have a requirements document, epic, or feature description you can share?
30
+
31
+ 3. **Describe the focus** - Can you briefly describe what enhancement or feature you're planning? For example:
32
+ - 'Adding payment processing to the user service'
33
+ - 'Refactoring the authentication module'
34
+ - 'Integrating with a new third-party API'
35
+
36
+ 4. **Document everything** - Or should I proceed with comprehensive documentation of the entire codebase? (Note: This may create excessive documentation for large projects)
37
+
38
+ Please let me know your preference, or I can proceed with full documentation if you prefer."
39
+
40
+ Based on their response:
41
+
42
+ - If they choose option 1-3: Use that context to focus documentation
43
+ - If they choose option 4 or decline: Proceed with comprehensive analysis below
44
+
45
+ Begin by conducting analysis of the existing project. Use available tools to:
46
+
47
+ 1. **Project Structure Discovery**: Examine the root directory structure, identify main folders, and understand the overall organization
48
+ 2. **Technology Stack Identification**: Look for package.json, requirements.txt, Cargo.toml, pom.xml, etc. to identify languages, frameworks, and dependencies
49
+ 3. **Build System Analysis**: Find build scripts, CI/CD configurations, and development commands
50
+ 4. **Existing Documentation Review**: Check for README files, docs folders, and any existing documentation
51
+ 5. **Code Pattern Analysis**: Sample key files to understand coding patterns, naming conventions, and architectural approaches
52
+
53
+ Ask the user these elicitation questions to better understand their needs:
54
+
55
+ - What is the primary purpose of this project?
56
+ - Are there any specific areas of the codebase that are particularly complex or important for agents to understand?
57
+ - What types of tasks do you expect AI agents to perform on this project? (e.g., bug fixes, feature additions, refactoring, testing)
58
+ - Are there any existing documentation standards or formats you prefer?
59
+ - What level of technical detail should the documentation target? (junior developers, senior developers, mixed team)
60
+ - Is there a specific feature or enhancement you're planning? (This helps focus documentation)
61
+
62
+ ### 2. Deep Codebase Analysis
63
+
64
+ CRITICAL: Before generating documentation, conduct extensive analysis of the existing codebase:
65
+
66
+ 1. **Explore Key Areas**:
67
+ - Entry points (main files, index files, app initializers)
68
+ - Configuration files and environment setup
69
+ - Package dependencies and versions
70
+ - Build and deployment configurations
71
+ - Test suites and coverage
72
+
73
+ 2. **Ask Clarifying Questions**:
74
+ - "I see you're using [technology X]. Are there any custom patterns or conventions I should document?"
75
+ - "What are the most critical/complex parts of this system that developers struggle with?"
76
+ - "Are there any undocumented 'tribal knowledge' areas I should capture?"
77
+ - "What technical debt or known issues should I document?"
78
+ - "Which parts of the codebase change most frequently?"
79
+
80
+ 3. **Map the Reality**:
81
+ - Identify ACTUAL patterns used (not theoretical best practices)
82
+ - Find where key business logic lives
83
+ - Locate integration points and external dependencies
84
+ - Document workarounds and technical debt
85
+ - Note areas that differ from standard patterns
86
+
87
+ **IF PRD PROVIDED**: Also analyze what would need to change for the enhancement
88
+
89
+ ### 3. Core Documentation Generation
90
+
91
+ [[LLM: Generate a comprehensive BROWNFIELD architecture document that reflects the ACTUAL state of the codebase.
92
+
93
+ **CRITICAL**: This is NOT an aspirational architecture document. Document what EXISTS, including:
94
+
95
+ - Technical debt and workarounds
96
+ - Inconsistent patterns between different parts
97
+ - Legacy code that can't be changed
98
+ - Integration constraints
99
+ - Performance bottlenecks
100
+
101
+ **Document Structure**:
102
+
103
+ # [Project Name] Brownfield Architecture Document
104
+
105
+ ## Introduction
106
+
107
+ This document captures the CURRENT STATE of the [Project Name] codebase, including technical debt, workarounds, and real-world patterns. It serves as a reference for AI agents working on enhancements.
108
+
109
+ ### Document Scope
110
+
111
+ [If PRD provided: "Focused on areas relevant to: {enhancement description}"]
112
+ [If no PRD: "Comprehensive documentation of entire system"]
113
+
114
+ ### Change Log
115
+
116
+ | Date | Version | Description | Author |
117
+ | ------ | ------- | --------------------------- | --------- |
118
+ | [Date] | 1.0 | Initial brownfield analysis | [Analyst] |
119
+
120
+ ## Quick Reference - Key Files and Entry Points
121
+
122
+ ### Critical Files for Understanding the System
123
+
124
+ - **Main Entry**: `src/index.js` (or actual entry point)
125
+ - **Configuration**: `config/app.config.js`, `.env.example`
126
+ - **Core Business Logic**: `src/services/`, `src/domain/`
127
+ - **API Definitions**: `src/routes/` or link to OpenAPI spec
128
+ - **Database Models**: `src/models/` or link to schema files
129
+ - **Key Algorithms**: [List specific files with complex logic]
130
+
131
+ ### If PRD Provided - Enhancement Impact Areas
132
+
133
+ [Highlight which files/modules will be affected by the planned enhancement]
134
+
135
+ ## High Level Architecture
136
+
137
+ ### Technical Summary
138
+
139
+ ### Actual Tech Stack (from package.json/requirements.txt)
140
+
141
+ | Category | Technology | Version | Notes |
142
+ | --------- | ---------- | ------- | -------------------------- |
143
+ | Runtime | Node.js | 16.x | [Any constraints] |
144
+ | Framework | Express | 4.18.2 | [Custom middleware?] |
145
+ | Database | PostgreSQL | 13 | [Connection pooling setup] |
146
+
147
+ etc...
148
+
149
+ ### Repository Structure Reality Check
150
+
151
+ - Type: [Monorepo/Polyrepo/Hybrid]
152
+ - Package Manager: [npm/yarn/pnpm]
153
+ - Notable: [Any unusual structure decisions]
154
+
155
+ ## Source Tree and Module Organization
156
+
157
+ ### Project Structure (Actual)
158
+
159
+ ```text
160
+ project-root/
161
+ ├── src/
162
+ │ ├── controllers/ # HTTP request handlers
163
+ │ ├── services/ # Business logic (NOTE: inconsistent patterns between user and payment services)
164
+ │ ├── models/ # Database models (Sequelize)
165
+ │ ├── utils/ # Mixed bag - needs refactoring
166
+ │ └── legacy/ # DO NOT MODIFY - old payment system still in use
167
+ ├── tests/ # Jest tests (60% coverage)
168
+ ├── scripts/ # Build and deployment scripts
169
+ └── config/ # Environment configs
170
+ ```
171
+
172
+ ### Key Modules and Their Purpose
173
+
174
+ - **User Management**: `src/services/userService.js` - Handles all user operations
175
+ - **Authentication**: `src/middleware/auth.js` - JWT-based, custom implementation
176
+ - **Payment Processing**: `src/legacy/payment.js` - CRITICAL: Do not refactor, tightly coupled
177
+ - **[List other key modules with their actual files]**
178
+
179
+ ## Data Models and APIs
180
+
181
+ ### Data Models
182
+
183
+ Instead of duplicating, reference actual model files:
184
+
185
+ - **User Model**: See `src/models/User.js`
186
+ - **Order Model**: See `src/models/Order.js`
187
+ - **Related Types**: TypeScript definitions in `src/types/`
188
+
189
+ ### API Specifications
190
+
191
+ - **OpenAPI Spec**: `docs/api/openapi.yaml` (if exists)
192
+ - **Postman Collection**: `docs/api/postman-collection.json`
193
+ - **Manual Endpoints**: [List any undocumented endpoints discovered]
194
+
195
+ ## Technical Debt and Known Issues
196
+
197
+ ### Critical Technical Debt
198
+
199
+ 1. **Payment Service**: Legacy code in `src/legacy/payment.js` - tightly coupled, no tests
200
+ 2. **User Service**: Different pattern than other services, uses callbacks instead of promises
201
+ 3. **Database Migrations**: Manually tracked, no proper migration tool
202
+ 4. **[Other significant debt]**
203
+
204
+ ### Workarounds and Gotchas
205
+
206
+ - **Environment Variables**: Must set `NODE_ENV=production` even for staging (historical reason)
207
+ - **Database Connections**: Connection pool hardcoded to 10, changing breaks payment service
208
+ - **[Other workarounds developers need to know]**
209
+
210
+ ## Integration Points and External Dependencies
211
+
212
+ ### External Services
213
+
214
+ | Service | Purpose | Integration Type | Key Files |
215
+ | -------- | -------- | ---------------- | ------------------------------ |
216
+ | Stripe | Payments | REST API | `src/integrations/stripe/` |
217
+ | SendGrid | Emails | SDK | `src/services/emailService.js` |
218
+
219
+ etc...
220
+
221
+ ### Internal Integration Points
222
+
223
+ - **Frontend Communication**: REST API on port 3000, expects specific headers
224
+ - **Background Jobs**: Redis queue, see `src/workers/`
225
+ - **[Other integrations]**
226
+
227
+ ## Development and Deployment
228
+
229
+ ### Local Development Setup
230
+
231
+ 1. Actual steps that work (not ideal steps)
232
+ 2. Known issues with setup
233
+ 3. Required environment variables (see `.env.example`)
234
+
235
+ ### Build and Deployment Process
236
+
237
+ - **Build Command**: `npm run build` (webpack config in `webpack.config.js`)
238
+ - **Deployment**: Manual deployment via `scripts/deploy.sh`
239
+ - **Environments**: Dev, Staging, Prod (see `config/environments/`)
240
+
241
+ ## Testing Reality
242
+
243
+ ### Current Test Coverage
244
+
245
+ - Unit Tests: 60% coverage (Jest)
246
+ - Integration Tests: Minimal, in `tests/integration/`
247
+ - E2E Tests: None
248
+ - Manual Testing: Primary QA method
249
+
250
+ ### Running Tests
251
+
252
+ ```bash
253
+ npm test # Runs unit tests
254
+ npm run test:integration # Runs integration tests (requires local DB)
255
+ ```
256
+
257
+ ## If Enhancement PRD Provided - Impact Analysis
258
+
259
+ ### Files That Will Need Modification
260
+
261
+ Based on the enhancement requirements, these files will be affected:
262
+
263
+ - `src/services/userService.js` - Add new user fields
264
+ - `src/models/User.js` - Update schema
265
+ - `src/routes/userRoutes.js` - New endpoints
266
+ - [etc...]
267
+
268
+ ### New Files/Modules Needed
269
+
270
+ - `src/services/newFeatureService.js` - New business logic
271
+ - `src/models/NewFeature.js` - New data model
272
+ - [etc...]
273
+
274
+ ### Integration Considerations
275
+
276
+ - Will need to integrate with existing auth middleware
277
+ - Must follow existing response format in `src/utils/responseFormatter.js`
278
+ - [Other integration points]
279
+
280
+ ## Appendix - Useful Commands and Scripts
281
+
282
+ ### Frequently Used Commands
283
+
284
+ ```bash
285
+ npm run dev # Start development server
286
+ npm run build # Production build
287
+ npm run migrate # Run database migrations
288
+ npm run seed # Seed test data
289
+ ```
290
+
291
+ ### Debugging and Troubleshooting
292
+
293
+ - **Logs**: Check `logs/app.log` for application logs
294
+ - **Debug Mode**: Set `DEBUG=app:*` for verbose logging
295
+ - **Common Issues**: See `docs/troubleshooting.md`]]
296
+
297
+ ### 4. Document Delivery
298
+
299
+ 1. **In Web UI (Gemini, ChatGPT, Claude)**:
300
+ - Present the entire document in one response (or multiple if too long)
301
+ - Tell user to copy and save as `docs/brownfield-architecture.md` or `docs/project-architecture.md`
302
+ - Mention it can be sharded later in IDE if needed
303
+
304
+ 2. **In IDE Environment**:
305
+ - Create the document as `docs/brownfield-architecture.md`
306
+ - Inform user this single document contains all architectural information
307
+ - Can be sharded later using PO agent if desired
308
+
309
+ The document should be comprehensive enough that future agents can understand:
310
+
311
+ - The actual state of the system (not idealized)
312
+ - Where to find key files and logic
313
+ - What technical debt exists
314
+ - What constraints must be respected
315
+ - If PRD provided: What needs to change for the enhancement]]
316
+
317
+ ### 5. Quality Assurance
318
+
319
+ CRITICAL: Before finalizing the document:
320
+
321
+ 1. **Accuracy Check**: Verify all technical details match the actual codebase
322
+ 2. **Completeness Review**: Ensure all major system components are documented
323
+ 3. **Focus Validation**: If user provided scope, verify relevant areas are emphasized
324
+ 4. **Clarity Assessment**: Check that explanations are clear for AI agents
325
+ 5. **Navigation**: Ensure document has clear section structure for easy reference
326
+
327
+ Apply the advanced elicitation task after major sections to refine based on user feedback.
328
+
329
+ ## Success Criteria
330
+
331
+ - Single comprehensive brownfield architecture document created
332
+ - Document reflects REALITY including technical debt and workarounds
333
+ - Key files and modules are referenced with actual paths
334
+ - Models/APIs reference source files rather than duplicating content
335
+ - If PRD provided: Clear impact analysis showing what needs to change
336
+ - Document enables AI agents to navigate and understand the actual codebase
337
+ - Technical constraints and "gotchas" are clearly documented
338
+
339
+ ## Notes
340
+
341
+ - This task creates ONE document that captures the TRUE state of the system
342
+ - References actual files rather than duplicating content when possible
343
+ - Documents technical debt, workarounds, and constraints honestly
344
+ - For brownfield projects with PRD: Provides clear enhancement impact analysis
345
+ - The goal is PRACTICAL documentation for AI agents doing real work