r/PiCodingAgent • • 14d ago

Resource Memshort - Short-term memory and rolling window compaction for agents

https://github.com/jandrikus/memshort

I would like to publish "memshort", my take on a "short-term memory" implementation for agents. (A "long-term memory" implementation will follow shortly once I have it publishable). I find it very useful for myself and I thought it would be nice to share it with others.

It is essentially a rolling-window compaction for coding agent sessions in pi, Claude Code, Codex and Hermes. When the context fills up, older messages are replaced by a dated observation log, and the newest messages stay word for word.

Some ideas are borrowed and adjusted. The code was written by the pi coding harness under my direction, and I run it primarily on my own pi sessions. Unfortunately I have no benchmark yet (no time for that). My subjective impression from daily use is that I can stretch sessions for very long without the agent losing the thread.

I'm publishing it because a rolling context window that keeps as much knowledge as possible deserves more people thinking about it, not because this is the final answer. If you have a better design, a case where this loses something important, or a way to measure it, open an issue or share your take. Let's build something better together.

Thanks for taking a look!

0 Upvotes

1 comment sorted by

2

u/alexis_moscow 14d ago

how different it is from the built-in rolling compaction?