BossAgents × MTClaw Summit Technical Documentation
1. Architecture Overview
┌─────────────────────────────────────────────────────────────────┐
│ 用户接入层(多端统一) │
│ Web浏览器 │ 微信小程序 │ 飞书机器人 │ 开放API │
└──────────┬──────────┬──────────┬──────────┬─────────────────────┘
│ │ │ │
┌──────────▼──────────▼──────────▼──────────▼─────────────────────┐
│ BossAgents 主服务 (Node.js :3006) │
│ ┌─────────────┐ ┌──────────────┐ ┌─────────────────────┐ │
│ │ SmartRouter │ │ BossScheduler│ │ Digital Staff Engine│ │
│ │ (调度中枢) │ │ (任务编排) │ │ (56个数字员工) │ │
│ └──────┬──────┘ └──────┬───────┘ └──────────┬──────────┘ │
│ │ │ │ │
│ ┌──────▼────────────────▼──────────────────────▼──────────┐ │
│ │ MTClaw Function Router (:18790) │ │
│ │ L1 关键词规则 → L2 端侧推理 → L3 云端兜底 │ │
│ └────────────────────────┬────────────────────────────────┘ │
│ │ │
│ ┌────────────────────────▼────────────────────────────────┐ │
│ │ LLM Provider 层 │ │
│ │ Ollama qwen2:7b (端侧) │ SenseNova (云端) │ │
│ └─────────────────────────────────────────────────────────┘ │
└─────────────────────────────────────────────────────────────────┘
2. MTClaw 三层路由机制
2.1 路由流程
用户请求 → SmartRouter → MTClaw Function Router
│
┌─────────▼─────────┐
│ L1: 关键词规则匹配 │
│ (12个高频词) │
└────┬────────┬─────┘
命中 │ │ 未命中
(0 Token) │
│ ┌────▼─────────┐
│ │ L2: 端侧推理 │
│ │ Ollama本地模型 │
│ └────┬────┬────┘
│ 成功 │ │ 失败
│ │ ┌──▼──────────┐
│ │ │ L3: 云端兜底 │
│ │ │ SenseNova │
│ │ └─────────────┘
▼ ▼
返回结果 + 加速证据
2.2 L1 关键词规则(12词)
| 类别 | 关键词 |
|------|--------|
| Chip Design | RTL, Verilog, Synthesis, Lint, Compilation, Simulation |
| Procurement | Sourcing, Price Comparison, Supplier, Quotation |
| Inventory | Stock, Level, Inventory Check |
| General | Query, Report, Weekly Report |
2.3 Acceleration Principle
- L1 Hit: Zero Token Consumption, Latency
- L2 Hit: Edge-side Inference, Latency 300-600ms, Low Token Consumption (Local Ollama)
- L3 Hit: Cloud Fallback, Latency 1200-2000ms, High Token Consumption (SenseNova API)
- Speedup Ratio: Direct Cloud Connection Latency / MTClaw Routing Latency
2.4 MTClaw Secondary Development Code
Core Modified Files:
- MTClaw/scripts/ — Custom Routing Scripts
- server/services/mtclaw-metrics-collector.js — Performance Metrics Collection
- server/routes/chipwise-routes.js — ChipWise Routing Integration
- server/services/llm.js — LLM Provider Layer (noFallback/timeout Passthrough)
3. Subagent Design
3.1 Digital Employee Architecture
Digital Staff Engine
├── Handler层 (意图识别 + 参数提取)
│ ├── chipwise-handler.js — 芯片设计7步流程
│ ├── procurement-handler.js — 采购比价
│ ├── inventory-handler.js — 库存管理
│ └── doc-handler.js — 文档生成
├── Worker层 (任务执行)
│ ├── chip-worker.js — RTLGenerate/编译/综合/仿真
│ ├── proc-worker.js — 供应商比价
│ └── doc-worker.js — 文档渲染
└── Profile层 (YAML画像)
└── profiles/local.yaml — 56个员工定义(唯一真相源)
3.2 ChipWise Engine 8步流程
| 步骤 | 能力 | LLM策略 | 超时 |
|------|------|----------|------|
| ① Toolchain Detection | EDA Health Check | None | 120s |
| ② Specification Identification | identify | Ollama→SenseNova (Speed Priority) | 15s |
| ③ RTL Generation | create | SenseNova (Cloud-Only Strong Model) | 180s |
| ④ EDA Compilation & Verification | compile+lint | None (iverilog+verible) | 120s |
| ⑤ Rule Engine Check | 47 Rules (12 IEEE) | None | 60s |
| ⑥ Relationship Engine Analysis | Module Dependency + Signal Chain | None | 60s |
| ⑦ Simulation Verification | Testbench Execution | None (iverilog+VVP) | 120s |
| ⑧ Timeline Summary | Full Process Traceability | None | 5s |
3.3 Fast/Slow Model Routing
- identify (fast): Ollama qwen2:7b on-device inference, latency ~500ms
- create (strong): SenseNova cloud-based large model, latency ~15s, maxTokens 16384
- No fallback to Ollama for create: On-device 7B model generates insufficient RTL quality
4. EDA Toolchain
| Tool | Version | Installation Method | Purpose |
|------|------|----------|------|
| iverilog | 11.0 | conda (WSL) | Verilog compilation + simulation |
| Yosys | 0.51 | conda (WSL) | RTL synthesis |
| Verible | 2024-06-10 | Pre-compiled (WSL) | Verilog Lint |
| riscv-gcc | 16.1.0 | conda (WSL) | RISC-V cross-compilation |
Execution method: Node.js → execSync('wsl ...') → wsl-eda.sh wrapper → conda environment
5. Latency and Performance Evaluation Data
5.1 MTClaw Routing Latency (Measured on 2026-08-02)
| Routing Layer | Average Latency | Token Consumption | Hit Rate (Measured 50 times) |
|--------|----------|-----------|-----------------|
| L1 Rule | ~11ms | 0 | 30.0% (15/50) |
| L2 On-device | ~450ms | ~100 | 46.0% (23/50) |
| L3 Cloud | ~1700ms | ~600 | 24.0% (12/50) |
| Direct Cloud Connection | ~2060ms | ~800 | — |
Measured data source: /api/mtclaw-metrics endpoint, statistics from 50 requests
- L1 vs L3 Speedup Ratio: 187x (11ms vs 2060ms)
- Token Savings: 80% (MTClaw 10875 vs Direct Cloud Connection 54184)
- Routing Success Rate: 98% (49/50)
5.2 ChipWise End-to-End Latency
| Step | Latency | Description |
|---|---|---|
| ② Identification | ~2s | Ollama On-Device Inference |
| ③ Generation | ~20s | SenseNova 8-Module RTL |
| ④ Compilation | ~5s | iverilog WSL |
| ④ Lint | ~3s | Verible WSL |
| ⑤ Rules | ~1s | Local Execution of 47 Rules |
| ⑥ Relationships | ~1s | Local Construction of Module Dependency Graph |
| ⑦ Simulation | ~8s | iverilog+VVP WSL |
| Total | ~40s | End-to-End |
5.3 Speedup Ratio Calculation (Based on Measured Data)
- MTClaw Weighted Average Latency: 0.30×11 + 0.46×450 + 0.24×1700 = 627ms
- Direct Cloud Connection Latency: 2060ms
- Overall Speedup Ratio: 3.3x
- L1 vs. Cloud Direct Connection Acceleration Ratio: 187x (Zero Token Consumption)
- Token Saving Rate: 80%
6. Open Source Benchmark
Based on the MTClaw standard benchmark test set:
- Routing Accuracy: >95% (L1+L2+L3 Three-layer Coverage)
- On-device Inference Availability: >98% (Ollama Local Service)
- Cloud Fallback Success Rate: 100% (SenseNova API)
7. Development Issues and Solutions
| # | Issue | Root Cause | Solution |
|---|---|---|---|
| 1 | Server Crash (>2min Response) | 10.7 Million Audit Logs | Cleanup + VACUUM + 3-day Retention Period |
| 2 | ChipWise API Timeout | await in Non-async Function | Change to async Function |
| 3 | LLM Call Chain Dead Link | Global _selected Pointing to 429 cloudbase | ChipWise Independent Priority |
| 4 | Ollama Fixed 60s Timeout Truncation | callLLM Not Passing Through timeout | Destructure options to Extract timeout and Pass to _callModel |
| 5 | WSL exec not responding | Node.js exec/execFile exception with wsl.exe | Switch to execSync |
| 6 | LLM-generated RTL missing riscv_top | Prompt does not enforce top-level module | Add rules 13+14 |
| 7 | wire vs reg compilation error | LLM does not distinguish Verilog signal types | Prompt rules 11/12 + repair rule 5 |
| 8 | CORS cross-origin issue | MTClaw(:18790) has no CORS | BossAgents backend proxy |
| 9 | Deadlock | Backend synchronous call to MTClaw → MTClaw callback to BossAgents | Asynchronous call + timeout protection |
| 10 | DeepSeek 402 insufficient balance | API account overdrawn | Switch to SenseNova as primary cloud service |
| 11 | L1 routing script execution KeyError('name') | STATE.tools whitelist check uses t["name"] instead of t["function"]["name"] | Fix to t.get("function",{}).get("name","") |
| 12 | L2 routing execute_tool lacks exception handling | Qwen selects tool, script execution throws exception → 500 | Add try/except to return error JSON |
| 13 | SmartRouter ping detection triggers L2 routing | "ping" message goes through Qwen tool selection → 5 rounds of failure | Switch to lightweight GET detection via /v1/models |
8. Demo Entry
- Chipwise Engine Demo: https://ylxt.chat/chipwise-demo
- MTClaw Performance Dashboard: https://ylxt.chat/mtclaw-dashboard
- API Endpoint: https://ylxt.chat/api/mtclaw-metrics
9. Startup Sequence
# 1. 启动WSL (EDA工具链)
wsl -d Ubuntu-22.04 -- echo "WSL OK"
# 2. 确认Ollama运行
ollama list # 应显示 qwen2:7b
# 3. 启动BossAgents
node server.js
# 4. 访问演示
# 浏览器打开 https://ylxt.chat/chipwise-demo
BossAgents