Adds time-gap awareness to _process_message in nanobot/agent/loop.py
When >5 minutes have passed since the last user message in a session, prepends [SYSTEM ANNOUNCEMENT: X minutes/hours/days have elapsed since last user message] to the current message content
Keeps the LLM aware of real time elapsed between conversation turns
Implementation Details
Walks session.messages in reverse to find the last user message timestamp
Uses datetime.fromisoformat() to parse the stored ISO timestamps
Threshold: 300s (5 min) → formats as minutes, hours, or days
## Summary
- Adds time-gap awareness to `_process_message` in `nanobot/agent/loop.py`
- When >5 minutes have passed since the last user message in a session, prepends `[SYSTEM ANNOUNCEMENT: X minutes/hours/days have elapsed since last user message]` to the current message content
- Keeps the LLM aware of real time elapsed between conversation turns
## Implementation Details
- Walks `session.messages` in reverse to find the last user message timestamp
- Uses `datetime.fromisoformat()` to parse the stored ISO timestamps
- Threshold: 300s (5 min) → formats as minutes, hours, or days
- Malformed timestamps silently skipped (try/except)
- Note: `session.add_message("user", ...)` runs **after** `build_messages`, so the reversed walk finds the *previous* user message — no off-by-one issue
- Only affects `_process_message`; `_process_system_message` (subagent announces) is unchanged
## Test plan
- [ ] Send two messages with >5 min gap — second message should log with `[SYSTEM ANNOUNCEMENT: X minutes have elapsed...]` prefix
- [ ] Send two messages with <5 min gap — no prefix injected
- [ ] Verify new session (no prior messages) — no prefix injected
🤖 Generated with [Claude Code](https://claude.ai/claude-code)
Adds elapsed-time awareness to _process_message. When >5 minutes have
passed since the last user message in a session, prepends a SYSTEM
ANNOUNCEMENT header so the LLM knows time has passed.
Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
Blocking a user prevents them from interacting with repositories, such as opening or commenting on pull requests or issues. Learn more about blocking a user.
Summary
_process_messageinnanobot/agent/loop.py[SYSTEM ANNOUNCEMENT: X minutes/hours/days have elapsed since last user message]to the current message contentImplementation Details
session.messagesin reverse to find the last user message timestampdatetime.fromisoformat()to parse the stored ISO timestampssession.add_message("user", ...)runs afterbuild_messages, so the reversed walk finds the previous user message — no off-by-one issue_process_message;_process_system_message(subagent announces) is unchangedTest plan
[SYSTEM ANNOUNCEMENT: X minutes have elapsed...]prefix🤖 Generated with Claude Code