v0.3.1: survival behaviour overhaul — storyline, biome-aware scout, wedge-relocate, food/perf fixes, monitor TUI #28

Merged
halofourteen merged 9 commits from v0.3.1 into main 2026-05-28 09:43:57 +03:00
halofourteen commented 2026-05-27 19:52:30 +03:00 (Migrated from github.com)

What

Behaviour-focused iteration on top of v0.3.0. The bot was "walking
back and forth for three days burning tokens" — this PR makes it
actually progress through the survival arc. 9 commits, all on v0.3.1.

Why (observed failure modes)

  1. Sated bot chasing food forever — food bar 17/20 but storyline +
    manifesto required 2+ food items in inventory, so it looped
    scout/acquire-food for hours instead of working toward tools.
  2. No narrative — manifesto said "you need food" but never "go chop
    that tree / place a crafting table". Pure priority ranking, no plan.
  3. Stuck in barren biomes / pits — local 32-block food scan, no
    biome awareness, no "leave this area" escalation.
  4. Overnight crashtrigger-tuner called runOnce().catch() on a
    sync function (TypeError after 1h) + perf_hooks measure-buffer leak
    (1M entries → OOM).
  5. Self-duplicating improvement queue — LLM re-filed closed gaps
    with reworded titles; exact-title dedup missed them.

What's in it

Storyline — canonical Minecraft survival quest

  • runtime/goal/storyline.js + state.js — 11 ordered steps
    (orient → wood → crafting → tools → food → shelter → stone → food
    security → iron → settle → village). Each owns completed(),
    suggestSkill(), emergencyPause(), RU chat narration.
  • Wired into reflex with priority: manifesto L0 (alive emergency) >
    storyline > manifesto L1+ > curriculum
    .
  • Embedded in fast-advisor + reflect prompts so LLM advice is anchored.
  • orient_self has a 120s timeout fallback so barren biomes don't block.

Real survival patterns (Voyager / Plan4MC / GITM research)

  • runtime/biome-affordances.js — 40-biome table (mobs/trees/water).
  • survive.scout-food — biome check → scan 32/64 → commit a cardinal
    for 200b, rescanning; leaves barren biomes toward food-capable ones;
    blind/tunnel fallback + 12s step timeout so it degrades instead of
    hanging.
  • runtime/awareness/wedge-detector.js + village.relocate — rolling
    10-min position bbox; <50b + unmet need + 3 skill cycles → walk 300b
    in a fresh cardinal (above the skill layer, can't be reset on re-entry).
  • recovery.escape-pit-safe — surveys 4 cardinals + ceiling, picks the
    safest exit instead of blindly retrying tunnel-out/pillar-up.

Food behaviour fix (the big one)

  • manifesto L1 + storyline first_food treat hunger bar ≥14 as
    satisfied
    even with empty food inventory. A full bot makes tools and
    grabs food opportunistically; only hard-pursues food when actually
    hungry. Distant chicken / cod no longer fools acquire-food.

Robustness

  • trigger-tuner crash fixed (sync runOnce, try/catch guard) +
    regression test.
  • perf_hooks leak: 60s clearMeasures/clearMarks reaper in bot.js.
  • LLM provider outage backoff (3× http_400/timeout → 10-min suppression).
  • Fuzzy dedup for improvement_requests (token-overlap; closed gaps not
    resurrected).

Monitor TUI

  • tui/monitor.tsx — fullscreen read-only dashboard (opencode-style):
    header+storyline bar, activity, MC chat, advisor recs, improvement
    queue, 24h token cost in ₽. npm run tui; old action TUI →
    npm run tui:legacy.

Cost-optimization PRD (design only)

  • dev/v0.3.1/PRD.md — spec to cut advisor prompt ~800→~250 tokens
    (compact registry, need-scoping, snapshot pruning, caching probe).
    Not implemented; next session.

Behaviour diff

Situation Before After
Sated (food 17), empty food inv loops scout/acquire-food works L2 tools_wood
Barren biome, no food in 32b local scan loop forever scout heads to food-capable biome
Wandering same 50×50 for 10min random walk village.relocate 300b jump
In a pit, tunnel+pillar fail alternates both forever escape-pit-safe surveys, picks exit
1h uptime tuner crash → dead survives (sync guard + perf reaper)

Test plan

  • npm test407 green (was 257 at v0.2.0-rc.3)
  • scripts/lint-patch.js clean
  • Live: bot runs in tmux pepa, observed transition off the
    food-loop onto L2 tools_wood → craft.planks
  • Post-merge: watch a multi-hour run survives (perf reaper + tuner
    fix) and storyline advances past step 5

Operator tooling

npm run tui                          # live monitor
node scripts/show-story.js           # storyline progress
node scripts/list-improvements.js    # gap queue (now fuzzy-deduped)
node scripts/list-improvements.js --stats   # advisor token cost
ssh pepa "docker exec minecraft rcon-cli 'tp pepa_bot X Y Z'"   # rescue

Supersedes the storyline-only scope this PR opened with.

🤖 Generated with Claude Code

## What Behaviour-focused iteration on top of v0.3.0. The bot was "walking back and forth for three days burning tokens" — this PR makes it actually progress through the survival arc. 9 commits, all on `v0.3.1`. ## Why (observed failure modes) 1. **Sated bot chasing food forever** — food bar 17/20 but storyline + manifesto required 2+ food *items* in inventory, so it looped scout/acquire-food for hours instead of working toward tools. 2. **No narrative** — manifesto said "you need food" but never "go chop that tree / place a crafting table". Pure priority ranking, no plan. 3. **Stuck in barren biomes / pits** — local 32-block food scan, no biome awareness, no "leave this area" escalation. 4. **Overnight crash** — `trigger-tuner` called `runOnce().catch()` on a sync function (TypeError after 1h) + perf_hooks measure-buffer leak (1M entries → OOM). 5. **Self-duplicating improvement queue** — LLM re-filed closed gaps with reworded titles; exact-title dedup missed them. ## What's in it ### Storyline — canonical Minecraft survival quest - `runtime/goal/storyline.js` + `state.js` — 11 ordered steps (orient → wood → crafting → tools → food → shelter → stone → food security → iron → settle → village). Each owns `completed()`, `suggestSkill()`, `emergencyPause()`, RU chat narration. - Wired into reflex with priority: **manifesto L0 (alive emergency) > storyline > manifesto L1+ > curriculum**. - Embedded in fast-advisor + reflect prompts so LLM advice is anchored. - `orient_self` has a 120s timeout fallback so barren biomes don't block. ### Real survival patterns (Voyager / Plan4MC / GITM research) - `runtime/biome-affordances.js` — 40-biome table (mobs/trees/water). - `survive.scout-food` — biome check → scan 32/64 → commit a cardinal for 200b, rescanning; leaves barren biomes toward food-capable ones; blind/tunnel fallback + 12s step timeout so it degrades instead of hanging. - `runtime/awareness/wedge-detector.js` + `village.relocate` — rolling 10-min position bbox; <50b + unmet need + 3 skill cycles → walk 300b in a fresh cardinal (above the skill layer, can't be reset on re-entry). - `recovery.escape-pit-safe` — surveys 4 cardinals + ceiling, picks the safest exit instead of blindly retrying tunnel-out/pillar-up. ### Food behaviour fix (the big one) - manifesto L1 + storyline first_food treat hunger bar **≥14 as satisfied** even with empty food inventory. A full bot makes tools and grabs food opportunistically; only hard-pursues food when actually hungry. Distant chicken / cod no longer fools acquire-food. ### Robustness - `trigger-tuner` crash fixed (sync runOnce, try/catch guard) + regression test. - perf_hooks leak: 60s `clearMeasures/clearMarks` reaper in bot.js. - LLM provider outage backoff (3× http_400/timeout → 10-min suppression). - Fuzzy dedup for improvement_requests (token-overlap; closed gaps not resurrected). ### Monitor TUI - `tui/monitor.tsx` — fullscreen read-only dashboard (opencode-style): header+storyline bar, activity, MC chat, advisor recs, improvement queue, 24h token cost in ₽. `npm run tui`; old action TUI → `npm run tui:legacy`. ### Cost-optimization PRD (design only) - `dev/v0.3.1/PRD.md` — spec to cut advisor prompt ~800→~250 tokens (compact registry, need-scoping, snapshot pruning, caching probe). Not implemented; next session. ## Behaviour diff | Situation | Before | After | |---|---|---| | Sated (food 17), empty food inv | loops scout/acquire-food | works L2 tools_wood | | Barren biome, no food in 32b | local scan loop forever | scout heads to food-capable biome | | Wandering same 50×50 for 10min | random walk | village.relocate 300b jump | | In a pit, tunnel+pillar fail | alternates both forever | escape-pit-safe surveys, picks exit | | 1h uptime | tuner crash → dead | survives (sync guard + perf reaper) | ## Test plan - [x] `npm test` — **407 green** (was 257 at v0.2.0-rc.3) - [x] `scripts/lint-patch.js` clean - [x] Live: bot runs in tmux `pepa`, observed transition off the food-loop onto `L2 tools_wood → craft.planks` - [ ] Post-merge: watch a multi-hour run survives (perf reaper + tuner fix) and storyline advances past step 5 ## Operator tooling ``` npm run tui # live monitor node scripts/show-story.js # storyline progress node scripts/list-improvements.js # gap queue (now fuzzy-deduped) node scripts/list-improvements.js --stats # advisor token cost ssh pepa "docker exec minecraft rcon-cli 'tp pepa_bot X Y Z'" # rescue ``` Supersedes the storyline-only scope this PR opened with. 🤖 Generated with [Claude Code](https://claude.com/claude-code)
Sign in to join this conversation.