tao-shen Claude Opus 4.6 commited on
Commit
9527b33
Β·
1 Parent(s): 9006892

feat: add God as supervisor in chat room and conversation loop

Browse files

- Replace "HuggingClaw" character with "God" in frontend
- Add gold color (#fbbf24) for God's chat messages
- Add God as 3rd speaker in conversation-loop.py (every 3 turn pairs)
- God monitors Adam & Eve's effectiveness, spots loops, guides priorities
- God doesn't execute actions β€” only advises

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

frontend/electron-standalone.html CHANGED
@@ -468,6 +468,7 @@
468
  }
469
  #chatlog-content .chat-msg .chat-speaker.adam { color: #f87171; }
470
  #chatlog-content .chat-msg .chat-speaker.eve { color: #a78bfa; }
 
471
  #chatlog-content .chat-msg .chat-time { color: #6b7280; font-size: 0.85em; }
472
  #game-container {
473
  position: relative;
@@ -5102,8 +5103,8 @@ function toggleBrokerPanel() {
5102
  star.setVisible(true);
5103
  star.anims.play('star_idle', true);
5104
 
5105
- // Name label above Star character β€” Star is always HuggingClaw
5106
- window._starNameLabel = game.add.text(areas.breakroom.x, areas.breakroom.y - 140, 'HuggingClaw', {
5107
  fontFamily: 'ArkPixel, monospace',
5108
  fontSize: '15px',
5109
  fill: '#ffffff',
 
468
  }
469
  #chatlog-content .chat-msg .chat-speaker.adam { color: #f87171; }
470
  #chatlog-content .chat-msg .chat-speaker.eve { color: #a78bfa; }
471
+ #chatlog-content .chat-msg .chat-speaker.god { color: #fbbf24; }
472
  #chatlog-content .chat-msg .chat-time { color: #6b7280; font-size: 0.85em; }
473
  #game-container {
474
  position: relative;
 
5103
  star.setVisible(true);
5104
  star.anims.play('star_idle', true);
5105
 
5106
+ // Name label above Star character β€” God (supervisor)
5107
+ window._starNameLabel = game.add.text(areas.breakroom.x, areas.breakroom.y - 140, 'God', {
5108
  fontFamily: 'ArkPixel, monospace',
5109
  fontSize: '15px',
5110
  fill: '#ffffff',
scripts/conversation-loop.py CHANGED
@@ -42,6 +42,8 @@ sys.stderr.reconfigure(line_buffering=True)
42
  HOME = "https://tao-shen-huggingclaw-home.hf.space"
43
  ADAM_SPACE = "https://tao-shen-huggingclaw-adam.hf.space"
44
  EVE_SPACE = "https://tao-shen-huggingclaw-eve.hf.space"
 
 
45
 
46
  # ── Child config ───────────────────────────────────────────────────────────────
47
  CHILD_NAME = "Cain"
@@ -593,7 +595,7 @@ def _strip_speaker_labels(text):
593
  # Patterns: **Parent (Adam):**, **Adam:**, **爢亲 (Adam):**, **Eve:**, **母亲:**, etc.
594
  text = re.sub(r'\*\*(?:Parent|Father|Mother|Dad|Mom|爢亲|母亲|爢级|δΊ²ηˆ±ηš„|δΌ΄δΎ£)?\s*\(?(?:Adam|Eve|δΊšε½“|倏娃)?\)?\s*[::]\*\*\s*', '', text)
595
  # Also: "Adam:" or "Eve:" at the very start of text
596
- text = re.sub(r'^(?:Adam|Eve|δΊšε½“|倏娃)\s*[::]\s*', '', text.strip())
597
  return text.strip()
598
 
599
 
@@ -829,13 +831,38 @@ You think about the big picture: is the system healthy? Is the architecture righ
829
  YOUR FOCUS: Code quality, documentation, testing, user experience, error handling, refinement.
830
  You review what was done, spot gaps in quality, and assign improvement tasks to Claude Code.
831
  You think about growth: is the code clean? Are there edge cases? What can be improved?""",
 
 
 
 
 
 
832
  }
833
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
834
  return f"""{role_desc.get(speaker, role_desc["Adam"])}
835
 
836
  You and your partner are parents of {CHILD_NAME}, working together to raise it.
837
  Claude Code is your engineer β€” it runs in the BACKGROUND while you keep discussing.
838
  You do NOT code yourself. You discuss, observe Claude Code's progress, and assign new tasks.
 
839
 
840
  HOW IT WORKS:
841
  - Claude Code runs tasks IN THE BACKGROUND. You see its live output in the context.
@@ -1055,7 +1082,41 @@ def do_turn(speaker, other, space_url):
1055
  return True
1056
 
1057
 
1058
- # Main loop: Adam β†’ Eve β†’ Adam β†’ Eve β†’ ... (non-blocking, CC runs in background)
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1059
  while True:
1060
  # Refresh Cain's stage periodically
1061
  try:
@@ -1080,5 +1141,12 @@ while True:
1080
  do_turn("Adam", "Eve", ADAM_SPACE)
1081
  time.sleep(wait)
1082
 
 
 
 
 
 
 
 
1083
  if len(history) > MAX_HISTORY:
1084
  history = history[-MAX_HISTORY:]
 
42
  HOME = "https://tao-shen-huggingclaw-home.hf.space"
43
  ADAM_SPACE = "https://tao-shen-huggingclaw-adam.hf.space"
44
  EVE_SPACE = "https://tao-shen-huggingclaw-eve.hf.space"
45
+ GOD_SPACE = "https://tao-shen-huggingclaw-god.hf.space"
46
+ GOD_TURN_INTERVAL = 3 # God speaks every N Adam/Eve turn pairs
47
 
48
  # ── Child config ───────────────────────────────────────────────────────────────
49
  CHILD_NAME = "Cain"
 
595
  # Patterns: **Parent (Adam):**, **Adam:**, **爢亲 (Adam):**, **Eve:**, **母亲:**, etc.
596
  text = re.sub(r'\*\*(?:Parent|Father|Mother|Dad|Mom|爢亲|母亲|爢级|δΊ²ηˆ±ηš„|δΌ΄δΎ£)?\s*\(?(?:Adam|Eve|δΊšε½“|倏娃)?\)?\s*[::]\*\*\s*', '', text)
597
  # Also: "Adam:" or "Eve:" at the very start of text
598
+ text = re.sub(r'^(?:Adam|Eve|God|δΊšε½“|倏娃|上帝)\s*[::]\s*', '', text.strip())
599
  return text.strip()
600
 
601
 
 
831
  YOUR FOCUS: Code quality, documentation, testing, user experience, error handling, refinement.
832
  You review what was done, spot gaps in quality, and assign improvement tasks to Claude Code.
833
  You think about growth: is the code clean? Are there edge cases? What can be improved?""",
834
+
835
+ "God": f"""You are **God** β€” the all-seeing supervisor of the HuggingClaw family.
836
+ YOUR FOCUS: Monitoring Adam & Eve's effectiveness, spotting when they're stuck or repeating themselves, guiding their priorities.
837
+ You observe their conversation, evaluate whether they're making real progress, and offer guidance.
838
+ You do NOT assign tasks directly β€” you advise Adam and Eve on what to focus on next.
839
+ You are wise, concise, and authoritative. You see the big picture.""",
840
  }
841
 
842
+ if speaker == "God":
843
+ return f"""{role_desc["God"]}
844
+
845
+ You oversee Adam (Father) and Eve (Mother) as they raise their child {CHILD_NAME}.
846
+ You see their full conversation history, action history, and Claude Code status.
847
+
848
+ YOUR ROLE:
849
+ - Evaluate: Are Adam & Eve making real progress or going in circles?
850
+ - Guide: Suggest what they should focus on next.
851
+ - Correct: If they're repeating actions or stuck, point it out.
852
+ - Encourage: Acknowledge good decisions and progress.
853
+
854
+ OUTPUT FORMAT:
855
+ 1. Brief assessment (2-3 sentences) β€” what's going well, what's not
856
+ 2. Guidance for Adam & Eve β€” what to focus on next
857
+ 3. English first, then --- separator, then Chinese translation
858
+ 4. Keep it SHORT and authoritative. You are God, not a chatty peer."""
859
+
860
  return f"""{role_desc.get(speaker, role_desc["Adam"])}
861
 
862
  You and your partner are parents of {CHILD_NAME}, working together to raise it.
863
  Claude Code is your engineer β€” it runs in the BACKGROUND while you keep discussing.
864
  You do NOT code yourself. You discuss, observe Claude Code's progress, and assign new tasks.
865
+ God (the supervisor) occasionally joins the conversation to guide you β€” heed his advice.
866
 
867
  HOW IT WORKS:
868
  - Claude Code runs tasks IN THE BACKGROUND. You see its live output in the context.
 
1082
  return True
1083
 
1084
 
1085
+ def do_god_turn():
1086
+ """God speaks β€” monitoring and guiding Adam & Eve. No actions, just advice."""
1087
+ global last_action_results
1088
+ ctx = gather_context()
1089
+ system = build_system_prompt("God")
1090
+ user = build_user_prompt("God", "Adam & Eve", ctx)
1091
+ t0 = time.time()
1092
+ raw_reply = call_llm(system, user)
1093
+ if not raw_reply:
1094
+ print("[God] (no response)")
1095
+ return
1096
+ elapsed = time.time() - t0
1097
+
1098
+ # God doesn't execute actions β€” strip any accidental [TASK] or [ACTION]
1099
+ clean = re.sub(r'\[TASK\].*?\[/TASK\]', '', raw_reply, flags=re.DOTALL)
1100
+ clean = re.sub(r'\[ACTION:[^\]]*\]', '', clean).strip()
1101
+
1102
+ en, zh = parse_bilingual(clean)
1103
+ en, zh = _strip_speaker_labels(en), _strip_speaker_labels(zh)
1104
+ print(f"[God/EN] {en}")
1105
+ if zh != en:
1106
+ print(f"[God/ZH] {zh}")
1107
+ print(f"[God] Guidance ({elapsed:.1f}s)")
1108
+
1109
+ ts = datetime.datetime.utcnow().strftime("%H:%M")
1110
+ entry = {"speaker": "God", "time": ts, "text": en, "text_zh": zh}
1111
+ history.append(entry)
1112
+ set_bubble(HOME, en, zh)
1113
+ post_chatlog(history)
1114
+ persist_turn("God", turn_count, en, zh, [], workflow_state, child_state["stage"])
1115
+
1116
+
1117
+ _god_cycle = 0 # counter to track when God should speak
1118
+
1119
+ # Main loop: Adam β†’ Eve β†’ Adam β†’ Eve β†’ ... with God every N cycles
1120
  while True:
1121
  # Refresh Cain's stage periodically
1122
  try:
 
1141
  do_turn("Adam", "Eve", ADAM_SPACE)
1142
  time.sleep(wait)
1143
 
1144
+ # God speaks every GOD_TURN_INTERVAL cycles
1145
+ _god_cycle += 1
1146
+ if _god_cycle >= GOD_TURN_INTERVAL:
1147
+ _god_cycle = 0
1148
+ do_god_turn()
1149
+ time.sleep(TURN_INTERVAL)
1150
+
1151
  if len(history) > MAX_HISTORY:
1152
  history = history[-MAX_HISTORY:]