Agent design workflow
On this page
This guide is for AI agents (and the people supervising them) that use Kessetsu to design,
verify and hand off analog circuits. It is served verbatim by the kessetsu_guide MCP tool,
so an agent connected through kess mcp receives the same rules a human reads here.
The promise: when a person says "use Kessetsu", the agent should produce a design that is traceable, testable and reviewable without the person writing a long prompt about Ngspice, output parsing or file organization.
Connecting your AI agent (kess mcp)
After installing the CLI (kess --version), register Kessetsu's built-in stdio MCP server:
- Claude Code:
claude mcp add kessetsu -- kess mcp - Claude Desktop, Cursor, Windsurf or any
mcpServersclient:{ "mcpServers": { "kessetsu": { "command": "kess", "args": ["mcp"] } } } - VS Code (
.vscode/mcp.json):{ "servers": { "kessetsu": { "type": "stdio", "command": "kess", "args": ["mcp"] } } }
Agents with terminal access can also call kess directly (kess check, kess simulate, kess test, kess tool, kess study, kess render, kess share, kess export with --format json). The MCP server exposes native tools for every phase:
kessetsu_guide: Returns this workflow guide and engineering constraints.kessetsu_capabilities: Introspects installed CLI capabilities, supported metrics, commands, and limits.kessetsu_check: Runs fast static ERC (floating pins, shorts, naming) and semantic validation without launching a simulator.kessetsu_simulate: Runs Ngspice simulation (OP, TRAN, AC, DC), evaluates optionalmeasureexpressions (measure: ["rms(V(OUT))", ...]), and returns dataset vectors and measurements (automatically populating OP node voltages and branch currents when no explicit measurements are requested).kessetsu_test: Verifies circuit performance against human-locked.kessreqrequirement contracts (automatically stripping any inlineassertlines from.kesssource when externalrequirementsorrequirements_pathis supplied).kessetsu_render_schematic: Generates a connectivity-proven SVG schematic for visual inspection.kessetsu_export: Exports circuits to external EDA targets (kicad,ltspice,bom-csv,spice,json,pdf).kessetsu_import_spice: Converts supported SPICE netlists into editable, reviewable.kesssource and returns the fullkessetsu.spice-import.v1report (kess_source,names,summary,diagnostics).kessetsu_tool: Nominal engineering calculators (dividerfor resistive dividers under load,rc_lowpass/rc-lowpassfor first-order filters,non_inverting_opamp/non-inverting-opampfor non-inverting op-amp stages, andzener_regulator/zener-regulatorfor 3.3 V / 5.1 V / 12 V Zener shunt regulators) with exact, E12, or E24 standard component selection, returning editable.kesssource and a clickableshare_url.kessetsu_study_plan: Plans deterministic multi-condition parameter studies (parameter sweeps, tolerance corners, temperature grids, seeded Monte Carlo draws) without side effects.kessetsu_study_run: Executes multi-condition parameter studies sequentially, evaluating assertions across all cases to verify yield, corners, and feasible design points.kessetsu_share_link: Generates a self-contained, clickablehttps://kessetsu.com/#kessetsu=1...Web Hub URL (kessetsu.share_link.v1) from.kessor SPICE source so the user can open, inspect, and simulate the circuit in one click.
The disciplined loop
- Requirements first. Turn the request into measurable limits before choosing a
topology. Write them to
requirements.kessreq(assertion lines only). Never weaken a limit to make a design pass; if a limit looks impossible, report it to the human. - Design in readable source. Write
design.kesswith named nets for every signal that matters (IN,OUT,VCC...), a comment stating the target, and modules for repeated blocks. Initial component values can be sized usingkessetsu_tool(voltage dividers, RC low-pass filters, non-inverting op-amp stages, and Zener shunt regulators with exact, E12, or E24 series). SPICE netlists are accepted too (see below), but.kessis the reviewable format. - Check structure. Call
kessetsu_check. Fix every ERC error (floating pins, shorted sources, ambiguous ground) before simulating; these are the root cause of most cryptic simulator failures. - Test against the requirements. Call
kessetsu_testwith the design and the unchanged requirements text (if using the CLI on a file path afterkess simulate, pass--forcesokess testcan overwrite the companion<design>.spiceartifact, or pipe via-). Iterate on the design only. Each assertion returns PASS/FAIL/ERROR/SKIPPED with its measured value. For parameter variations, corner analysis, or Monte Carlo distributions, callkessetsu_study_planandkessetsu_study_run. - Show the human. Call
kessetsu_render_schematicand saveschematic.svgnext to the design. A person can review a schematic; nobody reviews a netlist. - Hand off and share. Export what the next step needs (
kicad,ltspice,bom-csv,spice) and callkessetsu_share_link(orkess share) to generate a self-containedhttps://kessetsu.com/#kessetsu=1...Web Hub link. - Report honestly. Summarize: requirements, final PASS table, clickable Web Hub share link, assumptions (ideal sources, generic models, no tolerances unless studied), and open risks.
Recommended project layout:
my-circuit/
requirements.kessreq # acceptance criteria, owned by the human/evaluator
design.kess # the circuit, edited by the agent
schematic.svg # rendered for review
design.kicad_sch # optional handoff
NOTES.md # decisions, assumptions, final PASS table
Kessetsu source in one screen
// Target: 1 kHz RC low-pass, unity passband gain.
net GND
net IN
net OUT
source VIN ac(1V) // also: 5V, sine(0V,1V,1kHz), sine_ac(0V,1V,1kHz,1V), pulse(...), pwl(...)
resistor R1 1k
capacitor C1 159nF
connect VIN.plus, R1.p1 to IN
connect R1.p2, C1.p1 to OUT
connect VIN.minus, C1.p2 to GND
simulate ac dec 40 10Hz 100kHz // also: op | tran 10us 5ms | dc VIN 0V 5V 100mV
- Components and pins:
resistor|capacitor|inductor(p1,p2),diode D1 1N4148(p1,p2or aliasesanode/a,cathode/k; built-ins include1N4148,1N4007,1N5819,LED_RED,LED_GREEN,LED_BLUE,LED_WHITE,1N4733A,BZX84C3V3,BZX84C5V1,BZX84C12),transistor Q1 npn 2N3904(c,b,e; built-ins include2N3904,2N3906,2N2222,BC547,BC557),jfet J1 2N5457(d,g,s; built-ins2N5457,J201,2N5460),mosfet M1 IRF540(d,g,s, optionalb; built-ins includeIRF540,IRF9540,2N7000,BSS84),switch S1 [model](p1,p2,ctrl_p,ctrl_n),opamp U1 [KESSETSU_OPAMP_V1|KESSETSU_OPAMP_V2|LM358|TL072](in_p,in_n,vcc,vee,out),vcvs E1 2.0/vccs G1 10mS/ccvs H1 1k/cccs F1 50.0(p_out,n_out,ctrl_p,ctrl_n),source/current_source(plus,minus). net GNDis always SPICE node0. Name every net you will measure.- Initial conditions:
initial V(OUT) = 2.5V(or{v_init}, emits SPICE.icbefore.control). - Parameters:
param fc: Hz = 1kHz, thencapacitor C1 {1 / (2 * pi * 1k * fc)}. - Reusable blocks:
module LowPass(input,output,gnd) { ... }anduse LowPass F1(fc=2kHz). - Custom device models:
model diode D1 version=1.0.0 license=MIT Is=2n Rs=0.5 N=1.75.
The language reference is authoritative.
Requirements (.kessreq)
One assertion per line, literal limits only:
// Owned by the evaluator; the design agent must not edit this file.
assert upper_cutoff(V(OUT),V(IN)) > 950Hz
assert upper_cutoff(V(OUT),V(IN)) < 1050Hz
assert gain_at(V(OUT),V(IN),100Hz) > 0.99
Common metrics: value|min|max|peak|pk2pk|p2p|vpp|average|avg|rms(V(net)), gain(out,in),
gain_at(out,in,f), upper_cutoff/lower_cutoff(out,in), phase(out,in,f),
frequency/freq(V(net)[,start,stop]), period(V(net)[,start,stop]),
duty_cycle/duty(V(net)[,start,stop]), output_power(V(out),RL), efficiency(...),
thd(signal,f[,start,stop[,hann]]), rise_time/fall_time/settling_time/overshoot(...), dissipation(device).
Signals: V(net), V(net1,net2) (differential across OP/TRAN/DC/AC), V(device), V(component.pin,net), I(device), P(device). The
measurement reference defines exact semantics and the
analysis each metric needs (for example cutoff metrics need simulate ac).
Using SPICE you already have
Every circuit command accepts a supported Ngspice-style netlist directly. Kessetsu converts
it through the canonical importer, then applies the same ERC, simulation, assertions,
schematic and exports. Five-terminal op-amps (XU1 in_p in_n vcc vee out KESSETSU_OPAMP_V1
or OPAMP) become native opamp components, numeric SPICE nodes can be referenced directly
in .kessreq (V(1), V(2)), inline .model cards for D/NPN/PNP/NJF/PJF/NMOS/PMOS/SW are
imported as typed models, and root-level .ic V(node)=value directives convert natively to
initial V(NODE) = value; .control blocks and output/node-set directives (.print, .plot, .meas,
.nodeset, .options...) are skipped with warnings because Kessetsu owns measurement. Unsupported
constructs fail with line numbers instead of being dropped. See the
SPICE import guide.
Reading results
- Top-level
status:"success"means compilation, simulation and all assertions passed (exit code0). When any requirement fails,kess test/kessetsu_testreportsstatus: "test_failed"(exit code4); compile/ERC errors report"compile_failed"(exit code2), and simulator failures report"simulation_failed"(exit code3). - Assertion outcomes live in
assertions.assertions[*], where each entry carriescode,expression,status("PASS" | "FAIL" | "ERROR" | "SKIPPED"),actual,expectedandunit(aggregate counts are insummary.assertions). - Diagnostics carry stable codes:
KES-E*ERC,KES-C*semantic,KES-S*simulator,KES-T*assertions,KES-N*SPICE input. Fix the first error first. KES-S004(convergence/timestep) usually means a floating node, an ideal source loop, a missing DC path to ground, or an unrealistic step. Re-runkessetsu_checkand add realistic source/load resistance before touching simulator options.
Honest limits
Simulation evidence is not hardware validation. Built-in models are generic. Passing assertions prove only the stated conditions under the selected models and analyses. Say so in the final report.