systemprompt-loader
File loading infrastructure for systemprompt.io - separates I/O from shared models.
Overview
Part of the Infra layer in the systemprompt.io architecture. Infrastructure · Self-Hosted Deployment
This crate provides pure I/O operations for loading configuration files, profiles, secrets, extensions, and module definitions without any domain logic.
Architecture
The loader crate sits in the infrastructure layer and depends only on systemprompt-models (shared layer). It separates file I/O concerns from business logic, enabling:
- Testable file operations with clear boundaries
- Reusable loaders across different entry points (API, CLI)
- Consistent configuration parsing and validation
File Structure
src/
├── lib.rs # Public API exports
├── config_loader.rs # Services configuration loader with include merging
├── config_writer.rs # Agent configuration file writer
├── extension_loader.rs # Extension manifest discovery and loading
├── extension_registry.rs # Runtime extension binary registry
├── module_loader.rs # Module definition aggregator
├── profile_loader.rs # Profile YAML loader with validation
└── modules/
└── mod.rs # Module collection aggregator
Module Overview
Core Loaders
| Module | Purpose |
|---|---|
ProfileLoader |
Loads and validates profile YAML files from the profiles directory |
ConfigLoader |
Loads services configuration, merges includes, and validates strict schema |
ModuleLoader |
Aggregates all module definitions for database schema management |
Extension Support
| Module | Purpose |
|---|---|
ExtensionLoader |
Discovers extensions by scanning for manifest.yaml files |
ExtensionRegistry |
Runtime registry mapping binary names to extension metadata |
ConfigWriter |
Creates, updates, and deletes agent configuration files |
Module Definitions
The modules/ directory contains definitions for each systemprompt.io module. Each definition specifies:
- Module metadata (name, version, description)
- Database schemas with required columns
- Seed data for initial setup
- API configuration
- Module dependencies and load order (weight)
Usage
use ;
let config = load?;
let loader = from_env?;
let profile = load_and_validate?;
let modules = all;
let extensions = discover;
Dependencies
anyhow- Error handlingthiserror- Error type definitionsserde/serde_yaml/serde_json- Serializationtokio- Async runtimetracing- Loggingsystemprompt-models- Shared model types
Installation
Add to your Cargo.toml:
[]
= "0.0.1"
License
Business Source License 1.1 - See LICENSE for details.