# Project State ## Project Reference See: .planning/PROJECT.md (updated 2026-02-26) **Core value:** Admins can describe ranking criteria in natural language, the system interprets and ranks projects accordingly, and they can advance the top projects to the next round with one click — all with full override control. **Current focus:** Phase 1 — AI Ranking Backend ## Current Position Phase: 1 of 4 (AI Ranking Backend) Plan: 3 of TBD in current phase Status: In progress Last activity: 2026-02-27 — Plan 03 complete: tRPC rankingRouter with 5 procedures registered in appRouter Progress: [███░░░░░░░] ~30% ## Performance Metrics **Velocity:** - Total plans completed: 3 - Average duration: ~3 min - Total execution time: ~10 min **By Phase:** | Phase | Plans | Total | Avg/Plan | |-------|-------|-------|----------| | 01-ai-ranking-backend | 3 | ~10 min | ~3 min | **Recent Trend:** - Last 5 plans: 01-01 (~3 min), 01-02 (~3 min), 01-03 (~4 min) - Trend: Fast (service-layer tasks) *Updated after each plan completion* ## Accumulated Context ### Decisions Decisions are logged in PROJECT.md Key Decisions table. Recent decisions affecting current work: - [Init]: RankingSnapshot model (new table) preferred over Round.metadataJson for audit history — confirm with client before writing migration - [Init]: Per-category processing (STARTUP / BUSINESS_CONCEPT) — two parallel AI calls, not one combined call - [Init]: Phase 4 is independent and can be parallelized with Phases 2-3 - [01-01]: Used separate relation names per FK pair (RoundRankingSnapshots / TriggeredRankingSnapshots) — Prisma requires unique relation names per FK, not per target model - [01-01]: All EvaluationConfig ranking fields are optional/defaulted for backward compatibility with existing rounds - [01-01]: Created migration SQL manually (20260227000000_add_ranking_snapshot) — local DB credentials unavailable; migration applies on next deploy - [01-02]: fetchAndRankCategory exported (not private) so tRPC router can execute pre-parsed rules without re-parsing - [01-02]: Projects with zero SUBMITTED evaluations excluded from ranking entirely (not ranked last) - [01-02]: PrismaClient imported as real type (not import type) so transaction clients are compatible - [01-03]: Typed arrays cast to Prisma.InputJsonValue via `unknown` (direct cast rejected by strict TS — no index signature) - [01-03]: getSnapshot uses findUnique + manual TRPCError NOT_FOUND (findUniqueOrThrow gives INTERNAL_SERVER_ERROR) ### Pending Todos None yet. ### Blockers/Concerns - [Phase 1]: French/English variable naming for EmailTemplate bilingual fields needs client confirmation before Phase 3 schema migration - [Phase 1]: Poste.io bulk-send rate limits need verification before Phase 3 load testing - [Phase 3]: Tiptap Mention extension API in v3.x should be validated against Tiptap v3 docs before implementation ## Session Continuity Last session: 2026-02-27 Stopped at: Completed 01-03-PLAN.md (tRPC rankingRouter — 5 procedures, registered in appRouter) Resume file: None