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.

Catch person merge variables in any case in inbox sequences

Ethan95b979dbcb7a
diff --git a/harvey/agents/writer.py b/harvey/agents/writer.py
index b2b6591..233c470 100644
--- a/harvey/agents/writer.py
+++ b/harvey/agents/writer.py
@@ -24,7 +24,7 @@ from harvey.state import StateManager
logger = logging.getLogger("harvey.writer")
# Merge variables that name a person; a company inbox has none of them.
-PERSON_VAR = re.compile(r"\{\{\s*(first_name|last_name|title)\s*\}\}")
+PERSON_VAR = re.compile(r"\{\{\s*(first_?name|last_?name|title)\s*\}\}", re.IGNORECASE)
# Native mode: one Claude call per prospect for email 1, so batches stay
# small — the rest of the 'new' pool is picked up on later cycles.
diff --git a/tests/test_company_inbox.py b/tests/test_company_inbox.py
index 6ad265e..2d8559f 100644
--- a/tests/test_company_inbox.py
+++ b/tests/test_company_inbox.py
@@ -279,7 +279,10 @@ def sequence_writer(steps):
return writer
[email protected]("var", ["{{first_name}}", "{{last_name}}", "{{title}}"])
+ "{{first_name}}", "{{last_name}}", "{{title}}",
+ "{{ first_name }}", "{{First_Name}}", "{{firstName}}", "{{Title}}",
+])
@pytest.mark.asyncio
async def test_inbox_sequence_using_a_person_variable_is_rejected(var):
# "as General inbox at Acme" must never be rendered and sent.