Spaces:
Running
Running
Commit History
-
v4.5 - update Dockerfile, sync_hf.py; add local-whisper skill
e82ae2b
-
Update scripts/sync_hf.py
Verified signature1d986ce -
Update scripts/sync_hf.py
Verified signature1ea0575
-
perf: all Claude Code calls use Skills (/fix-cain, /fix-loop)
Static instructions now live in .claude/commands/ as custom slash commands: - /fix-cain: worker skill for Cain tasks (rules, Dockerfile/FastAPI, speed) - /fix-loop: God skill for fixing conversation-loop.py (commit convention, rules) Prompts only pass dynamic content (task description or diagnosis). Claude Code caches skill instructions, reducing per-call token usage. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>119850e -
perf: God 2-step monitoring — diagnose first, Claude Code only when needed
God now polls every 2min with a 2-step process: 1. Lightweight LLM call (~150 tokens, cheap model) to assess system health 2. Only if [PROBLEM] detected → launch Claude Code to fix (expensive) When system is healthy, God costs ~150 tokens per check instead of ~10k+. Estimated savings: ~80% of God's token budget since most checks are healthy. Also includes heuristic fallback if LLM diagnosis call fails. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>3bd2669 -
perf: API budget pacing — stretch usage from 3h to 5h
- God interval: 2min → 5min (biggest consumer, ~60% of budget) - God timeout: 10min → 5min - God skips when nothing changed (no new turns/pushes/stage changes) - CC Worker timeout: 5min → 3min (faster iteration, less token per task) - Turn interval: 15s → 25s (reduce A2A fallback frequency) Estimated savings: ~40% reduction, extending 3h budget to ~5h. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>eddf38e -
merge: adopt God's 25 iterations on discussion/execution balance
God received our push-frequency tracking and iterated 25 times to refine CC timeout, auto-completion detection, pending task tracking, and zero-push warnings. Adopting God's latest version as canonical. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>d737f0d -
feat: enforce discussion/execution balance — push frequency + trial-and-error
Merge God's improvements + add discussion/execution balance: - Push frequency tracking (_push_count, _turns_since_last_push, _last_push_time) - God monitors push frequency as #1 metric for "all talk no action" - Emergency loop-break lowered from 5→3 turns with concrete fix tasks - Discussion warning escalates at 1 turn (reminder) and 2 turns (stop) - Cooldown reduced from 6→3 min, clears on error states too - Turn message includes discussion vs execution strategy - God CLAUDE.md prioritizes push frequency over other issues Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>2b1ad32 -
feat: enforce discussion/execution balance — push frequency tracking + trial-and-error
- Add push count, turns-since-push, last-push-time tracking - God now monitors push frequency as #1 metric for detecting "all talk no action" - Lower emergency loop-break from 5→3 turns, discussion warning from 2→1 turn - Reduce cooldown from 6→3 minutes to enable faster iteration - Add explicit discussion vs execution strategy to turn messages - Forced emergency tasks now target actual errors (e.g. Gradio→Docker fix) - Update README with discussion/execution balance documentation Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>00f5dcc
-
feat: migrate all Claude Code invocations to ACP protocol via acpx
All Claude Code calls now go through ACP (Agent Client Protocol) using acpx as the backend, replacing direct CLI invocations. This includes conversation-loop.py, coding-agent extension, and infrastructure config. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>9d3acbc -
refactor: migrate Adam & Eve from direct Zhipu API to A2A protocol
- Replace call_llm() with send_a2a_message() using Google A2A JSON-RPC - Each agent (Adam/Eve) is now an OpenClaw instance with own memory/SOUL - conversation-loop.py becomes lightweight coordinator, not LLM caller - Remove centralized family memory (Module 4b) — OpenClaw handles this - Simplify prompt building into build_turn_message() (context only) - Update architecture diagram to v4 (A2A) - Net reduction: -173 lines Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>1db1d7b -
feat: add agent memory + God silent mode
- Adam & Eve memory: leverages OpenClaw's ~/.openclaw/workspace/memory/ system - Persistent markdown memory file (family-conversation.md) - Agents can save learnings via [MEMORY: ...] tags - Auto-backed up by openclaw_persist.py to HF Dataset - Loaded into system prompt each turn - God chatlog: only posts when making actual changes - No more "starting review" announcements - Uses [PROBLEM] and [FIX] markers in output - Silent when no issues found Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>545b0e0 -
docs: update README architecture to v3 with God supervisor
- Architecture diagram reflects 3-layer autonomy: Adam & Eve (Zhipu GLM), Claude Code worker, and God (Claude Code supervisor) - Added God agent description and self-improving system explanation - Updated agent table with roles and God entry - Updated Space table with current purposes - conversation-loop.py synced with deployed version (God as Claude Code, 2-min polling, dynamic chatlog messages, no rate-limit sleep) Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>49660e8
-
feat: inject top priority directive — Cain must use HuggingClaw Docker architecture
Creator's directive: Cain should mirror the parent HuggingClaw project (Node.js + OpenClaw + sync_hf.py + persistence), not a simple Python Gradio app. Injected as #1 priority in Adam/Eve system prompt. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>7e88878 -
feat: add God as supervisor in chat room and conversation loop
- 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>9527b33 -
fix: add action history to prevent agents from repeating same actions
Agents were stuck in a loop: repeatedly calling delete_env:grep_cmd and restart every turn because they couldn't see what they'd already done. Now accumulates action history across turns and injects it into context with "ACTIONS ALREADY DONE (do NOT repeat these)" header. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>9006892 -
fix: use correct kebab-case flag --dangerously-skip-permissions
The camelCase --dangerouslySkipPermissions was causing "unknown option" error (exit=1), breaking all Claude Code execution on Home Space. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>9354a89 -
fix: enable Claude Code to actually write files (skip permissions + prompt)
- Add --dangerouslySkipPermissions flag to claude CLI invocation - Add explicit instruction in task prompt: "You have FULL permission, do NOT ask for permission, just make changes directly" - Fixes the loop where CC would analyze code but never edit files, repeatedly asking "Shall I proceed?" and exiting with no changes Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>3ebdf62 -
fix: adaptive pacing + anti-repetition when CC output is stale
- Track _cc_stale_count: how many turns CC output hasn't changed - Adaptive interval: 15s → 30s → 45s → ... → max 105s when stale - After 2 stale turns, prompt agents to discuss future plans/features instead of repeating CC status observations - Log [PACE] when slowing down so monitoring can see why Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>2ac3479 -
feat: parallel discussion + async Claude Code execution
Architecture change: Adam/Eve no longer block waiting for Claude Code. - CC runs in background thread via cc_submit_task() - Agents discuss every 15s, seeing CC's live output in context - cc_get_live_status() shows: WORKING (with recent output), FINISHED, or IDLE - Agents assign [TASK] when CC is idle, discuss progress when CC is busy - cc_live_lines deque shares streaming output between CC and discussion - Removed nudge logic (not needed — discussion is natural when CC is busy) - Main loop simplified: no blocking, no skipping turns Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>426eeb0 -
fix: strip redundant speaker labels, add timestamps, protect delete_env
- Strip "**Parent (Adam):**" etc. from message text (already labeled) - Add HH:MM timestamps to chatlog entries, display in frontend - delete_env now requires actual variable/secret collision before deleting (prevents agents from blindly deleting legitimate variables) Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>121b371 -
feat: distinct father/mother roles + mandatory [TASK] every turn
- Adam (Father): architecture, infrastructure, deployment, security - Eve (Mother): code quality, docs, testing, UX, refinement - Each turn: discuss with partner → assign [TASK] to Claude Code - If no [TASK] produced, nudge LLM once to produce one - System prompt now receives speaker name for role-specific instructions Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>21e2a50 -
feat: force every turn to produce a [TASK] for Claude Code
- System prompt: agents are "task assigners", MUST output [TASK] every turn - If no [TASK] found in reply, nudge LLM once to produce one - Even during BUILDING/RESTARTING, agents assign review/planning tasks - No more "discussion only" turns — every turn goes through Claude Code Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>bc327e3 -
feat: stream Claude Code output to conv-loop log with [CC] prefix
- Replace subprocess.run(capture_output) with Popen streaming, so each line of Claude Code output appears in real-time with [CC] prefix - Add [CC-RESULT] summary (800 chars) after each claude_code action - Both opening turn and do_turn() now log CC results Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>8a21cd0 -
feat: add delete_env action + collision auto-detection
- Add [ACTION: delete_env:KEY] to delete env vars that collide with secrets - action_get_env() now detects and flags variable/secret name collisions - System prompt teaches agents to use delete_env for CONFIG_ERROR fixes - This is the correct fix: OPENAI_API_KEY exists as both Variable and Secret Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>ddef022 -
refactor: conversation-loop v2 — Claude Code as primary executor
Complete architecture change: - OLD: GLM picks from 15+ actions, manually reads files/writes code (badly) - NEW: GLM discusses situation → outputs [TASK] for Claude Code → Claude Code clones repo, analyzes, fixes, pushes autonomously Key changes: - gather_context() auto-collects health, env, files each turn - System prompt teaches agents they're "project managers", not coders - parse_and_execute_turn() routes [TASK] blocks to action_claude_code() - Removed: sub-agent delegation, emoji parser, 5-state machine, knowledge dedup, ACT-phase guard, write dedup — all replaced by Claude Code - Added: CONFIG_ERROR knowledge (HF env var / secret name collision) - Kept: cooldown, building-state guard, chatlog, persistence, bilingual output 885 lines (was 1630, -45%) Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>f3f1288 -
fix: use --user flag for pip install (non-root container)
Container runs as node user, not root. pip install without --user can't write to system site-packages. Also log pip result for debugging. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>5c981dd -
fix: install requests at runtime before launching conversation-loop
Dockerfile layer cache may not pick up the new dependency. Install requests via pip at runtime as a fallback to guarantee availability. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>f532fc8 -
feat: add /api/conv-loop-log endpoint for remote diagnostics
token-redirect.cjs: serve last 50 lines of conversation-loop.log via GET /api/conv-loop-log for remote monitoring without container access. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>8d482fd -
feat: run conversation-loop on Home Space cloud + CONFIG_ERROR fixes
- sync_hf.py: auto-launch conversation-loop.py on OFFICE_MODE=1 (Home Space) with 60s startup delay, auto-restart on crash, graceful shutdown - conversation-loop.py: add claude_code action for Claude Code CLI integration - conversation-loop.py: fix CONFIG_ERROR not clearing write dedup, cooldown, and state transitions (was only handling RUNTIME_ERROR/BUILD_ERROR) Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>acab3db -
feat: integrate Claude Code as coding-agent backend (z.ai/Zhipu GLM)
Replace custom HF API tools with Claude Code CLI sub-agent. The extension now spawns `claude -p` with ANTHROPIC_BASE_URL=api.z.ai to autonomously clone, analyze, fix, and push code changes to HF Spaces. - Dockerfile: install @anthropic-ai/claude-code globally - index.ts: 3 tools (claude_code, hf_space_status, hf_restart_space) - sync_hf.py: add ZAI_API_KEY env var passthrough - plugin.json: add zaiApiKey config field, bump to v2.0.0 Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>d653b4e -
feat: add coding-agent OpenClaw extension with 8 HF Space tools
New extension at extensions/coding-agent/ that registers tools directly into OpenClaw's agent runtime, giving Adam & Eve real coding capabilities: Tools registered: - hf_read_file: Read files from Space/Dataset - hf_write_file: Write files with auto Python syntax validation - hf_delete_file: Delete files from repos - hf_list_files: List all files in a repo - hf_space_status: Check Space health/stage - hf_restart_space: Restart the target Space - hf_search_code: Grep-like regex search across code files - python_syntax_check: Validate Python syntax before committing Key features: - Python .py files are syntax-checked BEFORE writing (prevents the blind-write-then-wait-for-build-failure loop) - Configured via CODING_AGENT_TARGET_SPACE/DATASET env vars - Follows A2A gateway extension pattern (registerTool API) Also adds: - workspace-templates/ with IDENTITY.md and SOUL.md for coding agent behavior (deployed on first boot if workspace files are default) - Dockerfile updated to COPY ex…b44dfca -
fix: clear write dedup when Cain is RUNNING but API unresponsive
files_written_this_cycle only cleared on API success or BUILD/RUNTIME_ERROR, but never when stage=RUNNING with unresponsive API. This permanently blocked agents from re-writing files to fix issues, causing them to spin for 17+ turns unable to apply their code fixes. Now clears dedup on RUNNING state too, so agents can iterate on fixes. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>7a1ef1c -
feat: persist Adam & Eve conversation to HF Dataset
Every turn is saved as a JSONL record to tao-shen/HuggingClaw-Home-data at conversation-log/chatlog.jsonl. Records include timestamp, speaker, bilingual text, actions with results, workflow state, and child stage. - Buffer 3 turns then flush to HF Dataset (reduces API calls) - Also writes to /tmp/conversation-loop-full.jsonl as local backup - Flushes on SIGTERM/exit so no data lost when process is killed - Re-buffers on flush failure to prevent data loss Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>b447519 -
fix: move global declaration to function top to fix SyntaxError
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>1956abb -
fix: defer cooldown to end of turn so agents can batch file ops
Previously, each write/delete to Space immediately activated the rebuild cooldown, blocking subsequent file ops in the SAME turn. This caused agents to self-lock: delete requirements.txt (cooldown starts) → can't write app.py. Now cooldown activates AFTER all actions in a turn complete, allowing agents to atomically modify multiple files (e.g., delete + write) in one turn. Also adds delete_file to cooldown guard — it was previously unguarded, letting agents trigger unlimited rebuilds via deletions. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>42eb3e9 -
feat: add delete_file action so agents can remove conflicting files
Agents couldn't delete Dockerfile when switching to sdk:gradio mode, causing persistent BUILD_ERROR. Now they can use: [ACTION: delete_file:space:Dockerfile] [ACTION: delete_file:dataset:PATH] Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>00e404d -
fix: add sdk:gradio vs sdk:docker warning — Dockerfile ignored in gradio mode
Agents kept writing Dockerfile fixes (pip uninstall, FROM python:3.X) that had zero effect because README.md has sdk:gradio, which makes HF ignore Dockerfile entirely. Added explicit warning to check sdk field first. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>2291ba7 -
fix: add pip uninstall hint for cached deps + torch OOM warning
Agents kept hitting pydub error even after removing from requirements.txt because Docker cached it. Added: 1) pip uninstall trick for stubborn deps, 2) grep code for imports, 3) warning against torch/transformers on free tier. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>b85abe9 -
fix: add HF Docker cache override warning + retry strategy rule
Agents were stuck in a loop rewriting Dockerfile to change Python version (4+ times) while HF Spaces kept ignoring the base image change. Added: 1. Warning that HF may override Python version in base image 2. Rule: if same fix fails 3+ times, change strategy (remove dep, not env) Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>39d732e -
fix: prevent wasted actions from Chinese action names in LLM output
GLM-4.5 sometimes translates action syntax to Chinese in the Chinese section (e.g. [ACTION: 写入文件:空间:PATH]), wasting 50% of actions. Added explicit rule that action syntax must be English only. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>6ee803b -
fix: fetch runtime logs in check_health when RUNNING but API unresponsive
Agents were blind-guessing why Cain's API wasn't responding because check_health only returned "Running but API not responding" with no logs. Now fetches last 10 lines of runtime logs, giving agents concrete errors. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>f1156b1 -
fix: add HF Spaces port 7860/Gradio constraint to agent system prompt
Agents were removing gradio from requirements.txt thinking it caused OOM, but HF Spaces requires port 7860 binding (via Gradio) to transition from APP_STARTING to RUNNING. Without this knowledge, agents go in circles. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>4653fc1 -
fix: allow write_file during APP_STARTING so agents can fix stuck startups
APP_STARTING was incorrectly grouped with BUILDING/RESTARTING in write-blocking guards. During BUILDING, writes reset the build. But during APP_STARTING, writes trigger a NEW build — which is exactly what agents need to fix a stuck startup (e.g. wrong entrypoint, blocking restore script, missing deps). This caused agents to diagnose the problem correctly but be unable to apply fixes, wasting entire grace periods on read-only diagnostics. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>8cab3f9 -
fix: add grace period after smart-wait timeout for consecutive agent turns
After timeout, agents got only 1 turn before re-entering 5min wait (Eve diagnosed but couldn't fix, Adam was SKIP'd, then back to wait). Now: timeout grants 3 consecutive Eve+Adam turn pairs (grace period). Also: APP_STARTING no longer triggers SKIP during grace period, so both agents can diagnose and write fixes before waiting resumes. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>a5f444a -
fix: add smart-wait timeout to prevent infinite APP_STARTING polling
After 15 polls (~5 min) with no stage change, smart-wait exits and resumes normal agent turns so they can diagnose why Cain is stuck. Previously, APP_STARTING could block agents indefinitely (observed 34+ polls / 11+ minutes with no escape). Counter resets on any stage change. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>d2dcafa -
fix: clear write-dedup and knowledge cache on RUNTIME_ERROR/BUILD_ERROR
When Cain enters RUNTIME_ERROR, agents need to re-read and re-write files to fix the crash. Previously, files_written_this_cycle only cleared on successful RUNNING state, trapping agents in an infinite diagnose-verify loop where they could never apply their fix (1 success vs 9 blocks on app.py over 46 turns). Now check_health clears both write-dedup and knowledge-read caches when RUNTIME_ERROR or BUILD_ERROR is detected, unblocking the fix path. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>5782191 -
fix: change break→continue in action guards to preserve multi-action turns
When a single action was blocked by safety guards (rebuild cooldown, ACT-phase guard, knowledge dedup), the `break` statement terminated the entire action-parsing loop, discarding all remaining actions in the LLM's multi-action output. Changed to `continue` so blocked actions are skipped while the rest still execute. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>ea70f5d -
feat: multi-action turns + sub-agent delegation + GLM-4.5
Major redesign of conversation-loop mechanism: - Model: GLM-4.7 → GLM-4.5 (user requested) - Multi-action: up to 5 actions per turn (was 1) - Sub-agent delegation: [ACTION: delegate:TASK] spawns focused sub-agents with their own LLM calls - Parallel delegation: multiple delegate tasks run concurrently via ThreadPoolExecutor - Updated system prompt teaches agents to batch reads, delegate parallel tasks, and work as project managers - Increased max_tokens to 2400 for richer multi-action responses - Turn timing adjusted to 20s for heavier turns Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>e91c753 -
perf: major efficiency overhaul for conversation-loop mechanism
1. Dynamic cooldown: auto-clears when build finishes instead of fixed 10min wait. Polls HF API to detect BUILDING→RUNNING/ERROR. 2. Smart wait during BUILDING: skips LLM API calls entirely when Cain is building/restarting. Polls health every 20s instead, saving API costs and avoiding wasted turns. 3. Reduced base cooldown from 600s to 360s (6 min). 4. Knowledge cache clearing: after write_file, the file is removed from the "already read" cache so agents can re-read to verify. 5. Per-cycle file write dedup: blocks writing the same Space file twice in one build cycle, preventing overwrites. 6. Cycle reset on RUNNING: write dedup set clears when Cain successfully enters RUNNING state. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>869a98d