Skip to content

Commit 1e7cad1

Browse files
authored
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
1 parent 17e9720 commit 1e7cad1

7 files changed

Lines changed: 30 additions & 10 deletions

File tree

packages/agents/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ npm install @skillkit/agents
2323
| Antigravity | SKILL.md | `.antigravity/skills/` | - |
2424
| Amp | SKILL.md | `.amp/skills/` | - |
2525
| Clawdbot | SKILL.md | `.clawdbot/skills/` | - |
26-
| OpenClaw | SKILL.md | `skills/` | - |
26+
| OpenClaw | SKILL.md | `.openclaw/skills/` | `~/.openclaw/workspace/skills/` |
2727
| Cline | SKILL.md | `.cline/skills/` | - |
2828
| CodeBuddy | SKILL.md | `.codebuddy/skills/` | - |
2929
| CodeGPT | SKILL.md | `.codegpt/skills/` | - |

packages/agents/src/openclaw.ts

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,9 +14,12 @@ export class OpenClawAdapter extends ClawdbotAdapter {
1414
override readonly configFile = config.configFile;
1515

1616
override async isDetected(): Promise<boolean> {
17+
const projectOpenClaw = join(process.cwd(), '.openclaw');
1718
const globalOpenClaw = join(homedir(), '.openclaw');
19+
const globalWorkspace = join(homedir(), '.openclaw', 'workspace');
1820
const openclawConfig = join(process.cwd(), 'openclaw.json');
1921

20-
return existsSync(globalOpenClaw) || existsSync(openclawConfig);
22+
return existsSync(projectOpenClaw) || existsSync(globalOpenClaw) ||
23+
existsSync(globalWorkspace) || existsSync(openclawConfig);
2124
}
2225
}

packages/core/src/agent-config.ts

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,8 @@ export interface AgentDirectoryConfig {
1515
skillsDir: string;
1616
/** Config file that references skills */
1717
configFile: string;
18+
/** Alternative config files that also mark this agent as present */
19+
altConfigFiles?: string[];
1820
/** Alternative skills directories */
1921
altSkillsDirs?: string[];
2022
/** Global skills directory */
@@ -121,10 +123,11 @@ export const AGENT_CONFIG: Record<AgentType, AgentDirectoryConfig> = {
121123
},
122124

123125
openclaw: {
124-
skillsDir: 'skills',
125-
configFile: 'CLAUDE.md',
126-
altSkillsDirs: ['~/.openclaw/skills'],
127-
globalSkillsDir: '~/.openclaw/skills',
126+
skillsDir: '.openclaw/skills',
127+
configFile: 'AGENTS.md',
128+
altConfigFiles: ['openclaw.json'],
129+
altSkillsDirs: ['skills', '~/.openclaw/workspace/skills'],
130+
globalSkillsDir: '~/.openclaw/workspace/skills',
128131
configFormat: 'xml',
129132
usesFrontmatter: true,
130133
frontmatterFields: [

packages/core/src/config.ts

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ import { homedir } from 'node:os';
44
import { createHash } from 'node:crypto';
55
import { parse as parseYaml, stringify as stringifyYaml } from 'yaml';
66
import { SkillkitConfig, LockFile, type AgentType, type SkillMetadata, type AgentAdapterInfo, type LockEntry } from './types.js';
7+
import { AGENT_CONFIG } from './agent-config.js';
78

89
const CONFIG_FILE = 'skillkit.yaml';
910
const METADATA_FILE = '.skillkit.json';
@@ -99,7 +100,16 @@ export function getSearchDirs(adapter: AgentAdapterInfo): string[] {
99100

100101
dirs.push(join(process.cwd(), adapter.skillsDir));
101102
dirs.push(join(process.cwd(), '.agent', 'skills'));
102-
dirs.push(join(homedir(), adapter.skillsDir));
103+
104+
const globalDir = AGENT_CONFIG[adapter.type]?.globalSkillsDir;
105+
if (globalDir) {
106+
const resolved = globalDir.startsWith('~/')
107+
? join(homedir(), globalDir.slice(2))
108+
: globalDir;
109+
dirs.push(resolved);
110+
} else {
111+
dirs.push(join(homedir(), adapter.skillsDir));
112+
}
103113
dirs.push(join(homedir(), '.agent', 'skills'));
104114

105115
return dirs;

packages/core/src/context/sync.ts

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -55,8 +55,11 @@ export class ContextSync {
5555
const skillsPath = join(this.projectPath, config.skillsDir);
5656
const configPath = join(this.projectPath, config.configFile);
5757

58-
// Check if either skills directory or config file exists
59-
if (existsSync(skillsPath) || existsSync(configPath)) {
58+
const altConfigExists = (config.altConfigFiles ?? []).some((alt) =>
59+
existsSync(join(this.projectPath, alt))
60+
);
61+
62+
if (existsSync(skillsPath) || existsSync(configPath) || altConfigExists) {
6063
detected.push(agent as AgentType);
6164
}
6265
}

packages/core/src/skills.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,7 @@ export const SKILL_DISCOVERY_PATHS = [
4141
'.mux/skills',
4242
'.neovate/skills',
4343
'.opencode/skills',
44+
'.openclaw/skills',
4445
'.openhands/skills',
4546
'.pi/skills',
4647
'.playcode/skills',

packages/mcp/src/tools.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -185,7 +185,7 @@ const AGENT_DIR_MAP: Record<string, string[]> = {
185185
'claude-code': ['.claude/skills'], 'cursor': ['.cursor/skills'], 'codex': ['.codex/skills'],
186186
'gemini-cli': ['.gemini/skills'], 'opencode': ['.opencode/skills', '.config/opencode/skills'],
187187
'antigravity': ['.antigravity/skills'], 'amp': ['.amp/skills'], 'clawdbot': ['.clawdbot/skills'],
188-
'openclaw': ['skills'], 'github-copilot': ['.github/skills'], 'goose': ['.goose/skills'],
188+
'openclaw': ['.openclaw/skills', '.openclaw/workspace/skills', 'skills'], 'github-copilot': ['.github/skills'], 'goose': ['.goose/skills'],
189189
'kilo': ['.kilocode/skills'], 'kiro-cli': ['.kiro/skills'], 'roo': ['.roo/skills'],
190190
'trae': ['.trae/skills'], 'windsurf': ['.windsurf/skills', '.codeium/windsurf/skills'],
191191
'universal': ['skills'], 'droid': ['.factory/skills'], 'factory': ['.factory/skills'],

0 commit comments

Comments
 (0)