メモリPhase2の実装

This commit is contained in:
2026-05-01 23:00:55 +09:00
parent f1b7af6249
commit d8a7200ea4
18 changed files with 1862 additions and 2 deletions
+10
View File
@@ -217,6 +217,16 @@ impl MemoryConfig {
extract_worker_max_input_tokens: upper
.extract_worker_max_input_tokens
.or(self.extract_worker_max_input_tokens),
consolidation_model: upper.consolidation_model.or(self.consolidation_model),
consolidation_worker_max_input_tokens: upper
.consolidation_worker_max_input_tokens
.or(self.consolidation_worker_max_input_tokens),
consolidation_threshold_files: upper
.consolidation_threshold_files
.or(self.consolidation_threshold_files),
consolidation_threshold_bytes: upper
.consolidation_threshold_bytes
.or(self.consolidation_threshold_bytes),
}
}
}
+5
View File
@@ -50,3 +50,8 @@ pub const COMPACT_DEFAULT_REFERENCE_COUNT: usize = 5;
/// own LLM calls. Exceeding this aborts the extract run.
/// See [`crate::MemoryConfig::extract_worker_max_input_tokens`].
pub const MEMORY_EXTRACT_WORKER_MAX_INPUT_TOKENS: u64 = 30_000;
/// Cumulative input-token cap for the memory Phase 2 (consolidation)
/// worker's own LLM calls. Exceeding this aborts the consolidation run.
/// See [`crate::MemoryConfig::consolidation_worker_max_input_tokens`].
pub const MEMORY_CONSOLIDATION_WORKER_MAX_INPUT_TOKENS: u64 = 80_000;
+21
View File
@@ -85,6 +85,27 @@ pub struct MemoryConfig {
/// [`defaults::MEMORY_EXTRACT_WORKER_MAX_INPUT_TOKENS`].
#[serde(default)]
pub extract_worker_max_input_tokens: Option<u64>,
/// Optional model for the Phase 2 (consolidation) worker. When
/// `None`, the main pod model is cloned via `clone_boxed()`.
/// Reasoning-class models are recommended.
#[serde(default)]
pub consolidation_model: Option<ModelManifest>,
/// Cumulative input-token cap for the consolidation worker's own
/// LLM calls. Exceeding this aborts the consolidation run. `None` ⇒
/// [`defaults::MEMORY_CONSOLIDATION_WORKER_MAX_INPUT_TOKENS`].
#[serde(default)]
pub consolidation_worker_max_input_tokens: Option<u64>,
/// Phase 2 trigger: file-count threshold of `_staging/`. Phase 2
/// fires when the staging directory has at least this many entries.
/// Either threshold reaching its limit fires Phase 2 (logical OR).
/// `None` for both thresholds ⇒ Phase 2 disabled.
#[serde(default)]
pub consolidation_threshold_files: Option<usize>,
/// Phase 2 trigger: byte-size threshold across all `_staging/`
/// entries. Either threshold reaching its limit fires Phase 2.
/// `None` for both thresholds ⇒ Phase 2 disabled.
#[serde(default)]
pub consolidation_threshold_bytes: Option<u64>,
}
/// Pod metadata.