Editor’s introduction
The research assessed five instruction categories—Repository Overview, Function Description, Implementation Detail, Testing, and Reconstruction Steps—across all 31 non-empty combinations in five human-written Python libraries. It measured agent-file generation token usage, compilation success, test suite performance, and structural similarity to original code using two LLMs, Gemma 4 and GPT-5.4. While most AI-generated libraries compiled successfully, functional correctness varied significantly: no Gemma 4 variant passed all tests, whereas 12.99% of GPT-5.4 variants did. Function Description yielded the highest partial-pass rate for Gemma 4, and Reconstruction Steps achieved the highest full-pass rate for GPT-5.4. Structurally, Reconstruction Steps was most often linked to code closest to originals in Lines of File and Cyclomatic Complexity, while Testing and Reconstruction Steps jointly showed strongest alignment in File Count and Function Count.
Introduction
Agentic coding in software engineering (SE) enables developers to use artificial intelligence (AI) agents to plan and write code with limited human involvement. However, an agent’s autonomy still depends on human-provided instructions. Suri et al. showed that specific context is necessary to guide AI agents in complex code-generation tasks; without sufficiently detailed instructions, agents may encounter conflicts and ambiguity.
To align AI-agent behavior with developer intent, software projects increasingly provide repository-level artifacts written specifically for agents, including AGENTS.md, copilot-instructions.md, and CLAUDE.md. We refer to these artifacts as agent files. They provide repository-specific information that helps agents assist developers, such as the project purpose, coding conventions, build and test commands, and technical constraints. We refer to the individual pieces of information within an agent file as agent instructions: they communicate what an agent should know and how it should act within a repository.
Although agent files can improve performance on agentic software-development tasks, it remains unclear how particular instruction categories, alone and in combination, affect the cost of generating agent files and the quality of the code subsequently generated from them. This gap is important because low-quality generated code can undermine the productivity gains of generative AI. Therefore, our objective is to examine how categories of agent instructions influence agent-file generation and code generation.
Our contributions include a comprehensive dataset and empirical evidence using real-world open source projects, which is feasible. We provide all scripts, dataset samples, and experimental configurations in a replication package to support reproducibility and enable other researchers to replicate the study. Our results show that providing more instructions neither increases agent-file-generation cost nor guarantees higher-quality generated code.
Agent Tasks
We then used AI agents, as shown in step II-b, to analyze each library and generate the corresponding 31 variants of AGENTS.md, which served as the agent files. As the agent harness, we used OpenCode, which provides two agent modes: Plan and Build. Based on our preliminary experiments, we selected two LLMs for evaluation: the open-source Gemma 4-26B-A4B and the proprietary OpenAI GPT-5.4. Gemma 4-26B-A4B was deployed locally and configured as a custom model in OpenCode. For GPT-5.4, we integrated the OpenAI API with OpenCode using API-based authentication. To support our experiment, we developed an OpenCode plugin that collects token usage for each agent-file generation session that can be seen in our replication package.
Build Agent. The role of the Build Agent is to execute the plan generated by the Plan Agent. Unlike the Plan Agent, the Build Agent was granted permission to edit files in the workspace. It follows the generated plan to produce a single output: an agent file containing a set of instructions that guide an AI agent in reconstructing the library. To ensure consistency throughout the experiment, all generated agent files were named AGENTS.md.
Similarly, to answer RQ1b, we used the same session files to analyze token usage during agent-file generation. For each instruction category and model, we identified the five instruction combinations that include that category and resulted in the lowest token usage. We then identify the instruction combination with the lowest token usage across all categories, libraries, and models.
Agent Tasks
As shown in step III-a, after generating all 310 agent files (AGENTS.md), we used them to reconstruct the trivial libraries with the same models. For each library reconstruction, we started the Plan agent in a working directory containing only one agent file. We used a single, consistent prompt accompanied only by the agent file in the directory during the reconstruction process. To avoid agent reasoning loops, we also set a five-minute time limit for reconstructing each library, although the agents often ignored this limit. Similarly to the agent-file generation process, the reconstruction prompt was used with the Plan Agent, allowing it to generate a complete library development plan from scratch, including the file tree structure, code implementation, testing, and verification. The Build Agent then executed the generated development plan.
Test Runs
The Partial category includes all variants that passed at least one but not all human-written test cases. Therefore, this category may group together variants with substantially different pass rates, such as variants that passed only a small fraction of the tests and variants that passed nearly all tests. We use this category to provide a high-level overview of functional correctness, while acknowledging that it does not capture fine-grained differences in test performance.
Functional Correctness (RQ2b)
For Gemma 4, the Function Description category achieved the highest success rate, with 20% of the instruction combinations containing this category partially passing the human-written test suites. No other instruction category achieved a higher partial-pass rate. In contrast, for GPT-5.4, the Reconstruction Steps category achieved the highest success rate, with 16.25% of the generated libraries from instruction combinations containing this category successfully passing all human-written test cases. Although these two instruction categories achieved the highest success rates, their advantage over the next-best category was only 1.25% for Gemma 4 and 3.75% for GPT-5.4. We also observed that providing more instruction categories does not necessarily improve the correctness of generated code, as the highest test success rates were achieved using only one-, two-, or three-category combinations.
Comparison to Human-Written Libraries (RQ2c)
Lines of File (LoF). The Reconstruction Steps category appeared most frequently, occurring in 6 of the 10 library datasets with the most similar LoF metric. Across the two models, GPT-5.4 generated libraries with LoF metrics that were generally more similar to the original human-written libraries than those generated by Gemma 4, with the smallest difference being only 16.44%.
File Count (FL). Because multiple generated libraries achieved the same FL as the original human-written library, a single library dataset may have more than one instruction combination with the closest FL. Consequently, 16 generated libraries were identified as having the closest FL across the 5 library datasets and 2 models. Both the Testing and Reconstruction Steps categories appeared most frequently, each occurring in 11 of the 16 generated libraries with the closest FL values. Across the two models, the closest FL differences for Gemma 4 ranged from -60.34% to -86.25%, whereas those for GPT-5.4 ranged from -37.50% to -73.68%.
Total Cyclomatic Complexity (CC). Among the 11 generated libraries with the closest total CC, seven included the Reconstruction Steps category. Overall, the generated libraries achieved total CC values that were similar to those of the original human-written libraries. For Gemma 4, three of the five library datasets had a total CC within 2.47% difference of the original human-written libraries, whereas GPT-5.4 achieved a total CC within 13.58% difference for four of the five library datasets.
Function Count (FC). Compared with the previous metrics, the FC metric exhibited greater variation in the instruction combinations that produced the closest results. This trend was particularly evident for Gemma 4-generated libraries, where two library datasets (areyoustillthere and autolink) each had at least four instruction combinations that produced the same FC. Consequently, across the 5 library datasets and 2 models, 19 generated libraries were identified as having the closest FC metric to the original human-written libraries. Among these 19 generated libraries, the Testing and Reconstruction Steps categories appeared in 12 generated libraries. Similar to the CC metric, the generated libraries generally produced FC values that were highly similar to those of the original human-written libraries. Gemma 4 achieved exact FC matches for multiple areyoustillthere library variants, while the remaining library datasets differed by at most 8.7%. GPT-5.4 also generated libraries with similar FC values, with differences of no more than 23.81% from the original human-written libraries.
Implications for Researchers
Instruction categories matter more for code generation than for agent-file generation. Our findings from RQ2c suggest that different instruction categories within an agent file influence different aspects of generated code, including functional correctness and structural characteristics. This suggests that, in our library reconstruction setting, no single instruction category was optimal for all evaluated outcomes.
Although these aspects are also influenced by factors such as the choice of LLM and the characteristics of the target dataset, our findings highlight opportunities for future research on automated instruction selection, instruction optimization, and adaptive agent-file generation tailored to different AI agents and models.
Furthermore, our findings from RQ1 and RQ2a–b suggest that providing more instructions to AI agents is not always beneficial. Instead, these findings motivate the development of tools that automatically identify, rank, or compose the most relevant instructions for a given reconstruction objective or code-generation setting, reducing unnecessary instruction processing while preserving code generation quality.
Finally, future benchmarks should evaluate agent files at a more detailed instruction level rather than only as complete artifacts. Such evaluations would provide a better understanding of which information is most valuable and contributes the most to generated code quality.
Implications for Users
Not all instruction categories are equal. Our findings for RQ2b in Section III-B show that providing more instruction categories does not guarantee higher-quality generated code. At the same time, our results for RQ1 in Section III-A indicate that the number of instruction categories does not directly determine the token cost of generating an agent file.
Our results suggest that agent files may benefit from being tailored to specific code-generation objectives rather than relying on a single comprehensive agent file. Consequently, agent files should be treated as configurable resources rather than static documents, so that only the instructions relevant to the AI agent and the target reconstruction or code-generation objective are selected.
Implications for Developers
Rather than treating all instructions equally, AI agents may benefit from prioritizing instructions that are most relevant to the current code-generation objective. For example, future work could examine whether Function Description and Repository Overview categories are useful for missing-function implementation, or whether Testing category is useful for unit-test repair. To do this, AI agents can first identify the user’s intent and then retrieve the appropriate instructions. This creates an opportunity for AI-coding-agent developers to implement task-aware instruction-selection mechanisms that dynamically choose the most relevant instructions within an agent file instead of providing all instructions at once for every request. Such agent-instruction-aware strategies have the potential to improve the efficiency and effectiveness of AI-assisted software development.
Construct Validity
Our experiment evaluated generated libraries using several metrics, including agent-file generation token usage, compilability, functional correctness based on human-written tests, and structural metrics such as LoF, FL, CC, and FC. However, these metrics have several limitations. Token usage measures only the economic cost of generating agent files and does not reflect the quality of the generated agent files.
Finally, although we compared the structural characteristics of generated and human-written libraries using LoF, FL, CC, and FC, we did not evaluate other software quality aspects, such as maintainability, readability, or architectural quality, which may influence developers’ understanding and the effectiveness of human–AI collaboration.
Internal Validity
Moreover, generated agent files may include information associated with other instruction categories, even when agents are instructed to generate only a single category. This behavior can blur the isolated effect of each category, reduce the distinction between experimental conditions, and influence the observed results.
External Validity
We also evaluated only two LLMs, Gemma 4 and GPT-5.4. Since different models may respond differently to instruction content, our findings may not generalize to other LLMs. Furthermore, our evaluation considered only one AI code generation task, namely library reconstruction from scratch.
Overall, these factors indicate that our findings should be viewed as preliminary and may not generalize beyond the studied setting of five trivial Python libraries, two LLMs, one agent harness, one reconstruction task, and one reconstruction run per condition.
Related Works
In this section, we review related work on agent files and generated code. Existing studies have shown that AI agents still struggle to reconstruct complete software libraries from natural-language requirements and that repository-level agent files can sometimes hinder agent performance. However, it remains unclear which types of instruction categories within agent files contribute to these outcomes.
AGENTS.md Impact on Tokens
Beyond instruction, token consumption is another key consideration for AI agents. Tokens are the basic units of computation used by AI models. Each interaction is measured in tokens, resulting in variable and often unpredictable costs. Since prior studies have shown that input tokens constitute the largest share of token usage, providing AI-related artifacts that can efficiently guide AI agents has become increasingly important for reducing generation costs.
Moreover, allocating a larger token budget does not necessarily guarantee successful task completion by AI agents. Lulla et al. investigated token consumption by comparing AI agents with and without an AGENTS.md file, measuring the resulting token costs. Their experiments showed that providing an AGENTS.md file reduced generation costs by approximately 20%.
However, they treated AGENTS.md as a single artifact and did not investigate how the different instruction categories within it influence token consumption. Furthermore, they did not evaluate whether these instructions affect the correctness of the generated code.
To address this gap, we investigate the impact of individual instruction category on both the agent file generation cost and the correctness of generated code. Rather than treating agent file as a single artifact, we analyze the contribution of each instruction category that it contains.
Repository-level Agentic Context Files
Recent work has begun investigating the effectiveness of repository-level agent files, such as AGENTS.md, for agentic software development. Gloaguen et al. conducted the first empirical study on the impact of repository-level agent files on coding agents using SWE-bench tasks and repositories containing developer-authored agent files. Their results showed that agent files generally reduced task success rates while increasing inference costs by more than 20%. The authors observed that coding agents tend to closely follow the instructions in these files, resulting in broader repository exploration, more extensive testing, and increased file traversal. They concluded that excessive or unnecessary repository-level instructions can hinder agent performance and recommended that agent files contain only the minimal information necessary for completing development tasks.
However, their study does not identify which instruction categories within an agent file contribute to these negative effects. It therefore remains unclear whether all instruction categories are equally detrimental or whether only specific categories increase inference cost or reduce task success.
Library Generation from Scratch
Zhao et al. introduced Commit0, a benchmark that evaluates AI agents on reconstructing complete software libraries from natural-language requirements in the form of PDF documents containing text and images, together with interactive unit tests and execution feedback. Their experiments demonstrated that current AI agents can pass portions of the provided test suites but are still unable to fully reconstruct complete software libraries. They further showed that iterative execution feedback substantially improves generation quality, highlighting the importance of requirements-guided agentic software development.
Conclusion
In this paper, we examined how agent instruction categories corresponds with agent-file generation cost and the characteristics of AI-generated code. We evaluated all 31 non-empty combinations of five instruction categories using two LLMs and five human-written Python libraries. Across 310 generated library variants, we measured agent-file-generation token usage, compilation success, performance against the original human-written test suites, and similarity to the original implementations across four structural metrics.
For RQ1, our results show that instruction quantity alone is not a reliable indicator of agent-file-generation cost. The highest token usage occurred with the combination of Repository Overview, Function Description, Implementation Details, and Reconstruction Steps using GPT-5.4, whereas the two lowest-token combinations both included Function Description and Implementation Details using Gemma 4. More broadly, single-category and multi-category combinations appeared among both the highest- and lowest-token cases, with substantial variation across models and target libraries.
For RQ2, compilation success did not consistently translate into functional correctness. Although 88.39% of Gemma 4 variants and 98.06% of GPT-5.4 variants compiled successfully, no Gemma 4 variant passed all human-written tests, compared with 12.99% of GPT-5.4 variants. Function Description had Gemma 4’s highest partial-pass rate, while Reconstruction Steps had GPT-5.4’s highest full-pass rate. Instruction selection also corresponded with structural similarity: Reconstruction Steps appeared most frequently among variants closest in Lines of File and total Cyclomatic Complexity, Testing appeared most frequently for File Count, and both instructions were most frequent for Function Count.
Together, these findings challenge the assumption that providing more instructions necessarily reduces agent-file-generation cost or improves generated code. Instead, the appropriate instruction selection depends on the target outcome and the chosen model. Because our study covers five small Python libraries, two LLMs, one agent harness, a single task type (library reconstruction), and one reconstruction run per condition, future work should evaluate larger and more diverse systems, repeat each condition, and examine additional agent-file formats and harnesses. Such evidence can support more reliable guidance for selecting instructions that better reflect developer intent.


