ast-grep
A code search and replacement tool based on abstract syntax trees (AST). It supports precise searching and refactoring by syntactic structure, ships with parsers for multiple languages, and can be used for code linting and automated refactoring.
Timeline (last 90 days)
The author's core strategy is to have the AI agent cite the output of static analysis tools (ripgrep, ast-grep, Serena, CodeQL) as evidence and to clearly distinguish it from the LLM's own analysis.
ast-grep searches AST nodes and internally uses a CST (concrete syntax tree), so it can search comments and string literals, but it does not perform macro expansion.
The author found that ripgrep and ast-grep gave different results when detecting external communication, because ripgrep also counted comments, showing that cross-validation with multiple tools is important.
All Facts (3)
The author's core strategy is to have the AI agent cite the output of static analysis tools (ripgrep, ast-grep, Serena, CodeQL) as evidence and to clearly distinguish it from the LLM's own analysis.
50%Unverifiedast-grep searches AST nodes and internally uses a CST (concrete syntax tree), so it can search comments and string literals, but it does not perform macro expansion.
50%UnverifiedThe author found that ripgrep and ast-grep gave different results when detecting external communication, because ripgrep also counted comments, showing that cross-validation with multiple tools is important.
50%