AGENTS.md
src/tools/AGENTS.mdAGENTS.md
Quality
86/100
Scores the file, not the repository.Length
1,043 words
25 headings · 8 code blocksRepository
38k
— · pushed 0 days agoLast changed
3 days ago
First indexed 3 days ago.1<!-- Parent: ../AGENTS.md -->2<!-- Generated: 2026-01-28 | Updated: 2026-01-31 -->34# tools56IDE-like capabilities for AI agents via Language Server Protocol (LSP), Abstract Syntax Tree (AST) tools, and Python REPL.78## Purpose910This directory provides agents with powerful code intelligence tools:11- **LSP Tools (12)**: Hover info, go-to-definition, find references, diagnostics, rename, code actions12- **AST Tools (2)**: Structural code search and transformation via ast-grep13- **Python REPL (1)**: Interactive Python execution for data analysis1415These tools enable agents to understand and manipulate code at a semantic level, far beyond text search.1617## Key Files1819| File | Description |20|------|-------------|21| `index.ts` | Tool registry - exports `allCustomTools`, `lspTools`, `astTools` |22| `lsp-tools.ts` | 12 LSP tool definitions (hover, definition, references, etc.) |23| `ast-tools.ts` | 2 AST tools for pattern search and replace |2425## Subdirectories2627| Directory | Purpose |28|-----------|---------|29| `lsp/` | LSP client, server configs, utilities (see `lsp/AGENTS.md`) |30| `diagnostics/` | Directory-level diagnostics (tsc/LSP) (see `diagnostics/AGENTS.md`) |31| `python-repl/` | Python REPL tool for data analysis |3233## For AI Agents3435### Working In This Directory3637#### LSP Tools Usage3839**Basic code intelligence:**40```typescript41// Get type info at position42lsp_hover({ file: "src/index.ts", line: 10, character: 15 })4344// Jump to definition45lsp_goto_definition({ file: "src/index.ts", line: 10, character: 15 })4647// Find all usages48lsp_find_references({ file: "src/index.ts", line: 10, character: 15 })49```5051**File/project analysis:**52```typescript53// Get file outline (all symbols)54lsp_document_symbols({ file: "src/index.ts" })5556// Search symbols across workspace57lsp_workspace_symbols({ query: "createSession", file: "src/index.ts" })5859// Single file diagnostics60lsp_diagnostics({ file: "src/index.ts", severity: "error" })6162// PROJECT-WIDE type checking (RECOMMENDED)63lsp_diagnostics_directory({ directory: ".", strategy: "auto" })64```6566**Refactoring support:**67```typescript68// Check if rename is valid69lsp_prepare_rename({ file: "src/index.ts", line: 10, character: 15 })7071// Preview rename (does NOT apply changes)72lsp_rename({ file: "src/index.ts", line: 10, character: 15, newName: "newFunction" })7374// Get available code actions75lsp_code_actions({ file: "src/index.ts", startLine: 10, startCharacter: 0, endLine: 10, endCharacter: 50 })76```7778#### AST Tools Usage7980**Pattern search with meta-variables:**81```typescript82// Find all function declarations83ast_grep_search({ pattern: "function $NAME($$$ARGS)", language: "typescript", path: "src" })8485// Find console.log calls86ast_grep_search({ pattern: "console.log($MSG)", language: "typescript" })8788// Find if statements89ast_grep_search({ pattern: "if ($COND) { $$$BODY }", language: "typescript" })9091// Find null checks92ast_grep_search({ pattern: "$X === null", language: "typescript" })93```9495**AST-aware replacement:**96```typescript97// Convert console.log to logger (dry run by default)98ast_grep_replace({99 pattern: "console.log($MSG)",100 replacement: "logger.info($MSG)",101 language: "typescript",102 dryRun: true // Preview only103})104105// Convert var to const106ast_grep_replace({107 pattern: "var $NAME = $VALUE",108 replacement: "const $NAME = $VALUE",109 language: "typescript",110 dryRun: false // Apply changes111})112```113114**Meta-variable syntax:**115- `$NAME` - Matches any single AST node (identifier, expression, etc.)116- `$$$ARGS` - Matches multiple nodes (function arguments, list items, etc.)117118#### Diagnostics Strategy119120The `lsp_diagnostics_directory` tool supports two strategies:121122| Strategy | When Used | Speed | Accuracy |123|----------|-----------|-------|----------|124| `tsc` | tsconfig.json exists | Fast | High (full type checking) |125| `lsp` | No tsconfig.json | Slow | File-by-file |126| `auto` | Default | Varies | Picks best available |127128**Recommendation**: Use `strategy: "auto"` (default) - it prefers `tsc` when available.129130### Modification Checklist131132#### When Adding a New Tool1331341. Define tool in appropriate file (`lsp-tools.ts`, `ast-tools.ts`, or new file)1352. Export from `index.ts` (add to `allCustomTools`)1363. Update `src/mcp/omc-tools-server.ts` if exposed via MCP1374. Update `docs/REFERENCE.md` (MCP Tools section)1385. Update agent tool assignments in `src/agents/definitions.ts` if needed1396. Update `docs/CLAUDE.md` (Agent Tool Matrix) if assigned to agents140141### Testing Requirements142143```bash144# Test LSP tools (requires language server installed)145npm test -- --grep "lsp"146147# Test AST tools148npm test -- --grep "ast"149```150151### Common Patterns152153**Tool Definition Structure:**154```typescript155export const myTool: ToolDefinition<{156 param: z.ZodString;157}> = {158 name: 'tool_name',159 description: 'What this tool does',160 schema: {161 param: z.string().describe('Parameter description')162 },163 handler: async (args) => {164 // Implementation165 return { content: [{ type: 'text', text: 'result' }] };166 }167};168```169170**Error handling:**171```typescript172async function withLspClient(filePath, operation, fn) {173 try {174 const client = await lspClientManager.getClientForFile(filePath);175 if (!client) {176 // Return helpful installation hints177 }178 return fn(client);179 } catch (error) {180 return { content: [{ type: 'text', text: `Error: ${error.message}` }] };181 }182}183```184185## Dependencies186187### Internal188- `lsp/` - LSP client and server configurations189- `diagnostics/` - Directory diagnostics (tsc/LSP aggregator)190191### External192| Package | Purpose |193|---------|---------|194| `zod` | Runtime schema validation for tool parameters |195| `@ast-grep/napi` | AST parsing and pattern matching |196| `vscode-languageserver-protocol` | LSP types |197198## Tool Summary199200### LSP Tools (12)201202| Tool | Purpose |203|------|---------|204| `lsp_hover` | Type info/docs at position |205| `lsp_goto_definition` | Jump to symbol definition |206| `lsp_find_references` | Find all usages |207| `lsp_document_symbols` | File outline |208| `lsp_workspace_symbols` | Cross-workspace symbol search |209| `lsp_diagnostics` | Single file errors/warnings |210| `lsp_diagnostics_directory` | **Project-wide type checking** |211| `lsp_servers` | List available language servers |212| `lsp_prepare_rename` | Check if rename is valid |213| `lsp_rename` | Preview multi-file rename |214| `lsp_code_actions` | Available refactorings/fixes |215| `lsp_code_action_resolve` | Get action details |216217### AST Tools (2)218219| Tool | Purpose |220|------|---------|221| `ast_grep_search` | Structural code search with patterns |222| `ast_grep_replace` | AST-aware code transformation |223224### Python REPL (1)225226| Tool | Purpose |227|------|---------|228| `python_repl` | Execute Python code for data analysis |229230## Language Support231232### LSP (via language servers)233| Language | Server | Install |234|----------|--------|---------|235| TypeScript/JavaScript | typescript-language-server | `npm i -g typescript-language-server typescript` |236| Python | ty | `Install ty from https://github.com/astral-sh/ty` |237| Rust | rust-analyzer | `rustup component add rust-analyzer` |238| Go | gopls | `go install golang.org/x/tools/gopls@latest` |239| C/C++ | clangd | System package manager |240| Java | jdtls | Eclipse JDT.LS |241| JSON | vscode-json-language-server | `npm i -g vscode-langservers-extracted` |242| HTML | vscode-html-language-server | `npm i -g vscode-langservers-extracted` |243| CSS | vscode-css-language-server | `npm i -g vscode-langservers-extracted` |244| YAML | yaml-language-server | `npm i -g yaml-language-server` |245246### AST (via ast-grep)247JavaScript, TypeScript, TSX, Python, Ruby, Go, Rust, Java, Kotlin, Swift, C, C++, C#, HTML, CSS, JSON, YAML248249<!-- MANUAL: -->250
Also in Yeachan-Heo/oh-my-claudecode
Diff this repo’s formatsOne repository carrying more than one format is the comparison this product exists for: does anyone actually write different content in each file, or is one a copy of the other?
| Repository | Format | Stack | Covers | Score | Changed |
|---|---|---|---|---|---|
| Yeachan-Heo/oh-my-claudecode.github/CLAUDE.md · 38k | CLAUDE.md | setupbuildstylegit+2 | 79/100 | 3 days ago | |
| Yeachan-Heo/oh-my-claudecodeAGENTS.md · 38k | AGENTS.md | setuplint-formatstyletypes+4 | 45/100 | 3 days ago | |
| Yeachan-Heo/oh-my-claudecodeskills/AGENTS.md · 38k | AGENTS.md | teststylearchdependencies+1 | 66/100 | 3 days ago | |
| Yeachan-Heo/oh-my-claudecodesrc/AGENTS.md · 38k | AGENTS.md | buildteststylearch+2 | 77/100 | 3 days ago | |
| Yeachan-Heo/oh-my-claudecodesrc/agents/AGENTS.md · 38k | AGENTS.md | teststylearchdependencies+1 | 66/100 | 3 days ago | |
| Yeachan-Heo/oh-my-claudecodesrc/features/AGENTS.md · 38k | AGENTS.md | teststylearchdependencies | 74/100 | 3 days ago | |
| Yeachan-Heo/oh-my-claudecodesrc/hooks/AGENTS.md · 38k | AGENTS.md | setupteststylearch+2 | 74/100 | 3 days ago | |
| Yeachan-Heo/oh-my-claudecodesrc/tools/diagnostics/AGENTS.md · 38k | AGENTS.md | teststylearchtypes+2 | 77/100 | 3 days ago | |
| Yeachan-Heo/oh-my-claudecodesrc/tools/lsp/AGENTS.md · 38k | AGENTS.md | setupteststylearch+2 | 74/100 | 3 days ago | |
| Yeachan-Heo/oh-my-claudecodeCLAUDE.md · 38k | CLAUDE.md | setupbuildstylegit+1 | 65/100 | 3 days ago |
Diff against .github/CLAUDE.md Diff against AGENTS.md Diff against skills/AGENTS.md Diff against src/AGENTS.md Diff against src/agents/AGENTS.md Diff against src/features/AGENTS.md Diff against src/hooks/AGENTS.md Diff against src/tools/diagnostics/AGENTS.md Diff against src/tools/lsp/AGENTS.md Diff against CLAUDE.md
Similar configs
Same format, overlapping stack, ranked by quality.
| Repository | Format | Stack | Covers | Score | Changed |
|---|---|---|---|---|---|
| mui/material-uiAGENTS.md · 99k | AGENTS.md | setupbuildtestlint-format+9 | 100/100 | 3 days ago | |
| TryGhost/Ghoste2e/AGENTS.md · 55k | AGENTS.md | setupteststylearch+2 | 100/100 | 3 days ago | |
| SkeneTechnologies/skene-cookbookAGENTS.md · 51 | AGENTS.md | setupbuildtestlint-format+7 | 100/100 | 2 days ago | |
| duckduckgo/content-scope-scriptsspecial-pages/AGENTS.md · 70 | AGENTS.md | buildteststylearch+3 | 100/100 | 3 days ago | |
| n8n-io/n8npackages/@n8n/agents/AGENTS.md · 199k | AGENTS.md | buildteststylearch+3 | 100/100 | 3 days ago | |
| aaif-goose/gooseAGENTS.md · 52k | AGENTS.md | setupbuildtestlint-format+6 | 100/100 | 3 days ago | |
| trick77/agents-md-syncAGENTS.md · 2 | AGENTS.md | setupbuildteststyle+5 | 100/100 | 3 days ago | |
| code-yeongyu/oh-my-openagentpackages/web/AGENTS.md · 67k | AGENTS.md | setupbuildtestlint-format+6 | 100/100 | 2 days ago |
