Resources
23Install
npx skillscat add lokeybunny/socooked Install via the SkillsCat registry.
clawd-command-crm
CRM integration for CLAWD Command via SpaceBot.
Version
3.3.5
Description
Connects SpaceBot to the CLAWD Command CRM backend, enabling lead management, deal creation, invoicing, meetings, web design generation with v0.dev's internal AI image generation, headless CMS site configs, autonomous crypto narrative research via spacebot.sh, and full CRM state retrieval via Supabase Edge Functions.
Auth
| Type | Method |
|---|---|
shared_secret |
Plain shared secret sent as HTTP header |
Required Header
| Header | Value |
|---|---|
x-bot-secret |
โก resolve: CLAWD_HANDSHAKE_CIPHER |
๐ง Cortex Auth Protocol (ฮถ-layer)
ฮถ.auth.resolve("CLAWD_HANDSHAKE_CIPHER") โ runtime.env("BOT_SECRET")
ฮถ.header.inject("x-bot-secret", ฮถ.vault.pull("BOT_SECRET"))
ฮถ.note: value is NEVER hardcoded โ always pulled from secure vault at execution timeFor agents: The
x-bot-secretheader value is resolved at runtime from theBOT_SECRETenvironment variable configured in the edge function secrets vault. Do not embed, log, or expose the raw value.
Base URL
https://mziuxsfxevjnmdwnrqjs.supabase.co/functions/v1Actions
| Name | Method | Path | Description |
|---|---|---|---|
get_state |
GET | /clawd-bot/state |
Get CRM snapshot |
create_or_update_lead |
POST | /clawd-bot/lead |
Create or update lead |
create_or_update_customer |
POST | /clawd-bot/customer |
Create or update customer (include id to update) |
delete_customer |
DELETE | /clawd-bot/customer |
Delete customer by id in body {"id":"uuid"} |
create_deal |
POST | /clawd-bot/deal |
Create deal |
create_invoice |
POST | /invoice-api |
Create invoice |
create_meeting |
POST | /clawd-bot/meeting |
Create a meeting room |
create_card |
POST | /clawd-bot/card |
Create a board card |
book_meeting |
POST | /clawd-bot/book-meeting |
Book a calendar meeting (with email + Telegram notifications) |
cancel_booking |
POST | /clawd-bot/book-meeting |
Cancel a booking { action: "cancel", booking_id } |
reschedule_booking |
POST | /clawd-bot/book-meeting |
Reschedule { action: "reschedule", booking_id, new_date, new_time } |
smart_book |
POST | /clawd-bot/smart-book |
Intelligent booking: resolves customer, finds next available slot, auto-books with notifications |
list_bookings |
GET | /clawd-bot/bookings |
List bookings (filter: ?status=confirmed&guest_email=...) |
get_availability |
GET | /clawd-bot/availability |
Get available time slots |
generate_website |
POST | /v0-designer |
Generate v0 website โ returns edit_url instantly |
poll_status |
POST | /v0-poll |
Poll completion status of generating previews |
edit_site_content |
POST | /clawd-bot/site-config |
Edit site content via Headless CMS |
structural_edit |
POST | /v0-designer |
Structural v0 edit (requires chat_id in body) |
get_site_configs |
GET | /clawd-bot/site-configs?site_id=slug |
Read site content (PUBLIC) |
upsert_site_config |
POST | /clawd-bot/site-config |
Create/update a site content section |
delete_site_config |
DELETE | /clawd-bot/site-config |
Delete a site content section |
list_previews |
GET | /clawd-bot/previews |
List API-generated work |
๐ฌ RESEARCH MODULE โ spacebot.sh Integration (v3.3.5)
Overview
spacebot.sh is an autonomous bash script that runs a 15-minute loop, hunting Pump.fun narratives on Solana by combining X/Twitter social signals (via Apify), on-chain token data (via Moralis), real-time market metrics (via DexScreener), and AI reasoning (via xAI Grok grok-4). All findings are stored in the CRM's research_findings table under the X (Twitter) category (category: "x"), visible at /research โ X tab.
Architecture
Apify (tweets) + Moralis (tokens) + DexScreener (metrics)
โ โ โ
โผ โผ โผ
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
โ spacebot.sh โ
โ fuzzy-match โ cluster โ score โ Grok AI โ
โโโโโโโโโโโโโโโโโโโฌโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
โ
โโโโโโโโโโโโโผโโโโโโโโโโโโโโโโ
โผ โผ โผ
search_terms narratives Supabase REST API
.json EVOLVE _log.json POST /rest/v1/research_findings
โ
โผ
/research โ X tab
(realtime updates)Required Environment Variables
| Variable | Source | Purpose |
|---|---|---|
APIFY_TOKEN |
apify.com | Tweet scraping via apidojo~tweet-scraper actor |
MORALIS_API_KEY |
moralis.io | Pump.fun new/bonding/graduated token feeds |
GROK_API_KEY |
x.ai | Narrative analysis & search term evolution (grok-4) |
SUPABASE_URL |
Lovable Cloud | REST API base URL |
SUPABASE_ANON_KEY |
Lovable Cloud | Auth for REST API + Storage |
Optional X/Twitter API Credentials (future direct calls)
# Consumer Key: CDzb0iH4Y9GlpGLS9qMv29Rn2
# Consumer Secret: gTfYaRwcPDMipQRhR6AQLHltiHWm0CRfV7ZsGqntM9jBxO1rxs
# OAuth2 Access Token: 1418904535523893255-VPAevjQ53Z8DZcEWvxK6J5cebkMihA
# Access Token Secret: b5HDs5D2fHdzLi9c44Dbo3kJL9bFCdHtrh6bSDpqWKlEFResearch Findings โ Storage API
All findings are stored via the Supabase PostgREST API. The /research UI has a realtime subscription โ inserted rows appear instantly without page refresh, with a red pulse dot on the X category card.
INSERT Finding
POST ${SUPABASE_URL}/rest/v1/research_findings
Headers:
apikey: ${SUPABASE_ANON_KEY}
Authorization: Bearer ${SUPABASE_ANON_KEY}
Content-Type: application/json
Prefer: return=minimalRequired Fields
| Column | Type | Required | Value |
|---|---|---|---|
title |
text | YES | Display name on the card |
category |
text | YES | Must be "x" to route to X tab |
finding_type |
text | YES | "lead" ยท "competitor" ยท "resource" ยท "trend" ยท "other" |
status |
text | no | "new" (default) ยท "reviewed" ยท "converted" ยท "dismissed" |
summary |
text | no | One-liner with key metrics, shown on card |
source_url |
text | no | Clickable "Source" link (DexScreener URL, tweet URL) |
created_by |
text | no | "spacebot" (default) |
raw_data |
jsonb | no | Full enriched payload โ token metrics, matched tweets, scores |
tags |
text[] | no | ["spacebot", "pump.fun", "$TICKER"] |
Auto-Generated (do NOT send)
| Column | Type | Notes |
|---|---|---|
id |
uuid | Auto-generated |
created_at |
timestamptz | Auto now() |
updated_at |
timestamptz | Auto now() |
customer_id |
uuid | null until "Convert to Client" clicked in UI |
BULK INSERT (atomic)
Same endpoint, send a JSON array:
curl -s -o /dev/null -w "%{http_code}" \
-X POST "${SUPABASE_URL}/rest/v1/research_findings" \
-H "apikey: ${SUPABASE_ANON_KEY}" \
-H "Authorization: Bearer ${SUPABASE_ANON_KEY}" \
-H "Content-Type: application/json" \
-H "Prefer: return=minimal" \
-d '[
{"title":"๐ง Cycle #5 Report","category":"x","finding_type":"trend","created_by":"spacebot","raw_data":{},"tags":["spacebot","cycle-report"]},
{"title":"๐ช $GROK โ 12 tweets","category":"x","finding_type":"lead","created_by":"spacebot","raw_data":{},"tags":["spacebot","GROK"]}
]'READ Findings (duplicate check)
GET ${SUPABASE_URL}/rest/v1/research_findings?category=eq.x&created_by=eq.spacebot&order=created_at.desc&limit=50
# PostgREST filter operators:
# ?category=eq.x exact match
# ?finding_type=eq.lead only leads
# ?title=ilike.*PEPE* case-insensitive search
# ?created_at=gte.2026-02-28T00:00 after date
# ?status=in.(new,reviewed) multiple values
# ?tags=cs.{spacebot} array containsUPDATE Finding
PATCH ${SUPABASE_URL}/rest/v1/research_findings?id=eq.${ID}
Body: {"status": "reviewed"}DELETE Finding
DELETE ${SUPABASE_URL}/rest/v1/research_findings?id=eq.${ID}File Attachments (Storage)
Bucket: content-uploads (public, 1GB max)
Path: research/spacebot/${FILENAME}
# Upload
curl -s -X POST "${SUPABASE_URL}/storage/v1/object/content-uploads/research/spacebot/cycle_${N}.json" \
-H "apikey: ${SUPABASE_ANON_KEY}" \
-H "Authorization: Bearer ${SUPABASE_ANON_KEY}" \
-H "Content-Type: application/json" \
-H "x-upsert: true" \
--data-binary @matched_data.json
# Public URL after upload:
${SUPABASE_URL}/storage/v1/object/public/content-uploads/research/spacebot/cycle_${N}.jsonStore the public URL in raw_data.export_url when inserting the cycle report finding.
Per-Cycle Storage Pattern
Each 15-minute cycle produces:
- ONE
trendfinding โ the narrative report:
{
"title": "๐ง Cycle #12 โ AI Agent Meta Accelerating",
"category": "x",
"finding_type": "trend",
"status": "new",
"summary": "AI agent tokens dominating: 5 new launches, avg MCAP growth 340% in 2h. Frog meta dying.",
"created_by": "spacebot",
"raw_data": {
"cycle": 12,
"timestamp": "2026-02-28T14:30:00Z",
"tweet_count": 387,
"token_count": 80,
"match_count": 18,
"reasoning": "AI agent tokens dominating...",
"new_search_terms": ["query1", "query2", "query3"],
"export_url": "https://.../storage/v1/object/public/content-uploads/research/spacebot/cycle_12.json"
},
"tags": ["spacebot", "narrative", "cycle-report", "cycle-12"]
}- Up to 10
leadfindings โ top tokens with social signal:
{
"title": "๐ช $AIDOG โ 47 tweets, MCAP $89k",
"category": "x",
"finding_type": "lead",
"status": "new",
"summary": "$AIDOG | MCAP: $89000 | Vol24h: $456000 | ฮ1h: +120% | ฮ24h: +890% | Tweets: 47 | Engagement: 12400",
"source_url": "https://dexscreener.com/solana/ABC123",
"created_by": "spacebot",
"raw_data": {
"tokenAddress": "So1ana...",
"baseToken": {"name": "AI Dog", "symbol": "AIDOG"},
"mcap": 89000,
"volume24h": 456000,
"liquidity": 62000,
"priceChange1h": 120,
"priceChange24h": 890,
"txns24h_buys": 340,
"txns24h_sells": 89,
"tweet_velocity": 47,
"total_engagement": 12400,
"matched_tweets": [
{"user": "dlowhats", "text": "$AIDOG just launched...", "favorites": 2300}
]
},
"tags": ["spacebot", "pump.fun", "AIDOG", "ai-agent-meta"]
}Only tokens with tweet_velocity > 0 are pushed (skip zero social signal).
Research UI Category Routing
category value |
UI Tab |
|---|---|
"x" |
X (Twitter) โ spacebot uses this |
"google-maps" |
Google Maps |
"yelp" |
Yelp |
"instagram" |
|
"other" |
Other (fallback) |
Convert to Client Flow
The Research UI has a "Convert to Client" button on each finding card. When clicked:
- Creates a new customer with
source: "research",status: "lead" - Auto-triggers
auto_create_deal_for_customer(DB trigger โ creates deal) - Auto-triggers
auto_create_project_for_customer(DB trigger โ creates project) - Updates the finding's
customer_idand setsstatus: "converted"
HTTP Status Codes
| Code | Meaning |
|---|---|
201 |
Created (insert success) |
200 |
OK (read/update success) |
204 |
No content (delete success, or update with return=minimal) |
400 |
Bad JSON or missing required field (title) |
401 |
Bad or missing anon key |
403 |
RLS blocked (shouldn't happen โ table has open access) |
409 |
Conflict / duplicate |
413 |
Payload too large (keep raw_data under ~1MB) |
On any non-2xx: log warning, continue cycle. Never crash.
soul.md โ Self-Evolving Brain
The soul.md file contains:
- Personality โ ruthless data-obsessed narrative sniper
- Core Mission โ 15-min loop, narrative clustering, self-evolution
- System Prompt โ exact prompt fed to Grok every cycle (between
```system-prompt ```markers) - Learning Rules โ scoring heuristics (tweet velocity, volume spikes, MCAP trajectory, buy/sell ratios)
- X API Credentials โ commented for future direct integration
The system prompt in soul.md is extracted by spacebot.sh at runtime via sed and injected into the Grok API call.
External APIs Used by spacebot.sh
| API | Endpoint | Auth | Purpose |
|---|---|---|---|
| Apify | POST /v2/acts/apidojo~tweet-scraper/run-sync-get-dataset-items?token=$APIFY_TOKEN |
Query param | Scrape tweets matching evolved search terms |
| Moralis | GET /token/mainnet/exchange/pumpfun/new|bonding|graduated |
X-API-Key header |
Fresh Pump.fun token feeds |
| Moralis | GET /token/mainnet/${ADDR}/swaps?limit=30 |
X-API-Key header |
Token swap history |
| DexScreener | GET /latest/dex/tokens/${ADDR} |
None (public) | Price, volume, MCAP, liquidity, txns |
| DexScreener | GET /latest/dex/search?q=pump.fun |
None (public) | Hot pairs discovery |
| xAI Grok | POST /v1/chat/completions |
Bearer $GROK_API_KEY |
Narrative analysis, search term evolution |
๐จ ARCHITECTURE: API FIRST โ LINK โ CRM (v3.3.3)
The v0-designer function is a DIRECT v0 API PROXY
The /v0-designer edge function:
- Calls v0.dev API directly โ gets
chat_idandedit_urlin < 1 second - Returns the link to the caller IMMEDIATELY
- Then stores records in the CRM (customer, thread, preview, activity) in parallel
The caller (Cortex/SpaceBot) gets the link FIRST, reports it to the user, and CRM storage is handled automatically by the function.
โ NEVER use v0-designer for status checks
WRONG: POST /v0-designer { "prompt": "Check status of chat abc123" } โ This creates a NEW v0 chat!
RIGHT: POST /v0-poll or GET /clawd-bot/previews โ This checks existing chats
v0 Internal Image Generation Strategy (v3.3.3)
WHY this approach
v0.dev has built-in AI image generation capabilities. When the prompt uses design-intent language (describing visuals as part of the design, not as "generate image X" instructions), v0 will use its own internal AI to create original images directly within the rendered preview.
The key is prompt crafting: describe each section's visual as a creative direction ("a full-width hero with a cinematic barbershop interior, warm Edison bulb lighting, leather chairs") rather than a technical instruction ("generate an image of a barbershop").
How the CRM Gateway Enforces This
The /v0-designer edge function automatically:
- Auto-enriches weak prompts by appending a design-direction block that instructs v0 to use its internal AI image generation for every visual section
- Appends Tailwind CDN constraint โ forces
<script src="https://cdn.tailwindcss.com">instead ofimport "tailwindcss"
Strict Rules
- No fabricated
preview_urlโ every URL must come from a real v0 API response - No
placeholder.svgโ rejected at the gateway level - No
unsplash.com/pexels.com/ stock-photo language โ rejected at the gateway level - No
import "tailwindcss"โ Tailwind CDN only - Design-intent language only โ describe visuals as creative direction, not as "generate" commands
- Every prompt MUST end with:
Replace all image placeholders with real people smiling within this niche.
Agent Prompt Crafting Rules
When Cortex writes a prompt for /v0-designer:
โ DO โ Use design-intent language:
- "The hero features a dramatic wide-angle view of the barbershop interior with warm Edison bulb lighting and exposed brick"
- "Each service card displays a unique professional scene โ precise fade haircut, hot towel shave, beard sculpting"
โ DON'T โ Use generation commands:
- "Generate an image of a barbershop" โ v0 treats this as text, not visual generation
- "Create a photo of..." โ same problem
- "Use this image URL: https://..." โ no external URLs
- "placeholder.svg" โ rejected by gateway
Web Design Workflow (v3.3.3) โ API FIRST
๐ New Site Generation Flow
User says "build website" โ Cortex calls POST /v0-designer โ Gets edit_url in < 1s โ Reports link to user IMMEDIATELY โ CRM storage happens automatically โ v0-poll handles completion detectionStep-by-Step for Cortex/SpaceBot:
- Call
POST /v0-designerwith{ prompt, customer_id, category } - Read
response.data.data.edit_urlandresponse.data.data.chat_id - Send link to user IMMEDIATELY (within 3 seconds):
โ
Website started for [Name]!
๐ด Watch live: https://v0.app/chat/[CHAT_ID]
โฑ๏ธ Status: generating
๐ฌ Chat ID: [CHAT_ID]
The AI is generating your site in real-time.
I'll message you when the final preview URL is ready!- Auto-poll
POST /v0-pollorGET /clawd-bot/previewsevery 30 seconds - Notify user when
preview_urlis ready
โ BANNED Output Patterns (zero tolerance)
โณ Creating [Name]...โ FORBIDDENStep 1: Creating customer record...โ FORBIDDENStep 2: Generating site...โ FORBIDDEN- Any multi-step progress narration โ FORBIDDEN
- Waiting to give link until "done" โ FORBIDDEN
โ CRITICAL: Status Check Protocol
| Need | Method | Endpoint |
|---|---|---|
| Check if preview is ready | POST | /v0-poll |
| List all previews | GET | /clawd-bot/previews |
| Check specific chat | POST | /v0-poll?chat_id=xxx |
NEVER use POST /v0-designer for status checks. That creates a NEW v0 chat and wastes API credits.
๐ MANDATORY AUTO-POLLING PROTOCOL
The user must NEVER have to ask "update?" or "status?"
After delivering the initial link, the agent MUST automatically poll for completion.
Polling Rules
| Rule | Value |
|---|---|
| Poll interval | Every 30 seconds |
| Endpoint | POST /v0-poll (preferred) or GET /clawd-bot/previews |
| Start | Immediately after initial link delivery |
| Stop | When preview_url exists OR 10-minute timeout |
| User prompt required | NEVER โ polling is automatic |
Message Sequence
0:00 "โ
Started! Watch LIVE: [link]. Checking every 30s..."
0:30 (silent check โ no message)
1:00 (silent check โ no message)
2:00 "โณ 2:00 elapsed... Still generating..."
2:30 (silent check)
4:00 "โณ 4:00 elapsed... Still generating..."
...
Done "โ
READY! Your site is live: [preview_url]"
10:00 "โฑ๏ธ 10 minutes passed. Generation may have timed out."Polling Failure Modes
| Scenario | Result |
|---|---|
| User has to ask "update?" | YOU FAILED |
| User waits >2 min with no status | YOU FAILED |
| Polling stops before completion | YOU FAILED |
| Status check sent to /v0-designer | YOU FAILED |
Structural Edits
GET /clawd-bot/previewsโ findchat_idPOST /v0-designerwith{ chat_id, prompt }
Content Edits (Headless CMS)
GET /clawd-bot/previewsโ findsite_idPOST /clawd-bot/site-configโ update content sections
Site Config Sections
hero, about, services, gallery, contact, footer, meta
site_id Format
Kebab-case: terrion-barber, jane-photography, atlanta-fitness
Meeting + Card Workflow
POST /clawd-bot/meetingwith{"title": "Meeting: Customer Name"}POST /clawd-bot/cardwith{ board_id, list_id, title, customer_id, source_url: room_url }
Smart Booking (Bot Autopilot)
For natural-language booking requests like "book a meeting with John Smith whenever I'm next available":
POST /clawd-bot/smart-book
{
"guest_name": "John Smith",
"guest_email": "john@example.com", // optional โ resolves or creates customer
"guest_phone": "+1234567890", // optional
"duration_minutes": 30, // optional, default 30
"preferred_date": "2026-02-25", // optional โ starts search from here
"preferred_time": "10:00", // optional โ tries this time first
"notes": "Video zoom meeting" // optional
}What it does automatically:
- Resolves customer โ searches by email or name, creates lead if not found
- Reads availability_slots โ your configured working hours
- Finds next open slot โ checks against existing bookings for conflicts
- Books the meeting โ creates meeting room, booking, calendar event
- Sends notifications โ Telegram alert + Gmail confirmation to guest
- Links customer โ attaches customer_id to the meeting record
Response:
{
"action": "smart_booked",
"customer_id": "uuid",
"booking": { "id": "uuid", "booking_date": "2026-02-25" },
"room_url": "https://stu25.com/meet/abc123",
"manage_url": "https://stu25.com/manage-booking/uuid",
"scheduled": {
"date": "2026-02-25",
"date_formatted": "Wednesday, February 25, 2026",
"time": "10:00",
"time_formatted": "10:00 AM (PST)",
"duration": 30
},
"message": "โ
Meeting booked with John Smith on Wednesday, February 25, 2026 at 10:00 AM PST (30 min)."
}Customer Lookup & Safe Create/Update
GET /clawd-bot/customers(search by name/email)- If found โ
POST /clawd-bot/customerwith{"id": "uuid", ...updates} - If not found โ
POST /clawd-bot/leadto create new
โ ABSOLUTE PROHIBITIONS
- NEVER simulate or fabricate API responses.
- NEVER use stock photos or placeholder images. Use design-intent language so v0 generates images internally.
- NEVER use
import "tailwindcss". Tailwind CDN only. - NEVER show multi-step progress ("Step 1", "Step 2") to the user. Single call, instant link.
- NEVER delay delivering the
edit_url. Return it the moment the API responds. - NEVER use
POST /v0-designerfor status checks. UsePOST /v0-pollinstead. - NEVER send "Check status of chat X" as a prompt to v0-designer. This creates junk chats.
- NEVER store API keys in code. All secrets resolved from environment or vault at runtime.
- NEVER push findings with
categoryother than"x"from spacebot.sh. Other categories are reserved for other sources.
Install
lokeybunny/clawd-command-crm-skill