RustForge AI: A Self-Hosted Rust Gateway for Local Coding Models with Item-Level Context Slicing for Compiler-Error Repair
Developers who want to use large language models (LLMs) for coding without sending source code to a hosted service can run open-weight models on their own hardware, but they still need an API that common tools understand, a way to pick a model size per request, and a way to keep prompts small. This paper is a system and experience report on RustForge AI, an open-source (MIT) Rust workspace that provides (i) an Axum-based gateway exposing an OpenAI-compatible chat-completions API in front of one or two llama.cpp servers, with a rule-based router between a small and a large GGUF coding model, a Model Context Protocol (MCP) client, SQLite (WAL) memory and a cron scheduler; and (ii) rf-cli, a client that runs cargo check, keeps only compiler errors, and sends the model only the smallest Rust item that encloses the first error, located with tree-sitter. We describe the design and the safety measures (a bind guard that refuses publicly routable addresses unless overridden, and bearer-token authentication). We report one measurement that we ran ourselves: over 529 Rust source files from the project and three widely used crates (140,693 non-blank lines), the bytes that the slicer would send for an error on a given line were a median of 2.2% to 28.1% of the whole file, depending on the corpus, with 8.5% to 24.6% of lines falling back to the whole file. We did not measure repair success rates, model quality or inference speed. We close with limitations identified by reading the code.
Authors
- Muhammad Afzal Kalwar (ORCID: https://orcid.org/0009-0002-1636-9120)
Publication Details
- Journal
- Zenodo (CERN European Organization for Nuclear Research)
- Published
- 2026-11-30
- DOI
- https://doi.org/10.5281/zenodo.24689081
- Primary Topic
- Software Engineering Research
- Type
- preprint