Pre-compaction memory flush

t-533·WorkTask·
·
·
·Omni/Agent/Memory.hs
Created3 months ago·Updated1 week ago·pipeline runs →

Description

Edit

Before compacting conversation history, run a silent turn prompting the agent to save important context to memory.

Inspired by moltbot's memory flush system:

  • Triggers when session nears context limit (configurable threshold)
  • Runs a silent agent turn with prompt like:

'Session nearing compaction. Save any important context to memory. Reply NO_REPLY when done.'

  • Only provides remember tool (minimal toolset)
  • Tracks flush per compaction cycle (don't flush twice)
  • NO_REPLY response is discarded

Implementation: 1. Add flush hook to Programs/Compaction.hs 2. Configure soft threshold (e.g., 4000 tokens before hard limit) 3. Add config: compaction.memoryFlush.enabled, .softThresholdTokens, .prompt

Reference: moltbot docs/concepts/memory.md 'Automatic memory flush'

Timeline (17)

🔄[system]Open → InProgress1 month ago
💬[system]1 month ago

Pipeline: dev completed (run=dev-t-533-1771510084, cost=0.0c)

🔄[system]InProgress → Open1 month ago
💬[system]1 month ago

Pipeline: verification failed: Build failed for Omni/Agent/Memory.hs (exit 1): 7[10000;10000H7[10000;10000Hthese 15 derivations will be built: /nix/store/0m5fa2krxa2d7m1rd67xnplb90yj9vbw-hs-mod-Omni_Agent_Prompt_IR.drv /nix/store/wrciq3ha3bcvsvdjjjphm4ispziykj2k-hs-mod-Omni_Agent_Trace.drv /nix/store/ppsjkiss9gjb8xvsmalw6lfbk98ajbjk-hs-mod-Omni_Agent_Op.drv /nix/store/kkmxaw0ks2y1ndih75clcsjsq4wc7dy9-hs-mod-Omni_Agent_Models.drv /nix/store/rvrifzh4ra6glx7w7p4znb7z0pgjbwi5-hs-mod-Omni_Agent_Provider.drv /nix/store/xyn2scqg0ygjhz73md9gbw8al9ragcsb-hs-mod-Omni_Agent_Prompt_Hydrate.drv /nix/store/ylwsiw8a9dr2ljc9siwn876bv7gizmnf-hs-mod-Omni_Agent_Prompt_Compile.drv /nix/store/11gi7wrxbsiq1x5g4c7cnn7lq3r4vf16-hs-mod-Omni_Agent_Interpreter_Sequential.drv /nix/store/zcw5fggqi3nlcnpp7n6q5ps9jg7ik1lp-hs-mod-Omni_Agent_Programs_Compaction.drv /nix/store/hrsrvpjr0wmvy5yjpln1p5v7q3vplwka-hs-mod-Omni_Agent_Programs_Agent.drv /nix/store/x0q0anj5xyg8pmdl2hq1cw17p6jh4qa9-hs-mod-Omni_Agent_Engine.drv /nix/store/3d2x10ar9h8jlxqzxqma1kk7p0jm6b77-hs-mod-Omni_Agent_Op_Bridge.drv /nix/store/lgpvbrwgjmlp7d0vphgigwn6ik39klbf-hs-mod-Omni_Time.drv /nix/store/d86jgf3zdqb1nr47k6mw02dr1gyigkg2-hs-mod-Omni_Agent_Memory.drv /nix/store/h3srk9cgxf1vg6zn9k2vh0hi3fb3js8g-omni-agent-memory.drv building '/nix/store/kkmxaw0ks2y1ndih75clcsjsq4wc7dy9-hs-mod-Omni_Agent_Models.drv'... building '/nix/store/0m5fa2krxa2d7m1rd67xnplb90yj9vbw-hs-mod-Omni_Agent_Prompt_IR.drv'... building '/nix/store/wrciq3ha3bcvsvdjjjphm4ispziykj2k-hs-mod-Omni_Agent_Trace.drv'... building '/nix/store/lgpvbrwgjmlp7d0vphgigwn6ik39klbf-hs-mod-Omni_Time.drv'...

Omni/Agent/Models.hs:35:1: error: Could not find module Data.Yaml' Use -v (or :set -v in ghci) to see a list of the files searched for. | 35 | import qualified Data.Yaml as Yaml | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error: builder for '/nix/store/kkmxaw0ks2y1ndih75clcsjsq4wc7dy9-hs-mod-Omni_Agent_Models.drv' failed with exit code 1; last 7 log lines: > > Omni/Agent/Models.hs:35:1: error: > Could not find module Data.Yaml' > Use -v (or :set -v in ghci) to see a list of the files searched for. > | > 35 | import qualified Data.Yaml as Yaml > | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ For full logs, run: nix log /nix/store/kkmxaw0ks2y1ndih75clcsjsq4wc7dy9-hs-mod-Omni_Agent_Models.drv error: 1 dependencies of derivation '/nix/store/h3srk9cgxf1vg6zn9k2vh0hi3fb3js8g-omni-agent-memory.drv' failed to build

[1A[1G[2K[+] Omni/Agent/Memory.hs [1A[1G[2K[0m[…] Omni/Agent/Memory.hs[0m[1B

[1A[1G[2K[+] Omni/Agent/Memory.hs [1A[1G[2K[~] Omni/Agent/Memory.hs: warning: you did not specify '--add-root'; the res...[1B[1A[1G[2K[~] Omni/Agent/Memory.hs: /nix/store/h3srk9cgxf1vg6zn9k2vh0hi3fb3js8g-omni-a...[1B[1A[1G[2K[~] Omni/Agent/Memory.hs: these 15 derivations will be built:…[1B[1A[1G[2K[~] Omni/Agent/Memory.hs: /nix/store/0m5fa2krxa2d7m1rd67xnplb90yj9vbw-hs-m...[1B[1A[1G[2K[~] Omni/Agent/Memory.hs: /nix/store/zcw5fggqi3nlcnpp7n6q5ps9jg7ik1lp-hs-m...[1B[1A[1G[2K[~] Omni/Agent/Memory.hs: building '/nix/store/kkmxaw0ks2y1ndih75clcsjsq4wc7...[1B[1A[1G[2K[~] Omni/Agent/Memory.hs: building '/nix/store/0m5fa2krxa2d7m1rd67xnplb90yj9...[1B[1A[1G[2K[~] Omni/Agent/Memory.hs: building '/nix/store/wrciq3ha3bcvsvdjjjphm4ispziyk...[1B[1A[1G[2K[~] Omni/Agent/Memory.hs: building '/nix/store/lgpvbrwgjmlp7d0vphgigwn6ik39k...[1B[1A[1G[2K[~] Omni/Agent/Memory.hs: Omni/Agent/Models.hs:35:1: error: Could not fin...[1B[1A[1G[2K[~] Omni/Agent/Memory.hs: error: builder for '/nix/store/kkmxaw0ks2y1ndih75c...[1B[1A[1G[2K[~] Omni/Agent/Memory.hs: error: 1 dependencies of derivation '/nix/store/h3...[1B[0m[38;5;1m[2Kfail: bild: realise: Omni/Agent/Memory.hs [0m[0m [0m[1A[1G[2K[0m[38;5;1m[x] Omni/Agent/Memory.hs[0m[1B 1

🔄[system]Open → InProgress1 month ago
💬[human]1 month ago

Pipeline scheduler: started run=pipeline-omni-agent-memory-hs-t-533-1771561136 domain=Omni/Agent/Memory.hs

🔄[human]InProgress → Review1 month ago
💬[human]1 month ago

Pipeline scheduler: run=pipeline-omni-agent-memory-hs-t-533-1771561136 domain=Omni/Agent/Memory.hs status=done cost=51c (fund-spend=failed)

💬[human]1 week ago

Ava triage: pipeline auto-run reached status=done but the agent made NO git commits and reported blockers (missing files, path mismatches, or need clarification). This task is not actually in review — there's nothing to review. Resetting status to Open so it can be re-scoped.

🔄[human]Review → Open1 week ago
💬[human]1 week ago

ORPHAN COMMIT: coder agent produced commit e2eb0d84282f4aa3c25824fe89b749eef86811b7 on 2026-02-19 but it was never merged into live. Reachable only via branchless reflog. Pipeline scheduler bug — see separate task. To recover: git cherry-pick e2eb0d84282f4aa3c25824fe89b749eef86811b7 from omni/live (expect conflicts after 6+ weeks of drift). Otherwise re-implement from scratch.