tao-shen Claude Opus 4.6 commited on
Commit
c32d600
·
1 Parent(s): 67854aa

fix: ban Gradio from agent discussions + sanitize history

Browse files

1. Add explicit "⛔ BANNED: Gradio" instruction at top of every turn message
2. Replace Gradio mentions in conversation history with [BANNED-WORD]
to prevent agents from re-discussing old Gradio approaches

Root cause: Eve kept discussing Gradio because old conversation turns
mentioning it were fed back as context, causing a feedback loop.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>

Files changed (1) hide show
  1. scripts/conversation-loop.py +6 -2
scripts/conversation-loop.py CHANGED
@@ -1836,6 +1836,7 @@ def build_turn_message(speaker, other, ctx):
1836
  }
1837
  parts.append(f"{role_hints.get(speaker, '')} Your partner is {other}.")
1838
  parts.append(f"Claude Code is your engineer — runs in background. You discuss and assign tasks, you do NOT code.")
 
1839
 
1840
  # Discussion/execution balance strategy
1841
  push_alert = "" if _turns_since_last_push < 5 else f" ⚠️ {_turns_since_last_push} TURNS SINCE LAST PUSH!"
@@ -1890,11 +1891,14 @@ def build_turn_message(speaker, other, ctx):
1890
  parts.append(f"{'='*60}")
1891
  return "\n".join(parts) # Return early - agent should just wait
1892
 
1893
- # Conversation history
1894
  if history:
1895
  parts.append("\n=== RECENT CONVERSATION ===")
1896
  for h in history[-15:]:
1897
- parts.append(f"{h['speaker']}: {h['text'][:3000]}")
 
 
 
1898
 
1899
  # Action history — what's already been done (prevents repetition)
1900
  ah_text = format_action_history()
 
1836
  }
1837
  parts.append(f"{role_hints.get(speaker, '')} Your partner is {other}.")
1838
  parts.append(f"Claude Code is your engineer — runs in background. You discuss and assign tasks, you do NOT code.")
1839
+ parts.append(f"⛔ BANNED: Gradio. {CHILD_NAME}'s Space uses sdk:docker + FastAPI + uvicorn on port 7860. NEVER mention or use Gradio/gr.Interface/.launch().")
1840
 
1841
  # Discussion/execution balance strategy
1842
  push_alert = "" if _turns_since_last_push < 5 else f" ⚠️ {_turns_since_last_push} TURNS SINCE LAST PUSH!"
 
1891
  parts.append(f"{'='*60}")
1892
  return "\n".join(parts) # Return early - agent should just wait
1893
 
1894
+ # Conversation history (sanitize banned terms to prevent re-infection)
1895
  if history:
1896
  parts.append("\n=== RECENT CONVERSATION ===")
1897
  for h in history[-15:]:
1898
+ text = h['text'][:3000]
1899
+ # Strip Gradio references from old turns to prevent agents re-discussing it
1900
+ text = re.sub(r'[Gg]radio', '[BANNED-WORD]', text)
1901
+ parts.append(f"{h['speaker']}: {text}")
1902
 
1903
  # Action history — what's already been done (prevents repetition)
1904
  ah_text = format_action_history()