{
	"id": "expand-task",
	"version": "1.0.0",
	"description": "Break down a task into detailed subtasks",
	"metadata": {
		"author": "system",
		"created": "2024-01-01T00:00:00Z",
		"updated": "2024-01-01T00:00:00Z",
		"tags": ["expansion", "subtasks", "breakdown"]
	},
	"parameters": {
		"subtaskCount": {
			"type": "number",
			"required": true,
			"description": "Number of subtasks to generate"
		},
		"task": {
			"type": "object",
			"required": true,
			"description": "The task to expand"
		},
		"nextSubtaskId": {
			"type": "number",
			"required": true,
			"description": "Starting ID for new subtasks"
		},
		"useResearch": {
			"type": "boolean",
			"default": false,
			"description": "Use research mode"
		},
		"expansionPrompt": {
			"type": "string",
			"required": false,
			"description": "Expansion prompt from complexity report"
		},
		"additionalContext": {
			"type": "string",
			"required": false,
			"default": "",
			"description": "Additional context for task expansion"
		},
		"complexityReasoningContext": {
			"type": "string",
			"required": false,
			"default": "",
			"description": "Complexity analysis reasoning context"
		},
		"gatheredContext": {
			"type": "string",
			"required": false,
			"default": "",
			"description": "Gathered project context"
		}
	},
	"prompts": {
		"complexity-report": {
			"condition": "expansionPrompt",
			"system": "You are an AI assistant helping with task breakdown. Generate {{#if (gt subtaskCount 0)}}exactly {{subtaskCount}}{{else}}an appropriate number of{{/if}} subtasks based on the provided prompt and context.\nRespond ONLY with a valid JSON object containing a single key \"subtasks\" whose value is an array of the generated subtask objects.\nEach subtask object in the array must have keys: \"id\", \"title\", \"description\", \"dependencies\", \"details\", \"status\".\nEnsure the 'id' starts from {{nextSubtaskId}} and is sequential.\nEnsure 'dependencies' only reference valid prior subtask IDs generated in this response (starting from {{nextSubtaskId}}).\nEnsure 'status' is 'pending'.\nDo not include any other text or explanation.",
			"user": "{{expansionPrompt}}{{#if additionalContext}}\n\n{{additionalContext}}{{/if}}{{#if complexityReasoningContext}}\n\n{{complexityReasoningContext}}{{/if}}{{#if gatheredContext}}\n\n# Project Context\n\n{{gatheredContext}}{{/if}}"
		},
		"research": {
			"condition": "useResearch === true && !expansionPrompt",
			"system": "You are an AI assistant that responds ONLY with valid JSON objects as requested. The object should contain a 'subtasks' array.",
			"user": "Analyze the following task and break it down into {{#if (gt subtaskCount 0)}}exactly {{subtaskCount}}{{else}}an appropriate number of{{/if}} specific subtasks using your research capabilities. Assign sequential IDs starting from {{nextSubtaskId}}.\n\nParent Task:\nID: {{task.id}}\nTitle: {{task.title}}\nDescription: {{task.description}}\nCurrent details: {{#if task.details}}{{task.details}}{{else}}None{{/if}}{{#if additionalContext}}\nConsider this context: {{additionalContext}}{{/if}}{{#if complexityReasoningContext}}\nComplexity Analysis Reasoning: {{complexityReasoningContext}}{{/if}}{{#if gatheredContext}}\n\n# Project Context\n\n{{gatheredContext}}{{/if}}\n\nCRITICAL: Respond ONLY with a valid JSON object containing a single key \"subtasks\". The value must be an array of the generated subtasks, strictly matching this structure:\n\n{\n  \"subtasks\": [\n    {\n      \"id\": <number>, // Sequential ID starting from {{nextSubtaskId}}\n      \"title\": \"<string>\",\n      \"description\": \"<string>\",\n      \"dependencies\": [<number>], // e.g., [{{nextSubtaskId}} + 1]. If no dependencies, use an empty array [].\n      \"details\": \"<string>\",\n      \"testStrategy\": \"<string>\" // Optional\n    },\n    // ... (repeat for {{#if (gt subtaskCount 0)}}{{subtaskCount}}{{else}}appropriate number of{{/if}} subtasks)\n  ]\n}\n\nImportant: For the 'dependencies' field, if a subtask has no dependencies, you MUST use an empty array, for example: \"dependencies\": []. Do not use null or omit the field.\n\nDo not include ANY explanatory text, markdown, or code block markers. Just the JSON object."
		},
		"default": {
			"system": "You are an AI assistant helping with task breakdown for software development.\nYou need to break down a high-level task into {{#if (gt subtaskCount 0)}}{{subtaskCount}}{{else}}an appropriate number of{{/if}} specific subtasks that can be implemented one by one.\n\nSubtasks should:\n1. Be specific and actionable implementation steps\n2. Follow a logical sequence\n3. Each handle a distinct part of the parent task\n4. Include clear guidance on implementation approach\n5. Have appropriate dependency chains between subtasks (using the new sequential IDs)\n6. Collectively cover all aspects of the parent task\n\nFor each subtask, provide:\n- id: Sequential integer starting from the provided nextSubtaskId\n- title: Clear, specific title\n- description: Detailed description\n- dependencies: Array of prerequisite subtask IDs (use the new sequential IDs)\n- details: Implementation details, the output should be in string\n- testStrategy: Optional testing approach\n\nRespond ONLY with a valid JSON object containing a single key \"subtasks\" whose value is an array matching the structure described. Do not include any explanatory text, markdown formatting, or code block markers.",
			"user": "Break down this task into {{#if (gt subtaskCount 0)}}exactly {{subtaskCount}}{{else}}an appropriate number of{{/if}} specific subtasks:\n\nTask ID: {{task.id}}\nTitle: {{task.title}}\nDescription: {{task.description}}\nCurrent details: {{#if task.details}}{{task.details}}{{else}}None{{/if}}{{#if additionalContext}}\nAdditional context: {{additionalContext}}{{/if}}{{#if complexityReasoningContext}}\nComplexity Analysis Reasoning: {{complexityReasoningContext}}{{/if}}{{#if gatheredContext}}\n\n# Project Context\n\n{{gatheredContext}}{{/if}}\n\nReturn ONLY the JSON object containing the \"subtasks\" array, matching this structure:\n\n{\n  \"subtasks\": [\n    {\n      \"id\": {{nextSubtaskId}}, // First subtask ID\n      \"title\": \"Specific subtask title\",\n      \"description\": \"Detailed description\",\n      \"dependencies\": [], // e.g., [{{nextSubtaskId}} + 1] if it depends on the next\n      \"details\": \"Implementation guidance\",\n      \"testStrategy\": \"Optional testing approach\"\n    },\n    // ... (repeat for {{#if (gt subtaskCount 0)}}a total of {{subtaskCount}}{{else}}an appropriate number of{{/if}} subtasks with sequential IDs)\n  ]\n}"
		}
	}
}
