Lower memory thresholds, add dedup, store from free-mode#14
Merged
AaronGoldsmith merged 2 commits intomainfrom Mar 21, 2026
Merged
Lower memory thresholds, add dedup, store from free-mode#14AaronGoldsmith merged 2 commits intomainfrom
AaronGoldsmith merged 2 commits intomainfrom
Conversation
- Lower similarity thresholds from 0.9/0.7 to 0.5/0.3 so memory actually influences agent selection (real similarities are 0.3-0.5) - Add dedup check in memory.store() to prevent duplicate task+winner entries - Store memory entries from free-mode matches via record_verdict.py so /mobius-run competitions feed back into the selection system Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
There was a problem hiding this comment.
Pull request overview
Adjusts Mobius’s vector-memory behavior so past task outcomes can influence agent selection in practice, while reducing duplicate memory entries and capturing outcomes recorded via the judge script.
Changes:
- Lowered similarity thresholds used to choose specialist/ensemble selection strategies.
- Added a duplicate check in
Memory.store()to skip repeated(task_text, winning_agent_id)entries. - Extended
record_verdict.pyto store a memory entry for the winning agent after recording a verdict.
Reviewed changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 3 comments.
| File | Description |
|---|---|
src/mobius/memory.py |
Adds dedup logic before inserting memory entries. |
src/mobius/config.py |
Lowers similarity thresholds to make memory influence selection more often. |
.claude/skills/mobius-judge/scripts/record_verdict.py |
Stores memory entries when verdicts are recorded via the script. |
Comments suppressed due to low confidence (1)
src/mobius/memory.py:56
- The SELECT-then-INSERT dedup check is not atomic. If two processes/threads call
store()concurrently, both can pass theSELECTand insert duplicates. Consider enforcing a DB-level uniqueness constraint (e.g., UNIQUE index on(task_text, winning_agent_id)) and switching the insert toINSERT ... ON CONFLICT DO NOTHING/INSERT OR IGNOREto make dedup race-free and avoid the extra round-trip.
existing = self.conn.execute(
"SELECT id FROM memory WHERE task_text = ? AND winning_agent_id = ?",
(entry.task_text, entry.winning_agent_id),
).fetchone()
if existing:
logger.debug(
"Duplicate memory entry for agent %s on task, skipping",
entry.winning_agent_id,
)
return
row = dict_to_row(entry.model_dump(exclude={"task_embedding"}))
cols = ", ".join(row.keys())
placeholders = ", ".join(["?"] * len(row))
self.conn.execute(
f"INSERT INTO memory ({cols}) VALUES ({placeholders})",
list(row.values()),
)
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
- Guard memory-write path with `if vec_available:` so Memory.store() is only called when vector search is operational - Reuse existing task_embedding blob from the match row instead of re-embedding task_text via embed() - Add two tests: vec_unavailable skips memory, existing embedding skips embed() call Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
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.
Summary
Why
Memory was never influencing agent selection because thresholds were too high for real embedding distances. Dedup prevents polluting the vector index.
🤖 Generated with Claude Code