AI Personal CRM Automation: The Contact Context Problem
You have 2,000 contacts scattered across your email, calendar, and LinkedIn profiles. While finding someone's email address takes seconds, recalling the context of your last conversation or what they were working on is a challenge. Details like follow-ups and commitments are lost in emails, meeting notes, or forgotten calendar events.
An AI personal CRM agent solves this by reading your existing data. It scans your inbox and calendar, extracts every contact you've interacted with, enriches these records with relevant context, and stores everything in a local, queryable database. This allows you to ask questions in plain English like “Who did I meet at that conference?” or “What did we discuss last?” and get clear, fact-based answers from your personal data.
This use case is a standout among OpenClaw use cases in productivity, creating a growing asset from your daily communications.
By the end of this tutorial, you'll have a personal CRM that automatically discovers contacts from your email and calendar, generates relationship summaries, and responds to queries naturally. You can preview extraction quality on real email threads using WisGate AI Studio before your initial scan. Visit https://wisgate.ai/studio/image and https://wisgate.ai/hall/tokens to get started.
What the Personal CRM Agent Does
The personal CRM agent operates in three key modes:
| Mode | Trigger | Model | Action |
|---|---|---|---|
| Initial scan | Run once manually | claude-sonnet-4-5 | Full inbox and calendar history scan; extract and enrich contacts |
| Daily sync | Cron, once per day | claude-haiku-4-5-20251001 | Process last 24 hours; update existing contact records |
| Query | On demand | claude-haiku-4-5-20251001 | Answer natural language queries against contact store |
The contact store comes in two formats:
| Format | Best for | Query method |
|---|---|---|
| JSON file | Fewer than 500 contacts; simple | OpenClaw reads full file as query context |
| SQLite | Above 500 contacts; performance | OpenClaw generates SQL from natural language |
Start with JSON for easy setup. As your database grows or your queries slow, migrate to SQLite for faster response and SQL querying.
To run this, you need OpenClaw configured with WisGate models, your IMAP email credentials, calendar API token, and the contact store schema with the supplied prompts in forthcoming sections.
OpenClaw API CRM Automation: Email and Calendar Ingestion Configuration
Before any enrichment, setup email and calendar ingestion.
Email ingestion (IMAP) configuration:
# crm-imap-config.yaml
host: imap.gmail.com
port: 993
ssl: true
username: your@email.com
password: "${EMAIL_APP_PASSWORD}"
fetch_folders: [INBOX, Sent] # Include Sent to capture outbound interactions
fetch_since_days: 365 # Initial scan range: last 12 months
extract_fields: [from, to, cc, subject, date, body_preview]
Including the Sent folder is crucial since outbound emails are the clearest indicator of active relationships you initiate. Inbox-only scans undercount your contacts.
Calendar ingestion configuration:
# crm-calendar-config.yaml
provider: google_calendar # Or use: ical_url for iCal feed
calendar_id: primary
fetch_since_days: 365
extract_fields: [summary, attendees, start_datetime, description]
exclude_solo_events: true # Skip meetings without other attendees
Both sources feed contact interactions into OpenClaw. Email provides communication signals; calendar meetings reveal shared contexts and attendees.
How to Configure OpenClaw with WisGate (Universal Setup — Include Near Top of Article)
Step 1 — Open the configuration file
OpenClaw stores config in your home directory. Open terminal and edit:
nano ~/.openclaw/openclaw.json
Step 2 — Add the WisGate provider to your models section
Copy and paste into the models section to register Sonnet and Haiku:
"models": {
"mode": "merge",
"providers": {
"moonshot": {
"baseUrl": "https://api.wisgate.ai/v1",
"apiKey": "WISGATE-API-KEY",
"api": "openai-completions",
"models": [
{
"id": "claude-sonnet-4-5",
"name": "Claude Sonnet 4.5",
"reasoning": false,
"input": ["text"],
"cost": { "input": 0, "output": 0, "cacheRead": 0, "cacheWrite": 0 },
"contextWindow": 256000,
"maxTokens": 8192
},
{
"id": "claude-haiku-4-5-20251001",
"name": "Claude Haiku 4.5",
"reasoning": false,
"input": ["text"],
"cost": { "input": 0, "output": 0, "cacheRead": 0, "cacheWrite": 0 },
"contextWindow": 256000,
"maxTokens": 8192
}
]
}
}
}
Replace WISGATE-API-KEY with your WisGate API key from https://wisgate.ai/hall/tokens. Confirm current model pricing at https://wisgate.ai/models to calculate your cost.
Step 3 — Save, exit, and restart OpenClaw
- Press
Ctrl + O, thenEnterto save - Press
Ctrl + Xto exit the editor - Restart OpenClaw:
Ctrl + Cto stop, thenopenclaw tuito launch
Step 4 — Validate contact extraction before the initial sync
Run a WisGate API call to test your contact extraction prompt on real email threads before scanning your inbox fully. This avoids costly errors.
Use this curl example replacing placeholders:
curl -s -X POST \
"https://api.wisgate.ai/v1/chat/completions" \
-H "Authorization: Bearer $WISGATE_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"model": "claude-sonnet-4-5",
"messages": [
{"role": "system", "content": "[PASTE CONTACT EXTRACTION SYSTEM PROMPT HERE]"},
{"role": "user", "content": "[PASTE SAMPLE EMAIL THREAD HERE]"}
],
"max_tokens": 512
}' | jq -r '.choices[0].message.content'
Alternatively, test interactively at https://wisgate.ai/studio/image with claude-sonnet-4-5.
LLM Contact Management Agent: Contact Extraction and Enrichment Prompts
Initial scan prompt (Sonnet) for contact extraction:
You are a personal CRM extraction agent.
INPUT: a batch of email threads and/or calendar events.
FOR EACH PERSON YOU IDENTIFY (excluding the account owner):
Extract and return a structured contact record:
{
"name": "full name if available, else email prefix", // string
"email": "primary email address", // string
"organization": "company or affiliation if mentioned", // string
"role": "job title or role if mentioned", // string
"first_contact": "ISO date of earliest interaction", // string
"last_contact": "ISO date of most recent interaction", // string
"interaction_count": N, // number
"relationship_context": "2–3 sentences describing who this person is, what you've discussed, any open items or commitments", // string
"topics": ["tag1", "tag2"], // array of strings
"source": "email" | "calendar" | "both" // string
}
Rules:
- relationship_context must be specific — not generic phrases.
- Only include information explicitly in the interactions; do not infer or hallucinate.
- Merge records if person appears in both email and calendar.
- Return JSON array without preamble.
Daily sync prompt (Haiku) for incremental updates:
You are a personal CRM sync agent.
INPUT: new email threads and calendar events from the last 24 hours, plus existing contact records.
For each contact with new interactions:
- Update last_contact date
- Increment interaction_count
- Append maximum 1 new sentence to relationship_context
- Add any new topic tags found
Return only updated records as a JSON array. No unchanged records or preamble.
Natural Language Query Interface
Your CRM answers queries by combining your full contact store (JSON) or SQLite query result as context for Haiku. It responds in plain English based on the data.
Query system prompt:
You are a personal CRM query assistant.
You have access to the user's contact store provided below.
Answer the user's question only with information present in the contact store.
If the answer is not in the data, say so.
Be specific: include names, dates, and topics where relevant.
Return plain prose — no JSON or bullet points unless asked.
CONTACT STORE:
${CONTACT_STORE_CONTENT}
Example queries include:
- "Who did I meet at a conference in the last six months?"
- "What was the last thing I discussed with [name]?"
- "Which contacts work at [company]?"
- "Who have I not contacted in over 90 days?"
- "Do I have any open commitments to follow up on?"
Pass the full JSON store if under ~200 contacts; otherwise pre-filter to conserve tokens.
OpenClaw Use Cases: Cost Per Contact Enrichment and Daily Sync
Understand your token budget and cost structure.
Initial enrichment (Sonnet) token estimate per contact:
- System prompt: ~400 tokens
- Email/calendar input: ~600 tokens
- JSON output record: ~250 tokens
- Total per contact: ~1,250 tokens
Daily sync (Haiku, example 10 contacts/day):
- Sync system prompt: ~300 tokens
- Input (10 contacts × 400 tokens): ~4,000 tokens
- Output (10 updated records): ~1,500 tokens
- Total per day: ~5,800 tokens
Pricing varies; confirm current rates on https://wisgate.ai/models to calculate exact costs.
| Operation | Model | Volume | WisGate Cost | Direct API Cost |
|---|---|---|---|---|
| Initial enrichment (500 contacts) | claude-sonnet-4-5 | ~625K tokens | Confirm + Calculate | Confirm + Calculate |
| Daily sync (10 contacts/day × 365) | claude-haiku-4-5-20251001 | ~2.1M tokens/yr | Confirm + Calculate | Confirm + Calculate |
| Annual total | Mixed | — | Calculate | Calculate |
Treat initial enrichment as a one-time investment; daily sync defines ongoing budget.
OpenClaw Use Cases: A Contact Database That Builds Itself
With ingestion configured, system prompts prepared, and API validation tested, your personal CRM is ready to launch.
Start by configuring your IMAP and calendar ingestion, then run the initial scan over the last 12 months. Review a handful of extracted contact records for accuracy before enabling the daily sync job. Once running, begin using natural language queries to get insights from your communication history.
The contact store compounds value with every daily sync. Over time, it surfaces deeper and richer relationship context.
The only prerequisites now are your IMAP credentials, calendar API token, and a WisGate API key. All setup artifacts and prompts are provided in this guide.
Visit https://wisgate.ai/hall/tokens to manage API keys and https://wisgate.ai/studio/image to test prompt quality. Enjoy your smarter, automated personal CRM.