feat: add OpenClaw agent adapter (Clawdbot rebrand)#96
feat: add OpenClaw agent adapter (Clawdbot rebrand)#96
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) - 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
|
The latest updates on your projects. Learn more about Vercel for GitHub. 2 Skipped Deployments
|
|
Caution Review failedThe pull request is closed. ℹ️ Recent review info⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (10)
📝 WalkthroughWalkthroughThis PR adds support for a new Changes
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~22 minutes Possibly related PRs
Poem
✨ 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 |
| 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, | ||
| }, |
There was a problem hiding this comment.
🔴 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.
Was this helpful? React with 👍 or 👎 to provide feedback.
Summary
Adds first-class
openclawagent support. Includes original commits from @austinmao (#86) with cleanup on top.Commits
feat: add OpenClaw agent adapter— @austinmao's original implementationfix: address PR review comments— @austinmao's review fixesrefactor: deduplicate, preserve legacy— cleanup passCleanup changes (commit 3)
OpenClawAdapterextendsClawdbotAdapterinstead of duplicating 80 lines.clawdbot/skills,AGENTS.md) — preserves legacy usersskills/,CLAUDE.md,~/.openclaw/, extended frontmatter)~/.openclaworopenclaw.json, Clawdbot checks~/.clawdbotorclawdbot.jsonTest Plan
pnpm --filter @skillkit/agents test— 189 tests passpnpm --filter @skillkit/core build— cleanpnpm --filter @skillkit/agents build— cleanCredit: @austinmao for the original implementation
Closes #86