Skip to content

Commit 05b80a6

Browse files
committed
Release 0.4.0 with rewritten project README
1 parent 7a12182 commit 05b80a6

6 files changed

Lines changed: 200 additions & 22 deletions

File tree

README.md

Lines changed: 194 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,29 +1,189 @@
11
# OpenClaw Router
22

3-
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"]
70+
B --> C["Extract signals from the prompt
71+
keywords, code fences, file paths, length, structure, constraints"]
72+
C --> D["Classify the request into a capability tier"]
73+
D --> E["Apply governance rules
74+
confidence thresholds, retry handling, session lock, fallback policy"]
75+
E --> F{"Best execution path?"}
76+
F --> G["Local model
77+
for simple, cheap, low-risk work"]
78+
F --> H["Private model
79+
for controlled internal execution"]
80+
F --> I["Public model
81+
for selective escalation to stronger external capability"]
82+
G --> J["Return answer"]
83+
H --> J
84+
I --> J
85+
J --> K["Log decision and context signals"]
86+
K --> L["Analyze patterns and refine routing
87+
via /router stats and /router learn"]
88+
```
89+
90+
## The Routing Model In Plain English
91+
92+
The plugin does not think in terms of one model being “best”.
93+
94+
It thinks in terms of matching work to the right execution level.
95+
96+
Current routing tiers:
97+
98+
| Tier | Plain-English meaning | Typical use |
99+
|------|-----------------------|-------------|
100+
| `efficient-response` | Fast and cheap execution | short text tasks, summaries, rewrites, translation |
101+
| `cost-optimized-solving` | Balanced default path | general requests that need more than a tiny local model |
102+
| `custom-policy` | Complex task path | strategy, architecture, multi-constraint analysis |
103+
| `control-orchestration` | Formal reasoning path | proof-style reasoning, derivations, structured decision logic |
104+
| `assured-intelligence` | High-confidence code path | coding, debugging, refactoring, implementation tasks |
105+
106+
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.
4146

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
6154

7155
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.
8156

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
10158

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.
12160

13-
## Repository Layout
161+
They become system data.
14162

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
19173

20-
## What It Does
174+
Current repository version: `0.4.0`
21175

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
27187

28188
## Quick Start
29189

@@ -50,7 +210,14 @@ Then enable the plugin in `~/.openclaw/openclaw.json`:
50210
}
51211
```
52212

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
54221

55222
## Docs
56223

@@ -71,6 +238,17 @@ npm run build
71238
npm test
72239
```
73240

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+
74248
## License
75249

76250
MIT. See [LICENSE](./LICENSE).
251+
252+
## 📊 Star History
253+
254+
[![Star History Chart](https://api.star-history.com/svg?repos=sparrowzhou/OpenClawRouter&type=Date)](https://www.star-history.com/#sparrowzhou/OpenClawRouter&Date)

README_CN.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ OpenClaw-Router/
3636
│ ├── dist/ # 编译输出
3737
│ ├── openclaw.plugin.json # Web 配置 schema
3838
│ ├── tsconfig.json
39-
│ └── package.json # v0.3.0
39+
│ └── package.json # v0.4.0
4040
├── skills/
4141
│ └── router-rule-tuner/ # 调参 Skill
4242
│ ├── SKILL.md # Skill 定义

router-plugin/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# OpenClaw Router
22

3-
Local-first model router plugin for OpenClaw. v0.3.0
3+
Local-first model router plugin for OpenClaw. v0.4.0
44

55
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.
66

router-plugin/package-lock.json

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

router-plugin/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "router",
3-
"version": "0.3.0",
3+
"version": "0.4.0",
44
"description": "Rule-based model router for OpenClaw Router local + CLI backends",
55
"type": "module",
66
"main": "dist/index.js",

router-plugin/src/index.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ const plugin = {
5757
id: "router",
5858
name: "OpenClaw Router",
5959
description: "Local-first token optimization router for OpenClaw Router",
60-
version: "0.3.0",
60+
version: "0.4.0",
6161

6262
register(api: PluginApi) {
6363
if (!shutdownHooksRegistered) {

0 commit comments

Comments
 (0)