Skip to main content

LLM-powered knowledge distillation loop for the Digital Me Living Knowledge Wiki.

Project description

@digital-me/dream-cycle

LLM-powered knowledge distillation loop for the Digital Me Living Knowledge Wiki.

Status: alpha — ported from the maintainer's prior personal setup; all migration phases landed.

What it does

The dream cycle is a nightly pipeline that turns raw inputs (chat transcripts, scratch notes, brain learnings) into curated, cross-linked wiki entries:

brain_learnings  →  compile  →  index  →  citations  →  crosslink
                                                ↓
                  consolidate  ←  drift_check  ←  lint

Each step uses either an LLM (via the OpenClaw gateway or directly against Gemini / OpenAI / Anthropic) or deterministic file operations.

Install

Requires Python ≥ 3.11. Only runtime dep: pyyaml.

Use a venv. Homebrew Python (and most modern Linux distros) ship as "externally-managed" per PEP 668 and reject system-wide pip install. The venv recipe works on every supported platform:

python3 -m venv ~/.venvs/dream-cycle
~/.venvs/dream-cycle/bin/pip install -e "<digital-me-os-repo>/packages/services/dream-cycle[dev]"
export PATH="$HOME/.venvs/dream-cycle/bin:$PATH"

Verify:

digital-me doctor          # the dream-cycle: * rows should all be OK
digital-me-dream-cycle --help

The pip install -e registers a digital-me-dream-cycle console script + makes dream_cycle importable. The @digital-me/cli runner also exposes it as digital-me dream-cycle [args] — see packages/cli/README.md.

If you really want to skip the venv (e.g. on a Linux CI runner without PEP 668), the bare pip install -e packages/services/dream-cycle[dev] still works there — digital-me doctor will tell you which install shape your Python actually supports.

Configuration

Dream-cycle reads config.yaml from your wiki root. Resolution order:

Setting Priority
Config file path --config-path$DIGITAL_ME_CONFIG_PATH<wiki_root>/config.yaml
Wiki root --wiki-root$DIGITAL_ME_WIKI_ROOT~/digital-me/
Brain DB (optional input) $DIGITAL_ME_BRAIN_DB~/.openclaw/data/task-orchestrator.db (graceful skip if missing)
Drift-check repo roots $DIGITAL_ME_DRIFT_CHECK_ROOTS (:-separated) → dream_cycle.drift_check_repo_roots in config → [wiki_root, $HOME]

Minimal config.yaml:

engine: standalone      # or "openclaw"
standalone:
  llm_provider: gemini
  llm_model: gemini-2.0-flash
  embedding_provider: gemini
  embedding_model: gemini-embedding-001
  api_key_env: GEMINI_API_KEY
sources: []
dream_cycle:
  schedule: "0 3 * * *"
  staleness_threshold_days: 30
  auto_archive: false
  # Optional: roots the drift-check step will scan for cited code.
  # Defaults to [wiki_root, $HOME] when omitted.
  drift_check_repo_roots:
    - ~/openclaw
    - ~/.claude

Run

# Full cycle (via the digital-me wrapper)
digital-me dream-cycle

# …or directly via the console script
digital-me-dream-cycle

# Skip the expensive LLM compile step
digital-me dream-cycle --no-compile

# Only process inbox files touched in the last day
digital-me dream-cycle --recent-days 1

# Use a different wiki root
digital-me dream-cycle --wiki-root /tmp/test-wiki

# All flags
digital-me dream-cycle --help

Scheduling

Pick whichever your system already uses:

  • launchd (macOS): write a .plist to ~/Library/LaunchAgents/ that runs digital-me-dream-cycle at the time in dream_cycle.schedule.
  • systemd (Linux): a .service + .timer pair pointing at the same console script.
  • cron: 0 3 * * * /path/to/digital-me-dream-cycle.
  • openclaw scheduler: load src/dream_cycle/workflow.json as a workflow template and let openclaw run it.

dream_cycle.schedule is validated at config load (standard 5-field cron, numeric only — named months/weekdays not supported). A bad expression fails fast with a clear error. The downstream scheduler (launchd / systemd / cron / openclaw) is what actually fires the schedule — dream-cycle just holds the string as the single source of truth so all your scheduling artifacts can be derived from it.

Tests

# From inside this package after `pip install -e .[dev]`:
pytest

# Or from anywhere with the venv on PATH:
pytest packages/services/dream-cycle/tests/

19 cases cover: every module imports clean, wiki-root + config-path resolution honors arg → env → default, brain_learnings gracefully skips when the DB is missing, and a full smoke pipeline runs against a tmp fixture wiki with no LLM calls.

Layout

src/dream_cycle/
  run.py                  entrypoint / orchestrator
  config.py               YAML loader, dataclasses, env resolvers
  engine.py               LLM/embedding abstraction (openclaw + standalone)
  compile.py              transcript → wiki extraction (LLM)
  consolidate.py          deduplicate / merge entries (LLM)
  drift_check.py          LLM citation-drift audit (configurable code roots)
  index.py                _INDEX.md / _STATS.md
  crosslink.py            _GRAPH.md cross-link generation
  citations.py            citation tracking from traces
  lint.py                 frontmatter / structure checks
  bundles.py              skill-bundle packaging
  brain_learnings.py      materialize learnings from brain MCP
  apply_taste.py          taste-skill application
  distill.py              distillation helpers
  backfill_types.py       backfill missing frontmatter type tags
  health_detector.py      per-entry health signals
  integrations/codex.py   write _INDEX.md → ~/.codex/CODEX.md
  workflow.json           openclaw workflow definition (one template, runs each step)

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

digital_me_dream_cycle-0.1.0.tar.gz (124.1 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

digital_me_dream_cycle-0.1.0-py3-none-any.whl (125.9 kB view details)

Uploaded Python 3

File details

Details for the file digital_me_dream_cycle-0.1.0.tar.gz.

File metadata

  • Download URL: digital_me_dream_cycle-0.1.0.tar.gz
  • Upload date:
  • Size: 124.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for digital_me_dream_cycle-0.1.0.tar.gz
Algorithm Hash digest
SHA256 faf89031ed6b43d41e27ff78e0216887336eb1bb42ab0775a5afb25ef4e6c08a
MD5 327de5bcb1103bb859493aaca0f390af
BLAKE2b-256 ba39f04c5686dc622ab84e9c909f1084c89c2d9ede3c68ef584311ec47ef86a0

See more details on using hashes here.

Provenance

The following attestation bundles were made for digital_me_dream_cycle-0.1.0.tar.gz:

Publisher: publish-dream-cycle.yml on Amyssjj/digital-me

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file digital_me_dream_cycle-0.1.0-py3-none-any.whl.

File metadata

File hashes

Hashes for digital_me_dream_cycle-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 c17a133772a1cf0760dfc37f26d3e009a2bd7a0346296f07fe77ca40cb1ad57f
MD5 b20bf0ec079aed5fda9f03a78b98466f
BLAKE2b-256 15ecc3913496b319ba69c5e13a09a8a5d6890f308e584a3b4c26098baa53c491

See more details on using hashes here.

Provenance

The following attestation bundles were made for digital_me_dream_cycle-0.1.0-py3-none-any.whl:

Publisher: publish-dream-cycle.yml on Amyssjj/digital-me

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page