← Back to Plugins
Integration

Lucy Openclaw

wwtfly By wwtfly 👁 121 views ▲ 0 votes

Lucy SuperBrain integration plugin for OpenClaw

GitHub

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

Loading comments...