Skip to content

feat(tools): add ast_search symbol navigator tool (ported from Cortex… - #82695

Closed
Synxneuos wants to merge 1 commit into
NousResearch:mainfrom
Synxneuos:feat-ast-search-pr
Closed

Synxneuos wants to merge 1 commit into
NousResearch:mainfrom
Synxneuos:feat-ast-search-pr

Conversation

@Synxneuos

Copy link
Copy Markdown
Contributor

Summary

This PR adds the ast_search structural code symbol navigator tool to Hermes Agent.

It allows Hermes to parse and inspect the Abstract Syntax Tree (AST) of Python files and directory trees without dumping whole 2,000+ line file contents into the prompt context window, saving up to 88% of input tokens during codebase navigation turns.


Provenance & License Information

  • Ported From: Cortex Agent Engine (https://github.com/codexbt/cortex)
  • Source Revision / Commit: 78d55cd9f20f3fa41d5ae61e8abea9a8663ac108 (main branch)
  • License: MIT License (Permissive open-source reuse)

Key Technical Design

  • Zero External Dependencies: Built entirely on Python standard library modules (ast, pathlib, os).
  • Self-Contained: Automatically discovered by tools.registry via standard module discovery.
  • Safety: Read-only code inspection tool with capped file parsing limits.

Test Command & Results

python -m pytest -o addopts="" tests/tools/test_ast_search.py

@alt-glitch alt-glitch added type/feature New feature or request P3 Low — cosmetic, nice to have comp/tools Tool registry, model_tools, toolsets labels Aug 9, 2026
@teknium1

teknium1 commented Aug 9, 2026

Copy link
Copy Markdown
Collaborator

Thanks for the port, @codexbt — the implementation is clean (stdlib-only, tested), but we're not taking this as a model tool.

Reasoning:

  1. Core tool surface is the most expensive rung. Every registered tool's schema ships on every API call for every user. Per the footprint ladder in AGENTS.md, structural code navigation is well served by the existing search_files + read_file tools, and as merged this would actually be dormant anyway (the ast_search toolset is never wired into toolsets.py, so no agent would see it).
  2. This capability is landing at the skill rung instead. PR feat(skills): add ast-grep structural search/codemod optional skill (port from oh-my-openagent) #80892 adds an ast-grep structural search/codemod optional skill, which covers this use case for all languages (not just Python) with zero tool-schema footprint. That's the direction we're going.

Note: the same two files are also bundled inside your #82686 — please drop them from that branch so it stays a pure NVIDIA-skills PR.

Appreciate the contribution and the clean rebase on the second attempt.

@teknium1 teknium1 closed this Aug 9, 2026
@Synxneuos Synxneuos mentioned this pull request Aug 10, 2026
23 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

comp/tools Tool registry, model_tools, toolsets P3 Low — cosmetic, nice to have type/feature New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants