Module aim

Source
Expand description

Agentic Inference Markup (AIM) file format support

This module provides support for the Agentic Inference Markup (AIM) file format used by Imogen. AIM is a text-based file format that stores workflows as hierarchical directories and files, with each .aim file representing a workflow containing a list of rules.

§File Format Structure

AIM files use a journal-based approach for version control:

workspace.aim     # Root workspace file
workspace.jnl     # Journal file for version tracking
workspace/
├── parent.aim    # Workflow file
├── parent.jnl    # Journal for parent workflow
├── parent/       # Subdirectory for child workflows
│   ├── child.aim # Child workflow
│   └── child.jnl # Journal for child workflow
└── sibling.aim   # Sibling workflow

§Version Control System

AIM uses a two-component versioning system:

  • Epoch: Major version number that increments for structural changes
  • Partial: Minor version number for incremental updates within the same epoch

Versions are tracked in journal files (.jnl) that map version numbers to byte offsets in the corresponding AIM files, enabling efficient random access to specific versions.

§Concurrency Model

AIM implements a Multi-Version Concurrency Control (MVCC) model:

  • Readers: Unlimited concurrent access to consistent snapshots without blocking
  • Writers: Fine-grained per-workflow locking for exclusive write access
  • Lazy Loading: Workflows loaded on-demand with reference-counted sharing

§Modules

  • config - Application configuration management
  • journal - Version journaling and persistence
  • lock_manager - Fine-grained workflow locking for concurrent access
  • read - Journaled workflow reading utilities
  • version - Version header parsing and management

§Re-exports

The following items are re-exported for convenient access:

Re-exports§

pub use config::AppName;
pub use config::Config;
pub use config::get_config;
pub use config::get_config_mut;
pub use journal::Journal;
pub use journal::to_journal_path;
pub use journal::journal_file;
pub use journal::journal_load;
pub use journal::journal_save;
pub use lock_manager::LockManager;
pub use lock_manager::get_lock_manager;
pub use read::read_latest;
pub use read::read_version;
pub use version::Version;
pub use version::parse_version;

Modules§

config
Application configuration management for AIM
journal
Version journaling and persistence for AIM files
lock_manager
Workflow Lock Manager for Concurrent Access Control
read
Journaled workflow reading utilities
version
Version header parsing and management for AIM files