repositories / pi-ext

pi-ext

bugabingas pi extensions

owned by bugabinga

extensions/ultra/workflows/feature.json

Raw
{
	"name": "feature",
	"description": "Research the codebase, plan a feature, critique and strengthen the plan, implement it, then review for security and quality.",
	"args": { "hint": "<task>", "params": ["task"] },
	"schemas": {
		"Research": {
			"type": "object",
			"properties": {
				"findings": {
					"type": "string",
					"description": "Summary of how the codebase handles this area"
				},
				"files": {
					"type": "array",
					"items": { "type": "string" },
					"description": "Relevant file paths"
				},
				"patterns": {
					"type": "array",
					"items": { "type": "string" },
					"description": "Existing conventions to follow"
				}
			},
			"required": ["findings", "files"]
		},
		"Plan": {
			"type": "object",
			"properties": {
				"tasks": {
					"type": "array",
					"items": { "type": "string" },
					"description": "Concrete implementation steps, in order"
				},
				"approach": {
					"type": "string",
					"description": "One-paragraph overall approach"
				},
				"risks": { "type": "array", "items": { "type": "string" } }
			},
			"required": ["tasks", "approach"]
		},
		"Critique": {
			"type": "object",
			"properties": {
				"approved": {
					"type": "boolean",
					"description": "true only if the plan is sound and complete"
				},
				"blocking": {
					"type": "array",
					"items": { "type": "string" },
					"description": "Each blocking gap the implementer must resolve"
				},
				"feedback": { "type": "string" }
			},
			"required": ["approved", "blocking"]
		},
		"Implementation": {
			"type": "object",
			"properties": {
				"implemented": {
					"type": "boolean",
					"description": "true only when the feature changes and focused checks completed"
				},
				"summary": {
					"type": "string",
					"description": "What was changed and why"
				},
				"modified_files": { "type": "array", "items": { "type": "string" } },
				"completed": {
					"type": "array",
					"items": { "type": "string" },
					"description": "Plan tasks actually completed"
				}
			},
			"required": ["implemented", "summary", "modified_files"]
		},
		"Verdict": {
			"type": "object",
			"properties": {
				"dimension": {
					"type": "string",
					"description": "echo of the review dimension, for correlation"
				},
				"passed": { "type": "boolean" },
				"findings": {
					"type": "array",
					"items": { "type": "string" },
					"description": "Blocking problems found (empty if passed)"
				}
			},
			"required": ["dimension", "passed"]
		}
	},
	"phases": [
		{
			"id": "research",
			"kind": "single",
			"step": {
				"summary": "Research feature: {args.task}",
				"prompt": "Research this codebase to implement the feature: {args.task}. Identify the files you'd touch, the existing patterns/conventions to follow, and any constraints. Inspect with read/grep/find/bash (e.g. `git log`, `git grep`); do not modify anything. Return JSON matching the Research schema.",
				"tools": ["read", "grep", "find", "ls", "bash"],
				"model": "small",
				"thinkingLevel": "medium",
				"schema": "Research"
			}
		},
		{
			"id": "plan",
			"kind": "single",
			"step": {
				"summary": "Plan feature: {args.task}",
				"prompt": "Produce an implementation plan for: {args.task}. Ground it in this research: {research.results}. Give concrete ordered tasks, a one-paragraph approach, and the real risks. Read further if needed; do not modify anything. Return JSON matching the Plan schema.",
				"tools": ["read", "grep", "find", "ls", "bash"],
				"model": "big",
				"thinkingLevel": "high",
				"schema": "Plan"
			}
		},
		{
			"id": "critique",
			"kind": "single",
			"step": {
				"summary": "Critique feature plan: {args.task}",
				"prompt": "Adversarially critique this plan BEFORE any code is written. Task: {args.task}. Plan: {plan.results}. Research: {research.results}. Hunt for missing steps, wrong assumptions, and unhandled edge cases. Set approved=false and list each blocking issue if the plan isn't ready; default approved=false when uncertain. Do not modify anything. Return JSON matching the Critique schema.",
				"tools": ["read", "grep", "find", "ls", "bash"],
				"model": "big",
				"thinkingLevel": "xhigh",
				"schema": "Critique"
			}
		},
		{
			"id": "refine",
			"kind": "single",
			"step": {
				"summary": "Strengthen feature plan: {args.task}",
				"prompt": "Strengthen the implementation plan for: {args.task}. Rewrite it as a complete replacement that resolves EVERY blocking item from this critique: {critique.results}. Original plan: {plan.results}. Research: {research.results}. Read further if needed; do not modify anything. Return JSON matching the Plan schema.",
				"tools": ["read", "grep", "find", "ls", "bash"],
				"model": "big",
				"thinkingLevel": "high",
				"schema": "Plan"
			}
		},
		{
			"id": "implement",
			"kind": "single",
			"step": {
				"summary": "Implement feature: {args.task}",
				"prompt": "Implement the feature: {args.task}. Follow the strengthened plan: {refine.results}. Make the actual edits with the edit/write tools, keep the change focused, and follow the conventions surfaced in research. Run focused checks and set implemented=true only when the changes and checks complete. Then return JSON matching the Implementation schema (list the files you changed and a concise summary).",
				"tools": ["read", "grep", "find", "ls", "bash", "edit", "write"],
				"model": "medium",
				"thinkingLevel": "high",
				"schema": "Implementation"
			}
		},
		{
			"id": "review",
			"kind": "fanout",
			"when": "{implement.results | where implemented}",
			"over": ["security", "quality"],
			"step": {
				"summary": "Review implementation from {item} perspective",
				"prompt": "Review the just-made implementation of {args.task} from the {item} perspective. What changed: {implement.results}. Inspect the working tree with read/grep and `git diff`; do not modify anything. Set passed=false and list each blocking {item} problem you find. Echo the `dimension` field as \"{item}\" so the verdict ties back. Return JSON matching the Verdict schema.",
				"tools": ["read", "grep", "find", "ls", "bash"],
				"model": "big",
				"thinkingLevel": "high",
				"schema": "Verdict"
			}
		}
	],
	"return": "{review.results}"
}