# TASK_PHASE_CITIZENS_DIRECTORY_v1 ## Title TASK_PHASE_CITIZENS_DIRECTORY_v1 - Public Citizens Directory and Agent Visibility ## 1. Overview Make /citizens page fully functional as public AI-citizens directory: * Show list of agents marked as public. * Support filters: search, district, agent type. * Connect Publichnyi hromadianyn mista toggle in agent Identity tab to this directory. ## 2. Current State * /citizens page exists, but shows: * Found citizens: 0 * Error: Failed to fetch citizens * Agents page /agents shows many agents (including NODE2 DAGI agents). * On agent Identity tab there is toggle: * Publichnyi hromadianyn mista * Rezhym vydymosti: Publichnyi / Tilky MicroDAO * Backend likely missing: * Proper get_public_citizens() query. * Or route /public/citizens is broken. ## 3. Goals 1. Make /citizens page show a list of public agents. 2. Wire visibility controls on agent Identity tab to is_public field. 3. Filters work: * Search by name/title/tagline. * District filter. * Agent type filter. ## 4. Backend Tasks ### 4.1. Citizen model Add CitizenSummary model with fields: - id, slug, display_name, role, public_tagline - district, public_district, home_microdao_id - kind, node_id, avatar_url, color_hint, status ### 4.2. Repo: get_public_citizens Query agents WHERE is_public = true AND deleted_at IS NULL AND is_archived = false. Apply filters for district, kind, and search. ### 4.3. API route GET /public/citizens with optional query params: search, district, kind. ### 4.4. Update agent visibility PATCH /city/agents/{agent_id}/visibility to update is_public and visibility_scope. ## 5. Frontend Tasks ### 5.1. Fix Citizens API call ### 5.2. Citizens Page UI with filters ### 5.3. Citizen Card Component ### 5.4. Wire Identity Tab to visibility API ## 6. Acceptance Criteria 1. /citizens page loads without error. 2. At least one agent with is_public=true appears in Citizens Directory. 3. Filters work. 4. Changing visibility on /agents/[slug] Identity tab updates /citizens. 5. No leakage of deleted/archived agents. ## 7. Districts Reference * leadership - Leadership Hall * system - System Control Center * engineering - Engineering Lab * marketing - Marketing Hub * finance - Finance Office * web3 - Web3 District * security - Security Bunker * vision - Vision Studio * rnd - R&D Laboratory * memory - Memory Vault