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 substrate;
41
42#[cfg(test)]
43mod integration;
44#[cfg(test)]
45mod testkit;
46
47pub use analyzer::{builtin_analyzers, AnalyzeCtx, Analyzer, OutcomeInput};
48pub use engine::{
49    Decision, Engine, Health, LlmMetrics, RunOptions, RunOutcome, RunResult, Scope, ScopeSet,
50    SkipReason, LOOP_NS,
51};
52pub use config::{AnalyzerConfig, AnalyzerConfigUpdate, AnalyzerSetting};
53pub use error::{Error, Result};
54pub use external::CommandAnalyzer;
55pub use llm::{CommandLlm, LlmBackend};
56pub use manifest::{
57    analyzer_family, AnalyzerManifest, AutoApplyClass, CadenceClass, Capability, ParamSpec, Params,
58    TargetClass, Tier, TrustClass,
59};
60pub use model::{ActionKind, GrainRecord, Origin, Severity, TargetRef};
61pub use policy::{AutoApplyGrant, Policy, TelemetryMode};
62pub use recommendation::{
63    dedup_key, validate_code_rules, AuditRecord, GatingEvidence, MetricSnapshot, ObserverType,
64    OutcomeResult, Proposal, RecDraft, RecStatus, Recommendation, Summary,
65};
66pub use reference::ReferenceSubstrate;
67pub use substrate::{
68    BudgetUsage, Capabilities, GrainAccess, GrainSpec, HeadGroup, OmsSubstrate, QueryUsage,
69    ReadOpts, SubstrateRead, TelemetryView,
70};