838b5ae216
Update root + 43 directory-level AGENTS.md files to reflect current state: - Root AGENTS.md rewritten with accurate counts (1967 TS files, 1304 source + 663 test, 278k LOC, 120 barrel index.ts), 7-step init flow, 5-tier hook composition, and full Team Mode section (12 team_* tools, eligibility, storage layout, config gate) - src/AGENTS.md adds team-mode init step, current per-subdir file/LOC table - src/tools/AGENTS.md documents conditional gates (team-mode +12, task system +4, hashline +1, interactive_bash +1, look_at +1) with always-on baseline of 20 - src/hooks/AGENTS.md splits into 5 tiers + 4 conditional team-mode hooks - src/features/team-mode/AGENTS.md surfaces 12 tools, eligible agents, spawn-race-safe invariants, and integration points - src/features/builtin-skills/AGENTS.md tracks 10 skills incl. team-mode - src/agents/AGENTS.md, src/plugin/AGENTS.md, src/config/AGENTS.md updated for team-mode awareness, accurate counts, and current schema field list - All other AGENTS.md files refreshed to 2026-05-08 generation date
1.8 KiB
1.8 KiB
src/features/opencode-skill-loader/ — 4-Scope Skill Discovery
Generated: 2026-05-08
OVERVIEW
28 files (~3.2k LOC). Discovers, parses, merges, and resolves SKILL.md files from 4 scopes with priority deduplication.
4-SCOPE PRIORITY (highest → lowest)
1. Project (.opencode/skills/)
2. OpenCode config (~/.config/opencode/skills/)
3. User (~/.config/opencode/oh-my-opencode/skills/)
4. Global (built-in skills)
Same-named skill at higher scope overrides lower.
KEY FILES
| File | Purpose |
|---|---|
loader.ts |
Main loadSkills() — orchestrates discovery → parse → merge |
async-loader.ts |
Async variant for non-blocking skill loading |
blocking.ts |
Sync variant for initial load |
merger.ts |
Priority-based deduplication across scopes |
skill-content.ts |
YAML frontmatter parsing from SKILL.md |
skill-discovery.ts |
Find SKILL.md files in directory trees |
skill-directory-loader.ts |
Load all skills from a single directory |
config-source-discovery.ts |
Discover scope directories from config |
skill-template-resolver.ts |
Variable substitution in skill templates |
skill-mcp-config.ts |
Extract MCP configs from skill YAML |
types.ts |
LoadedSkill, SkillScope, SkillDiscoveryResult |
SKILL FORMAT (SKILL.md)
---
name: my-skill
description: What this skill does
tools: [Bash, Read, Write]
mcp:
- name: my-mcp
type: stdio
command: npx
args: [-y, my-mcp-server]
---
Skill content (instructions for the agent)...
MERGER SUBDIRECTORY
Handles complex merge logic when skills from multiple scopes have overlapping names or MCP configs.
TEMPLATE RESOLUTION
Variables like {{directory}}, {{agent}} in skill content get resolved at load time based on current context.