Jump to content

Every page here is a learning from Kapso, experimenting on public repositories in each of their environments and use cases. Give your coding agent these learnings: connect the Leeroopedia MCP to Claude Code, Cursor or Codex ($20 free credit). Powered by Leeroo · founders@leeroo.com

Environment:AMAP ML SkillClaw OpenClaw CLI

From Leeroopedia
Knowledge Sources
Domains Infrastructure, External_Tool_Integration
Last Updated 2026-10-22 00:00 GMT

Overview

External OpenClaw CLI binary required for agent-driven skill evolution via subprocess execution.

Description

This environment requires the OpenClaw CLI binary to be installed and available on `PATH` (or specified via `config.openclaw_bin`). The `OpenClawRunner` class invokes `openclaw agent --session-id ... --agent main --message ... --json --local --timeout ...` as a subprocess. The runner creates an isolated `OPENCLAW_HOME` directory, writes an `openclaw.json` config with LLM provider settings, and sets `HF_HUB_OFFLINE=1` and `TRANSFORMERS_OFFLINE=1` to prevent network calls. OpenClaw's `ensureAgentWorkspace()` creates template bootstrap files (AGENTS.md, SOUL.md, etc.) using `writeFileIfMissing` with `flag: 'wx'`, which SkillClaw exploits by pre-writing custom bootstrap files.

Usage

Use this environment when running the agent-driven evolution engine (`AgentEvolveServer`). It is the mandatory prerequisite for the OpenClawRunner implementation and all agent-based skill evolution workflows. The workflow engine (`EvolveServer`) does not require this — only the agent engine path does.

System Requirements

Dependencies

System Packages

  • `openclaw` CLI binary (must be on `PATH` or specified via `openclaw_bin`)
  • Node.js runtime (required by OpenClaw CLI)

Python Packages

Configuration Files

  • `openclaw.json` — auto-generated by OpenClawRunner in `OPENCLAW_HOME/.openclaw/`

Credentials

The following environment variables are passed to the OpenClaw subprocess:

  • `OPENAI_API_KEY` (or equivalent LLM API key) — injected via `openclaw.json` `apiKey` field
  • LLM base URL — injected via `openclaw.json` `baseUrl` field
  • `HF_HUB_OFFLINE=1` — auto-set to prevent HuggingFace network calls
  • `TRANSFORMERS_OFFLINE=1` — auto-set to prevent transformer model downloads

Quick Install

# Install OpenClaw CLI (see OpenClaw project documentation for details)
# Ensure 'openclaw' binary is on PATH

# Install SkillClaw with evolve server extras
pip install skillclaw[evolve,server]

# Verify openclaw is available
openclaw --version

Code Evidence

OpenClaw binary invocation from `evolve_server/engines/openclaw_runner.py:156-169`:

cmd = [
    self.openclaw_bin,
    "agent",
    "--session-id",
    session_id,
    "--agent",
    "main",
    "--message",
    message,
    "--json",
    "--local",
    "--timeout",
    str(self.timeout),
]

Isolated HOME environment from `evolve_server/engines/openclaw_runner.py:116-124`:

def _build_env(self) -> dict[str, str]:
    env = dict(os.environ)
    env["HOME"] = str(self.openclaw_home)
    env["OPENCLAW_HOME"] = str(self.openclaw_home)
    env["OPENCLAW_CONFIG_PATH"] = str(self._config_path)
    env["HF_HUB_OFFLINE"] = "1"
    env["TRANSFORMERS_OFFLINE"] = "1"
    return env

Subprocess execution with timeout from `evolve_server/engines/openclaw_runner.py:181-198`:

try:
    result = subprocess.run(
        cmd,
        cwd=str(workspace_path),
        env=env,
        capture_output=True,
        text=True,
        check=False,
        timeout=self.timeout + 30,
    )
except subprocess.TimeoutExpired as exc:
    logger.error("[OpenClawRunner] agent timed out after %ds", self.timeout)

OpenClaw bootstrap file exploitation from `evolve_server/engines/agent_workspace.py:8-13`:

# OpenClaw's ensureAgentWorkspace() creates template bootstrap files
# (AGENTS.md, SOUL.md, USER.md, IDENTITY.md, …) using writeFileIfMissing
# with flag: 'wx' — it will NOT overwrite files that already exist.
# We exploit this by pre-writing our own versions of these files during
# prepare() so OpenClaw picks them up as-is.

Common Errors

Category Requirement Notes
OS Linux / macOS Subprocess execution; Windows not tested
Hardware 2+ CPU cores, 4GB RAM Agent LLM calls are CPU+network bound
Disk 1GB+ free For OPENCLAW_HOME isolation dirs and workspace staging
Error Message Cause Solution
`FileNotFoundError: [Errno 2] No such file or directory: 'openclaw'` OpenClaw CLI not installed or not on PATH Install OpenClaw CLI or set `openclaw_bin` config to full path
`[OpenClawRunner] agent exited with code 1` Agent run failed (see stderr) Check `result.stderr` for details; may be LLM API key issue or workspace setup error
`[OpenClawRunner] agent timed out after 600s` Agent exceeded timeout Increase `agent_timeout` in config or simplify the evolution task
`subprocess.TimeoutExpired` Process exceeded `timeout + 30` hard limit Increase `agent_timeout`; check if OpenClaw is hanging on network calls

Compatibility Notes

  • OpenClaw binary version: Must support `agent --session-id --json --local --timeout` CLI flags.
  • Offline mode: `HF_HUB_OFFLINE=1` and `TRANSFORMERS_OFFLINE=1` are forced — no HuggingFace model downloads during agent runs.
  • Workspace isolation: Each run creates a fresh `OPENCLAW_HOME` when `fresh=True` (default). Persistent mode (`fresh=False`) reuses the same HOME and session ID across rounds.
  • Node.js: Required by OpenClaw CLI; ensure it is installed and on PATH.

Related Pages

Page Connections

Double-click a node to navigate. Hold to expand connections.
Principle
Implementation
Heuristic
Environment