splinter-keep/tools/engine_lib/context.py
2026-06-30 21:18:35 +02:00

17 lines
558 B
Python

from __future__ import annotations
from .paths import CHAR_PATH, WORLD_PATH
from .prompts import SYSTEM_PROMPT
from . import state
def build_system_prompt() -> str:
"""Assemble the system prompt with current game state."""
char = state.read_file(CHAR_PATH) or "*No character sheet.*"
world = state.truncate_world(state.read_file(WORLD_PATH) or "") or "*No world state.*"
log = state.read_recent_log()
story = state.read_recent_book()
return SYSTEM_PROMPT.substitute(
character=char, world=world, log=log, story=story
)