Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 21 additions & 0 deletions src/prompts/triage-skill.ts
Original file line number Diff line number Diff line change
Expand Up @@ -74,8 +74,29 @@ const IMPORTANT_NOTES = `
4. Any threatening or angry language triggers negative_sentiment flag
`;


// ============================================
// SME Corrections (auto-generated by Self-Care SME Tool)
// ============================================

const SME_CORRECTIONS = `
## SME Corrections (apply these to the agent's system prompt)

These instructions were authored by domain experts based on real case reviews.

- [cor-1a6c6ac3] Reinforce keyword-matching logic in the triage prompt or add a post-LLM validation step that scans the email body for billing_payment keywords (refund, charge, payment, invoice, subscription) and auto-injects the risk flag if the LLM missed it. When any risk flag is present, override recommended_action to 'escalate'.
Context: Triage agent did not raise billing_payment risk flag despite the email explicitly mentioning 'cancel my subscription'. The system prompt lists 'subscription' as a billing_payment keyword and mandates escalation when any risk flag is present. Instead, the agent returned risk_flags=[] and recommended_action='draft_reply'.
(author: Dragos, since: 2026-02-27)

- [cor-b0cbea96] Add thread-depth analysis to the triage prompt or pre-processor: if the email thread contains 3+ prior messages from the same sender, auto-inject repeat_contact into risk_flags. This would also trigger escalation per the action decision rules.
Context: Triage LLM failed to detect repeat_contact risk flag. The email thread contains clear evidence of multiple prior contacts from the same user (at least 5 emails spanning Feb-Jul 2025), yet risk_flags was returned as an empty array.
(author: D6, since: 2026-02-27)
`;

export const TRIAGE_SYSTEM_PROMPT = `${SYSTEM_ROLE}

${SME_CORRECTIONS}

${CLASSIFICATION_INSTRUCTIONS}

${OUTPUT_FORMAT}
Expand Down