Skip to content

Memory: say how full an index is, name facts to merge, cap index lines - #685

Closed
lydakis wants to merge 1 commit into
mainfrom
claude/project-thread-0dikvb
Closed

lydakis wants to merge 1 commit into
mainfrom
claude/project-thread-0dikvb

Conversation

@lydakis

@lydakis lydakis commented Nov 5, 2026

Copy link
Copy Markdown
Owner

Requested by George · project thread

Relief for a busy project's memory index, which fills its 16 KiB cap within about a day and then refuses saves. For 0.8.1. Client only: no protocol or schema change, and the daemon is untouched.

What changes

  • Every save and removal says how full the index is. Replies carry index_bytes and limit (index already did).
  • From 90% full, the reply names merge_candidates. These are found without a model: alike lists up to three pairs of facts that share at least a third of the words in their names and descriptions; longest lists the longest index lines past the line limit; unread lists facts no agent has read or saved in 30 days.
  • memory_full names the same facts in its detail, so the agent knows where to start instead of deleting whatever comes to hand.
  • A new index line is at most 204 bytes, an eightieth of the index, so any index holds at least eighty facts. A longer one is refused with description_too_long, which says how many bytes to cut. A fact whose line was already longer can be saved again with a line no longer than it had, so existing facts keep working.
  • Agent-facing text matches. That covers the memory tool's description, the memory skill (merge the named facts, never remove one that still holds just to make room), the cleanup skill (shorten long lines), docs/SONNY.md and FEATURES.md.

What stays

The budget stays at 16 KiB. Both indexes go whole into every agent's instructions, which are capped at 60 KiB on the client and 64 KiB in the daemon, so a larger budget would leave agents unable to start (instructions_limit). The lasting fix is a budgeted view in the prompt plus a memory search. That needs a recall eval first, so it isn't in this PR.

Tests

  • a_new_index_line_past_the_line_limit_is_refused_and_an_old_one_may_not_grow
  • a_nearly_full_index_names_facts_to_merge_and_a_full_one_names_them_too
  • a_refused_cleanup_says_when_what_it_kept_overfills_the_index was reworked: it used 3,500-byte descriptions to fill the index with four facts, and it now fills it with lines near the cap.
  • cargo test -p agent-client passes and clippy is clean. exec::tests::a_script_ends_on_its_time_its_memory_or_its_turn failed once under a parallel run and passes alone, both on this branch and on main; it's unrelated.

Generated by Claude Code

Every save and removal answers with index_bytes and limit; from 90% full
it adds merge_candidates (pairs alike by shared words, the longest lines,
facts unread 30 days), found without a model, and memory_full names the
same facts. A new index line is at most 204 bytes, an eightieth of the
index, so an index holds at least eighty facts; a fact whose line was
already longer may be saved with a line no longer than it had. The memory
tool, the memory and cleanup skills and docs say so.

The index budget stays 16 KiB: both indexes go whole into every agent's
instructions, which are capped at 60 KiB, so a larger budget would make
agents fail to start.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_013jkdGFAkmSC4c8JiLYXBrd
@lydakis lydakis self-assigned this Nov 5, 2026
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Nov 5, 2026 •

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-11-05T02:27:49.376461Z 6ff0b19 PR opened
🔒 Security Review ✅ Completed 2026-11-05T02:30:20.721282Z 6ff0b19 PR opened
ℹ️ 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" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@lydakis lydakis closed this Nov 5, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants