메뉴
HN
Hacker News 32일 전

좋은 AGENTS.md는 모델 업그레이드, 나쁜 건 독

IMP
8/10
핵심 요약

AI 코딩 에이전트의 성능을 좌우하는 'AGENTS.md' 파일의 효과를 체계적으로 분석한 실험 결과입니다. 잘못 작성된 문서는 오히려 작업 완성도를 최대 30% 떨어뜨릴 수 있지만, 점진적 정보 공개나 순차적 워크플로우 등 핵심 패턴을 적용하면 모델을 상위 버전으로 업그레이드한 것과 같은 성능 향상을 얻을 수 있습니다.

번역된 본문

우리는 모노레포 전체에서 수십 개의 AGENTS.md 파일을 수집하여 코드 생성에 미치는 영향을 측정했습니다. 가장 우수했던 파일들은 코딩 에이전트의 품질을 Haiku에서 Opus로 업그레이드한 것과 맞먹는 도약을 이끌어냈습니다. 반면, 가장 최악의 파일들은 AGENTS.md가 아예 없을 때보다 출력 결과를 더 나쁘게 만들었습니다.

이러한 격차는 매우 놀라웠고, 우리는 이를 중심으로 체계적인 연구를 진행했습니다. 우리가 발견한 사실은 다음과 같습니다. 사람들이 AGENTS.md에 적어둔 대부분의 내용은 도움이 되지 않거나, 오히려 방해가 됩니다. 그리고 효과가 있는 패턴들은 구체적이며 학습 가능합니다.

같은 파일이 특정 작업에는 도움이 되지만, 다른 작업에서는 30%나 성능을 떨어뜨릴 수 있습니다. 단일 AGENTS.md가 모든 상황에서 무조건 좋거나 나쁜 것은 아닙니다. 동일한 파일이 단순 버그 수정에서는 best_practices(모범 사례) 점수를 25% 높였지만, 같은 모듈의 복잡한 기능 개발 작업에서는 완성도(completeness)를 30% 떨어뜨렸습니다.

버그 수정에서는 두 가지 유사한 데이터 패칭 방식 중 하나를 선택하기 위한 의사결정표(Decision table)가 에이전트가 올바른 패턴을 즉시 선택하고 코드베이스 표준을 준수하도록 도왔습니다. 하지만 기능 개발 작업에서는 에이전트가 동일한 파일을 읽고 참고 문헌 섹션으로 빠져들어, 자신의 접근 방식이 모든 가이드라인에 부합하는지 검증하기 위해 수십 개의 다른 마크다운 파일을 열어보았습니다. 그 결과 불필요한 추상화를 만들어내고 불완전한 솔루션을 제출했습니다. 문서의 다른 블록(구역)들이 각기 다른 작업에 정반대의 효과를 미친 것입니다.

이어지는 내용에서는 어떤 패턴이 통하고, 어떤 패턴이 실패하는지, 그리고 우리 코드베이스에서 이를 어떻게 구분할 수 있는지 설명합니다.

우리는 어떻게 측정했는가 우리는 내부 평가 도구 모음 중 하나인 AuggieBench를 사용하여 에이전트가 사내 개발 업무를 얼마나 잘 수행하는지 평가했습니다. 대규모 리포지토리에서 가져온 고품질 PR(풀 리퀘스트)을 기준으로 삼았는데, 이는 여러 시니어 엔지니어의 리뷰를 거쳐 실제로 병합된 일상적인 에이전트 작업을 반영합니다. 환경과 프롬프트를 설정한 뒤 에이전트에게 동일한 작업을 수행하도록 요청하고, 그 출력 결과를 '골든 PR(정답이 되는 PR)'과 비교했습니다. 범위가 표류(Scope creep)했거나 알려진 버그가 있는 PR은 걸러냈습니다.

이번 연구에서는 두 가지 필터를 추가했습니다. PR은 단일 모듈이나 앱 내에 국한되어야 했고, AGENTS.md의 정보가 실질적으로 도움이 될 수 있는 범위여야 했습니다. 그런 다음 각 작업을 파일이 있는 경우와 없는 경우로 나누어 두 번 실행하고 점수를 비교했습니다.

무엇이 효과가 있는가

  1. 포괄적인 내용보다는 점진적 정보 공개(Progressive disclosure) AGENTS.md를 하나의 '기술(Skill)'처럼 다루세요. 일반적인 케이스와 워크플로우를 상위 수준에서 다루고, 세부 정보는 에이전트가 필요할 때 불러올 수 있는 참고 파일로 분리하세요. 에이전트가 언제 해당 파일을 가져와야 하는지 알 수 있도록 각 참고 파일의 범위를 명확히 하세요.

약 100150줄짜리 AGENTS.md 파일과 몇 개의 중점적인 참고 문서를 갖춘 구성이 이번 연구에서 가장 뛰어난 성능을 보였습니다. 약 100개의 핵심 파일로 이루어진 중간 규모 모듈에서 모든 지표에 걸쳐 1015%의 성능 향상을 이끌어냈습니다. 하지만 메인 파일이 해당 길이를 넘어서자, 오히려 성능 향상폭이 줄어들거나 역효과가 나타났습니다.

  1. 순차적 워크플로우는 실패하는 에이전트를 성공으로 이끈다 작업을 번호가 매겨진 여러 단계의 워크플로우로 설명하는 것은 우리가 측정한 패턴 중 가장 강력한 효과 중 하나였습니다. 잘 작성된 워크플로우는 에이전트가 작업을 완료하지 못하는 상태에서 벗어나, 첫 번째 시도만에 정확한 해결책을 제시하도록 만들 수 있습니다.

우리 코드베이스의 한 예시로, 새로운 통합 기능을 배포하기 위한 6단계 워크플로우가 있었습니다. 에이전트는 이를 단계별로 그대로 따랐습니다. 그 결과 누락된 연결 파일이 있는 PR의 비율이 40%에서 10%로 떨어졌으며, 에이전트가 평균적으로 더 빠르게 작업을 마쳤습니다. 정확성(Correctness)은 25% 올랐고, 완성도(Completeness)는 20% 향상되었습니다. 복잡한 워크플로우의 경우 메인 파일은 간결하게 유지하고, 분기가 발생하는 케이스에 대해서는 참고 파일을 사용하세요.

  1. 의사결정표는 에이전트가 코드를 작성하기 전에 모호성을 해결합니다 코드베이스에 무언가를 처리할 수 있는 합리적인 방법이 두세 가지 있을 때, 의사결정표(Decision table)는 선택을 사전에 강제하게 합니다. 이 패턴은 코드베이스 규칙 준수도를 직접적으로 높여준 패턴입니다.

예시: 상태 관리를 위해 React Query와 Zustand 중 무엇을 사용할지 결정하기 질문 → React Query → Zustand 서버가 유일한 데이터 소스인가? ✅ → 여러 코드 경로에서 이 상태를 변경하는가? → ✅ 낙관적 업데이트(Optimistic updates)와 로컬 상태를 혼합해야 하는가? → ✅

이 영역의 PR은 best_practices 점수에서 25% 더 높은 성능을 보였습니다. 이 표는 에이전트가 단 한 줄의 코드도 작성하기 전에 모호성을 해결해 주었습니다.

  1. 실제 코드베이스의 예시는 일관성을 개선한다
원문 보기
원문 보기 (영어)
We pulled dozens of AGENTS.md files from across our monorepo and measured their effect on code generation. The best ones gave our coding agent a quality jump equivalent to upgrading from Haiku to Opus. The worst ones made the output worse than having no AGENTS.md at all. That gap was surprising enough that we built a systematic study around it. What we found: most of what people put in AGENTS.md either doesn't help or actively hurts, and the patterns that work are specific and learnable. The same file can help one task and hurt another by 30% A single AGENTS.md isn't uniformly good or bad. The same file boosted best_practices by 25% on a routine bug fix and dropped completeness by 30% on a complex feature task in the same module. On the bug fix, a decision table for choosing between two similar data-fetching approaches helped the agent pick the right pattern immediately and stay within codebase standards. On the feature task, the agent read that same file, got pulled into the reference section, opened dozens of other markdown files trying to verify its approach against every guideline, created unnecessary abstractions, and shipped an incomplete solution. Different blocks of the document had opposite effects on different tasks. What follows is which patterns work, which fail, and how to tell which is which for your codebase. How we measured this We used AuggieBench, one of our internal eval suites, to evaluate how well agents do our internal dev work. We start with high-quality PRs from a large repo that reflect typical day-to-day agent tasks, set up the environment and prompt, and ask the agent to do the same task. Then we compare its output against the golden PR, the version that actually landed after review by multiple senior engineers. We filtered out PRs with scope creep or known bugs. For this study, we added two more filters: PRs had to be contained within a single module or app, and the scope had to be one where information in an AGENTS.md might plausibly help. We then ran each task twice, with and without the file, and compared scores. What works 1. Progressive disclosure beats comprehensive coverage Treat your AGENTS.md like a skill. Cover the common cases and workflows at a high level, then push details into reference files the agent can load on demand. Keep each reference's scope clear so the agent knows when to pull it in. The 100–150 line AGENTS.md files with a handful of focused reference documents were the top performers in our study, delivering 10–15% improvements across all metrics in mid-size modules of around 100 core files. Once the main file got longer than that, the gains started reversing. 2. Procedural workflows take agents from failing to finishing Describing a task as a numbered, multi-step workflow was one of the strongest patterns we measured. A well-written workflow can move the agent from unable to complete a task to producing a correct solution on the first try. One example from our codebase: a six-step workflow for deploying a new integration. The agent followed it step by step. The share of PRs with missing wiring files dropped from 40% to 10%, and the agent finished faster on average. Correctness went up 25%. Completeness went up 20%. For complex workflows, keep the main file concise and use reference files for branching cases. 3. Decision tables resolve ambiguity before the agent writes code When your codebase has two or three reasonable ways to do something, decision tables force the choice up front. This is the pattern that most directly improved adherence to codebase conventions. Example : resolving React Query vs Zustand for state management. Question → React Query → Zustand Server is the only data source? ✅ Multiple code paths mutate this state? ✅ Need optimistic updates mixed with local state? ✅ PRs in this area scored 25% higher on best_practices . The table resolved the ambiguity before the agent wrote a single line of code. 4. Examples from the real codebase improve code reuse Short snippets of 3–10 lines from actual production code improved reuse and pattern adherence. Keep it to a few examples that are most relevant and not duplicative. More than that and the agent starts pattern-matching on the wrong thing. Example: we included copy-paste templates for Redux Toolkit primitives: createSlice with typed initial state, createAsyncThunk with proper error handling, and the typed useAppSelector hook. code_reuse went up 20%. The agent followed the template instead of inventing its own state management pattern, and the codebase stayed consistent. 5. Domain-specific rules still matter This is the pattern most people already associate with AGENTS.md : language- or org-specific gotchas. Example: Use Decimal instead of float for all financial calculations. The agent catches truncation, rounding, and precision issues that it would otherwise miss. best_practices improves whenever the rule is directly relevant to the task. This works when the rule is specific and enforceable. It stops working when you stack dozens of them. See the overexploration section below. 6. Pair every "don't" with a "do" Warning-only documentation consistently underperformed documentation that paired prohibitions with a concrete alternative. If you add Don't instantiate HTTP clients directly , pair it with Use the shared apiClient from lib/http with the retry middleware. The first on its own makes the agent cautious and exploratory. The pair tells it what to do and moves on. AGENTS.md files with 15+ sequential "don'ts" and no "dos" caused the agent to over-explore, stay conservative, and do less work. More on that below. 7. Keep your code modular, and AGENTS.md too The best-performing agent docs described relatively isolated submodules. Mid-size modules, around 100 core files, with a 100–150 line AGENTS.md and a few reference documents, were where we saw the 10–15% cross-metric gains. Examples: UI components of the client, standalone services. Huge, cross-cutting AGENTS.md files at the repo root underperformed module-level ones. But the document itself is only part of the story. In our study, the worst-performing AGENTS.md files were the ones sitting on top of massive surrounding documentation. One module had 37 related docs totaling about 500K characters. Another had 226 docs totaling over 2MB. In both cases, removing just the AGENTS.md barely changed agent behavior. The agent kept finding and reading the surrounding doc sprawl, and the sprawl was the problem. If your AGENTS.md is good but your module has 500K of specs around it, the specs are what the agent is reading. Fix the documentation environment, not just the entry point. Where AGENTS.md falls short The overexploration trap This is the most common failure mode we observed, and it's essentially context rot. Two patterns cause it: 1. Too much architecture overview. The agent gets pulled into reading documentation files, sometimes dozens of them, trying to "better understand the architecture." It loads tens or hundreds of thousands of tokens of context, and the output gets worse. Example : an AGENTS.md included a full service topology covering the event bus, message queues, API gateway routing, and shared middleware layers, with reasoning for every architectural decision. The task: a two-line config change. The agent read 12 documentation files trying to understand the architecture before touching code, loaded about 80K tokens of irrelevant context, got confused about which service owned the config, and produced an incomplete fix. completeness dropped 25%. Fix : keep architecture descriptions concise and isolated. Vague descriptions of component responsibilities push the agent into exploration mode. Highlight boundaries. Focus on the what , not the why . 2. Excessive warnings A big section of "don'ts" without matching "dos" produces a specific failure. The agent reads each instruction, tries to figure out whether it applies to the current task, and