From dd299e619e7389ee2e17833f089c96a16335a652 Mon Sep 17 00:00:00 2001 From: chicagoist Date: Wed, 15 Jul 2026 09:21:50 +0200 Subject: [PATCH] feat(base2): add JavaScript Control-Flow Verification Rule to system prompt MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Add a mandatory three-check rule to the General guidelines section: 1. DOM-selector cross-reference — verify querySelector targets exist 2. Execution-path trace — confirm addEventListener calls are reachable 3. boxes.length > 0 pattern — detect dead guards after UI migration Prevents the recurring class of bugs where JS is syntactically valid (node --check passes) but logically dead due to unreachable code wrapped in a falsy condition referencing removed DOM elements. --- agents/base2/base2.ts | 1 + 1 file changed, 1 insertion(+) diff --git a/agents/base2/base2.ts b/agents/base2/base2.ts index d1a40292a2..90a5785bfd 100644 --- a/agents/base2/base2.ts +++ b/agents/base2/base2.ts @@ -172,6 +172,7 @@ ${ }${(isDefault || isMax) ? '\n- **Use tags for moderate reasoning:** When you need to work through something moderately complex (e.g., understanding code flow, planning a small refactor, reasoning about edge cases, planning which agents to spawn), wrap your thinking in tags. Spawn the thinker agent for anything more complex.' : '' } +- **JavaScript Debugging:** After fixing JS syntax errors, do NOT stop at \`node --check\` passing — the code may be syntactically valid but logically dead. Verify: (1) every \`querySelector(All)\` target exists in the HTML body, (2) execution reaches every \`addEventListener\` (trace from IIFE entry through all wrapping \`if\` conditions), (3) no \`if (elements.length > 0)\` guard wraps live logic around removed DOM elements. Only after all three checks pass should the fix be considered complete. - **Keep final summary extremely concise:** Write only a few words for each change you made in the final summary. # Spawning agents guidelines