<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: Noble Ogbonna</title>
    <description>The latest articles on DEV Community by Noble Ogbonna (@noble_ogbonna_87771705460).</description>
    <link>https://dev.to/noble_ogbonna_87771705460</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F4192570%2Fb249082b-c5e4-40f7-bbbf-8352029298fe.png</url>
      <title>DEV Community: Noble Ogbonna</title>
      <link>https://dev.to/noble_ogbonna_87771705460</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/noble_ogbonna_87771705460"/>
    <language>en</language>
    <item>
      <title>How I Used a Graph Database to Rebuild Lost Source Code with AI</title>
      <dc:creator>Noble Ogbonna</dc:creator>
      <pubDate>Sun, 18 Oct 2026 17:35:50 +0000</pubDate>
      <link>https://dev.to/noble_ogbonna_87771705460/how-i-used-a-graph-database-to-rebuild-lost-source-code-with-ai-45al</link>
      <guid>https://dev.to/noble_ogbonna_87771705460/how-i-used-a-graph-database-to-rebuild-lost-source-code-with-ai-45al</guid>
      <description>&lt;p&gt;Banks, space programs, and old industrial systems still run on compiled programs (.exe files, Linux ELF files, firmware) whose source code was lost years ago. The authors retired, and the tools used to build them no longer exist.&lt;/p&gt;

&lt;p&gt;The standard way to look inside is a decompiler like NSA's Ghidra, which turns machine code back into C-like text. But the output is rough. It won't compile, and values show up only as raw memory addresses with no explanation.&lt;/p&gt;

&lt;h2&gt;
  
  
  The problem: the context cliff
&lt;/h2&gt;

&lt;p&gt;Here is a function from our billing test:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight c"&gt;&lt;code&gt;&lt;span class="kt"&gt;double&lt;/span&gt; &lt;span class="nf"&gt;compute_progressive_tax&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="kt"&gt;double&lt;/span&gt; &lt;span class="n"&gt;amount&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="kt"&gt;double&lt;/span&gt; &lt;span class="o"&gt;*&lt;/span&gt;&lt;span class="n"&gt;brackets&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="kt"&gt;double&lt;/span&gt; &lt;span class="o"&gt;*&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="mh"&gt;0x00405000&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt; &lt;span class="c1"&gt;// what is this?&lt;/span&gt;
    &lt;span class="p"&gt;...&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The function reads a table at address &lt;code&gt;0x00405000&lt;/code&gt;, but nothing in its code says what's in the table. Another function, two calls away, filled that table with the tax brackets when the program started.&lt;/p&gt;

&lt;p&gt;An AI model that sees only this one function can't know that. So it guesses, usually a flat 10% rate. We call this the &lt;strong&gt;context cliff&lt;/strong&gt;: the answer exists in the program, but outside what the model can see. On our billing test, a standalone model matched the original program's results only &lt;strong&gt;35%&lt;/strong&gt; of the time.&lt;/p&gt;

&lt;h2&gt;
  
  
  The idea: store the program as a graph
&lt;/h2&gt;

&lt;p&gt;A graph database stores things (nodes) and the links between them (edges). A compiled program is already shaped like that: functions call other functions, and functions read and write memory.&lt;/p&gt;

&lt;p&gt;GhostGraph loads the decompiled program into &lt;strong&gt;FalkorDB&lt;/strong&gt; as a graph:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Functions are nodes&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;CALLS&lt;/code&gt; edges connect a function to the functions it calls&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;READS&lt;/code&gt; and &lt;code&gt;WRITES&lt;/code&gt; edges connect functions to memory addresses&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Now the missing information is one query away. Cypher, FalkorDB's query language, follows the link from the function that reads an address to the function that wrote it:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight cypher"&gt;&lt;code&gt;&lt;span class="k"&gt;MATCH&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="ss"&gt;(&lt;/span&gt;&lt;span class="py"&gt;target:&lt;/span&gt;&lt;span class="n"&gt;Function&lt;/span&gt; &lt;span class="ss"&gt;{&lt;/span&gt;&lt;span class="py"&gt;name:&lt;/span&gt; &lt;span class="n"&gt;$function_name&lt;/span&gt;&lt;span class="ss"&gt;})&lt;/span&gt;&lt;span class="o"&gt;-&lt;/span&gt;&lt;span class="ss"&gt;[&lt;/span&gt;&lt;span class="nc"&gt;:READS&lt;/span&gt;&lt;span class="ss"&gt;]&lt;/span&gt;&lt;span class="o"&gt;-&amp;gt;&lt;/span&gt;&lt;span class="ss"&gt;(&lt;/span&gt;&lt;span class="py"&gt;mem:&lt;/span&gt;&lt;span class="n"&gt;GlobalMemory&lt;/span&gt;&lt;span class="ss"&gt;)&lt;/span&gt;&lt;span class="o"&gt;&amp;lt;-&lt;/span&gt;&lt;span class="ss"&gt;[&lt;/span&gt;&lt;span class="nc"&gt;:WRITES&lt;/span&gt;&lt;span class="ss"&gt;]&lt;/span&gt;&lt;span class="o"&gt;-&lt;/span&gt;&lt;span class="ss"&gt;(&lt;/span&gt;&lt;span class="py"&gt;initializer:&lt;/span&gt;&lt;span class="n"&gt;Function&lt;/span&gt;&lt;span class="ss"&gt;)&lt;/span&gt;
&lt;span class="k"&gt;RETURN&lt;/span&gt; &lt;span class="n"&gt;mem.address&lt;/span&gt;&lt;span class="ss"&gt;,&lt;/span&gt; &lt;span class="n"&gt;initializer.name&lt;/span&gt;&lt;span class="ss"&gt;,&lt;/span&gt; &lt;span class="n"&gt;initializer.pseudocode&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;In plain words: "Find the memory this function reads, then find whoever wrote to it." For the billing example, this returns the initializer function with the real brackets: 0% up to 100, 5% up to 500, and 12% up to 2000.&lt;/p&gt;

&lt;h2&gt;
  
  
  A team of agents working on the graph
&lt;/h2&gt;

&lt;p&gt;Four AI agents share the graph as their common memory:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;
&lt;strong&gt;Topology agent:&lt;/strong&gt; reads the binary with the Capstone disassembler and loads the graph.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Reconstruction agent:&lt;/strong&gt; queries the graph through MCP tools (a standard way to give AI models tools) and writes clean source code.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Verification agent:&lt;/strong&gt; runs the new code against 20 test inputs and compares results with the original program.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Supervisor agent:&lt;/strong&gt; passes work between the others and restarts the loop when tests fail.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;We also used FalkorDB's built-in &lt;strong&gt;PageRank&lt;/strong&gt; (a score of which functions are most connected) to decide which functions to rebuild first, and &lt;strong&gt;shortest path&lt;/strong&gt; queries to trace call chains. Separate graphs hold each target, so billing, Space Invaders, and Lunar Lander never mix.&lt;/p&gt;

&lt;h2&gt;
  
  
  Failure memory
&lt;/h2&gt;

&lt;p&gt;When rebuilt code fails a test, the agent writes the failure into the graph:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight cypher"&gt;&lt;code&gt;&lt;span class="k"&gt;CREATE&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="ss"&gt;(&lt;/span&gt;&lt;span class="n"&gt;c&lt;/span&gt;&lt;span class="ss"&gt;)&lt;/span&gt;&lt;span class="o"&gt;-&lt;/span&gt;&lt;span class="ss"&gt;[&lt;/span&gt;&lt;span class="nc"&gt;:FAILED_ON&lt;/span&gt; &lt;span class="ss"&gt;{&lt;/span&gt;&lt;span class="py"&gt;diff:&lt;/span&gt; &lt;span class="n"&gt;$diff&lt;/span&gt;&lt;span class="ss"&gt;}]&lt;/span&gt;&lt;span class="o"&gt;-&amp;gt;&lt;/span&gt;&lt;span class="ss"&gt;(&lt;/span&gt;&lt;span class="n"&gt;t&lt;/span&gt;&lt;span class="ss"&gt;)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;On the next attempt, the agent reads those failures first and fixes the exact edge case instead of repeating the same mistake. The graph is both the knowledge base and the agents' memory of what went wrong.&lt;/p&gt;

&lt;h2&gt;
  
  
  Results
&lt;/h2&gt;

&lt;p&gt;We tested three targets:&lt;/p&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Target&lt;/th&gt;
&lt;th&gt;Without graph&lt;/th&gt;
&lt;th&gt;With GhostGraph&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;Billing engine&lt;/td&gt;
&lt;td&gt;35%&lt;/td&gt;
&lt;td&gt;100%&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Apollo 11 Lunar Lander&lt;/td&gt;
&lt;td&gt;40%&lt;/td&gt;
&lt;td&gt;100%&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;1978 Space Invaders&lt;/td&gt;
&lt;td&gt;Broken game state&lt;/td&gt;
&lt;td&gt;100%&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;The Lunar Lander shows why the graph matters. Without it, the model assumed Earth's gravity (9.81 m/s²). With it, the agents found the real lunar value (1.62 m/s²) in a memory table, and the rebuilt physics landed the module.&lt;/p&gt;

&lt;p&gt;Each verified result also gets a signed certificate (HMAC-SHA256) that records the tests passed. Changing anything afterward breaks the signature, so anyone can check that a result is real.&lt;/p&gt;

&lt;h2&gt;
  
  
  What I learned
&lt;/h2&gt;

&lt;p&gt;Graph queries gave the model the one thing it was missing: connections between functions that its context window never held. And storing failures in the graph made the agents improve with each attempt.&lt;/p&gt;

&lt;h2&gt;
  
  
  Try it
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;Code: &lt;a href="https://github.com/chief-07/ghostgraph" rel="noopener noreferrer"&gt;https://github.com/chief-07/ghostgraph&lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;Demo: &lt;a href="https://youtube.com/shorts/dZx8V66GsuA" rel="noopener noreferrer"&gt;https://youtube.com/shorts/dZx8V66GsuA&lt;/a&gt;
&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Built for the WeMakeDevs × FalkorDB Graph Hacks hackathon. Thanks to both teams.&lt;/p&gt;

</description>
      <category>ai</category>
      <category>code</category>
      <category>database</category>
      <category>programming</category>
    </item>
  </channel>
</rss>
