What Is the Default Value for `breadth_weight` in ai-memory's Decay Configuration?
The default value for breadth_weight in ai-memory is 0.0, meaning breadth-based reinforcement has no effect on retention scores unless explicitly configured otherwise.
The ai-memory Rust crate implements a configurable decay system that governs how memory pages retain their relevance over time. Before customizing reinforcement behavior, developers must understand the baseline configuration for decay parameters. The breadth_weight parameter specifically determines how much a page's retention score increases when accessed by many different operators compared to repeated access by a single operator.
Where the Default Value Is Defined
According to the ai-memory source code, the default value for breadth_weight is explicitly set to 0.0.
This default is documented in the Users guide at docs/users.md (line 3032), which states that within the [decay] configuration section, breadth_weight defaults to 0.0. The underlying implementation reflects this in the DecayParams structure located in crates/ai-memory-store/src/decay.rs, where the Default trait implementation initializes breadth_weight to 0.0.
When this value is set to 0.0, the decay calculation ignores the diversity of operators accessing a page. The retention score depends solely on other factors such as recency and frequency from individual operators, effectively disabling the breadth-based reinforcement mechanism out of the box.
Configuring breadth_weight in Rust
You can inspect or override the default value programmatically using the DecayParams struct.
Using the Default Implementation
use ai_memory_store::decay::DecayParams;
// Creating a decay parameter set with the default values
let params = DecayParams::default();
// `params.breadth_weight` is 0.0 by default
assert_eq!(params.breadth_weight, 0.0);
Customizing the Value in Code
To enable breadth-based reinforcement, override the default when constructing the struct:
use ai_memory_store::decay::DecayParams;
// Overriding the default in code
let custom_params = DecayParams {
breadth_weight: 0.25, // give a modest boost for multi-operator reads
..Default::default()
};
Configuring breadth_weight via TOML
For runtime configuration, set the value in your TOML configuration file under the [decay] section:
[decay]
breadth_weight = 0.25 # optional; defaults to 0.0
The configuration is parsed once at startup via Config::load() and applied throughout the store. If omitted, the system automatically uses the 0.0 default defined in the source code.
Summary
- The default value for
breadth_weightin ai-memory is0.0, effectively disabling breadth-based reinforcement by default. - This default is documented in
docs/users.md(line 3032) and implemented in theDecayParamsstruct withincrates/ai-memory-store/src/decay.rs. - You can override the default programmatically by constructing a custom
DecayParamsinstance or via TOML configuration in the[decay]section. - When
breadth_weightis0.0, retention scores calculate without considering the diversity of operators accessing a memory page.
Frequently Asked Questions
What is the default breadth_weight value in ai-memory?
The default value is 0.0. Out of the box, ai-memory does not apply any breadth-based boost to retention scores, meaning pages accessed by many different operators receive no additional weight compared to pages accessed repeatedly by the same operator.
How do I change the breadth_weight setting?
You can change it either programmatically by creating a DecayParams struct with a custom breadth_weight value, or via the TOML configuration file by setting breadth_weight under the [decay] section. The system parses this configuration at startup through Config::load().
What happens when breadth_weight is set to 0.0?
When set to 0.0, the decay calculation ignores operator diversity entirely. The retention score depends only on other configured factors such as recency and individual operator frequency, without giving extra weight to pages accessed by many different users or processes.
Where is the breadth_weight default defined in the source code?
The default is defined in two locations: the user-facing documentation in docs/users.md (line 3032) explicitly states the default is 0.0, and the Rust implementation in crates/ai-memory-store/src/decay.rs within the DecayParams struct's Default implementation sets the initial value to 0.0.
Have a question about this repo?
These articles cover the highlights, but your codebase questions are specific. Give your agent direct access to the source. Share this with your agent to get started:
curl -s "https://instagit.com/install.md" Maintain an open-source project? Get it listed too →