# Project State ## Project Reference See: .planning/PROJECT.md (updated 2026-03-07) **Core value:** Generare un calendario di 13 caroselli Instagram strategicamente orchestrati, pronti per Canva Bulk Create, con un click dalla Web UI. **Current focus:** Phase 3 — Organization Layer (Plan 1/2 completato) ## Current Position Phase: 3 of 4 (Organization Layer) Plan: 1 of 2 in current phase — In progress Status: In progress — Plan 03-01 completo, manca 03-02 Last activity: 2026-03-09 — Completed 03-01-PLAN.md (SwipeService + pagina SwipeFile) Progress: [███████░░░] 77% (7/9 piani totali) ## Performance Metrics **Velocity:** - Total plans completed: 7 - Average duration: ~6.5 min - Total execution time: 47 min **By Phase:** | Phase | Plans | Total | Avg/Plan | |-------|-------|-------|----------| | 01-core-generation-pipeline | 4/4 COMPLETA | 33 min | 8 min | | 02-prompt-control-output-review | 2/2 COMPLETA | 9 min | 4.5 min | | 03-organization-layer | 1/2 In corso | 5 min | 5 min | **Recent Trend:** - Last 5 plans: 8 min, 10 min, 5 min, 4 min, 5 min - Trend: stabile intorno a 5 min *Updated after each plan completion* ## Accumulated Context ### Decisions Decisions are logged in PROJECT.md Key Decisions table. Recent decisions affecting current work: - [Setup]: FastAPI root_path SOLO via Uvicorn (--root-path), mai nel costruttore FastAPI() - [Setup]: CSV encoding = utf-8-sig (BOM) sempre; CANVA_FIELDS locked come costante - [Setup]: Prompt di sistema scritti IN italiano - [Setup]: Per-item error isolation dal primo loop di generazione - [01-01]: root_path SOLO via Uvicorn --root-path nel Dockerfile CMD - [01-01]: API_BASE='/postgenerator/api' nel frontend — Pitfall #9 risolto - [01-02]: CANVA_FIELDS 33 colonne con _image_keyword (non URL) — URL Unsplash in Phase 4 - [01-02]: PromptService usa ValueError per variabili mancanti - [01-03]: LLMService._parse_retry_after() legge header HTTP per wait esatto (fallback 60s) - [01-03]: asyncio.to_thread wrappa LLM sync calls nel background task async - [01-03]: Settings.api_key merge: PUT non sovrascrive con None se non inclusa nel body - [01-03]: Pipeline singleton in generate.py per mantenere _jobs tra request, con fallback da disco - [01-04]: Palette stone/amber per design B2B non generico (non gradienti viola) - [01-04]: Download CSV sempre via POST con edits inline (non GET originale) - [01-04]: localResults separato in OutputReview per edit inline senza mutare cache TanStack Query - [verification-fix]: GenerateResponse include calendar per badge PN/Schwartz nel frontend - [02-01]: PromptService init lazy via _get_prompt_service() per sincronizzazione con lifespan directory - [02-02]: Regen notes passate via campo tono in GenerateRequest (pragmatico, no backend changes) - [02-02]: Edit detection manuale via JSON.stringify comparison (trascurabile con 13 post) - [03-01]: SwipeService lazy init identico a PromptService (DATA_PATH creato nel lifespan FastAPI) - [03-01]: IDs brevi uuid4.hex[:12] — leggibili, no rischio collisione con volumi Swipe File - [03-01]: PUT con comportamento PATCH-like per nicchia/note — None cancella il valore - [03-01]: Filtro nicchia derivato dinamicamente da items (no config separata) ### Blockers/Concerns - [Phase 1]: Validare token usage reale per batch 13 post con claude-sonnet-4-5 — inter_request_delay=2.0s configurato, da validare in produzione - [Phase 1]: Baseline qualita' prompt italiani da validare dopo prima generazione reale - [Deploy]: Phase 2+3 plan1 complete — serve vps-lab-deploy per testare end-to-end il sistema - [03-02]: La route `/swipe-file` e il hook `useSwipeItems` sono pronti per l'integrazione nel form Genera Calendario ## Session Continuity Last session: 2026-03-09 Stopped at: Completed 03-01-PLAN.md (SwipeService + SwipeFile UI) — Plan 1/2 Phase 3 Resume file: None ## Next Actions 1. Eseguire 03-02-PLAN.md (Swipe-to-calendar integration: topic_overrides + picker Swipe File) 2. `vps-lab-deploy` per deployare su VPS e testare end-to-end il sistema 3. Pianificare Phase 4 (Enrichment: Unsplash integration)