Nonna

•
6
•

Detects structural code similarity across a codebase to prevent coding agents from reinventing existing standard library or project functions.

Nonna is a powerful structural code-similarity engine designed specifically for coding agents, aiming to promote code reuse and reduce redundancy. It operates by hashing each function's resolved control/data-flow graph into a unique feature set, then scoring pairs based on weighted Jaccard and asymmetric containment. A key differentiator is its rename-invariant matching, which ignores variable names, field names, literals, and concrete types, focusing solely on how functions compute. The core workflow for agents is 'reuse-before-write': agents can draft code, query Nonna for similar existing functions across the workspace and dependencies, and then learn to call existing implementations instead of rewriting them. It offers integration via MCP for agents and LSP for editors, alongside a duplication explorer UI for human developers.

主要功能

01Rename-invariant matching, ignoring superficial differences like variable names
02Structural code-similarity engine based on control/data-flow graphs
030 GitHub stars
04Integrated LSP server for editor diagnostics and 'find-similar' functionality
05"Reuse-before-write" primary loop for AI coding agents
06HTTP MCP server with a web-based duplication explorer UI

使用案例

01Guiding AI coding agents to reuse existing code effectively
02Analyzing semantic differences between functions, such as for bug/fix pairs
03Identifying and refactoring duplicate code across large codebases and dependencies