Unified Pipeline Prompts

这个 folder 存所有 prompt 全文 + input/output 说明,作为 reviewer 验证的 source。 Phase 1 live 5 份(01/02-old/03/04-old/05)从 callytics-infrastructure 代码同步(已 verified 2026-06-01)。 2026-06-02 用户交付 4 份新版(02 classify 重写 / 04 coaching 重写 / 04b coaching brain 新增 / 05a contact profile 新增 / 06 task decision 新增)— 未接入代码,等接入。 07 task-playbook 来自 2026-06-01 / 06-02 用户全文 — 未接入代码


接入状态(Phase 1 live vs 2026-06-02 用户交付的新版)

../unified-pipeline-final.md 定义 unified pipeline。在 prompt 维度的真实状态:

维度数量 / 列表
纯代码 stage1 — Pre-Triage gate(pre-triage.ts:36 preTriageByRules)
AI prompt surface(当前 live 在代码里)5 — Triage / Classify(老版)/ Verify(conditional)/ Coaching(老版)/ Contact Analyzer(combined,单 prompt 同时输出 contact + taskDecisions[])
2026-06-02 用户交付新版4 — Classify 重写(02 新版)/ Coaching 框架(04 新版)+ Coaching Brain 新增(04b)/ Contact Profile 拆出(05a)/ Task Decision 拆出(06)
Final 接入后总 surface8 个 prompt + 1 个 brain 层 — Triage / Classify(新)/ Verify / Coaching framework / Coaching Brain(read-only) / Contact Profile(新)/ Task Decision(新)/ Task Playbook(read-only)
仍待接入代码7 项(02 新 / 04 新 / 04b / 05a / 06 / 07 task-playbook 都还未上线代码,只有 Contact Analyzer combined 老版仍在跑)

详见 ../../../architecture/2-backend.md Layer 3b before/after 对比图。


全表(8 prompt + 1 brain)

#PromptFileStageWrites to状态
01Triage01-triage.mdPer-call AI pre-routing(决定是否值得继续分析)calls.callState / staffName / staffConfidence✅ Live
02Classify(2026-06-02 重写)02-classify.mdPer-call business classification(新增 topic_type standard vs cancellation 互斥 / revenue_priority / secondary_topics[] 约束)calls 表大量字段(见 calls-schema.md §4)🆕 待接入(覆盖老 CLASSIFY_SYSTEM_PROMPT)
03Verify03-verify.mdConditional verification when subcategory confidence is lowcalls.primarySubcategory(可能 override)✅ Live(conditional)
04Coaching framework(2026-06-02 重写)04-coaching.mdPer-call practical coaching feedback。Domain knowledge 已拆出到 04b braincalls.practicalCoachingScenario / practicalCoachingFeedback(见 coaching-schema.md)🆕 待接入(覆盖老 COACHING_SYSTEM_PROMPT)
04bCoaching Brain / Playbook(2026-06-02 新增)04b-coaching-brain.mdRead-only knowledge layer — 被 04 拼到 user message 当 guardrail。SALES / RETENTION / FREEZE / BILLING / COMPLAINT 6 大 domain 知识不写库,brain 字段绝不进 JSON🆕 全新概念(代码无对应)
05Contact Analyzer(current,combined)05-contact-analyzer-current.mdCross-call contact profile + task decision(老版 single prompt 一起做)contacts 表 + tasks 表✅ Live,待被 05a + 06 取代
05aContact Profile(2026-06-02 拆出)05a-contact-profile.mdCross-call analysis 的画像段 — 拆自老 05。只产 contact profile,不输出 taskDecisionscontacts 表(见 contacts-schema.md)🆕 待接入(跟 06 拼成一个 system prompt 1 次 LLM 调用)
06Task Decision(2026-06-02 拆出)06-task-decision.mdCross-call analysis 的 task 决策段 — 拆自老 05。只产 taskDecisions[](create / close / update,future record_progress),不输出 contact 画像字段Historical proposal:tasks + standalone progress;Target 改为 Timeline / Activity🆕 待接入(跟 05a 拼成一个 system prompt 1 次 LLM 调用)
07Task Playbook07-task-playbook.mdRead-only,Contact Analyzer 之后生成员工话术给 UI Playbook tab不写库(只渲染 UI Playbook tab)🆕 待接入(代码完全无 TASK_PLAYBOOK 符号,需新建 lambda/UI 引用)

Prompt → Schema 配对(reviewer 用)

每个 prompt 的 expected output JSON 字段必须 ∈ 对应 schema 表的字段集合。

Prompt主要写入 schema 文件次要 input schema(只读,不写)
01 Triagecalls-schema.md §2.5(callState / staffName / staffConfidence)
02 Classifycalls-schema.md §2.5(customerType / primaryCategory / primarySubcategory / primaryOutcomeResult / executiveSummary / followUpNeeded / ...)calls.startTime / direction / transcript
03 Verifycalls-schema.md §2.5(可能 override primarySubcategory)calls.transcript + Classify 输出
04 Coaching framework(2026-06-02)coaching-schema.md §2(practicalCoachingScenario / practicalCoachingFeedback;不输出 reviewCategory / reviewReason 占位)calls 完整 transcript + classify 结果 + optional 04b brain
04b Coaching BrainNONE — read-only(本身不接受 input;作为 reference text 拼到 04 user message)
05 Contact Analyzer(current)contacts-schema.md(lifecycleStage / lifecycleState / leadStatus / ...) + tasks-schema.md(taskDecisions[])calls + messages + leads + pending tasks + closed tasks
05a Contact Profile(Final)contacts-schema.md 11 字段calls + messages + leads + tasks
06 Task Decision(Final)tasks-schema.md(taskDecisions[] 写 tasks + task_progress_events)contact profile + open tasks + recent calls/messages
07 Task PlaybookNONE — read-onlySelected task + Contact profile + Recent calls/messages + Classification + Store playbook

已知 prompt ↔ schema misalignment

reviewer 要重点验证的不对齐:

MisalignmentWhereAction
Task Playbook closeGuidance.suggestedCloseResult enum 含 attempted(已 deprecated)+ backend-gated booked / backend-gated cancelled(stale 占位)07-task-playbook.mdPrompt rewriter 把 enum 改成 tasks-schema.md live closeResult 15 values
Contact Analyzer current 单 prompt 同时输出 contact profile + taskDecisions[]05-contact-analyzer-current.mdFinal 拆成 05a Contact Profile + 06 Task Decision(codex §6 定义)
Contact Analyzer prompt 注释说 TASK_CLOSE_RESULT 16 值,但 prompt 内文只列 11 个05-contact-analyzer-current.md Dynamic sectionscallytics-common/src/db/schema/tasks.ts 为准(live 15 值)
Contact Analyzer Task Decision 部分输出 create / close / update,缺 Final 的 create_closed / record_progress / no_op05-contact-analyzer-current.md §taskDecisionsFinal 拆分时 Task Decision prompt 必须支持 6 个 action(per codex §6)
progressType enum 在 current prompt 完全没出现n/a — current 没有 progress 概念V3 不扩大全局 progressType;Target 分别使用 typed ActivityBusiness Progress

源文件位置(reviewer 重跑 verify 用)

# Phase 1 live prompts 在代码里
ls ../../../../../callytics-infrastructure/lambda/ai-analysis-processor/src/core/stages/
# triage.ts / classify.ts / verify.ts / coaching.ts / prompts.ts

ls ../../../../../callytics-infrastructure/lambda/contacts-analyzer/src/core/
# prompt-builder.ts(05 Contact Analyzer)
# leadstatus-guard.ts / lifecycle-guard.ts(code-side guardrails)

# Verify prompts 文件未漂移
grep -l "TRIAGE_SYSTEM_PROMPT\|CLASSIFY_SYSTEM_PROMPT\|COACHING_SYSTEM_PROMPT" \
  ../../../../../callytics-infrastructure/lambda/ai-analysis-processor/src/core/stages/prompts.ts

grep -l "SYSTEM_PROMPT" \
  ../../../../../callytics-infrastructure/lambda/contacts-analyzer/src/core/prompt-builder.ts

# Task Playbook 尚未在代码里
grep -rn "task.playbook\|task_playbook\|TaskPlaybook" \
  ../../../../../callytics-infrastructure/lambda/ 2>&1 | head -5
# 期望: 找不到 — 还没接入

Cross-references