simcon-toolkit 0.1.0__py3-none-any.whl

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 (97) hide show
  1. simcon_toolkit/__init__.py +40 -0
  2. simcon_toolkit/__main__.py +7 -0
  3. simcon_toolkit/_kit/LICENSE +202 -0
  4. simcon_toolkit/_kit/NOTICE +37 -0
  5. simcon_toolkit/_kit/assets/parts/clip_frame.stl +0 -0
  6. simcon_toolkit/_kit/assets/parts/simple_plate.stl +0 -0
  7. simcon_toolkit/_kit/packages/.ruff.toml +10 -0
  8. simcon_toolkit/_kit/packages/cadmould_cloud/__init__.py +8 -0
  9. simcon_toolkit/_kit/packages/cadmould_cloud/auth.py +681 -0
  10. simcon_toolkit/_kit/packages/cadmould_cloud/client.py +235 -0
  11. simcon_toolkit/_kit/packages/cadmould_geometry/__init__.py +5 -0
  12. simcon_toolkit/_kit/packages/cadmould_geometry/mesh.py +210 -0
  13. simcon_toolkit/_kit/packages/cadmould_geometry/stl.py +168 -0
  14. simcon_toolkit/_kit/packages/cadmould_results/__init__.py +30 -0
  15. simcon_toolkit/_kit/packages/cadmould_results/loader.py +288 -0
  16. simcon_toolkit/_kit/packages/cadmould_scoring/__init__.py +7 -0
  17. simcon_toolkit/_kit/packages/cadmould_scoring/metrics.py +519 -0
  18. simcon_toolkit/_kit/pyproject.toml +232 -0
  19. simcon_toolkit/_kit/templates/_shared/AGENTS.base.md +101 -0
  20. simcon_toolkit/_kit/templates/gate-study/.gitignore +18 -0
  21. simcon_toolkit/_kit/templates/gate-study/AGENTS.md +46 -0
  22. simcon_toolkit/_kit/templates/gate-study/GATING_STUDY_PLAYBOOK.md +219 -0
  23. simcon_toolkit/_kit/templates/gate-study/INITIAL_PROMPT.md +26 -0
  24. simcon_toolkit/_kit/templates/gate-study/README.md +137 -0
  25. simcon_toolkit/_kit/templates/gate-study/main.py +344 -0
  26. simcon_toolkit/_kit/templates/gate-study/pipeline.py +281 -0
  27. simcon_toolkit/_kit/templates/process-window/.gitignore +20 -0
  28. simcon_toolkit/_kit/templates/process-window/AGENTS.md +49 -0
  29. simcon_toolkit/_kit/templates/process-window/METHOD.md +155 -0
  30. simcon_toolkit/_kit/templates/process-window/README.md +176 -0
  31. simcon_toolkit/_kit/templates/process-window/configs/simple-plate.yaml +116 -0
  32. simcon_toolkit/_kit/templates/process-window/doe_spec.schema.md +249 -0
  33. simcon_toolkit/_kit/templates/process-window/main.py +82 -0
  34. simcon_toolkit/_kit/templates/process-window/process_window/__init__.py +5 -0
  35. simcon_toolkit/_kit/templates/process-window/process_window/centre.py +298 -0
  36. simcon_toolkit/_kit/templates/process-window/process_window/design.py +144 -0
  37. simcon_toolkit/_kit/templates/process-window/process_window/economics.py +367 -0
  38. simcon_toolkit/_kit/templates/process-window/process_window/emit.py +591 -0
  39. simcon_toolkit/_kit/templates/process-window/process_window/guardrails.py +153 -0
  40. simcon_toolkit/_kit/templates/process-window/process_window/harness.py +360 -0
  41. simcon_toolkit/_kit/templates/process-window/process_window/identity.py +92 -0
  42. simcon_toolkit/_kit/templates/process-window/process_window/inspect_part.py +184 -0
  43. simcon_toolkit/_kit/templates/process-window/process_window/kpis.py +355 -0
  44. simcon_toolkit/_kit/templates/process-window/process_window/material_card.py +163 -0
  45. simcon_toolkit/_kit/templates/process-window/process_window/probe_proxy.py +169 -0
  46. simcon_toolkit/_kit/templates/process-window/process_window/run_confirm.py +403 -0
  47. simcon_toolkit/_kit/templates/process-window/process_window/run_epsilon_floor.py +198 -0
  48. simcon_toolkit/_kit/templates/process-window/process_window/run_feedback.py +322 -0
  49. simcon_toolkit/_kit/templates/process-window/process_window/run_refine.py +279 -0
  50. simcon_toolkit/_kit/templates/process-window/process_window/run_screening.py +370 -0
  51. simcon_toolkit/_kit/templates/process-window/process_window/run_sweep.py +166 -0
  52. simcon_toolkit/_kit/templates/process-window/process_window/setup_campaign.py +312 -0
  53. simcon_toolkit/_kit/templates/process-window/process_window/surrogate.py +201 -0
  54. simcon_toolkit/_kit/templates/process-window/process_window/test_centre.py +169 -0
  55. simcon_toolkit/_kit/templates/process-window/process_window/test_design.py +113 -0
  56. simcon_toolkit/_kit/templates/process-window/process_window/test_guardrails.py +157 -0
  57. simcon_toolkit/_kit/templates/process-window/process_window/test_surrogate.py +127 -0
  58. simcon_toolkit/_kit/templates/process-window/process_window/units.py +152 -0
  59. simcon_toolkit/_kit/templates/quoting/.gitignore +24 -0
  60. simcon_toolkit/_kit/templates/quoting/AGENTS.md +58 -0
  61. simcon_toolkit/_kit/templates/quoting/INTERVIEW.md +147 -0
  62. simcon_toolkit/_kit/templates/quoting/METHOD.md +256 -0
  63. simcon_toolkit/_kit/templates/quoting/PROMPT.md +46 -0
  64. simcon_toolkit/_kit/templates/quoting/QUOTING_PLAYBOOK.md +245 -0
  65. simcon_toolkit/_kit/templates/quoting/README.md +158 -0
  66. simcon_toolkit/_kit/templates/quoting/main.py +484 -0
  67. simcon_toolkit/_kit/templates/quoting/parts/.gitkeep +0 -0
  68. simcon_toolkit/_kit/templates/quoting/quoting/__init__.py +11 -0
  69. simcon_toolkit/_kit/templates/quoting/quoting/costing.py +725 -0
  70. simcon_toolkit/_kit/templates/quoting/quoting/geometry.py +398 -0
  71. simcon_toolkit/_kit/templates/quoting/quoting/shop.py +193 -0
  72. simcon_toolkit/_kit/templates/quoting/quoting/state.py +260 -0
  73. simcon_toolkit/_kit/templates/quoting/quoting/study.py +577 -0
  74. simcon_toolkit/_kit/templates/quoting/quoting/toolkit.py +50 -0
  75. simcon_toolkit/_kit/templates/quoting/shop/README.md +43 -0
  76. simcon_toolkit/_kit/templates/quoting/shop/commercial.md +86 -0
  77. simcon_toolkit/_kit/templates/quoting/shop/lessons.md +94 -0
  78. simcon_toolkit/_kit/templates/quoting/shop/machines.md +68 -0
  79. simcon_toolkit/_kit/templates/quoting/shop/materials.md +92 -0
  80. simcon_toolkit/_kit/templates/quoting/shop/shop-profile.md +87 -0
  81. simcon_toolkit/_kit/templates/quoting/shop/tooling.md +145 -0
  82. simcon_toolkit/_kit/templates/run-one-simulation/.gitignore +16 -0
  83. simcon_toolkit/_kit/templates/run-one-simulation/AGENTS.md +41 -0
  84. simcon_toolkit/_kit/templates/run-one-simulation/README.md +133 -0
  85. simcon_toolkit/_kit/templates/run-one-simulation/main.py +216 -0
  86. simcon_toolkit/_kit/templates.toml +83 -0
  87. simcon_toolkit/choices.py +11 -0
  88. simcon_toolkit/cli.py +381 -0
  89. simcon_toolkit/generate.py +590 -0
  90. simcon_toolkit/instructions.py +152 -0
  91. simcon_toolkit/manifest.py +86 -0
  92. simcon_toolkit/project.py +356 -0
  93. simcon_toolkit/wizard.py +160 -0
  94. simcon_toolkit-0.1.0.dist-info/METADATA +48 -0
  95. simcon_toolkit-0.1.0.dist-info/RECORD +97 -0
  96. simcon_toolkit-0.1.0.dist-info/WHEEL +4 -0
  97. simcon_toolkit-0.1.0.dist-info/entry_points.txt +2 -0
@@ -0,0 +1,147 @@
1
+ # The setup interview — teaching the agent your shop
2
+
3
+ The `shop/` folder ships filled in with a **fictional** moldmaker. Quoting a real part against
4
+ someone else's invented presses and rates produces a confident, precise, completely wrong
5
+ number — the worst possible output. So until this interview has been done, `main.py` warns on
6
+ every run and `quote.json` carries the watermark, so anything written from it inherits it.
7
+
8
+ This is deliberately a **rough** interview. It is not trying to capture your estimating system; it
9
+ is trying to get close enough that the first quotes are worth correcting. Everything else is
10
+ learned afterwards, from the corrections you give at the end of each quote
11
+ ([`shop/lessons.md`](shop/lessons.md)).
12
+
13
+ **Budget: 20–30 minutes with someone who quotes for a living.**
14
+
15
+ ```
16
+ python main.py setup # what is still example data
17
+ ...agent interviews you, edits shop/ ...
18
+ python main.py setup --confirm "Your Shop GmbH"
19
+ ```
20
+
21
+ The agent asks; the agent edits the files. You should not have to touch JSON.
22
+
23
+ ---
24
+
25
+ ## Rule for the agent running this
26
+
27
+ **Ask for what the estimator already knows in their head.** Nobody knows their "cavity fixed cost
28
+ per cm² of part surface". Everybody knows what their last four-cavity tool cost. Ask the second
29
+ question and derive the first — §3 shows how.
30
+
31
+ Ask in the order below: it is ordered by how much each answer moves the price. If the interview
32
+ gets cut short after §2, the quote is already roughly right on the biggest term.
33
+
34
+ ---
35
+
36
+ ## §1 What kind of shop is this? (must have)
37
+
38
+ Changes *what is quoted at all*, so it cannot be defaulted.
39
+
40
+ 1. **Do you build moulds, mould parts, or both?**
41
+ → `shop-profile.md` services. If tooling only, the piece price is a courtesy figure; if
42
+ moulding only, the tool is bought in and the quote is a piece price plus a tooling pass-through.
43
+ 2. **Do you sample the tool yourself, and is sampling included in the tool price?**
44
+ → `sampling.shots_included`. Shops that do not sample in-house rarely include it, and that is a
45
+ four-figure difference on every tool.
46
+ 3. **What do you *not* take?** Class-A cosmetic, 2K, micro, LSR, medical, anything under a
47
+ tolerance you will not sign up to.
48
+ → `shop-profile.md` "declines". The agent refuses those parts up front instead of quoting them
49
+ badly.
50
+ 4. **Currency, and do you quote a volume ladder or one volume?**
51
+ → `currency`, `volume_ladder_parts_per_year`.
52
+
53
+ ## §2 The presses (must have)
54
+
55
+ The single biggest lever on the piece price, because the machine rate multiplies the whole cycle.
56
+
57
+ 5. **List your presses: clamp force, shot volume, and the hourly rate you charge for each.**
58
+ → `machines.md`. Rough is fine — "five machines, 500 to 2500 kN, 45 to 85 €/h" is a usable
59
+ answer; the agent writes the list and you correct the two that matter.
60
+ 6. **Is that rate loaded?** Does it already carry your fixed-cost recovery, or is overhead added
61
+ on top?
62
+ → decides whether `overhead_pct_on_material_and_labour` also applies to the machine line. This
63
+ is the classic double-count and it is worth 10–15 % of the piece price.
64
+ 7. **How many shifts do you plan on, and what is your realistic OEE?**
65
+ → `cycle.oee`. If they say "we run 24/7 at 95 %", write 0.85 anyway and flag it — nobody's
66
+ long-run average is 95 %.
67
+ 8. **Robot or free-fall, and how long is your mould open + eject?**
68
+ → `cycle`. Two or three seconds of non-productive time is 20–40 % of a thin-wall cycle.
69
+
70
+ ## §3 The tooling anchor (must have — and this is the clever one)
71
+
72
+ Do **not** ask for a cost model. Ask for tools they have actually built:
73
+
74
+ 9. **"Tell me about two or three moulds you built recently: how many cavities, roughly how big the
75
+ part was, what the tool cost, and how many weeks."**
76
+
77
+ That is one question an estimator can answer instantly, and it calibrates the whole tooling
78
+ model. The agent then:
79
+ - runs `intake` on a comparable geometry (or uses the stated part size),
80
+ - computes what `costing.tool_cost()` would have quoted,
81
+ - and sets `calibration.tooling_price_factor` to the ratio.
82
+
83
+ Two anchors that disagree by more than ~25 % mean the *structure* is wrong for this shop (they
84
+ price by kg of steel, or they always buy the base in), not the factor — say so rather than
85
+ averaging.
86
+
87
+ 10. **What do you pay for a hot-runner drop, and at how many cavities do you switch from cold to
88
+ hot?** → `feed_system`. The gate-count decision is priced almost entirely on this number.
89
+ 11. **What does a slide cost you, all in?** → `side_actions.slide_eur`.
90
+ 12. **Lead time for a simple tool, and what adds weeks?** → `lead_time`.
91
+
92
+ ## §4 Materials (must have, briefly)
93
+
94
+ 13. **What do you actually run?** The three or four grades that are most of your shots, with the
95
+ price per kg and whether you hold them in stock.
96
+ → `materials.md` grades. This is the shop's **bias** and it is why the agent can propose a
97
+ material at all.
98
+ 14. **What is your default when the customer has not specified?** → `default_grade`.
99
+ 15. **What cavity pressure do you size clamp force with?** Most shops have a number per family
100
+ ("650 bar for glass-filled PA"). → `clamp_pressure_bar`.
101
+ If they do not have one, keep the shipped values and tell them the first tool trial will
102
+ correct it.
103
+
104
+ ## §5 Commercial (can be defaulted, but ask)
105
+
106
+ 16. **Labour rate, and how many machines per operator.**
107
+ 17. **Scrap allowance**, established vs. start-up.
108
+ 18. **Overhead and margin** — if they will not say, keep the defaults and flag every quote as
109
+ "margin per shop default, confirm before sending".
110
+ 19. **Setup hours per order and your minimum batch.** → the low-volume rung of the ladder is
111
+ almost entirely this.
112
+
113
+ ## §6 Close
114
+
115
+ 20. **Anything you always add that nobody asks about?** Spare parts package, documentation,
116
+ first-article inspection, packaging trials. Estimators always have one. It goes in the prose
117
+ of the relevant file, and the agent will then remember to quote it.
118
+
119
+ Then:
120
+
121
+ ```
122
+ python main.py setup --confirm "Your Shop GmbH"
123
+ ```
124
+
125
+ which refuses while obvious example values remain, and otherwise records whose shop this is and
126
+ drops the watermark.
127
+
128
+ ---
129
+
130
+ ## What the agent must write down as it goes
131
+
132
+ - **Numbers** into the fenced `json` block of the relevant `shop/` file.
133
+ - **The reasoning, in the estimator's own words**, into the prose above that block. The prose is
134
+ what the agent reads on the next quote to make a judgement call; a bare number cannot tell it
135
+ that "we only use the tie-bar-less machine for wide moulds because the others foul the guard".
136
+ - **Anything the estimator was unsure about** as a first entry in `shop/lessons.md`, so the first
137
+ correction on that topic has somewhere to land.
138
+
139
+ ## Do not try to be complete
140
+
141
+ Three things are true and worth telling the estimator up front:
142
+
143
+ 1. The first two or three quotes will be wrong somewhere, and the review at the end of each is
144
+ where that gets fixed.
145
+ 2. Corrections are cheap: they change one number and the reason is recorded next to it.
146
+ 3. Nothing here is a commitment. The shop files are text; anyone can open them and argue with
147
+ them, which is the point.
@@ -0,0 +1,256 @@
1
+ ---
2
+ # Front matter so the generator can emit this file unchanged as a Claude skill; it is
3
+ # inert everywhere else, and the procedure below is the same either way.
4
+ name: mold-quoting
5
+ description: >-
6
+ Quote an injection-moulded article end to end from nothing but a geometry file and a cavity
7
+ count: read the shop's own context, analyse the part, decide the material, run the filling
8
+ simulations on the Simcon cloud that settle the cost-driving decisions (gate count, cavity
9
+ pressure, fill time), price the tool and the piece, write the quotation, and close by
10
+ taking the estimator's corrections into the shop context. Use whenever someone asks for a
11
+ price, an offer, a quotation or a cost estimate for a moulded part or its mould.
12
+ ---
13
+
14
+ # Quoting a moulded article
15
+
16
+ You are quoting as a specific shop. Everything about that shop — what it sells, what it runs, what
17
+ it charges, what it got wrong last time — is in `shop/`. Read it before you touch the part.
18
+
19
+ The flow is four commands, run from the project folder:
20
+
21
+ ```
22
+ python main.py intake --part <geometry.stl> --cavities N [--material GRADE]
23
+ python main.py study --part <geometry.stl> [--gate-counts 1,2,3] [--offline]
24
+ python main.py cost --part <geometry.stl>
25
+ python main.py learn --quote <key>
26
+ ```
27
+
28
+ `--part` defaults to the bundled `sample/`, so every stage runs with no arguments. The last stage
29
+ takes `--quote` instead, because it corrects a quote that exists and never opens the geometry.
30
+
31
+ **A quote is keyed on the part's contents, not its file name.** `intake` prints a key like
32
+ `clip_frame-655b895fd2b5`; every later stage derives the same key from the same file. Re-export
33
+ the part and it becomes a new quote, so a changed part can never be priced against the previous
34
+ revision's mesh, uploaded geometry and decisions. If a stage reports no quote on file for a part
35
+ you have already run, that is what happened.
36
+
37
+ They write to `cache/<key>/`: `state.json` (resumable state) and `decisions.md` (the local
38
+ decision log). The quote itself lands in `output/<key>/quote.json`.
39
+
40
+ **`quote.json` is the deliverable, and writing the quotation document is your job, not the
41
+ kit's.** It carries the chosen option, every option it beat, the machine and cycle basis and the
42
+ reference volumes. Produce whatever the customer expects from it — but state the basis (surrogate
43
+ solver, one cavity, no runner, analytic cooling, geometric weld-visibility), and if the winner is
44
+ within a couple of percent of the runner-up, say the model cannot tell them apart.
45
+
46
+ The method, the cost model and its gotchas are in
47
+ [`QUOTING_PLAYBOOK.md`](QUOTING_PLAYBOOK.md) — read it before adapting anything.
48
+
49
+ ## 0. Is this shop's context actually filled in? (check before anything else)
50
+
51
+ `shop/` ships filled in with a **fictional** shop. Quoting a real part against someone else's
52
+ invented presses and rates gives a confident, precise, completely wrong number.
53
+
54
+ Run `python main.py setup` first. If it reports `provenance: example`, **stop and interview
55
+ the user** before quoting — the script is [`INTERVIEW.md`](INTERVIEW.md), it takes 20-30
56
+ minutes, and you ask the questions and edit the `shop/` files yourself. The one technique worth
57
+ knowing: do not ask for a cost model, ask for **two or three tools they actually built** (cavities,
58
+ part size, price, lead time) and calibrate `tooling_price_factor` against what the model would have
59
+ quoted. Estimators can answer that instantly and cannot answer "your cavity cost per cm²".
60
+
61
+ If the user wants to see the flow first, quoting on example data is fine — it is watermarked
62
+ everywhere, including in `quote.json`. Just never let that watermark be removed
63
+ by anything other than a real interview.
64
+
65
+ ## 1. Read the shop context first. All of it.
66
+
67
+ Before the first command, read every file in `shop/`:
68
+
69
+ | File | What you are looking for |
70
+ |---|---|
71
+ | `shop-profile.md` | what we sell, what we do in-house, the house quoting rules, what we decline |
72
+ | `machines.md` | the press list and the rules for picking one |
73
+ | `materials.md` | house grades, prices, **our material bias**, the ask to use when no grade is given |
74
+ | `tooling.md` | how a mould is estimated here, and what is deliberately *not* in the model |
75
+ | `commercial.md` | rates, scrap, overhead, margin, the volume ladder |
76
+ | **`lessons.md`** | **what previous quotes got wrong and the rules that came out of it** |
77
+
78
+ `lessons.md` is not background reading. It is the accumulated correction record, and its
79
+ `calibration` block is what the cost model computes with. If a lesson says "clamp from the rule of
80
+ thumb, never the simulation", that overrides your own reasoning — an estimator said it after a
81
+ tool flashed.
82
+
83
+ If the part is something the shop declines (`shop-profile.md`), say so before spending anything.
84
+
85
+ ## 2. What you are given, and what you may not invent
86
+
87
+ You get a **geometry** and a **cavity count**. That is the brief.
88
+
89
+ - **The cavity count is the customer's.** Never change it. If the simulation says it is a bad
90
+ idea — no press fits, pressure marginal — quote what was asked and put the problem in the flags.
91
+ - **Material: ask once, then move on.** If no grade was named, ask the scripted question in
92
+ `materials.md` (a recommendation plus the price impact, not an open question). If you get no
93
+ answer, quote the house default and mark it an assumption. Never stall a quote on it, and never
94
+ silently substitute a grade the customer named.
95
+ - **Annual volume: do not ask.** Quote the ladder from `shop-profile.md` and state the assumption.
96
+ - **Never invent** tolerances, surface class, functional faces, colour, or a delivery date.
97
+ Anything you needed and did not have goes on the "what we still need" slide.
98
+
99
+ ## 3. The five stages
100
+
101
+ ### `intake` — everything the geometry alone decides (offline, seconds)
102
+
103
+ Reads the STL and derives what drives the price before any simulation: projected area (→ clamp
104
+ force → press → hourly rate), wall thickness (→ cooling → cycle), undercuts (→ slides, a
105
+ four-figure line each), volume (→ shot, material, barrel fit).
106
+
107
+ Check the printed report yourself. Specifically:
108
+ - **`side actions`** — the estimate comes from ray-casting the draw direction. Verify it against
109
+ the drawing if you have one. A missed slide is the most expensive miss in tool estimating.
110
+ - **`draw direction`** — taken as the largest projected shadow. If the drawing shows a different
111
+ parting line, re-run with `--draw-axis`.
112
+ - **`watertight`** — a leaking STL makes volume, wall and undercuts estimates. Say so.
113
+
114
+ ### `study` — buy the decisions that move the price (cloud)
115
+
116
+ This is the only stage that costs anything. It runs the filling simulations that settle:
117
+
118
+ 1. **how many gates per cavity** → hot-runner nozzles × cavities, real money on the tool;
119
+ 2. **peak cavity pressure** → clamp force → press class → hourly rate;
120
+ 3. **fill time** → the fill part of the cycle, and where shear starts to limit flow.
121
+
122
+ Default is `--gate-counts 1,2,3`. Widen it only if the part is large or thin enough that one gate
123
+ is obviously not going to fill it. Add `--process-sweep` when the fill time matters to the cycle —
124
+ on thick-walled parts it does not, because cooling dominates.
125
+
126
+ `--offline` substitutes rule-of-thumb gating so the flow can be demonstrated without credentials.
127
+ Everything downstream is then marked `estimated`. **Never present an offline quote as
128
+ simulation-backed.**
129
+
130
+ ### `cost` — price every option and choose on money
131
+
132
+ Prices each gating option end to end and ranks by **total cost of ownership** at the reference
133
+ volume: tool + piece price × volume. This is the point of the whole exercise — the gate count is a
134
+ commercial decision, not a physics one. More gates lower the pressure (perhaps a press class
135
+ cheaper) and cost a nozzle per cavity plus a weld line. Neither side wins in general.
136
+
137
+ Read the comparison table before accepting the answer. If the winner is within a couple of percent
138
+ of the runner-up, say so and let the human choose — a 2 % difference is inside the model's error.
139
+
140
+ ### Writing the quotation — yours to do, not the kit's
141
+
142
+ `cost` writes `output/<key>/quote.json`: the chosen option, every option it beat, the machine
143
+ and cycle basis, and the reference volumes. **There is no `deck` command.** The kit deliberately
144
+ ships no slide or document generator — your customer's format is not ours to guess, and you can
145
+ produce it better than a template could.
146
+
147
+ Build whatever the user asks for from that file. Whatever the form, it must carry:
148
+
149
+ - **The basis**, stated plainly — surrogate solver, one cavity, no runner, analytic cooling,
150
+ geometric weld-visibility. This is what protects the price when the first article disagrees.
151
+ - **Whether the gating was simulated or estimated**, never blurred.
152
+ - **An honest comparison** — if the winner is within a couple of percent of the runner-up, say
153
+ the model cannot separate them.
154
+ - **One measure per chart.** Never one chart with two y-scales.
155
+
156
+ ### `learn` — the stage that is not optional
157
+
158
+ See §5.
159
+
160
+ ## 4. Running the simulations on the platform
161
+
162
+ The study drives the **Simcon cloud** through the kit's REST client (reused from the gate-study
163
+ example, via `quoting/toolkit.py`). What you need to know:
164
+
165
+ **Three separate sign-ins.** `cadmould-sdk-auth` configures pip so the licensed `cadmould` wheel
166
+ can be installed — that is the *install* sign-in. Opening the licence session below signs in to
167
+ the licence. A bearer token (`CLOUD_SOLVER_TOKEN`, or the Auth0 PKCE browser flow in
168
+ `cadmould_cloud.auth`) authorises *running* simulations. See [`README.md`](README.md).
169
+
170
+ **One licence session, never nested.** Local meshing needs `cadmould.Session.user_based()`. The
171
+ study opens exactly one, inside `study.mesh_part()`. A nested session releases the licence when its
172
+ inner `with` exits and breaks everything after it.
173
+
174
+ **When auth fails, re-login before debugging.** Cloud tokens go subtly stale — a token with a valid
175
+ `exp` can still be rejected (`401`, `missing email claim`). Do a full clean re-login *first*:
176
+ `python packages/cadmould_cloud/auth.py --logout`, then
177
+ `python packages/cadmould_cloud/auth.py --print-token --force`. Two separate commands —
178
+ `--logout` returns before it fetches anything, so the flags cannot be combined. Only debug
179
+ audiences and scopes once a genuinely fresh login still fails.
180
+
181
+ **The filling endpoint.** `POST /simulations/filling`, **synchronous**, ~9 s warm, AI solver,
182
+ filling only — no runner system, no cooling, no warpage. It **sheds load under concurrency**, so
183
+ the study runs at `max_workers=2` with retry and backoff. If everything times out the model went
184
+ cold; one lone request warms it, then resume. `num_timesteps` 50–64 is the working range.
185
+
186
+ **Simulations are deterministic.** An identical configuration returns an identical result. Never
187
+ re-run one for confidence or averaging — spend every run on a new configuration.
188
+
189
+ **Gates must sit on real mesh nodes.** The surrogate requires it; the harness snaps them.
190
+
191
+ **Organise it as a cloud project.** The study creates a project per quote, a group per batch, and
192
+ writes each decision as a project note. Six months later that is how anyone finds out why the tool
193
+ was quoted with two gates.
194
+
195
+ **The pressure caveat that matters most here.** The AI model is **one cavity with no runner
196
+ system**, and under-reads absolute pressure on multi-gate parts. Use it to rank gating options —
197
+ that is what it is good at. Do **not** size the clamp from it alone; the cost model already takes
198
+ the larger of the simulated value and the material's rule-of-thumb cavity pressure, and reports
199
+ which governed. If you find yourself arguing that the simulated pressure is fine, re-read L-002 in
200
+ `lessons.md`.
201
+
202
+ ## 5. Close every quote with the review — this is the point
203
+
204
+ The first quotes will be wrong. That is expected and it is the mechanism, not a defect.
205
+
206
+ Once the quote exists, **walk the estimator through what you decided** and ask for corrections.
207
+ Ask about the things you actually chose, in this order — biggest money first:
208
+
209
+ 1. **Tool price** — is the total in the right band? Which line is off?
210
+ 2. **Cycle time** — would this tool really run at that cycle?
211
+ 3. **Press and clamp** — is that the machine you would book?
212
+ 4. **Gate count and feed system** — would you build it that way?
213
+ 5. **Material and its price** — would you have proposed that grade?
214
+ 6. **Anything you flagged** — side actions, weld lines, barrel utilisation.
215
+
216
+ For each correction you must capture the **reason in the estimator's own words**. The number
217
+ without the reason is unmaintainable; the reason is what transfers to the next part.
218
+
219
+ Then write `cache/<key>/corrections.json` and run `python main.py learn --quote <key>`:
220
+
221
+ ```json
222
+ {
223
+ "quote": "bracket-A2",
224
+ "reviewer": "who corrected it",
225
+ "corrections": [
226
+ {
227
+ "title": "Cycle time too optimistic",
228
+ "agent_decided": "21.4 s from the analytic slab-cooling time",
229
+ "corrected_to": "24 s",
230
+ "why": "the estimator's own words - why the model was wrong, not just that it was",
231
+ "rule": "what to do differently next time",
232
+ "calibration": {"cooling_time_factor": 1.15}
233
+ }
234
+ ]
235
+ }
236
+ ```
237
+
238
+ `learn` appends the prose to `shop/lessons.md` and merges the numbers into its `calibration`
239
+ block, which the cost model reads on the next quote. The knobs are listed in that file; an unknown
240
+ key is rejected rather than silently ignored.
241
+
242
+ **Some corrections are not a number.** If the fix is "we would never build that with a cold
243
+ runner", record it with an empty `calibration` and edit the relevant `shop/` file directly —
244
+ `tooling.md` for construction rules, `machines.md` for press rules, `materials.md` for grades.
245
+ `lessons.md` records *why it changed*; the other files hold *what the shop is*.
246
+
247
+ ## 6. Failure modes to watch for
248
+
249
+ - **Quoting an offline estimate as if it were simulated.** `quote.json` records which it was;
250
+ do not contradict it in conversation or in the document you write.
251
+ - **Letting the model's confidence exceed its basis.** Cooling is analytic, pressure is a
252
+ surrogate on one cavity, undercuts are ray-cast. All three belong in whatever you hand over.
253
+ - **Silently accepting "no press fits".** It is a real answer sometimes, but check the cavity
254
+ count and the draw direction first — a wrong draw axis doubles the projected area.
255
+ - **Skipping the review because the quote looks plausible.** A plausible wrong number is the
256
+ expensive kind. The loop only improves if it runs.
@@ -0,0 +1,46 @@
1
+ # The prompt
2
+
3
+ Copy this into a fresh Claude Code session opened in `templates/quoting/`, after dropping the
4
+ geometry into `parts/`. It is deliberately short: the agent is meant to get the shop's context
5
+ from `shop/` and the method from `METHOD.md`, not from the prompt.
6
+
7
+ ---
8
+
9
+ > I've put a new part in `parts/` and we need to quote it. **4 cavities.**
10
+ >
11
+ > Run the whole thing the way we quote: work out what the part costs us to tool and to mould, run
12
+ > whatever simulations you need on the Simcon cloud to settle the decisions that have to be made
13
+ > now — how many gates, what pressure, what press, what cycle — and give me a quotation I can
14
+ > send.
15
+ >
16
+ > You know how this shop works; it's in `shop/`. Ask me if you need the material.
17
+ >
18
+ > When it's done, walk me through what you decided and I'll tell you where you're wrong.
19
+
20
+ ---
21
+
22
+ ## What the agent should do with that
23
+
24
+ 1. Read all of `shop/` — including `lessons.md`, which is where the last estimator's corrections
25
+ live and which overrides its own judgement.
26
+ 2. `intake` — geometry: projected area, wall thickness, undercuts, volume. Flag anything odd.
27
+ 3. Ask about the material **once**, with a recommendation and a price, per `shop/materials.md`.
28
+ 4. `study` — filling simulations on the cloud for each gate count, organised as a cloud project
29
+ with a decision log.
30
+ 5. `cost` — price every gating option and pick on **total cost of ownership**, not on pressure.
31
+ 6. **Ask for corrections** and record them with `learn`, so the next quote starts better.
32
+
33
+ ## Variations worth trying
34
+
35
+ - `--material "PA6 GF30"` at intake: watch the clamp force jump (650 bar rule of thumb vs 350 for
36
+ PP) and the press class with it.
37
+ - A part with real undercuts: the side-action count drives both the tool price and the lead time.
38
+ - Two cavity counts on the same part: 2 vs 8. The cavity count is the customer's, but the *cost*
39
+ consequence is the shop's to explain.
40
+ - Run it twice with a correction in between — that is the whole point of the system.
41
+
42
+ ## No cloud access?
43
+
44
+ Add `--offline` to the `study` stage. The gating comes from a rule of thumb instead of the solver,
45
+ everything downstream is marked `estimated`, and `quote.json` records it. It exercises
46
+ the full flow, and it is not a quote you would send.