Technology Radar
ast-grep is a command-line tool for structural code search, linting and rewriting. Patterns are written as ordinary code with wildcards for any syntax node and match against the syntax tree rather than text, using tree-sitter parsers for more than 20 languages. Linting and rewriting rules are written in a declarative YAML format. One of our teams used these rules as part of the harness around a coding agent, checking the agent’s code against a set of custom rules and feeding the results back to the agent.
ast-grep is similar to the tools behind code intelligence as agentic tooling, but it doesn't build an index or require a language server. Because it skips indexing, it's a low-friction first step for a large codebase before committing to heavier tools. Unlike most tools in that group, it also has uses that don't involve agents: developers can run the same searches, lint rules and rewrites themselves. ast-grep covers much the same ground as Comby, which we featured in 2021. Most IDEs already offer AST-based search, but they don't replace the custom lint rules and rewrites that set ast-grep apart.