refine_requirement is the step before get_stack when the user's prompt is vague. It returns a structured sub_needs array that you pass unchanged into the stack builder.
Input
- The user's raw use-case.
- Hint from classify_prompt, if already run.
- Optional constraints from the current project (language, framework, existing tools).
promptstringrequiredclassification"tool_discovery" | "stack_building" | "tool_comparison" | "tool_configuration"optionalproject_contextobjectoptionalExample
request
json
{
"prompt": "I'm building a SaaS with auth and billing",
"classification": "stack_building",
"project_context": { "language": "TypeScript" }
}response
json
{
"decomposition_prompt": "A full-stack SaaS with user auth and subscription billing.",
"sub_needs": [
{ "sub_need_type": "framework",
"keyword_sentence": "react, full-stack, ssr, typescript" },
{ "sub_need_type": "database",
"keyword_sentence": "sql, postgres, type-safe, migrations" },
{ "sub_need_type": "auth",
"keyword_sentence": "oauth, session, email-password, passkeys" },
{ "sub_need_type": "payment",
"keyword_sentence": "subscriptions, webhooks, checkout" }
]
}Pipeline
Agent pattern: classify_prompt → refine_requirement → get_stack. The first step is optional; the latter two are the core loop.
Related
get_stack— the consumer of the sub_needs returned here.- Keyword-Sentence Retrieval — why the output is structured this way.