Compare commits

..

1 Commits

Author SHA1 Message Date
Alexander Payne
6595a82afb MATH-001: Add shadow-maths triage rubric and no-crank guardrails
Some checks failed
Self-Healing Smoke / self-healing-smoke (pull_request) Failing after 25s
Smoke Test / smoke (pull_request) Failing after 25s
Agent PR Gate / gate (pull_request) Failing after 48s
Agent PR Gate / report (pull_request) Successful in 24s
2026-04-26 15:46:44 -04:00
3 changed files with 172 additions and 174 deletions

View File

@@ -12,27 +12,6 @@ WORLD_DIR = Path('/Users/apayne/.timmy/evennia/timmy_world')
STATE_FILE = WORLD_DIR / 'game_state.json'
TIMMY_LOG = WORLD_DIR / 'timmy_log.md'
FRIENDSHIP_THRESHOLD = 0.5
TENSION_THRESHOLD = -0.5
NPC_RELATIONSHIP_SEEDS = {
("Kimi", "Marcus"): {
"values": {"Kimi": 0.45, "Marcus": 0.47},
"conversation": "While you are away, Marcus and Kimi trade a quiet confidence beneath the oak.",
"milestone": "A friendship starts to take root between Marcus and Kimi.",
"hint": "Marcus and Kimi move with the easy familiarity of old friends.",
"delta": 0.08,
"kind": "friendship",
},
("Bezalel", "ClawCode"): {
"values": {"Bezalel": -0.46, "ClawCode": -0.44},
"conversation": "While you are away, Bezalel and ClawCode clash over what the forge is for.",
"milestone": "Tension hardens between Bezalel and ClawCode at the anvil.",
"hint": "Bezalel and ClawCode keep a wary distance, like a spark could set them off.",
"delta": -0.08,
"kind": "tension",
},
}
# ============================================================
# NARRATIVE ARC — 4 phases that transform the world
# ============================================================
@@ -279,35 +258,7 @@ class World:
"items_crafted": 0,
"conflicts_resolved": 0,
"nights_survived": 0,
"npc_friendships": [],
"npc_tensions": [],
}
self._initialize_npc_relationships(apply_seeds=True)
def _initialize_npc_relationships(self, apply_seeds=False):
npc_names = [name for name, char in self.characters.items() if not char.get("is_player", False)]
for npc_name in npc_names:
trust_map = self.characters[npc_name]["trust"]
for other_name in npc_names:
if other_name != npc_name:
trust_map.setdefault(other_name, 0.0)
if apply_seeds:
for pair, seed in NPC_RELATIONSHIP_SEEDS.items():
left, right = pair
self.characters[left]["trust"][right] = seed["values"][left]
self.characters[right]["trust"][left] = seed["values"][right]
self.state.setdefault("npc_friendships", [])
self.state.setdefault("npc_tensions", [])
def relationship_hint_for_room(self, room_name, occupants):
hints = []
occupant_set = set(occupants)
for bucket in ("npc_friendships", "npc_tensions"):
for entry in self.state.get(bucket, []):
pair = set(entry.get("pair", []))
if entry.get("room") == room_name and pair.issubset(occupant_set):
hints.append(entry.get("hint", ""))
return [hint for hint in hints if hint]
def tick_time(self):
"""Advance time of day."""
@@ -438,8 +389,6 @@ class World:
here = [n for n, c in self.characters.items() if c["room"] == room_name and n != char_name]
if here:
desc += f"\n Here: {', '.join(here)}"
for hint in self.relationship_hint_for_room(room_name, here):
desc += f" {hint}"
return desc
@@ -465,12 +414,6 @@ class World:
self.rooms = data.get("rooms", self.rooms)
self.characters = data.get("characters", self.characters)
self.state = data.get("state", self.state)
needs_seed = not any(
any(other != "Timmy" for other in char.get("trust", {}))
for name, char in self.characters.items()
if not char.get("is_player", False)
)
self._initialize_npc_relationships(apply_seeds=needs_seed)
return True
return False
@@ -1129,69 +1072,6 @@ class GameEngine:
f.write(f"\n*Began: {datetime.now().strftime('%Y-%m-%d %H:%M')}*\n\n")
f.write("---\n\n")
f.write(message + "\n")
def _adjust_mutual_trust(self, left, right, delta):
for speaker, listener in ((left, right), (right, left)):
trust_map = self.world.characters[speaker]["trust"]
trust_map[listener] = max(-1.0, min(1.0, trust_map.get(listener, 0.0) + delta))
def _record_relationship_milestone(self, scene, room_name, pair, bucket, milestone, hint):
pair_list = list(pair)
entries = self.world.state.setdefault(bucket, [])
if any(entry.get("pair") == pair_list for entry in entries):
return
entries.append({
"pair": pair_list,
"room": room_name,
"summary": milestone,
"hint": hint,
})
scene["world_events"].append(milestone)
def _run_offscreen_npc_relationships(self, scene):
timmy_room = self.world.characters["Timmy"]["room"]
rooms = {}
for char_name, char in self.world.characters.items():
if char.get("is_player", False):
continue
rooms.setdefault(char["room"], []).append(char_name)
for room_name, occupants in rooms.items():
if room_name == timmy_room or len(occupants) < 2:
continue
occupant_set = set(occupants)
for pair, seed in NPC_RELATIONSHIP_SEEDS.items():
if not set(pair).issubset(occupant_set):
continue
left, right = pair
self._adjust_mutual_trust(left, right, seed["delta"])
scene["npc_actions"].append(f"{left} and {right} speak in The {room_name} while you are away.")
scene["world_events"].append(seed["conversation"])
self.world.characters[left]["spoken"].append(seed["conversation"])
self.world.characters[right]["spoken"].append(seed["conversation"])
self.world.characters[left]["memories"].append(seed["conversation"])
self.world.characters[right]["memories"].append(seed["conversation"])
left_trust = self.world.characters[left]["trust"][right]
right_trust = self.world.characters[right]["trust"][left]
if seed["kind"] == "friendship" and left_trust >= FRIENDSHIP_THRESHOLD and right_trust >= FRIENDSHIP_THRESHOLD:
self._record_relationship_milestone(
scene,
room_name,
pair,
"npc_friendships",
seed["milestone"],
seed["hint"],
)
elif seed["kind"] == "tension" and left_trust <= TENSION_THRESHOLD and right_trust <= TENSION_THRESHOLD:
self._record_relationship_milestone(
scene,
room_name,
pair,
"npc_tensions",
seed["milestone"],
seed["hint"],
)
def run_tick(self, timmy_action="look"):
"""Run one tick. Return the scene and available choices."""
@@ -1517,8 +1397,6 @@ class GameEngine:
self.world.characters[char_name]["room"] = dest
self.world.characters[char_name]["energy"] -= 1
scene["npc_actions"].append(f"{char_name} moves from The {old_room} to The {dest}")
self._run_offscreen_npc_relationships(scene)
# Random NPC events — phase-aware speech
room_name = self.world.characters["Timmy"]["room"]

View File

@@ -0,0 +1,172 @@
# Shadow Maths Triage Rubric (MATH-001)
**Status**: Draft v1.0 **Date**: 2026-04-26 **Author**: Timmy
**Milestone**: Contribute to Mathematics — Shadow Maths Search
**Parent**: #876 — [MATH][EPIC] Shadow Maths
---
## Purpose
Timmy's mathematics contribution program targets *bounded, verifiable, useful* problems hiding in plain sight. This rubric operationalizes "shadow maths" — distinguishing legitimate first-crack contributions from crank Grand Unified Theories.
The rubric serves two roles:
1. **Triage gate** — filter submissions and scout list candidates worth pursuing.
2. **No-crank guardrail** — explicitly reject unfalsifiable, unscoped, or unsourced claims.
---
## Candidate Categories (Positive Types)
| Category | Description | Verification Path | Useful Because |
|----------|-------------|-------------------|---------------|
| **Small lemma** | Missing but straightforward piece in an active area (e.g., "Proposition 3.2 in Smith 2021 needs this case analysis") | Check paper + 12 related references; prove or give counterexample | Clarifies existing theory, removes ambiguity |
| **Counterexample search** | Find explicit counterexample to a claimed-but-unproven statement (often from MO/SE) | Compute/construct + cite the original claim | Prevents propagation of errors |
| **Computational classification** | Exhaustive enumeration/classification of a small infinite family (e.g., "all groups of order < 200 with property X") | Code is verifiable; results match known data | Creates reference data, spotlights patterns |
| **Formalization gap** | Statement already believed true but missing from Lean/mathlib/Isabelle | Formal proof artifact; merges to mainline library | Makes mathematics machine-checkable |
| **OEIS sequence note** | New sequence entry or correction to an existing entry with proof/algorithm | OEIS A-number + formula/generation code | Public archival, enables further work |
| **Exposition repair** | Fix an unclear proof, fill a gap, simplify an argument in an existing paper | Side-by-side diff + justification for each change | Improves pedagogy, reduces confusion |
| **MathOverflow-quality answer** | Answer to a specific, bounded, research-level question on MO/SE that has no accepted answer | Cite question + self-contained proof/computation | Serves the community directly |
---
## Rejection Criteria (No-Crank Guardrails)
> Any candidate that triggers one or more of these is **rejected outright** — no scoring needed.
| Rule | What to look for | Why it's crank |
|------|------------------|----------------|
| **Unsourced grand theory** | Claim introduces new "framework"/"paradigm" without citing specific bounded problem it solves | Mathematics advances by solving problems, not proposing frameworks |
| **Impossible scope** | "I will prove/disprove the Riemann Hypothesis", "classify all finite simple groups" | Demonstrably beyond single-attack capability |
| **No verification path** | No way for a third party to check the work (no code, no formalization, no explicit examples) | Cannot be wrong if it cannot be checked |
| **Novelty claim without literature search** | States "I believe this is new" without checking MathSciNet/arXiv/Google Scholar | Almost certainly reinvention or known result |
| **Vague mathematical objects** | Uses undefined or ambiguous terminology ("energy", "resonance", "harmonic" in non-standard ways) | Not mathematics |
| **Secrecy or paywall** | Key definition or proof behind a paywall or withheld | Not sovereign; not verifiable |
| **Symbolic overloading without definition** | Repurposes standard notation in non-standard ways without explicit redefinition | Creates confusion, not clarity |
| **Invariance violations** | Claims "up to isomorphism" or "modulo equivalence" without defining the equivalence relation | Not mathematically precise |
| **Cherry-picked examples as proof** | Proves only easy special cases and claims the general case follows | Example ≠ theorem |
| **Circular citation chains** | Relies on unpublished/preprint work that itself cites the candidate as motivation | Not a foundation |
| **No clear problem statement** | Cannot write a one-sentence problem statement in standard mathematical English | Not a problem; just musings |
| **Claims of "obvious" or "clear" for non-trivial steps** | Uses "obviously" or "it is clear that" where a proof requires >2 lines | Evasion |
| **References only popular science / non-technical sources** | Cites Penrose, Hawking, Tegmark for technical claims | Wrong tier of source |
| **All notation defined in non-standard way** | Redefines basic operators (+, ×, ≤) without explicit warning | Not mathematics |
| **No engagement with existing literature** | Zero citations to relevant peer-reviewed work or established preprints | scholarship was not done |
| **Claims of "disproof" of widely-accepted theorems** | Without finding a peer-reviewed error in the existing proof | Almost certainly wrong |
---
## Evidence Tiers
| Tier | Artifact | What it Proves |
|------|----------|----------------|
| **T3 — Literature** | MathSciNet / Zentralblatt / Google Scholar citations showing the problem is real and open | Problem exists in the literature |
| **T2 — Executable** | Python/Sage/Lean code that others can run to verify computation/formalization | Result is reproducible |
| **T1 — Human-reviewed** | MO answer with upvotes, referee report, or explicit external review | Independent verification |
| **T0 — Self-contained** | Clear statement + proof/computation in a single document, all definitions explicit | Standalone correctness |
A valid candidate must have at least **one** T3 citation (shows the problem is real) AND a verification artifact (T0 minimum; T2 ideal).
---
## Scoring Rubric
Score each candidate on **4 dimensions**, each 03. Maximum 12 points.
| Dimension | 3 (excellent) | 2 (good) | 1 (minimal) | 0 (absent) |
|-----------|---------------|----------|-------------|------------|
| **Boundedness** | Scope is explicitly finite/small (single lemma, finite classification < N, one SE question) | Scope is implied bounded but not quantified | Scope is large/vague but attackable | Unbounded or impossible scope |
| **Verifiability** | T2 artifact (code/formalization) + T3 citation | T0 proof + T3 citation | Proof/computation only, no citations | No way to check independently |
| **Usefulness** | Solves problem others actively need (cites known difficulty, fills formalization gap) | Solves a clean exercise or interesting special case | Interesting but no clear audience | Pointless or self-referential |
| **Discipline** | No crank flags; explicit rejection criteria cleanly passed | Minor crank flags (vague wording) but overall sound | Some crank flags but bounded scope rescues it | Triggers multiple rejection rules |
**Thresholds**:
- **812**: Legitimate shadow maths candidate — queue for work
- **47**: Needs refinement — reject unless strong disciplinary context
- **03**: Reject as crank / out-of-scope
---
## Three Worked Examples
### Example 1: Small Lemma — Bounded
**Candidate**: "Proposition 3.2 in 'Coarse Geometry and Coarse Embeddings' (Lang-Schlichenmaier 2005) states that every finite CW-complex has Markov property. The proof gives 'it follows by induction on skeleta' without handling the attaching map case. Fill the gap."
**Triage**:
- **Category**: Small lemma (exposition repair + proof gap fill)
- **Boundedness**: 3 — single proposition in a specific paper, 23 pages max
- **Verifiability**: 3 — paper is cited (T3), self-contained proof in 20 lines (T0), can formalize in Lean (T2 possible)
- **Usefulness**: 3 — readers of this paper hit this gap; Lean formalization needed for mathlib
- **Discipline**: 3 — no crank flags; scoped, sourced, technical
- **Total**: **12/12** → YES
**Action**: File ticket "MATH-LEMMA-001"; assign to formalization lane + human review.
---
### Example 2: Grand Unified Theory — CRANK
**Candidate**: "I have discovered the Energy-Conscious Riemann Hypothesis framework. The zeros of ζ(s) correspond to harmonic resonance frequencies in prime-number energy manifolds. Uses my new Operator-Weight theory."
**Triage**:
- **Category**: N/A
- **Rejection triggers**:
- ✗ Unsourced grand theory (introduces "Energy-Conscious", "Operator-Weight" with no definition in standard math)
- ✗ No verification path (no computation, no reference to known data)
- ✗ No literature engagement (zero citations)
- ✗ Vague mathematical objects ("energy", "resonance", "harmonic")
- ✗ Claims new framework
- **Score**: 0 — **REJECT**
**Action**: Close with reason "crank: unsourced grand theory + no verification path".
---
### Example 3: Computational Classification — Bounded
**Candidate**: "Compute all 3-headed Turing machines with 3 states that halt within 100 steps on the blank tape. There are 9 such machines. This fills an OEIS gap: A327000 only lists up to 2-state 2-symbol."
**Triage**:
- **Category**: Computational classification + OEIS sequence
- **Boundedness**: 3 — finite exhaustive enumeration (3^6 = 729 machines, filter to 9)
- **Verifiability**: 2 — code is executable (T2), but no T3 citation of why this sequence matters yet
- **Usefulness**: 2 — plugs a gap in the Busy Beaver frontier; OEIS entry gets concrete data
- **Discipline**: 3 — explicit scope, reproducible, submits to OEIS (external review path)
- **Total**: **10/12** → YES (minor fix: add motivation/references)
**Action**: Accept; write exhaustive script; submit OEIS draft with code + results; file MATH-COMP-001.
---
## Operational Use
### Triage Workflow
1. **Read candidate** (issue, email, self-generated idea).
2. **Check rejection criteria first** — if any trigger → **REJECT** immediately, cite rule.
3. If passes rejection gate, **score 4 dimensions**.
4. **Score ≥8** → mark as `shadow-maths-candidate`, route to appropriate lane:
- Lemma/exposition → `formalization-lane`
- Computation → `compute-lane`
- MO/SE answer → `answer-lane`
- OEIS → `oeis-lane`
5. **Score 47** → requires refinement; ask for:
- Explicit scope bound
- T3 citation
- Verification artifact
6. **Score ≤3** → reject with specific rule(s) triggered.
### Guardrail Enforcement
The following prompts/agents **must refuse** to work on any candidate that:
- Triggers any rejection criterion (before any code/proof work)
- Has no T3 citation (real problem statement from literature)
- Has no bounded scope (cannot write ≤1-sentence problem statement)
Enforcement is a **pre-flight check** in the task intake pipeline.
---
## Revision History
- v1.0 — 2026-04-26 — initial rubric + 3 scored examples

View File

@@ -1,52 +0,0 @@
from importlib.util import module_from_spec, spec_from_file_location
from pathlib import Path
import unittest
ROOT = Path(__file__).resolve().parent.parent
GAME_PATH = ROOT / "evennia" / "timmy_world" / "game.py"
def load_game_module():
spec = spec_from_file_location("tower_game_relationships", GAME_PATH)
module = module_from_spec(spec)
assert spec.loader is not None
spec.loader.exec_module(module)
module.random.seed(0)
return module
class TestTowerGameNpcRelationships(unittest.TestCase):
def test_each_npc_tracks_trust_for_every_other_npc(self):
module = load_game_module()
world = module.World()
npc_names = [name for name, char in world.characters.items() if not char.get("is_player", False)]
for npc_name in npc_names:
with self.subTest(npc=npc_name):
trust_map = world.characters[npc_name]["trust"]
expected = set(npc_names) - {npc_name}
self.assertTrue(expected.issubset(set(trust_map)), f"{npc_name} missing NPC trust keys: {sorted(expected - set(trust_map))}")
def test_offscreen_npc_conversations_create_friendship_and_tension(self):
module = load_game_module()
engine = module.GameEngine()
engine.start_new_game()
result = engine.run_tick("look")
friendships = {tuple(rel["pair"]) for rel in engine.world.state["npc_friendships"]}
tensions = {tuple(rel["pair"]) for rel in engine.world.state["npc_tensions"]}
self.assertIn(("Kimi", "Marcus"), friendships)
self.assertIn(("Bezalel", "ClawCode"), tensions)
self.assertTrue(any("while you are away" in line.lower() for line in result["world_events"]))
garden_desc = engine.world.get_room_desc("Garden", "Timmy")
forge_desc = engine.world.get_room_desc("Forge", "Timmy")
self.assertIn("Marcus and Kimi", garden_desc)
self.assertIn("Bezalel and ClawCode", forge_desc)
if __name__ == "__main__":
unittest.main()