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
+12 -1
View File
@@ -36,7 +36,12 @@ Spark). See *Fuzzy matching* below. Tests green (27/27 backend + the offline bot
Control** (`spark.py` reuses `backend/ingest/llm.py`; temp 0, JSON only) extracts
`{intent, investor_name, contact_name, contact_email, contact_title, note}`. The original
message text is stashed on the proposal as `_source_text` (needed later for `revise`'s
email-integrity check).
email-integrity check). The system prompt is built by `parse.build_system(roster)`, which —
when a **team roster** is configured (`INTAKE_TEAM_ROSTER`, see *Config*) — appends an
**outreach frame**: those names are our own team members *doing* the outreach, so a teammate's
name is never extracted as the investor/contact and the *other* party is the prospect. Fixes
the live-smoke gripe where *"jonathan is chatting with wyoming"* picked the teammate, not the
prospect. `revise` gets the same framing. Roster unset → prior behavior (no frame).
2. `crm_client.match` (`GET /api/intake/match`) resolves new-vs-existing. It returns **both** an
exact `match` (returns the **grid row id** so an approved note lands on exactly that investor,
no duplicate) **and**, when there's no exact match, a ranked list of fuzzy `candidates` (see
@@ -168,3 +173,9 @@ All in `.env` (names in `.env.example`): `MATRIX_HOMESERVER`, `MATRIX_USER`,
`MATRIX_ACCESS_TOKEN`, `MATRIX_DEVICE_ID`, `MATRIX_INTAKE_ROOM`; `CRM_API_BASE`,
`CRM_BOT_USERNAME`, `CRM_BOT_PASSWORD`, `CRM_API_VERIFY_TLS`. Spark settings are inherited from
the ingest client (`SPARK_CONTROL_URL`, `CRM_CHAT_MODEL`).
- **`INTAKE_TEAM_ROSTER`** (optional, comma-separated) — Ten31 team-member names that frame the
parse (see *Flow* step 1). Use the **first names as actually typed in the room** ("Grant,
Jonathan, …"). Read once at startup by `settings.team_roster()`, so **a roster change needs a
bot restart**. It lives only in the Spark's `.env` (bot-side) — no s9pk change. Empty/unset
disables the framing.