Documentation
Technical documentation for systemprompt.io - an embedded Rust library for building production AI infrastructure
On this page
systemprompt.io is an embedded Rust library for building production AI infrastructure. Clone the template, wrap your logic around it, and the CLI handles the rest—local development, cloud deployment, and everything in between.
Quick start:
# Clone the template
gh repo create my-ai --template systempromptio/systemprompt-template --clone
# Build
cargo build --release
# Run
just start
The same CLI that works locally also works in production. Your AI clients connect via MCP, your agents coordinate via A2A, and everything is authenticated and auditable out of the box.
Documentation Sections
| Section | Purpose | Key Code |
|---|---|---|
| Getting Started | Install, first agent, playbooks | src/main.rs, src/lib.rs |
| Config | Profiles, database, secrets | .systemprompt/profiles/*/profile.yaml |
| Services | Agents, MCP, AI providers | services/, extensions/web/src/config_loader.rs |
| Extensions | Custom Rust code | extensions/web/src/extension.rs |
| Cloud | Deploy, sync, domains | extensions/mcp/systemprompt/src/cli.rs |
Getting Started
The CLI binary is the primary interface. On startup, src/main.rs:6 calls __force_extension_link() which references each extension's PREFIX constant - this prevents the linker from stripping extensions during LTO optimization. The cli::run() function then initializes the library with all registered extensions.
- Installation - Install via
cargo install systempromptor build from source - Licensing - BSL-1.1 license, pricing model, and what you can build
- Playbooks - Machine-readable instruction sets that guide both users and AI agents
Code:
src/main.rs:6-8- CLI entry point with extension linkingsrc/lib.rs:19-20-__force_extension_link()prevents LTO stripping
Playbooks:
guide_start- Required first read, master indexcli_session- Authentication and session setup
Config
The .systemprompt/ directory contains deployment and environment configuration, kept separate from runtime services. Profiles define database connections, server settings, JWT secrets, and cloud credentials. The ProfileBootstrap::init() function in the MCP server entry point loads the active profile, followed by SecretsBootstrap::init() for credentials and Config::init() for service configuration.
- Config Overview - Directory structure and configuration flow
- Profiles - Environment-specific settings (local, staging, production)
- Database - PostgreSQL setup options (cloud, local, Docker, managed)
- Secrets - API keys and credentials (gitignored)
Code:
.systemprompt/profiles/local/profile.yaml:1-77- Profile structure: paths, database, server, security, cloud sectionsextensions/mcp/systemprompt/src/main.rs:14-16- Bootstrap sequence:ProfileBootstrap::init(),SecretsBootstrap::init(),Config::init()
Playbooks:
cli_config- Configuration management commandscli_session- Profile switching and authentication
Services
The services/ directory contains YAML configuration for all runtime components. No Rust code lives here - only configuration files and Markdown content. The config_loader.rs module loads navigation from services/web/config/navigation.yaml, homepage sections from homepage.yaml, and feature pages from features/*.yaml. Services are hot-reloadable: edit YAML, sync to database, changes take effect without restart.
- Services Overview - All service types and directory structure
- Agents - A2A protocol cards and skill assignments
- MCP - Tool server hosting with OAuth scopes
- AI - Provider configuration (Anthropic, OpenAI, Gemini)
- Content - Blog posts, documentation, content indexing
- Scheduler - Background jobs with cron scheduling
- Web - Branding, navigation, theme configuration
Code:
extensions/web/src/config_loader.rs:9-47-load_navigation_config(),load_homepage_config(),load_features_config()services/config/config.yaml:1-20- Master config with includes for agents, MCP, validationservices/ai/config.yaml:1-32- AI provider settings, default models, MCP auto-discoveryextensions/web/src/jobs/ingestion.rs:10-98-ContentIngestionJobparses Markdown and stores in database
Playbooks:
cli_services- Service lifecycle managementcli_agents- Agent configuration and messagingcli_plugins- MCP server registration
Extensions
Extensions add custom functionality via Rust code in extensions/. The library uses the inventory crate for compile-time registration - call register_extension!(MyExtension) and your extension is automatically discovered at startup. The Extension trait defines hooks for page data providers, component renderers, database schemas, API routes, background jobs, and required assets.
- Extensions Overview - Extension types and discovery mechanism
- Rust Extensions - API routes, database schemas, background jobs
- Web Extensions - Page data providers, static generation, assets
- CLI Extensions - Custom CLI commands with clap integration
- MCP Extensions - Tool servers implementing the MCP protocol
- Background Jobs - Scheduled tasks and async processing
Code:
extensions/web/src/extension.rs:39-280- Full extension implementation:- Line 90:
impl Extension for WebExtension - Line 99:
page_data_providers()- Navigation and homepage data - Line 138:
schemas()- Database migrations - Line 155:
router()- API routes under/api/v1/ - Line 165:
jobs()- Scheduler jobs like content ingestion - Line 185:
required_assets()- CSS/JS files to publish - Line 280:
register_extension!(WebExtension)- Inventory registration
- Line 90:
src/lib.rs:19-20-__force_extension_link()prevents LTO from stripping extensionsextensions/mcp/systemprompt/manifest.yaml:1-9- MCP server manifest with binary name and port
Playbooks:
build_extension-checklist- Extension development checklistbuild_mcp-checklist- MCP server developmentbuild_architecture- System architecture and boundaries
Cloud
systemprompt.io Cloud provides managed infrastructure for production deployments. The cloud configuration in profile.yaml defines credentials_path and tenants_path for authentication. The cli.rs module executes CLI commands with the auth token injected via environment variables (SYSTEMPROMPT_AUTH_TOKEN), enabling secure cloud operations from MCP servers.
- Configuration Overview - Features, free vs paid, architecture diagram
- Deployment - One-command deploy with CI/CD integration
- Sync - Push/pull configuration between local and cloud
- Domains - Custom domains with automatic TLS via Let's Encrypt
- Secrets - Cloud credential management and rotation
Code:
.systemprompt/profiles/local/profile.yaml:66-73- Cloud config section:credentials_path,tenants_path,tenant_idextensions/mcp/systemprompt/src/cli.rs:28-47-execute()runs CLI with auth token, JSON output, non-interactive mode.systemprompt/credentials.json- Cloud authentication credentials (gitignored).systemprompt/tenants.json- Tenant registry with database URLs and hostnames
Playbooks:
cli_cloud- Cloud setup, tenants, profilescli_deploy- Deployment workflowcli_sync- Configuration synchronization