Skip to content

feat: add OpenClaw agent adapter (Clawdbot rebrand)#97

Closed
rohitg00 wants to merge 3 commits intomainfrom
feat/openclaw-agent-adapter
Closed

feat: add OpenClaw agent adapter (Clawdbot rebrand)#97
rohitg00 wants to merge 3 commits intomainfrom
feat/openclaw-agent-adapter

Conversation

@rohitg00
Copy link
Copy Markdown
Owner

@rohitg00 rohitg00 commented Apr 7, 2026

Summary

Adds first-class openclaw agent support. Preserves original commits from @austinmao (#86) with cleanup on top.

Commits

  1. feat: add OpenClaw agent adapter@austinmao
  2. fix: address PR review comments@austinmao
  3. refactor: deduplicate, preserve legacy — cleanup

What changed in cleanup

  • OpenClawAdapter extends ClawdbotAdapter instead of duplicating 80 lines of identical generateConfig/parseConfig/getInvokeCommand
  • Clawdbot config reverted to original (.clawdbot/skills, AGENTS.md) — preserves legacy users
  • OpenClaw gets its own config (skills/, CLAUDE.md, ~/.openclaw/, extended frontmatter)
  • Detection: OpenClaw = ~/.openclaw or openclaw.json. Clawdbot = ~/.clawdbot or clawdbot.json. No overlap.
  • Tests updated: adapter count 44→45, detection assertions fixed

Test Plan

  • 189 agent tests pass
  • core + agents build clean
  • TUI build failure is pre-existing on main

Credit: @austinmao for the original implementation
Closes #86


Open with Devin

Summary by CodeRabbit

Release Notes

  • New Features
    • Added support for OpenClaw as a new agent type alongside existing integrations
    • OpenClaw workspaces are automatically detected via ~/.openclaw or openclaw.json files
    • Supports OpenClaw-specific configuration, skills discovery, and command generation

Lumina Mao and others added 3 commits April 7, 2026 10:56
OpenClaw (formerly Clawdbot) is a local-first AI agent framework with a
persistent gateway daemon. This adds first-class OpenClaw support:

- New `openclaw` agent type in AgentType enum and all Record types
- New `OpenClawAdapter` class with detection for `~/.openclaw/` + `openclaw.json`
- OpenClaw agent config: `skills/` dir (not `.clawdbot/skills/`), CLAUDE.md config
- Extended frontmatter fields: permissions, triggers, metadata, version, scan_exempt
- Agent dirs: `agents/` and `~/.openclaw/agents/`
- Command format: `.claude/commands/` directory
- Translator format map: `openclaw` → `skill-md`
- Simplified clawdbot adapter detection (legacy paths only)

OpenClaw SKILL.md files use an extended YAML frontmatter schema:
  - permissions: { filesystem: none|read|write, network: true|false }
  - triggers: [{ command: /skill-name }]
  - metadata.openclaw.requires: { bins: [], env: [], os: [] }

This enables `skillkit translate <skill> --to openclaw` producing
SKILL.md files compatible with the OpenClaw gateway runtime.

Ref: https://docs.openclaw.ai
- Remove legacy clawdbot path checks from OpenClawAdapter.isDetected()
  so pure clawdbot workspaces are not hijacked by OpenClaw detection
- Add '.openclaw/agents' to ALL_AGENT_DISCOVERY_PATHS so agent
  discovery works for OpenClaw agent directories
- OpenClawAdapter extends ClawdbotAdapter (removes 80 lines of copy-paste)
- Revert clawdbot config to original (.clawdbot/skills, AGENTS.md)
- OpenClaw detection: ~/.openclaw or openclaw.json
- Widen ClawdbotAdapter property types for extensibility
- Update tests: adapter count 44→45, fix detection assertions
@vercel
Copy link
Copy Markdown

vercel bot commented Apr 7, 2026

The latest updates on your projects. Learn more about Vercel for GitHub.

2 Skipped Deployments
Project Deployment Actions Updated (UTC)
skillkit Ignored Ignored Apr 7, 2026 10:18am
skillkit-docs Ignored Ignored Apr 7, 2026 10:18am

@coderabbitai
Copy link
Copy Markdown

coderabbitai bot commented Apr 7, 2026

📝 Walkthrough

Walkthrough

A new openclaw agent type was introduced as a rebranding of Clawdbot with distinct configuration and detection paths. The existing Clawdbot adapter was simplified to check only legacy paths, while a new OpenClawAdapter was created with support for extended SKILL.md frontmatter schema. Configuration, type definitions, discovery paths, command formats, and translator mappings were updated to recognize and route OpenClaw artifacts appropriately.

Changes

Cohort / File(s) Summary
Type System
packages/core/src/types.ts
Added "openclaw" string literal to AgentType enum, making it a valid agent type throughout the codebase.
Core Agent Configuration
packages/core/src/agent-config.ts
Added openclaw agent config entry with CLAUDE.md config file, skills/ dir, ~/.openclaw/skills/ global dir, extended frontmatter fields (permissions, triggers, metadata, version, scan_exempt), and XML format support. Updated clawdbot config to include ~/.clawdbot/skills/ in alternate skills directories.
Discovery & Format Routing
packages/core/src/agents/types.ts, packages/core/src/translator/types.ts
Added openclaw discovery paths (agents/, .openclaw/agents/), mapped openclaw to claude-agent agent format, and added openclaw: 'skill-md' to translator format mapping.
Command Generation
packages/core/src/commands/generator.ts
Added openclaw entry to AGENT_FORMATS with markdown command file extension and .claude/commands/ output directory, enabling slash commands and command file support.
Adapter Implementations
packages/agents/src/clawdbot.ts, packages/agents/src/openclaw.ts
Simplified ClawdbotAdapter detection to check only ~/.clawdbot and clawdbot.json paths; added explicit string type annotations to properties. Created new OpenClawAdapter extending ClawdbotAdapter with type: 'openclaw', detection for ~/.openclaw and openclaw.json, and configuration from AGENT_CONFIG.openclaw.
Adapter Registry
packages/agents/src/index.ts
Imported and re-exported OpenClawAdapter, instantiated it in the adapter registry, and added 'openclaw' to the agent detection priority list.
Test Updates
packages/agents/src/__tests__/adapters.test.ts, packages/agents/src/__tests__/clawdbot.test.ts
Updated adapter count expectation from 44 to 45. Removed isDetected test case for skills directory detection and assertion for join(process.cwd(), 'skills') path check in Clawdbot adapter tests.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

Possibly related PRs

Poem

🐰 A rabbit hops with joy today,
For OpenClaw has come to stay!
From Clawdbot's legacy we spring,
New paths, new schemas—let code sing! 🌟
With ~/.openclaw and frontmatter too,
The skills now know just what to do! ✨

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title 'feat: add OpenClaw agent adapter (Clawdbot rebrand)' clearly and specifically summarizes the main change: introducing OpenClaw as a new agent adapter type.
Linked Issues check ✅ Passed The PR successfully implements all core objectives from issue #86: adds openclaw agent type, OpenClawAdapter with proper detection, config paths, extended frontmatter support, and updated tooling (discovery, translators, tests).
Out of Scope Changes check ✅ Passed All changes are within scope of issue #86. File modifications target agent type support, adapter implementation, configuration, discovery paths, and test updates directly related to OpenClaw feature.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch feat/openclaw-agent-adapter

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link
Copy Markdown

@devin-ai-integration devin-ai-integration bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Devin Review found 1 potential issue.

View 5 additional findings in Devin Review.

Open in Devin Review

"gemini-cli",
"amp",
"clawdbot",
"openclaw",
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🔴 New openclaw agent type missing from translateSkillToAll() hardcoded agent list

Adding openclaw to the AgentType enum at packages/core/src/types.ts:12 was not propagated to the hardcoded agent list in translateSkillToAll() at packages/core/src/skill-translator.ts:400-408. That function explicitly enumerates all 44 pre-existing agent types but omits the newly added openclaw. As a result, calling translateSkillToAll() will never produce a translation for the openclaw agent, silently skipping it while translating for every other agent.

Prompt for agents
The function translateSkillToAll() in packages/core/src/skill-translator.ts (around line 400-408) contains a hardcoded array of all AgentType values. The new 'openclaw' agent type was added to the AgentType enum in packages/core/src/types.ts but was not added to this list. Add 'openclaw' to the agents array in translateSkillToAll(), likely next to 'clawdbot' on line 402. Consider refactoring this to use AgentType.options from the zod enum to avoid future drift.
Open in Devin Review

Was this helpful? React with 👍 or 👎 to provide feedback.

Copy link
Copy Markdown

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

🧹 Nitpick comments (1)
packages/core/src/agent-config.ts (1)

123-135: OpenClaw config aligns with PR objectives, but verify tilde path handling.

The configuration correctly implements OpenClaw-specific settings per PR objectives:

  • Workspace skills/ as primary directory
  • CLAUDE.md as config file
  • Extended frontmatter fields including permissions, triggers, scan_exempt

However, altSkillsDirs: ['~/.openclaw/skills'] has the same tilde expansion concern noted above. Since globalSkillsDir is also set to '~/.openclaw/skills', you may want to remove the duplicate from altSkillsDirs if it's only meant for global discovery.

♻️ Consider removing duplicate global path from altSkillsDirs
  openclaw: {
    skillsDir: 'skills',
    configFile: 'CLAUDE.md',
-   altSkillsDirs: ['~/.openclaw/skills'],
    globalSkillsDir: '~/.openclaw/skills',
    configFormat: 'xml',
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@packages/core/src/agent-config.ts` around lines 123 - 135, The openclaw
config duplicates the same tilde-path in altSkillsDirs and globalSkillsDir and
also uses a tilde which may not be expanded; update the openclaw object by
removing the duplicate path from altSkillsDirs (leave globalSkillsDir:
'~/.openclaw/skills') and/or replace tilde paths with absolute-expanded paths at
load-time; specifically modify the openclaw.altSkillsDirs and
openclaw.globalSkillsDir handling (or their loader) so tilde expansion is
performed (or duplicates removed) to avoid relying on raw '~' strings.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In `@packages/core/src/agent-config.ts`:
- Line 117: The altSkillsDirs arrays (symbol: altSkillsDirs in agent-config)
contain tilde-prefixed entries that won't expand when later joined with
projectPath in detectInstalledAgents() (method: detectInstalledAgents, uses
join(this.projectPath, altDir)), so either remove the '~' entries from
altSkillsDirs and rely on the existing globalSkillsDir for home-directory
discovery (symbol: globalSkillsDir), or implement explicit tilde-expansion
before joining (e.g., expand '~' to os.homedir()) so join(this.projectPath, ...)
receives a proper absolute path; update agent-config's altSkillsDirs to drop '~'
entries if you prefer the former approach.

---

Nitpick comments:
In `@packages/core/src/agent-config.ts`:
- Around line 123-135: The openclaw config duplicates the same tilde-path in
altSkillsDirs and globalSkillsDir and also uses a tilde which may not be
expanded; update the openclaw object by removing the duplicate path from
altSkillsDirs (leave globalSkillsDir: '~/.openclaw/skills') and/or replace tilde
paths with absolute-expanded paths at load-time; specifically modify the
openclaw.altSkillsDirs and openclaw.globalSkillsDir handling (or their loader)
so tilde expansion is performed (or duplicates removed) to avoid relying on raw
'~' strings.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: b42985ef-f88e-49ed-b393-d315f14827ac

📥 Commits

Reviewing files that changed from the base of the PR and between 59ea709 and bdab27b.

📒 Files selected for processing (10)
  • packages/agents/src/__tests__/adapters.test.ts
  • packages/agents/src/__tests__/clawdbot.test.ts
  • packages/agents/src/clawdbot.ts
  • packages/agents/src/index.ts
  • packages/agents/src/openclaw.ts
  • packages/core/src/agent-config.ts
  • packages/core/src/agents/types.ts
  • packages/core/src/commands/generator.ts
  • packages/core/src/translator/types.ts
  • packages/core/src/types.ts
💤 Files with no reviewable changes (1)
  • packages/agents/src/tests/clawdbot.test.ts

skillsDir: '.clawdbot/skills',
configFile: 'AGENTS.md',
altSkillsDirs: ['skills'],
altSkillsDirs: ['skills', '~/.clawdbot/skills'],
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟡 Minor

🧩 Analysis chain

🏁 Script executed:

#!/bin/bash
# Search for altSkillsDirs usage to understand if tilde expansion is handled
rg -n -A5 'altSkillsDirs' --type=ts

Repository: rohitg00/skillkit

Length of output: 5531


🏁 Script executed:

# Get more context around the detectInstalledAgents method
sed -n '200,250p' packages/core/src/primer/generator.ts

Repository: rohitg00/skillkit

Length of output: 1527


🏁 Script executed:

# Check if there's any tilde expansion utilities used in the codebase
rg -n 'expandUser|expandTilde|homedir|resolve.*~' --type=ts packages/core/src/

Repository: rohitg00/skillkit

Length of output: 4291


🏁 Script executed:

# Check the full implementation of detectInstalledAgents to see complete logic
ast-grep --pattern 'detectInstalledAgents() {
  $$$
}'

Repository: rohitg00/skillkit

Length of output: 43


Tilde paths in altSkillsDirs will not expand correctly and should be removed or handled separately.

The clawdbot and openclaw configurations include tilde paths ('~/.clawdbot/skills' and '~/.openclaw/skills') in altSkillsDirs. However, in detectInstalledAgents() (line 219 of packages/core/src/primer/generator.ts), these paths are joined directly with projectPath using join(this.projectPath, altDir), which treats the tilde as a literal directory name. This produces invalid paths like /project/path/~/.clawdbot/skills instead of expanding to the home directory.

Remove the tilde paths from altSkillsDirs and rely on globalSkillsDir (which is already defined for both agents) for home directory discovery, or ensure tilde expansion is applied before the join() call.

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@packages/core/src/agent-config.ts` at line 117, The altSkillsDirs arrays
(symbol: altSkillsDirs in agent-config) contain tilde-prefixed entries that
won't expand when later joined with projectPath in detectInstalledAgents()
(method: detectInstalledAgents, uses join(this.projectPath, altDir)), so either
remove the '~' entries from altSkillsDirs and rely on the existing
globalSkillsDir for home-directory discovery (symbol: globalSkillsDir), or
implement explicit tilde-expansion before joining (e.g., expand '~' to
os.homedir()) so join(this.projectPath, ...) receives a proper absolute path;
update agent-config's altSkillsDirs to drop '~' entries if you prefer the former
approach.

@rohitg00
Copy link
Copy Markdown
Owner Author

rohitg00 commented Apr 7, 2026

Superseded — merging #86 directly to preserve contributor attribution, cleanup will follow as separate PR

@rohitg00 rohitg00 closed this Apr 7, 2026
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