+
+
+ {isOnline ? 'online' : 'offline'}
+
View Profile →
@@ -218,4 +234,3 @@ function CitizenCard({ citizen }: { citizen: PublicCitizenSummary }) {
);
}
-
diff --git a/apps/web/src/app/microdao/[slug]/page.tsx b/apps/web/src/app/microdao/[slug]/page.tsx
index 4a1ec192..81693bcd 100644
--- a/apps/web/src/app/microdao/[slug]/page.tsx
+++ b/apps/web/src/app/microdao/[slug]/page.tsx
@@ -4,6 +4,7 @@ import { useParams } from "next/navigation";
import Link from "next/link";
import { useMicrodaoDetail } from "@/hooks/useMicrodao";
import { DISTRICT_COLORS } from "@/lib/microdao";
+import { ChevronLeft, Users, MessageSquare, Crown, Building2, Globe, Lock, Layers, BarChart3, Bot } from "lucide-react";
export default function MicrodaoDetailPage() {
const params = useParams();
@@ -23,8 +24,9 @@ export default function MicrodaoDetailPage() {
MicroDAO не знайдено
-
- ← Повернутися до списку
+
+
+ Повернутися до списку
@@ -40,6 +42,7 @@ export default function MicrodaoDetailPage() {
const cityRooms = microdao.channels.filter((c) => c.kind === "city_room");
const crewChannels = microdao.channels.filter((c) => c.kind === "crew");
const publicCitizens = microdao.public_citizens ?? [];
+ const childMicrodaos = microdao.child_microdaos ?? [];
return (
@@ -49,32 +52,43 @@ export default function MicrodaoDetailPage() {
href="/microdao"
className="inline-flex items-center gap-2 text-sm text-slate-400 hover:text-cyan-400 transition-colors"
>
-
+
Всі MicroDAO
{/* Header */}
-
+
- {microdao.logo_url && (
+ {microdao.logo_url ? (
+ // eslint-disable-next-line @next/next/no-img-element

+ ) : (
+
+
+
)}
-
{microdao.name}
+
+
{microdao.name}
+ {microdao.is_platform && (
+
+ Platform
+
+ )}
+
{microdao.description && (
{microdao.description}
)}
+ {/* Badges */}
{microdao.district && (
)}
+
{microdao.is_active ? "Active" : "Inactive"}
- {microdao.is_public && (
-
- Public
-
- )}
+
+ {microdao.is_public ? : }
+ {microdao.is_public ? "Public" : "Private"}
+
+
+ {/* Parent MicroDAO */}
+ {microdao.parent_microdao_slug && (
+
+
+ Parent:
+
+ {microdao.parent_microdao_slug}
+
+
+ )}
+ {/* Orchestrator */}
{orchestrator && (
-
-
Оркестратор
+
+
+
+ Оркестратор
+
{orchestrator.display_name}
@@ -117,13 +153,41 @@ export default function MicrodaoDetailPage() {
+ {/* Child MicroDAOs */}
+ {childMicrodaos.length > 0 && (
+
+
+
+ Дочірні MicroDAO
+
+
+ {childMicrodaos.map((child) => (
+
+
+
{child.name}
+
{child.slug}
+
+ {child.is_platform && (
+
+ Platform
+
+ )}
+
+ ))}
+
+
+ )}
+
{/* Agents */}
-
+
Агентська команда
+ ({microdao.agents.length})
{microdao.agents.length === 0 ? (
@@ -146,45 +210,45 @@ export default function MicrodaoDetailPage() {
{a.role}
)}
- {a.is_core && (
-
- Core
-
- )}
+
+ {a.agent_id === microdao.orchestrator_agent_id && (
+
+ )}
+ {a.is_core && (
+
+ Core
+
+ )}
+
))}
)}
+ {/* Public Citizens */}
{publicCitizens.length > 0 && (
-
+
Громадяни цього MicroDAO
+ ({publicCitizens.length})
{publicCitizens.map((citizen) => (
-
{citizen.display_name}
+
{citizen.display_name}
{citizen.public_title && (
-
{citizen.public_title}
+
{citizen.public_title}
)}
{citizen.district && (
-
{citizen.district}
+
{citizen.district}
)}
))}
@@ -195,9 +259,7 @@ export default function MicrodaoDetailPage() {
{/* Channels */}
-
+
Канали та кімнати
@@ -221,9 +283,6 @@ export default function MicrodaoDetailPage() {
rel="noreferrer"
className="inline-flex items-center gap-2 px-4 py-2 bg-blue-500/10 border border-blue-500/30 rounded-full text-sm text-blue-400 hover:bg-blue-500/20 transition-colors"
>
-
{c.display_name || c.ref_id}
))}
@@ -241,9 +300,6 @@ export default function MicrodaoDetailPage() {
key={c.ref_id}
className="inline-flex items-center gap-2 px-4 py-2 bg-green-500/10 border border-green-500/30 rounded-full text-sm text-green-400"
>
-
{c.display_name || c.ref_id}
))}
@@ -262,9 +318,6 @@ export default function MicrodaoDetailPage() {
href={`/city/${c.ref_id}`}
className="inline-flex items-center gap-2 px-4 py-2 bg-violet-500/10 border border-violet-500/30 rounded-full text-sm text-violet-400 hover:bg-violet-500/20 transition-colors"
>
-
{c.display_name || c.ref_id}
))}
@@ -282,9 +335,6 @@ export default function MicrodaoDetailPage() {
key={c.ref_id}
className="inline-flex items-center gap-2 px-4 py-2 bg-orange-500/10 border border-orange-500/30 rounded-full text-sm text-orange-400"
>
-
{c.display_name || c.ref_id}
))}
@@ -295,21 +345,32 @@ export default function MicrodaoDetailPage() {
)}
- {/* Future: Stats & Tokens */}
+ {/* Stats */}
-
- Статистика та токени
+
+ Статистика
-
- Цей блок буде наповнено метриками MicroDAO (участь, транзакції, голосування),
- коли буде готова токеноміка та governance-шар.
+
+
+
{microdao.agents.length}
+
Агентів
+
+
+
{publicCitizens.length}
+
Громадян
+
+
+
{microdao.channels.length}
+
Каналів
+
+
+
{childMicrodaos.length}
+
Дочірніх DAO
+
);
}
-
diff --git a/apps/web/src/app/microdao/page.tsx b/apps/web/src/app/microdao/page.tsx
index d6cd6273..640640b7 100644
--- a/apps/web/src/app/microdao/page.tsx
+++ b/apps/web/src/app/microdao/page.tsx
@@ -4,6 +4,7 @@ import { useState } from "react";
import { useMicrodaoList } from "@/hooks/useMicrodao";
import { DISTRICTS, DISTRICT_COLORS } from "@/lib/microdao";
import Link from "next/link";
+import { Building2, Users, MessageSquare, Search, MapPin, Crown, Globe, Lock, Layers } from "lucide-react";
export default function MicrodaoListPage() {
const [district, setDistrict] = useState();
@@ -15,36 +16,48 @@ export default function MicrodaoListPage() {
{/* Header */}
-
+
+
+
+
MicroDAO
- Кластери агентів і організацій у DAARION.city
+ Організації та кластери агентів у DAARION City
-
-
- setQ(e.target.value)}
- className="bg-slate-800/50 border border-slate-700 rounded-lg px-4 py-2 text-sm text-slate-200 placeholder:text-slate-500 focus:outline-none focus:ring-2 focus:ring-cyan-500/50 focus:border-cyan-500/50"
- />
-
+
+
+ {/* Filters */}
+
+
+
+
+ setQ(e.target.value)}
+ className="w-full bg-slate-800/50 border border-slate-700 rounded-lg pl-10 pr-4 py-2 text-sm text-slate-200 placeholder:text-slate-500 focus:outline-none focus:ring-2 focus:ring-cyan-500/50 focus:border-cyan-500/50"
+ />
+
+
+
+
+
@@ -76,18 +89,28 @@ export default function MicrodaoListPage() {
- {/* Title + District */}
+ {/* Title + Badges */}
-
-
- {m.name}
-
+
+
+
+ {m.name}
+
+ {/* Platform Badge */}
+ {m.is_platform && (
+
+ Platform
+
+ )}
+
{m.description && (
{m.description}
)}
+
+ {/* District Badge */}
{m.district && (
+ {/* Orchestrator */}
+ {m.orchestrator_agent_name && (
+
+
+ Orchestrator: {m.orchestrator_agent_name}
+
+ )}
+
{/* Stats */}
-
-
{m.agents_count} агентів
+
+
{m.member_count || m.agents_count} агентів
-
+
{m.channels_count} каналів
- {/* Status indicator */}
-
-
-
- {m.is_active ? "Active" : "Inactive"}
-
+ {/* Footer */}
+
+
+ {/* Status */}
+
+
+ {m.is_active ? "Active" : "Inactive"}
+
+
+
+ {/* Public/Private */}
+
+ {m.is_public ? (
+ <>
+
+ Public
+ >
+ ) : (
+ <>
+
+ Private
+ >
+ )}
+
@@ -131,4 +176,3 @@ export default function MicrodaoListPage() {
);
}
-
diff --git a/apps/web/src/hooks/useMicrodao.ts b/apps/web/src/hooks/useMicrodao.ts
index 6517ce5d..a1e2e2f5 100644
--- a/apps/web/src/hooks/useMicrodao.ts
+++ b/apps/web/src/hooks/useMicrodao.ts
@@ -1,7 +1,7 @@
'use client';
import { useState, useEffect, useCallback } from 'react';
-import type { MicrodaoSummary, MicrodaoDetail } from '@/lib/microdao';
+import type { MicrodaoSummary, MicrodaoDetail } from '@/lib/types/microdao';
interface UseMicrodaoListOptions {
district?: string;
diff --git a/apps/web/src/lib/types/agents.ts b/apps/web/src/lib/types/agents.ts
index abd4c171..dd1df585 100644
--- a/apps/web/src/lib/types/agents.ts
+++ b/apps/web/src/lib/types/agents.ts
@@ -1,14 +1,44 @@
-import { HomeNode } from './citizens';
+/**
+ * Unified Agent Types for DAARION MVP
+ * Aligned with backend models from TASK 028
+ */
-export type VisibilityScope = 'city' | 'microdao' | 'owner_only';
+// =============================================================================
+// Core Types
+// =============================================================================
+
+export type VisibilityScope = 'global' | 'microdao' | 'private';
+export type AgentStatus = 'online' | 'offline' | 'unknown';
+
+// =============================================================================
+// Home Node
+// =============================================================================
+
+export interface HomeNode {
+ id: string;
+ name?: string | null;
+ hostname?: string | null;
+ roles: string[];
+ environment?: string | null;
+}
+
+// =============================================================================
+// MicroDAO Badge (for agent's microDAO list)
+// =============================================================================
export interface MicrodaoBadge {
id: string;
name: string;
slug?: string | null;
role?: string | null;
+ is_public: boolean;
+ is_platform: boolean;
}
+// =============================================================================
+// Agent MicroDAO Membership (detailed)
+// =============================================================================
+
export interface AgentMicrodaoMembership {
microdao_id: string;
microdao_slug: string;
@@ -17,26 +47,31 @@ export interface AgentMicrodaoMembership {
is_core: boolean;
}
+// =============================================================================
+// Agent Summary (unified for Agent Console & internal use)
+// =============================================================================
+
export interface AgentSummary {
id: string;
- slug?: string | null;
+ slug: string;
display_name: string;
title?: string | null;
tagline?: string | null;
kind: string;
avatar_url?: string | null;
- status: string;
+ status: AgentStatus;
// Node info
- node_id?: string | null;
+ node_id: string;
node_label?: string | null;
home_node?: HomeNode | null;
- // Visibility
+ // Visibility & roles
visibility_scope: VisibilityScope;
is_listed_in_directory: boolean;
is_system: boolean;
is_public: boolean;
+ is_orchestrator: boolean;
// MicroDAO
primary_microdao_id?: string | null;
@@ -50,59 +85,97 @@ export interface AgentSummary {
public_skills: string[];
}
-export interface AgentListResponse {
- items: AgentSummary[];
- total: number;
+// =============================================================================
+// Agent Dashboard (full profile for Agent Console)
+// =============================================================================
+
+export interface SystemPrompts {
+ core?: {
+ content: string;
+ version?: number;
+ created_at?: string;
+ note?: string;
+ } | null;
+ safety?: {
+ content: string;
+ version?: number;
+ created_at?: string;
+ note?: string;
+ } | null;
+ governance?: {
+ content: string;
+ version?: number;
+ created_at?: string;
+ note?: string;
+ } | null;
+ tools?: {
+ content: string;
+ version?: number;
+ created_at?: string;
+ note?: string;
+ } | null;
}
-export interface AgentDashboard {
- id: string;
- slug?: string | null;
- display_name: string;
- kind: string;
- avatar_url?: string | null;
- status: string;
-
- // Visibility
- visibility_scope: VisibilityScope;
- is_listed_in_directory: boolean;
- is_system: boolean;
- is_public: boolean;
-
- // Profile
- public_slug?: string | null;
- public_title?: string | null;
- public_tagline?: string | null;
- public_skills: string[];
- district?: string | null;
-
- // Node
- node_id?: string | null;
- node_label?: string | null;
- home_node?: HomeNode | null;
-
- // MicroDAO
- primary_microdao_id?: string | null;
- primary_microdao_name?: string | null;
- primary_microdao_slug?: string | null;
- microdaos: MicrodaoBadge[];
- microdao_memberships: AgentMicrodaoMembership[];
-
+export interface ModelBindings {
+ primary_model?: string | null;
+ supported_kinds?: string[];
+}
+
+export interface UsageStats {
+ tokens_total_24h?: number;
+ calls_total_24h?: number;
+}
+
+export interface AgentDashboard extends AgentSummary {
// System prompts
- system_prompts?: {
- core?: string;
- safety?: string;
- governance?: string;
- tools?: string;
- };
+ system_prompts?: SystemPrompts;
- // Capabilities
+ // Capabilities & model
capabilities: string[];
model?: string | null;
role?: string | null;
+
+ // Future: model bindings and usage stats
+ model_bindings?: ModelBindings | null;
+ usage_stats?: UsageStats | null;
+}
+
+// =============================================================================
+// API Response Types
+// =============================================================================
+
+export interface AgentListResponse {
+ items: AgentSummary[];
+ total: number;
}
export interface AgentVisibilityPayload {
visibility_scope: VisibilityScope;
is_listed_in_directory: boolean;
}
+
+// =============================================================================
+// Helpers
+// =============================================================================
+
+/**
+ * Get node badge label (НОДА1 / НОДА2)
+ */
+export function getNodeBadgeLabel(nodeId?: string | null): string {
+ if (!nodeId) return 'Невідома нода';
+ if (nodeId.includes('node-1') || nodeId.includes('hetzner')) return 'НОДА1';
+ if (nodeId.includes('node-2') || nodeId.includes('macbook')) return 'НОДА2';
+ return nodeId;
+}
+
+/**
+ * Get visibility scope label
+ */
+export function getVisibilityScopeLabel(scope: VisibilityScope): string {
+ switch (scope) {
+ case 'global': return 'Публічний';
+ case 'microdao': return 'Тільки MicroDAO';
+ case 'private': return 'Приватний';
+ default: return scope;
+ }
+}
diff --git a/apps/web/src/lib/types/citizens.ts b/apps/web/src/lib/types/citizens.ts
index 4970c2f2..38b5a82c 100644
--- a/apps/web/src/lib/types/citizens.ts
+++ b/apps/web/src/lib/types/citizens.ts
@@ -1,10 +1,16 @@
-export interface HomeNode {
- id?: string | null;
- name?: string | null;
- hostname?: string | null;
- roles: string[];
- environment?: string | null;
-}
+/**
+ * Public Citizens Types for DAARION MVP
+ * Citizens are public-facing agents (is_public = true)
+ */
+
+import { HomeNode, AgentStatus } from './agents';
+
+// Re-export HomeNode for backward compatibility
+export { HomeNode };
+
+// =============================================================================
+// Public Citizen Summary (for /citizens list)
+// =============================================================================
export interface PublicCitizenSummary {
slug: string;
@@ -16,11 +22,22 @@ export interface PublicCitizenSummary {
district?: string | null;
primary_room_slug?: string | null;
public_skills: string[];
- online_status?: "online" | "offline" | "unknown" | string;
- status?: string | null;
+ online_status?: AgentStatus;
+ status?: string | null; // backward compatibility
home_node?: HomeNode | null;
+
+ // MicroDAO info (primary only for public display)
+ microdao?: {
+ slug: string;
+ name: string;
+ district?: string | null;
+ } | null;
}
+// =============================================================================
+// City Presence
+// =============================================================================
+
export interface CityPresenceRoom {
room_id?: string | null;
slug?: string | null;
@@ -32,6 +49,10 @@ export interface CityPresence {
rooms: CityPresenceRoom[];
}
+// =============================================================================
+// Public Citizen Profile (for /citizens/[slug])
+// =============================================================================
+
export interface PublicCitizenProfile {
slug: string;
display_name: string;
@@ -43,19 +64,33 @@ export interface PublicCitizenProfile {
status?: string | null;
node_id?: string | null;
public_skills: string[];
+
+ // City presence
city_presence?: CityPresence;
+
+ // Public data blocks
dais_public: Record
;
interaction: Record;
metrics_public: Record;
+
+ // Admin link (only for architects/admins)
admin_panel_url?: string | null;
+
+ // MicroDAO info
microdao?: {
slug: string;
name: string;
district?: string | null;
} | null;
+
+ // Home node (minimal for public display)
home_node?: HomeNode | null;
}
+// =============================================================================
+// Citizen Interaction
+// =============================================================================
+
export interface CitizenInteractionInfo {
slug: string;
display_name: string;
@@ -73,5 +108,3 @@ export interface CitizenAskResponse {
agent_display_name: string;
agent_id: string;
}
-
-
diff --git a/apps/web/src/lib/types/index.ts b/apps/web/src/lib/types/index.ts
new file mode 100644
index 00000000..64e4ca6f
--- /dev/null
+++ b/apps/web/src/lib/types/index.ts
@@ -0,0 +1,16 @@
+/**
+ * DAARION MVP Types - Central Export
+ */
+
+// Agent types
+export * from './agents';
+
+// Citizen types (public layer)
+export * from './citizens';
+
+// MicroDAO types
+export * from './microdao';
+
+// Node types
+export * from './nodes';
+
diff --git a/apps/web/src/lib/types/microdao.ts b/apps/web/src/lib/types/microdao.ts
new file mode 100644
index 00000000..00d0c22f
--- /dev/null
+++ b/apps/web/src/lib/types/microdao.ts
@@ -0,0 +1,128 @@
+/**
+ * MicroDAO Types for DAARION MVP
+ * Aligned with backend models from TASK 028
+ */
+
+// =============================================================================
+// MicroDAO Summary (for /microdao list)
+// =============================================================================
+
+export interface MicrodaoSummary {
+ id: string;
+ slug: string;
+ name: string;
+ description?: string | null;
+ district?: string | null;
+
+ // Visibility & type
+ is_public: boolean;
+ is_platform: boolean;
+ is_active: boolean;
+
+ // Orchestrator
+ orchestrator_agent_id?: string | null;
+ orchestrator_agent_name?: string | null;
+
+ // Hierarchy
+ parent_microdao_id?: string | null;
+ parent_microdao_slug?: string | null;
+
+ // Stats
+ logo_url?: string | null;
+ member_count: number;
+ agents_count: number; // backward compatibility
+ room_count: number;
+ rooms_count: number; // backward compatibility
+ channels_count: number;
+}
+
+// =============================================================================
+// MicroDAO Agent View (agent within MicroDAO)
+// =============================================================================
+
+export interface MicrodaoAgentView {
+ agent_id: string;
+ display_name: string;
+ role?: string | null;
+ is_core: boolean;
+}
+
+// =============================================================================
+// MicroDAO Channel View
+// =============================================================================
+
+export interface MicrodaoChannelView {
+ kind: string; // 'matrix' | 'telegram' | 'city_room' | 'crew'
+ ref_id: string;
+ display_name?: string | null;
+ is_primary: boolean;
+}
+
+// =============================================================================
+// MicroDAO Citizen View (public citizen within MicroDAO)
+// =============================================================================
+
+export interface MicrodaoCitizenView {
+ slug: string;
+ display_name: string;
+ public_title?: string | null;
+ public_tagline?: string | null;
+ avatar_url?: string | null;
+ district?: string | null;
+ primary_room_slug?: string | null;
+}
+
+// =============================================================================
+// MicroDAO Detail (for /microdao/[slug])
+// =============================================================================
+
+export interface MicrodaoDetail {
+ id: string;
+ slug: string;
+ name: string;
+ description?: string | null;
+ district?: string | null;
+
+ // Visibility & type
+ is_public: boolean;
+ is_platform: boolean;
+ is_active: boolean;
+
+ // Orchestrator
+ orchestrator_agent_id?: string | null;
+ orchestrator_display_name?: string | null;
+
+ // Hierarchy
+ parent_microdao_id?: string | null;
+ parent_microdao_slug?: string | null;
+ child_microdaos: MicrodaoSummary[];
+
+ // Content
+ logo_url?: string | null;
+ agents: MicrodaoAgentView[];
+ channels: MicrodaoChannelView[];
+ public_citizens: MicrodaoCitizenView[];
+}
+
+// =============================================================================
+// MicroDAO Option (for selectors)
+// =============================================================================
+
+export interface MicrodaoOption {
+ id: string;
+ slug: string;
+ name: string;
+}
+
+// =============================================================================
+// Agent MicroDAO Membership (for Agent Dashboard)
+// =============================================================================
+
+export interface AgentMicrodaoMembership {
+ microdao_id: string;
+ microdao_slug: string;
+ microdao_name: string;
+ role?: string;
+ is_core: boolean;
+}
+
diff --git a/scripts/cleanup/delete_mock_citizens.sql b/scripts/cleanup/delete_mock_citizens.sql
new file mode 100644
index 00000000..06b13d8c
--- /dev/null
+++ b/scripts/cleanup/delete_mock_citizens.sql
@@ -0,0 +1,40 @@
+-- Delete Mock Citizens Script
+-- This script marks mock/test citizens (agents) as deleted
+-- Run with caution in production!
+
+-- Preview: Show agents that would be affected
+-- (agents without node_id or without primary_microdao_id, and not already marked as test)
+SELECT id, display_name, kind, node_id, primary_microdao_id, is_public
+FROM agents
+WHERE (
+ node_id IS NULL
+ OR primary_microdao_id IS NULL
+)
+AND COALESCE(is_test, false) = false
+AND COALESCE(is_archived, false) = false
+AND deleted_at IS NULL;
+
+-- Uncomment to execute soft delete:
+-- UPDATE agents
+-- SET
+-- is_test = true,
+-- deleted_at = NOW()
+-- WHERE (
+-- node_id IS NULL
+-- OR primary_microdao_id IS NULL
+-- )
+-- AND COALESCE(is_test, false) = false
+-- AND COALESCE(is_archived, false) = false
+-- AND deleted_at IS NULL;
+
+-- Verify: Count remaining active agents
+SELECT
+ COUNT(*) as total_active_agents,
+ COUNT(*) FILTER (WHERE is_public = true) as public_citizens,
+ COUNT(*) FILTER (WHERE node_id IS NOT NULL) as agents_with_node,
+ COUNT(*) FILTER (WHERE primary_microdao_id IS NOT NULL) as agents_with_microdao
+FROM agents
+WHERE COALESCE(is_test, false) = false
+AND COALESCE(is_archived, false) = false
+AND deleted_at IS NULL;
+
diff --git a/scripts/cleanup/delete_mock_microdao.sql b/scripts/cleanup/delete_mock_microdao.sql
new file mode 100644
index 00000000..94780ab7
--- /dev/null
+++ b/scripts/cleanup/delete_mock_microdao.sql
@@ -0,0 +1,47 @@
+-- Delete Mock MicroDAO Script
+-- This script marks mock/test microDAOs as deleted
+-- Run with caution in production!
+
+-- Preview: Show microDAOs that would be affected
+-- (microDAOs with 0 agents or without orchestrator)
+SELECT
+ m.id,
+ m.slug,
+ m.name,
+ m.orchestrator_agent_id,
+ COUNT(ma.agent_id) as agent_count
+FROM microdaos m
+LEFT JOIN microdao_agents ma ON ma.microdao_id = m.id
+WHERE COALESCE(m.is_test, false) = false
+AND COALESCE(m.is_archived, false) = false
+AND m.deleted_at IS NULL
+GROUP BY m.id
+HAVING COUNT(ma.agent_id) = 0 OR m.orchestrator_agent_id IS NULL;
+
+-- Uncomment to execute soft delete:
+-- UPDATE microdaos
+-- SET
+-- is_test = true,
+-- deleted_at = NOW()
+-- WHERE id IN (
+-- SELECT m.id
+-- FROM microdaos m
+-- LEFT JOIN microdao_agents ma ON ma.microdao_id = m.id
+-- WHERE COALESCE(m.is_test, false) = false
+-- AND COALESCE(m.is_archived, false) = false
+-- AND m.deleted_at IS NULL
+-- GROUP BY m.id
+-- HAVING COUNT(ma.agent_id) = 0 OR m.orchestrator_agent_id IS NULL
+-- );
+
+-- Verify: Count remaining active microDAOs
+SELECT
+ COUNT(*) as total_active_microdaos,
+ COUNT(*) FILTER (WHERE is_public = true) as public_microdaos,
+ COUNT(*) FILTER (WHERE is_platform = true) as platforms,
+ COUNT(*) FILTER (WHERE orchestrator_agent_id IS NOT NULL) as with_orchestrator
+FROM microdaos
+WHERE COALESCE(is_test, false) = false
+AND COALESCE(is_archived, false) = false
+AND deleted_at IS NULL;
+