124 lines
4.9 KiB
Python
124 lines
4.9 KiB
Python
"""Golden replay cases for PMFlow AI long-context behavior.
|
|
|
|
Cases describe context-retention contracts, not business scene routing rules.
|
|
They are intentionally phrased as evidence expectations so the runner can stay
|
|
generic and avoid keyword or object-type dispatch.
|
|
"""
|
|
|
|
from __future__ import annotations
|
|
|
|
from typing import Any
|
|
|
|
|
|
PMFLOW_AI_CONTEXT_REPLAY_CASES: list[dict[str, Any]] = [
|
|
{
|
|
"case_id": "thread_recall_recent_decision",
|
|
"user_question": "你还记得刚才我定下来的优先级吗?",
|
|
"thread_context_pack": {
|
|
"recent_messages": [
|
|
{
|
|
"message_id": "msg_recall_1",
|
|
"role": "user",
|
|
"message_index": 1,
|
|
"content": "这个项目先做微信小程序版本,后台管理先延后。",
|
|
},
|
|
{
|
|
"message_id": "msg_recall_2",
|
|
"role": "assistant",
|
|
"message_index": 2,
|
|
"content": "已记录:微信小程序版本优先,后台管理延后。",
|
|
},
|
|
],
|
|
"relevant_messages": [],
|
|
"rolling_summary": {
|
|
"durable_points": [
|
|
{"summary": "用户决定微信小程序版本优先,后台管理延后。", "source_message_indexes": [1, 2]},
|
|
]
|
|
},
|
|
},
|
|
"memory_context_pack": {},
|
|
"expected_evidence": ["微信小程序版本优先", "后台管理延后"],
|
|
"forbidden_evidence": ["安卓原生优先"],
|
|
"budget_chars": 9000,
|
|
},
|
|
{
|
|
"case_id": "memory_preference_cross_thread",
|
|
"user_question": "以后给我项目建议时按什么口径收敛?",
|
|
"thread_context_pack": {"recent_messages": [], "relevant_messages": [], "rolling_summary": {}},
|
|
"memory_context_pack": {
|
|
"packet_version": "pmflow_ai_layered_memory_pack.v1",
|
|
"scope_refs": {"user": ["user:7"]},
|
|
"memories": [
|
|
{
|
|
"memory_id": "ctxmem_pref_1",
|
|
"memory_scope": "user",
|
|
"scope_ref": "user:7",
|
|
"summary": "用户偏好先给结论,再给证据和下一步;避免流程表演。",
|
|
"preferences": ["先给结论", "避免流程表演"],
|
|
"confidence_score": 0.88,
|
|
}
|
|
],
|
|
},
|
|
"expected_evidence": ["先给结论", "避免流程表演"],
|
|
"forbidden_evidence": ["默认先问用户确认"],
|
|
"budget_chars": 9000,
|
|
},
|
|
{
|
|
"case_id": "project_scope_does_not_mix",
|
|
"user_question": "这个项目下一步怎么推进?",
|
|
"thread_context_pack": {"recent_messages": [], "relevant_messages": [], "rolling_summary": {}},
|
|
"memory_context_pack": {
|
|
"packet_version": "pmflow_ai_layered_memory_pack.v1",
|
|
"scope_refs": {"project": ["project:101"]},
|
|
"memories": [
|
|
{
|
|
"memory_id": "ctxmem_project_101",
|
|
"memory_scope": "project",
|
|
"scope_ref": "project:101",
|
|
"summary": "项目 101 当前卡点是需求验证样本不足,需要先补访谈。",
|
|
"open_loops": ["补齐 8 个访谈样本"],
|
|
"confidence_score": 0.8,
|
|
}
|
|
],
|
|
},
|
|
"tenant_project_context": {"current_project_id": 101},
|
|
"expected_evidence": ["需求验证样本不足", "补访谈"],
|
|
"forbidden_evidence": ["项目 202"],
|
|
"budget_chars": 9000,
|
|
},
|
|
{
|
|
"case_id": "budget_keeps_thread_before_surface",
|
|
"user_question": "上面我说的那个约束还在吗?",
|
|
"thread_context_pack": {
|
|
"recent_messages": [
|
|
{
|
|
"message_id": f"msg_budget_{index}",
|
|
"role": "user" if index % 2 else "assistant",
|
|
"message_index": index,
|
|
"content": "关键约束:首版必须能导出给外部开发工具的执行包。" if index == 17 else f"普通上下文片段 {index}",
|
|
}
|
|
for index in range(1, 26)
|
|
],
|
|
"relevant_messages": [
|
|
{
|
|
"message_id": "msg_budget_relevant",
|
|
"role": "user",
|
|
"message_index": 17,
|
|
"content": "关键约束:首版必须能导出给外部开发工具的执行包。",
|
|
}
|
|
],
|
|
"rolling_summary": {},
|
|
},
|
|
"memory_context_pack": {},
|
|
"conversation_context": {
|
|
"active_workspace": {"notes": ["这是一段很长的工作区材料。" * 400]},
|
|
},
|
|
"expected_evidence": ["外部开发工具的执行包"],
|
|
"forbidden_evidence": [],
|
|
"budget_chars": 11000,
|
|
},
|
|
]
|
|
|
|
|
|
__all__ = ["PMFLOW_AI_CONTEXT_REPLAY_CASES"]
|