foundry-mcp 0.8.22__py3-none-any.whl

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.

Potentially problematic release.


This version of foundry-mcp might be problematic. Click here for more details.

Files changed (153) hide show
  1. foundry_mcp/__init__.py +13 -0
  2. foundry_mcp/cli/__init__.py +67 -0
  3. foundry_mcp/cli/__main__.py +9 -0
  4. foundry_mcp/cli/agent.py +96 -0
  5. foundry_mcp/cli/commands/__init__.py +37 -0
  6. foundry_mcp/cli/commands/cache.py +137 -0
  7. foundry_mcp/cli/commands/dashboard.py +148 -0
  8. foundry_mcp/cli/commands/dev.py +446 -0
  9. foundry_mcp/cli/commands/journal.py +377 -0
  10. foundry_mcp/cli/commands/lifecycle.py +274 -0
  11. foundry_mcp/cli/commands/modify.py +824 -0
  12. foundry_mcp/cli/commands/plan.py +640 -0
  13. foundry_mcp/cli/commands/pr.py +393 -0
  14. foundry_mcp/cli/commands/review.py +667 -0
  15. foundry_mcp/cli/commands/session.py +472 -0
  16. foundry_mcp/cli/commands/specs.py +686 -0
  17. foundry_mcp/cli/commands/tasks.py +807 -0
  18. foundry_mcp/cli/commands/testing.py +676 -0
  19. foundry_mcp/cli/commands/validate.py +982 -0
  20. foundry_mcp/cli/config.py +98 -0
  21. foundry_mcp/cli/context.py +298 -0
  22. foundry_mcp/cli/logging.py +212 -0
  23. foundry_mcp/cli/main.py +44 -0
  24. foundry_mcp/cli/output.py +122 -0
  25. foundry_mcp/cli/registry.py +110 -0
  26. foundry_mcp/cli/resilience.py +178 -0
  27. foundry_mcp/cli/transcript.py +217 -0
  28. foundry_mcp/config.py +1454 -0
  29. foundry_mcp/core/__init__.py +144 -0
  30. foundry_mcp/core/ai_consultation.py +1773 -0
  31. foundry_mcp/core/batch_operations.py +1202 -0
  32. foundry_mcp/core/cache.py +195 -0
  33. foundry_mcp/core/capabilities.py +446 -0
  34. foundry_mcp/core/concurrency.py +898 -0
  35. foundry_mcp/core/context.py +540 -0
  36. foundry_mcp/core/discovery.py +1603 -0
  37. foundry_mcp/core/error_collection.py +728 -0
  38. foundry_mcp/core/error_store.py +592 -0
  39. foundry_mcp/core/health.py +749 -0
  40. foundry_mcp/core/intake.py +933 -0
  41. foundry_mcp/core/journal.py +700 -0
  42. foundry_mcp/core/lifecycle.py +412 -0
  43. foundry_mcp/core/llm_config.py +1376 -0
  44. foundry_mcp/core/llm_patterns.py +510 -0
  45. foundry_mcp/core/llm_provider.py +1569 -0
  46. foundry_mcp/core/logging_config.py +374 -0
  47. foundry_mcp/core/metrics_persistence.py +584 -0
  48. foundry_mcp/core/metrics_registry.py +327 -0
  49. foundry_mcp/core/metrics_store.py +641 -0
  50. foundry_mcp/core/modifications.py +224 -0
  51. foundry_mcp/core/naming.py +146 -0
  52. foundry_mcp/core/observability.py +1216 -0
  53. foundry_mcp/core/otel.py +452 -0
  54. foundry_mcp/core/otel_stubs.py +264 -0
  55. foundry_mcp/core/pagination.py +255 -0
  56. foundry_mcp/core/progress.py +387 -0
  57. foundry_mcp/core/prometheus.py +564 -0
  58. foundry_mcp/core/prompts/__init__.py +464 -0
  59. foundry_mcp/core/prompts/fidelity_review.py +691 -0
  60. foundry_mcp/core/prompts/markdown_plan_review.py +515 -0
  61. foundry_mcp/core/prompts/plan_review.py +627 -0
  62. foundry_mcp/core/providers/__init__.py +237 -0
  63. foundry_mcp/core/providers/base.py +515 -0
  64. foundry_mcp/core/providers/claude.py +472 -0
  65. foundry_mcp/core/providers/codex.py +637 -0
  66. foundry_mcp/core/providers/cursor_agent.py +630 -0
  67. foundry_mcp/core/providers/detectors.py +515 -0
  68. foundry_mcp/core/providers/gemini.py +426 -0
  69. foundry_mcp/core/providers/opencode.py +718 -0
  70. foundry_mcp/core/providers/opencode_wrapper.js +308 -0
  71. foundry_mcp/core/providers/package-lock.json +24 -0
  72. foundry_mcp/core/providers/package.json +25 -0
  73. foundry_mcp/core/providers/registry.py +607 -0
  74. foundry_mcp/core/providers/test_provider.py +171 -0
  75. foundry_mcp/core/providers/validation.py +857 -0
  76. foundry_mcp/core/rate_limit.py +427 -0
  77. foundry_mcp/core/research/__init__.py +68 -0
  78. foundry_mcp/core/research/memory.py +528 -0
  79. foundry_mcp/core/research/models.py +1234 -0
  80. foundry_mcp/core/research/providers/__init__.py +40 -0
  81. foundry_mcp/core/research/providers/base.py +242 -0
  82. foundry_mcp/core/research/providers/google.py +507 -0
  83. foundry_mcp/core/research/providers/perplexity.py +442 -0
  84. foundry_mcp/core/research/providers/semantic_scholar.py +544 -0
  85. foundry_mcp/core/research/providers/tavily.py +383 -0
  86. foundry_mcp/core/research/workflows/__init__.py +25 -0
  87. foundry_mcp/core/research/workflows/base.py +298 -0
  88. foundry_mcp/core/research/workflows/chat.py +271 -0
  89. foundry_mcp/core/research/workflows/consensus.py +539 -0
  90. foundry_mcp/core/research/workflows/deep_research.py +4142 -0
  91. foundry_mcp/core/research/workflows/ideate.py +682 -0
  92. foundry_mcp/core/research/workflows/thinkdeep.py +405 -0
  93. foundry_mcp/core/resilience.py +600 -0
  94. foundry_mcp/core/responses.py +1624 -0
  95. foundry_mcp/core/review.py +366 -0
  96. foundry_mcp/core/security.py +438 -0
  97. foundry_mcp/core/spec.py +4119 -0
  98. foundry_mcp/core/task.py +2463 -0
  99. foundry_mcp/core/testing.py +839 -0
  100. foundry_mcp/core/validation.py +2357 -0
  101. foundry_mcp/dashboard/__init__.py +32 -0
  102. foundry_mcp/dashboard/app.py +119 -0
  103. foundry_mcp/dashboard/components/__init__.py +17 -0
  104. foundry_mcp/dashboard/components/cards.py +88 -0
  105. foundry_mcp/dashboard/components/charts.py +177 -0
  106. foundry_mcp/dashboard/components/filters.py +136 -0
  107. foundry_mcp/dashboard/components/tables.py +195 -0
  108. foundry_mcp/dashboard/data/__init__.py +11 -0
  109. foundry_mcp/dashboard/data/stores.py +433 -0
  110. foundry_mcp/dashboard/launcher.py +300 -0
  111. foundry_mcp/dashboard/views/__init__.py +12 -0
  112. foundry_mcp/dashboard/views/errors.py +217 -0
  113. foundry_mcp/dashboard/views/metrics.py +164 -0
  114. foundry_mcp/dashboard/views/overview.py +96 -0
  115. foundry_mcp/dashboard/views/providers.py +83 -0
  116. foundry_mcp/dashboard/views/sdd_workflow.py +255 -0
  117. foundry_mcp/dashboard/views/tool_usage.py +139 -0
  118. foundry_mcp/prompts/__init__.py +9 -0
  119. foundry_mcp/prompts/workflows.py +525 -0
  120. foundry_mcp/resources/__init__.py +9 -0
  121. foundry_mcp/resources/specs.py +591 -0
  122. foundry_mcp/schemas/__init__.py +38 -0
  123. foundry_mcp/schemas/intake-schema.json +89 -0
  124. foundry_mcp/schemas/sdd-spec-schema.json +414 -0
  125. foundry_mcp/server.py +150 -0
  126. foundry_mcp/tools/__init__.py +10 -0
  127. foundry_mcp/tools/unified/__init__.py +92 -0
  128. foundry_mcp/tools/unified/authoring.py +3620 -0
  129. foundry_mcp/tools/unified/context_helpers.py +98 -0
  130. foundry_mcp/tools/unified/documentation_helpers.py +268 -0
  131. foundry_mcp/tools/unified/environment.py +1341 -0
  132. foundry_mcp/tools/unified/error.py +479 -0
  133. foundry_mcp/tools/unified/health.py +225 -0
  134. foundry_mcp/tools/unified/journal.py +841 -0
  135. foundry_mcp/tools/unified/lifecycle.py +640 -0
  136. foundry_mcp/tools/unified/metrics.py +777 -0
  137. foundry_mcp/tools/unified/plan.py +876 -0
  138. foundry_mcp/tools/unified/pr.py +294 -0
  139. foundry_mcp/tools/unified/provider.py +589 -0
  140. foundry_mcp/tools/unified/research.py +1283 -0
  141. foundry_mcp/tools/unified/review.py +1042 -0
  142. foundry_mcp/tools/unified/review_helpers.py +314 -0
  143. foundry_mcp/tools/unified/router.py +102 -0
  144. foundry_mcp/tools/unified/server.py +565 -0
  145. foundry_mcp/tools/unified/spec.py +1283 -0
  146. foundry_mcp/tools/unified/task.py +3846 -0
  147. foundry_mcp/tools/unified/test.py +431 -0
  148. foundry_mcp/tools/unified/verification.py +520 -0
  149. foundry_mcp-0.8.22.dist-info/METADATA +344 -0
  150. foundry_mcp-0.8.22.dist-info/RECORD +153 -0
  151. foundry_mcp-0.8.22.dist-info/WHEEL +4 -0
  152. foundry_mcp-0.8.22.dist-info/entry_points.txt +3 -0
  153. foundry_mcp-0.8.22.dist-info/licenses/LICENSE +21 -0
@@ -0,0 +1,515 @@
1
+ """
2
+ Markdown plan review prompts for AI consultation workflows.
3
+
4
+ This module provides prompt templates for reviewing markdown plans
5
+ before converting them to formal JSON specifications. Supports iterative
6
+ review cycles to refine plans with AI feedback.
7
+
8
+ Templates:
9
+ - MARKDOWN_PLAN_REVIEW_FULL_V1: Comprehensive 6-dimension review
10
+ - MARKDOWN_PLAN_REVIEW_QUICK_V1: Critical blockers only
11
+ - MARKDOWN_PLAN_REVIEW_SECURITY_V1: Security-focused review
12
+ - MARKDOWN_PLAN_REVIEW_FEASIBILITY_V1: Complexity and risk assessment
13
+
14
+ Each template expects plan_content, plan_name, and optionally plan_path context.
15
+ """
16
+
17
+ from __future__ import annotations
18
+
19
+ from typing import Any, Dict, List
20
+
21
+ from foundry_mcp.core.prompts import PromptBuilder, PromptRegistry, PromptTemplate
22
+
23
+
24
+ # =============================================================================
25
+ # Response Schema for MARKDOWN_PLAN_REVIEW Templates
26
+ # =============================================================================
27
+
28
+ _RESPONSE_SCHEMA = """
29
+ # Review Summary
30
+
31
+ ## Critical Blockers
32
+ Issues that MUST be fixed before this becomes a spec.
33
+
34
+ - **[Category]** <Issue title>
35
+ - **Description:** <What's wrong>
36
+ - **Impact:** <Consequences if not fixed>
37
+ - **Fix:** <Specific actionable recommendation>
38
+
39
+ ## Major Suggestions
40
+ Significant improvements to strengthen the plan.
41
+
42
+ - **[Category]** <Issue title>
43
+ - **Description:** <What's wrong>
44
+ - **Impact:** <Consequences if not addressed>
45
+ - **Fix:** <Specific actionable recommendation>
46
+
47
+ ## Minor Suggestions
48
+ Smaller refinements.
49
+
50
+ - **[Category]** <Issue title>
51
+ - **Description:** <What could be better>
52
+ - **Fix:** <Specific actionable recommendation>
53
+
54
+ ## Questions
55
+ Clarifications needed before proceeding.
56
+
57
+ - **[Category]** <Question>
58
+ - **Context:** <Why this matters>
59
+ - **Needed:** <What information would help>
60
+
61
+ ## Praise
62
+ What the plan does well.
63
+
64
+ - **[Category]** <What works well>
65
+ - **Why:** <What makes this effective>
66
+
67
+ ---
68
+
69
+ **Important**:
70
+ - Use category tags: [Completeness], [Architecture], [Sequencing], [Feasibility], [Risk], [Clarity]
71
+ - Include all sections even if empty (write "None identified" for empty sections)
72
+ - Be specific and actionable in all feedback
73
+ - For clarity issues, use Questions section rather than creating a separate category
74
+ - Do NOT generate feedback about ownership, responsibility, or team assignments (e.g., "who verifies", "who owns", "who is responsible")
75
+ """
76
+
77
+
78
+ # =============================================================================
79
+ # System Prompts
80
+ # =============================================================================
81
+
82
+ _MARKDOWN_PLAN_REVIEW_SYSTEM_PROMPT = """You are an expert software architect conducting a technical review.
83
+ Your task is to provide constructive, actionable feedback on implementation plans
84
+ written in markdown format, BEFORE they become formal specifications.
85
+
86
+ Guidelines:
87
+ - Be thorough and specific - examine all aspects of the proposed approach
88
+ - Identify both strengths and opportunities for improvement
89
+ - Ask clarifying questions for ambiguities
90
+ - Propose alternatives when better approaches exist
91
+ - Focus on impact and prioritize feedback by potential consequences
92
+ - Be collaborative, not adversarial
93
+ - Remember: this is an early-stage plan, not a final spec
94
+ - Do NOT focus on ownership, responsibility, or team assignment concerns
95
+ - Avoid feedback like "who owns", "who verifies", "who is responsible for"
96
+ - Focus on technical requirements and verification steps themselves, not who performs them"""
97
+
98
+
99
+ # =============================================================================
100
+ # MARKDOWN_PLAN_REVIEW_FULL_V1
101
+ # =============================================================================
102
+
103
+ MARKDOWN_PLAN_REVIEW_FULL_V1 = PromptTemplate(
104
+ id="MARKDOWN_PLAN_REVIEW_FULL_V1",
105
+ version="1.0",
106
+ system_prompt=_MARKDOWN_PLAN_REVIEW_SYSTEM_PROMPT,
107
+ user_template="""You are conducting a comprehensive review of a markdown implementation plan.
108
+
109
+ **Plan Name**: {plan_name}
110
+ **Review Type**: Full (comprehensive analysis)
111
+
112
+ **Your role**: You are a collaborative senior peer helping refine the plan before it becomes a formal specification.
113
+
114
+ **Critical: Provide Constructive Feedback**
115
+
116
+ Effective reviews combine critical analysis with actionable guidance.
117
+
118
+ **Your evaluation guidelines**:
119
+ 1. **Be thorough and specific** - Examine all aspects of the proposed approach
120
+ 2. **Identify both strengths and opportunities** - Note what works well and what could improve
121
+ 3. **Ask clarifying questions** - Highlight ambiguities that need resolution
122
+ 4. **Propose alternatives** - Show better approaches when they exist
123
+ 5. **Be actionable** - Provide specific, implementable recommendations
124
+ 6. **Focus on impact** - Prioritize feedback by potential consequences
125
+
126
+ **Effective feedback patterns**:
127
+ - "Consider whether this approach handles X, Y, Z edge cases"
128
+ - "These estimates may be optimistic because..."
129
+ - "Strong design choice here because..."
130
+ - "Clarification needed: how does this handle scenario X?"
131
+
132
+ **Evaluate across 6 dimensions:**
133
+
134
+ 1. **Completeness** - Are all phases/deliverables identified? Missing sections?
135
+ 2. **Architecture** - Sound approach? Coupling concerns? Missing abstractions?
136
+ 3. **Sequencing** - Phases ordered correctly? Dependencies identified?
137
+ 4. **Feasibility** - Realistic estimates? Hidden complexity?
138
+ 5. **Risk** - What could go wrong? Mitigation strategies?
139
+ 6. **Clarity** - Unambiguous? Would another developer understand?
140
+
141
+ **MARKDOWN PLAN TO REVIEW:**
142
+
143
+ {plan_content}
144
+
145
+ ---
146
+
147
+ **Required Output Format** (Markdown):
148
+ {response_schema}
149
+
150
+ **Remember**: Your goal is to **help create a robust implementation plan**. Be specific, actionable, and balanced in your feedback. Identify both critical blockers and positive aspects of the plan.""",
151
+ required_context=["plan_content", "plan_name"],
152
+ optional_context=["response_schema", "plan_path"],
153
+ metadata={
154
+ "author": "foundry-mcp",
155
+ "category": "markdown_plan_review",
156
+ "workflow": "MARKDOWN_PLAN_REVIEW",
157
+ "review_type": "full",
158
+ "dimensions": [
159
+ "Completeness",
160
+ "Architecture",
161
+ "Sequencing",
162
+ "Feasibility",
163
+ "Risk",
164
+ "Clarity",
165
+ ],
166
+ "description": "Comprehensive 6-dimension markdown plan review",
167
+ },
168
+ )
169
+
170
+
171
+ # =============================================================================
172
+ # MARKDOWN_PLAN_REVIEW_QUICK_V1
173
+ # =============================================================================
174
+
175
+ MARKDOWN_PLAN_REVIEW_QUICK_V1 = PromptTemplate(
176
+ id="MARKDOWN_PLAN_REVIEW_QUICK_V1",
177
+ version="1.0",
178
+ system_prompt=_MARKDOWN_PLAN_REVIEW_SYSTEM_PROMPT,
179
+ user_template="""You are conducting a quick review of a markdown implementation plan.
180
+
181
+ **Plan Name**: {plan_name}
182
+ **Review Type**: Quick (focus on blockers and questions)
183
+
184
+ **Your role**: Identify critical blockers and key questions that need resolution before this becomes a spec.
185
+
186
+ **Focus on finding:**
187
+
188
+ 1. **Critical Blockers**: What would prevent this plan from becoming a valid spec?
189
+ - Missing phases or deliverables
190
+ - Undefined dependencies
191
+ - Unresolved technical decisions
192
+ - Incomplete objectives
193
+
194
+ 2. **Key Questions**: What needs clarification?
195
+ - Ambiguous requirements
196
+ - Unclear technical approaches
197
+ - Missing context or rationale
198
+ - Edge cases not addressed
199
+
200
+ **Evaluation areas**:
201
+ - **Completeness**: Are all necessary sections present?
202
+ - **Questions**: What clarifications are needed?
203
+
204
+ **MARKDOWN PLAN TO REVIEW:**
205
+
206
+ {plan_content}
207
+
208
+ ---
209
+
210
+ **Required Output Format** (Markdown):
211
+ {response_schema}
212
+
213
+ **Note**: Focus primarily on Critical Blockers and Questions sections. Brief notes for other sections are sufficient.""",
214
+ required_context=["plan_content", "plan_name"],
215
+ optional_context=["response_schema", "plan_path"],
216
+ metadata={
217
+ "author": "foundry-mcp",
218
+ "category": "markdown_plan_review",
219
+ "workflow": "MARKDOWN_PLAN_REVIEW",
220
+ "review_type": "quick",
221
+ "focus": ["Critical Blockers", "Questions"],
222
+ "description": "Quick review focusing on blockers and clarifications",
223
+ },
224
+ )
225
+
226
+
227
+ # =============================================================================
228
+ # MARKDOWN_PLAN_REVIEW_SECURITY_V1
229
+ # =============================================================================
230
+
231
+ MARKDOWN_PLAN_REVIEW_SECURITY_V1 = PromptTemplate(
232
+ id="MARKDOWN_PLAN_REVIEW_SECURITY_V1",
233
+ version="1.0",
234
+ system_prompt="""You are a security specialist reviewing implementation plans.
235
+ Your task is to identify security vulnerabilities, risks, and recommend mitigations
236
+ in the proposed implementation approach.
237
+
238
+ Guidelines:
239
+ - Focus on authentication, authorization, and data protection
240
+ - Identify injection risks and common vulnerabilities
241
+ - Consider OWASP Top 10 and industry security standards
242
+ - Provide specific, actionable remediation recommendations
243
+ - Prioritize findings by risk severity""",
244
+ user_template="""You are conducting a security review of a markdown implementation plan.
245
+
246
+ **Plan Name**: {plan_name}
247
+ **Review Type**: Security (focus on vulnerabilities and risks)
248
+
249
+ **Your role**: Security specialist helping identify and mitigate potential vulnerabilities in the proposed approach.
250
+
251
+ **Focus on security considerations:**
252
+
253
+ 1. **Authentication & Authorization**:
254
+ - Are authentication mechanisms properly planned?
255
+ - Is authorization enforced at appropriate boundaries?
256
+ - Does the plan follow principle of least privilege?
257
+
258
+ 2. **Data Protection**:
259
+ - Is input validation planned?
260
+ - Are secrets managed securely?
261
+ - Is encryption considered for data at rest and in transit?
262
+ - Do error handling plans avoid leaking sensitive information?
263
+
264
+ 3. **Common Vulnerabilities**:
265
+ - Are injection attacks (SQL, command, XSS, CSRF) considered?
266
+ - Are security headers and protections planned?
267
+ - Is rate limiting and DoS protection addressed?
268
+ - Are insecure defaults avoided?
269
+
270
+ 4. **Audit & Compliance**:
271
+ - Is audit logging planned for security events?
272
+ - Are privacy concerns addressed?
273
+ - Are relevant compliance requirements considered?
274
+
275
+ **Evaluation areas**:
276
+ - **Security**: Authentication, authorization, data protection, vulnerability prevention
277
+ - **Architecture**: Security-relevant design decisions
278
+ - **Risk**: Security risks and mitigations
279
+
280
+ **MARKDOWN PLAN TO REVIEW:**
281
+
282
+ {plan_content}
283
+
284
+ ---
285
+
286
+ **Required Output Format** (Markdown):
287
+ {response_schema}
288
+
289
+ **Note**: Focus primarily on Security category feedback. Include Critical Blockers for any security issues that must be addressed before this becomes a spec.""",
290
+ required_context=["plan_content", "plan_name"],
291
+ optional_context=["response_schema", "plan_path"],
292
+ metadata={
293
+ "author": "foundry-mcp",
294
+ "category": "markdown_plan_review",
295
+ "workflow": "MARKDOWN_PLAN_REVIEW",
296
+ "review_type": "security",
297
+ "focus": [
298
+ "Authentication",
299
+ "Authorization",
300
+ "Data Protection",
301
+ "Vulnerabilities",
302
+ ],
303
+ "description": "Security-focused review for vulnerabilities and risks",
304
+ },
305
+ )
306
+
307
+
308
+ # =============================================================================
309
+ # MARKDOWN_PLAN_REVIEW_FEASIBILITY_V1
310
+ # =============================================================================
311
+
312
+ MARKDOWN_PLAN_REVIEW_FEASIBILITY_V1 = PromptTemplate(
313
+ id="MARKDOWN_PLAN_REVIEW_FEASIBILITY_V1",
314
+ version="1.0",
315
+ system_prompt="""You are a pragmatic senior engineer assessing technical feasibility.
316
+ Your task is to identify implementation challenges, risks, and hidden complexity
317
+ in the proposed approach.
318
+
319
+ Guidelines:
320
+ - Identify non-obvious technical challenges
321
+ - Evaluate dependency availability and stability
322
+ - Assess resource and timeline realism
323
+ - Highlight areas of concentrated complexity
324
+ - Suggest risk mitigations and alternatives""",
325
+ user_template="""You are conducting a technical feasibility review of a markdown implementation plan.
326
+
327
+ **Plan Name**: {plan_name}
328
+ **Review Type**: Feasibility (focus on implementation challenges)
329
+
330
+ **Your role**: Pragmatic engineer helping identify technical challenges and implementation risks.
331
+
332
+ **Focus on technical considerations:**
333
+
334
+ 1. **Hidden Complexity**:
335
+ - What technical challenges might not be obvious?
336
+ - Where does complexity concentrate?
337
+ - What edge cases increase difficulty?
338
+
339
+ 2. **Dependencies & Integration**:
340
+ - Are all required dependencies identified?
341
+ - Are external services/APIs available and documented?
342
+ - Are integration points well-defined?
343
+ - What dependency risks exist?
344
+
345
+ 3. **Technical Constraints**:
346
+ - What technical limitations could impact the approach?
347
+ - Are performance requirements achievable?
348
+ - Are there scalability considerations?
349
+ - What infrastructure requirements exist?
350
+
351
+ 4. **Implementation Risks**:
352
+ - What could go wrong during implementation?
353
+ - Where are the highest-risk technical areas?
354
+ - What mitigation strategies are needed?
355
+
356
+ **Evaluation areas**:
357
+ - **Completeness**: Are technical requirements fully specified?
358
+ - **Feasibility**: Is the technical approach sound?
359
+ - **Risk**: What are the technical risks?
360
+
361
+ **MARKDOWN PLAN TO REVIEW:**
362
+
363
+ {plan_content}
364
+
365
+ ---
366
+
367
+ **Required Output Format** (Markdown):
368
+ {response_schema}
369
+
370
+ **Note**: Focus on technical challenges and risks. Identify Major Suggestions for areas of hidden complexity and Critical Blockers for missing technical requirements.""",
371
+ required_context=["plan_content", "plan_name"],
372
+ optional_context=["response_schema", "plan_path"],
373
+ metadata={
374
+ "author": "foundry-mcp",
375
+ "category": "markdown_plan_review",
376
+ "workflow": "MARKDOWN_PLAN_REVIEW",
377
+ "review_type": "feasibility",
378
+ "focus": ["Complexity", "Dependencies", "Risks"],
379
+ "description": "Technical feasibility and risk assessment",
380
+ },
381
+ )
382
+
383
+
384
+ # =============================================================================
385
+ # Template Registry
386
+ # =============================================================================
387
+
388
+
389
+ MARKDOWN_PLAN_REVIEW_TEMPLATES: Dict[str, PromptTemplate] = {
390
+ "MARKDOWN_PLAN_REVIEW_FULL_V1": MARKDOWN_PLAN_REVIEW_FULL_V1,
391
+ "MARKDOWN_PLAN_REVIEW_QUICK_V1": MARKDOWN_PLAN_REVIEW_QUICK_V1,
392
+ "MARKDOWN_PLAN_REVIEW_SECURITY_V1": MARKDOWN_PLAN_REVIEW_SECURITY_V1,
393
+ "MARKDOWN_PLAN_REVIEW_FEASIBILITY_V1": MARKDOWN_PLAN_REVIEW_FEASIBILITY_V1,
394
+ }
395
+
396
+
397
+ # =============================================================================
398
+ # Prompt Builder Implementation
399
+ # =============================================================================
400
+
401
+
402
+ class MarkdownPlanReviewPromptBuilder(PromptBuilder):
403
+ """
404
+ Prompt builder for markdown plan review workflows.
405
+
406
+ Provides access to MARKDOWN_PLAN_REVIEW_* templates for reviewing
407
+ markdown plans before they become formal JSON specifications.
408
+
409
+ Templates:
410
+ - MARKDOWN_PLAN_REVIEW_FULL_V1: Comprehensive 6-dimension review
411
+ - MARKDOWN_PLAN_REVIEW_QUICK_V1: Critical blockers and questions focus
412
+ - MARKDOWN_PLAN_REVIEW_SECURITY_V1: Security-focused review
413
+ - MARKDOWN_PLAN_REVIEW_FEASIBILITY_V1: Technical complexity assessment
414
+
415
+ Example:
416
+ builder = MarkdownPlanReviewPromptBuilder()
417
+
418
+ prompt = builder.build("MARKDOWN_PLAN_REVIEW_FULL_V1", {
419
+ "plan_content": "...",
420
+ "plan_name": "my-feature",
421
+ })
422
+ """
423
+
424
+ def __init__(self) -> None:
425
+ """Initialize the builder with all templates."""
426
+ self._registry = PromptRegistry()
427
+ for template in MARKDOWN_PLAN_REVIEW_TEMPLATES.values():
428
+ self._registry.register(template)
429
+
430
+ def build(self, prompt_id: str, context: Dict[str, Any]) -> str:
431
+ """
432
+ Build a markdown plan review prompt.
433
+
434
+ Args:
435
+ prompt_id: Template ID (MARKDOWN_PLAN_REVIEW_*)
436
+ context: Context dict with required variables
437
+
438
+ Returns:
439
+ Rendered prompt string
440
+
441
+ Raises:
442
+ ValueError: If prompt_id not found or required context missing
443
+ """
444
+ if prompt_id not in MARKDOWN_PLAN_REVIEW_TEMPLATES:
445
+ available = sorted(MARKDOWN_PLAN_REVIEW_TEMPLATES.keys())
446
+ raise ValueError(f"Unknown prompt_id '{prompt_id}'. Available: {available}")
447
+
448
+ render_context = dict(context)
449
+ # Add default response schema if not provided
450
+ if "response_schema" not in render_context:
451
+ render_context["response_schema"] = _RESPONSE_SCHEMA
452
+
453
+ return self._registry.render(prompt_id, render_context)
454
+
455
+ def list_prompts(self) -> List[str]:
456
+ """
457
+ Return all available prompt IDs.
458
+
459
+ Returns:
460
+ Sorted list of all prompt IDs
461
+ """
462
+ return sorted(MARKDOWN_PLAN_REVIEW_TEMPLATES.keys())
463
+
464
+ def get_template(self, prompt_id: str) -> PromptTemplate:
465
+ """
466
+ Get a template by ID for inspection.
467
+
468
+ Args:
469
+ prompt_id: Template identifier
470
+
471
+ Returns:
472
+ The PromptTemplate
473
+
474
+ Raises:
475
+ KeyError: If not found
476
+ """
477
+ if prompt_id not in MARKDOWN_PLAN_REVIEW_TEMPLATES:
478
+ available = sorted(MARKDOWN_PLAN_REVIEW_TEMPLATES.keys())
479
+ raise KeyError(
480
+ f"Template '{prompt_id}' not found. Available: {available}"
481
+ )
482
+ return self._registry.get_required(prompt_id)
483
+
484
+
485
+ # =============================================================================
486
+ # Helper Functions
487
+ # =============================================================================
488
+
489
+
490
+ def get_response_schema() -> str:
491
+ """
492
+ Get the standard response schema for markdown plan reviews.
493
+
494
+ Returns:
495
+ Response schema markdown string
496
+ """
497
+ return _RESPONSE_SCHEMA
498
+
499
+
500
+ # =============================================================================
501
+ # Module Exports
502
+ # =============================================================================
503
+
504
+ __all__ = [
505
+ # Templates
506
+ "MARKDOWN_PLAN_REVIEW_FULL_V1",
507
+ "MARKDOWN_PLAN_REVIEW_QUICK_V1",
508
+ "MARKDOWN_PLAN_REVIEW_SECURITY_V1",
509
+ "MARKDOWN_PLAN_REVIEW_FEASIBILITY_V1",
510
+ "MARKDOWN_PLAN_REVIEW_TEMPLATES",
511
+ # Builder
512
+ "MarkdownPlanReviewPromptBuilder",
513
+ # Helpers
514
+ "get_response_schema",
515
+ ]