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

# Autonomous Local Agents

> Run your OpenClaw/Hermes agent and ByteRover memory system entirely on local models using LM Studio - no cloud API keys required.

This guide walks through running both OpenClaw and ByteRover CLI on local LLMs using [LM Studio](https://lmstudio.ai/).

## Tested Configuration

| Component     | Version / Details    |
| ------------- | -------------------- |
| Machine       | Mac M4 Pro, RAM 24GB |
| LM Studio     | 0.4.9                |
| OpenClaw      | 2026.4.12            |
| ByteRover CLI | 3.3.0                |

<Note>
  This is an experimental setup. ByteRover and autonomous agents can run with OpenClaw on a Apple RAM 24GB machine, but for production usage we recommend at least an **Apple M4 with RAM 48GB**.
</Note>

## Step 1 — Download the Models

Search for and download both GGUF files directly from LM Studio's **Discover** tab.

<Steps>
  <Step title="Download Gemma 4 E4B for OpenClaw">
    Search for `unsloth/gemma-4-E4B-it-GGUF` and download `gemma-4-E4B-it-UD-Q4_K_XL.gguf`.

    <img src="https://mintcdn.com/demo-a750c123/bc8pszFoXUYU3psb/images/cookbook/autonomous-local-model/cookbook-gemma4-download.png?fit=max&auto=format&n=bc8pszFoXUYU3psb&q=85&s=d2024ebea6746538f5b5f0c9dfc32802" alt="Download Gemma 4 E4B in LM Studio" style={{ borderRadius: '12px', width: '100%' }} width="1684" height="887" data-path="images/cookbook/autonomous-local-model/cookbook-gemma4-download.png" />
  </Step>

  <Step title="Download Qwen3.5-9B for ByteRover">
    Search for `unsloth/Qwen3.5-9B-GGUF` and download `Qwen3.5-9B-Q4_K_S.gguf`.

    <img src="https://mintcdn.com/demo-a750c123/bc8pszFoXUYU3psb/images/cookbook/autonomous-local-model/cookbook-qwen3-5download.png?fit=max&auto=format&n=bc8pszFoXUYU3psb&q=85&s=7021e27a5b85fa0cbe6f82e1dc300181" alt="Download Qwen3.5-9B in LM Studio" style={{ borderRadius: '12px', width: '100%' }} width="1690" height="889" data-path="images/cookbook/autonomous-local-model/cookbook-qwen3-5download.png" />
  </Step>
</Steps>

<Note>
  On a 24 GB machine, both models fit in memory simultaneously. Gemma 4 E4B at Q4 uses \~8.7 GB and Qwen3.5-9B at Q4 uses \~10.5 GB.
</Note>

## Step 2 — Load Both Models in LM Studio

LM Studio serves all loaded models from a single endpoint at `http://localhost:1234/v1`. Load both models before starting the server.

<Steps>
  <Step title="Open My Models">
    Go to the **Models** tab. You should see both downloaded models listed.

    <img src="https://mintcdn.com/demo-a750c123/bc8pszFoXUYU3psb/images/cookbook/autonomous-local-model/cookbook-model-load-screen.png?fit=max&auto=format&n=bc8pszFoXUYU3psb&q=85&s=733b98a1776fc7d5acd555d940b95675" alt="LM Studio My Models screen" style={{ borderRadius: '12px', width: '100%' }} width="1679" height="891" data-path="images/cookbook/autonomous-local-model/cookbook-model-load-screen.png" />
  </Step>

  <Step title="Load Gemma 4 E4B">
    Click on `gemma-4-E4B-it-UD-Q4_K_XL.gguf` and click **Load**. Note the **API Identifier** — LM Studio assigns it `google/gemma-4-e4b`. This is the model ID you will use in OpenClaw's config.

    <img src="https://mintcdn.com/demo-a750c123/bc8pszFoXUYU3psb/images/cookbook/autonomous-local-model/cookbook-gemma4-load-configuration.png?fit=max&auto=format&n=bc8pszFoXUYU3psb&q=85&s=b9f2aac497c09fe2c1e895d9a720e882" alt="Gemma 4 E4B load configuration" style={{ borderRadius: '12px', width: '100%' }} width="754" height="714" data-path="images/cookbook/autonomous-local-model/cookbook-gemma4-load-configuration.png" />
  </Step>

  <Step title="Load Qwen3.5-9B">
    Click on `Qwen3.5-9B-Q4_K_S.gguf.gguf` and click **Load**. The API Identifier will be `qwen3.5-9b`.

    <img src="https://mintcdn.com/demo-a750c123/baUUr4s6Ni36xH9M/images/cookbook/autonomous-local-model/cookbook-qwen3-load-configuration.png?fit=max&auto=format&n=baUUr4s6Ni36xH9M&q=85&s=d5ba8b3ce8b6ac4aed2fa62175c2934e" alt="Qwen3.5-9B load configuration" style={{ borderRadius: '12px', width: '100%' }} width="1498" height="1422" data-path="images/cookbook/autonomous-local-model/cookbook-qwen3-load-configuration.png" />
  </Step>

  <Step title="Verify both models are ready">
    Open the **Developer** tab. Both models should show **READY** status, reachable at `http://127.0.0.1:1234`.

    <img src="https://mintcdn.com/demo-a750c123/bc8pszFoXUYU3psb/images/cookbook/autonomous-local-model/cookbook-local-model-load-success.png?fit=max&auto=format&n=bc8pszFoXUYU3psb&q=85&s=2e61984221889207f522f3aa2315304a" alt="Both models loaded and ready in LM Studio Developer tab" style={{ borderRadius: '12px', width: '100%' }} width="1689" height="888" data-path="images/cookbook/autonomous-local-model/cookbook-local-model-load-success.png" />

    Confirm with:

    ```bash theme={null}
    curl http://localhost:1234/v1/models
    ```

    The response should list both `google/gemma-4-e4b` and `qwen3.5-9b`.
  </Step>
</Steps>

## Step 3 — Configure Your Agent

Both OpenClaw and Hermes use the same local provider setup. Pick the agent you are using.

<Tabs>
  <Tab title="OpenClaw">
    Run the OpenClaw onboard wizard:

    ```bash theme={null}
    openclaw onboard
    ```

    <Steps>
      <Step title="Select Custom Provider">
        When prompted for **Model/auth provider**, scroll down and select **Custom Provider**.

        <img src="https://mintcdn.com/demo-a750c123/bc8pszFoXUYU3psb/images/cookbook/autonomous-local-model/cookbook-openclaw-local-model-select-local-LLM-provider.png?fit=max&auto=format&n=bc8pszFoXUYU3psb&q=85&s=89fbfd3f21980b8410f6d080c8cbf690" alt="Select Custom Provider in OpenClaw onboard wizard" style={{ borderRadius: '12px', width: '100%' }} width="2368" height="1098" data-path="images/cookbook/autonomous-local-model/cookbook-openclaw-local-model-select-local-LLM-provider.png" />
      </Step>

      <Step title="Enter the endpoint details">
        Fill in the following when prompted:

        | Field                  | Value                      |
        | ---------------------- | -------------------------- |
        | API Base URL           | `http://localhost:1234/v1` |
        | API Key                | *(leave blank)*            |
        | Endpoint compatibility | `OpenAI-compatible`        |
        | Model ID               | `google/gemma-4-e4b`       |
        | Model alias            | `google-gemma-4-e4b`       |

        The wizard verifies the endpoint and reports **Verification successful**.

        <img src="https://mintcdn.com/demo-a750c123/bc8pszFoXUYU3psb/images/cookbook/autonomous-local-model/cookbook-openclaw-local-model-setup.png?fit=max&auto=format&n=bc8pszFoXUYU3psb&q=85&s=f7217facb380d683d2ed64aa4bc626e0" alt="OpenClaw Custom Provider setup and verification" style={{ borderRadius: '12px', width: '100%' }} width="2372" height="1098" data-path="images/cookbook/autonomous-local-model/cookbook-openclaw-local-model-setup.png" />
      </Step>

      <Step title="Start OpenClaw and verify">
        Launch OpenClaw. It will use `google/gemma-4-e4b` served by LM Studio at `localhost:1234`.

        <img src="https://mintcdn.com/demo-a750c123/bc8pszFoXUYU3psb/images/cookbook/autonomous-local-model/cookbook-openclaw-local-model-sample-usage.png?fit=max&auto=format&n=bc8pszFoXUYU3psb&q=85&s=9620b40bb51354bf19fccaee64e9e16a" alt="OpenClaw running with local Gemma model" style={{ borderRadius: '12px', width: '100%' }} width="3008" height="1776" data-path="images/cookbook/autonomous-local-model/cookbook-openclaw-local-model-sample-usage.png" />
      </Step>
    </Steps>

    <Warning>
      **Context limit** — OpenClaw works normally 50,000 tokens and above. To update this, edit `openclaw.json` manually, then run `openclaw gateway restart` to apply changes.

      <img src="https://mintcdn.com/demo-a750c123/bc8pszFoXUYU3psb/images/cookbook/autonomous-local-model/cookbook-openlcaw-local-model-context-limit-excedded-issue.png?fit=max&auto=format&n=bc8pszFoXUYU3psb&q=85&s=b251ab4a647d9d93bcf764adae82c788" alt="Context limit exceeded warning in OpenClaw" style={{ borderRadius: '12px', width: '100%' }} width="2366" height="1088" data-path="images/cookbook/autonomous-local-model/cookbook-openlcaw-local-model-context-limit-excedded-issue.png" />
    </Warning>

    <Accordion title="Resulting openclaw.json config">
      The wizard writes the following into `~/.openclaw/openclaw.json`. You can also add this manually:

      ```json theme={null}
      {
        "models": {
          "mode": "merge",
          "providers": {
            "custom-localhost-1234": {
              "baseUrl": "http://localhost:1234/v1",
              "api": "openai-completions",
              "models": [
                {
                  "id": "google/gemma-4-e4b",
                  "name": "gemma-4-E4B-it (Local)",
                  "contextWindow": 50000,
                  "maxTokens": 50000,
                  "input": ["text"],
                  "cost": { "input": 0, "output": 0, "cacheRead": 0, "cacheWrite": 0 },
                  "reasoning": false
                }
              ]
            }
          }
        },
        "agents": {
          "defaults": {
            "model": {
              "primary": "custom-localhost-1234/google/gemma-4-e4b"
            },
            "models": {
              "custom-localhost-1234/google/gemma-4-e4b": {
                "alias": "google-gemma-4-e4b"
              }
            }
          }
        }
      }
      ```
    </Accordion>
  </Tab>

  <Tab title="Hermes">
    Run the Hermes model setup wizard:

    ```bash theme={null}
    hermes setup model
    ```

    <Steps>
      <Step title="Select Custom Provider">
        When prompted for the model provider, scroll down and select **Custom Provider (any OpenAI or Anthropic compatible endpoint)**.

        <img src="https://mintcdn.com/demo-a750c123/bc8pszFoXUYU3psb/images/cookbook/autonomous-local-model/cookbook-hermes-local-model-select-custome-provider.png?fit=max&auto=format&n=bc8pszFoXUYU3psb&q=85&s=f0828d8405d1577866ccd103a08c194d" alt="Select Custom Provider in Hermes setup wizard" style={{ borderRadius: '12px', width: '100%' }} width="1232" height="557" data-path="images/cookbook/autonomous-local-model/cookbook-hermes-local-model-select-custome-provider.png" />
      </Step>

      <Step title="Enter the endpoint details">
        Fill in the following when prompted:

        | Field                  | Value                      |
        | ---------------------- | -------------------------- |
        | API Base URL           | `http://localhost:1234/v1` |
        | API Key                | *(leave blank)*            |
        | Endpoint compatibility | `OpenAI-compatible`        |
        | Model ID               | `google/gemma-4-e4b`       |

        <img src="https://mintcdn.com/demo-a750c123/bc8pszFoXUYU3psb/images/cookbook/autonomous-local-model/cookbook-hermes-local-model-select-local-LLM-provider.png?fit=max&auto=format&n=bc8pszFoXUYU3psb&q=85&s=2af8729c9239077b1c3685a8dde60c60" alt="Hermes local LLM provider configuration" style={{ borderRadius: '12px', width: '100%' }} width="1234" height="558" data-path="images/cookbook/autonomous-local-model/cookbook-hermes-local-model-select-local-LLM-provider.png" />

        The wizard confirms the endpoint and model are configured.

        <img src="https://mintcdn.com/demo-a750c123/bc8pszFoXUYU3psb/images/cookbook/autonomous-local-model/cookbook-hermes-local-model-setup.png?fit=max&auto=format&n=bc8pszFoXUYU3psb&q=85&s=0e0300668a28b2ef3511777c8ded272e" alt="Hermes local model setup complete" style={{ borderRadius: '12px', width: '100%' }} width="1237" height="557" data-path="images/cookbook/autonomous-local-model/cookbook-hermes-local-model-setup.png" />
      </Step>

      <Step title="Configure context length">
        Hermes will prompt you to set the context length. Set it to match the model's context window (`65000` tokens for Gemma 4 E4B because hermes agent required minimum 64000 tokens).

        <img src="https://mintcdn.com/demo-a750c123/bc8pszFoXUYU3psb/images/cookbook/autonomous-local-model/cookbook-hermes-local-model-context-length.png?fit=max&auto=format&n=bc8pszFoXUYU3psb&q=85&s=efb2549443b25d42e0a9ac0c9178c83c" alt="Hermes context length configuration" style={{ borderRadius: '12px', width: '100%' }} width="1239" height="557" data-path="images/cookbook/autonomous-local-model/cookbook-hermes-local-model-context-length.png" />
      </Step>

      <Step title="Start Hermes and verify">
        Launch Hermes. It will use `google/gemma-4-e4b` served by LM Studio at `localhost:1234`.

        <img src="https://mintcdn.com/demo-a750c123/bc8pszFoXUYU3psb/images/cookbook/autonomous-local-model/cookbook-hermes-local-model-sample-usage.png?fit=max&auto=format&n=bc8pszFoXUYU3psb&q=85&s=55257ad5e2abcc08511de7bbcfb8ecfa" alt="Hermes running with local Gemma model" style={{ borderRadius: '12px', width: '100%' }} width="1240" height="556" data-path="images/cookbook/autonomous-local-model/cookbook-hermes-local-model-sample-usage.png" />
      </Step>
    </Steps>
  </Tab>
</Tabs>

## Step 4 — Configure ByteRover CLI

Connect ByteRover to the same local endpoint and select the Qwen model.

<Tabs>
  <Tab title="TUI">
    <Steps>
      <Step title="Open the providers command">
        In the ByteRover TUI, type `/providers` and press Enter.

        <img src="https://mintcdn.com/demo-a750c123/bc8pszFoXUYU3psb/images/cookbook/autonomous-local-model/cookbook-byterover-setup-local-model-providers-command-sample.png?fit=max&auto=format&n=bc8pszFoXUYU3psb&q=85&s=aefb2c1b28813a5046ef6085838f7685" alt="ByteRover TUI /providers command" style={{ borderRadius: '12px', width: '100%' }} width="2394" height="1182" data-path="images/cookbook/autonomous-local-model/cookbook-byterover-setup-local-model-providers-command-sample.png" />
      </Step>

      <Step title="Select OpenAI Compatible">
        Scroll to **OpenAI Compatible** and press Enter. This covers LM Studio, Ollama, and any other OpenAI-compatible local server.

        <img src="https://mintcdn.com/demo-a750c123/bc8pszFoXUYU3psb/images/cookbook/autonomous-local-model/cookbook-byterover-setup-local-model-select-local-LLM-provider.png?fit=max&auto=format&n=bc8pszFoXUYU3psb&q=85&s=d625ca357586426c9549361cfcdf665f" alt="Select OpenAI Compatible provider" style={{ borderRadius: '12px', width: '100%' }} width="2404" height="1172" data-path="images/cookbook/autonomous-local-model/cookbook-byterover-setup-local-model-select-local-LLM-provider.png" />
      </Step>

      <Step title="Enter the base URL">
        When prompted, enter `http://localhost:1234/v1` and press Enter. Leave the API key blank.

        <img src="https://mintcdn.com/demo-a750c123/bc8pszFoXUYU3psb/images/cookbook/autonomous-local-model/cookbook-byterover-setup-local-model-register-local-model-endpoint.png?fit=max&auto=format&n=bc8pszFoXUYU3psb&q=85&s=c7e0c0cde26b9dbc0ee42b8a2156ce38" alt="Enter LM Studio base URL" style={{ borderRadius: '12px', width: '100%' }} width="2400" height="1174" data-path="images/cookbook/autonomous-local-model/cookbook-byterover-setup-local-model-register-local-model-endpoint.png" />
      </Step>

      <Step title="Select the Qwen model">
        From the model list, select `qwen3.5-9b` (128K ctx).

        <img src="https://mintcdn.com/demo-a750c123/bc8pszFoXUYU3psb/images/cookbook/autonomous-local-model/cookbook-byterover-setup-local-model-selecting-model.png?fit=max&auto=format&n=bc8pszFoXUYU3psb&q=85&s=63968e677ef5efd673d0bcc257e69546" alt="Select qwen3.5-9b model" style={{ borderRadius: '12px', width: '100%' }} width="2384" height="1172" data-path="images/cookbook/autonomous-local-model/cookbook-byterover-setup-local-model-selecting-model.png" />
      </Step>
    </Steps>
  </Tab>

  <Tab title="CLI">
    <Steps>
      <Step title="Connect the local provider">
        ```bash theme={null}
        brv providers connect openai-compatible --base-url http://localhost:1234/v1
        ```
      </Step>

      <Step title="Switch to the Qwen model">
        ```bash theme={null}
        brv model switch qwen3.5-9b
        ```
      </Step>
    </Steps>
  </Tab>
</Tabs>

## Step 5 — Verify ByteRover Is Working

Run a quick curate command to confirm ByteRover is using the local Qwen model.

<Steps>
  <Step title="Run a curate command">
    ```
    /curate "caching algorithm list: lru, lfu, fifo"
    ```

    <img src="https://mintcdn.com/demo-a750c123/bc8pszFoXUYU3psb/images/cookbook/autonomous-local-model/cookbook-byterover-sample-curate-command-sample.png?fit=max&auto=format&n=bc8pszFoXUYU3psb&q=85&s=28f648c5f50ebed41acf0cf44062a9ad" alt="ByteRover curate command sample" style={{ borderRadius: '12px', width: '100%' }} width="2386" height="1174" data-path="images/cookbook/autonomous-local-model/cookbook-byterover-sample-curate-command-sample.png" />
  </Step>

  <Step title="Confirm it processes with the local model">
    ByteRover sends the request to Qwen3.5-9B on LM Studio. You can watch the LM Studio Developer tab update in real time.

    <img src="https://mintcdn.com/demo-a750c123/bc8pszFoXUYU3psb/images/cookbook/autonomous-local-model/cookbook-byterover-curate-is-working.png?fit=max&auto=format&n=bc8pszFoXUYU3psb&q=85&s=9e0d3a568990f216a4df31a51b9935d9" alt="ByteRover curate working with Qwen local model" style={{ borderRadius: '12px', width: '100%' }} width="3020" height="1784" data-path="images/cookbook/autonomous-local-model/cookbook-byterover-curate-is-working.png" />
  </Step>

  <Step title="Review the results">
    ByteRover returns structured knowledge extracted from the curate request.

    <img src="https://mintcdn.com/demo-a750c123/bc8pszFoXUYU3psb/images/cookbook/autonomous-local-model/cookbook-byterover-result-sample.png?fit=max&auto=format&n=bc8pszFoXUYU3psb&q=85&s=2dc75734df338cde6986600e5a45f1ed" alt="ByteRover curate result in terminal" style={{ borderRadius: '12px', width: '100%' }} width="1130" height="877" data-path="images/cookbook/autonomous-local-model/cookbook-byterover-result-sample.png" />

    The context tree is updated with new memory files you can inspect directly.

    <img src="https://mintcdn.com/demo-a750c123/bc8pszFoXUYU3psb/images/cookbook/autonomous-local-model/cookbook-byterover-result-sample-2.png?fit=max&auto=format&n=bc8pszFoXUYU3psb&q=85&s=12c9b1a4a31002e5e0b53b8246d99d8c" alt="ByteRover memory file created in VS Code" style={{ borderRadius: '12px', width: '100%' }} width="957" height="796" data-path="images/cookbook/autonomous-local-model/cookbook-byterover-result-sample-2.png" />

    <img src="https://mintcdn.com/demo-a750c123/bc8pszFoXUYU3psb/images/cookbook/autonomous-local-model/cookbook-byterover-vc-commands-checking-new-memory-file.png?fit=max&auto=format&n=bc8pszFoXUYU3psb&q=85&s=214b1e0ba6b9598f54eed0037e901e1c" alt="Checking new memory file via ByteRover commands" style={{ borderRadius: '12px', width: '100%' }} width="2996" height="1784" data-path="images/cookbook/autonomous-local-model/cookbook-byterover-vc-commands-checking-new-memory-file.png" />
  </Step>
</Steps>

## Step 6 — Enable ByteRover Memory Integration

Connect your agent to ByteRover for persistent memory across sessions.

<CardGroup cols={2}>
  <Card title="OpenClaw Integration" icon="book" href="/autonomous-agents/openclaw">
    Configure ByteRover as the context engine for OpenClaw
  </Card>

  <Card title="Hermes Integration" icon="book" href="/autonomous-agents/hermes">
    Configure ByteRover as the memory provider for Hermes
  </Card>
</CardGroup>

## Reference

<CardGroup cols={2}>
  <Card title="LLM Providers" icon="cpu" href="/external-llm-providers/overview">
    Connect an external provider or use the built-in LLM
  </Card>

  <Card title="Onboard Context" icon="lightbulb" href="/common-workflows/onboard-context">
    Learn how to seed your context tree with existing knowledge
  </Card>
</CardGroup>

<CardGroup cols={2}>
  <Card title="Reference" icon="book" href="/autonomous-agents/openclaw-reference">
    Configuration details, troubleshooting, and advanced topics
  </Card>

  <Card title="Local & Cloud" icon="book" href="/local-vs-cloud">
    Exploring local & cloud options
  </Card>
</CardGroup>
