copperflow 0.3.3 → 0.3.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (230) hide show
  1. package/README.md +36 -0
  2. package/dist/app/assets/{NewPartDialog-B_cnPuI-.js → NewPartDialog-C4sKWnGI.js} +2 -2
  3. package/dist/app/assets/index-BgzJedaB.css +1 -0
  4. package/dist/app/assets/index-C_U9me2P.js +19 -0
  5. package/dist/app/index.html +2 -2
  6. package/dist/cli-commands.js +51 -8
  7. package/dist/cli-commands.js.map +1 -1
  8. package/dist/cli-library.d.ts +5 -0
  9. package/dist/cli-library.js +58 -0
  10. package/dist/cli-library.js.map +1 -0
  11. package/dist/cli-modules.d.ts +6 -0
  12. package/dist/cli-modules.js +33 -0
  13. package/dist/cli-modules.js.map +1 -0
  14. package/dist/cli-studio.d.ts +1 -0
  15. package/dist/cli-studio.js +27 -0
  16. package/dist/cli-studio.js.map +1 -0
  17. package/dist/core/board-import.d.ts +39 -0
  18. package/dist/core/board-import.js +114 -0
  19. package/dist/core/board-import.js.map +1 -0
  20. package/dist/core/board-shape-edit.d.ts +13 -0
  21. package/dist/core/board-shape-edit.js +134 -0
  22. package/dist/core/board-shape-edit.js.map +1 -0
  23. package/dist/core/edit.js +9 -3
  24. package/dist/core/edit.js.map +1 -1
  25. package/dist/core/git.d.ts +16 -0
  26. package/dist/core/git.js +51 -0
  27. package/dist/core/git.js.map +1 -0
  28. package/dist/core/home.d.ts +2 -0
  29. package/dist/core/home.js +10 -0
  30. package/dist/core/home.js.map +1 -0
  31. package/dist/core/index.d.ts +1 -0
  32. package/dist/core/index.js +1 -0
  33. package/dist/core/index.js.map +1 -1
  34. package/dist/core/instance-copper.d.ts +25 -0
  35. package/dist/core/instance-copper.js +142 -0
  36. package/dist/core/instance-copper.js.map +1 -0
  37. package/dist/core/instance-move.d.ts +23 -0
  38. package/dist/core/instance-move.js +59 -0
  39. package/dist/core/instance-move.js.map +1 -0
  40. package/dist/core/instance-requests.d.ts +3 -2
  41. package/dist/core/instance-requests.js +17 -3
  42. package/dist/core/instance-requests.js.map +1 -1
  43. package/dist/core/library-modules.d.ts +29 -0
  44. package/dist/core/library-modules.js +324 -0
  45. package/dist/core/library-modules.js.map +1 -0
  46. package/dist/core/library-sources.d.ts +33 -0
  47. package/dist/core/library-sources.js +179 -0
  48. package/dist/core/library-sources.js.map +1 -0
  49. package/dist/core/modules.d.ts +44 -0
  50. package/dist/core/modules.js +284 -0
  51. package/dist/core/modules.js.map +1 -0
  52. package/dist/core/new-circuit-sheets.d.ts +11 -2
  53. package/dist/core/new-circuit-sheets.js +35 -6
  54. package/dist/core/new-circuit-sheets.js.map +1 -1
  55. package/dist/core/placement-write.d.ts +2 -0
  56. package/dist/core/placement-write.js +12 -6
  57. package/dist/core/placement-write.js.map +1 -1
  58. package/dist/core/plain-sheet.d.ts +12 -0
  59. package/dist/core/plain-sheet.js +169 -0
  60. package/dist/core/plain-sheet.js.map +1 -0
  61. package/dist/core/sheet-card.d.ts +33 -0
  62. package/dist/core/sheet-card.js +118 -0
  63. package/dist/core/sheet-card.js.map +1 -0
  64. package/dist/core/types.d.ts +20 -0
  65. package/dist/core/workspace.d.ts +4 -0
  66. package/dist/core/workspace.js +13 -2
  67. package/dist/core/workspace.js.map +1 -1
  68. package/dist/engine/checks/drc-parts.js +7 -7
  69. package/dist/engine/checks/drc-parts.js.map +1 -1
  70. package/dist/engine/checks/erc.js +35 -3
  71. package/dist/engine/checks/erc.js.map +1 -1
  72. package/dist/engine/component.d.ts +2 -0
  73. package/dist/engine/component.js +18 -1
  74. package/dist/engine/component.js.map +1 -1
  75. package/dist/engine/dxf/board.d.ts +42 -0
  76. package/dist/engine/dxf/board.js +218 -0
  77. package/dist/engine/dxf/board.js.map +1 -0
  78. package/dist/engine/dxf/index.d.ts +2 -0
  79. package/dist/engine/dxf/index.js +3 -0
  80. package/dist/engine/dxf/index.js.map +1 -0
  81. package/dist/engine/dxf/reader.d.ts +43 -0
  82. package/dist/engine/dxf/reader.js +142 -0
  83. package/dist/engine/dxf/reader.js.map +1 -0
  84. package/dist/engine/elaborate.js +14 -4
  85. package/dist/engine/elaborate.js.map +1 -1
  86. package/dist/engine/fab/designator-places.d.ts +101 -0
  87. package/dist/engine/fab/designator-places.js +259 -0
  88. package/dist/engine/fab/designator-places.js.map +1 -0
  89. package/dist/engine/fab/designators.d.ts +26 -14
  90. package/dist/engine/fab/designators.js +320 -70
  91. package/dist/engine/fab/designators.js.map +1 -1
  92. package/dist/engine/fab/layers.js +6 -6
  93. package/dist/engine/fab/layers.js.map +1 -1
  94. package/dist/engine/fab/stroke-font.d.ts +2 -2
  95. package/dist/engine/fab/stroke-font.js +7 -6
  96. package/dist/engine/fab/stroke-font.js.map +1 -1
  97. package/dist/engine/model.d.ts +15 -1
  98. package/dist/engine/model.js.map +1 -1
  99. package/dist/engine/pcb-place/block-board.d.ts +9 -0
  100. package/dist/engine/pcb-place/block-board.js +256 -0
  101. package/dist/engine/pcb-place/block-board.js.map +1 -0
  102. package/dist/engine/pcb-place/blocks.d.ts +31 -6
  103. package/dist/engine/pcb-place/blocks.js +37 -8
  104. package/dist/engine/pcb-place/blocks.js.map +1 -1
  105. package/dist/engine/pcb-place/constructive.d.ts +3 -2
  106. package/dist/engine/pcb-place/constructive.js +14 -2
  107. package/dist/engine/pcb-place/constructive.js.map +1 -1
  108. package/dist/engine/pcb-place/index.d.ts +8 -0
  109. package/dist/engine/pcb-place/index.js +7 -0
  110. package/dist/engine/pcb-place/index.js.map +1 -1
  111. package/dist/engine/pcb-place/scope.js +6 -1
  112. package/dist/engine/pcb-place/scope.js.map +1 -1
  113. package/dist/engine/pcb.d.ts +6 -0
  114. package/dist/engine/pcb.js +12 -1
  115. package/dist/engine/pcb.js.map +1 -1
  116. package/dist/engine/router/replicate.js +4 -0
  117. package/dist/engine/router/replicate.js.map +1 -1
  118. package/dist/engine/router/route-board.d.ts +2 -0
  119. package/dist/engine/router/route-board.js +27 -1
  120. package/dist/engine/router/route-board.js.map +1 -1
  121. package/dist/engine/sheet-ports.d.ts +17 -1
  122. package/dist/engine/sheet-ports.js +38 -1
  123. package/dist/engine/sheet-ports.js.map +1 -1
  124. package/dist/mcp/batch.d.ts +2 -2
  125. package/dist/mcp/batch.js +12 -12
  126. package/dist/mcp/batch.js.map +1 -1
  127. package/dist/mcp/board-import-tool.d.ts +25 -0
  128. package/dist/mcp/board-import-tool.js +25 -0
  129. package/dist/mcp/board-import-tool.js.map +1 -0
  130. package/dist/mcp/board-summary.d.ts +1 -1
  131. package/dist/mcp/board-summary.js +1 -1
  132. package/dist/mcp/board-summary.js.map +1 -1
  133. package/dist/mcp/copper-tools.d.ts +4 -4
  134. package/dist/mcp/copper-tools.js +19 -19
  135. package/dist/mcp/copper-tools.js.map +1 -1
  136. package/dist/mcp/create-part.d.ts +1 -1
  137. package/dist/mcp/create-part.js +8 -8
  138. package/dist/mcp/create-part.js.map +1 -1
  139. package/dist/mcp/datasheet-tools.d.ts +1 -1
  140. package/dist/mcp/datasheet-tools.js +4 -4
  141. package/dist/mcp/datasheet-tools.js.map +1 -1
  142. package/dist/mcp/fillet-tools.d.ts +2 -2
  143. package/dist/mcp/fillet-tools.js +6 -6
  144. package/dist/mcp/fillet-tools.js.map +1 -1
  145. package/dist/mcp/guide.d.ts +1 -1
  146. package/dist/mcp/guide.js +4 -3
  147. package/dist/mcp/guide.js.map +1 -1
  148. package/dist/mcp/import-part.d.ts +1 -1
  149. package/dist/mcp/import-part.js +4 -4
  150. package/dist/mcp/import-part.js.map +1 -1
  151. package/dist/mcp/make-sheet.d.ts +1 -1
  152. package/dist/mcp/make-sheet.js +6 -6
  153. package/dist/mcp/make-sheet.js.map +1 -1
  154. package/dist/mcp/module-tools.d.ts +4 -0
  155. package/dist/mcp/module-tools.js +21 -0
  156. package/dist/mcp/module-tools.js.map +1 -0
  157. package/dist/mcp/new-circuit.d.ts +13 -2
  158. package/dist/mcp/new-circuit.js +30 -28
  159. package/dist/mcp/new-circuit.js.map +1 -1
  160. package/dist/mcp/open-studio.d.ts +30 -0
  161. package/dist/mcp/open-studio.js +97 -0
  162. package/dist/mcp/open-studio.js.map +1 -0
  163. package/dist/mcp/place-tools.d.ts +2 -2
  164. package/dist/mcp/place-tools.js +14 -11
  165. package/dist/mcp/place-tools.js.map +1 -1
  166. package/dist/mcp/pour-tools.d.ts +4 -4
  167. package/dist/mcp/pour-tools.js +18 -18
  168. package/dist/mcp/pour-tools.js.map +1 -1
  169. package/dist/mcp/project-tools.d.ts +3 -3
  170. package/dist/mcp/project-tools.js +8 -8
  171. package/dist/mcp/project-tools.js.map +1 -1
  172. package/dist/mcp/render-tool.d.ts +1 -1
  173. package/dist/mcp/render-tool.js +6 -6
  174. package/dist/mcp/render-tool.js.map +1 -1
  175. package/dist/mcp/route-tools.d.ts +2 -2
  176. package/dist/mcp/route-tools.js +10 -10
  177. package/dist/mcp/route-tools.js.map +1 -1
  178. package/dist/mcp/server.js +47 -31
  179. package/dist/mcp/server.js.map +1 -1
  180. package/dist/mcp/sheet-card-tools.d.ts +28 -0
  181. package/dist/mcp/sheet-card-tools.js +45 -0
  182. package/dist/mcp/sheet-card-tools.js.map +1 -0
  183. package/dist/render/render.js +75 -20
  184. package/dist/studio/idle.d.ts +7 -0
  185. package/dist/studio/idle.js +34 -0
  186. package/dist/studio/idle.js.map +1 -0
  187. package/dist/studio/place-runner.js +1 -1
  188. package/dist/studio/place-runner.js.map +1 -1
  189. package/dist/studio/run-studio.d.ts +21 -0
  190. package/dist/studio/run-studio.js +68 -0
  191. package/dist/studio/run-studio.js.map +1 -0
  192. package/dist/studio/server.d.ts +5 -0
  193. package/dist/studio/server.js +24 -2
  194. package/dist/studio/server.js.map +1 -1
  195. package/dist/studio/studio-control.d.ts +6 -0
  196. package/dist/studio/studio-control.js +14 -0
  197. package/dist/studio/studio-control.js.map +1 -0
  198. package/dist/studio/studio-note.d.ts +33 -0
  199. package/dist/studio/studio-note.js +130 -0
  200. package/dist/studio/studio-note.js.map +1 -0
  201. package/dist/version.d.ts +1 -1
  202. package/dist/version.js +1 -1
  203. package/library/modules/CanNode/CanNode.sheet.tsx +65 -0
  204. package/library/modules/CanNode/module.json +4 -0
  205. package/library/modules/CanNode/parts/MCP2515-I-SO/MCP2515_I_SO.tsx +10 -0
  206. package/library/modules/CanNode/parts/MCP2515-I-SO/part.yaml +64 -0
  207. package/library/modules/CanNode/parts/MCP2515-I-SO/verification.md +42 -0
  208. package/library/modules/CanNode/parts/TJA1051T-3/TJA1051T_3.tsx +10 -0
  209. package/library/modules/CanNode/parts/TJA1051T-3/part.yaml +34 -0
  210. package/library/modules/CanNode/parts/TJA1051T-3/verification.md +28 -0
  211. package/library/modules/DigitalInput24V/DigitalInput24V.sheet.tsx +24 -0
  212. package/library/modules/DigitalInput24V/module.json +4 -0
  213. package/library/modules/RelayDriver/RelayDriver.sheet.tsx +39 -0
  214. package/library/modules/RelayDriver/module.json +4 -0
  215. package/library/modules/RelayDriver/parts/AO3400A/AO3400A.tsx +11 -0
  216. package/library/modules/RelayDriver/parts/AO3400A/part.yaml +21 -0
  217. package/library/modules/RelayDriver/parts/AO3400A/verification.md +24 -0
  218. package/library/modules/RelayDriver/parts/SRD-12VDC-SL-C/SRD_12VDC_SL_C.tsx +11 -0
  219. package/library/modules/RelayDriver/parts/SRD-12VDC-SL-C/footprint.yaml +70 -0
  220. package/library/modules/RelayDriver/parts/SRD-12VDC-SL-C/part.yaml +31 -0
  221. package/library/modules/RelayDriver/parts/SRD-12VDC-SL-C/verification.md +37 -0
  222. package/package.json +2 -1
  223. package/skills/copperflow/SKILL.md +16 -16
  224. package/skills/copperflow/references/copper.md +81 -6
  225. package/skills/copperflow/references/modules.md +80 -0
  226. package/skills/copperflow/references/planning.md +55 -11
  227. package/skills/copperflow/references/writing-circuits.md +29 -3
  228. package/skills/copperflow-plan/SKILL.md +7 -4
  229. package/dist/app/assets/index-CSWIIMFE.css +0 -1
  230. package/dist/app/assets/index-CjN3tctq.js +0 -19
@@ -0,0 +1,31 @@
1
+ title: Songle SRD relay, 12 V coil (400 ohm, 30 mA), SPDT changeover, 10 A
2
+ description: "Pads from the DRILLING drawing on page 1 of the Songle SRD
3
+ datasheet, read as the bottom view and mirrored to the top view. The datasheet
4
+ gives no hole size: 1.3 mm drill chosen for the 1.1 x 0.4 mm contact leads.
5
+ Pin numbers are this library's own (the datasheet numbers none)."
6
+ manufacturer: Ningbo Songle Relay
7
+ mpn: SRD-12VDC-SL-C
8
+ origin: written 2026-11-17
9
+ footprint: footprint.yaml
10
+ pins:
11
+ "1":
12
+ name: COM
13
+ type: passive
14
+ "2":
15
+ name: COIL1
16
+ type: passive
17
+ "3":
18
+ name: COIL2
19
+ type: passive
20
+ "4":
21
+ name: NO
22
+ type: passive
23
+ "5":
24
+ name: NC
25
+ type: passive
26
+ suppliers:
27
+ lcsc: C30431
28
+ datasheet:
29
+ url: https://www.circuitbasics.com/wp-content/uploads/2015/11/SRD-05VDC-SL-C-Datasheet.pdf
30
+ title: Songle Relay SRD datasheet
31
+ datasheet_pages: 1 (DRILLING and WIRING DIAGRAM), 2 (coil data, contact rating)
@@ -0,0 +1,37 @@
1
+ # Verification of Songle SRD relay, 12 V coil (400 ohm, 30 mA), SPDT changeover, 10 A
2
+
3
+ Status: not verified
4
+ Content: 23f012c42e27 (changes when part.yaml or footprint.yaml changes)
5
+
6
+ Check each item against the datasheet and write the page next to it. When everything is
7
+ checked, run in a terminal: copperflow parts verify SRD-12VDC-SL-C --by "<your name>" --against "<datasheet, revision, page>"
8
+
9
+ - [ ] Pins from Songle Relay SRD datasheet, page(s) 1 (DRILLING and WIRING DIAGRAM), 2 (coil data, contact rating): compare each pin
10
+ - [ ] Pin 1 is COM (passive)
11
+ - [ ] Pin 2 is COIL1 (passive)
12
+ - [ ] Pin 3 is COIL2 (passive)
13
+ - [ ] Pin 4 is NO (passive)
14
+ - [ ] Pin 5 is NC (passive)
15
+ - [ ] Footprint footprint.yaml matches the package drawing
16
+ - [ ] Every pad in footprint.yaml matches the recommended land pattern (position, size, drill)
17
+ - [ ] lcsc part C30431 is this exact part
18
+
19
+ ## Where each item was read
20
+
21
+ Songle Relay SRD datasheet, 2 pages: https://www.circuitbasics.com/wp-content/uploads/2015/11/SRD-05VDC-SL-C-Datasheet.pdf
22
+ (the same 2-page sheet covers every SRD coil voltage; the LCSC copy for C30431 could not be opened).
23
+
24
+ - Page 1, DRILLING: common 1.4 mm in from the body edge on the centre line; coil pins 2 +/- 0.05 mm further in,
25
+ 12 +/- 0.05 mm apart (6 mm either side); contact pins 12.2 +/- 0.05 mm beyond the coil pins, 12 mm apart.
26
+ - Page 1, DIMENSION: body 19.1 x 15.5 mm max, 15.3 mm high; leads 1 x 0.4 mm (contacts) and 0.6 mm, 0.3 mm thick.
27
+ No hole size is given: the 1.3 mm drill and 2.5 mm round pads are this part's choice, not the datasheet's.
28
+ - Page 1, WIRING DIAGRAM: coil between the two pins beside the common; the blade from the common rests on the
29
+ contact on the side drawn at the bottom of the diagram (normally closed); the other contact is normally open.
30
+ - The datasheet does not say whether the drilling and wiring drawings are seen from the top or the bottom.
31
+ They were read as the bottom view (the usual convention for a drilling plan) and mirrored: on this
32
+ footprint (top view, common on the left) NC is pad 5 at y = +6 and NO is pad 4 at y = -6. If the drawing
33
+ is a top view, NO and NC are swapped. Check with an ohmmeter on a relay in hand.
34
+ - Pin numbers 1 to 5 are this library's own; the datasheet numbers no pins.
35
+ - Page 2, COIL DATA: 12 V coil (high sensitivity, L, 0.36 W): 30 mA, 400 ohm +/- 10 %, pull-in 75 % max,
36
+ drop-out 10 % min. CONTACT RATING (form C): 7 A 28 VDC, 10 A 125 VAC, 7 A 240 VAC resistive.
37
+ - Page 1, RATING: UL/CUL 10 A 125 VAC 28 VDC, TUV 10 A 240 VAC 28 VDC.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "copperflow",
3
- "version": "0.3.3",
3
+ "version": "0.3.4",
4
4
  "description": "Design circuits in code with a human and an AI agent editing the same files.",
5
5
  "license": "Apache-2.0",
6
6
  "author": "Eren Kürpe",
@@ -29,6 +29,7 @@
29
29
  },
30
30
  "files": [
31
31
  "dist",
32
+ "library",
32
33
  "skills",
33
34
  "LICENSE",
34
35
  "NOTICE"
@@ -45,7 +45,7 @@ means, `replace`, refused pins and the export's warnings are in
45
45
  [references/writing-circuits.md](references/writing-circuits.md).
46
46
 
47
47
  1. **Plan.** A new board starts with [references/planning.md](references/planning.md): every
48
- question for the person in one message, blocks with ports, a sub-agent per block. Then `set_project`
48
+ question in one message, a search for sources, blocks with ports, a sub-agent each. Then `set_project`
49
49
  `{ intent, blocks: [{ name, does, status }], open }` writes PROJECT.md:
50
50
  `Change c0001: Intent, Blocks, Open written to PROJECT.md`. `intent` is a string of at most
51
51
  2000 characters, `blocks` an array of at most 50 objects, `open` an array of at most 50
@@ -105,21 +105,21 @@ means, `replace`, refused pins and the export's warnings are in
105
105
  6. **Ask the person before the PCB.** Stop here. Run `check_circuit` and fix its errors, then
106
106
  summarise the blocks and the parts chosen (and which are unverified) and ask whether to go on
107
107
  to the board. Wait for a yes; `note_decision` what they approved.
108
- 7. **Place.** A small board (a dozen or two parts, no sheets): one `autoplace` `{ file }`. A larger
109
- one, or with sheets, block by block: `{ file, instance: "CH1" }` or `{ file, parts: [...] }`, the
110
- block with most connections (the MCU) first, connectors last. One change: `Placed 12 parts; wire
111
- length 184 mm (was 412); board 42 × 28 mm; 0 overlaps`, `Change c0007; …`, `Not placed:`, `Notes:`.
112
- Parts a person placed or locked stay and are worked round. A sheet holds one layout for all
113
- its instances: the first one placed sets it, and `autoplace` moves each other instance as a
114
- whole by its anchor (`{ instance: "CH2" }`, or the whole board), noting `CH2 was moved as a block`.
115
- `Not placed: U1 (no free spot …)`: make the board larger (`fit_board` with a larger `margin`) and run
116
- `autoplace` again, or place that part with `set_props` `{ pcbX, pcbY }` and `autoplace` the
117
- rest. Then read `board_summary`'s longest connections: a part far from the pin it serves (a
118
- crystal, a pull-up) shows there with both pads' places; move it with `set_props` `{ pcbX, pcbY }`
119
- and `autoplace` leaves it alone from then on. Do not repeat `autoplace` hoping for better.
120
- 8. **Board shape and connectors.** `fit_board` `{ file, margin? }`:
121
- `Change c0010: board 42 × 28 mm (margin 2 mm)`; or `autoplace` with `fit: true`.
122
- Mounting holes with `add_hole` `{ file, x, y, diameter }`.
108
+ 7. **Place.** A small board (a dozen or two parts, no sheets): one `autoplace` `{ file }`. With
109
+ sheets, blocks first: `autoplace` `{ file, instance: "CH1" }` packs one sheet's first instance
110
+ on its own, `autoroute` `{ file, instance: "CH1" }` routes its inside (`Routed 4 of 4 connections`;
111
+ a `short` with copies still sitting on it lasts until the board is placed), `render` to look.
112
+ Then the board, `autoplace` `{ file, fit: true }`: connectors on the edges, the block with most
113
+ connections first, every instance whole, side by side, turned alike, with its block's copper
114
+ (`CH2 was moved as a block, keeping the arrangement of CH1`, `Copper: 32 pieces of copper went
115
+ with …`); then pours and `autoroute` for the tracks between blocks. One change: `Placed 34 parts;
116
+ wire length 233 mm (was 197); board 32 × 24 mm; 0 overlaps`, `Change c0007; …`, `Not placed:`, `Notes:`.
117
+ Parts a person placed or locked stay. `set_props` `{ pcbX, pcbY, pcbRotation }` on an instance's
118
+ name moves it with its copper; copper leaving it is removed (unrouted again).
119
+ `Not placed: U1 (no free spot …)`: `fit: true`, or place it with `set_props` `{ pcbX, pcbY }`.
120
+ `board_summary`'s longest connections show a part far from the pin it serves; move it with
121
+ `set_props`. Do not repeat `autoplace` hoping for better. Details: [references/copper.md](references/copper.md).
122
+ 8. **Board shape.** `fit_board` `{ file, margin? }`: `Change c0010: board 42 × 28 mm (margin 2 mm)`; holes: `add_hole`. A `.dxf` in the project: step 7 starts with `import_board`, then `render` (copper.md).
123
123
  9. **Fine tuning.** `board_summary` `{ file }` reads the board: `main.circuit.tsx: Board 42 × 28 mm,
124
124
  2 layers, courtyards use 38%; 24 parts, 18 nets`, one line per part
125
125
  (`U1 MCP2515 soic18w @(12.0, 8.5) r90 top [LOCKED]`), the ten longest connections with both pads' places,
@@ -2,6 +2,17 @@
2
2
 
3
3
  Read before you place or route a board, or draw copper by hand.
4
4
 
5
+ ## The board from a drawing
6
+
7
+ When the person has put a `.dxf` in the project folder, `import_board` `{ file, dxf }` first, then
8
+ `render` to look, then place. One change: the largest closed shape is the outline (centred on the
9
+ origin; `origin: "keep"` leaves it as drawn), circles inside it are mounting holes, other closed
10
+ shapes inside it become keepouts on all layers (not cut out of the board). It answers
11
+ `Change c0003: board outline from enclosure.dxf: 12 corners, 82 x 54 mm (drawing in mm, moved by
12
+ -41, -27)`, then the holes, the keepouts and `Not used: 2 SPLINE, …`. `layer` picks the outline's
13
+ layer when the largest shape is not the board; `units` overrides the file's; a board that has holes
14
+ or keepouts already needs `replace: true`. Placed parts stay; the answer names those now outside.
15
+
5
16
  ## Placing and routing
6
17
 
7
18
  Copper: place the parts first with `autoplace` (one history entry; parts without a position, or
@@ -12,15 +23,44 @@ an `instance`, within `budgetSeconds`, 20 s by default, and names each connectio
12
23
  route with the reason), then `check_circuit` once at the end (filter `copper` for the full list).
13
24
 
14
25
  One `autoplace` over the whole board is right for a small board (a dozen or two parts on one
15
- sheet). A larger board, or one with sub-sheets, is placed block by block: `{ instance }` or
16
- `{ parts: [...] }` for each block, the one with most connections first, connectors last. The
17
- placer keeps decoupling capacitors beside their supply pins, a crystal beside the two chip pins
26
+ sheet). A board with sub-sheets is laid out the way a person does it, blocks first:
27
+
28
+ 1. Each sheet's first instance on its own: `autoplace` `{ file, instance: "CH1" }` answers
29
+ `Placed 4 parts; …`. Its parts are packed tight, turned so the pads of a shared net face each
30
+ other; the unplaced parts of the rest of the board are not in its way. A sheet holds one layout
31
+ for all its instances, so the other copies sit on it for now.
32
+ 2. Its inside routed on its own: `autoroute` `{ file, instance: "CH1" }` answers
33
+ `Change …: Routed 4 of 4 connections in 1 pass`. Copies still sitting on it get no copy of the
34
+ route and show as a `short` until the board is placed; copies already placed the same way
35
+ elsewhere get the route copied.
36
+ 3. `render` `{ file, parts: ["R101", "C101"] }` to look at the block.
37
+ 4. The board: `autoplace` `{ file, fit: true }`. Connectors go on the edge nearest the blocks they
38
+ serve, pins inward; the block or chip with most connections first; then every instance as one
39
+ rigid block, side by side with the courtyard clearance between them, all instances of a sheet
40
+ with the same arrangement and the same turn (the one with least wire). Each copy takes its
41
+ block's inner copper. It answers `Placed 34 parts; …; 0 overlaps`, then `Notes: CH2 was moved as a
42
+ block, keeping the arrangement of CH1; …; Copper: 32 pieces of copper went with CH1, …`. A block
43
+ with no room on the board is put beside it, never on another block: without `fit` it is named
44
+ in `Not placed: CH8 (no free room on the board for its … block; …)`, with `fit` the board grows
45
+ round it.
46
+ 5. Pours, then `autoroute` `{ file }` for the tracks between blocks and to the connectors.
47
+
48
+ An instance is one thing on the board: `set_props` `{ file, part: "CH3", props: { pcbX, pcbY,
49
+ pcbRotation } }` moves and turns it with its inner copper (`Copper: 4 pieces of copper went with
50
+ CH3`); copper that left it (to a connector or another block) is removed and shows as unrouted
51
+ again (`… removed (now unrouted)`). The Studio's moves and the placer's do the same.
52
+
53
+ On a board without sub-sheets, place block by block with `{ parts: [...] }`, the part with most
54
+ connections first, connectors last. The placer keeps decoupling capacitors beside their supply pins, a crystal beside the two chip pins
18
55
  it is across with its load capacitors on its far side, and a pull-up or an LED's resistor beside
19
56
  the pin it serves. After `autoplace`, read `board_summary`'s longest connections: a part far
20
57
  from the pin it serves shows there with both pads' places. Move it with `set_props`
21
58
  `{ pcbX, pcbY, pcbRotation }`; it then has a position, and `autoplace` leaves it alone.
22
59
  Look at the board with `render` `{ file }` after `autoplace` and again after `autoroute`: it is the
23
60
  Studio's own drawing, what the person sees; `parts: ["U1", "C3"]` zooms to those parts.
61
+ When the person wants to watch, or asks to open copperflow or the editor, `open_studio {}` starts the
62
+ Studio (or finds the running one), opens it in their browser and answers with the address and its
63
+ key: give that address to the person only.
24
64
 
25
65
  Connectors are placed last, into the edge room the other parts left, so on a tight board a
26
66
  connector can land far from the part it serves. If `board_summary` or `copper_summary` shows a
@@ -48,7 +88,28 @@ track or via of that net). `add_via` and `remove_copper` add and remove, and rou
48
88
  `fillet_tracks` (`straighten_tracks` squares them again); each is one history entry, and the
49
89
  answer lists the copper violations the change introduced. Or move parts and run `autoroute`
50
90
  again; `unroute` (`nets` or `all: true`) takes back the router's copper and never hand-drawn
51
- copper.
91
+ copper, locked copper or router tracks that start on a locked part's pad (the answer names those).
92
+
93
+ Details of the copper tools:
94
+ - `layer` is `top` or `bottom`; `inner1` and `inner2` exist only on a 4-layer board and cannot be
95
+ routed in the Studio. With `from` and `to`, the layer defaults to the pads' shared layer; a
96
+ `from` or `to` may name a pin by name (`"U2.GND"`). `width` defaults to the net class's width,
97
+ else the fabrication default. No corner or segment may touch another net's copper.
98
+ - `add_via` takes its net from the pad or track under it unless `net` is given; its size follows
99
+ the net class and the fabrication minimum ring; `layers` defaults to `["top", "bottom"]`.
100
+ - `remove_copper` `{ id, segment }` removes one segment (0 is from the first point to the
101
+ second): the run before it stays as the track and the run after it becomes a new track; a run
102
+ of one point disappears.
103
+ - `fillet_tracks` rounds with chords on an arc tangent to both legs, of the design rules' fillet
104
+ radius (1 mm unless `rules.yaml` sets `fabrication.filletRadius`; a track's width is the floor).
105
+ A corner stays square when its arc would break clearance, its legs are too short or its net's
106
+ copper joins the replaced part; `straighten_tracks` keeps a corner round when the square corner
107
+ would break clearance. Both leave locked tracks and tracks starting on a locked part alone; with
108
+ no `tracks` they take every track of the board.
109
+ - `autoroute`'s `instance` route is copied to the other instances of its sheet placed the same
110
+ way. When `budgetSeconds` runs out, what is routed is written and the rest is reported.
111
+ - `fit_board` and `autoplace` `fit: true` leave a 2 mm margin round the parts' courtyards by
112
+ default; `fit_board` refuses a board drawn with a non-rectangular outline.
52
113
 
53
114
  `copper_summary` shows per net the tracks, vias, length and unrouted connections, each pour
54
115
  (`copperpour:1 GND top: 812.40 mm², joins 14 pads`) and each hole (`hole:1 at (3, 3), 3.2 mm`),
@@ -72,8 +133,11 @@ answers `Change c0010: added copperpour:1 (GND, top)` and the fill line. Then `a
72
133
  one joining fewer than half of them, `pour-empty` of one left with no copper, `copper-hole` of
73
134
  copper too near a hole).
74
135
 
75
- `props` takes `priority`, `clearance`, `minWidth`, `thermal` (`relief` or `solid`),
76
- `thermalWidth` and `thermalGap`.
136
+ `props` takes `priority` (higher wins where pours overlap; default 0), `clearance` (mm to other
137
+ nets; default the net class's), `minWidth` (narrowest copper kept; default 0.25 mm), `thermal`
138
+ (`relief`, the default, four spokes per pad, or `solid`), `thermalWidth` (spoke width; default
139
+ 0.3 mm) and `thermalGap` (pad-to-pour gap; default 0.25 mm). `new_circuit` gives a board a GND
140
+ pour on the layer the parts sit on (both layers when a two-layer board is routed on both).
77
141
 
78
142
  ## Holes and ids
79
143
 
@@ -82,3 +146,14 @@ copper too near a hole).
82
146
  `new_circuit` takes `pours` and `holes`. A part's lock never covers a pour; a pour or hole is
83
147
  locked by its id, and a locked one is left alone. A pour or hole inside a sub-sheet instance
84
148
  (`PS1/copperpour:1`) is written in its sheet file: edit that file instead.
149
+
150
+ ## Designators
151
+
152
+ Each part's name goes on the silkscreen by itself at every build: beside a side of its courtyard,
153
+ running along that side (standing beside a left or right side, never upside down), clear of pads,
154
+ holes, vias, other parts, other names and the board's edge, and the same round every copy of a
155
+ sheet's part where that place is free. A name with no free place within 2 mm takes the least bad
156
+ one, and `check_circuit` gives a `silk-on-pad` warning naming what it covers. For such a name,
157
+ give the part room (move it or its neighbours), or put the name yourself with `set_props`:
158
+ `pcbNameAt` (`{ x, y }`, the name's middle as an offset from the part's origin, in mm) and
159
+ `pcbNameRotation` (0 flat, 90 standing); the other names go round it. `null` removes either.
@@ -0,0 +1,80 @@
1
+ # Modules: blocks that describe themselves, and a shelf to keep them on
2
+
3
+ A sheet (`<Name>.sheet.tsx`) is a block used as instances. Its **card** says what it is, in the
4
+ same file: what it does, where it comes from, and for each port its type and what it carries. A
5
+ person keeps the blocks they approved on a **shelf** of modules, outside any project, so the next
6
+ board starts from them instead of from nothing.
7
+ (Without this skill installed, `guide { "topic": "modules" }` returns this page.)
8
+
9
+ ## The card
10
+
11
+ ```tsx
12
+ <sheet does="24 V digital input: divider, clamp, RC filter" sources={["https://example.com/app-note.pdf"]}>
13
+ <port name="IN" type="input" carries="0 to 24 V from the field, 5 mA at most" />
14
+ <port name="OUT" type="output" carries="0 to 3.3 V logic to the controller" />
15
+ <port name="GND" type="ground" />
16
+ …
17
+ </sheet>
18
+ ```
19
+
20
+ - `does`: one line, at most 160 characters: the job, and the numbers that choose it over another
21
+ block. `24 V digital input: divider, clamp, RC filter` says more than `Input stage`.
22
+ - `sources`: at most 8 links or document names (datasheet, application note, the page of a
23
+ reference design) the block was designed from, so the next person can check it.
24
+ - A port's `type` is the instance's pin type: `power_in`, `power_out`, `ground`, `input`,
25
+ `output`, `bidirectional` or `passive` (the default). `check_circuit` then sees across blocks:
26
+ two outputs joined, or a power input with nothing that supplies it.
27
+ - A port's `carries`, at most 80 characters: the range, the limit and the direction of energy.
28
+ `9 to 24 V in, 300 mA`, `3.3 V out, 500 mA at most`, `0 to 3.3 V logic, 1 kHz`, `RS-485 A line`.
29
+ Not the name again (`IN input`).
30
+
31
+ Write a card with the sheet: `new_circuit`'s `sheets` take
32
+ `{ parts, nets, ports, does, sources }`, a port being a name or `{ name, type, carries }`. For a
33
+ sheet that exists, `describe_sheet { file, does, sources, ports: { IN: { type, carries } } }` is one
34
+ change the person can undo. `circuit_summary` on the sheet file, or with `filter` naming an
35
+ instance, shows the card.
36
+
37
+ ## Before designing a block: the shelf
38
+
39
+ 1. `list_modules { filter }`: one line a module, its job, its ports and whether a person verified
40
+ it. A module that does the job is used, not designed again.
41
+ 2. `module_info { name }`: the card, the parts with values and footprints, the sources, where it
42
+ was saved from. Read it before using one.
43
+ 3. `use_module { module, file }` copies the module's sheet beside the circuit `file` (and its
44
+ library parts the project does not have), then says how to place it with `edit_circuit`'s
45
+ `add_instance`. A different sheet of that name in the project is refused.
46
+ 4. Say to the person which modules you used and whether each is verified. A module that is NOT
47
+ verified is a draft: check it as you would your own block.
48
+
49
+ ## After the person approved a board: save_module
50
+
51
+ `save_module { file: "Input.sheet.tsx", name, replace }` copies a sheet and its library parts to
52
+ the shelf. Only after the person has approved the board, and only blocks worth keeping. It is
53
+ refused when the card is missing `does` or a port has neither a type nor what it carries (write them
54
+ with `describe_sheet`), when the sheet does not build, and when the name is taken unless `replace`.
55
+ A module is one sheet with library parts; a sheet that imports other sheets is not saved.
56
+
57
+ ## Only a person verifies
58
+
59
+ A saved module is NOT verified. The person checks it and runs, at a terminal,
60
+ `copperflow modules verify <name> --by <name>`. The mark holds the hash of the sheet's text: a sheet
61
+ that changes afterwards reads NOT verified again. No tool verifies a module or a part; do not ask
62
+ for a way around that. `copperflow modules` lists the shelf, `copperflow modules remove <name>` takes
63
+ one off. The shelf is `~/.copperflow/modules/`, or the folder `COPPERFLOW_MODULES` names.
64
+
65
+ ## Libraries
66
+
67
+ Besides the shelf, modules come from libraries: `copperflow`, which ships with copperflow, and the
68
+ ones the person added from a git address or a folder. `list_modules` lists the shelf, then each
69
+ library; a library's module is named `<library>/<Name>` (`copperflow/Input`), and `module_info` and
70
+ `use_module` take that name. `use_module` brings a library's sheet only when it is plain (part
71
+ imports, one function returning tags with literal values) and writes its parts' component files
72
+ itself; a sheet that is not plain is refused with the first thing found and its line. The history
73
+ entry says which library the sheet came from.
74
+
75
+ A library's modules are NOT verified here until the person runs
76
+ `copperflow modules verify <library>/<Name> --by <name>`; anything a library says about itself counts
77
+ for nothing. Adding a library is the person's choice, by command only:
78
+ `copperflow library add <name> <git address or folder> [--ref <branch or tag>]`,
79
+ `copperflow library update [name]`, `copperflow library remove <name>`, `copperflow library` to list.
80
+ Asked to add one, tell the person the command; run it only if they asked you to and you have a shell.
@@ -1,7 +1,8 @@
1
- # Planning a board: questions, blocks, sub-agents
1
+ # Planning a board: questions, sources, blocks, sub-agents
2
2
 
3
3
  Read this before the first circuit file of a new board. The plan comes before parts and nets: what
4
- the person wants, the board as a tree of blocks with named ports, and who designs each block. A
4
+ the person wants, how such a circuit is usually built, the board as a tree of blocks with named
5
+ ports, and who designs each block. A
5
6
  block that is used eight times is designed once and placed eight times; that is what keeps a
6
7
  large board small enough to think about.
7
8
 
@@ -26,14 +27,47 @@ with the default you assumed; do not come back later with a question you could h
26
27
  6. **Signals that set rules.** Bus speeds (USB, CAN bit rate, SPI clock), analog accuracy,
27
28
  currents in power paths, isolation, lengths that matter.
28
29
  7. **The board.** Size or shape limits, layers (two unless said), mounting holes, height limits,
29
- the enclosure.
30
+ the enclosure. When the board must fit something, ask for a DXF of its outline in the project folder.
30
31
  8. **Bring-up.** Programming or debug connector, test points, status LEDs, buttons.
31
32
  9. **Conditions.** Temperature range, automotive or industrial supply, what a standard requires.
32
33
  10. **Later.** What the person wants to decide later.
33
34
 
34
- ## 2. The block tree
35
-
36
- Split the board into blocks before choosing a single part.
35
+ ## 2. Look it up
36
+
37
+ Nobody designs a circuit from nothing, and neither should you: before the blocks, find how this
38
+ kind of circuit is usually built. Search with your own web access; copperflow fetches nothing.
39
+
40
+ - **What to look for**, for the board and then for each function in it: the datasheet of every
41
+ chip in question with its typical application circuit; the makers' application notes and
42
+ reference designs (an evaluation board's schematic is the best source there is); open hardware
43
+ projects that do the same job; and pictures of schematics and boards, which you open when your
44
+ client can show you images.
45
+ - **How far to trust it.** A maker's document is a source. A forum post, a blog or a picture is a
46
+ lead: take the idea, then check every value and every pin against the datasheet. Never copy pin
47
+ numbers from a picture.
48
+ - **What to bring back** for each function: the usual way to build it and why, the parts it
49
+ takes, the values that have to be worked out for this board, and what goes wrong when a part is
50
+ left out. Three or four good sources are enough; stop when they agree.
51
+ - **Write the sources down** as you use them: `note_decision`
52
+ `{ text: "Source: <link> (what it is): what was taken from it" }`, so the person can check
53
+ where a circuit came from. A design under an open hardware licence carries that licence's
54
+ terms: tell the person before you build on one.
55
+ - Without web access say so, ask the person for the datasheets and any reference they have, and
56
+ put in `Open` what you could not check. Do not draw a chip's circuit from memory.
57
+
58
+ An example. "A relay driver module: 12 V supply, switched by 0 V and by 3.3 V or 5 V logic." The
59
+ search finds the low-side switch the sources agree on: a transistor or a logic-level MOSFET under
60
+ the coil, a diode across the coil for the spike at turn-off, a resistor to the input sized so
61
+ that 3.3 V still switches the coil's current fully, a pull-down so that an open input is off, and
62
+ often an LED or an optocoupler. From the relay's datasheet come the coil's voltage and current;
63
+ from the transistor's, the gain or the threshold that sizes the resistor. Those become the
64
+ block's parts, and what the search raised (how many relays, what they switch, isolated or not)
65
+ goes back to the person if step 1 did not settle it.
66
+
67
+ ## 3. The block tree
68
+
69
+ Split the board into blocks before choosing a single part. Look at `list_modules` first: a module
70
+ on the person's shelf that does a block's job is used, not designed again ([modules.md](modules.md)).
37
71
 
38
72
  - A block does one job and has **ports**: the nets that cross its edge. Name every port and say
39
73
  what it carries: `VIN 7 to 24 V in`, `V3_3 3.3 V 300 mA out`, `IN 0 to 24 V from the field`,
@@ -68,7 +102,7 @@ set_project {
68
102
  Then show the person the block list, the supply tree and what you assumed, and ask whether to go
69
103
  on. Wait for a yes and `note_decision` it. Changing the split is cheap now and costly later.
70
104
 
71
- ## 3. One sub-agent per block
105
+ ## 4. One sub-agent per block
72
106
 
73
107
  When your client can start sub-agents, give each block to one, several at a time. A repeated
74
108
  block goes to one sub-agent, once. Without sub-agents, do the same yourself, one block after
@@ -79,27 +113,35 @@ The brief is all a sub-agent knows. Give it:
79
113
  - the board in one or two lines (from the Intent);
80
114
  - the block: its job, every port with what it carries, and the limits from the answers (packages,
81
115
  supplier, parts the person fixed);
116
+ - the sources step 2 found for this block, to read and to look further from in the same way;
82
117
  - the tools: `guide` for how to work, `list_parts`, `part_info`, `create_part` and
83
118
  `attach_datasheet` for parts. **It writes no circuit file**: no `new_circuit`, `edit_circuit`,
84
- `place_part` or `connect_nets`. Only you write the circuit, once, in step 4;
119
+ `place_part` or `connect_nets`. Only you write the circuit, once, in step 5;
85
120
  - what to send back, below.
86
121
 
87
122
  A sub-agent sends back the block as one sheet in the shape `new_circuit` takes, and a few lines:
88
123
 
89
124
  ```
90
125
  Input: {
126
+ does: "24 V digital input: divider, clamp, RC filter",
91
127
  parts: [ { name: "R1", kind: "resistor", value: "10k", footprint: "0603" },
92
128
  { name: "R2", kind: "resistor", value: "1.5k", footprint: "0603" },
93
129
  { name: "C1", kind: "capacitor", value: "100nF", footprint: "0603" },
94
130
  { name: "R3", kind: "resistor", value: "1k", footprint: "0603" } ],
95
131
  nets: { IN: ["R1.pin1"], DIV: ["R1.pin2", "R2.pin1", "R3.pin1"],
96
132
  OUT: ["R3.pin2", "C1.pin1"], GND: ["R2.pin2", "C1.pin2"] },
97
- ports: ["IN", "OUT", "GND"] }
133
+ ports: [ { name: "IN", type: "input", carries: "0 to 24 V from the field" },
134
+ { name: "OUT", type: "output", carries: "0 to 3.1 V logic, filtered" },
135
+ { name: "GND", type: "ground" } ] }
98
136
  parts created: none
99
137
  decisions: 10k over 1.5k gives 3.1 V at 24 V in; the 1k and 100 nF filter at 1.6 kHz
138
+ sources: none beyond the divider and filter formulas
100
139
  questions: V3_3 is not needed by this block; drop the port?
101
140
  ```
102
141
 
142
+ - Each port goes back with its type and what it carries, `{ name: "IN", type: "input", carries:
143
+ "0 to 24 V from the field" }`, and the sheet with its `does`; `describe_sheet` writes them into a
144
+ sheet that has none.
103
145
  - Designators are local and start at 1 in every block (R1, C1, U1); each use gets its own on the
104
146
  board (R101, R201).
105
147
  - Every port is a net of the block, and no net leaves the block except through a port.
@@ -108,7 +150,7 @@ questions: V3_3 is not needed by this block; drop the port?
108
150
  access; `attach_datasheet` records the link and the page. It reports each created part and
109
151
  that it is not verified.
110
152
 
111
- ## 4. Put the blocks together
153
+ ## 5. Put the blocks together
112
154
 
113
155
  1. Check each block against the plan: its ports are the plan's ports, every `part:` id is in
114
156
  `list_parts`, and its nets name only its own parts. Settle the sub-agents' questions, with the
@@ -137,7 +179,9 @@ questions: V3_3 is not needed by this block; drop the port?
137
179
  3. `check_circuit` once. An error inside a block is the block's: correct the sheet and write the
138
180
  board again with `replace: true`, so every use gets the correction.
139
181
  4. `set_project` with each block's status `designed`, then go on with SKILL.md at "Ask the
140
- person before the PCB". On the board, place block by block: `autoplace` `{ file, instance }`.
182
+ person before the PCB". On the board, blocks first (`autoplace` and `autoroute` with
183
+ `{ file, instance }`, `render` to look), then the whole board and the tracks between blocks:
184
+ the order and the answers are in [copper.md](copper.md), "Placing and routing".
141
185
 
142
186
  One more input later is one more instance (`edit_circuit` with `add_instance`), not eight more
143
187
  parts.
@@ -6,8 +6,11 @@ Read before your first `new_circuit` or `edit_circuit` in a project.
6
6
 
7
7
  - `part`: a library part id from `list_parts` (a chip made with `create_part` or `import_part`).
8
8
  Create the library part first; `new_circuit` refuses an id the library does not have.
9
- - `kind`: a built-in part (`resistor`, `capacitor`, `inductor`, `led`, `diode`, `pinheader`,
10
- …). Never `kind: "chip"` with hand-written pins: chips come from the library.
9
+ - `kind`: a built-in part: `resistor`, `capacitor`, `inductor`, `led`, `diode`, `fuse`,
10
+ `crystal`, `resonator`, `pinheader`, `pushbutton`, `switch`, `testpoint`, `transistor`,
11
+ `mosfet`, `battery`, `potentiometer`, `chip` or `connector` (`place_part` takes the same names
12
+ as `part`). Never `kind: "chip"` with hand-written pins: chips come from the library. A chip or
13
+ connector needs `pinLabels`, `pinCount` or a footprint with known pads.
11
14
  - `value`: the main value of a built-in part (`"10k"`, `"100nF"`).
12
15
  - `footprint`: a generated footprint string for a built-in part (`"0402"`, `"0603"`); a
13
16
  library part brings its own.
@@ -27,6 +30,27 @@ have is refused before anything is written, and the answer lists the part's real
27
30
  of those. `new_circuit` refuses a file that exists; pass `replace: true` to overwrite it and its
28
31
  sheet files (one history entry, so `undo_change` brings the old text back).
29
32
 
33
+ `new_circuit` places the schematic and routes its wires, then (unless `place: false`) places the
34
+ board as a second history entry, fitting the board round the parts when no `board` is given (the
35
+ default board is 30 x 20 mm). `undo_change` takes the placement back first, leaving the file as
36
+ written without positions; a second undo removes the files. `pages` lists the pages after the
37
+ first, `"Main"`, which holds every part not listed; an instance's name may be listed there too.
38
+ Pages are drawing only: a net name joins its pins on every page. In `sheets`, a net named like a
39
+ port is that port's and any other is local to each instance; each sheet is written as
40
+ `<name>.sheet.tsx` beside the circuit with local designators (R1, C1), and an instance's `sheet`
41
+ may also name a `<name>.sheet.tsx` already there. `base` 100 makes R1 into R101 (default 100, 200,
42
+ … in order). `make_sheet` does the opposite on a written circuit: the parts it moves get local
43
+ designator + base (100 or the next free one), and `rename` numbers them from 1.
44
+
45
+ In `edit_circuit`, `add_instance` is `{ sheet, name, connections, base?, page? }` (another use of a
46
+ sub-sheet, base default the next free hundred), `set_connections` `{ instance, connections }`
47
+ gives every port its net (ports left out are open), and `move_to_page` `{ part, page }` takes a
48
+ part or an instance (the page is made when missing). `set_props` sets `schNameAt` and `schValueAt`
49
+ (the part's name and value on the schematic, in sheet units) and `pcbNameAt` (its silkscreen
50
+ designator, in mm) as an offset `{ x, y }` from the part's origin that moves with the part; null
51
+ puts the label back. `noConnect: "pin3,pin10"` flags pins meant to stay open (no pin-unconnected
52
+ error, a cross on the schematic); null removes the flags.
53
+
30
54
  ## Reading what is there
31
55
 
32
56
  `circuit_summary` shows parts the tools cannot edit as `[read-only: …]` with the reason (an
@@ -51,7 +75,9 @@ datasheet or a choice only they can make, suggest that instead.
51
75
  `export_fabrication` `{ file, out? }` writes into the circuit's folder, or into the project
52
76
  folder `out` (e.g. `"fab"`). Pass on every `Warning:` line: connections not routed, parts
53
77
  without a footprint, silkscreen over pads, parts without an LCSC number (JLCPCB assembly will
54
- not match them). A design with errors is refused and nothing is written.
78
+ not match them). A design with errors is refused and nothing is written. It writes Gerbers,
79
+ plated and non-plated drills, pick-and-place and the BOM into `<name>-fab/` and
80
+ `<name>-fab.zip`. `bom` and `export_package` read the built design, so parts made in loops count.
55
81
 
56
82
  Export only a clean board: `check_circuit` with 0 errors and no `unrouted` warning. With
57
83
  connections still unrouted the files are written with a warning, but the board is not finished
@@ -1,6 +1,6 @@
1
1
  ---
2
2
  name: copperflow-plan
3
- description: Plan a new circuit board in a copperflow project before any circuit file is written. Use when the person asks for a new board, circuit, PCB or module, or a new block on one. Asks the person every question the design needs, splits the board into blocks with named ports (a repeated function is one block and a count), and gives each block to a sub-agent.
3
+ description: Plan a new circuit board in a copperflow project before any circuit file is written. Use when the person asks for a new board, circuit, PCB or module, or a new block on one. Asks the person every question the design needs, searches the web for how such a circuit is usually built (datasheets, application notes, reference designs, pictures), splits the board into blocks with named ports (a repeated function is one block and a count), and gives each block to a sub-agent.
4
4
  ---
5
5
 
6
6
  # Planning a copperflow board
@@ -14,11 +14,14 @@ copperflow server's `guide` tool with `{ topic: "planning" }`) and follow it in
14
14
  1. **Ask everything first**, in one numbered message with your defaults: purpose, counts of
15
15
  everything that repeats, power, outside connections, parts, signals that set rules, the board,
16
16
  bring-up, conditions.
17
- 2. **The block tree.** Each block does one job and has named ports; a repeated function is one
17
+ 2. **Look it up.** Search for how this kind of circuit is usually built: datasheets with their
18
+ typical application circuits, application notes, reference designs, pictures of schematics.
19
+ Check leads against the datasheet and write the sources down with `note_decision`.
20
+ 3. **The block tree.** Each block does one job and has named ports; a repeated function is one
18
21
  block and a count; power first. Write it with `set_project` and get the person's yes.
19
- 3. **One sub-agent per block**, which sends back the block as one sheet (`parts`, `nets`,
22
+ 4. **One sub-agent per block**, which sends back the block as one sheet (`parts`, `nets`,
20
23
  `ports`) and writes no circuit file.
21
- 4. **Put the blocks together** with one `new_circuit` (`sheets` and `instances`), then
24
+ 5. **Put the blocks together** with one `new_circuit` (`sheets` and `instances`), then
22
25
  `check_circuit`.
23
26
 
24
27
  After the plan, go on with the copperflow skill's design workflow at "Ask the person before the