feat: add OpenClaw agent adapter (Clawdbot rebrand)#97
feat: add OpenClaw agent adapter (Clawdbot rebrand)#97
Conversation
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
|
The latest updates on your projects. Learn more about Vercel for GitHub. 2 Skipped Deployments
|
📝 WalkthroughWalkthroughA new Changes
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~20 minutes Possibly related PRs
Poem
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
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. Comment |
| "gemini-cli", | ||
| "amp", | ||
| "clawdbot", | ||
| "openclaw", |
There was a problem hiding this comment.
🔴 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.
Was this helpful? React with 👍 or 👎 to provide feedback.
There was a problem hiding this comment.
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 directoryCLAUDE.mdas config file- Extended frontmatter fields including
permissions,triggers,scan_exemptHowever,
altSkillsDirs: ['~/.openclaw/skills']has the same tilde expansion concern noted above. SinceglobalSkillsDiris also set to'~/.openclaw/skills', you may want to remove the duplicate fromaltSkillsDirsif 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
📒 Files selected for processing (10)
packages/agents/src/__tests__/adapters.test.tspackages/agents/src/__tests__/clawdbot.test.tspackages/agents/src/clawdbot.tspackages/agents/src/index.tspackages/agents/src/openclaw.tspackages/core/src/agent-config.tspackages/core/src/agents/types.tspackages/core/src/commands/generator.tspackages/core/src/translator/types.tspackages/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'], |
There was a problem hiding this comment.
🧩 Analysis chain
🏁 Script executed:
#!/bin/bash
# Search for altSkillsDirs usage to understand if tilde expansion is handled
rg -n -A5 'altSkillsDirs' --type=tsRepository: rohitg00/skillkit
Length of output: 5531
🏁 Script executed:
# Get more context around the detectInstalledAgents method
sed -n '200,250p' packages/core/src/primer/generator.tsRepository: 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.
|
Superseded — merging #86 directly to preserve contributor attribution, cleanup will follow as separate PR |
Summary
Adds first-class
openclawagent support. Preserves original commits from @austinmao (#86) with cleanup on top.Commits
What changed in cleanup
OpenClawAdapterextendsClawdbotAdapterinstead of duplicating 80 lines of identical generateConfig/parseConfig/getInvokeCommand.clawdbot/skills,AGENTS.md) — preserves legacy usersskills/,CLAUDE.md,~/.openclaw/, extended frontmatter)~/.openclaworopenclaw.json. Clawdbot =~/.clawdbotorclawdbot.json. No overlap.Test Plan
Credit: @austinmao for the original implementation
Closes #86
Summary by CodeRabbit
Release Notes
~/.openclaworopenclaw.jsonfiles