> ## Documentation Index
> Fetch the complete documentation index at: https://desme.mintlify.site/llms.txt
> Use this file to discover all available pages before exploring further.

# Session Format

> Reference for the JSON session file format used by dbgflow to capture execution graphs and events.

A session file is a JSON file that dbgflow writes after capturing a run. It encodes the full execution graph — nodes representing functions, types, and tests; edges representing relationships between them; and a chronological list of events that occurred during execution. The UI reads this file to render the graph and replay your program's behavior.

## Top-level fields

**title** `string` *required*

Human-readable session title shown in the UI header.

**nodes** `Node[]` *required*

Array of graph nodes. Each node represents a function, type, or test in your codebase.

**edges** `Edge[]` *required*

Array of directed edges connecting nodes. Edges describe how nodes relate to each other.

**events** `Event[]` *required*

Ordered list of events captured during execution, sorted by sequence number.

***

## Node object

A node represents a named entity in your codebase: a function, a type definition, or a test.

**id** `string` *required*

Unique identifier for this node within the session. Referenced by edges and events.

**label** `string` *required*

Display name shown in the graph UI, typically the short function or type name.

**kind** `string` *required*

The category of this node. One of `function`, `type`, or `test`. See [Node kinds](#node-kinds) below.

**module\_path** `string` *required*

Fully-qualified Rust module path, e.g. `my_crate::pipeline::transform`.

**file** `string` *required*

Source file path relative to the workspace root.

**line** `number` *required*

Line number where this entity is defined.

**source** `string`

Optional snippet of the source code for this entity. May be `null` if source extraction was not enabled.

### Node kinds

| Kind | Description |
| - | - |
| `function` | A regular Rust function instrumented with dbgflow. |
| `type` | A struct, enum, or trait relevant to the captured execution. |
| `test` | A test function annotated with `#[dbg_test]`. |

***

## Edge object

An edge is a directed connection between two nodes. Edges describe control flow, data dependencies, or test relationships.

**from** `string` *required*

The `id` of the source node.

**to** `string` *required*

The `id` of the destination node.

**kind** `string` *required*

The type of relationship. One of `control_flow`, `data_flow`, or `test_link`. See [Edge kinds](#edge-kinds) below.

**label** `string`

Optional human-readable label displayed on the edge in the graph UI.

### Edge kinds

| Kind | Description |
| - | - |
| `control_flow` | One function calls another during execution. |
| `data_flow` | A value produced by one node is consumed by another. |
| `test_link` | A test node exercises the linked function or type node. |

***

## Event object

Events are the timestamped record of what happened during execution. They are listed in order by `seq` and drive the replay timeline in the UI.

**seq** `number` *required*

Monotonically increasing sequence number. Used to order events during replay.

**call\_id** `number`

Unique identifier for a specific function invocation. Allows the UI to correlate `function_enter` and `function_exit` events for the same call. May be `null` for non-call events.

**parent\_call\_id** `number`

The `call_id` of the caller. Used to reconstruct the call stack. May be `null` for top-level calls.

**node\_id** `string` *required*

The `id` of the node this event is associated with.

**kind** `string` *required*

The type of event. See [Event kinds](#event-kinds) below.

**title** `string` *required*

Short description of the event shown in the timeline, e.g. `"enter process_batch"`.

**values** `ValueSlot[]` *required*

Captured variable snapshots at the time of this event. May be an empty array.

### Event kinds

| Kind | Description |
| - | - |
| `function_enter` | A function call started. `values` contains argument snapshots. |
| `function_exit` | A function call returned. `values` may contain the return value. |
| `value_snapshot` | A mid-execution snapshot of one or more values at an instrumented point. |
| `test_started` | A `#[dbg_test]` test began execution. |
| `test_passed` | A `#[dbg_test]` test completed successfully. |
| `test_failed` | A `#[dbg_test]` test failed. `title` includes the failure message. |

***

## ValueSlot object

A `ValueSlot` is a named, captured value at a point in execution.

**name** `string` *required*

The variable or parameter name, e.g. `"input"` or `"return"`.

**preview** `string` *required*

A string rendering of the value using Rust's `Debug` formatter (`{:?}`). This is a plain string, not structured data.

> [!NOTE]
>
> `preview` values are produced by `Debug` formatting. If a type does not implement `Debug`, dbgflow cannot capture a preview for it and the field will reflect that limitation.

***

## Minimal example

The following is a minimal valid session file with one node and two events representing a single function call.

```json theme={null}
{
  "title": "Example session",
  "nodes": [
    {
      "id": "node_1",
      "label": "add",
      "kind": "function",
      "module_path": "my_crate::math",
      "file": "src/math.rs",
      "line": 12,
      "source": "pub fn add(a: i32, b: i32) -> i32 { a + b }"
    }
  ],
  "edges": [],
  "events": [
    {
      "seq": 1,
      "call_id": 1,
      "parent_call_id": null,
      "node_id": "node_1",
      "kind": "function_enter",
      "title": "enter add",
      "values": [
        { "name": "a", "preview": "3" },
        { "name": "b", "preview": "7" }
      ]
    },
    {
      "seq": 2,
      "call_id": 1,
      "parent_call_id": null,
      "node_id": "node_1",
      "kind": "function_exit",
      "title": "exit add",
      "values": [
        { "name": "return", "preview": "10" }
      ]
    }
  ]
}
```

***

## Multi-pipeline sessions

You can merge multiple session files from a directory to produce a combined view across parallel pipelines or independent runs. dbgflow reads all `.json` session files in a given directory and merges their nodes, edges, and events into a single unified graph.

> [!NOTE]
>
> When merging sessions from a directory, dbgflow automatically re-namespaces all node IDs, edge references, and event sequence numbers so there are no collisions between sessions.


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.