> ## Documentation Index
> Fetch the complete documentation index at: https://docs.rocket.new/llms.txt
> Use this file to discover all available pages before exploring further.

# Advisor Agent

> Rocket's built-in senior architect that diagnoses root causes, resolves error loops, and makes architectural decisions so the coding agent never gets stuck.

export const LlmsDirective = () => <blockquote className="llms-directive">
    For the complete documentation index, see <a href="/llms.txt">llms.txt</a>.
    For a lightweight markdown version of this page, append .md to the URL.
  </blockquote>;

<LlmsDirective />

Every AI coding agent has a failure mode. It tries to fix a bug, fails, tries again, and starts recycling the same approaches. It gets stuck and it doesn't know it.

The Advisor Agent is a senior architect sub-agent built into Rocket's code generation pipeline. It runs on the most capable model available (Claude Opus), operates in read-only mode, and is invoked specifically in the moments where the coding agent's reasoning is not enough.

<Divider />

## What the Advisor does

The Advisor never writes a line of code. It returns structured analysis: root causes, a recommendation, numbered implementation steps, and a trade-off table. Then the coding agent executes.

<CardGroup cols={2}>
  <Card title="Error loop resolution" icon="rotate">
    When the coding agent has failed to fix a bug after 2+ attempts, it escalates. The Advisor identifies the root cause rather than the symptom the coding agent was already chasing.
  </Card>

  <Card title="Architectural decisions" icon="sitemap">
    When multiple valid approaches exist with real trade-offs, the Advisor reads the project structure, weighs the options, and recommends the one that fits your codebase.
  </Card>

  <Card title="Large scale refactoring" icon="arrows-split-up-and-left">
    Before sweeping changes, the Advisor maps what breaks. It identifies what needs to change, in what order, and what the risks are.
  </Card>

  <Card title="Code review" icon="magnifying-glass-chart">
    Before finalizing complex generated code, the Advisor checks it for correctness, edge cases, and failure modes.
  </Card>
</CardGroup>

<Divider />

## How it helps you

<AccordionGroup>
  <Accordion title="No more repeated failures">
    No more watching an agent loop on the same broken fix three times while your progress bar resets. When something is genuinely hard, the Advisor gets pulled in before the loop forms. You see a result, not repeated attempts.
  </Accordion>

  <Accordion title="Expert level reasoning on the hardest decisions">
    Architectural choices compound. A wrong call on how to structure auth, handle database seeding, or wire an integration creates technical debt that shows up weeks later. The Advisor treats these decisions with the weight they deserve, reading your actual codebase rather than applying a generic template.
  </Accordion>
</AccordionGroup>

<Divider />

## How it helps the coding agent

<AccordionGroup>
  <Accordion title="Prevents compounding errors">
    An agent that has tried the wrong approach twice and tries it a third time is not just wasting time. It is potentially making the codebase harder to fix. The Advisor stops that pattern.
  </Accordion>

  <Accordion title="Separates reasoning from execution">
    The coding agent is optimized for action: writing code, running tools, generating files. The Advisor is optimized for analysis: reading, inferring, comparing. Keeping these concerns separated produces better outcomes than asking a single agent to do both under time pressure.
  </Accordion>

  <Accordion title="Uses the most capable model where it matters most">
    Running Claude Opus on every token of a coding session is expensive. Running it on the specific moments where architectural reasoning determines whether the session succeeds is how you get the intelligence without the cost.
  </Accordion>

  <Accordion title="Grounds recommendations in the actual codebase">
    The Advisor never advises from memory or pattern matching. Every recommendation cites specific file paths, field names, and constraint names. The coding agent does not get generic advice. It gets a roadmap.
  </Accordion>
</AccordionGroup>

<Divider />

## Real example: Supabase auth fix

A user asked to make their app fully dynamic with Supabase auth. The coding agent created demo accounts by writing directly to `auth.users` and `auth.identities` via SQL migrations.

Login returned "Invalid login credentials". The agent tried two fixes. Both failed.

On the third attempt, the Advisor was invoked. It read both migration files in full and identified four root causes:

<Steps>
  <Step title="Wrong UUID fields">
    The `auth.identities.id` field must be a new UUID, not the user's UUID. The `provider_id` for the email provider must be the user's UUID, not their email address. Both migrations got both fields backwards. GoTrue v2.116.0 restructured the identities table in late 2023.
  </Step>

  <Step title="Wrong column order in conflict clause">
    The `ON CONFLICT` clause targeted `(provider, provider_id)` but PostgreSQL's constraint matching is column order sensitive. The actual constraint is `(provider_id, provider)`. The conflict clause silently failed to match.
  </Step>

  <Step title="Silent error swallowing">
    Both migrations wrapped everything in `EXCEPTION WHEN OTHERS THEN RAISE NOTICE`. Every SQL error was swallowed silently and reported as a successful "skip".
  </Step>

  <Step title="Fragile approach by design">
    The entire SQL approach was fragile. Supabase updates GoTrue independently. The correct approach is `supabase.auth.admin.createUser()` which routes through GoTrue's own logic and is always schema correct regardless of version.
  </Step>
</Steps>

The coding agent followed the steps. Login worked. Not another attempt at the same fix, but a fundamentally different diagnosis.

<Divider />

## What's next?

<CardGroup cols={2}>
  <Card title="Chat with Rocket" icon="messages" href="/build/editor/chat">
    Build and iterate on your app through natural language chat.
  </Card>

  <Card title="Agent sleeping" icon="moon" href="/build/editor/agent-sleeping">
    Learn about agent inactivity and how to resume.
  </Card>

  <Card title="Best practices" icon="lightbulb" href="/build/best-practices">
    Get the most out of Rocket with effective prompting patterns.
  </Card>

  <Card title="Troubleshooting" icon="wrench" href="/help/troubleshooting">
    Fix common build errors and unexpected behavior.
  </Card>
</CardGroup>
