diff --git a/AGENTS.md b/AGENTS.md index f82cd18..1a960fa 100644 --- a/AGENTS.md +++ b/AGENTS.md @@ -1,7 +1,7 @@ # PROJECT KNOWLEDGE BASE -**Generated:** 2026-01-01T21:15:00+09:00 -**Commit:** 490c0b6 +**Generated:** 2026-01-02T00:10:00+09:00 +**Commit:** b0c39e2 **Branch:** dev ## OVERVIEW @@ -17,7 +17,7 @@ oh-my-opencode/ │ ├── hooks/ # 22 lifecycle hooks - see src/hooks/AGENTS.md │ ├── tools/ # LSP, AST-Grep, Grep, Glob, etc. - see src/tools/AGENTS.md │ ├── mcp/ # MCP servers: context7, websearch_exa, grep_app -│ ├── features/ # Claude Code compatibility - see src/features/AGENTS.md +│ ├── features/ # Claude Code compatibility + core features - see src/features/AGENTS.md │ ├── config/ # Zod schema, TypeScript types │ ├── auth/ # Google Antigravity OAuth - see src/auth/AGENTS.md │ ├── shared/ # Utilities: deep-merge, pattern-matcher, logger, etc. - see src/shared/AGENTS.md @@ -36,12 +36,14 @@ oh-my-opencode/ | Add hook | `src/hooks/` | Create dir with createXXXHook(), export from index.ts | | Add tool | `src/tools/` | Dir with index/types/constants/tools.ts, add to builtinTools | | Add MCP | `src/mcp/` | Create config, add to index.ts and types.ts | +| Add skill | `src/features/builtin-skills/` | Create skill dir with SKILL.md | | LSP behavior | `src/tools/lsp/` | client.ts (connection), tools.ts (handlers) | | AST-Grep | `src/tools/ast-grep/` | napi.ts for @ast-grep/napi binding | | Google OAuth | `src/auth/antigravity/` | OAuth plugin for Google/Gemini models | | Config schema | `src/config/schema.ts` | Zod schema, run `bun run build:schema` after changes | | Claude Code compat | `src/features/claude-code-*-loader/` | Command, skill, agent, mcp loaders | | Background agents | `src/features/background-agent/` | manager.ts for task management | +| Skill MCP | `src/features/skill-mcp-manager/` | MCP servers embedded in skills | | Interactive terminal | `src/tools/interactive-bash/` | tmux session management | | CLI installer | `src/cli/install.ts` | Interactive TUI installation | | Doctor checks | `src/cli/doctor/checks/` | Health checks for environment | @@ -74,6 +76,7 @@ oh-my-opencode/ - **Broad tool access**: Prefer explicit `include` over unrestricted access - **Sequential agent calls**: Use `background_task` for parallel execution - **Heavy PreToolUse logic**: Slows every tool call +- **Self-planning for complex tasks**: Spawn planning agent (Prometheus) instead ## UNIQUE STYLES @@ -128,19 +131,22 @@ bun test # Run tests | File | Lines | Description | |------|-------|-------------| -| `src/index.ts` | 697 | Main plugin orchestration, all hook/tool initialization | -| `src/cli/config-manager.ts` | 670 | JSONC parsing, environment detection, installation | -| `src/auth/antigravity/fetch.ts` | 622 | Token refresh, URL rewriting, endpoint fallbacks | -| `src/tools/lsp/client.ts` | 612 | LSP protocol, stdin/stdout buffering, JSON-RPC | -| `src/hooks/anthropic-context-window-limit-recovery/executor.ts` | 555 | Session compaction, multi-stage recovery pipeline | -| `src/agents/sisyphus.ts` | 505 | Orchestrator prompt, delegation strategies | +| `src/index.ts` | 723 | Main plugin orchestration, all hook/tool initialization | +| `src/cli/config-manager.ts` | 669 | JSONC parsing, environment detection, installation | +| `src/auth/antigravity/fetch.ts` | 621 | Token refresh, URL rewriting, endpoint fallbacks | +| `src/tools/lsp/client.ts` | 611 | LSP protocol, stdin/stdout buffering, JSON-RPC | +| `src/auth/antigravity/response.ts` | 598 | Response transformation, streaming | +| `src/auth/antigravity/thinking.ts` | 571 | Thinking block extraction/transformation | +| `src/hooks/anthropic-context-window-limit-recovery/executor.ts` | 554 | Session compaction, multi-stage recovery pipeline | +| `src/agents/sisyphus.ts` | 504 | Orchestrator prompt, delegation strategies | ## NOTES -- **Testing**: Bun native test (`bun test`), BDD-style `#given/#when/#then` +- **Testing**: Bun native test (`bun test`), BDD-style `#given/#when/#then`, 360+ tests - **OpenCode**: Requires >= 1.0.150 - **Multi-lang docs**: README.md (EN), README.ko.md (KO), README.ja.md (JA), README.zh-cn.md (ZH-CN) - **Config**: `~/.config/opencode/oh-my-opencode.json` (user) or `.opencode/oh-my-opencode.json` (project) - **Trusted deps**: @ast-grep/cli, @ast-grep/napi, @code-yeongyu/comment-checker - **JSONC support**: Config files support comments (`// comment`, `/* block */`) and trailing commas - **Claude Code Compat**: Full compatibility layer for settings.json hooks, commands, skills, agents, MCPs +- **Skill MCP**: Skills can embed MCP server configs in YAML frontmatter diff --git a/src/features/AGENTS.md b/src/features/AGENTS.md index a70292e..c719f21 100644 --- a/src/features/AGENTS.md +++ b/src/features/AGENTS.md @@ -13,6 +13,8 @@ features/ │ ├── manager.test.ts │ └── types.ts ├── builtin-commands/ # Built-in slash command definitions +├── builtin-skills/ # Built-in skills (playwright, etc.) +│ └── */SKILL.md # Each skill in own directory ├── claude-code-agent-loader/ # Load agents from ~/.claude/agents/*.md ├── claude-code-command-loader/ # Load commands from ~/.claude/commands/*.md ├── claude-code-mcp-loader/ # Load MCPs from .mcp.json @@ -20,6 +22,9 @@ features/ ├── claude-code-plugin-loader/ # Load external plugins from installed_plugins.json ├── claude-code-session-state/ # Session state persistence ├── opencode-skill-loader/ # Load skills from OpenCode and Claude paths +├── skill-mcp-manager/ # MCP servers embedded in skills +│ ├── manager.ts # Lazy-loading MCP client lifecycle +│ └── types.ts └── hook-message-injector/ # Inject messages into conversation ``` @@ -72,6 +77,19 @@ Disable features in `oh-my-opencode.json`: - **Timing**: PreToolUse, PostToolUse, UserPromptSubmit, Stop - **Format**: Returns `{ messages: [{ role: "user", content: "..." }] }` +## SKILL MCP MANAGER + +- **Purpose**: Manage MCP servers embedded in skill YAML frontmatter +- **Lifecycle**: Lazy client loading, session-scoped cleanup +- **Config**: `mcp` field in skill's YAML frontmatter defines server config +- **Tool**: `skill_mcp` exposes MCP capabilities (tools, resources, prompts) + +## BUILTIN SKILLS + +- **Location**: `src/features/builtin-skills/*/SKILL.md` +- **Available**: `playwright` (browser automation) +- **Disable**: `disabled_skills: ["playwright"]` in config + ## ANTI-PATTERNS (FEATURES) - **Blocking on load**: Loaders run at startup, keep them fast diff --git a/src/tools/AGENTS.md b/src/tools/AGENTS.md index 747ff75..1edff46 100644 --- a/src/tools/AGENTS.md +++ b/src/tools/AGENTS.md @@ -29,6 +29,8 @@ tools/ │ ├── storage.ts # File I/O operations │ ├── utils.ts # Formatting, filtering │ └── tools.ts # Tool implementations +├── skill/ # Skill loading and execution +├── skill-mcp/ # Skill-embedded MCP invocation ├── slashcommand/ # Slash command execution └── index.ts # builtinTools export ``` @@ -45,6 +47,7 @@ tools/ | Multimodal | look_at | PDF/image analysis via Gemini | | Terminal | interactive_bash | Tmux session control | | Commands | slashcommand | Execute slash commands | +| Skills | skill, skill_mcp | Load skills, invoke skill-embedded MCPs | | Agents | call_omo_agent | Spawn explore/librarian | ## HOW TO ADD A TOOL