# mzulali/xj-scanner architecture

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

- Interactive diagram: https://gitdiagram.com/mzulali/xj-scanner
- Repository: https://github.com/mzulali/xj-scanner

## Overview

xj-scanner connects a laptop-based agent or scanner interface to a Jeep’s OBD1 engine computer through a USB Arduino SCI bridge. The main path is connection, PCM requests, decoded fault/live data, and optional CSV logging and analysis; actuator tests and ROM inspection are additional diagnostic workflows. The graph includes the documented agent playbooks and helper tools. Some firmware and unsampled scanner paths are represented only where the README or source index supports the relationship.

Main entry points: [`pc/xj_protocol.py`](https://github.com/mzulali/xj-scanner/blob/main/pc/xj_protocol.py) (OBD1 protocol and decoding), [`pc/xj_scan.py`](https://github.com/mzulali/xj-scanner/blob/main/pc/xj_scan.py) (Scanner worker), [`arduino/xj_bridge/xj_bridge.ino`](https://github.com/mzulali/xj-scanner/blob/main/arduino/xj_bridge/xj_bridge.ino) (SCI bridge firmware), [`tools/pid_sweep.py`](https://github.com/mzulali/xj-scanner/blob/main/tools/pid_sweep.py) (PID sweep)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_guidance["Agent Guidance"]
  node_playbooks["Setup playbooks<br/>[skills]"]
end

subgraph group_scanner["Laptop Scanner"]
  node_scanner_app["Scanner UI and CLI<br/>[xj_scan.py]"]
  node_worker["Scanner worker<br/>[xj_scan.py]"]
  node_csv_log["CSV logging<br/>[xj_scan.py]"]
  node_protocol["OBD1 protocol and decoding<br/>[xj_protocol.py]"]
  node_dtc["Fault descriptions<br/>[dtc_table.py]"]
end

subgraph group_bridge["Vehicle Interface"]
  node_bridge_fw["SCI bridge firmware<br/>[xj_bridge.ino]"]
  node_sniffer_fw["Signal capture sketch<br/>[xj_sniff.ino]"]
end

subgraph group_analysis["Diagnostic Tools"]
  node_logs[("Drive CSV files")]
  node_drive_report["Drive analysis<br/>[drive_report.py]"]
  node_summarize["Log summary<br/>[summarize.py]"]
  node_pid_sweep["PID sweep<br/>[pid_sweep.py]"]
  node_romcheck["ROM inspection<br/>[romcheck.py]"]
  node_sniffer_tool["Signal decoder<br/>[sniff.py]"]
end

node_driver(("Jeep owner"))
node_agent(("Coding agent"))
node_pcm{{"Jeep PCM"}}

node_driver -->|"requests setup"| node_agent
node_agent -->|"follows guidance"| node_playbooks
node_driver -->|"runs scanner"| node_scanner_app
node_scanner_app -->|"queues commands"| node_worker
node_worker -->|"uses link"| node_protocol
node_protocol -->|"looks up codes"| node_dtc
node_protocol -->|"exchanges SCI bytes"| node_bridge_fw
node_bridge_fw -->|"relays diagnostics"| node_pcm
node_worker -->|"writes readings"| node_csv_log
node_csv_log -->|"stores rows"| node_logs
node_logs -->|"analyzed by"| node_drive_report
node_logs -->|"summarized by"| node_summarize
node_pid_sweep -->|"queries parameters"| node_protocol
node_romcheck -->|"reads PCM memory"| node_protocol
node_sniffer_tool -->|"drives capture"| node_sniffer_fw

click node_playbooks "https://github.com/mzulali/xj-scanner/tree/main/.claude/skills"
click node_scanner_app "https://github.com/mzulali/xj-scanner/blob/main/pc/xj_scan.py"
click node_worker "https://github.com/mzulali/xj-scanner/blob/main/pc/xj_scan.py"
click node_csv_log "https://github.com/mzulali/xj-scanner/blob/main/pc/xj_scan.py"
click node_protocol "https://github.com/mzulali/xj-scanner/blob/main/pc/xj_protocol.py"
click node_dtc "https://github.com/mzulali/xj-scanner/blob/main/pc/dtc_table.py"
click node_bridge_fw "https://github.com/mzulali/xj-scanner/blob/main/arduino/xj_bridge/xj_bridge.ino"
click node_drive_report "https://github.com/mzulali/xj-scanner/blob/main/tools/drive_report.py"
click node_summarize "https://github.com/mzulali/xj-scanner/blob/main/tools/summarize.py"
click node_pid_sweep "https://github.com/mzulali/xj-scanner/blob/main/tools/pid_sweep.py"
click node_romcheck "https://github.com/mzulali/xj-scanner/blob/main/tools/romcheck.py"
click node_sniffer_fw "https://github.com/mzulali/xj-scanner/blob/main/arduino/xj_sniff/xj_sniff.ino"
click node_sniffer_tool "https://github.com/mzulali/xj-scanner/blob/main/tools/sniff.py"

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_playbooks toneBlue
class node_scanner_app,node_worker,node_csv_log,node_protocol,node_dtc toneAmber
class node_bridge_fw,node_sniffer_fw toneMint
class node_logs,node_drive_report,node_summarize,node_pid_sweep,node_romcheck,node_sniffer_tool toneRose
class node_driver,node_agent,node_pcm toneIndigo
```

## Components

### Agent Guidance

- [Setup playbooks](https://github.com/mzulali/xj-scanner/tree/main/.claude/skills): `.claude/skills`

### Laptop Scanner

- [Scanner UI and CLI](https://github.com/mzulali/xj-scanner/blob/main/pc/xj_scan.py): `pc/xj_scan.py`
- [Scanner worker](https://github.com/mzulali/xj-scanner/blob/main/pc/xj_scan.py): `pc/xj_scan.py`
- [CSV logging](https://github.com/mzulali/xj-scanner/blob/main/pc/xj_scan.py): `pc/xj_scan.py`
- [OBD1 protocol and decoding](https://github.com/mzulali/xj-scanner/blob/main/pc/xj_protocol.py): `pc/xj_protocol.py`
- [Fault descriptions](https://github.com/mzulali/xj-scanner/blob/main/pc/dtc_table.py): `pc/dtc_table.py`

### Vehicle Interface

- [SCI bridge firmware](https://github.com/mzulali/xj-scanner/blob/main/arduino/xj_bridge/xj_bridge.ino): `arduino/xj_bridge/xj_bridge.ino`
- [Signal capture sketch](https://github.com/mzulali/xj-scanner/blob/main/arduino/xj_sniff/xj_sniff.ino): `arduino/xj_sniff/xj_sniff.ino`

### Diagnostic Tools

- **Drive CSV files**
- [Drive analysis](https://github.com/mzulali/xj-scanner/blob/main/tools/drive_report.py): `tools/drive_report.py`
- [Log summary](https://github.com/mzulali/xj-scanner/blob/main/tools/summarize.py): `tools/summarize.py`
- [PID sweep](https://github.com/mzulali/xj-scanner/blob/main/tools/pid_sweep.py): `tools/pid_sweep.py`
- [ROM inspection](https://github.com/mzulali/xj-scanner/blob/main/tools/romcheck.py): `tools/romcheck.py`
- [Signal decoder](https://github.com/mzulali/xj-scanner/blob/main/tools/sniff.py): `tools/sniff.py`

### Other components

- **Jeep owner**
- **Coding agent**
- **Jeep PCM**

## Connections

- Jeep owner → Coding agent: requests setup (evidence: `README.md`)
- Coding agent → Setup playbooks: follows guidance (evidence: `README.md`)
- Jeep owner → Scanner UI and CLI: runs scanner (evidence: `README.md`)
- Scanner UI and CLI → Scanner worker: queues commands (evidence: `pc/xj_scan.py`)
- Scanner worker → OBD1 protocol and decoding: uses link (evidence: `pc/xj_scan.py`)
- OBD1 protocol and decoding → Fault descriptions: looks up codes (evidence: `pc/xj_protocol.py`)
- OBD1 protocol and decoding → SCI bridge firmware: exchanges SCI bytes (evidence: `pc/xj_protocol.py`)
- SCI bridge firmware → Jeep PCM: relays diagnostics (evidence: `README.md`)
- Scanner worker → CSV logging: writes readings (evidence: `pc/xj_scan.py`)
- CSV logging → Drive CSV files: stores rows (evidence: `pc/xj_scan.py`)
- Drive CSV files → Drive analysis: analyzed by (evidence: `tools/drive_report.py`)
- Drive CSV files → Log summary: summarized by (evidence: `tools/summarize.py`)
- PID sweep → OBD1 protocol and decoding: queries parameters (evidence: `tools/pid_sweep.py`)
- ROM inspection → OBD1 protocol and decoding: reads PCM memory (evidence: `tools/romcheck.py`)
- Signal decoder → Signal capture sketch: drives capture (evidence: `tools/sniff.py`)
