Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
44 changes: 40 additions & 4 deletions hooks/useSpecWorkflow.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1415,15 +1415,24 @@ Please update the ${state.phase} document based on this feedback while maintaini

// Helper functions for prompts
function getSystemPromptForPhase(phase: WorkflowPhase): string {
// Get current date from browser
const currentDate = new Date().toLocaleDateString('en-US', {
year: 'numeric',
month: 'long',
day: 'numeric'
});

const dateContext = ` Current Date: ${currentDate}. Use this date when referencing timeframes, planning, or scheduling in your response.`;

switch (phase) {
case 'requirements':
return 'You are creating a requirements document in EARS format based on the provided feature description. Generate an initial requirements document following the structure with clear user stories and EARS acceptance criteria using WHEN, IF, WHILE, WHERE keywords.'
return `You are creating a requirements document in EARS format based on the provided feature description. Generate an initial requirements document following the structure with clear user stories and EARS acceptance criteria using WHEN, IF, WHILE, WHERE keywords.${dateContext}`
case 'design':
return 'You are creating a comprehensive design document based on approved requirements. Include technical architecture, components, data models, error handling, and testing strategy. Use Mermaid diagrams for complex relationships.'
return `You are creating a comprehensive design document based on approved requirements. Include technical architecture, components, data models, error handling, and testing strategy. Use Mermaid diagrams for complex relationships.${dateContext}`
case 'tasks':
return 'You are creating an actionable implementation plan based on approved design. Convert the design into discrete, manageable coding tasks with numbered checkboxes, specific deliverables, and requirement references.'
return `You are creating an actionable implementation plan based on approved design. Convert the design into discrete, manageable coding tasks with numbered checkboxes, specific deliverables, and requirement references.${dateContext}`
default:
return 'You are creating technical specifications following standard formats.'
return `You are creating technical specifications following standard formats.${dateContext}`
}
}

Expand All @@ -1442,8 +1451,17 @@ function getRefinementPromptForPhase(phase: WorkflowPhase): string {

// Phase-specific prompt builders matching Kiro IDE's approach
function buildRequirementsPrompt(featureName: string, description: string, contextFiles: ContextFile[]): string {
// Get current date from browser
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Bug: Inconsistent Date Context in Refinement Prompts

The getRefinementPromptForPhase function was not updated to include current date context, unlike other prompt generation functions. This creates an inconsistency where AI models receive date context during initial generation but not during refinement, potentially causing incorrect or inconsistent date references when refining content involving timelines or scheduling.

Fix in Cursor Fix in Web

const currentDate = new Date().toLocaleDateString('en-US', {
year: 'numeric',
month: 'long',
day: 'numeric'
});

let prompt = `Feature: ${featureName}

Current Date: ${currentDate}

Description:
${description}`

Expand Down Expand Up @@ -1493,15 +1511,33 @@ ${description}`
}

function buildDesignPrompt(requirements: string): string {
// Get current date from browser
const currentDate = new Date().toLocaleDateString('en-US', {
year: 'numeric',
month: 'long',
day: 'numeric'
});

return `Based on the following approved requirements, create a comprehensive technical design document with architectural diagrams.

Current Date: ${currentDate}

## Requirements:
${requirements}`
}

function buildTasksPrompt(requirements: string, design: string): string {
// Get current date from browser
const currentDate = new Date().toLocaleDateString('en-US', {
year: 'numeric',
month: 'long',
day: 'numeric'
});

return `Based on the following approved requirements and design, create a detailed implementation task list with numbered checkboxes.

Current Date: ${currentDate}

## Requirements:
${requirements}

Expand Down