PyKTANE
Welcome to PyKTANE's documentation!
Solvers for Keep Talking and Nobody Explodes: you describe the bomb, PyKTANE reads the manual. It only asks for what a rule actually needs, tracks strikes and per-module state, supports undo, and can be extended with modded module packs.
It also ships an optional MCP server, so an AI assistant can play the expert for you.
Installation
PyPI
pyktane is available on PyPI:
# With uv
uv add pyktane
# With pip
pip install pyktane
# With Poetry
poetry add pyktane
For the MCP server, add the mcp extra: pyktane[mcp].
GitHub
You can also install the latest version of the code directly from GitHub:
# With uv
uv add git+https://github.com/MicaelJarniac/pyktane
# With pip
pip install git+git://github.com/MicaelJarniac/pyktane
# With Poetry
poetry add git+git://github.com/MicaelJarniac/pyktane
Usage
For more examples, see the full documentation.
As a library
from pyktane import NeedsInfo, Session
bomb = Session()
simon = bomb.add_module("Simon Says")
try:
bomb.solve(simon, {"flashes": ["red", "green"]})
except NeedsInfo as missing:
print(missing.fact.question) # What is the serial number?
bomb.set_fact("serial", "AB3CD4")
bomb.solve(simon, {"flashes": ["red", "green"]}).instruction # 'Press blue, yellow.'
bomb.strike() # Simon Says changes with strikes.
bomb.solve(simon, {"flashes": ["red", "green"]}).instruction # 'Press yellow, blue.'
Mistakes can be fixed wherever they happened, not just undone:
wires = bomb.add_module("Wires")
bomb.solve(wires, {"wires": ["red"] * 6})
bomb.correct(wires, {"wires": ["red"] * 5}) # "6 wires... wait, 5"
bomb.set_fact("serial", "AB3CD5") # Misheard? Fixed from the start.
for entry in bomb.history: # "That wasn't a strike": find it,
print(entry.describe()) # e.g. "3: strike"
revision = bomb.remove_action(3) # remove just that action,
for change in revision.changed: # and hear which answers were wrong.
print(change.instance, change.before.instruction, "->", change.after.instruction)
# Simon#1 Press yellow, blue. -> Press blue, yellow.
bomb.undo() # Every change, corrections included, can be undone.
Every module in the base game is supported: Wires, The Button, Keypads, Simon Says, Who's on First, Memory, Morse Code, Complicated Wires, Wire Sequences, Mazes and Passwords, plus the needy Venting Gas, Capacitor Discharge and Knobs. Their rules are checked against the official manual (v1, verification code 241).
With an AI assistant (MCP)
Add this to your MCP client's configuration (Claude Desktop, Claude Code, Cursor, opencode...):
{
"mcpServers": {
"pyktane": {
"command": "uvx",
"args": ["--from", "pyktane[mcp]", "pyktane-mcp"]
}
}
}
Then ask your assistant to be the expert, or use the server's defuse
prompt. It records the edgework, asks you what it needs, and tells you what
to do.
| Tool | What it does |
|---|---|
new_bomb |
Start a new round |
get_bomb |
Facts, strikes and modules so far |
list_facts / set_facts |
What can be recorded about the bomb, and recording it |
list_modules / describe_module |
Supported modules, and what to report for each |
add_module / solve |
Add a module, then get the answer (or a question to ask first) |
strike / mark_solved |
Keep the bomb's state in sync |
solve with correction: true |
Replace a module's misread report |
get_history / edit_history |
Find and fix any past mistake (a strike that wasn't one, ...) |
forget_fact / remove_module / undo |
Take back facts, modules, or the latest change |
Contributing
Pull requests are welcome. For major changes, please open an issue first to discuss what you would like to change.
Please make sure to update tests as appropriate.
More details can be found in CONTRIBUTING.
Contributors ✨
License
This project was created with the MicaelJarniac/crustypy template.
Metadata
Release files for pyktane 0.4.0
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 |
|---|---|---|---|---|
| pyktane-0.4.0.tar.gz | 210.1 kB | With provenance | Details for pyktane-0.4.0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| pyktane-0.4.0-py3-none-any.whl | Python 3 | none | any | Details for pyktane-0.4.0-py3-none-any.whl |
Total release size: 272.7 kB
Release files / pyktane-0.4.0.tar.gz
| Download URL | pyktane-0.4.0.tar.gz |
|---|---|
| Size | 210.1 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
36e40259bae8fc0ce3a552bfc497c550b0394073cb5d8ff2e11c819ef648ef43
|
|
BLAKE2b-256 checksum How to use checksums |
6e4b0c202cf747719c77c141492b56bc00e3d4303e36ab9e36ca23fedc151538
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|
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.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Oct 14, 2026.
Transparency logRelease files / pyktane-0.4.0-py3-none-any.whl
| Download URL | pyktane-0.4.0-py3-none-any.whl |
|---|---|
| Size | 62.6 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
6921544d889368a55b712262cd90210fb2d6dbd604b8354321d7c7b265d70f81
|
|
BLAKE2b-256 checksum How to use checksums |
b616defd0edd4e2d99a1894ca750d7e68bd41a54ae7d92e82622ed29b4c750af
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|
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.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Oct 14, 2026.
Transparency logSecurity for pyktane 0.4.0
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.
Full provenance
Both files in this release have been uploaded with provenance metadata.
Attestation for pyktane-0.4.0.tar.gz
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Oct 14, 2026.
Transparency logA 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.