feat(agent): let an agent sleep on it - #18
Merged
Merged
Conversation
…hings in fewer words Memory only ever grew. `MEMORY.md` gains a line every time an agent is told something and loses one only when a person deletes it, so after a month it holds the same fact written three ways, a correction sitting above the thing it corrected, and a note about a project that finished in March — all of it in every prompt, forever. So, optionally, once a night: the agent re-reads what it knows and writes back a shorter version that says the same things. Duplicates merge, the later correction wins, what is plainly finished falls away. Three rules make it safe to leave running, and they are enforced in code rather than asked for in the prompt: * **Nothing is invented.** The model sees only what the agent already wrote down. A dream that could add a belief would be a system quietly rewriting what it thinks of you, overnight, forever. * **Nothing is lost.** The previous memory is copied into `DREAMS.md` — verbatim, before the new one is written — so a bad night is one file to open and one block to paste back. * **It refuses rather than guesses.** An empty answer, an answer longer than what it was given, or one that dropped more than half the lines is discarded and the memory left untouched. "The model returned nothing useful" must never mean "the agent forgot everything". Off by default: it costs a language-model call per agent per day, and on the first day there is nothing to consolidate — a memory of four lines is already as short as it gets. The daemon checks on a timer rather than scheduling for 3 a.m., because a laptop is asleep at 3 a.m. and a cron-shaped design would only work for people who leave a desktop running. Never while recording. A night that refused still counts as slept, or the daemon would ask the same question every half hour until the memory changed. Measured on the running daemon against a stub provider: six lines in, four out, the duplicate pair merged, and the old six still readable in `DREAMS.md`.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Memory only ever grew.
MEMORY.mdgains a line every time an agent is told something and loses one only when a person deletes it — so after a month it holds the same fact written three ways, a correction sitting above the thing it corrected, and a note about a project that finished in March. All of it goes into every prompt.Optionally, once a night, the agent re-reads what it knows and writes back a shorter version that says the same things.
Three rules, enforced in code and not merely asked for
DREAMS.mdverbatim before the new one is written.Off by default
A language-model call per agent per day, for no benefit on day one. The daemon checks on a timer instead of scheduling for 3 a.m. — a laptop is asleep at 3 a.m., and a cron-shaped design only works for people who leave a desktop running. Never while recording. A night that refused still counts as slept, or the daemon would ask the same question every half hour forever.
Measured
On the running daemon against a stub provider: 6 lines in, 4 out, the duplicate pair merged, the original six still readable in
DREAMS.md, and the prompt confirmed to carry the "add nothing" rule.Plus unit tests for every refusal path, and the whole browser suite still green.
🤖 Generated with Claude Code