|
| 1 | +--- |
| 2 | +id: 0001 |
| 3 | +title: Create implementation plan for Recurring Tasks feature |
| 4 | +stage: plan |
| 5 | +date: 2025-12-10 |
| 6 | +surface: agent |
| 7 | +model: claude-sonnet-4-5-20250929 |
| 8 | +feature: 013-recurring-tasks |
| 9 | +branch: main |
| 10 | +user: mjunaidca |
| 11 | +command: Create implementation plan for Recurring Tasks feature |
| 12 | +labels: ["planning", "recurring-tasks", "phase-v", "spec-driven"] |
| 13 | +links: |
| 14 | + spec: specs/013-recurring-tasks/spec.md |
| 15 | + ticket: null |
| 16 | + adr: null |
| 17 | + pr: null |
| 18 | +files: |
| 19 | + - specs/013-recurring-tasks/plan.md |
| 20 | +tests: |
| 21 | + - None (planning phase) |
| 22 | +--- |
| 23 | + |
| 24 | +## Prompt |
| 25 | + |
| 26 | +Create implementation plan for Recurring Tasks feature. |
| 27 | + |
| 28 | +## Context Files to Read |
| 29 | +1. Spec: specs/013-recurring-tasks/spec.md |
| 30 | +2. Constitution: .specify/memory/constitution.md |
| 31 | +3. PRD: specs/011-phase-v-features-planner/agent-2a-recurring-tasks-prd.md |
| 32 | + |
| 33 | +## Current Codebase Structure |
| 34 | +- Backend: packages/api/src/taskflow_api/ |
| 35 | + - models/task.py - Task SQLModel |
| 36 | + - schemas/task.py - Pydantic schemas (TaskCreate, TaskUpdate, TaskRead, TaskListItem) |
| 37 | + - routers/tasks.py - Task API endpoints including update_status |
| 38 | +- Frontend: web-dashboard/src/ |
| 39 | + - types/index.ts - TypeScript types |
| 40 | + - app/projects/[id]/tasks/new/page.tsx - Task creation form |
| 41 | + |
| 42 | +## Your Task |
| 43 | +Create a comprehensive implementation plan at specs/013-recurring-tasks/plan.md that includes: |
| 44 | + |
| 45 | +1. **Summary**: Primary requirement + technical approach |
| 46 | + |
| 47 | +2. **Technical Context**: |
| 48 | + - Language: Python 3.13 (backend), TypeScript (frontend) |
| 49 | + - Framework: FastAPI + SQLModel (backend), Next.js 16 (frontend) |
| 50 | + - Database: PostgreSQL via Neon (production), SQLite (tests) |
| 51 | + - Testing: pytest (backend) |
| 52 | + |
| 53 | +3. **Constitution Check**: Verify against 5 Non-Negotiable Principles: |
| 54 | + - Audit: Every action auditable |
| 55 | + - Agent Parity: Same API for humans/agents |
| 56 | + - Recursive Tasks: N/A for this feature |
| 57 | + - Spec-Driven: Spec exists before code |
| 58 | + - Phase Continuity: Data model works through Phase V |
| 59 | + |
| 60 | +4. **Implementation Phases**: |
| 61 | + |
| 62 | + **Phase 1: Backend Model + Migration** (Priority: Highest) |
| 63 | + - Add 5 fields to Task model: is_recurring, recurrence_pattern, reminder_sent, max_occurrences, occurrences_created |
| 64 | + - Create Alembic migration |
| 65 | + - Test with pytest |
| 66 | + |
| 67 | + **Phase 2: Schema Updates** |
| 68 | + - Update TaskCreate with is_recurring, recurrence_pattern, max_occurrences |
| 69 | + - Update TaskUpdate with same fields |
| 70 | + - Update TaskRead, TaskListItem with is_recurring indicator |
| 71 | + - Add validation (pattern required when recurring=true) |
| 72 | + |
| 73 | + **Phase 3: Recurring Logic** |
| 74 | + - Add calculate_next_due() function |
| 75 | + - Add create_next_occurrence() async function |
| 76 | + - Modify update_status endpoint to trigger on completion |
| 77 | + - Create audit log entry for spawned tasks |
| 78 | + |
| 79 | + **Phase 4: Frontend Updates** |
| 80 | + - Update TypeScript types (TaskCreate, TaskRead, TaskListItem) |
| 81 | + - Add RECURRENCE_PATTERNS constant |
| 82 | + - Add recurring toggle + pattern selector to task create form |
| 83 | + - Add recurring badge to task list |
| 84 | + - Add recurring indicator to task detail view |
| 85 | + |
| 86 | +5. **File Changes Summary**: |
| 87 | + List all files to be modified/created with specific changes |
| 88 | + |
| 89 | +6. **Test Strategy**: |
| 90 | + - Unit tests for calculate_next_due() |
| 91 | + - Integration test for complete recurring task flow |
| 92 | + - Edge case tests (max_occurrences, no due_date, etc.) |
| 93 | + |
| 94 | +7. **Risk Assessment**: |
| 95 | + - Database migration on production |
| 96 | + - Backward compatibility with existing tasks |
| 97 | + |
| 98 | +Write the complete plan to: specs/013-recurring-tasks/plan.md |
| 99 | + |
| 100 | +## Response snapshot |
| 101 | + |
| 102 | +Created comprehensive implementation plan at `specs/013-recurring-tasks/plan.md` with the following structure: |
| 103 | + |
| 104 | +**Key Sections:** |
| 105 | +1. **Summary**: Auto-create next occurrence on task completion with time-based (1m-1h) and calendar-based (daily/weekly/monthly) patterns |
| 106 | +2. **Technical Context**: Python 3.13/FastAPI/SQLModel backend, TypeScript/Next.js 16 frontend, PostgreSQL database |
| 107 | +3. **Constitution Check**: ✅ All 5 principles verified (Audit, Agent Parity, Recursive N/A, Spec-Driven, Phase Continuity) |
| 108 | +4. **4 Implementation Phases** (45min total): |
| 109 | + - Phase 1: Backend Model + Migration (15min) - Add 5 fields, generate/apply Alembic migration |
| 110 | + - Phase 2: Schema Updates (10min) - Extend TaskCreate/Update/Read with validation |
| 111 | + - Phase 3: Recurring Logic (15min) - Implement calculate_next_due(), create_next_occurrence(), integrate into update_status |
| 112 | + - Phase 4: Frontend (15min) - Add recurring toggle, pattern selector, badges/indicators |
| 113 | +5. **File Changes**: 8 files, ~307 lines total |
| 114 | +6. **Test Strategy**: Unit tests (calculate_next_due), integration tests (completion flow, max_occurrences, audit), manual testing checklist |
| 115 | +7. **Risk Assessment**: 5 risks identified with mitigation (migration safety, backward compat, infinite loops, timezones, UI validation) |
| 116 | + |
| 117 | +**Technical Highlights:** |
| 118 | +- New Task fields: `is_recurring`, `recurrence_pattern`, `reminder_sent`, `max_occurrences`, `occurrences_created` |
| 119 | +- Recurrence patterns: 1m, 5m, 10m, 15m, 30m, 1h, daily, weekly, monthly |
| 120 | +- Triggers only on `status=completed` (one-time event, no loops) |
| 121 | +- Inherits: title, description, assignee, priority, tags, project |
| 122 | +- Audit log links new task to source (`recurring_from` detail) |
| 123 | +- Backend validation: pattern required when recurring=true |
| 124 | +- Frontend: Checkbox + Select dropdown + optional max occurrences input |
| 125 | + |
| 126 | +**Constitution Compliance:** |
| 127 | +- ✅ Audit: log_action() for new task with recurring_from reference |
| 128 | +- ✅ Agent Parity: Same /api/tasks/{id}/status endpoint for humans/agents |
| 129 | +- ⚠️ Recursive: N/A (new tasks are siblings, not subtasks) |
| 130 | +- ✅ Spec-Driven: Follows specs/013-recurring-tasks/spec.md |
| 131 | +- ✅ Phase Continuity: Additive fields with defaults, backward compatible |
| 132 | + |
| 133 | +## Outcome |
| 134 | + |
| 135 | +- ✅ Impact: Created production-ready implementation plan with 13 sections covering all aspects (model, schemas, logic, frontend, tests, risks) |
| 136 | +- 🧪 Tests: Test strategy includes unit tests (9 pattern calculations), integration tests (4 scenarios: basic flow, max_occurrences, no due_date, audit), manual checklist |
| 137 | +- 📁 Files: Plan document (1 created), identifies 8 files to modify (4 backend, 4 frontend), ~307 total lines |
| 138 | +- 🔁 Next prompts: (1) Implement Phase 1 (backend model + migration), (2) Implement Phase 2 (schemas), (3) Implement Phase 3 (recurring logic), (4) Implement Phase 4 (frontend) |
| 139 | +- 🧠 Reflection: Plan follows constitution's 5 principles, provides clear phase breakdown with time estimates, includes rollback strategies for migration risk, documents edge cases (no due_date → use completion time, monthly = 30 days not calendar month) |
| 140 | + |
| 141 | +## Evaluation notes (flywheel) |
| 142 | + |
| 143 | +- Failure modes observed: None - plan creation successful on first attempt |
| 144 | +- Graders run and results (PASS/FAIL): N/A (planning phase, no code execution) |
| 145 | +- Prompt variant (if applicable): Base prompt with structured sections (Context + Task breakdown) |
| 146 | +- Next experiment (smallest change to try): Begin Phase 1 implementation (backend model changes) |
0 commit comments