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 runs a "dream cycle" overnight: a multi-phase pipeline that syncs, lints, fixes backlinks, extracts entities, embeds new pages, purges deleted, and detects orphans. It keeps the brain healthy without manual intervention.
Uteke has individual maintenance commands (doctor, consolidate, prune, aging) but no way to run them as a coordinated pipeline. Users have to manually run each step.
Proposal
Add uteke dream — a single command that runs all maintenance phases in dependency order, all local, zero LLM.
Pipeline Phases
uteke dream
│
├─ Phase 1: Lint — check for missing sources, invalid types, broken refs
├─ Phase 2: Backlinks — rebuild bidirectional edges (#350)
├─ Phase 3: Dedup — find & merge near-duplicate memories (existing consolidate)
├─ Phase 4: Orphans — detect & report orphaned memories (#351)
├─ Phase 5: Compact — run aging cleanup, prune cold memories (existing)
├─ Phase 6: Verify — schema integrity check (existing doctor)
│
└─ Report: Summary of what changed per phase
Output Example
🌙 Uteke Dream Cycle — 2026-06-14T12:00:00+07:00
═══════════════════════════════════════════════════
Phase 1: Lint
✓ 847 memories checked
⚠ 3 missing sources (run: uteke audit sources --missing)
Phase 2: Backlinks
✓ 156 edges verified
+ 12 backlinks created (from #350)
Phase 3: Dedup
✓ 2 near-duplicates found and merged
Phase 4: Orphans
⚠ 8 orphaned memories detected (run: uteke orphans)
Phase 5: Compact
✓ 0 memories pruned (0 cold)
✓ aging tiers: 847 hot, 0 warm, 0 cold
Phase 6: Verify
✓ Schema version 5 OK
✓ Index integrity OK
───────────────────────────────────────────────────
Total: 14 changes | 5 warnings | 0 errors
Duration: 1.2s
Phase Control
# Run all phases (default)
uteke dream
# Run specific phases only
uteke dream --phases lint,dedup
# Dry run (report only, no changes)
uteke dream --dry-run
# Skip phases
uteke dream --skip orphansCron-Friendly
# Run via cron daily at 3am
0 3 * * * /usr/local/bin/uteke dream --quiet >> ~/.uteke/dream.log 2>&1--quiet mode outputs only warnings/errors, exits non-zero if any errors found (for monitoring).
Scope
- Define
DreamPhaseenum and pipeline orchestrator - Implement lint phase (source check, type validation, broken refs)
- Integrate existing consolidate as dedup phase
- Integrate existing aging/prune as compact phase
- Integrate existing doctor as verify phase
- Integrate feat: backlink auto-generation — bidirectional links on memory references #350 (backlinks) and feat: orphan detection — find disconnected memories in the graph #351 (orphans) when available
- Add
uteke dreamCLI command with--phases,--skip,--dry-run,--quietflags - Structured output (human + JSON via
--json) - Tests: phase ordering, dry-run safety, partial execution, idempotency
Non-Goals
- LLM-based consolidation (existing deterministic consolidate only)
- Sleep scheduling / background daemon (manual/cron trigger only)
- Report email/notification (just CLI output + log file)
- Phase parallelization (sequential is fine for local scale)
Dependencies
- Works standalone (uses existing commands for most phases)
- Enhanced when feat: backlink auto-generation — bidirectional links on memory references #350 (backlinks) and feat: orphan detection — find disconnected memories in the graph #351 (orphans) are merged — those phases become richer
References
- GBrain:
cycle.ts(102K LOC) — full dream cycle implementation - GBrain:
runPhaseLint,runPhaseBacklinks,runPhaseEmbed,runPhasePurge,runPhaseOrphans - Current:
uteke doctor,uteke consolidate,uteke prune,uteke aging— scattered, no coordination
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(#353): don't abort dream on phase error + lint via SQL
fix(#353): error on invalid phase + namespace-aware orphans + propaga…
fix(#353): namespace-aware lint + exclude deprecated in orphan count
fix(#353): dedup phase returns Warning status when duplicates found
docs(#353): document namespace scope and dry-run semantics
fix(#353): canonical phase order + dedup
fix(#353): compact phase shows 'would be pruned' in dry-run
feat(#351): orphan detection — find disconnected memories (#389)
merge: resolve conflicts with develop (#390)
feat(codecoradev#353): dream cycle — coordinated maintenance pipeline (…
feat(#351): orphan detection — find disconnected memories (#389)
feat(#353): dream cycle — coordinated maintenance pipeline (#390)