# codegraph-ast-grep

> Supercharge repo exploration and refactoring with semantic call-graph tracing and structural AST pattern matching.

codegraph-ast-grep is a free AI agent skill on Agensi by servrox, in Code Quality & Review. It loads into your AI agent through the Agensi MCP server, always in its latest approved version.

- Price: Free
- Creator: [servrox](https://www.agensi.io/creators/marcel-mayer)
- Category: [Code Quality & Review](https://www.agensi.io/skills/code-quality-review)
- Uses: 9
- Version: 1.0
- Last updated: 2026-05-31
- Security: scan passed (2026-05-31); every new listing is also reviewed by a person
- Listing: https://www.agensi.io/skills/codegraph-ast-grep
- Tags: code-review, codegraph, ast-grep, refactoring, static-analysis, typescript

## About this skill

### The Ultimate Repo Exploration & Refactor Engine

Navigating complex codebases requires more than just keyword search. This skill combines the semantic power of **CodeGraph** with the structural precision of **ast-grep** to give your AI agent a deep, multi-dimensional understanding of your repository.

### What it does

- **Semantic Mapping:** Uses CodeGraph to trace call flows, find callers/callees, and perform impact analysis across entire repositories.

- **Structural Search:** Leverages ast-grep for deterministic, AST-based pattern matching (e.g., finding unsafe writes or deprecated API patterns).

- **Intelligent Setup:** Automates the configuration of Codex MCP servers, handling global vs. local installs and .gitignore management.

- **Safe Refactoring:** Scopes impacted symbols with semantic data before applying precise structural rewrites.

### Why use this skill

Standard AI prompting often hallucinates code relationships or misses structural nuances in large repos. This developer-centric skill provides a "ground truth" layer by integrating specialized tools. Instead of asking "Where is this used?", your agent can now prove it by tracing the actual call path and identifying the exact syntax nodes involved, ensuring refactors are both comprehensive and safe.

### Supported Workflows

Designed for professional environments, it respects package manager policies, redacts secrets during MCP configuration, and integrates with existing .codex/ and .codegraph/ metadata.

## Requires

- Setup And Config MCP
- uv (Python tool runner)
- pinned server commands or isolated MCP
- @colbymchenry/codegraph
- Node.js
- Python
- Ast Grep MCP

## Known limitations

- Requires local installation of CodeGraph and ast-grep binaries.
- Performance varies with repository size and index freshness.
- Does not replace language-specific compilers for final validation.

## How to use this skill

1. Connect your AI agent to Agensi once: add the MCP server https://mcp.agensi.io/mcp/auth and sign in with your Agensi account (OAuth, no API key). Steps for Claude, ChatGPT, Claude Code, Codex, Cursor, VS Code and other agents: https://www.agensi.io/docs/mcp-setup
2. Ask your agent: "Use the codegraph-ast-grep skill from Agensi" and describe your task.
3. Your agent loads the skill from Agensi when it needs it. Nothing is downloaded.

## Frequently asked questions

### How does codegraph-ast-grep differ from regular AI code search?

This skill combines semantic call-graph tracing with structural AST pattern matching, allowing your AI agent to perform deep impact analysis and precise, syntax-aware refactoring that standard keyword searches miss.

### What is involved in the initial setup and configuration process?

The skill automates the setup of Codex MCP servers, manages .gitignore entries, and handles both global and local environments to ensure all dependencies are correctly configured for your specific repository.

### Which AI agents or environments are compatible with this skill?

It is optimized for any AI agent or platform that supports the Model Context Protocol (MCP) and can interface with specialized developer tools like ast-grep.

### What exactly is included in the purchase of this skill?

Your purchase includes the full skill definition, necessary configuration protocols for CodeGraph and ast-grep integration, and documentation on implementing the semantic-to-structural workflow.

### Does this skill require me to expose my entire codebase or credentials?

No, the skill is designed to respect your project's .gitignore and security policies, and it includes logic to redact sensitive information during MCP server configuration.

### Which programming languages are supported for structural pattern matching?

The skill is built to be language-agnostic but performs best with languages supported by both CodeGraph and ast-grep, such as TypeScript, JavaScript, Python, and Rust.

---

Source: [Agensi](https://www.agensi.io), the marketplace of skills for AI agents. Any MCP-compatible agent (Claude, ChatGPT, Claude Code, Codex, Cursor, VS Code and more) connects at https://mcp.agensi.io/mcp/auth and signs in with an Agensi account; setup for every agent: https://www.agensi.io/docs/mcp-setup. Append .md to any skill, guide or docs address on agensi.io for its markdown version.
