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.

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.4.1

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.4.1
File Size Uploaded Provenance Actions
pyktane-0.4.1.tar.gz 212.6 kB With provenance Details for pyktane-0.4.1.tar.gz

Built distribution (wheel)

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

Total release size: 276.4 kB

Release files / pyktane-0.4.1.tar.gz

Download URL pyktane-0.4.1.tar.gz
Size 212.6 kB
Tags Source
SHA-256 checksum
How to use checksums
eba489c4c8243cbbbc6ae57b07c2f553641ed70696d442427cd7d7546a8a58f3
BLAKE2b-256 checksum
How to use checksums
4636b0579df3c9c1ec291ffbd0a8a126e503b59a3a2bad33edeee3257c2891d3
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.4.1-py3-none-any.whl

Download URL pyktane-0.4.1-py3-none-any.whl
Size 63.8 kB
Tags Python 3
SHA-256 checksum
How to use checksums
7d06343be59c4375945244a1d35f5a6a18d084d3ea3f50f5d5839a2f1ae32992
BLAKE2b-256 checksum
How to use checksums
09700b21ccad8d2e52b48f00a212029fd014d2e981cb337cf252c0900ebbe77b
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.4.1

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.4.1.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