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

· Source: cs.AI updates on arXiv.org · Field: Technology & Digital — Artificial Intelligence & Machine Learning, Software Development & Engineering · Depth: Expert, extended

Summary

ContextSniper is an open-source, token-efficient code memory layer designed to optimize large language model agents for repository-level program repair. It integrates between a host coding agent and a repository, retrieving and ranking candidate code and runtime evidence using hybrid signals, then filtering long outputs via an intention-aware context gate. This process returns compact evidence packets to the agent while preserving recoverable source context. Evaluated on SWE-bench Lite with 50 task runs per condition, ContextSniper reduced total token use by 51.5% and logged cost by 36.4% for OpenClaw. For Claude Code, it achieved a 38.9% reduction in total token use and a 27.3% estimated cost reduction. Submitted-resolution rates saw slight decreases, from 26.0% to 24.0% for OpenClaw and 32.0% to 30.0% for Claude Code.

Key takeaway

For MLOps Engineers managing LLM-based coding agents for repository repair, integrating ContextSniper can significantly reduce operational costs and latency. You should consider deploying this memory layer to optimize token usage, as it filters noisy context while preserving critical repair evidence. This approach ensures your agents receive compact, relevant information, making their debugging and patching workflows more predictable and efficient, especially for evolving codebases.

Key insights

ContextSniper optimizes LLM agent context by aggressively filtering irrelevant code and logs, preserving only repair-relevant evidence.

Principles

Method

ContextSniper uses an AGFS-backed L0-L2 memory hierarchy, adaptive top-k hybrid retrieval, and an intention-aware context gate, synchronized with repository edits.

In practice

Topics

Code references

Best for: AI Engineer, Research Scientist, AI Scientist, Machine Learning Engineer, MLOps Engineer

Related on AIssential

Open in AIssential →

Editorial summary, takeaway, and curation by AIssential. Original article published by cs.AI updates on arXiv.org.