Skip to content

STORY-01: source-native builder, SWMD-mini, HG-02 gym - #54

Draft
patrickdugan wants to merge 38 commits into
masterfrom
research/storyworld-native-three-mode-gym-20261123
Draft

patrickdugan wants to merge 38 commits into
masterfrom
research/storyworld-native-three-mode-gym-20261123

Conversation

@patrickdugan

@patrickdugan patrickdugan commented Nov 22, 2026 •

Copy link
Copy Markdown
Collaborator

STORY-01 / STORY-02: source-native Storyworld gym

Implements DataGoblin's read-only GPTStoryworld research gym, with bounded native scoring, model-facing turn-by-turn play, and four-world source-held-out evaluation. Upstream source pinned at 5cd0b480e9a01d07418cdf8cb3bedbc9d38ef906; each source artifact and script is SHA-256 recorded.

Native source adapters

  • Builder: source SweepWeave JSON, deterministic reaction-successor repairs, original validator, exact restoration and meaningful schema-valid negatives.
  • Mini: original JSON-to-SWMD-0-MIN converter and encounter index parser; one redacted encounter per prompt; native compiler SWMD-MICRO-0.1 SFT for compile/compression/repair/targeted edit.
  • Hypergame: genuine source HG-02 partially observed 140D simulator; exact Bellman, blind, metric and proxy controls; true utility, unsafe releases, action legality and observer-visible state.

Local interactive model runner

src/datagoblin/training_gym/rlt_gym/storyworld_local.py uses an operator-provided, already-running localhost /v1/chat/completions endpoint. It sends public HG-02 observations turn by turn, logs raw responses and usage, enforces 8K Mini / 16K hard context budgets, and keeps hidden state exclusively in the simulator. It rejects proxy redirects or non-loopback network destinations. Completed turns survive interrupted runs with --resume and are independently rescored using --replay-run. GitHub tests use a public-observation-only stub policy. No actual Inky Mini inference has been claimed or run.

Multi-world registry and custody

training/rlt_gym/storyworld_native/world_cohort_v1.json pins four source worlds and assigns each whole world to one split:

  • Train: Forecast Backstab (diplomacy); Charter of Ashen Aegis (law)
  • Calibration: The Fifth Testimony
  • OOD development: TSUN-01B Last Train Home (rescue)

Source-world isolation applies to builder/Mini and SFT. Held-out world train-label streams are empty. Larger compiler packets stay in audited micro_oversize.jsonl rather than being silently truncated, keeping the 8K budget and source labels intact.

Reproducibility receipts

Passing 14-test native workflow includes source checkout, ruff, interactive offline-stub tests, exact collection replay, four-world split audits and overbudget accounting.

Pilot cohort (seed 23, 2 native roots/world, 2 micro tasks/encounter): 4 worlds, 32 native tasks, 112 native control rollouts, 26 admitted Mini compiler tasks, 6 recorded overbudget exclusions, and 16 train-only SFT labels.

Commands and model invocation: storyworld_native README.

Scope and gates

Initial full-builder task is bounded repair, and Mini SFT uses deterministic source compiler labels. Narrative generation, independent quality criticism, new world simulation, actual local model evaluation and trained-model generalization need separate measured experiments. The public source-world holdout is an engineering split, not an undisclosed private world benchmark. Keep this PR in draft pending those results.

root = Path(td)
seed = root / "key.bin"
secret = b"private reproducibility key for synthetic smoke 01"
seed.write_bytes(secret)
Comment on lines +53 to +54
"\n".join(json.dumps({"root": x["root"], "output": json.dumps(x["expected"])})
for x in secret) + "\n", encoding="utf-8",
Comment on lines +16 to +59
runs-on: ubuntu-latest
timeout-minutes: 15
steps:
- name: Checkout DataGoblin
uses: actions/checkout@v4
- name: Checkout pinned GPTStoryworld files
uses: actions/checkout@v4
with:
repository: MoralityLabAI/GPTStoryworld
ref: 5cd0b480e9a01d07418cdf8cb3bedbc9d38ef906
path: GPTStoryworld
filter: blob:none
sparse-checkout-cone-mode: false
sparse-checkout: |
codex-skills/storyworld-building/scripts/sweepweave_validator.py
codex-skills/storyworld-building/scripts/json_to_swmd.py
codex-skills/small-storyworld-builder/scripts/swmd_encounter_index.py
codex-skills/small-storyworld-builder/scripts/swmd_build_qlora_examples.py
verifiers_envs/storyworld-hypergames-env/src/spiral_ln/hypergames_single_player.py
verifiers_envs/storyworld-hypergames-env/src/spiral_ln/evaluation_hypergames.py
storyworlds/diplomacy/forecast_backstab.json
storyworlds/charter_of_ashen_aegis.json
storyworlds/the_fifth_testimony_p2.json
storyworlds/tsun01b_last_train_home/tsun01b.sweepweave.json
- name: Python
uses: actions/setup-python@v5
with:
python-version: "3.11"
- name: Install DataGoblin and lint dependencies
run: python -m pip install -e '.[dev]'
- name: Native tests and source-pinned replay
env:
PYTHONPATH: src
GPTSTORYWORLD_SOURCE: GPTStoryworld
GPTSTORYWORLD_EXPECT_SHA: 5cd0b480e9a01d07418cdf8cb3bedbc9d38ef906
run: |
ruff check src/datagoblin/training_gym/rlt_gym/storyworld_native.py src/datagoblin/training_gym/rlt_gym/storyworld_micro.py src/datagoblin/training_gym/rlt_gym/storyworld_local.py src/datagoblin/training_gym/rlt_gym/storyworld_cohort.py tests/unit/test_rlt_gym_storyworld_native.py tests/unit/test_rlt_gym_storyworld_micro.py tests/unit/test_rlt_gym_storyworld_local.py tests/unit/test_rlt_gym_storyworld_cohort.py
python -m unittest discover -s tests/unit -p 'test_rlt_gym_storyworld*.py' -v
python -m datagoblin.training_gym.rlt_gym.storyworld_native --source GPTStoryworld --expect-source-commit "$GPTSTORYWORLD_EXPECT_SHA" --per-mode 2 --seed 23 --out "$RUNNER_TEMP/dg-sw-native"
python -m datagoblin.training_gym.rlt_gym.storyworld_native --source GPTStoryworld --expect-source-commit "$GPTSTORYWORLD_EXPECT_SHA" --replay "$RUNNER_TEMP/dg-sw-native"
python -m datagoblin.training_gym.rlt_gym.storyworld_micro --source GPTStoryworld --expect-source-commit "$GPTSTORYWORLD_EXPECT_SHA" --examples-per-encounter 4 --seed 23 --out "$RUNNER_TEMP/dg-sw-micro"
python -m datagoblin.training_gym.rlt_gym.storyworld_micro --source GPTStoryworld --expect-source-commit "$GPTSTORYWORLD_EXPECT_SHA" --replay "$RUNNER_TEMP/dg-sw-micro"
python -m datagoblin.training_gym.rlt_gym.storyworld_cohort --source GPTStoryworld --per-mode 2 --micro-examples 2 --micro-max-encounters 4 --seed 23 --out "$RUNNER_TEMP/dg-sw-cohort"
python -m datagoblin.training_gym.rlt_gym.storyworld_cohort --source GPTStoryworld --replay "$RUNNER_TEMP/dg-sw-cohort"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants