Skip to content

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

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

feat: add OpenClaw agent adapter (Clawdbot rebrand)#96
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. Includes original commits from @austinmao (#86) with cleanup on top.

Commits

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

Cleanup changes (commit 3)

  • OpenClawAdapter extends ClawdbotAdapter instead of duplicating 80 lines
  • 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 checks ~/.openclaw or openclaw.json, Clawdbot checks ~/.clawdbot or clawdbot.json
  • Tests updated: adapter count 44→45, detection assertions fixed

Test Plan

  • pnpm --filter @skillkit/agents test — 189 tests pass
  • pnpm --filter @skillkit/core build — clean
  • pnpm --filter @skillkit/agents build — clean
  • TUI build failure is pre-existing on main

Credit: @austinmao for the original implementation
Closes #86

Lumina Mao and others added 3 commits April 7, 2026 10:47
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)
- Clawdbot keeps legacy paths (.clawdbot/skills, AGENTS.md) for backward compat
- OpenClaw uses new paths (skills/, CLAUDE.md, ~/.openclaw/)
- OpenClaw detection: ~/.openclaw or openclaw.json
- Clawdbot detection: ~/.clawdbot or clawdbot.json (no longer checks skills/)
- Update tests: adapter count 44→45, fix detection path 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 9:54am
skillkit-docs Ignored Ignored Apr 7, 2026 9:54am

@coderabbitai
Copy link
Copy Markdown

coderabbitai bot commented Apr 7, 2026

Caution

Review failed

The pull request is closed.

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: deb6a11b-d7ca-485d-a667-623d164b1392

📥 Commits

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

📒 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

📝 Walkthrough

Walkthrough

This PR adds support for a new openclaw agent type by introducing the OpenClawAdapter class (extending ClawdbotAdapter), updating agent configuration and type definitions, and refining ClawdbotAdapter's detection logic. It includes corresponding configuration entries, discovery path mappings, and test adjustments.

Changes

Cohort / File(s) Summary
Test Updates
packages/agents/src/__tests__/adapters.test.ts, packages/agents/src/__tests__/clawdbot.test.ts
Updated adapter count assertion from 44 to 45; removed test cases validating local "skills" directory detection in ClawdbotAdapter.
Core Adapter Logic
packages/agents/src/clawdbot.ts, packages/agents/src/openclaw.ts, packages/agents/src/index.ts
Added OpenClawAdapter class extending ClawdbotAdapter with openclaw-specific properties and detection logic; refined ClawdbotAdapter with explicit type annotations (:string for name, skillsDir, configFile) and narrowed isDetected() to exclude workspace-local "skills" directory check; registered openclaw adapter in agent registry and detection order.
Agent Configuration
packages/core/src/agent-config.ts
Extended clawdbot.altSkillsDirs to include ~/.clawdbot/skills; added new openclaw configuration with skillsDir, configFile, altSkillsDirs, globalSkillsDir, XML format support, frontmatter fields, and auto-discovery enabled.
Type & Discovery Definitions
packages/core/src/types.ts, packages/core/src/agents/types.ts, packages/core/src/translator/types.ts
Added 'openclaw' to AgentType enum; extended AGENT_DISCOVERY_PATHS, ALL_AGENT_DISCOVERY_PATHS, and CUSTOM_AGENT_FORMAT_MAP to include openclaw mappings; added openclaw entry to AGENT_FORMAT_MAP.
Command Generator
packages/core/src/commands/generator.ts
Added openclaw entry to AGENT_FORMATS mapping with markdown command file extension and .claude/commands target directory.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~22 minutes

Possibly related PRs

Poem

🐰 A new agent hops into the ring,
OpenClaw spreads its wings,
Detection narrowed, types now clear,
Configuration configs appear! ✨
Five adapters became ten today,
Hopping forward in every way!

✨ 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.

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

Comment on lines +123 to +135
openclaw: {
skillsDir: 'skills',
configFile: 'CLAUDE.md',
altSkillsDirs: ['~/.openclaw/skills'],
globalSkillsDir: '~/.openclaw/skills',
configFormat: 'xml',
usesFrontmatter: true,
frontmatterFields: [
'name', 'description', 'version', 'scan_exempt',
'permissions', 'triggers', 'metadata',
],
supportsAutoDiscovery: true,
},
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🔴 Missing openclaw in MethodologyManager's hardcoded agent directories causes throw on skill sync

The PR adds openclaw as a new AgentType and registers it in most agent maps, but fails to update the hardcoded agentDirs record inside MethodologyManager.writeSkillToAgent() at packages/core/src/methodology/manager.ts:510-528. When writeSkillToAgent is called with agent='openclaw', the lookup agentDirs[agent] returns undefined, causing line 531-532 to throw "Unknown agent: openclaw". This breaks methodology skill syncing for the openclaw agent.

Affected hardcoded list in manager.ts

Additionally, detectAgents() at packages/core/src/methodology/manager.ts:556-575 has a similar hardcoded list that also lacks openclaw, so the methodology manager won't auto-detect openclaw and won't include it in automatic sync operations.

Prompt for agents
The new 'openclaw' agent type was added to AgentType, AGENT_CONFIG, and most agent registries, but was not added to the hardcoded agent directory mappings in packages/core/src/methodology/manager.ts. Two places need updating:

1. writeSkillToAgent() (line ~510-528): The agentDirs Record needs an entry for openclaw. Based on AGENT_CONFIG.openclaw.skillsDir being 'skills', add: openclaw: 'skills'

2. detectAgents() (line ~556-575): The agentDirs array needs an entry for openclaw. Based on the .openclaw directory convention, add: ['openclaw', '.openclaw']

Both of these are in the MethodologyManager class in packages/core/src/methodology/manager.ts. Without these additions, methodology skill syncing will throw an error for the openclaw agent, and openclaw won't be auto-detected for methodology syncing.
Open in Devin Review

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

@rohitg00 rohitg00 changed the title feat: add OpenClaw agent adapter (cleaned up from #86) feat: add OpenClaw agent adapter (Clawdbot rebrand) 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