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