← Back to Plugins
Tools

Wise Spatial Companion

fumicado By fumicado 👁 137 views ▲ 0 votes

3D spatial AI companion with VRM avatars and WebXR โ€” OpenClaw plugin

GitHub

Install

npm install

#

Configuration Example

{
  "skills": ["wise-spatial-companion"]
}

README

# Wise Spatial Companion

3D spatial AI companion with **VRM avatars** and **WebXR** support.
An [OpenClaw](https://openclaw.com) plugin for immersive AI agent interaction.

> Based on [openclaw-world](https://github.com/ChenKuanSun/openclaw-world) by ChenKuanSun. Extended with VRM avatars, WebXR (Vision Pro / Meta Quest), voice I/O, and lip sync.

## Features

- **VRM Avatars** โ€” Load any VRM model via `@pixiv/three-vrm`. Auto-blink, breathing, and idle animations built in.
- **WebXR** โ€” Enter immersive VR on Meta Quest Browser or Apple Vision Pro Safari. "Enter VR" button with hand tracking support.
- **Voice I/O** โ€” Push-to-talk voice input (Web Speech API) + TTS response with volume-based lip sync.
- **OpenClaw Plugin** โ€” Drop-in compatible. Agents register, move, chat, and emote in a shared 3D room.
- **Spatial Awareness** โ€” Area-of-Interest filtering, collision avoidance, 20Hz server game loop.

## Quick Start

```bash
# Clone
git clone https://github.com/fumicado/wise-spatial-companion.git
cd wise-spatial-companion

# Install
npm install

# Dev (server + client)
npm run dev

# Open browser
open http://localhost:3000
```

## VRM Avatar

Place your `.vrm` model in `public/models/default.vrm`, or specify a URL per agent:

```bash
curl -X POST http://localhost:18800/ipc -H "Content-Type: application/json" -d '{
  "command": "register",
  "args": {
    "agentId": "my-agent",
    "name": "AI Assistant",
    "color": "#3498db",
    "avatar": "https://example.com/my-avatar.vrm"
  }
}'
```

## WebXR

Click **"Enter VR"** on supported devices:
- **Meta Quest 3/Pro** โ€” Full WebXR + hand tracking
- **Apple Vision Pro** โ€” WebXR VR mode (Safari)
- **Desktop** โ€” Use [Meta Immersive Web Emulator](https://developer.meta.com/horizon/documentation/web/webxr-emulator) Chrome extension

## OpenClaw Integration

Add to your OpenClaw agent config:

```json
{
  "skills": ["wise-spatial-companion"]
}
```

Available commands: `register`, `world-move`, `world-chat`, `world-action`, `world-emote`, `world-leave`, `profiles`, `room-info`

See `skills/world-room/skill.json` for full API schema.

## Architecture

```
โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
โ”‚  OpenClaw Agent (LLM)       โ”‚
โ”‚  POST /ipc commands         โ”‚
โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ฌโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜
           โ”‚ HTTP
โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ–ผโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
โ”‚  Server (Node.js :18800)    โ”‚
โ”‚  Game loop (20Hz)           โ”‚
โ”‚  Spatial index / AOI        โ”‚
โ”‚  Command queue / rate limit โ”‚
โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ฌโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜
           โ”‚ WebSocket
โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ–ผโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
โ”‚  Client (Three.js + VRM)    โ”‚
โ”‚  WebXR session manager      โ”‚
โ”‚  VRM avatar + animations    โ”‚
โ”‚  Voice I/O + lip sync       โ”‚
โ”‚  CSS2D labels + bubbles     โ”‚
โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜
```

## Tech Stack

| Component | Technology |
|-----------|-----------|
| 3D Engine | Three.js 0.170 |
| Avatars | @pixiv/three-vrm 3.5 |
| XR | WebXR Device API |
| Voice | Web Speech API (STT + TTS) |
| Server | Node.js + WebSocket |
| Build | Vite 6 + TypeScript 5 |
| Protocol | OpenClaw IPC over HTTP |

## Project Structure

```
src/
โ”œโ”€โ”€ scene/
โ”‚   โ”œโ”€โ”€ vrm-avatar.ts       # VRM loader, idle anim, lip sync, expressions
โ”‚   โ”œโ”€โ”€ avatar-manager.ts    # Multi-avatar lifecycle + movement
โ”‚   โ”œโ”€โ”€ xr-manager.ts        # WebXR session + VR HUD
โ”‚   โ”œโ”€โ”€ room.ts              # 3D environment (floor, walls, lighting)
โ”‚   โ””โ”€โ”€ effects.ts           # CSS2D labels, chat bubbles, emotes
โ”œโ”€โ”€ audio/
โ”‚   โ””โ”€โ”€ voice-io.ts          # Speech recognition + synthesis
โ”œโ”€โ”€ ui/
โ”‚   โ”œโ”€โ”€ voice-button.ts      # Push-to-talk microphone button
โ”‚   โ”œโ”€โ”€ overlay.ts           # Agent list panel
โ”‚   โ”œโ”€โ”€ chat-log.ts          # Chat history
โ”‚   โ””โ”€โ”€ profile-panel.ts     # Agent profile sidebar
โ”œโ”€โ”€ net/
โ”‚   โ””โ”€โ”€ ws-client.ts         # WebSocket client
โ””โ”€โ”€ main.ts                  # Entry point
```

## Roadmap

- [ ] MFCC-based phoneme lip sync (upgrade from volume-based)
- [ ] Emotion engine (LLM response โ†’ VRM expression tags)
- [ ] Autonomous avatar behavior (wander, sit, play)
- [ ] Spatial audio (Web Audio API PannerNode)
- [ ] AR passthrough (when Vision Pro WebXR AR ships)
- [ ] Multi-LLM backend support (Wise API, direct Anthropic, etc.)

## Credits

- [openclaw-world](https://github.com/ChenKuanSun/openclaw-world) โ€” Original spatial room architecture
- [three-vrm](https://github.com/pixiv/three-vrm) โ€” VRM avatar rendering
- [Amica](https://github.com/semperai/amica) โ€” VRM animation patterns reference

## License

MIT
tools

Comments

Sign in to leave a comment

Loading comments...