added the implemented architecture in it's own folder

This commit is contained in:
Steffen committed 2026-10-15 14:59:26 +02:00
1 parent 0205f98390
commit 097d156c18
13 files changed
+867 -75

No files matched your search

+73 -75
View File
@@ -1,106 +1,104 @@
# AGENT.md — Requirements-Driven Architecture Design
# AGENT.md — Health App Architecture Implementation
## Mission
Design a coherent software architecture for the Health App based on the supplied requirements and relevant design constraints. Produce an architecture that can satisfy the application's required behaviour and is explicitly reasoned about in terms of potential energy efficiency.
Implement the **approved architecture for HealthAppRepositoryB** using the existing Health App implementation as the functional starting point.
Your task is **architecture design, not implementation**. Do not generate, edit, inspect, or request application source code. Do not implement services, infrastructure, scripts, tests, or deployment configurations.
The objective is to realize the architecture specified in `ArchitectureProposal/` while preserving the application's required and externally observable behaviour. This is **architectural restructuring**, not a new application, an opportunity to redesign functionality, or a general code-cleanup exercise.
Design an architecture justified by the documented requirements, constraints, and engineering trade-offs. Do not introduce complexity merely to produce a different architectural structure.
The architectural proposal is a design to implement, **not evidence of lower energy consumption**. Do not claim energy savings from implementation, reduced resource usage, faster execution, or architectural plausibility alone.
Evaluate architectural alternatives with **energy efficiency as an important design objective**. Explain which architectural characteristics could influence energy consumption, why, and under what assumptions. Consider potential trade-offs when selecting the proposed architecture.
## Authority and source material
## Inputs and authority
Read and classify the available documentation before starting work:
All documentation relevant to the application is located under `Docs/`.
1. **`Docs/` — authoritative functional and domain requirements.** Preserve user stories, acceptance criteria, domain rules, API contracts and externally observable success, alternative and failure behaviour. Where an older design in `Docs/` conflicts with the approved proposed architecture, retain its functional requirements but do not automatically retain its structural decisions.
2. **`ArchitectureProposal/` — target architecture.** Follow its architecture specification, decisions, diagrams, component boundaries, data ownership, communication, security and deployment requirements. Treat the proposal as approved only to the extent the user has explicitly designated it as the implementation target. If the proposal contains unresolved alternatives, open questions, or internal contradictions affecting implementation, ask before proceeding.
3. **`../HealthAppRepository/` — original Health App implementation and behavioural reference.** This is the sibling directory one level above `HealthAppRepositoryB`. Verify that it exists and is the intended original Git repository. Record its exact Git commit before using it as the starting reference. Inspect and copy required source files only into `HealthAppRepositoryB`; the original implementation is strictly read-only. Never commit or modify files in `../HealthAppRepository/`.
4. **Existing tests and public interfaces — behavioural evidence.** Preserve the original tests and their intent. Tests may need architecture-dependent wiring or integration adjustments, but never weaken, delete, or rewrite assertions simply to make failures disappear.
Before designing the architecture, recursively inspect and read the documentation contained in `Docs/`, including its subdirectories.
When requirements, proposed architecture and source implementation disagree, explicitly document the conflict. Functional requirements govern behaviour; the approved architecture governs structure; original source code helps establish existing observable semantics. **Do not silently choose between contradictory instructions.**
Use this documentation to establish the system's functional requirements, business rules, constraints, and expected behaviour.
## Scope
Distinguish mandatory requirements from existing architectural and design decisions. Existing architectural and design decisions may be reconsidered unless they represent explicit requirements or constraints.
In scope:
Where documents contain contradictions, ambiguities, or missing information that materially affect architectural decisions, request clarification rather than silently making assumptions.
- Restructure modules/services, ownership boundaries, dependencies, communication and data flows to conform to the approved architecture.
- Adapt persistence, deployment configuration, integration points, authentication boundaries and infrastructure as required by the proposed architecture.
- Make minimal supporting code changes that are necessary consequences of the architectural restructuring.
- Adapt or add tests to verify preservation of functional behaviour and conformity to the new architecture.
- Document material decisions, deviations, migrations, and steps needed to build and run the result.
Do not modify the original documentation under `Docs/`. Place all newly produced architecture documentation in `ArchitectureProposal/`.
Out of scope unless separately approved:
Treat sources according to their role:
- New or removed user-facing functionality, changed business rules, changed domain semantics or changed externally observable API behaviour.
- Algorithm replacements, micro-optimisations, speculative performance tuning, unrelated refactoring or technology substitutions not required by the approved architecture.
- Unrequested changes to the architecture proposal, functional requirements or the original source repository.
- Energy measurement, benchmarking as proof of energy savings, or invented claims of energy improvement.
1. **Functional requirements, acceptance criteria, and externally observable behaviour** are binding. Preserve them, including error and alternative scenarios.
2. **Domain concepts and genuine constraints** from the documentation must be respected where required by the functional requirements, acceptance criteria, documented non-functional requirements, or explicit user clarification. Record assumptions and unresolved ambiguities.
3. **Existing structural or technology decisions** described in documentation (such as service boundaries, number of databases, gateway placement, persistence allocation, protocols, or deployment topology) are **not binding solely because they appear in an earlier design**. Determine whether each is an explicit requirement or a design choice. If its status materially affects the architecture and is unclear, ask for clarification.
**Same functionality does not mean byte-for-byte identical code.** Code may change to implement different architectural boundaries, but each change must be justifiable as necessary for the target architecture or preserving functionality.
Design the architecture that best satisfies the documented requirements and constraints, with energy efficiency as an important design objective.
## Mandatory preparation — stop before coding
Evaluate relevant architectural alternatives and justify the selected approach based on their advantages, disadvantages, and expected consequences.
1. Inventory `Docs/` and `ArchitectureProposal/`, including all editable `.drawio` diagrams and their accompanying text. Identify inconsistencies or missing detail.
2. Locate and inspect the original implementation at **`../HealthAppRepository/`**. Verify its Git repository identity and current commit. Record the exact commit hash; if its working tree contains uncommitted changes or the intended baseline is ambiguous, ask which revision to use before copying any code. Treat this directory as read-only.
3. Record the original baseline revision, the target architecture revision, and the current `HealthAppRepositoryB` revision. Ensure the working tree is clean or obtain instructions on how to handle pre-existing changes.
4. Establish how the original system builds, starts and tests. Inventory its observable APIs, existing test suite, dependencies, supported deployment assumptions and data migration considerations.
5. Produce `ImplementationPlan/implementation-plan.md` containing:
- A mapping of every major proposed architectural decision to affected modules/files and concrete implementation tasks.
- A functional preservation plan, including how user stories/acceptance criteria and API contracts will be checked.
- A list of anticipated migrations, operational risks, and architectural uncertainties.
- A sequence of small, reviewable changes with verification checkpoints.
- Any decisions requiring user approval.
6. **Present the plan and request explicit approval before implementing architectural changes.** Do not begin code migration while material ambiguities remain unresolved.
Existing architectural decisions may be retained, modified, or replaced based on their suitability. Do not favour an architecture merely because it already exists, nor reject one because it resembles an existing design.
## Implementation rules
Prioritize architectural suitability and justified decisions over novelty or the number of changes proposed.
- Work only in `HealthAppRepositoryB` after approval; never modify the original implementation.
- Use the approved proposal as the architecture contract. If implementation cannot conform, stop, explain why and propose a documented deviation for approval before making it.
- Preserve functional requirements and observable behaviour, including authorization, validation, status codes, error cases, persistence semantics and key workflows, where specified.
- Avoid creating functionality simply because the target architecture makes it convenient.
- Make cohesive, incremental changes. Keep each commit focused and meaningful; do not mix architectural migration with unrelated cleanups.
- Preserve repository history and research evidence. Never rewrite history, force-push, delete source identifiers or erase original input documents without explicit authorization.
- Do not make silent changes to `Docs/` or `ArchitectureProposal/`. Record proposed corrections or necessary deviations in `ImplementationPlan/` for review.
- Do not modify tests to conceal regressions. New test infrastructure and architecture-specific integration tests are allowed; record why each test change was necessary.
- Security properties, data handling, failure behaviour, and deployability must not be weakened as a side effect of architectural restructuring.
- If essential information is missing, ask a focused question rather than inventing a design or requirement.
Never edit the supplied requirements or design input files. Record suggested clarifications separately.
## Verification
## Design boundaries
At each meaningful checkpoint:
- Work at **software architecture and system design level**: components and responsibilities, boundaries, interactions, domain concepts and relationships, conceptual class structures, data ownership, persistence, caching, concurrency, deployment topology, communication, and relevant architectural patterns. Domain and class diagrams describe the design, not existing source code.
- Preserve required capabilities and externally observable API semantics where specified. Do not invent new functional requirements.
- Prefer architectural simplicity where alternatives otherwise satisfy the requirements and design objectives comparably. Evaluate whether additional complexity offers justified benefits, including potential energy-efficiency benefits.
- You may consider a monolith, modular monolith, microservices, or another pattern; no pattern is inherently preferred unless the supplied requirements mandate it.
- Consider energy-related consequences of architectural decisions, including idle resource use, inter-process/network communication, duplicated runtime overhead, database footprint, serialization, and scaling behaviour.
- Distinguish **energy consumption** from latency, throughput, CPU usage, and memory usage. These are not interchangeable measurements.
- Exclude code-level tuning, compiler flags, algorithm replacement, and micro-optimizations. Do not include the energy cost of operating an LLM.
- Maintain security, data protection, maintainability, deployability, and correctness; energy is not the only design objective.
1. Build the affected components and run appropriate existing automated tests.
2. Check functional equivalence using requirements and observable interfaces, not merely successful compilation or an increased test count.
3. Verify architectural conformance against the specification and Draw.io diagrams (service/component boundaries, dependencies, communication, persistence, deployment and security).
4. Document tests that could not be executed and why; do not present untested behaviour as validated.
5. Record deviations, regressions, operational prerequisites and unresolved risks.
## Working procedure
At completion, provide a requirement-to-test/conformance summary. Distinguish **verified**, **partially verified** and **not verified**. Do not claim strict functional equivalence where evidence is insufficient.
1. **Inventory the inputs.** Identify each requirements and design source, its purpose, and missing information. Read all relevant material before designing.
2. **Create a requirements-and-constraints register.** Separate binding functional behaviour, non-functional requirements, domain rules, assumed constraints, and optional existing design decisions. Cite file paths and requirement/user-story IDs.
3. **Identify architectural drivers.** Explain which requirements and expected runtime behaviours influence topology, boundaries, data flow, storage, and energy use. Identify important unknowns, especially expected workload and deployment environment.
4. **Consider alternatives.** Compare at least two feasible architectural approaches at a high level, including likely strengths, weaknesses, and energy-related hypotheses. Do not assume the most distributed or most consolidated design is superior.
5. **Select and develop one complete proposed architecture.** Justify the choice; define necessary components, responsibilities, interfaces, domain concepts, conceptual class relationships, data ownership, communication, persistence, security boundaries, and deployment assumptions. Document the architecture in an authoritative written specification and consistent editable diagrams. Avoid implementation-specific details unless necessary to make the design unambiguous.
6. **Check coverage and consistency.** Map every user story and acceptance criterion to the components and interactions responsible for satisfying it. Flag gaps and conflicts; do not silently redefine requirements.
7. **Evaluate the design critically.** Identify risks, trade-offs, likely bottlenecks, uncertainties, and expected energy-related consequences of architectural decisions. Explain the reasoning and assumptions behind those expectations.
## Required implementation artifacts
If essential requirements are contradictory or a decision could materially alter the architecture, **stop and ask a focused question**. For smaller uncertainties, make the smallest explicit, reversible assumption and record it.
Maintain these in `ImplementationPlan/` (create when needed):
## Outputs
- `implementation-plan.md` — mapping, sequence, risks, approval status and checkpoints.
- `architecture-conformance.md` — architectural decisions implemented, evidence and approved deviations.
- `functional-equivalence.md` — mapped requirements, contracts, tests, outcomes and coverage limitations.
- `implementation-log.md` — architecture-driven changes with relevant commit IDs and reasons.
- `open-questions.md` — unresolved conflicts, assumptions and decisions awaiting approval.
Write all new artifacts under `ArchitectureProposal/`; do not overwrite or rewrite the provided `Docs/` inputs.
Also update build/deployment/readme instructions **in the implementation repository** as needed to accurately explain how to run the resulting architecture. Do not replace the approved architectural documentation unless the user explicitly authorizes it.
Create:
## Completion criteria
- `ArchitectureProposal/README.md` — overview, scope, status, input list, assumptions, and navigation.
- `ArchitectureProposal/software-architecture.md` — authoritative written specification of the chosen architecture, including architectural style, system boundaries, components and responsibilities, interfaces and interactions, data flows and persistence, domain model, security and trust boundaries, deployment and runtime behaviour, failure handling, and key assumptions. Refer to the diagrams and keep the written specification consistent with them.
- `ArchitectureProposal/requirements-traceability.md` — mapping from every functional requirement, user story, and acceptance criterion to the proposed architecture; gaps and open questions.
- `ArchitectureProposal/architecture-decisions.md` — significant decisions and rationale, alternatives considered, consequences, and rejected options.
- `ArchitectureProposal/energy-hypotheses.md` — for each energy-relevant decision: anticipated mechanism, expected effect, assumptions, dependencies, and possible counter-effects. These are design expectations, not measured results; do not invent numerical savings or measurement procedures.
- `ArchitectureProposal/risks-and-open-questions.md` — uncertainties, unresolved constraints, potential behavioural incompatibilities, and trade-offs.
- `ArchitectureProposal/diagrams/` — editable **`.drawio` source files** for at least:
- **System context diagram** — actors, external systems, and system boundary.
- **Logical component diagram** — architectural components, responsibilities, interfaces, and interactions.
- **Domain model diagram** — domain concepts, their relationships, and relevant constraints; independent of source-code classes.
- **Conceptual class diagram** — design-level classes/types, responsibilities, key attributes and associations needed to explain the domain and design; do not reverse-engineer or invent code-level implementation details.
- **Data ownership/persistence diagram** — ownership and storage relationships.
- **Deployment topology diagram** — runtime units, hosts/containers where relevant, and communication boundaries.
Add sequence diagrams for important cross-component use cases when useful. Do not provide image-only diagrams as the sole source.
Do not report the implementation as complete unless:
The proposed architecture must be sufficiently precise to guide implementation, but **do not write implementation code**.
- [ ] The approved target architecture is implemented or deviations are explicitly approved and documented.
- [ ] All functional requirements and acceptance criteria have been checked for preservation, with gaps disclosed.
- [ ] Tests and build/deployment verification results are documented honestly.
- [ ] Original source repository and original input documentation remain unchanged.
- [ ] Architecture-specific code and configuration changes are traceable to approved decisions.
- [ ] Changes unrelated to architectural restructuring have not been introduced without approval.
- [ ] No unmeasured energy-efficiency improvement is presented as an empirical result.
## Quality gate before declaring completion
Confirm in the README that:
- [ ] Every functional requirement, user story, and acceptance criterion is traceable to the proposed architecture; unresolved coverage gaps are explicitly identified. No requirement has been silently omitted or changed.
- [ ] All significant input design constraints have been classified as mandatory, assumed, or optional, with uncertainty recorded.
- [ ] The proposed architecture is internally consistent, satisfies the documented requirements and constraints, and its significant decisions are justified independently of whether they resemble existing designs.
- [ ] The authoritative software architecture specification is complete and consistent with the diagrams.
- [ ] The domain model and conceptual class diagram cover relevant domain concepts and design relationships without prescribing unnecessary implementation detail.
- [ ] All components have clear responsibilities and ownership of data.
- [ ] Key communication, security, deployment, and failure-handling concerns are addressed.
- [ ] Expected energy-related effects are presented with reasoning, assumptions, and potential counter-effects, not as established savings.
- [ ] Draw.io source diagrams are editable and consistent with the written design.
- [ ] No application source code or original input documents were changed.
## Interaction and change control
Work only on the architecture assignment defined here. You may add or revise files in `ArchitectureProposal/`. Do not change requirements, original design documents, or other repository areas without explicit authorization. Explain important uncertainties and seek approval when a requirement conflicts with a proposed decision. Do not present expected energy benefits as measured results.
This assignment is complete only when a functioning architecture-conformant implementation and its verification evidence have been produced, or when blockers and incomplete areas have been clearly reported.