mirror of
https://github.com/All-Hands-AI/OpenHands.git
synced 2026-01-09 14:57:59 -05:00
Improve repo.md documentation to instruct OpenHands on capturing repository context efficiently (#8977)
Co-authored-by: openhands <openhands@all-hands.dev>
This commit is contained in:
@@ -11,7 +11,7 @@ Currently OpenHands supports the following types of microagents:
|
|||||||
- [Keyword-Triggered Microagents](./microagents-keyword): Guidelines activated by specific keywords in prompts.
|
- [Keyword-Triggered Microagents](./microagents-keyword): Guidelines activated by specific keywords in prompts.
|
||||||
|
|
||||||
To customize OpenHands' behavior, create a .openhands/microagents/ directory in the root of your repository and
|
To customize OpenHands' behavior, create a .openhands/microagents/ directory in the root of your repository and
|
||||||
add `<microagent_name>.md` files inside.
|
add `<microagent_name>.md` files inside. For repository-specific guidelines, you can ask OpenHands to analyze your repository and create a comprehensive `repo.md` file (see [General Microagents](./microagents-repo) for details).
|
||||||
|
|
||||||
<Note>
|
<Note>
|
||||||
Loaded microagents take up space in the context window.
|
Loaded microagents take up space in the context window.
|
||||||
|
|||||||
@@ -17,13 +17,45 @@ Frontmatter should be enclosed in triple dashes (---) and may include the follow
|
|||||||
|-----------|-----------------------------------------|----------|----------------|
|
|-----------|-----------------------------------------|----------|----------------|
|
||||||
| `agent` | The agent this microagent applies to | No | 'CodeActAgent' |
|
| `agent` | The agent this microagent applies to | No | 'CodeActAgent' |
|
||||||
|
|
||||||
## Example
|
## Creating a Comprehensive Repository Agent
|
||||||
|
|
||||||
|
To create an effective repository agent, you can ask OpenHands to analyze your repository with a prompt like:
|
||||||
|
|
||||||
General microagent file example located at `.openhands/microagents/repo.md`:
|
|
||||||
```
|
```
|
||||||
|
Please browse the repository, look at the documentation and relevant code, and understand the purpose of this repository.
|
||||||
|
|
||||||
|
Specifically, I want you to create a `.openhands/microagents/repo.md` file. This file should contain succinct information that summarizes:
|
||||||
|
1. The purpose of this repository
|
||||||
|
2. The general setup of this repo
|
||||||
|
3. A brief description of the structure of this repo
|
||||||
|
|
||||||
|
Read all the GitHub workflows under .github/ of the repository (if this folder exists) to understand the CI checks (e.g., linter, pre-commit), and include those in the repo.md file.
|
||||||
|
```
|
||||||
|
|
||||||
|
This approach helps OpenHands capture repository context efficiently, reducing the need for repeated searches during conversations and ensuring more accurate solutions.
|
||||||
|
|
||||||
|
## Example Content
|
||||||
|
|
||||||
|
A comprehensive repository agent file (`.openhands/microagents/repo.md`) should include:
|
||||||
|
|
||||||
|
```
|
||||||
|
# Repository Purpose
|
||||||
This project is a TODO application that allows users to track TODO items.
|
This project is a TODO application that allows users to track TODO items.
|
||||||
|
|
||||||
|
# Setup Instructions
|
||||||
To set it up, you can run `npm run build`.
|
To set it up, you can run `npm run build`.
|
||||||
|
|
||||||
|
# Repository Structure
|
||||||
|
- `/src`: Core application code
|
||||||
|
- `/tests`: Test suite
|
||||||
|
- `/docs`: Documentation
|
||||||
|
- `/.github`: CI/CD workflows
|
||||||
|
|
||||||
|
# CI/CD Workflows
|
||||||
|
- `lint.yml`: Runs ESLint on all JavaScript files
|
||||||
|
- `test.yml`: Runs the test suite on pull requests
|
||||||
|
|
||||||
|
# Development Guidelines
|
||||||
Always make sure the tests are passing before committing changes. You can run the tests by running `npm run test`.
|
Always make sure the tests are passing before committing changes. You can run the tests by running `npm run test`.
|
||||||
```
|
```
|
||||||
|
|
||||||
|
|||||||
@@ -117,7 +117,10 @@ You can see an example of a repo agent in [the agent for the OpenHands repo itse
|
|||||||
- Include repository structure details
|
- Include repository structure details
|
||||||
- Specify testing and build procedures
|
- Specify testing and build procedures
|
||||||
- List environment requirements
|
- List environment requirements
|
||||||
|
- Document CI workflows and checks
|
||||||
|
- Include information about code quality standards
|
||||||
- Maintain up-to-date team practices
|
- Maintain up-to-date team practices
|
||||||
|
- Consider using OpenHands to generate a comprehensive repo.md (see [Creating a Repository Agent](#creating-a-repository-agent))
|
||||||
- YAML frontmatter is optional - files without frontmatter will be loaded with default settings
|
- YAML frontmatter is optional - files without frontmatter will be loaded with default settings
|
||||||
|
|
||||||
### Submission Process
|
### Submission Process
|
||||||
|
|||||||
Reference in New Issue
Block a user