Ran into an annoying issue with local models on long tasks. Once context window compaction hits after a few thousand tokens, the model loses sight of the original scope. Even with good system prompts, a few compaction cycles cause goal drift, hallucinated task completion, or loops. Wrote a small plugin to force deterministic tracking instead of relying purely on context memory:https://github.com/janpauldahlke/dsh-local-long-horizon How it works &&& what is on screen The plugin hooks into the agent loop and maintains a structured state outside the main chat buffer. Looking at the UI: Right Panel (Plugin State): This sidebar runs independently of the chat context memory. Active: Tracks the current macro milestone (M2+M3+M4 accepted -> chunk commit -> M5 -> main). Now: Shows the immediate micro-step currently executing (In flight: M5 - history search: scanner core...). Next 3: The explicit deterministic queue of upcoming steps so the model doesn't jump ahead or invent tasks after compaction. Done (recent): Verification log showing committed checkpoints, exit codes, and test status. When the agent compacts context, the plugin re-anchors the model to this exact state file rather than trusting the lossy summary generated during compaction. Code is on GitHub if anyone wants to test or adapt it for their own local rig setup. Feedback or PRs welcome.   submitted by   /u/paulqq [link]   [comments]