From Agent Behaviour to Agent-Friendly Documentation: An Empirical Study of How Coding Agents Discover, Read, and Write Technical Documentation
Organizations: Peking University Beijing, China
Abstract
Technical documentation is written for human developers, but an increasing share of software changes is now authored by autonomous coding agents. Which documents they consult, when, and what follows remain unknown. We conduct a behaviour-grounded study of agent-documentation interaction across two public datasets: 557 agentic coding sessions from SWE-chat, yielding 94,813 development events including 3,033 documentation interactions; and 33,097 agentic pull requests from AIDev, with 690,260 classified file-level change records. Four findings challenge current documentation practice. First, agents' documentation work is dominated by agent-facing artefacts: instruction files and working notes account for 60.5% of all documentation interactions, versus 10.6% for classical technical documentation and 1.3% for API references. Second, the link between consultation and code editing is unresolved: the adjacent transition probability is 0.002 and the unadjusted three-event lift 1.05, whereas a stage-adjusted model places it above unity (OR 1.33 [1.09, 1.62]); documentation creation is elevated unadjusted (lift 1.67) but its adjusted interval includes unity. Third, no explicit documentation-based validation sequence was observed, and consultation is associated with less immediate testing (lift 0.23, cluster CI 0.08-0.45; adjusted OR 0.39 [0.25, 0.60]). Fourth, consultation is self-initiated (70.2%) far more often than failure-driven (7.5%), and documentation trails code: among multi-commit pull requests changing both, code is touched first 4.7x more often. From these traces we derive a descriptive model of agent-documentation interaction as a two-lobed cycle rather than a linear journey, and show that two widely assumed properties of "agent-friendly" documentation - actionability and verifiability - lack consistent behavioural support. We release our pipeline, coding scheme, and event-level data.
Figures & tables
| Document type | Events | Share |
|---|---|---|
| Agent instructions † | 1,074 | 35.4% |
| Agent working notes † | 760 | 25.1% |
| Task / requirements | 301 | 9.9% |
| Configuration | 205 | 6.8% |
| README | 197 | 6.5% |
| Other prose (residual) | 165 | 5.4% |
| Trigger | Events | Share |
|---|---|---|
| Agent initiative | 1,236 | 40.8% |
| Implementation need | 893 | 29.4% |
| User instruction | 618 | 20.4% |
| Tool failure | 217 | 7.2% |
| Planning | 58 | 1.9% |
| Test failure | 7 | 0.2% |
| Action | After consult. | Base | [95% CI] | Lift [95% CI] | Adj. OR [95% CI] |
|---|---|---|---|---|---|
| Create documentation | 0.044 | 0.026 | +0.0176 [+0.0040, +0.0320] | 1.67 [1.14, 2.31] | 1.41 [0.98, 2.02] |
| Edit code | 0.232 | 0.221 | +0.0113 [-0.0325, +0.0587] | 1.05 [0.86, 1.27] | 1.33 [1.09, 1.62] |
| Revise plan | 0.015 | 0.019 | -0.0044 [-0.0124, +0.0042] | 0.77 [0.35, 1.24] | 0.75 [0.43, 1.30] |
| Run test | 0.005 | 0.022 | -0.0169 [-0.0250, -0.0094] | 0.23 [0.08, 0.45] | 0.39 [0.25, 0.60] |
| Build | 0.004 | 0.025 | -0.0214 [-0.0292, -0.0143] | 0.15 [0.02, 0.33] | 0.25 [0.14, 0.44] |
| First recovery action | (%) | Resolved | 95% CI |
|---|---|---|---|
| Read code | 631 (31.0) | 39/159 | [.18, .32] |
| Retry directly | 404 (19.9) | 48/192 | [.19, .32] |
| No action within horizon | 318 (15.6) | 5/67 | [.03, .16] |
| Edit directly | 312 (15.3) | 45/160 | [.22, .36] |
| Search code | 251 (12.3) | 17/73 | [.15, .34] |
| Read documentation | 109 (5.4) | 7/11 | [.35, .85] |
| Prop. [95% CI] | ||
| (a) Documentation involvement | ||
| Code only | 17,988/33,097 | .543 [.538, .549] |
| Code + documentation | 10,586/33,097 | .320 [.315, .325] |
| Documentation only | 3,164/33,097 | .096 [.092, .099] |
| Neither (build/config/data) | 1,359/33,097 | .041 [.039, .043] |
| (b) First artefact touched | ||
| Statistic | Prop. | Cluster-bootstrap 95% CI | Wilson 95% CI | Width ratio | |
| Sessions as clusters (SWE-chat) | |||||
| Agent-facing, all interactions | 1,834/3,033 | 0.605 | [0.539, 0.665] | [0.587, 0.622] | 3.6 |
| consultation events | 927/1,615 | 0.574 | [0.508, 0.634] | [0.550, 0.598] | 2.6 |
| production events | 893/1,401 | 0.637 | [0.553, 0.713] | [0.612, 0.662] | 3.2 |
| Self-initiated, all interactions | 2,129/3,033 | 0.702 | [0.667, 0.733] | [0.685, 0.718] | 2.0 |
| Failure-driven, all interactions | 228/3,033 | 0.075 | [0.060, 0.093] | [0.066, 0.085] | 1.8 |
| Document type | Cons. | % | Prod. | % |
|---|---|---|---|---|
| Agent instructions † | 545 | 33.7 | 526 | 37.5 |
| Agent working notes † | 382 | 23.7 | 367 | 26.2 |
| Task / requirements | 129 | 8.0 | 170 | 12.1 |
| Configuration | 195 | 12.1 | 10 | 0.7 |
| README | 89 | 5.5 | 107 | 7.6 |
| Other prose | 72 | 4.5 | 93 | 6.6 |
| Statistic | Event | Sess.-eq. | Agent-wt. |
|---|---|---|---|
| Agent-facing, all interactions | 60.5% | 54.7% | 55.1% |
| consultation events only | 57.4% | 50.5% | 50.1% |
| production events only | 63.7% | 67.1% | 66.3% |
| Self-initiated, all interactions | 70.2% | 63.2% | 61.9% |
| Sessions w/ doc event | — | 56.7% | 59.8% |
| Agent | With docs | Sessions | Rate [95% CI] |
|---|---|---|---|
| Gemini CLI | 9 | 12 | .750 [.468, .911] |
| Agent | 8 | 12 | .667 [.391, .862] |
| Claude Code | 238 | 380 | .626 [.577, .673] |
| OpenCode | 45 | 99 | .455 [.360, .552] |
| Codex | 16 | 43 | .372 [.244, .521] |
| Cursor | 0 | 11 | .000 [.000, .259] |
| Candidate stage | Events | Status |
|---|---|---|
| Contribute/Update | 1,401 | strongly attested |
| Retrieve | 1,344 | strongly attested |
| Orient | 462 | attested |
| Interpret | 413 | attested |
| Revisit | 360 | attested |
| Discover | 287 | attested |
Software Engineering
Software engineering studies how to design, build, test, deploy, and maintain reliable software systems and the processes behind them.
See all 265 papers