SkillAgentSearch skills...

Dreamgraph

An autonomous cognitive layer for software systems. It discovers, verifies, and resolves system-level insights through structured "dream cycles" via MCP.

Install / Use

/learn @mmethodz/Dreamgraph

README

<p align="center"> <img src="dreamgraph.jpeg" alt="DreamGraph - Autonomous Cognitive Layer" width="400" /> </p>

DreamGraph v5.2 — Autonomous Cognitive Layer for Software Systems

Traditional AI systems answer questions. DreamGraph reduces uncertainty over time — it finds, verifies, and resolves problems in your system autonomously.

A self-regulating AI cognitive layer that discovers, verifies, and resolves system-level insights through structured "dream cycles" — and now dreams adversarially, reasons causally, thinks temporally, narrates its own understanding, proposes concrete fixes, tunes its own thresholds, reacts to events, and writes its own autobiography.


Overview

DreamGraph is a cognitive layer for software systems that continuously discovers, verifies, and resolves problems using structured reasoning loops. It augments software development with:

  • Autonomous reasoning loops
  • Structured knowledge graphs
  • Evidence-based validation
  • Controlled speculative exploration ("dreaming")
  • Self-cleaning memory via decay and resolution
  • Adversarial security scanning (NIGHTMARE state)
  • Causal inference chains across dream history
  • Temporal pattern analysis with precognition and retrocognition
  • Multi-system dream federation for cross-project learning
  • System autobiography — narrative understanding, not just data
  • Intervention planning — from insight to concrete remediation
  • Runtime/APM awareness — embodied senses from live metrics
  • Metacognitive self-tuning — analyzes its own performance and adjusts thresholds
  • Event-driven dreaming — reactive cognition triggered by system changes
  • Continuous narrative — persistent, auto-accumulated system autobiography
  • Dream scheduling — policy-driven temporal orchestration for autonomous cognitive work

It is not a chatbot.

It is a thinking layer that sits on top of your codebase and continuously:

detect → analyze → verify → resolve → learn → forget

DreamGraph is an MCP (Model Context Protocol) server. It connects to any MCP-compatible client — Claude Desktop, VS Code Copilot, Cursor, Windsurf, or anything that speaks MCP — and gives AI agents a persistent, evolving knowledge graph of your system.


Key Concepts

Tensions

A tension is an unresolved question, inconsistency, or hypothesis.

Examples:

  • "Is this API route missing org scoping?"
  • "Does this workflow lack a required step?"
  • "Are these two features conceptually related?"

Tensions drive all cognition.

Dream Cycles

The system runs periodic "dream cycles" where it:

  • Explores relationships (analogy, gaps, symmetry, cross-domain, causal chains)
  • Generates candidate connections (edges)
  • Evaluates them through a normalization pipeline

Dreaming is isolated — it cannot modify reality.

Normalization (Truth Filter)

Every idea passes through strict evaluation:

  • Plausibility — does it make sense?
  • Evidence — is it grounded in code/data?
  • Contradiction — does it conflict with reality?

Results:

| Outcome | Meaning | |---|---| | validated | Promoted to the knowledge graph | | latent | Stored as speculative memory | | rejected | Discarded |

Evidence-Based Verification

The system does not rely on memory alone.

It can verify using:

  • Source code inspection
  • Database schema queries
  • Workflow definitions
  • Runtime metrics (OpenTelemetry / Prometheus)

This enables conclusions like:

"I checked the code and DB — this is correct / already fixed."

Tension Lifecycle

Tensions are not permanent. They:

  • Decay over time (urgency -0.02/cycle)
  • Expire via TTL (default 30 cycles)
  • Can be resolved with evidence
  • Are capped to maintain focus (max 50 active)
  • Can be turned into remediation plans with concrete fix steps

This prevents cognitive overload:

2033 tensions → 50 active → manageable focus

Speculative Memory

Not all ideas are immediately provable. The system retains latent hypotheses that:

  • May become valid later
  • Guide future exploration
  • Never pollute factual output

The Eleven Cognitive Capabilities

DreamGraph's cognitive engine provides eleven advanced features that take the system from "observant" to "truly intelligent."

1. Causal Reasoning Engine

Mines dream history for cause→effect inference chains. When Entity A changes, what happens downstream?

  • Discovers temporal correlations between tensions
  • Builds multi-hop causal chains with confidence scores
  • Identifies propagation hotspots — entities where changes cascade
  • Adds causal_replay as a new dream strategy

Tool: get_causal_insights

2. Adversarial Dreaming (NIGHTMARE State)

A fourth cognitive state — NIGHTMARE — where the system actively tries to break itself.

AWAKE → NIGHTMARE → AWAKE    (adversarial scan)
AWAKE → REM → NORMALIZING → AWAKE    (normal dream cycle)

Five adversarial scan strategies:

| Strategy | What it scans for | |---|---| | privilege_escalation | Missing role checks, broad admin scopes, open endpoints | | data_leak_path | Unprotected PII, cross-tenant data exposure, missing encryption | | injection_surface | Unsafe dynamic queries, unparameterized SQL, template injection | | missing_validation | Missing input validation, type coercion gaps, range violations | | broken_access_control | Missing RLS, org-scoping gaps, horizontal privilege escalation |

Produces threat edges with severity, CWE IDs, and blast radius. Results persist to a threat log.

Tool: nightmare_cycle Resource: dream://threats

3. Temporal Dreaming

Adds a time dimension to reasoning:

  • Tension trajectories — is urgency rising, falling, spiking, or stable?
  • Precognition — predicts future tensions based on trajectory extrapolation
  • Seasonal patterns — detects recurring cycles across domains
  • Retrocognition — finds past resolution patterns that match current tensions

Tool: get_temporal_insights

4. Multi-System Dream Federation

Enables cross-project learning by extracting anonymized architectural patterns:

  • Abstracts validated edges into transferable archetypes (e.g., "Service A calls Service B without retry logic")
  • Exports as portable exchange files
  • Imports archetypes from other DreamGraph instances
  • Deduplicates on import to prevent pollution

Tools: export_dream_archetypes, import_dream_archetypes Resource: dream://archetypes

5. Dream Narratives (System Autobiography)

Generates a coherent narrative of the system's evolving understanding — not a log, a story:

"I started by thinking catalog and cart were unrelated. After 8 cycles, I discovered they share an implicit session model. This led me to find that order management has no awareness of session expiry, which became my highest-urgency tension..."

Three depth levels:

| Depth | For whom | Detail level | |---|---|---| | executive | Stakeholders | 1-page summary with health assessment | | technical | Engineers | Detailed findings with entity references | | full | Deep analysis | Complete cycle-by-cycle narrative |

Tool: get_system_narrative

6. Intervention Engine

Bridges the gap from "awareness" to "remedy" by generating concrete remediation plans:

  • Ordered steps with file-level change descriptions
  • Test suggestions for each step
  • Effort estimates (trivial / small / medium / large)
  • ADR conflict checks — warns if a fix may violate an existing architectural decision
  • Predicted new tensions the fix might introduce

Plans are generated from the highest-urgency unresolved tensions.

Tool: get_remediation_plan

7. Embodied Senses (Runtime Awareness)

Connects DreamGraph to live runtime metrics — OpenTelemetry, Prometheus, or custom JSON endpoints:

  • Fetches and parses real-time performance data
  • Correlates runtime behavior with knowledge graph entities
  • Detects behavioral patterns: error cascades, co-occurrence, sequential usage
  • Generates runtime-informed tension signals

Gracefully degrades when no endpoint is configured.

Tool: query_runtime_metrics

8. Metacognitive Self-Tuning

DreamGraph analyses its own performance and recommends (or auto-applies) threshold adjustments — closing the feedback loop between dreaming and tuning.

Three analysis modes:

| Mode | What it measures | |---|---| | Strategy Performance | Per-strategy precision, recall, validation lag, consecutive zero-yield cycles, recommended budget weight | | Promotion Calibration | Actual validation rates per confidence bucket — reveals whether thresholds are too strict or too lenient | | Domain Decay Profiles | Per-domain optimal TTL and urgency decay based on historical resolution patterns |

Safety guarantees:

  • Hard min/max guards on all threshold adjustments (confidence never below 0.55 or above 0.90)
  • Auto-tuning is in-memory only — resets on restart, never persists to disk
  • Every action logged to data/meta_log.json with basis and old/new values

Tool: metacognitive_analysis Resource: dream://metacognition

9. Event-Driven Dreaming

Dream cycles are triggered on-demand, but the most valuable time to think is when something changes. The event router creates a reactive layer that classifies events, resolves affected entities, and recommends cognitive actions.

| Event Source | Trigger Condition | Cognitive Response | |---|---|---| | git_webhook | Push to configured branch | Scoped dream_cycle (strategy: tension_directed) | | ci_cd | Deploy failure | Scoped nightmare_cycle on deployment entities | | ci_cd | Deploy success | Scoped dream_cycle (strategy: gap_detection) | | runtime_anomaly | Error rate exceeds threshold | get_causal_insights + scoped dream_cycle | | tension_threshold | Tension urgency > 0.8 | Auto-trigger get_remediation_plan | | federation_import | Archetypes imported | Scoped dream_cycle (strat

View on GitHub
GitHub Stars10
CategoryDevelopment
Updated28m ago
Forks3

Languages

TypeScript

Security Score

95/100

Audited on Apr 4, 2026

No findings