docs(agents): regenerate all AGENTS.md with deep codebase analysis
This commit is contained in:
+52
-35
@@ -2,53 +2,70 @@
|
||||
|
||||
## OVERVIEW
|
||||
|
||||
Background systems that extend plugin capabilities: agents, skills, Claude Code compatibility layer, MCP managers, and task orchestration.
|
||||
18 feature modules extending plugin capabilities: agent orchestration, skill loading, Claude Code compatibility, MCP management, task storage, and tmux integration.
|
||||
|
||||
## STRUCTURE
|
||||
|
||||
```
|
||||
features/
|
||||
├── background-agent/ # Task lifecycle, concurrency (manager.ts 1646 lines, concurrency.ts)
|
||||
├── boulder-state/ # Persistent state for multi-step operations
|
||||
├── builtin-commands/ # Command templates: refactor (619 lines), ralph-loop, handoff, init-deep
|
||||
├── builtin-skills/ # Skills: git-master (1111 lines), playwright, dev-browser, frontend-ui-ux
|
||||
├── claude-code-agent-loader/ # CC agent loading from .opencode/agents/
|
||||
├── claude-code-command-loader/ # CC command loading from .opencode/commands/
|
||||
├── claude-code-mcp-loader/ # CC MCP loading from .opencode/mcp/
|
||||
├── claude-code-plugin-loader/ # CC plugin discovery from .opencode/plugins/
|
||||
├── claude-code-session-state/ # Subagent session state tracking
|
||||
├── claude-tasks/ # Task schema + storage (has own AGENTS.md)
|
||||
├── context-injector/ # Auto-injects AGENTS.md, README.md, rules
|
||||
├── hook-message-injector/ # System message injection
|
||||
├── mcp-oauth/ # OAuth flow for MCP servers
|
||||
├── opencode-skill-loader/ # YAML frontmatter skill loading
|
||||
├── skill-mcp-manager/ # MCP client lifecycle per session (manager.ts 150 lines)
|
||||
├── task-toast-manager/ # Task progress notifications
|
||||
├── tmux-subagent/ # Tmux integration (manager.ts 350 lines)
|
||||
└── tool-metadata-store/ # Tool execution metadata caching
|
||||
├── background-agent/ # Task lifecycle, concurrency (50 files, 8330 LOC)
|
||||
│ ├── manager.ts # Main task orchestration (1646 lines)
|
||||
│ ├── concurrency.ts # Parallel execution limits per provider/model
|
||||
│ └── spawner/ # Task spawning utilities (8 files)
|
||||
├── tmux-subagent/ # Tmux integration (28 files, 3303 LOC)
|
||||
│ └── manager.ts # Pane management, grid planning (350 lines)
|
||||
├── opencode-skill-loader/ # YAML frontmatter skill loading (28 files, 2967 LOC)
|
||||
│ ├── loader.ts # Skill discovery (4 scopes)
|
||||
│ ├── skill-directory-loader.ts # Recursive directory scanning
|
||||
│ ├── skill-discovery.ts # getAllSkills() with caching
|
||||
│ └── merger/ # Skill merging with scope priority
|
||||
├── mcp-oauth/ # OAuth 2.0 flow for MCP (18 files, 2164 LOC)
|
||||
│ ├── provider.ts # McpOAuthProvider class
|
||||
│ ├── oauth-authorization-flow.ts # PKCE, callback handling
|
||||
│ └── dcr.ts # Dynamic Client Registration (RFC 7591)
|
||||
├── skill-mcp-manager/ # MCP client lifecycle per session (12 files, 1769 LOC)
|
||||
│ └── manager.ts # SkillMcpManager class (150 lines)
|
||||
├── builtin-skills/ # 5 built-in skills (10 files, 1921 LOC)
|
||||
│ └── skills/ # git-master (1111), playwright, dev-browser, frontend-ui-ux
|
||||
├── builtin-commands/ # 6 command templates (11 files, 1511 LOC)
|
||||
│ └── templates/ # refactor, ralph-loop, init-deep, handoff, start-work, stop-continuation
|
||||
├── claude-tasks/ # Task schema + storage (7 files, 1165 LOC)
|
||||
├── context-injector/ # AGENTS.md, README.md, rules injection (6 files, 809 LOC)
|
||||
├── claude-code-plugin-loader/ # Plugin discovery from .opencode/plugins/ (10 files)
|
||||
├── claude-code-mcp-loader/ # .mcp.json with ${VAR} expansion (6 files)
|
||||
├── claude-code-command-loader/ # Command loading from .opencode/commands/ (3 files)
|
||||
├── claude-code-agent-loader/ # Agent loading from .opencode/agents/ (3 files)
|
||||
├── claude-code-session-state/ # Subagent session state tracking (3 files)
|
||||
├── hook-message-injector/ # System message injection (4 files)
|
||||
├── task-toast-manager/ # Task progress notifications (4 files)
|
||||
├── boulder-state/ # Persistent state for multi-step ops (5 files)
|
||||
└── tool-metadata-store/ # Tool execution metadata caching (3 files)
|
||||
```
|
||||
|
||||
## KEY PATTERNS
|
||||
|
||||
**Background Agent Lifecycle:**
|
||||
- Task creation -> Queue -> Concurrency check -> Execute -> Monitor -> Cleanup
|
||||
- Manager.ts handles full lifecycle with 1646 lines of task orchestration
|
||||
- Concurrency.ts manages parallel execution limits per provider/model
|
||||
- Tasks survive session restarts via persistent storage
|
||||
Task creation → Queue → Concurrency check → Execute → Monitor/Poll → Notification → Cleanup
|
||||
|
||||
**Skill Loading Pipeline (4-scope priority):**
|
||||
opencode-project (`.opencode/skills/`) > opencode (`~/.config/opencode/skills/`) > project (`.claude/skills/`) > user (`~/.claude/skills/`)
|
||||
|
||||
**Claude Code Compatibility Layer:**
|
||||
5 directories provide full CC compatibility:
|
||||
- agent-loader: Loads custom agents from .opencode/agents/
|
||||
- command-loader: Loads slash commands from .opencode/commands/
|
||||
- mcp-loader: Loads MCP servers from .opencode/mcp/
|
||||
- plugin-loader: Discovers plugins from .opencode/plugins/
|
||||
- session-state: Tracks subagent session state and recovery
|
||||
5 loaders: agent-loader, command-loader, mcp-loader, plugin-loader, session-state
|
||||
|
||||
**Skill Loading Pipeline:**
|
||||
1. opencode-skill-loader: Parses YAML frontmatter from skill files
|
||||
2. skill-mcp-manager: Manages MCP lifecycle per skill session (manager.ts 150 lines)
|
||||
3. Context injection: Auto-loads AGENTS.md, README.md, rules into context
|
||||
4. Hook message injector: Injects system messages for skill activation
|
||||
**SKILL.md Format:**
|
||||
```yaml
|
||||
---
|
||||
name: my-skill
|
||||
description: "..."
|
||||
model: "claude-opus-4-6" # optional
|
||||
agent: "sisyphus" # optional
|
||||
mcp: # optional embedded MCPs
|
||||
server-name:
|
||||
type: http
|
||||
url: https://...
|
||||
---
|
||||
# Skill instruction content
|
||||
```
|
||||
|
||||
## HOW TO ADD
|
||||
|
||||
|
||||
Reference in New Issue
Block a user