Skip to content

Autonomous AI sales agent powered by Claude Code or Codex. Finds prospects, writes cold emails, sends campaigns, handles replies, books meetings. No API keys needed — runs on your Claude or Codex subscriptions.

Separate companies from contacts, add feedback and account navigation

Ethan5f823ebbe725
diff --git a/harvey/brain.py b/harvey/brain.py
index 7c1dc6d..a0b8b28 100644
--- a/harvey/brain.py
+++ b/harvey/brain.py
@@ -128,7 +128,7 @@ class Brain:
# product_knowledge and competitive_intel are auto-generated by the trainer
# and loaded by every agent that needs product context
skill_map = {
- "scout": ["prospecting_tactics", "lead_qualification", "product_knowledge"],
+ "scout": ["prospecting_tactics", "lead_qualification", "account_navigation", "product_knowledge"],
"writer": ["email_frameworks", "sales_methodology", "offer_strategy", "product_knowledge", "competitive_intel"],
"handler": ["objection_handling", "sales_methodology", "offer_strategy", "product_knowledge", "competitive_intel"],
"sender": ["email_frameworks", "product_knowledge"],
diff --git a/harvey/dashboard.py b/harvey/dashboard.py
index 26434f2..35b6a44 100644
--- a/harvey/dashboard.py
+++ b/harvey/dashboard.py
@@ -264,6 +264,64 @@ async def test_instantly(request: Request):
return {"success": False, "message": f"Connection failed: {str(e)}"}
+# ── Companies ──
+
+
[email protected]("/api/companies")
+async def get_companies():
+ """All companies with contact counts."""
+ rows = await query_db("""
+ SELECT c.*,
+ (SELECT COUNT(*) FROM prospects p WHERE p.company_id = c.id) as contact_count
+ FROM companies c ORDER BY c.created_at DESC LIMIT 200
+ """)
+ return rows
+
+
[email protected]("/api/companies/{company_id}/contacts")
+async def get_company_contacts(company_id: str):
+ """Get all contacts for a specific company."""
+ rows = await query_db(
+ "SELECT * FROM prospects WHERE company_id = ? ORDER BY score DESC",
+ (company_id,),
+ )
+ return rows
+
+
+# ── Feedback ──
+
+
[email protected]("/api/feedback")
+async def add_feedback(request: Request):
+ """Add a comment/feedback on any entity."""
+ data = await request.json()
+ entity_type = data.get("entity_type", "")
+ entity_id = data.get("entity_id", "")
+ comment = data.get("comment", "")
+ if not comment:
+ return {"success": False, "message": "Comment is required."}
+ feedback_id = _new_id()
+ db_path = str(DB_PATH)
+ if DB_PATH.exists():
+ async with aiosqlite.connect(db_path) as db:
+ await db.execute(
+ "INSERT INTO feedback (id, entity_type, entity_id, comment) VALUES (?, ?, ?, ?)",
+ (feedback_id, entity_type, entity_id, comment),
+ )
+ await db.commit()
+ return {"success": True, "id": feedback_id}
+
+
[email protected]("/api/feedback/{entity_type}/{entity_id}")
+async def get_feedback(entity_type: str, entity_id: str):
+ """Get feedback for an entity."""
+ rows = await query_db(
+ "SELECT * FROM feedback WHERE entity_type = ? AND entity_id = ? ORDER BY created_at DESC",
+ (entity_type, entity_id),
+ )
+ return rows
+
+
# ── Harvey Controls ──
@@ -716,7 +774,8 @@ DASHBOARD_HTML = """<!DOCTYPE html>
<nav>
<button class="active" onclick="showTab('setup', this)">Setup</button>
<button onclick="showTab('overview', this)">Overview</button>
- <button onclick="showTab('prospects', this)">Prospects</button>
+ <button onclick="showTab('companies', this)">Companies</button>
+ <button onclick="showTab('prospects', this)">Contacts</button>
<button onclick="showTab('campaigns', this)">Campaigns</button>
<button onclick="showTab('conversations', this)">Conversations</button>
<button onclick="showTab('activity', this)">Activity</button>
@@ -741,7 +800,12 @@ DASHBOARD_HTML = """<!DOCTYPE html>
<div class="stats-grid" id="stats-grid"></div>
</div>
-<!-- ── Prospects ── -->
+<!-- ── Companies ── -->
+<div id="companies" class="section">
+ <div id="companies-list"></div>
+</div>
+
+<!-- ── Contacts ── -->
<div id="prospects" class="section">
<div id="prospects-table"></div>
</div>
@@ -944,6 +1008,7 @@ function loadCurrentTab() {
switch (currentTab) {
case 'setup': loadSetupStatus(); break;
case 'overview': loadStats(); break;
+ case 'companies': loadCompanies(); break;
case 'prospects': loadProspects(); break;
case 'campaigns': loadCampaigns(); break;
case 'conversations': loadConversations(); break;
@@ -1173,6 +1238,51 @@ async function loadStats() {
<div class="stat-card"><div class="label">Actions Today</div><div class="value">${data.actions_total||0}</div><div class="breakdown">Claude calls today: ${data.claude_calls_today||0}</div></div>`;
}
+async function loadCompanies() {
+ const r = await fetch('/api/companies');
+ const data = await r.json();
+ if (!data.length) {
+ document.getElementById('companies-list').innerHTML = `<div class="empty"><div class="big">No companies yet</div>Harvey hasn't researched any companies yet.</div>`;
+ return;
+ }
+ let html = `<table><thead><tr><th>Company</th><th>Domain</th><th>Industry</th><th>Size</th><th>Location</th><th>Contacts</th><th>Source</th><th>Added</th></tr></thead><tbody>`;
+ for (const c of data) {
+ const website = c.website || (c.domain ? 'https://'+c.domain : '');
+ const nameLink = website ? `<a href="${escHtml(website)}" target="_blank" style="color:#4a9eff">${escHtml(c.name)}</a>` : escHtml(c.name);
+ html += `<tr style="cursor:pointer" onclick="showCompanyContacts('${c.id}', '${escHtml(c.name)}')">
+ <td>${nameLink}</td><td>${escHtml(c.domain)}</td><td>${escHtml(c.industry)}</td><td>${escHtml(c.company_size)}</td><td>${escHtml(c.location)}</td><td>${c.contact_count||0}</td><td>${escHtml(c.source)}</td><td>${formatDate(c.created_at)}</td></tr>`;
+ }
+ document.getElementById('companies-list').innerHTML = html + '</tbody></table>';
+}
+
+async function showCompanyContacts(companyId, companyName) {
+ const r = await fetch('/api/companies/' + companyId + '/contacts');
+ const data = await r.json();
+ let html = `<div class="card" style="margin-bottom:16px"><h2>${escHtml(companyName)} - Contacts</h2><button class="btn btn-secondary btn-sm" onclick="loadCompanies()" style="margin-bottom:16px">Back to Companies</button>`;
+ if (!data.length) {
+ html += '<p style="color:#888">No contacts found at this company.</p></div>';
+ } else {
+ html += '<table><thead><tr><th>Name</th><th>Title</th><th>Email</th><th>Phone</th><th>LinkedIn</th><th>Status</th><th>Source</th></tr></thead><tbody>';
+ for (const p of data) {
+ const emailIcon = p.email_verified ? ' &#10003;' : '';
+ const phoneIcon = p.phone_verified ? ' &#10003;' : '';
+ html += `<tr><td>${escHtml(p.first_name)} ${escHtml(p.last_name)}</td><td>${escHtml(p.title)}</td><td>${escHtml(p.email)}${emailIcon}</td><td>${escHtml(p.phone)}${phoneIcon}</td><td>${p.linkedin_url ? '<a href="'+escHtml(p.linkedin_url)+'" target="_blank" style="color:#4a9eff">Profile</a>' : ''}</td><td>${badge(p.status)}</td><td>${escHtml(p.source)}</td></tr>`;
+ }
+ html += '</tbody></table></div>';
+ }
+ document.getElementById('companies-list').innerHTML = html;
+}
+
+async function addFeedback(entityType, entityId, promptText) {
+ const comment = prompt(promptText || 'Add your feedback:');
+ if (!comment) return;
+ await fetch('/api/feedback', {
+ method: 'POST', headers: {'Content-Type':'application/json'},
+ body: JSON.stringify({entity_type: entityType, entity_id: entityId, comment: comment})
+ });
+ showToast('Feedback saved.', 'success');
+}
+
async function loadProspects() {
const r = await fetch('/api/prospects');
const data = await r.json();
@@ -1180,9 +1290,11 @@ async function loadProspects() {
document.getElementById('prospects-table').innerHTML = `<div class="empty"><div class="big">No prospects yet</div>Harvey hasn't found any prospects yet.</div>`;
return;
}
- let html = `<table><thead><tr><th>Name</th><th>Title</th><th>Company</th><th>Email</th><th>Status</th><th>Score</th><th>Source</th><th>Added</th></tr></thead><tbody>`;
+ let html = `<table><thead><tr><th>Name</th><th>Title</th><th>Company</th><th>Email</th><th>Phone</th><th>Status</th><th>Source</th><th>Added</th><th></th></tr></thead><tbody>`;
for (const p of data) {
- html += `<tr><td>${escHtml(p.first_name)} ${escHtml(p.last_name)}</td><td>${escHtml(p.title)}</td><td>${escHtml(p.company)}</td><td>${escHtml(p.email)}</td><td>${badge(p.status)}</td><td>${p.score||0}</td><td>${escHtml(p.source)}</td><td>${formatDate(p.created_at)}</td></tr>`;
+ const emailV = p.email ? (escHtml(p.email) + (p.email_verified ? ' <span style="color:#40c060">&#10003;</span>' : '')) : '';
+ const phoneV = p.phone ? (escHtml(p.phone) + (p.phone_verified ? ' <span style="color:#40c060">&#10003;</span>' : '')) : '';
+ html += `<tr><td>${escHtml(p.first_name)} ${escHtml(p.last_name)}</td><td>${escHtml(p.title)}</td><td>${escHtml(p.company)}</td><td>${emailV}</td><td>${phoneV}</td><td>${badge(p.status)}</td><td>${escHtml(p.source)}</td><td>${formatDate(p.created_at)}</td><td><button class="btn btn-secondary btn-sm" onclick="addFeedback('contact','${p.id}','Feedback on this contact:')">Feedback</button></td></tr>`;
}
document.getElementById('prospects-table').innerHTML = html + '</tbody></table>';
}
@@ -1201,7 +1313,7 @@ async function loadCampaigns() {
stepsHtml += `<div class="email-step"><div class="step-num">Email ${step.step||'?'}${step.delay_days ? ` &middot; Send after ${step.delay_days} days`:''}</div><div class="subject">${escHtml(step.subject)}</div><div class="body">${escHtml(step.body)}</div></div>`;
}
const pc = (c.prospect_ids||[]).length;
- html += `<div class="campaign-card"><h3>${escHtml(c.name||'Untitled Campaign')}</h3><div class="meta">${badge(c.status)}<span>${c.channel||'email'}</span><span>${pc} prospect${pc!==1?'s':''}</span><span>${formatDate(c.created_at)}</span></div>${stepsHtml||'<div class="empty">No email steps</div>'}</div>`;
+ html += `<div class="campaign-card"><h3>${escHtml(c.name||'Untitled Campaign')}</h3><div class="meta">${badge(c.status)}<span>${c.channel||'email'}</span><span>${pc} prospect${pc!==1?'s':''}</span><span>${formatDate(c.created_at)}</span><button class="btn btn-secondary btn-sm" onclick="event.stopPropagation();addFeedback('campaign','${c.id}','Leave feedback on this campaign:')">Feedback</button></div>${stepsHtml||'<div class="empty">No email steps</div>'}</div>`;
}
document.getElementById('campaigns-list').innerHTML = html;
}
diff --git a/harvey/models/company.py b/harvey/models/company.py
new file mode 100644
index 0000000..1a1f988
--- /dev/null
+++ b/harvey/models/company.py
@@ -0,0 +1,21 @@
+"""Company data model."""
+
+from datetime import datetime
+
+from pydantic import BaseModel, Field
+
+
+class Company(BaseModel):
+ id: str = ""
+ name: str = ""
+ domain: str = ""
+ website: str = ""
+ description: str = ""
+ industry: str = ""
+ company_size: str = ""
+ location: str = ""
+ source: str = "" # how we found them: google_dork, linkedin, company_scrape
+ source_url: str = "" # specific URL where we found the info
+ notes: str = ""
+ created_at: datetime = Field(default_factory=datetime.utcnow)
+ updated_at: datetime = Field(default_factory=datetime.utcnow)
diff --git a/harvey/models/prospect.py b/harvey/models/prospect.py
index 9feca1e..9f6f0f4 100644
--- a/harvey/models/prospect.py
+++ b/harvey/models/prospect.py
@@ -1,4 +1,4 @@
-"""Prospect data model."""
+"""Contact data model — a person at a company."""
from datetime import datetime
@@ -6,21 +6,33 @@ from pydantic import BaseModel, Field
class Prospect(BaseModel):
- id: str
- first_name: str = ""
- last_name: str = ""
+ id: str = ""
+ company_id: str = "" # FK to companies table
+ first_name: str = "" # required for a valid contact
+ last_name: str = "" # required for a valid contact
email: str = ""
+ email_verified: bool = False
+ phone: str = ""
+ phone_verified: bool = False
linkedin_url: str = ""
+ title: str = "" # required for a valid contact
+ seniority: str = "" # c_suite, vp, director, manager, individual
+ department: str = ""
+ source: str = "" # how we found them
+ source_url: str = "" # where we found the info
+ status: str = "new" # new/contacted/replied/meeting/closed/lost
+ score: int = 0
+ personalization_notes: str = ""
+ # legacy fields kept for backwards compat with existing code
company: str = ""
- title: str = ""
industry: str = ""
company_size: str = ""
- source: str = ""
- status: str = "new" # new/contacted/replied/meeting/closed/lost
- score: int = 0
- personalization_notes: str = ""
created_at: datetime = Field(default_factory=datetime.utcnow)
updated_at: datetime = Field(default_factory=datetime.utcnow)
def full_name(self) -> str:
return f"{self.first_name} {self.last_name}".strip()
+
+ def is_valid(self) -> bool:
+ """A contact must have at minimum a name and title."""
+ return bool(self.first_name and self.last_name and self.title)
diff --git a/harvey/state.py b/harvey/state.py
index a8014ba..7c6430a 100644
--- a/harvey/state.py
+++ b/harvey/state.py
@@ -7,6 +7,7 @@ from pathlib import Path
import aiosqlite
+from harvey.models.company import Company
from harvey.models.prospect import Prospect
from harvey.models.campaign import Campaign, EmailStep
from harvey.models.conversation import Conversation, Message
@@ -27,20 +28,43 @@ class StateManager:
Path(self.db_path).parent.mkdir(parents=True, exist_ok=True)
async with aiosqlite.connect(self.db_path) as db:
await db.executescript("""
+ CREATE TABLE IF NOT EXISTS companies (
+ id TEXT PRIMARY KEY,
+ name TEXT DEFAULT '',
+ domain TEXT DEFAULT '',
+ website TEXT DEFAULT '',
+ description TEXT DEFAULT '',
+ industry TEXT DEFAULT '',
+ company_size TEXT DEFAULT '',
+ location TEXT DEFAULT '',
+ source TEXT DEFAULT '',
+ source_url TEXT DEFAULT '',
+ notes TEXT DEFAULT '',
+ created_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP,
+ updated_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP
+ );
+
CREATE TABLE IF NOT EXISTS prospects (
id TEXT PRIMARY KEY,
+ company_id TEXT DEFAULT '' REFERENCES companies(id),
first_name TEXT DEFAULT '',
last_name TEXT DEFAULT '',
email TEXT DEFAULT '',
+ email_verified INTEGER DEFAULT 0,
+ phone TEXT DEFAULT '',
+ phone_verified INTEGER DEFAULT 0,
linkedin_url TEXT DEFAULT '',
- company TEXT DEFAULT '',
title TEXT DEFAULT '',
- industry TEXT DEFAULT '',
- company_size TEXT DEFAULT '',
+ seniority TEXT DEFAULT '',
+ department TEXT DEFAULT '',
source TEXT DEFAULT '',
+ source_url TEXT DEFAULT '',
status TEXT DEFAULT 'new',
score INTEGER DEFAULT 0,
personalization_notes TEXT DEFAULT '',
+ company TEXT DEFAULT '',
+ industry TEXT DEFAULT '',
+ company_size TEXT DEFAULT '',
created_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP,
updated_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP
);
@@ -68,6 +92,14 @@ class StateManager:
updated_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP
);
+ CREATE TABLE IF NOT EXISTS feedback (
+ id TEXT PRIMARY KEY,
+ entity_type TEXT DEFAULT '',
+ entity_id TEXT DEFAULT '',
+ comment TEXT DEFAULT '',
+ created_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP
+ );
+
CREATE TABLE IF NOT EXISTS actions (
id TEXT PRIMARY KEY,
action_type TEXT,
@@ -84,13 +116,79 @@ class StateManager:
created_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP
);
+ CREATE INDEX IF NOT EXISTS idx_companies_domain ON companies(domain);
+ CREATE INDEX IF NOT EXISTS idx_prospects_company_id ON prospects(company_id);
CREATE INDEX IF NOT EXISTS idx_prospects_status ON prospects(status);
CREATE INDEX IF NOT EXISTS idx_campaigns_status ON campaigns(status);
CREATE INDEX IF NOT EXISTS idx_conversations_status ON conversations(status);
+ CREATE INDEX IF NOT EXISTS idx_feedback_entity ON feedback(entity_type, entity_id);
CREATE INDEX IF NOT EXISTS idx_usage_date ON usage_log(date);
""")
- # ── Prospects ──
+ # ── Companies ──
+
+ async def add_company(self, company: Company) -> str:
+ if not company.id:
+ company.id = _new_id()
+ async with aiosqlite.connect(self.db_path) as db:
+ await db.execute(
+ """INSERT OR IGNORE INTO companies
+ (id, name, domain, website, description, industry,
+ company_size, location, source, source_url, notes,
+ created_at, updated_at)
+ VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)""",
+ (
+ company.id, company.name, company.domain, company.website,
+ company.description, company.industry, company.company_size,
+ company.location, company.source, company.source_url,
+ company.notes,
+ company.created_at.isoformat(),
+ company.updated_at.isoformat(),
+ ),
+ )
+ await db.commit()
+ return company.id
+
+ async def get_company(self, company_id: str) -> Company | None:
+ async with aiosqlite.connect(self.db_path) as db:
+ db.row_factory = aiosqlite.Row
+ async with db.execute(
+ "SELECT * FROM companies WHERE id = ?", (company_id,)
+ ) as cursor:
+ row = await cursor.fetchone()
+ if not row:
+ return None
+ return Company(**dict(row))
+
+ async def get_company_by_domain(self, domain: str) -> Company | None:
+ async with aiosqlite.connect(self.db_path) as db:
+ db.row_factory = aiosqlite.Row
+ async with db.execute(
+ "SELECT * FROM companies WHERE domain = ?", (domain,)
+ ) as cursor:
+ row = await cursor.fetchone()
+ if not row:
+ return None
+ return Company(**dict(row))
+
+ async def get_contacts_for_company(self, company_id: str) -> list[Prospect]:
+ async with aiosqlite.connect(self.db_path) as db:
+ db.row_factory = aiosqlite.Row
+ async with db.execute(
+ "SELECT * FROM prospects WHERE company_id = ? ORDER BY score DESC",
+ (company_id,),
+ ) as cursor:
+ rows = await cursor.fetchall()
+ return [Prospect(**dict(r)) for r in rows]
+
+ async def company_exists(self, domain: str) -> bool:
+ async with aiosqlite.connect(self.db_path) as db:
+ async with db.execute(
+ "SELECT 1 FROM companies WHERE domain = ?", (domain,)
+ ) as cursor:
+ return bool(await cursor.fetchone())
+
+ # ── Prospects (Contacts) ──
async def add_prospect(self, prospect: Prospect) -> str:
if not prospect.id:
@@ -98,16 +196,23 @@ class StateManager:
async with aiosqlite.connect(self.db_path) as db:
await db.execute(
"""INSERT OR IGNORE INTO prospects
- (id, first_name, last_name, email, linkedin_url, company,
- title, industry, company_size, source, status, score,
- personalization_notes, created_at, updated_at)
- VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)""",
+ (id, company_id, first_name, last_name, email, email_verified,
+ phone, phone_verified, linkedin_url, title, seniority,
+ department, source, source_url, status, score,
+ personalization_notes, company, industry, company_size,
+ created_at, updated_at)
+ VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)""",
(
- prospect.id, prospect.first_name, prospect.last_name,
- prospect.email, prospect.linkedin_url, prospect.company,
- prospect.title, prospect.industry, prospect.company_size,
- prospect.source, prospect.status, prospect.score,
+ prospect.id, prospect.company_id,
+ prospect.first_name, prospect.last_name,
+ prospect.email, int(prospect.email_verified),
+ prospect.phone, int(prospect.phone_verified),
+ prospect.linkedin_url, prospect.title,
+ prospect.seniority, prospect.department,
+ prospect.source, prospect.source_url,
+ prospect.status, prospect.score,
prospect.personalization_notes,
+ prospect.company, prospect.industry, prospect.company_size,
prospect.created_at.isoformat(),
prospect.updated_at.isoformat(),
),
@@ -124,7 +229,10 @@ class StateManager:
row = await cursor.fetchone()
if not row:
return None
- return Prospect(**dict(row))
+ d = dict(row)
+ d["email_verified"] = bool(d.get("email_verified", 0))
+ d["phone_verified"] = bool(d.get("phone_verified", 0))
+ return Prospect(**d)
async def get_prospects_by_status(self, status: str) -> list[Prospect]:
async with aiosqlite.connect(self.db_path) as db:
@@ -134,7 +242,13 @@ class StateManager:
(status,),
) as cursor:
rows = await cursor.fetchall()
- return [Prospect(**dict(r)) for r in rows]
+ results = []
+ for r in rows:
+ d = dict(r)
+ d["email_verified"] = bool(d.get("email_verified", 0))
+ d["phone_verified"] = bool(d.get("phone_verified", 0))
+ results.append(Prospect(**d))
+ return results
async def update_prospect_status(self, prospect_id: str, status: str):
async with aiosqlite.connect(self.db_path) as db:
@@ -145,7 +259,6 @@ class StateManager:
await db.commit()
async def prospect_exists(self, email: str = "", linkedin_url: str = "") -> bool:
- """Check if a prospect already exists by email or LinkedIn URL."""
async with aiosqlite.connect(self.db_path) as db:
if email:
async with db.execute(
@@ -169,6 +282,44 @@ class StateManager:
rows = await cursor.fetchall()
return {row[0]: row[1] for row in rows}
+ # ── Feedback ──
+
+ async def add_feedback(
+ self, entity_type: str, entity_id: str, comment: str
+ ) -> str:
+ feedback_id = _new_id()
+ async with aiosqlite.connect(self.db_path) as db:
+ await db.execute(
+ """INSERT INTO feedback (id, entity_type, entity_id, comment)
+ VALUES (?, ?, ?, ?)""",
+ (feedback_id, entity_type, entity_id, comment),
+ )
+ await db.commit()
+ return feedback_id
+
+ async def get_feedback(
+ self, entity_type: str, entity_id: str
+ ) -> list[dict]:
+ async with aiosqlite.connect(self.db_path) as db:
+ db.row_factory = aiosqlite.Row
+ async with db.execute(
+ """SELECT * FROM feedback
+ WHERE entity_type = ? AND entity_id = ?
+ ORDER BY created_at DESC""",
+ (entity_type, entity_id),
+ ) as cursor:
+ rows = await cursor.fetchall()
+ return [dict(r) for r in rows]
+
+ async def get_all_feedback(self) -> list[dict]:
+ async with aiosqlite.connect(self.db_path) as db:
+ db.row_factory = aiosqlite.Row
+ async with db.execute(
+ "SELECT * FROM feedback ORDER BY created_at DESC LIMIT 100"
+ ) as cursor:
+ rows = await cursor.fetchall()
+ return [dict(r) for r in rows]
+
# ── Campaigns ──
async def add_campaign(self, campaign: Campaign) -> str:
@@ -293,7 +444,6 @@ class StateManager:
# ── Summary for Decision Making ──
async def get_state_summary(self) -> dict:
- """Get a high-level summary of current state for the decision engine."""
prospect_counts = await self.count_prospects_by_status()
async with aiosqlite.connect(self.db_path) as db:
async with db.execute(
diff --git a/skills/account_navigation.md b/skills/account_navigation.md
new file mode 100644
index 0000000..a01051d
--- /dev/null
+++ b/skills/account_navigation.md
@@ -0,0 +1,108 @@
+# Account Navigation: Working Multiple Contacts at One Company
+
+## Companies vs Contacts
+
+A company is an account. A contact is a person at that company. One company can have many contacts. Harvey must always create the company profile first, then attach contacts to it.
+
+## Company Profiles
+
+Every company Harvey researches must have:
+- **Name**: The actual company name
+- **Domain**: Their website domain (e.g., acme.com)
+- **Website**: Full URL
+- **Description**: What the company does (1-2 sentences)
+- **Industry**: Primary industry
+- **Company size**: Employee range
+- **Location**: HQ city/region
+- **Source**: How Harvey found them (google, linkedin, website scrape)
+- **Source URL**: The exact URL where Harvey found the info
+
+Harvey should pull this from the company's website, LinkedIn company page, or Google results. Do not guess. If you can't verify a field, leave it blank.
+
+## Contact Profiles
+
+Every contact must have at minimum:
+- **First name**: Required. Must be real, verified.
+- **Last name**: Required. Must be real, verified.
+- **Title**: Required. Must be their actual current title.
+- **Company**: Linked to the company profile.
+
+Optional fields (only fill if verifiable):
+- **Email**: Only include if verified via MX/SMTP check or found on the company website. Mark email_verified = true only if confirmed.
+- **Phone**: Very difficult to find. Only include if listed publicly (company website, LinkedIn profile). Mark phone_verified = true only if confirmed. Do NOT guess phone numbers.
+- **LinkedIn URL**: Include if found.
+- **Seniority**: c_suite, vp, director, manager, individual. Infer from title.
+- **Department**: Sales, marketing, engineering, operations, etc. Infer from title.
+
+### Data Quality Rules
+1. Never fabricate contact information. If you can't verify it, don't include it.
+2. Email patterns ([email protected]) are only valid after SMTP verification.
+3. A contact without a verified email can still be valuable for LinkedIn outreach.
+4. Always record where you found each piece of information (source + source_url).
+
+## Who to Contact at a Company
+
+### The Entry Point Matrix
+
+Not all contacts are equal. Who you reach out to first depends on the deal type:
+
+| Deal Type | First Contact | Second Contact | Avoid First |
+|-----------|--------------|----------------|-------------|
+| **Small purchase** (<$500/mo) | End user / manager | Their boss | C-suite (too senior) |
+| **Mid-market** ($500-5k/mo) | Director / VP | Manager who'd use it | Individual contributors |
+| **Enterprise** ($5k+/mo) | VP / C-suite | Champion (manager who'll advocate) | Junior staff |
+
+### Multi-Threading: Working Multiple Contacts
+
+When Harvey finds multiple contacts at one company:
+
+1. **Start with one.** Never email multiple people at the same company simultaneously. It looks spammy and they'll compare notes.
+
+2. **Start at the right level.** Pick the person most likely to:
+ - Feel the pain your product solves
+ - Have authority to evaluate solutions
+ - Actually read and respond to email
+
+3. **Move up or down based on response:**
+ - No response from manager? Try the VP.
+ - VP says "talk to my team"? Email the manager and reference the VP.
+ - Manager is interested? Ask if they'd like to loop in their boss.
+
+4. **Wait between contacts.** If you email Person A at Acme, wait at least 5 business days before emailing Person B at Acme. Treat the company as one account, not individual contacts.
+
+5. **Share context across contacts.** If Person A replied, Harvey should know that when writing to Person B. "Your colleague Sarah mentioned she's evaluating options" is powerful.
+
+### Seniority Detection
+
+Infer seniority from the title:
+
+- **C-Suite**: CEO, CTO, CFO, CMO, COO, CRO, "Chief __"
+- **VP**: VP, Vice President, SVP, EVP, "Head of __"
+- **Director**: Director, Senior Director, "Director of __"
+- **Manager**: Manager, Senior Manager, Team Lead, "Manager of __"
+- **Individual**: Analyst, Specialist, Coordinator, Associate, Engineer
+
+### When to Stop
+
+Stop contacting a company if:
+- 3 different contacts have been emailed with no response
+- Any contact explicitly says "not interested" or "stop emailing"
+- The company doesn't match ICP after further research
+
+## Sample Verification
+
+Before adding prospects to the live pipeline, Harvey should create a sample batch of 5-10 company + contact profiles and present them to the user for review. This ensures:
+
+1. The ICP targeting is correct (right industries, right company sizes)
+2. The contact titles match what the user wants
+3. The data quality meets expectations
+4. The research sources are legitimate
+
+### Sample Flow
+1. Harvey researches 5-10 companies and their contacts
+2. Presents them as a sample: "Here are 8 companies I found. Each has 1-2 contacts. Take a look and let me know if these are the right kind of targets."
+3. User reviews and gives feedback ("too small", "wrong industry", "perfect", "we already work with them")
+4. Harvey adjusts targeting based on feedback
+5. After approval, Harvey proceeds with full prospecting
+
+This sample step only happens once at the start (or when the ICP changes). After the user approves the sample, Harvey prospects autonomously.