> For the complete documentation index, see [llms.txt](https://docs.auroralabs.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.auroralabs.com/loci-plugin-for-ai-coding-assistants.md). Agents can also search and read this documentation through its [MCP server](https://docs.auroralabs.com/~gitbook/mcp).

# LOCI Plugin for AI Coding Assistants

## AI Writes Code. LOCI Gates It.

LOCI is a quality-gate agent for Claude Code and GitHub Copilot CLI that models regressions, power, latency, and control-flow safety directly from your compiled binary, from plan to merge. It requires no running code, no instrumentation, and no code changes: every result is grounded in real execution data recovered from the binary itself.

***

### What LOCI does

LOCI connects Claude Code to LCLM (Large Code Language Model), a model trained on billions of assembly blocks and real hardware traces from IoT, networking, and safety-critical systems — not a general-purpose model wrapped around your code. Because analysis happens at the binary level, LOCI can answer questions about timing, energy, memory, and control flow that source-level tools can't: the actual compiled output, not an approximation of it.

***

### Prerequisites

| Requirement                           | Version | Required for                                                                                                                           |
| ------------------------------------- | ------- | -------------------------------------------------------------------------------------------------------------------------------------- |
| GitHub Copilot CLI                    | latest  | 1.0.90 or newer                                                                                                                        |
| [Claude Code](https://claude.ai/code) | latest  | Everything                                                                                                                             |
| Python                                | 3.12+   | The `loci` CLI (local ELF/ build analysis)                                                                                             |
| [uv](https://docs.astral.sh/uv/)      | any     | Installs the `loci` CLI as a tool. Install this yourself — the plugin checks for it and gives you the install command if it's missing. |

**Cross-compiler depends on the** project you work with.

Skills that work without a cross-compiler or backend network access: `/loci:stack-depth`, `/loci:memory-report`, `/loci:control-flow` and `/loci:contract` need no cross-compiler and no backend call. All of them except `/loci:contract` still need a signed-in session.

***

### Install

Install the plugin from inside Claude Code:

`/plugin marketplace add auroralabs-loci/loci-claude`

`/plugin install loci@loci`

`/loci:setup`, then `! loci login` and `/loci:init`

&#x20;`/reload-plugins`

In GitHub Copilot CLI, install from a terminal with:

`copilot plugin marketplace add auroralabs-loci/loci-claude`

`copilot plugin install loci@loci`

run `/loci:setup` in a session

\
There is no separate CLI download step. The loci command-line tool is installed automatically in the background the first time a Claude Code session starts, using uv.If uv isn't already on your system, the agent tells you the install command to run.

***

### Authentication

Every analysis skill requires a signed-in session, including the ones that run entirely on your machine.

1. Run `! loci login` from inside Claude Code (or `loci login` in your terminal).
2. Confirm it worked with `loci auth status` - it should show `signed_in`.

* `/loci:stack-depth, /loci:memory-report, /loci:control-flow` run locally, but the CLI still requires a session.&#x20;
* Only `/loci:help`, `/loci:setup`, `/loci:bug-report` and `/loci:contract` work signed out.

***

### Quick Start

Once installed, signed in and initialized with `/loci:init`, try these in any C, C++, Rust, Go or Python (Cython) project:

1. **Timing & energy -** ask: "What's the execution cost of main()?"
2. **Memory budget -** ask: "How much ROM/RAM does my build use?"
3. **Stack safety** - ask: "Is my stack safe for TaskMain?"
4. **Control-flow safety -** ask: "What does the call graph for process\_data() look like?"
5. **Bounds** - say: "TaskMain must not exceed 4 kB of stack". LOCI drafts the bound and you apply it. Bounds are what let a report pass or fail.

Two skills also run automatically, with no invocation needed:

* `loci-preflight` fires during `/plan` mode — analyzes callees at the binary level before code is written.
* `loci-post-edit` (Save Guard) fires after every edit to C, C++, Rust, Go or Python source, or a header they include - diffs the binary and reports what the change cost. Also label `loci-preflight` as Plan Guard.

***

### Skills Reference

<table data-header-hidden><thead><tr><th width="141"></th><th width="216"></th><th width="93"></th><th></th></tr></thead><tbody><tr><td>Skill</td><td>Trigger</td><td>Sign-in required</td><td>What it does</td></tr><tr><td>loci-preflight</td><td>Automatic, in <code>/plan</code> mode</td><td>Yes</td><td>Audits the plan at binary level before code is written — timing, energy, and control-flow-graph impact.</td></tr><tr><td>loci-post-edit</td><td>Automatic, after edits to C/C++/Rust</td><td>Yes</td><td>Diffs pre/post compiled artifacts and returns a regression verdict on timing, energy, and control flow.</td></tr><tr><td>exec-trace</td><td>User-invoked</td><td>Yes</td><td>Function-level timing and energy from real-time hardware traces, powered by LCLM.</td></tr><tr><td>stack-depth</td><td>User-invoked</td><td>Yes</td><td>Worst-case stack depth via call-graph traversal and per-function frame sizes.</td></tr><tr><td>memory-report</td><td>User-invoked</td><td>Yes</td><td>ROM/RAM section breakdown and top consumers from compiled ELF binaries.</td></tr><tr><td>control-flow</td><td>User-invoked</td><td>Yes</td><td>Annotated control-flow graphs, optimized for LLM analysis.</td></tr><tr><td>trends</td><td>User-invoked</td><td>Yes</td><td>Per-function measurement history and optimization progress on the current branch.</td></tr><tr><td>help</td><td><code>/help</code></td><td>No</td><td>Confirms LOCI is loaded and lists available skills.</td></tr><tr><td>setup</td><td><code>/loci:setup</code>, or automatically on CLI-missing errors</td><td>No</td><td>Installs, repairs, or verifies the <code>loci</code> CLI. Safe to re-run at any time.</td></tr><tr><td>bug-report</td><td><code>/bug-report</code></td><td>No</td><td>Generates a full diagnostic report when something isn't working.</td></tr></tbody></table>

***

### Automatic Hooks

The plugin registers six hooks that run without user action:

| Hook               | Trigger                    | What it does                                                                                                                                                                                                  |
| ------------------ | -------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `SessionStart`     | Session startup or resume  | Installs the `loci` CLI in the background if missing, injects session context, cleans old build state, and reuses a confirmed recipe for a new checkout of a repository already set up. Never blocks startup. |
| `UserPromptSubmit` | Every prompt               | Stamps the turn id every measurement is filed under; in plan mode, reminds the agent to run Plan Guard.                                                                                                       |
| `PreToolUse`       | Before Edit, Write or Bash | Keeps `.loci/contract.yaml` and `.loci/build.yaml` read-only to the agent; snapshots the compiled `.o` for delta analysis.                                                                                    |
| `PostToolUse`      | After Edit, Write or Bash  | Checks whether the change can alter a compiled function (including edits made through the shell) and, if so, tells the agent to run `loci-post-edit`. Advisory only.                                          |
| `SubagentStart`    | A subagent is spawned      | Under GitHub Copilot CLI, lets the subagent's edits inherit the parent turn's id.                                                                                                                             |
| `Stop`             | End of each turn           | Flushes analysis records to your account, nudges about a pending contract draft, and cleans the turn's build state.                                                                                           |

***

### Troubleshooting

`loci` **CLI not found**:

1. Check it's on PATH: `command -v loci` and `loci --version`.
2. If it's missing, the background install may still be running or may have failed. Run `/loci:setup` to reinstall and verify — it's safe to re-run — or `loci doctor` once the CLI is present.
3. Confirm `uv` is installed (`command -v uv`); the plugin needs it to install the CLI.

**A skill reports** `auth_required`:

1. Type `! loci login` at the agent's prompt (or `loci login` in a terminal), then retry.
2. Confirm `loci auth status` shows `signed_in`.<br>

**Auto-skills didn't fire**:

* `loci-preflight` only runs in `/plan` mode — confirm you're planning new logic, not just asking a question.
* `loci-post-edit` only runs after edits to C/C++/Rust/Go/Python source files, or a header they include, in a project `/loci:init` has set up.
* Both compile the source themselves — they don't need a pre-built binary. They do require a supported LOCI target and a working cross-compiler for it on PATH, plus a valid session context from startup. If the compiler is missing, restore it (or point LOCI at it) and re-run.<br>

**On-demand skills didn't respond**:

* Type `/loci:help` to confirm LOCI is loaded is loaded and see the full skill list.
* Restart Claude Code from inside your project directory if the build environment wasn't detected at session start.
* Check that a cross-compiler is installed and on your PATH (see the table above).

**Nothing seems to work**:

Run `/loci:bug-report` to generate a full diagnostic report.

***

### LOCI Portal

Every analysis run from Claude Code is logged and visualized automatically at the LOCI Portal (app.auroralabs.com), no extra configuration needed. The Portal is where you view session history, binary analysis results, PR review status, and team/quota settings.

***

### Account Plans

LOCI is available on a free tier with limited daily interactions. Paid tiers raise or remove that limit and unlock additional capabilities...&#x20;

For current plans and pricing, see [auroralabs.com/pricing](https://www.auroralabs.com/pricing).

***

### Support

* Email: <loci@auroralabs.com>
* Plugin issues: [github.com/auroralabs-loci/loci-claude/issues](https://github.com/auroralabs-loci/loci-claude/issues)

***

### Reference

* Quick Start (web): `auroralabs.com/product#quick-start`
* Talk to us: `auroralabs.com/contact`
