> For the complete documentation index, see [llms.txt](https://docs.loci-dev.net/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.loci-dev.net/quick-start-loci-github-integration.md).

# Quick-Start LOCI GitHub Integration

The **LOCI AI Agent** GitHub integration enables developers and engineering teams to automate performance analysis directly within their existing GitHub CI/CD workflows. By connecting LOCI's hardware-aware optimization engine with GitHub Actions and the LOCI GitHub App, teams gain immediate visibility into the performance impact of every commit, build, and pull request.

***

### User Flow Overview

<figure><img src="/files/TdXcJaK7i9p1dyGxRGiq" alt=""><figcaption></figcaption></figure>

**Setup steps (1–3)** are performed once per repository.&#x20;

**Usage steps (4–5)** repeat automatically on every pull request.

***

### Step-by-Step Guide

#### Step 1 — Install the LOCI GitHub App

Go to <https://github.com/marketplace/loci-agentic-ai> and install the app on your repository. This enables LOCI to post automated performance analysis comments directly on your pull requests. An active LOCI license is required (free plans available).

***

#### Step 2 — Add Your Credentials to GitHub

In your repository settings, add two values:

* `LOCI_API_KEY` — as a GitHub Secret
* `LOCI_BACKEND_URL` — as a GitHub Variable

Optionally add `LOCI_GITHUB_TOKEN` to enable workflow summary integration. These credentials connect the LOCI Action to your licensed backend.

***

#### Step 3 — Add the LOCI Action to Your CI Workflow

Add the [LOCI Action](https://github.com/marketplace/actions/loci-action) to your existing `.github/workflows` file. The action runs in two steps: **upload** (build and ship your binary after compilation) and **summary** (wait for analysis and attach the Agent Report to the workflow run).

```yaml

name: Upload to LOCI
  uses: auroralabs-loci/loci-action@v1
  env:
          LOCI_BACKEND_URL: '${{ vars.LOCI_PROD_BACKEND_URL }}'
          LOCI_API_KEY: '${{ secrets.LOCI_PROD_API_KEY_STD }}'
  with:
    mode: upload
    project: my-project
```

***

#### Step 4 — Open a Pull Request

Push a branch and open a PR as normal. LOCI automatically detects the changed functions, compiles the before/after binaries, and runs hardware-aware analysis — no manual trigger needed.

***

#### Step 5 — Review the LOCI Report

LOCI posts its findings directly in the PR as a comment from the `loci-review` \[Bot]. The report includes:

* Execution timing and energy deltas per changed function
* Flame graph comparison between base and target versions (when relevant)
* Control-flow analysis highlighting call-depth changes
* Agent Summary with optimization recommendations and a pass/fail performance check

***

### Next Steps

* [Explore the full PR Insights Report in LOCI Inspector](https://app.gitbook.com/o/ZFw3dndBL81eukjWL25m/s/S2ZTr9umTUpVzGSJHbuR/~/edit/~/changes/51/loci-inspector)
* [Explore the full GitHub Actions reference](https://github.com/marketplace/actions/loci-action)
* [View a live example PR](https://github.com/auroralabs-loci/llama.cpp/pull/1361)


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.loci-dev.net/quick-start-loci-github-integration.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
