# agileplus-trace-validator
Ontology, DAG, and edge-constraint validator for AgilePlus intent graphs.
Every graph persisted into the workspace must pass through this crate.
## Purpose
`agileplus-trace-validator` is the workspace's canonical validation
layer. It enforces the AgilePlus Intent Graph Ontology (node kinds,
edge kinds, property schemas, DAG acyclicity, edge endpoint
constraints) so downstream consumers — CLI, HTTP server, MCP server,
web UI, plugins — can trust that any graph they read is internally
consistent.
## Installation
This is a library crate. There is no binary to install. Add it to
your `Cargo.toml`:
```toml
[dependencies]
agileplus-trace-validator = "0.3"
```
Or build the workspace from source:
```bash
cargo build -p agileplus-trace-validator
```
## Minimal Usage
Validate an in-memory intent graph built with `agileplus-domain`:
```rust
use agileplus_domain::intent_graph::IntentGraphBuilder;
use agileplus_trace_validator::{validate, ValidationError};
let graph = IntentGraphBuilder::new("Build OAuth2 login")
.feature("Login endpoint")
.feature("Session manager")
.plan("OAuth2 plan")
.build();
match validate(&graph) {
Ok(report) => println!("ok: {} nodes, {} edges", report.node_count, report.edge_count),
Err(ValidationError::Cycle { .. }) => panic!("graph contains a cycle"),
Err(e) => panic!("validation failed: {e}"),
}
```
The validator returns either a `ValidationReport` summarising the
graph's shape, or a typed `ValidationError` describing the first
violation. The workspace's `intent`, `validate`, and bulk `import`
subcommands all funnel through this function.
## Ontology Extensions
`agileplus-trace-validator` also owns the `ontology_ext` module, which
adds optional node kinds (Stories, Bugs, Metrics, Hypotheses) on top
of the core ontology. See
[`crates/agileplus-trace-validator/src/ontology_ext.rs`](../agileplus-trace-validator/src/ontology_ext.rs).
## API Reference
See the [workspace `docs/`](../../docs/README.md) for the full
ontology spec, edge-constraint tables, and the proptest-driven
property coverage in the test suite.
## License
MIT — see [`LICENSE`](../../LICENSE).