intent-ir
Agent IR lowering, verification, audit bridge, and collaboration tooling for IntentLang.
Part of the IntentLang toolchain — a declarative specification language for human-AI collaboration.
What it does
Lowers IntentLang ASTs into a typed intermediate representation and provides verification, auditing, diffing, incremental caching, and multi-agent locking:
- Lowering — AST to IR (structs, functions, invariants, edge guards). Every IR node carries a
SourceTracelinking back to the original spec. - Verification — structural checks (type resolution, field access,
old()placement) and coherence analysis (verification obligations). - Audit — trace maps from spec items to IR constructs with source lines. Coverage summaries.
- Diff — spec-level diffs between two versions of a spec.
- Incremental — per-item verification caching. Re-verifies only items whose content changed.
- Lock — multi-agent spec-item claiming. Prevents conflicts when multiple agents work on the same spec.
Usage
use parse_file;
use ;
let source = read_to_string.unwrap;
let ast = parse_file.unwrap;
// Lower to IR
let ir = lower_file;
// Verify structural correctness + coherence
let errors = verify_module;
let obligations = analyze_obligations;
// Generate audit trace map
let report = generate_audit;
Modules
| Module | Public API | Description |
|---|---|---|
lower |
lower_file() |
AST to IR lowering |
verify |
verify_module(), analyze_obligations() |
Structural verification and coherence |
audit |
generate_audit() |
Audit trace maps and coverage |
diff |
diff_reports() |
Spec-level diffs between versions |
incremental |
incremental_verify(), VerifyCache |
Cached per-item verification |
lock |
lock_item(), unlock_item(), format_status() |
Multi-agent collaboration |
Part of IntentLang
This crate is the IR and verification layer. Other crates in the workspace:
- intent-parser — PEG parser and typed AST
- intent-check — Semantic analysis and type checking
- intent-render — Markdown and HTML rendering
- intent-cli — CLI binary (
intent check,intent verify, etc.)