Task Planning and Codebase Analysis
When you describe a task, agent mode starts by analyzing your project. It reads the directory structure, package.json or requirements.txt, existing code patterns, and test configuration. From this analysis, it builds a step-by-step plan: which files to create, which existing files to modify, what packages to install, and what tests to run. The plan appears in the chat panel before execution begins — you can approve it, modify steps, add constraints ("use Zod for validation, not Joi"), or remove steps you want to handle manually.
The planning phase is what separates agent mode from simple code generation. A code generator writes a function and stops. Agent mode understands that building an API endpoint also requires route registration, middleware configuration, input validation, error handling, database queries, response formatting, and test coverage. It plans all of these steps as a coherent sequence with dependencies — the route handler is created after the database model, and tests are written after both exist.