Skip to content

get_causal_graph

Get the full causal network for a project as nodes and edges — ready for D3, Mermaid, or any graph visualization library.

Overview

get_causal_graph returns the complete causal relationship graph for a project. Each node is a context snapshot; each edge is a causal link (one context caused another). The output is structured for direct use with D3.js force graphs, Mermaid diagrams, or any graph tool that accepts a node/edge list.

Added: v3.5.0

Layer: Layer 1 (Causality Engine)

Purpose: Visualize decision lineage and causal relationships across a project


Parameters

ParameterTypeRequiredDescription
projectstringYesProject identifier
limitnumberNoMaximum contexts to include (default: 200)

Returns

A structured graph with nodes and edges:

json
{
  "nodes": [
    {
      "id": "ctx-abc123",
      "summary": "Decided to use PostgreSQL for the main database",
      "timestamp": "2026-05-10T14:30:00Z",
      "actionType": "decision",
      "memoryTier": "ARCHIVED"
    },
    {
      "id": "ctx-def456",
      "summary": "Created initial schema based on PostgreSQL decision",
      "timestamp": "2026-05-10T15:00:00Z",
      "actionType": "implementation",
      "memoryTier": "ARCHIVED"
    }
  ],
  "edges": [
    {
      "source": "ctx-abc123",
      "target": "ctx-def456",
      "type": "caused"
    }
  ]
}

Examples

Get Full Project Graph

typescript
get_causal_graph({ project: "api-service" })

Limit to Recent Contexts

typescript
get_causal_graph({ project: "api-service", limit: 50 })

Use Cases

Visualize Decision History

Feed the output directly into a D3.js force-directed graph to see how decisions cascaded through a project:

javascript
// D3 example
const { nodes, edges } = await wake.getCausalGraph({ project: "api-service" });
const simulation = d3.forceSimulation(nodes)
  .force("link", d3.forceLink(edges).id(d => d.id));

Generate a Mermaid Diagram

typescript
// Ask Claude to convert get_causal_graph output to Mermaid
get_causal_graph({ project: "my-project", limit: 20 })
// Then: "Convert this to a Mermaid graph diagram"

Architecture Audit

Identify root decisions (nodes with no incoming edges) that everything else depends on.


See Also