Skip to content

The fastest, cheapest, most efficient open-source agent harness. Run more than 500 agents on a $10 VPS.

fix(scripts): correct prompt breakdown for empty input

Steven Enamakel81ea4ef7d2f3
diff --git a/scripts/debug/prompt-breakdown.mjs b/scripts/debug/prompt-breakdown.mjs
index f775efa1b0..4f183abab6 100644
--- a/scripts/debug/prompt-breakdown.mjs
+++ b/scripts/debug/prompt-breakdown.mjs
@@ -83,7 +83,10 @@ export function splitSections(text) {
if (!inFence && !openTag) {
const h = /^(#{1,6})\s+(.*)$/.exec(line);
if (h) {
- push({ title: `${h[1]} ${h[2].trim()}`, level: h[1].length, lines: [line], children: [] });
+ // `### SOUL.md`-style lines mark an injected workspace file: they sit
+ // above the file's own `#` headings, whatever their hash count.
+ const level = /^[\w.-]+\.md$/.test(h[2].trim()) ? 0.25 : h[1].length;
+ push({ title: `${h[1]} ${h[2].trim()}`, level, lines: [line], children: [] });
continue;
}
const t = /^<([A-Za-z_][\w.-]*)(\s[^>]*)?>\s*$/.exec(line);