Skip to content

Repository files navigation

Swarm Intelligence Engine

The Swarm Intelligence Engine is a high-fidelity sociological simulation tool designed to model public opinion and societal reactions in Georgia. By leveraging custom-crafted, culturally authentic AI personas and Google's Gemini models, it simulates how different demographic cohorts react to political news, policy updates, or social events.

This is a local, self-hostable version with no payment restrictions or web3 dependencies. You only need to provide your own Google Gemini API key to run simulations and generate personas.


Key Features

  • Swarm Simulation: Select from a diverse library of pre-seeded Georgian personas (representing different ages, locations, employment statuses, and political views) and see their realistic reactions.
  • Semantic & Strategic Analysis: Generate an advanced strategic intelligence report detailing narrative clusters, demographic intersections, and sentiment analyses of the swarm's reactions.
  • Persona Generator: Describe a cohort of people (e.g., "Tech students in Kutaisi" or "Pensioners in Kakheti") and generate highly customized, culturally authentic personas dynamically to expand your library.
  • Local-First & Secure: Built using SvelteKit, Drizzle ORM, and SQLite. Your Gemini API key is stored locally in your browser cookies (or your server .env file) and sent directly to Google's API endpoints.

Getting Started

1. Prerequisites

You will need Bun installed on your machine.

2. Installation

Clone the repository and install the dependencies:

# Clone the repository
git clone https://github.com/your-username/SWARM.git
cd SWARM

# Install dependencies using Bun
bun install

3. Database Setup

The repository comes pre-packaged with a pre-seeded sqlite.db file in the root directory, which contains a rich set of initial Georgian personas.

If you ever need to recreate or reset the database schema, you can run Drizzle migrations:

bun x drizzle-kit push

4. Configure your Gemini API Key

You can configure your API key in one of two ways:

Option A: Via the Web UI (Recommended)

  1. Start the application (see below).
  2. Click the Settings (gear) icon in the top-right corner of the header.
  3. Paste your Gemini API Key (AIzaSy...) and click Save Changes.
  4. The key is securely saved in a browser cookie (gemini_api_key) and used for SvelteKit server-side API calls.

Option B: Via .env File

  1. Copy .env.example to .env:
    cp .env.example .env
  2. Open .env and paste your API key:
    GEMINI_API_KEY="your-gemini-api-key-here"

Running the Application

To run the engine in development mode:

bun run dev

Open your browser and navigate to http://localhost:5173.

Building for Production

To create a production-optimized build:

bun run build

Preview the production build locally:

bun run preview

Tech Stack

  • Framework: SvelteKit (Svelte 5)
  • Styling: Vanilla CSS with Tailwind CSS v4
  • Database: SQLite with Drizzle ORM
  • LLM Integration: Google GenAI SDK (@google/genai) using Gemini 3.1 models
  • Icons: Lucide Svelte

License

This project is open-source and free to use. Set up your API key, run it locally, and start exploring collective intelligence simulations!

About

Swarm Intelligence Engine is a high-fidelity sociological simulation tool designed to model public opinion and societal reactions

Resources

Stars

0 stars

Watchers

0 watching

Forks

Contributors

Languages