@@ -12,14 +12,24 @@ runnable, measured, and clearly documented designs.
1212
1313## Existing Foundation
1414
15- The repository already contains most of the infrastructure needed for this
16- direction:
15+ The repository contains the infrastructure needed for this direction:
1716
1817- ` SpiceSharpParser.AIExamples ` contains 948 unique measured netlists. These
1918 provide candidates for human review and promotion into the cookbook.
2019- ` circuits/a-devices ` demonstrates a strong example format: runnable
2120 netlists, ` .SAVE ` , ` .PLOT ` , ` .MEAS ` , explanatory guides, and automated
2221 verification.
22+ - ` circuits/cookbook ` contains four complete application-oriented recipes
23+ across the pure-SPICE and CustomComponents tracks.
24+ - ` tools/cookbook-schematic ` renders deterministic, accessible SVG schematics
25+ from a SPICE netlist plus a compact ` schematic.toml ` layout. Its validator
26+ keeps displayed component and node names synchronized with the netlist.
27+ - ` tools/cookbook-report ` provides a read-only cookbook quality gate. It checks
28+ required documentation, analysis and output directives, measurement-table
29+ coverage, layout topology, SVG accessibility, and generated schematic
30+ freshness. It can emit stable JSON for CI or another AI tool.
31+ - Repository-local ` cookbook-schematic ` and ` cookbook-report ` skills document
32+ the corresponding AI workflows.
2333- The main documentation is comprehensive about syntax, analyses, and
2434 components, but it is not yet organized around practical things users can
2535 build.
@@ -28,6 +38,24 @@ The accepted AI examples should be treated as a quarry rather than published
2838as-is. Promoted circuits must receive an independent review of their topology,
2939equations, assumptions, measurements, and educational value.
3040
41+ ## Current Implementation Status
42+
43+ The initial cookbook milestone is complete:
44+
45+ - Rectifier power supply, PWM DAC, ideal-diode power OR, and simple PLL recipes
46+ are present in the user-facing catalog.
47+ - Every current recipe has a runnable ` .cir ` , full guide, checked-in
48+ ` schematic.toml ` , generated ` schematic.svg ` , and accessible ` response.svg ` .
49+ - All current schematic layouts display every parsed netlist component and
50+ render reproducibly from their checked-in sources.
51+ - The repository-local cookbook report passes without errors or warnings.
52+ - The data-driven ` CircuitCookbookTests ` suite compiles and simulates all
53+ current recipes and enforces their measurement ranges.
54+
55+ The next circuit should be the BJT audio preamplifier. It expands the
56+ pure-SPICE track with operating-point and AC analysis instead of adding another
57+ transient-only example.
58+
3159## Cookbook Tracks
3260
3361Maintain two visible tracks.
@@ -49,7 +77,7 @@ complete applications rather than isolated component behavior.
4977| Circuit | Foundation | Status | What it demonstrates |
5078| --- | --- | --- | --- |
5179| Rectifier, reservoir, and simple regulator | Pure SPICE | Complete | Diodes, ripple, load regulation, startup, and peak current |
52- | BJT audio preamplifier | Pure SPICE | Planned | Bias point, AC gain, bandwidth, clipping, and Fourier distortion |
80+ | BJT audio preamplifier | Pure SPICE | Next | Bias point, AC gain, bandwidth, clipping, and Fourier distortion |
5381| PWM-to-analog converter | Pure SPICE | Complete | Switching, settling time, average output, and ripple |
5482| Transmission-line termination experiment | Pure SPICE | Planned | Reflections, propagation delay, and source/load matching |
5583| Ideal-diode redundant power input | CustomComponents | Complete | Supply OR-ing, failover, and reverse-current blocking |
@@ -58,31 +86,28 @@ complete applications rather than isolated component behavior.
5886| Sampled sensor alarm or data recorder | Sample-and-hold plus digital library | Planned | A complete analog-to-digital signal chain |
5987| Simple phase-locked loop | ` PHASEDET ` , loop filter, and ` MODULATOR ` | Complete | A mixed-signal system assembled from existing components |
6088
61- ## Recommended Starting Sequence
89+ ## Completed Starting Sequence
90+
91+ The starting sequence established three complementary examples:
6292
63931 . ** Rectifier and filtered DC supply**
64- Establish the cookbook structure with an accessible, practical pure-SPICE
65- circuit.
94+ Established the cookbook structure with an accessible, practical
95+ pure-SPICE circuit.
6696
67972 . ** PWM DAC**
68- Add a compact transient example with clear measurements for output average,
69- ripple, and settling time.
98+ Added a compact transient example with clear measurements for output
99+ average, ripple, and settling time.
70100
711013 . ** Simple PLL**
72- Demonstrate that CustomComponents can form a complete mixed-signal system,
102+ Demonstrated that CustomComponents can form a complete mixed-signal system,
73103 rather than only isolated device examples.
74104
75- This sequence covers nonlinear analog behavior, switching behavior, and a
76- composed custom-component application without requiring new library features.
77-
78- The three-circuit starting sequence is complete. The ideal-diode redundant
79- power input is the first follow-on application. The next recommended addition
80- is the BJT audio preamplifier, which expands the pure-SPICE track with operating
81- point and AC analysis instead of adding another transient-only example.
105+ The ideal-diode redundant power input was the first follow-on application. The
106+ next addition is the BJT audio preamplifier.
82107
83- ## Proposed Repository Structure
108+ ## Current Repository Structure and Growth Path
84109
85- Add a user-oriented catalog while initially leaving existing historical and
110+ Keep the user-oriented catalog beside the source while leaving historical and
86111milestone directories intact.
87112
88113``` text
@@ -93,28 +118,38 @@ circuits/
93118 rectifier-power-supply/
94119 README.md
95120 rectifier-power-supply.cir
121+ schematic.toml
96122 schematic.svg
97123 response.svg
98124 pwm-dac/
99125 README.md
100126 pwm-dac.cir
127+ schematic.toml
101128 schematic.svg
102129 response.svg
103130 custom-components/
104131 ideal-diode-power-or/
105132 README.md
106133 ideal-diode-power-or.cir
134+ schematic.toml
107135 schematic.svg
108136 response.svg
109137 simple-pll/
110138 README.md
111139 simple-pll.cir
140+ schematic.toml
112141 schematic.svg
113142 response.svg
143+ tools/
144+ cookbook-schematic/
145+ cookbook-report/
146+ .agents/skills/
147+ cookbook-schematic/
148+ cookbook-report/
114149```
115150
116- The root ` circuits/README.md ` should be the searchable cookbook catalog. It
117- should classify circuits by application, required package, analysis type, and
151+ The root ` circuits/README.md ` is the searchable cookbook catalog. It should
152+ classify circuits by application, required package, analysis type, and
118153difficulty.
119154
120155Implementation-oriented examples such as ` digital-milestone-a ` can remain as
@@ -143,7 +178,10 @@ Every circuit `README.md` should use the same order.
143178 compatibility.
144179
1451804 . ** Schematic**
146- Include a readable SVG with node names matching the netlist.
181+ Include a readable, accessible SVG with component and node names matching
182+ the netlist. Keep layout intent in ` schematic.toml ` , generate
183+ ` schematic.svg ` with ` cookbook-schematic ` , and do not hand-edit the generated
184+ SVG.
147185
1481865 . ** Runnable netlist**
149187 Link to the complete ` .cir ` file. Include only the most instructive excerpt
@@ -162,7 +200,9 @@ Every circuit `README.md` should use the same order.
162200
1632019 . ** Expected behavior and measurements**
164202 Identify the important waveforms and compare ` .MEAS ` results with calculated
165- targets or documented acceptance ranges.
203+ targets or documented acceptance ranges. Include an accessible
204+ ` response.svg ` that summarizes the signals and scalar results discussed in
205+ the guide.
166206
16720710 . ** Experiments**
168208 Suggest safe parameter changes that help users understand or adapt the
@@ -205,13 +245,91 @@ A cookbook circuit is complete only when it satisfies all of the following:
205245- The documentation compares simulation with theory or an independent
206246 expectation.
207247- Saved waveforms and plots correspond to the signals discussed in the guide.
208- - The schematic and netlist use matching names.
248+ - ` schematic.toml ` passes topology and netlist-reference validation.
249+ - ` schematic.svg ` is a fresh renderer output and uses matching component and
250+ node names.
251+ - Both SVG assets have useful accessible title and description metadata.
209252- The model boundary and significant limitations are explicit.
210253- Another user can run it by following only the documented instructions.
211254
255+ Run the fast, read-only structural and generated-asset gate first:
256+
257+ ``` powershell
258+ .\tools\cookbook-schematic\.venv\Scripts\cookbook-report
259+ ```
260+
261+ Use deterministic JSON when CI or an AI agent needs to consume the result:
262+
263+ ``` powershell
264+ .\tools\cookbook-schematic\.venv\Scripts\cookbook-report `
265+ --format json --output artifacts\cookbook-report.json
266+ ```
267+
268+ Then run the compile, simulation, plot, and measurement regression suite:
269+
270+ ``` powershell
271+ dotnet test src\SpiceSharpParser.Tests\SpiceSharpParser.Tests.csproj `
272+ --filter 'FullyQualifiedName~CircuitCookbookTests'
273+ ```
274+
212275Portable-SPICE claims should be checked with another simulator when practical.
213276Native LTspice comparison can continue for LTspice A-device examples.
214277
278+ ## Tooling Roadmap
279+
280+ Develop the cookbook tooling in small, independently useful layers.
281+
282+ ### Complete: schematic source and rendering
283+
284+ ` cookbook-schematic ` supplies a versioned TOML layout, netlist-aware
285+ validation, deterministic accessible SVG rendering, and a documented AI
286+ workflow. Continue extending its symbol vocabulary only when a real cookbook
287+ circuit needs a conventional symbol that cannot be expressed clearly today.
288+
289+ ### Complete: read-only cookbook report
290+
291+ ` cookbook-report ` discovers recipes and produces deterministic text or JSON. It
292+ checks the static cookbook contract and compares each checked-in schematic with
293+ a fresh render without overwriting repository files.
294+
295+ ### Next: recipe manifest and data-driven coverage
296+
297+ Add one small versioned manifest per recipe containing its netlist, required
298+ dialect or custom mappings, analysis types, measurement acceptance ranges, and
299+ catalog metadata. Migrate ` CircuitCookbookTests ` from hard-coded cases to these
300+ manifests so adding a recipe does not require editing a central C# list.
301+
302+ The report should then compare manifest measurement names with ` .MEAS `
303+ statements and the guide's Verified Measurements table.
304+
305+ ### Later: structured simulation reports
306+
307+ Add a thin .NET runner that compiles each manifest with the correct dialect and
308+ custom mappings, executes its analyses, and returns versioned JSON containing
309+ diagnostics, plot names, measurement values, and convergence status. Integrate
310+ that output into ` cookbook-report ` only after the JSON contract is stable.
311+
312+ ### Later: deterministic response summaries and catalog generation
313+
314+ Generate ` response.svg ` from reviewed plot specifications plus structured
315+ simulation results, while retaining visual review as a required step. Generate
316+ the catalog table from recipe manifests once the manifest schema has proved
317+ stable across several additional circuits.
318+
319+ ## Immediate Next Steps
320+
321+ 1 . Add the BJT audio preamplifier with OP, AC, and transient measurements.
322+ 2 . Define and trial the recipe manifest on the BJT recipe and one existing
323+ pure-SPICE recipe.
324+ 3 . Migrate the remaining cookbook test cases after the manifest format is
325+ validated.
326+ 4 . Implement the structured .NET simulation runner and add an opt-in
327+ simulation mode to ` cookbook-report ` .
328+ 5 . Add deterministic ` response.svg ` generation after structured simulation
329+ output and plot specifications are available.
330+ 6 . Cross-check portable-SPICE recipes with an independent simulator where
331+ practical.
332+
215333## Keeping the Project Small
216334
217335Use the following constraints to prevent the cookbook effort from becoming
@@ -234,6 +352,10 @@ feature growth:
234352- Document expected values and tolerances; let CI report current test counts.
235353- Prefer one authoritative circuit guide instead of separate requirements,
236354 documentation, and results files unless the design is genuinely complex.
355+ - Keep generated files reproducible from compact, reviewable source files; do
356+ not introduce a new generator without a corresponding freshness check.
357+ - Keep report and validation commands read-only unless their command name and
358+ documentation explicitly promise generation or repair.
237359
238360## Selection Criteria
239361
0 commit comments