# Code for Machines, Not Just Humans: Quantifying AI-Friendliness with Code Health Metrics

arXiv: https://arxiv.org/abs/2601.02200 · HTML: https://mlsanity.com/paper/2601.02200/

## Key facts

- Cited by 2 papers in the map (data through 14 Oct 2026).
- Placed in Software engineering coding agents, one of 16 directions in LLM agents and tool use.
- Builds on 19 of its 59 references that are in the map.
- First posted on arXiv 5 Jan 2026.

## Placed in

- LLM agents and tool use / [Software engineering coding agents](https://mlsanity.com/agents/software-engineering-coding-agents/)

## Builds on (most cited first, 19 of 19)

- [SWE-bench: Can Language Models Resolve Real-World GitHub Issues?](https://mlsanity.com/paper/2310.06770/) (2023)
- [Competition-Level Code Generation with AlphaCode](https://mlsanity.com/paper/2203.07814/) (2022)
- [CodeBLEU: a Method for Automatic Evaluation of Code Synthesis](https://mlsanity.com/paper/2009.10297/) (2020)
- [LLM-Based Multi-Agent Systems for Software Engineering: Literature Review, Vision and the Road Ahead](https://mlsanity.com/paper/2404.04834/) (2024)
- [Agents in Software Engineering: Survey, Landscape, and Vision](https://mlsanity.com/paper/2409.09030/) (2024)
- [On the Use of Agentic Coding: An Empirical Study of Pull Requests on GitHub](https://mlsanity.com/paper/2509.14745/) (2025)
- [On the "Naturalness" of Buggy Code](https://mlsanity.com/paper/1506.01159/) (2015)
- [Test-Driven Development for Code Generation](https://mlsanity.com/paper/2402.13521/) (2024)
- [Code Smells and Refactoring: A Tertiary Systematic Review of Challenges and Observations](https://mlsanity.com/paper/2004.10777/) (2020)
- [Assessing Correctness in LLM-Based Code Generation via Uncertainty Estimation](https://mlsanity.com/paper/2502.11620/) (2025)
- [MANTRA: Enhancing Automated Method-Level Refactoring with Contextual RAG and Multi-Agent LLM Collaboration](https://mlsanity.com/paper/2503.14340/) (2025)
- [Code Red: The Business Impact of Code Quality -- A Quantitative Study of 39 Proprietary Production Codebases](https://mlsanity.com/paper/2203.04374/) (2022)
- [An Empirical Validation of Cognitive Complexity as a Measure of Source Code Understandability](https://mlsanity.com/paper/2007.12520/) (2020)
- [Lessons from Building StackSpot AI: A Contextualized AI Coding Assistant](https://mlsanity.com/paper/2311.18450/) (2023)
- [The Fools are Certain; the Wise are Doubtful: Exploring LLM Confidence in Code Completion](https://mlsanity.com/paper/2508.16131/) (2025)
- [Ghost Echoes Revealed: Benchmarking Maintainability Metrics and Machine Learning Predictions Against Human Assessments](https://mlsanity.com/paper/2408.10754/) (2024)
- [ACE: Automated Technical Debt Remediation with Validated Large Language Model Refactorings](https://mlsanity.com/paper/2507.03536/) (2025)
- [Increasing, not Diminishing: Investigating the Returns of Highly Maintainable Code](https://mlsanity.com/paper/2401.13407/) (2024)
- [How do Humans and LLMs Process Confusing Code?](https://mlsanity.com/paper/2508.18547/) (2025)

## Built on by (most cited first, 2 of 2)

- [Triage: Routing Software Engineering Tasks to Cost-Effective LLM Tiers via Code Quality Signals](https://mlsanity.com/paper/2604.07494/) (2026)
- [Can Agents Design Libraries for Agents?](https://mlsanity.com/paper/2609.36730/) (2026)

## Abstract (arXiv)

We are entering a hybrid era in which human developers and AI coding agents work in the same codebases. While industry practice has long optimized code for human comprehension, it is increasingly important to ensure that LLMs with different capabilities can edit code reliably. In this study, we investigate the concept of ``AI-friendly code'' via LLM-based refactoring on a dataset of 5,000 Python files from competitive programming. We find a meaningful association between CodeHealth, a quality metric calibrated for human comprehension, and semantic preservation after AI refactoring. Our findings confirm that human-friendly code is also more compatible with AI tooling. These results suggest that organizations can use CodeHealth to guide where AI interventions are lower risk and where additional human oversight is warranted. Investing in maintainability not only helps humans; it also prepares for large-scale AI adoption.
