drop turn_reaction.md: store_turn.py takes no args, outcome captured in next turn description

This commit is contained in:
Dejvino 2026-06-25 08:33:48 +02:00
parent 634e84b08b
commit 8a5072dcbd
3 changed files with 10 additions and 33 deletions

View File

@ -24,7 +24,6 @@ the-chaos/
├── log/ # Raw session logs by date ├── log/ # Raw session logs by date
├── turn_description.md # DM narrative for current turn ├── turn_description.md # DM narrative for current turn
├── turn_prompt.md # "What do you do?" prompt for current turn ├── turn_prompt.md # "What do you do?" prompt for current turn
└── turn_reaction.md # Player's raw reaction (filled, then rewritten)
``` ```
## First Steps (Fresh Session) ## First Steps (Fresh Session)
@ -67,10 +66,9 @@ The core loop for every turn:
2. **Ask the player** in the chat to act — they read the scene in the TUI, type their action, and come back here with the result. 2. **Ask the player** in the chat to act — they read the scene in the TUI, type their action, and come back here with the result.
3. **Process the turn:** 3. **Process the turn:**
a. Resolve outcomes mechanically — update `character.md`, `world.md`, `journal.md`, and append to `session/log/<today>.md`. a. Resolve outcomes mechanically — update `character.md`, `world.md`, `journal.md`, and append to `session/log/<today>.md`.
b. Rewrite `session/turn_reaction.md` as a coherent narrative continuation of the turn description using full markdown — reads like a book. b. Run `python3 tools/store_turn.py` to archive the turn description to `session/book.md` and clear turn temp files.
c. Run `python3 tools/store_turn.py "<reaction text>"` to append both description and reaction to `session/book.md` and clear all turn temp files.
4. **Generate a new turn:** 4. **Generate a new turn:**
a. Populate `session/turn_description.md` with the next scene's narrative using full markdown — **bold** for emphasis, *italic* for thoughts or sounds, `---` for scene breaks, lists for options or details, and quotes for dialogue. a. Populate `session/turn_description.md` with the next scene's narrative using full markdown — naturally narrating what happened in the previous turn as context. Use **bold** for emphasis, *italic* for thoughts or sounds, `---` for scene breaks, lists for options or details, and quotes for dialogue.
b. Populate `session/turn_prompt.md` with "What do you do?". b. Populate `session/turn_prompt.md` with "What do you do?".
c. Update `session/ambience.md` if the mood has changed. c. Update `session/ambience.md` if the mood has changed.

View File

@ -1 +0,0 @@
While he is busy, we should find a good hiding spot in the room, wait and see what happens.

View File

@ -1,12 +1,10 @@
#!/usr/bin/env python3 #!/usr/bin/env python3
"""Append a turn to the story book and clear turn temp files. """Archive the current turn to the story book and clear turn temp files.
Usage: Usage:
python3 scripts/store_turn.py "Dillion stepped into the chamber..." python3 tools/store_turn.py
python3 scripts/store_turn.py < reaction.txt
""" """
import sys
from pathlib import Path from pathlib import Path
from datetime import date from datetime import date
@ -14,39 +12,21 @@ SESSION = Path(__file__).resolve().parent.parent / 'session'
BOOK = SESSION / 'book.md' BOOK = SESSION / 'book.md'
TURN_DESC = SESSION / 'turn_description.md' TURN_DESC = SESSION / 'turn_description.md'
TURN_PROMPT = SESSION / 'turn_prompt.md' TURN_PROMPT = SESSION / 'turn_prompt.md'
TURN_REACTION = SESSION / 'turn_reaction.md'
CLEAR_FILES = [TURN_DESC, TURN_PROMPT, TURN_REACTION] CLEAR_FILES = [TURN_DESC, TURN_PROMPT]
def get_reaction() -> str:
if len(sys.argv) > 1:
return sys.argv[1]
if not sys.stdin.isatty():
return sys.stdin.read().strip()
return ''
def main(): def main():
reaction = get_reaction()
if not reaction:
print("No reaction text provided. Pass as argument or pipe stdin.")
sys.exit(1)
description = TURN_DESC.read_text().strip() if TURN_DESC.exists() else '' description = TURN_DESC.read_text().strip() if TURN_DESC.exists() else ''
if not description:
print("Nothing to store — turn_description.md is empty.")
return
timestamp = date.today().isoformat() timestamp = date.today().isoformat()
entry_parts = []
if description:
entry_parts.append(description)
if reaction:
entry_parts.append(reaction)
entry = '\n\n'.join(entry_parts)
heading = f'\n\n## Turn — {timestamp}\n\n' heading = f'\n\n## Turn — {timestamp}\n\n'
BOOK.parent.mkdir(parents=True, exist_ok=True) BOOK.parent.mkdir(parents=True, exist_ok=True)
with open(BOOK, 'a') as f: with open(BOOK, 'a') as f:
f.write(heading + entry + '\n') f.write(heading + description + '\n')
for fpath in CLEAR_FILES: for fpath in CLEAR_FILES:
if fpath.exists(): if fpath.exists():