Files

442 lines
18 KiB
JSON
Raw Permalink Normal View History

{
"schema": "agent_zero.crm.task_graph.v1",
"project": "crm-system",
"created_at": "2026-06-03T22:13:49Z",
"phases": [
{
"id": "phase-3-exploration",
"title": "Codebase Exploration & Pattern Reuse",
"subagent": "codebase_explorer",
"depends_on": [
"phase-2-architecture"
],
"deliverables": [
{
"id": "exploration-wochenplaner",
"type": "analysis",
"description": "Analysiere wochenplaner-Repo (FastAPI+SQLite+bcrypt, deployed via Coolify, Domain reinigung.media-on.de) und identifiziere wiederverwendbare Patterns: FastAPI-Layout, Dockerfile, docker-compose mit content:-mounts, Alembic-Setup, Auth-Flow, Coolify-Config, .env-Handling"
},
{
"id": "exploration-rentman-clone",
"type": "analysis",
"description": "Analysiere rentman-clone-Repo (falls vorhanden) für FastAPI-Layout, Alembic-Flow, Tooling-Patterns. Falls nicht: dokumentiere dass rentman-clone nicht verfügbar ist und nutze nur wochenplaner."
},
{
"id": "pattern-summary",
"type": "markdown",
"path": "/a0/.a0/03a-patterns-summary.md",
"description": "Markdown-Summary mit: wiederverwendbare Snippets, Pfade zu relevanten Files im wochenplaner, Empfehlungen für CRM-Implementation"
}
],
"estimated_duration_min": 30
},
{
"id": "phase-4a-backend-foundation",
"title": "Backend Foundation: Project-Skeleton, DB, Auth",
"subagent": "implementation_engineer",
"depends_on": [
"phase-3-exploration"
],
"deliverables": [
{
"id": "backend-skeleton",
"type": "code",
"description": "Projekt-Layout: app/ (main.py, core/, models/, schemas/, services/, api/v1/, alembic/, webui/, tests/), requirements.txt, pyproject.toml, .env.example, .gitignore"
},
{
"id": "core-modules",
"type": "code",
"description": "app/core/config.py (Pydantic-Settings), core/db.py (async-SQLAlchemy-Engine, Session-Factory), core/security.py (JWT-Encode/Decode, bcrypt-Hashing), core/deps.py (FastAPI-Dependencies)"
},
{
"id": "models-base",
"type": "code",
"description": "app/models/base.py (Base, TimestampMixin, SoftDeleteMixin, OrgScopedMixin), models/org.py, models/user.py"
},
{
"id": "alembic-init",
"type": "code",
"description": "alembic init (async template), alembic/env.py, erste Migration 0001_init.py mit orgs + users Tabellen"
},
{
"id": "auth-routes",
"type": "code",
"description": "app/api/v1/auth.py (register, login, refresh, logout), app/schemas/auth.py, app/services/auth_service.py, app/schemas/user.py, app/api/v1/users.py, app/services/user_service.py"
},
{
"id": "health-route",
"type": "code",
"description": "app/api/v1/health.py (GET /health mit DB-Check), an main.py gemounted"
},
{
"id": "main-app",
"type": "code",
"description": "app/main.py: FastAPI-Init, Router-Mounts (/api/v1/*), Static-Mounts (/static/* für webui/), CORS-Middleware, Global-Exception-Handler, Startup-Event (DB-Connection-Check), Docs (Swagger unter /docs)"
},
{
"id": "tests-foundation",
"type": "test",
"description": "tests/conftest.py (TestClient, DB-Fixtures), tests/test_auth.py (alle 9 Akzeptanzkriterien aus FR-1), tests/test_health.py, tests/test_users_me.py (für current-user-endpoint)"
}
],
"estimated_duration_min": 120,
"review_block_after": true
},
{
"id": "phase-4b-backend-business",
"title": "Backend Business-Logic: Accounts, Contacts, Deals, Activities, Notes, Tags, Dashboard",
"subagent": "implementation_engineer",
"depends_on": [
"phase-4a-backend-foundation"
],
"review_block_after": true,
"deliverables": [
{
"id": "models-business",
"type": "code",
"description": "app/models/{account,contact,deal,activity,note,tag,tag_link,deal_stage_history}.py mit allen Relationships, Indizes, Mixins"
},
{
"id": "schemas-business",
"type": "code",
"description": "app/schemas/{account,contact,deal,activity,note,tag,dashboard}.py (Pydantic-v2 Create/Update/Out-Schemas)"
},
{
"id": "services-business",
"type": "code",
"description": "app/services/{account,contact,deal,activity,note,tag,dashboard}_service.py mit Business-Logic, OrgScopedQuery-Nutzung, Polymorphic-Validation für Notes+Tags (R-2)"
},
{
"id": "routers-business",
"type": "code",
"description": "app/api/v1/{accounts,contacts,deals,activities,notes,tags,dashboard}.py mit allen 40+ Endpoints aus 01-requirements Tabelle"
},
{
"id": "alembic-2",
"type": "code",
"description": "alembic revision 0002_business_entities.py mit allen 8 neuen Tabellen (account, contact, deal, activity, note, tag, tag_link, deal_stage_history)"
},
{
"id": "tests-business",
"type": "test",
"description": "tests/test_{accounts,contacts,deals,activities,notes,tags,dashboard}.py mit DB-Write-Tests (CRUD), Integration-Tests (httpx.AsyncClient), alle Akzeptanzkriterien aus FR-2 bis FR-7 abdecken"
}
],
"estimated_duration_min": 240
},
{
"id": "phase-4c-frontend",
"title": "Frontend: Login, Dashboard, alle Pages mit Alpine.js + Tailwind",
"subagent": "implementation_engineer",
"depends_on": [
"phase-4a-backend-foundation"
],
"can_run_parallel_with": [
"phase-4b-backend-business"
],
"review_block_after": true,
"deliverables": [
{
"id": "frontend-foundation",
"type": "code",
"description": "webui/index.html (Login+Register), webui/app.html (Layout-Shell mit Auth-Gate), webui/css/app.css, webui/js/api.js (fetch-Wrapper mit JWT), webui/js/auth.js, webui/js/store.js (Alpine-Store für auth + notifications)"
},
{
"id": "frontend-pages",
"type": "code",
"description": "webui/{accounts,contacts,pipeline,activities,settings}.html mit Alpine.js-Komponenten (x-data), Tailwind-Styling, fetch()-Calls zu Backend"
},
{
"id": "frontend-components",
"type": "code",
"description": "webui/components/{account-list,contact-list,deal-kanban,activity-list,dashboard-kpis}.js als Alpine-Komponenten"
},
{
"id": "csp-headers",
"type": "code",
"description": "CSP-Header in main.py: script-src 'self' https://cdn.tailwindcss.com, object-src 'none', x-text statt x-html durchsetzen (R-5)"
},
{
"id": "smoke-tests-frontend",
"type": "test",
"description": "smoke-Tests: curl gegen jede HTML-Page (200 + content-sniff), headless-Browser-Test (Playwright optional v1.1)"
}
],
"estimated_duration_min": 180
},
{
"id": "phase-4d-deployment",
"title": "Deployment: Dockerfile, docker-compose, Coolify-Service, Runbook",
"subagent": "implementation_engineer",
"depends_on": [
"phase-4b-backend-business",
"phase-4c-frontend"
],
"review_block_after": true,
"deliverables": [
{
"id": "dockerfile",
"type": "code",
"description": "Dockerfile (python:3.12-slim, multi-stage optional, non-root-user, alembic upgrade head im Start-Command)"
},
{
"id": "docker-compose",
"type": "code",
"description": "docker-compose.yml mit crm-app + postgres-services, env-vars, healthchecks, volumes (vom wochenplaner-Pattern kopiert mit Anpassungen)"
},
{
"id": "coolify-config",
"type": "config",
"description": "Coolify-Service-Config (für manuelles Setup via UI oder API): Build-Command, Start-Command, ENV-Vars, Healthcheck, Domain-Plan"
},
{
"id": "runbook",
"type": "markdown",
"path": "/a0/.a0/runbook-restore.md",
"description": "Restore-Runbook: DB-Backup-Liste, Restore-Steps, ENV-Var-Liste, Healthcheck-Checkliste, Rollback-Plan"
}
],
"estimated_duration_min": 60
},
{
"id": "phase-5-test-debug",
"title": "Test & Debug: Live-Server-Tests, DB-Write-Tests, Bug-Fixes",
"subagent": "test_debug_engineer",
"depends_on": [
"phase-4a",
"phase-4b",
"phase-4c",
"phase-4d"
],
"deliverables": [
{
"id": "live-server-tests",
"type": "test",
"description": "uvicorn main:app starten, alle 49 funktionalen Endpoints via httpx testen, 3+ System-Endpoints (/health, /docs, /metrics-optional), Auth-Flow komplett"
},
{
"id": "db-write-tests",
"type": "test",
"description": "Jedes der 10 Models: pytest mit echter SQLite-DB + alembic upgrade head, create+read+update+delete+soft-delete"
},
{
"id": "smoke-tests-runtime",
"type": "test",
"description": "Docker-Stack hochfahren, curl /health (200), Auth-Flow testen, 3+ Endpoints testen, alembic upgrade head verifizieren, Frontend-Pages testen"
},
{
"id": "bug-report",
"type": "markdown",
"path": "/a0/.a0/05-bug-report.md",
"description": "Markdown mit allen gefundenen Bugs, Repro-Steps, Root-Cause, Fix-Empfehlung. Bugs werden in Phase 6 (Security-Data-Engineer) oder Phase 7 (Quality-Reviewer) gefixt."
}
],
"estimated_duration_min": 120
},
{
"id": "phase-6-security",
"title": "Security & Data-Engineering: Auth, Validation, Secrets, Backup",
"subagent": "security_data_engineer",
"depends_on": [
"phase-5-test-debug"
],
"deliverables": [
{
"id": "input-validation-audit",
"type": "audit",
"description": "Alle Pydantic-Schemas prüfen: fehlende Validatoren, SQL-Injection-Risiken, XSS-Inputs, Path-Traversal"
},
{
"id": "auth-jwt-audit",
"type": "audit",
"description": "JWT-Generation, Expiry, Secret-Handling, get_current_user-Dependency, RBAC-Checks (admin/sales_manager/sales_rep)"
},
{
"id": "secrets-management",
"type": "config",
"description": "Verifizieren: keine Secrets in repo, AUTH_SECRET in Coolify-ENV, DATABASE_URL in Coolify-ENV, .env.example ohne echte Werte, .gitignore deckt .env/.db ab"
},
{
"id": "data-persistence-check",
"type": "audit",
"description": "Soft-Delete-Implementierung, Foreign-Key-Cascades, Alembic-Migration-Rollback-Test, OrgScopedQuery-Isolation-Test (org 1 darf keine Daten von org 2 sehen)"
},
{
"id": "backup-restore-audit",
"type": "audit",
"description": "Coolify-Daily-Backup verifizieren, Restore-Runbook testen (auf Dev-Instanz), RPO/RTO quantifizieren"
},
{
"id": "security-report",
"type": "markdown",
"path": "/a0/.a0/06-security-report.md",
"description": "Markdown-Audit-Report mit allen Findings (PASS/WARN/FAIL), Fix-Empfehlungen, Prio-Reihenfolge"
}
],
"estimated_duration_min": 90
},
{
"id": "phase-7-quality",
"title": "Quality-Review: Code-Style, Type-Check, Dependency-Audit",
"subagent": "quality_reviewer",
"depends_on": [
"phase-6-security"
],
"deliverables": [
{
"id": "code-style-audit",
"type": "audit",
"description": "Ruff-Lint (alle Files, keine Warnungen), Black-Format (alle Files), Import-Sort (isort)"
},
{
"id": "type-check",
"type": "audit",
"description": "mypy --strict, alle Public-Interfaces, 0 Errors"
},
{
"id": "dependency-audit",
"type": "audit",
"description": "pip-audit oder safety-check, keine HIGH/CRITICAL Vulnerabilities, requirements.txt vollständig"
},
{
"id": "test-coverage",
"type": "audit",
"description": "pytest --cov, ≥ 70% Coverage, alle 40 Akzeptanzkriterien aus 01-requirements als Test implementiert"
},
{
"id": "quality-report",
"type": "markdown",
"path": "/a0/.a0/07-quality-report.md",
"description": "Markdown mit allen Audits, Score-Card, Fix-Liste"
}
],
"estimated_duration_min": 60
},
{
"id": "phase-8-runtime",
"title": "Runtime DevOps: Docker-Build, Coolify-Deploy, Healthcheck, Smoke",
"subagent": "runtime_devops_engineer",
"depends_on": [
"phase-7-quality"
],
"deliverables": [
{
"id": "docker-build-smoke",
"type": "verification",
"description": "docker build erfolgreich, Image-Größe < 500MB, Layer-Cache effizient"
},
{
"id": "docker-compose-up",
"type": "verification",
"description": "docker-compose up erfolgreich, alle Services healthy, /health 200, alembic upgrade head erfolgreich"
},
{
"id": "coolify-deploy",
"type": "deployment",
"description": "Coolify-Service-Setup (manuell oder via API), ENV-Vars gesetzt, Domain konfiguriert, Healthcheck grün"
},
{
"id": "live-smoke-tests",
"type": "test",
"description": "Login-Flow E2E, 3+ API-Endpoints, Frontend-Pages laden, CSP-Header korrekt, JWT-Flow funktioniert"
},
{
"id": "env-docs",
"type": "markdown",
"path": "/a0/.a0/08-runtime-report.md",
"description": "Environment-Doku: alle ENV-Vars, ihre Quelle, ihre Default-Werte, wo sie gesetzt werden müssen (Coolify UI), Runbook für Re-Deploy"
}
],
"estimated_duration_min": 60
},
{
"id": "phase-9-release",
"title": "Release-Audit: Final-Readiness, Handoff-Package, Deployment-Approval",
"subagent": "release_auditor",
"depends_on": [
"phase-8-runtime"
],
"deliverables": [
{
"id": "final-readiness-checklist",
"type": "markdown",
"path": "/a0/.a0/09-final-readiness.md",
"description": "Checkliste aller Phase-Reports, alle Akzeptanzkriterien, alle NFRs quantifiziert, alle Risiken adressiert, alle ADR-Trade-offs dokumentiert"
},
{
"id": "handoff-package",
"type": "markdown",
"path": "/a0/.a0/09-handoff.md",
"description": "User-Handoff: Wie nutze ich das CRM, ENV-Var-Übersicht, Runbook-Links, Backup-Strategie, bekannte Limitierungen, v1.1-Roadmap"
},
{
"id": "next-steps",
"type": "markdown",
"path": "/a0/.a0/09-next-steps.md",
"description": "Vorgeschlagene v1.1-Features: SMTP-Email, Audit-Log, Refresh-Token, Rate-Limiting, Avatar-Upload, E2E-Playwright-Tests, Hard-Delete-Tool für DSGVO, Multi-Tenant-Switch"
},
{
"id": "release-approval",
"type": "approval",
"description": "User-Approval für Production-Deployment auf Coolify, mit Domain-Wahl"
}
],
"estimated_duration_min": 30
}
],
"critical_path": [
"phase-2-architecture",
"phase-3-exploration",
"phase-4a-backend-foundation",
"phase-4b-backend-business",
"phase-4d-deployment",
"phase-5-test-debug",
"phase-6-security",
"phase-7-quality",
"phase-8-runtime",
"phase-9-release"
],
"parallelizable_pairs": [
[
"phase-4b-backend-business",
"phase-4c-frontend"
]
],
"total_estimated_duration_min": 990,
"approval_gates": [
{
"after_phase": "phase-2-architecture",
"approver": "user",
"description": "User genehmigt Architektur + Task-Graph, dann startet Phase 3"
},
{
"after_phase": "phase-4a-backend-foundation",
"approver": "user",
"description": "User genehmigt Backend-Skeleton + Auth, dann startet Phase 4b+4c parallel"
},
{
"after_phase": "phase-7-quality",
"approver": "user",
"description": "User genehmigt Quality-Report, dann startet Phase 8 (Runtime)"
},
{
"after_phase": "phase-8-runtime",
"approver": "user",
"description": "User genehmigt Live-Runtime, dann startet Phase 9 (Release)"
},
{
"after_phase": "phase-9-release",
"approver": "user",
"description": "User genehmigt Production-Deployment mit Domain-Wahl"
}
],
"constraints": [
"Plan Mode aktiv: implementation_allowed = false. Architektur-Phase schreibt nur Markdown + JSON-Schema.",
"Kein Code, keine Migrationen, keine docker-compose-Files in Phase 2.",
"Wochenplaner-Repo als Referenz: FastAPI+SQLite+bcrypt, deployed via Coolify (project-uuid urmddibnyooglc8ei314tseu, service-uuid v100oc23yok921ue26q8epei, domain reinigung.media-on.de)",
"Coolify-Server: localhost (uuid lw80w8scs4044gwcw084s00s4), 2 concurrent_builds, 25 queue_limit, 3600s timeout",
"Single-Tenant v1, org_id überall, OrgScopedQuery-Helper Pflicht (R-1)",
"Polymorphic-Validation für Notes+Tags in Service-Layer (R-2)",
"JWT im localStorage, strikte CSP, x-text statt x-html (R-5)"
]
}