Modular, crash-resilient runtime for autonomous LLM agents and Telegram userbots written in Go 1.22+ and C++20.
Russian version | English version
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.
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.
- Go 1.22+.
- CMake 3.20+ and a C++20 compiler (GCC, Clang, or MinGW).
- TDLib binaries (
tdjson.dllon Windows orlibtdjson.soon Linux) insidedata/telegram/.
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 websearchAlternatively, you can unpack releases/modules.zip manually:
# Linux / macOS
unzip releases/modules.zip
# Windows (PowerShell)
Expand-Archive -Path releases/modules.zip -DestinationPath . -ForceCopy the environment template and provide your API keys:
cp .env.example .envKey environment variables:
OPENROUTER_API_KEY=sk-or-v1-...
SPERMACORE_TELEGRAM_API_ID=12345678
SPERMACORE_TELEGRAM_API_HASH=abcdef0123456789...
SPERMACORE_DB_KEY=your_secure_db_keyRun directly through Go (uncompiled plugins in config.toml are automatically built by the Go runtime via CMake on first boot):
go run ./coreOr build a production executable:
go build -o releases/spermacore.exe ./core
./releases/spermacore.exeAccess the local management WebUI at http://localhost:8080.
| 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.
- 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.1and uses a generated one-time session token ifauth_tokenis left empty.
Distributed under the PolyForm Noncommercial License 1.0.0. See LICENSE or visit polyformproject.org for terms.