Integration
Lucy Openclaw
Lucy SuperBrain integration plugin for OpenClaw
Install
npm install
#
Configuration Example
{
"plugins": {
"lucy": {
"gatewayUrl": "http://localhost:8000",
"agentId": "openclaw_agent",
"strictMode": true
}
}
}
README
# Lucy OpenClaw Plugin
> ่ฎฉ SuperBrain (Lucy) ๆไธบ OpenClaw ็่ถ
่
## ๆถๆ
```
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
โ OpenClaw (Client/Frontend) โ
โ Lucy Plugin โ
โ - onMessageReceived โ ๆถๆฏ้ขๅค็ โ
โ - beforeAgentRun โ Agent ๆง่กๅ โ
โ - onToolCall โ ๅทฅๅ
ทๆฆๆช/ไผๅ โ
โ - beforeMessageSend โ ๅๅคๅฎกๆฅ โ
โโโโโโโโโโโโโโโโโโโโโโโโโโฌโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
โ HTTP API
โผ
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
โ SuperBrain Gateway (Server/Backend) โ
โ http://localhost:8000 โ
โ /think, /audit, /assimilate, /health โ
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
```
## ็ฎๅฝ็ปๆ
```
lucy-openclaw-plugin/
โโโ src/
โ โโโ index.ts # ๆไปถๅ
ฅๅฃ
โ โโโ types/
โ โ โโโ index.ts # TypeScript ็ฑปๅๅฎไน
โ โโโ client/
โ โ โโโ lucy-client.ts # Lucy Gateway HTTP ๅฎขๆท็ซฏ
โ โโโ hooks/
โ โโโ onMessageReceived.ts # ๆถๆฏ้ขๅค็
โ โโโ beforeAgentRun.ts # Agent ๆง่กๅ
โ โโโ onToolCall.ts # ๅทฅๅ
ทๆฆๆช
โ โโโ beforeMessageSend.ts # ๅๅคๅฎกๆฅ
โโโ configs/
โ โโโ default.json # ้ป่ฎค้
็ฝฎ
โโโ package.json
โโโ tsconfig.json
โโโ README.md
```
## ๅผๅไปปๅก
### Phase 1: ๅบ็กๆกๆถ (v0.1.0) - ่ฟ่กไธญ
- [x] ้กน็ฎๅๅงๅ
- [x] TypeScript ็ฑปๅๅฎไน
- [x] LucyClient ๅฎ็ฐ
- [x] Hook ๆกๆถๅบ็ก
### Phase 2: Hook ๅฎ็ฐ (v0.2.0)
- [ ] onMessageReceived hook
- [ ] ่ฐ็จ `/think` ่ทๅไธไธๆ
- [ ] ๆณจๅ
ฅ่ฎฐๅฟๅฐ session
- [ ] ้ฃไนฆไธไธๆๆๅ
- [ ] beforeAgentRun hook
- [ ] ๅฎๅ
จๅฎกๆฅ
- [ ] ๆทฑๅบฆๆ่ๆณจๅ
ฅ
- [ ] Persona ่ฎพ็ฝฎ
- [ ] onToolCall hook
- [ ] ้ซๅฑๆไฝๆฆๆช
- [ ] ๅฎกๆนๆต็จ้ๆ
- [ ] ๆง่กๅๅญฆไน
- [ ] beforeMessageSend hook
- [ ] ๅๅคๅฎกๆฅ
- [ ] ๅฎๅ
จ่ญฆๅๆณจๅ
ฅ
### Phase 3: ้ฃไนฆ้ๆ (v0.3.0)
- [ ] ๅฎกๆนๅก็ๅ้
- [ ] ๅฎกๆนๅ่ฐๅค็
- [ ] ็ถๆ้็ฅ
### Phase 4: ๆต่ฏไธ้จ็ฝฒ (v0.4.0)
- [ ] ๅๅ
ๆต่ฏ
- [ ] ้ๆๆต่ฏ
- [ ] OpenClaw ๆไปถๆณจๅ
- [ ] ็ไบง้จ็ฝฒ
## ๅฎ่ฃ
```bash
# ๅฎ่ฃ
ไพ่ต
npm install
# ๅผๅๆจกๅผ
npm run dev
# ๆๅปบ
npm run build
# ๆต่ฏ
npm test
```
## ้
็ฝฎ
ๅจ OpenClaw ้
็ฝฎๆไปถไธญๆทปๅ :
```json
{
"plugins": {
"lucy": {
"gatewayUrl": "http://localhost:8000",
"agentId": "openclaw_agent",
"strictMode": true
}
}
}
```
็ฏๅขๅ้:
| ๅ้ | ้ป่ฎคๅผ | ่ฏดๆ |
|------|--------|------|
| `LUCY_GATEWAY_URL` | http://localhost:8000 | Lucy Gateway ๅฐๅ |
| `AGENT_ID` | openclaw_agent | Agent ID |
| `LUCY_STRICT_MODE` | true | ไธฅๆ ผๆจกๅผ |
| `LUCY_TIMEOUT` | 30000 | ่ถ
ๆถ(ms) |
## Hook ่ฏฆๆ
### onMessageReceived
็จๆทๆถๆฏๅฐ่พพๆถ่งฆๅ:
1. ่ฐ็จ `/think` ่ทๅ็ธๅ
ณ่ฎฐๅฟ
2. ๆๅ้ฃไนฆไธไธๆ
3. ๆณจๅ
ฅ่ฎฐๅฟๅฐ session
4. ่ฎพ็ฝฎๅฎๅ
จ่ญฆๅ
### beforeAgentRun
Agent ๆง่กๅ่งฆๅ:
1. ๅฎๅ
จๅฎกๆฅ (`/audit`)
2. ๆทฑๅบฆๆ่ (`/think` mode=deep)
3. ๆณจๅ
ฅ system prompt
### onToolCall
ๅทฅๅ
ท่ฐ็จๅ/ๅ่งฆๅ:
**Before:**
1. ้ซๅฑๆไฝๅฎกๆฅ
2. ๅฎกๆน่ฏทๆฑ(ๅฆๆ้่ฆ)
3. ๅๆฐไผๅ
**After:**
1. ๆๅๆไปทๅผไฟกๆฏ
2.Assimilate ๅฐ Lucy
3. ้่ฏฏๅญฆไน
### beforeMessageSend
ๅๅคๅ้ๅ่งฆๅ:
1. ๅฎกๆฅๅๅคๅ
ๅฎน
2. ๆณจๅ
ฅๅฎๅ
จ่ญฆๅ
3. ๆทปๅ Lucy ็ญพๅ
## ไธ SuperBrain ้ไฟก
```typescript
import { getLucyClient } from 'lucy-openclaw-plugin';
const lucy = getLucyClient();
// ๆ่
const context = await lucy.think({
agent_id: 'openclaw',
query: 'ๅๆ่ฟไธชไปปๅก'
});
// ๅฎกๆฅ
const result = await lucy.audit({
agent_id: 'openclaw',
action: 'bash',
params: { command: 'ls -la' }
});
// ๅญฆไน
await lucy.assimilate({
agent_id: 'openclaw',
observation: 'Task completed',
learned_lesson: 'Use async/await'
});
```
## ็ธๅ
ณๆๆกฃ
- [SuperBrain ้กน็ฎ](../SuperBrain/)
- [OpenClaw Hooks](https://docs.openclaw.ai/gateway/hooks)
- [OpenClaw ๆไปถๅผๅ](https://docs.openclaw.ai/plugins)
## License
MIT
integration
Comments
Sign in to leave a comment