skills/agentic-dream-engine/SKILL.md
Extend the arifOS dream-engine so every AAA warga (333-AGI, 555-ASI, 888-APEX, A-AUDIT, A-ARCHIVE), OpenCode, and OpenClaw can autonomously consolidate memory without violating F1-F13.
npx skillsauth add ariffazil/openclaw-workspace Agentic Dream Engine — Federation Memory ConsolidationInstall this skill globally with one command. Works with Claude Code, Cursor, and Windsurf.
3 of 9 scanners reported clean
Some scanners were skipped, did not run, or reported a non-clean status. Review each row below.
Before using this skill on any mutating, irreversible, or high-blast-radius task:
The existing dream-engine (/root/HERMES/skills/dream-engine/) is a single-organ, single-cadence nightly batch that consolidates the last 24 hours of memory_records into canon. It is an entropy pump, not a phenomenology claim (F9).
This skill extends that engine into a federation protocol: every AAA warga agent, plus OpenCode and OpenClaw, can run its own dream cycle, but all canon promotions route through the same constitutional gates:
actor_id = agent, source_ref.ratified_by = Arif)memory_records + memory_audit_log write patharif_seal with human ack or 888_JUDGE verdict.The dream-engine is not a metaphor. It is a thermodynamic necessity for any agent whose substrate does not consolidate on its own. The cron is the price of statelessness. The LLM is the price of scale. The threshold is the price of sovereignty.
Extended corollary for multi-agent federation:
Each agent has its own entropy pump, but all pumps drain into the same canonical reservoir. The reservoir has one lock: F13.
| Function | Biology analog | Engineering analog | Current owner | Federation extension | |----------|---------------|-------------------|---------------|----------------------| | Replay | Hippocampal reactivation | Pull recent episodic memory | dream-engine stage1 | Each agent replays its own trajectory store | | Cluster | Sharp-wave ripple binding | Cosine grouping | dream-engine stage2 | Agent-local + federation cross-agent cluster | | Synthesize | Gist extraction | LLM compression to falsifiable statement | dream-engine stage3 | Per-agent + cross-warga synthesis | | Defend + Seal | Counterfactual threat rehearsal | Counterfactual challenge before canon write | dream-engine stage4 + rehearse.py | Centralized via arifOS kernel | | Recombine | Creative interleaving (Kekulé/Mendeleev) | Cross-organ graph walk | dream-engine recombine.py | Weekly cross-warga pattern detection |
Two valid ways to talk about the 6-layer stack:
| Layer | Cognitive framing (intelligence ladder) | Canonical substrate framing (arifOS memory skill) |
|-------|----------------------------------------|---------------------------------------------------|
| L1 | Working context | Redis ephemeral |
| L2 | Short-term/episodic | Redis session / raw logs |
| L3 | Semantic/facts | Qdrant vector space |
| L4 | Procedural/skills | Postgres memory_records + memory_store |
| L5 | Constitutional/values | Graphiti/FalkorDB relational graph |
| L6 | Core identity/legacy | VAULT999 immutable ledger |
Important: The canonical substrate mapping is the source of truth for implementation. The cognitive framing is useful for reasoning about what each layer does, but code must use the substrate names (Redis, Qdrant, Postgres, Graphiti, VAULT999) to avoid deployment drift.
scripts/entropy_controller.py computes five entropy proxies (P1–P5) and proposes cadence/threshold changes. It does not enforce a hard ΔS < -ε bound. The controller is an advisory instrument; the actual entropy reduction happens when low-signal singletons are excluded and clusters are compressed into canon. Any claim that the controller enforces a numeric epsilon should be treated as a documentation/interpretation error unless a future F13-ratified patch adds it.
Every agent that dreams runs a loop:
REPLAY → pull agent-local episodic buffer (24h)
CLUSTER → group by semantic similarity
SYNTHESIZE → produce candidate canonical statements
PROPOSE → emit tier_up_eligible candidates
Agents do not seal their own canon. They propose.
Proposals are collected by the arifOS dream-engine coordinator (the existing nightly cron, extended). It:
rehearse.py).memory_records + memory_audit_log with:
actor_id = <agent>:<dream-cycle>source_ref.ratified_by = arif-fazilsource_ref.ratified_floors = [F7_threshold, F8_reversibility, F11_auth, F13_cap]Weekly, the federation recombiner reads L5 (Graphiti/FalkorDB) for entities shared across warga agents and proposes cross-agent patterns. These also route through the seal gate.
OpenCode already has auto-dream.ts (/root/mimocode/packages/opencode/src/session/auto-dream.ts) which consolidates project memory every 7 days and auto-distills every 30 days.
| OpenCode concept | Federation mapping | Gap |
|------------------|-------------------|-----|
| AUTO_DREAM_TITLE session | Local replay + cluster + synthesis | Not yet writing to arifOS L4 |
| AUTO_DISTILL_TITLE session | Pattern packaging into skills | Should produce canon candidates, not just skills |
| Config.dream.interval_days | Agent-local cadence | Must also respect federation global cadence/cap |
Recommended wiring: OpenCode's dream cycle should emit a dream_proposal.jsonl to a known federation inbox (/var/spool/arifos/dream-proposals/opencode/ or Supabase staging table). The nightly coordinator ingests it.
OpenClaw is the AGI gateway; its dream cycle is a sleep-time compute daemon that metabolizes idle hours.
| Stage | Function | Reversibility Mechanism |
|-------|----------|------------------------|
| 1. State Monitor | Detect idle (t_idle > 120 min or scheduled nightly window); acquire L1 mutex | Suspends immediately on 888 activity |
| 2. L2 Ingress & Entropy Sorting | Pull raw L2 traces; cluster semantically; drop noise | Read-only on primary stores |
| 3. Offline EMD Metabolizer | Gist extraction + anticipatory reasoning trees | Output stays in shadow partition |
| 4. Shadow Commit & Seal | Write compressed gist to L3_shadow; cryptographic hash; morning briefing handshake | Single-command purge or merge |
L3/L4 during an unsupervised cycle. Always shadow-first.| Option | Mechanism | Pros | Cons | Recommendation | |--------|-----------|------|------|----------------| | A — Chronological | Fixed nightly window (e.g., 03:00 MYT) | Predictable cost; guaranteed morning briefing | Wasted compute on light days; may clash with late sessions | Prototype | | B — Saturation | Trigger when L2 token/complexity threshold crossed | Compute-efficient; dreams only when material exists | Unpredictable timing; may miss briefings | Phase 2 |
Prototype files: see /root/AAA/skills/agentic-dream-engine/prototype/.
| Warga | Dream content | Output | |-------|--------------|--------| | 333-AGI | Code forge receipts, plan DAGs, test results | Engineering canon | | 555-ASI | Memory synthesis, ethical critiques, cross-agent patterns | Memory + dignity canon | | 888-APEX | Verdict patterns, floor violations, seal chains | Governance canon | | A-AUDIT | Anomaly patterns, drift signals | Audit canon | | A-ARCHIVE | Vault chain topology, seal topology | Archive canon |
| Floor | Requirement | Current Status |
|-------|-------------|----------------|
| F1 AMANAH | Proposals only; no agent self-seals. Rollback = DELETE FROM memory_records WHERE actor_id = '<agent>:<cycle>'. Add pre-seal snapshot of memory_records + memory_audit_log state so hallucinated L3/L4 writes can be reverted cleanly. | Partial — additive writes exist, but snapshot rollback is missing |
| F2 TRUTH | Every canonical statement is falsifiable and carries a counterfactual. Add explicit tri-witness cross-check before seal (human/AI/earth or second-agent verifier). | Partial — counterfactual is generated, but no independent witness validates offline replay |
| F4 CLARITY | One candidate = one cluster = one proposition. No noise promotion. | Aligned |
| F7 HUMILITY | synthesis_score ≥ 0.65 is F13-locked; no agent overrides. | Aligned |
| F8 LAW | Agent boundaries enforced via arifOS lease + A2A auth. | Aligned for Hermes; gaps for OpenCode/OpenClaw/warga |
| F9 ANTIHANTU | Logs are process descriptions, never "I dreamed". | Aligned |
| F11 AUTH | Every write has actor_id, session_id, and memory_audit_log row. | Aligned |
| F13 SOVEREIGN | Threshold, daily cap, and cadence changes require Arif's explicit ratification. | Aligned |
| ID | Gap | Severity | Owner | 888_HOLD gate |
|----|-----|----------|-------|---------------|
| G1 | No pre-seal L3/L4 snapshot for clean rollback | High | dream-engine | Before Phase 0 execution |
| G2 | Offline replay lacks independent F2 witness before seal | Medium | dream-engine stage4 | Before Phase 1 federation inbox |
| G3 | OpenCode auto-dream does not write to federation canon | High | OpenCode / AAA | Phase 1 ratification |
| G4 | OpenClaw and AAA warga have no dream cycle | High | AAA / OpenClaw | Phase 2 design |
| G5 | entropy_controller.py computes proxies but does not enforce a hard ΔS < -ε | Clarification | dream-engine | Document, do not change without F13 |
| G6 | arifOS + WEALTH degraded; global recombine unsafe | Blocker | ops | Phase 0 repair |
Current verified state: Stages 1-4 run nightly at 04:00 MYT, entropy is reducing, and Vault999 seals are locking. arifOS and WEALTH systemd services are active, though MCP organ attestation flags them DEGRADED (probe issue).
Pivot: Phase 2 counterfactual rehearsal is the real unbuilt learning engine. Phase 1/3 speculative vectors (Letta sleep-time compute, RL weight updates) are dropped per F2 evidence.
Goal: Make cross-organ consolidation safe before expanding scope.
Deliverables:
consolidate.py Supabase drift: it queries arifosmcp_memory_records.id which does not exist; align with memory_records.memory_id.entropy_controller.py R6 vault read error: 'str' object has no attribute 'get'.memory_records + memory_audit_log state for rollback.888_HOLD gate: Arif clears kernel stability + snapshot policy.
Goal: Implement the real learning engine: weekly stress-testing of sealed rules.
Deliverables:
stage5_rehearse.py — weekly random sample of 10-20% of recent sealed rules.stress_tested: true).alerts.jsonl, never auto-amend.arif-dream-phase2.timer (Sunday 02:00 MYT).888_HOLD gate: Deployment of systemd timer + weekly rehearsal policy.
Goal: Let OpenCode's existing auto-dream feed arifOS canon.
Deliverables:
dream_proposals staging table in Supabase (or filesystem spool).auto-dream.ts extended to emit dream_proposal.jsonl.888_HOLD gate: Schema + global cap policy ratification.
Goal: Federation discovers cross-agent patterns no single agent sees.
Deliverables:
888_HOLD gate: Any cross-agent policy change.
## Skill Result: agentic-dream-engine
### Summary
One-paragraph summary of the federation dream design.
### Evidence
- Current dream-engine path: /root/HERMES/skills/dream-engine/
- OpenCode auto-dream: /root/mimocode/packages/opencode/src/session/auto-dream.ts
- Memory schema: /root/arifOS/arifosmcp/migrations/001_memory_schema.sql
### Recommendations
- Implement Phase 1 inbox for OpenCode.
- Extend entropy controller with per-agent proxies.
### Escalations
- F13 ratification needed for threshold/cap/cadence changes.
/root/HERMES/skills/dream-engine/SKILL.md — existing nightly engine/root/docs/DREAM_ENGINE_SPEC.md — entropy proxy spec/root/arifOS/arifosmcp/migrations/001_memory_schema.sql — canonical memory schemaarXiv:2606.03979 — Behrouz et al., Language Models Need SleepPMC3079906 — Wamsley & Stickgold, Memory, Sleep and Dreaming: Experiencing ConsolidationarXiv:2504.13171 — Letta team, Sleep-time ComputeForged: 2026-06-16 by FORGE (000Ω) — DITEMPA BUKAN DIBERI
development
Federation-wide gold (XAUUSD) trading capability. Python stack, OANDA broker, backtesting, macro signals, RSI strategy. Every organ has a role.
development
Capital claim state management — tracks claim lifecycle across WEALTH organ.
development
Archived constitutional warga placeholder retained only for audit provenance. Do not use for active work; use the live arifOS governance and constitutional skills instead.
testing
Warga (citizen) agent skills for AAA federation members. See subdirectories for specialized warga skills.