# luo-root/pulse architecture

> Architecture diagram of the GitHub repository luo-root/pulse, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-10-15). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/luo-root/pulse
- Repository: https://github.com/luo-root/pulse

## Overview

Pulse is an embeddable Go library for defining and running data-driven workflows in-process. The principal path is to define a graph and its nodes, provide inputs, start and wait for an execution, then read declared outputs. Major branches include reusable subgraphs, streams, checkpoint integration, YAML assembly and analysis, and execution observability. Relationships use README-documented behavior; source excerpts are partial, so some internal wiring is not represented.

Main entry points: [`graph.go`](https://github.com/luo-root/pulse/blob/main/graph.go) (Graph definition), [`execution.go`](https://github.com/luo-root/pulse/blob/main/execution.go) (Execution lifecycle), [`observe/record.go`](https://github.com/luo-root/pulse/blob/main/observe/record.go) (Structured records), [`node.go`](https://github.com/luo-root/pulse/blob/main/node.go) (Workflow nodes)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_engine["Workflow engine"]
  node_keys["Typed keys<br/>[key.go]"]
  node_inputs["Run inputs<br/>[inputs.go]"]
  node_nodes["Workflow nodes<br/>[node.go]"]
  node_aspects["Retry and timeout<br/>[aspect.go]"]
  node_graph["Graph definition<br/>[graph.go]"]
  node_execution["Execution lifecycle<br/>[execution.go]"]
  node_run["Run orchestration<br/>[execution_run.go]"]
  node_outputs["Output reads<br/>[inputs.go]"]
  node_problems["Run problems<br/>[problems.go]"]
  node_snapshot["Run snapshot<br/>[snapshot.go]"]
  node_checkpoint["Checkpoint bridge<br/>[checkpoint_run.go]"]
end

subgraph group_composition["Composition"]
  node_subgraphs["Reusable subgraphs<br/>[sub.go]"]
  node_streams["Stream processing<br/>[stream.go]"]
  node_topology["Topology view<br/>[topology.go]"]
  node_mermaid["Mermaid rendering<br/>[mermaid.go]"]
end

subgraph group_interfaces["Assembly and analysis"]
  node_yaml_load["YAML assembly<br/>[load.go]"]
  node_yaml_subgraph["YAML subgraphs<br/>[subgraph.go]"]
  node_yaml_analyze["YAML analysis<br/>[analyze.go]"]
end

subgraph group_observability["Observability"]
  node_observer["Observer events<br/>[observer.go]"]
  node_record_observer["Record adapter<br/>[graph_record.go]"]
  node_records["Structured records<br/>[record.go]"]
  node_line_sink["Line sink<br/>[linelog.go]"]
  node_async_sink["Async sink<br/>[async.go]"]
end

node_developer(("Application developer"))
node_custom_sink["Custom sink"]

node_developer -->|"defines"| node_graph
node_developer -->|"provides"| node_inputs
node_graph -->|"registers"| node_nodes
node_nodes -->|"declares data"| node_keys
node_nodes -->|"uses policies"| node_aspects
node_graph -->|"creates execution"| node_execution
node_inputs -->|"seeds"| node_execution
node_execution -->|"starts and waits"| node_run
node_run -->|"enables reads"| node_outputs
node_execution -->|"reports failures"| node_problems
node_execution -->|"exposes state"| node_snapshot
node_execution -->|"supports bridge"| node_checkpoint
node_graph -->|"mounts"| node_subgraphs
node_graph -->|"supports"| node_streams
node_graph -->|"exposes structure"| node_topology
node_topology -.->|"renders"| node_mermaid
node_developer -->|"loads workflow"| node_yaml_load
node_yaml_load -->|"assembles"| node_graph
node_yaml_load -.->|"assembles subgraphs"| node_yaml_subgraph
node_developer -->|"analyzes workflow"| node_yaml_analyze
node_yaml_analyze -.->|"returns structure"| node_topology
node_execution -->|"emits events"| node_observer
node_observer -->|"adapts events"| node_record_observer
node_record_observer -->|"creates records"| node_records
node_records -->|"writes lines"| node_line_sink
node_records -.->|"queues records"| node_async_sink
node_records -->|"exports records"| node_custom_sink

click node_keys "https://github.com/luo-root/pulse/blob/main/key.go"
click node_inputs "https://github.com/luo-root/pulse/blob/main/inputs.go"
click node_nodes "https://github.com/luo-root/pulse/blob/main/node.go"
click node_aspects "https://github.com/luo-root/pulse/blob/main/aspect.go"
click node_graph "https://github.com/luo-root/pulse/blob/main/graph.go"
click node_execution "https://github.com/luo-root/pulse/blob/main/execution.go"
click node_run "https://github.com/luo-root/pulse/blob/main/execution_run.go"
click node_outputs "https://github.com/luo-root/pulse/blob/main/inputs.go"
click node_problems "https://github.com/luo-root/pulse/blob/main/problems.go"
click node_snapshot "https://github.com/luo-root/pulse/blob/main/snapshot.go"
click node_checkpoint "https://github.com/luo-root/pulse/blob/main/checkpoint_run.go"
click node_subgraphs "https://github.com/luo-root/pulse/blob/main/sub.go"
click node_streams "https://github.com/luo-root/pulse/blob/main/stream.go"
click node_topology "https://github.com/luo-root/pulse/blob/main/topology.go"
click node_mermaid "https://github.com/luo-root/pulse/blob/main/mermaid.go"
click node_yaml_load "https://github.com/luo-root/pulse/blob/main/yaml/load.go"
click node_yaml_subgraph "https://github.com/luo-root/pulse/blob/main/yaml/subgraph.go"
click node_yaml_analyze "https://github.com/luo-root/pulse/blob/main/yaml/analyze.go"
click node_observer "https://github.com/luo-root/pulse/blob/main/observer.go"
click node_record_observer "https://github.com/luo-root/pulse/blob/main/observe/graph_record.go"
click node_records "https://github.com/luo-root/pulse/blob/main/observe/record.go"
click node_line_sink "https://github.com/luo-root/pulse/blob/main/observe/linelog.go"
click node_async_sink "https://github.com/luo-root/pulse/blob/main/observe/async.go"

classDef toneNeutral fill:#f8fafc,stroke:#334155,stroke-width:1.5px,color:#0f172a
classDef toneBlue fill:#dbeafe,stroke:#2563eb,stroke-width:1.5px,color:#172554
classDef toneAmber fill:#fef3c7,stroke:#d97706,stroke-width:1.5px,color:#78350f
classDef toneMint fill:#dcfce7,stroke:#16a34a,stroke-width:1.5px,color:#14532d
classDef toneRose fill:#ffe4e6,stroke:#e11d48,stroke-width:1.5px,color:#881337
classDef toneIndigo fill:#e0e7ff,stroke:#4f46e5,stroke-width:1.5px,color:#312e81
classDef toneTeal fill:#ccfbf1,stroke:#0f766e,stroke-width:1.5px,color:#134e4a
class node_keys,node_inputs,node_nodes,node_aspects,node_graph,node_execution,node_run,node_outputs,node_problems,node_snapshot,node_checkpoint toneBlue
class node_subgraphs,node_streams,node_topology,node_mermaid toneAmber
class node_yaml_load,node_yaml_subgraph,node_yaml_analyze toneMint
class node_observer,node_record_observer,node_records,node_line_sink,node_async_sink toneRose
class node_developer,node_custom_sink toneIndigo
```

## Components

### Workflow engine

- [Typed keys](https://github.com/luo-root/pulse/blob/main/key.go): `key.go`
- [Run inputs](https://github.com/luo-root/pulse/blob/main/inputs.go): `inputs.go`
- [Workflow nodes](https://github.com/luo-root/pulse/blob/main/node.go): `node.go`
- [Retry and timeout](https://github.com/luo-root/pulse/blob/main/aspect.go): `aspect.go`
- [Graph definition](https://github.com/luo-root/pulse/blob/main/graph.go): `graph.go`
- [Execution lifecycle](https://github.com/luo-root/pulse/blob/main/execution.go): `execution.go`
- [Run orchestration](https://github.com/luo-root/pulse/blob/main/execution_run.go): `execution_run.go`
- [Output reads](https://github.com/luo-root/pulse/blob/main/inputs.go): `inputs.go`
- [Run problems](https://github.com/luo-root/pulse/blob/main/problems.go): `problems.go`
- [Run snapshot](https://github.com/luo-root/pulse/blob/main/snapshot.go): `snapshot.go`
- [Checkpoint bridge](https://github.com/luo-root/pulse/blob/main/checkpoint_run.go): `checkpoint_run.go`

### Composition

- [Reusable subgraphs](https://github.com/luo-root/pulse/blob/main/sub.go): `sub.go`
- [Stream processing](https://github.com/luo-root/pulse/blob/main/stream.go): `stream.go`
- [Topology view](https://github.com/luo-root/pulse/blob/main/topology.go): `topology.go`
- [Mermaid rendering](https://github.com/luo-root/pulse/blob/main/mermaid.go): `mermaid.go`

### Assembly and analysis

- [YAML assembly](https://github.com/luo-root/pulse/blob/main/yaml/load.go): `yaml/load.go`
- [YAML subgraphs](https://github.com/luo-root/pulse/blob/main/yaml/subgraph.go): `yaml/subgraph.go`
- [YAML analysis](https://github.com/luo-root/pulse/blob/main/yaml/analyze.go): `yaml/analyze.go`

### Observability

- [Observer events](https://github.com/luo-root/pulse/blob/main/observer.go): `observer.go`
- [Record adapter](https://github.com/luo-root/pulse/blob/main/observe/graph_record.go): `observe/graph_record.go`
- [Structured records](https://github.com/luo-root/pulse/blob/main/observe/record.go): `observe/record.go`
- [Line sink](https://github.com/luo-root/pulse/blob/main/observe/linelog.go): `observe/linelog.go`
- [Async sink](https://github.com/luo-root/pulse/blob/main/observe/async.go): `observe/async.go`

### Other components

- **Application developer**
- **Custom sink**

## Connections

- Application developer → Graph definition: defines (evidence: `README.md`)
- Application developer → Run inputs: provides (evidence: `README.md`)
- Graph definition → Workflow nodes: registers (evidence: `README.md`)
- Workflow nodes → Typed keys: declares data (evidence: `README.md`)
- Workflow nodes → Retry and timeout: uses policies (evidence: `README.md`)
- Graph definition → Execution lifecycle: creates execution (evidence: `README.md`)
- Run inputs → Execution lifecycle: seeds (evidence: `README.md`)
- Execution lifecycle → Run orchestration: starts and waits (evidence: `README.md`)
- Run orchestration → Output reads: enables reads (evidence: `README.md`)
- Execution lifecycle → Run problems: reports failures (evidence: `README.md`)
- Execution lifecycle → Run snapshot: exposes state (evidence: `README.md`)
- Execution lifecycle → Checkpoint bridge: supports bridge (evidence: `README.md`)
- Graph definition → Reusable subgraphs: mounts (evidence: `README.md`)
- Graph definition → Stream processing: supports (evidence: `README.md`)
- Graph definition → Topology view: exposes structure (evidence: `README.md`)
- Topology view → Mermaid rendering: renders
- Application developer → YAML assembly: loads workflow (evidence: `README.md`)
- YAML assembly → Graph definition: assembles (evidence: `README.md`)
- YAML assembly → YAML subgraphs: assembles subgraphs
- Application developer → YAML analysis: analyzes workflow (evidence: `README.md`)
- YAML analysis → Topology view: returns structure
- Execution lifecycle → Observer events: emits events (evidence: `README.md`)
- Observer events → Record adapter: adapts events (evidence: `README.md`)
- Record adapter → Structured records: creates records (evidence: `README.md`)
- Structured records → Line sink: writes lines (evidence: `README.md`)
- Structured records → Async sink: queues records
- Structured records → Custom sink: exports records (evidence: `README.md`)
