Skip to content

feat: dream cycle — automated local maintenance pipeline (lint → backlinks → dedup → orphans) #353

Closed

Description

@ajianaz

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 orphans

Cron-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

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

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

Activity

  1. added this to the milestone on Jun 14, 2026
  2. added
    enhancement
    scope:core
    scope:cli
    type:feature
    priority:low
    epic:memory-engine
    on Jun 14, 2026
  3. modified the milestones: , v0.2.1 — DX & Ecosystem on Jun 14, 2026
  4. added 9 commits that reference this issue on Jun 19, 2026
  5. added a commit that references this issue on Jul 2, 2026
  6. added 2 commits that reference this issue on Aug 13, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementepic:memory-enginepriority:lowscope:cliscope:coretype:feature

    Type

    No type

    Projects

    No projects

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions