Skip to content

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

Open
austinmao wants to merge 1 commit intorohitg00:mainfrom
austinmao:feat/openclaw-agent-adapter
Open

feat: add OpenClaw agent adapter (Clawdbot rebrand)#86
austinmao wants to merge 1 commit intorohitg00:mainfrom
austinmao:feat/openclaw-agent-adapter

Conversation

@austinmao
Copy link

@austinmao austinmao commented Mar 22, 2026

Summary

OpenClaw (formerly Clawdbot) is a local-first AI agent framework with a persistent gateway daemon. Clawdbot was rebranded to OpenClaw, but the existing clawdbot adapter still uses the legacy .clawdbot/ paths and doesn't support OpenClaw's extended SKILL.md frontmatter schema.

This PR adds first-class openclaw as a new agent type with correct paths and extended frontmatter support.

Changes

  • New openclaw agent type in AgentType enum and all Record<AgentType, ...> types
  • New OpenClawAdapter (packages/agents/src/openclaw.ts) with detection for ~/.openclaw/ + openclaw.json
  • OpenClaw agent config in agent-config.ts: skills/ dir (workspace root), ~/.openclaw/skills/ global, CLAUDE.md config file
  • Extended frontmatter fields: permissions, triggers, metadata, version, scan_exempt
  • Agent dirs: agents/ and ~/.openclaw/agents/
  • Command format: .claude/commands/
  • Translator format map: openclawskill-md
  • Simplified clawdbot adapter: 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:

---
name: skill-name
description: "Trigger phrase for routing"
version: "1.0.0"
permissions:
  filesystem: none  # none | read | write
  network: false    # true | false
triggers:
  - command: /skill-name
metadata:
  openclaw:
    requires:
      bins: ["jq", "curl"]
      env: ["MY_API_KEY"]
      os: ["darwin", "linux"]
---

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

Build verification

  • @skillkit/core builds successfully
  • @skillkit/agents builds successfully
  • TUI build error is pre-existing on main (not caused by this PR)

Test plan

  • skillkit doctor detects openclaw when ~/.openclaw/ exists
  • skillkit translate <skill> --to openclaw produces output in skills/ (not .clawdbot/skills/)
  • skillkit translate <skill> --to clawdbot still works for legacy users
  • Detection priority: openclaw checked before clawdbot (prevents false positive)

Open with Devin

Summary by CodeRabbit

  • New Features

    • Added OpenClaw agent support with automatic workspace detection
    • OpenClaw can now discover and manage skills with configuration support
    • Updated skill file support and discovery paths for improved compatibility
  • Improvements

    • Refined agent detection logic for more accurate workspace identification

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
@vercel
Copy link

vercel bot commented Mar 22, 2026

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.

@coderabbitai
Copy link

coderabbitai bot commented Mar 22, 2026

📝 Walkthrough

Walkthrough

A 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

Cohort / File(s) Summary
Core Type System
packages/core/src/types.ts
Extended AgentType enum to include 'openclaw' as a valid agent type.
Agent Adapter Implementations
packages/agents/src/clawdbot.ts, packages/agents/src/openclaw.ts
Narrowed Clawdbot detection to check only ~/.clawdbot and clawdbot.json; added new OpenClawAdapter implementing full agent adapter interface with XML skill generation, configuration parsing, command invocation, and detection logic supporting project-root and global OpenClaw directories.
Agent Registry & Detection
packages/agents/src/index.ts
Registered OpenClawAdapter in adapters registry, exported OpenClaw module, and added 'openclaw' to detection order for agent discovery.
Agent Configuration
packages/core/src/agent-config.ts
Updated Clawdbot config with new skillsDir: 'skills', configFile: 'CLAUDE.md', expanded altSkillsDirs, and added frontmatter field definitions; added new OpenClaw configuration mirroring Clawdbot settings with OpenClaw-specific paths and global skills directory.
Agent Discovery & Formats
packages/core/src/agents/types.ts, packages/core/src/commands/generator.ts, packages/core/src/translator/types.ts
Added OpenClaw entries to AGENT_DISCOVERY_PATHS, CUSTOM_AGENT_FORMAT_MAP, AGENT_FORMATS, and AGENT_FORMAT_MAP with appropriate directory and format category mappings.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~22 minutes

Possibly related PRs

Poem

🐰 A new agent hops into the field,
OpenClaw joins with skills revealed,
Detection paths and configs aligned,
Clawdbot refined, fresh paths to find! 🌿

🚥 Pre-merge checks | ✅ 2 | ❌ 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 (2 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title accurately and clearly summarizes the main change: adding OpenClaw agent adapter support with context that it's a Clawdbot rebrand.

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

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

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.

Tip

You can customize the tone of the review comments and chat replies.

Configure the tone_instructions setting to customize the tone of the review comments and chat replies. For example, you can set the tone to Act like a strict teacher, Act like a pirate and more.

Copy link

@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 2 potential issues.

View 3 additional findings in Devin Review.

Open in Devin Review

Choose a reason for hiding this comment

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

🔴 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',
Open in Devin Review

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

Comment on lines +97 to +102
return (
(existsSync(projectSkills) && existsSync(globalOpenClaw)) ||
existsSync(openclawConfig) ||
existsSync(globalClawdbot) ||
existsSync(clawdbotConfig)
);

Choose a reason for hiding this comment

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

🔴 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);
Open in Devin Review

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

Copy link

@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: 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

📥 Commits

Reviewing files that changed from the base of the PR and between 5691b10 and 3509b74.

📒 Files selected for processing (8)
  • 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

Comment on lines +86 to +103
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)
);
}
Copy link

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟠 Major

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'],
Copy link

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟡 Minor

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.

Suggested change
'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.

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