HP and Inventory left to integrity of player
The current implementation of the game relies upon the honesty and integrity of the player. As the player goes around the dungeon, they are expected to record their inventory via the exported I shell variable. The battle(and other) scripts could query that variable, to ensure that the player has properly recorded that state.
It would also be possible to append a new line with each new item to a top-level .inventory to compare the acquired vs recorded items and respond accordingly.
Same for HP: during a battle, upon being hit there is no chance to record the change to HP nor a way to indicate 0 or even gulp negative hit points, resulting in player death or unconsciousness.