Skip to content

feat(recall): send recent turns (prompt + answer) and the session title in the recall context - #92

Draft
forrestlinfeng wants to merge 4 commits into
mainfrom
claude/recall-recent-turns
Draft

forrestlinfeng wants to merge 4 commits into
mainfrom
claude/recall-recent-turns

Conversation

@forrestlinfeng

@forrestlinfeng forrestlinfeng commented Nov 18, 2026 •

Copy link
Copy Markdown
Contributor

What

A recall's context now carries what came before the current prompt:

  • recent_turns: the last three typed turns before this one, oldest first. Each turn is its prompt { role: 'user', text } followed by the answer it ended with { role: 'assistant', text }.
    • Size limits: a prompt keeps 500 characters, an answer keeps its first 800, and the whole field holds at most 4000, in whole turns only.
    • Each message is cleaned and redacted the same way as a prompt (promptTextOf). Commands, and turns nobody typed, are left out.
    • The answer is kept at turn end. For hosts that report it among tool notes instead (Cursor, ZCode), it is taken from the turn's record when the turn settles.
  • title: the host's newest name for the session, up to 120 characters.
    • Claude Code provides it as the last custom-title entry in its transcript. The hooks module now sends transcript_path (from $.session.info()), and the profile reads the last 256 KiB of that file.
    • Other hosts send no title for now.
  • Size limit: the context stays within the Proxy's 16 KiB (the plugin requires Proxy 2.0.50). When it is too large, the oldest turn is dropped whole, prompt with its answer, and only then is the task cut.

Why

A real bad case from a Claude Code session distilling the nexu-io sources:

  • Turn 8 asked "好,总共产生了多少资产,蒸完评估完再汇报" ("OK, how many assets were produced in total? Report after distillation and evaluation are done").
  • The recall sent only that prompt plus the session's first prompt. That first prompt is a background preamble about "distilling Genes and publishing them to the Hub".
  • The Hub returned a Gene about counting an EvoX asset library with inspect_assets, a tool Claude Code does not have. The turn then credited it as reused.
  • The earlier prompts ("汇报一下进展吧", "要,蒸完后评估", i.e. "give me a progress update", "yes, evaluate after distilling") would not have helped.
  • The previous answer would have: "56 sources: 12 published, 114 assets, 113 accepted and 1 quarantined by the Hub". It says the assets are the pipeline's published output.

Hub side (required for any effect)

The Hub currently keeps only task, trigger and language from the context (fetchContextOf). recent_turns and title pass through the .passthrough() schema and are dropped. Until the Hub feeds them to the context-fit judge, or at least records them for evaluation, this change has no effect on ranking. A separate Hub change is needed.

Data

Sending assistant answers sends more of the session to the Hub than sending prompts did: the first 800 characters of each of the last three answers. They are redacted the same way prompts are. This was agreed with the plugin owner for this change.

Tests

  • test/app/recall-context.test.js:
    • prompt then answer per turn, and the first prompt carries none
    • only the last three turns, and a turn with no answer keeps its prompt
    • the title is carried forward to later recalls
    • commands are excluded
    • an answer reported among tool notes is used
  • test/recall.test.js: recentTurnsOf limits, whole turns, redaction, and dropping whole turns under the Proxy limit.
  • test/hosts/claude-code/profile.test.js: the newest custom-title is used, and none is used without one. Checked against a real transcript, it read the title in about 2 ms.
  • Full suite: no failure is new on this branch. The 37 that remain also fail on main here.

🤖 Generated with Claude Code

A recall's context now carries the typed prompts before this turn's, oldest
first, as recent_turns ({ role: 'user', text }; at most 5, 1000 characters
each and 4000 in all, cleaned and redacted like a prompt; commands excluded).
The Hub records them beside the recall for evaluation and does not rank by
them yet, so a follow-up like "and step three?" can be studied with what it
refers to.

The context limit follows the Proxy the plugin requires (2.0.50 keeps up to
16 KiB, not 4096 bytes): the oldest recent turns are dropped first, and only
then is the task cut.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@evomap-aiqa-bot

evomap-aiqa-bot Bot commented Nov 18, 2026 •

Copy link
Copy Markdown

Sentinel 已审核此变更,未发现已核验问题,但发现需要人工确认的风险。

另有 3 个需要人工确认的风险;黄色 advisory 不阻塞合并,建议开发 agent review advisory 评论并逐条确认。

开发 agent 查询详情: 调用 MCP 工具 sentinel_pr_review_context,传入 owner_repo="evomap/evolver-agent-plugin"、pr_number=92、head_sha="da03c1268468f03c251c8f1572203337e8a6ace6",并按条目追加 finding_id 或 finding_key。

由 Sentinel 审核 · 目标提交 da03c1268468

@evomap-aiqa-bot

Copy link
Copy Markdown

Sentinel 保留了 3 个尚未确认的审核候选。这些黄色条目不阻塞合并;红色 P0/P1 与其他独立硬门禁不受影响。 单一猜测、缺少变更行证据或纯 checklist 的候选会统一降为 P3。
开发 agent:请 review 以下 advisory,并逐条给出“已验证无风险 / 已修复 / 转为后续事项”的结论;不要只做整体确认。

  • [P2] 未协商 Proxy 版本便将上下文上限提升至 16 KiB — PR 将发送端限制从 4096 字节直接提高到 16384 字节,但没有在请求前协商或检测 Proxy 版本。�...(truncated) · lib/recall.js · advisory_c73d5cfdfd9bc74b859e885b
  • [P2] 并发提交可能把当前提示误记为自己的历史提示 — promptSubmitted 已持有本次调用的 opened 快照,但 recalled 又异步读取共享 session,并从最新...(truncated) · lib/app/prompt.js · advisory_b5c0133bb44a7baeb920b773
  • [P3] reset/clear 后可能缺少 in-flight completion 防护 — 状态链探针:reset/clear path touches async state but no abort/generation fence is visible for in-flight completion...(truncated) · lib/recall.js · state_chain_5530a58f0e55743f

需要完整证据时,可用行末 finding_key 查询 Sentinel PR review context。

由 Sentinel 审核 · 目标提交 da03c1268468

@forrestlinfeng
forrestlinfeng marked this pull request as draft November 18, 2026 02:22
forrestlinfeng and others added 2 commits November 23, 2026 14:40
…title

A short follow-up such as "how many assets in all?" was recalled with only
the session's first prompt beside it. A Gene for counting an EvoX asset
library was taken for it in a session that counted a distillation
pipeline's output. The prompts before it ("report progress") said as
little.

- recent_turns now holds the last three typed turns, each prompt then the
  answer the turn ended with, as { role: 'user' | 'assistant', text }.
  A prompt keeps 500 characters and an answer its first 800, 4000 in all,
  whole turns only, cleaned and redacted as a prompt is. The answer is
  kept at turn end, or at settle from a host that tells it among its
  tool notes (Cursor, ZCode).
- context.title is the host's newest name for the session. Claude Code
  gives it as the last custom-title in its transcript, which the hooks
  module now names through $.session.info().
- Over the Proxy limit, the oldest turn goes whole, prompt with answer,
  before the task is cut.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@forrestlinfeng forrestlinfeng changed the title feat(recall): send the session's recent prompts as recent_turns feat(recall): send recent turns (prompt + answer) and the session title in the recall context Nov 23, 2026
@evomap-aiqa-bot

evomap-aiqa-bot Bot commented Nov 23, 2026 •

Copy link
Copy Markdown

Sentinel 已审核此变更,未发现已核验问题,但发现需要人工确认的风险。

另有 4 个需要人工确认的风险;黄色 advisory 不阻塞合并,建议开发 agent review advisory 评论并逐条确认。

开发 agent 查询详情: 调用 MCP 工具 sentinel_pr_review_context,传入 owner_repo="evomap/evolver-agent-plugin"、pr_number=92、head_sha="507dd5283bf73e1b566cf09000443a1670bc2f42",并按条目追加 finding_id 或 finding_key。

由 Sentinel 审核 · 目标提交 507dd5283bf7

@evomap-aiqa-bot

Copy link
Copy Markdown

Sentinel 保留了 4 个尚未确认的审核候选。这些黄色条目不阻塞合并;红色 P0/P1 与其他独立硬门禁不受影响。 单一猜测、缺少变更行证据或纯 checklist 的候选会统一降为 P3。
开发 agent:请 review 以下 advisory,并逐条给出“已验证无风险 / 已修复 / 转为后续事项”的结论;不要只做整体确认。

  • [P3] recentTurnsOf 未限制最多三个历史回合 — 函数仅以 4000 个字符作为总量上限,从最新回合开始持续加入;没有“最多三个回合”的计...(truncated) · lib/recall.js · advisory_09b5aa366845cb0e1cf24e25
  • [P3] 并发提示可能使用后一轮的任务、标题和历史上下文 — promptSubmitted 已取得本轮的 opened 快照,但 recalled 没有使用该快照,而是重新执行 ports....(truncated) · ``lib/app/prompt.js`` · advisory_098f415884aa2acc48129996`
  • [P3] 延迟的 turn-end 可将旧答案写入当前新 turn — 本 PR 新增的 closedTurn(sessionOf(stored), turnId, ..., answerTextOf(answer)) 从更新执行时的最新 session ...(truncated) · lib/app/turn-end.js · advisory_76927750a2a5fc803d7497ee
  • [P3] 迟到的无标识结束事件可把旧答案写入新 turn — 本次修改把事件携带的 answer 直接传入 closedTurn 并写入当前 session;expectedTurn 校验仍是...(truncated) · lib/app/turn-end.js · advisory_1a42abbc8524ddc6555df4cd

需要完整证据时,可用行末 finding_key 查询 Sentinel PR review context。

由 Sentinel 审核 · 目标提交 507dd5283bf7

…keeps recent turns

- A turn joined the recent turns only when the next turn was typed. So a task
  notification's turn between two typed turns lost the first typed turn's
  answer, and its own answer was recorded under that turn's prompt. Each turn
  now records whether a person typed it, and a typed turn joins the recent
  turns when the next turn of any kind opens.
- endedSession dropped the recent turns and title. A session ended and resumed
  under the same id then recalled with its task alone. It now keeps both, with
  the last typed turn added.

Found by replaying each host's captured payloads over three turns. Every host
passed before and after the fix; the untyped-turn and resume cases failed
before it.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@evomap-aiqa-bot

evomap-aiqa-bot Bot commented Nov 23, 2026 •

Copy link
Copy Markdown

Sentinel 已审核此变更,未发现已核验问题,但发现需要人工确认的风险。

GitHub CI 未通过。 此状态来自当前 CI gate,不是 Sentinel finding;请以最新 CI attempt 的日志为准。

另有 7 个需要人工确认的风险;黄色 advisory 不阻塞合并,建议开发 agent review advisory 评论并逐条确认。

开发 agent 查询详情: 调用 MCP 工具 sentinel_pr_review_context,传入 owner_repo="evomap/evolver-agent-plugin"、pr_number=92、head_sha="99866df5d9880eba582ba355f94c842b206890d3",并按条目追加 finding_id 或 finding_key。

由 Sentinel 审核 · 目标提交 99866df5d988

@evomap-aiqa-bot

Copy link
Copy Markdown

Sentinel 保留了 7 个尚未确认的审核候选。这些黄色条目不阻塞合并;红色 P0/P1 与其他独立硬门禁不受影响。 单一猜测、缺少变更行证据或纯 checklist 的候选会统一降为 P3。
开发 agent:请 review 以下 advisory,并逐条给出“已验证无风险 / 已修复 / 转为后续事项”的结论;不要只做整体确认。

  • [P2] 16 KiB 上下文会被旧版 Proxy 整体丢弃 — 本 PR 将客户端发送上限从 4096 字节提高到 16384 字节,但没有在构造请求时协商或检测 Proxy ...(truncated) · lib/recall.js · advisory_83ef52ada5fc8b0457e9d472
  • [P2] recentTurnsOf 未落实“最多三个回合”的外发边界 — 新增循环只执行 4000 字符总量限制,没有回合计数限制。四个或更多较短的历史回合会全部...(truncated) · lib/recall.js · advisory_9ea086c96e2831e5b3a1ace5
  • [P2] 无回合标识的迟到 turnEnded 可能把旧答案写入当前回合 — 本 PR 将事件携带的 answer 传给 closeTurn,后者从执行时的当前 session 调用 closedTurn(..., answ...(truncated) · lib/app/turn-end.js·advisory_d5aaf3405a3e3c58b96be478`
  • [P3] 缺失或被清洗的用户提示会留下孤立的助手回答 — messagesOf 独立过滤空消息,而非以整轮为单位过滤;当 turn.prompt 为空而 turn.answer 有内...(truncated) · lib/recall.js · advisory_1b7ff2a8c124cda54e0df9ea
  • [P3] 迟到的 turnEnded 会把旧答案写入新回合 — turnEnded 的 expectedTurn 和 turnId 均可省略;此时 closeTurn 直接对更新执行时的最新 session ...(truncated) · lib/app/turn-end.js · advisory_a470cd77593885f69436b40e
  • [P3] 并发提示可能读取后一轮的任务、标题和历史上下文 — promptSubmitted 已取得本轮 fencedOpen 返回的 opened 快照,但 recalled 不使用该快照,而是异...(truncated) · lib/app/prompt.js · advisory_7e170cb5fe502e220fb769b5
  • [P3] 无 turnId 的结束事件可将旧答案写入当前回合 — 新增的 answer 会在未提供 turnId 时写入任意当前打开回合。若异步结束事件可迟到且其调...(truncated) · lib/session/state.js · advisory_99b59c77627c0349497165b4

需要完整证据时,可用行末 finding_key 查询 Sentinel PR review context。

由 Sentinel 审核 · 目标提交 99866df5d988

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