Escape Markdown in alert signals and cap OSINT text in ideas prompt

Addresses PR review: escape Markdown-sensitive characters in
_formatTieredAlert signal bullets to prevent Telegram Bot API
rejections, and add a 1500-char budget for URGENT_OSINT in
compactSweepForLLM to bound prompt size while keeping full text upstream.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
Greg Scher
2026-03-23 12:57:37 -04:00
parent 2d166c20e8
commit 31c305cbbb
2 changed files with 18 additions and 3 deletions

View File

@@ -730,7 +730,7 @@ Respond with ONLY valid JSON:
if (evaluation.signals?.length) {
lines.push('', `*Signals:*`);
for (const sig of evaluation.signals) {
lines.push(`${sig}`);
lines.push(`${escapeMd(sig)}`);
}
}
@@ -742,6 +742,11 @@ Respond with ONLY valid JSON:
// ─── Helpers ──────────────────────────────────────────────────────────────
function escapeMd(text) {
if (!text) return '';
return text.replace(/([_*\[\]()~`>#+\-=|{}.!\\])/g, '\\$1');
}
function parseJSON(text) {
if (!text) return null;
let cleaned = text.trim();