Automatically discover and load documentation resources from .opencode subdirectories as native OpenCode tools
Transform your markdown documentation into instantly accessible OpenCode tools with intelligent search, dynamic discovery, and seamless integration.
Quick Start • Documentation • Contributing
🔍 Smart Discovery
- Three powerful discovery tools:
resource_list,resource_search,resource_info - Intelligent search with multi-word queries and relevance scoring
- 5-minute search caching for optimal performance
📦 Six Resource Types
- Agents: Specialized agent configurations
- Checklists: Step-by-step process guides
- Commands: Slash commands and workflows
- Knowledge Bases: Reference documentation
- Tasks: Task templates and workflows
- Templates: Reusable examples
🔄 Dynamic Tool Generation
- Automatic tool creation with pattern
{type}_{resource_name} - Example:
checklist_api_documentation,knowledge_base_jenkins_patterns
🌐 Multi-Location Support
- Project-local:
.opencode/(highest priority) - Global config:
~/.config/opencode/ - Global home:
~/.opencode/
🏷️ Rich Metadata
- YAML frontmatter support
- Categories and tags for organization
- Version tracking and related resources
⚡ Performance Optimized
- Fast in-memory indexing
- Cached search results
- Context-aware size management
Add the plugin to your OpenCode config:
{
"$schema": "https://opencode.ai/config.json",
"plugin": ["@pantheon-ai/opencode-resources-loader"]
}Organize your documentation in .opencode directories:
.opencode/
├── checklist/
│ └── api-documentation.md
├── knowledge-base/
│ └── best-practices.md
└── task/
└── deployment.md
// List all available resources
resource_list({ type: 'all' });
// Search for specific topics
resource_search({ query: 'api documentation' });
// Get detailed info
resource_info({ tool_name: 'checklist_api_documentation' });
// Load a resource directly
checklist_api_documentation();.opencode/
├── agent/ # Specialized agent configurations
├── checklist/ # Step-by-step checklists
├── command/ # Slash commands
├── knowledge-base/ # Reference documentation
├── task/ # Task templates
└── template/ # Reusable templates
---
description: Comprehensive API documentation checklist
type: checklist
category: Documentation
tags: [api, rest, graphql, documentation]
version: 1.0.0
---
# API Documentation Checklist
Your content here...Tools are automatically named from file paths:
| File Path | Generated Tool Name |
|---|---|
checklist/api-documentation.md |
checklist_api_documentation |
knowledge-base/jenkins-patterns.md |
knowledge_base_jenkins_patterns |
task/deployment/prod-deploy.md |
task_deployment_prod_deploy |
List and filter resources by type, category, or tags.
// List all checklists
resource_list({ type: 'checklist' });
// Filter by category
resource_list({ category: 'Documentation' });
// Filter by tag
resource_list({ tag: 'api' });Search with intelligent relevance scoring.
// Search across all fields
resource_search({ query: 'api documentation' });
// Search within specific type
resource_search({ query: 'deployment', type: 'task' });
// Limit results
resource_search({ query: 'security', max_results: 5 });Get detailed resource metadata.
// View full metadata and related resources
resource_info({ tool_name: 'checklist_api_documentation' });- Discovery: Runs once at initialization
- Search: < 100ms for 100+ resources
- Caching: 5-minute TTL for search results
- Memory: Efficient on-demand loading
The plugin helps manage context usage:
- Size Warnings: Resources > 30k characters show warnings
- Size Limits: Resources > 50k characters return errors
- Discovery First: Preview resources before loading with
resource_info - Load Incrementally: Start with 1-2 most relevant resources
- List:
resource_list({ type: 'checklist' }) - Search:
resource_search({ query: 'api security' }) - Check:
resource_info({ tool_name: 'checklist_api_security' }) - Load:
checklist_api_security()
Resources are discovered at plugin initialization. Restart OpenCode after adding new resources:
# Restart OpenCode to discover new resources
opencodeEnable/disable discovery tools in your OpenCode config:
{
"tools": {
"resource_list": true,
"resource_search": true,
"resource_info": true
}
}When duplicate tool names exist, priority is:
- Highest:
.opencode/(project-local) - Medium:
~/.config/opencode/(global config) - Lowest:
~/.opencode/(global home)
Project-local resources always override global ones.
- Full Documentation - Complete documentation site
- API Reference - Detailed API docs
- Architecture - System design
- Development Guide - Contributing guide
# Install dependencies
bun install
# Run tests
bun test
# Type checking
bun run type-check
# Linting
bun run lint
# Format code
bun run formatSee Development Guide for details.
- Check file extension is
.md - Verify directory structure matches expected layout
- Restart OpenCode to trigger re-discovery
- Check console for error messages
If you see warnings about duplicate tool names:
- Check for resources with same name in different locations
- Consider renaming one resource
- Remember: project-local resources take priority
- Verify markdown file is valid UTF-8
- Check file permissions are readable
- Look for console errors during initialization
- Ensure the file contains content
We welcome contributions! See our Contributing Guide for details.
Quick links:
- Issues - Report bugs or request features
- Discussions - Ask questions
- Pull Requests - Submit changes
MIT License - see LICENSE file for details.
- Issues: GitHub Issues
- Discussions: GitHub Discussions
- Documentation: GitHub Pages
Built with ❤️ for the OpenCode community