MathSphere Nexus
An installation may open with a door: before anything else answers — before the gate, before any wizard — the person at the terminal types the installation's own password. Four decisions shape it:
1. The lock is voluntary, and the offer is made once. At setup, the person chooses: set a lock, or decline. A decline is recorded and the question is never asked again — no nagging on later runs. Declining is not disappearing, though: the lock stays findable from inside (in the prototype, the lock command is where it lives), for whenever the person changes their mind.
2. The offer states the honest trade before the choice. For you: nobody who sits down at the machine can open the installation. Against you: a lock you cannot open is a door you cannot pass — so the moment a password is set, the person also receives recovery keys (below); but if the password and the keys are both lost, there is no back door, for anyone. The house keeps no copy of anything. That price is stated on the offer screen, where the decision is actually made — not buried in a manual.
3. Recovery keys — five, one-time, replaceable. Setting the password mints five one-time recovery keys, shown exactly once; only their hashes are kept, and nobody can display them again. At the door, the password prompt also accepts a key: it opens once, is spent, and is receipted, and the program directs the person to set a new password while they are in. Inside, a keys command reports how many remain, and keys new mints a fresh set of five — a fresh set kills the old set, so a lost key cannot outlive its replacement, and minting asks the current password first, as proof. The pattern is the house's own: the Arbiter's vault carries five one-time recovery keys, and its replenishment is now on the Arbiter's list as well.
4. Every step explains itself. The door says how many tries you have and what a lockout means before you type anything; the menu says what each command does and what to type next; a near-miss — extra words after a command, unlock typed while already inside — receives pointed guidance instead of a bare refusal; and no instruction shows a bare placeholder word for a person to copy literally (the note command reads type the word note, then YOUR OWN words). Interrupting with Ctrl+C closes cleanly, and interrupting the offer itself records no choice at all. This wording was refined across the owner's own hands-on runs: the first version's presentation was, in his words, “a little confusing”; the guided version he ran next drew his verdict “allot better now” — a note he left in the prototype's own receipts — and that guided wording stands below unchanged, with the trade and the keys added around it.
The prototype implements exactly that, in one standard-library Python file (557 lines).
The first run makes the offer once. A yes goes to setup; a no writes the decline to the receipts and to the installation's state, and no later run ever raises the question again:
if ans in ("yes", "y"):
setup()
return True
if ans in ("no", "n"):
_save_declined()
receipt("lock_declined",
"start lock declined at setup; not asked again")
print("No lock. The door stays open, and you will")
print("not be asked again. If you ever change your mind,")
print("type lock inside — that is where it lives.")
return True
Interrupting the offer (Ctrl+C) returns without deciding: nothing is written, so the question is rightly asked again on the next run — an interruption is not a refusal.
Setting the lock stores a salt and a PBKDF2 hash (50,000 iterations); the password itself is never written anywhere. Changing the password asks the current one first, and the receipts record the change — not the passwords.
With a lock set, every run opens at the door. The receipts chain is verified before the first prompt — tampering is announced at the door, not discovered later. Three wrong tries and the door stays closed for that run; every refusal is receipted. The same prompt also accepts a recovery key:
spent = _check_recovery(pw)
if spent is not None:
num, set_no, left = spent
receipt("recovery_used",
f"set {set_no}, key {num} of {KEYS_PER_SET} — spent")
print("Door open.")
print(f"That was recovery key {num} of set {set_no} — it is")
print("spent now and will not work again.")
print(f"You have {left} of {KEYS_PER_SET} recovery keys left.")
Minting a set replaces the whole set — that single fact is what makes a lost key safe to replace:
def _issue_keys():
"""Mint a fresh set of five one-time recovery keys. Any previous set
dies here — a lost key must not outlive its replacement. Only the
hashes are kept; the plain keys are returned for one display."""
plain = [_gen_key() for _ in range(KEYS_PER_SET)]
state = _load_state()
set_no = int(state.get("recovery_set", 0)) + 1
state["recovery_set"] = set_no
state["recovery"] = []
for key in plain:
salt = secrets.token_hex(8)
state["recovery"].append(
{"salt": salt, "hash": _key_hash(key, salt), "used": False})
_write_state(state)
receipt("recovery_keys_issued", f"set {set_no}, five one-time keys")
return plain
A key carries about 70 bits of its own randomness, so each is kept as a salted fast hash; the human-chosen password, being low-entropy, keeps the slow PBKDF2 above. Spending a key flips its used flag in the same motion that opens the door — a spent key is checked against nothing and opens nothing:
def _check_recovery(typed):
"""If `typed` is a live recovery key: spend it and report
(key number, set number, keys left). Otherwise None."""
norm = typed.strip().upper()
if not norm.startswith("WK-"):
return None
state = _load_state()
for i, entry in enumerate(state.get("recovery", [])):
if entry["used"]:
continue
if hmac.compare_digest(_key_hash(norm, entry["salt"]), entry["hash"]):
entry["used"] = True
_write_state(state)
left = sum(1 for e in state["recovery"] if not e["used"])
return i + 1, int(state.get("recovery_set", 1)), left
return None
The keys survive a password change — the password's salt and hash are replaced in the state; the key set is untouched — and that, too, is one of the checks below.
Every act — the offer declined, the lock set, keys issued, a refusal, a key spent, a note, a password change, a re-lock — is appended to a hash-chained receipts log, the same chain discipline as every other build in this house. The receipts name acts and key numbers — never a password, never a key.
The prototype's test file drives it as a person at a terminal would, in temporary folders. Result on November 14, 2026: 26 checks, all passing — in a plain pipe and in a terminal window alike (the distinction matters: on a real terminal, a hidden password prompt reads the keyboard itself, and the harness was rebuilt to honor that rather than be fooled by its absence).
keys reports the count · keys new mints five fresh ones · the old set dies when a fresh set is madeThe dated terminal proof — the actual output of the test run on the owner's own machine, unedited — followed by its parse, and by the owner's own hands-on runs.
$ date Saturday, November 14, 2026 — 00:40 PST $ python3 test_lock_prototype.py PASS setup announces itself PASS door opens after setup password re-typed at the prompt PASS state file written PASS password never stored in plain text PASS three wrong tries lock the door PASS refusals are receipted PASS lockout is receipted PASS note is written and receipted PASS log reads the chain as OK PASS re-lock from inside works PASS password change succeeds PASS old password no longer opens PASS new password opens PASS tampered chain is reported at the door PASS declining is honored and receipted PASS a declined installation is never asked again PASS the lock can be turned on later from inside PASS after the late opt-in, the door asks PASS setup issues five recovery keys PASS the key set is stored as five unspent hashes PASS recovery keys are never stored in plain text PASS a recovery key opens the door and is spent PASS a spent key does not open again PASS keys reports the count and keys new mints five fresh ones PASS the old set dies when a fresh set is made PASS recovery keys survive a password change 26/26 checks passed
The owner's own runs (November 14, 2026). The same evening, the owner ran the prototype himself, both roads. On the voluntary road he answered the offer no — and the next two runs opened straight in, unasked:
Set a start lock? [yes/no]: no No lock. The door stays open, and you will not be asked again. If you ever change your mind, type lock inside — that is where it lives.
On the locked road he set the password, received his five keys, read the count back (keys — 5 of 5), minted a fresh set (keys new — The old set is dead), changed the password, re-locked from inside, and — testing the interruption that had once produced a raw traceback — pressed Ctrl+C at the door of a fresh run. The whole reply:
Password: Closed.
And the last road: on a later run he re-locked from inside and answered the door with a recovery key instead of the password. It opened, spent itself, and counted what remained — and his keys read-back agreed:
Password: Door open. That was recovery key 1 of set 2 — it is spent now and will not work again. You have 4 of 5 recovery keys left.
The parse — how each proved thing is used. To decline the lock, answer the one-time offer no: the decline is receipted, the door stays open, and no run ever asks again (declining is honored and receipted, a declined installation is never asked again). To take the lock later anyway, type lock inside: it walks through setting a password and issues the keys in the same sitting (the lock can be turned on later from inside, after the late opt-in, the door asks). To open the door, type the password; three wrong tries close it for that run, each refusal receipted (three wrong tries lock the door). To get in with a forgotten password, type a recovery key at the same prompt: it opens, spends itself, and reports how many remain (a recovery key opens the door and is spent; a spent key does not open again). To run low safely, type keys for the count and keys new — password as proof — for five fresh ones, the old set dying in the same motion (keys reports the count and keys new mints five fresh ones; the old set dies when a fresh set is made). To change the password, passwd asks the current one, then the new one twice — and the keys keep working across the change (password change succeeds; recovery keys survive a password change). To check the record itself, log reads the chain back and verifies it — and a record rewritten after the fact is announced at the door before anything is asked (log reads the chain as OK; tampered chain is reported at the door).
Receipts, hash-chained — every act above is receipted, and the chain is verified at the door. Standard library only — the prototype imports nothing outside Python's standard library. Asking before it acts — the room holds no destructive command; the two acts that change the lock itself, passwd and keys new, demand the current password as proof before they move, and the lock's whole offer is a question the person answers once. Demo discipline — this page is the documentation half; the test file is the live half; the owner's runs above are the third witness.
Honesty about scope: the prototype proves the door's shape — the voluntary offer, the honest trade, the keys and their replenishment — in miniature, with plain files. It is a door lock on the installation, not encryption of the machine's disk: it governs who may open the program, and makes no claim about someone reading raw files off the drive. The real build wires the same shape into Wizard Central Pro at Phase 6 (§6.7): the offer made by requirementswiz during setup, the check placed before the gate and any wizard, the keys living with the installation's own state. The terminal lock — guarding the terminal itself, carried by bashwiz — is a sibling mechanism, designed alongside this one and not part of this prototype.
A command is what you type. The name is what the project is.