ContextSniper: AntTrail's Token-Efficient Code Memory for Repository-Level Program Repair

Chiwang Luk, Matin Mohammad Najafi, Zhifeng Jia, Wei Yang, Xiuchang Li +4 more
7/2/2026
cs.AI

Official code: Calluking/ContextSniper (0 stars, MulanPSL-2.0, last commit 2026-06-18).

Abstract

Large language model agents can repair real repository issues, but they often spend large context budgets on whole-file reads, broad searches, and long terminal outputs where useful evidence is mixed with irrelevant code and logs. This paper presents ContextSniper, AntTrail's token-efficient code memory layer for repository-level program repair. As the coding specialization of AntTrail's broader agent memory engine, ContextSniper implements the Sniper feature for precision evidence selection: it retrieves candidate code and runtime evidence, ranks it with hybrid retrieval signals, filters long outputs through an intention-aware context gate, and returns compact evidence packets while preserving recoverable source context outside the prompt. We evaluate ContextSniper on SWE-bench Lite with OpenClaw and Claude Code, using 50 task runs per host-agent condition. ContextSniper reduces total token use by 51.5% and logged cost by 36.4% for OpenClaw, and reduces total token use by 38.9% and estimated cost by 27.3% for Claude Code. Submitted-resolution rates decrease slightly, from 26.0% to 24.0% for OpenClaw and from 32.0% to 30.0% for Claude Code. ContextSniper's pilot testing scripts are open-sourced at https://github.com/Calluking/ContextSniper

View on arXivView PDF

Code Implementations(1)

MulanPSL-2.0
00Go, ShellJun 18, 20264 months agoMulanPSL-2.0

Similar Papers

Cite this paper

@article{luk2026contextsniper,
  title  = {ContextSniper: AntTrail's Token-Efficient Code Memory for Repository-Level Program Repair},
  author = {Chiwang Luk and Matin Mohammad Najafi and Zhifeng Jia and Wei Yang and Xiuchang Li and Jinwei Zhu and Yang Ren and Lei Chen and Gao Cong},
  year   = {2026},
  eprint = {2607.01916},
  archivePrefix = {arXiv},
  url    = {http://arxiv.org/abs/2607.01916v1}
}

Add a badge to your README

Shows whether official code is linked for this paper.

Code of Paper badge
[![Code of Paper](https://codeofpaper.com/badge/2607.01916.svg)](https://codeofpaper.com/paper/2607.01916)

Discussion