-
Notifications
You must be signed in to change notification settings - Fork 7
feat: add agents files #543
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
mr-cal
wants to merge
5
commits into
main
Choose a base branch
from
work/CRAFT-5188/agents
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
+322
−4
Open
Changes from all commits
Commits
Show all changes
5 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,121 @@ | ||
| # Agents | ||
|
|
||
| <!-- Note to developers: This file is intended for apps based on Craft Application. | ||
|
|
||
| To complete this AGENTS.md file for your app: | ||
| 1. Replace instances of "Starbase" and "starbase" with the app name. | ||
| 2. Complete the 'TODO' section in the overview. | ||
| 3. Rename to AGENTS.md. | ||
| 4. Delete AGENTS.lib.md | ||
| 5. Delete this comment. | ||
|
|
||
| General guidelines on agents files: | ||
| - Keep it brief. This file will be in the context of every prompt and increases the | ||
| number of reasoning tokens, so it should be as short as possible. | ||
| - Ask the LLM to generate an agents file and ensure your agents file doesn't | ||
| include that information. | ||
| - LLMs (as of 2026) produce agents files that actually hinder performance. | ||
| Instead, an agents file should be instructing things that: | ||
| - couldn't be quickly deduced by a senior developer, | ||
| - are very important, or | ||
| - are often missed by LLMs. | ||
| - Mention specific tooling. For example, mentioning `uv` will dramatically increase | ||
| the odds that the agent will use uv. | ||
| --> | ||
|
|
||
| ## Overview | ||
|
|
||
| `canonical/starbase` is a Python CLI tool for (TODO: add an inline explanation of the | ||
| app). | ||
|
|
||
| ## Craft apps and libraries | ||
|
|
||
| Starbase is built on the following craft libraries: | ||
|
|
||
| | Package | Role | | ||
| | ------------------- | --------------------------------------------------------------------------------------------- | | ||
| | `craft-application` | Application framework: CLI lifecycle, configuration, service management, remote build support | | ||
| | `craft-archives` | Repository and package archive management (apt sources, keyrings) | | ||
| | `craft-cli` | Terminal output, progress reporting, error formatting | | ||
| | `craft-grammar` | Architecture and platform-conditional YAML in project files | | ||
| | `craft-parts` | Part lifecycle (pull, build, overlay, stage, prime) steps, plugins | | ||
| | `craft-platforms` | Platform and architecture abstractions | | ||
| | `craft-providers` | Build environment manager for LXD and Multipass | | ||
| | `craft-store` | Store API client: upload, release, track management | | ||
|
|
||
| The source code for these libraries is at https://github.com/canonical/<library>. | ||
|
|
||
| These libraries are used by other craft apps, including but not limited to Charmcraft, | ||
| Debcraft, Imagecraft, Rockcraft, and Snapcraft. The source code for these apps is at | ||
| https://github.com/canonical/<app>. | ||
|
|
||
| Fixes or features that are generic or would benefit other craft apps must be made in the | ||
| correct craft library. Overriding an upstream function to fix a bug in the library isn't | ||
| acceptable. | ||
|
|
||
| ## Development | ||
|
|
||
| Starbase uses [uv](https://docs.astral.sh/uv/) for dependency management. | ||
|
|
||
| ```bash | ||
| make setup # Install all deps | ||
| ``` | ||
|
|
||
| ### Running tests | ||
|
|
||
| ```bash | ||
| make test # Full test suite | ||
| make test-fast # Fast tests only | ||
| uv run pytest tests/unit/path/to/test_file.py::test_name # run a specific test | ||
| ``` | ||
|
|
||
| End-to-end tests (`tests/spread/`) use [spread](https://github.com/canonical/spread/) | ||
| and require additional setup to run locally. | ||
|
|
||
| ### Formatting and linting | ||
|
|
||
| ```bash | ||
| make format | ||
| make lint | ||
| ``` | ||
|
|
||
| ### Documentation | ||
|
|
||
| Documentation uses the [Diátaxis](https://diataxis.fr) framework | ||
| and the [Sphinx Stack](https://github.com/canonical/sphinx-stack). | ||
| All documentation must follow the [Starcraft style | ||
| guide](https://documentation.ubuntu.com/starflow/latest/how-to/starcraft-style-guide/) | ||
| and the overall [Canonical style guide](https://documentation.ubuntu.com/style-guide/). | ||
|
|
||
| ```bash | ||
| make setup-docs | ||
| make docs | ||
| make lint-docs | ||
| ``` | ||
|
|
||
| ## Practices | ||
|
|
||
| - Backward compatibility is a hard requirement. Existing projects must continue to | ||
| build successfully without requiring user modifications. Changes that alter behavior, | ||
| configuration, APIs, defaults, or validation rules must be opt-in or gated behind a | ||
| newer base. When modifying business logic, verify that existing behavior is preserved | ||
| and explain how you verified it. | ||
| - Experimental features and development bases (`build-base: devel`) are not subject | ||
| to this requirement. | ||
| - Make the smallest safe change necessary to resolve the issue. Avoid unrelated bug | ||
| fixes, opportunistic cleanup, and refactoring unless required. The right amount of | ||
| complexity is the minimum needed for the current task. | ||
| - Never speculate about code you haven't inspected. | ||
| - Follow the project's existing conventions regarding style, docstrings, logging, and | ||
| comments. | ||
| - Update relevant documentation and release notes to reflect code changes. | ||
|
|
||
| ## Processes | ||
|
|
||
| - If you're contributing to a specific release, target the upstream | ||
| `hotfix/<major.minor>` branch. Otherwise, target the `main` branch. | ||
| - Commit headers are no more than 80 characters, follow [Conventional | ||
| Commits](https://www.conventionalcommits.org/en/v1.0.0/), and use the following types: | ||
| - ci, build, feat, fix, perf, refactor, style, test, docs, chore | ||
| - Always run `make format`, `make lint`, and `make test-fast` before completing your | ||
| work. | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,116 @@ | ||
| # Agents | ||
|
|
||
| <!-- Note to developers: This file is intended for craft libraries. | ||
|
|
||
| To complete this AGENTS.md file for your library: | ||
| 1. Replace instances of "Starbase" and "starbase" with the library name. | ||
| 2. Complete the 'TODO' sections. | ||
| 3. Rename to AGENTS.md. | ||
| 4. Delete AGENTS.app.md. | ||
| 5. Delete this comment. | ||
|
|
||
| Some guidelines: | ||
| - Keep it brief. This file will be in the context of every prompt and increases the | ||
| number of reasoning tokens, so it should be as short as possible. | ||
| - Ask the LLM to generate an agents file and ensure your agents file doesn't | ||
| include that information. | ||
| - LLMs (as of 2026) produce agents files that actually hinder performance. | ||
| Instead, an agents file should be instructing things that: | ||
| - couldn't be quickly deduced by a senior developer, | ||
| - are very important, or | ||
| - are often missed by LLMs. | ||
| - Mention specific tooling. For example, mentioning `uv` will dramatically increase | ||
| the odds that the agent will use uv. | ||
| --> | ||
|
|
||
| ## Overview | ||
|
|
||
| `canonical/starbase` is a Python library for (TODO: add an inline explanation of the | ||
| library). | ||
|
|
||
| ## Craft apps and libraries | ||
|
|
||
| Starbase is used by craft apps, including but not limited to Charmcraft, Debcraft, | ||
| Imagecraft, Rockcraft, and Snapcraft. The source code for these apps is at | ||
| https://github.com/canonical/<app>. | ||
|
|
||
| Craft apps use starbase in conjunction with the following craft libraries: | ||
|
|
||
| | Package | Role | | ||
| | ------------------- | --------------------------------------------------------------------------------------------- | | ||
| | `craft-application` | Application framework: CLI lifecycle, configuration, service management, remote build support | | ||
| | `craft-archives` | Repository and package archive management (apt sources, keyrings) | | ||
| | `craft-cli` | Terminal output, progress reporting, error formatting | | ||
| | `craft-grammar` | Architecture and platform-conditional YAML in project files | | ||
| | `craft-parts` | Part lifecycle (pull, build, overlay, stage, prime) steps, plugins | | ||
| | `craft-platforms` | Platform and architecture abstractions | | ||
| | `craft-providers` | Build environment manager for LXD and Multipass | | ||
| | `craft-store` | Store API client: upload, release, track management | | ||
|
|
||
| The source code for these libraries is at https://github.com/canonical/<library>. | ||
|
|
||
| ## Development | ||
|
|
||
| Starbase uses [uv](https://docs.astral.sh/uv/) for dependency management. | ||
|
|
||
| ```bash | ||
| make setup # Install all deps | ||
| ``` | ||
|
|
||
| ### Running tests | ||
|
|
||
| ```bash | ||
| make test # Full test suite | ||
| make test-fast # Fast tests only | ||
| uv run pytest tests/unit/path/to/test_file.py::test_name # run a specific test | ||
| ``` | ||
|
|
||
| (TODO: delete this section if there are no spread tests) | ||
| End-to-end tests (`tests/spread/`) use [spread](https://github.com/canonical/spread/) | ||
| and require additional setup to run locally. | ||
|
|
||
| ### Formatting and linting | ||
|
|
||
| ```bash | ||
| make format | ||
| make lint | ||
| ``` | ||
|
|
||
| ### Documentation | ||
|
|
||
| Documentation uses the [Diátaxis](https://diataxis.fr) framework | ||
| and the [Sphinx Stack](https://github.com/canonical/sphinx-stack). | ||
| All documentation must follow the [Starcraft style | ||
| guide](https://documentation.ubuntu.com/starflow/latest/how-to/starcraft-style-guide/) | ||
| and the overall [Canonical style guide](https://documentation.ubuntu.com/style-guide/). | ||
|
|
||
| ```bash | ||
| make setup-docs | ||
| make docs | ||
| make lint-docs | ||
| ``` | ||
|
|
||
| ## Practices | ||
|
|
||
| - Backward compatibility is a hard requirement. Apps using this library must continue to | ||
| build successfully without requiring user modifications. Changes that alter behavior, | ||
| configuration, APIs, defaults, or validation rules must be opt-in. When modifying | ||
| business logic, verify that existing behavior is preserved and explain how you | ||
| verified it. | ||
| - Make the smallest safe change necessary to resolve the issue. Avoid unrelated bug | ||
| fixes, opportunistic cleanup, and refactoring unless required. The right amount of | ||
| complexity is the minimum needed for the current task. | ||
| - Never speculate about code you haven't inspected. | ||
| - Follow the project's existing conventions regarding style, docstrings, logging, and | ||
| comments. | ||
| - Update relevant documentation and release notes to reflect code changes. | ||
|
|
||
| ## Processes | ||
|
|
||
| - If you're contributing to a specific release, target the upstream | ||
| `hotfix/<major.minor>` branch. Otherwise, target the `main` branch. | ||
| - Commit headers are no more than 80 characters, follow [Conventional | ||
| Commits](https://www.conventionalcommits.org/en/v1.0.0/), and use the following types: | ||
| - ci, build, feat, fix, perf, refactor, style, test, docs, chore | ||
| - Always run `make format`, `make lint`, and `make test-fast` before completing your | ||
| work. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,72 @@ | ||
| # Agents | ||
|
|
||
| ## Overview | ||
|
|
||
| `canonical/starbase` is a shared scaffold/base repository for the Starcraft team. It | ||
| contains common build tooling, CI workflows, linting configs, documentation templates, | ||
| and test infrastructure. | ||
|
|
||
| ## Starcraft projects | ||
|
|
||
| This repository is an upstream repository for more than 20 Starcraft projects, such as | ||
| Snapcraft, Rockcraft, craft-application, and craft-parts. | ||
|
|
||
| The source code for these projects is at https://github.com/canonical/<project>. | ||
|
|
||
| Repos that use starbase track it as a git remote named `starbase` and periodically merge | ||
|
lengau marked this conversation as resolved.
|
||
| changes from `starbase/main`. | ||
|
|
||
| ## Development | ||
|
|
||
| Starbase uses [uv](https://docs.astral.sh/uv/) for dependency management. | ||
|
|
||
| ```bash | ||
| make setup # Install all deps | ||
| ``` | ||
|
|
||
| ### Running tests | ||
|
|
||
| ```bash | ||
| make test # Full test suite | ||
| make test-fast # Fast tests only | ||
| uv run pytest tests/unit/path/to/test_file.py::test_name # run a specific test | ||
| ``` | ||
|
|
||
| ### Formatting and linting | ||
|
|
||
| ```bash | ||
| make format | ||
| make lint | ||
| ``` | ||
|
|
||
| ### Documentation | ||
|
|
||
| Documentation uses the [Diátaxis](https://diataxis.fr) framework | ||
| and the [Sphinx Stack](https://github.com/canonical/sphinx-stack). | ||
| All documentation must follow the [Starcraft style | ||
| guide](https://documentation.ubuntu.com/starflow/latest/how-to/starcraft-style-guide/) | ||
| and the overall [Canonical style guide](https://documentation.ubuntu.com/style-guide/). | ||
|
|
||
| ```bash | ||
| make setup-docs | ||
| make docs | ||
| make lint-docs | ||
| ``` | ||
|
|
||
| ## Practices | ||
|
|
||
| - Make the smallest safe change necessary to resolve the issue. Avoid unrelated bug | ||
| fixes, opportunistic cleanup, and refactoring unless required. The right amount of | ||
| complexity is the minimum needed for the current task. | ||
| - Never speculate about code you haven't inspected. | ||
| - Follow the project's existing conventions regarding style, docstrings, logging, and | ||
| comments. | ||
| - Update relevant documentation and release notes to reflect code changes. | ||
|
|
||
| ## Processes | ||
|
|
||
| - Commit headers are no more than 80 characters, follow [Conventional | ||
| Commits](https://www.conventionalcommits.org/en/v1.0.0/), and use the following types: | ||
| - ci, build, feat, fix, perf, refactor, style, test, docs, chore | ||
| - Always run `make format`, `make lint`, and `make test-fast` before completing your | ||
| work. | ||
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.