Skip to content

feat(hosts): add a partial OpenClaw host adapter - #218

Draft
neoLsH wants to merge 2 commits into
QoderAI:mainfrom
neoLsH:feat/openclaw-host-adapter
Draft

neoLsH wants to merge 2 commits into
QoderAI:mainfrom
neoLsH:feat/openclaw-host-adapter

Conversation

@neoLsH

@neoLsH neoLsH commented Nov 23, 2026

Copy link
Copy Markdown
Contributor

Summary

better-harness agent-customize inventory --provider openclaw now reads an OpenClaw installation: managed and personal skills, per-agent workshop-skills, mcp.servers from openclaw.json, the agent workspace skills/ and .agents/skills, and the six instruction files OpenClaw loads at session start. OpenClaw joins the host descriptor catalog with configured assets and portable HTML rendering only.

Why

  • Issue/Story: Refs [Feature]:OpenClaw Host Support #114.
  • User or maintainer outcome: OpenClaw users get the same configured-asset inventory that other source-local hosts already have, without a parallel code path and without pretending the host's live session store is readable.

Traceability and Scope

  • Spec/ADR, if applicable: SPEC-2026-11-23-openclaw-host-adapter.
  • Acceptance criteria addressed: AC1-AC6 in the spec (home and config resolution, JSON5 parse states, workspace attribution, user and project inventory, registry/help wiring, docs).
  • Canonical owners changed: scripts/agent-customize/providers/openclaw.mjs (new), scripts/agent-customize/core/json5.mjs (new), scripts/host-support/index.mjs, the provider map and CLI help, references/agent-customize/platforms/openclaw.md (new), and the adapter docs.
  • Explicit non-goals: no session-evidence slice (live sessions and transcripts stay in per-agent SQLite, and openclaw sessions export-trajectory writes into the workspace it exports from), no install shell, no plugin lifecycle profile, no Asset Practices, Checkup, Harness report, or Evidence Bundle claim, and no write, migration, or repair of OpenClaw state.

Change Type

  • Feature
  • Bug fix
  • Tests only
  • Documentation/community
  • Refactor with no intended behavior change
  • Dependency, packaging, or infrastructure

Test and Review Evidence

Check Result
npx vitest run test/agents/agent-customize.test.mjs test/agents/json5-config-reader.test.mjs 64 passed
npm test 1804 passed, 7 skipped, 1 failed
npm run pack:verify pack verification passed: npm 752 entries, runtime zip 1013 entries
node scripts/doc-link-graph/cli.mjs skills/better-harness Graph: 39 files, 56 links
git diff --check clean
better-harness agent-customize help lists openclaw and --openclaw-home / --openclaw-config-path
better-harness plugin plan install --host openclaw rejected as an unknown host, exit 64

The one npm test failure is test/plugins/antigravity-plugin-artifact.test.mjs (Resolved dependency identity or version does not match source package.json): the local install has yaml 2.9.0 while package.json declares 2.9.1. It fails identically on main in this checkout and is unrelated to this change.

Manual or visual evidence: none. No native OpenClaw install was smoked; the adapter is verified against synthetic fixtures that mirror the documented layout.

Risk and Recovery

  • Compatibility and cross-platform impact: additive. A new host id and a new provider module; existing providers, help snapshots, and report platforms are unchanged. Paths are built with node:path and the config reader has no platform-specific branches.
  • Package, plugin, schema, or generated-file impact: pack:verify reports the same package roots as before; no new metadata root ships. core/json5.mjs is a documented subset normalizer, not a full JSON5 parser, so a config using features outside that subset is reported as invalid rather than guessed at.
  • Rollback or recovery path: revert the commit. All collection is read-only, so no host state needs repair.
  • Residual risk or unverified boundary: workspace attribution depends on agents.defaults.workspace and agents.entries.<agentId>.workspace. If a future release changes that roster shape, the adapter reports an unmatched workspace instead of guessing. CHANGELOG.md is untouched because AGENTS.md reserves release metadata for the maintainers.

AI Involvement

  • Level: Generated.
  • Human review and validation: the host layout was read from the OpenClaw docs on 2026-11-23; the full test suite, pack verification, doc-link graph, and CLI probes above were run locally before opening this PR.

Checklist

  • I followed AGENTS.md, CONTRIBUTING.md, and the relevant canonical-owner guidance.
  • The change is focused and does not include unrelated local or generated state.
  • Tests and documentation match the behavior actually delivered.
  • Markdown links were checked when documentation moved or changed.
  • Cross-platform behavior was considered for Windows, macOS, and Linux.
  • Package/runtime verification was run when shipped files or dependencies changed.
  • User-facing or compatibility changes are recorded in CHANGELOG.md. (AGENTS.md asks contributors not to edit it proactively.)
  • I have the right to contribute this work under the repository's MIT License.

neoLsH and others added 2 commits November 23, 2026 15:03
OpenClaw keeps two storage families apart: a state directory
(~/.openclaw, OPENCLAW_STATE_DIR, or a profile variant) and one workspace
per agent. The workspace is an agent home rather than a code checkout, so
project scope only applies when the requested workspace resolves to a
configured agent. The adapter attributes the workspace through
agents.defaults.workspace and agents.entries.<agentId>.workspace, keeps an
unmatched or unreadable config explicit in diagnostics, and collects
workspace skills plus the six instruction files OpenClaw loads at session
start.

openclaw.json is JSON5, so a comment-laden hand-edited config would have
been dropped by a strict JSON reader. A small normalizer in
scripts/agent-customize/core/json5.mjs handles comments, trailing commas,
bare keys, and single-quoted strings, and every read reports a parse state
(json, json5, empty, missing, skipped, invalid) so a config the reader
cannot understand is reported instead of being treated as empty.

The descriptor claims configured assets and portable HTML rendering only.
Live sessions and transcripts stay in per-agent SQLite, which is never
decoded here, and `openclaw sessions export-trajectory` mutates the
workspace it exports from, so no session-evidence slice ships. Lifecycle
targets keep rejecting openclaw, and the matrix, docs site page, zh-Hans
mirror, platform note, and CLI help state that boundary.

Spec: docs/specs/2026-11-23-openclaw-host-adapter.md (issue QoderAI#114).
Test: npm test - 1804 passed, 7 skipped. One unrelated failure remains: the
Antigravity artifact build trips over local dependency drift (yaml 2.9.1
declared, 2.9.0 installed). npm run pack:verify passed; the doc-link graph
resolves 39 files and 56 links.

Co-authored-by: Qoder <noreply@qoder.com>
Windows CI reported the fixture config as unparsed. mkdtemp hands back a
C:\Users\... path, and a raw path inside a single-quoted JSON5 string
turns \U into an invalid escape, so the whole config was rejected and the
four OpenClaw tests that depend on it failed on windows-latest.

Escape the embedded paths and pin the escaped Windows path in the JSON5
reader tests so the case runs on every platform.

Co-authored-by: Qoder <noreply@qoder.com>

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant