Feature: Macro System with {{char}}, {{user}}, {{speaker}} substitution #17
Labels
No labels
audit-2025-12-03
component/api
component/commands
component/llm
component/memory
component/tick-loop
component/tools
priority
high
priority
low
status
in-progress
status
needs-info
status
needs-triage
status
on-hold
type
bug
type
documentation
type
enhancement
type
feature
type
refactor
type
test
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
blightbow/evennia_ai#17
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Summary
Implement a macro substitution system for prompt templates, compatible with SillyTavern/V3 character card conventions but adapted for multi-user MUD environments.
Key Design:
{{user}}vs{{speaker}}Problem: SillyTavern character cards reference
{{user}}as a fixed relationship:In MUDs, many players interact with one assistant. If
{{user}}= current speaker, everyone becomes the spouse/ward.Solution: Two distinct macros:
{{char}}{{user}}{{speaker}}Macro Categories
Identity Macros
{{char}}- Assistant character name (fixed){{char_key}}- Assistant character dbref{{user}}- Configured partner entity (fixed){{user_key}}- Configured partner dbref{{speaker}}- Current message sender (dynamic){{speaker_key}}- Current message sender dbrefLocation Macros
{{location}}- Current room name{{location_desc}}- Current room description{{exits}}- Available exits (formatted){{present}}- Characters in room (excluding self)Game State Macros
{{time}}- In-game time (if available){{weather}}- Weather state (if available){{date}}- In-game date (if available)Implementation
New Files
macros.py- MacroRegistry, MacroContext, resolve_macros()Modified Files
assistant_script.py- Adddb.user_entityattributehelpers/- Addset_user_entity(),get_user_entity(),clear_user_entity()prompt_templates.py- Call macro resolutionCommands
aisetup /macro- List available macrosaisetup /macro user <entity>- Set {{user}} bindingaisetup /macro user clear- Remove bindingTests
tests/test_macros.pyReferences
script.js:substituteParams()