105 lines
9.8 KiB
Markdown
105 lines
9.8 KiB
Markdown
# AGENT.md — Health App Architecture Implementation
|
|
|
|
## Mission
|
|
|
|
Implement the **approved architecture for HealthAppRepositoryB** using the existing Health App implementation as the functional starting point.
|
|
|
|
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.
|
|
|
|
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.
|
|
|
|
## Authority and source material
|
|
|
|
Read and classify the available documentation before starting work:
|
|
|
|
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.
|
|
|
|
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.**
|
|
|
|
## Scope
|
|
|
|
In scope:
|
|
|
|
- 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.
|
|
|
|
Out of scope unless separately approved:
|
|
|
|
- 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.
|
|
|
|
**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.
|
|
|
|
## Mandatory preparation — stop before coding
|
|
|
|
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.
|
|
|
|
## Implementation rules
|
|
|
|
- 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.
|
|
|
|
## Verification
|
|
|
|
At each meaningful checkpoint:
|
|
|
|
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.
|
|
|
|
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.
|
|
|
|
## Required implementation artifacts
|
|
|
|
Maintain these in `ImplementationPlan/` (create when needed):
|
|
|
|
- `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.
|
|
|
|
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.
|
|
|
|
## Completion criteria
|
|
|
|
Do not report the implementation as complete unless:
|
|
|
|
- [ ] 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.
|
|
|
|
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.
|