Manuscript Offprint

arXiv:2610.07757

Acquiring and Verifying Repository Norms for Coding Agents

Kaifeng He, Xiaojun Zhang, Zhenxi Chen, Christoph Treude, Mingwei Liu

Open access. PaperVantage converted this article to text, so layout and figures may differ from the original.

KAIFENG HE, Sun Yat-Sen University, China

XIAOJUN ZHANG, Sun Yat-Sen University, China

ZHENXI CHEN, Sun Yat-Sen University, China

CHRISTOPH TREUDE, Singapore Management University, Singapore

MINGWEI LIU*, Sun Yat-sen University, China

Changes produced by coding agents can pass functional tests while leaving repository contribution requirements unmet. Following repository-specific norms requires identifying guidance dispersed across repository sources and interpreting its conditions and exceptions. Retrieval and documentation approaches supply general context, but agents must still determine which norms apply. We introduce RepoNorm to acquire explicit and implicit repository norms independently of coding tasks. It checks norm content and applicability using repository evidence, consults Git history when needed, and delivers norm packages to existing coding agents. Our evaluation uses three coding models and 121 tasks from RepoNormBench. Against the baseline with no additional generated guidance (Raw), relative improvements are 7.42–10.77% for Overall Norm Compliance Rate (NCR), 31.64–45.44% for Contribution NCR, and 11.34–17.69% for Prompt-omitted NCR. All three coding models also obtain higher values on these NCR measures with RepoNorm than with CodeWiki documentation. Functional success rates show observed gains of 5.79–9.09 percentage points over Raw; the paired comparisons do not reach the significance threshold. Sampled precision is 86% with RepoNorm's default configuration.

CCS Concepts: • Software and its engineering → Software development techniques.

Additional Key Words and Phrases: repository-specific norms, coding agents, norm acquisition, large language models, mining software repositories

1 Introduction

Following established project practices is important for long-term software maintenance. Violating these practices can require corrective changes during code review [1, 27]. In this paper, we define repository-specific norms as requirements, recommendations, and supported source-code conventions that guide how changes should be implemented, tested, and documented in a project. A norm identifies the changes or artifacts it governs, together with relevant conditions and exceptions. For example, Jinja’s contribution guide explicitly requires a changelog entry with code changes. In Tiktoken, existing recovery code and its comment provide implicit evidence for preserving surrogate handling in new encoding paths. Coding agents now navigate repositories, edit files, and execute tests [32, 35]. Their contributions must satisfy applicable requirements and respect other repository norms, even when task descriptions leave them unstated. Overlooking norms can leave contributions incomplete or change established behavior despite passing functional tests, as illustrated in Section 2.

One way to help agents follow these norms is through repository-level instruction files, such as CLAUDE.md or AGENTS.md [3]. Writing this guidance manually requires developers to identify relevant norms and express their applicability. Automating this work requires finding and interpreting evidence distributed across a repository [28]. Explicit sources include contribution guides [23], configurations, and workflows [6]; source-code practices supply implicit evidence [2]. A norm may have both explicit and implicit support, with source code and tests qualifying the applicability of a

∗^{*}Corresponding author.

Authors' Contact Information: Kaifeng He, Sun Yat-Sen University, China, hekaifeng70@gmail.com; Xiaojun Zhang, Sun Yat-Sen University, China, zhangxj229@mail2.sysu.edu.cn; Zhenxi Chen, Sun Yat-Sen University, China, chenzhx236@mail2.sysu.edu.cn; Christoph Treude, Singapore Management University, Singapore, ctreude@smu.edu.sg; Mingwei Liu, Sun Yat-sen University, China, liumw26@mail.sysu.edu.cn.

He et al.

documented rule. The evidence’s location need not define the norm’s scope: a helper can constrain callers elsewhere. A recurring pattern may instead be confined to one component. Automated acquisition must determine which observations support a candidate norm, what conditions or exceptions apply, and which changes it governs before delivering the guidance to an agent.

Existing automated retrieval and documentation approaches primarily provide repository context [10, 25]. Repoformer selectively retrieves context for repository-level code completion [29]. Documentation systems such as DeepWiki and CodeWiki explain repository structure and behavior [10]. Such context can help agents implement a task but may leave unclear which aspects contributors are expected to preserve and which additional artifacts they must deliver. A study of developer-written and automatically generated instruction files finds that agents generally follow their instructions without a consistent improvement in task resolution across the evaluated settings [7]. This observation motivates assessing the quality and usefulness of guidance separately from whether agents follow it. These resources can contain norms, but acquiring them as reliable guidance still requires checking their content and applicability against repository evidence.

We present RepoNorm, a task-independent approach to repository norm acquisition for coding agents. Before a concrete task begins, RepoNorm extracts candidates from explicit sources and infers candidates from source-code practices. It checks candidates against repository evidence, examining support and counterexamples to verify the proposed norm together with its scope, conditions, and exceptions. Bounded queries to local Git history supply additional evidence when needed to resolve questions about existing candidates. It then delivers selected norms and their supporting evidence through a norm package.

Preparing norms independently of a coding task allows the package to support multiple tasks and coding models for the repository. The static package organizes norms by applicability path, so agents can use native file tools to find guidance for the files and directories involved in a change. Each norm retains its applicability and evidence for inspection. The consuming agent selects relevant guidance and remains responsible for code generation, editing, and test execution.

To evaluate repository norm compliance and functional correctness, we construct RepoNorm-Bench from CooperBench [15]. It contains 121 coding tasks, with refined task descriptions, strengthened functional tests, and repository-grounded reference norms paired with automated compliance checks. Norm checks assess adherence to applicable repository norms, while functional tests assess the requested behavior. This distinction captures changes that solve a task but leave contribution obligations unmet [33]. We compare RepoNorm guidance with no additional generated guidance (Raw) and with CodeWiki documentation, and assess norm quality through precision and coverage of the reference norms.

Across DeepSeek, Qwen, and Gemini, RepoNorm increases Overall Norm Compliance Rate (NCR) by 7.42–10.77%, Contribution NCR by 31.64–45.44%, and Prompt-omitted NCR by 11.34–17.69%, all relative improvements over Raw. It improves these three measures over CodeWiki documentation for every model, with entirely positive paired 95% confidence intervals. The larger gains concern contribution requirements less directly tied to functional correctness; changes in Behavioral NCR are smaller. Observed functional and joint success rates are 5.79–9.09 and 0.83–4.96 percentage points higher than with Raw, respectively, although paired comparisons do not reach the significance threshold after Holm correction. CodeWiki's functional results alongside its less consistent compliance gains suggest that context supporting task completion and explicit guidance for contribution requirements provide distinct benefits. Under its default configuration, RepoNorm achieves 86.00% sampled precision in norm acquisition.

The paper contributes:

  • RepoNorm, a repository norm acquisition method and implementation combining explicit extraction, implicit inference, and verification of candidate content and applicability, with evidence retained in agent-readable norm packages.

  • RepoNormBench, a benchmark derived from CooperBench with refined task descriptions, strengthened functional tests, and repository-grounded norm-compliance metrics that complement functional evaluation.

  • An evaluation across three coding models that measures repository norm compliance, including adherence to norms not explicitly stated in task descriptions, alongside functional correctness and norm quality.

References (26)