An experimental Java conversion (MVP) of the OpenClaw Personal AI Assistant.
This project implements a minimal viable version of OpenClaw in Java, focusing on:
- WebSocket Gateway (port 18789)
- Anthropic-powered Agent Runtime
- Console-based Interaction Channel
- Session Management with JSONL persistence
- Java 21+ (virtual threads required)
- Anthropic API Key (
sk-ant-...)
-
Build the project:
./gradlew build
-
Configure: Create
~/.openclaw-java/config.json:{ "gateway": { "port": 18789, "authToken": "test-token" }, "agent": { "provider": "anthropic", "apiKey": "sk-ant-...", "model": "claude-sonnet-4-20250514" } } -
Run Gateway:
java -jar build/libs/openclaw-java.jar gateway
-
Interact: The gateway will launch an interactive console prompt. Type messages to chat with the agent.
src/main/java/ai/openclaw/gateway- WebSocket serversrc/main/java/ai/openclaw/agent- Agent logic loop & LLM providersrc/main/java/ai/openclaw/channel- Console channel implementationsrc/main/java/ai/openclaw/config- Configuration loadersrc/main/java/ai/openclaw/session- Session storage
You can run the application in a Docker container for an isolated environment.
-
Build the Docker image:
docker build -t openclaw-java . -
Run the container: You must provide your Anthropic API key as an environment variable.
docker run -it --rm \ -e ANTHROPIC_API_KEY=sk-ant-... \ -p 18789:18789 \ openclaw-java
The container runs as a non-root user (
openclaw) for security.- Code execution is confined to
/home/openclaw/workspace. - File access is restricted to the workspace directory.
- Network access to internal/private IPs is blocked.
- Code execution is confined to