twisty
A partially-observable twisty puzzle environment exposed as MCP tools.
The cube is fixed in space. From any viewpoint you see exactly 3 of 6 faces — the other 3 are hidden. Rotate the camera to reveal new faces, apply moves to solve, and try to minimize total steps.
Quick start
Claude Code:
claude mcp add --transport stdio twisty -- uvx twisty
Codex CLI:
codex mcp add twisty -- uvx twisty
Claude Desktop / Cursor / VS Code — add to your MCP config:
{
"mcpServers": {
"twisty": {
"type": "stdio",
"command": "uvx",
"args": ["twisty"]
}
}
}
Or commit .mcp.json to your repo for team sharing — Claude Code will auto-detect it.
How it works
This is a Partially Observable Markov Decision Process (POMDP). The agent interacts with a standard 3x3 cube through a constrained observation model:
- Fixed cube — the cube doesn't rotate; R always turns the Right face clockwise
- 8 viewpoints — 4 top-ring and 4 bottom-ring camera positions, each revealing 3 faces
- Partial observability — at any moment, 3 faces are visible and 3 are hidden
- Cost model — face turns cost 1 move step, camera rotations cost 1 inspection step
- Goal — solve the cube while minimizing total steps (moves + inspections)
A typical session: scramble() → look() → plan → move() / rotate_view() → repeat until is_solved() returns true.
Tools
| Tool | Description | Cost |
|---|---|---|
scramble(num_moves) |
Scramble with n random moves (default 20) |
— |
look() |
Read the current 3-face view | Free |
rotate_view(direction) |
Orbit camera: left, right, up, down | 1 inspection |
move(notation) |
Apply a face turn: R, U', F2, L, D', B2, etc. | 1 move |
is_solved() |
Check if the cube is solved | Free |
get_history() |
Moves applied since last scramble | Free |
get_stats() |
Moves, inspections, total steps, solved status | Free |
reset() |
Reset to solved state | — |
What the model sees
Each tool call returns a net render of the cube — visible faces in color, hidden faces hatched out:
| Front-Right-Top | Front-Left-Top | Front-Right-Bottom |
|---|---|---|
| Sees F, R, U | Sees F, L, U | Sees F, R, D |
Live viewer
A browser-based 3D viewer launches automatically at localhost:4321 when the server starts. It shows:
- Animated cube state via cubing.js TwistyPlayer
- Camera synced to the agent's current viewpoint
- Viewpoint net highlighting visible faces
- Move and inspection counters
- Tool call history
- Picture-in-Picture mode for watching while the agent works in another window
Development
git clone https://github.com/tejadhith/cube.git
cd cube
uv sync
uv run cube-server
Built with
Metadata
Release files for twisty 0.1.6
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| twisty-0.1.6.tar.gz | 249.3 kB | Without provenance | Details for twisty-0.1.6.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| twisty-0.1.6-py3-none-any.whl | Python 3 | none | any | Details for twisty-0.1.6-py3-none-any.whl |
Total release size: 500.4 kB
Release files / twisty-0.1.6.tar.gz
| Download URL | twisty-0.1.6.tar.gz |
|---|---|
| Size | 249.3 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
d19ee51e8b603ba9eff095d2c1a30abd6b6ad5472575495fb90c31438862b9e1
|
|
BLAKE2b-256 checksum How to use checksums |
41166d8d71a0344532ac322e77e9fa83e13459bb1e46e07eec3683a596185c7d
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.13.9
|
Release files / twisty-0.1.6-py3-none-any.whl
| Download URL | twisty-0.1.6-py3-none-any.whl |
|---|---|
| Size | 251.1 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
7f974d8f8e00e545c324af1ca8b2396be935abcd389af4f7bbf0f800467b1b1a
|
|
BLAKE2b-256 checksum How to use checksums |
2e9c59cce0523421aab568a1b8bf40b8b933f281d9fcef8b61e406bc071c16a7
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.13.9
|
Security for twisty 0.1.6
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.