AimDB Codegen — architecture state to Mermaid and Rust source
This library reads .aimdb/state.toml (the architecture agent's decision
record) and emits two artefacts:
- Mermaid diagram —
.aimdb/architecture.mermaid, a read-only graph projection of the architecture (see [generate_mermaid]) - Rust source —
src/generated_schema.rs, compilable AimDB schema using the actual 0.5.x API (see [generate_rust])
Usage
use ;
let toml = r#"
[meta]
aimdb_version = "0.5.0"
created_at = "2026-02-22T14:00:00Z"
last_modified = "2026-02-22T14:00:00Z"
[[records]]
name = "Temperature"
buffer = "SpmcRing"
capacity = 128
key_prefix = "sensor."
key_variants = ["room1"]
producers = ["sensor_task"]
consumers = ["dashboard"]
[[records.fields]]
name = "celsius"
type = "f64"
description = "Temperature in Celsius"
"#;
let state = from_toml.unwrap;
let errors = validate;
assert!;
let mermaid = generate_mermaid;
assert!;
let rust = generate_rust;
assert!;