How to Configure Alternative Model Providers Like Ollama for Local Egonex AI Analysis

You can configure Egonex AI to use local models like Ollama by setting the OLLAMA_HOST environment variable and updating the .understand-anything/config.json file with your provider details, enabling fully offline code analysis.

The Understand-Anything plugin from Egonex AI separates static code analysis from semantic enrichment, allowing you to swap the default cloud LLM provider for any local endpoint that speaks an OpenAI-compatible API. By pointing the analyzer at a local Ollama instance, you maintain complete data residency while retaining the tool’s graph-driven insights. This configuration requires editing a JSON config file and optionally setting environment variables before running the standard /understand command.

Install and Prepare Ollama

Before configuring the plugin, ensure your local model server is running and accessible.

  1. Start the Ollama server on the default port:

    ollama serve

    This exposes the API at http://localhost:11434.

  2. Pull your desired model (for example, Llama 2):

    ollama pull llama2
    ollama run llama2

    Running the model once warms up the cache and confirms the installation works.

Configure the Local Model Endpoint

The plugin discovers your local model through either environment variables or the project configuration file located at .understand-anything/config.json.

Method 1: Environment Variable

Set OLLAMA_HOST to point to your local server endpoint. This is useful for temporary switches or CI/CD pipelines.

export OLLAMA_HOST=http://127.0.0.1:11434

Add this to your shell profile (.bashrc, .zshrc, or .env file) to make it persistent across sessions.

Method 2: Project Configuration File

Create or modify .understand-anything/config.json in your project root to permanently bind this repository to the local provider:

{
  "modelProvider": "ollama",
  "model": "llama2",
  "baseUrl": "http://127.0.0.1:11434"
}

The plugin reads these three fields at startup. The baseUrl parameter is appended to the HTTP request payload in packages/core/src/analyzer/llm-analyzer.ts, which constructs the actual API calls to your local server.

Run the Analysis

With the configuration in place, execute the standard analysis command:

/understand

The first scan initiates a full repository analysis and may take several minutes as the local model generates completions for semantic enrichment. Subsequent runs are incremental, re-analyzing only changed files for faster feedback.

Verify the Configuration

After the initial run, check the status indicator in your dashboard or IDE. The interface should display "Local model (Ollama)" in the status bar, confirming that requests are routing to your local endpoint rather than the default cloud provider. The .understand-anything/config.json file will also persist the provider settings for future sessions.

How the Integration Works

The architecture separates static analysis (handled by Tree-Sitter parsers) from semantic enrichment (handled by LLM calls). When you trigger /understand, the core analyzer (llm-analyzer.ts) reads the baseUrl from your config and dispatches HTTP requests to that endpoint using standard OpenAI-compatible formatting. This modular design means you can replace the cloud backend with any local server—Ollama, LM Studio, or custom implementations—without modifying the static parsing logic or graph generation code.

Summary

  • Install Ollama and start the server with ollama serve to expose a local API at port 11434.
  • Configure the endpoint by setting OLLAMA_HOST or editing .understand-anything/config.json with modelProvider, model, and baseUrl fields.
  • Run analysis using the standard /understand command; initial scans are slower, but subsequent runs are incremental.
  • Verify locally by checking for "Local model (Ollama)" in the status bar, confirming data residency and custom provider usage.

Frequently Asked Questions

What file does Egonex AI read to determine which model provider to use?

The plugin reads .understand-anything/config.json from your project root. This JSON file contains the modelProvider, model, and baseUrl keys that tell the analyzer in packages/core/src/analyzer/llm-analyzer.ts where to send LLM requests. If this file is missing, the plugin falls back to the provider injected by the host platform (Claude Code, Codex, etc.).

Can I use other local LLM servers besides Ollama?

Yes. Any server implementing an OpenAI-compatible API works, including LM Studio, LocalAI, or custom Python servers. Simply set the baseUrl in your config to the appropriate local address (e.g., http://localhost:1234) and ensure the modelProvider value matches your setup. The HTTP request construction in llm-analyzer.ts uses standard OpenAI formatting, making it compatible with most local LLM wrappers.

Why is the first analysis run slower when using a local model?

The initial /understand command performs a full semantic scan of the entire codebase, generating embeddings and completions for every significant code block. Local models on consumer hardware generate tokens slower than cloud APIs, causing the first run to take several minutes. Subsequent runs are incremental, analyzing only changed files, which significantly reduces latency after the initial cache is built.

Do I need to keep Ollama running in the background continuously?

Yes. The ollama serve process must remain active to accept HTTP requests from the Egonex plugin. If the server stops, the analyzer will fail to connect to http://127.0.0.1:11434 and will revert to error states or fallback providers depending on your host environment. You can daemonize the process or use systemd services on Linux to keep it running persistently.

Have a question about this repo?

These articles cover the highlights, but your codebase questions are specific. Give your agent direct access to the source. Share this with your agent to get started:

Share the following with your agent to get started:
curl -s "https://instagit.com/install.md"

Works with
Claude Codex Cursor VS Code OpenClaw Any MCP Client

Maintain an open-source project? Get it listed too →