it0/packages/openclaw-bridge
hailin 96e336dd18 feat(openclaw): OpenClaw skill injection pipeline — iAgent → bridge → SKILL.md
## Changes

### openclaw-bridge: POST /skill-inject
- New endpoint writes SKILL.md to ~/.openclaw/skills/{name}/ inside the container volume
- OpenClaw gateway file watcher picks it up within 250ms (no restart needed)
- Optionally calls sessions.delete RPC after write so the next user message starts
  a fresh session that loads the new skill directory immediately (zero-downtime)
- Path traversal guard on skill name (rejects names with / .. \)
- OPENCLAW_HOME env var configurable (default: /home/node/.openclaw)

### agent-service: POST /api/v1/agent/instances/:id/skills
- New endpoint in AgentInstanceController proxies skill injection requests to the
  instance's bridge (http://{serverHost}:{hostPort}/skill-inject)
- Guards: instance must be 'running', serverHost/hostPort must be set, content ≤ 100KB
- iAgent calls this internally (localhost:3002) via Python urllib — no Kong auth needed
- sessionKey format for DingTalk users: "agent:main:dt-{dingTalkUserId}"

### agent-service: remove dead SkillManagerService
- Deleted skill-manager.service.ts (file-system .md loader, never called by anything)
- Removed from agent.module.ts provider list
- The live skill path is ClaudeAgentSdkEngine.loadTenantSkills() which reads directly
  from the DB (it0_t_{tenantId}.skills) at task-execution time

### agent-service: clean up SystemPromptBuilder
- Removed unused skills?: string[] from SystemPromptContext (was never populated)
- Added clarifying comment: SDK engine handles skill injection, not this builder

## DB
- Inserted iAgent meta-skill "为小龙虾安装技能" into it0_t_default.skills
  (id: 79ac23ed-78c2-4d5f-8652-a99cf5185b61)
- Content instructs iAgent to: query user instances → generate SKILL.md → call
  POST /api/v1/agent/instances/:id/skills via Python urllib heredoc

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-03-09 02:16:47 -07:00
..
src feat(openclaw): OpenClaw skill injection pipeline — iAgent → bridge → SKILL.md 2026-03-09 02:16:47 -07:00
CHANNEL_DEV_GUIDE.md feat(bridge): DingTalk channel plugin + OpenClaw Protocol v3 rewrite 2026-03-08 05:10:01 -07:00
Dockerfile fix(bridge): bake AGENTS.md symlink into Docker image 2026-03-09 00:44:05 -07:00
README.md feat(openclaw): Phase 1 — server pool + agent instance deployment infrastructure 2026-03-07 11:11:21 -08:00
package-lock.json feat(bridge): DingTalk channel plugin + OpenClaw Protocol v3 rewrite 2026-03-08 05:10:01 -07:00
package.json feat(bridge): DingTalk channel plugin + OpenClaw Protocol v3 rewrite 2026-03-08 05:10:01 -07:00
start-dingtalk.sh feat(bridge): DingTalk channel plugin + OpenClaw Protocol v3 rewrite 2026-03-08 05:10:01 -07:00
supervisord.conf fix(openclaw-bridge): add --allow-unconfigured to gateway command 2026-03-08 07:25:39 -07:00
tsconfig.json feat(openclaw): Phase 1 — server pool + agent instance deployment infrastructure 2026-03-07 11:11:21 -08:00

README.md

IT0 OpenClaw Bridge

Custom Docker image that bundles the official OpenClaw agent with the IT0 Bridge process, enabling IT0's agent-service to manage and monitor OpenClaw instances.

Architecture

Container (single image, two processes via supervisord)
  ├── openclaw gateway  (internal port 18789, NOT exposed)
  └── it0-bridge        (external port 3000, exposed to IT0)
        ├── GET  /health    — liveness probe
        ├── GET  /status    — detailed status
        ├── POST /task      — submit task to OpenClaw
        ├── GET  /sessions  — list sessions
        └── GET  /metrics   — usage metrics

Build & Push

docker build -t it0hub/openclaw-bridge:latest .
docker push it0hub/openclaw-bridge:latest

Environment Variables

Variable Required Description
OPENCLAW_GATEWAY_TOKEN Yes Internal OpenClaw gateway auth token
CLAUDE_API_KEY Yes Anthropic API key (injected by IT0)
IT0_INSTANCE_ID Yes UUID from IT0's agent_instances table
IT0_AGENT_SERVICE_URL Yes IT0 agent-service URL for heartbeat

Deploy (via iAgent SSH)

docker run -d \
  --name openclaw-{instanceId} \
  --restart unless-stopped \
  -p {hostPort}:3000 \
  -v /data/openclaw/{instanceId}:/home/node/.openclaw \
  -e OPENCLAW_GATEWAY_TOKEN={token} \
  -e CLAUDE_API_KEY={claudeApiKey} \
  -e IT0_INSTANCE_ID={instanceId} \
  -e IT0_AGENT_SERVICE_URL=https://it0api.szaiai.com \
  it0hub/openclaw-bridge:latest