feat: per-role inject_datetime toggle for system prompt

Each role can now disable the current date/time header injected into the
system prompt. Default is true (all existing roles unchanged). Useful for
pure processing roles (summarizer, classifier, translator) where temporal
context is irrelevant or could cause unexpected model behavior.

Changes:
- model_registry: set_role_config/get_role_config gain inject_datetime field
- context_loader: load_context gains inject_datetime param (default True)
- orchestrator router: passes inject_datetime from role_cfg to load_context
- local_llm router: reads inject_datetime from POST body, passes to registry;
  role_config_data_js includes the field
- local_llm.html: checkbox in role config panel; populate on open, save on submit

Session logs still timestamp every turn (HH:MM header in YYYY-MM-DD.md files)
regardless of this setting — the toggle only affects the system prompt header.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
Scott Idem
2026-05-08 21:53:35 -04:00
parent 8e512d4e11
commit 6ad7597db8
5 changed files with 53 additions and 23 deletions

View File

@@ -20,6 +20,7 @@ def load_context(
include_mid: bool = True,
include_short: bool = True,
role_append: str = "",
inject_datetime: bool = True,
) -> str:
"""
Build the system-prompt context block for a given tier and memory toggles.
@@ -38,9 +39,10 @@ def load_context(
inara_dir = persona_path()
parts = []
# ── 0. Current date and time (always — injected first so it's prominent) ──
now = datetime.now().astimezone()
parts.append(f"--- System ---\nCurrent date and time: {now.strftime('%A, %Y-%m-%d at %I:%M %p %Z')}")
# ── 0. Current date and time (per-role toggle — injected first so it's prominent) ──
if inject_datetime:
now = datetime.now().astimezone()
parts.append(f"--- System ---\nCurrent date and time: {now.strftime('%A, %Y-%m-%d at %I:%M %p %Z')}")
# ── 1. Core identity (always) ──────────────────────────────────
for filename in _CORE: