Skip to main content

Discord

Badges
Build Nox semantic-release PyPI Read the Docs
Tests coverage pre-commit asv
Standards SemVer 2.0.0 Conventional Commits
Code uv Ruff Nox Checked with mypy
Repo GitHub issues GitHub stars GitHub license All Contributors Contributor Covenant

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.

Read the Docs

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. It works well in voice mode: describe modules the way you'd say them ("vertical wires", "a big button"), and when an answer depends on something it doesn't know yet, it tells you what's safe to do right away first.

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; mark_solved takes a module name when the defuser solved it alone
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

MIT

This project was created with the MicaelJarniac/crustypy template.

Metadata

Release files for pyktane 0.5.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for pyktane 0.5.0
File Size Uploaded Provenance Actions
pyktane-0.5.0.tar.gz 219.7 kB With provenance Details for pyktane-0.5.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for pyktane 0.5.0
File Interpreter ABI Platform Actions
pyktane-0.5.0-py3-none-any.whl Python 3 none any Details for pyktane-0.5.0-py3-none-any.whl

Total release size: 289.1 kB

Release files / pyktane-0.5.0.tar.gz

Download URL pyktane-0.5.0.tar.gz
Size 219.7 kB
Tags Source
SHA-256 checksum
How to use checksums
573a09912933177aa9fe38417618d8e10a7bfc27759e968afe21c41c1fd387e2
BLAKE2b-256 checksum
How to use checksums
767f4e6ee93e21e4549e44fdabcd787ca03a72791070bd393df817d190638f6a
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 log

Release files / pyktane-0.5.0-py3-none-any.whl

Download URL pyktane-0.5.0-py3-none-any.whl
Size 69.3 kB
Tags Python 3
SHA-256 checksum
How to use checksums
314b35257a42dd9bbf1bdcd90ae3106d3434b60f930876c8bff4347155ca249d
BLAKE2b-256 checksum
How to use checksums
4899e56344ad1c3b8c4e8619435817e0e937570bd016d07f59402e870158acc2
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 log

Security for pyktane 0.5.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.

Select from 2 files

Attestation for pyktane-0.5.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 log

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.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page