๐ง agentiker-code-intel โ Hermes Plugin
AST-aware code intelligence for Hermes Agent โ tree-sitter + ast-grep + LSP
70 tools that understand your code's structure, not just its text. 10โ50ร fewer tokens for code navigation.
Forked from
rewasa/hermes-code-intel-pluginโ extended for agentiker.de (70 Tools, 3125 Tests)
๐ Table of Contents
- โจ Why?
- ๐ Quick Start
- ๐ Tools
- ๐ฆ Installation
- ๐ Supported Languages
- ๐ Architecture
- ๐ง How It Works
- ๐งช Development
- ๐ค Contributing
- ๐ Credits
โจ Why?
Hermes ships with search_files (regex grep) and read_file (raw text). Those work, but they're blind to syntax โ they match comments, strings, and formatting equally. This plugin adds:
| Feature | What it does |
|---|---|
| Symbol extraction | Get all functions, classes, methods with signatures and line numbers without reading the whole file |
| Structural search | Find imports, decorators, function calls, try/catch blocks by AST node type, not regex |
| Safe refactoring | Rename patterns, wrap functions, add parameters across files โ dry-run by default |
| Go-to-definition | LSP-powered jump to symbol definition (falls back to AST) |
| Find references | LSP-powered cross-file usage search (falls back to AST) |
| Blast radius | What breaks if you change this symbol? Transitive callers + test coverage |
| PR impact | Git diff + call graph + test coverage + reviewer suggestions |
| Hot paths | Rank files by transitive import count via ImportGraph |
| Complexity | Per-function cyclomatic complexity with rank A-E |
| Cycle detection | Find circular imports via Tarjan's SCC algorithm |
| Knowledge graph | SQLite-persistent import graph โ callers, callees, health metrics |
The result: editor-grade code intelligence in the terminal โ same approach as Neovim 0.5+, Zed, and Helix.
๐ Quick Start
Installation
cd ~/.hermes/plugins
git clone https://github.com/IVRZ-da/agentiker-code-intel.git
cd agentiker-code-intel
pip install -e .
Usage
# Symbole einer Datei abrufen (ohne die ganze Datei zu lesen)
code_symbols(path="src/service.py")
# Strukturelle Suche โ finde alle Imports
code_search(path="src/", preset="imports")
# Go-to-Definition
code_definition(path="src/service.py", line=42)
# Alle Referenzen eines Symbols finden
code_references(path="src/service.py", line=42)
# Code-Risiko-Analyse
code_dependency_risk(path="src/")
code_blast_radius(path="src/service.py", line=42)
# Impact-Analyse vor Refactoring
code_impact(path="src/service.py", line=42)
Cross-Plugin: Feed Scout Bug-Hunt from code-intel
# code-intel finds dead code โ scout scans automatically
analysis_deadcode(path="src/")
bug_hunt_scan(session_id="...", patterns=["analysis"])
๐ Tools
Version: 0.6.37
Tests: 3415 tests
Tools (70):
Profiles:
| Profile | Tools | Description |
|---|---|---|
all | 70 | All 70 tools (default) |
core | 22 | AST core tools: symbols, search, definition, references |
search | 15 | Code search and analysis: search_by_error, duplicates, hot_paths |
edit | 10 | AST-based code editing: replace_body, safe_delete, insert |
lsp | 25 | LSP integration: definition, references, diagnostics, completion |
Supported Languages: c, cpp, go, java, javascript, python, rust, tsx, typescript
| Tool | Description |
|---|---|
code_action | LSP code actions: auto-fixes, refactoring suggestions, quick-fixes |
code_batch_refactor | ast-grep bulk refactoring across multiple files (dry-run) |
code_blast_radius | What breaks if you change this symbol? Callers + tests |
code_call_hierarchy | LSP call hierarchy: incoming and outgoing calls |
code_callees | Find all callees of a symbol (transitive) |
code_callers | Find all callers of a symbol (transitive) |
code_capsule | Compact symbol overview: signature, doc, references, imports |
code_code_lens | LSP code lens: run/debug/test links above functions |
code_completion | LSP completion: auto-completion at cursor position |
code_complexity | Cyclomatic complexity per function with rank A-E |
code_cycle_detector | Find circular import chains with Tarjan's SCC algorithm |
code_definition | LSP-powered go-to-definition with AST fallback |
code_dependency_graph | Visual dependency graph as Mermaid diagram |
code_dependency_risk | Rate dependency risks (score 0-10) |
code_diagnostics | LSP diagnostics: errors, warnings, hints for a file |
code_diagram_symbol | Generate ASCII/Mermaid diagrams for functions and classes |
code_diff_analysis | Compare two git refs: complexity delta + blast radius |
code_docstring_generate | Generate docstring template from AST signature |
code_document_links | LSP document links: clickable links in docs and comments |
code_document_symbols | LSP document symbols: all symbols in the current file |
code_duplicates | Find duplicate or similar code blocks via AST comparison |
code_explain | Structured symbol explanation with complexity + callers |
code_export | Export symbol index as JSON/Markdown for documentation |
code_folding_range | LSP folding ranges: code fold regions for a file |
code_format | LSP formatting: auto-format a file using language server |
code_generate_tests | Generate test scaffold from a function signature |
code_git_blame | Per-line git blame for a file |
code_git_diff_file | Show uncommitted git diff for a file |
code_git_log_symbol | Git log for a specific symbol (author, date, message) |
code_graph_query | Query the Knowledge Graph: callers, callees, hot paths, cycles |
code_highlight | LSP document highlight: all occurrences of a symbol in a file |
code_hot_paths | Rank files by transitive import frequency |
code_hover | LSP hover: type information and docstring at cursor |
code_impact | Impact analysis before refactoring โ blast radius + test coverage |
code_implementations | LSP implementations: find all implementations of an interface |
code_index | Build a persistent Knowledge Graph (SQLite) for a project |
code_inlay_hints | LSP inlay hints: type hints inline (parameters, variables) |
code_inline_values | LSP inline values: value display for variables at debug time |
code_insert_after | Insert code AFTER a symbol definition (AST-based) |
code_insert_before | Insert code BEFORE a symbol definition (AST-based) |
code_linked_editing | LSP linked editing: coupled editing (JSX tags, CSS classes) |
code_merge_conflict_finder | Find merge conflict markers (<<<<<<<, =======) |
code_metrics | Aggregated project metrics: LOC, files, comment ratio |
code_migration | YAML-based bulk migrations across a project |
code_move | Move a symbol between files via AST extraction |
code_overview | Compact symbol overview of a file as tree view |
code_pr_impact | PR impact analysis: diff + call graph + test coverage |
code_prepare_rename | LSP prepare rename: check if a symbol can be renamed |
code_query | Smart query router โ auto-selects the best tool for your intent |
code_refactor | Structural search-and-replace with ast-grep (dry-run by default) |
code_references | LSP-powered cross-file reference search with AST fallback |
code_rename | LSP-powered symbol rename across the entire project |
code_replace_body | Replace the entire definition of a symbol (AST-based) |
code_review_assistant | Automated code review between git refs (diff + security) |
code_safe_delete | Delete a symbol ONLY if it has no external references |
code_search | AST-based structural search โ find imports, decorators, try/catch blocks |
code_search_by_error | Find all places that handle a specific error type |
code_security_scan | Security scan: hardcoded secrets, SQL injection, path traversal |
code_selection_range | LSP selection ranges: hierarchical selection regions |
code_semantic_tokens | LSP semantic tokens: colored syntax highlighting via LSP |
code_signatures | LSP signature help: parameter info for function calls |
code_symbols | Extract functions, classes, and methods via AST โ no read_file needed |
code_tests_for_symbol | Find tests that cover a specific symbol |
code_timeline | Track symbol evolution across git history |
code_todo_finder | Find TODO/FIXME/HACK/KNOWN-BUG comments in codebase |
code_type_definition | LSP type definition: jump to type definition of a symbol |
code_type_hierarchy | LSP type hierarchy: subtypes and supertypes of a type |
code_unused_finder | Find unused imports and unused functions |
code_workspace_summary | Compact monorepo overview: apps, packages, dependencies |
code_workspace_symbols | LSP workspace symbol search across the entire project |
Recent Changelog
[0.6.37] โ 2026-11-20
๐ Hermes-Katalog-Review (PR #157345) โ 6 blockierende Punkte
Alle sechs Anforderungen aus dem Review von teknium1 (gegen 475a950/v0.6.31)
sind umgesetzt.
- Keine Core-Mutationen mehr (Punkte 1+2):
_inject_toolsets()(Append in
toolsets.TOOLSETS["hermes-acp"|"hermes-api-server"]) und_inject_steering_hints()
(Patch derdescriptionvonsearch_files/read_file/patch) sind entfernt. Der
toolsets-Import im Plugin entfรคllt damit;hermes plugins validatemeldet keine
โprivate core imports" mehr fรผr__init__.py. Steering lรคuft รผber
ctx.register_system_prompt_section("code-intel", โฆ)sowie รผber die Beschreibungen der
eigenen Dispatcher (namespaces.py). Wer ACP/API-Server mit den Tools betreiben will,
aktiviert das Toolset explizit (toolsets: [hermes-cli, agentiker_code_intel]). - Schreibschutz (Punkt 3): neues
_write_guard.py. Jeder Schreibpfad prรผft
agent.file_safety.is_write_denied()โ dieselbe Denylist wiewrite_file/patchโ und
code_batch_refactorbleibt im รผbergebenen Baum (guard_write_in_root). Abgesichert:
ast_edit_tools(insert/move/replace_body/safe_delete),pattern,batch(inkl.
Vorab-Scan vor dem ast-grep-Apply),migration,code_format, rename/workspace-edit.
โ ๏ธ Limitations
| Limitation | Description |
|---|---|
| LSP Dependency | Tools like code_rename, code_hover, code_diagnostics, code_signatures require an LSP server. Without a server they fall back to AST/text analysis. |
| C/C++/Java | No LSP support (tree-sitter + ast-grep only for basic operations) |
| Cold Start | First LSP tool call ~1.5s (server process needs to initialize). Subsequent calls are faster (~0.65s for cached LSP) |
| Batch Refactoring | code_batch_refactor creates .bak backups โ check disk space for 500+ files |
| Subagent Compatibility | See Subagent Integration section below |
Subagent Integration
All code_intel tools are automatically available in delegated subagents (delegate_task):
# Subagent hat automatisch Zugriff auf alle 70 code_intel Tools
delegate_task(goal="Refactoriere die User-Service Klasse",
context="...",
toolsets=["agentiker_code_intel", "terminal", "file"])
Steering: the plugin registers a system-prompt section (ctx.register_system_prompt_section) that points at the code_* dispatchers, so agents use code_search (op=symbols) instead of read_file for code understanding โ saves 10-50ร tokens. Built-in tool schemas are never modified.
๐ฆ Installation
1. Plugin aktivieren
Enable in ~/.hermes/config.yaml:
plugins:
enabled:
- code_intel
Requires Hermes restart (/new or daemon restart).
The tools live in the agentiker_code_intel toolset. In the CLI session that toolset is
enabled through platform_toolsets; for the ACP/API-server platforms (or to add it next to
hermes-cli explicitly) list it in the session's toolsets:
toolsets: [hermes-cli, agentiker_code_intel]
The plugin deliberately does not inject itself into platform bundles โ that would mutate
Hermes core state (see references/core-override-analysis.md).
2. Dependencies installieren
# Ins Hermes-Venv installieren (vom Plugin-Ordner aus)
cd ~/.hermes/plugins/agentiker-code-intel
~/.hermes/hermes-agent/venv/bin/pip install -e .
# Option B โ Via Install-Script
./scripts/install-deps.sh
# Option C โ Manuell (nur Dependencies)
python3 -m pip install tree-sitter tree-sitter-languages ast-grep-py rich PyYAML
Dependencies: tree-sitter>=0.24.0, ast-grep-py>=0.37.0, rich>=13.0, PyYAML>=6.0
Python: 3.12+ (declared as requires-python in pyproject.toml). Hermes itself
supports 3.11, this plugin does not: it uses 3.12 syntax and library behaviour. On a 3.11
host, install into a 3.12 virtualenv (uv venv --python 3.12) before pip install -e . โ
hermes plugins validate reports the mismatch instead of failing silently.
3. LSP Server (optional, for full semantic features)
LSP tools (code_definition, code_references) work without a server โ they fall back to AST analysis. For full support:
# Python
pip install pyright
# TypeScript / JavaScript
npm install -g typescript-language-server typescript
# Rust
rustup component add rust-analyzer
# Go
go install golang.org/x/tools/gopls@latest
Das Plugin erkennt Server automatisch via PATH, node_modules/.bin und npx-Fallback.
4. Monorepo Support
Automatic detection of pnpm-workspace.yaml, nx.json, lerna.json โ workspace folders are sent to the LSP server for cross-workspace type resolution. No configuration needed.
๐ Supported Languages
| Language | Extensions | Tree-sitter | ast-grep | LSP |
|---|---|---|---|---|
| Python | .py, .pyi | โ | โ | โ (pyright/pylsp) |
| JavaScript | .js, .jsx | โ | โ | โ |
| TypeScript | .ts | โ | โ | โ (tsls) |
| TSX | .tsx | โ | โ | โ (tsls) |
| Rust | .rs | โ | โ | โ (rust-analyzer) |
| Go | .go | โ | โ | โ (gopls) |
| Java | .java | โ | โ | โ |
| C | .c, .h | โ | โ | โ |
| C++ | .cpp | โ | โ | โ |
๐ Architecture
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
โ code_intel Plugin โ
โโโโโโโโโโโโโโโโโโโโโโโโโโโโฌโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโค
โ tree-sitter / AST โ LSP Bridge โ
โ (schnell, offline) โ (semantisch, online) โ
โ โ โ
โ โโโโโโโโโโโโโโโโโโโโโโ โ โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ โ
โ โ code_symbols โ โ โ code_definition โ โ
โ โ code_search โ โ โ code_references โ โ
โ โ code_refactor โ โ โ code_diagnostics โ โ
โ โ code_capsule โ โ โ code_hover โ โ
โ โ code_complexity โ โ โ code_call_hierarchy โ โ
โ โ code_duplicates โ โ โ code_type_hierarchy โ โ
โ โ code_unused_finder โ โ โ code_rename โ โ
โ โ ... โ โ โ ... โ โ
โ โโโโโโโโโโโโโโโโโโโโโโ โ โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ โ
โโโโโโโโโโโโโโโโโโโโโโโโโโโโดโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโค
โ Knowledge Graph โ
โ โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ โ
โ โ code_index โ SQLite-persistenter ImportGraph โ โ
โ โ code_graph_query: callers, callees, hot_paths, โ โ
โ โ cycles, health, summary โ โ
โ โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ โ
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโค
โ Subagent Integration โ
โ โข Automatische Injektion in _SUBAGENT_TOOLSETS โ
โ โข Jeder delegate_task-Spawn hat code_intel Tools โ
โ โข Steering-Hint: "Nutze code_symbols statt read_file" โ
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
๐ง How It Works
LSP Bridge Performance
| Fix | Before | After | Impact |
|---|---|---|---|
stderr=subprocess.DEVNULL | Pipe buffer (64KB) fills with warnings โ Deadlock | Silenced | Cold starts never hang |
PYTHONWARNINGS=ignore | pylsp schreibt ~200KB Deprecation-Warnings | Suppressed | 2ร faster Python LSP init |
_LSP_INIT_TIMEOUT=15s | 60s auf dead server โ Agent blockt | 15s fast retry | Agent reagiert sofort |
_LSP_REQUEST_TIMEOUT=15s | 30s auf hung request (tsserver parsing giant file) | 15s | Quicker fallback to AST |
LSP bridges are keyed by (language_id, workspace_root) with LRU pool (max 8 concurrent). Fallback chain: first available server wins.
Symbol Caching
AST results are cached in memory (OrderedDict, max 2000 entries, LRU). Auto-cleared at session end.
๐ฉบ Health Check Script
Das Plugin shiped scripts/health_check.py โ 10 Assertions: Tool-Registry, tree-sitter extraktion, AST search, ast-grep refactoring, LSP definition + references, Schema-Validierung.
# Manuell
~/.hermes/hermes-agent/venv/bin/python3 \
~/.hermes/plugins/code_intel/scripts/health_check.py
# Als cron (empfohlen) โ stumm bei Gesundheit:
hermes cronjob create \
--name "code_intel_health" \
--schedule "every 60m" \
--script "scripts/health_check.py" \
--no-agent
Bundled Skill
Das Plugin registriert automatisch den Skill code_intel:native-code-intelligence:
skill_view("code_intel:native-code-intelligence")
Contains: Mandatory Workflows, Tool Selection Rules, Quality Guardrails, IDE Feature Coverage Map.
Slash Command
Nach Aktivierung: /code-intel status, /code-intel clear, /code-intel help
LSP Benchmarks (TypeScript, pnpm monorepo, 60 workspaces)
| Tool | Scenario | Time | Output Tokens |
|---|---|---|---|
code_definition | Import binding โ typeDefinition fallback | ~1.5s (first) | ~272 |
code_definition | Cached request | ~0.65s | ~290 |
code_references | Small class (~3 refs) | ~0.67s | ~1,362 |
code_references | Medium class (~6 refs) | ~0.66s | ~2,610 |
๐งช Development
cd ~/.hermes/plugins/agentiker-code-intel
# Run tests
PYTHONPATH=~/.hermes/plugins ~/.hermes/hermes-agent/venv/bin/python3 \
-m pytest -q --tb=short
# Einzelner Test
PYTHONPATH=~/.hermes/plugins ~/.hermes/hermes-agent/venv/bin/python3 \
-m pytest tests/test_code_intel.py::test_extract_symbols_python -v
Pre-Commit Hook: Automatischer Syntax-Check + Tests vor jedem Commit.
git config core.hooksPath .githooks
CHANGELOG
Jeder Release bekommt einen Eintrag in CHANGELOG.md:
[added]fรผr neue Features[changed]fรผr รnderungen[fixed]fรผr Bugfixes[removed]fรผr Entfernungen
๐ค Contributing
- Fork the repo
- Create a feature branch
- Add tests for your changes
- Run
PYTHONPATH=~/.hermes/plugins python3 -m pytest -qโ all tests green - Open a PR
๐ License
MIT โ use it however you like.
๐ Credits
- Hermes Agent โ the plugin system this builds on
- rewasa โ original author of upstream
hermes-code-intel-plugin - tree-sitter โ incremental parsing system
- ast-grep โ pattern-based code search and replacement
- pyright โ Python LSP server (fallback)
- typescript-language-server โ TypeScript/JavaScript LSP server
README from the reviewed commit 44adf76; it updates when the author re-pins.

IVRZ-da