feat: use memory usage for selection (#12909)

This commit is contained in:
jif-oai
2026-02-26 16:44:02 +00:00
committed by GitHub
Unverified
parent 1503a8dad7
commit c528f32acb
8 changed files with 329 additions and 16 deletions
+8 -1
View File
@@ -59,7 +59,14 @@ Phase 2 consolidates the latest stage-1 outputs into the filesystem memory artif
What it does:
- claims a single global phase-2 job (so only one consolidation runs at a time)
- loads a bounded set of the most recent stage-1 outputs from the state DB (the per-rollout memories produced by Phase 1, used as the consolidation input set)
- loads a bounded set of stage-1 outputs from the state DB using phase-2
selection rules:
- ignores memories whose `last_usage` falls outside the configured
`max_unused_days` window
- for memories with no `last_usage`, falls back to `generated_at` so fresh
never-used memories can still be selected
- ranks eligible memories by `usage_count` first, then by the most recent
`last_usage` / `generated_at`
- computes a completion watermark from the claimed watermark + newest input timestamps
- syncs local memory artifacts under the memories root:
- `raw_memories.md` (merged raw memories, latest first)