Add dynamic seat-guidance layer to LLM following prompt#414
Merged
Conversation
Inject a situation-specific "Guidance for this seat" bullet into the following prompt, computed in code from the trick state so a small model no longer has to retrieve-then-apply the static rules itself. This is the surgical, per-seat layer the static system prompt couldn't be without global blast radius. - localBuildSeatGuidance: one applied bullet per (teammate-winning + safe / opponent-winning + points + trump-vs-offsuit / void / last-seat), naming concrete players and spelling out the beat-back inference. - Memory-aware boss: reuse isComboUnbeatable so a K is treated as boss once both Aces are played; "boss" is now strictly off-suit (trump uses an "unbeatable top trump" notion instead — there is no boss in trump). - #411.2 gate: when the player holds nothing that beats the current winner in-suit, guide to duck rather than dump a matching boss/point card. - #413: in a trump trick a regular K/10 isn't beat-back-proof — don't pour a point card into a trick a later active rank/joker captures. - Trick Win Security verdict extended: a trump trick where all remaining opponents are out of trump now reads as safe. - "Points still live" off-suit readout (localFormatLiveOffSuitPoints): unseen point-card value per side suit as a reference (counts both deck copies; kitty treated as unseen). - Static rules deduped against the guidance: §5.1 defers to the verdict, §9 trimmed to positional insight, §5.3 4th-player parenthetical dropped, boss-matching reframed as a heuristic. - prompt-refinement skill (v1.3.0): documents the seat-guidance layer and the requirement that its decision table stay aligned with §5/§6/§9. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
buildLLMUserPrompt now builds the engine's GameContext once and reads trick-winner analysis, per-player void memory, played-card memory, and attacking status from it — the same source the rule-based AI uses. - Remove detectSuitVoidsFromHistory (a second, independent void-detection algorithm that lived only in the LLM path and could drift from the memory system). Voids now project from MemoryContext.playerMemories (suitVoids + trumpVoid → the "Trump Group" string the prompt consumes), which also accounts for the in-progress trick. - Winner/points/trump-lead facts read from trickWinnerAnalysis; isAttacking and attackingPoints from the context; unbeatable detection is fed memoryContext.playedCards instead of re-gathering trick cards. - Off-suit boss detection is gated on the teammate winning (its only use), avoiding the isComboUnbeatable call when an opponent leads. Verified equivalent: a remaining opponent confirmed void in the led suit still flips a teammate's boss Ace to UNCERTAIN (ruff threat), and the memory-boss / can't-beat seat guidance is unchanged. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
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.
This PR implements a programmatic dynamic seat-guidance layer to the LLM following prompt and integrates it with the core engine's memory context.
Key Changes:
localBuildSeatGuidance):MemoryContextto retrieve player voids dynamically, eliminating the need to parse historical tricks on-the-fly.isComboUnbeatablefrom the engine to check if a teammate's currently winning card is an off-suit boss.localFormatLiveOffSuitPoints):STATIC_LLM_GAME_RULESfor better consistency and instructs the LLM on reading the seat-guidance section.prompt-refinement/SKILL.mdto version1.3.0documenting this architecture.