feat: add OpenClaw agent adapter (Clawdbot rebrand)#86
feat: add OpenClaw agent adapter (Clawdbot rebrand)#86austinmao wants to merge 1 commit intorohitg00:mainfrom
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
|
Someone is attempting to deploy a commit to the rohitg00's projects Team on Vercel. A member of the Team first needs to authorize it. |
📝 WalkthroughWalkthroughA new OpenClaw adapter is introduced to the agent framework alongside narrowing of Clawdbot's detection logic. The OpenClaw adapter is registered throughout the system with its own configuration, detection rules, and skill parsing behavior. Type definitions and various registries are updated to recognize OpenClaw as a valid agent type. Changes
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~22 minutes Possibly related PRs
Poem
🚥 Pre-merge checks | ✅ 2 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (2 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 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 Tip You can customize the tone of the review comments and chat replies.Configure the |
There was a problem hiding this comment.
🔴 ALL_AGENT_DISCOVERY_PATHS missing .openclaw/agents path
AGENT_DISCOVERY_PATHS at packages/core/src/agents/types.ts:230 defines ['agents', '.openclaw/agents'] for the openclaw agent type. However, the manually-maintained ALL_AGENT_DISCOVERY_PATHS union array (lines 272-326) does not include .openclaw/agents. This means discoverAgents() at packages/core/src/agents/discovery.ts:67 and findAgent() at packages/core/src/agents/discovery.ts:180 — which iterate over ALL_AGENT_DISCOVERY_PATHS — will never search the .openclaw/agents/ directory, causing openclaw agents stored there to be silently ignored.
(Refers to lines 272-326)
Prompt for agents
In packages/core/src/agents/types.ts, add '.openclaw/agents' to the ALL_AGENT_DISCOVERY_PATHS array. This array is the union of all paths from AGENT_DISCOVERY_PATHS. Insert '.openclaw/agents' in alphabetical order, after '.opencode/agent' (currently at line 301). The entry should be: '.openclaw/agents',
Was this helpful? React with 👍 or 👎 to provide feedback.
| return ( | ||
| (existsSync(projectSkills) && existsSync(globalOpenClaw)) || | ||
| existsSync(openclawConfig) || | ||
| existsSync(globalClawdbot) || | ||
| existsSync(clawdbotConfig) | ||
| ); |
There was a problem hiding this comment.
🔴 OpenClaw isDetected() checks legacy clawdbot paths, making clawdbot detection unreachable
In detectAgent() at packages/agents/src/index.ts:122-123, openclaw is checked before clawdbot. OpenClaw's isDetected() (packages/agents/src/openclaw.ts:97-102) returns true for ~/.clawdbot (line 100) and clawdbot.json (line 101) — the exact same two paths that clawdbot's isDetected() checks (packages/agents/src/clawdbot.ts:72-75). Since openclaw is evaluated first and is a superset of clawdbot's detection conditions, the clawdbot adapter's isDetected() can never be the first match in the detectAgent() loop. Existing clawdbot-only users (who have ~/.clawdbot but not ~/.openclaw) will be misidentified as openclaw users, receiving openclaw-specific configuration (different skillsDir, configFile, etc.).
Prompt for agents
In packages/agents/src/openclaw.ts, the isDetected() method at lines 86-103 should NOT check for legacy clawdbot paths (existsSync(globalClawdbot) and existsSync(clawdbotConfig) at lines 100-101). These paths should remain exclusive to the ClawdbotAdapter's isDetected() so that existing clawdbot users are correctly identified. Remove lines 94-95 (the variable declarations) and lines 100-101 (the existsSync checks) from OpenClawAdapter.isDetected(). The corrected return should be: return (existsSync(projectSkills) && existsSync(globalOpenClaw)) || existsSync(openclawConfig);
Was this helpful? React with 👍 or 👎 to provide feedback.
There was a problem hiding this comment.
Actionable comments posted: 2
🤖 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/agents/src/openclaw.ts`:
- Around line 86-103: isDetected() currently returns true for legacy clawdbot
markers regardless of OpenClaw presence, which causes detectAgent() to
mis-detect clawdbot workspaces as openclaw; modify isDetected() so legacy
markers (globalClawdbot, clawdbotConfig) are only considered when an
OpenClaw-specific indicator is also present (projectSkills or globalOpenClaw or
openclawConfig), e.g. require (globalClawdbot || clawdbotConfig) to be combined
with (globalOpenClaw || openclawConfig || projectSkills) before returning true;
update the logic in isDetected() (referencing variables projectSkills,
globalOpenClaw, openclawConfig, globalClawdbot, clawdbotConfig) so detectAgent()
no longer hijacks pure legacy clawdbot workspaces.
In `@packages/core/src/agents/types.ts`:
- Line 230: ALL_AGENT_DISCOVERY_PATHS is missing the new '.openclaw/agents'
entry that was added to AGENT_DISCOVERY_PATHS; update the
ALL_AGENT_DISCOVERY_PATHS array to include '.openclaw/agents' (maintain the
array's alphabetical ordering) so the union list matches AGENT_DISCOVERY_PATHS
and discovery for the 'openclaw' agent works correctly.
ℹ️ Review info
⚙️ Run configuration
Configuration used: defaults
Review profile: CHILL
Plan: Pro
Run ID: 9016fddc-bcc8-4601-91a2-d11c32885804
📒 Files selected for processing (8)
packages/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
| async isDetected(): Promise<boolean> { | ||
| // OpenClaw workspace: skills/ dir at project root | ||
| const projectSkills = join(process.cwd(), 'skills'); | ||
| // OpenClaw global config | ||
| const globalOpenClaw = join(homedir(), '.openclaw'); | ||
| // OpenClaw config file | ||
| const openclawConfig = join(process.cwd(), 'openclaw.json'); | ||
| // Legacy clawdbot paths | ||
| const globalClawdbot = join(homedir(), '.clawdbot'); | ||
| const clawdbotConfig = join(process.cwd(), 'clawdbot.json'); | ||
|
|
||
| return ( | ||
| (existsSync(projectSkills) && existsSync(globalOpenClaw)) || | ||
| existsSync(openclawConfig) || | ||
| existsSync(globalClawdbot) || | ||
| existsSync(clawdbotConfig) | ||
| ); | ||
| } |
There was a problem hiding this comment.
Detection logic unconditionally claims legacy clawdbot workspaces.
The isDetected() method checks for legacy clawdbot paths (~/.clawdbot and clawdbot.json) without requiring any OpenClaw-specific marker (lines 100-101). Since openclaw is checked before clawdbot in detectAgent(), this effectively hijacks all legacy clawdbot workspaces—users who haven't migrated to OpenClaw will be detected as openclaw instead of clawdbot.
This appears to contradict the PR's intent to maintain backward compatibility, as the clawdbot adapter will never be detected when these legacy paths exist.
🔧 Suggested fix: require OpenClaw-specific markers for migration
Only claim legacy clawdbot workspaces when there's also an OpenClaw indicator:
async isDetected(): Promise<boolean> {
// OpenClaw workspace: skills/ dir at project root
const projectSkills = join(process.cwd(), 'skills');
// OpenClaw global config
const globalOpenClaw = join(homedir(), '.openclaw');
// OpenClaw config file
const openclawConfig = join(process.cwd(), 'openclaw.json');
- // Legacy clawdbot paths
- const globalClawdbot = join(homedir(), '.clawdbot');
- const clawdbotConfig = join(process.cwd(), 'clawdbot.json');
return (
(existsSync(projectSkills) && existsSync(globalOpenClaw)) ||
- existsSync(openclawConfig) ||
- existsSync(globalClawdbot) ||
- existsSync(clawdbotConfig)
+ existsSync(openclawConfig)
);
}Alternatively, if the intent is to migrate clawdbot users who have ~/.openclaw, guard the legacy check:
return (
(existsSync(projectSkills) && existsSync(globalOpenClaw)) ||
existsSync(openclawConfig) ||
- existsSync(globalClawdbot) ||
- existsSync(clawdbotConfig)
+ // Claim legacy clawdbot only if user has started OpenClaw migration
+ (existsSync(globalOpenClaw) && (existsSync(globalClawdbot) || existsSync(clawdbotConfig)))
);🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.
In `@packages/agents/src/openclaw.ts` around lines 86 - 103, isDetected()
currently returns true for legacy clawdbot markers regardless of OpenClaw
presence, which causes detectAgent() to mis-detect clawdbot workspaces as
openclaw; modify isDetected() so legacy markers (globalClawdbot, clawdbotConfig)
are only considered when an OpenClaw-specific indicator is also present
(projectSkills or globalOpenClaw or openclawConfig), e.g. require
(globalClawdbot || clawdbotConfig) to be combined with (globalOpenClaw ||
openclawConfig || projectSkills) before returning true; update the logic in
isDetected() (referencing variables projectSkills, globalOpenClaw,
openclawConfig, globalClawdbot, clawdbotConfig) so detectAgent() no longer
hijacks pure legacy clawdbot workspaces.
| 'antigravity': ['.antigravity/agents'], | ||
| 'amp': ['.amp/agents'], | ||
| 'clawdbot': ['.clawdbot/agents', 'agents'], | ||
| 'openclaw': ['agents', '.openclaw/agents'], |
There was a problem hiding this comment.
Missing .openclaw/agents in ALL_AGENT_DISCOVERY_PATHS.
The AGENT_DISCOVERY_PATHS correctly includes '.openclaw/agents' for the new agent, but the ALL_AGENT_DISCOVERY_PATHS array (lines 272-326) does not include this path. This array appears to be a manually-maintained union of all agent discovery paths and should be updated for consistency.
🔧 Proposed fix
Add .openclaw/agents to the ALL_AGENT_DISCOVERY_PATHS array (around line 280, maintaining alphabetical order):
'.cline/agents',
'.clawdbot/agents',
'.codebuddy/agents',
+ '.openclaw/agents',📝 Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.
| 'openclaw': ['agents', '.openclaw/agents'], | |
| '.cline/agents', | |
| '.clawdbot/agents', | |
| '.codebuddy/agents', | |
| '.openclaw/agents', |
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.
In `@packages/core/src/agents/types.ts` at line 230, ALL_AGENT_DISCOVERY_PATHS is
missing the new '.openclaw/agents' entry that was added to
AGENT_DISCOVERY_PATHS; update the ALL_AGENT_DISCOVERY_PATHS array to include
'.openclaw/agents' (maintain the array's alphabetical ordering) so the union
list matches AGENT_DISCOVERY_PATHS and discovery for the 'openclaw' agent works
correctly.
Summary
OpenClaw (formerly Clawdbot) is a local-first AI agent framework with a persistent gateway daemon. Clawdbot was rebranded to OpenClaw, but the existing
clawdbotadapter still uses the legacy.clawdbot/paths and doesn't support OpenClaw's extended SKILL.md frontmatter schema.This PR adds first-class
openclawas a new agent type with correct paths and extended frontmatter support.Changes
openclawagent type inAgentTypeenum and allRecord<AgentType, ...>typesOpenClawAdapter(packages/agents/src/openclaw.ts) with detection for~/.openclaw/+openclaw.jsonagent-config.ts:skills/dir (workspace root),~/.openclaw/skills/global,CLAUDE.mdconfig filepermissions,triggers,metadata,version,scan_exemptagents/and~/.openclaw/agents/.claude/commands/openclaw→skill-mdclawdbotadapter: legacy.clawdbot/detection only (no longer falsely detects OpenClaw workspaces as clawdbot)OpenClaw SKILL.md Frontmatter
OpenClaw skills use an extended YAML frontmatter schema beyond the standard
name+description:This enables
skillkit translate <skill> --to openclawto produce SKILL.md files compatible with the OpenClaw gateway runtime.Build verification
@skillkit/corebuilds successfully@skillkit/agentsbuilds successfullymain(not caused by this PR)Test plan
skillkit doctordetectsopenclawwhen~/.openclaw/existsskillkit translate <skill> --to openclawproduces output inskills/(not.clawdbot/skills/)skillkit translate <skill> --to clawdbotstill works for legacy usersopenclawchecked beforeclawdbot(prevents false positive)Summary by CodeRabbit
New Features
Improvements