
In my last piece on OpenSpace, I showed you the big picture: 4.2× income improvement, 45.9% token reduction, and skills that evolve from your actual work. Today, I'm going deeper — specifically on how to use OpenSpace entirely from the CLI, how to run multiple isolated profiles, and how to integrate with your existing agents like Claude Code, nanobot, and OpenClaw.
I cracked open the source code. Here's everything you actually need.
OpenSpace gives you two distinct usage patterns:
| Path | What It Is | Best For |
|---|---|---|
| Path A: For Your Agent | Plug OpenSpace into Claude Code, nanobot, Codex, Cursor, OpenClaw as skills | Users who already have an agent workflow |
| Path B: As Your Co-Worker | Use OpenSpace directly via CLI or Python API | Developers who want standalone CLI access, custom integrations |
Path B is where we focus today — running OpenSpace purely from the command line, no code required.
Here's the full picture from the actual __main__.py source code:
git clone --filter=blob:none --sparse https://github.com/HKUDS/OpenSpace.git
cd OpenSpace
git sparse-checkout set ' /* ' ' !assets/ '
pip install -e .
The sparse checkout skips the 50MB assets folder. Installation verified.
openspace
This drops you into a live REPL:
>>> Build a monitoring dashboard for my Docker containers
>>> Create a GitHub PR review script
>>> status # Check system status
>>> help # Show available commands
>>> exit # Quit
Inside __main__.py, the interactive loop is straightforward:
async def interactive_mode(openspace: OpenSpace, ui_manager: UIManager):
CLIDisplay.print_interactive_header()
while True:
query = input(">>> ").strip()
if query.lower() in ['exit', 'quit', 'q']:
break
if query.lower() == 'status':
_print_status(openspace)
if query.lower() == 'help':
CLIDisplay.print_help()
result = await openspace.execute(query)
openspace --model "anthropic/claude-sonnet-4-5" \
--query "Create a monitoring dashboard for my Docker containers"
The --model flag overrides the default (which is openrouter/anthropic/claude-sonnet-4.5).
openspace [command] [options]
Commands:
refresh-cache Refresh MCP tool cache (starts all servers once)
Options:
--config, -c Configuration file path (JSON)
--query, -q Single query mode
--model, -m LLM model name
--log-level DEBUG, INFO, WARNING, ERROR
--max-iterations Maximum iteration count
--timeout LLM API call timeout (seconds)
--interactive, -i Force interactive mode
--no-ui Disable visualization UI
--ui-compact Use compact UI layout
openspace-mcp --help
This spawns an MCP server exposing 4 tools:
| Tool | What It Does |
|---|---|
execute_task |
Run multi-step grounding agent loop |
search_skills |
Search local + cloud skills |
fix_skill |
Repair a broken SKILL.md |
upload_skill |
Push evolved skill to cloud community |
# Download a skill from the community cloud
openspace-download-skill <skill_id>
# Upload your evolved skill to share
openspace-upload-skill /path/to/skill/dir
# Terminal 1: Backend API
openspace-dashboard --port 7788
# Terminal 2: Frontend
cd frontend && npm install && npm run dev
This gives you:
Here's the key insight from tool_layer.py:
@dataclass
class OpenSpaceConfig:
# Workspace Configuration
workspace_dir: Optional[str] = None
# Skill Evolution
evolution_max_concurrent: int = 3
# LLM Configuration
llm_model: str = "openrouter/anthropic/claude-sonnet-4.5"
llm_enable_thinking: bool = False
llm_timeout: float = 120.0
OpenSpace is single-instance per workspace — but you can run multiple instances with different configurations.
Create separate profiles by workspace:
# Profile 1: Web Development
mkdir -p ~/.openspace/profiles/web-dev
cat > ~/.openspace/profiles/web-dev/.env << EOF
OPENSPACE_WORKSPACE=/home/jack/projects/web
OPENSPACE_LLM_MODEL=anthropic/claude-sonnet-4-5
EOF
# Profile 2: Data Science
mkdir -p ~/.openspace/profiles/data-science
cat > ~/.openspace/profiles/data-science/.env << EOF
OPENSPACE_WORKSPACE=/home/jack/projects/data
OPENSPACE_LLM_MODEL=openai/gpt-4o
EOF
# Profile 3: DevOps
mkdir -p ~/.openspace/profiles/devops
cat > ~/.openspace/profiles/devops/.env << EOF
OPENSPACE_WORKSPACE=/home/jack/projects/infra
OPENSPACE_LLM_MODEL=anthropic/claude-opus-4
EOF
# Method 1: Environment variable
OPENSPACE_WORKSPACE=/home/jack/projects/web openspace
# Method 2: Config file per profile
openspace --config ~/.openspace/profiles/web-dev/config.json
# Method 3: Python API (for scripted workflows)
from openspace import OpenSpace, OpenSpaceConfig
config = OpenSpaceConfig(
workspace_dir="/home/jack/projects/web",
llm_model="anthropic/claude-sonnet-4-5",
evolution_max_concurrent=3
)
| Profile | Workspace | Model | Use Case |
|---|---|---|---|
web-dev |
~/projects/web |
claude-sonnet-4-5 | Fast iteration, React/Next.js |
data-science |
~/projects/data |
gpt-4o | Analysis, visualization, pandas |
devops |
~/projects/infra |
claude-opus-4 | Complex infrastructure, Terraform |
writing |
~/projects/content |
claude-sonnet-4-5 | Documentation, blogs |
Each profile accumulates its own skills. The web-dev profile evolves skills for React patterns; the data-science profile evolves pandas and visualization patterns. They're isolated but can share via the cloud community.
This is where OpenSpace gets interesting. You can plug it into Claude Code, nanobot, OpenClaw, Codex, or Cursor.
From host_skills/README.md:
Your Agent (nanobot / openclaw / Claude Code / ...)
│
│ MCP protocol (stdio)
▼
openspace-mcp ← 4 tools exposed
├── execute_task ← multi-step grounding agent loop
├── search_skills ← local + cloud skill search
├── fix_skill ← repair a broken SKILL.md
└── upload_skill ← push skill to cloud community
.claude.json or MCP settings):{
"mcpServers": {
"openspace": {
"command": "openspace-mcp",
"toolTimeout": 600,
"env": {
"OPENSPACE_HOST_SKILL_DIRS": "/path/to/claude-code/skills",
"OPENSPACE_WORKSPACE": "/path/to/OpenSpace",
"OPENSPACE_API_KEY": "sk-xxx"
}
}
}
}
cp -r OpenSpace/openspace/host_skills/delegate-task/ /path/to/your/agent/skills/
cp -r OpenSpace/openspace/host_skills/skill-discovery/ /path/to/your/agent/skills/
These two skills teach your agent when and how to use OpenSpace — no additional prompting needed.
# Copy skills
cp -r host_skills/skill-discovery/ ~/.nanobot/skills/
cp -r host_skills/delegate-task/ ~/.nanobot/skills/
# Add to nanobot config (~/.nanobot/config.json)
{
"tools": {
"mcpServers": {
"openspace": {
"command": "openspace-mcp",
"toolTimeout": 1200,
"env": {
"OPENSPACE_HOST_SKILL_DIRS": "~/.nanobot/skills",
"OPENSPACE_WORKSPACE": "/path/to/OpenSpace",
"OPENSPACE_API_KEY": "sk-xxx"
}
}
}
}
}
OpenClaw uses mcporter for MCP runtime:
mcporter config add openspace \
--command "openspace-mcp" \
--env OPENSPACE_HOST_SKILL_DIRS=/path/to/openclaw/skills \
--env OPENSPACE_WORKSPACE=/path/to/OpenSpace \
--env OPENSPACE_API_KEY=sk-xxx
For advanced use cases, here's the full Python API from __init__.py:
from openspace import (
OpenSpace,
OpenSpaceConfig,
GroundingAgent,
GroundingClient,
LLMClient,
RecordingManager,
RecordingViewer
)
# Minimal setup
config = OpenSpaceConfig(
llm_model="anthropic/claude-sonnet-4-5",
workspace_dir="/path/to/workspace",
grounding_max_iterations=20,
evolution_max_concurrent=3
)
async with OpenSpace(config) as os:
result = await os.execute("Build a REST API with FastAPI")
# Check evolved skills
for skill in result.get("evolved_skills", []):
print(f"Evolved: {skill['name']} from {skill['origin']}")
config = OpenSpaceConfig(
# LLM Configuration
llm_model="anthropic/claude-sonnet-4-5",
llm_enable_thinking=True, # Claude extended thinking
llm_timeout=120.0,
llm_max_retries=3,
# Separate models for specific tasks
tool_retrieval_model="openai/gpt-4o-mini",
skill_registry_model="anthropic/claude-haiku",
execution_analyzer_model="anthropic/claude-haiku",
# Backend Configuration
backend_scope=["shell", "gui", "mcp", "web", "system"],
# Workspace
workspace_dir="/path/to/workspace",
# Recording
enable_recording=True,
enable_screenshot=False,
recording_log_dir="./logs/recordings"
)
Inside skill_engine/, OpenSpace tracks every execution and evolves skills automatically:
| Mode | Trigger | Action | Token Savings |
|---|---|---|---|
| FIX | Skill execution fails | Auto-repair SKILL.md | Prevents repeated failures |
| DERIVED | Successful pattern found | Extract reusable pattern | Reuse without re-reasoning |
| CAPTURED | Novel workflow succeeds | Create new skill | Build skill library from scratch |
The benchmark ran 50 professional tasks in two phases:
| Category | Tasks | Income Δ | Token Δ |
|---|---|---|---|
| 📝 Documents | 7 | 71→74% (+3.3pp) | −56% |
| 📋 Compliance | 11 | 51→70% (+18.5pp) | −51% |
| 🎬 Media | 3 | 53→58% (+5.8pp) | −46% |
| 🛠️ Engineering | 4 | 70→78% (+8.7pp) | −43% |
| 📊 Spreadsheets | 15 | 63→70% (+7.3pp) | −37% |
| 💻 Programming | 10 | 68→75% (+7.6pp) | −33% |
Bottom line: Phase 2 (warm rerun with evolved skills) dramatically outperformed Phase 1 (cold start, no prior knowledge).
Register at open-space.cloud to get your OPENSPACE_API_KEY.
execute_task — workssearch_skills — local results onlyfix_skill — worksupload_skill — failsVisit open-space.cloud to:
No installation needed — it's a web interface.
| Scenario | Recommended Approach |
|---|---|
| Quick task, one-off | openspace --query "..." |
| Ongoing project work | Interactive mode + dedicated profile |
| Already using Claude Code/nanobot | Path A integration (MCP) |
| Custom automation pipeline | Python API |
| Team skill sharing | Cloud community + API key |
| Solo developer, multi-project | Multiple profiles, one OpenSpace install |
# 1. Install
git clone --filter=blob:none --sparse https://github.com/HKUDS/OpenSpace.git
cd OpenSpace && pip install -e .
# 2. Verify
openspace-mcp --help
# 3. Interactive mode
openspace
# 4. Single query
openspace --query "Build a FastAPI todo app"
# 5. Specific model
openspace --model "anthropic/claude-opus-4" --query "Complex task"
# 6. Download community skill
openspace-download-skill <skill_id>
# 7. Refresh MCP cache
openspace refresh-cache
# 8. Dashboard (requires Node.js ≥ 20)
openspace-dashboard --port 7788
# Then: cd frontend && npm run dev
OpenSpace is not just a research prototype — it's a production-ready CLI tool with:
Whether you're a solo developer with multiple project profiles or a team lead integrating with Claude Code, OpenSpace adapts to your workflow. The self-evolution engine means every task you run makes the system smarter for the next one.
GitHub: HKUDS/OpenSpace (1.5k stars)
Cloud Community: open-space.cloud
Benchmark Paper: GDPVal on arXiv
All benchmark data verified against the official GDPVal paper and GitHub repository. CLI commands verified against __main__.py and tool_layer.py source code.