codebase-memory-mcp icon indicating copy to clipboard operation
codebase-memory-mcp copied to clipboard

Architectural Drift Detection Between Git Revisions

Open coderleeon opened this issue 5 months ago • 3 comments

What problem does this solve?

The knowledge graph already captures functions, classes, call chains, HTTP routes, and cross-service relationships.

However, when working in large repositories, it is often difficult to understand how the architecture evolves over time. Developers frequently introduce changes that unintentionally increase coupling, create cyclic dependencies, or alter critical call paths.

Currently, users can inspect the current graph, but there is no way to compare architectural changes across commits or branches.

Proposed solution

Add a graph diff mode that compares two indexed revisions (commit, branch, or tag) and reports architectural changes.

Example output:

New dependency cycles introduced Added/removed service boundaries Changed call paths Newly orphaned modules Significant increases in fan-in/fan-out

Example:

Comparing: main vs feature/auth-refactor

  • 14 new call edges
  • 2 new dependency cycles
  • 1 orphaned module removed ! Authentication service fan-in increased by 42%

Alternatives considered

Git diff provides file-level changes, but it does not expose structural or architectural changes.

External architecture tools exist, but they are disconnected from the MCP knowledge graph and coding agent workflow.

Confirmations

  • [x] I searched existing issues and this is not a duplicate.

coderleeon avatar Jun 19 '26 15:06 coderleeon

That's a great idea. Will try to find a concept when there is capacity. If you like you can also work on this and we can see how it fits :)

DeusData avatar Jun 20 '26 23:06 DeusData

A building block landed on main in 4ae5a735 (PR #1885, "feat: compare indexed graph snapshots").

Leaving this open, because comparison is the mechanism and drift detection is the feature. That PR gives a bounded way to diff two indexed graph snapshots, which is the substrate this issue needs — but detecting architectural drift between git revisions also wants a notion of which differences are meaningful, and a way to express what the intended architecture was. Snapshot comparison alone will report every change equally.

Recording the progress here so the connection is not lost, and keeping the issue open for the rest. If your original need is in fact met by snapshot comparison alone, say so and I will close it.

DeusData avatar Aug 29 '26 09:08 DeusData

Thank you for the architectural-drift proposal. The earlier update records snapshot comparison as partial progress. Does that comparison meet your workflow, or do you still need automatic drift detection between revisions? Keeping the distinction explicit before considering this complete.

DeusData avatar Oct 25 '26 17:10 DeusData