2025-12-24 17:11:18 +09:00
|
|
|
# TOOLS KNOWLEDGE BASE
|
|
|
|
|
|
|
|
|
|
## OVERVIEW
|
2026-01-17 22:01:56 +09:00
|
|
|
|
2026-01-23 02:14:08 +09:00
|
|
|
20+ tools: LSP (6), AST-Grep (2), Search (2), Session (4), Agent delegation (4), System (2), Skill (3).
|
2025-12-24 17:11:18 +09:00
|
|
|
|
|
|
|
|
## STRUCTURE
|
2026-01-17 22:01:56 +09:00
|
|
|
|
2025-12-24 17:11:18 +09:00
|
|
|
```
|
|
|
|
|
tools/
|
2026-01-17 19:16:49 +09:00
|
|
|
├── [tool-name]/
|
2026-01-17 22:01:56 +09:00
|
|
|
│ ├── index.ts # Barrel export
|
2026-01-23 02:14:08 +09:00
|
|
|
│ ├── tools.ts # ToolDefinition
|
2026-01-17 22:01:56 +09:00
|
|
|
│ ├── types.ts # Zod schemas
|
2026-01-23 02:14:08 +09:00
|
|
|
│ └── constants.ts # Fixed values
|
|
|
|
|
├── lsp/ # 6 tools: definition, references, symbols, diagnostics, rename
|
|
|
|
|
├── ast-grep/ # 2 tools: search, replace (25 languages)
|
2026-01-23 16:00:38 +09:00
|
|
|
├── delegate-task/ # Category-based routing (1039 lines)
|
2026-01-17 22:01:56 +09:00
|
|
|
├── session-manager/ # 4 tools: list, read, search, info
|
2026-01-23 02:14:08 +09:00
|
|
|
├── grep/ # Custom grep with timeout
|
|
|
|
|
├── glob/ # 60s timeout, 100 file limit
|
2026-01-17 22:01:56 +09:00
|
|
|
├── interactive-bash/ # Tmux session management
|
2026-01-23 02:14:08 +09:00
|
|
|
├── look-at/ # Multimodal PDF/image
|
2026-01-17 22:01:56 +09:00
|
|
|
├── skill/ # Skill execution
|
|
|
|
|
├── skill-mcp/ # Skill MCP operations
|
|
|
|
|
├── slashcommand/ # Slash command dispatch
|
|
|
|
|
├── call-omo-agent/ # Direct agent invocation
|
2026-01-25 13:12:40 +09:00
|
|
|
└── background-task/ # background_output, background_cancel (513 lines)
|
2025-12-24 17:11:18 +09:00
|
|
|
```
|
|
|
|
|
|
|
|
|
|
## TOOL CATEGORIES
|
2026-01-17 22:01:56 +09:00
|
|
|
|
|
|
|
|
| Category | Tools | Purpose |
|
|
|
|
|
|----------|-------|---------|
|
2026-01-23 02:14:08 +09:00
|
|
|
| LSP | lsp_goto_definition, lsp_find_references, lsp_symbols, lsp_diagnostics, lsp_prepare_rename, lsp_rename | Semantic code intelligence |
|
|
|
|
|
| Search | ast_grep_search, ast_grep_replace, grep, glob | Pattern discovery |
|
|
|
|
|
| Session | session_list, session_read, session_search, session_info | History navigation |
|
|
|
|
|
| Agent | delegate_task, call_omo_agent, background_output, background_cancel | Task orchestration |
|
|
|
|
|
| System | interactive_bash, look_at | CLI, multimodal |
|
|
|
|
|
| Skill | skill, skill_mcp, slashcommand | Skill execution |
|
2025-12-24 17:11:18 +09:00
|
|
|
|
2026-01-17 19:16:49 +09:00
|
|
|
## HOW TO ADD
|
2026-01-17 22:01:56 +09:00
|
|
|
|
|
|
|
|
1. Create `src/tools/[name]/` with standard files
|
2026-01-23 02:14:08 +09:00
|
|
|
2. Use `tool()` from `@opencode-ai/plugin/tool`
|
2026-01-17 22:01:56 +09:00
|
|
|
3. Export from `src/tools/index.ts`
|
|
|
|
|
4. Add to `builtinTools` object
|
2025-12-24 17:11:18 +09:00
|
|
|
|
|
|
|
|
## LSP SPECIFICS
|
2026-01-17 22:01:56 +09:00
|
|
|
|
2026-01-25 13:12:40 +09:00
|
|
|
- **Client**: `client.ts` manages stdio, JSON-RPC (596 lines)
|
2026-01-17 22:01:56 +09:00
|
|
|
- **Singleton**: `LSPServerManager` with ref counting
|
|
|
|
|
- **Capabilities**: definition, references, symbols, diagnostics, rename
|
2025-12-24 17:11:18 +09:00
|
|
|
|
|
|
|
|
## AST-GREP SPECIFICS
|
2026-01-17 22:01:56 +09:00
|
|
|
|
|
|
|
|
- **Engine**: `@ast-grep/napi` for 25+ languages
|
2026-01-23 02:14:08 +09:00
|
|
|
- **Patterns**: `$VAR` (single), `$$$` (multiple)
|
2026-01-13 21:00:00 +09:00
|
|
|
|
|
|
|
|
## ANTI-PATTERNS
|
2026-01-17 22:01:56 +09:00
|
|
|
|
2026-01-23 02:14:08 +09:00
|
|
|
- **Sequential bash**: Use `&&` or delegation
|
2026-01-17 22:01:56 +09:00
|
|
|
- **Raw file ops**: Never mkdir/touch in tool logic
|
2026-01-23 02:14:08 +09:00
|
|
|
- **Sleep**: Use polling loops
|