Skip to content

[FEATURE]: File-specific skill auto-loading and protected context buffer for skills and AGENTS.md #37629

Closed as not planned

Description

@devZu9

Checklist

  • I have searched the existing issues and confirmed this is not a duplicate

Problem

When using OpenCode in long sessions, two issues make Agent Skills (SKILL.md) and AGENTS.md unreliable:

1. Skills are not automatically applied to specific files

A skill like session-log defines how ROADMAP.md, SESSIONS.md, CHANGELOG.md, and SUMMARY.md should be formatted. But the agent has no mechanism to detect that a target file has an associated skill, load it automatically, and apply its rules. The skill exists but is often ignored because the agent forgets to load it before editing the file.

2. Skills and AGENTS.md are evicted during context compaction

When the context fills up and triggers compaction, loaded skill content and AGENTS.md rules are lost from the active context. The agent continues working as if no rules exist — ignoring formatting, conventions, and workflow instructions.

Suggested solution

A. File-to-Skill mapping

Associate files with skills so the agent loads the skill automatically before editing:

{
  "skills": {
    "file_map": {
      "ROADMAP.md": "session-log",
      "SESSIONS.md": "session-log",
      "CHANGELOG.md": "session-log",
      "*.rs": "rust-api-first",
      "docs/**/*.md": "docs-only"
    }
  }
}

B. Protected context buffer for skills and AGENTS.md

Introduce a protected memory region that compaction cannot evict:

{
  "compaction": {
    "protected": {
      "AGENTS.md": true,
      "skills": true
    }
  }
}

This ensures the agent always has access to project rules regardless of session length.

Activity

  1. github-actions commented on Jul 18, 2026

    @github-actions
    Contributor

    This issue doesn't fully meet our contributing guidelines.

    What needs to be fixed:

    • This appears to be a feature request, but the title does not start with [FEATURE]: as required by the feature request template.
    • The feature request template requires a verification checkbox confirming you searched existing issues. Please use the proper template so all required fields are present.

    Please edit this issue to address the above within 2 hours, or it will be automatically closed.


    This issue might be a duplicate of existing issues. Please check:

    If you believe this was flagged incorrectly, please let a maintainer know.

  2. changed the title [-]File-specific skill auto-loading and protected context buffer for skills/rules[/-] [+][FEATURE]: File-specific skill auto-loading and protected context buffer for skills and AGENTS.md[/+] on Jul 18, 2026
  3. github-actions commented on Jul 18, 2026

    @github-actions
    Contributor

    Thanks for updating the issue! It now follows our contributing guidelines and looks great. We appreciate you taking the time to clarify the problem and proposed solution.

  4. github-actions commented on Jul 18, 2026

    @github-actions
    Contributor

    Thanks for updating the issue! It now follows our contributing guidelines. We appreciate you taking the time to address the feedback.

  5. github-actions commented on Sep 18, 2026

    @github-actions
    Contributor

    To stay organized issues are automatically closed after 60 days of no activity. If the issue is still relevant please open a new one.

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

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions