ltspice-agents
README.md
# ltspice-agents
[](https://github.com/guirguispierre/ltspice-agents/actions/workflows/ci.yml)
[](LICENSE)
[](pyproject.toml)
**Open-source LTspice-style circuit simulation for agents — one CLI and MCP
server, ngspice-backed.**
Modeled on [REA](https://github.com/morluto/rea)'s architecture: shared
workflows behind a CLI and a stdio MCP server, a bundled agent skill,
additive `setup`/`doctor` client registration, and evidence-bearing results.
Simulations run on open engines — [ngspice](https://ngspice.sourceforge.io)
by default, or a bring-your-own LTspice binary (native or wine) for real
LTspice decks. No proprietary components required.
## Quick start
```bash
pip install 'git+https://github.com/guirguispierre/ltspice-agents.git'
ltspice-agents doctor # what engines + agents are present?
ltspice-agents setup --dry-run # show planned MCP registrations
ltspice-agents setup --yes # register (additive, backed up)
```
A PyPI package is planned; once published, `pip install ltspice-agents` (or
`pipx install ltspice-agents`) will be the preferred installation path.
With no MCP client, use the CLI directly — every command prints the same
JSON envelope the MCP tools return:
```bash
ltspice-agents simulate examples/rc_lowpass.net
ltspice-agents waveforms sim.raw --signals v\(in\),v\(out\)
ltspice-agents validate mydeck.net --engine ngspice
ltspice-agents netlist divider.asc --symbol-dir ./lib
```
Engines: `ngspice` is found on PATH (`apt install ngspice`,
`brew install ngspice`, conda-forge). `ltspice` is detected if an LTspice
binary exists natively or under wine — ltspice-agents never installs
engines for you.
## MCP tool surface
| Group | Tools |
| --------- | ----- |
| Identity | `spice_session`, `status` |
| Docs | `list_reference_docs`, `get_reference` |
| Design | `open_design`, `get_design_content`, `set_design_content`, `get_schematic_netlist`, `list_open_designs`, `get_active_design_path`, `set_active_design` |
| Simulate | `start_simulation`, `is_simulation_running`, `get_spice_log` |
| Waveforms | `get_raw_info`, `read_raw_waveforms`, `export_raw_waveforms` |
| Workflows | `validate_netlist`, `simulate_netlist` |
Run the server: `ltspice-agents mcp` (stdio).
## What it does
- **Decks**: parse/validate `.net`/`.cir`/`.sp` — elements, dot-cards,
`.param`, `.inc`, subckts — with line-referenced errors and
engine-compatibility warnings (LTspice-only cards flagged for ngspice).
- **Simulation**: `ngspice -b` through a `.control` wrapper so `.meas`
results land in the log and a binary rawfile is written deterministically.
`.step` is expanded into per-step runs (cartesian product), each with its
own log/raw — `get_spice_log` tabulates meas per step.
- **Schematics**: parse `.asc` (wires, flags, symbols, directives) and
netlist them via `.asy` pin geometry + `SpiceOrder`. Derived netlists are
marked as derived evidence — verify before simulating.
- **Waveforms**: read ngspice (point-major) and LTspice (variable-major)
binary/ASCII rawfiles, stepped runs, complex AC data; export to SQLite,
CSV, or JSON.
- **Docs**: bundled references (written here, not ADI's) are one tool call
away so an agent never has to guess syntax.
## Evidence contract
Every result is `{ok, data|error, evidence:{sources, limitations,
unknowns}}`. Observed, derived, and inferred facts stay distinct; coverage
that could not be examined is reported as `unknown`, never as absence.
## Setup for your agent
`ltspice-agents setup` registers the MCP server and installs the bundled
skill, per client, with backups — approval required before anything writes.
| Client | Config touched |
| ------ | -------------- |
| Claude Code | `~/.claude.json` + `~/.claude/skills` |
| Claude Desktop | `claude_desktop_config.json` |
| Cursor | `~/.cursor/mcp.json` + `~/.agents/skills` |
| Windsurf | `~/.codeium/windsurf/mcp_config.json` |
| Gemini CLI | `~/.gemini/settings.json` |
| Codex | `~/.codex/config.toml` |
| VS Code | `~/.config/Code/User/mcp.json` |
| OpenCode | `~/.config/opencode/opencode.json` |
| Zed | `~/.config/zed/settings.json` |
| Devin | manual — org-managed MCP integrations; use the CLI |
## Why not the official LTspice MCP?
LTspice 26.1+ ships an excellent MCP server — on Windows, behind a
proprietary binary. This package exists for everywhere else: Linux/macOS
CI, containers, agents on bare VMs, and anyone who wants the whole stack
open-source. When you do have LTspice 26.1+, use its MCP — it's the better
path for native LTspice semantics.
## Caveats
- `.asc` netlisting is derived evidence: verified on hand-built fixtures,
not against LTspice's own netlister. Check `get_schematic_netlist`.
- LTspice `.raw` detection uses header + axis-monotonicity heuristics;
`get_raw_info` reports the layout it chose.
- ngspice has no `.step` card — steps are expanded into multiple runs, so
stepped LTspice decks take step_count × run time.
## Development
From a fresh clone:
```bash
sudo apt-get update && sudo apt-get install -y ngspice # Debian/Ubuntu
python -m venv .venv
. .venv/bin/activate
pip install -U pip setuptools wheel
pip install -e '.[dev]'
pytest -q
```
Coding agents should start with
[`.agents/skills/ltspice-agents-bootstrap/SKILL.md`](.agents/skills/ltspice-agents-bootstrap/SKILL.md);
it captures the environment setup, validation commands, architecture map, and
repository guardrails. Human contributors can start with
[CONTRIBUTING.md](CONTRIBUTING.md).
Security reports are private through
[SECURITY.md](SECURITY.md). Community expectations are in
[CODE_OF_CONDUCT.md](CODE_OF_CONDUCT.md), and release notes live in
[CHANGELOG.md](CHANGELOG.md).
## License
MIT — see [LICENSE](LICENSE). ngspice is BSD-3-Clause (invoked as a
subprocess; no linking). LTspice is © Analog Devices — referenced only via
documented file formats and your own installed binary.
This server cannot be deployed
Maintenance
ActivityMaintained
ResponsivenessNo recent community issues