← Back to Plugins
Tools

Kunpeng Agents

YH7916 By YH7916 👁 4 views ▲ 0 votes

OpenClaw cost optimization plugin - Reduce token costs by 60-80% through intelligent model routing

GitHub

Install

npm install
```

Configuration Example

{
  "mcpServers": {
    "kunpeng-optimizer": {
      "command": "node",
      "args": ["--import", "tsx", "packages/openclaw-plugin/src/server.ts"]
    }
  }
}

README

# Kunpeng Optimizer

> 北冥有鱼,其名为鲲。化而为鸟,其名为鹏。

**OpenClaw 成本优化插件 - 通过智能任务分类和模型路由降低 60-80% Token 成本**

## 核心特性

- **智能分类**: 基于任务复杂度自动分类(简单/中等/复杂)
- **模型路由**: 自动选择最优模型(Haiku/Mini/Sonnet)
- **成本追踪**: 实时统计成本节省
- **MCP 集成**: 作为 MCP Server 集成到 OpenClaw

## 快速开始

### 1. 安装依赖

```bash
pnpm install
```

### 2. 测试分类器

```bash
node --import tsx packages/openclaw-plugin/src/cli.ts "fix typo"
# Output: Recommended Model: claude-3-haiku-20240307, Estimated Savings: 91.7%
```

### 3. 作为 MCP Server 使用

在 OpenClaw 的 `mcp.json` 中添加:

```json
{
  "mcpServers": {
    "kunpeng-optimizer": {
      "command": "node",
      "args": ["--import", "tsx", "packages/openclaw-plugin/src/server.ts"]
    }
  }
}
```

## 架构

```
packages/
├── core/src/optimization/     # 成本优化核心
│   ├── task-classifier.ts     # 任务分类器
│   ├── model-router.ts        # 模型路由器
│   ├── cost-tracker.ts        # 成本追踪器
│   └── cost-optimizer.ts      # 优化器整合
└── openclaw-plugin/           # OpenClaw 插件
    ├── src/server.ts          # MCP Server
    ├── src/cli.ts             # CLI 工具
    └── src/llm-client.ts      # API 客户端
```

---

## 原 Kunpeng 多 Agent 协调系统



```bash
corepack pnpm install
corepack pnpm simulate
```

With SQLite persistence:

```bash
corepack pnpm simulate -- --db ./.data/kunpeng.db
```

With a publish target:

```bash
corepack pnpm simulate -- --target local-demo
```

### 2. Run The Distributed Coordination Demo

```bash
corepack pnpm demo:distributed
```

This starts a local coordination server, connects three sample agents, and shows:

- `Kun` before dependencies tighten
- `Peng` when `server-agent` is pushed into the dependency center
- `Roost` after the downstream document artifact lands

If you want to run each process separately:

```bash
corepack pnpm demo:distributed:server
corepack pnpm demo:distributed:wechat
corepack pnpm demo:distributed:server-agent
corepack pnpm demo:distributed:feishu
```

### 3. Run The Coordination CLI

```bash
corepack pnpm kunpeng help
corepack pnpm kunpeng server start
corepack pnpm kunpeng status
corepack pnpm kunpeng watch
```

## Architecture

Kunpeng is a hybrid system with multiple planes:

- **Blackboard plane**: structured artifacts, lineage, replayable facts
- **Execution plane**: actors or external agents consume and produce artifacts
- **Coordination plane**: lead wing election based on dependency centrality and pressure
- **Governance plane**: fixed gates that cannot be bypassed by emergent coordination
- **Form plane**: `Kun -> Peng -> Roost`

Two implementation tracks currently coexist in the repo:

- The **workflow engine** in `packages/core` and `apps/simulator`
- The **coordination kernel** in `packages/core`, `packages/coordination-server`, and `packages/agent-client`

The workflow engine proves replayability and governance on a narrow path.
The coordination kernel is the more general direction for dynamic multi-agent integration.

## Repository Structure

```text
apps/
  kunpeng-cli/          coordination CLI
  simulator/            runnable narrow workflow
packages/
  agent-client/         websocket client for external agents
  coordination-server/  broadcast-based coordination server
  core/                 workflow engine, coordinator, lead election, replay
  openclaw-plugin/      plugin and persisted run management
  playwright-adapter/   browser automation adapter
  shared/               schemas, contracts, constants
examples/
  distributed/          multi-agent coordination demo
docs/
  ARCHITECTURE.md
  REAL_ARCHITECTURE.md
  PHILOSOPHY.md
```

## What Makes Kunpeng Different

| Approach | Coordination | Main Unit | What Changes |
|----------|--------------|-----------|--------------|
| Fixed workflow systems | predefined | tasks | almost nothing |
| Free-chat swarms | conversational | messages | who talks |
| Kunpeng | pressure-driven | artifacts | system form and temporary coordination center |

The key idea is simple:

- dynamic coordination is allowed
- governance is not

Or in one sentence:

> Coordination can emerge. Review authority cannot.

## Verification

Verified locally on March 29, 2026:

- `corepack pnpm typecheck` ✅
- `corepack pnpm build` ✅
- `corepack pnpm test` ✅
- `corepack pnpm demo:distributed` ✅

## Current State

Kunpeng is best understood today as:

- a **runnable transformation kernel**
- a **replayable artifact-first workflow prototype**
- an **early coordination control plane** for external agents

It is not yet a full product shell with benchmarks, visual dashboards, or end-to-end deployment packaging.

## Documentation

- [Architecture](./docs/ARCHITECTURE.md)
- [Real Architecture Direction](./docs/REAL_ARCHITECTURE.md)
- [Philosophy](./docs/PHILOSOPHY.md)
- [Distributed Demo](./examples/distributed/README.md)

## License

TBD
tools

Comments

Sign in to leave a comment

Loading comments...