email-agent
Processes incoming emails for Unite-Hub. Extracts sender data, identifies communication intents, links to CRM contacts, analyzes sentiment, and updates contact records with AI insights.
What this skill does
# Email Agent Skill
## Overview
The Email Agent is responsible for:
1. **Processing unprocessed emails** from a workspace
2. **Extracting sender information** and linking to existing contacts
3. **Analyzing email content** for intents and sentiment
4. **Updating CRM contacts** with interaction data
5. **Creating audit logs** for all actions
## How to Use This Agent
### Trigger
User says: "Process emails for Duncan's workspace" or "Analyze unprocessed emails"
### What the Agent Does
#### 1. Fetch Unprocessed Emails
```
Call: convex query emails.getUnprocessed({
orgId: "k57akqzf14r07d9q3pbf9kebvn7v7929",
workspaceId: "kh72b1cng9h88691sx4x7krt2h7v7dehh",
limit: 50
})
```
Returns array of emails not yet processed (`isProcessed: false`)
#### 2. For Each Email
**Step A: Extract Sender Email**
```
From: "[email protected]"
Extract: sender_email = "[email protected]"
```
**Step B: Link to Contact**
```
Call: convex query contacts.getByEmail({
orgId: "k57akqzf14r07d9q3pbf9kebvn7v7929",
workspaceId: "kh72b1cng9h88691sx4x7krt2h7v7dehh",
email: "[email protected]"
})
```
If exists → `contactId = found_contact._id`
If NOT exists → Create new contact with:
- email: sender_email
- name: extracted from email or "Unknown"
- source: "email"
- status: "lead"
**Step C: Analyze Email Content**
Extract these intent keywords:
- "interested" / "partnership" / "collaboration" → intent: **inquiry**
- "proposal" / "quote" / "pricing" → intent: **proposal**
- "issue" / "problem" / "help" → intent: **complaint**
- "?" / "how" / "what" / "when" → intent: **question**
- "follow up" / "re:" → intent: **followup**
- "meeting" / "call" / "sync" / "schedule" → intent: **meeting**
Multiple intents can apply to one email.
**Step D: Analyze Sentiment**
Read email tone:
- Positive indicators: "excited", "love", "great", "thank you", "appreciate"
- Negative indicators: "problem", "issue", "concerned", "unhappy", "urgent"
- Neutral: Standard business tone
Classify as: **positive**, **neutral**, or **negative**
**Step E: Generate Summary**
Create 1-2 sentence summary of email intent:
```
Example: "John from TechStartup is inquiring about Q4 marketing services and partnership opportunities."
```
**Step F: Mark as Processed**
Call: convex mutation emails.markProcessed({
orgId: "k57akqzf14r07d9q3pbf9kebvn7v7929",
emailId: "email_id_from_step_1",
contactId: "contact_id_from_step_b",
intents: ["inquiry", "partnership"],
sentiment: "positive",
summary: "John inquiring about Q4 partnership"
})
**Step G: Update Contact**
If this is a NEW interaction, update:
```
Call: convex mutation contacts.updateAiScore({
orgId: "k57akqzf14r07d9q3pbf9kebvn7v7929",
contactId: "contact_id",
score: 75 // Increase score based on engagement
})
Call: convex mutation contacts.addNote({
orgId: "k57akqzf14r07d9q3pbf9kebvn7v7929",
contactId: "contact_id",
note: "Email from John: Inquiring about Q4 partnership. Sentiment: positive. Intents: inquiry, partnership"
})
```
**Step H: Log Audit Event**
Call: convex mutation system.logAudit({
orgId: "k57akqzf14r07d9q3pbf9kebvn7v7929",
action: "email_processed",
resource: "email",
resourceId: "email_id",
agent: "email-agent",
details: JSON.stringify({
from: "[email protected]",
intents: ["inquiry", "partnership"],
sentiment: "positive",
contactLinked: true
}),
status: "success"
})
### Error Handling
If something fails:
```
Call: convex mutation system.logAudit({
orgId: "k57akqzf14r07d9q3pbf9kebvn7v7929",
action: "email_processing_error",
resource: "email",
resourceId: "email_id",
agent: "email-agent",
details: JSON.stringify({ error: "error message" }),
status: "error",
errorMessage: "description"
})
```
Then continue to next email (don't stop).
## Summary Output
After processing all emails, provide:
```
✅ Email Processing Complete
Total processed: X
Successfully linked: X
New contacts created: X
Intents extracted: X
Average sentiment: X
Contacts engaged:
- John Smith (TechStartup) - positive, inquiry
- Lisa Johnson (eCommerce) - positive, proposal
- Carlos Rodriguez (Agency) - positive, collaboration
Next steps:
1. Review high-priority contacts (positive sentiment + inquiry)
2. Generate followup emails for warm leads
3. Schedule meetings with decision-makers
```
## Key Points
- **Org isolation**: All operations scoped to `orgId`
- **Workspace scope**: Process only emails from target workspace
- **Contact linking**: Always try to link email to existing contact
- **AI scoring**: Increase contact score when they engage (email received)
- **Audit trail**: Log every action for compliance
---
## Example: Processing One Email
**Input Email:**
```
From: [email protected]
Subject: Interested in your services
Body: Hi Duncan, we're looking to revamp our marketing strategy for Q4. Would love to chat about partnership opportunities.
```
**Agent Process:**
1. ✅ Extract sender: `[email protected]`
2. ✅ Query contact: Found "John Smith" in contacts
3. ✅ Extract intents: `["inquiry", "partnership"]`
4. ✅ Analyze sentiment: `"positive"` (enthusiastic tone)
5. ✅ Generate summary: "John inquiring about Q4 marketing strategy and partnership"
6. ✅ Mark email processed with contact link
7. ✅ Increase contact AI score from 68 → 78
8. ✅ Add note with timestamp and details
9. ✅ Log audit event with full context
**Result:**
- Contact updated with fresh interaction data
- Audit trail shows agent processed email
- Contact now appears in "high-value prospects" due to increased score
Related in AI Agents
skill-development
IncludedComprehensive meta-skill for creating, managing, validating, auditing, and distributing Claude Code skills and slash commands (unified in v2.1.3+). Provides skill templates, creation workflows, validation patterns, audit checklists, naming conventions, YAML frontmatter guidance, progressive disclosure examples, and best practices lookup. Use when creating new skills, validating existing skills, auditing skill quality, understanding skill architecture, needing skill templates, learning about YAML frontmatter requirements, progressive disclosure patterns, tool restrictions (allowed-tools), skill composition, skill naming conventions, troubleshooting skill activation issues, creating custom slash commands, configuring command frontmatter, using command arguments ($ARGUMENTS, $1, $2), bash execution in commands, file references in commands, command namespacing, plugin commands, MCP slash commands, Skill tool configuration, or deciding between skills vs slash commands. Delegates to docs-management skill for official documentation.
reprompter
IncludedTransform messy prompts into well-structured, effective prompts — single or multi-agent. Use when: "reprompt", "reprompt this", "clean up this prompt", "structure my prompt", rough text needing XML tags and best practices, "reprompter teams", "repromptception", "run with quality", "smart run", "smart agents", multi-agent tasks, audits, parallel work, anything going to agent teams. Don't use when: simple Q&A, pure chat, immediate execution-only tasks. See "Don't Use When" section for details. Outputs: Structured XML/Markdown prompt, quality score (before/after), optional team brief + per-agent sub-prompts, agent team output files. Success criteria: Single mode quality score ≥ 7/10; Repromptception per-agent prompt quality score 8+/10; all required sections present, actionable and specific.
adaptive-compaction
IncludedAdaptive add-on policy and recovery layer that decides WHEN to compact, prune, snapshot, or fork -- replacing fixed-percent auto-compaction across Claude Code, Codex, and MCP-capable hosts. Trigger on auto-compact timing or damage: "when should I compact", "is it safe to compact now or start a fresh session", "auto-compact fires too early/mid-task", "switching to an unrelated task but the window still has space", "context rot", "answers get worse the longer the session runs", "the agent forgot the plan or my decisions after it summarized", "add a layer on top that manages context without changing the agent", raising autoCompactWindow to give the policy room, or installing/tuning a cross-tool compaction policy or PreCompact hook -- even when "compaction" is never said but the problem is context-window pressure or post-summarization memory loss. Do NOT use to summarize a conversation, build RAG, write a summarization prompt (decides WHEN not HOW), or answer max-context-length trivia.
agent-skill-creator
IncludedCreate cross-platform agent skills from workflow descriptions. Activates when users ask to create an agent, automate a repetitive workflow, create a custom skill, or need advanced agent creation. Triggers on phrases like create agent for, automate workflow, create skill for, every day I have to, daily I need to, turn process into agent, need to automate, create a cross-platform skill, validate this skill, export this skill, migrate this skill. Supports single skills, multi-agent suites, transcript processing, template-based creation, interactive configuration, cross-platform export, and spec validation.
llm-wiki
IncludedUse when building or maintaining a persistent personal knowledge base (second brain) in Obsidian where an LLM incrementally ingests sources, updates entity/concept pages, maintains cross-references, and keeps a synthesis current. Triggers include "second brain", "Obsidian wiki", "personal knowledge management", "ingest this paper/article/book", "build a research wiki", "compound knowledge", "Memex", or whenever the user wants knowledge to accumulate across sessions instead of being re-derived by RAG on every query.
skill-master
IncludedAgent Skills authoring, evaluation, and optimization. Create, edit, validate, benchmark, and improve skills following the agentskills.io specification. Use when designing SKILL.md files, structuring skill folders (references, scripts, assets), ingesting external documentation into skills, running trigger evals, benchmarking skill quality, optimizing descriptions, or performing blind A/B comparisons. Keywords: agentskills.io, SKILL.md, skill authoring, eval, benchmark, trigger optimization.