# nolaforensix/scalpel3-release architecture

> Architecture diagram of the GitHub repository nolaforensix/scalpel3-release, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-12-04). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/nolaforensix/scalpel3-release
- Repository: https://github.com/nolaforensix/scalpel3-release

## Overview

Scalpel3 is a high-performance file-carving application: users provide an image and configuration, the carver scans and validates candidate files, reassembles fragmented candidates, and writes recovered output. Its domain-specific validators are designed to be added independently of the threading model. The repository also includes blockmap and checkpoint utilities, image-layout visualization, and a synthetic image generator. The README documents these capabilities; sampled source confirms the ELF ONNX inference boundary and some internal relationships, but most runtime calls and tool implementations were not inspected, so those links are omitted or documented as such.

Main entry points: [`src/carve.c`](https://github.com/nolaforensix/scalpel3-release/blob/main/src/carve.c) (Carving engine), [`src/blockmap.c`](https://github.com/nolaforensix/scalpel3-release/blob/main/src/blockmap.c) (Blockmap storage), [`src/scalpel.c`](https://github.com/nolaforensix/scalpel3-release/blob/main/src/scalpel.c) (Scalpel CLI), [`src`](https://github.com/nolaforensix/scalpel3-release/tree/main/src) (File validators)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_carving["Carving runtime"]
  node_scalpel["Scalpel CLI<br/>[scalpel.c]"]
  node_config["Carve configuration<br/>[scalpelconf.c]"]
  node_engine["Carving engine<br/>[carve.c]"]
  node_reassembly["Fragment reassembly<br/>[reassembly.c]"]
end

subgraph group_validation["Validation and inference"]
  node_validators["File validators"]
  node_elfmodel["ELF ONNX inference<br/>[elf_onnx.cpp]"]
  node_elfapi["ELF inference API<br/>[elf_onnx.h]"]
  node_elfglobal["ELF singleton<br/>[elf_onnx_global.c]"]
  node_providers["ONNX providers<br/>[onnx_providers.c]"]
end

subgraph group_state["Image and recovery state"]
  node_promising["Promising candidates<br/>[promising_output.h]"]
  node_filemirror["Image block access<br/>[filemirror.c]"]
  node_blockmap[("Blockmap storage<br/>[blockmap.c]")]
  node_output["Recovered output<br/>[scalpel_output.h]"]
end

subgraph group_toolchain["Recovery toolchain"]
  node_crblockmap["Create blockmap<br/>[crblockmap.c]"]
  node_modblockmap["Edit blockmap<br/>[modblockmap.c]"]
  node_cmpblockmaps["Compare blockmaps<br/>[cmpblockmaps.c]"]
  node_mergeblockmap["Merge blockmaps<br/>[mergeblockmap.c]"]
  node_blockmapfs["Blockmap FUSE view<br/>[blockmapfs.c]"]
  node_dumphf["Header/footer database<br/>[dumphf.c]"]
  node_dumpbt["Block confidence database<br/>[dumpbt.c]"]
  node_mergecps["Merge checkpoints<br/>[mergecps.c]"]
  node_diskviz["Layout visualization<br/>[diskviz.c]"]
end

subgraph group_simulation["Image simulation"]
  node_fragmentator["Synthetic image generator<br/>[fragmentator.c]"]
end

node_operator(("Operator"))
node_image["Disk image"]

node_operator -->|"runs"| node_scalpel
node_image -->|"provides input"| node_scalpel
node_operator -->|"defines types"| node_config
node_scalpel -.->|"starts carving"| node_engine
node_engine -.->|"reads image blocks"| node_filemirror
node_engine -->|"uses required map"| node_blockmap
node_engine -->|"validates candidates"| node_validators
node_engine -->|"dispatches reassembly"| node_reassembly
node_engine -.->|"queues candidates"| node_promising
node_engine -.->|"writes recovery"| node_output
node_validators -.->|"uses optional inference"| node_elfglobal
node_elfglobal -->|"creates handle"| node_elfapi
node_elfapi -->|"exposes inference"| node_elfmodel
node_elfmodel -->|"selects provider"| node_providers
node_operator -->|"creates map"| node_crblockmap
node_crblockmap -->|"produces"| node_blockmap
node_operator -->|"edits map"| node_modblockmap
node_modblockmap -->|"updates"| node_blockmap
node_operator -->|"compares maps"| node_cmpblockmaps
node_operator -->|"combines maps"| node_mergeblockmap
node_operator -->|"mounts view"| node_blockmapfs
node_blockmapfs -->|"reads coverage"| node_blockmap
node_operator -->|"inspects locations"| node_dumphf
node_operator -->|"inspects confidence"| node_dumpbt
node_operator -->|"merges checkpoints"| node_mergecps
node_operator -->|"generates test image"| node_fragmentator
node_fragmentator -->|"supplies layouts"| node_diskviz
node_operator -->|"visualizes layouts"| node_diskviz

click node_scalpel "https://github.com/nolaforensix/scalpel3-release/blob/main/src/scalpel.c"
click node_config "https://github.com/nolaforensix/scalpel3-release/blob/main/src/scalpelconf.c"
click node_engine "https://github.com/nolaforensix/scalpel3-release/blob/main/src/carve.c"
click node_reassembly "https://github.com/nolaforensix/scalpel3-release/blob/main/src/reassembly.c"
click node_validators "https://github.com/nolaforensix/scalpel3-release/tree/main/src"
click node_elfmodel "https://github.com/nolaforensix/scalpel3-release/blob/main/src/exe_vision/unix/elf_onnx.cpp"
click node_elfapi "https://github.com/nolaforensix/scalpel3-release/blob/main/src/exe_vision/unix/elf_onnx.h"
click node_elfglobal "https://github.com/nolaforensix/scalpel3-release/blob/main/src/exe_vision/unix/elf_onnx_global.c"
click node_providers "https://github.com/nolaforensix/scalpel3-release/blob/main/src/onnx_providers.c"
click node_promising "https://github.com/nolaforensix/scalpel3-release/blob/main/src/promising_output.h"
click node_filemirror "https://github.com/nolaforensix/scalpel3-release/blob/main/src/filemirror.c"
click node_blockmap "https://github.com/nolaforensix/scalpel3-release/blob/main/src/blockmap.c"
click node_output "https://github.com/nolaforensix/scalpel3-release/blob/main/src/scalpel_output.h"
click node_crblockmap "https://github.com/nolaforensix/scalpel3-release/blob/main/src/crblockmap.c"
click node_modblockmap "https://github.com/nolaforensix/scalpel3-release/blob/main/src/modblockmap.c"
click node_cmpblockmaps "https://github.com/nolaforensix/scalpel3-release/blob/main/src/cmpblockmaps.c"
click node_mergeblockmap "https://github.com/nolaforensix/scalpel3-release/blob/main/src/mergeblockmap.c"
click node_blockmapfs "https://github.com/nolaforensix/scalpel3-release/blob/main/src/blockmapfs.c"
click node_dumphf "https://github.com/nolaforensix/scalpel3-release/blob/main/src/dumphf.c"
click node_dumpbt "https://github.com/nolaforensix/scalpel3-release/blob/main/src/dumpbt.c"
click node_mergecps "https://github.com/nolaforensix/scalpel3-release/blob/main/src/mergecps.c"
click node_diskviz "https://github.com/nolaforensix/scalpel3-release/blob/main/src/diskviz.c"
click node_fragmentator "https://github.com/nolaforensix/scalpel3-release/blob/main/src/fragmentator.c"

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_scalpel,node_config,node_engine,node_reassembly toneBlue
class node_validators,node_elfmodel,node_elfapi,node_elfglobal,node_providers toneAmber
class node_promising,node_filemirror,node_blockmap,node_output toneMint
class node_crblockmap,node_modblockmap,node_cmpblockmaps,node_mergeblockmap,node_blockmapfs,node_dumphf,node_dumpbt,node_mergecps,node_diskviz toneRose
class node_fragmentator,node_operator,node_image toneIndigo
```

## Components

### Carving runtime

- [Scalpel CLI](https://github.com/nolaforensix/scalpel3-release/blob/main/src/scalpel.c): `src/scalpel.c`
- [Carve configuration](https://github.com/nolaforensix/scalpel3-release/blob/main/src/scalpelconf.c): `src/scalpelconf.c`
- [Carving engine](https://github.com/nolaforensix/scalpel3-release/blob/main/src/carve.c): `src/carve.c`
- [Fragment reassembly](https://github.com/nolaforensix/scalpel3-release/blob/main/src/reassembly.c): `src/reassembly.c`

### Validation and inference

- [File validators](https://github.com/nolaforensix/scalpel3-release/tree/main/src): `src`
- [ELF ONNX inference](https://github.com/nolaforensix/scalpel3-release/blob/main/src/exe_vision/unix/elf_onnx.cpp): `src/exe_vision/unix/elf_onnx.cpp`
- [ELF inference API](https://github.com/nolaforensix/scalpel3-release/blob/main/src/exe_vision/unix/elf_onnx.h): `src/exe_vision/unix/elf_onnx.h`
- [ELF singleton](https://github.com/nolaforensix/scalpel3-release/blob/main/src/exe_vision/unix/elf_onnx_global.c): `src/exe_vision/unix/elf_onnx_global.c`
- [ONNX providers](https://github.com/nolaforensix/scalpel3-release/blob/main/src/onnx_providers.c): `src/onnx_providers.c`

### Image and recovery state

- [Promising candidates](https://github.com/nolaforensix/scalpel3-release/blob/main/src/promising_output.h): `src/promising_output.h`
- [Image block access](https://github.com/nolaforensix/scalpel3-release/blob/main/src/filemirror.c): `src/filemirror.c`
- [Blockmap storage](https://github.com/nolaforensix/scalpel3-release/blob/main/src/blockmap.c): `src/blockmap.c`
- [Recovered output](https://github.com/nolaforensix/scalpel3-release/blob/main/src/scalpel_output.h): `src/scalpel_output.h`

### Recovery toolchain

- [Create blockmap](https://github.com/nolaforensix/scalpel3-release/blob/main/src/crblockmap.c): `src/crblockmap.c`
- [Edit blockmap](https://github.com/nolaforensix/scalpel3-release/blob/main/src/modblockmap.c): `src/modblockmap.c`
- [Compare blockmaps](https://github.com/nolaforensix/scalpel3-release/blob/main/src/cmpblockmaps.c): `src/cmpblockmaps.c`
- [Merge blockmaps](https://github.com/nolaforensix/scalpel3-release/blob/main/src/mergeblockmap.c): `src/mergeblockmap.c`
- [Blockmap FUSE view](https://github.com/nolaforensix/scalpel3-release/blob/main/src/blockmapfs.c): `src/blockmapfs.c`
- [Header/footer database](https://github.com/nolaforensix/scalpel3-release/blob/main/src/dumphf.c): `src/dumphf.c`
- [Block confidence database](https://github.com/nolaforensix/scalpel3-release/blob/main/src/dumpbt.c): `src/dumpbt.c`
- [Merge checkpoints](https://github.com/nolaforensix/scalpel3-release/blob/main/src/mergecps.c): `src/mergecps.c`
- [Layout visualization](https://github.com/nolaforensix/scalpel3-release/blob/main/src/diskviz.c): `src/diskviz.c`

### Image simulation

- [Synthetic image generator](https://github.com/nolaforensix/scalpel3-release/blob/main/src/fragmentator.c): `src/fragmentator.c`

### Other components

- **Operator**
- **Disk image**

## Connections

- Operator → Scalpel CLI: runs
- Disk image → Scalpel CLI: provides input
- Operator → Carve configuration: defines types
- Scalpel CLI → Carving engine: starts carving
- Carving engine → Image block access: reads image blocks
- Carving engine → Blockmap storage: uses required map
- Carving engine → File validators: validates candidates (evidence: `src/carve.c`)
- Carving engine → Fragment reassembly: dispatches reassembly (evidence: `src/carve.c`)
- Carving engine → Promising candidates: queues candidates (evidence: `src/carve.c`)
- Carving engine → Recovered output: writes recovery
- File validators → ELF singleton: uses optional inference (evidence: `src/exe_vision/unix/elf_onnx_global.c`)
- ELF singleton → ELF inference API: creates handle (evidence: `src/exe_vision/unix/elf_onnx_global.c`)
- ELF inference API → ELF ONNX inference: exposes inference (evidence: `src/exe_vision/unix/elf_onnx.h`)
- ELF ONNX inference → ONNX providers: selects provider (evidence: `src/exe_vision/unix/elf_onnx.cpp`)
- Operator → Create blockmap: creates map
- Create blockmap → Blockmap storage: produces
- Operator → Edit blockmap: edits map
- Edit blockmap → Blockmap storage: updates
- Operator → Compare blockmaps: compares maps
- Operator → Merge blockmaps: combines maps
- Operator → Blockmap FUSE view: mounts view
- Blockmap FUSE view → Blockmap storage: reads coverage
- Operator → Header/footer database: inspects locations
- Operator → Block confidence database: inspects confidence
- Operator → Merge checkpoints: merges checkpoints
- Operator → Synthetic image generator: generates test image
- Synthetic image generator → Layout visualization: supplies layouts
- Operator → Layout visualization: visualizes layouts
