Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions .prettierignore
Original file line number Diff line number Diff line change
Expand Up @@ -58,3 +58,8 @@ plugins/openclaw-weixin/
# Top-level legal / generated text
LICENSE
NOTICE

# Private/generated Goals acceptance artifacts
benchmarks/harbor/.venv/
benchmarks/harbor/.work/
benchmarks/harbor/reports/
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ MicroClaw is designed to remove the usual Windows setup friction around OpenClaw
- **Only the LLM is bring-your-own**: the user supplies the model endpoint, API key, and model name; the rest of the stack is installed and configured by MicroClaw
- **Fast path on first launch**: if no provider is configured, the app opens a setup wizard that asks only for model credentials; if `MODEL_*` values already exist in `.env`, MicroClaw can auto-configure them
- **Recommended tasks on day one**: the home screen ships with starter task cards and prompt suggestions so users can begin with concrete tasks instead of a blank chat box
- **Personal goals per agent**: add, edit and complete persistent todos in chat or the sidebar's Goals page. Choose a category to create a goal; reminders are optional. One-time reminders use ordinary messages while the desktop app is running. See [Todo behavior and delivery](plugins/microclaw-todos/README.md).
- **Preloaded capability surface**: bundled OpenClaw skills plus 6 managed skills are included in the default Windows experience; availability depends on each skill's platform, dependencies and configuration, and specialist agents add their own skills on demand

### Built-In Trust
Expand Down
1 change: 1 addition & 0 deletions README.zh-CN.md
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ MicroClaw 的设计重点,是把 OpenClaw 在 Windows 上常见的安装和配
- **唯一需要用户自备的是 LLM**:用户提供模型地址、API Key 和模型名,其余栈内组件由 MicroClaw 安装并连接起来
- **首启路径很短**:如果还没有模型配置,应用只会引导填写模型凭据;如果 `.env` 里已有 `MODEL_*`,MicroClaw 还可以自动配置
- **首屏自带推荐任务**:首页不是空白输入框,而是预置了任务卡片和提示词建议,安装后就能直接开始做事
- **每个助手独立目标**:通过聊天或侧栏「目标」添加、编辑和完成持久事项。页面提供简洁的跟进列表和分类创建入口,单次文字提醒可按需设置。行为与投递范围见 [Todo 说明](plugins/microclaw-todos/README.md)。
- **能力预装到位**:默认包含 OpenClaw 内置技能及 6 个托管技能;实际可用性取决于各技能的平台、依赖和配置,专家智能体按需安装自己的专属技能

### 内建信任
Expand Down
6 changes: 6 additions & 0 deletions benchmarks/harbor/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
.venv/
.work/
reports/
node_modules/
__pycache__/
*.local.json
67 changes: 67 additions & 0 deletions benchmarks/harbor/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
# Goals Harbor acceptance

This standalone suite contains only two Goals tasks. Harbor 0.25.0 runs a fixed UI oracle against the real Windows desktop; the model inside MicroClaw performs the actions. The verifier independently checks native tool provenance, the trial's persisted Todo state, session/agent identity, visible results, and graceful cleanup.

| Task | Coverage |
| --- | --- |
| `goals-chat-lifecycle` (G01) | Create, list, rename, complete and delete the same Todo through natural-language chat. |
| `goals-agent-isolation` (G03) | A new conversation of the same agent sees its Todo; another agent sees only its own and cannot modify the foreign ID. |

The suite requires only a packaged Goals build and model credentials. Shared support handles disposable profiles, credential protection, UI evidence and standard Harbor reward files. The Windows adapter is not a security sandbox.

## Setup

Build a complete packaged desktop directory containing the Goals plugin:

```powershell
npm run pack --prefix desktop
.\benchmarks\harbor\run.ps1 -Setup -Check
```

The default configuration is `%LOCALAPPDATA%\MicroClawBench\goals.json`, outside the repository. `-Check` performs no model call. Fill the selected model configuration and point `appPath` at the new packaged executable. Both tasks require an actual model; there is no UI-only substitute.

```json
{
"schema": 1,
"appPath": "C:\\path\\to\\win-unpacked\\MicroClawDesktop.exe",
"model": {
"provider": "openai-compatible",
"baseUrl": "https://your-model-endpoint.example/v1",
"id": "your-model-id",
"apiKey": "enter-locally-then-run-check"
},
"evidence": { "privacy": "local-details" }
}
```

After entering a key, immediately run `-Check`: the input is verified and replaced by a reference to Windows DPAPI CurrentUser ciphertext. No plaintext backup is created. Do not commit or share the configuration, credential cache, or private profile. Existing configuration is never overwritten by initialization.

An existing GitHub Copilot test cache is also supported with `model.provider="github-copilot"`, `model.id`, absolute `model.credentialCache`, and `model.runtimeDir` pointing to the pinned OpenClaw 2026.10.10 package. The credential helper restores only that provider into the new test profile. A cache's existence is not proof that the service will accept it.

## Run

```powershell
.\benchmarks\harbor\run.ps1 -Task goals-chat-lifecycle -Config 'C:\private\goals.json' -Check
.\benchmarks\harbor\run.ps1 -Task goals-chat-lifecycle -Config 'C:\private\goals.json'
.\benchmarks\harbor\run.ps1 -Task goals-agent-isolation -Config 'C:\private\goals.json'
```

Run one desktop trial at a time. Each trial uses a unique marker and a fresh `MICROCLAW_TEST_PROFILE`; it does not import daily todos, chats, or messaging accounts. All mutations go through visible UI or the tested model's Todo tools. Read-only native catalog/history and filesystem observations provide independent evidence; the driver never repairs the model's work by writing the Todo store or invoking mutation RPCs.

The state parser and verifier are independent of the product's TodoStore. They reject missing/stale tool results, wrong agent/session identity, duplicate items, unsolicited reminders, foreign disclosure, unexpected state changes and forced cleanup. A verbal claim alone cannot pass. The bounded history projection is requested explicitly for evidence; ordinary chat history reads retain their default limits.

Reports are written under `reports/<job>/<trial>/`, with verifier `result.json` and `reward.txt`, a screenshot gallery and conversation evidence. Reward is 1 only when all required checkpoints pass. `BLOCKED` prerequisites receive 0 and remain distinct from a product failure. Historical failures are retained. If a trial fails or its processes cannot be confirmed stopped, its `.work` profile remains private for diagnosis.

G01/G03 do not cover scheduling accuracy, restart recovery, or real phone delivery. Runtime/unit tests cover the deterministic reminder contract separately. Real phone checks require a dedicated account/device and separate authorization.

## Framework tests

```powershell
npm ci --ignore-scripts --prefix benchmarks/harbor
npm test --prefix benchmarks/harbor
Push-Location benchmarks/harbor
.\.venv\Scripts\python.exe -X utf8 -m unittest discover -s tests -p test_environment.py
Pop-Location
```

Task definitions follow Harbor schema 1.4 and explicitly register in `runtime/cases.mjs` and the Windows environment allowlist. Additions must provide their own expected state and verifier; absent implementations are not successful runs.
1 change: 1 addition & 0 deletions benchmarks/harbor/microclaw_harbor/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
"""MicroClaw's trusted local Windows task adapter for Harbor."""
218 changes: 218 additions & 0 deletions benchmarks/harbor/microclaw_harbor/environment.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,218 @@
"""Runs reviewed desktop tasks in disposable profiles on the interactive Windows host.

This is deliberately not a security sandbox or an arbitrary-command environment.
Only Harbor's oracle/verifier batch entry points and reward cleanup are accepted.
Virtual C:\\ paths never address the host drive root.
"""

import asyncio
import json
import os
import re
import shutil
import tempfile
from pathlib import Path, PureWindowsPath

from harbor.environments.base import BaseEnvironment, ExecResult
from harbor.environments.capabilities import EnvironmentCapabilities

ROOT = Path(__file__).resolve().parents[1]


class WindowsDesktop(BaseEnvironment):
def __init__(self, *args, config_path=None, **kwargs):
self.config_path = (
str(Path(config_path).resolve())
if config_path
else str(
Path(os.environ.get("LOCALAPPDATA", Path.home())) / "MicroClawBench" / "goals.json"
)
)
self.root = None
self.process = None
super().__init__(*args, **kwargs)

@staticmethod
def type():
return "microclaw-windows-desktop"

@property
def capabilities(self):
return EnvironmentCapabilities(windows=True)

def _validate_definition(self):
self._task_name()

def _task_name(self):
definition = self.environment_dir.resolve()
if (
definition.parent.parent != ROOT / "tasks"
or definition.name != "environment"
or definition.parent.name
not in {
"goals-chat-lifecycle",
"goals-agent-isolation",
}
or not (definition / "desktop.json").is_file()
):
raise ValueError("Only reviewed MicroClaw desktop task definitions are supported")
return definition.parent.name

def local_path(self, value):
virtual = PureWindowsPath(str(value))
if virtual.drive.lower() != "c:" or not virtual.is_absolute() or ".." in virtual.parts:
raise ValueError("Expected an absolute Harbor virtual C: path")
relative = virtual.parts[1:]
if not relative or relative[0].lower() not in {"logs", "tests", "solution", "workdir"}:
raise ValueError("Unsupported Harbor virtual directory")
target = self.root.joinpath(*relative).resolve()
if not target.is_relative_to(self.root) or target == self.root:
raise ValueError("Path escapes this trial")
return target

async def start(self, force_build=False):
if os.name != "nt":
raise RuntimeError("An interactive Windows desktop is required")
work = ROOT / ".work"
work.mkdir(exist_ok=True)
self.root = Path(tempfile.mkdtemp(prefix="trial-", dir=work)).resolve()
for name in (
"logs/agent",
"logs/verifier",
"logs/artifacts",
"tests",
"solution",
"workdir",
):
(self.root / name).mkdir(parents=True, exist_ok=True)

async def _stop_process(self):
if self.process and self.process.returncode is None:
# Only the process created by this trial, including its owned desktop/Gateway.
killer = await asyncio.create_subprocess_exec(
"taskkill.exe",
"/PID",
str(self.process.pid),
"/T",
"/F",
stdout=asyncio.subprocess.DEVNULL,
stderr=asyncio.subprocess.DEVNULL,
)
await killer.wait()
await self.process.wait()

async def stop(self, delete=True):
await self._stop_process()
if delete and self.root:
target = self.root.resolve()
if target.parent != (ROOT / ".work").resolve() or not target.name.startswith("trial-"):
raise ValueError("Invalid trial cleanup path")
if (target / "workdir" / "profile").exists():
try:
evidence = json.loads(
(target / "logs/agent/evidence.json").read_text(encoding="utf-8")
)
cleaned = any(
p.get("name") == "cleanup" and p.get("ok") is True
for p in evidence.get("checkpoints", [])
)
except (OSError, ValueError):
cleaned = False
if not cleaned:
raise RuntimeError(
f"Desktop cleanup was not confirmed; private profile retained at {target}"
)
try:
verdict = json.loads(
(target / "logs/verifier/result.json").read_text(encoding="utf-8")
)
except (OSError, ValueError):
verdict = {}
if evidence.get("status") != "COMPLETE" or verdict.get("status") != "PASS":
# Preserve failed trial artifacts privately without preventing the next serial run.
return
shutil.rmtree("\\\\?\\" + str(target) if os.name == "nt" else target)

async def upload_file(self, source_path, target_path):
target = self.local_path(target_path)
target.parent.mkdir(parents=True, exist_ok=True)
shutil.copy2(source_path, target)

async def upload_dir(self, source_dir, target_dir):
shutil.copytree(source_dir, self.local_path(target_dir), dirs_exist_ok=True)

async def download_file(self, source_path, target_path):
Path(target_path).parent.mkdir(parents=True, exist_ok=True)
shutil.copy2(self.local_path(source_path), target_path)

async def download_dir(self, source_dir, target_dir):
shutil.copytree(self.local_path(source_dir), target_dir, dirs_exist_ok=True)

async def is_dir(self, path, user=None):
return self.local_path(path).is_dir()

async def is_file(self, path, user=None):
return self.local_path(path).is_file()

async def reset_dirs(self, *, remove_dirs, create_dirs, chmod_dirs=None):
for directory in remove_dirs:
target = self.local_path(directory)
if target.exists():
shutil.rmtree(target)
return await self.ensure_dirs(create_dirs)

async def ensure_dirs(self, dirs, *, chmod=True):
for directory in dirs:
self.local_path(directory).mkdir(parents=True, exist_ok=True)
return ExecResult(return_code=0)

async def empty_dirs(self, dirs, *, chmod=True):
return await self.reset_dirs(remove_dirs=dirs, create_dirs=dirs)

async def exec(self, command, cwd=None, env=None, timeout_sec=None, user=None):
if user is not None:
raise ValueError("User switching is unsupported")
# Harbor removes old reward files before invoking the verifier. Do it natively.
if "del /F /Q" in command and "reward.txt" in command and "reward.json" in command:
for name in ("reward.txt", "reward.json"):
(self.root / "logs" / "verifier" / name).unlink(missing_ok=True)
return ExecResult(return_code=0)
matches = re.findall(r"C:[\\/](?:solution[\\/]solve|tests[\\/]test)\.bat", command, re.I)
if len(matches) != 1:
raise ValueError("This adapter only runs the task's solve.bat and test.bat")
script = self.local_path(matches[0])
process_env = dict(os.environ)
process_env.update(self._merge_env(env) or {})
process_env.update(
{
"MICROCLAW_BENCH_ROOT": str(ROOT),
"MICROCLAW_BENCH_WORK": str(self.root / "workdir"),
"MICROCLAW_BENCH_CONFIG": self.config_path,
"MICROCLAW_BENCH_TASK": self._task_name(),
"MICROCLAW_BENCH_EVIDENCE": str(self.root / "logs" / "agent" / "evidence.json"),
"MICROCLAW_BENCH_REPORT_DIR": str(self.trial_paths.agent_dir.resolve()),
"MICROCLAW_BENCH_REWARD": str(self.root / "logs" / "verifier"),
}
)
self.process = await asyncio.create_subprocess_exec(
"cmd.exe",
"/d",
"/c",
str(script),
cwd=self.local_path(cwd) if cwd else self.root / "workdir",
env=process_env,
stdout=asyncio.subprocess.PIPE,
stderr=asyncio.subprocess.PIPE,
)
try:
stdout, stderr = await asyncio.wait_for(self.process.communicate(), timeout_sec)
except (TimeoutError, asyncio.CancelledError):
await self._stop_process()
raise
# Scripts emit only machine statuses. Never copy application stdout or secrets here.
output = stdout.decode("utf-8", errors="replace")
errors = stderr.decode("utf-8", errors="replace")
log_matches = re.findall(r"C:[\\/]logs[\\/](?:agent|verifier)[\\/][\w.-]+", command, re.I)
if log_matches:
self.local_path(log_matches[0]).write_text(output + errors, encoding="utf-8")
return ExecResult(stdout=output, stderr=errors, return_code=self.process.returncode)
53 changes: 53 additions & 0 deletions benchmarks/harbor/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

16 changes: 16 additions & 0 deletions benchmarks/harbor/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
{
"name": "microclaw-harbor-bench",
"private": true,
"type": "module",
"scripts": {
"test": "node --test tests/*.test.mjs support/credentials/tests/*.test.mjs",
"check": "node runtime/config.mjs check",
"init": "node runtime/config.mjs init"
},
"dependencies": {
"playwright": "1.64.1"
},
"devDependencies": {
"pngjs": "7.0.0"
}
}
1 change: 1 addition & 0 deletions benchmarks/harbor/requirements.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
harbor==0.25.0
Loading
Loading