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