Skip to content

feat: 給訪談 bot 共用的 interview briefing(purpose + 累積 context)#27

Open
MakiDevelop wants to merge 1 commit into
mainfrom
feat/interview-briefing-context
Open

feat: 給訪談 bot 共用的 interview briefing(purpose + 累積 context)#27
MakiDevelop wants to merge 1 commit into
mainfrom
feat/interview-briefing-context

Conversation

@MakiDevelop
Copy link
Copy Markdown
Owner

摘要

根因修法。 一場真人 pilot 連續踩了 4 個 bug(#23 EVASION 誤判、#24 resume 把控制訊息當題目、#25 PII 誤 redact、#26 follow-up 咬語氣詞)。四個都是症狀,根因同一個:

每個 LLM call 只拿到「當前問題 + 當前回答」,沒有訪談目的、沒有累積的對話脈絡 —— bot 沒頭沒尾。

修法(Codex + Gemini 雙審設計,Chair 拍板)

新增「共用 interview briefing」層,注入到每個 LLM call:

  • 新模組 briefing.py
    • INTERVIEW_PURPOSE 常數 —— 訪談目的陳述(明示「困惑/懷疑/痛苦是材料,不是迴避」)。
    • build_interview_briefing() —— 每 turn 組裝:purpose + 進度(第幾週)+ durable summary(anchors ≤12 / triples ≤12)+ coverage gaps(≤8)+ 最近逐字(≤8 turns)。純 deterministic,原料全來自既有 DB。
    • InterviewBriefing dataclass + 4 種 render(mode)full / follow_up / classifier / anchor —— 各 LLM call 拿到適量 context。
  • 4 個 LLM call 注入evaluate_depth(classifier mode —— EVASION 誤判的根因修法)、extract_anchors(anchor mode)、_final_reply(full)、generate_follow_up(follow_up)。
  • process_turn 每 turn 組裝一次、傳遍所有下游。
  • 所有 briefing 參數 optional(=None) → 向後相容、零行為改變。

範圍

本 slice = 在既有 pipeline 上加一層共用 context不是重寫成 LLM-driven 訪談、不改 DB schema、不擴張 ontology。

驗證

ruff check src tests   → All checks passed
pytest(全 suite)      → 287 passed(含新 test_briefing.py / test_anchor_extractor.py)
git diff --check        → 乾淨

review chain

設計:Codex + Gemini 雙審收斂 → Chair 拍板。實作:Codex。驗證:Claude 獨立(287 全綠 + briefing.py 逐行 + 整合 diff 逐行)。Gemini 獨立 code review 進行中,結果會補在本 PR comment。

注意

  • 未 merge、未部署。 這是 session 最大的一個 slice,merge + 部署是 Chair 決定,建議休息後再 review。
  • 預期效果:bot 拿到 purpose + 累積脈絡後,不再把真誠回答誤判成迴避、不再咬語氣詞、能接話。

🤖 Generated with Claude Code

根因修法。pilot 連續 4 個 bug(EVASION 誤判 / resume 把控制訊息當題目 /
PII 誤 redact / follow-up 咬語氣詞)的共同根因:每個 LLM call 只拿到
當前問題、沒有訪談目的、沒有累積的對話脈絡 —— bot 沒頭沒尾,不知道
為何問、不知道前面聊過什麼、不知道怎麼接話。

Codex + Gemini 雙審設計、Chair 拍板:
- 新模組 briefing.py:build_interview_briefing 組裝 purpose(訪談目的,
  明示困惑/痛苦是材料不是迴避)+ 進度 + durable summary(anchors/
  triples)+ coverage gaps + 最近逐字
- InterviewBriefing dataclass + 4 種 render mode(full / follow_up /
  classifier / anchor),各 LLM call 拿到適量 context
- process_turn 每 turn 組裝一次,注入 evaluate_depth / extract_anchors /
  _final_reply / generate_follow_up
- 全部 briefing 參數 optional(=None),向後相容、零行為改變

Constraint: 在既有 pipeline 上加 context 層;不重寫成 LLM-driven、
不改 DB schema、不擴張 ontology
Directive: classifier mode 只給 purpose + 近期逐字 — EVASION 誤判的根因
修法;anchor mode 不給完整舊 anchors,避免 confirmation bias

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@MakiDevelop
Copy link
Copy Markdown
Owner Author

Gemini 獨立 code review — 無 blocker

Gemini(Analyst)對 briefing.py 與 4 個注入點做了獨立 review。

結論:無 blocker,可 commit/merge。

6 個檢查點:

  • ✅ Aliasing / 副作用:safe(sections 為局部 list,full mode 傳入的是淺拷貝;修改不影響 frozen dataclass)
  • ✅ 向後相容 + 注入點 mode 映射:correct(briefing=None 各函式皆有 fallback)
  • ✅ Determinism:safe
  • 🔸 Low:_truncate_last_section 理論上若 prefix 本身超過 limit 會溢出 —— 但現有常數下 prefix ~3120 字、遠低於 8000,實務安全。建議 follow-up:未來新增 section 時在 _fit_to_limit 末尾加總長度強制截斷。
  • 🔹 Nitpick:_format_durable_summary f-string 內直接用 anchor.content,前面卻用 getattr 防呆 —— 建議統一。
  • 🔹 _truncate_section 若 target < 12 會略超 —— 現有 target=2000 無實際問題。

review chain 完整:設計 Codex+Gemini 雙審 → Codex 實作 → Claude 獨立驗證(287 全綠 + 逐行)→ Gemini 獨立 review(本則)。

follow-up(非 blocker):_fit_to_limit 末尾加總長度 hard cap、getattr 一致化 —— 可留待後續 polish。

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant