Rebase onto upstream (a4d95fd)
#12
@@ -54,10 +54,6 @@ Skills with available="false" need dependencies installed first - you can try in
|
||||
|
||||
def _get_identity(self) -> str:
|
||||
"""Get the core identity section with runtime context."""
|
||||
from datetime import datetime
|
||||
import time as _time
|
||||
now = datetime.now().strftime("%Y-%m-%d %H:%M (%A)")
|
||||
tz = _time.strftime("%Z") or "UTC"
|
||||
workspace_path = str(self.workspace.expanduser().resolve())
|
||||
system = platform.system()
|
||||
runtime = f"{'macOS' if system == 'Darwin' else system} {platform.machine()}, Python {platform.python_version()}"
|
||||
@@ -69,9 +65,6 @@ Skills with available="false" need dependencies installed first - you can try in
|
||||
- Send messages to users on chat channels
|
||||
- Spawn subagents for complex background tasks
|
||||
|
||||
## Current Time
|
||||
{now} ({tz})
|
||||
|
||||
## Runtime
|
||||
{runtime}
|
||||
|
||||
|
||||
@@ -293,8 +293,11 @@ class AgentLoop:
|
||||
if isinstance(cron_tool, CronTool):
|
||||
cron_tool.set_context(msg.channel, msg.chat_id)
|
||||
|
||||
# Prepend time-gap notice if >5 minutes since last user message
|
||||
current_message = msg.content
|
||||
# Prepend current time + optional time-gap notice to every user message
|
||||
now_dt = datetime.now()
|
||||
tz = time.strftime("%Z") or "UTC"
|
||||
time_str = now_dt.strftime("%Y-%m-%d %H:%M (%A)")
|
||||
current_message = f"[Current time: {time_str} {tz}]\n{msg.content}"
|
||||
last_user_ts = None
|
||||
for m in reversed(session.messages):
|
||||
if m.get("role") == "user":
|
||||
@@ -303,7 +306,6 @@ class AgentLoop:
|
||||
if last_user_ts:
|
||||
try:
|
||||
last_dt = datetime.fromisoformat(last_user_ts)
|
||||
now_dt = datetime.now()
|
||||
elapsed_seconds = (now_dt - last_dt).total_seconds()
|
||||
if elapsed_seconds > 300: # 5 minutes
|
||||
if elapsed_seconds < 3600:
|
||||
@@ -312,7 +314,7 @@ class AgentLoop:
|
||||
gap_str = f"{int(elapsed_seconds // 3600)} hours"
|
||||
else:
|
||||
gap_str = f"{int(elapsed_seconds // 86400)} days"
|
||||
current_message = f"[SYSTEM ANNOUNCEMENT: {gap_str} have elapsed since last user message; take this into account when replying to user]\n\n{msg.content}"
|
||||
current_message = f"[SYSTEM ANNOUNCEMENT: {gap_str} have elapsed since last user message; take this into account when replying to user. Ask about it if appropriate]\n\n{current_message}"
|
||||
except (ValueError, TypeError):
|
||||
pass # Malformed timestamp — skip silently
|
||||
|
||||
|
||||
Reference in New Issue
Block a user