Skip to content

docs: add Architecture Decision Records (ADR-001 to ADR-010)#4

Merged
singyichen merged 5 commits into
mainfrom
docs/adr-001-monorepo
Mar 19, 2026
Merged

docs: add Architecture Decision Records (ADR-001 to ADR-010)#4
singyichen merged 5 commits into
mainfrom
docs/adr-001-monorepo

Conversation

@singyichen
Copy link
Copy Markdown
Owner

Summary

  • Add docs/adr/ directory with 10 ADRs covering all major technology and architecture decisions
  • Rename docs/decisions/docs/adr/ to align with project convention
  • Update CLAUDE.md to reference ADR directory and enforce TDD for all agents

ADRs Added

ADR Decision
001 Modular Monorepo Structure
002 Package Managers — uv (backend) + pnpm (frontend)
003 Backend Framework — FastAPI
004 Frontend Framework — React + Vite
005 Database — PostgreSQL 16
006 Cache and Message Broker — Redis 7
007 Async Task Execution — Celery
008 Containerization — Docker + Docker Compose
009 Testing Strategy — pytest + Playwright + TDD requirement
010 Config-Driven Task Architecture (NON-NEGOTIABLE)

Each ADR includes: context, candidates evaluated with comparison tables, decision, Easier/Harder consequences, and alternatives rejected.

Test Plan

  • All ADR files present in docs/adr/ (10 ADRs + README index)
  • docs/decisions/ removed (renamed to docs/adr/)
  • CLAUDE.md Architecture section references docs/adr/
  • CLAUDE.md Constitution principle 4 updated with TDD + ADR-009 link
  • ADR-009 TDD Workflow section includes agent-specific rules and Red-Green-Refactor example
  • Documentation-only change — no test suite run required per PR Flow

🤖 Generated with Claude Code

singyichen and others added 3 commits March 19, 2026 13:47
Record the architectural decision to keep frontend (React) and backend
(FastAPI) in a single repository under separate top-level directories.

Rationale: single developer, unified Docker Compose orchestration, and
Demo Paper goal all favor monorepo over two separate repos. Full-stack
feature changes are captured atomically in one PR, and a single
`docker compose up` reproduces the entire system.

- docs/decisions/ADR-001-monorepo-structure.md: new ADR with context,
  decision, rationale table, consequences, and rejected alternatives
- CLAUDE.md: added ADR-001 reference note in Architecture section

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Rename docs/decisions/ → docs/adr/ to align with the labor-law-assistant
project convention. Reformat ADR-001 and add nine new ADRs covering
all major technology and architecture decisions for label-eval-portal.

ADR list:
- 001: Modular Monorepo (reformatted from original)
- 002: Package managers — uv (backend) + pnpm (frontend)
- 003: Backend framework — FastAPI
- 004: Frontend framework — React + Vite (vs Next.js)
- 005: Database — PostgreSQL 16 with JSONB for task configs
- 006: Cache and message broker — Redis 7 (dual role)
- 007: Async task execution — Celery with Redis broker
- 008: Containerization — Docker + Docker Compose
- 009: Testing strategy — pytest (≥80%/90% scoring) + Playwright E2E
- 010: Config-driven architecture (NON-NEGOTIABLE, core contribution)

Each ADR includes: context, candidates evaluated with comparison tables,
decision, consequences (Easier/Harder), and alternatives rejected.

Also update CLAUDE.md Architecture section to reference docs/adr/.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
All agents and developers must follow Red-Green-Refactor when writing
tests. Agents must write the test file first, confirm it fails (Red),
then implement the minimum code to pass (Green), then refactor.

- ADR-009: added TDD Workflow section with agent-specific rules and
  a concrete scoring metric example (Red → Green → Refactor)
- CLAUDE.md: updated Constitution principle 4 to explicitly reference
  TDD and link to ADR-009

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@qodo-code-review
Copy link
Copy Markdown

Review Summary by Qodo

Add Architecture Decision Records (ADR-001 to ADR-010) and establish ADR directory structure

📝 Documentation

Grey Divider

Walkthroughs

Description
• Add 10 Architecture Decision Records (ADR-001 to ADR-010) documenting all major technology and
  architecture decisions
• Rename docs/decisions/ directory to docs/adr/ to align with project conventions
• Update CLAUDE.md to reference ADR directory and enforce Test-Driven Development (TDD) for all
  agents
• Each ADR includes context, evaluated candidates with comparison tables, decision rationale, and
  consequences analysis
Diagram
flowchart LR
  A["Project Architecture"] --> B["10 ADRs Created"]
  B --> C["ADR-001: Monorepo"]
  B --> D["ADR-002: Package Managers"]
  B --> E["ADR-003: FastAPI"]
  B --> F["ADR-004: React+Vite"]
  B --> G["ADR-005: PostgreSQL"]
  B --> H["ADR-006: Redis"]
  B --> I["ADR-007: Celery"]
  B --> J["ADR-008: Docker"]
  B --> K["ADR-009: Testing+TDD"]
  B --> L["ADR-010: Config-Driven"]
  M["CLAUDE.md Updated"] --> N["TDD Enforcement"]
  N --> K
Loading

Grey Divider

File Changes

1. CLAUDE.md 📝 Documentation +3/-1

Add ADR references and enforce TDD requirement

CLAUDE.md


2. docs/adr/001-monorepo-structure.md 📝 Documentation +58/-0

Document modular monorepo architecture decision

docs/adr/001-monorepo-structure.md


3. docs/adr/002-package-managers.md 📝 Documentation +66/-0

Document uv and pnpm package manager selection

docs/adr/002-package-managers.md


View more (9)
4. docs/adr/003-backend-framework-fastapi.md 📝 Documentation +54/-0

Document FastAPI backend framework decision

docs/adr/003-backend-framework-fastapi.md


5. docs/adr/004-frontend-framework-react-vite.md 📝 Documentation +63/-0

Document React and Vite frontend framework choice

docs/adr/004-frontend-framework-react-vite.md


6. docs/adr/005-database-postgresql.md 📝 Documentation +59/-0

Document PostgreSQL 16 database selection

docs/adr/005-database-postgresql.md


7. docs/adr/006-caching-queue-redis.md 📝 Documentation +72/-0

Document Redis dual-role caching and broker

docs/adr/006-caching-queue-redis.md


8. docs/adr/007-async-tasks-celery.md 📝 Documentation +82/-0

Document Celery async task execution framework

docs/adr/007-async-tasks-celery.md


9. docs/adr/008-containerization-docker-compose.md 📝 Documentation +77/-0

Document Docker and Docker Compose containerization

docs/adr/008-containerization-docker-compose.md


10. docs/adr/009-testing-strategy.md 📝 Documentation +127/-0

Document pytest, Playwright, and TDD testing strategy

docs/adr/009-testing-strategy.md


11. docs/adr/010-config-driven-architecture.md 📝 Documentation +103/-0

Document config-driven task architecture principle

docs/adr/010-config-driven-architecture.md


12. docs/adr/README.md 📝 Documentation +31/-0

Create ADR index and directory overview

docs/adr/README.md


Grey Divider

Qodo Logo

@qodo-code-review
Copy link
Copy Markdown

qodo-code-review Bot commented Mar 19, 2026

Code Review by Qodo

🐞 Bugs (0) 📘 Rule violations (0) 📎 Requirement gaps (0) 📐 Spec deviations (0)

Grey Divider


Action required

1. Chinese strings in ADR-010📘 Rule violation ⚙ Maintainability
Description
Non-English text is introduced in docs/adr/010-config-driven-architecture.md (Chinese label
display values). This violates the English-first requirement for project artifacts outside
README.zh-TW.md and can reduce consistency/searchability across docs.
Code

docs/adr/010-config-driven-architecture.md[R58-62]

+      display: "疾病"
+      color: "#EF4444"
+    - id: symptom
+      display: "症狀"
+      color: "#F59E0B"
Evidence
PR Compliance ID 1 requires all project artifacts to be in English except README.zh-TW.md. The new
ADR introduces Chinese text in the example config (display: "疾病", display: "症狀").

CLAUDE.md
docs/adr/010-config-driven-architecture.md[58-62]

Agent prompt
The issue below was found during a code review. Follow the provided context and guidance below and implement a solution

## Issue description
`docs/adr/010-config-driven-architecture.md` introduces non-English (Chinese) text in the YAML example (`display` fields), which violates the English-first artifacts rule (only `README.zh-TW.md` may be non-English).
## Issue Context
The repository compliance requirement is to keep documentation and other artifacts in English for consistency.
## Fix Focus Areas
- docs/adr/010-config-driven-architecture.md[58-62]

ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools



Remediation recommended

2. Broken Constitution ADR link🐞 Bug ✓ Correctness
Description
ADR-010 links to .specify/memory/constitution.md using a path relative to docs/adr/, which
resolves to a non-existent location and breaks navigation to the Constitution. As a result, the
“NON-NEGOTIABLE” reference cannot be followed from the ADR.
Code

docs/adr/010-config-driven-architecture.md[R100-103]

+## Referenced by
+
+- [Constitution](.specify/memory/constitution.md) — Principle 2: Generalization-First (NON-NEGOTIABLE)
+- [README.md](../../README.md) — Key Contributions §1: Configurable and General-Purpose
Evidence
From docs/adr/010-config-driven-architecture.md, the relative link
.specify/memory/constitution.md would resolve under docs/adr/, but the Constitution file
actually lives at the repo root under .specify/memory/constitution.md.

docs/adr/010-config-driven-architecture.md[100-103]
.specify/memory/constitution.md[1-6]

Agent prompt
The issue below was found during a code review. Follow the provided context and guidance below and implement a solution

## Issue description
`docs/adr/010-config-driven-architecture.md` links to the Constitution using a relative path that is correct only from the repository root, not from within `docs/adr/`. This makes the link broken when viewed on GitHub.
### Issue Context
The Constitution file is located at `.specify/memory/constitution.md` at the repo root. Since ADR-010 is in `docs/adr/`, the link must traverse up to the root first.
### Fix
Update the link target to a correct relative path from `docs/adr/010-config-driven-architecture.md`, e.g. `../../.specify/memory/constitution.md`.
### Fix Focus Areas
- docs/adr/010-config-driven-architecture.md[100-103]
- .specify/memory/constitution.md[1-6]

ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools


3. Inconsistent coverage path references🐞 Bug ⚙ Maintainability
Description
ADR-009’s coverage thresholds reference services/scoring.py and api/routes/, but CLAUDE.md
documents the backend layout as backend/app/services/ and backend/app/api/routes/. This
inconsistency can misdirect contributors when locating the modules for the stated coverage targets.
Code

docs/adr/009-testing-strategy.md[R83-90]

+### Coverage Thresholds
+
+| Layer | Threshold | Rationale |
+|-------|----------:|-----------|
+| General backend | ≥ 80% | Constitution principle 4 |
+| Scoring engine (`services/scoring.py`) | ≥ 90% | Correctness-critical |
+| Leakage prevention (`api/routes/`) | 100% of security ACs | Non-negotiable |
+
Evidence
ADR-009 uses what appears to be filesystem-style paths in its coverage table (including a .py file
path), but those paths omit the backend/app/ prefix shown as the canonical structure in
CLAUDE.md’s architecture tree. The same ADR section also uses explicit root-relative directories
like backend/tests/..., reinforcing that these are intended as repo paths.

docs/adr/009-testing-strategy.md[83-99]
CLAUDE.md[74-107]

Agent prompt
The issue below was found during a code review. Follow the provided context and guidance below and implement a solution

## Issue description
ADR-009’s coverage threshold entries point to `services/scoring.py` and `api/routes/`, which conflicts with the documented repo layout in `CLAUDE.md` (`backend/app/services/` and `backend/app/api/routes/`). This makes it harder to apply/verify the documented coverage expectations.
### Issue Context
- `CLAUDE.md` includes a canonical directory tree under the Architecture section.
- `docs/adr/009-testing-strategy.md` mixes explicit repo paths (e.g., `backend/tests/unit/`) with shortened paths (e.g., `services/scoring.py`).
### Fix
Update ADR-009 to use the same path convention as `CLAUDE.md` (for example, change to `backend/app/services/scoring.py` and `backend/app/api/routes/`), or explicitly label these as logical modules if shorthand is intentional.
### Fix Focus Areas
- docs/adr/009-testing-strategy.md[83-90]
- CLAUDE.md[79-101]

ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools


Grey Divider

ⓘ The new review experience is currently in Beta. Learn more

Grey Divider

Qodo Logo

Comment thread docs/adr/010-config-driven-architecture.md Outdated
singyichen and others added 2 commits March 19, 2026 17:44
YAML example in ADR-010 used Chinese label display names ("疾病",
"症狀"), violating the English-first rule for all project artifacts
outside README.zh-TW.md.

Replaced with English equivalents ("Disease", "Symptom").

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
ADR-009: update coverage threshold paths to match CLAUDE.md canonical
layout (backend/app/services/scoring.py, backend/app/api/routes/).

ADR-010: fix broken Constitution relative link from .specify/... to
../../.specify/memory/constitution.md (correct from docs/adr/).

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@singyichen singyichen merged commit c2e81fc into main Mar 19, 2026
6 checks passed
@singyichen singyichen deleted the docs/adr-001-monorepo branch March 19, 2026 09:55
singyichen added a commit that referenced this pull request Mar 25, 2026
- Remove 'prompt' from search.py docstring and core.py style keywords
  since it is not a supported --domain value (closes qodo issue #2)
- Remove committed __pycache__/*.pyc files from git tracking
- Add .gitignore with Python, Node, env, and IDE exclusions (closes qodo issue #4)

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
singyichen added a commit that referenced this pull request Mar 25, 2026
- Allow zh-TW in prototype/ directory (CLAUDE.md rule update) [#1]
- Fix login.html to apply persisted language on load instead of zh-TW [#2]
- Add STRINGS[lang] guard in applyLang() to prevent crash on invalid lang [#3]
- Extend applyLang() to localize aria-label attributes via data-i18n-aria-label [#4]
- Add aria-label i18n keys to dashboard and login STRINGS objects [#4]
- Qualify agent ownership paths with "when present" in CLAUDE.md [#5]

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
singyichen added a commit that referenced this pull request Apr 8, 2026
Covers spec #4 — two pages: /forgot-password (email submission with
generic success message) and /reset-password (new+confirm password form
with valid/expired/used token states and password mismatch validation).

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
singyichen added a commit that referenced this pull request Apr 9, 2026
design: wireframes and prototypes for forgot/reset password pages (spec #4)
singyichen added a commit that referenced this pull request Apr 10, 2026
CLAUDE.md:
- Reduce SDD section from 62 lines to ~20 lines; remove pipeline table,
  status trigger list, and archive bash block (all now live in SKILL.md
  and specs/STATUS.md)
- Keep only hard behavioral constraints: pipeline one-liner, TDD MUST NOT
  rule, pre-PR analyze gate, module names, design paths, status/archive
  pointers

sdd-workflow SKILL.md:
- Add /superpowers:brainstorm as first pipeline step with gate condition
- Add STATUS.md update annotations at each pipeline stage
- Mark /speckit.analyze as REQUIRED gate (was "optional")
- Add archive step at pr-flow stage
- Update Spec Directory Structure to show STATUS.md and _archive/
- Add /superpowers:brainstorm to Spec-Kit Commands table
- Add new TDD Rule section with Red-Green-Refactor, applies-to scope,
  anti-rationalisation table, and restart instruction
- Expand SDD Rules from 5 to 8: add TDD rule (#3), analyze gate (#4),
  archive on merge (#8)

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
singyichen added a commit that referenced this pull request Apr 14, 2026
* docs: add spec status index and archive convention

- Add specs/STATUS.md: single source of truth for all 16 feature pipeline
  statuses, with status legend, feature table, and archive log
- Add specs/_archive/ directory for completed specs post-merge
- Update CLAUDE.md: add Spec Status Index section with required update
  triggers, Spec Archive Convention with bash command, and two new rows
  in Workflow Quick Reference table

Addresses weak document indexing and unclear completion status in spec-kit.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>

* docs: strengthen SDD pipeline with brainstorm, TDD, and analyze gate

- CLAUDE.md: add full SDD pipeline table (8 stages with hard gates) at
  the top of the SDD section, replacing vague /sdd-workflow reference
- CLAUDE.md: add TDD Rule section with mandatory language ("MUST NOT
  write implementation before failing test") and explicit rejection of
  common rationalisations
- CLAUDE.md: update Workflow Quick Reference — new feature row now shows
  full stage sequence; add Pre-PR gate row requiring speckit.analyze
  zero findings before every PR
- speckit.implement.md: step 4 upgraded from suggestion to REQUIRED gate
  with anti-rationalisation list and restart instruction
- speckit.implement.md: add step 7 (mandatory /speckit.analyze gate,
  must pass before PR); step 8 updates STATUS.md on completion

Addresses three SDD gaps identified from OpenSpec and Superpowers articles:
missing brainstorm entry point, unforced TDD, and optional analyze gate.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>

* docs: slim CLAUDE.md SDD section and sync sdd-workflow SKILL.md

CLAUDE.md:
- Reduce SDD section from 62 lines to ~20 lines; remove pipeline table,
  status trigger list, and archive bash block (all now live in SKILL.md
  and specs/STATUS.md)
- Keep only hard behavioral constraints: pipeline one-liner, TDD MUST NOT
  rule, pre-PR analyze gate, module names, design paths, status/archive
  pointers

sdd-workflow SKILL.md:
- Add /superpowers:brainstorm as first pipeline step with gate condition
- Add STATUS.md update annotations at each pipeline stage
- Mark /speckit.analyze as REQUIRED gate (was "optional")
- Add archive step at pr-flow stage
- Update Spec Directory Structure to show STATUS.md and _archive/
- Add /superpowers:brainstorm to Spec-Kit Commands table
- Add new TDD Rule section with Red-Green-Refactor, applies-to scope,
  anti-rationalisation table, and restart instruction
- Expand SDD Rules from 5 to 8: add TDD rule (#3), analyze gate (#4),
  archive on merge (#8)

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>

* docs: add 1→N iteration support to SDD workflow

- spec-template: add Version field, Spec Dependencies section (upstream/downstream), and Changelog section
- constitution: add iteration rule (update vs new spec), semantic versioning policy, and downstream impact requirement
- sdd-workflow SKILL: add Iteration Workflow (1→N) section and Cross-Spec Dependencies section

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>

* docs: add version, spec dependencies, and changelog to account specs 001-002

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>

* fix: address PR #28 review findings

- specs/STATUS.md: clear stale branch and update notes for feature 012 (wireframe done via PR #27)
- speckit.implement: remove premature STATUS.md→done update; defer to pr-flow
- constitution.md: bump version to 1.3.0 and update Last Amended to 2026-04-13

Co-Authored-By: Claude Haiku 4.5 <noreply@anthropic.com>

* fix: address PR #28 review finding — fix agent-team ordering in workflow table

Move /agent-team before analyze gate in Workflow Quick Reference; it is an
implementation method, not a post-analyze step.

Co-Authored-By: Claude Haiku 4.5 <noreply@anthropic.com>

* fix: address PR #28 review findings

Co-Authored-By: Claude Haiku 4.5 <noreply@anthropic.com>

* docs: rewrite AGENTS.md as standard agent rules file

Replace agent directory catalog with a concise rules-focused format.
Reduces token consumption by ~65% (211 → 80 lines) by removing
redundant tables and replacing them with boundary constraints,
hard rules, and required behaviors for autonomous agents.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>

* fix: address PR #28 review findings — align SDD pipeline across docs

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>

---------

Co-authored-by: Claude Sonnet 4.6 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant