Repository navigation
Memory: no index cap, agents start with its head; work facts; search - #686
Merged
Merged
Conversation
A project's MEMORY.md filled its 16 KiB cap mid-day, and the refusal told working agents to merge or remove facts to make room. Now: - An index lists every fact, most needed first: work under way by name, then the person's own facts, then the rest, by confirmations and date. New agents and `show` take each index's first 16 KiB plus a line saying how many facts it leaves out. A save is never refused for room. - A `work` type for work under way. The index names it only; cleanup start lists work unsaved for over three days as stale_work, the cleanup retires it after keeping any lesson, and the loss guard leaves work out. - `memory search WORDS` (and the tool's `search`): facts holding every word across both scopes, best first, with their matching lines. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_013jkdGFAkmSC4c8JiLYXBrd
Codex Review SummaryThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 21472a997a
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
…bound kept on save Review fixes for the uncapped index: - Each work fact is its own index line (name and date), so the head keeps as many as fit rather than losing them all with one long line. - `changed` is true while a work fact is stale, so a quiet night still wakes the cleanup that retires it; work still under way is saved again. - A folder may hold 16,384 entries, and a new fact's save is refused at that bound, so no save leaves a folder the other commands cannot read. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_013jkdGFAkmSC4c8JiLYXBrd
Merged
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.
🤖 Generated with Claude Code
https://claude.ai/code/session_013jkdGFAkmSC4c8JiLYXBrd
Why
A busy project's
MEMORY.mdhit its 16 KiB cap mid-day. Two things drove it. Agents had nowhere else durable to keep work in flight, and every index went whole into each agent's instructions, which are capped at 60 KiB. Saves were refused withmemory_full, and the refusal told working agents to merge or remove facts. That is the nightly cleanup's job, not theirs. Every mature system bounds what gets preloaded rather than what gets saved: Claude Code loads the first 200 lines or 25 KB, and Codex loads a small summary plus its most-used facts.What changes
All of this is client-side, so there's no protocol or schema change.
MEMORY.mdlists every fact, most needed first. Work under way comes first, by name on one line, thenuserandfeedback, then the rest. Within each group, the most confirmed and then the most recently verified come first. A new agent's instructions andshowtake the first 16 KiB of each index (memory::head), then a line saying how many facts it leaves out. A save is never refused for room, and nothing tells agents how full memory is.worktype. It holds work under way that a later agent may pick up. The index lists work facts by name only.cleanup startlists the ones not saved in over three days asstale_work. The cleanup skill retires them after saving any lesson they hold as a fact of its own. The loss guard leaves work facts out of both of its counts.search.memory search WORDS... [SCOPE]and the tool'ssearchfield look across both scopes. They return at most 20 facts whose file holds every word (case-insensitive), best first, each with its index line and up to three matching lines.searchandwork, and drops the merge-on-refusal paragraph. The cleanup skill gets a stale-work step.lead.mdnow saves work under way as aworkfact, within its byte budget. The tool schema and description,docs/SONNY.mdand the FEATURES row are updated to match.Retiring lasting facts by age is left out on purpose. With only the head loaded it isn't needed for room, and removing facts on age alone can lose true ones.
Checks
cargo fmt,cargo clippy --locked --workspace --all-targets -- -D warningscargo test -p agent-client: 98 pass.cargo test -p sonny: all pass.stale_workis listed, and retiring work passes the loss guardGenerated by Claude Code