All work

Case study

An Elixir knowledge graph for coding agents

A graph of our Elixir application gives coding agents a way to find the right code without rediscovering the same relationships in every session.

My role
Design, Elixir implementation, MCP server, agent guidance, and rollout across multiple teams.
Built with
Elixir · AST analysis · MCP
Outcome
About 80% lower total token usage on comparable engineering tasks, including code discovery.

How the system works

Elixir source

Umbrella application

AST indexer

Walks the syntax tree

Knowledge graph

Modules, functions, callers

MCP server

Exposes graph queries

Coding agents

OpenCode, Claude Code

AGENTS.md

Requires graph use for discovery

The graph records relationships from Elixir source. Agents query it through MCP, with AGENTS.md requiring its use in each new session.

Every new coding-agent session began with the same expensive introduction to our Elixir umbrella application. It had to find the relevant modules, trace callers, and work out how the pieces fit together. The next session arrived with an empty context window and started again.

The application’s structure was already there in the source. I built a knowledge graph to make it available to agents as something they could query.

Building for our codebase

I’d used CodeGraph, ClawVault, and codebase-memory-mcp. For this project, I wanted a graph built specifically for our Elixir umbrella application, with agent guidance designed alongside it.

The graph walks the project’s AST and records modules, functions, and their callers. A custom MCP server makes those relationships available to OpenCode and Claude Code. Finding the callers of a function becomes a graph query.

Making it part of everyday work

I rolled it out across multiple engineering teams and wrote the AGENTS.md guidance that requires agents to use it for code discovery in each new session.

Across comparable engineering tasks, I observed about 80% lower total token usage, along with more accurate outputs and quicker resolutions. That figure covers the whole task, including code discovery.

More work

All work & case studies

Next: Software factory

A software factory built with agents