Skip to main content

areev_loop/
lib.rs

1//! # Areev Loop
2//!
3//! The governed self-improvement engine for AI-agent memory. Areev Loop turns an
4//! agent's own history into **recommendations** — evidence-cited, reviewable,
5//! undoable, measured — and governs every change through four gates (propose,
6//! review, apply, verify). The deterministic core produces useful
7//! recommendations with **zero model calls** by computing over declared grain
8//! semantics, never raw prose.
9//!
10//! This crate is a **standalone engine over an [`OmsSubstrate`]** (CAL text +
11//! grains) with zero Areev dependencies (serde only). Areev is the first
12//! substrate; [`ReferenceSubstrate`] lets tests run with no store at all.
13//!
14//! ```
15//! use areev_loop::{Engine, ReferenceSubstrate, RunOptions};
16//!
17//! let mut store = ReferenceSubstrate::new();
18//! let engine = Engine::with_builtins();
19//! let result = engine.run(&mut store, &RunOptions::default(), 1_000).unwrap();
20//! assert!(result.ran());
21//! ```
22//!
23//! See the design proposal (`docs/loop-proposal.md`) for the full model.
24
25pub mod analyzer;
26pub mod analyzers;
27pub mod cal;
28pub mod config;
29pub mod engine;
30pub mod error;
31pub mod eval;
32pub mod external;
33pub mod llm;
34pub mod manifest;
35pub mod model;
36pub mod policy;
37pub mod proc;
38pub mod recommendation;
39pub mod reference;
40pub mod replay;
41pub mod substrate;
42
43#[cfg(test)]
44mod integration;
45#[cfg(test)]
46mod testkit;
47
48pub use analyzer::{builtin_analyzers, AnalyzeCtx, Analyzer, OutcomeInput};
49pub use engine::{
50    Decision, Engine, Health, LlmMetrics, RunOptions, RunOutcome, RunResult, Scope, ScopeSet,
51    SkipReason, LOOP_NS,
52};
53pub use config::{AnalyzerConfig, AnalyzerConfigUpdate, AnalyzerSetting};
54pub use error::{Error, Result};
55pub use external::CommandAnalyzer;
56pub use llm::{CommandLlm, LlmBackend};
57pub use manifest::{
58    analyzer_family, AnalyzerManifest, AutoApplyClass, CadenceClass, Capability, ParamSpec, Params,
59    TargetClass, Tier, TrustClass,
60};
61pub use model::{ActionKind, GrainRecord, Origin, Severity, TargetRef};
62pub use policy::{AutoApplyGrant, Policy, TelemetryMode};
63pub use recommendation::{
64    dedup_key, validate_code_rules, AuditRecord, GatingEvidence, MetricSnapshot, ObserverType,
65    OutcomeResult, Proposal, RecDraft, RecStatus, Recommendation, Summary,
66};
67pub use reference::ReferenceSubstrate;
68pub use substrate::{
69    BudgetUsage, Capabilities, GrainAccess, GrainSpec, HeadGroup, OmsSubstrate, QueryUsage,
70    ReadOpts, SubstrateRead, TelemetryView,
71};