Manuscript Offprint

arXiv:2610.37332

Hidden in Plain Sight: an Empirical Study about The Instruction Stacks of Coding Agents

Felipe de Sant'Anna Paixão, Dhyego Tavares, Eduardo Almeida, Iftekhar Ahmed

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

Felipe de Sant'Anna Paixão, Dhyego Tavares, Eduardo Almeida

Federal University of Bahia

{felipe.paixao, dhyegocruz, eduardo.almeida}@ufba.br

Iftekhar Ahmed

University of California at Irvine

iftekha@uci.edu

Abstract—Coding agents send their models more than the user's prompt: they add instructions, tool definitions, and environmental context that form an instruction stack. This stack guides execution and changes across releases, yet remains largely unexposed to users and insufficiently characterized in research. We present a longitudinal, cross-agent study of the instruction stacks captured in the first model requests of 1,886 releases of Claude Code, Codex, Gemini CLI, Qwen Code, and OpenCode. Under controlled conditions, we analyze their composition and evolution and trace changes in the four open-source agents to documented motivations. Our findings show why examining the system prompt or reporting the model alone provides an incomplete account of agent inputs. Tool definitions dominate three agents' latest requests, while occasional concentrated revisions alter instructions governing tool use, attribution, and coding style. Such revisions can complicate how researchers identify agent-authored contributions and interpret generated code. We also found that only 48% of examined change units directly explain the motivation for stack revisions. Across agents, shared capabilities emerge despite increasingly distinct wording. These findings expose an evolving, incompletely documented layer of agent design. The findings motivate documenting captured instruction stacks alongside agent releases, models, and user prompts, and preserving the rationale behind their revisions. Our replication package is available at [1].

Index Terms—coding agents, system prompts, prompt evolution, software evolution, mining software repositories

1. INTRODUCTION

Coding agents such as Claude Code [2], Codex [3], and Gemini CLI [4] extend LLM-based software development from generating code suggestions to executing multistep tasks. They inspect repositories, edit files, and run commands on a user's behalf. However, the user's request is only one part of the input that guides this work. Before calling a Large Language Model (LLM), an agent supplements the request with instructions, tool definitions, and context. For example, SWE-agent supplies instructions, documentation, and demonstrations of the commands the model may execute [5]. Fig. 1 illustrates this additional material in Claude Code alongside the user's prompt; the request contains agent-authored instructions, definitions of available tools, and facts collected at runtime, such as the current date and working directory.

We call this agent-supplied material the instruction stack. It comprises instruction text—behavioral directives, contextual facts, and structural text supplied through top-level fields or messages—and tool definitions, including descriptions and argument schemas. The system prompt is therefore only one component of the stack. Our analysis examines the stack in the first request to the main model under a fixed experimental configuration, excluding the user prompt and API configuration parameters. We extracted the instruction stack from widely adopted agents in a fresh, sandboxed environment, allowing us to isolate the agent's contribution to the stack. This stack guides how the model interacts with users, modifies code, requests permission, and uses tools. Although parts may be available in source code, the assembled stack is generally not exposed in the user interface and can change between releases.

These changes in the instruction stack matter because instructions can influence model behavior and resource use. Rewording or reformatting prompts can shift accuracy [6], [7], while increasing instruction count or input length can reduce instruction-following reliability [8]–[10]. Even changing a tool's description can alter its invocation frequency [11]. More broadly, a study of 35 Qwen Code releases using a fixed model found that token expenditure per task increased by approximately 70% [12]. Although that finding concerns the harness as a whole, it illustrates why model identity alone cannot characterize an agent's behavior or cost.

The instruction stack also provides the context in which developer-written guidance operates. Files such as AGENTS.md and CLAUDE.md supply repository-specific instructions [13], and recent studies examine their content and evolution [14]–[17]. Evidence of their effectiveness is mixed [18], [19], with agent-specific behavior proposed as one explanation [20]. These files may repeat or contradict vendor instructions, which can themselves conflict [21]. Understanding the surrounding stack is therefore necessary to characterize the conditions under which such guidance is evaluated. More generally, researchers who report only the model and user prompt leave an evolving input to agent behavior unspecified.

Prior work provides only a partial view of this input. Prompt-mining studies examine strings and templates embedded in application source code [22]–[24], whereas coding agents assemble requests at runtime from multiple instruction sources, tool definitions, and environmental information. Source inspection alone may therefore miss what reaches the model and is unavailable for closed-source agents such as Claude Code. Harness studies describe implementations at one or two points in time [13], [25]; the closest longitudinal study evaluates one agent's releases for cost and quality [12]. To our knowledge, no prior study systematically captures and compares the assembled

Claude Code 2.1.243 first request to the model, 74,078 characters

system field 9,517 characters identity You are a Claude agent, built on Anthropic's Claude Agent SDK. engineering guidance Write code that reads like the surrounding code: match its comment density, ... execution policy Before deleting or overwriting, look at the target. context facts ... Primary working directory: /workspace context facts OS Version: Linux 7.1.5-arch1-2

...

User message 327 characters context management <system-reminder> ... Today's date is 2026-09-01. ...

I AM THE USER PROMPT.

System message 5,935 characters capability catalog Available agent types for the Agent tool: - claude: Catch-all for any task ... capability catalog - run: Launch and drive this project's app to see a change working.

...

tools field, 20 tool definitions 57,346 characters WebSearch: "Search the web ..." Arguments: query, allowed_domains, blocked_domains. Other tools: Agent, Bash, Edit, Read, ..., Write.

Instruction text

User prompt 0.03% of the request

Instruction text

Tool definitions

Fig. 1. The first request that Claude Code 2.1.243 sent to its model in our capture, abridged. The user typed one sentence, which is 0.03% of the request. Most of the rest is the instruction stack that the agent adds: instruction text, in the system field and in messages, and tool definitions. Colored tags show how our annotation labels the instruction text (Table II). Underlined values come from the environment where the agent is running: the working directory, the kernel version of the host, and the date.

instruction stacks of multiple production coding agents across their release histories.

These observations motivate a longitudinal, cross-agent analysis. Following release histories reveals which directives persist, change, or disappear and, where development records provide evidence, why maintainers revise them. Comparing agents distinguishes shared practices from agent-specific choices about tool use, verification, autonomy, and user interaction. Together, these analyses characterize the evolution of an often unobserved instruction stack and help characterize the design space in which these agents operate.

We study Claude Code, Codex, Gemini CLI, Qwen Code, and OpenCode. We attempted to run all 1,911 stable npm releases published before 25 August 2026, each in a fresh sandbox with the same user prompt and a fixed configuration per agent. A local server intercepted the first request to the main model for 1,886 releases. We focus on this request because it exposes the initial instruction stack before responses from the main model and subsequent tool results cause execution paths to diverge. Later requests combine instructions with task-dependent histories, making differences harder to attribute to release changes. The first request thus provides a controlled starting point for tracing release-level changes, while excluding instructions loaded later or the full context of interactive sessions. We normalized four API protocols into a common representation, segmented the instruction text into sentences, and classified each segment using a functional codebook. For the four open-source agents, we also traced changes to development records to identify documented motivations. We answer four research questions:

RQ1. How are agents' instruction stacks structured?

RQ2. How do instruction stacks evolve across releases, and what is added or removed?

RQ3. What documented motivations underlie changes to instruction stacks?

RQ4. What content is shared across agents, what is agent-specific, and how do these patterns evolve?

This paper makes four contributions:

  1. A capture infrastructure that records initial model requests from isolated agent releases and normalizes four API protocols.

  2. A longitudinal dataset of 1,886 captured requests from five production coding agents, with capture provenance.

  3. A functional characterization of instruction stacks that distinguishes behavioral directives, contextual information, and structural text.

  4. A longitudinal, cross-agent analysis of stack changes, shared practices, and agent-specific choices, including documented motivations for the four open-source agents.

The rest of the paper is structured as follows. Section 2 defines the terms we use and discusses related work. Section 4 describes how we built the dataset and how we answer each question, and Section 5 reports the results. Section 6 discusses implications and threats to validity, and Section 8 concludes.

References (83)