Skip to main content

Daydream

PyPI version Python 3.11+ License

Daydream (daydream-rsi) is a model-agnostic, three-timescale sleep-time compute & Recursive Self-Improvement (RSI) sidecar proxy for self-hosted LLMs (vLLM, SGLang, llama.cpp, or any OpenAI/Anthropic-compatible inference server).

Instead of training fragile weight updates on unverified self-outputs, Daydream separates adaptation across three timescales, each protected by strict verification gates:

Daydream demo

                       ┌─────────────────────────────────────────────┐
  OpenAI / Anthropic   │             Daydream RSI Proxy              │   Upstream vLLM / SGLang
   Clients / Agents ──▶│  1. Fast Loop:  GPU Steering Policy (<5ms)  │──▶ (Base Model + Hot LoRA)
                       │  2. Med Loop:   BM25 Verified Skill Memory  │
                       │  3. Slow Loop:  Active LoRA + Verifier API  │
                       └──────────────────────┬──────────────────────┘
                                              │ trajectories + /daydream/feedback
                                              ▼
                       ┌─────────────────────────────────────────────┐
                       │         Sleep Consolidation Cycle           │
                       │  • Counterfactual multi-effort dreaming     │
                       │  • Pareto-gated Steering Policy promotion   │
                       │  • Contrastive Verified Skill distillation  │
                       │  • Anti-collapse Verified LoRA SFT export   │
                       └─────────────────────────────────────────────┘

Set Up With Your Agent

Paste this into Claude Code (or any coding agent) to wire Daydream in front of your existing model server automatically:

Install daydream-rsi (pip install daydream-rsi), inspect how my local LLM server is currently run (vLLM / SGLang / llama.cpp / Docker / systemd / k8s), add daydream serve as a sidecar proxy in front of it on port 8105 without breaking existing clients, verify /health returns 200, and schedule daydream sleep to run nightly against the same --state-dir.

Try It in 30 Seconds (No GPU Required)

pip install daydream-rsi
daydream demo

daydream demo spins up an in-process mock upstream server and live proxy to walk through all three loops — neural effort steering, BM25 verified skill injection, /daydream/feedback coverage attribution, and SkillDuet context-distilled LoRA dataset export — right on your CPU.

The Three-Timescale Architecture

Timescale Loop Mechanism Guardrail
Fast (per-turn / hours) daydream.steering Compact GPU neural policy (~2.79M params, blake2b hash embeddings + multi-scale GLU Conv1D + 24 structural features) predicts per-turn reasoning effort (nothink / low / medium / xhigh), tool-call intent, and risk score. Strict held-out Pareto promotion gate + risk-threshold calibration; zero base-model weight edits.
Medium (daily / sleep) daydream.memory Falsification-gated skill distillation (contrastive dreams + deviation mining), SkillPlumber instruction-level coverage attribution (followed / ignored / uncovered), SIM/HMED hindsight meta-memory, SkillAdam volatility edit budgets, EvoDisco 4-op consolidation (abstract / refine / bridge / reframe), and BM25 + UCB1 + Hebbian retrieval. Replay falsification gate, injection/overfitting filters, volatility freeze, automatic rollback logged to meta-memory, and deactivation on repeated losses. Portable across base-model upgrades.
Slow (nightly / milestone) daydream.lora Curates strictly verified winning pairs (score >= 0.90, TTR collapse-filtered) with SkillDuet context distillation (strips injected skills from prompts so LoRA internalizes them with zero token overhead) and ReSAIL anchor replay buffer; includes trainability preflight (daydream lora probe), assistant-masked PEFT/QLoRA training, and vLLM hot-swapping. Trainability preflight, minimum dataset size, minimum target accuracy gain, held-out regression ceiling, and immutable anchor replay floor.

Quick Start

pip install daydream-rsi

# 1. Start the Daydream proxy in front of your vLLM / SGLang server
daydream serve \
  --upstream http://localhost:8000 \
  --port 8105 \
  --state-dir ./state \
  --device auto

# 2. Check live health, device, active policy generation, and skill count
curl -s http://localhost:8105/health | jq .

# 3. Run a sleep consolidation cycle (can be scheduled via cron or k8s CronJob)
daydream sleep \
  --upstream http://localhost:8000/v1 \
  --model your-model-name \
  --state-dir ./state \
  --device auto

HTTP Endpoints & Headers

  • Proxied APIs: /v1/chat/completions, /chat/completions, /v1/messages, /messages (streaming & non-streaming), plus transparent passthrough for all other paths.
  • Health, plasticity & telemetry: GET /health, GET /daydream/health, and GET /daydream/stats (exposes GPU decide latency, operator bandit stats, and Agent Plasticity metrics).
  • Verified memory inspection: GET /daydream/memory.
  • External verifier feedback: POST /daydream/feedback — feed test-runner / linter / user verification outcomes so Loop 2 updates skill confidence and Loop 3 collects verified SFT pairs.
  • Per-request overrides:
    • x-daydream-effort: nothink|low|medium|xhigh — override neural effort steering for a single request.
    • x-daydream-memory: off — disable skill-memory injection for a single request.
    • x-daydream-lora: <adapter-name> — route a single request to a loaded vLLM LoRA adapter.

Docker & Kubernetes

  • Build the GPU-enabled container image:
    docker build -f docker/Dockerfile -t daydream-rsi:latest .
    
  • See deploy/k8s/daydream.yaml for a reference Kubernetes Service, Deployment, and 6-hour sleep CronJob manifest.
  • See docs/architecture.md for full design details, promotion gates, and security notes.

Development

pip install -e ".[dev]"
pytest -v
ruff check src tests

License

Apache License 2.0 — see LICENSE.

Metadata

Release files for daydream-rsi 0.3.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for daydream-rsi 0.3.0
File Size Uploaded Provenance Actions
daydream_rsi-0.3.0.tar.gz 314.8 kB Without provenance Details for daydream_rsi-0.3.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for daydream-rsi 0.3.0
File Interpreter ABI Platform Actions
daydream_rsi-0.3.0-py3-none-any.whl Python 3 none any Details for daydream_rsi-0.3.0-py3-none-any.whl

Total release size: 393.8 kB

Release files / daydream_rsi-0.3.0.tar.gz

Download URL daydream_rsi-0.3.0.tar.gz
Size 314.8 kB
Tags Source
SHA-256 checksum
How to use checksums
59b106b90af6bc125f31fca2919c47b609a9097e032921f9f11a2277389c38ff
BLAKE2b-256 checksum
How to use checksums
aaa65b58ebdd027ab2ebca86256dc4a659007c48767453b811abdc6e3c081586
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.12.8

Release files / daydream_rsi-0.3.0-py3-none-any.whl

Download URL daydream_rsi-0.3.0-py3-none-any.whl
Size 79.0 kB
Tags Python 3
SHA-256 checksum
How to use checksums
7fcb3e2ddf0d25ca17d68748c0b21cffc2939c103fd34c6b69e6a2c2c2653a09
BLAKE2b-256 checksum
How to use checksums
652fdc9d8ba7c7e5daedb8337be768dfe86099044f3d219e8c572ae794ce31b8
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.12.8

Security for daydream-rsi 0.3.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

0.3.0 This release

2 release files No provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page