%%{init: {"flowchart": {"wrappingWidth": 680}}}%%
flowchart TB
%% 依据:lpt-ai src/llm/recall.ts recallHintRules 第 2 条(parentId 未定义归属)、
%% normalizeRecallResultInner「提示结构」段的唯一根校验(children.filter(n => n.parentId === null).length === 1);
%% 现象来自 lpt-ai/data/logs.json 的 recall-hint 记录与同一份回忆的本地复跑。
classDef src fill:#ffe1e1,stroke:#c0392b,stroke-width:3.5px,color:#7b1414
classDef api fill:#e8f0fe,stroke:#1a56b0,stroke-width:1.2px,color:#111
classDef take fill:#e7f6ea,stroke:#2e8b57,stroke-width:1.2px,color:#14532d
classDef use fill:#f3f0fb,stroke:#6b4fa0,stroke-width:1.2px,color:#3b2a63
classDef origin fill:#fff3cd,stroke:#b8860b,stroke-dasharray:4 3,color:#664d03
classDef note fill:#f7f7f7,stroke:#999,stroke-dasharray:4 3,color:#333
classDef warn fill:#ffe1e1,stroke:#c0392b,stroke-width:2.2px,color:#7b1414
P["「源」原提示词第 2 条
nodes:[{id,parentId:string|null,text}]
没有说明 parentId 只能引用同一条提示内的节点"]:::origin
P --> M["「用」模型把 1 个 LEAF 节点
挂成导图节点的 parentId
(实测填的是 expression 节点 id)"]:::use
M --> V["「用」校验要求恰好 1 个 parentId=null 的根
该节点不在本条 nodes 内 → 无根 / 父链断裂"]:::use
V --> R["「源」阶段固定为「提示结构」
重生成提示只带阶段名,两次结构检查重复同一形状"]:::warn
EVI["「说明」2026-11-19 09:19–09:23 四条 recall-hint:
attempt 1 finish=length;attempt 2/3 finish=stop 仍失败;
同一输出把 parentId 置 null 后通过校验"]:::note
R -.-> EVI
F1["「变更」已修:recallHintRules 写明
parentId 只在同条 nodes 内引用、顶层必须为 null"]:::take
F2["「变更」已修:提示结构失败附带固定子原因
(如「根节点不是 null」),重生成提示能指名规则"]:::take
F3["「待拍板」未采用:放宽 LEAF 的 parentId
lpt-fe 的 hintRows / bringRecallHelp 依赖唯一根"]:::warn
R -->|"已修"| F1
F1 -->|"同时"| F2
F2 -.->|"对比"| F3
A["「说明」现协议里 anchorNodeId 已经表达「挂在导图哪个节点下」
parentId 只用于一条提示内部的树形关系"]:::note
A -.-> V