feat(agent): trusted time evidence and collection prompt optimization
- time_context.py: server-side observation clocks for relative-time evidence (anti client-forgery); resolves X分钟前/小时前 against the observation timestamp of the turn that produced them, never re-basing history on the current clock; flags historical references without a reliable baseline - state: dialogue_timestamps keyed by dialogue message index, persisted with checkpoint; welcome seeds index 0 - collect: single clock per turn shared by reply/extraction/repair; time_evidence injected into runtime context; reply_validator hook rejects time claims lacking evidence (one shared repair budget); model still interprets facts and chooses actions - prompts: collection prompt restructured (shorter, state-bound-to-action table, gatekeeper principle, time source rules); extraction prompt aligned; workflow@20261021 json updated to match - evals: prompt_probes / prompt_compare / time_boundary probe scripts (supplementary checks, original cases untouched) - docs: collection-prompt-optimization.md (method + baselines), time-boundary-fix.md (problem, design, verification) - gitignore: editor artifact dirs (.agents/.claude/.vscode, skills-lock) Verified: 171 unit tests pass (16 new time-context tests)
This commit is contained in:
@@ -46,6 +46,9 @@ class AgentState(TypedDict):
|
||||
# 已交换的消息列表 [{"role": "user"/"assistant", "content": str}],
|
||||
# 用于注入提示词,让模型跳过已知信息;可序列化,随 checkpoint 持久化。
|
||||
dialogue: list
|
||||
# 服务器接收用户消息时的时钟,key为完整dialogue的消息索引;
|
||||
# 独立于消息正文,避免客户端伪造历史基准,随checkpoint跨轮保存。
|
||||
dialogue_timestamps: dict[str, str]
|
||||
client_mode: str # direct / browser_addon(LangGraphBackend 注入)
|
||||
|
||||
# ---- 信息核实(作业 5) ----
|
||||
|
||||
Reference in New Issue
Block a user