Dax Raad 4 months ago
parent
commit
b5a710c9b2

+ 1 - 5
packages/opencode/src/session/prompt.ts

@@ -532,11 +532,7 @@ export namespace SessionPrompt {
         agent,
         abort,
         sessionID,
-        system: [
-          ...(await SystemPrompt.environment()),
-          ...(tools.skill ? await SystemPrompt.skills(agent.name) : []),
-          ...(await SystemPrompt.custom()),
-        ],
+        system: [...(await SystemPrompt.environment()), ...(await SystemPrompt.custom())],
         messages: [
           ...MessageV2.toModelMessage(sessionMessages),
           ...(isLastStep

+ 0 - 39
packages/opencode/src/session/system.ts

@@ -14,7 +14,6 @@ import PROMPT_POLARIS from "./prompt/polaris.txt"
 import PROMPT_BEAST from "./prompt/beast.txt"
 import PROMPT_GEMINI from "./prompt/gemini.txt"
 import PROMPT_ANTHROPIC_SPOOF from "./prompt/anthropic_spoof.txt"
-import PROMPT_COMPACTION from "./prompt/compaction.txt"
 
 import PROMPT_CODEX from "./prompt/codex.txt"
 import type { Provider } from "@/provider/provider"
@@ -118,42 +117,4 @@ export namespace SystemPrompt {
     )
     return Promise.all(found).then((result) => result.filter(Boolean))
   }
-
-  export async function skills(agentName?: string) {
-    const all = await Skill.all()
-    if (all.length === 0) return []
-
-    // Filter skills by agent permission if agent name provided
-    let filtered = all
-    if (agentName) {
-      const { Agent } = await import("../agent/agent")
-      const { Wildcard } = await import("../util/wildcard")
-      const agent = await Agent.get(agentName)
-      if (agent) {
-        const permissions = agent.permission.skill
-        filtered = all.filter((skill) => {
-          const action = Wildcard.all(skill.id, permissions)
-          return action !== "deny"
-        })
-      }
-    }
-
-    if (filtered.length === 0) return []
-
-    const lines = [
-      "You have access to skills listed in `<available_skills>`. When a task matches a skill's description, use the skill tool to load detailed instructions.",
-      "",
-      "<available_skills>",
-    ]
-    for (const skill of filtered) {
-      lines.push("  <skill>")
-      lines.push(`    <id>${skill.id}</id>`)
-      lines.push(`    <name>${skill.name}</name>`)
-      lines.push(`    <description>${skill.description}</description>`)
-      lines.push("  </skill>")
-    }
-    lines.push("</available_skills>")
-
-    return [lines.join("\n")]
-  }
 }

+ 0 - 45
packages/opencode/test/skill/skill.test.ts

@@ -101,51 +101,6 @@ test("returns empty array when no skills exist", async () => {
   })
 })
 
-test("SystemPrompt.skills() returns empty array when no skills", async () => {
-  await using tmp = await tmpdir({ git: true })
-
-  await Instance.provide({
-    directory: tmp.path,
-    fn: async () => {
-      const result = await SystemPrompt.skills()
-      expect(result).toEqual([])
-    },
-  })
-})
-
-test("SystemPrompt.skills() returns XML block with skills", async () => {
-  await using tmp = await tmpdir({
-    git: true,
-    init: async (dir) => {
-      const skillDir = path.join(dir, ".opencode", "skill", "example-skill")
-      await Bun.write(
-        path.join(skillDir, "SKILL.md"),
-        `---
-name: example-skill
-description: An example skill for testing XML output.
----
-
-# Example
-`,
-      )
-    },
-  })
-
-  await Instance.provide({
-    directory: tmp.path,
-    fn: async () => {
-      const result = await SystemPrompt.skills()
-      expect(result.length).toBe(1)
-      expect(result[0]).toContain("<available_skills>")
-
-      expect(result[0]).toContain("<name>example-skill</name>")
-      expect(result[0]).toContain("<description>An example skill for testing XML output.</description>")
-      expect(result[0]).toContain("</available_skills>")
-      expect(result[0]).toContain("use the skill tool")
-    },
-  })
-})
-
 // test("discovers skills from .claude/skills/ directory", async () => {
 //   await using tmp = await tmpdir({
 //     git: true,