# Implementation Plan: [FEATURE] **Branch**: `[###-feature-name]` | **Date**: [DATE] | **Spec**: [link] **Input**: Feature specification from `/specs/[###-feature-name]/spec.md` **Note**: This template is filled in by the `/speckit.plan` command. See `.specify/templates/plan-template.md` for the execution workflow. ## Summary [Extract from feature spec: primary requirement + technical approach from research] ## Technical Context **Language/Version**: Python 3.13+ (backend), JavaScript/TypeScript (frontend Svelte 5) **Primary Dependencies**: FastAPI, SQLAlchemy, APScheduler (backend); SvelteKit, Vite, Tailwind CSS (frontend) **Storage**: PostgreSQL 16 **Testing**: pytest (backend), vitest + @testing-library/svelte (frontend) **Target Platform**: Linux server (Docker), modern browsers **Project Type**: web application (FastAPI REST + WebSocket backend, SvelteKit SPA frontend) **Performance Goals**: [domain-specific, e.g., <200ms p95 API latency, 60fps UI] **Constraints**: [domain-specific, e.g., <100MB memory per container, RBAC enforcement, offline-capable Docker bundle] **Scale/Scope**: [domain-specific, e.g., 50 concurrent users, 1000 dashboards, 10 plugins] ## Constitution Check *GATE: Must pass before Phase 0 research. Re-check after Phase 1 design.* [Evaluate against constitution.md and semantics.md. Explicitly confirm semantic protocol compliance, complexity-driven contract coverage, UX-state compatibility (Svelte 5 runes), async boundaries (FastAPI), API-wrapper rules, RBAC/security constraints (local auth + ADFS SSO), plugin lifecycle rules, and any required belief-state/logging constraints for Complexity 4/5 Python modules.] ## Project Structure ### Documentation (this feature) ```text specs/[###-feature]/ ├── plan.md # This file (/speckit.plan command output) ├── research.md # Phase 0 output (/speckit.plan command) ├── data-model.md # Phase 1 output (/speckit.plan command) ├── quickstart.md # Phase 1 output (/speckit.plan command) ├── contracts/ # Phase 1 output (/speckit.plan command) └── tasks.md # Phase 2 output (/speckit.tasks command - NOT created by /speckit.plan) ``` ### Source Code (repository root) ```text # Web application (default for this repository) backend/ ├── src/ │ ├── api/ # FastAPI routes │ ├── core/ # Core services (task_manager, auth, migration, plugins) │ ├── models/ # SQLAlchemy ORM models │ ├── services/ # Business logic │ └── schemas/ # Pydantic schemas └── tests/ # pytest tests frontend/ ├── src/ │ ├── routes/ # SvelteKit pages │ ├── lib/ │ │ ├── components/ # Reusable Svelte 5 components │ │ ├── stores/ # Svelte rune stores ($state, $derived) │ │ └── api/ # API client modules │ └── i18n/ # Internationalization └── tests/ # vitest tests docker/ # Docker configurations ``` **Structure Decision**: This is a web application with separate `backend/` (Python/FastAPI) and `frontend/` (SvelteKit) directories. Docker Compose orchestrates both services plus PostgreSQL. ## Semantic Contract Guidance > Use this section to drive Phase 1 artifacts, especially `contracts/modules.md`. - Classify each planned module/component with `@COMPLEXITY: 1..5`. - Use comment-anchor syntax appropriate for each context: - Python: `# [DEF:id:Type]` - Svelte markup: `` - Svelte script: `// [DEF:id:Type]` - Match contract density to complexity: - Complexity 1: anchors only (DTOs, simple constants) - Complexity 2: `@PURPOSE` (utility functions, pure helpers) - Complexity 3: `@PURPOSE`, `@RELATION`; Svelte components also `@UX_STATE` - Complexity 4: `@PURPOSE`, `@RELATION`, `@PRE`, `@POST`, `@SIDE_EFFECT`; Python also `belief_scope`/`reason`/`reflect` markers; Svelte also `@UX_FEEDBACK`, `@UX_RECOVERY`, `@UX_REACTIVITY` - Complexity 5: level 4 + `@DATA_CONTRACT`, `@INVARIANT` + `@RATIONALE`/`@REJECTED` decision memory - Write relations only in canonical form: `@RELATION PREDICATE -> TARGET_ID` - If any relation target, DTO, or contract dependency is unknown, emit `[NEED_CONTEXT: target]` instead of inventing placeholders. ## Complexity Tracking > **Fill ONLY if Constitution Check has violations that must be justified** | Violation | Why Needed | Simpler Alternative Rejected Because | |-----------|------------|-------------------------------------| | [e.g., 4th plugin] | [current need] | [why 3 plugins insufficient] | | [e.g., Service layer pattern] | [specific problem] | [why direct ORM access insufficient] |