Matrix intake: frame parse with team roster so a teammate isn't read as the prospect

Local-smoke found "jonathan is chatting with wyoming" extracted the teammate, not
the prospect. Feed the parser an optional team roster (INTAKE_TEAM_ROSTER) via a
build_system(roster) outreach frame: roster names/initials are the people doing
outreach and are never extracted; the other party is the investor/prospect. Same
framing on the revise leg. Unset roster = prior behavior.
This commit is contained in:
Keysat
2026-06-17 21:58:54 -05:00
parent b376b8ce33
commit c1ea1769a4
6 changed files with 106 additions and 12 deletions
+43
View File
@@ -152,6 +152,49 @@ def test_revise_preserves_match_id():
assert revised["intent"] == "meeting_note"
def test_build_system_appends_roster_frame_only_when_roster_given():
base = parse.build_system()
assert base.strip().endswith("Output JSON only.")
assert "doing the outreach" not in base # no roster → no outreach frame
framed = parse.build_system(["Grant", "Jonathan", "Marty"])
assert "Grant" in framed and "Jonathan" in framed and "Marty" in framed
assert "doing the outreach" in framed # the outreach frame is present
assert framed.strip().endswith("Output JSON only.") # JSON-only stays last for recency
def test_parse_message_injects_roster_into_system_prompt():
# Capture the system prompt the model is handed, and confirm the teammate ("jonathan")
# is framed as outreach while the prospect ("wyoming") is what gets extracted.
seen = {}
def cap(text, system=None, max_tokens=400):
seen["system"] = system
return {"intent": "meeting_note", "investor_name": "Wyoming", "contact_name": None,
"note": "jonathan chatting with them"}
p = parse.parse_message("jonathan is chatting with wyoming", parse_fn=cap,
roster=["Grant", "Jonathan", "Marty"])
assert "Jonathan" in seen["system"]
assert "doing the outreach" in seen["system"]
assert p["investor_name"] == "Wyoming"
def test_revise_injects_roster_into_system_prompt():
proposal = {"intent": "meeting_note", "investor_name": "Wyoming", "contact_name": None,
"contact_email": None, "contact_title": None, "note": "x",
"_source_text": "jonathan is chatting with wyoming"}
seen = {}
def cap(prompt, system=None, max_tokens=400):
seen["system"] = system
return {"note": "sent the deck"}
parse.revise(proposal, "note: sent the deck", parse_fn=cap, roster=["Grant", "Jonathan"])
assert "Jonathan" in seen["system"]
assert "doing the outreach" in seen["system"]
def test_revise_cannot_empty_the_proposal():
proposal = {"intent": "new_investor", "investor_name": "Acme", "contact_name": "Jane",
"contact_email": None, "contact_title": None, "note": "x", "_source_text": "Acme Jane"}