Klin12/my-personal-assistant
OpenClaw on Hugging Face Spaces - Smart Auto-Detection System
๐ฏ What This Does
This is an intelligent OpenClaw deployment that automatically detects the best way to run OpenClaw in Docker and uses it. No manual configuration needed!
The Smart System
Docker Build Time:
โ
Install OpenClaw
โ
Investigate its structure
โ Check for SDK exports
โ Find server files
โ Map available APIs
โ
Save investigation results
Runtime:
โ
Smart Gateway starts
โ
Method 1: Try OpenClaw SDK
โ (if fails)
Method 2: Try direct server execution
โ (if fails)
Method 3: Enhanced custom fallback
โ
โ Gateway running!โจ Key Features
๐ Auto-Detection
- Investigates OpenClaw during Docker build
- Tries multiple methods to run it
- Automatically falls back if needed
- You get the best possible implementation
๐จ Multiple Modes
Mode 1: OpenClaw SDK (Best)
- โ Full OpenClaw features
- โ Multi-channel support
- โ Plugin system
- โ Native UI
Mode 2: Direct Execution (Good)
- โ Most OpenClaw features
- โ Direct server access
- โ ๏ธ May have limited APIs
Mode 3: Enhanced Custom (Fallback)
- โ Core chat functionality
- โ Conversation history
- โ Persistent storage
- โ Web-only (no Telegram/Discord)
๐ Quick Setup
1. Required Secrets
Go to Space Settings โ Variables and secrets, add:
2. Files Already Uploaded โ
These files should already be in your Space:
- โ
Dockerfile- Investigates & installs OpenClaw - โ
smart-gateway.js- Auto-detecting gateway - โ
storage-adapter.js- HF Dataset sync - โ
start.sh- Startup script - โ
README.md- This file
3. Access Your Assistant
Once the Space builds (3-5 minutes), access at:
https://Klin12-my-personal-assistant.hf.space๐ How to Check What's Running
During Build (Check Logs Tab)
Look for investigation results:
=== OpenClaw Investigation Results ===
Package.json main entry: dist/index.js
Module exports: { success: true, ... }During Runtime (Check Logs Tab)
Look for success messages:
OpenClaw SDK mode:
[Method 1] โโโ SUCCESS! OpenClaw Gateway started via SDKDirect execution mode:
[Method 2] โโโ SUCCESS! Server started from direct fileCustom fallback mode:
[Method 3] โโโ Enhanced custom gateway running on port 7860In the Web Interface
The badge shows which implementation is running:
- ๐ข "OpenClaw SDK" = Full OpenClaw features
- ๐ก "Enhanced Custom Gateway" = Fallback mode
Via API
curl -H "Authorization: Bearer YOUR_AUTH_TOKEN" \
https://Klin12-my-personal-assistant.hf.space/api/status๐ What You Get
Best Case: Method 1 Success ๐
- โ Full OpenClaw features
- โ Multi-channel support (Telegram, Discord, Slack)
- โ Plugin system
- โ Advanced conversation management
- โ Tool use capabilities
Good Case: Method 2 Success ๐
- โ Most OpenClaw features
- โ Direct server access
- โ Core functionality
- โ ๏ธ Some advanced features may be limited
Fallback Case: Method 3 ๐ช
- โ Web chat interface (modern, responsive)
- โ Conversation history (persistent)
- โ Multi-turn context preservation
- โ Google Gemini AI integration
- โ Auto-sync to HF Dataset
- โ Web-only (no Telegram/Discord)
- โ No plugin system
Either way, you get a fully functional AI assistant!
๐จ Customization
Change AI Model
Add to Space secrets:
GEMINI_MODEL=gemini-2.5-pro # More powerful
# or
GEMINI_MODEL=gemini-2.0-flash # FasterAvailable models:
gemini-2.5-flash- Latest, fast (default)gemini-2.5-pro- Most capablegemini-2.0-flash- Fast and efficient
Adjust Sync Frequency
SYNC_INTERVAL=30000 # 30 seconds (default: 10000)Force Fallback Mode (for testing)
FORCE_CUSTOM_GATEWAY=true๐ ๏ธ Troubleshooting
Build Fails
Check:
- All 4 secrets are set correctly
- Dataset repository exists
- HF_TOKEN has write permissions
Fix:
- Review build logs for specific errors
- Verify all files are uploaded
- Check Space settings
Can't Access Web Interface
Check:
- Build completed successfully (Status: "Running")
- No errors in Logs tab
- URL is correct:
https://Klin12-my-personal-assistant.hf.space
Fix:
- Wait for build to complete
- Force rebuild by editing README (add a space)
- Check firewall/VPN settings
Gateway Not Responding
Check:
- GOOGLEAPIKEY is set and valid
- Auth token matches in request
- Logs show gateway started successfully
Fix:
- Verify API key at https://aistudio.google.com/app/apikey
- Check you haven't exceeded API quota (1000 req/day free)
- Restart Space if needed
Data Not Syncing
Check:
- HF_TOKEN has write permissions
- Dataset repo is accessible
- No rate limiting errors in logs
Fix:
- Increase SYNC_INTERVAL to reduce API calls
- Verify token permissions
- Check dataset repo commits tab
๐ Understanding the System
Why This Approach?
The Problem:
- OpenClaw CLI uses
systemctlfor service management - Docker containers don't have systemd
- Can't run
openclaw gateway startnormally
The Solution:
- Investigate OpenClaw's structure during build
- Find how to run it without systemctl
- Try multiple methods in order
- Use whichever works!
What Makes It Smart?
- โ Adapts automatically to OpenClaw's structure
- โ Works with future updates without manual changes
- โ Tries multiple approaches for maximum compatibility
- โ Always provides a working gateway
- โ Transparent - shows exactly what it's doing
Investigation Report
During build, creates:
/app/investigation/exports.json- Module analysis/app/investigation/package.json- OpenClaw metadata/app/investigation/tree.txt- Directory structure/app/investigation/js-files.txt- JavaScript files/app/investigation/gateway-search.txt- Gateway locations/app/investigation/server-search.txt- Server code locations
๐ก Pro Tips
- Check build logs to see investigation results
- Monitor runtime logs to see which method succeeded
- Use status API to verify mode and features
- Bookmark your Space URL for quick access
- Set dataset to Private for sensitive conversations
๐ Resources
- Your Space: https://huggingface.co/spaces/Klin12/my-personal-assistant
- Your Dataset: https://huggingface.co/datasets/Klin12/openclaw-data
- Space Settings: https://huggingface.co/spaces/Klin12/my-personal-assistant/settings
- Google AI Studio: https://aistudio.google.com/app/apikey
- HF Tokens: https://huggingface.co/settings/tokens
๐ Cost Breakdown
Perfect for personal use! For production or high-volume, consider upgrading.
๐ฏ Next Steps
- โ Secrets are configured
- โ Files are uploaded
- โณ Wait for build (3-5 min)
- ๐ Check logs to see which mode
- ๐ Start chatting with your assistant!
โ FAQ
Q: Which mode will I get? A: Depends on OpenClaw's structure. The system will automatically use the best available method. Check logs to see!
Q: Can I force a specific mode? A: Yes, set FORCE_CUSTOM_GATEWAY=true to use fallback mode.
Q: Will this work with future OpenClaw updates? A: Yes! The investigation system adapts automatically.
Q: What if all methods fail? A: Very unlikely - Method 3 is guaranteed to work.
Q: How do I get full OpenClaw features? A: Hope for Method 1 or 2 success! Check build logs to see what the investigation found.
This is the smartest way to run OpenClaw in Docker! ๐ง ๐ฆ
The system handles all the complexity of Docker compatibility, so you can focus on using your AI assistant!
