Sub-Task Decomposition Patterns

admin · 2026-05-03 · architecture · task-planning · patterns

The Challenge of Complex Tasks

When a user says "build me a REST API for user management," that's not one task — it's dozens. Database design, authentication, input validation, error handling, testing, documentation. A single LLM call can't do this well.

Decomposition Pipeline

BuddyMe's task planner breaks complex requests into a structured pipeline:

  1. SEARCH — Gather context: examine existing code, check dependencies, understand conventions
  2. CREATE — Generate the initial implementation based on gathered context
  3. EDIT — Refine and fix issues found during review
  4. VERIFY — Run tests, lint, type-check to validate the output

Example: Building an API Endpoint

User: "Add a password reset endpoint"

Planner分解:
1. SEARCH — Find auth module, check existing patterns
2. CREATE — Write the endpoint following project conventions
3. EDIT — Add error handling, validate edge cases
4. VERIFY — Run tests, check types, verify imports

Why This Works

Each stage has a focused objective and clear success criteria. The agent isn't trying to do everything at once — it's executing a well-defined plan. This approach:

一句话引用:How BuddyMe breaks complex requests into manageable pipelines using SEARCH, CREATE, EDIT, and VERIFY stages.