Skip to main content

Crate ironclad_ai_agent

Crate ironclad_ai_agent 

Source
Expand description

§IronClad 🛡️

Secure-by-Design Autonomous AI Agent

IronClad is a Rust-based autonomous agent that treats the LLM as an untrusted component (“The Dreamer”) and enforces strict policies (“The Governor”) on all actions.

§Architecture

The system is built around a “Three-Ring” security architecture:

  1. The Dreamer (LLM): Generates intentions and commands but has no direct system access
  2. The Governor: Validates and gates all LLM outputs through a Traffic Light policy
  3. The Executor (Sandbox): Runs approved commands in isolated environments

§Key Features

  • Multi-Provider LLM Support: Ollama (local), OpenAI, and Anthropic
  • Sandboxed Execution: Docker or WSL backends for command isolation
  • Traffic Light Policy: Commands classified as Green/Yellow/Red/Blocked
  • MCP Integration: Model Context Protocol for extensible tools
  • Audit Logging: Complete audit trail in SQLite
  • Telegram Integration: Remote control via Telegram bot
  • Pulse Scheduler: Autonomous cron job execution
  • Web Dashboard: Localhost web interface for observability and management
  • RAG Knowledge Base: Local codebase indexing for context-aware responses

§Quick Start

use ironclad_ai_agent::config::AppConfig;
use ironclad_ai_agent::audit::AuditLogger;
use ironclad_ai_agent::vault::Vault;
use ironclad_ai_agent::llm;
use std::path::Path;

#[tokio::main]
async fn main() -> ironclad_ai_agent::error::Result<()> {
    // Load configuration
    let config = AppConfig::load(Path::new("settings.toml"))?;
     
    // Initialize audit logger
    let audit = AuditLogger::new(Path::new("audit.db")).await?;
     
    // Load API keys from environment
    let vault = Vault::load();
     
    // Create LLM provider
    let provider = llm::create_provider(&config, &vault)?;
     
    Ok(())
}

§Modules

  • audit: Audit logging and event tracking
  • config: Configuration management
  • dashboard: Localhost web dashboard for observability
  • error: Error types and Result alias
  • governor: Security policy engine and intent parsing
  • integrations: External integrations (Telegram, Playwright, STT)
  • llm: LLM providers and orchestrator
  • mcp: Model Context Protocol client
  • memory: Chat history persistence
  • planner: Task planning and context management
  • pulse: Job scheduler for autonomous tasks
  • rag: RAG knowledge base for codebase indexing
  • react: Constrained ReAct (Thought-Action-Observation) harness
  • sandbox: Execution backends (Docker, WSL)
  • security: Path validation and workspace boundary enforcement
  • skills: Tool/skill system
  • subprocess: Subprocess orchestration for CLI agent management
  • tui: Terminal user interface
  • vault: API key management and secret scrubbing

Modules§

api
audit
Audit logging subsystem — the “Black Box” recorder.
bootstrap
Bootstrapping logic for IronClad.
collab
Multi-instance collaboration (collab_workspace).
config
Application configuration.
dashboard
Localhost Web Dashboard for Observability & Management.
error
Custom error types for IronClad.
governor
The Governor — intent parser and permission gate.
integrations
llm
LLM provider abstraction and implementations.
mcp
Model Context Protocol (MCP) integration.
memory
Memory management for chat history and sessions.
metrics
Simple metrics tracking for the Orchestrator.
planner
Planner module — context management and three-file enforcement.
plugin
IronClad Dynamic & In-Process Plugin Subsystem.
prelude
Re-export commonly used types for convenience
pulse
Pulse scheduler for autonomous task execution.
rag
RAG (Retrieval-Augmented Generation) Knowledge Base Module.
react
sandbox
Sandbox execution backends.
security
Security utilities for path validation and workspace boundary enforcement.
skills
Skills system for tool execution.
subprocess
Subprocess orchestration engine for IronClad.
swarm
Asynchronous Multi-Agent Swarm module.
telemetry
tui
TUI module — Terminal User Interface for IronClad.
vault
The Vault — secure API key management.

Functions§

floor_char_boundary
Return the largest byte index ≤ index that falls on a UTF-8 char boundary.
safe_truncate
Truncate a string slice to at most max_bytes without splitting a UTF-8 code point.