Skip to content
LHCWNPublic

About

Local companion for OpenClaw: shows the model only the skills and MCP tools each prompt needs, recommends assets from your library, and routes work between local and external models.

Resources

Code of conduct

Contributing

Stars

3 stars

Watchers

0 watching

Forks

Repository files navigation

RelayMind

Show your OpenClaw agent only the skills and tools each prompt needs.

An agent with hundreds of skills and MCP tools puts every description into every prompt. That costs context on each turn and makes the right skill harder to find. RelayMind runs next to OpenClaw on your machine. Before each prompt it picks the few skills and tools that fit and names them to the model. OpenClaw keeps ownership of sessions, tool execution, permissions and approvals.

OpenClaw is the host RelayMind is built for, tested with and ships plugins for, and this page follows that path. The gateway itself is plain HTTP on loopback, so another agent host or any OpenAI-compatible client can use the same selection and the same model gateway: see Use it without OpenClaw.

RelayMind architecture: OpenClaw, the RelayMind gateway, a selector and optional models on one machine

What it does for OpenClaw

Part What you get Guide
Per-prompt guidance The model sees the skills and tools this prompt needs instead of the full list. It works across English and Chinese, and can refuse what was not selected if you ask for that. Guidance tutorial · 简体中文
Recommendations Search your skill and MCP tool library, compare candidates and choose. A recommendation never installs or runs anything. Recommendation setup · 简体中文
Model gateway An OpenAI-compatible endpoint that uses a local model when it is suitable and an external model when needed. OpenClaw provider setup · Gateway quickstart

Turn on only the parts you want. Most setups start with guidance alone, and that is what the steps below install.

How one prompt flows

  1. You write a prompt in OpenClaw. The guidance plugin sends the prompt and the list of skills and tools that OpenClaw would offer to the gateway on 127.0.0.1.
  2. The gateway asks a selector which few fit. The built-in selector is plain word match. A better one, such as magpie-picker, plugs in over HTTP.
  3. The gateway checks the answer: it passes on only assets that OpenClaw offered for this prompt.
  4. The plugin adds one labeled hint to the prompt. The model loads what it needs with OpenClaw's own tools.
  5. If anything fails or is slow, the turn goes on without a hint. Nothing is blocked.

Install

You need Python 3.12 or newer, git, and OpenClaw 2026.10.5 or newer (see Supported OpenClaw releases). RelayMind is tested on macOS (Apple Silicon) and Windows (x86-64), with no WSL or Docker; on Linux it runs and is used for functional checks. This setup downloads no model and needs no API key.

1. Install RelayMind and start the gateway.

git clone https://github.com/LHCWN/relaymind.git
cd relaymind
python3 -m venv .venv
source .venv/bin/activate
pip install -e .
cp relaymind.openclaw.example.toml relaymind.toml
relaymind serve --config relaymind.toml

On Windows PowerShell, use python -m venv .venv, .\.venv\Scripts\Activate.ps1 and Copy-Item relaymind.openclaw.example.toml relaymind.toml.

The gateway prints its address and a token. Leave it running:

Serving on http://127.0.0.1:8080
Application token: <token>

2. Connect OpenClaw. In a second terminal, in the same folder:

source .venv/bin/activate
relaymind openclaw guidance

This one command uses OpenClaw's own commands to install the guidance plugin, check that it loaded, and stop listing every skill in the prompt. Add --tools-file ~/.relaymind/tools.json to offer your MCP tools too.

3. Give OpenClaw the token. The guidance plugin reads it from RELAYMIND_APP_TOKEN: set that variable to the printed token in the environment that starts OpenClaw, and restart OpenClaw. The gateway makes a new token at every start, so repeat this step after you restart the gateway.

4. Check it. Ask something in OpenClaw: the request sent to the model now starts with [RelayMind guidance, not from the user] and names a few skills. Or ask the gateway yourself, with the token in RELAYMIND_APP_TOKEN in that shell:

curl -sS http://127.0.0.1:8080/relay/v1/guidance \
  -H "Authorization: Bearer $RELAYMIND_APP_TOKEN" -H 'Content-Type: application/json' \
  -d '{"schema_version":1,"task_text":"merge two pdf files",
       "assets":[{"name":"pdf-merge","kind":"skill","description":"Merge pdf documents"}]}'

The answer names pdf-merge with "chosen_by":"word_match".

To undo the setup, give the model its skill list back with openclaw config unset skills.limits.maxSkillsInPrompt. Do the same if the gateway will be stopped for long, because without it the model sees no skill list and no hint. The guidance tutorial has every option, including the strict limit.

Better selection with magpie-picker

The steps above give you word match: fast, with nothing to install, but it only finds a skill whose description shares words with the prompt. It cannot connect a Chinese prompt to an English skill, and it cannot tell similar skills apart. On the similar-skill holdout it put the right skill first for 49% of the English one-skill prompts and 7% of the Chinese ones (record of 2026-11-23).

magpie-picker is a selector built for RelayMind that fixes this without sending anything out of the machine:

  • Local and private. One small embedding model on your CPU. No API key, and no prompt leaves the machine.
  • Works across languages and similar skills. It compares meaning, not words.
  • Learns your own skills. After each turn RelayMind tells it which skills and tools the turn used, and it finds them for the next request worded like it.
  • Fast. About 0.2 to 0.3 s a request on RelayMind's benchmark requests. On its larger assets-match benchmark it took 0.64 s at the median, where a hosted chat model asked to choose took 7.3 s.

Its own measurements on the same similar-skill holdout: macro precision 83% and macro recall 78%, with no pick on unrelated requests. A hosted chat-model picker reached 70% and 96% there: it finds more, and magpie-picker is more precise and stays on the machine (magpie-picker results, read on 29 November 2026). It needs about 460 MB of disk, 1.2 to 1.8 GB of RAM depending on the system, and no GPU.

To add it, with uv installed:

git clone https://github.com/LHCWN/magpie-picker.git
cd magpie-picker
uv sync
uv run magpie-picker up

The first start downloads about 400 MB and then prints a [guidance] table. Paste it into relaymind.toml in place of the [guidance] table that is there, and restart the gateway. The gateway sends your skills and tools to magpie-picker with the first prompt, and it indexes them in the background, about half a minute per 100.

Choose what fits your machine:

Selector Needs Choose it when
Word match (the default) Nothing Prompts and skills are in one language and the skills differ clearly
magpie-picker About 460 MB of disk and up to 1.8 GB of RAM You have many or similar skills, or prompts in another language, and nothing may leave the machine
Keywords from a local model llama.cpp and a 0.6 GB model You want cross-language matching inside the gateway, with no second service
A cheap external model as picker An API key An external model is acceptable and you want the best choice among similar skills
Your own selector A local HTTP service You have your own algorithm: see Connect your own algorithm

Supported OpenClaw releases

Check yours with openclaw --version. RelayMind is built and tested on OpenClaw 2026.10.7. On another release in the range, the setup command says once that the release is unqualified and goes on. Outside the range it changes nothing in OpenClaw and says why.

Part Sets up on Range declared to OpenClaw
Per-prompt guidance 2026.10.5 to the end of 2026 >=2026.10.5 <2027.0.0-0
Model provider and recommendation panel 2026.10.7 to the end of 2026 >=2026.10.7 <2027.0.0-0

Guidance cannot start before 2026.10.5, because the host lacks what the plugin is built on:

OpenClaw What is missing
2026.10.1 to 2026.10.4 The session's skill list names no file for a skill (source.filePath), so the plugin cannot read any description. It would load and offer nothing, with no error. Plugin hooks also do not run under openclaw agent exec.
2026.8.35 to 2026.9.37 The host has no skills_read and no skills_search, which the hint and the strict limit use.
2026.2.26 to 2026.7.35 The host turn failed in our check before any model request.

Setting guidance up there would leave the model with no skill list and no hint, so the command refuses. Upgrade OpenClaw instead: on 29 November 2026, extended-stable (2026.10.34) and latest (2026.11.12) are both in the range. A 2027 release is refused until it has been checked.

With a model double on Linux, the hint and the strict limit worked on 2026.10.5, 2026.10.6, 2026.10.7, 2026.10.34 and 2026.11.12. That is a functional check, not a qualification; the record has the script and the limits.

Use it without OpenClaw

Nothing in the gateway depends on OpenClaw. Only the two plugins and the relaymind openclaw ... commands do. Start the gateway as in Install, step 1, and call it with the printed token as a bearer token:

You have Call You get
Your own agent or host with many skills and tools POST /relay/v1/guidance before each prompt The few assets that fit this prompt
Any OpenAI-compatible client or SDK http://127.0.0.1:8080/v1 as the base URL, model relaymind Chat completions routed to a local or an external model. This needs a real model in the launch file: gateway quickstart
A library of skills and MCP tools to search POST /relay/v1/recommendations Ranked candidates to compare and choose: recommendation setup

Guidance from your own host takes one request per prompt. Send the prompt and the list of skills and tools your agent could use:

{
  "schema_version": 1,
  "task_text": "merge two pdf files and send them by email",
  "assets": [
    {"name": "pdf-merge", "kind": "skill", "description": "Merge pdf documents into one file"},
    {"name": "mail__send_email", "kind": "mcp_tool", "description": "Send an email with attachments"},
    {"name": "weather-report", "kind": "skill", "description": "Forecast for a city"}
  ]
}

The answer names the ones that fit, here two of the three:

{
  "schema_version": 1,
  "decision": "picks",
  "picks": [
    {"name": "pdf-merge", "kind": "skill", "summary": "Merge pdf documents into one file"},
    {"name": "mail__send_email", "kind": "mcp_tool", "summary": "Send an email with attachments"}
  ],
  "chosen_by": "word_match",
  "mechanism": "word_match",
  "degraded": false,
  "offered": 3,
  "shortlist": 2,
  "stages": [{"stage": "word_match", "outcome": "ok", "ms": 3.7, "usage": null}]
}

Then your host does what the OpenClaw plugin does:

  1. Show the model only the picked assets, or name them in a hint and keep the rest loadable.
  2. Treat the answer as a proposal. The gateway returns only names you sent, and your host still decides what may run.
  3. If the call fails or takes too long, go on with your full list. Never block a turn on it.
  4. When the answer carries a recommendation_id, you may report which assets the turn really used to POST /relay/v1/guidance/feedback. A selector that learns, such as magpie-picker, uses it.

The selector choice is the same as with OpenClaw: word match by default, or magpie-picker and other selectors through the [guidance] table.

The request and the answer are published schemas: request, answer. The OpenClaw plugin is one file, index.js, and is a worked example of such a host integration. OpenClaw is the only host this has been run with: with another host you write and test that small piece yourself.

Technology

Layer What it is built with
Gateway Python 3.12+, FastAPI and uvicorn, bound to loopback only; httpx for outbound calls
Contracts JSON Schema for every request, answer and stored event; an OpenAI-compatible Chat Completions subset
State SQLite: versioned run state, trace events, approvals and recommendations
OpenClaw plugins The public OpenClaw plugin SDK: a guidance plugin in JavaScript and a provider plugin in TypeScript
Local model (optional) llama.cpp llama-server with Qwen3-0.6B in GGUF, pinned by hash
External model (optional) Any OpenAI-compatible endpoint; the key stays in an environment variable
Selector (optional) Any local HTTP service that speaks the published selection contract; magpie-picker is one
Quality pytest with model doubles, vitest for the plugins, ruff; CI on Linux, macOS and Windows

Design decisions

  • Local first. The gateway listens only on loopback. A request handled locally makes no external call, and the trace shows it.
  • The selector proposes, the gateway admits. A selector never executes anything or grants a permission. The gateway passes on only what the host offered for this request.
  • OpenClaw stays in charge. Sessions, tools, permissions and approvals belong to OpenClaw. RelayMind adds a hint and, if you ask, a limit.
  • Fail open. A slow or failed gateway, selector or model means no hint, never a blocked turn.
  • Replaceable selection. Selection is one published HTTP contract, so word match, a model, magpie-picker or your own service are interchangeable and are compared with the same metrics.
  • Bounded and recorded. Every time, size and call limit is a named setting, and each run records the values it used.
  • Specification and evidence. Behavior is defined in one specification; tests come before code; measured results are kept apart from examples, and a functional check is never called a qualification.

The architecture guide maps these to the code.

Other ways to use it

You want to… Start here
Use RelayMind as the OpenClaw model provider Provider install guide
Use the recommendation panel in OpenClaw Panel guide · 简体中文
Use guidance from another agent host Use it without OpenClaw
Connect any OpenAI-compatible client Gateway quickstart
Add an external model or change a limit Configure
Plug in your own recommendation algorithm Selector v2 guide
Compare selectors on the same catalog Source-backed benchmark

Recommendations and the managed gateway are distinct interfaces: a recommended asset does not become an executable gateway skill. See the interface guide.

Configure

The launch file is TOML and holds no credential. relaymind.openclaw.example.toml is the short starter used above; relaymind.example.toml shows every setting.

  • External model. Fill in the [external_model] table (base URL, model name, context limit) and export the key in the shell that starts the gateway: export RELAYMIND_EXTERNAL_API_KEY="your-provider-key", or in PowerShell $env:RELAYMIND_EXTERNAL_API_KEY = "your-provider-key".
  • Local model. Add a [local_model] table and install the runtime as models/README.md describes.
  • Limits. Time, model generations and tool calls have defaults in the [budgets] table.

The gateway quickstart explains each of these, running without a local model, the loopback HTTP selector for managed runs, and how to call the gateway from an OpenAI client.

Scope and evidence

RelayMind is a single-user prototype with explicit catalog, context and execution limits. Its recorded development benchmarks show the tested catalog sizes, misses and limitations. They do not establish unlimited scale or guarantee better answers, lower cost or lower latency. The numbers on this page are development measurements with their sources linked, not guarantees.

The gateway ships sandbox demo skills and tools. Its Chat Completions endpoint implements the documented OpenAI-compatible subset. Use the roadmap for current implementation and qualification status, and the evidence record for measured results.

Documentation and contributing

Need Source
Required behavior and acceptance criteria Specification
Current implementation and remaining gates Roadmap
Measured results and their limitations Evidence
Code layout and ownership Architecture
Running the gateway by itself Gateway quickstart
Development setup and checks Contributing, contributor rules
Manual and automated verification Testing

Dated release and design records preserve historical context and do not override these sources.

License

MIT. See LICENSE.

About

Local companion for OpenClaw: shows the model only the skills and MCP tools each prompt needs, recommends assets from your library, and routes work between local and external models.

Resources

Code of conduct

Contributing

Stars

3 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages