Skip to content

feat: carry NPC conversation session context#103

Merged
JOY (JOY) merged 1 commit into
devfrom
codex/conversation-sessions
May 20, 2026
Merged

feat: carry NPC conversation session context#103
JOY (JOY) merged 1 commit into
devfrom
codex/conversation-sessions

Conversation

@JOY
Copy link
Copy Markdown
Contributor

Summary

  • Carry conversation_session_id and trigger_event_id from Unity NPC decision requests into Nakama.
  • Inject the active conversation session into the DOS.AI decision prompt, including objective, participants, current turn count, turns remaining, and compact transcript summary.
  • Seed new conversation sessions with the triggering player line so the first NPC reply and later follow-ups have shared context.
  • Add a regression test proving a later player question sees both the original player line and the previous NPC answer in the model prompt.

Why

NPC chat was model-backed, but each model decision could still feel stateless. This patch makes the current Nakama conversation session part of the prompt, so follow-up questions can reference what was just said instead of sounding like a fresh call.

Safety

  • LLM output still goes through the existing validated intent path.
  • Session context is read-only prompt context. It does not let the model mutate authoritative game state.
  • Unity client sends only session identifiers and trigger identifiers, not provider keys or model credentials.

Local Code Review Fallback

Verdict: APPROVED.

Verification

  • TDD red: new prompt-history assertion failed because conversation_session was missing from the DOS.AI prompt.
  • npm.cmd run build in backend/nakama
  • npm.cmd test in backend/nakama
  • git diff --check --cached
  • Staged-file em-dash scan

Verification Note

dotnet build Unity\SecondSpawn.AI.csproj could not be completed inside the isolated worktree because Unity-generated project files and Library package assemblies are ignored and not present there. Copying .csproj files locally still left Unity package references such as Unity.InputSystem unresolved. The C# change is limited to adding DTO string fields and assigning existing string values; Unity compile should be checked from the main Unity checkout or Editor after merge.

Unrelated Files Left Out

The worktree has a generated knowledge-pack line-ending touch from npm run build; it is intentionally not staged.

@JOY JOY (JOY) merged commit 0f0c6f5 into dev May 20, 2026
1 check passed
@JOY JOY (JOY) deleted the codex/conversation-sessions branch May 20, 2026 18:13
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.

1 participant