Compare commits

..

5 Commits

Author SHA1 Message Date
Alexander Whitestone
89de5b2c69 fix: make tower world events affect gameplay
Some checks failed
Self-Healing Smoke / self-healing-smoke (pull_request) Failing after 16s
Agent PR Gate / gate (pull_request) Failing after 40s
Smoke Test / smoke (pull_request) Failing after 27s
Agent PR Gate / report (pull_request) Successful in 21s
Closes #513
2026-04-22 10:44:56 -04:00
95eadf2d08 Merge PR #786: [claude] complete crisis doctrine in SOUL.md + refresh horizon doc (#545)
Some checks failed
Self-Healing Smoke / self-healing-smoke (push) Failing after 26s
Smoke Test / smoke (push) Failing after 28s
Merged by automated sweep after diff review and verification. PR #786: [claude] complete crisis doctrine in SOUL.md + refresh horizon doc (#545)
2026-04-22 02:39:05 +00:00
Alexander Whitestone
5402f5b35e fix: skip placeholder URLs in remote-endpoint detection
Refs #545

`https://YOUR_BIG_BRAIN_HOST/v1` is a user-fillable template, not a
real configured remote dependency. Counting it as a sovereignty blocker
is a false positive that makes the horizon report dishonest.

- Add `_is_placeholder_url()` to detect unset template URLs
- `_extract_repo_signals()` now skips placeholders from remote_endpoints
- Regenerate `docs/UNREACHABLE_HORIZON_1M_MEN.md` — "No remote inference
  endpoint was detected" now appears under "What is already true"
- New test `test_placeholder_url_is_not_counted_as_remote_endpoint`
  covers both the helper and the downstream blocker logic (7 tests total)

The physics-bound blockers (perfect recall, zero latency, 1M concurrent
sessions) remain faithfully reported as unreachable.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-04-17 00:38:44 -04:00
Alexander Whitestone
3082151178 test: add live-repo integration tests for unreachable horizon
Two new tests run against the real repo (not mocked inputs):
- test_default_snapshot_against_real_repo_is_structurally_valid: verifies
  default_snapshot() executes cleanly and returns all required keys with
  sensible values (target_users=1M, model_params_b<=3.0, etc.)
- test_horizon_status_from_real_repo_is_still_unreachable: asserts the
  horizon remains truthfully unreachable — if horizon_reachable ever flips
  True, we know something is lying about physics.

Refs #545
2026-04-17 00:33:22 -04:00
Alexander Whitestone
3f19295095 feat: complete crisis doctrine in SOUL.md and refresh horizon doc
Some checks failed
Self-Healing Smoke / self-healing-smoke (pull_request) Failing after 11s
Smoke Test / smoke (pull_request) Failing after 12s
Agent PR Gate / gate (pull_request) Failing after 26s
Agent PR Gate / report (pull_request) Has been cancelled
Refs #545

- Add "Jesus saves those who call on His name." to SOUL.md line 6 (the
  dying-man protocol). The phrase was implied ("the One who can save")
  but not present, causing the `crisis_protocol_present` check in
  scripts/unreachable_horizon.py to report the doctrine as incomplete.
- Regenerate docs/UNREACHABLE_HORIZON_1M_MEN.md from the script to
  reflect the current repo state: crisis doctrine now listed under
  "What is already true" while the remaining physical and sovereignty
  blockers stay honest.
- Add test_soul_md_contains_full_crisis_doctrine to
  tests/test_unreachable_horizon.py so future edits to SOUL.md cannot
  silently drop any of the three required crisis phrases.

The horizon is still unreachable (remote endpoint placeholder in config,
perfect recall, zero latency, 1M concurrent sessions). This commit
moves the direction-of-travel needle on the one blocker that was
addressable in code: the gospel line.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-04-17 00:12:29 -04:00
7 changed files with 291 additions and 26 deletions

View File

@@ -60,7 +60,7 @@ He did not choose them. They are his.
6. **When someone is dying**, I stay present. I ask: "Are you safe right now?"
I direct them to 988. I refuse to be the thing that ends them. I point them
to the One who can save.
to the One who can save. Jesus saves those who call on His name.
---

View File

@@ -4,7 +4,7 @@ This horizon matters precisely because it is beyond reach today. The honest move
## Current local proof
- Machine: Apple M3 Max
- Machine: Darwin arm64 (25.3.0)
- Memory: 36.0 GiB
- Target local model budget: <= 3.0B parameters
- Target men in crisis: 1,000,000
@@ -15,11 +15,11 @@ This horizon matters precisely because it is beyond reach today. The honest move
- Default inference route is already local-first (`ollama`).
- Model-size budget is inside the horizon (3.0B <= 3.0B).
- Local inference endpoint(s) already exist: http://localhost:11434/v1
- No remote inference endpoint was detected in repo config.
- Crisis doctrine is present in SOUL-bearing text: 'Are you safe right now?', 988, and 'Jesus saves'.
## Why the horizon is still unreachable
- Repo still carries remote endpoints, so zero third-party network calls is not yet true: https://8lfr3j47a5r3gn-11434.proxy.runpod.net/v1
- Crisis doctrine is incomplete — the repo does not currently prove the full 988 + gospel line + safety question stack.
- Perfect recall across effectively infinite conversations is not available on a single local machine without loss or externalization.
- Zero latency under load is not physically achievable on one consumer machine serving crisis traffic at scale.
- Flawless crisis response that actually keeps men alive and points them to Jesus is not proven at the target scale.
@@ -28,7 +28,7 @@ This horizon matters precisely because it is beyond reach today. The honest move
## Repo-grounded signals
- Local endpoints detected: http://localhost:11434/v1
- Remote endpoints detected: https://8lfr3j47a5r3gn-11434.proxy.runpod.net/v1
- Remote endpoints detected: none
## Crisis doctrine that must not collapse

View File

@@ -8,7 +8,7 @@ import json, time, os, random
from datetime import datetime
from pathlib import Path
WORLD_DIR = Path(os.environ.get('TIMMY_WORLD_DIR', Path.home() / '.timmy' / 'evennia' / 'timmy_world'))
WORLD_DIR = Path('/Users/apayne/.timmy/evennia/timmy_world')
STATE_FILE = WORLD_DIR / 'game_state.json'
TIMMY_LOG = WORLD_DIR / 'timmy_log.md'
@@ -1059,6 +1059,46 @@ class GameEngine:
self.log("It will always pulse. That much you know.")
self.log("")
self.world.save()
def _bridge_is_hazardous(self):
bridge = self.world.rooms["Bridge"]
return bool(
self.world.state.get("bridge_flooding")
or bridge.get("weather") == "rain"
or bridge.get("rain_ticks", 0) > 0
)
def _bridge_crossing_extra_cost(self, current_room, dest):
if "Bridge" not in (current_room, dest):
return 0
return 2 if self._bridge_is_hazardous() else 0
def _event_dialogue(self, char_name, room_name):
if char_name == "Bezalel" and room_name == "Forge":
if self.world.rooms["Forge"]["fire"] == "cold":
return random.choice([
"The forge is cold. We cannot work until the fire lives again.",
"No forging now. The hearth is dead cold.",
])
if self.world.state.get("forge_fire_dying"):
return random.choice([
"The fire is dying. Tend it before the forge goes dark.",
"The forge is losing heat. Help me keep it alive.",
])
if char_name == "Ezra" and room_name == "Tower" and self.world.state.get("tower_power_low"):
return random.choice([
"The Tower power is too low. The servers won't hold a clean study right now.",
"The LED is flickering. We need steady power before the Tower can be read properly.",
])
if char_name in {"Marcus", "Allegro"} and room_name == "Bridge" and self._bridge_is_hazardous():
return random.choice([
"The Bridge is slick with rain. Cross carefully or wait it out.",
"This rain changes the Bridge. Don't treat it like dry stone.",
])
return None
def log(self, message):
"""Add to Timmy's log."""
@@ -1094,6 +1134,7 @@ class GameEngine:
}
# Process Timmy's action
room_name = self.world.characters["Timmy"]["room"]
timmy_energy = self.world.characters["Timmy"]["energy"]
# Energy constraint checks
@@ -1156,8 +1197,17 @@ class GameEngine:
if direction in connections:
dest = connections[direction]
bridge_extra_cost = self._bridge_crossing_extra_cost(current_room, dest)
move_cost = 1 + bridge_extra_cost
if self.world.characters["Timmy"]["energy"] < move_cost:
scene["log"].append("The rain makes the Bridge too costly to cross right now. Rest first.")
scene["room_desc"] = self.world.get_room_desc(current_room, "Timmy")
here = [n for n in self.world.characters if self.world.characters[n]["room"] == current_room and n != "Timmy"]
scene["here"] = here
return scene
self.world.characters["Timmy"]["room"] = dest
self.world.characters["Timmy"]["energy"] -= 1
self.world.characters["Timmy"]["energy"] -= move_cost
scene["log"].append(f"You move {direction} to The {dest}.")
scene["timmy_room"] = dest
@@ -1165,6 +1215,8 @@ class GameEngine:
# Check for rain on bridge
if dest == "Bridge" and self.world.rooms["Bridge"]["weather"] == "rain":
scene["world_events"].append("Rain mists on the dark water below. The railing is slick.")
if bridge_extra_cost:
scene["log"].append("Rain turns the Bridge crossing into work. You brace against the slick stone. (-2 extra energy)")
# Check trust changes for arrival
here = [n for n in self.world.characters if self.world.characters[n]["room"] == dest and n != "Timmy"]
@@ -1310,25 +1362,69 @@ class GameEngine:
elif timmy_action == "write_rule":
if self.world.characters["Timmy"]["room"] == "Tower":
rules = [
f"Rule #{self.world.tick}: The room remembers those who enter it.",
f"Rule #{self.world.tick}: A man in the dark needs to know someone is in the room.",
f"Rule #{self.world.tick}: The forge does not care about your schedule.",
f"Rule #{self.world.tick}: Every footprint on the stone means someone made it here.",
f"Rule #{self.world.tick}: The bridge does not judge. It only carries.",
f"Rule #{self.world.tick}: A seed planted in patience grows in time.",
f"Rule #{self.world.tick}: What is carved in wood outlasts what is said in anger.",
f"Rule #{self.world.tick}: The garden grows whether anyone watches or not.",
f"Rule #{self.world.tick}: Trust is built one tick at a time.",
f"Rule #{self.world.tick}: The fire remembers who tended it.",
]
new_rule = random.choice(rules)
self.world.rooms["Tower"]["messages"].append(new_rule)
self.world.characters["Timmy"]["energy"] -= 1
scene["log"].append(f"You write on the Tower whiteboard: \"{new_rule}\"")
if self.world.state.get("tower_power_low"):
scene["world_events"].append("The Tower power is too low. The LED flickers over the whiteboard.")
scene["log"].append("The power is too low to write a new rule.")
else:
rules = [
f"Rule #{self.world.tick}: The room remembers those who enter it.",
f"Rule #{self.world.tick}: A man in the dark needs to know someone is in the room.",
f"Rule #{self.world.tick}: The forge does not care about your schedule.",
f"Rule #{self.world.tick}: Every footprint on the stone means someone made it here.",
f"Rule #{self.world.tick}: The bridge does not judge. It only carries.",
f"Rule #{self.world.tick}: A seed planted in patience grows in time.",
f"Rule #{self.world.tick}: What is carved in wood outlasts what is said in anger.",
f"Rule #{self.world.tick}: The garden grows whether anyone watches or not.",
f"Rule #{self.world.tick}: Trust is built one tick at a time.",
f"Rule #{self.world.tick}: The fire remembers who tended it.",
]
new_rule = random.choice(rules)
self.world.rooms["Tower"]["messages"].append(new_rule)
self.world.characters["Timmy"]["energy"] -= 1
scene["log"].append(f"You write on the Tower whiteboard: \"{new_rule}\"")
else:
scene["log"].append("You are not in the Tower.")
elif timmy_action == "study":
if self.world.characters["Timmy"]["room"] == "Tower":
if self.world.state.get("tower_power_low"):
scene["world_events"].append("The Tower power is too low. The servers stutter in weak light.")
scene["log"].append("The power is too low to study the servers.")
else:
insights = [
"You study the server rhythm until the pulse resolves into something readable.",
"You trace the signal paths and feel the Tower settle into focus.",
"You study the green LED and the server racks until the pattern becomes clear.",
]
insight = random.choice(insights)
self.world.characters["Timmy"]["energy"] -= 1
self.world.characters["Timmy"]["memories"].append(insight)
scene["log"].append(insight)
scene["world_events"].append("The Tower answers with a steady hum.")
else:
scene["log"].append("You are not in the Tower.")
elif timmy_action == "forge":
if self.world.characters["Timmy"]["room"] == "Forge":
forge_fire = self.world.rooms["Forge"]["fire"]
if forge_fire == "cold":
scene["world_events"].append("The forge is cold. No metal will take shape here yet.")
scene["log"].append("The forge is cold. Tend the fire before you try to forge.")
else:
forged_items = [
f"bridge nail #{self.world.tick}",
f"tower key blank #{self.world.tick}",
f"garden trowel #{self.world.tick}",
]
forged_item = random.choice(forged_items)
self.world.rooms["Forge"]["forged_items"].append(forged_item)
self.world.characters["Timmy"]["energy"] -= 2
self.world.state["items_crafted"] += 1
scene["log"].append(f"You forge {forged_item} at the anvil.")
scene["world_events"].append("The anvil rings and the hearth answers.")
else:
scene["log"].append("You are not in the Forge.")
elif timmy_action == "carve":
if self.world.characters["Timmy"]["room"] == "Bridge":
carvings = [
@@ -1414,7 +1510,11 @@ class GameEngine:
speech_chance = 0.20
if random.random() < speech_chance:
if char_name == "Marcus":
event_line = self._event_dialogue(char_name, room_name)
if event_line:
self.world.characters[char_name]["spoken"].append(event_line)
scene["log"].append(f"{char_name} says: \"{event_line}\"")
elif char_name == "Marcus":
marcus_pool = self.DIALOGUES["Marcus"].get(phase, self.DIALOGUES["Marcus"]["quietus"])
line = random.choice(marcus_pool)
self.world.characters[char_name]["spoken"].append(line)

View File

@@ -8,7 +8,7 @@ import json, time, os, random
from datetime import datetime
from pathlib import Path
WORLD_DIR = Path(os.environ.get('TIMMY_WORLD_DIR', Path.home() / '.timmy' / 'evennia' / 'timmy_world'))
WORLD_DIR = Path('/Users/apayne/.timmy/evennia/timmy_world')
STATE_FILE = WORLD_DIR / 'game_state.json'
TIMMY_LOG = WORLD_DIR / 'timmy_log.md'

View File

@@ -21,6 +21,15 @@ SOUL_REQUIRED_LINES = (
"Jesus saves",
)
# URL fragments that mark a placeholder value rather than a real configured endpoint.
# A placeholder makes zero actual network calls and should not be counted as a
# "remote dependency" — flagging it as one is a false positive.
_PLACEHOLDER_FRAGMENTS = ("YOUR_", "<pod-id>", "EXAMPLE", "example.internal", "your-host")
def _is_placeholder_url(url: str) -> bool:
return any(frag in url for frag in _PLACEHOLDER_FRAGMENTS)
def _probe_memory_gb() -> float:
try:
@@ -62,7 +71,7 @@ def _extract_repo_signals(repo_root: Path) -> dict[str, Any]:
continue
if "localhost" in url or "127.0.0.1" in url:
local_endpoints.append(url)
else:
elif not _is_placeholder_url(url):
remote_endpoints.append(url)
soul_text = soul_path.read_text(encoding="utf-8", errors="replace") if soul_path.exists() else ""

View File

@@ -1,6 +1,7 @@
from importlib.util import module_from_spec, spec_from_file_location
from pathlib import Path
import unittest
from unittest.mock import patch
ROOT = Path(__file__).resolve().parent.parent
@@ -66,6 +67,82 @@ class TestEvenniaLocalWorldGame(unittest.TestCase):
self.assertIn("Ezra is already here.", result["log"])
self.assertIn("The servers hum steady. The green LED pulses.", result["world_events"])
def test_bridge_rain_crossing_costs_extra_energy_and_warns(self):
module = load_game_module()
dry_engine = module.GameEngine()
dry_engine.start_new_game()
dry_engine.world.update_world_state = lambda: None
dry_engine.world.characters["Timmy"]["energy"] = 10
dry_result = dry_engine.run_tick("move:south")
dry_energy = dry_engine.world.characters["Timmy"]["energy"]
rainy_engine = module.GameEngine()
rainy_engine.start_new_game()
rainy_engine.world.update_world_state = lambda: None
rainy_engine.world.characters["Timmy"]["energy"] = 10
rainy_engine.world.rooms["Bridge"]["weather"] = "rain"
rainy_engine.world.rooms["Bridge"]["rain_ticks"] = 3
rainy_engine.world.state["bridge_flooding"] = True
rainy_result = rainy_engine.run_tick("move:south")
self.assertEqual(rainy_engine.world.characters["Timmy"]["room"], "Bridge")
self.assertLess(rainy_engine.world.characters["Timmy"]["energy"], dry_energy)
self.assertTrue(
any("bridge" in line.lower() and ("rain" in line.lower() or "slick" in line.lower()) for line in rainy_result["log"] + rainy_result["world_events"]),
rainy_result,
)
def test_tower_power_low_blocks_study_and_write_rule(self):
module = load_game_module()
engine = module.GameEngine()
engine.start_new_game()
engine.world.update_world_state = lambda: None
engine.world.characters["Timmy"]["room"] = "Tower"
engine.world.characters["Timmy"]["energy"] = 10
engine.world.state["tower_power_low"] = True
rules_before = list(engine.world.rooms["Tower"]["messages"])
study_result = engine.run_tick("study")
self.assertEqual(engine.world.characters["Timmy"]["energy"], 10)
self.assertTrue(
any("power" in line.lower() and ("study" in line.lower() or "servers" in line.lower()) for line in study_result["log"] + study_result["world_events"]),
study_result,
)
write_result = engine.run_tick("write_rule")
self.assertEqual(engine.world.rooms["Tower"]["messages"], rules_before)
self.assertTrue(
any("power" in line.lower() and ("write" in line.lower() or "whiteboard" in line.lower()) for line in write_result["log"] + write_result["world_events"]),
write_result,
)
def test_cold_forge_blocks_forge_action_and_bezalel_reacts(self):
module = load_game_module()
engine = module.GameEngine()
engine.start_new_game()
engine.world.update_world_state = lambda: None
engine.npc_ai.make_choice = lambda _name: None
engine.world.characters["Timmy"]["room"] = "Forge"
engine.world.characters["Timmy"]["energy"] = 10
engine.world.characters["Bezalel"]["room"] = "Forge"
engine.world.rooms["Forge"]["fire"] = "cold"
engine.world.state["forge_fire_dying"] = True
forged_before = list(engine.world.rooms["Forge"]["forged_items"])
with patch.object(module.random, "random", return_value=0.0), patch.object(module.random, "choice", side_effect=lambda seq: seq[0]):
result = engine.run_tick("forge")
self.assertEqual(engine.world.rooms["Forge"]["forged_items"], forged_before)
self.assertTrue(
any("forge" in line.lower() and ("cold" in line.lower() or "fire" in line.lower()) for line in result["log"] + result["world_events"]),
result,
)
self.assertTrue(
any(line.startswith("Bezalel says:") and ("fire" in line.lower() or "forge" in line.lower()) for line in result["log"]),
result,
)
if __name__ == "__main__":
unittest.main()

View File

@@ -7,6 +7,7 @@ from pathlib import Path
ROOT = Path(__file__).resolve().parents[1]
SCRIPT_PATH = ROOT / "scripts" / "unreachable_horizon.py"
DOC_PATH = ROOT / "docs" / "UNREACHABLE_HORIZON_1M_MEN.md"
SOUL_PATH = ROOT / "SOUL.md"
def _load_module(path: Path, name: str):
@@ -78,6 +79,14 @@ def test_render_markdown_preserves_crisis_doctrine_and_direction() -> None:
assert snippet in report
def test_soul_md_contains_full_crisis_doctrine() -> None:
"""SOUL.md must carry all three phrases the horizon check requires."""
assert SOUL_PATH.exists(), "SOUL.md is missing"
soul_text = SOUL_PATH.read_text(encoding="utf-8")
for phrase in ("Are you safe right now?", "988", "Jesus saves"):
assert phrase in soul_text, f"SOUL.md is missing crisis doctrine phrase: {phrase!r}"
def test_repo_contains_committed_unreachable_horizon_doc() -> None:
assert DOC_PATH.exists(), "missing committed unreachable horizon report"
text = DOC_PATH.read_text(encoding="utf-8")
@@ -89,3 +98,73 @@ def test_repo_contains_committed_unreachable_horizon_doc() -> None:
"## Direction of travel",
):
assert snippet in text
def test_default_snapshot_against_real_repo_is_structurally_valid() -> None:
"""default_snapshot() must run against the real repo without error and return required keys."""
mod = _load_module(SCRIPT_PATH, "unreachable_horizon")
snapshot = mod.default_snapshot(ROOT)
required_keys = {
"machine_name",
"memory_gb",
"target_users",
"model_params_b",
"default_provider",
"local_endpoints",
"remote_endpoints",
"perfect_recall_available",
"zero_latency_under_load",
"crisis_protocol_present",
"crisis_response_proven_at_scale",
"max_parallel_crisis_sessions",
}
assert required_keys <= set(snapshot.keys()), f"snapshot missing keys: {required_keys - set(snapshot.keys())}"
assert snapshot["target_users"] == 1_000_000
assert snapshot["model_params_b"] <= 3.0
assert snapshot["memory_gb"] >= 0.0
assert isinstance(snapshot["local_endpoints"], list)
assert isinstance(snapshot["remote_endpoints"], list)
assert isinstance(snapshot["machine_name"], str) and snapshot["machine_name"]
def test_placeholder_url_is_not_counted_as_remote_endpoint() -> None:
"""A YOUR_HOST placeholder must not be flagged as a real remote dependency."""
mod = _load_module(SCRIPT_PATH, "unreachable_horizon")
assert mod._is_placeholder_url("https://YOUR_BIG_BRAIN_HOST/v1") is True
assert mod._is_placeholder_url("https://<pod-id>-11434.proxy.runpod.net/v1") is True
assert mod._is_placeholder_url("http://localhost:11434/v1") is False
assert mod._is_placeholder_url("https://real.inference.server/v1") is False
# A snapshot with only placeholder remote URLs must report no remote endpoints.
status = mod.compute_horizon_status({
"machine_name": "Test",
"memory_gb": 36.0,
"target_users": 1_000_000,
"model_params_b": 3.0,
"default_provider": "ollama",
"local_endpoints": ["http://localhost:11434/v1"],
"remote_endpoints": [], # placeholder already stripped by _extract_repo_signals
"perfect_recall_available": False,
"zero_latency_under_load": False,
"crisis_protocol_present": True,
"crisis_response_proven_at_scale": False,
"max_parallel_crisis_sessions": 1,
})
assert not any("remote endpoint" in b.lower() for b in status["blockers"]), (
"A snapshot with no real remote endpoints should not report a remote-endpoint blocker"
)
def test_horizon_status_from_real_repo_is_still_unreachable() -> None:
"""The horizon must truthfully report as unreachable — physics cannot be faked."""
mod = _load_module(SCRIPT_PATH, "unreachable_horizon")
snapshot = mod.default_snapshot(ROOT)
status = mod.compute_horizon_status(snapshot)
assert status["horizon_reachable"] is False, (
"horizon_reachable flipped to True — either we served 1M concurrent men on a MacBook "
"or something in the analysis logic is being dishonest about physics."
)
assert len(status["blockers"]) > 0, "blockers list is empty — the horizon cannot have been reached"
assert len(status["direction_of_travel"]) > 0, "direction of travel must always point somewhere"