Skip to content

Auto-tag NPCs left behind during scene transitions #22

Description

@barrulus

Context

Issue #21 added scene tracking. When the LLM signals a `sceneTransition`, the named NPCs in `npcsInScene` are tagged with the new scene, but NPCs that should be "left behind" in the previous scene are not automatically tagged.

If an NPC has `scene_tag = NULL` (the default), they are treated as "general population" and remain visible in every scene the player enters. This means the village herder can still appear inside Kael's cottage simply because nobody told the system he should stay outside.

Proposed solution

When a `sceneTransition` is applied, for each NPC currently visible to the player but NOT in `npcsInScene`:

  • If the NPC has no `scene_tag`, set it to a sensible "left behind" scene derived from the player's previous scene (or the default outdoor scene of the burg if there was no previous scene). e.g. "outside in Dure village square".
  • This ensures NPCs are explicitly anchored somewhere instead of floating in the general pool.

Alternatively:

  • Extend the DM response schema with an `npcsLeftBehind` array so the LLM can be explicit about which NPCs stayed in the previous scene. Easier for the LLM to reason about.
  • Combine: auto-anchor untagged NPCs to the player's previous scene whenever a transition fires.

Why this matters

Without it, the scene filter only catches NPCs that have already been explicitly anchored. Newly-extracted NPCs and any NPC with no scene tag will continue to bleed across rooms.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions