AI
New Framework Uses Repository Context to Generate Better Commit Messages
CAMGen leverages functional code relationships to help large language models produce clearer, more informative commit messages across multiple programming languages.
Commit messages are vital for software maintenance—they help developers quickly grasp what changed and why. But writing good ones is hard, especially when edits span multiple interconnected code components. A new approach aims to make automated commit message generation more effective by giving AI models a richer view of the codebase.
The Challenge with Current Approaches#
Existing systems for generating commit messages often struggle to capture the broader functional impact of local code changes. Even when powered by large language models, they typically lack the context needed to explain not just what changed, but why it matters and how it ripples through the system. This gap makes the generated messages less useful for developers trying to understand a change's full scope.
How CAMGen Works#
Researchers have introduced CAMGen, a framework that feeds language models three complementary layers of repository information:
- Functional Semantic View: The system identifies the "core entities" most directly affected by code edits, then uses repository-wide semantic clustering to find related functionality. This view explains how changes propagate through the codebase.
- Structural Dependency View: Captures how code components depend on one another.
- Historical Exemplar View: Draws on past commit patterns to inform the model's generation.
By combining these views with the actual code diff, the framework gives the LLM much richer context for understanding and articulating the intent behind a change.
Validated Results#
Testing across three programming languages showed CAMGen outperformed existing baselines—both traditional approaches and other LLM-based methods—on most automatic evaluation metrics. Human reviewers confirmed the advantage: generated commit messages were more complete, with clearer explanations of what changed and why it matters. The results suggest that functional context and repository-wide semantic information are genuinely valuable for this task.

