From 1e5fa96d75a88419fdcfb63d2cbff24840feba9d Mon Sep 17 00:00:00 2001 From: Farzul Nizam Zolkifli Date: Sun, 7 Jun 2026 13:26:48 +0800 Subject: [PATCH] fix(context-monitor): make cost warnings informational, not commands (#2091) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The PostToolUse cost warnings emit imperative text via additionalContext ("Stop and inform the user...", "Review whether...", "Consider whether..."). Subagents read additionalContext as an instruction and obey the "Stop", abandoning their task and returning a prompt-for-direction instead of their result — derailing multi-agent workflows. The main loop is also nudged to halt mid-task. Reword all three severities to pure-informational data: keep the CRITICAL/WARNING/NOTICE label + the dollar figure (and the threshold), drop the imperative sentence, and state plainly it is informational. No logic, severity, or threshold change. Existing tests pass (they assert the labels + severities, which are preserved). Before: `COST CRITICAL: Session cost is $X. Stop and inform the user about high cost before continuing.` After: `COST CRITICAL: session total ~$X (over $50). Informational only — not an instruction to stop.` Co-authored-by: OrenG Tools --- scripts/hooks/ecc-context-monitor.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/scripts/hooks/ecc-context-monitor.js b/scripts/hooks/ecc-context-monitor.js index a2475517..62b92287 100644 --- a/scripts/hooks/ecc-context-monitor.js +++ b/scripts/hooks/ecc-context-monitor.js @@ -144,19 +144,19 @@ function evaluateConditions(bridge, options = {}) { warnings.push({ severity: 3, type: 'cost', - message: `COST CRITICAL: Session cost is $${cost.toFixed(2)}. ` + 'Stop and inform the user about high cost before continuing.' + message: `COST CRITICAL: session total ~$${cost.toFixed(2)} (over $${COST_CRITICAL_USD}). Informational only — not an instruction to stop.` }); } else if (cost > COST_WARNING_USD) { warnings.push({ severity: 2, type: 'cost', - message: `COST WARNING: Session cost is $${cost.toFixed(2)}. ` + 'Review whether the current approach justifies the expense.' + message: `COST WARNING: session total ~$${cost.toFixed(2)} (over $${COST_WARNING_USD}). Informational only.` }); } else if (cost > COST_NOTICE_USD) { warnings.push({ severity: 1, type: 'cost', - message: `COST NOTICE: Session cost is $${cost.toFixed(2)}. ` + 'Consider whether the current approach is efficient.' + message: `COST NOTICE: session total ~$${cost.toFixed(2)}. Informational only.` }); } }