Code Graph logo

Code Graph

Community
alinaqi
code-graph

AST-based code graph for fast symbol lookup, dependency analysis, and blast radius via codebase-memory-mcp MCP server

Overview

Publisheralinaqi
Repositorymaggy
Skill namecode-graph
Stars
707
Forks
57
Bundled files
Instructions only
LicenseMIT
Links
  • Markdown instructions

    A SKILL.md file the model loads on demand, so it only costs tokens when a request actually matches.

  • Works with any LLM

    AI skills are plain Markdown, not provider-specific code, so this works with GPT, Claude, Gemini, Grok, or a local model.

  • Self-contained

    Everything the model needs lives in the instructions — no extra files to sync.

  • Open source

    Published by alinaqi on GitHub. Read the source before you install it.

Installation

Install the Code Graph AI skill in TypingMind to use it with any LLM, or drop it into another agent that reads SKILL.md.

1

Install in TypingMind

TypingMind installs a skill straight from its GitHub folder — it reads SKILL.md, bundles the resource files, and stores the result locally.

  1. Open the app and go to Plugins → Skills.
  2. Choose "Install from GitHub".
  3. Paste the skill folder URL below and confirm.
    https://github.com/alinaqi/maggy/tree/main/skills/code-graph
  4. Enable the skill in any chat where you want it available.
Plugins → Skills → Add skill → From GitHub URL, then paste the folder URL and press Continue.
2

Install in another agent

Any agent that reads the Agent Skills format can use this skill — copy the folder into that agent's skills directory.

Claude Code — .claude/skills
git clone --depth 1 https://github.com/alinaqi/maggy.git /tmp/maggy
mkdir -p .claude/skills
cp -r /tmp/maggy/skills/code-graph .claude/skills/code-graph
Restart Claude Code after copying so it picks up the new skill.

Use it in TypingMind

Enable Code Graph in any TypingMind chat and the model takes it from there. Its name and description sit in the system prompt, and the moment a request matches, the model loads the full instructions itself — you never invoke it by hand, and it costs no tokens until it is actually used.

The model loads Code Graph on its own as soon as a request matches it.

Works with any AI model

AI skills are plain Markdown instructions rather than provider-specific code, so Code Graph is not tied to the model it was written for. Install it once in TypingMind and use it with GPT-5, Claude, Gemini, Grok, DeepSeek, Mistral, Llama, or a local model you run yourself — all on your own API keys.

  • Loaded only when it is needed

    The system prompt carries just the name and description. The instructions are fetched on the first matching request, so an idle skill costs nothing.

  • Switch models mid-chat

    Because the skill is instructions rather than code, changing model does not break it — the next model reads the same SKILL.md.

Skill instructions

This is the SKILL.md content the model loads. Read it before installing — a skill is instructions your model will follow.

Code Graph Skill

Purpose: Use the code graph (codebase-memory-mcp) for sub-millisecond symbol lookup, function search, dependency analysis, and blast radius detection. This replaces brute-force grep and file reading for code navigation.


Core Principle

Graph first, file second. Before reading files or grepping, query the code graph. Only read full files when you need to modify them or need context beyond what the graph provides.

Consider graph when planning. When planning any change — feature, refactor, bug fix — start by querying the graph to understand scope, dependencies, and blast radius. This applies to thinking and planning phases, not just implementation. Grep is still the right tool for searching string literals, log messages, config values, and content that lives outside code structure.

┌────────────────────────────────────────────────────────────────┐
│  GRAPH FIRST, FILE SECOND                                      │
│  ─────────────────────────────────────────────────────────────│
│  The code graph indexes your entire codebase as a persistent   │
│  knowledge graph. Claude queries it via MCP for instant         │
│  symbol lookup, dependency chains, and blast radius — instead   │
│  of reading hundreds of files.                                 │
│                                                                │
│  14 MCP tools │ 64 languages │ sub-ms queries │ zero deps      │
│  ~99% fewer tokens for navigation vs brute-force file reads    │
├────────────────────────────────────────────────────────────────┤
│  AUTO-UPDATED                                                  │
│  ─────────────────────────────────────────────────────────────│
│  File watcher keeps graph in sync. Post-commit hook ensures    │
│  freshness. No manual rebuild needed.                          │
└────────────────────────────────────────────────────────────────┘

When to Use Graph vs Direct Read

TaskUse Graph ToolUse Direct Read?
Find function/class definitionsearch_graphNo
Get function signature + docsget_code_snippetNo
Find all callers of a functiontrace_call_pathNo
Trace dependency chainquery_graphNo
Determine blast radius of changedetect_changesNo
Understand project architectureget_architectureNo
Search for code patternssearch_codeNo
Read full implementation to modifysearch_graph to locate, then Read fileYes
Understand business logic contextget_code_snippet for overview, then ReadYes

Rule: If a graph tool can answer the question, use it. Only open files when you need the full source to make edits.


Available MCP Tools

Indexing & Status

ToolPurposeWhen to Use
index_repositoryBuild/rebuild graph for a projectFirst setup, or after major restructure
index_statusCheck if graph is currentBefore querying, if unsure of freshness
list_projectsList all indexed projectsMulti-project navigation

Querying & Navigation

ToolPurposeWhen to Use
search_graphFind symbols by name (fuzzy)"Find auth-related functions"
search_codeText search across indexed codebase"Find TODO comments", pattern matching
get_code_snippetGet source code for a specific symbolNeed signature, docstring, implementation
get_graph_schemaUnderstand graph structure and relationshipsExploring what data is available
query_graphRun structured graph queriesComplex dependency/relationship queries

Analysis

ToolPurposeWhen to Use
trace_call_pathTrace caller/callee chains"Who calls sendEmail?", "What does init() trigger?"
detect_changesIdentify changed files and blast radiusBefore/after code changes, PR review
get_architectureHigh-level module/package structureOnboarding, understanding project layout

Management

ToolPurposeWhen to Use
delete_projectRemove a project from the graphCleanup, project restructure
manage_adrArchitecture decision recordsDocument architectural decisions
ingest_tracesImport runtime tracesPerformance analysis, dead code detection

Workflow: Before Any Code Change

0. PLAN       → get_architecture + search_graph to understand scope before planning
1. LOCATE     → search_graph to find the symbol
2. UNDERSTAND → get_code_snippet for context
3. BLAST      → detect_changes to assess impact
4. TRACE      → trace_call_path to find all affected callers
5. CHANGE     → Read file, make edit
6. VERIFY     → detect_changes again to confirm scope

Step 0 applies to planning, not just coding. When the user asks you to plan a feature, refactor, or fix — query the graph first to understand what exists, what depends on what, and what the scope looks like. This prevents plans based on wrong assumptions about the codebase.

Never skip step 3. Blast radius analysis prevents unexpected breakage from changes to shared code.


Graph Data & Freshness

The graph stays fresh automatically through 3 layers — no manual rebuild needed:

LayerTriggerWhat Happens
File watcherEvery file savecodebase-memory-mcp detects changes and re-indexes affected files in real-time
Auto-indexSession startauto_index: true ensures graph is current when Claude Code starts
Post-commit hookEvery git commitTouches .code-graph/.needs-update marker — file watcher picks it up (~10ms, non-blocking)

You do NOT need to manually re-index unless you do a major restructure (rename entire directories, switch branches with massive diffs). In that case: index_repository once, then the 3 layers keep it fresh.

  • Storage: .code-graph/ directory (auto-created, gitignored)
  • MCP config: .mcp.json at project root (committed, shared with team)

MCP Configuration

The code graph MCP server is configured in .mcp.json at project root:

json
{
  "mcpServers": {
    "codebase-memory": {
      "command": "codebase-memory-mcp",
      "args": []
    }
  }
}

Installation: ~/.claude/install-graph-tools.sh


Decision Framework

Need to find a symbol/function?
  → search_graph (sub-ms, structured result)
  → NOT: grep -r "functionName" (slow, unstructured)

Need to understand dependencies?
  → query_graph or trace_call_path (complete, traversable)
  → NOT: manually reading import statements

Need to assess change impact?
  → detect_changes (comprehensive, instant)
  → NOT: searching for usages manually across files

Need to understand architecture?
  → get_architecture (high-level overview)
  → NOT: reading every directory listing

Need to read/modify code?
  → search_graph to locate, then Read the specific file
  → NOT: reading entire directories hoping to find it

Anti-Patterns

Anti-PatternDo This Instead
Grepping for function namessearch_graph with the function name
Reading entire files to find a signatureget_code_snippet for the specific symbol
Manually tracing import chainstrace_call_path or query_graph
Making changes without checking impactdetect_changes before every edit to shared code
Reading all files in a directoryget_architecture for structure, search_graph for specifics
Ignoring graph staleness warningsCheck index_status, re-index if needed
Re-indexing on every queryTrust the file watcher; only manual re-index after major restructure

Frequently asked questions

What does the Code Graph AI skill do?

AST-based code graph for fast symbol lookup, dependency analysis, and blast radius via codebase-memory-mcp MCP server

Why use Code Graph on TypingMind?

Because you install it once and use it with any model. Code Graph is plain Markdown rather than provider-specific code, so the same skill runs on GPT-5, Claude, Gemini, Grok, or a local model — and you can switch model mid-chat without it breaking. TypingMind runs on your own API keys, so you pay providers directly instead of a per-seat subscription, and your skills and chats stay in your own storage.

How do I install Code Graph in TypingMind?

Open Plugins → Skills → Install from GitHub in TypingMind and paste https://github.com/alinaqi/maggy/tree/main/skills/code-graph. TypingMind reads its SKILL.md and installs it as a skill you can enable per chat.

Which AI models can use Code Graph?

Any model you connect in TypingMind. AI skills are plain Markdown instructions rather than provider-specific code, so GPT, Claude, Gemini, Grok, and local models can all load this skill when a request matches it.

How many AI models can I use with Code Graph?

As many as you like. As long as a model supports skills, you can use Code Graph with it — GPT, Claude, Gemini, Grok, DeepSeek, Mistral, Llama and more — all on TypingMind with your own API keys.

Is the Code Graph AI skill free?

Yes. It is published on GitHub by alinaqi under the MIT license. You only pay your own AI provider for the tokens you use.

What are AI skills?

An AI skill is a reusable instruction bundle that teaches an AI model how to do one specific task. It follows the open Agent Skills format: a SKILL.md file with a name and description, plus any scripts, templates or reference files the model may need. The model reads the instructions only when your request matches the skill, so an installed skill costs nothing until it is used.

How are AI skills different from plugins or MCP servers?

A plugin or MCP server gives a model new tools to call — code that runs somewhere and returns a result. An AI skill gives the model knowledge and process instead: how to approach a task, which steps to follow, what good output looks like. Skills are plain Markdown, so they need no server, no API key and no runtime, and they work with any model.

View all

Set up your own AI workspace now

Get notified about new features and future giveaways by subscribing to our newsletter 👇