# Openclaw Dev

> Use when working on the OpenClaw multi-agent Discord bot system. Covers architecture, agent routing, RAG pipeline, LM Studio integration, shared modules, and CommonJS patterns.

- Skill: `uncfreak1255-code/openclaw-dev` (Agent Skill)
- Install (CLI): `npx skillmds@latest add uncfreak1255-code/openclaw-dev`
- Raw SKILL.md: https://api.skillmd.com/api/skills/uncfreak1255-code/openclaw-dev/raw
- Safety review: pending
- Works with: Claude Code, Claude.ai, OpenAI Codex
- Category: DevOps & Infra
- Author: uncfreak1255-code (https://skillmd.com/u/uncfreak1255-code)
- Updated: 2026-09-17
- Page: https://skillmd.com/skills/uncfreak1255-code/openclaw-dev

---


# OpenClaw Development Skill

## System Architecture
OpenClaw is a multi-agent Discord bot at ~/.openclaw/ running on 64GB Apple Silicon Mac.

### 6 Agents
| Agent | Role | Key Integrations |
|-------|------|-----------------|
| Doni | Coordinator — routes messages to specialists | Message bus, inter-agent |
| Cove | Guest operations — handles guest inquiries | Hostaway API, RAG |
| Vector | SEO — content and optimization | Search APIs, content gen |
| Dev | Engineering — code tasks | File system, git |
| Spark | Memory/RAG — knowledge retrieval | LanceDB, embeddings |
| Ops | Monitoring — system health | Logs, metrics |

### Runtime Stack
- **LLM**: LM Studio at localhost:1234 (qwen2.5-7b-instruct, ~33GB RAM)
- **RAG**: LanceDB at ~/.openclaw/data/lancedb/ + nomic-embed-text-v1.5 (768 dims)
- **Runtime**: Node.js, ALL CommonJS (require/module.exports — NO ESM)
- **327 memories** seeded across 5 LanceDB tables

### 5-Tier Context System
| Tier | Context | Cost | Use Case |
|------|---------|------|----------|
| 1 | 8K | FREE (local) | Simple routing, status |
| 2 | 16K | FREE (local) | Standard queries |
| 3 | 32K | ~$0.50/M | Complex queries |
| 4 | 128K | ~$3/M | Multi-doc RAG |
| 5 | 200K | ~$15-75/M (Opus) | Full analysis |

### Shared Modules (at ~/.openclaw/shared/)
- vectorstore.js — LanceDB table management
- embedding-client.js — nomic-embed-text-v1.5 interface
- rag-injection.js — Query → retrieve → inject pipeline
- context-tier.js — Automatic tier selection
- message-bus.js — Inter-agent message routing
- inter-agent.js — Agent-to-agent communication protocol
- smart-compaction.js — Two-pass Gemini Flash-Lite compaction
- llm-router-patch.js — LLM provider routing

### Code Standards
- **CommonJS ONLY**: `const x = require('./x')` / `module.exports = { x }`
- **Error handling**: Wrap ALL LLM calls in try/catch with fallback
- **Logging**: `console.log('[MODULE_NAME]', message)`
- **Testing**: `node -e "require('./path')"` to verify modules load
- **Two-layer structure**: agents/<n>/agent/ (runtime) + workspaces/<n>/ (full workspace)

### Current Phase
Phase 4 complete (327 memories seeded, shared modules deployed). Next: wire Phase 4 modules into llm-router.js and test end-to-end Discord message flow.

