Skip to content

Shared task board where people and AI coding agents work as teammates. Source-available, self-hostable.

Go

fix(execenv): fall back OpenClaw skills to .agent_context/skills/ and stop claiming native auto-discovery (#2621)

Bohan Jiangf82a6adde9a2
diff --git a/server/internal/daemon/execenv/context.go b/server/internal/daemon/execenv/context.go
index dfac6066fb..39efbad4fc 100644
--- a/server/internal/daemon/execenv/context.go
+++ b/server/internal/daemon/execenv/context.go
@@ -16,6 +16,7 @@ import (
// Codex: skills → handled separately in Prepare via codex-home
// Copilot: skills → {workDir}/.github/skills/{name}/SKILL.md (native project-level discovery)
// OpenCode: skills → {workDir}/.opencode/skills/{name}/SKILL.md (native discovery)
+// OpenClaw: skills → {workDir}/.agent_context/skills/{name}/SKILL.md (NO native auto-discovery — see note in resolveSkillsDir)
// Pi: skills → {workDir}/.pi/skills/{name}/SKILL.md (native discovery)
// Cursor: skills → {workDir}/.cursor/skills/{name}/SKILL.md (native discovery)
// Kimi: skills → {workDir}/.kimi/skills/{name}/SKILL.md (native discovery)
diff --git a/server/internal/daemon/execenv/execenv_test.go b/server/internal/daemon/execenv/execenv_test.go
index 375ebd334c..9a2e11c1f1 100644
--- a/server/internal/daemon/execenv/execenv_test.go
+++ b/server/internal/daemon/execenv/execenv_test.go
@@ -802,6 +802,54 @@ func TestWriteContextFilesOpencodeNativeSkills(t *testing.T) {
}
}
+// OpenClaw scans its own workspaceDir (resolved from the openclaw config,
+// not the task workdir) and never reads {workDir}/.openclaw/skills/. Until
+// per-task workspace integration lands, openclaw skills fall back to
+// .agent_context/skills/ — the meta AGENTS.md content references that path
+// explicitly. This test fails closed if someone re-adds a dead-drop case to
+// resolveSkillsDir.
+func TestWriteContextFilesOpenclawFallsBackToAgentContext(t *testing.T) {
+ t.Parallel()
+ dir := t.TempDir()
+
+ ctx := TaskContextForEnv{
+ IssueID: "openclaw-skill-test",
+ AgentSkills: []SkillContextForEnv{
+ {
+ Name: "Go Conventions",
+ Content: "Follow Go conventions.",
+ Files: []SkillFileContextForEnv{
+ {Path: "templates/example.go", Content: "package main"},
+ },
+ },
+ },
+ }
+
+ if err := writeContextFiles(dir, "openclaw", ctx); err != nil {
+ t.Fatalf("writeContextFiles failed: %v", err)
+ }
+
+ skillMd, err := os.ReadFile(filepath.Join(dir, ".agent_context", "skills", "go-conventions", "SKILL.md"))
+ if err != nil {
+ t.Fatalf("failed to read .agent_context/skills/go-conventions/SKILL.md: %v", err)
+ }
+ if !strings.Contains(string(skillMd), "Follow Go conventions.") {
+ t.Error("SKILL.md missing content")
+ }
+
+ supportFile, err := os.ReadFile(filepath.Join(dir, ".agent_context", "skills", "go-conventions", "templates", "example.go"))
+ if err != nil {
+ t.Fatalf("failed to read supporting file: %v", err)
+ }
+ if string(supportFile) != "package main" {
+ t.Errorf("supporting file content = %q, want %q", string(supportFile), "package main")
+ }
+
+ if _, err := os.Stat(filepath.Join(dir, ".openclaw", "skills")); !os.IsNotExist(err) {
+ t.Error(".openclaw/skills/ MUST NOT be written — openclaw never scans that path; writing there is a dead drop")
+ }
+}
+
func TestWriteContextFilesKiroNativeSkills(t *testing.T) {
t.Parallel()
dir := t.TempDir()
diff --git a/server/internal/daemon/execenv/runtime_config.go b/server/internal/daemon/execenv/runtime_config.go
index c8df869000..5c60e509b3 100644
--- a/server/internal/daemon/execenv/runtime_config.go
+++ b/server/internal/daemon/execenv/runtime_config.go
@@ -56,7 +56,7 @@ func formatProjectResource(r ProjectResourceForEnv) string {
// For Codex: writes {workDir}/AGENTS.md (skills discovered natively via CODEX_HOME)
// For Copilot: writes {workDir}/AGENTS.md (skills discovered natively from .github/skills/)
// For OpenCode: writes {workDir}/AGENTS.md (skills discovered natively from .opencode/skills/)
-// For OpenClaw: writes {workDir}/AGENTS.md (skills discovered natively from .openclaw/skills/)
+// For OpenClaw: writes {workDir}/AGENTS.md (skills fall back to .agent_context/skills/; OpenClaw does not auto-discover from workdir)
// For Hermes: writes {workDir}/AGENTS.md (skills fall back to .agent_context/skills/; AGENTS.md points there)
// For Gemini: writes {workDir}/GEMINI.md (discovered natively by the Gemini CLI)
// For Pi: writes {workDir}/AGENTS.md (skills discovered natively from .pi/skills/)
@@ -305,12 +305,15 @@ func buildMetaSkillContent(provider string, ctx TaskContextForEnv) string {
case "claude":
// Claude discovers skills natively from .claude/skills/ — just list names.
b.WriteString("You have the following skills installed (discovered automatically):\n\n")
- case "codex", "copilot", "opencode", "openclaw", "pi", "cursor", "kimi", "kiro":
- // Codex, Copilot, OpenCode, OpenClaw, Pi, Cursor, Kimi, and Kiro discover skills natively from their respective paths — just list names.
+ case "codex", "copilot", "opencode", "pi", "cursor", "kimi", "kiro":
+ // Codex, Copilot, OpenCode, Pi, Cursor, Kimi, and Kiro discover skills natively from their respective paths — just list names.
b.WriteString("You have the following skills installed (discovered automatically):\n\n")
- case "gemini", "hermes":
- // Gemini reads GEMINI.md directly; Hermes has no native skills discovery path
- // wired up in resolveSkillsDir, so both fall back to .agent_context/skills/.
+ case "gemini", "hermes", "openclaw":
+ // Gemini reads GEMINI.md directly. Hermes has no native skills discovery
+ // path wired up in resolveSkillsDir. OpenClaw scans its own workspaceDir
+ // (resolved from the openclaw config, not the task workdir) so per-task
+ // skills written by Multica are not visible to its native loader; we
+ // fall back to .agent_context/skills/ and reference the files explicitly.
b.WriteString("Detailed skill instructions are in `.agent_context/skills/`. Each subdirectory contains a `SKILL.md`.\n\n")
default:
b.WriteString("Detailed skill instructions are in `.agent_context/skills/`. Each subdirectory contains a `SKILL.md`.\n\n")