Skip to content

[Feature] Task-level context manager with searchable session pool #19

Description

@zhuqingyv

目标模式执行版

目标:把 Task-level Context Manager 剩余工作收敛为可验证的稳定性硬化,不重做已经存在的 MVP。

当前状态基线

以当前代码为准:

  • 已有 src/agent/context-manager.ts
  • 已有 .context.json / .pool.jsonl / .index.jsonl / .patch.jsonl 侧车文件。
  • 已有 Active Context、pool、search、recall、pin、drop、clear 等能力。
  • 已有 CLI ma ctx ... 和交互命令 /context ...
  • agent 内部 ma ctx / ma say 可自动注入当前 session。

本 issue 剩余目标

让 ContextManager 成为稳定的在线上下文源:

  1. 请求默认来自 ContextManager active context,不是完整历史回放。
  2. user/system 不可变。
  3. tool_call/tool_result 不拆组。
  4. pool 中被压缩/移出的证据可搜索、召回、重新进入 Active Context。
  5. 长对话中 active context 尺寸可控,compact 是 fallback,不是常态。

非目标

执行切片

  1. Request Builder 验证:补测试确认真实 provider request 使用 active context,并保留必要 tail/tool pair。
  2. Current-session search/recall 硬化:确认 agent/CLI 不需要模型手填 sessionId;召回结果保留原始 ID。
  3. Pool 鲁棒性:覆盖损坏 JSONL、无结果、重复 recall、旧 session 迁移。
  4. 长聊指标:增加固定 30-50 轮测试/benchmark,记录 active context 大小、compact 次数、召回成功率。

验收标准

  • 请求构造测试证明默认不回放完整历史。
  • compact/patch 后仍有 user message,且 tool_call/tool_result 不拆组。
  • /context search/context recallma ctx search/recall 在当前 session 下可用。
  • pool 损坏行不会导致 agent 崩溃。
  • 召回内容带原始 ID,并能进入 Active Context。
  • 30-50 轮测试中 active context 尺寸受控,早期关键事实可召回。
  • npm testnpm run build 通过。

与其他 issue 的关系

Activity

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

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions