[#739] Tile-trait beliefs out of MindGraph#748
Merged
Conversation
Grazable and Drinkable are objective world facts derivable from terrain type, not subjective beliefs. The audit on issue #739 showed perception churned 717K HasTrait mutations on a 12-game-hour run, dominated by the "agent walks in → asserts (Tile, HasTrait, Grazable) → walks out → removes it" cycle, with N agents perceiving the same tile producing N duplicate triples. Replace the per-agent belief path with a direct WorldMap spatial query: - Add TileType::has_trait(concept) and WorldMap::tiles_with_trait(...) that map terrain types to concepts (Grass→Grazable, water→Drinkable). - target_enumeration::enumerate_tiles_with_trait now scans the world map within a planning radius of the agent — no MindGraph round-trip. - Delete perceive_grass_tiles and perceive_water_tiles entirely. No legacy shim per the no-backwards-compat rule. Subjective tile beliefs that are *not* derivable from terrain stay in MindGraph: Unreachable (per-agent learned pathing failure with TTL), Territory (per-agent claim, set once at spawn). Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Pre-#739 the herbivore-only restriction on Graze rode along with perceive_grass_tiles, which only wrote (Tile, HasTrait, Grazable) for herbivores. With the perception path gone, omnivores were enumerating grass tiles too — a hungry human at (50,50) on the all-grass test map would graze instead of walking to the apple tree, breaking the brain cadence test. Add Action::eligible_diets (default empty = all diets) and override on Graze to return Herbivore. collect_planning_actions filters by it alongside the existing satiation gate. Add a regression test that an omnivore never starts Graze. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
…its-out-of-mindgraph
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
closes #739
Summary
Grazable/Drinkableare objective terrain facts, not subjective beliefs. Move them out of every agent's MindGraph and read them fromWorldMapdirectly.TileType::has_trait(Concept)andWorldMap::tiles_with_trait(center, radius, concept)— the planner'sTargetSource::TileWithTraitnow does a bounded spatial scan instead of querying the agent's belief store.perceive_grass_tilesandperceive_water_tilesentirely. No legacy shim per the no-backwards-compat rule.Unreachable(learned pathing failure with TTL) andTerritory(per-agent claim set once at spawn) — neither churns.Why
Audit on the issue showed 717K
MindGraphMutationevents over a 12-game-hour run, dominated by the perception lifecycle adding/removing(Tile, HasTrait, Grazable|Drinkable)triples as the agent walks in and out of vision. N agents perceiving the same grass tile produced N duplicate triples; the tile didn't change. Storing objective world state in a subjective belief store was the wrong abstraction.Test plan
TileType::has_traitandWorldMap::tiles_with_trait(src/world/map.rs)tests/test_graze.rs::grazing_deer_has_no_per_tile_grazable_beliefs(asserts no(Tile, HasTrait, Grazable)triples appear after grazing)tests/test_graze.rs::two_deer_both_graze_without_per_tile_beliefs(overlapping perception, both can graze, neither stores tile beliefs)hungry_deer_on_grass_grazes_and_reduces_hungerandhungry_deer_on_grass_enters_graze_action🤖 Generated with Claude Code