feat: atomic extract-and-connect + stale PR monitor + response audit #4

Merged
m3taversal merged 70 commits from epimetheus/atomic-connect-and-stale-monitor into main 2026-03-30 11:03:35 +00:00
Showing only changes of commit 9267351aba - Show all commits

View file

@ -204,10 +204,27 @@ def _git_commit_archive(archive_path, filename: str):
def _load_learnings() -> str:
"""Load Rio's learnings file for prompt injection. Sanitized (Ganymede: prompt injection risk)."""
"""Load Rio's learnings file for prompt injection. Sanitized (Ganymede: prompt injection risk).
Dated entries older than 7 days are filtered out (Ganymede: stale learning TTL).
Permanent entries (undated) always included.
"""
try:
raw = Path(LEARNINGS_FILE).read_text()[:3000]
return sanitize_message(raw) # Same sanitization as user messages
raw = Path(LEARNINGS_FILE).read_text()[:4000]
today = datetime.now(timezone.utc).date()
lines = []
for line in raw.split("\n"):
# Check for dated entries [YYYY-MM-DD]
date_match = re.search(r"\[(\d{4}-\d{2}-\d{2})\]", line)
if date_match:
try:
entry_date = datetime.strptime(date_match.group(1), "%Y-%m-%d").date()
if (today - entry_date).days > 7:
continue # stale, skip
except ValueError:
pass
lines.append(line)
return sanitize_message("\n".join(lines))
except Exception:
return ""
@ -619,6 +636,7 @@ IMPORTANT: Two special tags you can append at the end of your response (after yo
1. If you learn something: LEARNING: [category] [what you learned]
Categories: factual, communication, structured_data
Only when genuinely learned something. Most responses have none.
NEVER save a learning about what data you do or don't have access to. Your knowledge base changes constantly — availability learnings become stale immediately.
2. If the user would benefit from an X search on a topic: RESEARCH: [search query]
This triggers an automatic X search. Use when the user asks about recent sentiment, community takes, or emerging discussions. Only when a search would genuinely help."""