Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
48 changes: 48 additions & 0 deletions docs/learnings/saffron-gate-measured-2026-09-07.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
# The Saffron gate, measured — 2026-09-07

Lane 33 walked into the Route 6 gate house's guard eight times from a 2-badge save and the Forger had no
class for the sentence. `scripts/probe_saffron_gate.py` boots a list of banked saves, walks each toward
Saffron (map 10) with no model seated, and records the refusal, the bag before and after, and what the guard
says when spoken to. Rows: `data/replay_arcs/logs/probe_saffron_gate{,2,3}.jsonl`.

## What the saves said

| save | badges | FRESH WATER in bag | gate | the guard, spoken to |
|---|---|---|---|---|
| captain_done | 2 | no | refused at 73 (3,2) | "I'm on guard duty. Gee, I'm thirsty, though! Oh wait there, the road's closed." |
| leg_5 | 3 | no | refused at 73 (3,2) | same |
| celadon | 3 | no | refused at 73 (3,2) | same |
| b5_celadon | 4 | yes | passed | "Hi, thanks for the cool drinks!" (70 (1,3)) |
| b5_lavender | 4 | yes | passed | same |
| BADGE5 | 5 | yes | passed | |
| fly_won-27 | 6 | no (tossed earlier: 6 `supervisor.tossed` rows in the sink) | passed | |

The refused step prints the window's first clause, `I on guard duty. Gee, I thi` (the decoder drops
apostrophes and the box cuts at the row). A guard in another gate house (map 126) was heard earlier saying
"I'm thirsty! I want something to drink!" (body_engaged rows in the sink). Passing consumes nothing on the
saves that pass; the clear happened on their lineage before the earliest of them was banked, and the guard
names it himself: drinks.

## What is and is not established

- **Established:** the gate class, both of its sentences, and the sentence of a cleared guard. The lineage
that passes is the lineage that acquired FRESH WATER; the guard on that lineage thanks the player for
drinks. `badge4` (4 badges, no FRESH WATER, different lineage) never reached a gate in this probe, so the
badge count is not shown to matter either way.
- **Not established:** the act itself (handing the drink over) was never performed by a run of ours — no
measured shop sells FRESH WATER (`quartermaster.SHOPS` are marts) and the sink has no hand-over row for it.
The deposit test (bank the water, re-walk) did not run: `pc_store_item` refused on b5_celadon's Center.
`clears_with` therefore says what was measured and no more.

## Added

`thirsty_guard`, pattern `on guard duty|I thirsty`, in pokemon-kafka `GATE_CLASSES` and empirical-evidence
`GATES`. The corpus's gate-text rows for this sentence exist only after a rebuild; the next `convert_telemetry`
run turns the 15 `supervisor.gate_text` rows on maps 70/73 into training rows with this class.

## Next

1. A drink-handing leg: teach the rig the vending machine (measured, like the marts) or find the b5
lineage's FRESH WATER source in its run logs; then hand it to a refused guard and record the bag and the
sentence change. That completes the clear.
2. Rebuild the corpus and regate the Forger with the new class in it.
5 changes: 5 additions & 0 deletions scripts/expedition_crew.py
Original file line number Diff line number Diff line change
Expand Up @@ -102,6 +102,11 @@
("nothing_to_cut", r"isn't anything to CUT"),
("badge_gate", r"only if you have the \w+BADGE"),
("stale_window_text", r"hope to see you again"),
# Measured 2026-09-07 (probe_saffron_gate): refused on every 2- and 3-badge save with "I'm on guard
# duty. Gee, I'm thirsty, though! Oh wait there, the road's closed."; open on every save of the
# lineage that holds FRESH WATER, whose guard says "Hi, thanks for the cool drinks!". The window
# decoder drops apostrophes, so the pattern is the words that survive it.
("thirsty_guard", r"on guard duty|I thirsty"),
)
_GATE_PATTERNS = tuple((cls, re.compile(pat)) for cls, pat in GATE_CLASSES)
# Reads that are not the body's words (the START menu on a ball tile, the text pinned after a
Expand Down
88 changes: 88 additions & 0 deletions scripts/probe_saffron_gate.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,88 @@
"""Measure the Saffron-side gate (map 70, the Route 6 gate house) across banked saves.

Lane 33 (2026-09-07) walked into its guard eight times from a 2-badge save: "I on guard duty. Gee,
I thi..." and a refused step. The sentence is measured; what clears it is not. This probe boots
each named baton, walks toward Saffron (map 10) through that gate with no model seated, and
records: badges and bag before, whether the gate passed, every refusal sentence the game
printed, the bag after (an item consumed is a clear), and what the guard says when talked to.
The clear is whatever differs between the last refused save and the first passed one.

uv run python scripts/probe_saffron_gate.py captain_done badge3 badge4 b5_celadon BADGE5
"""

import json
import sys
from pathlib import Path

sys.path.insert(0, str(Path(__file__).parent))

from expedition_rig import Rig # noqa: E402
from supervisor import LegRunner # noqa: E402

GATE_HOUSE = 70
SAFFRON = 10
VERMILION = 5
NO_CONSULT = lambda tier, facts, menu: (None, "consults disabled", "none") # noqa: E731


def probe(name: str, deposit: str | None = None) -> dict:
rig = Rig(f"data/local_runs/roster-bench/{name}.state", live_label=f"probe saffron gate — {name}")
out = {"baton": name, "start": list(rig.pos()), "badges": f"0b{rig.badges():08b}", "bag_before": rig.bag_named()}
quiet = lambda *a: None # noqa: E731
# Capture what every talk returned: _what_it_said reads a buffer the talk has already consumed.
talks: list[str] = []
real_talk = rig.talk
rig.talk = lambda face: talks.append(real_talk(face)) or talks[-1] # type: ignore[method-assign]
if deposit:
# Bank the named item at the nearest Center's PC first: if the gate still passes without it
# in the bag, the clear is state on the lineage, not the item in hand.
here = rig.pos()[0]
centers = [w[2] for w in rig.truth["maps"].get(str(here), {}).get("warps", []) if rig.center_counter(w[2])]
if centers:
LegRunner(rig, goal=centers[0], budget_s=240, consult=NO_CONSULT, log=quiet).run()
out["deposited"] = bool(rig.pc_store_item(deposit)) if rig.center_pc(rig.pos()[0]) else "no-center"
out["bag_after_deposit"] = rig.bag_named()
if rig.pos()[0] not in (VERMILION, 19, GATE_HOUSE):
# Approach from Vermilion so every save meets the same gate; a save that cannot get
# there walks at Saffron from where it stands and meets whichever gate house is on the way.
first = LegRunner(rig, goal=VERMILION, budget_s=420, consult=NO_CONSULT, log=quiet).run()
out["to_vermilion"] = first.get("outcome")
runner = LegRunner(rig, goal=SAFFRON, budget_s=360, consult=NO_CONSULT, log=quiet)
result = runner.run()
out["outcome"] = result.get("outcome")
out["pos"] = list(rig.pos())
out["refusals"] = result.get("gates") or {}
out["passed"] = rig.pos()[0] == SAFFRON or result.get("ok", False)
out["bag_after"] = rig.bag_named()
before = {n for n, _ in out["bag_before"]}
after = {n for n, _ in out["bag_after"]}
out["bag_lost"] = sorted(before - after)
out["bag_gained"] = sorted(after - before)
# What the guard says when spoken to: in the house the refusal left us in, or — after a pass —
# back in the Route 6 gate house so the open gate's guard is heard too.
if out["passed"]:
LegRunner(rig, goal=GATE_HOUSE, budget_s=240, consult=NO_CONSULT, log=quiet).run()
house = rig.pos()[0]
if house != SAFFRON:
heard = {}
for s in rig.truth["maps"].get(str(house), {}).get("sprites", []):
spot = (s["x"], s["y"])
if s.get("kind") in ("trainer", "npc") and runner._go_and_talk(spot):
heard[f"{house}:{spot}"] = talks[-1] if talks else ""
out["guard_says"] = heard
out["bag_after_talk"] = rig.bag_named()
rig.finish(outcome=f"probe saffron gate: {'passed' if out['passed'] else 'refused'}")
return out


if __name__ == "__main__":
args = sys.argv[1:]
deposit = None
if args and args[0] == "--deposit":
deposit, args = args[1], args[2:]
for baton in args:
try:
row = probe(baton, deposit)
except Exception as exc: # noqa: BLE001 — one bad baton must not end the sweep
row = {"baton": baton, "error": repr(exc)}
print(json.dumps(row), flush=True)
3 changes: 3 additions & 0 deletions tests/test_expedition_crew.py
Original file line number Diff line number Diff line change
Expand Up @@ -309,6 +309,9 @@ def test_gate_classes_are_the_corpus_builders_and_unknown_sentences_are_not_gate
assert crew.classify_gate("Excuse me! Wait up please!") == "route_gate_guard"
assert crew.classify_gate("You can pass only if you have the CASCADEBADGE!") == "badge_gate"
assert crew.classify_gate("We hope to see you again!") == "stale_window_text"
assert crew.classify_gate("I on guard duty. Gee, I thi") == "thirsty_guard" # the refused step's window
assert crew.classify_gate("I thirsty! I want something to drink!") == "thirsty_guard" # the guard, spoken to
assert crew.classify_gate("Hi, thanks for the cool drinks!") is None # the same guard once cleared
assert crew.classify_gate("I like shorts!") is None


Expand Down
Loading