Skip to content

Commit 5bbd0be

Browse files
authored
feat: add AGENTS.md (#17) (#24)
1 parent 948a3fd commit 5bbd0be

File tree

2 files changed

+67
-0
lines changed

2 files changed

+67
-0
lines changed

AGENTS.md

Lines changed: 61 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,61 @@
1+
## Repository Description
2+
- `subroutines` provides the lifecycle engine used by Platform Mesh controllers and operators.
3+
- The main exported areas are subroutine orchestration, typed reconciliation `Result` values, condition management, spread scheduling, finalizer handling, and metrics.
4+
- This is a Go library repo built around [controller-runtime](https://github.com/kubernetes-sigs/controller-runtime) and [multicluster-runtime](https://github.com/platform-mesh/multicluster-runtime).
5+
- Read the org-wide [AGENTS.md](https://github.com/platform-mesh/.github/blob/main/AGENTS.md) for general conventions.
6+
7+
## Core Principles
8+
- Keep changes small and local. Behavior changes here can ripple into multiple downstream operators.
9+
- Prefer extending existing lifecycle patterns over introducing parallel orchestration abstractions.
10+
- Verify behavior before finishing. Start with focused package tests, then broader validation if needed.
11+
- Keep this file focused on agent execution and repository-specific constraints.
12+
13+
## Project Structure
14+
- `subroutines`: core interfaces and typed `Result` helpers.
15+
- `lifecycle`: orchestration engine that runs subroutines and coordinates reconciliation flow.
16+
- `conditions`: condition management helpers for subroutine and aggregate readiness.
17+
- `spread`: helpers for spreading reconciliation work over time.
18+
- `metrics`: Prometheus metrics for subroutine execution.
19+
20+
## Architecture
21+
This is a dependency repo, not a runnable service. Small semantic changes can affect many controllers.
22+
23+
### Lifecycle model
24+
- The core abstraction is the ordered execution of subroutines that return typed `Result` values such as `OK`, `Pending`, and `Stop`.
25+
- `lifecycle` owns reconciliation flow semantics, finalizer handling, and status/condition integration.
26+
- `conditions` is the supported path for condition aggregation; avoid inventing alternative condition wiring in this repo.
27+
28+
### Downstream impact
29+
- Several Platform Mesh operators depend on this library for reconcile ordering and readiness semantics.
30+
- A change that looks local, such as altering `Result` handling or condition updates, can change runtime behavior across multiple repositories.
31+
32+
## Commands
33+
- `task lint` — run formatting and golangci-lint.
34+
- `task test` — run the standard local unit test flow.
35+
- `task cover` — run tests with coverage output.
36+
- `task test-coverage` — enforce coverage thresholds from `.testcoverage.yml`.
37+
- `task validate` — run the standard validation flow.
38+
- `go test ./<pkg>` — fast fallback for targeted package verification.
39+
40+
## Code Conventions
41+
- Preserve public package APIs unless the change is intentionally coordinated with downstream consumers.
42+
- Add or update `_test.go` files alongside behavior changes.
43+
- Follow the existing package split instead of introducing new umbrella utility packages.
44+
- Keep logging, metrics, and condition semantics explicit and predictable.
45+
46+
## Generated Artifacts
47+
- Mocks and generated outputs should be regenerated through the repo workflows, not hand-edited.
48+
- Review coverage-related changes carefully when touching core lifecycle behavior.
49+
50+
## Do Not
51+
- Change `Result` semantics casually.
52+
- Hand-edit generated outputs if a repo workflow exists to regenerate them.
53+
- Update `.testcoverage.yml` unless the task explicitly requires it.
54+
55+
## Hard Boundaries
56+
- Do not invent new local workflows when a `task` target already exists.
57+
- Ask before making changes that intentionally break compatibility for downstream operators.
58+
59+
## Human-Facing Guidance
60+
- Use `README.md` for local setup and rough architecture context.
61+
- Use `CONTRIBUTING.md` for contribution process, DCO, and broader developer workflow expectations.

CONTRIBUTING.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,12 @@ Prefer table-driven tests. To run tests locally:
4646
task test
4747
```
4848

49+
## Generative AI
50+
51+
If you use generative AI tools while preparing a contribution, you remain responsible for the correctness, safety, licensing, and maintainability of the submitted change.
52+
53+
If you use Claude while contributing, do not assume it will automatically pick up this repository's `AGENTS.md`. Explicitly provide or reference `AGENTS.md` at the start of the session so Claude has the repository-specific instructions before it suggests or applies changes.
54+
4955
## Issues
5056

5157
We use GitHub issues to track bugs. Please ensure your description is

0 commit comments

Comments
 (0)