fix(openclaw): align paths with upstream openclaw/openclaw conventions (#117)

* fix(openclaw): align paths with upstream openclaw/openclaw conventions

- skillsDir: 'skills' -> '.openclaw/skills' (match project-scoped convention)
- configFile: 'CLAUDE.md' -> 'AGENTS.md' (upstream uses AGENTS.md/SOUL.md)
- globalSkillsDir: '~/.openclaw/skills' -> '~/.openclaw/workspace/skills'
- altSkillsDirs: keep 'skills' for back-compat, add workspace variant
- isDetected: also check project .openclaw/ and global workspace/
- MCP AGENT_DIR_MAP: .openclaw/skills for runtime discovery
- README: reflect real paths

Refs NousResearch upstream layout; pairs with #114 Hermes support.

* fix(openclaw): address review findings for discovery + detection

- skills.ts: add '.openclaw/skills' to SKILL_DISCOVERY_PATHS (alphabetical)
- config.ts: getSearchDirs prefers globalSkillsDir for home path
  (was deriving from skillsDir, producing ~/.openclaw/skills instead
  of ~/.openclaw/workspace/skills)
- agent-config.ts: add altConfigFiles to AgentDirectoryConfig schema,
  set openclaw altConfigFiles: ['openclaw.json']
- context/sync.ts: detectAgents also iterates altConfigFiles so
  projects with only openclaw.json still detected
- mcp/tools.ts: AGENT_DIR_MAP includes '.openclaw/workspace/skills'
  for home-rooted global discovery
This commit is contained in:
Rohit Ghumare
2026-04-21 10:20:46 +01:00
committed by GitHub
parent 17e9720834
commit 1e7cad18c1
7 changed files with 30 additions and 10 deletions
+1 -1
View File
@@ -23,7 +23,7 @@ npm install @skillkit/agents
| Antigravity | SKILL.md | `.antigravity/skills/` | - |
| Amp | SKILL.md | `.amp/skills/` | - |
| Clawdbot | SKILL.md | `.clawdbot/skills/` | - |
| OpenClaw | SKILL.md | `skills/` | - |
| OpenClaw | SKILL.md | `.openclaw/skills/` | `~/.openclaw/workspace/skills/` |
| Cline | SKILL.md | `.cline/skills/` | - |
| CodeBuddy | SKILL.md | `.codebuddy/skills/` | - |
| CodeGPT | SKILL.md | `.codegpt/skills/` | - |
+4 -1
View File
@@ -14,9 +14,12 @@ export class OpenClawAdapter extends ClawdbotAdapter {
override readonly configFile = config.configFile;
override async isDetected(): Promise<boolean> {
const projectOpenClaw = join(process.cwd(), '.openclaw');
const globalOpenClaw = join(homedir(), '.openclaw');
const globalWorkspace = join(homedir(), '.openclaw', 'workspace');
const openclawConfig = join(process.cwd(), 'openclaw.json');
return existsSync(globalOpenClaw) || existsSync(openclawConfig);
return existsSync(projectOpenClaw) || existsSync(globalOpenClaw) ||
existsSync(globalWorkspace) || existsSync(openclawConfig);
}
}
+7 -4
View File
@@ -15,6 +15,8 @@ export interface AgentDirectoryConfig {
skillsDir: string;
/** Config file that references skills */
configFile: string;
/** Alternative config files that also mark this agent as present */
altConfigFiles?: string[];
/** Alternative skills directories */
altSkillsDirs?: string[];
/** Global skills directory */
@@ -121,10 +123,11 @@ export const AGENT_CONFIG: Record<AgentType, AgentDirectoryConfig> = {
},
openclaw: {
skillsDir: 'skills',
configFile: 'CLAUDE.md',
altSkillsDirs: ['~/.openclaw/skills'],
globalSkillsDir: '~/.openclaw/skills',
skillsDir: '.openclaw/skills',
configFile: 'AGENTS.md',
altConfigFiles: ['openclaw.json'],
altSkillsDirs: ['skills', '~/.openclaw/workspace/skills'],
globalSkillsDir: '~/.openclaw/workspace/skills',
configFormat: 'xml',
usesFrontmatter: true,
frontmatterFields: [
+11 -1
View File
@@ -4,6 +4,7 @@ import { homedir } from 'node:os';
import { createHash } from 'node:crypto';
import { parse as parseYaml, stringify as stringifyYaml } from 'yaml';
import { SkillkitConfig, LockFile, type AgentType, type SkillMetadata, type AgentAdapterInfo, type LockEntry } from './types.js';
import { AGENT_CONFIG } from './agent-config.js';
const CONFIG_FILE = 'skillkit.yaml';
const METADATA_FILE = '.skillkit.json';
@@ -99,7 +100,16 @@ export function getSearchDirs(adapter: AgentAdapterInfo): string[] {
dirs.push(join(process.cwd(), adapter.skillsDir));
dirs.push(join(process.cwd(), '.agent', 'skills'));
dirs.push(join(homedir(), adapter.skillsDir));
const globalDir = AGENT_CONFIG[adapter.type]?.globalSkillsDir;
if (globalDir) {
const resolved = globalDir.startsWith('~/')
? join(homedir(), globalDir.slice(2))
: globalDir;
dirs.push(resolved);
} else {
dirs.push(join(homedir(), adapter.skillsDir));
}
dirs.push(join(homedir(), '.agent', 'skills'));
return dirs;
+5 -2
View File
@@ -55,8 +55,11 @@ export class ContextSync {
const skillsPath = join(this.projectPath, config.skillsDir);
const configPath = join(this.projectPath, config.configFile);
// Check if either skills directory or config file exists
if (existsSync(skillsPath) || existsSync(configPath)) {
const altConfigExists = (config.altConfigFiles ?? []).some((alt) =>
existsSync(join(this.projectPath, alt))
);
if (existsSync(skillsPath) || existsSync(configPath) || altConfigExists) {
detected.push(agent as AgentType);
}
}
+1
View File
@@ -41,6 +41,7 @@ export const SKILL_DISCOVERY_PATHS = [
'.mux/skills',
'.neovate/skills',
'.opencode/skills',
'.openclaw/skills',
'.openhands/skills',
'.pi/skills',
'.playcode/skills',
+1 -1
View File
@@ -185,7 +185,7 @@ const AGENT_DIR_MAP: Record<string, string[]> = {
'claude-code': ['.claude/skills'], 'cursor': ['.cursor/skills'], 'codex': ['.codex/skills'],
'gemini-cli': ['.gemini/skills'], 'opencode': ['.opencode/skills', '.config/opencode/skills'],
'antigravity': ['.antigravity/skills'], 'amp': ['.amp/skills'], 'clawdbot': ['.clawdbot/skills'],
'openclaw': ['skills'], 'github-copilot': ['.github/skills'], 'goose': ['.goose/skills'],
'openclaw': ['.openclaw/skills', '.openclaw/workspace/skills', 'skills'], 'github-copilot': ['.github/skills'], 'goose': ['.goose/skills'],
'kilo': ['.kilocode/skills'], 'kiro-cli': ['.kiro/skills'], 'roo': ['.roo/skills'],
'trae': ['.trae/skills'], 'windsurf': ['.windsurf/skills', '.codeium/windsurf/skills'],
'universal': ['skills'], 'droid': ['.factory/skills'], 'factory': ['.factory/skills'],