Skip to content
Review Open access

SmartCode AI: Intelligent Code Refactoring and Automated Bug Repair Using Retrieval Augmented Generation Architecture

Oct 2026 · International Journal for Research in Applied Science and Engineering Technology · 0 citations

TL;DR

SmartCode AI is presented, an explainable bug localization and automated repair system that grounds a large language model in retrieved repair knowledge using retrieval augmented generation by combining static analysis, semantic retrieval, generative repair and sandbox validation.

Abstract

Software maintenance, especially locating defects and repairing faulty logic, consumes a large share of development effort and remains error prone when performed manually. This paper presents SmartCode AI, an explainable bug localization and automated repair system that grounds a large language model in retrieved repair knowledge using retrieval augmented generation. The system parses submitted Python code with abstract syntax tree analysis to validate syntax, extract structure and detect code smells such as bare exception handlers, empty functions and mutable default arguments. A lightweight hashing based embedding, computed fully offline, queries a persistent ChromaDB vector store of verified repair patterns, and the retrieved patterns together with the structural facts form a grounded prompt for the Llama-3.3-70B model hosted on Groq. The model returns a bug localization report, a refactoring plan and a corrected program. Every patch is executed in an isolated subprocess with a five second timeout, so that runtime failures and infinite loops are captured before the developer sees the result, and accepted patches are written back to the vector store through a feedback loop. An interactive Streamlit dashboard exposes each stage of the pipeline. Experiments on common runtime defects show that the system localizes and repairs division by zero, unguarded indexing and unsafe dictionary access errors while keeping the host environment safe. By combining static analysis, semantic retrieval, generative repair and sandbox validation, the system reduces debugging effort and delivers transparent fixes that developers can review before adoption.

Read PDF

Similar papers

Open access Oct 2026

Enhancing LLM-Based Bug Reproduction via Code Entity Retrieval and Test Case Repair

Experimental results on the widely-used Defects4J benchmark show that LTER substantially outperforms the best performance in automated bug reproduction, increasing the reproduction success rate to 46.2% with successfully identifying a valid reproduction test as the top candidate in 38.1% of the cases.

Hao Ding, Yan-Jie Jiang, Yu-Xia Zhang et al. · 0 citations
Preprint Oct 2026

Automated Multi-Line Bug Repair Using Model Checker Aided LLMs: A Case Study on RISC-V Processors

This paper proposes a novel automated RTL bug repair methodology that combines LLMs, assertions, and a model checker to provide scalable, trustworthy semantic grounding and formal guarantees, and is the first work to show automated, LLM-assisted RTL multi-line bug repair results on a complex RISC-V processor design in...

Debleena Das, C. Jha, Muhammad Hassan et al. · 1 citation
Preprint Oct 2026

RepGen: Reproducing Deep Learning Bugs through Context-Aware Code Generation and Verification

Reproducing deep learning (DL) bugs is challenging because failures can involve source code, models, data, dependencies, and execution environments. Incomplete bug reports further complicate reproduction by omitting essential details. We present RepGen, an open-source tool for reproducing DL bugs through context-aware...

Mehil B. Shah, M. Rahman, F. Khomh · 0 citations
#artificial intelligence Preprint Oct 2026

Can LLMs Fix It Without Code? Toward Automated Verification of No-Code Bug Fixes

A no-code fix resolves an invalid bug report by directing the user to change a setting, update to a version where the problem is already fixed, or adjust their workflow. Manually verifying whether a proposed no-code fix resolves the reported bug takes considerable developer time. This study proposes an automated, execu...

U. B. Torun, Veli Karakaya, Eray Tuzun · 0 citations
Book Open access Oct 2026

Testing Static Analyzers via Semantic-Preserving Mutators Learned from Real-World Refactoring Practice

Static analyzers reason about program behavior without execution and report issues when code violates predefined rules. A key limitation is their production of inaccurate, incomplete results, generating spurious warnings and missing critical issues. Metamorphic testing is the most commonly used method to efficiently de...

Mei-Lin Li, Kai-Xuan Li, Zi-Fan Xie et al. · 0 citations
Open access Oct 2026

Repairing Code Defects Through Multiple LLM Collaboration and Failure Information Capturing

In recent years, the advent of large language models (LLMs) has significantly advanced automatic program repair (APR). However, due to a lack of domain-specific software engineering knowledge, base LLMs are prone to hallucinations during the repair process, which compromises the correctness of the generated patches. Al...

Jia-Xuan Han, Ze-Yuan Zhou, Gang Cao et al. · 0 citations

We use cookies to run the site and, with your consent, for analytics and to show ads. See our Cookie Policy.