<!-- mobian-agent-page publisher="dailydev" canonical="https://daily.dev/posts/i-created-a-code-graph-of-magento-2-for-ai-agents-3jitcrppy" -->

---
title: I Created a Code Graph of Magento 2 for AI Agents
description: A developer built rgctl, a tool that indexes an entire codebase once into a structural graph (functions, classes, calls, inheritance, communities) so coding...
canonical: https://daily.dev/posts/i-created-a-code-graph-of-magento-2-for-ai-agents-3jitcrppy
twitter:card: summary_large_image
twitter:site: @dailydotdev
og:type: website
og:site_name: daily.dev
og:title: I Created a Code Graph of Magento 2 for AI Agents | daily.dev
og:description: A developer built rgctl, a tool that indexes an entire codebase once into a structural graph (functions, classes, calls, inheritance, communities) so coding...
og:url: https://daily.dev/posts/i-created-a-code-graph-of-magento-2-for-ai-agents-3jitcrppy
og:image: https://api.daily.dev/og/posts/3JitCRpPy.png
og:image:alt: I Created a Code Graph of Magento 2 for AI Agents
og:image:width: 1200
og:image:height: 630
og:locale: en
---

> ## Documentation Index
> Fetch the complete documentation index at: https://daily.dev/llms.txt
> Use this file to discover all available pages before exploring further.

# I Created a Code Graph of Magento 2 for AI Agents

**[Shaaf](https://daily.dev/sources/shaaf)** · 9 min read · 0 upvotes · 0 comments

## Summary

A developer built rgctl, a tool that indexes an entire codebase once into a structural graph (functions, classes, calls, inheritance, communities) so coding agents can query it deterministically instead of loading thousands of files into context. Tested against upstream Magento Open Source (~25,000 PHP files) using a new tree-sitter-based PHP Tier 1 plugin. Shallow discover extracts symbols and relations in ~12s; deep discover adds CFG, taint, and field mutation tracking in ~33s but taint detection was largely ineffective on Magento's heavily indirected code. The post is candid about the tool's limits: Magento's dependency injection via di.xml is invisible to static analysis, so many call edges resolve only to interfaces rather than concrete implementations. Includes copy-paste command recipes for agent workflows like blast-radius analysis, community detection for module boundaries, and combining graph queries with di.xml inspection.

## Full article

daily.dev links to this article rather than hosting it. Read it at the original source: <https://shaaf.dev/post/2026-09-03-i-created-a-code-graph-of-magento-2-for-ai-agents>

## Questions this post answers

### Why can't a static analysis tool resolve concrete method calls in Magento 2's dependency injection code?

Magento uses constructor injection through interfaces, with the actual binding declared in etc/di.xml and resolved only at runtime. A call like $this->orderRepository->get($id) has a declared type of the interface, not the concrete class, so static tools can record the parameter type and field but cannot produce a unique Calls edge to the real implementation without also parsing di.xml.

_Teams debugging DI resolution gaps in Magento can follow related tooling deep dives on daily.dev._

### How long does it take to run a full structural code graph index on the Magento 2 Open Source codebase with rgctl?

A cold shallow discover pass over roughly 25,499 PHP files took about 12 seconds and produced around 266,000 graph nodes and 100,000 functions on maintainer hardware, peaking at about 2 GB RSS. A deep discover pass adding control flow graphs, taint analysis, and security scanning took about 33 seconds cold, peaking at roughly 5.7 GB RSS, but dropped to about 12 seconds on a warm cache re-run.

_Developers evaluating code-graph tooling for large PHP monoliths can compare benchmarks like these on daily.dev._

### Why did taint analysis find almost no vulnerabilities when scanning the Magento 2 core codebase?

A cold deep-discover run with taint analysis enabled found only two taint flows across the entire Magento 2 core, because framework wrappers and indirection around inputs like $_FILES, filter_input, and PDO prepare/SQL sinks mean discover-time pattern heuristics miss most real sinks. A near-zero taint count should be read as the pattern library not matching the framework's abstractions, not as evidence the code is safe.

_Anyone assessing static taint analysis limits on framework-heavy codebases can dig deeper via daily.dev._

## Similar posts on daily.dev

- [GraphRAG for Code: What Happens When You Give an AI a Map Instead of a Textbook](https://daily.dev/posts/graphrag-for-code-what-happens-when-you-give-an-ai-a-map-instead-of-a-textbook-gtyozd0bu) · Medium · 0 upvotes · 0 comments
- [Introducing rgctl: A Code Knowledge Graph for Engineering Teams and Agents](https://daily.dev/posts/introducing-rgctl-a-code-knowledge-graph-for-engineering-teams-and-agents-qmzmriimy) · Shaaf · 16 upvotes · 17 comments
- [Cut your coding agent’s cost with Sonar Vortex](https://daily.dev/posts/cut-your-coding-agent-s-cost-with-sonar-vortex-jlvdo2nwa) · Security Boulevard · 1 upvotes · 0 comments

---

Tags: [#ai-agents](https://daily.dev/tags/ai-agents), [#php](https://daily.dev/tags/php), [#magento](https://daily.dev/tags/magento)

[View this post on daily.dev](https://daily.dev/posts/i-created-a-code-graph-of-magento-2-for-ai-agents-3jitcrppy)

```json
{"@context":"https://schema.org","@graph":[{"@type":"Organization","@id":"https://daily.dev/#organization","name":"daily.dev","url":"https://daily.dev","logo":{"@type":"ImageObject","url":"https://daily.dev/apple-touch-icon.png","width":180,"height":180},"sameAs":["https://twitter.com/dailydotdev","https://github.com/dailydotdev","https://www.linkedin.com/company/daily-dev-ltd"]},{"@type":"WebSite","@id":"https://daily.dev/#website","url":"https://daily.dev","name":"daily.dev","publisher":{"@id":"https://daily.dev/#organization"},"potentialAction":{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https://daily.dev/search?q={search_term_string}"},"query-input":"required name=search_term_string"}}]}
{"@context":"https://schema.org","@type":"TechArticle","headline":"I Created a Code Graph of Magento 2 for AI Agents","url":"https://daily.dev/posts/i-created-a-code-graph-of-magento-2-for-ai-agents-3jitcrppy","mainEntityOfPage":{"@type":"WebPage","@id":"https://daily.dev/posts/i-created-a-code-graph-of-magento-2-for-ai-agents-3jitcrppy"},"datePublished":"2026-09-07T15:56:23.342Z","dateModified":"2026-09-13T21:26:03.355Z","description":"A developer built rgctl, a tool that indexes an entire codebase once into a structural graph (functions, classes, calls, inheritance, communities) so coding...","image":"https://media.daily.dev/image/upload/f_auto,q_auto/v1/posts/535d767653aa6f382a12af46e45e9f04?_a=AQAEuop","thumbnailUrl":"https://media.daily.dev/image/upload/f_auto,q_auto/v1/posts/535d767653aa6f382a12af46e45e9f04?_a=AQAEuop","isAccessibleForFree":true,"articleSection":"Shaaf","inLanguage":"en","publisher":{"@type":"Organization","name":"daily.dev","url":"https://daily.dev","logo":{"@type":"ImageObject","url":"https://daily.dev/apple-touch-icon.png","width":180,"height":180}},"author":{"@type":"Organization","name":"Shaaf","logo":"https://media.daily.dev/image/upload/t_logo,f_auto/v1/logos/0b296c189bd840d99decdb5078460675","url":"https://daily.dev/sources/shaaf"},"commentCount":0,"discussionUrl":"https://daily.dev/posts/i-created-a-code-graph-of-magento-2-for-ai-agents-3jitcrppy","interactionStatistic":[{"@type":"InteractionCounter","interactionType":{"@type":"LikeAction"},"userInteractionCount":0},{"@type":"InteractionCounter","interactionType":{"@type":"CommentAction"},"userInteractionCount":0}],"keywords":"ai-agents,php,magento","timeRequired":"PT9M"}
{"@context":"https://schema.org","@type":"BreadcrumbList","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https://daily.dev"},{"@type":"ListItem","position":2,"name":"Shaaf","item":"https://daily.dev/sources/shaaf"},{"@type":"ListItem","position":3,"name":"I Created a Code Graph of Magento 2 for AI Agents"}]}
{"@context":"https://schema.org","@type":"FAQPage","@id":"https://daily.dev/posts/i-created-a-code-graph-of-magento-2-for-ai-agents-3jitcrppy#faq","mainEntity":[{"@type":"Question","name":"Why can't a static analysis tool resolve concrete method calls in Magento 2's dependency injection code?","acceptedAnswer":{"@type":"Answer","text":"Magento uses constructor injection through interfaces, with the actual binding declared in etc/di.xml and resolved only at runtime. A call like $this-\u003eorderRepository-\u003eget($id) has a declared type of the interface, not the concrete class, so static tools can record the parameter type and field but cannot produce a unique Calls edge to the real implementation without also parsing di.xml. Teams debugging DI resolution gaps in Magento can follow related tooling deep dives on daily.dev."}},{"@type":"Question","name":"How long does it take to run a full structural code graph index on the Magento 2 Open Source codebase with rgctl?","acceptedAnswer":{"@type":"Answer","text":"A cold shallow discover pass over roughly 25,499 PHP files took about 12 seconds and produced around 266,000 graph nodes and 100,000 functions on maintainer hardware, peaking at about 2 GB RSS. A deep discover pass adding control flow graphs, taint analysis, and security scanning took about 33 seconds cold, peaking at roughly 5.7 GB RSS, but dropped to about 12 seconds on a warm cache re-run. Developers evaluating code-graph tooling for large PHP monoliths can compare benchmarks like these on daily.dev."}},{"@type":"Question","name":"Why did taint analysis find almost no vulnerabilities when scanning the Magento 2 core codebase?","acceptedAnswer":{"@type":"Answer","text":"A cold deep-discover run with taint analysis enabled found only two taint flows across the entire Magento 2 core, because framework wrappers and indirection around inputs like $_FILES, filter_input, and PDO prepare/SQL sinks mean discover-time pattern heuristics miss most real sinks. A near-zero taint count should be read as the pattern library not matching the framework's abstractions, not as evidence the code is safe. Anyone assessing static taint analysis limits on framework-heavy codebases can dig deeper via daily.dev."}}]}
```

