systemprompt-loader 0.12.1

File and module discovery infrastructure for systemprompt.io AI governance — manifests, schemas, and extension loading. Separates I/O from shared models in the MCP governance pipeline.
Documentation

Production infrastructure for AI agents

Website · Documentation · Guides · Core · Template · Discord


systemprompt-loader

Crates.io Docs.rs License: BSL-1.1

File and module discovery infrastructure for systemprompt.io AI governance — manifests, schemas, and extension loading. Separates I/O from shared models in the MCP governance pipeline. Provides pure I/O operations for loading configuration files, profiles, secrets, extensions, and module definitions without any domain logic.

Layer: Infra — infrastructure primitives (database, security, events, etc.) consumed by domain crates. Part of the systemprompt-core workspace.

Overview

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
src/
├── lib.rs                       # Public API exports
├── error.rs                     # ConfigLoad / ConfigWrite / ExtensionLoad / ProfileLoad error types
├── config_loader/               # Services configuration loader
│   ├── mod.rs                   # ConfigLoader entry point
│   ├── includes.rs              # Recursive `includes:` resolution with cycle detection
│   ├── merge.rs                 # Deep-merge logic for included fragments
│   └── types.rs                 # Loader-internal types
├── config_writer.rs             # Agent configuration file writer
├── extension_loader/            # Extension manifest discovery and loading
│   ├── mod.rs                   # ExtensionLoader entry point
│   ├── manifest.rs              # manifest.yaml parsing
│   └── result.rs                # ExtensionValidationResult
├── extension_registry.rs        # Runtime extension binary registry
├── module_loader.rs             # `inventory`-driven extension aggregator
├── profile_loader.rs            # Profile YAML loader with validation
└── modules/
    └── mod.rs                   # Module collection aggregator

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 Thin wrapper over the inventory-driven ExtensionRegistry; discovers compiled-in extensions and collects their schemas

Extension Support

Module Purpose
ExtensionLoader Discovers on-disk 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 Aggregation

The modules module re-exports the compile-time extension registry. ModuleLoader::discover_extensions returns every inventory-registered Extension, and ModuleLoader::collect_extension_schemas flattens their SchemaDefinitions for schema installation.

Usage

[dependencies]
systemprompt-loader = "0.12.0"

Features

Feature Default Purpose
expose-internals off Exposes test-only entry points such as ConfigLoader::load_from_content to dependent crates outside cfg(test).
use systemprompt_loader::{
    ConfigLoader, ProfileLoader,
    ExtensionLoader, ExtensionRegistry, ModuleLoader,
};

let config = ConfigLoader::load()?;

let loader = ConfigLoader::for_active_profile()?;

let profile = ProfileLoader::load_and_validate(services_path, "development")?;

let extensions = ModuleLoader::discover_extensions()?;
let schemas = ModuleLoader::collect_extension_schemas()?;

let discovered = ExtensionLoader::discover(project_root);

Dependencies

  • thiserror — typed error variants
  • serde / serde_yaml / serde_json — serialisation
  • tokio — async runtime
  • tracing — structured logging
  • systemprompt-config — profile and config primitives
  • systemprompt-extension — extension trait registry
  • systemprompt-identifiers — typed IDs
  • systemprompt-models — shared model types

License

BSL-1.1 (Business Source License). Source-available for evaluation, testing, and non-production use. Production use requires a commercial license. Each version converts to Apache 2.0 four years after publication. See LICENSE.


systemprompt.io · Documentation · Guides · Live Demo · Template · crates.io · docs.rs · Discord

Infra layer · Own how your organization uses AI.