Skip to content

A cross-platform desktop application built in Rust that enables digital artists and AI image generation practitioners to create, manage, and compose prompts for fictional character generation with consistency and precision.

License

Notifications You must be signed in to change notification settings

j-about/Persona-Prompt-Manager

Repository files navigation

Persona Prompt Manager

License Version Platforms Node Rust Build

A cross-platform desktop application built in Rust that enables digital artists and AI image generation practitioners to create, manage, and compose prompts for fictional character generation with consistency and precision.


Table of Contents


Features

  • Persona Management — Create and organize fictional character profiles with custom tags for easy categorization and retrieval.

  • Token Organization — Structure prompt elements hierarchically across 7 color-coded granularity levels (Style, General, Hair, Face, Upper Body, Midsection, Lower Body) with positive/negative polarity support and drag-and-drop reordering.

  • Prompt Composition — Assemble complete prompts by selectively combining tokens from different granularity levels, with support for ad-hoc additions and weight modifiers.

  • Multi-Model Tokenization — Accurate CLIP and T5 token counting for popular image generation models including Stable Diffusion XL, PixArt, Hunyuan, and DeepFloyd IF.

  • AI-Powered Generation — Generate contextual token suggestions and complete persona profiles using multiple AI providers: OpenAI, Anthropic, Google, xAI, or Ollama (local). Includes physical criteria forms for detailed character specification.

  • Secure API Key Storage — API keys are stored securely using OS-native credential storage (macOS Keychain, Windows Credential Manager, Linux Secret Service).

  • Import/Export — Backup and restore your entire database as a SQLite file for migration or safekeeping, with schema version validation to ensure compatibility.

  • Cross-Platform — Native desktop application for Windows, macOS, and Linux built with Tauri.


Getting Started

Prerequisites

  • Node.js >= 24.0.0

  • Rust (latest stable via rustup)

  • Platform-specific dependencies:

    Linux (Debian/Ubuntu)
    sudo apt update
    sudo apt install -y \
      libwebkit2gtk-4.1-dev \
      libayatana-appindicator3-dev \
      librsvg2-dev \
      patchelf
    Linux (Fedora)
    sudo dnf install -y \
      webkit2gtk4.1-devel \
      libappindicator-gtk3-devel \
      librsvg2-devel
    Linux (Arch)
    sudo pacman -S --needed \
      webkit2gtk-4.1 \
      libayatana-appindicator \
      librsvg
    macOS

    Install Xcode Command Line Tools:

    xcode-select --install
    Windows

    Install Visual Studio Build Tools with the "Desktop development with C++" workload.

Installation

# Clone the repository
git clone https://github.com/j-about/Persona-Prompt-Manager.git
cd Persona-Prompt-Manager

# Install frontend dependencies
npm install

# Run in development mode
npm run tauri dev

# Build for production
npm run tauri build

Production builds are output to src-tauri/target/release/bundle/.


Development

Available Scripts

Command Description
npm run dev Start Vite development server (frontend only)
npm run build Build frontend for production
npm run check Type-check Svelte components
npm run check:watch Type-check in watch mode
npm run lint Run ESLint
npm run lint:fix Auto-fix ESLint issues
npm run format Format code with Prettier
npm run format:check Check Prettier formatting
npm run validate Run all checks (format:check + lint + check)
npm run tauri dev Start full Tauri development application
npm run tauri build Build production desktop application

Project Structure

Persona-Prompt-Manager/
├── src/                        # SvelteKit frontend
│   ├── app.css                 # Global styles (Tailwind)
│   ├── app.html                # HTML template
│   ├── lib/
│   │   ├── components/         # Reusable UI components
│   │   │   ├── persona/        # Persona management (cards, forms, filters)
│   │   │   │   ├── AiPersonaForm.svelte
│   │   │   │   ├── PersonaCard.svelte
│   │   │   │   ├── PersonaFilterBar.svelte
│   │   │   │   ├── PersonaForm.svelte
│   │   │   │   ├── PersonaList.svelte
│   │   │   │   └── PhysicalCriteriaForm.svelte
│   │   │   ├── token/          # Token management (cards, modals, drag-and-drop)
│   │   │   │   ├── TokenCard.svelte
│   │   │   │   ├── TokenEditModal.svelte
│   │   │   │   ├── TokenInput.svelte
│   │   │   │   ├── TokenLegend.svelte
│   │   │   │   └── TokenManager.svelte
│   │   │   └── ui/             # Generic UI primitives
│   │   │       ├── ApiKeyModal.svelte
│   │   │       ├── Badge.svelte
│   │   │       ├── Button.svelte
│   │   │       ├── Card.svelte
│   │   │       ├── ConfirmDialog.svelte
│   │   │       ├── DonationPopup.svelte
│   │   │       ├── Modal.svelte
│   │   │       ├── MultiSelect.svelte
│   │   │       ├── Spinner.svelte
│   │   │       ├── Tag.svelte
│   │   │       ├── Toast.svelte
│   │   │       └── TokenCountBadge.svelte
│   │   ├── services/           # Tauri IPC service layer
│   │   │   ├── ai.ts           # AI generation service
│   │   │   ├── config.ts       # Configuration service
│   │   │   ├── export.ts       # Import/export service
│   │   │   ├── persona.ts      # Persona CRUD service
│   │   │   ├── prompt.ts       # Prompt composition service
│   │   │   ├── settings.ts     # Settings & credentials
│   │   │   ├── tauri.ts        # Tauri IPC base handler
│   │   │   ├── token.ts        # Token CRUD service
│   │   │   └── tokenizer.ts    # Token counting service
│   │   ├── stores/             # Svelte 5 reactive stores
│   │   │   ├── config.svelte.ts    # App configuration state
│   │   │   ├── donation.svelte.ts  # Donation popup state
│   │   │   ├── persona.svelte.ts   # Persona state management
│   │   │   ├── toast.svelte.ts     # Toast notifications
│   │   │   └── token.svelte.ts     # Token state management
│   │   └── types/              # TypeScript type definitions
│   │       ├── ai.ts               # AI provider types
│   │       ├── common.ts           # Shared utilities
│   │       ├── export.ts           # Export/import types
│   │       ├── persona.ts          # Persona definitions
│   │       ├── prompt.ts           # Prompt composition types
│   │       ├── token.ts            # Token definitions
│   │       └── tokenizer.ts        # Tokenizer types
│   └── routes/                 # SvelteKit pages
│       ├── +layout.svelte      # Root layout with navigation
│       ├── +layout.ts          # SSR configuration
│       ├── +page.svelte        # Dashboard
│       ├── personas/           # Persona CRUD pages
│       │   ├── +page.svelte    # Personas list
│       │   ├── new/            # Create persona
│       │   └── [id]/           # Edit persona (dynamic route)
│       ├── compose/            # Prompt composition
│       ├── settings/           # Configuration
│       └── about/              # About page
├── src-tauri/                  # Rust backend
│   ├── src/
│   │   ├── commands/           # Tauri IPC command handlers
│   │   ├── domain/             # Business logic & entities
│   │   ├── infrastructure/     # Database, AI, keyring adapters
│   │   │   ├── ai.rs           # AI provider integrations
│   │   │   ├── database/       # SQLite repository layer
│   │   │   ├── keyring/        # OS-native credential storage
│   │   │   └── tokenizer.rs    # HuggingFace tokenizer
│   │   ├── error/              # Error handling
│   │   ├── lib.rs              # Library entry point
│   │   └── main.rs             # Application entry point
│   ├── icons/                  # Application icons
│   ├── Cargo.toml              # Rust dependencies
│   └── tauri.conf.json         # Tauri configuration
├── static/                     # Static assets
├── package.json                # Node dependencies & scripts
├── tsconfig.json               # TypeScript configuration
├── vite.config.ts              # Vite build configuration
├── svelte.config.js            # SvelteKit configuration
├── eslint.config.js            # ESLint rules
└── prettier.config.js          # Prettier formatting rules

Architecture

Tech Stack

Layer Technology
Frontend SvelteKit 2.0, Svelte 5, TypeScript 5, Tailwind CSS 4, DaisyUI 5
Backend Rust, Tauri 2, SQLite (WAL mode)
AI genai crate (OpenAI, Anthropic, Google, xAI, Ollama)
Tokenization HuggingFace Tokenizers (CLIP, T5)
Security OS-native keyring (keyring crate)

Clean Architecture

The Rust backend follows clean architecture principles with clear separation of concerns:

┌─────────────────────────────────────────────────────────────┐
│                     Frontend (Svelte)                       │
│   Routes  →  Stores  →  Services  →  Tauri IPC              │
└─────────────────────────────────────────────────────────────┘
                            │
                      Tauri Bridge
                            │
┌─────────────────────────────────────────────────────────────┐
│                      Backend (Rust)                         │
│  ┌──────────────┐  ┌──────────────┐  ┌──────────────────┐   │
│  │   Commands   │──│    Domain    │──│  Infrastructure  │   │
│  │  (IPC Layer) │  │   (Logic)    │  │  (DB, AI, Keys)  │   │
│  └──────────────┘  └──────────────┘  └──────────────────┘   │
└─────────────────────────────────────────────────────────────┘

Layers:

  • Commands — Thin IPC handlers that expose functionality to the frontend via Tauri's invoke system.
  • Domain — Core business entities (Persona, Token, Prompt) and logic, independent of external services.
  • Infrastructure — External adapters for SQLite database, AI providers, and OS keyring.

Configuration

AI Provider Setup

  1. Navigate to Settings in the application
  2. Select your preferred AI provider (OpenAI, Anthropic, Google, xAI, or Ollama)
  3. Enter your API key (stored securely in your OS keyring)
  4. Configure per-persona AI settings in the persona editor

Supported AI Providers

Provider Default Model API Key Required
OpenAI gpt-5.2 Yes
Anthropic claude-opus-4-5 Yes
Google gemini-3-pro-preview Yes
xAI grok-4-1-fast-reasoning Yes
Ollama llama3.2 No (local)

Import/Export

  • Export: Settings → Export Database → Select destination → Saves a .db SQLite file
  • Import: Settings → Import Database → Select .db file → Replaces all existing data

Note: Import validates the database schema version to ensure compatibility. Databases from newer application versions cannot be imported into older versions.


Security

This application prioritizes security through multiple layers:

  • No unsafe Rust code — Enforced via #![forbid(unsafe_code)] compiler directive.

  • OS-native credential storage — API keys are stored in platform-specific secure storage:

    • macOS: Keychain
    • Windows: Credential Manager
    • Linux: Secret Service (libsecret)
  • Content Security Policy — Strict CSP headers prevent XSS and other injection attacks.

  • Type safety — Full type checking across both TypeScript (frontend) and Rust (backend) codebases.

  • No telemetry — The application does not collect or transmit any user data.


License

This project is licensed under the MIT License — see the LICENSE file for details.


Acknowledgments


Made with Rust and Svelte

About

A cross-platform desktop application built in Rust that enables digital artists and AI image generation practitioners to create, manage, and compose prompts for fictional character generation with consistency and precision.

Resources

License

Stars

Watchers

Forks

Packages

No packages published