Yield Framework Audit — Mnemonic v0.33.0
Full codebase audit through the Yield framework lens, covering compounding assets, cleverness debt, leverage inventory, iteration friction, hardcoded judgment, and scaling ceilings.
Previous Findings (from v0.24.0 audit)
| # |
Finding |
Status |
| 1 |
Encoding finalization duplication (~140 lines) |
Still exists |
| 2 |
store.Store god interface (now 102 methods) |
Still exists, worse |
| 3 |
cmd/mnemonic/main.go monolith (3341 lines) |
Still exists |
| 4 |
FTS5 column mismatch in CLAUDE.md |
RESOLVED — code fixed, docs stale |
| 5 |
Config fallback helpers duplicated 3 ways |
Improved but still 3 patterns |
| 6 |
O(n²) embedding search |
RESOLVED — proper in-memory index |
| 7 |
MCP server monolith (internal/mcp/server.go) |
Still exists |
| 8 |
HeuristicFilter goroutine leak (no cancellation) |
Still exists |
| 9 |
Consolidation magic numbers |
Improved — 33 named config fields |
| 10 |
ctx/cancel struct field anti-pattern in agents |
Still exists |
New Findings
1. CosineSimilarity duplicated across 4 files
Identical function copy-pasted in multiple packages. Any fix or optimization must be applied 4 times. Highest priority DELETE — extract to a shared internal/mathutil or similar.
2. Hardcoded CORS origins in ws.go
Not derived from config. Should be configurable.
3. Encoding agent constructor leaks a context
Creates a context in the constructor that gets replaced in Start() — the original is never cancelled.
4. 90+ entries in hardcoded heuristic filter lists
internal/agent/perception/heuristic.go has static keyword/path lists that should be in config or learned from feedback data.
5. Stale FTS5 Known Issue in CLAUDE.md
The FTS5 column mismatch is fixed in code but still listed as a known issue. Misleads future sessions.
6. SearchByConcepts uses LIKE '%concept%' with OR
Scaling ceiling at ~5K memories. Should use proper FTS or a concept index.
Compounding Assets (invest further)
- Event bus architecture — clean, minimal, agents genuinely decoupled
- Feedback-driven association tuning — user ratings adjust retrieval quality over time
- Spread activation retrieval — 11-step pipeline, core value proposition
- Multi-resolution memory model — salience decay, Hebbian strengthening, consolidation cycles
- Embedding index — now properly indexed, scales with data
Cleverness Debt (highest risk)
- Encoding finalization duplication:
encodeMemory() and finalizeEncodedMemory() implement the same ~140-line finalization path independently. Changes to one won't propagate to the other.
- Store god interface at 102 methods: Every new feature, every test mock, every agent must satisfy the full interface. Adding one method forces changes in 3+ files.
- HeuristicFilter goroutine leak:
cleanupLoop() goroutine has no cancellation mechanism — runs forever even if the filter is GC'd.
Scaling Ceilings
If the system gets 100x more usage/data:
SearchByConcepts with LIKE queries breaks first (~5K memories)
- Single SQLite write connection (
SetMaxOpenConns(1)) serializes all reads too
- In-memory embedding index — loads all embeddings at startup, fine to ~100K but memory-bound beyond that
- Consolidation pairwise clustering — O(n²) cluster detection
Action Plan
AMPLIFY
- Event bus, feedback loop, spread activation, embedding index
DELETE (quick wins)
REPLACE (structural improvements)
DEFER (fine for now)
main.go monolith — annoying but functional
- MCP server monolith — same
- Consolidation tunables — configurable now, learn from data later
- ctx/cancel struct field anti-pattern — works, not idiomatic
Yield Framework Audit — Mnemonic v0.33.0
Full codebase audit through the Yield framework lens, covering compounding assets, cleverness debt, leverage inventory, iteration friction, hardcoded judgment, and scaling ceilings.
Previous Findings (from v0.24.0 audit)
store.Storegod interface (now 102 methods)cmd/mnemonic/main.gomonolith (3341 lines)internal/mcp/server.go)New Findings
1.
CosineSimilarityduplicated across 4 filesIdentical function copy-pasted in multiple packages. Any fix or optimization must be applied 4 times. Highest priority DELETE — extract to a shared
internal/mathutilor similar.2. Hardcoded CORS origins in
ws.goNot derived from config. Should be configurable.
3. Encoding agent constructor leaks a context
Creates a context in the constructor that gets replaced in
Start()— the original is never cancelled.4. 90+ entries in hardcoded heuristic filter lists
internal/agent/perception/heuristic.gohas static keyword/path lists that should be in config or learned from feedback data.5. Stale FTS5 Known Issue in CLAUDE.md
The FTS5 column mismatch is fixed in code but still listed as a known issue. Misleads future sessions.
6.
SearchByConceptsusesLIKE '%concept%'with ORScaling ceiling at ~5K memories. Should use proper FTS or a concept index.
Compounding Assets (invest further)
Cleverness Debt (highest risk)
encodeMemory()andfinalizeEncodedMemory()implement the same ~140-line finalization path independently. Changes to one won't propagate to the other.cleanupLoop()goroutine has no cancellation mechanism — runs forever even if the filter is GC'd.Scaling Ceilings
If the system gets 100x more usage/data:
SearchByConceptswith LIKE queries breaks first (~5K memories)SetMaxOpenConns(1)) serializes all reads tooAction Plan
AMPLIFY
DELETE (quick wins)
CosineSimilarityimplementations (~15 min)REPLACE (structural improvements)
persistEncodedMemory()to eliminate encoding duplication (~1 hour)store.Storeinto composable sub-interfaces (MemoryReader,MemoryWriter,AssociationStore,PatternStore, etc.)LIKE '%concept%'concept search with proper FTS or concept indexDEFER (fine for now)
main.gomonolith — annoying but functional