You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
OpenClaw Router is a core execution-governance component for private AI systems. It classifies prompts by complexity and lets requests flow safely, cost-effectively, and auditably across local models, private models, and public models.
3
+
OpenClaw Router is a core execution-governance component for private AI systems.
4
+
5
+
Its job is simple to describe but hard to do well: let AI requests move across local models, private models, and public models in a way that is safe, cost-aware, and auditable.
6
+
7
+
Most AI products today still route requests in a very rough way:
8
+
- everything goes to the same expensive model
9
+
- local models are underused
10
+
- sensitive work is mixed with non-sensitive work
11
+
- teams cannot clearly explain why a certain model was chosen
12
+
- quality drops when people try to save cost with manual switching
13
+
14
+
OpenClaw Router exists to solve that layer.
15
+
16
+
This repository currently contains one key component in that broader governance stack: a local-first routing plugin for OpenClaw. It is designed for builders, operators, and product teams who want execution control instead of ad hoc prompt-to-model selection.
17
+
18
+
The project is led by an AI-native builder, product-oriented founder, and direction-setting operator. The repository also reflects an active interest in connecting with aligned investors and project partners who want to help build the execution-governance layer for private AI systems.
19
+
20
+
## What This Project Is
21
+
22
+
At a high level, OpenClaw Router acts like a traffic controller for AI execution.
23
+
24
+
When a user sends a request, the router looks at the request, estimates what kind of capability it needs, and decides whether it should stay on a local model, move to a private deployment, or escalate to a stronger public model.
25
+
26
+
The goal is not just lower cost.
27
+
28
+
The goal is better system behavior:
29
+
- easy work should stay cheap
30
+
- sensitive work should stay controlled
31
+
- hard work should still reach strong models
32
+
- every decision should be reviewable later
33
+
34
+
## Why It Matters
35
+
36
+
If you are building a serious AI product, model choice is no longer only an engineering detail. It becomes an execution policy problem.
37
+
38
+
Examples:
39
+
- A short rewrite task should not burn premium API budget.
40
+
- A coding or debugging task should not be forced onto an underpowered local model just because it is cheap.
41
+
- A compliance-sensitive workflow may need to prefer private infrastructure.
42
+
- A repeated failure should trigger escalation instead of silently getting stuck.
43
+
- A team should be able to inspect routing decisions and improve them over time.
44
+
45
+
This is the gap OpenClaw Router is meant to fill.
46
+
47
+
## What The Repository Contains
48
+
49
+
-`router-plugin/`: the main TypeScript plugin that runs inside OpenClaw
50
+
-`docs/`: supporting documentation, examples, roadmap, and API contract
51
+
-`skills/router-rule-tuner/`: a local skill for analyzing router decisions and tuning rules
52
+
-`.github/`: CI and repository workflow templates
53
+
54
+
## What It Does Today
55
+
56
+
- Classifies prompts into execution tiers
57
+
- Keeps simple, low-risk work on low-cost paths when possible
58
+
- Escalates code, debugging, complex analysis, and reasoning work to stronger tiers
59
+
- Supports local-first routing instead of API-first routing
60
+
- Tracks retries and session depth so the system can recover from weak routing
61
+
- Logs decisions for auditability and later optimization
62
+
- Learns from historical routing data to improve future routing
63
+
- Exposes `/router`, `/router stats`, and `/router learn`
64
+
65
+
## How It Works
66
+
67
+
```mermaid
68
+
flowchart TD
69
+
A["User prompt enters OpenClaw"] --> B["Router intercepts at before_model_resolve"]
In practice, this means a casual prompt and a high-stakes coding task do not need to hit the same model.
107
+
108
+
## What Makes It Different
109
+
110
+
This project is not trying to be “just another prompt classifier”.
111
+
112
+
It is building toward an execution-governance layer with a few important properties:
113
+
114
+
- Local-first by design: cheap work stays local when it can.
115
+
- Policy-oriented: routing is driven by explicit rules and thresholds, not hidden provider behavior.
116
+
- Auditable: decisions can be logged, reviewed, and tuned later.
117
+
- Adaptive: the system can learn from real traffic instead of staying static.
118
+
- Safe by default: first install starts in `suggest` mode rather than immediately overriding models.
119
+
120
+
## Who This Is For
121
+
122
+
OpenClaw Router is especially useful for:
123
+
124
+
- teams building private AI systems
125
+
- founders who want cost control without quality collapse
126
+
- operators running a mix of local, private, and external models
127
+
- AI product builders who need clearer execution policies
128
+
- anyone who wants an inspectable routing layer instead of opaque model selection
129
+
130
+
## A Simple Example
131
+
132
+
Imagine the same system receives these three requests:
133
+
134
+
1. “Summarize this paragraph.”
135
+
2. “Compare two product strategies and list risks.”
136
+
3. “Debug this TypeScript function and refactor it.”
137
+
138
+
Without governance, all three might go to the same expensive model.
139
+
140
+
With OpenClaw Router:
141
+
- the summary can stay on a fast local model
142
+
- the strategy comparison can go to a stronger planning tier
143
+
- the coding task can escalate to a code-focused tier
144
+
145
+
That is the core value: better model allocation, lower waste, and clearer system behavior.
4
146
5
-
This repository currently contains one key component in that governance layer: a local-first model routing plugin for OpenClaw. It is designed for teams and builders who want strong execution control instead of ad hoc model switching.
147
+
## Routing Modes
148
+
149
+
OpenClaw Router supports three operating modes:
150
+
151
+
-`suggest`: the safest first-install mode; it recommends a route but does not override the active model
152
+
-`override`: it actively applies routing decisions
153
+
-`respect-explicit`: it routes normally except for agents that already have an explicitly assigned primary model
6
154
7
155
The repository ships in a safe first-install posture: routing defaults to `suggest`, and real model overrides stay disabled until the user explicitly configures all tier models for their own environment.
8
156
9
-
It is especially useful for people who already run one or more local models on their own machine or home lab and want OpenClaw to keep easy work local while still escalating harder prompts to stronger remote models only when necessary.
157
+
## Learning And Auditability
10
158
11
-
The project is led by an AI-native builder, product-oriented founder, and direction-setting operator. The repository also explicitly reflects an active intention to connect with aligned investors and project partners who want to help build the execution-governance layer for private AI systems.
159
+
One of the most important parts of the project is that routing decisions are not treated as disposable runtime noise.
12
160
13
-
## Repository Layout
161
+
They become system data.
14
162
15
-
-`router-plugin/` - TypeScript plugin, tests, build output, and plugin manifest
16
-
-`docs/` - design notes and host/plugin API contract
17
-
-`skills/router-rule-tuner/` - local skill for analysing router logs and tuning rules
18
-
-`.github/workflows/ci.yml` - CI for build, type-check, and test
163
+
The router can:
164
+
- write structured decision logs
165
+
- track retry behavior
166
+
- track conversation depth
167
+
- surface routing patterns in `/router stats`
168
+
- learn weight adjustments from historical behavior through `/router learn`
169
+
170
+
This is what makes the project useful as governance infrastructure rather than only a convenience plugin.
171
+
172
+
## Current Status
19
173
20
-
## What It Does
174
+
Current repository version: `0.4.0`
21
175
22
-
- Keeps simple, low-risk tasks on local models when possible
23
-
- Routes code and debugging work to a stronger code-oriented tier
24
-
- Tracks retry and session-depth signals to avoid getting stuck on weak routing
25
-
- Logs routing decisions for offline analysis and learning
26
-
- Supports `/router`, `/router stats`, and `/router learn`
176
+
What is already present:
177
+
- routing tiers and rule-based classification
178
+
- session-aware routing
179
+
- retry-aware escalation
180
+
- structured logging
181
+
- dynamic weight learning
182
+
- TF-IDF-assisted scoring
183
+
- tests for core routing behavior
184
+
185
+
What this repository represents strategically:
186
+
- one working component inside a larger private-AI execution-governance vision
27
187
28
188
## Quick Start
29
189
@@ -50,7 +210,14 @@ Then enable the plugin in `~/.openclaw/openclaw.json`:
50
210
}
51
211
```
52
212
53
-
Before switching to `override`, replace all `router.config.tiers.*` model refs with models that actually exist in the installer's environment. The plugin cannot auto-discover local/provider models from the current OpenClaw host API.
213
+
Before switching to `override`, replace all `router.config.tiers.*` model references with models that actually exist in your own environment.
214
+
215
+
## Repository Layout
216
+
217
+
-`router-plugin/` - TypeScript plugin, tests, build output, and plugin manifest
218
+
-`docs/` - design notes and host/plugin API contract
219
+
-`skills/router-rule-tuner/` - local skill for analyzing router logs and tuning rules
220
+
-`.github/workflows/ci.yml` - CI for build, type-check, and test
54
221
55
222
## Docs
56
223
@@ -71,6 +238,17 @@ npm run build
71
238
npm test
72
239
```
73
240
241
+
## Collaboration
242
+
243
+
The project is open to conversations with:
244
+
- investors who understand the long-term importance of execution governance in private AI systems
245
+
- product and technical partners who want to build this layer together
246
+
- operators who can validate real routing and deployment needs
247
+
74
248
## License
75
249
76
250
MIT. See [LICENSE](./LICENSE).
251
+
252
+
## 📊 Star History
253
+
254
+
[](https://www.star-history.com/#sparrowzhou/OpenClawRouter&Date)
Copy file name to clipboardExpand all lines: router-plugin/README.md
+1-1Lines changed: 1 addition & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -1,6 +1,6 @@
1
1
# OpenClaw Router
2
2
3
-
Local-first model router plugin for OpenClaw. v0.3.0
3
+
Local-first model router plugin for OpenClaw. v0.4.0
4
4
5
5
This plugin is a strong fit for users who already have locally deployed models and want a practical way to keep simple prompts on those local models while escalating only the harder requests to stronger hosted models.
0 commit comments