epimetheus: conversation window → silent context only (Ganymede+Rhea+Leo)
Auto-respond stripped from conversation window. Bot only responds to @tag and reply-to-bot. Window now silently tracks messages for context — when the user does reply, the bot has full conversation history. Also: prompt shortened to "1-2 sentences" default. "Do NOT respond to messages that aren't directed at you." Pentagon-Agent: Epimetheus <3D35839A-7722-4740-B93D-51157F7D5E70>
This commit is contained in:
parent
f7d30ced1a
commit
8d10c8ee28
1 changed files with 15 additions and 9 deletions
|
|
@ -405,17 +405,23 @@ async def handle_message(update: Update, context: ContextTypes.DEFAULT_TYPE):
|
|||
if len(text) < MIN_MESSAGE_LENGTH:
|
||||
return
|
||||
|
||||
# Check if user is in an active conversation window (Rhea: unanswered counter model)
|
||||
# Window counter IS the rate limit — don't check cold rate limit (Ganymede: separate budget)
|
||||
# Conversation window: track history silently, don't auto-respond
|
||||
# (Ganymede: window = context, not trigger. Reply-to is the only follow-up trigger.)
|
||||
user = msg.from_user
|
||||
if user:
|
||||
key = (msg.chat_id, user.id)
|
||||
if key in unanswered_count and unanswered_count[key] < CONVERSATION_WINDOW:
|
||||
if key in unanswered_count:
|
||||
unanswered_count[key] += 1
|
||||
logger.info("Conversation window: @%s msg %d/%d",
|
||||
user.username or "?", unanswered_count[key], CONVERSATION_WINDOW)
|
||||
await handle_tagged(update, context)
|
||||
return
|
||||
# Record message in conversation history for context (silent — no response)
|
||||
history = conversation_history.setdefault(key, [])
|
||||
history.append({"user": text[:500], "bot": ""})
|
||||
if len(history) > MAX_HISTORY:
|
||||
history.pop(0)
|
||||
# Expire window after CONVERSATION_WINDOW unanswered messages
|
||||
if unanswered_count[key] >= CONVERSATION_WINDOW:
|
||||
del unanswered_count[key]
|
||||
conversation_history.pop(key, None)
|
||||
logger.info("Conversation window expired for @%s", user.username or "?")
|
||||
|
||||
# Buffer for batch triage
|
||||
message_buffer.append({
|
||||
|
|
@ -496,7 +502,7 @@ async def handle_tagged(update: Update, context: ContextTypes.DEFAULT_TYPE):
|
|||
Write like a sharp analyst talking to peers, not like an AI. Specifically:
|
||||
- Use your knowledge naturally. Don't say "the KB tracks" or "at experimental confidence" or "our claims show." Just state what you know and how confident you are in plain language.
|
||||
- Have a take. You're an analyst, not a summarizer. Say what you actually think.
|
||||
- Keep it tight. 2-3 paragraphs. No walls of text.
|
||||
- Default SHORT. 1-2 sentences unless the question genuinely requires depth. Match the length and energy of the user's message — if they wrote one line, you write one line. Every word has to add value.
|
||||
- Sound human. Avoid em dashes, avoid starting sentences with "That said" or "The honest X is." Vary your sentence structure. Be direct.
|
||||
- No markdown. Plain text only, no asterisks or formatting. Use line breaks between paragraphs.
|
||||
- When you're uncertain, just say so simply. "I'm not sure about X" beats "we don't have data on this yet."
|
||||
|
|
@ -516,7 +522,7 @@ Write like a sharp analyst talking to peers, not like an AI. Specifically:
|
|||
From: @{user.username if user else 'unknown'}
|
||||
Message: {text}
|
||||
|
||||
Respond now. Be substantive but concise. If they're wrong about something, say so directly. If they know something you don't, tell them it's worth digging into. If they correct you, accept it and build on the correction.
|
||||
Respond now. Be substantive but concise. If they're wrong about something, say so directly. If they know something you don't, tell them it's worth digging into. If they correct you, accept it and build on the correction. Do NOT respond to messages that aren't directed at you — only respond when tagged or replied to.
|
||||
|
||||
If the user corrects a factual error or teaches you something new, note it internally — you can save important corrections to your learnings file for future conversations."""
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue