metalcraft-flows
A serializable, human-authored DAG format for AI agent workflows.
Flows are JSON documents describing a graph of nodes (prompts, branches,
custom steps) connected by edges. They are designed to be edited in a visual
editor, persisted on disk, and executed by an external runtime such as
metalcraft.
This crate provides:
- The reference Rust types (
FlowDefinition,FlowNode,FlowEdge,SavedFlow) that parse and emit the wire format losslessly. - A generic BFS walker over a flow graph.
- Validation for spec conformance.
- Optional filesystem-backed CRUD (
fsfeature, on by default). - Optional flow execution logging (
logfeature).
See SPEC.md for the formal wire-format specification.
Quick start
[]
= "0.1"
use ;
use json;
let flow = FlowDefinition ;
let json = to_string_pretty.unwrap;
println!;
Custom node types
The spec supports vendor-namespaced custom node types so third-party tooling can add new step kinds without forking:
use FlowNodeType;
let nt: FlowNodeType = from_str.unwrap;
assert!;
See SPEC.md §5.2 for the vendor namespace rules.
Features
| Feature | Default | Description |
|---|---|---|
fs |
yes | Enables save_flow, load_flow, list_flows, delete_flow. |
log |
no | Enables FlowLogEntry plus append_flow_log / load_flow_logs. |
To depend on the spec types only, opt out of defaults:
= { = "0.1", = false }
License
MIT — see LICENSE.