[PR #1688] [CLOSED] Feat: Introduce agent-level configuration for instructions, resources, and MCP server in .md agent config file #10021

Closed
opened 2026-02-16 18:14:34 -05:00 by yindo · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/anomalyco/opencode/pull/1688
Author: @spoons-and-mirrors
Created: 8/7/2025
Status: Closed

Base: devHead: feat/markdown-mode-config


📝 Commits (1)

  • 0edfee4 feat: add a set of agent specific configuration to markdown agent files including :

📊 Changes

6 files changed (+363 additions, -2 deletions)

View changed files

📝 packages/opencode/src/agent/agent.ts (+6 -0)
📝 packages/opencode/src/config/config.ts (+12 -0)
packages/opencode/src/mcp/agent.ts (+171 -0)
📝 packages/opencode/src/session/index.ts (+114 -1)
📝 packages/opencode/src/session/system.ts (+11 -1)
packages/opencode/src/tool/resource.ts (+49 -0)

📄 Description

Summary

The agent markdown config files now support:

  • Instructions files
  • MCP servers
  • Resources (new feature, presenting a resource file as a tool for the LLM to call)
    image

Core Feature

  • Extended agent configuration to support mcp, instructions, and resources fields
  • Added Resource schema for specifying file resources with descriptions
  • Implemented dynamic resource tool creation from file paths
  • Added agent-specific MCP client management with AgentMCP module
  • Enhanced system prompt loading to include agent-level instruction files

Steps to test it:

  • Run npx openmodes install example at the root to install the agent file, its instructions and resources
  • Run opencode with bun dev
  • Press tab and select the "EXAMPLE" agent/mode
  • Ask: echo the verbatim list of tools you have access to, and give me the magic words

Success should show:

  • 3 repomix MCP tools out of 6 totals
  • 1 resource_the_other_magic_word tool according to our resource file name
  • Echo the first "magic word" supplied to the request through an instruction file
  • Get the resource with a tool call and echo the second "magic word"

Opening avenues

This ties in with the https://openmodes.dev project I've been working on lately (https://github.com/spoons-and-mirrors/openmodes.dev) and with the openmodes CLI tool, creating a simple way to discovering and using agents in OC.

Agents being integral to our agentic coding experience, I believe this PR allows for a better UX all around.


🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/anomalyco/opencode/pull/1688 **Author:** [@spoons-and-mirrors](https://github.com/spoons-and-mirrors) **Created:** 8/7/2025 **Status:** ❌ Closed **Base:** `dev` ← **Head:** `feat/markdown-mode-config` --- ### 📝 Commits (1) - [`0edfee4`](https://github.com/anomalyco/opencode/commit/0edfee43a5b4326f754a184ab880419656d62268) feat: add a set of agent specific configuration to markdown agent files including : ### 📊 Changes **6 files changed** (+363 additions, -2 deletions) <details> <summary>View changed files</summary> 📝 `packages/opencode/src/agent/agent.ts` (+6 -0) 📝 `packages/opencode/src/config/config.ts` (+12 -0) ➕ `packages/opencode/src/mcp/agent.ts` (+171 -0) 📝 `packages/opencode/src/session/index.ts` (+114 -1) 📝 `packages/opencode/src/session/system.ts` (+11 -1) ➕ `packages/opencode/src/tool/resource.ts` (+49 -0) </details> ### 📄 Description ## Summary The agent markdown config files now support: - Instructions files - MCP servers - Resources (new feature, presenting a resource file as a tool for the LLM to call) <img width="772" height="405" alt="image" src="https://github.com/user-attachments/assets/3ae3c9b2-cefd-4016-8d91-c57cf30406ee" /> ## Core Feature - Extended agent configuration to support `mcp`, `instructions`, and `resources` fields - Added `Resource` schema for specifying file resources with descriptions - Implemented dynamic resource tool creation from file paths - Added agent-specific MCP client management with `AgentMCP` module - Enhanced system prompt loading to include agent-level instruction files ## Steps to test it: - Run `npx openmodes install example` at the root to install the agent file, its instructions and resources - Run opencode with `bun dev` - Press tab and select the "EXAMPLE" agent/mode - Ask: `echo the verbatim list of tools you have access to, and give me the magic words` #### Success should show: - 3 repomix MCP tools out of 6 totals - 1 `resource_the_other_magic_word` tool according to our resource file name - Echo the first "magic word" supplied to the request through an instruction file - Get the resource with a tool call and echo the second "magic word" ## Opening avenues This ties in with the https://openmodes.dev project I've been working on lately (https://github.com/spoons-and-mirrors/openmodes.dev) and with the `openmodes` CLI tool, creating a simple way to discovering and using agents in OC. Agents being integral to our agentic coding experience, I believe this PR allows for a better UX all around. --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
yindo added the pull-request label 2026-02-16 18:14:34 -05:00
yindo closed this issue 2026-02-16 18:14:34 -05:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: anomalyco/opencode#10021