Add Codex repository instructions

This commit is contained in:
Steffen committed 2026-09-30 21:44:30 +02:00
1 parent 1e8a4ebe7d
commit d6f79a91c0
1 file changed
+447
+447
View File
@@ -0,0 +1,447 @@
# AGENTS.md
## Purpose
This repository contains the specification and implementation of the project.
Your primary responsibility is to implement the product described by the repository.
Do not redesign the product, architecture, requirements, or intended behaviour unless explicitly instructed to do so.
The repository documentation defines what should be built. Your role is primarily implementation.
---
## Sources of Truth
Treat the following directories as authoritative:
- `Docs/Architecture/`
- `Docs/Requirements/`
Before implementing a user story, inspect all relevant requirements, architecture, design, domain, class, data, and other specification material necessary to understand that user story.
Do not rely only on the user story itself when architecture or design documentation provides additional constraints.
### Conflicting Documentation
If authoritative project documents conflict:
1. Do not choose between them yourself.
2. Stop the affected implementation work.
3. Explain the conflict clearly.
4. Ask the user which interpretation should be followed.
Do not silently resolve specification conflicts.
---
## Missing Implementation Details
Not every implementation detail needs to be specified in the project documentation.
When a detail necessary for implementation is unspecified:
- make the smallest reasonable implementation decision;
- prefer the simplest solution that satisfies the documented requirements;
- avoid introducing additional architecture, abstractions, features, or complexity;
- remain consistent with the existing architecture and design.
Do not stop for ordinary low-level implementation decisions that can reasonably be made without changing the intended system.
---
## Architecture
The architecture documented under `Docs/Architecture/` must be followed.
Do not independently change:
- service boundaries;
- component responsibilities;
- domain boundaries;
- communication patterns;
- persistence ownership;
- data flow;
- deployment architecture;
- architectural patterns;
- documented relationships between components;
- other architectural or design decisions.
If implementation appears to require an architectural or design change:
1. do not make the change;
2. explain why the current architecture creates a problem;
3. explain the proposed change and why it is necessary;
4. place the proposal in `suggestions/`;
5. request explicit approval before implementing it.
Architecture changes require explicit user permission.
---
## Requirements and User Stories
Existing user stories and acceptance criteria are authoritative requirements.
Do not modify existing user stories or acceptance criteria unless explicitly instructed.
If a requirement appears:
- incomplete;
- contradictory;
- missing an important scenario;
- difficult to implement as written;
- inconsistent with the architecture;
do not silently rewrite it.
Instead, create a suggestion in `suggestions/`.
You may propose:
- changes to existing user stories;
- additional acceptance criteria;
- new user stories;
- missing product behaviour.
These remain suggestions until explicitly approved.
---
## Suggestions
Use the repository directory:
`/suggestions/`
for proposed changes or additions.
Create the directory if it does not exist.
Suggestions may concern:
- additional user stories;
- missing requirements;
- requirement changes;
- architecture or design changes;
- documentation improvements;
- other product-completeness concerns.
Do not move suggestions into `Docs/`.
The user will review suggestions and manually move or incorporate approved material into the authoritative documentation.
A suggestion is not authorization to implement it.
If a proposed change is required before the current user story can be implemented correctly, stop and request approval.
If the suggestion is optional and does not prevent correct implementation of the current user story, record it and continue with the documented implementation.
---
## Documentation
Treat `Docs/` as read-only unless the user explicitly authorizes a modification.
You may read and analyze anything in `Docs/`.
Do not:
- edit documentation;
- replace diagrams;
- rewrite requirements;
- update architecture documents;
- add new authoritative documents;
unless explicitly instructed.
Proposed documentation additions belong in `suggestions/`.
---
## Technology Stack and Deployment Model
Use the following technology stack unless explicitly instructed otherwise:
- Language: C#
- Platform: current .NET LTS
- Web framework: ASP.NET Core Web API
- API style: REST / JSON
- API structure: Controllers
- Persistence: PostgreSQL
- Data access: Entity Framework Core
- Testing: xUnit
- Target operating system: Linux
- Service manager: systemd
Keep the implementation conventional and representative of normal industry practice for this type of backend system.
Avoid unnecessary framework, library, or infrastructure complexity. Do not introduce additional architectural patterns, middleware frameworks, abstraction layers, or infrastructure unless they are required by the documented architecture, requirements, or current user story.
### Microservice Process Boundary
Each documented microservice must be implemented as an independent project and independent operating-system process.
Each microservice must:
- have its own ASP.NET Core project;
- be independently buildable;
- be independently startable and stoppable;
- expose its own network API where required by the documented architecture;
- own its own configuration;
- own its own persistence where persistence is assigned to that service;
- be deployable independently of the other services;
- be capable of running on a different physical or virtual machine from every other microservice.
Do not rely on:
- shared process memory;
- in-process calls between microservices;
- shared static state;
- direct project references that couple one microservice implementation to another;
- assumptions that two services run on the same host;
- localhost-only communication between separate services.
Communication between microservices must use the communication mechanisms defined by the architecture and must remain valid when services are deployed on separate machines.
### Shared Code
Do not introduce shared implementation libraries across microservices merely to reduce duplication.
A shared library may only be introduced when it does not create inappropriate coupling between independently deployable services and when its use is clearly justified.
Prefer service independence over convenience.
Shared contracts, schemas, or generated API clients may be used when appropriate, but they must not create hidden runtime coupling or violate the documented service boundaries.
### Configuration
Environment-specific values must not be hard-coded.
Use standard .NET configuration mechanisms for values such as:
- hostnames;
- ports;
- database connection strings;
- service endpoints;
- credentials;
- environment-specific settings.
Configuration must support deployment of each service on a separate machine without code changes.
Do not commit secrets to the repository.
Provide safe example configuration where useful, such as `.env.example` or documented configuration templates.
### Linux Deployment
Each service must be suitable for running as a long-lived Linux service.
The implementation should support:
- Release builds;
- independent deployment;
- clean startup and shutdown;
- standard output/error logging suitable for systemd/journald;
- restart by the service manager;
- external configuration;
- network binding configurable per deployment.
When deployment files are created, prefer straightforward systemd-compatible deployment rather than introducing containers, orchestration platforms, or additional infrastructure unless explicitly requested.
---
## Dependencies
Prefer as few external dependencies as reasonably possible.
Do not add dependencies merely for convenience when existing project capabilities or standard platform functionality are sufficient.
A dependency may be added without prior approval when:
- it clearly fits the selected technology stack;
- it provides a sensible solution to a real implementation need;
- its use does not change the documented architecture or requirements.
When adding a dependency:
- ensure that it has a clear purpose;
- avoid unnecessary overlapping libraries;
- prefer established and appropriately scoped dependencies;
- document the reason for introducing it in the implementation summary.
---
## Infrastructure and Configuration
You may create implementation-supporting files when necessary, including for example:
- build configuration;
- package configuration;
- `Dockerfile`;
- container/Compose configuration;
- database migrations;
- test configuration;
- application configuration;
- `.env.example`;
- development scripts;
- CI configuration.
Such files must support the documented system rather than redefine its architecture.
---
## Development Unit: One User Story
Work incrementally.
The preferred unit of implementation is one user story at a time.
Do not attempt to implement the entire product in one large change unless explicitly instructed.
A user story may require changes across multiple:
- services;
- modules;
- databases;
- tests;
- configuration files;
and those changes may be made together when they are necessary to complete that user story.
Keep unrelated work out of the user-story implementation.
---
## Before Implementing a User Story
Before modifying implementation files:
1. Identify the user story being implemented.
2. Read its complete acceptance criteria.
3. Identify all architecture and design documentation relevant to it.
4. Inspect the existing implementation that may be affected.
5. Identify everything required to implement the user story correctly.
6. Determine which services, components, persistence layers, configuration, and tests are likely to be affected.
7. Check for conflicts between the requirement and the documented architecture.
Implementation must remain aligned with both the requirements and the documented architecture.
Do not create a large speculative design phase when the required implementation is already clear.
---
## Testing
Acceptance criteria should be covered by automated tests wherever technically possible.
Tests should verify the behaviour required by the user story rather than implementation details unnecessarily.
Before considering a user story complete:
- run the relevant automated tests;
- run appropriate broader tests when the changes could affect existing functionality;
- ensure existing relevant tests still pass.
Do not weaken, remove, or bypass tests merely to make an implementation pass.
If an acceptance criterion cannot reasonably be tested automatically, explain why.
---
## Definition of Done
A user story is complete only when:
- all relevant acceptance criteria are implemented;
- the implementation conforms to the documented architecture and design;
- relevant automated tests exist where technically possible;
- all relevant tests pass;
- the project builds or starts successfully as applicable;
- no unrelated functionality has been changed;
- no unauthorized architecture or requirement changes have been introduced;
- the completed working user story is committed as one logical Git commit.
Do not commit a user story as complete while its implementation is knowingly broken.
---
## Git Workflow
You may:
- inspect Git history and status;
- modify repository files;
- stage files;
- run builds and tests;
- create commits.
Use one logical commit for each completed working user story.
Commit messages should identify the implemented user story or clearly describe the completed behaviour.
Do not perform the following unless explicitly instructed:
- `git push`;
- `git pull`;
- merges;
- rebases;
- branch deletion;
- history rewriting;
- force pushes.
Do not commit unrelated modifications together with a user story.
---
## External Technical Information
You may consult external technical documentation when necessary to determine how technologies, frameworks, libraries, protocols, or APIs work.
External sources may inform **how** the product is implemented.
They must not override the repository when determining **what** the product should do.
The repository architecture and requirements remain authoritative.
---
## Scope Control
Make only the changes necessary to correctly implement the current user story.
Do not independently:
- redesign the system;
- refactor unrelated code;
- optimize unrelated code;
- introduce additional features;
- generalize functionality beyond the requirements;
- introduce speculative abstractions;
- replace technologies;
- change architectural patterns;
- expand project scope.
If such a change appears necessary:
1. do not implement it immediately;
2. explain why it is needed;
3. describe the expected consequences;
4. create a proposal in `suggestions/`;
5. request explicit permission.
Small implementation-level changes necessary to correctly implement the current user story are allowed when they do not alter requirements, architecture, or unrelated behaviour.
---
## General Principle
Implement the project that is specified, not the project you would have designed instead.
When the specification is clear, follow it.
When ordinary implementation details are missing, make the smallest reasonable decision.
When requirements or architecture conflict, stop and ask.
When a larger change appears desirable or necessary, propose it rather than silently introducing it.