feat(memory): LLM-maintained fact files — cap errors, stats, eviction policy (M1-M4) - #162
Merged
Merged
Conversation
… policy (M1-M4) - M1: cap errors in Add/Replace/ReplaceAt carry the entry index (index, byte size, rune-safe preview) + remove/replace guidance, so the agent can evict without an extra read - M2: new memory stats action — per-entry sizes + used/cap fill - M3: tool description codifies the eviction policy (git/GitHub- recoverable records evict first, untracked-work pointers last) - M4: system-prompt memory block warns at >=90% file fill - docs/MEMORY.md: Automatic Cap Maintenance section RED-first: auto_eviction_test.go (9 tests). Scoped -race green.
Deploying with
|
| Status | Name | Latest Commit | Preview URL | Updated (UTC) |
|---|---|---|---|---|
| ✅ Deployment successful! View logs |
odek | 2963323 | Commit Preview URL Branch Preview URL |
Aug 30 2026, 07:32 PM |
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.
What
Makes fact-file memory self-maintaining by the agent: when a file fills, the agent evicts older entries itself — judgment stays in the ReAct loop, and every eviction is an explicit, auditable
memory remove/replacecall.facts.go): cap failures inAdd/Replace/ReplaceAtcarry the full entry index ([n] size "rune-safe preview") + explicitmemory remove/replaceguidance, so the agent evicts without an extra read round-trip.statsaction (tool.go):memory(action:"stats", target:"env")→{used, cap, entries:[{index, chars, preview}]}as a pre-flight fill check.viewstays episodes-only (provenance gate).tool.go): the tool description codifies the contract — git/GitHub-recoverable records evict first, pointers to untracked local work evict last.memory.go): the system-prompt memory block appends a one-line⚠ env fact file NN% full — evict stale entries via memory removeonly at ≥90% fill.docs/MEMORY.md.Deliberately not built
Tests
RED-first: 9 tests in
internal/memory/auto_eviction_test.go(cap-error index incl. the 4-byte§separator byte accounting, stats guards, rune-safe previews, hint threshold pinning). Verified:go test -race -count=1 ./internal/memory/...green,go build ./...clean, filteredcmd/odekMemory tests green, gofmt/vet clean.