What this file is

This is the attention mechanism of the Flow knowledge base. Read this before any other doc. It tells you exactly which documents to load based on what you are working on — and in what order. Never load docs at random; always use this map.

Weight scale: 10 = always load · 8–9 = load for related task · 5–7 = reference if needed · 1–4 = legacy/history


Always Load (Weight 10) — Every Session

These docs are the foundation. Read them at the start of every session regardless of task.

DocWhat it containsTokens
overviewFull tech stack, all architectural decisions, what does NOT exist and why~120
database-schemaAll ~30 tables, RLS pattern, key views (public_profiles), known tech debt~300
2026-04-27-architecture-refactor-master-guidePre-task checklist, DB standards, RLS mandatory pattern, tech debt register (§4), security rules — read §1 checklist before any DB/schema work~800

Load By Task (Weight 8–9)

Read the matching row before writing any code.

Task areaLoad this docWeight
Any DB schema / migration / RLS2026-04-27-architecture-refactor-master-guide §1 checklist10
Auth / registration wizardfeat-registration-wizard-v29
UI components / theme tokensrefactor-theme-tokens9
Supabase Edge Functionsservices9
Tag system / recommendationsfeat-registration-wizard-v2 + this file’s tag section below9
Localization / i18nlocalization8
Error handling / loggingfeat-unified-error-handling8
Push notificationscrash-reporting-settings8
Event discovery / feedfeat-event-discovery-live8
Social / crews / friendsfeature-crew-chat8
Web admin portaloverview8
Deploymentguide8
Branch / commit workflowbranch-strategy7

Quick Reference (Weight 5–7)

Load only when you need to verify a specific fact.

Need to check…Load this
Intentional RLS / service_role bypassessecurity-bypass-log
API endpoints / PostgREST contractsapi-documentation
Supabase migration historydatabase-schema (migration log section)
Gamification rules (XP, badges, karma)feature-xp-karma-score
Brand identity / colors / voicebrand-identity
Open product questionsopen-questions
Feature tracker / roadmapfeature-tracker
Local dev setuplocal-setup
Architecture issues (infra proposals)1-event-bus

Tag & Recommendation System (inline — Weight 9)

Tables: tags (id, name, category ENUM, parent_id, usage_count), tag_affinity (tag_a_id, tag_b_id, weight FLOAT, co_occurrences, computed_at)

Weight formula: P(B|A) = co_occurrences(A,B) / count(profiles_with_A) — asymmetric conditional probability.

Flutter providers:

  • tagListProvider — all tags, global singleton, prefetched at wizard mount
  • tagAffinityProvider(tagId)FutureProvider.autoDispose.family, per-tag affinity weights from tag_affinity

orderedTags(allTags, selectedNames, lastSelectedName, {affinityWeights}):

  1. Selected (in selection order)
  2. Neural path if affinityWeights non-empty → sort unselected by P(B|lastSelected) desc
  3. Structural fallback if empty → same parentId or category, sorted by usageCount
  4. Rest by usageCount desc

Edge Function: compute-tag-affinity — daily cron 03:00 UTC, reads profiles.interests[], builds co-occurrence matrix, upserts into tag_affinity. Deployed 2026-04-27.


Do Not Load (Weight 1–4) — Legacy / History

These are archived. Never update them. Reference only if explicitly asked about history.

DocReason
legacy/ folderArchived microservices era, pre-Supabase migration
2-redis-socketioResolved by Supabase-only migration
database-audit-2026-03-24Historical audit, superseded by live schema

After Finishing Code — Update Protocol

After any code change, update the matching doc immediately (do not batch):

ChangedUpdate
Any Flutter screenmobile/features/<area>/<feature>.md
Supabase schemabackend/database-schema.md
Edge Functionarchitecture/services.md + backend/api-documentation.md
Auth / wizard flowmobile/features/auth/feat-registration-wizard-v2.md
Theme / design systemmobile/features/ui/refactor-theme-tokens.md
New tag/recommendation logicThis file (tag section above) + feat-registration-wizard-v2.md
Architecture decisionarchitecture/overview.md
New l10n keysmobile/features/localization.md

If no doc exists for the area → create one, then add it to this map.