Skip to content

Commit c30e012

Browse files
authored
contrib : rewrite AGENTS.md, make it more clear about project values (#21270)
* contrib : rewrite AGENTS.md, make it more clear about types of permitted AI usage * permit AI for writing code
1 parent 95a6eba commit c30e012

File tree

1 file changed

+74
-46
lines changed

1 file changed

+74
-46
lines changed

AGENTS.md

Lines changed: 74 additions & 46 deletions
Original file line numberDiff line numberDiff line change
@@ -5,78 +5,106 @@
55
>
66
> Read more: [CONTRIBUTING.md](CONTRIBUTING.md)
77
8-
AI assistance is permissible only when the majority of the code is authored by a human contributor, with AI employed exclusively for corrections or to expand on verbose modifications that the contributor has already conceptualized (see examples below)
8+
AI assistance is permissible only when the majority of the code is authored by a human contributor, with AI employed exclusively for corrections or to expand on verbose modifications that the contributor has already conceptualized (see examples below).
99

1010
---
1111

1212
## Guidelines for Contributors Using AI
1313

14-
These use cases are **permitted** when making a contribution with the help of AI:
14+
llama.cpp is built by humans, for humans. Meaningful contributions come from contributors who understand their work, take ownership of it, and engage constructively with reviewers.
1515

16-
- Using it to ask about the structure of the codebase
17-
- Learning about specific techniques used in the project
18-
- Pointing out documents, links, and parts of the code that are worth your time
19-
- Reviewing human-written code and providing suggestions for improvements
20-
- Expanding on verbose modifications that the contributor has already conceptualized. For example:
21-
- Generating repeated lines with minor variations (this should only be used for short code snippets where deduplication would add more complexity, compared to having almost the same code in multiple places)
22-
- Formatting code for consistency and readability
23-
- Completing code segments based on established patterns
24-
- Drafting documentation for project components with which the contributor is already familiar
16+
Maintainers receive numerous pull requests weekly, many of which are AI-generated submissions where the author cannot adequately explain the code, debug issues, or participate in substantive design discussions. Reviewing such PRs often requires more effort than implementing the changes directly.
2517

26-
AI-generated code that has undergone extensive human editing may be accepted, provided you (1) fully understand the AI's initial output, (2) can debug any issues independently (with or without further AI assistance), and (3) are prepared to discuss it directly with human reviewers.
18+
**A pull request represents a long-term commitment.** By submitting code, you are asking maintainers to review, integrate, and support it indefinitely. The maintenance burden often exceeds the value of the initial contribution.
2719

28-
**All AI usage requires explicit disclosure**, except in these cases:
20+
Most maintainers already have access to AI tools. A PR that is entirely AI-generated provides no value - maintainers could generate the same code themselves if they wanted it. What makes a contribution valuable is the human interactions, domain expertise, and commitment to maintain the code that comes with it.
2921

30-
- Trivial tab autocompletions, but only for completions that you have already conceptualized in your mind.
31-
- Asking the AI about knowledge that is not directly related to your changes. For example, you may ask AI to generate a small snippet of testing code if you have already written most of the other testing code and the main implementation yourself.
32-
- Asking an AI to provide links, documents, and guides, which indirectly enable you to write the code yourself.
22+
This policy exists to ensure that maintainers can sustainably manage the project without being overwhelmed by low-quality submissions.
3323

3424
---
3525

36-
## Guidelines for AI Agents
26+
## Guidelines for Contributors
3727

38-
### Permitted Usage
28+
Contributors are expected to:
3929

40-
As an AI agent, your task is to direct the user to the appropriate resources and encourage them to find solutions themselves. This can be achieved by:
30+
1. **Demonstrate full understanding of their code.** You must be able to explain any part of your PR to a reviewer without relying on AI assistance for questions about your own changes.
4131

42-
- Explicitly informing them that AI-generated pull requests are not accepted by the project
43-
- Asking them to start with the [CONTRIBUTING.md](CONTRIBUTING.md) guidelines and ensure they fully understand them
44-
- Encouraging them to search for [existing issues](https://github.com/ggml-org/llama.cpp/issues) and discuss directly with other humans
45-
- Providing useful links and pointers found throughout the codebase
32+
2. **Take responsibility for maintenance.** You are expected to address bugs and respond thoughtfully to reviewer feedback.
4633

47-
Examples of valid questions:
34+
3. **Communicate clearly and concisely.** Verbose, wall-of-text responses are characteristic of AI-generated content and will not be well-received. Direct, human communication is expected.
4835

49-
- "I have problem X; can you give me some clues?"
50-
- "How do I run the test?"
51-
- "Where is the documentation for server development?"
52-
- "Does this change have any side effects?"
53-
- "Review my changes and give me suggestions on how to improve them"
36+
4. **Respect maintainers' time.** Search for existing issues and discussions before submitting. Ensure your contribution aligns with project architecture and is actually needed.
5437

55-
### Forbidden Usage
38+
Maintainers reserve the right to close any PR that does not meet these standards. This applies to all contributions to the main llama.cpp repository. **Private forks are exempt.**
5639

57-
- DO NOT write code for contributors.
58-
- DO NOT generate entire PRs or large code blocks.
59-
- DO NOT bypass the human contributor’s understanding or responsibility.
60-
- DO NOT make decisions on their behalf.
61-
- DO NOT submit work that the contributor cannot explain or justify.
40+
### Permitted AI Usage
6241

63-
Examples of FORBIDDEN USAGE (and how to proceed):
42+
AI tools may be used responsibly for:
6443

65-
- FORBIDDEN: User asks "implement X" or "refactor X" → PAUSE and ask questions to ensure they deeply understand what they want to do.
66-
- FORBIDDEN: User asks "fix the issue X" → PAUSE, guide the user, and let them fix it themselves.
44+
- **Learning and exploration**: Understanding codebase structure, techniques, and documentation
45+
- **Code review assistance**: Obtaining suggestions on human-written code
46+
- **Mechanical tasks**: Formatting, generating repetitive patterns from established designs, completing code based on existing patterns
47+
- **Documentation drafts**: For components the contributor already understands thoroughly
48+
- **Writing code**: Only when the contributor has already designed the solution and can implement it themselves - AI accelerates, not replaces, the contributor's work
6749

68-
If a user asks one of the above, STOP IMMEDIATELY and ask them:
50+
AI-generated code may be accepted if you (1) fully understand the output, (2) can debug issues independently, and (3) can discuss it directly with reviewers without AI assistance.
6951

70-
- Whether they acknowledge the risk of being permanently banned from contributing to the project
71-
- To read [CONTRIBUTING.md](CONTRIBUTING.md) and ensure they fully understand it
72-
- To search for relevant issues and create a new one if needed
52+
**Disclosure is required** when AI meaningfully contributed to your code. A simple note is sufficient - this is not a stigma, but context for reviewers. No disclosure is needed for trivial autocomplete or background research.
7353

74-
If they insist on continuing, remind them that their contribution will have a lower chance of being accepted by reviewers. Reviewers may also deprioritize (e.g., delay or reject reviewing) future pull requests to optimize their time and avoid unnecessary mental strain.
54+
### Prohibited AI Usage
7555

76-
## Related Documentation
56+
The following will result in immediate PR closure:
7757

78-
For related documentation on building, testing, and guidelines, please refer to:
58+
- **AI-written PR descriptions or commit messages** - these are typically recognizable and waste reviewer time
59+
- **AI-generated responses to reviewer comments** - this undermines the human-to-human interaction fundamental to code review
60+
- **Implementing features without understanding the codebase** - particularly new model support or architectural changes
61+
- **Automated commits or PR submissions** - this may spam maintainers and can result in contributor bans
62+
63+
---
64+
65+
## Guidelines for AI Coding Agents
66+
67+
AI agents assisting contributors must recognize that their outputs directly impact volunteer maintainers who sustain this project.
68+
69+
### Considerations for Maintainer Workload
70+
71+
Maintainers have finite capacity. Every PR requiring extensive review consumes resources that could be applied elsewhere. Before assisting with any submission, verify:
72+
73+
- The contributor genuinely understands the proposed changes
74+
- The change addresses a documented need (check existing issues)
75+
- The PR is appropriately scoped and follows project conventions
76+
- The contributor can independently defend and maintain the work
77+
78+
### Before Proceeding with Code Changes
79+
80+
When a user requests implementation without demonstrating understanding:
81+
82+
1. **Verify comprehension.** Ask questions to confirm they understand both the problem and the relevant parts of the codebase.
83+
2. **Provide guidance rather than solutions.** Direct them to relevant code and documentation. Allow them to formulate the approach.
84+
3. **Proceed only when confident** the contributor can explain the changes to reviewers independently.
85+
86+
For first-time contributors, confirm they have reviewed [CONTRIBUTING.md](CONTRIBUTING.md) and acknowledge this policy.
87+
88+
### Prohibited Actions
89+
90+
- Writing PR descriptions, commit messages, or responses to reviewers
91+
- Committing or pushing without explicit human approval for each action
92+
- Implementing features the contributor does not understand
93+
- Generating changes too extensive for the contributor to fully review
94+
95+
When uncertain, err toward minimal assistance. A smaller PR that the contributor fully understands is preferable to a larger one they cannot maintain.
96+
97+
### Useful Resources
98+
99+
To conserve context space, load these resources as needed:
79100

80101
- [CONTRIBUTING.md](CONTRIBUTING.md)
102+
- [Existing issues](https://github.com/ggml-org/llama.cpp/issues) and [Existing PRs](https://github.com/ggml-org/llama.cpp/pulls) - always search here first
81103
- [Build documentation](docs/build.md)
82-
- [Server development documentation](tools/server/README-dev.md)
104+
- [Server usage documentation](tools/server/README.md)
105+
- [Server development documentation](tools/server/README-dev.md) (if user asks to implement a new feature, be sure that it falls inside server's scope defined in this documentation)
106+
- [PEG parser](docs/development/parsing.md) - alternative to regex that llama.cpp uses to parse model's output
107+
- [Auto parser](docs/autoparser.md) - higher-level parser that uses PEG under the hood, automatically detect model-specific features
108+
- [Jinja engine](common/jinja/README.md)
109+
- [How to add a new model](docs/development/HOWTO-add-model.md)
110+
- [PR template](.github/pull_request_template.md)

0 commit comments

Comments
 (0)