cyclecad 3.10.3 → 3.11.0

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.
@@ -0,0 +1,34 @@
1
+ name: Deploy to GitHub Pages
2
+
3
+ on:
4
+ push:
5
+ branches: [main]
6
+ workflow_dispatch:
7
+
8
+ permissions:
9
+ contents: read
10
+ pages: write
11
+ id-token: write
12
+
13
+ concurrency:
14
+ group: pages
15
+ cancel-in-progress: true
16
+
17
+ jobs:
18
+ deploy:
19
+ runs-on: ubuntu-latest
20
+ environment:
21
+ name: github-pages
22
+ url: ${{ steps.deployment.outputs.page_url }}
23
+ steps:
24
+ - name: Checkout
25
+ uses: actions/checkout@v4
26
+ - name: Setup Pages
27
+ uses: actions/configure-pages@v5
28
+ - name: Upload artifact
29
+ uses: actions/upload-pages-artifact@v3
30
+ with:
31
+ path: '.'
32
+ - name: Deploy to GitHub Pages
33
+ id: deployment
34
+ uses: actions/deploy-pages@v4
package/.nojekyll ADDED
File without changes
package/CLAUDE.md CHANGED
@@ -1119,3 +1119,433 @@ import { startSketch, endSketch, setTool, getEntities, clearSketch, entitiesToGe
1119
1119
 
1120
1120
  # currentDate
1121
1121
  Today's date is 2026-04-01.
1122
+
1123
+ ## Session 2026-04-23 — AI Copilot Template Library + Real CSG
1124
+
1125
+ ### What shipped
1126
+ - **cyclecad@3.10.2** (live on npm): AI Copilot v1.1 with template library, real CSG booleans, draggable dialogs, click-pin menus
1127
+ - **cyclecad@3.10.3** (pending/retry): template expansion with 5 more shapes (washer, flange, threaded rod, mounting plate, box)
1128
+
1129
+ ### Key files
1130
+ - `app/js/modules/ai-copilot.js` (~900 lines) — multi-step CAD copilot. IIFE that sets `window.CycleCAD.AICopilot`. Key internals: `matchTemplate()`, `miniExecute()` (async), `subtractFromBody()` (CSG), `loadCSG()` (lazy import vendored lib), `run()` (orchestrator), `buildUI()`
1131
+ - `app/js/vendor/three-bvh-csg.js` (3892 lines) — vendored three-bvh-csg@0.0.17 with bare imports rewritten: `'three'` and `'three-mesh-bvh'` → CDN URLs (`cdn.jsdelivr.net/npm/three@0.170.0/...` and `three-mesh-bvh@0.7.8`)
1132
+ - `app/index.html` — has `<script src="/app/js/modules/ai-copilot.js?v=HASH">` (cache-busted) and menu entry `data-action="tools-ai-copilot"`
1133
+
1134
+ ### Template library (8 shapes) — `matchTemplate(prompt)` in ai-copilot.js
1135
+ All templates bypass LLM and output a fixed JSON plan with correct DIN/ISO coordinates:
1136
+ | Prompt pattern | Shape | Notes |
1137
+ |---|---|---|
1138
+ | `raspberry pi \| rpi \| pi 4` + `case` | Pi case | Case body 89×14×60, 4 mounting posts at ±38.75, y=14, ±26. Optional USB/HDMI/Ethernet ops.hole cutouts |
1139
+ | `M(n) nut` | Hex nut (DIN 934) | Cylinder with correct across-flats + thickness by M-size |
1140
+ | `L-bracket` + `Nmm` + `N holes` + `Nmm centers` | L-bracket | Rect plate + N CSG holes |
1141
+ | `M(n) washer` or `DIN 125 M(n)` | Washer | Disk + center hole, DIN 125 spec |
1142
+ | `flange` + `Nmm` + `N bolt holes` + `PCD N` | Flange | Disk + bolt circle + center bore |
1143
+ | `threaded rod` + `M(n)` + `Nmm` | Threaded rod | Cylinder by M-size + length |
1144
+ | `mounting plate` + `NxN` + `N holes` | Mounting plate | Rect + N holes (4-hole = corners, else evenly spaced) |
1145
+ | `box NxNxN` | Generic box | Box extrude |
1146
+
1147
+ ### Coordinate system (for mini-executor)
1148
+ - X = left/right, Y = up, Z = front/back
1149
+ - All solids centered at origin: rect W×H → [-W/2,W/2] × [-H/2,H/2]
1150
+ - ops.extrude depth=D → Y spans [0, D]
1151
+ - Params `position:[x,y,z]` places the centerpoint of the extruded solid
1152
+
1153
+ ### Mini-executor API (handles these methods)
1154
+ - `sketch.start/rect/circle/line/end`
1155
+ - `ops.extrude {depth, position, subtract}` — subtract:true does CSG cut
1156
+ - `ops.hole {position, depth, radius OR width+height}` — CSG subtraction from body
1157
+ - `ops.revolve/fillet/chamfer/shell/pattern` (fillet/chamfer/shell are visual-approx only)
1158
+ - `view.set/fit`, `query.*`, `validate.*`
1159
+
1160
+ ### State (IIFE-local `miniState`)
1161
+ - `miniState.group` — THREE.Group with name 'AICopilotBuild' (wiped on every `run()` via `miniReset()`)
1162
+ - `miniState.body` — first solid mesh; ALL `ops.hole` subtractions target this (not lastMesh)
1163
+ - `miniState.lastMesh` — last added mesh; used by `ops.pattern` for cloning
1164
+ - `miniState.currentSketch` — `{shape, width, height, radius, origin}` consumed by next `ops.extrude`
1165
+
1166
+ ### Critical bug patterns fixed this session
1167
+ 1. **Single-quote apostrophe in SYSTEM_PROMPT** — `isn't` closed the JS string. Use `is not` or escape.
1168
+ 2. **Module not loading** — `window.CycleCAD.AICopilot` was undefined because wrapped import had syntax error. Always `node --check` the file before push.
1169
+ 3. **Base64 2-chunk delivery corrupts file** — large files clipboard-split and concatenated via bash can lose the first half. Prefer single `cat > file << 'EOF'` heredoc.
1170
+ 4. **Scene accumulates between runs** — `miniReset()` must be called at start of `run()`. This call was dropped twice in earlier patches.
1171
+ 5. **ops.hole eating posts instead of body** — `subtractFromLast` targeted whatever was most recently added. Fixed by tracking `miniState.body` separately and calling `subtractFromBody`.
1172
+ 6. **Posts landing at origin** — `ops.extrude` was ignoring `params.position` and only reading `sketch.origin`. Fixed to read params first.
1173
+ 7. **Bare imports in vendored library** — `'three-mesh-bvh'` also needed rewriting, not just `'three'`.
1174
+ 8. **Cmd+C hijacking Copy** — killer-features.js shortcuts had no Shift modifier. Changed to Cmd+Shift+C/K/P/G/T.
1175
+
1176
+ ### Click-pin menu (in index.html)
1177
+ CSS: `.menu-item.open .menu-dropdown { display: flex !important; }`. JS initMenuPin() wires click-to-toggle + click-outside-to-close. File still has the `:hover` fallback for quick hover.
1178
+
1179
+ ### Dialog drag (in index.html)
1180
+ Pointer events on `#dialog-title` drag the whole dialog container via `position: fixed; left/top` — set once on pointerdown, updated on pointermove.
1181
+
1182
+ ### UX niceties
1183
+ - Banner: `Ready: <model>` (green) or `No <provider> key — click the key icon` (red)
1184
+ - Low-credit errors auto-offer "Switch to Gemini (free)" button
1185
+ - Multi-goal prompts: detect `N` quoted strings, run first, log others to "paste one at a time"
1186
+ - Gemini 404 fallback: `gemini-2.0-flash` → `gemini-1.5-flash` → `gemini-1.5-flash-latest`
1187
+ - Cache-bust: `?v=HASH` query param on script tags, auto-bumped by MD5 of mtime
1188
+
1189
+ ### Supported models
1190
+ - Claude Sonnet 4.6 (paid, default when anthropic key present)
1191
+ - Claude Haiku 4.5 / Opus 4.6 (paid)
1192
+ - Gemini 2.0 Flash (free, 10 RPM)
1193
+ - Groq Llama 3.3 70B (free, 30 RPM — better for repeat prompts)
1194
+
1195
+ ### Pending
1196
+ - The `block-only-in-chrome` user report — needs repro with actual prompt
1197
+
1198
+ ### Collaboration notes
1199
+ - User on Mac, tests in Chrome/Safari private
1200
+ - Git user is `sachin@sachins-MacBook-Air.fritz.box` (not configured globally; harmless warning)
1201
+ - Clipboard delivery via `write_clipboard` — user pastes in Terminal
1202
+ - Verification via Claude-in-Chrome MCP (navigate → execute → screenshot → dom inspect)
1203
+ - Terminal is tier-click, so clipboard write is BLOCKED while Terminal is frontmost — switch to Chrome first
1204
+
1205
+ ## Session 2026-04-24 — GitHub Pages Pipeline Fix + Template Library Expansion
1206
+
1207
+ ### What shipped
1208
+ - **cyclecad@3.10.3** confirmed live on npm (earlier interrupted publish actually went through)
1209
+ - **cyclecad@3.10.4 patch prepared** (delivery command sent via clipboard heredoc, user ran it): 3 new AI Copilot templates
1210
+ - `spur gear 20 teeth module 2 bore 10mm` → cylinder blank at OD with bore, correct DIN pitch math (`pitchDia = m*z`, `outsideDia = m*(z+2)`, default face width 10mm, default bore 8mm)
1211
+ - `pulley 80mm bore 12mm` or `v-belt pulley 100mm` or `timing pulley 60mm` → disc with center bore, V-groove noted as next step (true groove needs revolve)
1212
+ - `shaft 20mm dia 150mm long`, `stepped shaft 25mm 120mm`, `axle 16mm 200mm`, `spindle Ø10 80mm long` → simple or 2-step cylinder with fallback heuristic for bare `Nmm` values (smaller=dia, larger=length)
1213
+ - **GitHub Pages deploy pipeline migrated** — from auto-generated "Deploy from a branch" to explicit GitHub Actions workflow with `cancel-in-progress: true`
1214
+
1215
+ ### Pages deploy fix details
1216
+ - **Root cause of failed runs #151/#152**: concurrent deployment conflict. Commit `ccacf45` pushed while `746008a` was mid-deploy → HTTP 400 "in progress deployment". Build succeeded (31s) but deploy step failed in 3s with 3 annotations.
1217
+ - Self-resolved for subsequent runs (#153-#166 all green) but would recur on future rapid pushes.
1218
+ - **Fix shipped**: Added `.github/workflows/pages.yml` with:
1219
+ ```yaml
1220
+ permissions: { contents: read, pages: write, id-token: write }
1221
+ concurrency: { group: pages, cancel-in-progress: true }
1222
+ ```
1223
+ Uses `actions/checkout@v4`, `actions/configure-pages@v5`, `actions/upload-pages-artifact@v3`, `actions/deploy-pages@v4`.
1224
+ - Added `.nojekyll` at repo root (harmless, prevents future Jekyll issues).
1225
+ - **Pages source setting flipped manually** via GitHub UI (via Chrome MCP): Settings → Pages → Source → "GitHub Actions" (was "Deploy from a branch"). Confirmed with "GitHub Pages source saved." banner.
1226
+ - Triggered manual `workflow_dispatch` run → Deploy #2 succeeded in 20s (13s deploy step). Deploy step output URL = `https://cyclecad.com/` confirming new pipeline is authoritative.
1227
+ - Old `pages build and deployment` workflow automatically stops firing once source is "GitHub Actions".
1228
+ - One remaining harmless warning: "Node.js 20 actions are deprecated" — affects the whole actions ecosystem, will resolve when major versions bump.
1229
+
1230
+ ### Template patching pattern (for future template additions)
1231
+ Templates go in `matchTemplate(prompt)` in `app/js/modules/ai-copilot.js`, inserted before `return null;` (currently ~line 594, was line 514 before gear/pulley/shaft block). Each template:
1232
+ 1. Matches user prompt with regex
1233
+ 2. Parses params with sensible defaults
1234
+ 3. Returns array of plan steps: `sketch.start` → `sketch.circle/rect` → `ops.extrude` → optional `ops.hole` → `view.set iso` → `view.fit`
1235
+ 4. All solids centered at origin, Y is extrude axis
1236
+
1237
+ ### Tested template prompts (all passing via Node eval)
1238
+ - `spur gear 20 teeth module 2` → m=2, Z=20, pitch Ø40, OD Ø44 ✓
1239
+ - `gear m=3 z=40 bore 10mm` → m=3, Z=40, pitch Ø120, OD Ø126, bore Ø10 ✓
1240
+ - `v-belt pulley 80mm bore 12` → Ø80x20 with bore Ø12 ✓
1241
+ - `shaft 20mm dia 150mm long` → Ø20 x 150mm ✓
1242
+ - `stepped shaft 25mm dia 120mm long` → main Ø25x72mm + reduced Ø21x48mm ✓ (60/40 split)
1243
+ - `axle 16mm 200mm` (bare Nmm heuristic) → dia=16 (min), len=200 (max) ✓
1244
+ - `spindle Ø10 80mm long` → Ø10 x 80mm ✓
1245
+
1246
+ ### ExplodeView AI Render diagnostic (cross-reference)
1247
+ User reported Nano Banana v2 renders ignoring source CAD object. Three stacked problems in `docs/demo/app.js` `buildPrompt()` (line 6595):
1248
+ 1. Prompt wrapper `Photorealistic render of an industrial/mechanical product in ${scene}...` nests user's preservation intent grammatically, weakening it
1249
+ 2. Nano Banana v2 is generative not inpainting — reference image is style guidance, not pixel-level preservation
1250
+ 3. Product Photo preset suffix "studio lighting, minimal shadows" fights outdoor scene prompts
1251
+ Fix delivered as prompt rewrite (preservation-first pattern). Code fix as v304 prepared but NOT YET SHIPPED. See explodeview CLAUDE.md for full details.
1252
+
1253
+ ### Pending (next session)
1254
+ - Confirm cyclecad@3.10.4 publish went through (user ran command; verify with `curl -s https://registry.npmjs.org/cyclecad/latest | python3 -c 'import json,sys; print(json.load(sys.stdin)["version"])'`)
1255
+ - Ship ExplodeView v304 (buildPrompt fix for AI Render prompt hijacking)
1256
+ - Add more AI Copilot templates: mounting bracket variations, T-slot extrusions, bearing cutouts, ball/roller bearings
1257
+ - Eventually: true involute gear teeth via `sketch.polyline` (would require mini-executor support for polyline → geometry, currently polyline is a no-op)
1258
+ - Post viral LinkedIn draft (user approval pending) — see `~/explodeview/linkedin-post-viral.md`
1259
+ - Push ExplodeView route redirects (explodeview.com/docs/demo/ currently 404)
1260
+ - The `block-only-in-chrome` user report — still needs repro
1261
+
1262
+ ### Collaboration lessons learned this session
1263
+ - **GitHub Pages 3-annotation failures** ("Failed to create deployment status: 400" + "Deployment request failed...due to in progress deployment" + "Creating Pages deployment failed") = concurrent deploy conflict, NOT build failure. Fix: explicit workflow with `concurrency: group: pages, cancel-in-progress: true`.
1264
+ - **GitHub API path for Pages source**: `PUT /repos/{owner}/{repo}/pages` with `-f build_type=workflow` (workflow) or `legacy` (branch). Good fallback when Chrome MCP auth is unavailable — user just runs `gh api --method PUT /repos/vvlars-cmd/cyclecad/pages -f build_type=workflow` on Mac where `gh` is authenticated.
1265
+ - **Password entry via Chrome MCP is prohibited** — Claude will not sign in on user's behalf under any circumstance. User must sign in themselves; Claude can then operate in authenticated sessions.
1266
+ - **Chrome tier "read"** blocks `computer_use` clicks in the browser itself, but Claude-in-Chrome MCP tools (`mcp__Claude_in_Chrome__*`) DO work — they go through the extension.
1267
+ - **Use `find` tool with aria role** (e.g., `menuitemradio "GitHub Actions"`) rather than guessing pixel coordinates — much more reliable. First click attempt at (585, 452) missed the dropdown option, second via `ref_311` landed perfectly.
1268
+ - **After Pages source flip**, trigger `workflow_dispatch` immediately to prove the new pipeline actually serves traffic (the existing run only built the artifact — it didn't serve until source was flipped).
1269
+ - **Successful Pages deploy step** shows the deploy environment URL (e.g. `https://cyclecad.com/`) as a link under the job name — that's the tell that it worked end-to-end, not just a green check.
1270
+
1271
+ ## Session 2026-04-24 (continued) — ExplodeView v304 shipped + new roadmap item
1272
+
1273
+ ### What shipped
1274
+ - **ExplodeView v1.0.22 / v304** published to npm and deployed (commit `b47d6a9`, then `41471f3` for the version bump). `buildPrompt()` in `docs/demo/app.js` rewritten with preservation-first logic:
1275
+ - Detects explicit preservation cues ("do not change", "preserve", "keep exactly", "same shape", etc.) → leads with strong reference-image anchor
1276
+ - Detects scene-descriptive prompts (>40 chars + spatial language) → passes them to the model directly with only the preamble in front, drops the rigid "render of a product in X" wrapper
1277
+ - Suppresses Product Photo / Technical preset suffixes when the scene has outdoor cues (forest, trail, sunset, etc.) so the studio suffix doesn't fight the scene
1278
+ - Adds a "No Style" preset (`presetSuffixes.none = ''`) that skips the suffix entirely; new dashed-border button in `docs/demo/index.html` at line ~2145
1279
+ - Version badge updated: "ExplodeView v304 — preservation-first AI Render"
1280
+
1281
+ ### New roadmap item — AI Engineering Analyst (MecAgent-parity)
1282
+
1283
+ **Source**: user shared MecAgent demo screenshots in `/Users/sachin/Desktop/mec` (12 screenshots, 2026-04-24 at 11:49-11:51). The demo runs inside Inventor via MecAgent's Copilot panel and solves a complete bolted joint problem:
1284
+
1285
+ Problem statement (exact wording from screenshots):
1286
+ > A steel plate is secured using 4 × M12 bolts (property class 10.9) in a preloaded configuration. The joint is subjected to: a shear force of 18 kN, an axial separating force of 18 kN, an in plane moment of 420 Nm. Given: friction coefficient between contact surfaces μ = 0.16, preload per bolt 39 kN, bolt circle diameter: 96mm, required safety factor against slipping: 1.5. Question: Verify whether the joint is safe with respect to: 1. slip resistance, 2. maximum tensile load in the most loaded bolt, 3. combined tension and shear in the bolts.
1287
+
1288
+ MecAgent's response walks through three checks with full equations:
1289
+ - **Slip resistance**: `F_friction = z·Q_F·μ = 4·39000·0.16 = 24960 N` vs required `F_required = K_s·F_shear = 1.5·26000 = 39000 N`
1290
+ - **Tension with moment**: `F_axial,bolt = F_axial,total/z = 18000/4 = 4500 N`; moment contribution `F_moment = M·r/Σr² = 420·1000·48/(4·48²) = 2187.5 N`; `F_max,tensile = 6687.5 N`
1291
+ - **Combined**: preload adds on top → `F_tensile,total = 45687.5 N`; tensile stress `σ = F/A = 45687.5/84.3 = 542 MPa`; shear stress `τ = 6500/84.3 = 77 MPa`; Von Mises `σ_vm = √(σ²+3τ²) = 558 MPa`
1292
+ - Compared against 10.9 proof strength (~936 MPa) → verdict "safe"
1293
+ - **Critical UX detail**: cites "Analysis and Design of Machine Elements" by Wei Jiang (Wiley), page 85, with clickable "Open Document" buttons showing the exact textbook page
1294
+
1295
+ **Why this matters**: cycleCAD's existing `ai-copilot.js` generates geometry (templates for gears, bolts, flanges), `fusion-simulation.js` has stubbed FEA, and `validate.designReview` returns A-F scores from geometry heuristics. None of them answer a natural-language engineering question with analytical methods and cited sources. This is the single biggest competitive gap vs MecAgent's pitch, and closing it makes cycleCAD's "agent-first" positioning real.
1296
+
1297
+ **Scope v1 — bolted joint analysis (VDI 2230 / Shigley)**:
1298
+ - Module: `app/js/modules/ai-engineer.js` (~800-1200 lines)
1299
+ - Inputs: bolt grade (4.6–12.9), bolt count, thread size, preload, external loads (shear/tension/moment + BCD), friction coefficient, safety factor target
1300
+ - Outputs: slip-resistance check, per-bolt tension with moment redistribution, combined Von Mises stress, proof-strength comparison, pass/fail verdict
1301
+ - Rendering: LaTeX equations via KaTeX (faster than MathJax), stepwise narrative, green/red badges per check
1302
+
1303
+ **Scope v2 — other machine elements**: gear pair (AGMA bending + pitting), shaft fatigue (Goodman/Soderberg), rolling bearing L10 life, fillet weld sizing
1304
+
1305
+ **RAG / citations**:
1306
+ - User uploads machine-element PDF → chunk + embed in IndexedDB (no server, runs locally with @xenova/transformers MiniLM)
1307
+ - Bundled fallback: public-domain machine-element references + excerpts from DIN/ISO standards we can legally redistribute
1308
+ - Every equation in the response cites page + source
1309
+
1310
+ **LLM layer**:
1311
+ - Same provider stack as ai-copilot.js (Claude Sonnet 4.6 / Gemini 2.0 Flash / Groq Llama 3.3 70B)
1312
+ - Tool-use pattern: model writes narrative, calls deterministic analytical JS functions for every number, never fabricates results. Analytical core is pure math (no LLM) — LLM is only for problem parsing + narrative.
1313
+
1314
+ **UI**:
1315
+ - New "Engineer" tab in right panel alongside Properties / Chat / Guide
1316
+ - Reuses selected-assembly context, materials, and bolt patterns from Fastener Wizard as implicit inputs (so user doesn't have to re-enter them)
1317
+
1318
+ ### Pending (next session, updated)
1319
+ - **AI Engineering Analyst module** (above) — the biggest pending feature
1320
+ - More AI Copilot templates: mounting bracket variations, T-slot extrusions, bearing cutouts, ball/roller bearings
1321
+ - Eventually: true involute gear teeth via `sketch.polyline` (requires mini-executor support for polyline → geometry, currently polyline is a no-op)
1322
+ - ExplodeView compositing render (true pixel preservation — render 3D with transparent bg, send only background region to Nano Banana, composite in canvas)
1323
+ - Run cyclecad test agent in Chrome (`app/test-agent.html`, 113 tests) and fix failures
1324
+ - Dynamic version badge in cyclecad status bar (currently hardcoded v0.9.0 but npm is 3.10.4)
1325
+ - Wire cyclecad splash buttons (New Sketch / Open-Import / Text-to-CAD / Inventor Project) to actually trigger their actions
1326
+ - 138MB STEP import — server-side conversion path (server/converter.py) is the safer route than opencascade.js v293
1327
+ - Text-to-CAD with live preview
1328
+ - Photo-to-CAD reverse engineering
1329
+ - Docker compose local test
1330
+ - The `block-only-in-chrome` user report — still needs repro
1331
+
1332
+ ## Session 2026-04-24 (session 2) — Pentamachine Collaboration + Suite Positioning + Pentacad Extension
1333
+
1334
+ ### Big strategic updates
1335
+
1336
+ **Suite positioning locked in:**
1337
+ cyclecad.com is now an umbrella brand — **cycleCAD Suite** — covering three products:
1338
+ - **cycleCAD** (parametric CAD modeller, existing, MIT)
1339
+ - **ExplodeView** (3D viewer / AR / AI render, existing, MIT)
1340
+ - **Pentacad** (CAM + 5-axis simulator + Kinetic Control bridge, NEW, AGPL-3 / commercial dual)
1341
+
1342
+ Pentacad is a **cycleCAD module**, NOT a separate repo. Lives at `app/js/modules/pentacad*.js` following the existing `window.CycleCAD.Pentacad` IIFE pattern.
1343
+
1344
+ **Matt / Pentamachine status — CRITICAL:**
1345
+ Matt agreed to send files without NDA, but he explicitly stated: *"We do provide feedback for 4+ companies that are working on similar CAM concepts to yours."*
1346
+
1347
+ Implication: Matt is a **neutral ecosystem supplier**, not a partner. JV ask is dead. Strategy is pilot-first: build in silence, ship polished demos (not source, not architecture), public launch before he asks for exclusivity. Commercial progression: Phase 0-1 silent, Phase 2 license discussion, Phase 3 exclusive EU resale if warranted, JV only if Matt raises equity first. Full tactical playbook at `~/Documents/Penta/pentacad-notes/pilot-intelligence-brief.md` (private).
1348
+
1349
+ ### Pentacad extension shipped (scaffold)
1350
+
1351
+ Files added to cycleCAD repo:
1352
+ | File | Purpose |
1353
+ |---|---|
1354
+ | `app/js/modules/pentacad.js` | Coordinator — registers sub-modules, machine picker UI, loadMachine(id), public API |
1355
+ | `app/js/modules/pentacad-cam.js` | 12 CAM strategies (stubs), post-processor skeleton, emitGCode() matching Pentamachine dialect |
1356
+ | `app/js/modules/pentacad-sim.js` | G-code parser (works for G20/G90/G94/G93/G54, tracks modal state + A/B axes), forward-kinematics stub, soft-limit check |
1357
+ | `app/js/modules/pentacad-bridge.js` | WebSocket client for controller bridge — connect/disconnect/stream/jog/pause/abort, DRO event handling, auto-reconnect |
1358
+ | `app/pentacad.html` | Dedicated UI entry point with split-screen viewport + machine picker + workspace tabs (Machine / Design / CAM / Simulate / Control) |
1359
+ | `machines/v2-50-chb/kinematics.json` | Template values marked `_confirmed: false` pending Matt's real data |
1360
+
1361
+ ### Suite landing mockup
1362
+
1363
+ `mockups/cyclecad-suite-mockup.html` — full animated wireframe (not yet in production).
1364
+
1365
+ Page structure:
1366
+ 1. **Hero** — "From idea to finished part. One browser tab." with staggered fade-up, drifting orb gradients, blinking cursor
1367
+ 2. **Lifecycle strip** — 5 stages with rainbow gradient line drawing across all chips on scroll-into-view
1368
+ 3. **End-to-End Journeys** — 3 animated product examples showing the full business lifecycle (idea → design → market → sell → manufacture → feedback):
1369
+ - 🔔 Custom bike bell (consumer, 6 days, €345, 23 pre-orders)
1370
+ - ⚙️ Precision flange (B2B, 3 days, €2,400, 50-unit PO)
1371
+ - 🍺 Branded bottle-opener ring (promo, 2 days, €1,900, 100 units)
1372
+ - 15s loop, 2.5s per step, rows offset by one step each, hover to pause, click step to jump
1373
+ 4. **5 stage deep-dives** — each with SVG animations (typing terminal, line-draw CAD, exploded parts, toolpath tracing, data-flow arrows)
1374
+ 5. **Products grid** (3 cards — gold/teal/emerald per product), stats, CTA, founder note, footer
1375
+
1376
+ Old `index.html` backed up as `index-agent-first.html.bak`. Production index.html NOT yet written — mockup is the design spec.
1377
+
1378
+ ### Pentamachine deliverables at `~/Documents/Penta/pentacad-deliverables/`
1379
+ - `ARCHITECTURE.md` — full system architecture (repo doc, shareable with Matt)
1380
+ - `Pentacad-Complete.pptx` — 25-slide deck (16 public architecture + 8 private intelligence brief, clearly divided)
1381
+ - `Pentacad-Complete.pdf` — same, non-editable
1382
+ - `pilot-intelligence-brief.md` — full tactical playbook
1383
+
1384
+ Plus standalone pentacad repo scaffold at `~/Documents/Penta/pentacad/` (superseded by extension approach, kept as reference).
1385
+
1386
+ ### What Matt has sent (in `~/Documents/Penta/`)
1387
+ Marketing kit + installation guides + ONE real technical artifact: bottle-opener ring Fusion archive + 3 `.ngc` files confirming A/B kinematics, G20 imperial, G93 inverse-time feed, 40000 RPM spindle.
1388
+
1389
+ **Still blocking Phase 0**: native 3D models of V2-10/V2-50CHB/V2-50CHK + kinematics JSON per machine.
1390
+
1391
+ ### Pending task inbox (tasks #10-24)
1392
+
1393
+ **AI Engineering Analyst** (biggest competitive gap vs MecAgent):
1394
+ - #10 v1 — bolted-joint analysis (VDI 2230 / Shigley), pure-math core tested against MecAgent numbers, KaTeX rendering, LLM tool-use, RAG
1395
+ - #11 v2 — gears (AGMA), shafts (Goodman/Soderberg), bearings (L10), welds (throat stress)
1396
+ - #12 — RAG + citations (@xenova/transformers MiniLM, IndexedDB, "Open Document" footnotes)
1397
+
1398
+ **cycleCAD quick wins** (ship 3.10.5 next):
1399
+ - #13 — more AI Copilot templates (brackets, T-slots 40/40 + 80/40, bearings, cutouts)
1400
+ - #14 — polyline → geometry in mini-executor (unblocks involute gear teeth)
1401
+
1402
+ **cycleCAD other**:
1403
+ - #15 dynamic version badge · #16 wire splash buttons · #17 run test-agent.html (113 tests) · #18 text-to-CAD live preview · #19 photo-to-CAD · #20 server-side 138MB STEP · #21 docker compose test
1404
+
1405
+ **ExplodeView**:
1406
+ - #22 compositing render (transparent background + Nano Banana + canvas composite, bypasses "generative ≠ inpainting") · #23 killer-features-test · #24 block-only-in-chrome repro
1407
+
1408
+ **Suite website**:
1409
+ - Port mockup into production index.html once motion is approved
1410
+ - Build dedicated /pentacad.html marketing page in same style
1411
+
1412
+ ### Recommended next sprint
1413
+ #13 + #14 as warm-ups (ship 3.10.5 fast), then #10 as the big strategic work.
1414
+
1415
+ ### Handoff files for next chat
1416
+ - `~/cyclecad/HANDOFF-2026-04-24.md` (earlier session — AI Render v304 + Pages workflow)
1417
+ - `~/cyclecad/HANDOFF-2026-04-24-session-2.md` (this session — Pentacad + Matt + mockup)
1418
+
1419
+ Both should be read together when resuming.
1420
+
1421
+ ## Session 2026-04-24 (session 3) — cyclecad 3.10.5 ship + AI Engineering Analyst v1
1422
+
1423
+ ### Sprint executed (per session-2 handoff recommendation)
1424
+
1425
+ **Task #14 — Polyline support in mini-executor** ✅
1426
+ - `app/js/modules/ai-copilot.js` `sketch.polyline` method: accepts `{points:[[x,z],[x,z],...]}`, min 3 points
1427
+ - `ops.extrude` now handles `shape==='polyline'` via `THREE.Shape` + `THREE.ExtrudeGeometry`
1428
+ - Coordinate math: `Shape.moveTo(x, -z)` compensates for `rotateX(-π/2)` so user input `[x,z]` maps to world X,Z correctly
1429
+ - `g.translate(0, 0, -d/2)` before rotate to center along extrude axis, matching `BoxGeometry` / `CylinderGeometry` convention
1430
+ - `SYSTEM_PROMPT` updated so LLM knows about the method
1431
+ - Unblocks true involute gear teeth, real T-slot cross-sections, custom 2D cams/profiles
1432
+
1433
+ **Task #13 — More AI Copilot templates** ✅
1434
+ Added 4 new templates to `matchTemplate()` in `app/js/modules/ai-copilot.js`:
1435
+ 1. **Ball bearing (ISO 15 / DIN 625)** — lookup table of 20 standard deep-groove designations (608, 625, 6000-6006, 6200-6206, 6300-6304). Matches `"6200 bearing"`, `"6203 deep-groove bearing"`, `"608 bearing"`, etc.
1436
+ 2. **Generic ball bearing with bore** — matches `"ball bearing 15mm bore"`. Uses approximation `OD ≈ 2.5·bore + 10, B ≈ 0.4·bore + 4` for 62xx-series sizing.
1437
+ 3. **Bearing housing / pocket** — matches `"bearing housing"`, `"bearing pocket for 6204"`, `"bearing seat"`. Block with recess, shaft clearance bore, 4 mounting holes at corners. If a bearing designation is present, looks up its OD automatically.
1438
+ 4. **T-slot aluminum extrusion** — matches `"2020 t-slot extrusion"`, `"4040 aluminum extrusion 1000mm"`, `"4080 profile"`, `"40x40 extrusion"`. Solid rect extrusion with 4 slot cuts (one per face). Double-wide profiles (4080) get extra slots on the long faces.
1439
+ 5. **U-bracket / channel bracket** — matches `"U-bracket 60mm wide 40mm high 120mm long"`, `"channel bracket 80mm long"`. Box with rectangular pocket cut from top, leaves base + 2 side walls. Includes configurable mounting holes through base.
1440
+
1441
+ Priority/ordering details:
1442
+ - Housing keyword detection (`bearing housing|pocket|seat|recess|mount`) runs BEFORE the bearing code regex so `"bearing pocket for 6204"` routes to the housing template with OD=47 looked up from the 6204 spec, not built as a bearing body.
1443
+ - T-slot length fallback: if no `"Nmm long"` keyword, take the largest `\d+mm` value that isn't the profile code (handles `"4040 extrusion 1000mm"`).
1444
+
1445
+ ### Smoke tests (run via `node /tmp/smoke.js` with stubbed globals)
1446
+ All 15 prompts match/reject correctly:
1447
+ - Specific bearing designations: `6200`, `6203`, `608` → bearing body w/ looked-up dims
1448
+ - Generic bearing w/ bore: `"ball bearing 15mm bore"` → approximated Ø48×10
1449
+ - Housing w/ explicit OD: `"bearing housing for a 32mm OD bearing"` → 48×48×15 block
1450
+ - Housing w/ designation: `"bearing pocket for 6204"` → 63×63×19 block (OD=47 from lookup)
1451
+ - T-slot variants: `2020`, `4040` (with 500mm, 1000mm, 600mm lengths)
1452
+ - U-bracket with/without dims and hole counts
1453
+ - Regression: spur gear + M8 nut still work
1454
+ - Unrelated prompt correctly returns `null`
1455
+
1456
+ ### Key files changed in 3.10.5
1457
+ | File | Delta | Notes |
1458
+ |------|-------|-------|
1459
+ | `app/js/modules/ai-copilot.js` | +190 lines | 4 templates + polyline support + docs |
1460
+ | `package.json` | version 3.10.4 → 3.10.5 | |
1461
+ | `CLAUDE.md` | This block | Session 3 notes |
1462
+
1463
+ ### Task #10 — AI Engineering Analyst v1 ✅ SHIPPED (3.11.0)
1464
+
1465
+ **File**: `app/js/modules/ai-engineer.js` (~570 lines).
1466
+
1467
+ **Architecture delivered:**
1468
+ - **Analytical core** (pure JS math, 0 deps) — `boltedJointAnalysis(params)` returns `{inputs, slipResistance, tensionCheck, combinedStress, verdict, verdictClass, notes}`. All numbers are computed deterministically — no LLM fabrication possible.
1469
+ - **Reference tables** (ISO/DIN data, frozen objects):
1470
+ - `STEEL_GRADES` — 8 ISO 898-1 property classes (4.6 through 12.9) with R_m, R_p0.2, R_el
1471
+ - `BOLT_STRESS_AREA` — DIN 13 A_s for 26 thread sizes M3–M56
1472
+ - `BOLT_MAJOR_DIA` — nominal dia per thread
1473
+ - `FRICTION_PRESETS` — VDI 2230 Table A6 surface conditions
1474
+ - **Natural-language parser** — `parseBoltedJointPrompt(text)` extracts boltCount, thread, grade, forces (kN/N), moment (Nm/kNm), preload, bcd, friction, safetyFactor. Tested against MecAgent's verbatim problem statement → all 10 params extracted correctly.
1475
+ - **UI** — dialog-mounted form with:
1476
+ - Free-text prompt → "Parse" button that auto-fills all fields
1477
+ - 11-field input grid with live recompute on any change
1478
+ - 3 preset buttons (MecAgent demo, flange M8 light, heavy M20)
1479
+ - Live report with verdict banner (green/yellow/red), 3 check sections (slip / tension / stress), KaTeX-rendered formulas, pass/fail messages per check
1480
+ - Collapsible self-test panel showing the MecAgent reference comparison
1481
+ - **KaTeX integration** — loaded on demand from CDN (jsdelivr), 0.16.21. Non-blocking, falls back to LaTeX source text if CDN fails.
1482
+ - **Menu wiring** — Tools → `🔩 AI Engineering Analyst` opens the dialog.
1483
+
1484
+ **Analytical verification (self-tests in module):**
1485
+ All 7 tests pass against MecAgent screenshot numbers within tolerance:
1486
+ ```
1487
+ PASS: F_friction actual=24960.00 expected≈24960
1488
+ PASS: F_moment/bolt actual=2187.50 expected≈2187.5
1489
+ PASS: F_bolt_max_tang actual=6687.50 expected≈6687.5
1490
+ PASS: F_bolt_total actual=45687.50 expected≈45687.5
1491
+ PASS: σ (tensile) actual=541.96 expected≈542
1492
+ PASS: τ (shear) actual=79.33 expected≈79
1493
+ PASS: σ_vm actual=559.11 expected≈558
1494
+ overall: PASS
1495
+ ```
1496
+
1497
+ Self-tests run automatically on `init()` — warnings logged if any fail. Also available as `window.CycleCAD.AIEngineer.runSelfTests()`.
1498
+
1499
+ **Verdict classification:**
1500
+ - `SAFE` — both slip and stress checks pass.
1501
+ - `SAFE (bearing-type)` — stress OK but slip fails. Bolts carry shear directly; common in practice.
1502
+ - `UNSAFE` — stress check fails. Bolt will yield.
1503
+
1504
+ For the MecAgent problem with defaults it correctly returns "SAFE (bearing-type)" because σ_vm=559 < R_p0.2=830 but F_friction=24960 < F_required=39000.
1505
+
1506
+ **Public API:**
1507
+ ```js
1508
+ window.CycleCAD.AIEngineer = {
1509
+ analyze(params), // run analysis, returns structured result
1510
+ parsePrompt(text), // NL → params
1511
+ runSelfTests(), // {results[], allPass}
1512
+ STEEL_GRADES, BOLT_STRESS_AREA, BOLT_MAJOR_DIA, FRICTION_PRESETS,
1513
+ init(), getUI(),
1514
+ execute(cmd, params) // 'analyze' | 'parse' | 'show'
1515
+ };
1516
+ ```
1517
+
1518
+ **Scope v1 limits (to address in task #11 / #12):**
1519
+ - Load factor Φ simplified to 1 (conservative — real VDI 2230 uses 0.1–0.3 for gasketed joints).
1520
+ - Bolt-circle geometry assumes uniform spacing (moment redistribution formula M / (z·r) is exact for that case).
1521
+ - No fatigue check.
1522
+ - No ball-bearing / shaft / gear / weld analysis — v2 will add these.
1523
+ - No RAG / textbook citations — v3.
1524
+
1525
+ ### 3.11.0 files changed
1526
+ | File | Delta |
1527
+ |------|-------|
1528
+ | `app/js/modules/ai-engineer.js` | new, 570 lines |
1529
+ | `app/index.html` | +3 lines (menu entry, dispatch case, script tag) |
1530
+ | `package.json` | 3.10.5 → 3.11.0 |
1531
+
1532
+ ### Ship commands (both 3.10.5 + 3.11.0 in a single push)
1533
+
1534
+ Commits landed in the VM:
1535
+ - `41d4862` — v3.10.5 (AI Copilot polyline + bearing / housing / T-slot / U-bracket templates)
1536
+ - HEAD (pending commit) — v3.11.0 (AI Engineering Analyst v1)
1537
+
1538
+ Push + publish in one combined command (lock-file prefix handles the VM-generated `.git/*.lock` cruft):
1539
+ ```bash
1540
+ rm -f ~/cyclecad/.git/HEAD.lock ~/cyclecad/.git/index.lock && \
1541
+ cd ~/cyclecad && \
1542
+ git push origin main && \
1543
+ npm publish
1544
+ ```
1545
+
1546
+ If the 3.10.5 commit was also pending as of this handoff, `git push` covers both in one shot. The `npm publish` publishes 3.11.0 (latest version in `package.json`). 3.10.5 is not separately published to npm since 3.11.0 supersedes it — users bumping from 3.10.4 get both feature sets at once.
1547
+
1548
+ ### Pending after this session
1549
+ - #11 AI Engineering Analyst v2 — gears (AGMA bending + pitting), shafts (Goodman/Soderberg), bearings (L10), welds (throat stress)
1550
+ - #12 AI Engineering Analyst — RAG citations via `@xenova/transformers` MiniLM-L6-v2 + IndexedDB + "Open Document" footnote UI
1551
+ - All other pending tasks from session 2 handoff (#15-24)