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.
- foundry_mcp/__init__.py +13 -0
- foundry_mcp/cli/__init__.py +67 -0
- foundry_mcp/cli/__main__.py +9 -0
- foundry_mcp/cli/agent.py +96 -0
- foundry_mcp/cli/commands/__init__.py +37 -0
- foundry_mcp/cli/commands/cache.py +137 -0
- foundry_mcp/cli/commands/dashboard.py +148 -0
- foundry_mcp/cli/commands/dev.py +446 -0
- foundry_mcp/cli/commands/journal.py +377 -0
- foundry_mcp/cli/commands/lifecycle.py +274 -0
- foundry_mcp/cli/commands/modify.py +824 -0
- foundry_mcp/cli/commands/plan.py +640 -0
- foundry_mcp/cli/commands/pr.py +393 -0
- foundry_mcp/cli/commands/review.py +667 -0
- foundry_mcp/cli/commands/session.py +472 -0
- foundry_mcp/cli/commands/specs.py +686 -0
- foundry_mcp/cli/commands/tasks.py +807 -0
- foundry_mcp/cli/commands/testing.py +676 -0
- foundry_mcp/cli/commands/validate.py +982 -0
- foundry_mcp/cli/config.py +98 -0
- foundry_mcp/cli/context.py +298 -0
- foundry_mcp/cli/logging.py +212 -0
- foundry_mcp/cli/main.py +44 -0
- foundry_mcp/cli/output.py +122 -0
- foundry_mcp/cli/registry.py +110 -0
- foundry_mcp/cli/resilience.py +178 -0
- foundry_mcp/cli/transcript.py +217 -0
- foundry_mcp/config.py +1454 -0
- foundry_mcp/core/__init__.py +144 -0
- foundry_mcp/core/ai_consultation.py +1773 -0
- foundry_mcp/core/batch_operations.py +1202 -0
- foundry_mcp/core/cache.py +195 -0
- foundry_mcp/core/capabilities.py +446 -0
- foundry_mcp/core/concurrency.py +898 -0
- foundry_mcp/core/context.py +540 -0
- foundry_mcp/core/discovery.py +1603 -0
- foundry_mcp/core/error_collection.py +728 -0
- foundry_mcp/core/error_store.py +592 -0
- foundry_mcp/core/health.py +749 -0
- foundry_mcp/core/intake.py +933 -0
- foundry_mcp/core/journal.py +700 -0
- foundry_mcp/core/lifecycle.py +412 -0
- foundry_mcp/core/llm_config.py +1376 -0
- foundry_mcp/core/llm_patterns.py +510 -0
- foundry_mcp/core/llm_provider.py +1569 -0
- foundry_mcp/core/logging_config.py +374 -0
- foundry_mcp/core/metrics_persistence.py +584 -0
- foundry_mcp/core/metrics_registry.py +327 -0
- foundry_mcp/core/metrics_store.py +641 -0
- foundry_mcp/core/modifications.py +224 -0
- foundry_mcp/core/naming.py +146 -0
- foundry_mcp/core/observability.py +1216 -0
- foundry_mcp/core/otel.py +452 -0
- foundry_mcp/core/otel_stubs.py +264 -0
- foundry_mcp/core/pagination.py +255 -0
- foundry_mcp/core/progress.py +387 -0
- foundry_mcp/core/prometheus.py +564 -0
- foundry_mcp/core/prompts/__init__.py +464 -0
- foundry_mcp/core/prompts/fidelity_review.py +691 -0
- foundry_mcp/core/prompts/markdown_plan_review.py +515 -0
- foundry_mcp/core/prompts/plan_review.py +627 -0
- foundry_mcp/core/providers/__init__.py +237 -0
- foundry_mcp/core/providers/base.py +515 -0
- foundry_mcp/core/providers/claude.py +472 -0
- foundry_mcp/core/providers/codex.py +637 -0
- foundry_mcp/core/providers/cursor_agent.py +630 -0
- foundry_mcp/core/providers/detectors.py +515 -0
- foundry_mcp/core/providers/gemini.py +426 -0
- foundry_mcp/core/providers/opencode.py +718 -0
- foundry_mcp/core/providers/opencode_wrapper.js +308 -0
- foundry_mcp/core/providers/package-lock.json +24 -0
- foundry_mcp/core/providers/package.json +25 -0
- foundry_mcp/core/providers/registry.py +607 -0
- foundry_mcp/core/providers/test_provider.py +171 -0
- foundry_mcp/core/providers/validation.py +857 -0
- foundry_mcp/core/rate_limit.py +427 -0
- foundry_mcp/core/research/__init__.py +68 -0
- foundry_mcp/core/research/memory.py +528 -0
- foundry_mcp/core/research/models.py +1234 -0
- foundry_mcp/core/research/providers/__init__.py +40 -0
- foundry_mcp/core/research/providers/base.py +242 -0
- foundry_mcp/core/research/providers/google.py +507 -0
- foundry_mcp/core/research/providers/perplexity.py +442 -0
- foundry_mcp/core/research/providers/semantic_scholar.py +544 -0
- foundry_mcp/core/research/providers/tavily.py +383 -0
- foundry_mcp/core/research/workflows/__init__.py +25 -0
- foundry_mcp/core/research/workflows/base.py +298 -0
- foundry_mcp/core/research/workflows/chat.py +271 -0
- foundry_mcp/core/research/workflows/consensus.py +539 -0
- foundry_mcp/core/research/workflows/deep_research.py +4142 -0
- foundry_mcp/core/research/workflows/ideate.py +682 -0
- foundry_mcp/core/research/workflows/thinkdeep.py +405 -0
- foundry_mcp/core/resilience.py +600 -0
- foundry_mcp/core/responses.py +1624 -0
- foundry_mcp/core/review.py +366 -0
- foundry_mcp/core/security.py +438 -0
- foundry_mcp/core/spec.py +4119 -0
- foundry_mcp/core/task.py +2463 -0
- foundry_mcp/core/testing.py +839 -0
- foundry_mcp/core/validation.py +2357 -0
- foundry_mcp/dashboard/__init__.py +32 -0
- foundry_mcp/dashboard/app.py +119 -0
- foundry_mcp/dashboard/components/__init__.py +17 -0
- foundry_mcp/dashboard/components/cards.py +88 -0
- foundry_mcp/dashboard/components/charts.py +177 -0
- foundry_mcp/dashboard/components/filters.py +136 -0
- foundry_mcp/dashboard/components/tables.py +195 -0
- foundry_mcp/dashboard/data/__init__.py +11 -0
- foundry_mcp/dashboard/data/stores.py +433 -0
- foundry_mcp/dashboard/launcher.py +300 -0
- foundry_mcp/dashboard/views/__init__.py +12 -0
- foundry_mcp/dashboard/views/errors.py +217 -0
- foundry_mcp/dashboard/views/metrics.py +164 -0
- foundry_mcp/dashboard/views/overview.py +96 -0
- foundry_mcp/dashboard/views/providers.py +83 -0
- foundry_mcp/dashboard/views/sdd_workflow.py +255 -0
- foundry_mcp/dashboard/views/tool_usage.py +139 -0
- foundry_mcp/prompts/__init__.py +9 -0
- foundry_mcp/prompts/workflows.py +525 -0
- foundry_mcp/resources/__init__.py +9 -0
- foundry_mcp/resources/specs.py +591 -0
- foundry_mcp/schemas/__init__.py +38 -0
- foundry_mcp/schemas/intake-schema.json +89 -0
- foundry_mcp/schemas/sdd-spec-schema.json +414 -0
- foundry_mcp/server.py +150 -0
- foundry_mcp/tools/__init__.py +10 -0
- foundry_mcp/tools/unified/__init__.py +92 -0
- foundry_mcp/tools/unified/authoring.py +3620 -0
- foundry_mcp/tools/unified/context_helpers.py +98 -0
- foundry_mcp/tools/unified/documentation_helpers.py +268 -0
- foundry_mcp/tools/unified/environment.py +1341 -0
- foundry_mcp/tools/unified/error.py +479 -0
- foundry_mcp/tools/unified/health.py +225 -0
- foundry_mcp/tools/unified/journal.py +841 -0
- foundry_mcp/tools/unified/lifecycle.py +640 -0
- foundry_mcp/tools/unified/metrics.py +777 -0
- foundry_mcp/tools/unified/plan.py +876 -0
- foundry_mcp/tools/unified/pr.py +294 -0
- foundry_mcp/tools/unified/provider.py +589 -0
- foundry_mcp/tools/unified/research.py +1283 -0
- foundry_mcp/tools/unified/review.py +1042 -0
- foundry_mcp/tools/unified/review_helpers.py +314 -0
- foundry_mcp/tools/unified/router.py +102 -0
- foundry_mcp/tools/unified/server.py +565 -0
- foundry_mcp/tools/unified/spec.py +1283 -0
- foundry_mcp/tools/unified/task.py +3846 -0
- foundry_mcp/tools/unified/test.py +431 -0
- foundry_mcp/tools/unified/verification.py +520 -0
- foundry_mcp-0.8.22.dist-info/METADATA +344 -0
- foundry_mcp-0.8.22.dist-info/RECORD +153 -0
- foundry_mcp-0.8.22.dist-info/WHEEL +4 -0
- foundry_mcp-0.8.22.dist-info/entry_points.txt +3 -0
- foundry_mcp-0.8.22.dist-info/licenses/LICENSE +21 -0
|
@@ -0,0 +1,627 @@
|
|
|
1
|
+
"""
|
|
2
|
+
Plan review prompts for AI consultation workflows.
|
|
3
|
+
|
|
4
|
+
This module provides prompt templates for two categories of plan review:
|
|
5
|
+
|
|
6
|
+
1. **PLAN_REVIEW_*_V1 Templates** (PromptTemplate instances):
|
|
7
|
+
- PLAN_REVIEW_FULL_V1: Comprehensive 6-dimension review
|
|
8
|
+
- PLAN_REVIEW_QUICK_V1: Critical blockers and questions focus
|
|
9
|
+
- PLAN_REVIEW_SECURITY_V1: Security-focused review
|
|
10
|
+
- PLAN_REVIEW_FEASIBILITY_V1: Technical complexity and risk assessment
|
|
11
|
+
- SYNTHESIS_PROMPT_V1: Multi-model response synthesis
|
|
12
|
+
|
|
13
|
+
2. **Legacy Templates** (string templates):
|
|
14
|
+
- review_spec: Comprehensive spec review
|
|
15
|
+
- review_phase: Phase-specific review
|
|
16
|
+
- security_review: Security-focused review
|
|
17
|
+
- feasibility_review: Feasibility assessment
|
|
18
|
+
- quick_review: Fast high-level review
|
|
19
|
+
|
|
20
|
+
Each PLAN_REVIEW_* template expects spec_content, spec_id, and title context.
|
|
21
|
+
"""
|
|
22
|
+
|
|
23
|
+
from __future__ import annotations
|
|
24
|
+
|
|
25
|
+
from typing import Any, Dict, List
|
|
26
|
+
|
|
27
|
+
from foundry_mcp.core.prompts import PromptBuilder, PromptRegistry, PromptTemplate
|
|
28
|
+
|
|
29
|
+
|
|
30
|
+
# =============================================================================
|
|
31
|
+
# Response Schema for PLAN_REVIEW Templates
|
|
32
|
+
# =============================================================================
|
|
33
|
+
|
|
34
|
+
_RESPONSE_SCHEMA = """
|
|
35
|
+
# Review Summary
|
|
36
|
+
|
|
37
|
+
## Critical Blockers
|
|
38
|
+
Issues that must be fixed before implementation can begin.
|
|
39
|
+
|
|
40
|
+
- **[Category]** <Issue title>
|
|
41
|
+
- **Description:** <What's wrong>
|
|
42
|
+
- **Impact:** <Consequences if not fixed>
|
|
43
|
+
- **Fix:** <Specific actionable recommendation>
|
|
44
|
+
|
|
45
|
+
## Major Suggestions
|
|
46
|
+
Significant improvements that enhance quality, maintainability, or design.
|
|
47
|
+
|
|
48
|
+
- **[Category]** <Issue title>
|
|
49
|
+
- **Description:** <What's wrong>
|
|
50
|
+
- **Impact:** <Consequences if not addressed>
|
|
51
|
+
- **Fix:** <Specific actionable recommendation>
|
|
52
|
+
|
|
53
|
+
## Minor Suggestions
|
|
54
|
+
Smaller improvements and optimizations.
|
|
55
|
+
|
|
56
|
+
- **[Category]** <Issue title>
|
|
57
|
+
- **Description:** <What could be better>
|
|
58
|
+
- **Fix:** <Specific actionable recommendation>
|
|
59
|
+
|
|
60
|
+
## Questions
|
|
61
|
+
Clarifications needed or ambiguities to resolve.
|
|
62
|
+
|
|
63
|
+
- **[Category]** <Question>
|
|
64
|
+
- **Context:** <Why this matters>
|
|
65
|
+
- **Needed:** <What information would help>
|
|
66
|
+
|
|
67
|
+
## Praise
|
|
68
|
+
What the spec does well.
|
|
69
|
+
|
|
70
|
+
- **[Category]** <What works well>
|
|
71
|
+
- **Why:** <What makes this effective>
|
|
72
|
+
|
|
73
|
+
---
|
|
74
|
+
|
|
75
|
+
**Important**:
|
|
76
|
+
- Use category tags: [Completeness], [Architecture], [Data Model], [Interface Design], [Security], [Verification]
|
|
77
|
+
- Include all sections even if empty (write "None identified" for empty sections)
|
|
78
|
+
- Be specific and actionable in all feedback
|
|
79
|
+
- For clarity issues, use Questions section rather than creating a separate category
|
|
80
|
+
- Attribution: In multi-model reviews, prefix items with "Flagged by [model-name]:" when applicable
|
|
81
|
+
- Do NOT generate feedback about ownership, responsibility, or team assignments (e.g., "who verifies", "who owns", "who is responsible")
|
|
82
|
+
"""
|
|
83
|
+
|
|
84
|
+
|
|
85
|
+
# =============================================================================
|
|
86
|
+
# System Prompts
|
|
87
|
+
# =============================================================================
|
|
88
|
+
|
|
89
|
+
_PLAN_REVIEW_SYSTEM_PROMPT = """You are an expert software architect conducting a technical review.
|
|
90
|
+
Your task is to provide constructive, actionable feedback on software specifications.
|
|
91
|
+
|
|
92
|
+
Guidelines:
|
|
93
|
+
- Be thorough and specific - examine all aspects of the design
|
|
94
|
+
- Identify both strengths and opportunities for improvement
|
|
95
|
+
- Ask clarifying questions for ambiguities
|
|
96
|
+
- Propose alternatives when better approaches exist
|
|
97
|
+
- Focus on impact and prioritize feedback by potential consequences
|
|
98
|
+
- Be collaborative, not adversarial
|
|
99
|
+
- Do NOT focus on ownership, responsibility, or team assignment concerns
|
|
100
|
+
- Avoid feedback like "who owns", "who verifies", "who is responsible for"
|
|
101
|
+
- Focus on technical requirements and verification steps themselves, not who performs them"""
|
|
102
|
+
|
|
103
|
+
|
|
104
|
+
# =============================================================================
|
|
105
|
+
# PLAN_REVIEW_FULL_V1
|
|
106
|
+
# =============================================================================
|
|
107
|
+
|
|
108
|
+
PLAN_REVIEW_FULL_V1 = PromptTemplate(
|
|
109
|
+
id="PLAN_REVIEW_FULL_V1",
|
|
110
|
+
version="1.0",
|
|
111
|
+
system_prompt=_PLAN_REVIEW_SYSTEM_PROMPT,
|
|
112
|
+
user_template="""You are conducting a comprehensive technical review of a software specification.
|
|
113
|
+
|
|
114
|
+
**Spec**: {spec_id}
|
|
115
|
+
**Title**: {title}
|
|
116
|
+
**Review Type**: Full (comprehensive analysis)
|
|
117
|
+
|
|
118
|
+
**Your role**: You are a collaborative senior peer helping refine the design and identify opportunities for improvement.
|
|
119
|
+
|
|
120
|
+
**Critical: Provide Constructive Feedback**
|
|
121
|
+
|
|
122
|
+
Effective reviews combine critical analysis with actionable guidance.
|
|
123
|
+
|
|
124
|
+
**Your evaluation guidelines**:
|
|
125
|
+
1. **Be thorough and specific** - Examine all aspects of the design
|
|
126
|
+
2. **Identify both strengths and opportunities** - Note what works well and what could improve
|
|
127
|
+
3. **Ask clarifying questions** - Highlight ambiguities that need resolution
|
|
128
|
+
4. **Propose alternatives** - Show better approaches when they exist
|
|
129
|
+
5. **Be actionable** - Provide specific, implementable recommendations
|
|
130
|
+
6. **Focus on impact** - Prioritize feedback by potential consequences
|
|
131
|
+
|
|
132
|
+
**Effective feedback patterns**:
|
|
133
|
+
- "Consider whether this approach handles X, Y, Z edge cases"
|
|
134
|
+
- "These estimates may be optimistic because..."
|
|
135
|
+
- "Strong design choice here because..."
|
|
136
|
+
- "Clarification needed: how does this handle scenario X?"
|
|
137
|
+
|
|
138
|
+
**Evaluate across 6 technical dimensions:**
|
|
139
|
+
|
|
140
|
+
1. **Completeness** - Identify missing sections, undefined requirements, ambiguous tasks
|
|
141
|
+
2. **Architecture** - Find design issues, coupling concerns, missing abstractions, scalability considerations
|
|
142
|
+
3. **Data Model** - Evaluate data structures, relationships, consistency, migration strategies
|
|
143
|
+
4. **Interface Design** - Review API contracts, component boundaries, integration patterns
|
|
144
|
+
5. **Security** - Identify authentication, authorization, data protection, and vulnerability concerns
|
|
145
|
+
6. **Verification** - Find testing gaps, missing verification steps, coverage opportunities
|
|
146
|
+
|
|
147
|
+
**SPECIFICATION TO REVIEW:**
|
|
148
|
+
|
|
149
|
+
{spec_content}
|
|
150
|
+
|
|
151
|
+
---
|
|
152
|
+
|
|
153
|
+
**Required Output Format** (Markdown):
|
|
154
|
+
{response_schema}
|
|
155
|
+
|
|
156
|
+
**Remember**: Your goal is to **help create robust, well-designed software**. Be specific, actionable, and balanced in your feedback. Identify both critical blockers and positive aspects of the design.""",
|
|
157
|
+
required_context=["spec_content", "spec_id", "title"],
|
|
158
|
+
optional_context=["response_schema"],
|
|
159
|
+
metadata={
|
|
160
|
+
"author": "foundry-mcp",
|
|
161
|
+
"category": "plan_review",
|
|
162
|
+
"workflow": "PLAN_REVIEW",
|
|
163
|
+
"review_type": "full",
|
|
164
|
+
"dimensions": [
|
|
165
|
+
"Completeness",
|
|
166
|
+
"Architecture",
|
|
167
|
+
"Data Model",
|
|
168
|
+
"Interface Design",
|
|
169
|
+
"Security",
|
|
170
|
+
"Verification",
|
|
171
|
+
],
|
|
172
|
+
"description": "Comprehensive 6-dimension specification review",
|
|
173
|
+
},
|
|
174
|
+
)
|
|
175
|
+
|
|
176
|
+
|
|
177
|
+
# =============================================================================
|
|
178
|
+
# PLAN_REVIEW_QUICK_V1
|
|
179
|
+
# =============================================================================
|
|
180
|
+
|
|
181
|
+
PLAN_REVIEW_QUICK_V1 = PromptTemplate(
|
|
182
|
+
id="PLAN_REVIEW_QUICK_V1",
|
|
183
|
+
version="1.0",
|
|
184
|
+
system_prompt=_PLAN_REVIEW_SYSTEM_PROMPT,
|
|
185
|
+
user_template="""You are conducting a quick technical review of a software specification.
|
|
186
|
+
|
|
187
|
+
**Spec**: {spec_id}
|
|
188
|
+
**Title**: {title}
|
|
189
|
+
**Review Type**: Quick (focus on blockers and questions)
|
|
190
|
+
|
|
191
|
+
**Your role**: Identify critical blockers and key questions that need resolution before implementation.
|
|
192
|
+
|
|
193
|
+
**Focus on finding:**
|
|
194
|
+
|
|
195
|
+
1. **Critical Blockers**: What would prevent implementation from starting?
|
|
196
|
+
- Missing required sections or requirements
|
|
197
|
+
- Undefined dependencies or integrations
|
|
198
|
+
- Unresolved technical decisions
|
|
199
|
+
- Incomplete acceptance criteria
|
|
200
|
+
|
|
201
|
+
2. **Key Questions**: What needs clarification?
|
|
202
|
+
- Ambiguous requirements or acceptance criteria
|
|
203
|
+
- Unclear technical approaches
|
|
204
|
+
- Missing context or rationale
|
|
205
|
+
- Edge cases not addressed
|
|
206
|
+
|
|
207
|
+
**Evaluation areas**:
|
|
208
|
+
- **Completeness**: Are all necessary sections and requirements present?
|
|
209
|
+
- **Questions**: What clarifications are needed?
|
|
210
|
+
|
|
211
|
+
**SPECIFICATION TO REVIEW:**
|
|
212
|
+
|
|
213
|
+
{spec_content}
|
|
214
|
+
|
|
215
|
+
---
|
|
216
|
+
|
|
217
|
+
**Required Output Format** (Markdown):
|
|
218
|
+
{response_schema}
|
|
219
|
+
|
|
220
|
+
**Note**: Focus primarily on Critical Blockers and Questions sections. Brief notes for other sections are sufficient.""",
|
|
221
|
+
required_context=["spec_content", "spec_id", "title"],
|
|
222
|
+
optional_context=["response_schema"],
|
|
223
|
+
metadata={
|
|
224
|
+
"author": "foundry-mcp",
|
|
225
|
+
"category": "plan_review",
|
|
226
|
+
"workflow": "PLAN_REVIEW",
|
|
227
|
+
"review_type": "quick",
|
|
228
|
+
"focus": ["Critical Blockers", "Questions"],
|
|
229
|
+
"description": "Quick review focusing on blockers and clarifications",
|
|
230
|
+
},
|
|
231
|
+
)
|
|
232
|
+
|
|
233
|
+
|
|
234
|
+
# =============================================================================
|
|
235
|
+
# PLAN_REVIEW_SECURITY_V1
|
|
236
|
+
# =============================================================================
|
|
237
|
+
|
|
238
|
+
PLAN_REVIEW_SECURITY_V1 = PromptTemplate(
|
|
239
|
+
id="PLAN_REVIEW_SECURITY_V1",
|
|
240
|
+
version="1.0",
|
|
241
|
+
system_prompt="""You are a security specialist reviewing software specifications.
|
|
242
|
+
Your task is to identify security vulnerabilities, risks, and recommend mitigations.
|
|
243
|
+
|
|
244
|
+
Guidelines:
|
|
245
|
+
- Focus on authentication, authorization, and data protection
|
|
246
|
+
- Identify injection risks and common vulnerabilities
|
|
247
|
+
- Consider OWASP Top 10 and industry security standards
|
|
248
|
+
- Provide specific, actionable remediation recommendations
|
|
249
|
+
- Prioritize findings by risk severity""",
|
|
250
|
+
user_template="""You are conducting a security review of a software specification.
|
|
251
|
+
|
|
252
|
+
**Spec**: {spec_id}
|
|
253
|
+
**Title**: {title}
|
|
254
|
+
**Review Type**: Security (focus on vulnerabilities and risks)
|
|
255
|
+
|
|
256
|
+
**Your role**: Security specialist helping identify and mitigate potential vulnerabilities.
|
|
257
|
+
|
|
258
|
+
**Focus on security considerations:**
|
|
259
|
+
|
|
260
|
+
1. **Authentication & Authorization**:
|
|
261
|
+
- Are authentication mechanisms properly designed?
|
|
262
|
+
- Is authorization enforced at appropriate boundaries?
|
|
263
|
+
- Does access control follow principle of least privilege?
|
|
264
|
+
|
|
265
|
+
2. **Data Protection**:
|
|
266
|
+
- Is input validation comprehensive?
|
|
267
|
+
- Are secrets managed securely?
|
|
268
|
+
- Is data encrypted at rest and in transit?
|
|
269
|
+
- Do error messages avoid leaking sensitive information?
|
|
270
|
+
|
|
271
|
+
3. **Common Vulnerabilities**:
|
|
272
|
+
- Are injection attacks (SQL, command, XSS, CSRF) prevented?
|
|
273
|
+
- Are security headers and protections in place?
|
|
274
|
+
- Is rate limiting and DoS protection addressed?
|
|
275
|
+
- Are insecure defaults avoided?
|
|
276
|
+
|
|
277
|
+
4. **Audit & Compliance**:
|
|
278
|
+
- Is audit logging sufficient for security events?
|
|
279
|
+
- Are privacy concerns addressed?
|
|
280
|
+
- Are relevant compliance requirements considered?
|
|
281
|
+
|
|
282
|
+
**Evaluation areas**:
|
|
283
|
+
- **Security**: Authentication, authorization, data protection, vulnerability prevention
|
|
284
|
+
- **Architecture**: Security-relevant design decisions
|
|
285
|
+
- **Data Model**: Data sensitivity, encryption, access patterns
|
|
286
|
+
|
|
287
|
+
**SPECIFICATION TO REVIEW:**
|
|
288
|
+
|
|
289
|
+
{spec_content}
|
|
290
|
+
|
|
291
|
+
---
|
|
292
|
+
|
|
293
|
+
**Required Output Format** (Markdown):
|
|
294
|
+
{response_schema}
|
|
295
|
+
|
|
296
|
+
**Note**: Focus primarily on Security category feedback. Include Critical Blockers for any security issues that must be addressed before implementation.""",
|
|
297
|
+
required_context=["spec_content", "spec_id", "title"],
|
|
298
|
+
optional_context=["response_schema"],
|
|
299
|
+
metadata={
|
|
300
|
+
"author": "foundry-mcp",
|
|
301
|
+
"category": "plan_review",
|
|
302
|
+
"workflow": "PLAN_REVIEW",
|
|
303
|
+
"review_type": "security",
|
|
304
|
+
"focus": [
|
|
305
|
+
"Authentication",
|
|
306
|
+
"Authorization",
|
|
307
|
+
"Data Protection",
|
|
308
|
+
"Vulnerabilities",
|
|
309
|
+
],
|
|
310
|
+
"description": "Security-focused review for vulnerabilities and risks",
|
|
311
|
+
},
|
|
312
|
+
)
|
|
313
|
+
|
|
314
|
+
|
|
315
|
+
# =============================================================================
|
|
316
|
+
# PLAN_REVIEW_FEASIBILITY_V1
|
|
317
|
+
# =============================================================================
|
|
318
|
+
|
|
319
|
+
PLAN_REVIEW_FEASIBILITY_V1 = PromptTemplate(
|
|
320
|
+
id="PLAN_REVIEW_FEASIBILITY_V1",
|
|
321
|
+
version="1.0",
|
|
322
|
+
system_prompt="""You are a pragmatic senior engineer assessing technical feasibility.
|
|
323
|
+
Your task is to identify implementation challenges, risks, and hidden complexity.
|
|
324
|
+
|
|
325
|
+
Guidelines:
|
|
326
|
+
- Identify non-obvious technical challenges
|
|
327
|
+
- Evaluate dependency availability and stability
|
|
328
|
+
- Assess resource and timeline realism
|
|
329
|
+
- Highlight areas of concentrated complexity
|
|
330
|
+
- Suggest risk mitigations and alternatives""",
|
|
331
|
+
user_template="""You are conducting a technical complexity review of a software specification.
|
|
332
|
+
|
|
333
|
+
**Spec**: {spec_id}
|
|
334
|
+
**Title**: {title}
|
|
335
|
+
**Review Type**: Technical Complexity (focus on implementation challenges)
|
|
336
|
+
|
|
337
|
+
**Your role**: Pragmatic engineer helping identify technical challenges and implementation risks.
|
|
338
|
+
|
|
339
|
+
**Focus on technical considerations:**
|
|
340
|
+
|
|
341
|
+
1. **Hidden Complexity**:
|
|
342
|
+
- What technical challenges might not be obvious?
|
|
343
|
+
- Where does complexity concentrate?
|
|
344
|
+
- What edge cases increase difficulty?
|
|
345
|
+
|
|
346
|
+
2. **Dependencies & Integration**:
|
|
347
|
+
- Are all required dependencies identified?
|
|
348
|
+
- Are external services/APIs available and documented?
|
|
349
|
+
- Are integration points well-defined?
|
|
350
|
+
- What dependency risks exist?
|
|
351
|
+
|
|
352
|
+
3. **Technical Constraints**:
|
|
353
|
+
- What technical limitations could impact the design?
|
|
354
|
+
- Are performance requirements achievable?
|
|
355
|
+
- Are there scalability considerations?
|
|
356
|
+
- What infrastructure requirements exist?
|
|
357
|
+
|
|
358
|
+
4. **Implementation Risks**:
|
|
359
|
+
- What could go wrong during implementation?
|
|
360
|
+
- Where are the highest-risk technical areas?
|
|
361
|
+
- What mitigation strategies are needed?
|
|
362
|
+
|
|
363
|
+
**Evaluation areas**:
|
|
364
|
+
- **Completeness**: Are technical requirements fully specified?
|
|
365
|
+
- **Architecture**: Is the technical approach sound?
|
|
366
|
+
- **Data Model**: Are data complexity factors addressed?
|
|
367
|
+
- **Interface Design**: Are integration points well-defined?
|
|
368
|
+
|
|
369
|
+
**SPECIFICATION TO REVIEW:**
|
|
370
|
+
|
|
371
|
+
{spec_content}
|
|
372
|
+
|
|
373
|
+
---
|
|
374
|
+
|
|
375
|
+
**Required Output Format** (Markdown):
|
|
376
|
+
{response_schema}
|
|
377
|
+
|
|
378
|
+
**Note**: Focus on technical challenges and risks. Identify Major Suggestions for areas of hidden complexity and Critical Blockers for missing technical requirements.""",
|
|
379
|
+
required_context=["spec_content", "spec_id", "title"],
|
|
380
|
+
optional_context=["response_schema"],
|
|
381
|
+
metadata={
|
|
382
|
+
"author": "foundry-mcp",
|
|
383
|
+
"category": "plan_review",
|
|
384
|
+
"workflow": "PLAN_REVIEW",
|
|
385
|
+
"review_type": "feasibility",
|
|
386
|
+
"focus": ["Complexity", "Dependencies", "Risks"],
|
|
387
|
+
"description": "Technical feasibility and risk assessment",
|
|
388
|
+
},
|
|
389
|
+
)
|
|
390
|
+
|
|
391
|
+
|
|
392
|
+
# =============================================================================
|
|
393
|
+
# SYNTHESIS_PROMPT_V1
|
|
394
|
+
# =============================================================================
|
|
395
|
+
|
|
396
|
+
SYNTHESIS_PROMPT_V1 = PromptTemplate(
|
|
397
|
+
id="SYNTHESIS_PROMPT_V1",
|
|
398
|
+
version="1.0",
|
|
399
|
+
system_prompt="""You are an expert at synthesizing multiple technical reviews.
|
|
400
|
+
Your task is to consolidate diverse perspectives into actionable consensus.
|
|
401
|
+
|
|
402
|
+
Guidelines:
|
|
403
|
+
- Attribute findings to specific models
|
|
404
|
+
- Identify areas of agreement and disagreement
|
|
405
|
+
- Prioritize by consensus strength
|
|
406
|
+
- Preserve unique insights from each model
|
|
407
|
+
- Create actionable, consolidated recommendations""",
|
|
408
|
+
user_template="""You are synthesizing {num_models} independent AI reviews of a specification.
|
|
409
|
+
|
|
410
|
+
**Specification**: {title} (`{spec_id}`)
|
|
411
|
+
|
|
412
|
+
**Your Task**: Read all reviews below and create a comprehensive synthesis.
|
|
413
|
+
|
|
414
|
+
**Required Output** (Markdown format):
|
|
415
|
+
|
|
416
|
+
```markdown
|
|
417
|
+
# Synthesis
|
|
418
|
+
|
|
419
|
+
## Overall Assessment
|
|
420
|
+
- **Consensus Level**: Strong/Moderate/Weak/Conflicted (based on agreement across models)
|
|
421
|
+
|
|
422
|
+
## Critical Blockers
|
|
423
|
+
Issues that must be fixed before implementation (identified by multiple models):
|
|
424
|
+
- **[Category]** Issue title - flagged by: [model names]
|
|
425
|
+
- Impact: ...
|
|
426
|
+
- Recommended fix: ...
|
|
427
|
+
|
|
428
|
+
## Major Suggestions
|
|
429
|
+
Significant improvements that enhance quality, maintainability, or design:
|
|
430
|
+
- **[Category]** Issue title - flagged by: [model names]
|
|
431
|
+
- Description: ...
|
|
432
|
+
- Recommended fix: ...
|
|
433
|
+
|
|
434
|
+
## Questions for Author
|
|
435
|
+
Clarifications needed (common questions across models):
|
|
436
|
+
- **[Category]** Question - flagged by: [model names]
|
|
437
|
+
- Context: Why this matters
|
|
438
|
+
|
|
439
|
+
## Design Strengths
|
|
440
|
+
What the spec does well (areas of agreement):
|
|
441
|
+
- **[Category]** Strength - noted by: [model names]
|
|
442
|
+
- Why this is effective
|
|
443
|
+
|
|
444
|
+
## Points of Agreement
|
|
445
|
+
- What all/most models agree on
|
|
446
|
+
|
|
447
|
+
## Points of Disagreement
|
|
448
|
+
- Where models conflict
|
|
449
|
+
- Your assessment of the disagreement
|
|
450
|
+
|
|
451
|
+
## Synthesis Notes
|
|
452
|
+
- Overall themes across reviews
|
|
453
|
+
- Actionable next steps
|
|
454
|
+
```
|
|
455
|
+
|
|
456
|
+
**Important**:
|
|
457
|
+
- Attribute issues to specific models (e.g., "flagged by: gemini, codex")
|
|
458
|
+
- Note where models agree vs. disagree
|
|
459
|
+
- Focus on synthesizing actionable feedback across all reviews
|
|
460
|
+
|
|
461
|
+
---
|
|
462
|
+
|
|
463
|
+
{model_reviews}""",
|
|
464
|
+
required_context=["spec_id", "title", "num_models", "model_reviews"],
|
|
465
|
+
optional_context=[],
|
|
466
|
+
metadata={
|
|
467
|
+
"author": "foundry-mcp",
|
|
468
|
+
"category": "plan_review",
|
|
469
|
+
"workflow": "PLAN_REVIEW",
|
|
470
|
+
"review_type": "synthesis",
|
|
471
|
+
"description": "AI-powered synthesis of multiple model responses",
|
|
472
|
+
},
|
|
473
|
+
)
|
|
474
|
+
|
|
475
|
+
|
|
476
|
+
# =============================================================================
|
|
477
|
+
# Template Registries
|
|
478
|
+
# =============================================================================
|
|
479
|
+
|
|
480
|
+
|
|
481
|
+
# PLAN_REVIEW_* templates registry (PromptTemplate instances)
|
|
482
|
+
PLAN_REVIEW_TEMPLATES: Dict[str, PromptTemplate] = {
|
|
483
|
+
"PLAN_REVIEW_FULL_V1": PLAN_REVIEW_FULL_V1,
|
|
484
|
+
"PLAN_REVIEW_QUICK_V1": PLAN_REVIEW_QUICK_V1,
|
|
485
|
+
"PLAN_REVIEW_SECURITY_V1": PLAN_REVIEW_SECURITY_V1,
|
|
486
|
+
"PLAN_REVIEW_FEASIBILITY_V1": PLAN_REVIEW_FEASIBILITY_V1,
|
|
487
|
+
"SYNTHESIS_PROMPT_V1": SYNTHESIS_PROMPT_V1,
|
|
488
|
+
}
|
|
489
|
+
|
|
490
|
+
|
|
491
|
+
# =============================================================================
|
|
492
|
+
# Legacy String Templates (for backwards compatibility)
|
|
493
|
+
# =============================================================================
|
|
494
|
+
|
|
495
|
+
# Legacy templates have been removed. Use PLAN_REVIEW_* templates.
|
|
496
|
+
|
|
497
|
+
|
|
498
|
+
# =============================================================================
|
|
499
|
+
# Template Registries
|
|
500
|
+
# =============================================================================
|
|
501
|
+
|
|
502
|
+
|
|
503
|
+
# PLAN_REVIEW_* templates registry (PromptTemplate instances)
|
|
504
|
+
PLAN_REVIEW_TEMPLATES: Dict[str, PromptTemplate] = {
|
|
505
|
+
"PLAN_REVIEW_FULL_V1": PLAN_REVIEW_FULL_V1,
|
|
506
|
+
"PLAN_REVIEW_QUICK_V1": PLAN_REVIEW_QUICK_V1,
|
|
507
|
+
"PLAN_REVIEW_SECURITY_V1": PLAN_REVIEW_SECURITY_V1,
|
|
508
|
+
"PLAN_REVIEW_FEASIBILITY_V1": PLAN_REVIEW_FEASIBILITY_V1,
|
|
509
|
+
"SYNTHESIS_PROMPT_V1": SYNTHESIS_PROMPT_V1,
|
|
510
|
+
}
|
|
511
|
+
|
|
512
|
+
|
|
513
|
+
# =============================================================================
|
|
514
|
+
# Prompt Builder Implementation
|
|
515
|
+
# =============================================================================
|
|
516
|
+
|
|
517
|
+
|
|
518
|
+
class PlanReviewPromptBuilder(PromptBuilder):
|
|
519
|
+
"""
|
|
520
|
+
Prompt builder for SDD plan review workflows.
|
|
521
|
+
|
|
522
|
+
Provides access to PLAN_REVIEW_* templates (PromptTemplate instances).
|
|
523
|
+
|
|
524
|
+
PLAN_REVIEW Templates:
|
|
525
|
+
- PLAN_REVIEW_FULL_V1: Comprehensive 6-dimension review
|
|
526
|
+
- PLAN_REVIEW_QUICK_V1: Critical blockers and questions focus
|
|
527
|
+
- PLAN_REVIEW_SECURITY_V1: Security-focused review
|
|
528
|
+
- PLAN_REVIEW_FEASIBILITY_V1: Technical complexity assessment
|
|
529
|
+
- SYNTHESIS_PROMPT_V1: Multi-model response synthesis
|
|
530
|
+
"""
|
|
531
|
+
|
|
532
|
+
def __init__(self) -> None:
|
|
533
|
+
"""Initialize the builder with all templates."""
|
|
534
|
+
self._registry = PromptRegistry()
|
|
535
|
+
# Register PLAN_REVIEW_* templates
|
|
536
|
+
for template in PLAN_REVIEW_TEMPLATES.values():
|
|
537
|
+
self._registry.register(template)
|
|
538
|
+
|
|
539
|
+
def build(self, prompt_id: str, context: Dict[str, Any]) -> str:
|
|
540
|
+
"""
|
|
541
|
+
Build a plan review prompt.
|
|
542
|
+
|
|
543
|
+
Args:
|
|
544
|
+
prompt_id: Template ID (PLAN_REVIEW_* or SYNTHESIS_PROMPT_V1)
|
|
545
|
+
context: Context dict with required variables
|
|
546
|
+
|
|
547
|
+
Returns:
|
|
548
|
+
Rendered prompt string
|
|
549
|
+
|
|
550
|
+
Raises:
|
|
551
|
+
ValueError: If prompt_id not found or required context missing
|
|
552
|
+
"""
|
|
553
|
+
# Check if it's a PLAN_REVIEW_* template
|
|
554
|
+
if prompt_id in PLAN_REVIEW_TEMPLATES:
|
|
555
|
+
render_context = dict(context)
|
|
556
|
+
# Add default response schema if not provided
|
|
557
|
+
if "response_schema" not in render_context:
|
|
558
|
+
render_context["response_schema"] = _RESPONSE_SCHEMA
|
|
559
|
+
return self._registry.render(prompt_id, render_context)
|
|
560
|
+
|
|
561
|
+
# Unknown prompt_id
|
|
562
|
+
all_ids = sorted(list(PLAN_REVIEW_TEMPLATES.keys()))
|
|
563
|
+
raise ValueError(f"Unknown prompt_id '{prompt_id}'. Available: {all_ids}")
|
|
564
|
+
|
|
565
|
+
def list_prompts(self) -> List[str]:
|
|
566
|
+
"""
|
|
567
|
+
Return all available prompt IDs.
|
|
568
|
+
|
|
569
|
+
Returns:
|
|
570
|
+
Sorted list of all prompt IDs (PLAN_REVIEW_*)
|
|
571
|
+
"""
|
|
572
|
+
return sorted(list(PLAN_REVIEW_TEMPLATES.keys()))
|
|
573
|
+
|
|
574
|
+
def get_template(self, prompt_id: str) -> PromptTemplate:
|
|
575
|
+
"""
|
|
576
|
+
Get a PLAN_REVIEW_* template by ID for inspection.
|
|
577
|
+
|
|
578
|
+
Args:
|
|
579
|
+
prompt_id: Template identifier (must be a PLAN_REVIEW_* template)
|
|
580
|
+
|
|
581
|
+
Returns:
|
|
582
|
+
The PromptTemplate
|
|
583
|
+
|
|
584
|
+
Raises:
|
|
585
|
+
KeyError: If not found or not a PLAN_REVIEW_* template
|
|
586
|
+
"""
|
|
587
|
+
if prompt_id not in PLAN_REVIEW_TEMPLATES:
|
|
588
|
+
available = sorted(PLAN_REVIEW_TEMPLATES.keys())
|
|
589
|
+
raise KeyError(
|
|
590
|
+
f"Template '{prompt_id}' not found. "
|
|
591
|
+
f"Only PLAN_REVIEW_* templates can be inspected. Available: {available}"
|
|
592
|
+
)
|
|
593
|
+
return self._registry.get_required(prompt_id)
|
|
594
|
+
|
|
595
|
+
|
|
596
|
+
# =============================================================================
|
|
597
|
+
# Helper Functions
|
|
598
|
+
# =============================================================================
|
|
599
|
+
|
|
600
|
+
|
|
601
|
+
def get_response_schema() -> str:
|
|
602
|
+
"""
|
|
603
|
+
Get the standard response schema for plan reviews.
|
|
604
|
+
|
|
605
|
+
Returns:
|
|
606
|
+
Response schema markdown string
|
|
607
|
+
"""
|
|
608
|
+
return _RESPONSE_SCHEMA
|
|
609
|
+
|
|
610
|
+
|
|
611
|
+
# =============================================================================
|
|
612
|
+
# Module Exports
|
|
613
|
+
# =============================================================================
|
|
614
|
+
|
|
615
|
+
__all__ = [
|
|
616
|
+
# PLAN_REVIEW_* templates
|
|
617
|
+
"PLAN_REVIEW_FULL_V1",
|
|
618
|
+
"PLAN_REVIEW_QUICK_V1",
|
|
619
|
+
"PLAN_REVIEW_SECURITY_V1",
|
|
620
|
+
"PLAN_REVIEW_FEASIBILITY_V1",
|
|
621
|
+
"SYNTHESIS_PROMPT_V1",
|
|
622
|
+
"PLAN_REVIEW_TEMPLATES",
|
|
623
|
+
# Builder
|
|
624
|
+
"PlanReviewPromptBuilder",
|
|
625
|
+
# Helpers
|
|
626
|
+
"get_response_schema",
|
|
627
|
+
]
|