git clone git@github.com:holla2040/ThomsonLint.git
cd ThomsonLintFusion Electronics:
- Open your circuit design in Fusion Electronics.
- From both the schematic editor and the board editor, run:
One command per editor produces the JSON connectivity export, layer stackup JSON (board only), and high-resolution image renders. To customise output paths or DPI, run the three underlying ULPs (
RUN fusion-electronics-all.ulpfusion-electronics-export.ulp,fusion-electronics-stackup.ulp,fusion-electronics-images.ulp) directly — see §7.
KiCad 9:
- Run
python tools/kicad-export.py path/to/MyProject.kicad_pro
Then run Claude Code from the repo root and type /design-review at the prompt:
/design-review
(Fallback if the skill is unavailable: Read docs/REVIEWER_INSTRUCTIONS.md and follow it to review my design in exports/. Please begin the review.)
(A pre-generated review_instructions.txt bundle is also produced for single-file upload to web AIs like Gemini, but that workflow has not been tested — see §5 "Running a Review".)
- Python 3 (3.8+)
- jsonschema — required for JSON validation and report generation:
pip install jsonschema
On UNIX and UNIX-like operating systems (Linux, *BSD, MacOS etc), you can run the
run_review.sh script from the shell with auto-detection of the project name from the exports/ directory:
./run_review.shIf there are more than one project outputs in the directory, then specify it explicitly on the command line:
./run_review.sh MySpecialProjectIt require the jq and claude shell commands. To install these on MacOS using brew: brew install jq claude-code.
This repository hosts a knowledge and rule framework designed to empower AI models with the specialized expertise required for comprehensive hardware design reviews. The goal is to provide a structured, machine-readable, and human-readable set of resources that enable an AI to analyze and identify potential issues in hardware designs, including schematics and PCB layouts.
The framework is built upon three core components:
- Ontology (
ontology/ontology.json): A machine-readable JSON file that defines a rich set of rules, domains, severity levels, and failure modes for hardware design. This forms the core of the AI's knowledge base. - Knowledge Base (
docs/AI_Hardware_Design_Review_KnowledgeBase.md): A human-readable Markdown file that provides detailed explanations, appendices, and context for the rules defined in the ontology. - Examples (
examples/examples.json): A collection of practical examples, both good and bad, that map to the rules in the ontology. These can be used for training, testing, and validating the AI's understanding of the rules.
The name pays homage to J.J. Thomson, who discovered the electron in 1897 through his experiments with cathode rays at the Cavendish Laboratory in Cambridge, England. He demonstrated that cathode rays were composed of negatively charged particles much smaller than atoms, which he called "corpuscles" (later renamed electrons). He won the Nobel Prize in Physics in 1906 for this discovery.
Just as Thomson revealed the fundamental building blocks of electrical circuits, this project aims to uncover the fundamental issues in hardware designs—catching the small problems that can have big consequences.
The initial development phase of this project is complete. All tasks outlined in the TODO.md file have been implemented, resulting in a comprehensive and well-structured framework for AI-assisted hardware design review.
The repository is organized as follows:
README.md: This file, providing an overview of the project.LICENSE: The project's license.CONTRIBUTING.md: Guidelines for contributing to the project.TODO.md: The completed task list for the initial development phase.ontology/ontology.json: The core machine-readable ontology of hardware design rules.examples/examples.json: A set of example hardware design scenarios for training and testing.docs/REVIEWER_INSTRUCTIONS.md: The single source of truth for how a review is conducted; consumed by both Claude Code and the bundled web-AI workflow.docs/AI_Hardware_Design_Review_KnowledgeBase.md: A detailed, human-readable knowledge base.docs/KiCad_Review_Guide.md: Usage guide for the KiCad 9 export workflow.docs/Multi_Agent_Reasoning_Spec.md: A specification for a conceptual multi-agent reasoning architecture.tests/ontology_schema.json: A JSON schema for validatingontology/ontology.json.tests/examples_schema.json: A JSON schema for validatingexamples/examples.json.tests/findings_schema.json: A JSON schema for validating findings JSON files produced by a review.tests/sample_findings.json: A worked example demonstrating issues, verified_checks, cross_checks, and image / stackup evidence rows.tools/fusion-electronics-all.ulp: Wrapper ULP — recommended entry point. Chains the three exporters below in the right order based on the current editor, so the user runs only one command per editor.tools/fusion-electronics-export.ulp: ULP that exports schematic and board connectivity/placement to JSON. Run from each editor.tools/fusion-electronics-stackup.ulp: ULP that exports the layer stack (copper ordering, used-vs-unused layers) to JSON. Run from the board editor.tools/fusion-electronics-images.ulp: ULP that renders the schematic sheets and per-layer board images as high-resolution PNGs (300 DPI schematic / 1200 DPI board defaults). Run from each editor.tools/kicad-export.py: Standalone Python script to export KiCad 9 designs for review.tools/validate_findings.py: Coverage validator — schema-checks the findings JSON, lists every input inexports/not cited in anyevidence[].source, and flags missing required fields. Mandatory gate before generating the HTML report.tools/gen_report.py: Generates the self-contained HTML review report from findings JSON; embeds image evidence as inline thumbnails.validate_json.py: A Python script for validating the JSON files against their schemas.gen_context.sh: A bash script to generate the review instructions file.review_instructions.txt: Pre-generated file containing the complete knowledge base and AI instructions. Ready to use immediately.
This section is for the person reviewing a board. It lists the exact inputs the AI needs and the exact outputs a complete review produces. Claude Code is the only driver path that has been tested end-to-end; a single-file-upload bundle is provided for web AIs but that workflow has not been validated.
Reviewer procedure (read by the AI):
docs/REVIEWER_INSTRUCTIONS.md— the single source of truth for how a review is conducted. Step 1 of this file directs the AI to read the framework knowledge base.
Framework knowledge (loaded by the AI per Step 1 of REVIEWER_INSTRUCTIONS.md):
ontology/ontology.json— rule definitionsexamples/examples.json— worked examples mapped to rulesdocs/AI_Hardware_Design_Review_KnowledgeBase.md— explanations and appendices
Design data (drop into exports/):
<project>-thomson-export-sch.json— schematic export (Fusion Electronics ULP ortools/kicad-export.py)<project>-thomson-export-brd.json— board export (same source as above)<project>-thomson-export-stack.json— layer stack (Fusionfusion-electronics-stackup.ulp); copper ordering + used-vs-unused layers<project>-img-sch-p<N>.png— one PNG per schematic sheet at 300 DPI (Fusionfusion-electronics-images.ulp)<project>-img-silk-top.png,<project>-img-silk-bot.png— silkscreen renders at 1200 DPI<project>-img-cu-L<num>-<name>.png— per-copper-layer renders at 1200 DPI (traces + filled pours + airwires + restrict zones)*.pdf/*.PDF— datasheets for critical ICs (power converters, MCUs, transceivers), plus any stackup or pinout PDFs
Every input above is hard-gated by tools/validate_findings.py: any file present but not cited in some evidence[].source causes review failure. The case-insensitive match also catches uppercase .PDF / .PNG.
Claude Code (CLI, in this repo) — read the reviewer instructions directly. From the repo root run claude and type:
/design-review
(Fallback: Read docs/REVIEWER_INSTRUCTIONS.md and follow it to review my design in exports/. Please begin the review.)
See §7 "Using with Claude Code" for the full step-by-step.
Single-file upload to a web AI (e.g., Gemini, Claude.ai, ChatGPT) — the repo also produces review_instructions.txt, a single concatenation of ontology + examples + KB. Uploading this file along with the design exports to a web AI is possible but has not been tested by the maintainers; treat as experimental. See §6.1 for the quick-start. Do not point Claude Code at this bundle — it exceeds the per-file Read limit, and Claude Code should read the source files directly anyway.
A complete review writes to exports/:
-
<project>-findings.json— structured findings, schema intests/findings_schema.json -
<project>-review.html— interactive Open / Accept / Ignore checklist generated by:python tools/gen_report.py exports/<project>-findings.json --output exports/
Triage status is persisted in browser localStorage.
The findings JSON and HTML report sit alongside the schematic/board exports so the review trail stays with the design.
This framework serves two types of users:
- Design Reviewers: Engineers who want to review their circuit designs using AI
- Contributors: Developers who want to extend the knowledge base with new rules
Status: experimental. This path has not been validated by the maintainers. The tested workflow is Claude Code (§7). The instructions below are provided as a starting point if you want to try a web AI.
If you want to try reviewing a hardware design with a web AI that takes a single file upload, you don't need to clone or run anything:
- Download
review_instructions.txtfrom this repository (it's pre-generated and always up-to-date). - Open an AI assistant with file upload support.
- Upload two things:
- The
review_instructions.txtfile - Your design files (schematic images, PCB layout screenshots, etc.)
- The
- Type:
Please begin the review.
The AI should perform a pre-review assessment, ask for any missing information (datasheets, component values, stackup details), and then attempt a review with rule references. Output quality, completeness, and the ability to produce the structured findings JSON / HTML report have not been verified on this path.
If you want to extend the knowledge base or customize the rules:
git clone <repository-url>
cd ThomsonLintpip install jsonschema # if not installed
python validate_json.py- Modify the JSON files: Add new entries to
ontology/ontology.jsonorexamples/examples.jsonfollowing the existing structure. - Update the knowledge base: If necessary, add new sections to
docs/AI_Hardware_Design_Review_KnowledgeBase.md. - Validate your changes: Run
python validate_json.py. - Regenerate the review file:
./gen_context.sh > review_instructions.txt
Claude Code is the tested driver for this framework. It reads the exported design data and the framework's source files (ontology/ontology.json, examples/examples.json, docs/AI_Hardware_Design_Review_KnowledgeBase.md) directly from the repository — no file uploads, no review_instructions.txt (the bundle exists for the experimental web-AI path in §6.1, and exceeds Claude Code's per-file Read limit).
- Claude Code CLI installed and authenticated
- ThomsonLint repository cloned locally
- Design exported from Fusion Electronics or KiCad 9 (see below)
The simplest path is the wrapper ULP — one command per editor, no flags:
- Open your design in Fusion Electronics.
- From the Schematic Editor, run:
This chains:
RUN fusion-electronics-all.ulpfusion-electronics-export.ulp→fusion-electronics-images.ulp. Produces<design>-thomson-export-sch.jsonand one<design>-img-sch-p<N>.pngper sheet (300 DPI). - Switch to the Board Editor (PCB) and run the same command:
This chains:
RUN fusion-electronics-all.ulpfusion-electronics-export.ulp→fusion-electronics-stackup.ulp→fusion-electronics-images.ulp. Produces<design>-thomson-export-brd.json,<design>-thomson-export-stack.json,<design>-img-silk-top.png,<design>-img-silk-bot.png, and one<design>-img-cu-L<num>-<name>.pngper used copper layer (1200 DPI).
The wrapper detects which editor it's in and runs the right chain. All four ULPs (wrapper plus three children) live under tools/ and write to <repo>/exports/ automatically (path derived from argv[0]). The wrapper uses each child ULP's default output path and DPI; for granular control, run the children directly — see "Individual ULPs" below.
The schematic JSON export contains components, nets, pin connectivity, and signal analysis. The board JSON contains placement coordinates, trace routing, board geometry, and layout analysis. The stackup JSON contains the physical copper-layer ordering plus the full layer table. The image PNGs are visual evidence — qualitative inputs only; never derive distances or trace widths from them (the reviewer instructions enforce this rule).
If you need to override the output path, use a file-save dialog, or change the image DPI, run the children directly. Each child shares the same flag set:
| Flag | Description |
|---|---|
-d |
Opens a file-save dialog so you can choose the output location interactively |
-o <prefix> |
Writes the output(s) using the specified prefix directly |
-r <dpi> |
Image ULP only: override per-mode DPI (50–2400). Default is 300 (schematic) / 1200 (board). Use e.g. -r 600 if you want smaller board PNGs for a coarse-pitch design. |
Examples:
RUN fusion-electronics-export.ulp -d
RUN fusion-electronics-export.ulp -o C:\Users\me\Desktop\my-export.json
RUN fusion-electronics-images.ulp -r 600 # smaller board PNGs
To replicate what fusion-electronics-all.ulp does manually, run from the schematic editor:
RUN fusion-electronics-export.ulp # connectivity / placement JSON
RUN fusion-electronics-images.ulp # PNG renders
…and from the board editor:
RUN fusion-electronics-export.ulp # connectivity / placement JSON
RUN fusion-electronics-stackup.ulp # layer stack JSON
RUN fusion-electronics-images.ulp # PNG renders (run last — it terminates the chain)
If your design is in KiCad 9, use the standalone Python exporter instead:
python tools/kicad-export.py path/to/MyProject.kicad_proThis generates both -thomson-export-sch.json and -thomson-export-brd.json files in the exports/ directory. Use --output <dir> to specify a different output directory.
The script parses KiCad 9 S-expression files directly — no KiCad installation required, Python 3.6+ standard library only. It handles hierarchical multi-sheet schematics, reads net classes from the project file, and classifies signals (power, ground, clock, differential pairs with interface detection for USB, CAN, Ethernet, HDMI, LVDS, PCIe, SATA, MIPI).
See docs/KiCad_Review_Guide.md for full details on the KiCad export format.
Place any datasheets or other reference documents into the same exports/ directory alongside the ULP-generated artifacts:
exports/
Pendant_2_I_O_Schematic-thomson-export-sch.json
Pendant_2_I_O_Board-thomson-export-brd.json
Pendant_2_I_O_Board-thomson-export-stack.json
Pendant_2_I_O_Schematic-img-sch-p1.png
Pendant_2_I_O_Board-img-silk-top.png
Pendant_2_I_O_Board-img-silk-bot.png
Pendant_2_I_O_Board-img-cu-L1-Top.png
Pendant_2_I_O_Board-img-cu-L2-GND.png
Pendant_2_I_O_Board-img-cu-L303-POWER.png
Pendant_2_I_O_Board-img-cu-L304-Bottom.png
TPS54302_datasheet.pdf
connector_pinout.pdf
Claude Code can read PDFs and PNGs directly. Providing datasheets for critical ICs (power converters, MCUs, transceivers) up front saves back-and-forth and produces a more thorough review. The stackup JSON and per-layer PNGs let the reviewer make layer-aware claims (return-path adjacency, plane-split crossing, pour integrity) without having to ask you for stackup specs.
Open a terminal in the ThomsonLint directory and start Claude Code:
cd ThomsonLint
claudeThen start the review using the project skill:
/design-review
(Fallback if the skill is unavailable: Read docs/REVIEWER_INSTRUCTIONS.md and follow it to review my design in exports/. Please begin the review.)
Claude Code will:
- Read
docs/REVIEWER_INSTRUCTIONS.md(the reviewer procedure) and, per its Step 1, the framework knowledge base —ontology/ontology.json,examples/examples.json, anddocs/AI_Hardware_Design_Review_KnowledgeBase.md - Read the
-sch.json,-brd.json, and-stack.jsonexports, the layer/silk/schematic PNGs, plus any datasheet PDFs fromexports/ - Perform a pre-review assessment and ask for any missing information (datasheets, stackup details, etc.)
- Run through all applicable rules and report issues with specific
rule_idcitations, recording datasheet verifications inverified_checks[]and design-wide analyses incross_checks[] - Write findings to
exports/<project>-findings.json, runtools/validate_findings.py(mandatory coverage gate), and produceexports/<project>-review.htmlviatools/gen_report.py(see §5 "Outputs")
It is also possible to run this whole process automatically on a UNIX or UNIX-Like operating system
by running the run_review.sh script:
cd ThomsonLint
run_review.shClaude may ask for:
- Datasheets for critical ICs (it will try to web-search first)
- Component ratings not captured in the schematic attributes
- PCB stackup and manufacturing specs
- Functional descriptions for non-obvious signals or connectors
Answer these in the chat and Claude will proceed with the full review.
Schematic export (*-thomson-export-sch.json):
- Project info (name, variant, sheet count)
- Components with ref, value, package, type classification, attributes
- Net connectivity with pin directions and net classes
- Signal classification (power, ground, clock, differential pairs)
- Analysis: floating inputs, single-pin nets, voltage guesses
Board export (*-thomson-export-brd.json):
- Component placement (X/Y coordinates, rotation, top/bottom side)
- Board geometry (dimensions, layer count, holes)
- Signal routing (trace lengths, widths, via counts, segment counts)
- Full trace segments for high-speed/clock/differential nets
- Copper pours and ground plane layers
- Components near board edges
Development (including Claude Code) runs on an Ubuntu 24.04 host. The repository can be mounted into Windows 11 WSL via SSHFS so that Fusion Electronics (running on Windows) can execute the ULP exporter directly:
sshfs -o allow_other,default_permissions host:/home/user/ThomsonLint ThomsonLint/The ULP auto-detects its own location and writes exports to <repo>/exports/, so no path configuration is needed regardless of where the repository is cloned.
While the initial development is complete, the framework is designed for continuous improvement. Future work could include:
- Expanding the ontology with even more specialized rules.
- Adding more complex and nuanced examples.
- Integrating the framework with actual AI models and hardware design tools.