# GitHub Integration Setup Guide (Optibot)

This guide walks you through how to install and configure Optibot — Optimal AI’s secure AI code review agent — directly within your GitHub workflow.

## Prerequisites

Before you begin, ensure you have:

- Admin access to your GitHub organization or repo
- A GitHub account with permission to install apps
- Access to your org’s GitHub repositories

## Step 1: Sign Up & Install the GitHub App

1. **Visit the Sign-Up Link** — Begin by signing up through the [Optibot signup link](https://agents.getoptimal.ai/signup). This activates your free trial (unlimited repos, PRs, and usage during trial).

2. **Authorize the GitHub App Installation** — During onboarding, you’ll be prompted to install the Optibot GitHub App:
   - Select the organization and repositories where you want Optibot active.
   - Grant the required read/write permissions for pull requests and metadata.
3. **Select Repositories** — Choose either:
   - **All Repositories** (for full org coverage), or
   - **Specific Repos** where you’d like Optibot to run.
4. **Wait for Context Indexing** — Once installed, Optibot begins indexing your codebase to build context.
   - For small repos: indexing completes in minutes
   - For large repos or monorepos: indexing can take a few hours
   - Very large codebases may take up to a week

> ⏳ During indexing, the app may appear as “Installing…” — no action is needed during this phase.

## Step 2: Optibot Starts Reviewing PRs

Once indexing is complete, Optibot begins functioning automatically:

- **PR Summaries** — You’ll receive rich, contextual summaries with functional intent, not just diffs.
- **Automated Code Reviews** — Optibot flags bugs, security issues, anti-patterns, and logic problems across the repo.
- 🟢 Merge recommendations or 🛑 blocking flags will appear as part of the PR review flow.

## Step 3: Customize with `.optibot` file (Optional)

Upon installation, Optibot opens a PR containing a default `.optibot` file. You can customize:

- ✅ Repos or folders where Optibot should/shouldn’t review code
- 🧪 Enable or disable certain review features (e.g. test fixing, CI failure handling)
- 🛡️ Turn on optional security enforcement or guidelines

Once merged, these settings go live and will be applied on future PRs.

## Optional Features to Turn On (Post-Setup)

Once you’re familiar with the baseline functionality, you can optionally enable:

- **Guidelines Enforcement** — Upload a shared ruleset to enforce team practices across PRs
- **Dependabot Bundling** — Automatically test, merge, and close PRs opened by Dependabot
- **SOC 2 Compliance Checks** — Run `#optibot compliance` in PR comments for risk assessments

## Troubleshooting & Support

- Join a shared Slack channel with the Optimal AI team for real-time help
- Installation status, indexing progress, and detailed logs are visible in your dashboard
- Questions? Use `@optibot` inside PRs to request additional reviews or ask for clarifications

## Security Notes

- No code is stored — all analysis is done ephemerally during the review
- Optibot supports fine-grained repo-level access
- Your `.optibot` file config stays version-controlled inside your repo
