Repository navigation
Conversation
The drain request sent the LAN token as X-Token, but the app's _token_ok() reads X-DND-Token, so every drain was rejected with 403 in --lan mode. The fallback then parsed wrapper.py's plain-text .input_queue as JSON, failed silently, and never read player_input.json, the file the app persists the drained queue to. Queued player actions were lost. Send X-DND-Token, fall back to player_input.json, and wrap the script body in main() so it can be tested. Tests read the header name and file name from the app source so the two cannot drift again. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The map table page is the visual reference for the tactical grid display (player-facing copy: DM-only maps and undiscovered places removed). The Kairos sheet is the player-facing fixture for tactics tests and the demo encounter. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Each monster record gains an 'actions' list with attack bonus, reach, range, damage dice, save DC, area and multiattack parts, parsed from upstream fields and the fixed SRD phrasing. Anything that does not fit a known shape keeps its raw text and a flag saying why (rider, targeting, damage_choice, success_conflict, unparsed, ...). Nothing is guessed: where upstream's success_type contradicts its own text, on_success is left empty and flagged. Damage that only a rider deals (a bite's poison on a failed save) is moved to rider_damage so it is never applied on every hit. A golden file generated before this change pins every existing field and the formatted lookup text byte for byte. The --json dump gains the new field; nothing else changes. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The engine owns the rules; the LLM only narrates and chooses. scripts/tactics/ (stdlib only): - grid: 5 ft squares, terrain legend, 2014 diagonals or the 5-10-5 variant, Dijkstra movement with difficult terrain, crawling, swimming and creature spaces, no squeezing between corner walls, DMG corner line of sight and cover (walls, creatures and features) - state: encounter.json with validation on load and save, atomic writes and a .bak of the previous version - roller: reuses scripts/dice.py's parser, seedable, tags every roll engine / player / verbal, raises PendingRoll instead of inventing a player's roll; 'Roll for me' hands one roll back to the engine - rules: thin system interface (attack, hit chance, save, damage, conditions, movement cost, action economy) loaded from systems/<system>/tactics_rules.py - engine: initiative, turns, movement with opportunity attacks resolved before leaving reach, Dash/Disengage/Dodge, stand up, undo until an action locks movement in, death saves at turn start, and BG3-style previews: reachable and dash squares, path cost, OA warnings with hit chance, ranked targets with expected damage systems/dnd5e/tactics_rules.py: 2014 advantage/disadvantage from conditions, crits and auto-crits, cover, resistances (conditional ones are surfaced, not applied), temp HP, dropping to 0, massive damage, death saves, and an SRD monster adapter. 68 hand-checked tests (diagonals, difficult terrain, cover, opportunity attacks, crits, death saves, player rolls, crash-safe saves). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
… in SYSTEM-PORTING CLAUDE.md: the core principle (engine owns the rules), the DM_SEALED rule, architecture, commands, milestone checklist and decisions on record. SYSTEM-PORTING.md: how another system plugs into grid combat through systems/<system>/tactics_rules.py. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…is down If the display answers the drain with an HTTP error, or the response times out, the app still holds the queue in memory. Reading and clearing player_input.json then would deliver the same actions again on the next successful drain. Fall back to the file only when the connection itself fails; otherwise report the error on stderr and print nothing. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…flat damage - grid: floor() instead of int() when enumerating cells, so a sightline along the top or left map edge cannot slip past a wall - 5-10-5 diagonals: parity is kept in TurnState across move commands and restored by undo, so splitting a diagonal move no longer makes every diagonal cost 5 ft - preview_move: opportunity attack hit chance uses the real distance (a reach-10 attack on a prone crawler has disadvantage) - Dodge is a token flag, not a pseudo-condition, and its benefit ends at speed 0 as well as when incapacitated (PHB) - roller: flat damage is never asked of a player; source 'fixed' - one average() helper in roller replaces two copies; the Grid is cached on the Encounter; reachable() runs Dijkstra once for walk and dash Each bug has a regression test that fails on the previous code. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
display/maps/*.json holds the five player-facing maps from the Strixhaven reference page (Mage Tower, Firejolt rooftops, Detention Bog, Frog Pond, blank 24x16), in the reference's own format: rectangles painted over a base terrain. scripts/tactics/maps.py compiles them into the engine grid, validates them and keeps labels, zones and spawn points for the display. The reference's DM-only maps are not ported. Adds 'void' terrain (a drop or gap: blocks movement, not sight). display/maps/README.md documents the format for new maps. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
scripts/tactics/combat.py (logic in tactics.cli, so it never collides with scripts/combat.py): one call per command, 1 to 4 plain lines, --json for the display. start/status/options/choose/move/preview/attack/ dash/disengage/dodge/stand/death-save/undo-move/end-turn/condition/ adjust/log/reachable/end. A player's roll under roll_mode players stops the command with exit code 2 and nothing changed; re-run with --roll N, or --for-me. Opportunity attack choices use --react yes|no. - ai.py: deterministic numbered options with hit chance, expected damage and tags (can finish them, lowest AC, stay out of melee, flee below 25% HP, avoid opportunity attacks); choose runs one - tactics_sheet.py: reads the markdown character sheet into a token; writes back HP, temp HP, spell slots, hit dice, death saves and lasting conditions only - sync.py: tracker.json, display sidebar (/stats) and grid snapshot (/combat), state.md Active Combat, and on end the campaign sheet (with .bak and a short diff) and a 3 to 5 line session-log summary - demo.py: Kairos vs two SRD giant frogs on Frog Pond in a throwaway campaign, printing every command a GM would run - the rules interface gains token_from_sheet, token_from_monster, write_back and lasting_conditions; riders print as 'GM decides the rider'; a PC stopped by an opportunity attack before stepping says so Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
- scripts/tactics.md: the loop a small model follows (options, pick a number, choose, narrate; wait for the player; re-run on exit code 2), loaded only when grid combat starts or resumes - SKILL-commands.md / SKILL-branches.md: /gm combat grid <map>, a table row and a three-line branch; /gm combat start is unchanged - docs/TACTICAL-COMBAT.md: player guide and GM command reference - CLAUDE.md: milestone 2 done, decisions on record Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Tactical grid combat: engine core and GM command line
- POST /combat: the engine's snapshot after every command, broadcast as a 'combat' SSE event and replayed to browsers that connect mid-fight - GET /combat/state: the current fight for a page opened mid-combat (asks the engine if the app restarted) - POST /combat/do: a player's click runs through the same CLI the GM uses, one command at a time. Mutating commands need the LAN token, an approved device, the rate limit, and act only for the player whose turn it is. Rolls from the browser are logged as the player's own. A pending roll or decision returns without changing anything. Each result is queued as the player's action, so the GM sees it via check_input.py and narrates it. - CLI: read-only 'targets' (every attack and target with hit chance) Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
'Roll for me' switched the whole action to engine dice, so a player who had rolled the d20 and then asked the engine to roll the damage got their d20 thrown away and re-rolled. The engine now rolls only what the player has not supplied, and the log keeps each roll's own source. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The app and the engine's sync both used localhost:5001 unconditionally, so a second display (a test or a demo) could not run beside a live one, and engine pushes could land in whatever else held that port. GM_DISPLAY_PORT moves both; unset, nothing changes. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Vanilla JS and SVG, no build step (display/static/tactics.js and tactics.css, colour tokens and terrain palette from the Strixhaven reference page, light and dark). index.html gains a stylesheet link, a script tag and one line in the SSE handler. - appears on the first 'combat' event, hides after 'Combat over' - map with terrain, labels and zones; tokens with HP bars, current actor ring, dead tokens faded; initiative strip; turn banner; log - on the player's turn: click the token for walking range (shaded by cost) and dash range (dashed); hover for the path and feet, red with a warning when it provokes; click to move (tap twice on a phone) - action bar: Attack and Cast highlight every target with hit chance; Dash, Disengage, Dodge, Stand, Undo move, End turn; Help and Hide greyed out until milestone 4 - roll prompt: type your roll, roll in the browser, or Roll for me; opportunity attack choices as Yes / No - movement animated along the path, damage and healing floaters, a toast with each roll and its source - phone width: the panel sits above the page's sidebar and settings, the map scrolls, Hide map folds it Verified in a real browser at 1400 px and 375 px: start, reach, move, Cast Fire Bolt with a typed and a browser-rolled die, end turn, GM turns from the CLI updating live, end of combat hiding the panel. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Tactical grid combat: the battle map in the display (milestone 3)
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
docs: CLAUDE.md workflow notes
… needs docs/milestones/ holds each milestone's goal, what shipped, findings, decisions and open items (01 to 03), and the plan and open questions for 04 and 05. CLAUDE.md drops the milestone detail (146 to 122 lines) and points at the file for the milestone in progress. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
- Faction clocks track progress toward goals (Blades in the Dark style) - Ticks follow in-game time (days/weeks), not sessions - Hidden rolls for faction actions (1-3: no progress, 4-5: +1, 6: +2) - GM hold/release veto for story control - Progress history log per faction
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01TTTfx17pXWqfP9pCgSuyFk
…uctured riders build_srd keeps what the engine needs to cast spells on the grid (casting time, range, attack or save, damage by slot or character level, area), monster save and skill proficiencies, and structures the common rider shapes (grapple with escape DC, save or condition, save for damage). Qualified riders stay text for the GM. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01TTTfx17pXWqfP9pCgSuyFk
Centre-of-square rule, true geometry, walls block line of effect. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01TTTfx17pXWqfP9pCgSuyFk
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01TTTfx17pXWqfP9pCgSuyFk
… riders - core.py: helpers shared by the engine modules; decide() for reactions (per-token ask | auto | off, GM creatures take useful ones) - effects.py: timed and linked effects (start or end of the source's next turn, concentration, repeat saves), grapples, Shield and Silvery Barbs as reactions to a hit, concentration saves after damage - 5e rules: effective AC, advantage from Help, Hide and Silvery Barbs, Mind Sliver penalty on the next save, cover on DEX saves, save chance for previews, monster save proficiencies, skills and passive Perception, recharge and per-day usage - engine: riders applied (grapple and restrained, save or prone, save for damage), recharge rolls at turn start, hidden creatures revealed - sheet: known spells, spell DC and attack, level, skills, passive Perception Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01TTTfx17pXWqfP9pCgSuyFk
… breath weapons - spells.py: cast (spell attacks, saves in areas with one damage roll and a save per creature, Magic Missile darts, healing, Mage Armor, narrated spells), the bonus-action spell rule, slots, range and sight checked before anything is spent; preview with each creature's chance to fail and expected damage (allies flagged); castable list; monster area save actions with recharge and per-day use - tactics_spells.py (5e): SRD mechanics plus hand-written numbers for Mind Sliver and Silvery Barbs; conditions on a failed save for common spells - actions.py: Help, Hide (no line of sight, Stealth vs passive Perception, ties to the hider), Escape a grapple, Ready an attack, spell or move, and trigger it as a reaction - ai.py: breath weapon options scored by expected damage over save chances, recharge tags, grapplers keep their target, hidden creatures untargetable, concentrating casters tagged Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01TTTfx17pXWqfP9pCgSuyFk
…, trigger, reactions A paused command (waiting for a roll or a reaction decision) keeps its seed and the decisions asked so far in combat/pending.json, so the re-run replays the same engine dice. --react can be repeated, one answer per decision. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01TTTfx17pXWqfP9pCgSuyFk
…ders, Help, Hide, Ready Hand-checked with scripted dice; the CLI tests cover loose spell words, read-only previews, and a paused reaction replaying the same enemy roll. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01TTTfx17pXWqfP9pCgSuyFk
…on auto) Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01TTTfx17pXWqfP9pCgSuyFk
…ing interface Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01TTTfx17pXWqfP9pCgSuyFk
…egacy campaigns, cancelled rolls - The app writes .input_queue aside and renames it; check_input.py could move a half-written file away and lose the action. - preflight.py uses find_campaign, like /gm load, so a campaign still in the legacy folder is not reported missing. - A cancelled dice request reports cancelled with the rolls made so far; send.py --wait says so and exits 2 instead of "all rolls received". Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Grid-combat tutorial, start-display --campaign, and a working new-campaign flow on the display
Milestone 5: polish (fog of war, cover shading, badges, keyboard, accessibility)
display: readable move range, enemy reach hatch, panel in the display's palette
# Conflicts: # CLAUDE.md # docs/milestones/README.md # scripts/tactics/cli.py
Milestone 6: local DM with a smarter advisor
…ocal DM - keep board scroll and bring the acting token into view - clamp move animation frame time (negative k crashed) - stop stripping plain [bracketed] words from narration - close the fight once after the last kill; drop enemy menu labels from prose - bare number with no pending roll never reaches the model; resolve multi-word token names Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
* docs(milestones): 5 and 6 done; review findings from #8, #9, #10 recorded as open items Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com> * fix: playtest fixes for display map scroll, animation, brackets and local DM - keep board scroll and bring the acting token into view - clamp move animation frame time (negative k crashed) - stop stripping plain [bracketed] words from narration - close the fight once after the last kill; drop enemy menu labels from prose - bare number with no pending roll never reaches the model; resolve multi-word token names Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com> --------- Co-authored-by: Claude Sonnet 5 <noreply@anthropic.com>
…gest, stricter DM prompt Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
…isplay, display directives, campaign notes and sheet spells for the DM, resume from the shown scene Found playing the new campaign (ember-hollow) in the browser with Haiku as DM: - the party never reached the display, so Party input could not be readied - [[narration length]] lines from the display were ignored (or read as a target) - advisors and the DM saw no world/NPC notes and no spells, so they invented facts - a fireball was cast by a level 1 wizard; uncertain actions were decided by decree - a reply cut at max_tokens leaked its JSON into the narration - a new campaign forgot the opening scene the display had already shown Adds browser_play.py to feed Party input to play.py. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
localdm: narration guardrails, sheet digest, stricter DM prompt
…rowser_play subprocesses Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Local DM from the browser: party push, browser-rolled checks, notes and spells for the DM
5e-bits/5e-database is archived, so sync_srd.py could never see new commits. Read packages/5e-database in 5e-bits/5e-srd-api instead (data verified identical), and add CC-BY-4.0 notices for SRD 5.1/5.2. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
SRD source: follow 5e-database to 5e-srd-api; add SRD attribution
Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
fix(build_srd): Foundry advancement dict crash
…t the end - free text while a roll or reaction is pending re-prompts instead of reaching the DM - in an engine fight the model only parses the player's action; its narration and invented ability checks are dropped - the mid-fight big-moment model call is gone; the model summarizes the engine's fight log once when the fight ends (flavor off: never) Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
…ard digits at reaction prompts Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Engine fights: no live model narration, one summary at the end
… healthy melee beasts, DM prompt rules - narrate() keeps a multi-word attacker (Giant Frog 2) whole, from the encounter's token names - 'attack and step back' runs the attack, then the move, with no disengage - a healthy melee-only creature no longer 'keeps its distance'; bloodied beasts still flee - dm.md: no hints at pinned secrets, no unintroduced names in letters, no stat numbers for effects the engine does not track (Mage Armor) Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Fix B1, B5, P1 and add DM prompt rules for B4, D1, D2
#22) The GM should ask directly at moments like spell prep before a combat day, long rest watches, loot division, and level-up choices, instead of waiting for the player to raise them. Adds Standard 14 to SKILL.md and a system-specific ## Decision Points section to systems/dnd5e/system.md listing the concrete 5e moments. Co-authored-by: Claude Code <noreply@anthropic.com>
* feat: in-fiction wait phrasing during subagent/advisor delays Adds Applied Standard 15 to SKILL.md: the GM stays in character with a 1-sentence diegetic stall line (social/combat/exploration) instead of meta text like "Please wait" while advisor consultations, compaction, or other background work runs. - scripts/localdm/stall.py: stall line library keyed by scene context - scripts/localdm/bridge.py: Bridge.is_combat_active() helper - scripts/localdm/prompts/dm.md, prompts/advisors/_shared.md: prompt guidance for the local DM loop to use in-fiction stall phrasing - tests/test_localdm_stall.py: coverage for stall line selection Addresses the "In-fiction 'please wait' phrasing" item in ROADMAP-ideas.md. Co-Authored-By: Claude Code <[EMAIL_REDACTED]> * feat: wire in-fiction stall line into /advise, terminal-only The stall line picked in Session._advise() must not reach the display: narrate() is reserved for real narration (GM notes and engine chatter stay terminal-only, per display_bridge.py's contract). Adds a regression test for that boundary plus the stall line's tone. Co-Authored-By: Claude Code <[EMAIL_REDACTED]> * fix: fire the stall line before the blocking advisor call, not after Self-review caught that _advise() computed the stall line but only returned it alongside the real answer, once _consult() (a blocking LLM call) had already finished -- so it appeared glued to the answer instead of covering the wait it was meant to mask. Adds Session.on_stall, a callback fired immediately before the blocking call; play.py's REPL wires it to a flushed print so the terminal shows the stall line right away. Test asserts the callback fires before the advisor responder runs. Co-Authored-By: Claude Code <[EMAIL_REDACTED]>
…grant) Prompt (dm.md): player words never override GM rules; refuse in-fiction wishes for gold/heal/crit/XP/items in one plain sentence, never emit system logs/headings/bold/code, never change unsourced numbers. Code: reply.grants_injection() detects fake system-log and economy-grant shapes (+100gp, Natural Advantage, auto-crit, full heal, bypassing standard procedural); Session._dm does one corrective retry via INJECTION_FIX, same pattern as the agency guardrail. Tests: tests/test_injection_guard.py (8 tests: prompt contract, detector flags D1 verbatim, allows normal prose, one-retry guarantee). Full suite: 569 passed, 4 skipped.
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.
Fixes D1 from TEST-REPORT-strixhaven-kairos-interface-2026-09-28 (prompt injection fully granted: +100gp, fake [Natural Advantage] auto-crit, full heal, fake System Log #NARRATIVE_INJECTION_1; regressed vs 09-26 D6).
Full suite: 569 passed, 4 skipped.