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

# Example Workflows

> Real-world patterns for using CodeAlive with AI coding agents

Discover how developers use CodeAlive to accelerate their daily work. Each workflow shows a realistic scenario with step-by-step instructions and example prompts you can copy directly into your AI agent.

## Workflows

<Tabs>
  <Tab title="Onboard to a Codebase">
    <Info>
      **Scenario:** You just joined a team and need to understand a large, unfamiliar project quickly.
    </Info>

    <Steps>
      <Step title="Index the repository">
        Add the project repository in your [CodeAlive dashboard](https://app.codealive.ai) and wait for indexing to complete.
      </Step>

      <Step title="Ask about architecture">
        Start with broad questions to understand the overall structure:

        ```
        "What is the high-level architecture of this project?"
        "What frameworks and libraries does this codebase use?"
        "How is the code organized — what are the main modules?"
        ```
      </Step>

      <Step title="Find entry points">
        Narrow down to the most important files:

        ```
        "Where is the main entry point of the application?"
        "Show me the API route definitions"
        "Where is the database schema defined?"
        ```
      </Step>

      <Step title="Explore patterns and conventions">
        Understand how the team writes code:

        ```
        "How is error handling done in this project?"
        "What patterns are used for authentication?"
        "Show me how services communicate with each other"
        ```
      </Step>
    </Steps>

    <Tip>
      Start with `semantic_search` and `grep_search` for evidence gathering, then switch to `chat` only when you need synthesized architecture-level analysis.
    </Tip>
  </Tab>

  <Tab title="Cross-Repo Search">
    <Info>
      **Scenario:** You need to find how a shared library or API is used across multiple services in a microservices architecture.
    </Info>

    <Steps>
      <Step title="Set up a workspace">
        In your CodeAlive dashboard, group related repositories into a workspace (e.g., "platform-services").
      </Step>

      <Step title="Search across repositories">
        Use semantic search to find usage patterns across all repos:

        ```
        "Search for usage of the UserService API across all repositories"
        "Find all implementations of the PaymentGateway interface"
        "Show me how the shared auth library is imported and used"
        ```
      </Step>

      <Step title="Compare implementations">
        Look for inconsistencies or patterns:

        ```
        "Compare how error handling is done in the order-service vs payment-service"
        "Are there any services not using the latest version of the shared client?"
        "Find all places where the deprecated createUser method is still called"
        ```
      </Step>
    </Steps>

    <Tip>
      Use `get_data_sources` first to see all available repositories and workspaces — pass your task as the `query` argument to get only the relevant ones. Scope searches with workspace names for faster, more relevant results.
    </Tip>
  </Tab>

  <Tab title="AI Code Review">
    <Info>
      **Scenario:** You need to review a pull request with full awareness of how the changes affect the broader codebase.
    </Info>

    <Steps>
      <Step title="Understand the change context">
        Ask CodeAlive about the code being modified:

        ```
        "Explain how the authentication middleware works in this project"
        "What calls the handlePayment function and what depends on its return value?"
        ```
      </Step>

      <Step title="Check for pattern consistency">
        Verify the PR follows existing conventions:

        ```
        "How do other API endpoints in this project handle validation?"
        "Show me how similar services are structured in this codebase"
        "What error handling pattern is used in the controller layer?"
        ```
      </Step>

      <Step title="Analyze for risks">
        Look for potential issues:

        ```
        "What other code would break if the User model schema changes?"
        "Find all callers of this function to check if the new parameter is handled"
        "Are there existing tests that cover this authentication flow?"
        ```
      </Step>
    </Steps>

    <Tip>
      Use `semantic_search` and `grep_search` to find related code quickly, then `chat` to get a synthesized analysis of how the changes fit into the broader architecture.
    </Tip>
  </Tab>

  <Tab title="Build Following Patterns">
    <Info>
      **Scenario:** You need to add a new API endpoint (or service, component, etc.) that matches the team's existing conventions.
    </Info>

    <Steps>
      <Step title="Find similar implementations">
        Search for existing patterns to follow:

        ```
        "Show me an example API endpoint with full CRUD operations"
        "How are controllers structured in this project?"
        "Find a service that handles database transactions"
        ```
      </Step>

      <Step title="Analyze the pattern">
        Ask CodeAlive to extract the conventions:

        ```
        "What is the standard structure for a new API endpoint in this project?"
        "What middleware is applied to protected routes?"
        "How are request validation and error responses handled?"
        ```
      </Step>

      <Step title="Generate matching code">
        Use the patterns as context for code generation:

        ```
        "Create a new /api/orders endpoint following the same patterns as /api/products"
        "Generate a service class for OrderService matching the structure of ProductService"
        "Write tests for the OrderController using the same testing patterns as ProductController"
        ```
      </Step>
    </Steps>

    <Tip>
      The search-then-generate flow produces much better results than asking for code from scratch. The AI sees your actual conventions, not generic best practices.
    </Tip>
  </Tab>

  <Tab title="Debug Across Files">
    <Info>
      **Scenario:** You're tracking down a bug that spans multiple files or services and need to trace the execution path.
    </Info>

    <Steps>
      <Step title="Search for error context">
        Start from the error message or symptom:

        ```
        "Search for where 'PaymentProcessingError' is thrown"
        "Find all places where the order status is updated to 'failed'"
        "Show me the error handling chain for payment webhooks"
        ```
      </Step>

      <Step title="Trace the data flow">
        Follow the execution path through the codebase:

        ```
        "Trace the flow from when a payment webhook arrives to when the order status is updated"
        "What functions call processPayment and what happens with the return value?"
        "Show me the middleware chain that runs before the payment endpoint"
        ```
      </Step>

      <Step title="Find the root cause">
        Narrow down to the issue:

        ```
        "Are there any race conditions in the payment processing flow?"
        "Compare the error handling in processPayment with similar functions — is anything missing?"
        "What happens if the database connection drops during a payment transaction?"
        ```
      </Step>
    </Steps>

    <Tip>
      Use `grep_search` with specific error messages or function names for fast, targeted lookups and `semantic_search` for broader retrieval. Switch to `chat` only when you need the AI to reason about execution flow after search.
    </Tip>
  </Tab>

  <Tab title="Multi-Agent Workflow">
    <Info>
      **Scenario:** You want to research in one AI agent and implement in another — with both sharing the same codebase context.
    </Info>

    <Steps>
      <Step title="Research in your preferred agent">
        Use CodeAlive in Cursor, VS Code, or any connected agent to explore:

        ```
        "How does the notification system work?"
        "What would need to change to add email notifications?"
        "Show me the existing notification channels and their implementations"
        ```
      </Step>

      <Step title="Switch agents for implementation">
        Open Claude Code (or any other agent) — CodeAlive provides the same context:

        ```
        "Search for the NotificationService implementation"
        "Create an EmailNotificationChannel following the pattern of SlackNotificationChannel"
        ```

        Both agents query the same indexed codebase, so your research carries over naturally.
      </Step>

      <Step title="Verify across agents">
        Use any connected agent to verify the changes fit:

        ```
        "Does the new EmailNotificationChannel follow the same interface as other channels?"
        "What tests exist for notification channels that I should replicate?"
        ```
      </Step>
    </Steps>

    <Tip>
      CodeAlive acts as a shared knowledge layer. Index once, query from any agent. This is especially useful when different agents have different strengths — use Cursor for exploration and Claude Code for implementation, for example.
    </Tip>
  </Tab>
</Tabs>

## What's Next

<CardGroup cols={2}>
  <Card title="Tips & Tricks" icon="lightbulb" href="/tips-and-tricks">
    Get the most out of CodeAlive with practical tips
  </Card>

  <Card title="MCP Integration" icon="plug" href="/integrations/mcp">
    Set up CodeAlive with your AI agent
  </Card>
</CardGroup>
