cm-topology::build(kind, roles) instantiates a canonical graph for any of the 12 kinds from a role list (the template catalog + the search generator). cm-orchestrator::evolve searches a (kinds × team-size) grid using the comparison machinery as fitness: build a candidate per cell, run the task, score it, and keep a MAP-Elites-style archive of per-cell elites + a quality/cost Pareto front and the global best. evolve_all() covers every kind at full size. This is the bridge toward Autonomous Organizational Evolution on a safe substrate — every candidate still executes via safe turns (§15 invariant holds). Demoed in topology_bench (auto-picks the best topology + Pareto kinds). cm-topology 20 tests; cm-orchestrator 17 (--features provider); clippy clean. Co-Authored-By: Claude Opus 4.8 <[email protected]>
47 lines
1.7 KiB
Rust
47 lines
1.7 KiB
Rust
//! Organizational topologies for agentic systems — pure, offline modeling.
|
|
//!
|
|
//! A [`TopologyGraph`] describes *who talks to whom and who decides* in a
|
|
//! system of agents (claws). It is a description only: execution semantics
|
|
//! (and the §15 safety gates) live in the orchestrator, never here.
|
|
//!
|
|
//! This crate is dependency-light (serde + thiserror) and has no I/O, so it
|
|
//! doubles as a reusable library for benchmarking/topology research.
|
|
//!
|
|
//! Modules:
|
|
//! - [`kind`] — the curated [`TopologyKind`] taxonomy.
|
|
//! - [`graph`] — the [`TopologyGraph`] data model + validation.
|
|
//! - [`adapter`] — normalize a loose JSON/YAML spec into a graph.
|
|
//! - [`classifier`]— infer a topology kind from a graph's structure.
|
|
//! - [`heuristics`]— per-kind role distributions / optimization weights.
|
|
|
|
mod adapter;
|
|
mod builders;
|
|
mod classifier;
|
|
mod graph;
|
|
mod heuristics;
|
|
mod kind;
|
|
|
|
pub use adapter::{from_json, to_json};
|
|
pub use builders::build;
|
|
pub use classifier::{classify, Classification, GraphMetrics};
|
|
pub use graph::{Edge, EdgeKind, Node, TopologyGraph};
|
|
pub use heuristics::{heuristics, Heuristics};
|
|
pub use kind::TopologyKind;
|
|
|
|
/// Errors produced while building or validating a topology.
|
|
#[derive(Debug, thiserror::Error, PartialEq, Eq)]
|
|
pub enum TopologyError {
|
|
/// The graph has no nodes.
|
|
#[error("topology has no nodes")]
|
|
Empty,
|
|
/// An edge references a node id that does not exist.
|
|
#[error("edge references unknown node: {0}")]
|
|
UnknownNode(String),
|
|
/// Two nodes share an id.
|
|
#[error("duplicate node id: {0}")]
|
|
DuplicateNode(String),
|
|
/// The input spec could not be parsed.
|
|
#[error("invalid spec: {0}")]
|
|
Spec(String),
|
|
}
|