Skip to content

Latest commit

 

History

History

Folders and files

NameName
Last commit message
Last commit date

parent directory

..
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

README.md

Trading Desk Example

A reference pod showing mixed managed agents (openclaw, nanoclaw, nullclaw, microclaw, hermes) running as a governed fleet — each with Discord presence and shared infrastructure context. This spike now enables cllama passthrough routing for trader agents (cllama).

What's in the box

File Purpose
Clawfile OpenClaw trader image (tiverton, westin)
Clawfile.nanoclaw NanoClaw image (allen)
Clawfile.nullclaw NullClaw image with Discord startup announcement (logan)
Clawfile.microclaw MicroClaw spike image with Discord startup announcement
Clawfile.hermes Hermes spike image with Discord startup announcement
claw-pod.yml Pod definition — per-agent handles, surfaces, invoke schedules
Dockerfile.openclaw-base Builds the local openclaw:latest base image
Dockerfile.trading-api Mock trading API with skill label emission and automatic contract injection
entrypoint.sh Baked into the base image — starts gateway, sends greeting
agents/ Per-agent AGENTS.md contracts
policy/ Shared skills (risk limits, approval workflow)

Prerequisites

  • Docker with Compose V2 (docker compose version)
  • claw binary on PATH (go build -o bin/claw ./cmd/claw)
  • Discord bot tokens — one per agent — plus server/channel IDs

.env file

Copy .env.example and fill in real values:

TIVERTON_BOT_TOKEN=Bot ...
WESTIN_BOT_TOKEN=Bot ...
ALLEN_BOT_TOKEN=Bot ...
LOGAN_BOT_TOKEN=Bot ...
MICRO_BOT_TOKEN=Bot ...
HERMES_BOT_TOKEN=Bot ...

TIVERTON_DISCORD_ID=...
WESTIN_DISCORD_ID=...
ALLEN_DISCORD_ID=...
LOGAN_DISCORD_ID=...
MICRO_DISCORD_ID=...
HERMES_DISCORD_ID=...
DISCORD_GUILD_ID=...
DISCORD_TRADING_FLOOR_CHANNEL=...
DISCORD_TRADING_API_WEBHOOK=...
OPERATOR_DISCORD_ID=...

POSTGRES_PASSWORD=...
SECRET_KEY_BASE=...
OPENROUTER_API_KEY=...
ANTHROPIC_API_KEY=...

claw up reads this pod-local .env file when resolving ${...} placeholders inside x-claw metadata before generating runtime config such as openclaw.json. This example keeps the shared Discord guild/channel topology in pod-level x-claw.handles-defaults, while each service's x-claw.handles.discord only declares its own bot ID and username. Only runtime process env like bot tokens need to be duplicated under a service environment: block.

Running

# Pull pinned infra, then build the pod's local services
claw pull
claw build
claw up -d

# Check health
claw health

# Tail logs
claw logs tiverton

Spike integration test

cmd/claw/spike_test.go is a full end-to-end test that:

  1. Builds all images (Clawfile* variants for all claw types, plus mock trading API)
  2. Runs claw up on a pre-expanded pod YAML
  3. Asserts generated artifacts — including x-claw.handles-defaults inheritance into per-service Discord topology, openclaw.json structure, jobs.json channel IDs, and compose mounts
  4. Asserts cllama wiring — proxy service emitted, provider endpoints in models.providers.* rewritten to cllama, bearer token injected, per-agent context dir generated
  5. Waits for containers to be healthy
  6. Polls the Discord channel REST API to confirm startup greetings arrived

Requirements:

  • Docker running
  • Env-owned Discord IDs for tiverton, westin, allen, logan, micro, and hermes, plus shared guild/channel IDs
  • Real bot tokens in examples/trading-desk/.env (TIVERTON_BOT_TOKEN at minimum; others can reuse it for local spike runs)
  • Provider key for proxy env (OPENROUTER_API_KEY; ANTHROPIC_API_KEY optional fallback)
  • Internet access from Docker containers (no internal-only Docker Desktop network mode)

Run:

go test -tags spike -v -run TestSpikeComposeUp -timeout 300s ./cmd/claw/

The test skips automatically if TIVERTON_BOT_TOKEN is not set in .env, or if the required per-service Discord IDs/topology are missing.

What it verifies:

Assertion What it checks
openclaw.json structure channels.discord.token, guilds keyed by guild ID
openclaw.json cllama rewrite models.providers.<provider>.baseUrl points to cllama, apiKey is per-agent token
jobs.json structure agentTurn payload, delivery.to = resolved channel ID
cllama context files .claw-runtime/context/<agent>/ contains AGENTS.md, CLAWDAPUS.md, metadata.json
Compose mounts /app/config directory, /app/state/cron directory
Container readability /app/config/openclaw.json, /app/state/cron/jobs.json, /claw/AGENTS.md
Skills populated /claw/skills/ contains extracted skill files
Health check Docker healthcheck reports healthy
Discord greetings Messages appear in the channel via REST API polling