alaz-graph 1.0.0

Long-term memory for AI coding agents
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
use alaz_core::Result;
use alaz_db::repos::GraphRepo;
use sqlx::PgPool;
use tracing::info;

/// Run the background decay job on graph edge weights.
///
/// Applies exponential decay (multiply by 0.95) to all edge weights,
/// then deletes edges that have decayed below 0.05.
///
/// Returns the number of deleted edges.
pub async fn run_decay(pool: &PgPool) -> Result<u64> {
    let deleted = GraphRepo::decay_weights(pool).await?;
    info!(deleted, "decay job completed");
    Ok(deleted)
}