The /goal command launches a goal-driven agent loop where Kiro works autonomously toward an objective you define. Unlike a regular prompt, the agent cycles through implementation and self-verification, only marking the task complete when acceptance criteria are met. By default, the agent runs up to 5 iterations — increase this with --max:
# Default: 5 iterations /goal refactor the auth module to use JWT tokens and ensure all tests pass # Allow more iterations for complex tasks /goal --max 10 migrate the entire test suite from Jest to Vitest
When you set a goal, the agent enters an iterative loop:
This cycle continues until the agent confirms the work is done or you cancel the goal.
The agent derives acceptance criteria from your goal statement. Be explicit about what "done" looks like — "all tests pass" or "no TypeScript errors" gives the agent a concrete verification target. Vague goals like "improve the code" may cause the agent to iterate longer than necessary.
# Set a goal with clear acceptance criteria /goal refactor the auth module to use JWT tokens and ensure all tests pass # Cancel an active goal /goal clear
Goals work best for multi-step tasks where you want autonomous execution with a built-in quality gate:
For simple, single-step tasks where you already know what you want, a regular prompt is faster. Use /goal when you want the agent to own the verification step.
While a goal is running, you have two options:
/goal clear to stop the loop and return to standard interactive mode/goal clear
File changes already made remain on disk. Use your version control system to revert if needed.
The agent respects the same turn limits and context window constraints as regular prompts. If it exhausts its context or hits a repeated failure pattern, it stops and reports what it tried. You can also use queue steering to nudge the agent mid-loop without cancelling the goal entirely.
Goal