Repository navigation
Closed
Labels
enhancementNew feature or requestepic:memory-engineEpic: Memory engine core capabilitiespriority:lowFix when convenientscope:cliCLI and UXscope:coreCore engine worktype:featureNew feature
Milestone
Description
Motivation
GBrain's dream cycle includes runPhaseOrphans — detecting pages with no connections to anything else in the brain. Orphaned memories are low-value: they can't be reached via graph traversal, don't connect to related memories, and dilute recall quality.
Uteke has no concept of orphan detection. As memories accumulate, disconnected nodes reduce graph density and make recall noisier.
Proposal
Detect and report memories that have no edges (no relationships, no backlinks, no shared tags with other memories).
Depends on: #346 (edge table)
Orphan Criteria
A memory is considered "orphaned" if ALL of the following are true:
- No outgoing edges (no
references,supersedes, etc.) - No incoming edges (no
referenced_by) access_count == 0(never recalled)- Not pinned
- Below importance threshold (configurable, default: 0.3)
CLI Commands
# Find orphans
uteke orphans # list orphaned memories
uteke orphans --namespace work # scoped to namespace
uteke orphans --threshold 0.2 # custom importance threshold
# Interactive cleanup (prompts per orphan)
uteke orphans --cleanup # ask: forget / keep / tag / link
# Non-interactive bulk forget
uteke orphans --forget # forget all orphans (dangerous, --yes to confirm)Orphan Score
Each memory gets an orphan_score (0.0 - 1.0):
orphan_score = (1 - edge_density) * 0.4
+ (1 - access_frequency_normalized) * 0.3
+ (1 - importance) * 0.3
Score > 0.8 = strong orphan candidate. Score < 0.3 = well-connected.
Output Format
Found 12 orphaned memories (out of 847 total, 1.4%)
Score ID Type Created Content (truncated)
─────────────────────────────────────────────────────────────
0.94 a3f2... note 2026-03-01 "random thought about..."
0.91 b7e1... reference 2026-02-15 "https://example.com/..."
0.87 c9d4... fact 2026-01-30 "SQLite WAL mode..."
Scope
- Implement
find_orphans()function (SQL query using edge table + memory fields) - Calculate orphan_score per memory
- Add
uteke orphansCLI subcommand - Add
--cleanupinteractive mode (prompt per orphan) - Add
--forgetbulk mode (with safety confirmation) - Add orphan check to
uteke doctor - Tests: orphan detection, scoring, namespace scoping, cleanup safety
Non-Goals
- Auto-forgetting orphans without user confirmation (safety)
- LLM-based relevance assessment (pure heuristics)
- Orphan prevention at write time (just detection + cleanup)
Dependencies
- Requires feat: typed auto-edges — self-wiring knowledge graph on every remember() #346 (edge table) for edge-based orphan detection
References
- GBrain:
cycle.tsrunPhaseOrphans— nightly orphan detection - GBrain:
find_orphansoperation
Metadata
Metadata
Assignees
Labels
enhancementNew feature or requestepic:memory-engineEpic: Memory engine core capabilitiespriority:lowFix when convenientscope:cliCLI and UXscope:coreCore engine worktype:featureNew feature
Activity
fix(#351): fetch all orphan candidates before sort + truncate
fix(#351): differentiate access_count=0 vs 1 + clamp importance
fix(#351): exclude deprecated memories + clippy manual_range_contains
fix(#353): namespace-aware lint + exclude deprecated in orphan count
merge: resolve conflicts with develop (#389)
feat(#351): orphan detection — find disconnected memories (#389)
merge: resolve conflicts with develop (#390)
feat(#353): dream cycle — coordinated maintenance pipeline (#390)
feat(#351): orphan detection — find disconnected memories (#389)
feat(#353): dream cycle — coordinated maintenance pipeline (#390)