Skip to content

About

Modular runtime for personal LLM bots and Telegram userbots built with Go and C++20 dynamic plugins (ABI 1.7.1). Features HNSW vector memory, TDLib transport, WebUI dashboard and autonomous reasoning loops. Note: currently in active beta.

Topics

Resources

Contributing

Stars

2 stars

Watchers

0 watching

Forks

Repository files navigation

SpermaCore

Go 1.22+ C++20 ABI v1.7.1 TDLib SQLCipher PolyForm License

Modular, crash-resilient runtime for autonomous LLM agents and Telegram userbots written in Go 1.22+ and C++20.

Russian version | English version


Overview

SpermaCore is an agent engine designed around strict separation of concerns. Instead of stuffing prompt handling, memory indexes, and client protocols into an unmaintainable monolith, the runtime divides responsibilities between two layers:

  • Core Runtime (Go 1.22+): Non-blocking event loop, worker goroutines pool, multi-provider LLM routing (OpenRouter, Groq, Ollama, Gemini Vision), SQLCipher-encrypted SQLite store, and a local WebUI dashboard on port 8080.
  • Native Modules (C++20 Shared Libraries): High-performance modules compiled against a stable C ABI (include/plugin_api.h). Includes TDLib transport, long-term HNSW vector memory (embedsc), proactive background reflection loop (agentloop), media/sticker vision, message grouping, and web search.

If a C++ module crashes or fails to load, the Go core catches the fault, marks the worker degraded, and continues serving requests in safe mode without dropping client sessions.


Architecture & ABI (1.7.1)

spermacore/
├── core/              # Go runtime: dispatcher, LLM routing, SQLCipher storage, WebUI
├── include/           # Stable C ABI headers (plugin_api.h)
├── modules/           # Native C++20 dynamic plugins
├── landing/           # Project dashboard & documentation landing page
├── releases/          # Precompiled binaries and modules.zip package
├── config.toml        # Application and provider configuration
├── .env.example       # Secrets and credential templates
└── CMakeLists.txt     # Root build script for C++ plugins

The core talks to modules via standard C function pointers (plugin_get_api()). Each plugin exports lifecycle hooks (init, start, stop, destroy) and optional event sinks, ensuring zero memory copies across language boundaries.


Quickstart

Prerequisites

  • Go 1.22+.
  • CMake 3.20+ and a C++20 compiler (GCC, Clang, or MinGW).
  • TDLib binaries (tdjson.dll on Windows or libtdjson.so on Linux) inside data/telegram/.

1. Extract & Manage Modules

The recommended way to bootstrap, verify, and manage modules is using scpkg (SpermaCore Package Manager):

# Bootstrap official modules and compile
scpkg bootstrap

# Or install individual modules from the registry
scpkg install telegram
scpkg install websearch

Alternatively, you can unpack releases/modules.zip manually:

# Linux / macOS
unzip releases/modules.zip

# Windows (PowerShell)
Expand-Archive -Path releases/modules.zip -DestinationPath . -Force

2. Configure Environment

Copy the environment template and provide your API keys:

cp .env.example .env

Key environment variables:

OPENROUTER_API_KEY=sk-or-v1-...
SPERMACORE_TELEGRAM_API_ID=12345678
SPERMACORE_TELEGRAM_API_HASH=abcdef0123456789...
SPERMACORE_DB_KEY=your_secure_db_key

3. Build & Run

Run directly through Go (uncompiled plugins in config.toml are automatically built by the Go runtime via CMake on first boot):

go run ./core

Or build a production executable:

go build -o releases/spermacore.exe ./core
./releases/spermacore.exe

Access the local management WebUI at http://localhost:8080.


Active Modules

Module Language Role
telegram C++20 Full TDLib userbot client (QR code auth, typing simulation, voice/photo transport)
embedsc C++20 In-memory HNSW vector index for semantic retrieval and long-term memory
agentloop C++20 Proactive reflection loop for autonomous task execution
media C++20 Sticker, emoji, and image preprocessing pipeline
grouper C++20 Inbound message grouping and anti-flood debouncing
moderation C++20 User rate-limiting, allowlist, and blocklist policies
websearch C++20 Low-overhead search engine scraper for live information retrieval
dashboard C++20 Module telemetry and real-time health metrics streaming to WebUI

To enable or disable modules, adjust the load array under [plugins] in config.toml.


Security

  • Secrets and tokens are loaded strictly from environment variables or .env.
  • Local SQLite databases are encrypted at rest with SQLCipher using SPERMACORE_DB_KEY.
  • By default, the WebUI binds to 127.0.0.1 and uses a generated one-time session token if auth_token is left empty.

License

Distributed under the PolyForm Noncommercial License 1.0.0. See LICENSE or visit polyformproject.org for terms.

About

Modular runtime for personal LLM bots and Telegram userbots built with Go and C++20 dynamic plugins (ABI 1.7.1). Features HNSW vector memory, TDLib transport, WebUI dashboard and autonomous reasoning loops. Note: currently in active beta.

Topics

Resources

Contributing

Stars

2 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages