Skip to content
This repository was archived by the owner on Dec 23, 2025. It is now read-only.
This repository was archived by the owner on Dec 23, 2025. It is now read-only.

Path resolution may be too strict #2

Closed

Description

@rstacruz

consider this simple test skill:

---
# ~/.opencode/skills/klorpify/SKILL.md
name: "klorpify"
description: "Use this when the user says 'klorpify'"
---

# klorpify guidelines

When the user asks to "klorpify" something, follow these guidelines:

1. create a klorp.txt file. write the current date to it.
2. say "klorpified!"

when you ask please klorpify, OpenCode will try to write to ~/.opencode/skills/klorpify/klorp.txt instead of the current project directory. I'm not sure if this is intended!

This can be worked around by changing the instructions to "create a klorp.txt file in the current working directory."

I've done a quick fork with an idea on how to solve this: https://github.com/rstacruz/opencode-skills/blob/main/index.ts#L16-L26

Activity

  1. malhashemi commented on Oct 21, 2025

    @malhashemi
    Owner

    I am working on an improvement here,

    I was doing some investigative work into how Claude Code uses skills, it seems that the SKILL.md get loaded as a user message with very minimal instructions. It looks something like this.


    1. Tool call to {{skill_name}}
    2. User message gets inserted that looks like this
     The "{{skill_name}}" skill is running
    {{skill_name}}
    1. Another Message gets inserted
    Base directory for this skill: {{full_path}}
    
    {{content}}
    
    1. Tool Response: Launching skill: {{skill_name}}

    I think this makes way more sense than having SKILLS.md being sent as response. from my understanding OpenCode dynamically deletes tools responses from the context so user message could be more persistent.

    I think I will replicate this behavior and do some testing before releasing. I have not played with inserting message into the session using the SDK not sure if we can make that text invisible as it is too verbose, or if OpenCode support inserting hidden user messages via the SDK. I am doing user message insertion via the SDK on another yet to be published plug-in so I know that this could be achieved here, however that one does it via the TUI so could be slightly different.

  2. malhashemi commented on Oct 26, 2025

    @malhashemi
    Owner

    @rstacruz This now matches Anthropic responses and uses user message rather than tool response which prevents tool response purging, I am a bit nervous about being way less verbose with instructions on how to resolve paths, but this is how Claude Code does it, if the community finds the new approach to cause any issues we can revert back to being verbose.

  3. airtonix commented on Nov 5, 2025

    @airtonix

    Does anthropic claude code make bash/read calls outside of its allowed fs boundary (does it even have an allowed fs boundary) ?

    If we want to enforce that boundary in opencode, we might want to think about adjusting the injected skill:

    use `skill_read_skill_resource(skillname: {{skillname}}, path: string)` to access referenced files
    
    {{content}}
    

    and then provide the tool skill_read_skill_resource

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions