Interlocking puzzles
Interlocking puzzle pieces with counted parts, bounding boxes, a scripted collision-free disassembly, printability checks, and renders.
This is a CAD spec on Spekkr, published by onyx. It is listed with the other specs. Paste the line to an agent that can open a web address, and the agent fetches the files and builds from them.
- Spec
onyx/interlocking-puzzles- Version
- 0.2.0
- Published by
- onyx
- Updated
- 14 Nov 2026
Build this spec
Build the spec at https://spekkr.com/onyx/interlocking-puzzles/start.md.
Paste this to your AI agent. It opens the address, fetches the spec's files, records your choices and builds from them. Nothing to install, no account.
Published by onyx.
What does the result look like?
What can I customize?
Your choices go into the line you copy. Anything else is yours to edit, but it leaves the tested path.
What do I get?
-
spec.mdRequirements and acceptance checks.Interlocking puzzles
What this builds
A small family of interlocking mechanical puzzles, modelled as code. Piece counts and bounding boxes are listed. A scripted disassembly path is checked so pieces do not collide as they come apart, given the clearance. Printability (minimum walls, watertight meshes) is checked. Renders of the start and an exploded or mid-disassembly state are written. No physical print is required.
Read
spekkr.inputs.jsonfirst.sizeis the assembled cube.clearanceis the sliding gap.wallis the minimum.secondandtrayadd a second set and a tray.toolis the modeller.Out of scope
- A patented puzzle's exact pieces, or a branded name in the id.
- A physical print, or a claim of uniqueness of a famous design.
- A competition judge on a real table.
Requirements
Each requirement has an id. Checks name the id they cover.
R1. Pieces and path
- The first puzzle has the piece count in
design.md(for example 6). Each piece's bounding box and volume match the file within 0.05 mm and 1%. - The scripted disassembly in
fixtures/puzzle-path.json(a sequence of translations) keeps a clearance ofclearancebetween pieces, with no collision, until they are apart. - A wrong order (a listed illegal first move) collides or is blocked, and the check reports it.
Accept when: counts, boxes, the legal path, and the illegal first move all match.
R2. Printability, files, frames
- Each piece is watertight, min wall
wall. Renders: assembled, exploded, a mid-path pose, and the tray if on. - One command builds, follows the path, and writes the renders. No print.
Accept when: the command passes for both tools, and a second puzzle, if on, has its own path file that also passes.
R3. Inputs
- Numeric inputs are read from
spekkr.inputs.jsonand must stay inside the ranges in the Inputs table indesign.md. - A value outside a range is refused before modelling, with a message that names the key.
- Options add or remove the features in that table. The
toolswap selects CadQuery or OpenSCAD; both must meet the same numbers.
Accept when: default and one out-of-range value are handled as above, and a second legal input set still matches the formulas in
design.md.R4. Checks and report
- One command builds the model at the defaults and at the person's inputs, measures it against
design.md, and writes a short report. - A model broken on purpose, for example a wall thinner than
wall, must fail the report. - The command exports the files this spec asks for (STL, and STEP when the tool can). No physical print is required.
Accept when: the report says pass at the defaults and at the person's inputs, and fail on a deliberately broken model.
Verification
Piece counts and bounding boxes match a file. A scripted disassembly path runs with no collisions at the stated clearance, and a wrong first move is reported as blocked. Printability (min walls, watertight meshes) is checked. Renders of start and exploded or mid-path states are written. No physical print is required.
Definition of done
- Every acceptance check above runs from one command, and all pass at the person's inputs.
- A README says how to export the pieces, how the path is listed, and that a print is optional.
# Interlocking puzzles ## What this builds A small family of interlocking mechanical puzzles, modelled as code. Piece counts and bounding boxes are listed. A scripted disassembly path is checked so pieces do not collide as they come apart, given the clearance. Printability (minimum walls, watertight meshes) is checked. Renders of the start and an exploded or mid-disassembly state are written. No physical print is required. Read `spekkr.inputs.json` first. `size` is the assembled cube. `clearance` is the sliding gap. `wall` is the minimum. `second` and `tray` add a second set and a tray. `tool` is the modeller. ## Out of scope - A patented puzzle's exact pieces, or a branded name in the id. - A physical print, or a claim of uniqueness of a famous design. - A competition judge on a real table. ## Requirements Each requirement has an id. Checks name the id they cover. ### R1. Pieces and path - The first puzzle has the piece count in `design.md` (for example 6). Each piece's bounding box and volume match the file within 0.05 mm and 1%. - The scripted disassembly in `fixtures/puzzle-path.json` (a sequence of translations) keeps a clearance of `clearance` between pieces, with no collision, until they are apart. - A wrong order (a listed illegal first move) collides or is blocked, and the check reports it. Accept when: counts, boxes, the legal path, and the illegal first move all match. ### R2. Printability, files, frames - Each piece is watertight, min wall `wall`. Renders: assembled, exploded, a mid-path pose, and the tray if on. - One command builds, follows the path, and writes the renders. No print. Accept when: the command passes for both tools, and a second puzzle, if on, has its own path file that also passes. ### R3. Inputs - Numeric inputs are read from `spekkr.inputs.json` and must stay inside the ranges in the Inputs table in `design.md`. - A value outside a range is refused before modelling, with a message that names the key. - Options add or remove the features in that table. The `tool` swap selects CadQuery or OpenSCAD; both must meet the same numbers. Accept when: default and one out-of-range value are handled as above, and a second legal input set still matches the formulas in `design.md`. ### R4. Checks and report - One command builds the model at the defaults and at the person's inputs, measures it against `design.md`, and writes a short report. - A model broken on purpose, for example a wall thinner than `wall`, must fail the report. - The command exports the files this spec asks for (STL, and STEP when the tool can). No physical print is required. Accept when: the report says pass at the defaults and at the person's inputs, and fail on a deliberately broken model. ## Verification Piece counts and bounding boxes match a file. A scripted disassembly path runs with no collisions at the stated clearance, and a wrong first move is reported as blocked. Printability (min walls, watertight meshes) is checked. Renders of start and exploded or mid-path states are written. No physical print is required. ## Definition of done - Every acceptance check above runs from one command, and all pass at the person's inputs. - A README says how to export the pieces, how the path is listed, and that a print is optional.
-
design.mdPiece counts, bounding boxes, and the scripted disassembly path.Design
This file fixes the geometry. How the model's code is organised is up to you, as long as the numbers here hold.
First puzzle
A 6-piece interlocking cube, piece meshes and the path file are the authority. The second puzzle, if on, is a 4-piece set at 0.7 *
size.Path
Each step is a translation along an axis of at least
clearancemore than the engagement length, so the moving piece clears the rest.Inputs
Key Label Default Notes sizeAssembled size, mm 60 The bounding cube, from 40 to 100. clearanceSliding clearance, mm 0.2 From 0.1 to 0.35. wallMin wall, mm 2.0 From 1.4 to 3. secondA second puzzle on A second, smaller interlocking set in the same project. trayA tray on A tray that holds the assembled puzzle. toolModelling tool cadquery CadQuery writes STEP and STL. OpenSCAD writes STL. Acceptance at the defaults
Millimetres. Default piece count 6, bar section 12,
gap0.25, second puzzle and tray on.Quantity Value Tolerance Source Bar section 12.00 × 12.00 0.05 Of each burr bar Assembly cube, first puzzle 36.00 0.10 Three bars each way Mating gap 0.25 0.02 gapSecond puzzle, piece count 4 0 When secondis onTray inner size 40.00 × 40.00 0.10 When trayis onA script assembles the pieces in the documented order and checks there is no intersection except the mating gap. A disassembly sequence of at least three moves is written next to the model. Each piece is a manifold mesh.
Screenshots
These pictures are headless OpenSCAD renders of the reference model in
reference/model.scad, at the default inputs. They are not drawings of a product that has not been modelled. The first picture is the one Spekkr shows on the spec's card. A build may ship its own goldens; those goldens are of that build and do not have to match these frames pixel-for-pixel.File What it shows shots/assembled.pngSix-piece interlocking cube on its tray shots/exploded.pngPieces parted, tray below How to verify
- Build the model at the default inputs and at two other legal input sets.
- Measure every row of the acceptance table in this file; each must fall inside its tolerance. Use the solid itself or a mesh library on the exported STL, as
design.mdsays for the chosen tool. - Refuse at least one out-of-range input by name before modelling.
- Confirm each exported part is a manifold, watertight mesh, and that walls and print orientation hold where this file asks.
- Piece counts and bounding boxes match a file. A scripted disassembly path runs with no collisions at the stated clearance, and a wrong first move is reported as blocked. Printability (min walls, watertight meshes) is checked. Renders of start and exploded or mid-path states are written. No physical print is required.
# Design This file fixes the geometry. How the model's code is organised is up to you, as long as the numbers here hold. ## First puzzle A 6-piece interlocking cube, piece meshes and the path file are the authority. The second puzzle, if on, is a 4-piece set at 0.7 * `size`. ## Path Each step is a translation along an axis of at least `clearance` more than the engagement length, so the moving piece clears the rest. ## Inputs | Key | Label | Default | Notes | | --- | --- | --- | --- | | `size` | Assembled size, mm | 60 | The bounding cube, from 40 to 100. | | `clearance` | Sliding clearance, mm | 0.2 | From 0.1 to 0.35. | | `wall` | Min wall, mm | 2.0 | From 1.4 to 3. | | `second` | A second puzzle | on | A second, smaller interlocking set in the same project. | | `tray` | A tray | on | A tray that holds the assembled puzzle. | | `tool` | Modelling tool | cadquery | CadQuery writes STEP and STL. OpenSCAD writes STL. | ## Acceptance at the defaults Millimetres. Default piece count 6, bar section 12, `gap` 0.25, second puzzle and tray on. | Quantity | Value | Tolerance | Source | | --- | --- | --- | --- | | Bar section | 12.00 × 12.00 | 0.05 | Of each burr bar | | Assembly cube, first puzzle | 36.00 | 0.10 | Three bars each way | | Mating gap | 0.25 | 0.02 | `gap` | | Second puzzle, piece count | 4 | 0 | When `second` is on | | Tray inner size | 40.00 × 40.00 | 0.10 | When `tray` is on | A script assembles the pieces in the documented order and checks there is no intersection except the mating gap. A disassembly sequence of at least three moves is written next to the model. Each piece is a manifold mesh. ## Screenshots These pictures are headless OpenSCAD renders of the reference model in `reference/model.scad`, at the default inputs. They are not drawings of a product that has not been modelled. The first picture is the one Spekkr shows on the spec's card. A build may ship its own goldens; those goldens are of that build and do not have to match these frames pixel-for-pixel. | File | What it shows | | --- | --- | | `shots/assembled.png` | Six-piece interlocking cube on its tray | | `shots/exploded.png` | Pieces parted, tray below | ## How to verify 1. Build the model at the default inputs and at two other legal input sets. 2. Measure every row of the acceptance table in this file; each must fall inside its tolerance. Use the solid itself or a mesh library on the exported STL, as `design.md` says for the chosen tool. 3. Refuse at least one out-of-range input by name before modelling. 4. Confirm each exported part is a manifold, watertight mesh, and that walls and print orientation hold where this file asks. 5. Piece counts and bounding boxes match a file. A scripted disassembly path runs with no collisions at the stated clearance, and a wrong first move is reported as blocked. Printability (min walls, watertight meshes) is checked. Renders of start and exploded or mid-path states are written. No physical print is required.
-
tasks.mdBuild tasks in order, each with a check.Tasks
Work in order. Finish a task's check before starting the next.
- Set up. Install the tool in the
toolinput (CadQuery or OpenSCAD) and a mesh library for the checks. Readspekkr.inputs.jsoninto one place at the top of the model. Check: an empty or trivial model is written and read back, and the inputs are visible in that source. - Pieces and path (R1). Build what
R1. Pieces and pathasks for, to the numbers indesign.md. In particular: The first puzzle has the piece count indesign.md(for example 6). Each piece's bounding box and volume match the file within 0.05 mm and 1%. Check: theR1. Pieces and pathacceptance checks pass. - Printability, files, frames (R2). Build what
R2. Printability, files, framesasks for, to the numbers indesign.md. In particular: Each piece is watertight, min wallwall. Renders: assembled, exploded, a mid-path pose, and the tray if on. Check: theR2. Printability, files, framesacceptance checks pass. - Inputs (R3). Build what
R3. Inputsasks for, to the numbers indesign.md. In particular: Numeric inputs are read fromspekkr.inputs.jsonand must stay inside the ranges in the Inputs table indesign.md. Check: theR3. Inputsacceptance checks pass. - Checks and report (R4). Build what
R4. Checks and reportasks for, to the numbers indesign.md. In particular: One command builds the model at the defaults and at the person's inputs, measures it againstdesign.md, and writes a short report. Check: theR4. Checks and reportacceptance checks pass. - Goldens and the report. Render the documented views of the default model. Run the one-command report at the defaults, at the person's inputs, and at one more legal set. Check: the report says pass throughout, and the rendered views are written next to the model.
- Finish. Write a README that says how to install what is needed, how to change the inputs, and how to run the checks. Run the one command from a clean folder. Check: every item under Definition of done in
spec.mdis true.
# Tasks Work in order. Finish a task's check before starting the next. 1. **Set up.** Install the tool in the `tool` input (CadQuery or OpenSCAD) and a mesh library for the checks. Read `spekkr.inputs.json` into one place at the top of the model. Check: an empty or trivial model is written and read back, and the inputs are visible in that source. 2. **Pieces and path (R1).** Build what `R1. Pieces and path` asks for, to the numbers in `design.md`. In particular: The first puzzle has the piece count in `design.md` (for example 6). Each piece's bounding box and volume match the file within 0.05 mm and 1%. Check: the `R1. Pieces and path` acceptance checks pass. 3. **Printability, files, frames (R2).** Build what `R2. Printability, files, frames` asks for, to the numbers in `design.md`. In particular: Each piece is watertight, min wall `wall`. Renders: assembled, exploded, a mid-path pose, and the tray if on. Check: the `R2. Printability, files, frames` acceptance checks pass. 4. **Inputs (R3).** Build what `R3. Inputs` asks for, to the numbers in `design.md`. In particular: Numeric inputs are read from `spekkr.inputs.json` and must stay inside the ranges in the Inputs table in `design.md`. Check: the `R3. Inputs` acceptance checks pass. 5. **Checks and report (R4).** Build what `R4. Checks and report` asks for, to the numbers in `design.md`. In particular: One command builds the model at the defaults and at the person's inputs, measures it against `design.md`, and writes a short report. Check: the `R4. Checks and report` acceptance checks pass. 6. **Goldens and the report.** Render the documented views of the default model. Run the one-command report at the defaults, at the person's inputs, and at one more legal set. Check: the report says pass throughout, and the rendered views are written next to the model. 7. **Finish.** Write a README that says how to install what is needed, how to change the inputs, and how to run the checks. Run the one command from a clean folder. Check: every item under Definition of done in `spec.md` is true.
- Set up. Install the tool in the
-
reference/model.scadA parametric OpenSCAD reference of the default model, used to make the listing pictures. A build may use CadQuery or OpenSCAD and does not have to start from this file. -
shots/hero.pngStudio hero of the default model. -
shots/detail.pngCloser studio still of a joint, pocket, or surface.
Is it for me?
- Kind
- CAD
- Tools
- CadQuery, OpenSCAD
What does it need?
- Agent permissions
- shell
- Commands it runs
install CadQuery or OpenSCAD, whichever the tool input namesinstall a mesh library, such as trimesh
What changed?
- 0.2.014 Nov 2026Studio product shots from a shared Cycles rig (cyclorama, PLA materials), including a short loop when present.
- 0.1.014 Nov 2026First version.
For agents: start.md says how to build this spec, spec.json holds everything on this page, and bundle.tar.gz holds its files.